From b78827037a97f617ceae9620b8bc1530ffc2c877 Mon Sep 17 00:00:00 2001 From: Jad Date: Wed, 13 Dec 2023 14:57:39 -0800 Subject: [PATCH] Enhancements for filterselect and name filter --- .../shared/filterSelect/FilterSelect.tsx | 43 ++++++------------- epictrack-web/src/styles/theme.tsx | 1 + .../src/utils/MatchingTextHighlight.tsx | 5 ++- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/epictrack-web/src/components/shared/filterSelect/FilterSelect.tsx b/epictrack-web/src/components/shared/filterSelect/FilterSelect.tsx index 029cdc964..cb429114e 100644 --- a/epictrack-web/src/components/shared/filterSelect/FilterSelect.tsx +++ b/epictrack-web/src/components/shared/filterSelect/FilterSelect.tsx @@ -9,21 +9,8 @@ import SingleValue from "./components/SingleValueContainer"; import DropdownIndicator from "./components/DropDownIndicator"; import { MET_Header_Font_Weight_Regular } from "../../../styles/constants"; -// const useStyle = makeStyles({ -// infoSelect: { -// pointerEvents: "auto", -// borderRadius: "4px", -// "& > div:first-child": { -// paddingRight: 0, -// }, -// "&:hover": { -// backgroundColor: Palette.neutral.bg.main, -// }, -// }, -// }); - +const INPUT_SIZE = "0.875rem"; const FilterSelect = (props: SelectProps) => { - // const classes = useStyle(); const { name, isMulti, defaultValue } = props; const standardDefault = isMulti ? [] : ""; const [options, setOptions] = React.useState([]); @@ -92,7 +79,6 @@ const FilterSelect = (props: SelectProps) => { }; const applyFilters = () => { - // header.column.setFilterValue(selectedOptions); if (props.filterAppliedCallback) { props.filterAppliedCallback(selectedOptions); } @@ -117,7 +103,6 @@ const FilterSelect = (props: SelectProps) => { const clearFilters = () => { setSelectedOptions([]); setSelectValue(isMulti ? [] : ""); - // header.column.setFilterValue(isMulti ? [] : ""); if (props.filterClearedCallback) { props.filterClearedCallback(isMulti ? [] : ""); } @@ -139,6 +124,16 @@ const FilterSelect = (props: SelectProps) => { setOptions(filterOptions); }, [props.options]); + const isSearchable = () => { + if (props.isSearchable !== undefined) return props.isSearchable; + + if (selectValue instanceof Array) { + return selectValue.length === 0; + } + + return !selectValue; + }; + return (