7
7
useRef ,
8
8
useState ,
9
9
} from 'react' ;
10
- import Autocomplete , { AutocompleteInputChangeReason } from '@mui/material/Autocomplete' ;
10
+ import Autocomplete , {
11
+ AutocompleteInputChangeReason ,
12
+ } from '@mui/material/Autocomplete' ;
11
13
import Box from '@mui/material/Box' ;
12
14
import Checkbox from '@mui/material/Checkbox' ;
13
15
import Chip from '@mui/material/Chip' ;
@@ -144,13 +146,17 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
144
146
? ( column . getFilterValue ( ) as [ string , string ] ) ?. [
145
147
rangeFilterIndex as number
146
148
] || ''
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 ) ?? '' ) ,
150
154
) ;
151
155
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 ,
154
160
) ;
155
161
156
162
const handleChangeDebounced = useCallback (
@@ -187,8 +193,12 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
187
193
textFieldProps ?. onChange ?.( event ) ;
188
194
} ;
189
195
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 ) ;
192
202
} ;
193
203
194
204
const handleAutocompleteChange = ( newValue : DropdownOption | null ) => {
@@ -208,8 +218,8 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
208
218
return newFilterValues ;
209
219
} ) ;
210
220
} else if ( isAutocompleteFilter ) {
211
- setAutocompleteValue ( null )
212
- setFilterValue ( '' )
221
+ setAutocompleteValue ( null ) ;
222
+ setFilterValue ( '' ) ;
213
223
// when using 'autocomplete' this function is called only inside effect and only if the filterValue === undefined
214
224
// so the following call is excessive; should be uncommented if the handleClear becomes part of the Autocomplete component callbacks
215
225
// column.setFilterValue(undefined)
@@ -343,8 +353,8 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
343
353
...textFieldProps . slotProps ?. formHelperText ,
344
354
} ,
345
355
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 } ,
348
358
htmlInput : {
349
359
'aria-label' : filterPlaceholder ,
350
360
autoComplete : 'off' ,
0 commit comments