import * as React from 'react'; import { useGridApiContext } from '@mui/x-data-grid'; // eslint-disable-next-line no-restricted-imports import { COUNTRY_ISO_OPTIONS } from '@mui/x-data-grid-generator/services/static-data'; import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete'; import Box from '@mui/material/Box'; import InputBase from '@mui/material/InputBase'; import { styled } from '@mui/material/styles'; const Country = React.memo(function Country(props) { const { value } = props; return ( img': { mr: 0.5, flexShrink: 0, width: '20px', }, }} > {value.label} ); }); const StyledAutocomplete = styled(Autocomplete)(({ theme }) => ({ height: '100%', [`& .${autocompleteClasses.inputRoot}`]: { ...theme.typography.body2, padding: '1px 0', height: '100%', '& input': { padding: '0 16px', height: '100%', }, }, })); function EditCountry(props) { const { id, value, field } = props; const apiRef = useGridApiContext(); const handleChange = React.useCallback( async (event, newValue) => { await apiRef.current.setEditCellValue({ id, field, value: newValue }, event); apiRef.current.stopCellEditMode({ id, field }); }, [apiRef, field, id], ); return ( option.label} autoHighlight fullWidth open disableClearable renderOption={(optionProps, option) => ( img': { mr: 1.5, flexShrink: 0, }, }} {...optionProps} key={option.code} > {option.label} )} renderInput={(params) => ( )} /> ); } export function renderCountry(params) { if (params.value == null) { return ''; } return ; } export function renderEditCountry(params) { return ; } export default renderCountry;