@databiosphere/findable-ui 35.2.0 → 36.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/lib/common/entities.d.ts +2 -3
- package/lib/components/DataDictionary/components/Entities/constants.d.ts +3 -1
- package/lib/components/DataDictionary/components/Entities/constants.js +6 -2
- package/lib/components/DataDictionary/components/Entities/entities.js +6 -2
- package/lib/components/DataDictionary/components/Entities/entities.styles.d.ts +3 -0
- package/lib/components/DataDictionary/components/Entities/entities.styles.js +5 -0
- package/lib/components/DataDictionary/components/Entity/entity.styles.js +1 -8
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.d.ts +4 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.js +15 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.styles.d.ts +7 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.styles.js +7 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/constants.d.ts +2 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/constants.js +6 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/types.d.ts +6 -0
- package/lib/components/DataDictionary/components/Filters/filters.js +2 -0
- package/lib/components/DataDictionary/components/Filters/filters.styles.js +3 -3
- package/lib/components/DataDictionary/components/Filters/stories/constants.d.ts +1 -0
- package/lib/components/DataDictionary/components/Filters/stories/constants.js +16 -0
- package/lib/components/DataDictionary/components/Filters/stories/filters.stories.js +11 -3
- package/lib/components/DataDictionary/components/Filters/stories/hook.d.ts +4 -0
- package/lib/components/DataDictionary/components/Filters/stories/hook.js +4 -0
- package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.d.ts +2 -1
- package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.js +4 -4
- package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.js +1 -4
- package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/types.d.ts +4 -2
- package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.d.ts +2 -1
- package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.js +4 -4
- package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.js +4 -1
- package/lib/components/DataDictionary/components/Table/hook.d.ts +2 -2
- package/lib/components/DataDictionary/components/Table/hook.js +8 -4
- package/lib/components/DataDictionary/components/Table/options/columnFilters/constants.js +2 -1
- package/lib/components/DataDictionary/components/Table/options/columnFilters/hook.d.ts +2 -5
- package/lib/components/DataDictionary/components/Table/options/columnFilters/hook.js +8 -6
- package/lib/components/DataDictionary/components/Table/options/globalFilter/constants.d.ts +2 -0
- package/lib/components/DataDictionary/components/Table/options/globalFilter/constants.js +5 -0
- package/lib/components/DataDictionary/components/Table/options/globalFilter/hook.d.ts +3 -0
- package/lib/components/DataDictionary/components/Table/options/globalFilter/hook.js +16 -0
- package/lib/components/DataDictionary/components/Table/options/hook.js +7 -5
- package/lib/components/DataDictionary/components/Table/options/pagination/constants.d.ts +2 -0
- package/lib/components/DataDictionary/components/Table/options/pagination/constants.js +3 -0
- package/lib/components/DataDictionary/dataDictionary.d.ts +1 -1
- package/lib/components/DataDictionary/dataDictionary.js +31 -12
- package/lib/components/DataDictionary/hooks/UseDataDictionaryConfig/hook.d.ts +4 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionaryConfig/hook.js +27 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionaryConfig/types.d.ts +7 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionaryConfig/types.js +1 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionaryConfig/utils.d.ts +6 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionaryConfig/utils.js +8 -0
- package/lib/components/DataDictionary/hooks/UseMeasureFilters/hook.d.ts +2 -0
- package/lib/components/DataDictionary/hooks/UseMeasureFilters/hook.js +17 -0
- package/lib/components/DataDictionary/hooks/UseMeasureFilters/types.d.ts +7 -0
- package/lib/components/DataDictionary/hooks/UseMeasureFilters/types.js +1 -0
- package/lib/components/DataDictionary/types.d.ts +1 -0
- package/lib/components/Filter/components/FilterCountChip/filterCountChip.d.ts +2 -0
- package/lib/components/Filter/components/FilterCountChip/filterCountChip.js +8 -0
- package/lib/components/Filter/components/FilterCountChip/filterCountChip.styles.d.ts +3 -0
- package/lib/components/Filter/components/FilterCountChip/filterCountChip.styles.js +18 -0
- package/lib/components/Filter/components/FilterCountChip/stories/filterCountChip.stories.d.ts +6 -0
- package/lib/components/Filter/components/FilterCountChip/stories/filterCountChip.stories.js +6 -0
- package/lib/components/Filter/components/FilterCountChip/types.d.ts +5 -0
- package/lib/components/Filter/components/FilterCountChip/types.js +1 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +1 -1
- package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
- package/lib/components/Table/columnDef/globalFilter/constants.d.ts +2 -0
- package/lib/components/Table/columnDef/globalFilter/constants.js +4 -0
- package/lib/components/Table/columnDef/globalFilter/filterFn.d.ts +13 -0
- package/lib/components/Table/columnDef/globalFilter/filterFn.js +24 -0
- package/lib/components/Table/columnDef/globalFilter/types.d.ts +4 -0
- package/lib/components/Table/columnDef/globalFilter/types.js +1 -0
- package/lib/components/Table/columnDef/globalFilter/utils.d.ts +23 -0
- package/lib/components/Table/columnDef/globalFilter/utils.js +57 -0
- package/lib/components/Table/components/TableCell/components/RankedCell/rankedCell.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/RankedCell/rankedCell.js +25 -0
- package/lib/components/Table/components/TableCell/components/RankedCell/utils.d.ts +30 -0
- package/lib/components/Table/components/TableCell/components/RankedCell/utils.js +64 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.js +9 -5
- package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.d.ts +9 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.js +20 -1
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/columnFilterTag.d.ts +3 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/columnFilterTag.js +9 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/columnFilterTag.styles.d.ts +5 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/columnFilterTag.styles.js +24 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/constants.d.ts +3 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/constants.js +10 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/stories/columFilterTag.stories.d.ts +6 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/stories/columFilterTag.stories.js +17 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/types.d.ts +6 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/types.js +1 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.d.ts +2 -1
- package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.js +6 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/types.d.ts +3 -2
- package/lib/components/Table/components/TableFeatures/GlobalFilter/constants.d.ts +2 -0
- package/lib/components/Table/components/TableFeatures/GlobalFilter/constants.js +6 -0
- package/lib/components/Table/components/TableFeatures/GlobalFilter/globalFilter.d.ts +3 -0
- package/lib/components/Table/components/TableFeatures/GlobalFilter/globalFilter.js +10 -0
- package/lib/components/Table/components/TableFeatures/GlobalFilter/types.d.ts +6 -0
- package/lib/components/Table/components/TableFeatures/GlobalFilter/types.js +1 -0
- package/lib/components/Table/coreOptions/state/pagination/constants.d.ts +2 -0
- package/lib/components/Table/coreOptions/state/pagination/constants.js +6 -0
- package/lib/components/Table/coreOptions/state/pagination/utils.d.ts +9 -0
- package/lib/components/Table/coreOptions/state/pagination/utils.js +18 -0
- package/lib/components/common/AnchorLink/anchorLink.js +4 -2
- package/lib/components/common/AnchorLink/anchorLink.styles.d.ts +1 -1
- package/lib/components/common/AnchorLink/anchorLink.styles.js +1 -1
- package/lib/components/common/CustomIcon/components/SearchIcon/searchIcon.d.ts +2 -2
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment.d.ts +2 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment.js +13 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment.styles.d.ts +5 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment.styles.js +11 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/constants.d.ts +3 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/constants.js +10 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/types.d.ts +4 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/types.js +1 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/constants.d.ts +2 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/constants.js +5 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/searchInputAdornment.d.ts +1 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/searchInputAdornment.js +9 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/constants.d.ts +2 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/components/constants.js +5 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/inputAdornment.styles.d.ts +5 -0
- package/lib/components/common/OutlinedInput/components/InputAdornment/inputAdornment.styles.js +5 -0
- package/lib/components/common/OutlinedInput/outlinedInput.styles.d.ts +7 -0
- package/lib/components/common/OutlinedInput/outlinedInput.styles.js +18 -0
- package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.js +2 -2
- package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.js +3 -3
- package/lib/hooks/stateSyncManager/types.d.ts +1 -1
- package/lib/providers/dataDictionary/context.d.ts +2 -0
- package/lib/providers/dataDictionary/context.js +4 -0
- package/lib/providers/dataDictionary/hook.d.ts +6 -0
- package/lib/providers/dataDictionary/hook.js +9 -0
- package/lib/providers/dataDictionary/types.d.ts +3 -0
- package/lib/providers/dataDictionary/types.js +1 -0
- package/lib/providers/dataDictionaryState/actions/clearMeta/action.d.ts +9 -0
- package/lib/providers/dataDictionaryState/actions/clearMeta/action.js +12 -0
- package/lib/providers/dataDictionaryState/actions/clearMeta/dispatch.d.ts +6 -0
- package/lib/providers/dataDictionaryState/actions/clearMeta/dispatch.js +11 -0
- package/lib/providers/dataDictionaryState/actions/clearMeta/types.d.ts +6 -0
- package/lib/providers/dataDictionaryState/actions/clearMeta/types.js +1 -0
- package/lib/providers/dataDictionaryState/actions/stateToUrl/action.d.ts +9 -0
- package/lib/providers/dataDictionaryState/actions/stateToUrl/action.js +14 -0
- package/lib/providers/dataDictionaryState/actions/stateToUrl/dispatch.d.ts +7 -0
- package/lib/providers/dataDictionaryState/actions/stateToUrl/dispatch.js +12 -0
- package/lib/providers/dataDictionaryState/actions/stateToUrl/types.d.ts +12 -0
- package/lib/providers/dataDictionaryState/actions/stateToUrl/types.js +5 -0
- package/lib/providers/dataDictionaryState/actions/types.d.ts +13 -0
- package/lib/providers/dataDictionaryState/actions/types.js +8 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/action.d.ts +9 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/action.js +18 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/dispatch.d.ts +7 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/dispatch.js +12 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/types.d.ts +10 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/types.js +1 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/utils.d.ts +11 -0
- package/lib/providers/dataDictionaryState/actions/updateColumnFilters/utils.js +27 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/action.d.ts +9 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/action.js +19 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/dispatch.d.ts +7 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/dispatch.js +12 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/types.d.ts +10 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/types.js +1 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/utils.d.ts +17 -0
- package/lib/providers/dataDictionaryState/actions/updateGlobalFilter/utils.js +36 -0
- package/lib/providers/dataDictionaryState/actions/urlToState/action.d.ts +9 -0
- package/lib/providers/dataDictionaryState/actions/urlToState/action.js +20 -0
- package/lib/providers/dataDictionaryState/actions/urlToState/dispatch.d.ts +7 -0
- package/lib/providers/dataDictionaryState/actions/urlToState/dispatch.js +12 -0
- package/lib/providers/dataDictionaryState/actions/urlToState/types.d.ts +9 -0
- package/lib/providers/dataDictionaryState/actions/urlToState/types.js +1 -0
- package/lib/providers/dataDictionaryState/context.d.ts +2 -0
- package/lib/providers/dataDictionaryState/context.js +6 -0
- package/lib/providers/dataDictionaryState/dictionaries/constants.d.ts +4 -0
- package/lib/providers/dataDictionaryState/dictionaries/constants.js +4 -0
- package/lib/providers/dataDictionaryState/dictionaries/state.d.ts +11 -0
- package/lib/providers/dataDictionaryState/dictionaries/state.js +29 -0
- package/lib/providers/dataDictionaryState/dictionaries/types.d.ts +9 -0
- package/lib/providers/dataDictionaryState/dictionaries/types.js +1 -0
- package/lib/providers/dataDictionaryState/dictionaries/utils.d.ts +14 -0
- package/lib/providers/dataDictionaryState/dictionaries/utils.js +20 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryInitialArgs/hook.d.ts +2 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryInitialArgs/hook.js +6 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryInitialArgs/types.d.ts +4 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryInitialArgs/types.js +1 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryReducer/hook.d.ts +2 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryReducer/hook.js +9 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryState/hook.d.ts +6 -0
- package/lib/providers/dataDictionaryState/hooks/UseDataDictionaryState/hook.js +9 -0
- package/lib/providers/dataDictionaryState/initializer/constants.d.ts +2 -0
- package/lib/providers/dataDictionaryState/initializer/constants.js +4 -0
- package/lib/providers/dataDictionaryState/initializer/initializer.d.ts +9 -0
- package/lib/providers/dataDictionaryState/initializer/initializer.js +17 -0
- package/lib/providers/dataDictionaryState/initializer/utils.d.ts +8 -0
- package/lib/providers/dataDictionaryState/initializer/utils.js +29 -0
- package/lib/providers/dataDictionaryState/provider.d.ts +4 -0
- package/lib/providers/dataDictionaryState/provider.js +7 -0
- package/lib/providers/dataDictionaryState/reducer.d.ts +9 -0
- package/lib/providers/dataDictionaryState/reducer.js +34 -0
- package/lib/providers/dataDictionaryState/types.d.ts +15 -0
- package/lib/providers/dataDictionaryState/types.js +1 -0
- package/lib/styles/common/mui/iconButton.d.ts +11 -0
- package/lib/styles/common/mui/iconButton.js +29 -0
- package/lib/styles/common/mui/inputAdornment.d.ts +9 -0
- package/lib/styles/common/mui/inputAdornment.js +13 -0
- package/lib/styles/common/mui/outlinedInput.d.ts +7 -0
- package/lib/styles/common/mui/outlinedInput.js +7 -0
- package/lib/theme/common/components.js +122 -16
- package/lib/theme/components/muiButtonGroup.js +4 -0
- package/lib/theme/components/muiTableCell.js +6 -0
- package/lib/utils/parseJsonQueryParam.d.ts +14 -0
- package/lib/utils/parseJsonQueryParam.js +25 -0
- package/lib/utils/stateToUrlQuery.d.ts +15 -0
- package/lib/utils/stateToUrlQuery.js +35 -0
- package/lib/views/DataDictionaryView/dataDictionaryView.d.ts +2 -2
- package/lib/views/DataDictionaryView/dataDictionaryView.js +16 -2
- package/lib/views/DataDictionaryView/types.d.ts +4 -0
- package/lib/views/DataDictionaryView/types.js +1 -0
- package/lib/views/DataDictionaryView/utils.d.ts +12 -0
- package/lib/views/DataDictionaryView/utils.js +17 -0
- package/lib/views/ExploreView/utils.d.ts +1 -1
- package/lib/views/ExploreView/utils.js +1 -1
- package/package.json +2 -1
- package/src/common/entities.ts +2 -3
- package/src/components/DataDictionary/components/Entities/constants.ts +9 -3
- package/src/components/DataDictionary/components/Entities/entities.styles.ts +6 -0
- package/src/components/DataDictionary/components/Entities/entities.tsx +7 -2
- package/src/components/DataDictionary/components/Entity/entity.styles.ts +1 -10
- package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.styles.ts +8 -0
- package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.tsx +33 -0
- package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/constants.ts +8 -0
- package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/types.ts +8 -0
- package/src/components/DataDictionary/components/Filters/filters.styles.ts +3 -3
- package/src/components/DataDictionary/components/Filters/filters.tsx +2 -0
- package/src/components/DataDictionary/components/Filters/stories/constants.ts +18 -0
- package/src/components/DataDictionary/components/Filters/stories/filters.stories.tsx +15 -3
- package/src/components/DataDictionary/components/Filters/stories/hook.ts +8 -0
- package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.ts +1 -5
- package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.tsx +13 -7
- package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/types.ts +4 -2
- package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.ts +4 -1
- package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.tsx +13 -7
- package/src/components/DataDictionary/components/Table/hook.ts +10 -6
- package/src/components/DataDictionary/components/Table/options/columnFilters/constants.ts +2 -1
- package/src/components/DataDictionary/components/Table/options/columnFilters/hook.ts +13 -12
- package/src/components/DataDictionary/components/Table/options/globalFilter/constants.ts +14 -0
- package/src/components/DataDictionary/components/Table/options/globalFilter/hook.ts +28 -0
- package/src/components/DataDictionary/components/Table/options/hook.ts +9 -11
- package/src/components/DataDictionary/components/Table/options/pagination/constants.ts +6 -0
- package/src/components/DataDictionary/dataDictionary.tsx +45 -16
- package/src/components/DataDictionary/hooks/UseDataDictionaryConfig/hook.ts +38 -0
- package/src/components/DataDictionary/hooks/UseDataDictionaryConfig/types.ts +8 -0
- package/src/components/DataDictionary/hooks/UseDataDictionaryConfig/utils.ts +8 -0
- package/src/components/DataDictionary/hooks/UseMeasureFilters/hook.ts +27 -0
- package/src/components/DataDictionary/hooks/UseMeasureFilters/types.ts +6 -0
- package/src/components/DataDictionary/types.ts +1 -0
- package/src/components/Filter/components/FilterCountChip/filterCountChip.styles.ts +19 -0
- package/src/components/Filter/components/FilterCountChip/filterCountChip.tsx +21 -0
- package/src/components/Filter/components/FilterCountChip/stories/filterCountChip.stories.tsx +12 -0
- package/src/components/Filter/components/FilterCountChip/types.ts +6 -0
- package/src/components/Table/columnDef/globalFilter/constants.ts +5 -0
- package/src/components/Table/columnDef/globalFilter/filterFn.ts +34 -0
- package/src/components/Table/columnDef/globalFilter/types.ts +5 -0
- package/src/components/Table/columnDef/globalFilter/utils.ts +74 -0
- package/src/components/Table/components/TableCell/components/RankedCell/rankedCell.tsx +50 -0
- package/src/components/Table/components/TableCell/components/RankedCell/utils.ts +85 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.ts +26 -1
- package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.tsx +11 -5
- package/src/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/columnFilterTag.styles.ts +25 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/columnFilterTag.tsx +31 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/constants.ts +13 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/stories/columFilterTag.stories.tsx +26 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/components/ColumnFilterTag/types.ts +9 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/constants.ts +8 -1
- package/src/components/Table/components/TableFeatures/ColumnFilter/types.ts +3 -2
- package/src/components/Table/components/TableFeatures/GlobalFilter/constants.ts +8 -0
- package/src/components/Table/components/TableFeatures/GlobalFilter/globalFilter.tsx +33 -0
- package/src/components/Table/components/TableFeatures/GlobalFilter/types.ts +9 -0
- package/src/components/Table/coreOptions/state/pagination/constants.ts +8 -0
- package/src/components/Table/coreOptions/state/pagination/utils.ts +21 -0
- package/src/components/common/AnchorLink/anchorLink.styles.ts +1 -1
- package/src/components/common/AnchorLink/anchorLink.tsx +9 -3
- package/src/components/common/CustomIcon/components/SearchIcon/searchIcon.tsx +2 -3
- package/src/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment.styles.ts +12 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment.tsx +21 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/constants.ts +13 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/types.ts +4 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/constants.ts +7 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/searchInputAdornment.tsx +13 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/components/constants.ts +7 -0
- package/src/components/common/OutlinedInput/components/InputAdornment/inputAdornment.styles.ts +6 -0
- package/src/components/common/OutlinedInput/outlinedInput.styles.ts +24 -0
- package/src/hooks/stateSyncManager/hooks/UseMetaCommands/hook.ts +2 -2
- package/src/hooks/stateSyncManager/hooks/UseStateSync/hook.ts +3 -3
- package/src/hooks/stateSyncManager/types.ts +1 -1
- package/src/providers/dataDictionary/context.ts +6 -0
- package/src/providers/dataDictionary/hook.ts +11 -0
- package/src/providers/dataDictionary/types.ts +6 -0
- package/src/providers/dataDictionaryState/actions/clearMeta/action.ts +18 -0
- package/src/providers/dataDictionaryState/actions/clearMeta/dispatch.ts +13 -0
- package/src/providers/dataDictionaryState/actions/clearMeta/types.ts +8 -0
- package/src/providers/dataDictionaryState/actions/stateToUrl/action.ts +20 -0
- package/src/providers/dataDictionaryState/actions/stateToUrl/dispatch.ts +14 -0
- package/src/providers/dataDictionaryState/actions/stateToUrl/types.ts +15 -0
- package/src/providers/dataDictionaryState/actions/types.ts +20 -0
- package/src/providers/dataDictionaryState/actions/updateColumnFilters/action.ts +24 -0
- package/src/providers/dataDictionaryState/actions/updateColumnFilters/dispatch.ts +16 -0
- package/src/providers/dataDictionaryState/actions/updateColumnFilters/types.ts +12 -0
- package/src/providers/dataDictionaryState/actions/updateColumnFilters/utils.ts +41 -0
- package/src/providers/dataDictionaryState/actions/updateGlobalFilter/action.ts +25 -0
- package/src/providers/dataDictionaryState/actions/updateGlobalFilter/dispatch.ts +16 -0
- package/src/providers/dataDictionaryState/actions/updateGlobalFilter/types.ts +12 -0
- package/src/providers/dataDictionaryState/actions/updateGlobalFilter/utils.ts +50 -0
- package/src/providers/dataDictionaryState/actions/urlToState/action.ts +28 -0
- package/src/providers/dataDictionaryState/actions/urlToState/dispatch.ts +14 -0
- package/src/providers/dataDictionaryState/actions/urlToState/types.ts +11 -0
- package/src/providers/dataDictionaryState/context.ts +9 -0
- package/src/providers/dataDictionaryState/dictionaries/constants.ts +4 -0
- package/src/providers/dataDictionaryState/dictionaries/state.ts +45 -0
- package/src/providers/dataDictionaryState/dictionaries/types.ts +11 -0
- package/src/providers/dataDictionaryState/dictionaries/utils.ts +25 -0
- package/src/providers/dataDictionaryState/hooks/UseDataDictionaryInitialArgs/hook.ts +14 -0
- package/src/providers/dataDictionaryState/hooks/UseDataDictionaryInitialArgs/types.ts +5 -0
- package/src/providers/dataDictionaryState/hooks/UseDataDictionaryReducer/hook.ts +17 -0
- package/src/providers/dataDictionaryState/hooks/UseDataDictionaryState/hook.ts +11 -0
- package/src/providers/dataDictionaryState/initializer/constants.ts +6 -0
- package/src/providers/dataDictionaryState/initializer/initializer.ts +22 -0
- package/src/providers/dataDictionaryState/initializer/utils.ts +39 -0
- package/src/providers/dataDictionaryState/provider.tsx +16 -0
- package/src/providers/dataDictionaryState/reducer.ts +42 -0
- package/src/providers/dataDictionaryState/types.ts +18 -0
- package/src/styles/common/mui/iconButton.ts +40 -0
- package/src/styles/common/mui/inputAdornment.ts +22 -0
- package/src/styles/common/mui/outlinedInput.ts +14 -0
- package/src/theme/common/components.ts +122 -16
- package/src/theme/components/muiButtonGroup.ts +4 -0
- package/src/theme/components/muiTableCell.ts +6 -0
- package/src/utils/parseJsonQueryParam.ts +27 -0
- package/src/utils/stateToUrlQuery.ts +40 -0
- package/src/views/DataDictionaryView/dataDictionaryView.tsx +29 -3
- package/src/views/DataDictionaryView/types.ts +5 -0
- package/src/views/DataDictionaryView/utils.ts +23 -0
- package/src/views/ExploreView/utils.ts +1 -1
- package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.d.ts +0 -4
- package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +0 -36
- package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +0 -8
- package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +0 -51
- package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +0 -9
- /package/lib/components/DataDictionary/{hooks/UseDataDictionary → components/Filters/components/ColumnFilterTags}/types.js +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
getBorderBoxSizeHeight,
|
|
4
|
+
useResizeObserver,
|
|
5
|
+
} from "../../../../hooks/useResizeObserver";
|
|
6
|
+
import { useLayoutDimensions } from "../../../../providers/layoutDimensions/hook";
|
|
7
|
+
import { UseMeasureFilters } from "./types";
|
|
8
|
+
|
|
9
|
+
export const useMeasureFilters = (): UseMeasureFilters => {
|
|
10
|
+
// Get header dimensions.
|
|
11
|
+
const { dimensions } = useLayoutDimensions();
|
|
12
|
+
const { header } = dimensions;
|
|
13
|
+
|
|
14
|
+
// Measure filters dimensions.
|
|
15
|
+
const filtersRef = useRef<HTMLElement>(null);
|
|
16
|
+
const filtersRect = useResizeObserver(
|
|
17
|
+
filtersRef,
|
|
18
|
+
getBorderBoxSizeHeight,
|
|
19
|
+
header.height > 0 // Only measure filters height, when header measurement is available.
|
|
20
|
+
);
|
|
21
|
+
const { height = 0 } = filtersRect || {};
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
dimensions: { height },
|
|
25
|
+
filtersRef,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Chip, styled } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const StyledChip = styled(Chip)`
|
|
4
|
+
align-items: center;
|
|
5
|
+
border-radius: 10px;
|
|
6
|
+
flex: none;
|
|
7
|
+
gap: 0;
|
|
8
|
+
height: 16px;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
min-width: 16px;
|
|
11
|
+
padding: 0 4px;
|
|
12
|
+
|
|
13
|
+
.MuiChip-label {
|
|
14
|
+
font-size: 9px;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
line-height: 16px;
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CHIP_PROPS } from "../../../../styles/common/mui/chip";
|
|
3
|
+
import { StyledChip } from "./filterCountChip.styles";
|
|
4
|
+
import { FilterCountChipProps } from "./types";
|
|
5
|
+
|
|
6
|
+
export const FilterCountChip = ({
|
|
7
|
+
className,
|
|
8
|
+
count,
|
|
9
|
+
...props /* MuiChipProps */
|
|
10
|
+
}: FilterCountChipProps): JSX.Element | null => {
|
|
11
|
+
if (!count) return null;
|
|
12
|
+
return (
|
|
13
|
+
<StyledChip
|
|
14
|
+
className={className}
|
|
15
|
+
color={CHIP_PROPS.COLOR.PRIMARY}
|
|
16
|
+
label={String(count)}
|
|
17
|
+
variant={CHIP_PROPS.VARIANT.FILLED}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { FilterCountChip } from "../filterCountChip";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FilterCountChip> = {
|
|
5
|
+
component: FilterCountChip,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
|
|
12
|
+
export const DEFAULT: Story = { args: { count: 1, onDelete: undefined } };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FilterMeta, Row, RowData } from "@tanstack/react-table";
|
|
2
|
+
import { parseSearchTerms, rankColumnValue, rankRowColumns } from "./utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fuzzy matches a column against search terms.
|
|
6
|
+
* A true value is returned if the column's value passes the ranking threshold.
|
|
7
|
+
* Normally, TanStack global filtering will not process remaining row columns if a match is found.
|
|
8
|
+
* This function ranks other row columns for highlighting purposes.
|
|
9
|
+
* @param row - Row.
|
|
10
|
+
* @param columnId - Column identifier.
|
|
11
|
+
* @param value - Search term.
|
|
12
|
+
* @param addMeta - Function to add filter metadata.
|
|
13
|
+
* @returns Whether the row passed the filter.
|
|
14
|
+
*/
|
|
15
|
+
export function fuzzy<T extends RowData>(
|
|
16
|
+
row: Row<T>,
|
|
17
|
+
columnId: string,
|
|
18
|
+
value: unknown,
|
|
19
|
+
addMeta: (meta: FilterMeta) => void
|
|
20
|
+
): boolean {
|
|
21
|
+
// Split the search term into terms.
|
|
22
|
+
const terms = parseSearchTerms(value);
|
|
23
|
+
|
|
24
|
+
// Rank the column value.
|
|
25
|
+
const passed = rankColumnValue(row, columnId, terms);
|
|
26
|
+
|
|
27
|
+
// Add the filter metadata.
|
|
28
|
+
addMeta({ passed });
|
|
29
|
+
|
|
30
|
+
// Rank other columns for highlighting purposes (TanStack global filtering will not process remaining columns if a match is found).
|
|
31
|
+
if (passed) rankRowColumns(row, columnId, terms);
|
|
32
|
+
|
|
33
|
+
return passed;
|
|
34
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { rankItem } from "@tanstack/match-sorter-utils";
|
|
2
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
3
|
+
import { RANK_ITEM_OPTIONS } from "./constants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parses a search term into an array of terms.
|
|
7
|
+
* @param value - Search term.
|
|
8
|
+
* @returns Array of terms.
|
|
9
|
+
*/
|
|
10
|
+
export function parseSearchTerms(value: unknown): string[] {
|
|
11
|
+
return String(value ?? "")
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.trim()
|
|
14
|
+
.split(/\s+/)
|
|
15
|
+
.filter(Boolean);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Ranks a column's value against search terms.
|
|
20
|
+
* @param row - Row to rank.
|
|
21
|
+
* @param columnId - Column identifier.
|
|
22
|
+
* @param terms - Search terms to match against.
|
|
23
|
+
* @returns Whether the value passed.
|
|
24
|
+
*/
|
|
25
|
+
export function rankColumnValue<T extends RowData>(
|
|
26
|
+
row: Row<T>,
|
|
27
|
+
columnId: string,
|
|
28
|
+
terms: string[]
|
|
29
|
+
): boolean {
|
|
30
|
+
// Get the column value.
|
|
31
|
+
const columnValue = row.getValue(columnId);
|
|
32
|
+
|
|
33
|
+
// Return false if the column value is undefined or null.
|
|
34
|
+
if (columnValue === undefined || columnValue === null) return false;
|
|
35
|
+
|
|
36
|
+
// Check if each term matches the column value.
|
|
37
|
+
// Ranking from CASE_SENSITIVE_EQUAL to CONTAINS (excludes `ACRONYM`, `MATCHES` threshold).
|
|
38
|
+
const rankings = terms.map((term) =>
|
|
39
|
+
rankItem(String(columnValue), term, RANK_ITEM_OPTIONS)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return rankings.every(({ passed }) => passed);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Ranks a row's columns against search terms.
|
|
47
|
+
* Processes columns that are searchable and have not already been processed.
|
|
48
|
+
* @param row - Row to rank.
|
|
49
|
+
* @param columnId - Column identifier.
|
|
50
|
+
* @param terms - Search terms to match against.
|
|
51
|
+
*/
|
|
52
|
+
export function rankRowColumns<T extends RowData>(
|
|
53
|
+
row: Row<T>,
|
|
54
|
+
columnId: string,
|
|
55
|
+
terms: string[]
|
|
56
|
+
): void {
|
|
57
|
+
const columnFiltersMeta = row.columnFiltersMeta;
|
|
58
|
+
|
|
59
|
+
// Process other columns.
|
|
60
|
+
for (const { column } of row.getAllCells()) {
|
|
61
|
+
// Column is not searchable.
|
|
62
|
+
if (!column.getCanGlobalFilter()) continue;
|
|
63
|
+
|
|
64
|
+
// Column has already been processed.
|
|
65
|
+
if (column.id === columnId) continue;
|
|
66
|
+
if (column.id in columnFiltersMeta) continue;
|
|
67
|
+
|
|
68
|
+
// Rank the column value.
|
|
69
|
+
const passed = rankColumnValue(row, column.id, terms);
|
|
70
|
+
|
|
71
|
+
// Add the filter metadata.
|
|
72
|
+
row.columnFiltersMeta[column.id] = { passed };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CellContext, RowData } from "@tanstack/react-table";
|
|
2
|
+
import React, { Fragment } from "react";
|
|
3
|
+
import { BaseComponentProps } from "../../../../../types";
|
|
4
|
+
import { getTokens, getTokensRegex, isRankedCell } from "./utils";
|
|
5
|
+
|
|
6
|
+
export const RankedCell = <
|
|
7
|
+
T extends RowData,
|
|
8
|
+
TValue = string | undefined | null
|
|
9
|
+
>({
|
|
10
|
+
className,
|
|
11
|
+
column,
|
|
12
|
+
getValue,
|
|
13
|
+
row,
|
|
14
|
+
table,
|
|
15
|
+
}: BaseComponentProps & CellContext<T, TValue>): JSX.Element | null => {
|
|
16
|
+
// Get the cell value.
|
|
17
|
+
const value = getValue();
|
|
18
|
+
|
|
19
|
+
// If the cell value is undefined or null, return null.
|
|
20
|
+
if (value === undefined || value === null) return null;
|
|
21
|
+
|
|
22
|
+
// Convert the cell value to a string.
|
|
23
|
+
const stringValue = String(value);
|
|
24
|
+
|
|
25
|
+
// Check if the cell is ranked.
|
|
26
|
+
const isRanked = isRankedCell(table, row, column.id);
|
|
27
|
+
|
|
28
|
+
// Return the unranked cell, as-is.
|
|
29
|
+
if (!isRanked) return <Fragment>{stringValue}</Fragment>;
|
|
30
|
+
|
|
31
|
+
// Tokenise the current global filter.
|
|
32
|
+
const tokens = getTokens(table);
|
|
33
|
+
|
|
34
|
+
// If there are no tokens, return the value as-is.
|
|
35
|
+
if (tokens.length === 0) return <Fragment>{stringValue}</Fragment>;
|
|
36
|
+
|
|
37
|
+
// Create regex pattern.
|
|
38
|
+
const regex = getTokensRegex(tokens);
|
|
39
|
+
|
|
40
|
+
// Return the ranked cell, with highlighting.
|
|
41
|
+
return (
|
|
42
|
+
<span className={className}>
|
|
43
|
+
{stringValue.split(regex).map((part, i) => (
|
|
44
|
+
<Fragment key={i}>
|
|
45
|
+
{part.match(regex) ? <mark>{part}</mark> : part}
|
|
46
|
+
</Fragment>
|
|
47
|
+
))}
|
|
48
|
+
</span>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Row, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
import { escapeRegExp } from "../../../../../../common/utils";
|
|
3
|
+
import { ColumnFilterMeta } from "../../../../columnDef/globalFilter/types";
|
|
4
|
+
import { parseSearchTerms } from "../../../../columnDef/globalFilter/utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a cell value with highlighting if it matches item rank filter criteria.
|
|
8
|
+
* @param table - Table.
|
|
9
|
+
* @param row - Row.
|
|
10
|
+
* @param columnId - Column identifier.
|
|
11
|
+
* @param value - Cell value.
|
|
12
|
+
* @returns Rendered cell value with highlighting.
|
|
13
|
+
*/
|
|
14
|
+
export function renderRankedCell<T extends RowData>(
|
|
15
|
+
table: Table<T>,
|
|
16
|
+
row: Row<T>,
|
|
17
|
+
columnId: string,
|
|
18
|
+
value: string | undefined | null
|
|
19
|
+
): string {
|
|
20
|
+
// If the cell value is undefined or null, return an empty string.
|
|
21
|
+
if (value === undefined || value === null) return "";
|
|
22
|
+
|
|
23
|
+
const stringValue = String(value);
|
|
24
|
+
|
|
25
|
+
// Check if the cell is ranked.
|
|
26
|
+
const isRanked = isRankedCell(table, row, columnId);
|
|
27
|
+
|
|
28
|
+
// Return the unranked cell, as-is, in string form.
|
|
29
|
+
if (!isRanked) return stringValue;
|
|
30
|
+
|
|
31
|
+
// Tokenise the current global filter.
|
|
32
|
+
const tokens = getTokens(table);
|
|
33
|
+
|
|
34
|
+
// If there are no tokens, return the value as-is, in string form.
|
|
35
|
+
if (tokens.length === 0) return stringValue;
|
|
36
|
+
|
|
37
|
+
// Create regex pattern.
|
|
38
|
+
const regex = getTokensRegex(tokens);
|
|
39
|
+
|
|
40
|
+
return stringValue.replace(regex, "<mark>$1</mark>");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the current global filter tokens from the table.
|
|
45
|
+
* @param table - Table.
|
|
46
|
+
* @returns An array of search tokens.
|
|
47
|
+
*/
|
|
48
|
+
export function getTokens<T extends RowData>(table: Table<T>): string[] {
|
|
49
|
+
const { getState } = table;
|
|
50
|
+
const { globalFilter } = getState();
|
|
51
|
+
return parseSearchTerms(globalFilter);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns a RegExp pattern for matching search tokens.
|
|
56
|
+
* @param tokens - Search tokens.
|
|
57
|
+
* @returns A RegExp pattern that matches any of the tokens.
|
|
58
|
+
*/
|
|
59
|
+
export function getTokensRegex(tokens: string[]): RegExp {
|
|
60
|
+
return new RegExp(`(${tokens.map(escapeRegExp).join("|")})`, "gi");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a cell is ranked based on the global filter.
|
|
65
|
+
* @param table - Table.
|
|
66
|
+
* @param row - Row.
|
|
67
|
+
* @param columnId - Column identifier.
|
|
68
|
+
* @returns Whether the cell is ranked.
|
|
69
|
+
*/
|
|
70
|
+
export function isRankedCell<T extends RowData>(
|
|
71
|
+
table: Table<T>,
|
|
72
|
+
row: Row<T>,
|
|
73
|
+
columnId: string
|
|
74
|
+
): boolean {
|
|
75
|
+
const { getState } = table;
|
|
76
|
+
const { globalFilter } = getState();
|
|
77
|
+
|
|
78
|
+
// If there is no global filter, return the value as-is.
|
|
79
|
+
if (!globalFilter) return false;
|
|
80
|
+
|
|
81
|
+
// Check if the column has filter metadata with itemRank.passed
|
|
82
|
+
const columnFilterMeta = row.columnFiltersMeta[columnId] as ColumnFilterMeta;
|
|
83
|
+
|
|
84
|
+
return columnFilterMeta?.passed ?? false;
|
|
85
|
+
}
|
|
@@ -1,11 +1,36 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
|
-
import { Menu, menuClasses, paperClasses } from "@mui/material";
|
|
3
|
+
import { Button, Menu, menuClasses, paperClasses } from "@mui/material";
|
|
4
|
+
import { PALETTE } from "../../../../../styles/common/constants/palette";
|
|
3
5
|
import { MAX_LIST_HEIGHT_PX } from "../../../../Filter/common/constants";
|
|
4
6
|
import {
|
|
5
7
|
MuiListItemButtonRoot,
|
|
6
8
|
MuiListItemTextRoot,
|
|
7
9
|
} from "../../../../Filter/components/FilterList/filterList.styles";
|
|
8
10
|
|
|
11
|
+
interface Props {
|
|
12
|
+
open: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const StyledButton = styled(Button, {
|
|
16
|
+
shouldForwardProp: (prop) => prop !== "open",
|
|
17
|
+
})<Props>`
|
|
18
|
+
&.MuiButtonGroup-grouped {
|
|
19
|
+
gap: 0;
|
|
20
|
+
|
|
21
|
+
.MuiButton-endIcon {
|
|
22
|
+
margin-left: 0;
|
|
23
|
+
margin-right: -8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
${({ open }) =>
|
|
27
|
+
open &&
|
|
28
|
+
css`
|
|
29
|
+
background-color: ${PALETTE.SMOKE_LIGHT};
|
|
30
|
+
`}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
9
34
|
export const StyledMenu = styled(Menu)`
|
|
10
35
|
.${paperClasses.root} {
|
|
11
36
|
margin: 4px 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox,
|
|
3
|
+
Grid,
|
|
3
4
|
ListItemButton,
|
|
4
5
|
ListItemText,
|
|
5
|
-
Button as MButton,
|
|
6
6
|
Typography,
|
|
7
7
|
} from "@mui/material";
|
|
8
8
|
import { RowData } from "@tanstack/react-table";
|
|
@@ -13,10 +13,11 @@ import { CheckedIcon } from "../../../../common/CustomIcon/components/CheckedIco
|
|
|
13
13
|
import { UncheckedIcon } from "../../../../common/CustomIcon/components/UncheckedIcon/uncheckedIcon";
|
|
14
14
|
import { DropDownIcon } from "../../../../common/Form/components/Select/components/DropDownIcon/dropDownIcon";
|
|
15
15
|
import { useMenu } from "../../../../common/Menu/hooks/useMenu";
|
|
16
|
+
import { FilterCountChip } from "../../../../Filter/components/FilterCountChip/filterCountChip";
|
|
16
17
|
import { getColumnHeader } from "../../../common/utils";
|
|
17
18
|
import { getSortedFacetedValues } from "../../../featureOptions/facetedColumn/utils";
|
|
18
|
-
import { StyledMenu } from "./columnFilter.styles";
|
|
19
|
-
import { MENU_PROPS } from "./constants";
|
|
19
|
+
import { StyledButton, StyledMenu } from "./columnFilter.styles";
|
|
20
|
+
import { GRID_PROPS, MENU_PROPS } from "./constants";
|
|
20
21
|
import { ColumnFilterProps } from "./types";
|
|
21
22
|
import { updater } from "./utils";
|
|
22
23
|
|
|
@@ -26,7 +27,7 @@ import { updater } from "./utils";
|
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
29
|
export const ColumnFilter = <T extends RowData>({
|
|
29
|
-
Button =
|
|
30
|
+
Button = StyledButton,
|
|
30
31
|
className,
|
|
31
32
|
column,
|
|
32
33
|
...props /* MuiMenuProps */
|
|
@@ -39,10 +40,15 @@ export const ColumnFilter = <T extends RowData>({
|
|
|
39
40
|
<Fragment>
|
|
40
41
|
<Button
|
|
41
42
|
key={column.id}
|
|
43
|
+
disabled={sortedValues.length === 0}
|
|
42
44
|
endIcon={<DropDownIcon color={SVG_ICON_PROPS.COLOR.INK_LIGHT} />}
|
|
43
45
|
onClick={onOpen}
|
|
46
|
+
open={open}
|
|
44
47
|
>
|
|
45
|
-
{
|
|
48
|
+
<Grid {...GRID_PROPS}>
|
|
49
|
+
{getColumnHeader(column)}
|
|
50
|
+
<FilterCountChip count={filterValue.length} />
|
|
51
|
+
</Grid>
|
|
46
52
|
</Button>
|
|
47
53
|
<StyledMenu
|
|
48
54
|
{...MENU_PROPS}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Chip } from "@mui/material";
|
|
3
|
+
import { PALETTE } from "../../../../../../../styles/common/constants/palette";
|
|
4
|
+
|
|
5
|
+
export const StyledChip = styled(Chip)`
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
box-shadow: 0 0 0 2px ${PALETTE.COMMON_WHITE};
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
justify-self: flex-start;
|
|
11
|
+
padding: 0 8px;
|
|
12
|
+
|
|
13
|
+
.MuiChip-label {
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.MuiChip-deleteIcon {
|
|
18
|
+
font-size: 16px;
|
|
19
|
+
margin: 0 -4px 0 0;
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
color: inherit;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CloseRounded } from "@mui/icons-material";
|
|
2
|
+
import { RowData } from "@tanstack/react-table";
|
|
3
|
+
import React, { Fragment } from "react";
|
|
4
|
+
import { updater } from "../../../../../components/TableFeatures/ColumnFilter/utils";
|
|
5
|
+
import { StyledChip } from "./columnFilterTag.styles";
|
|
6
|
+
import { CHIP_PROPS, SVG_ICON_PROPS } from "./constants";
|
|
7
|
+
import { ColumnFilterTagProps } from "./types";
|
|
8
|
+
|
|
9
|
+
export const ColumnFilterTag = <T extends RowData>({
|
|
10
|
+
className,
|
|
11
|
+
column,
|
|
12
|
+
...props /* MuiChipProps */
|
|
13
|
+
}: ColumnFilterTagProps<T>): JSX.Element => {
|
|
14
|
+
const filterValue = column.getFilterValue() as unknown[];
|
|
15
|
+
return (
|
|
16
|
+
<Fragment>
|
|
17
|
+
{filterValue.map((value) => (
|
|
18
|
+
<StyledChip
|
|
19
|
+
{...CHIP_PROPS}
|
|
20
|
+
key={String(value)}
|
|
21
|
+
className={className}
|
|
22
|
+
deleteIcon={<CloseRounded {...SVG_ICON_PROPS} />}
|
|
23
|
+
label={String(value)}
|
|
24
|
+
onClick={() => column.setFilterValue(updater(value))}
|
|
25
|
+
onDelete={() => column.setFilterValue(updater(value))}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
))}
|
|
29
|
+
</Fragment>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChipProps, SvgIconProps } from "@mui/material";
|
|
2
|
+
import { CHIP_PROPS as MUI_CHIP_PROPS } from "../../../../../../../styles/common/mui/chip";
|
|
3
|
+
import { SVG_ICON_PROPS as MUI_SVG_ICON_PROPS } from "../../../../../../../styles/common/mui/svgIcon";
|
|
4
|
+
|
|
5
|
+
export const CHIP_PROPS: ChipProps = {
|
|
6
|
+
clickable: false,
|
|
7
|
+
color: MUI_CHIP_PROPS.COLOR.DEFAULT,
|
|
8
|
+
size: MUI_CHIP_PROPS.SIZE.MEDIUM,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const SVG_ICON_PROPS: SvgIconProps = {
|
|
12
|
+
color: MUI_SVG_ICON_PROPS.COLOR.INHERIT,
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { BIONETWORK } from "../../../../../../../DataDictionary/components/Filters/stories/constants";
|
|
5
|
+
import { ColumnFilterTag } from "../columnFilterTag";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof ColumnFilterTag> = {
|
|
8
|
+
component: ColumnFilterTag,
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story): JSX.Element => (
|
|
11
|
+
<Box sx={{ display: "grid", gap: 2, gridAutoFlow: "column" }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</Box>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
column: BIONETWORK,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChipProps } from "@mui/material";
|
|
2
|
+
import { Column, RowData } from "@tanstack/react-table";
|
|
3
|
+
import { BaseComponentProps } from "../../../../../../types";
|
|
4
|
+
|
|
5
|
+
export interface ColumnFilterTagProps<T extends RowData>
|
|
6
|
+
extends BaseComponentProps,
|
|
7
|
+
ChipProps {
|
|
8
|
+
column: Column<T>;
|
|
9
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { MenuProps } from "@mui/material";
|
|
1
|
+
import { GridProps, MenuProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const GRID_PROPS: GridProps = {
|
|
4
|
+
alignItems: "center",
|
|
5
|
+
container: true,
|
|
6
|
+
direction: "row",
|
|
7
|
+
gap: 1,
|
|
8
|
+
};
|
|
2
9
|
|
|
3
10
|
export const MENU_PROPS: Omit<MenuProps, "anchorEl" | "onClose" | "open"> = {
|
|
4
11
|
anchorOrigin: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MenuProps } from "@mui/material";
|
|
2
2
|
import { Column, RowData } from "@tanstack/react-table";
|
|
3
3
|
import { BaseComponentProps } from "../../../../types";
|
|
4
|
+
import { StyledButton } from "./columnFilter.styles";
|
|
4
5
|
|
|
5
6
|
export interface ColumnFilterProps<T extends RowData>
|
|
6
7
|
extends BaseComponentProps,
|
|
7
8
|
Omit<MenuProps, "anchorEl" | "onClose" | "open"> {
|
|
8
|
-
Button?: typeof
|
|
9
|
+
Button?: typeof StyledButton;
|
|
9
10
|
column: Column<T>;
|
|
10
11
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OutlinedInputProps } from "@mui/material";
|
|
2
|
+
import { OUTLINED_INPUT_PROPS as MUI_OUTLINED_INPUT_PROPS } from "../../../../../styles/common/mui/outlinedInput";
|
|
3
|
+
|
|
4
|
+
export const OUTLINED_INPUT_PROPS: OutlinedInputProps = {
|
|
5
|
+
color: MUI_OUTLINED_INPUT_PROPS.COLOR.SECONDARY,
|
|
6
|
+
fullWidth: true,
|
|
7
|
+
id: "global-filter",
|
|
8
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RowData } from "@tanstack/react-table";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ClearInputAdornment } from "../../../../common/OutlinedInput/components/InputAdornment/components/ClearInputAdornment/clearInputAdornment";
|
|
4
|
+
import { SearchInputAdornment } from "../../../../common/OutlinedInput/components/InputAdornment/components/SearchInputAdornment/searchInputAdornment";
|
|
5
|
+
import { StyledOutlinedInput } from "../../../../common/OutlinedInput/outlinedInput.styles";
|
|
6
|
+
import { OUTLINED_INPUT_PROPS } from "./constants";
|
|
7
|
+
import { GlobalFilterProps } from "./types";
|
|
8
|
+
|
|
9
|
+
export const GlobalFilter = <T extends RowData>({
|
|
10
|
+
className,
|
|
11
|
+
table,
|
|
12
|
+
...props /* MuiOutlinedInputProps */
|
|
13
|
+
}: GlobalFilterProps<T>): JSX.Element => {
|
|
14
|
+
const { getState, setGlobalFilter } = table;
|
|
15
|
+
const { globalFilter } = getState();
|
|
16
|
+
return (
|
|
17
|
+
<StyledOutlinedInput
|
|
18
|
+
{...OUTLINED_INPUT_PROPS}
|
|
19
|
+
className={className}
|
|
20
|
+
endAdornment={
|
|
21
|
+
<ClearInputAdornment
|
|
22
|
+
in={!!globalFilter}
|
|
23
|
+
onClick={() => setGlobalFilter(undefined)}
|
|
24
|
+
/>
|
|
25
|
+
}
|
|
26
|
+
hasValue={!!globalFilter}
|
|
27
|
+
onChange={(e) => setGlobalFilter(e.target.value)}
|
|
28
|
+
startAdornment={<SearchInputAdornment />}
|
|
29
|
+
value={globalFilter ?? ""}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OutlinedInputProps } from "@mui/material";
|
|
2
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
3
|
+
import { BaseComponentProps } from "components/types";
|
|
4
|
+
|
|
5
|
+
export interface GlobalFilterProps<T extends RowData>
|
|
6
|
+
extends BaseComponentProps,
|
|
7
|
+
OutlinedInputProps {
|
|
8
|
+
table: Table<T>;
|
|
9
|
+
}
|