1- import { Toolbar , SaveButton , SelectInput , SimpleForm , required , useResourceDefinition } from "react-admin" ;
1+ import { AutocompleteInput , required , SaveButton , SimpleForm , Toolbar , useResourceDefinition } from "react-admin" ;
22import DoneIcon from '@mui/icons-material/Done' ;
33import { Component , useEffect } from "react" ;
44import PropTypes from "prop-types" ;
55import CustomQueryEditButton from "../CustomQueryEditor/customQueryEditButton" ;
66
77const MyToolbar = ( ) => (
88 < Toolbar >
9- < SaveButton icon = { < DoneIcon /> } label = "Query" />
9+ < SaveButton icon = { < DoneIcon /> } label = "Query" />
1010 </ Toolbar >
1111) ;
1212
@@ -26,21 +26,29 @@ const TemplatedQueryForm = (props) => {
2626 const resourceDef = useResourceDefinition ( ) ;
2727
2828 useEffect ( ( ) => {
29- if ( submitted ) {
29+ if ( submitted ) {
3030 onSubmit ( searchPar ) ;
3131 }
3232 } , [ submitted ] )
33-
33+
3434 return (
35- < SimpleForm toolbar = { < MyToolbar /> } onSubmit = { onSubmit } >
36- { ! ! resourceDef . options && resourceDef . options . queryGroupId === 'cstm' && < CustomQueryEditButton queryID = { resourceDef . name } /> }
35+ < SimpleForm toolbar = { < MyToolbar /> } onSubmit = { onSubmit } >
36+ { ! ! resourceDef . options && resourceDef . options . queryGroupId === 'cstm' &&
37+ < CustomQueryEditButton queryID = { resourceDef . name } /> }
3738 { Object . entries ( variableOptions ) . map ( ( [ name , options ] ) => (
38- < SelectInput key = { name } source = { name } name = { name } label = { name } validate = { required ( ) } choices = {
39- options . map ( ( option ) => ( {
40- id : option ,
41- name : option
42- } ) )
43- } />
39+ < AutocompleteInput
40+ key = { name }
41+ source = { name }
42+ name = { name }
43+ label = { name }
44+ validate = { required ( ) }
45+ fullWidth = { true }
46+ choices = {
47+ options . map ( ( option ) => ( {
48+ id : option ,
49+ name : option
50+ } ) ) }
51+ />
4452 ) ) }
4553 </ SimpleForm >
4654 ) ;
0 commit comments