77 useRef ,
88 useState ,
99} from 'react' ;
10- import Autocomplete , { AutocompleteInputChangeReason } from '@mui/material/Autocomplete' ;
10+ import Autocomplete , {
11+ AutocompleteInputChangeReason ,
12+ } from '@mui/material/Autocomplete' ;
1113import Box from '@mui/material/Box' ;
1214import Checkbox from '@mui/material/Checkbox' ;
1315import Chip from '@mui/material/Chip' ;
@@ -144,13 +146,17 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
144146 ? ( column . getFilterValue ( ) as [ string , string ] ) ?. [
145147 rangeFilterIndex as number
146148 ] || ''
147- : isAutocompleteFilter
148- ? typeof column . getFilterValue ( ) === 'string' ? column . getFilterValue ( ) as string : ''
149- : ( ( column . getFilterValue ( ) as string ) ?? '' ) ,
149+ : isAutocompleteFilter
150+ ? typeof column . getFilterValue ( ) === 'string'
151+ ? ( column . getFilterValue ( ) as string )
152+ : ''
153+ : ( ( column . getFilterValue ( ) as string ) ?? '' ) ,
150154 ) ;
151155 const [ autocompleteValue , setAutocompleteValue ] =
152- useState < DropdownOption | null > (
153- ( ) => isAutocompleteFilter ? ( ( column . getFilterValue ( ) || null ) as DropdownOption | null ) : null ,
156+ useState < DropdownOption | null > ( ( ) =>
157+ isAutocompleteFilter
158+ ? ( ( column . getFilterValue ( ) || null ) as DropdownOption | null )
159+ : null ,
154160 ) ;
155161
156162 const handleChangeDebounced = useCallback (
@@ -187,8 +193,12 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
187193 textFieldProps ?. onChange ?.( event ) ;
188194 } ;
189195
190- const handleAutocompleteInputChange = ( _event : SyntheticEvent , newValue : string , _reason : AutocompleteInputChangeReason ) => {
191- handleChange ( newValue )
196+ const handleAutocompleteInputChange = (
197+ _event : SyntheticEvent ,
198+ newValue : string ,
199+ _reason : AutocompleteInputChangeReason ,
200+ ) => {
201+ handleChange ( newValue ) ;
192202 } ;
193203
194204 const handleAutocompleteChange = ( newValue : DropdownOption | null ) => {
@@ -208,8 +218,8 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
208218 return newFilterValues ;
209219 } ) ;
210220 } else if ( isAutocompleteFilter ) {
211- setAutocompleteValue ( null )
212- setFilterValue ( '' )
221+ setAutocompleteValue ( null ) ;
222+ setFilterValue ( '' ) ;
213223 // when using 'autocomplete' this function is called only inside effect and only if the filterValue === undefined
214224 // so the following call is excessive; should be uncommented if the handleClear becomes part of the Autocomplete component callbacks
215225 // column.setFilterValue(undefined)
@@ -343,8 +353,8 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
343353 ...textFieldProps . slotProps ?. formHelperText ,
344354 } ,
345355 input : endAdornment //hack because mui looks for presence of endAdornment key instead of undefined
346- ? { endAdornment, startAdornment, ...textFieldProps . slotProps ?. input }
347- : { startAdornment, ...textFieldProps . slotProps ?. input } ,
356+ ? { endAdornment, startAdornment, ...textFieldProps . slotProps ?. input }
357+ : { startAdornment, ...textFieldProps . slotProps ?. input } ,
348358 htmlInput : {
349359 'aria-label' : filterPlaceholder ,
350360 autoComplete : 'off' ,
0 commit comments