2222 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323 THE SOFTWARE.
2424*/
25- import React , { ReactNode } from 'react' ;
25+ import React , { ReactNode } from 'react' ;
2626import { EnumCellProps , EnumOption , WithClassname } from '@jsonforms/core' ;
2727
2828import Input from '@material-ui/core/Input' ;
2929import Autocomplete , { AutocompleteRenderOptionState } from '@material-ui/lab/Autocomplete' ;
3030import { areEqual } from '@jsonforms/react' ;
3131import merge from 'lodash/merge' ;
32+ import { FilterOptionsState } from '@material-ui/lab/useAutocomplete' ;
3233
3334export interface WithOptionLabel {
3435 getOptionLabel ?( option : EnumOption ) : string ;
3536 renderOption ?( option : EnumOption , state : AutocompleteRenderOptionState ) : ReactNode ;
37+ filterOptions ?( options : EnumOption [ ] , state : FilterOptionsState < EnumOption > ) : EnumOption [ ] ;
3638}
3739
3840export const MuiAutocomplete = React . memo ( ( props : EnumCellProps & WithClassname & WithOptionLabel ) => {
@@ -47,7 +49,8 @@ export const MuiAutocomplete = React.memo((props: EnumCellProps & WithClassname
4749 options,
4850 config,
4951 getOptionLabel,
50- renderOption
52+ renderOption,
53+ filterOptions
5154 } = props ;
5255 const appliedUiSchemaOptions = merge ( { } , config , uischema . options ) ;
5356 const [ inputValue , setInputValue ] = React . useState ( data ?? '' ) ;
@@ -77,6 +80,7 @@ export const MuiAutocomplete = React.memo((props: EnumCellProps & WithClassname
7780 < Input style = { { width : '100%' } } type = 'text' inputProps = { params . inputProps } inputRef = { params . InputProps . ref } autoFocus = { appliedUiSchemaOptions . focus } />
7881 ) }
7982 renderOption = { renderOption }
83+ filterOptions = { filterOptions }
8084 />
8185 ) ;
8286} , areEqual ) ;
0 commit comments