import {FieldProps, WidgetProps} from "@rjsf/utils"; import AnyOfField from "@rjsf/core/lib/components/fields/MultiSchemaField"; import {ListSubheader, MenuItem, Select} from "@mui/material"; import {useState} from "react"; import Autocomplete from "@mui/material/Autocomplete"; import TextField from "@mui/material/TextField"; export const UnionEnumWidget = (props: WidgetProps) => { const { options, value, } = props; const [selectedValue, setSelectedValue] = useState(null); if (! selectedValue && value && options.enumOptions) { for (const opt of options.enumOptions){ if (opt.value == value) { setSelectedValue(opt); break; } } } return ( { setSelectedValue(newValue); props.onChange(newValue.value); }} options={options.enumOptions} groupBy={(option) => option.type} getOptionLabel={(option) => option.title} renderInput={(params) => ( )} /> ); }