diff --git a/react-openapi/components/FilterBar.tsx b/react-openapi/components/FilterBar.tsx index 5e1a12d..447a166 100644 --- a/react-openapi/components/FilterBar.tsx +++ b/react-openapi/components/FilterBar.tsx @@ -7,6 +7,7 @@ import { Autocomplete, Typography, } from "@mui/material"; +import DoneIcon from "@mui/icons-material/Done"; import FilterListIcon from "@mui/icons-material/FilterList"; import { ResourceField, ResourceMode } from "../types/config"; @@ -93,15 +94,35 @@ function renderFilterInput( } const selected = Array.isArray(value) ? value : []; + // const sortedOptions = React.useMemo(() => { + // const sel = new Set(selected); + // const picked: string[] = []; + // const rest: string[] = []; + // for (const o of options) { + // if (sel.has(o)) picked.push(o); + // else rest.push(o); + // } + // return [...picked, ...rest]; + // }, [options, selected]); + return ( onChange("value", val.length > 0 ? val : undefined)} + renderOption={(props, option, { selected }) => ( +
  • + {selected ? : } + {option} +
  • + )} renderInput={(params) => } - sx={{ '& .MuiOutlinedInput-root': { height: 'auto', minHeight: '2.5rem', py: 0.5 } }} + sx={{ '& .MuiOutlinedInput-root': { minHeight: '3rem', py: 0.5 } }} /> ); }