@databiosphere/findable-ui 35.1.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 +27 -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/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.js +21 -29
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.js +21 -36
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.d.ts +2 -0
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.js +22 -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/CodeCell/codeCell.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.js +9 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.d.ts +5 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.js +15 -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/hooks/useFileManifest/useFileManifestDownload.d.ts +2 -2
- package/lib/hooks/useFileManifest/useFileManifestDownload.js +3 -10
- package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.d.ts +5 -4
- package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.js +24 -20
- 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/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.tsx +43 -71
- package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.tsx +52 -74
- package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.ts +24 -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/CodeCell/codeCell.styles.ts +16 -0
- package/src/components/Table/components/TableCell/components/CodeCell/codeCell.tsx +21 -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/hooks/useFileManifest/useFileManifestDownload.ts +9 -16
- package/src/hooks/useFileManifest/useFileManifestSpreadsheet.ts +41 -26
- 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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
1
|
import { MANIFEST_DOWNLOAD_FORMAT } from "../../apis/azul/common/entities";
|
|
3
2
|
import { Filters } from "../../common/entities";
|
|
4
3
|
import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT } from "../../components/Export/common/entities";
|
|
@@ -15,18 +14,15 @@ export interface ManifestDownload {
|
|
|
15
14
|
isIdle: boolean;
|
|
16
15
|
isLoading: boolean;
|
|
17
16
|
manifestURL?: string;
|
|
17
|
+
requestManifest: () => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Returns file manifest download url and file name.
|
|
22
22
|
* @param filters - Filters.
|
|
23
|
-
* @param disabled - Disabled.
|
|
24
23
|
* @returns file manifest download url and file name.
|
|
25
24
|
*/
|
|
26
|
-
export const useFileManifestDownload = (
|
|
27
|
-
filters: Filters,
|
|
28
|
-
disabled: boolean
|
|
29
|
-
): ManifestDownload => {
|
|
25
|
+
export const useFileManifestDownload = (filters: Filters): ManifestDownload => {
|
|
30
26
|
// Retrieve the endpoint URL from configured data source.
|
|
31
27
|
const config = useConfig();
|
|
32
28
|
const endpointUrl = config.config.dataSource.url;
|
|
@@ -39,24 +35,21 @@ export const useFileManifestDownload = (
|
|
|
39
35
|
filters,
|
|
40
36
|
MANIFEST_DOWNLOAD_FORMAT.COMPACT
|
|
41
37
|
);
|
|
42
|
-
const {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const {
|
|
39
|
+
data,
|
|
40
|
+
isIdle,
|
|
41
|
+
isLoading,
|
|
42
|
+
run: requestManifest,
|
|
43
|
+
} = useRequestFileLocation(requestUrl, requestMethod);
|
|
46
44
|
const manifestURL = getManifestDownloadURL(data);
|
|
47
45
|
const fileName = getManifestDownloadFileName(data);
|
|
48
46
|
|
|
49
|
-
// Requests file manifest.
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (disabled) return;
|
|
52
|
-
run();
|
|
53
|
-
}, [disabled, requestUrl, run]);
|
|
54
|
-
|
|
55
47
|
return {
|
|
56
48
|
fileName,
|
|
57
49
|
isIdle,
|
|
58
50
|
isLoading,
|
|
59
51
|
manifestURL,
|
|
52
|
+
requestManifest,
|
|
60
53
|
};
|
|
61
54
|
};
|
|
62
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useMemo } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
2
2
|
import {
|
|
3
3
|
APIEndpoints,
|
|
4
4
|
AzulEntitiesResponse,
|
|
@@ -9,24 +9,25 @@ import { fetchQueryParams } from "../../utils/fetchQueryParams";
|
|
|
9
9
|
import { useAsync } from "../useAsync";
|
|
10
10
|
import { useCatalog } from "../useCatalog";
|
|
11
11
|
import { useFetchRequestURL } from "../useFetchRequestURL";
|
|
12
|
+
import { useRequestFileLocation } from "../useRequestFileLocation";
|
|
12
13
|
|
|
13
14
|
export interface ManifestSpreadsheet {
|
|
14
|
-
exists?: boolean;
|
|
15
|
-
fileFormat?: string;
|
|
16
15
|
fileName?: string;
|
|
17
16
|
fileUrl?: string;
|
|
17
|
+
isIdle?: boolean;
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
requestManifest?: () => void;
|
|
20
|
+
spreadsheetUrl?: string;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Returns file manifest spreadsheet.
|
|
22
25
|
* @param filters - Filters.
|
|
23
|
-
* @param disabled - Disabled.
|
|
24
26
|
* @returns file manifest spreadsheet.
|
|
25
27
|
*/
|
|
26
28
|
export const useFileManifestSpreadsheet = (
|
|
27
|
-
filters: Filters
|
|
28
|
-
|
|
29
|
-
): ManifestSpreadsheet | undefined => {
|
|
29
|
+
filters: Filters
|
|
30
|
+
): Omit<ManifestSpreadsheet, "fileUrl"> => {
|
|
30
31
|
// Determine catalog.
|
|
31
32
|
const catalog = useCatalog() as string; // catalog should be defined.
|
|
32
33
|
// Build request params.
|
|
@@ -34,20 +35,39 @@ export const useFileManifestSpreadsheet = (
|
|
|
34
35
|
// Build request URL.
|
|
35
36
|
const requestURL = useFetchRequestURL(APIEndpoints.FILES, requestParams);
|
|
36
37
|
// Fetch files to determine if file exists.
|
|
37
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
data: files,
|
|
40
|
+
isIdle,
|
|
41
|
+
isLoading: isFilesLoading,
|
|
42
|
+
run: requestFiles,
|
|
43
|
+
} = useAsync<AzulEntitiesResponse>();
|
|
44
|
+
|
|
38
45
|
// Grab manifest spreadsheet.
|
|
39
|
-
const
|
|
40
|
-
() => getManifestSpreadsheet(
|
|
41
|
-
[
|
|
46
|
+
const { fileName, fileUrl } = useMemo(
|
|
47
|
+
() => getManifestSpreadsheet(files?.hits),
|
|
48
|
+
[files]
|
|
42
49
|
);
|
|
43
50
|
|
|
51
|
+
// Fetch file manifest.
|
|
52
|
+
const { data, isLoading, run } = useRequestFileLocation(fileUrl);
|
|
53
|
+
|
|
44
54
|
// Fetch response from files endpoint.
|
|
55
|
+
const requestManifest = useCallback(() => {
|
|
56
|
+
requestFiles(fetchEntitiesFromURL(requestURL, undefined));
|
|
57
|
+
}, [requestFiles, requestURL]);
|
|
58
|
+
|
|
59
|
+
// Fetch file manifest.
|
|
45
60
|
useEffect(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [disabled, requestURL, run]);
|
|
61
|
+
run();
|
|
62
|
+
}, [fileUrl, run]);
|
|
49
63
|
|
|
50
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
fileName,
|
|
66
|
+
isIdle,
|
|
67
|
+
isLoading: isFilesLoading || isLoading,
|
|
68
|
+
requestManifest,
|
|
69
|
+
spreadsheetUrl: data?.location,
|
|
70
|
+
};
|
|
51
71
|
};
|
|
52
72
|
|
|
53
73
|
/**
|
|
@@ -74,21 +94,16 @@ function buildFetchFileUrl(fileUrl?: string): string | undefined {
|
|
|
74
94
|
*/
|
|
75
95
|
function getManifestSpreadsheet(
|
|
76
96
|
files?: AzulEntitiesResponse["hits"]
|
|
77
|
-
): ManifestSpreadsheet |
|
|
78
|
-
if (!files) {
|
|
79
|
-
|
|
80
|
-
}
|
|
97
|
+
): Pick<ManifestSpreadsheet, "fileName" | "fileUrl"> {
|
|
98
|
+
if (!files) return { fileName: undefined, fileUrl: undefined };
|
|
99
|
+
|
|
81
100
|
// Handle case where file does not exist.
|
|
82
|
-
if (files.length === 0) {
|
|
83
|
-
|
|
84
|
-
exists: false,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
101
|
+
if (files.length === 0) return { fileName: undefined, fileUrl: undefined };
|
|
102
|
+
|
|
87
103
|
// Project manifest spreadsheet exists.
|
|
88
104
|
const file = files[0];
|
|
105
|
+
|
|
89
106
|
return {
|
|
90
|
-
exists: true,
|
|
91
|
-
fileFormat: file.files[0]?.format,
|
|
92
107
|
fileName: file.files[0]?.name,
|
|
93
108
|
fileUrl: buildFetchFileUrl(file.files[0]?.url),
|
|
94
109
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { DataDictionaryContext } from "./context";
|
|
3
|
+
import { DataDictionaryContextProps } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns data dictionary context.
|
|
7
|
+
* @returns data dictionary context.
|
|
8
|
+
*/
|
|
9
|
+
export const useDataDictionary = (): DataDictionaryContextProps => {
|
|
10
|
+
return useContext(DataDictionaryContext);
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataDictionaryState } from "../../types";
|
|
2
|
+
import { ClearMetaPayload } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Reducer function to handle the "clear meta" action.
|
|
6
|
+
* @param state - Data Dictionary State.
|
|
7
|
+
* @param payload - Payload.
|
|
8
|
+
* @returns data dictionary state.
|
|
9
|
+
*/
|
|
10
|
+
export function clearMetaAction(
|
|
11
|
+
state: DataDictionaryState,
|
|
12
|
+
payload: ClearMetaPayload
|
|
13
|
+
): DataDictionaryState {
|
|
14
|
+
return {
|
|
15
|
+
...state,
|
|
16
|
+
meta: payload,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataDictionaryActionKind } from "../types";
|
|
2
|
+
import { ClearMetaAction } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Action creator for clearing meta in the state.
|
|
6
|
+
* @returns Action with payload and action type.
|
|
7
|
+
*/
|
|
8
|
+
export function clearMeta(): ClearMetaAction {
|
|
9
|
+
return {
|
|
10
|
+
payload: null,
|
|
11
|
+
type: DataDictionaryActionKind.ClearMeta,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { META_COMMAND } from "../../../../hooks/stateSyncManager/hooks/UseMetaCommands/types";
|
|
2
|
+
import { DataDictionaryState } from "../../types";
|
|
3
|
+
import { ROUTER_METHOD, StateToUrlPayload } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reducer function to handle the "state >> URL sync" action.
|
|
7
|
+
* @param state - State.
|
|
8
|
+
* @param payload - Payload.
|
|
9
|
+
* @returns state.
|
|
10
|
+
*/
|
|
11
|
+
export function stateToUrlAction(
|
|
12
|
+
state: DataDictionaryState,
|
|
13
|
+
payload: StateToUrlPayload
|
|
14
|
+
): DataDictionaryState {
|
|
15
|
+
const command =
|
|
16
|
+
payload.method === ROUTER_METHOD.PUSH
|
|
17
|
+
? META_COMMAND.STATE_TO_URL_PUSH
|
|
18
|
+
: META_COMMAND.STATE_TO_URL_REPLACE;
|
|
19
|
+
return { ...state, meta: { command } };
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataDictionaryActionKind } from "../types";
|
|
2
|
+
import { StateToUrlAction, StateToUrlPayload } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Action creator for state >> URL sync.
|
|
6
|
+
* @param payload - Payload.
|
|
7
|
+
* @returns Action with payload and action type.
|
|
8
|
+
*/
|
|
9
|
+
export function stateToUrl(payload: StateToUrlPayload): StateToUrlAction {
|
|
10
|
+
return {
|
|
11
|
+
payload,
|
|
12
|
+
type: DataDictionaryActionKind.StateToUrl,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataDictionaryActionKind } from "../types";
|
|
2
|
+
|
|
3
|
+
export enum ROUTER_METHOD {
|
|
4
|
+
PUSH = "push",
|
|
5
|
+
REPLACE = "replace",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type StateToUrlAction = {
|
|
9
|
+
payload: StateToUrlPayload;
|
|
10
|
+
type: DataDictionaryActionKind.StateToUrl;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type StateToUrlPayload = {
|
|
14
|
+
method: ROUTER_METHOD;
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ClearMetaAction } from "./clearMeta/types";
|
|
2
|
+
import { StateToUrlAction } from "./stateToUrl/types";
|
|
3
|
+
import { UpdateColumnFiltersAction } from "./updateColumnFilters/types";
|
|
4
|
+
import { UpdateGlobalFilterAction } from "./updateGlobalFilter/types";
|
|
5
|
+
import { UrlToStateAction } from "./urlToState/types";
|
|
6
|
+
|
|
7
|
+
export type DataDictionaryAction =
|
|
8
|
+
| ClearMetaAction
|
|
9
|
+
| StateToUrlAction
|
|
10
|
+
| UpdateColumnFiltersAction
|
|
11
|
+
| UpdateGlobalFilterAction
|
|
12
|
+
| UrlToStateAction;
|
|
13
|
+
|
|
14
|
+
export enum DataDictionaryActionKind {
|
|
15
|
+
ClearMeta = "CLEAR_META",
|
|
16
|
+
StateToUrl = "STATE_TO_URL",
|
|
17
|
+
UpdateColumnFilters = "UPDATE_COLUMN_FILTERS",
|
|
18
|
+
UpdateGlobalFilter = "UPDATE_GLOBAL_FILTER",
|
|
19
|
+
UrlToState = "URL_TO_STATE",
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { META_COMMAND } from "../../../../hooks/stateSyncManager/hooks/UseMetaCommands/types";
|
|
2
|
+
import { buildNextDictionaries } from "../../dictionaries/state";
|
|
3
|
+
import { DataDictionaryState } from "../../types";
|
|
4
|
+
import { UpdateColumnFiltersPayload } from "./types";
|
|
5
|
+
import { buildNextColumnFilters } from "./utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Reducer function to handle the "update column filters" action.
|
|
9
|
+
* @param state - Data dictionary state.
|
|
10
|
+
* @param payload - Payload.
|
|
11
|
+
* @returns data dictionary state.
|
|
12
|
+
*/
|
|
13
|
+
export function updateColumnFiltersAction(
|
|
14
|
+
state: DataDictionaryState,
|
|
15
|
+
payload: UpdateColumnFiltersPayload
|
|
16
|
+
): DataDictionaryState {
|
|
17
|
+
return {
|
|
18
|
+
...state,
|
|
19
|
+
dictionaries: buildNextDictionaries(state, payload.dictionary, {
|
|
20
|
+
columnFilters: buildNextColumnFilters(state, payload),
|
|
21
|
+
}),
|
|
22
|
+
meta: { command: META_COMMAND.STATE_TO_URL_PUSH },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataDictionaryActionKind } from "../types";
|
|
2
|
+
import { UpdateColumnFiltersAction, UpdateColumnFiltersPayload } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Action creator for updating column filters in the state.
|
|
6
|
+
* @param payload - Payload.
|
|
7
|
+
* @returns Action with payload and action type.
|
|
8
|
+
*/
|
|
9
|
+
export function updateColumnFilters(
|
|
10
|
+
payload: UpdateColumnFiltersPayload
|
|
11
|
+
): UpdateColumnFiltersAction {
|
|
12
|
+
return {
|
|
13
|
+
payload,
|
|
14
|
+
type: DataDictionaryActionKind.UpdateColumnFilters,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnFiltersState, Updater } from "@tanstack/react-table";
|
|
2
|
+
import { DataDictionaryActionKind } from "../types";
|
|
3
|
+
|
|
4
|
+
export type UpdateColumnFiltersAction = {
|
|
5
|
+
payload: UpdateColumnFiltersPayload;
|
|
6
|
+
type: DataDictionaryActionKind.UpdateColumnFilters;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export interface UpdateColumnFiltersPayload {
|
|
10
|
+
dictionary: string;
|
|
11
|
+
updaterOrValue: Updater<ColumnFiltersState>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ColumnFiltersState, functionalUpdate } from "@tanstack/react-table";
|
|
2
|
+
import { DataDictionaryState } from "../../types";
|
|
3
|
+
import { UpdateColumnFiltersPayload } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Builds the next column filters state for the current dictionary.
|
|
7
|
+
* Uses TanStack updater to update the column filters state.
|
|
8
|
+
* @param state - State.
|
|
9
|
+
* @param payload - Payload.
|
|
10
|
+
* @returns column filters state.
|
|
11
|
+
*/
|
|
12
|
+
export function buildNextColumnFilters(
|
|
13
|
+
state: DataDictionaryState,
|
|
14
|
+
payload: UpdateColumnFiltersPayload
|
|
15
|
+
): ColumnFiltersState {
|
|
16
|
+
return functionalUpdate(
|
|
17
|
+
payload.updaterOrValue,
|
|
18
|
+
getOldColumnFilters(state, payload)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the current "old" column filters state.
|
|
24
|
+
* @param state - State.
|
|
25
|
+
* @param payload - Payload.
|
|
26
|
+
* @returns old column filters state.
|
|
27
|
+
*/
|
|
28
|
+
function getOldColumnFilters(
|
|
29
|
+
state: DataDictionaryState,
|
|
30
|
+
payload: UpdateColumnFiltersPayload
|
|
31
|
+
): ColumnFiltersState {
|
|
32
|
+
// Grab the dictionary.
|
|
33
|
+
const dictionary = state.dictionaries[payload.dictionary];
|
|
34
|
+
|
|
35
|
+
// If the dictionary is not found, return an empty array.
|
|
36
|
+
if (!dictionary) return [];
|
|
37
|
+
|
|
38
|
+
// Grab column filters from dictionary state.
|
|
39
|
+
const { columnFilters = [] } = dictionary.state;
|
|
40
|
+
return columnFilters;
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { buildNextDictionaries } from "../../dictionaries/state";
|
|
2
|
+
import { DataDictionaryState } from "../../types";
|
|
3
|
+
import { UpdateGlobalFilterPayload } from "./types";
|
|
4
|
+
import { buildNextGlobalFilter, buildNextMeta } from "./utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reducer function to handle the "update global filter" action.
|
|
8
|
+
* @param state - State.
|
|
9
|
+
* @param payload - Payload.
|
|
10
|
+
* @returns state.
|
|
11
|
+
*/
|
|
12
|
+
export function updateGlobalFilterAction(
|
|
13
|
+
state: DataDictionaryState,
|
|
14
|
+
payload: UpdateGlobalFilterPayload
|
|
15
|
+
): DataDictionaryState {
|
|
16
|
+
const globalFilter = buildNextGlobalFilter(payload);
|
|
17
|
+
const meta = buildNextMeta(state, payload, globalFilter);
|
|
18
|
+
return {
|
|
19
|
+
...state,
|
|
20
|
+
dictionaries: buildNextDictionaries(state, payload.dictionary, {
|
|
21
|
+
globalFilter,
|
|
22
|
+
}),
|
|
23
|
+
meta,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataDictionaryActionKind } from "../types";
|
|
2
|
+
import { UpdateGlobalFilterAction, UpdateGlobalFilterPayload } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Action creator for updating global filter in the state.
|
|
6
|
+
* @param payload - Payload.
|
|
7
|
+
* @returns Action with payload and action type.
|
|
8
|
+
*/
|
|
9
|
+
export function updateGlobalFilter(
|
|
10
|
+
payload: UpdateGlobalFilterPayload
|
|
11
|
+
): UpdateGlobalFilterAction {
|
|
12
|
+
return {
|
|
13
|
+
payload,
|
|
14
|
+
type: DataDictionaryActionKind.UpdateGlobalFilter,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Updater } from "@tanstack/react-table";
|
|
2
|
+
import { DataDictionaryActionKind } from "../types";
|
|
3
|
+
|
|
4
|
+
export type UpdateGlobalFilterAction = {
|
|
5
|
+
payload: UpdateGlobalFilterPayload;
|
|
6
|
+
type: DataDictionaryActionKind.UpdateGlobalFilter;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export interface UpdateGlobalFilterPayload {
|
|
10
|
+
dictionary: string;
|
|
11
|
+
updaterOrValue: Updater<string | undefined>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { functionalUpdate } from "@tanstack/react-table";
|
|
2
|
+
import { META_COMMAND } from "../../../../hooks/stateSyncManager/hooks/UseMetaCommands/types";
|
|
3
|
+
import { DataDictionaryState } from "../../types";
|
|
4
|
+
import { UpdateGlobalFilterPayload } from "./types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Builds the next global filter state for the current dictionary.
|
|
8
|
+
* Uses TanStack updater to update the global filter state.
|
|
9
|
+
* @param payload - Payload.
|
|
10
|
+
* @returns global filter state.
|
|
11
|
+
*/
|
|
12
|
+
export function buildNextGlobalFilter(
|
|
13
|
+
payload: UpdateGlobalFilterPayload
|
|
14
|
+
): string | undefined {
|
|
15
|
+
return functionalUpdate(payload.updaterOrValue, undefined) || undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Builds the next meta state for the current dictionary.
|
|
20
|
+
* @param state - State.
|
|
21
|
+
* @param payload - Payload.
|
|
22
|
+
* @param nextGlobalFilter - Next global filter.
|
|
23
|
+
* @returns meta state.
|
|
24
|
+
*/
|
|
25
|
+
export function buildNextMeta(
|
|
26
|
+
state: DataDictionaryState,
|
|
27
|
+
payload: UpdateGlobalFilterPayload,
|
|
28
|
+
nextGlobalFilter: string | undefined
|
|
29
|
+
): DataDictionaryState["meta"] {
|
|
30
|
+
const currentGlobalFilter = getCurrentGlobalFilter(state, payload);
|
|
31
|
+
// Use PUSH method with adding or removing the global filter.
|
|
32
|
+
if (currentGlobalFilter === undefined || nextGlobalFilter === undefined) {
|
|
33
|
+
return { command: META_COMMAND.STATE_TO_URL_PUSH };
|
|
34
|
+
}
|
|
35
|
+
// Use REPLACE method with edits to the global filter.
|
|
36
|
+
return { command: META_COMMAND.STATE_TO_URL_REPLACE };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the current global filter for the current dictionary.
|
|
41
|
+
* @param state - State.
|
|
42
|
+
* @param payload - Payload.
|
|
43
|
+
* @returns global filter.
|
|
44
|
+
*/
|
|
45
|
+
function getCurrentGlobalFilter(
|
|
46
|
+
state: DataDictionaryState,
|
|
47
|
+
payload: UpdateGlobalFilterPayload
|
|
48
|
+
): string | undefined {
|
|
49
|
+
return state.dictionaries[payload.dictionary].state.globalFilter;
|
|
50
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { parseJsonQueryParam } from "../../../../utils/parseJsonQueryParam";
|
|
2
|
+
import { DATA_DICTIONARY_URL_PARAMS } from "../../dictionaries/constants";
|
|
3
|
+
import { buildNextDictionaries } from "../../dictionaries/state";
|
|
4
|
+
import { DataDictionaryState } from "../../types";
|
|
5
|
+
import { UrlToStatePayload } from "./types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Reducer function to handle the "URL >> state sync" action.
|
|
9
|
+
* @param state - State.
|
|
10
|
+
* @param payload - Payload.
|
|
11
|
+
* @returns state.
|
|
12
|
+
*/
|
|
13
|
+
export function urlToStateAction(
|
|
14
|
+
state: DataDictionaryState,
|
|
15
|
+
payload: UrlToStatePayload
|
|
16
|
+
): DataDictionaryState {
|
|
17
|
+
if (typeof payload.query.dictionary !== "string") return state;
|
|
18
|
+
return {
|
|
19
|
+
...state,
|
|
20
|
+
dictionaries: buildNextDictionaries(state, payload.query.dictionary, {
|
|
21
|
+
columnFilters: parseJsonQueryParam(
|
|
22
|
+
payload.query[DATA_DICTIONARY_URL_PARAMS.COLUMN_FILTERS],
|
|
23
|
+
[]
|
|
24
|
+
),
|
|
25
|
+
globalFilter: payload.query[DATA_DICTIONARY_URL_PARAMS.GLOBAL_FILTER],
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataDictionaryActionKind } from "../types";
|
|
2
|
+
import { UrlToStateAction, UrlToStatePayload } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Action creator for URL >> state sync.
|
|
6
|
+
* @param payload - Payload.
|
|
7
|
+
* @returns Action with payload and action type.
|
|
8
|
+
*/
|
|
9
|
+
export function urlToState(payload: UrlToStatePayload): UrlToStateAction {
|
|
10
|
+
return {
|
|
11
|
+
payload,
|
|
12
|
+
type: DataDictionaryActionKind.UrlToState,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NextRouter } from "next/router";
|
|
2
|
+
import { DataDictionaryActionKind } from "../types";
|
|
3
|
+
|
|
4
|
+
export type UrlToStateAction = {
|
|
5
|
+
payload: UrlToStatePayload;
|
|
6
|
+
type: DataDictionaryActionKind.UrlToState;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type UrlToStatePayload = {
|
|
10
|
+
query: NextRouter["query"];
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
import { INITIAL_DATA_DICTIONARY_STATE } from "./initializer/constants";
|
|
3
|
+
import { DataDictionaryStateContextProps } from "./types";
|
|
4
|
+
|
|
5
|
+
export const DataDictionaryStateContext =
|
|
6
|
+
createContext<DataDictionaryStateContextProps>({
|
|
7
|
+
dataDictionaryDispatch: null,
|
|
8
|
+
dataDictionaryState: INITIAL_DATA_DICTIONARY_STATE,
|
|
9
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { TableState } from "@tanstack/react-table";
|
|
2
|
+
import { stateToUrlQuery } from "../../../utils/stateToUrlQuery";
|
|
3
|
+
import { DataDictionaryState } from "../types";
|
|
4
|
+
import { DictionariesContext } from "./types";
|
|
5
|
+
import { extractDictionaryUrlState as extractUrlState } from "./utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Builds the next dictionaries context.
|
|
9
|
+
* @param state - State.
|
|
10
|
+
* @param dictionaryKey - Dictionary key.
|
|
11
|
+
* @param nextDictionaryState - Next dictionary state.
|
|
12
|
+
* @returns Next dictionaries context.
|
|
13
|
+
*/
|
|
14
|
+
export function buildNextDictionaries(
|
|
15
|
+
state: DataDictionaryState,
|
|
16
|
+
dictionaryKey: string,
|
|
17
|
+
nextDictionaryState: Partial<TableState>
|
|
18
|
+
): DictionariesContext {
|
|
19
|
+
// Clone the dictionaries.
|
|
20
|
+
const dictionaries: DictionariesContext = { ...state.dictionaries };
|
|
21
|
+
|
|
22
|
+
for (const [key, dictionary] of Object.entries(dictionaries)) {
|
|
23
|
+
// Clone the dictionary context.
|
|
24
|
+
const dictionaryContext = { ...dictionary };
|
|
25
|
+
|
|
26
|
+
// If the dictionary key is a match, update the dictionary context.
|
|
27
|
+
if (key === dictionaryKey) {
|
|
28
|
+
// Update the dictionary state.
|
|
29
|
+
dictionaryContext.state = { ...dictionary.state, ...nextDictionaryState };
|
|
30
|
+
|
|
31
|
+
// Grab param values from the updated dictionary state.
|
|
32
|
+
const { columnFilters, globalFilter } = dictionaryContext.state;
|
|
33
|
+
|
|
34
|
+
// Update the dictionary query.
|
|
35
|
+
dictionaryContext.query = stateToUrlQuery(
|
|
36
|
+
extractUrlState(key, { columnFilters, globalFilter })
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Update the dictionary context.
|
|
41
|
+
dictionaries[key] = dictionaryContext;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return dictionaries;
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TableState } from "@tanstack/react-table";
|
|
2
|
+
import { NextRouter } from "next/router";
|
|
3
|
+
|
|
4
|
+
export interface DictionariesContext {
|
|
5
|
+
[key: string]: DictionaryContext;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DictionaryContext {
|
|
9
|
+
query: NextRouter["query"];
|
|
10
|
+
state: Partial<TableState>;
|
|
11
|
+
}
|