@databiosphere/findable-ui 29.0.2 → 31.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 +35 -0
- package/lib/common/categories/config/types.d.ts +28 -0
- package/lib/common/categories/config/utils.d.ts +31 -0
- package/lib/common/categories/config/utils.js +29 -0
- package/lib/common/categories/models/range/typeGuards.d.ts +14 -0
- package/lib/common/categories/models/range/typeGuards.js +18 -0
- package/lib/common/categories/models/range/types.d.ts +15 -0
- package/lib/common/categories/models/range/types.js +1 -0
- package/lib/common/categories/models/range/utils.d.ts +23 -0
- package/lib/common/categories/models/range/utils.js +41 -0
- package/lib/common/categories/models/select/utils.d.ts +8 -0
- package/lib/common/categories/models/select/utils.js +16 -0
- package/lib/common/categories/models/types.d.ts +6 -0
- package/lib/common/categories/models/types.js +1 -0
- package/lib/common/categories/views/common/types.d.ts +10 -0
- package/lib/common/categories/views/common/types.js +1 -0
- package/lib/common/categories/views/range/typeGuards.d.ts +8 -0
- package/lib/common/categories/views/range/typeGuards.js +8 -0
- package/lib/common/categories/views/range/types.d.ts +19 -0
- package/lib/common/categories/views/range/types.js +1 -0
- package/lib/common/categories/views/range/utils.d.ts +12 -0
- package/lib/common/categories/views/range/utils.js +24 -0
- package/lib/common/categories/views/select/typeGuards.d.ts +8 -0
- package/lib/common/categories/views/select/typeGuards.js +8 -0
- package/lib/common/categories/views/select/types.d.ts +7 -0
- package/lib/common/categories/views/select/types.js +1 -0
- package/lib/common/categories/views/types.d.ts +13 -0
- package/lib/common/categories/views/types.js +8 -0
- package/lib/common/entities.d.ts +8 -23
- package/lib/components/DataDictionary/components/Entities/entities.d.ts +3 -1
- package/lib/components/DataDictionary/components/Entities/entities.js +1 -1
- package/lib/components/DataDictionary/components/Entities/types.d.ts +5 -5
- package/lib/components/DataDictionary/components/Entity/entity.d.ts +3 -1
- package/lib/components/DataDictionary/components/Entity/entity.js +6 -6
- package/lib/components/DataDictionary/components/Entity/types.d.ts +5 -5
- package/lib/components/DataDictionary/components/Outline/utils.d.ts +3 -2
- package/lib/components/DataDictionary/components/Table/components/BasicCell/basicCell.d.ts +3 -2
- package/lib/components/DataDictionary/components/Table/components/BasicCell/basicCell.js +6 -2
- package/lib/components/DataDictionary/components/Table/components/BasicCell/utils.d.ts +9 -0
- package/lib/components/DataDictionary/components/Table/components/BasicCell/utils.js +12 -0
- package/lib/components/DataDictionary/components/Table/hook.d.ts +3 -3
- package/lib/components/DataDictionary/components/Table/hook.js +3 -1
- package/lib/components/DataDictionary/components/Table/options/core/constants.d.ts +2 -3
- package/lib/components/DataDictionary/components/Table/options/hook.d.ts +2 -2
- package/lib/components/DataDictionary/components/Table/options/sorting/constants.d.ts +2 -3
- package/lib/components/DataDictionary/components/Table/table.d.ts +2 -1
- package/lib/components/DataDictionary/components/Table/table.js +1 -1
- package/lib/components/DataDictionary/components/Table/types.d.ts +3 -4
- package/lib/components/DataDictionary/dataDictionary.d.ts +3 -1
- package/lib/components/DataDictionary/dataDictionary.styles.js +2 -3
- package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.d.ts +3 -1
- package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +5 -5
- package/lib/components/Filter/components/Filter/filter.d.ts +2 -2
- package/lib/components/Filter/components/Filter/filter.js +11 -3
- package/lib/components/Filter/components/Filter/stories/args.d.ts +5 -0
- package/lib/components/Filter/components/Filter/stories/args.js +19 -0
- package/lib/components/Filter/components/Filter/stories/filter.stories.d.ts +8 -0
- package/lib/components/Filter/components/Filter/stories/filter.stories.js +21 -0
- package/lib/components/Filter/components/FilterMenu/filterMenu.js +2 -2
- package/lib/components/Filter/components/FilterMenu/filterMenu.styles.d.ts +1 -1
- package/lib/components/Filter/components/FilterMenu/filterMenu.styles.js +1 -1
- package/lib/components/Filter/components/FilterRange/constants.d.ts +0 -2
- package/lib/components/Filter/components/FilterRange/constants.js +0 -5
- package/lib/components/Filter/components/FilterRange/filterRange.d.ts +1 -1
- package/lib/components/Filter/components/FilterRange/filterRange.js +50 -21
- package/lib/components/Filter/components/FilterRange/filterRange.styles.js +58 -10
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/constants.d.ts +5 -0
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/constants.js +5 -0
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.d.ts +2 -2
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.js +32 -7
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/schema.d.ts +6 -0
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/schema.js +50 -0
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/types.d.ts +26 -3
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/types.js +6 -1
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/utils.d.ts +15 -0
- package/lib/components/Filter/components/FilterRange/hooks/UseFilterRange/utils.js +25 -0
- package/lib/components/Filter/components/FilterRange/stories/args.d.ts +3 -0
- package/lib/components/Filter/components/FilterRange/stories/args.js +13 -0
- package/lib/components/Filter/components/FilterRange/stories/filterRange.stories.js +2 -2
- package/lib/components/Filter/components/FilterRange/types.d.ts +10 -6
- package/lib/components/Filter/components/FilterRange/types.js +1 -6
- package/lib/components/Filter/components/FilterRange/utils.d.ts +8 -0
- package/lib/components/Filter/components/FilterRange/utils.js +15 -0
- package/lib/components/Filter/components/FilterTag/stories/args.d.ts +5 -0
- package/lib/components/Filter/components/FilterTag/stories/args.js +17 -0
- package/lib/components/Filter/components/FilterTag/stories/filterTag.stories.d.ts +8 -0
- package/lib/components/Filter/components/FilterTag/stories/filterTag.stories.js +21 -0
- package/lib/components/Filter/components/FilterTag/utils.d.ts +10 -0
- package/lib/components/Filter/components/FilterTag/utils.js +40 -0
- package/lib/components/Filter/components/Filters/filters.d.ts +2 -2
- package/lib/components/Filter/components/Filters/filters.js +15 -8
- package/lib/components/Filter/components/Filters/stories/args.d.ts +3 -0
- package/lib/components/Filter/components/Filters/stories/args.js +15 -0
- package/lib/components/Filter/components/Filters/stories/constants.d.ts +22 -0
- package/lib/components/Filter/components/Filters/stories/constants.js +134 -0
- package/lib/components/Filter/components/Filters/stories/filters.stories.d.ts +6 -0
- package/lib/components/Filter/components/Filters/stories/filters.stories.js +15 -0
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.d.ts +1 -1
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.js +5 -5
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeListItem/variableSizeListItem.js +2 -1
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.d.ts +3 -2
- package/lib/components/Filter/components/SearchAllFilters/searchAllFilters.js +6 -4
- package/lib/components/Filter/components/VariableSizeListItem/variableSizeListItem.js +2 -1
- package/lib/components/Index/components/EntitiesView/components/ChartView/utils.js +2 -0
- package/lib/components/Index/table/hook.js +4 -0
- package/lib/components/MarkdownRenderer/components/Anchor/anchor.d.ts +19 -0
- package/lib/components/MarkdownRenderer/components/Anchor/anchor.js +21 -0
- package/lib/components/MarkdownRenderer/components/Table/table.d.ts +3 -0
- package/lib/components/MarkdownRenderer/components/Table/table.js +5 -0
- package/lib/components/MarkdownRenderer/components/Table/table.styles.d.ts +4 -0
- package/lib/components/MarkdownRenderer/components/Table/table.styles.js +40 -0
- package/lib/components/MarkdownRenderer/constants.d.ts +2 -0
- package/lib/components/MarkdownRenderer/constants.js +6 -0
- package/lib/components/MarkdownRenderer/markdownRenderer.d.ts +2 -0
- package/lib/components/MarkdownRenderer/markdownRenderer.js +45 -0
- package/lib/components/MarkdownRenderer/markdownRenderer.styles.d.ts +4 -0
- package/lib/components/MarkdownRenderer/markdownRenderer.styles.js +13 -0
- package/lib/components/MarkdownRenderer/types.d.ts +6 -0
- package/lib/components/MarkdownRenderer/types.js +1 -0
- package/lib/components/Table/columnDef/accessorFn/typeGuards.d.ts +9 -0
- package/lib/components/Table/columnDef/accessorFn/typeGuards.js +10 -0
- package/lib/components/Table/common/utils.d.ts +2 -2
- package/lib/components/Table/common/utils.js +28 -13
- package/lib/components/Table/components/TableCell/components/ChipCell/chipCell.d.ts +4 -0
- package/lib/components/Table/components/TableCell/components/ChipCell/chipCell.js +8 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/linkCell.d.ts +4 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/linkCell.js +21 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/stories/args.d.ts +6 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/stories/args.js +27 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.d.ts +9 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.js +18 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/stories/types.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/stories/types.js +1 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/utils.d.ts +22 -0
- package/lib/components/Table/components/TableCell/components/LinkCell/utils.js +45 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.d.ts +4 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.js +13 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.js +30 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/args.d.ts +4 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/args.js +10 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/constants.d.ts +5 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/constants.js +9 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.d.ts +7 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.js +25 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/types.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/types.js +1 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/types.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/MarkdownCell/types.js +1 -0
- package/lib/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues.d.ts +8 -0
- package/lib/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues.js +46 -0
- package/lib/components/common/Link/typeGuards.d.ts +13 -0
- package/lib/components/common/Link/typeGuards.js +21 -0
- package/lib/config/entities.d.ts +2 -11
- package/lib/hooks/useCategoryFilter.d.ts +8 -13
- package/lib/hooks/useCategoryFilter.js +31 -28
- package/lib/providers/exploreState/entities.d.ts +5 -3
- package/lib/providers/exploreState/payloads/entities.d.ts +6 -2
- package/lib/providers/exploreState.d.ts +3 -2
- package/lib/providers/exploreState.js +1 -1
- package/lib/styles/common/mui/typography.js +1 -0
- package/lib/tests/utils.d.ts +24 -0
- package/lib/tests/utils.js +34 -0
- package/lib/theme/common/components.js +19 -1
- package/lib/views/ExploreView/exploreView.js +10 -8
- package/package.json +7 -1
- package/src/common/categories/config/types.ts +42 -0
- package/src/common/categories/config/utils.ts +47 -0
- package/src/common/categories/models/range/typeGuards.ts +24 -0
- package/src/common/categories/models/range/types.ts +17 -0
- package/src/common/categories/models/range/utils.ts +51 -0
- package/src/common/categories/models/select/utils.ts +23 -0
- package/src/common/categories/models/types.ts +7 -0
- package/src/common/categories/views/common/types.ts +11 -0
- package/src/common/categories/views/range/typeGuards.ts +13 -0
- package/src/common/categories/views/range/types.ts +21 -0
- package/src/common/categories/views/range/utils.ts +35 -0
- package/src/common/categories/views/select/typeGuards.ts +13 -0
- package/src/common/categories/views/select/types.ts +8 -0
- package/src/common/categories/views/types.ts +15 -0
- package/src/common/entities.ts +8 -26
- package/src/components/DataDictionary/components/Entities/entities.tsx +7 -5
- package/src/components/DataDictionary/components/Entities/types.ts +5 -9
- package/src/components/DataDictionary/components/Entity/entity.tsx +9 -7
- package/src/components/DataDictionary/components/Entity/types.ts +5 -9
- package/src/components/DataDictionary/components/Outline/utils.ts +5 -2
- package/src/components/DataDictionary/components/Table/components/BasicCell/basicCell.tsx +12 -4
- package/src/components/DataDictionary/components/Table/components/BasicCell/utils.ts +13 -0
- package/src/components/DataDictionary/components/Table/hook.ts +16 -8
- package/src/components/DataDictionary/components/Table/options/core/constants.ts +2 -3
- package/src/components/DataDictionary/components/Table/options/hook.ts +3 -3
- package/src/components/DataDictionary/components/Table/options/sorting/constants.ts +2 -6
- package/src/components/DataDictionary/components/Table/table.tsx +4 -1
- package/src/components/DataDictionary/components/Table/types.ts +3 -4
- package/src/components/DataDictionary/dataDictionary.styles.ts +2 -3
- package/src/components/DataDictionary/dataDictionary.tsx +4 -2
- package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +9 -2
- package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +5 -9
- package/src/components/Filter/components/Filter/filter.tsx +38 -13
- package/src/components/Filter/components/Filter/stories/args.ts +24 -0
- package/src/components/Filter/components/Filter/stories/filter.stories.tsx +32 -0
- package/src/components/Filter/components/FilterMenu/filterMenu.styles.ts +1 -1
- package/src/components/Filter/components/FilterMenu/filterMenu.tsx +7 -3
- package/src/components/Filter/components/FilterRange/constants.ts +0 -7
- package/src/components/Filter/components/FilterRange/filterRange.styles.ts +58 -14
- package/src/components/Filter/components/FilterRange/filterRange.tsx +112 -40
- package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/constants.ts +5 -0
- package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/hook.ts +51 -10
- package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/schema.ts +60 -0
- package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/types.ts +34 -3
- package/src/components/Filter/components/FilterRange/hooks/UseFilterRange/utils.ts +32 -0
- package/src/components/Filter/components/FilterRange/stories/args.ts +16 -0
- package/src/components/Filter/components/FilterRange/stories/filterRange.stories.tsx +2 -2
- package/src/components/Filter/components/FilterRange/types.ts +12 -6
- package/src/components/Filter/components/FilterRange/utils.ts +16 -0
- package/src/components/Filter/components/FilterTag/stories/args.ts +22 -0
- package/src/components/Filter/components/FilterTag/stories/filterTag.stories.tsx +32 -0
- package/src/components/Filter/components/FilterTag/utils.ts +57 -0
- package/src/components/Filter/components/Filters/filters.tsx +21 -12
- package/src/components/Filter/components/Filters/stories/args.ts +24 -0
- package/src/components/Filter/components/Filters/stories/constants.ts +151 -0
- package/src/components/Filter/components/Filters/stories/filters.stories.tsx +24 -0
- package/src/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.tsx +32 -29
- package/src/components/Filter/components/SearchAllFilters/components/VariableSizeListItem/variableSizeListItem.tsx +9 -1
- package/src/components/Filter/components/SearchAllFilters/searchAllFilters.tsx +12 -6
- package/src/components/Filter/components/VariableSizeListItem/variableSizeListItem.tsx +2 -1
- package/src/components/Index/components/EntitiesView/components/ChartView/utils.ts +2 -0
- package/src/components/Index/table/hook.ts +4 -0
- package/src/components/MarkdownRenderer/components/Anchor/anchor.tsx +34 -0
- package/src/components/MarkdownRenderer/components/Table/table.styles.ts +41 -0
- package/src/components/MarkdownRenderer/components/Table/table.tsx +13 -0
- package/src/components/MarkdownRenderer/constants.ts +8 -0
- package/src/components/MarkdownRenderer/markdownRenderer.styles.ts +16 -0
- package/src/components/MarkdownRenderer/markdownRenderer.tsx +62 -0
- package/src/components/MarkdownRenderer/types.ts +7 -0
- package/src/components/Table/columnDef/accessorFn/typeGuards.ts +15 -0
- package/src/components/Table/common/utils.ts +37 -16
- package/src/components/Table/components/TableCell/components/ChipCell/chipCell.tsx +16 -0
- package/src/components/Table/components/TableCell/components/LinkCell/linkCell.tsx +64 -0
- package/src/components/Table/components/TableCell/components/LinkCell/stories/args.ts +35 -0
- package/src/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.tsx +32 -0
- package/src/components/Table/components/TableCell/components/LinkCell/stories/types.ts +4 -0
- package/src/components/Table/components/TableCell/components/LinkCell/utils.ts +59 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.ts +31 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.tsx +29 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/stories/args.ts +17 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/stories/constants.ts +11 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.tsx +37 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/stories/types.ts +4 -0
- package/src/components/Table/components/TableCell/components/MarkdownCell/types.ts +3 -0
- package/src/components/Table/featureOptions/facetedColumn/getFacetedMinMaxValues.ts +64 -0
- package/src/components/common/Link/typeGuards.ts +35 -0
- package/src/config/entities.ts +1 -14
- package/src/hooks/useCategoryFilter.ts +56 -53
- package/src/providers/exploreState/entities.ts +3 -3
- package/src/providers/exploreState/initializer/utils.ts +1 -1
- package/src/providers/exploreState/payloads/entities.ts +5 -2
- package/src/providers/exploreState.tsx +5 -3
- package/src/styles/common/mui/typography.ts +1 -0
- package/src/tests/utils.ts +44 -0
- package/src/theme/common/components.ts +19 -1
- package/src/views/ExploreView/exploreView.tsx +17 -22
- package/tests/filter.test.tsx +100 -0
- package/tests/filterRange.test.tsx +331 -46
- package/tests/filters.test.tsx +61 -0
- package/tests/getFacetedMinMaxValues.test.ts +166 -0
- package/tests/linkCell.test.tsx +89 -0
- package/tests/markdownCell.test.tsx +53 -0
- package/types/data-explorer-ui.d.ts +2 -0
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +0 -3
- package/lib/components/Filter/components/Filter/filter.stories.d.ts +0 -25
- package/lib/components/Filter/components/Filter/filter.stories.js +0 -42
- package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +0 -16
- package/lib/components/Filter/components/FilterTag/filterTag.stories.js +0 -17
- package/lib/components/Filter/components/Filters/filters.stories.d.ts +0 -6
- package/lib/components/Filter/components/Filters/filters.stories.js +0 -91
- package/src/components/DataDictionary/components/Table/components/BasicCell/types.ts +0 -7
- package/src/components/Filter/components/Filter/filter.stories.tsx +0 -52
- package/src/components/Filter/components/FilterTag/filterTag.stories.tsx +0 -23
- package/src/components/Filter/components/Filters/filters.stories.tsx +0 -101
- package/tests/filterRangeMock.test.tsx +0 -38
- /package/lib/{components/DataDictionary/components/Table/components/BasicCell → common/categories/config}/types.js +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
sortingFns,
|
|
10
10
|
Table,
|
|
11
11
|
} from "@tanstack/react-table";
|
|
12
|
-
import {
|
|
12
|
+
import { Category } from "../../../common/categories/models/types";
|
|
13
13
|
import { EXPLORE_MODE, ExploreMode } from "../../../hooks/useExploreMode/types";
|
|
14
14
|
import { COLUMN_IDENTIFIER } from "./columnIdentifier";
|
|
15
15
|
|
|
@@ -38,26 +38,47 @@ type TableData = number | string | string[];
|
|
|
38
38
|
export function buildCategoryViews<T extends RowData>(
|
|
39
39
|
columns: Column<T>[],
|
|
40
40
|
columnFilters: ColumnFiltersState
|
|
41
|
-
):
|
|
42
|
-
const categoryViews:
|
|
41
|
+
): Category[] {
|
|
42
|
+
const categoryViews: Category[] = [];
|
|
43
43
|
for (const column of columns) {
|
|
44
|
-
const {
|
|
44
|
+
const {
|
|
45
|
+
columnDef,
|
|
46
|
+
getCanFilter,
|
|
47
|
+
getFacetedMinMaxValues,
|
|
48
|
+
getFacetedUniqueValues,
|
|
49
|
+
id,
|
|
50
|
+
} = column;
|
|
45
51
|
const { header: columnHeader } = columnDef;
|
|
46
52
|
if (getCanFilter()) {
|
|
47
|
-
updateFacetedUniqueValues(getFacetedUniqueValues(), columnFilters, id);
|
|
48
53
|
const key = id;
|
|
49
54
|
const label = columnHeader as string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
// Handle range categories.
|
|
56
|
+
if (columnDef.filterFn === "inNumberRange") {
|
|
57
|
+
const minMax = getFacetedMinMaxValues();
|
|
58
|
+
categoryViews.push({
|
|
59
|
+
key,
|
|
60
|
+
label,
|
|
61
|
+
max: minMax?.[1] || Infinity,
|
|
62
|
+
min: minMax?.[0] || -Infinity,
|
|
63
|
+
selectedMax: null, // Selected state updated in reducer.
|
|
64
|
+
selectedMin: null, // Selected state updated in reducer.
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Handle select categories.
|
|
68
|
+
if (columnDef.filterFn === "arrIncludesSome") {
|
|
69
|
+
updateFacetedUniqueValues(getFacetedUniqueValues(), columnFilters, id);
|
|
70
|
+
const values = [...getFacetedUniqueValues()].map(([value, count]) => ({
|
|
71
|
+
count,
|
|
72
|
+
key: value,
|
|
73
|
+
label: String(value ?? ""),
|
|
74
|
+
selected: false, // Selected state updated in reducer.
|
|
75
|
+
}));
|
|
76
|
+
categoryViews.push({
|
|
77
|
+
key,
|
|
78
|
+
label,
|
|
79
|
+
values: values,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
61
82
|
}
|
|
62
83
|
}
|
|
63
84
|
return categoryViews;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Chip, ChipProps } from "@mui/material";
|
|
2
|
+
import { CellContext, RowData } from "@tanstack/react-table";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { BaseComponentProps } from "../../../../../types";
|
|
5
|
+
|
|
6
|
+
export const ChipCell = <
|
|
7
|
+
T extends RowData,
|
|
8
|
+
TValue extends ChipProps = ChipProps
|
|
9
|
+
>({
|
|
10
|
+
className,
|
|
11
|
+
getValue,
|
|
12
|
+
}: BaseComponentProps & CellContext<T, TValue>): JSX.Element | null => {
|
|
13
|
+
const props = getValue();
|
|
14
|
+
if (!props) return null;
|
|
15
|
+
return <Chip className={className} {...props} />;
|
|
16
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LinkProps, Link as MLink, Typography } from "@mui/material";
|
|
2
|
+
import { CellContext, RowData } from "@tanstack/react-table";
|
|
3
|
+
import { BaseComponentProps } from "components/types";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { isValidUrl } from "../../../../../../common/utils";
|
|
6
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../../styles/common/mui/typography";
|
|
7
|
+
import { isClientSideNavigation } from "../../../../../Links/common/utils";
|
|
8
|
+
import { getComponent, getRelAttribute, getTargetAttribute } from "./utils";
|
|
9
|
+
|
|
10
|
+
export const LinkCell = <
|
|
11
|
+
T extends RowData,
|
|
12
|
+
TValue extends LinkProps = LinkProps
|
|
13
|
+
>({
|
|
14
|
+
className,
|
|
15
|
+
getValue,
|
|
16
|
+
}: BaseComponentProps & CellContext<T, TValue>): JSX.Element | null => {
|
|
17
|
+
const props = getValue();
|
|
18
|
+
if (!props) return null;
|
|
19
|
+
const {
|
|
20
|
+
children,
|
|
21
|
+
color,
|
|
22
|
+
href = "",
|
|
23
|
+
rel,
|
|
24
|
+
target,
|
|
25
|
+
underline,
|
|
26
|
+
...linkProps
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
// Determine if the href should use client-side navigation.
|
|
30
|
+
const isClientSide = isClientSideNavigation(href);
|
|
31
|
+
|
|
32
|
+
// Determine if the href is valid.
|
|
33
|
+
const isValid = isClientSide || isValidUrl(href);
|
|
34
|
+
|
|
35
|
+
// If the href is invalid, return a Typography component.
|
|
36
|
+
if (!isValid)
|
|
37
|
+
return (
|
|
38
|
+
<Typography
|
|
39
|
+
className={className}
|
|
40
|
+
color={TYPOGRAPHY_PROPS.COLOR.INHERIT}
|
|
41
|
+
component="span"
|
|
42
|
+
variant={TYPOGRAPHY_PROPS.VARIANT.INHERIT}
|
|
43
|
+
{...linkProps}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</Typography>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// If the href is valid, return a Link component.
|
|
50
|
+
return (
|
|
51
|
+
<MLink
|
|
52
|
+
className={className}
|
|
53
|
+
color={color}
|
|
54
|
+
component={getComponent(href, isClientSide)}
|
|
55
|
+
href={href}
|
|
56
|
+
rel={getRelAttribute(rel, isClientSide)}
|
|
57
|
+
target={getTargetAttribute(target, isClientSide)}
|
|
58
|
+
underline={underline}
|
|
59
|
+
{...linkProps}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</MLink>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../../../styles/common/mui/typography";
|
|
3
|
+
import { LinkCell } from "../linkCell";
|
|
4
|
+
import { GetValue } from "./types";
|
|
5
|
+
|
|
6
|
+
export const CLIENT_SIDE_ARGS: Partial<ComponentProps<typeof LinkCell>> = {
|
|
7
|
+
getValue: (() => ({
|
|
8
|
+
children: "Explore",
|
|
9
|
+
href: "/",
|
|
10
|
+
})) as GetValue,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const EXTERNAL_ARGS: Partial<ComponentProps<typeof LinkCell>> = {
|
|
14
|
+
getValue: (() => ({
|
|
15
|
+
children: "Explore",
|
|
16
|
+
href: "https://www.example.com",
|
|
17
|
+
})) as GetValue,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const INVALID_ARGS: Partial<ComponentProps<typeof LinkCell>> = {
|
|
21
|
+
getValue: (() => ({
|
|
22
|
+
children: "Explore",
|
|
23
|
+
})) as GetValue,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const WITH_CUSTOM_STYLE_ARGS: Partial<ComponentProps<typeof LinkCell>> =
|
|
27
|
+
{
|
|
28
|
+
getValue: (() => ({
|
|
29
|
+
children: "Explore",
|
|
30
|
+
color: "success",
|
|
31
|
+
href: "/",
|
|
32
|
+
underline: "none",
|
|
33
|
+
variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_SMALL_400,
|
|
34
|
+
})) as GetValue,
|
|
35
|
+
};
|
package/src/components/Table/components/TableCell/components/LinkCell/stories/linkCell.stories.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { LinkCell } from "../linkCell";
|
|
3
|
+
import {
|
|
4
|
+
CLIENT_SIDE_ARGS,
|
|
5
|
+
EXTERNAL_ARGS,
|
|
6
|
+
INVALID_ARGS,
|
|
7
|
+
WITH_CUSTOM_STYLE_ARGS,
|
|
8
|
+
} from "./args";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof LinkCell> = {
|
|
11
|
+
component: LinkCell,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const ClientSide: Story = {
|
|
19
|
+
args: CLIENT_SIDE_ARGS,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const External: Story = {
|
|
23
|
+
args: EXTERNAL_ARGS,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Invalid: Story = {
|
|
27
|
+
args: INVALID_ARGS,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithCustomStyle: Story = {
|
|
31
|
+
args: WITH_CUSTOM_STYLE_ARGS,
|
|
32
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import { ElementType } from "react";
|
|
3
|
+
import { isValidUrl } from "../../../../../../common/utils";
|
|
4
|
+
import {
|
|
5
|
+
ANCHOR_TARGET,
|
|
6
|
+
REL_ATTRIBUTE,
|
|
7
|
+
} from "../../../../../Links/common/entities";
|
|
8
|
+
import {
|
|
9
|
+
assertAnchorRelAttribute,
|
|
10
|
+
assertAnchorTargetAttribute,
|
|
11
|
+
} from "../../../../../common/Link/typeGuards";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns the component to use for a link based on the given href and client-side navigation flag.
|
|
15
|
+
* @param href - The href attribute to use.
|
|
16
|
+
* @param isClientSide - Whether the link is a client-side navigation.
|
|
17
|
+
* @returns The component to use for the link.
|
|
18
|
+
*/
|
|
19
|
+
export function getComponent(href: string, isClientSide: boolean): ElementType {
|
|
20
|
+
if (isClientSide) return Link; // Use Next/Link for client-side navigation.
|
|
21
|
+
if (isValidUrl(href)) return "a"; // Use anchor tag for external links.
|
|
22
|
+
return "span"; // Use span for invalid links.
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns the rel attribute for a link based on the given rel and client-side navigation flag.
|
|
27
|
+
* @param rel - The rel attribute to use.
|
|
28
|
+
* @param isClientSideNavigation - Whether the link is a client-side navigation.
|
|
29
|
+
* @returns The rel attribute for the link.
|
|
30
|
+
*/
|
|
31
|
+
export function getRelAttribute(
|
|
32
|
+
rel: string | undefined,
|
|
33
|
+
isClientSideNavigation: boolean
|
|
34
|
+
): string {
|
|
35
|
+
if (rel) {
|
|
36
|
+
assertAnchorRelAttribute(rel);
|
|
37
|
+
return rel;
|
|
38
|
+
}
|
|
39
|
+
return isClientSideNavigation
|
|
40
|
+
? REL_ATTRIBUTE.NO_OPENER
|
|
41
|
+
: REL_ATTRIBUTE.NO_OPENER_NO_REFERRER;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns the target attribute for a link based on the given target and client-side navigation flag.
|
|
46
|
+
* @param target - The target attribute to use.
|
|
47
|
+
* @param isClientSideNavigation - Whether the link is a client-side navigation.
|
|
48
|
+
* @returns The target attribute for the link.
|
|
49
|
+
*/
|
|
50
|
+
export function getTargetAttribute(
|
|
51
|
+
target: string | undefined,
|
|
52
|
+
isClientSideNavigation: boolean
|
|
53
|
+
): string {
|
|
54
|
+
if (target) {
|
|
55
|
+
assertAnchorTargetAttribute(target);
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
58
|
+
return isClientSideNavigation ? ANCHOR_TARGET.SELF : ANCHOR_TARGET.BLANK;
|
|
59
|
+
}
|
package/src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
3
|
+
import { MarkdownRenderer } from "../../../../../MarkdownRenderer/markdownRenderer";
|
|
4
|
+
|
|
5
|
+
export const StyledMarkdownRenderer = styled(MarkdownRenderer)`
|
|
6
|
+
align-self: flex-start;
|
|
7
|
+
|
|
8
|
+
code {
|
|
9
|
+
all: unset;
|
|
10
|
+
font: inherit;
|
|
11
|
+
font-family: Roboto Mono, monospace;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
h2,
|
|
15
|
+
h3,
|
|
16
|
+
h4,
|
|
17
|
+
h5,
|
|
18
|
+
h6 {
|
|
19
|
+
margin: 8px 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
hr {
|
|
23
|
+
border: none;
|
|
24
|
+
border-bottom: 1px solid ${PALETTE.SMOKE_MAIN};
|
|
25
|
+
margin: 16px 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
p {
|
|
29
|
+
font: inherit;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CellContext, RowData } from "@tanstack/react-table";
|
|
2
|
+
import { BaseComponentProps } from "components/types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { COMPONENTS } from "../../../../../MarkdownRenderer/constants";
|
|
5
|
+
import { StyledMarkdownRenderer } from "./markdownCell.styles";
|
|
6
|
+
import { MarkdownCellProps } from "./types";
|
|
7
|
+
|
|
8
|
+
export const MarkdownCell = <
|
|
9
|
+
T extends RowData,
|
|
10
|
+
TValue extends MarkdownCellProps = MarkdownCellProps
|
|
11
|
+
>({
|
|
12
|
+
className,
|
|
13
|
+
column,
|
|
14
|
+
getValue,
|
|
15
|
+
}: BaseComponentProps & CellContext<T, TValue>): JSX.Element | null => {
|
|
16
|
+
const props = getValue();
|
|
17
|
+
if (!props) return null;
|
|
18
|
+
const { values } = props;
|
|
19
|
+
const columnDef = column?.columnDef;
|
|
20
|
+
const columnMeta = columnDef?.meta;
|
|
21
|
+
const components = columnMeta?.components;
|
|
22
|
+
return (
|
|
23
|
+
<StyledMarkdownRenderer
|
|
24
|
+
className={className}
|
|
25
|
+
components={{ ...COMPONENTS, ...components }}
|
|
26
|
+
value={values}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { MarkdownCell } from "../markdownCell";
|
|
3
|
+
import { GetValue } from "./types";
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_ARGS: Partial<ComponentProps<typeof MarkdownCell>> = {
|
|
6
|
+
getValue: (() => ({
|
|
7
|
+
values:
|
|
8
|
+
'| Key | Annotator | Value |\n| --- | --- | --- |\n| `tissue_ontology_term_id` | Curator | categorical with `str` categories. This **MUST** be the UBERON or CL term that best describes the tissue the cell was derived from, depending on the sample type. |\n\n**Mapping guidance**\n\n| For | Use |\n| --- | --- |\n| Tissue | STRONGLY RECOMMENDED to be an UBERON term <br />(e.g. [`UBERON:0008930`](http://purl.obolibrary.org/obo/UBERON_0008930) for a *somatosensory cortex* tissue sample) |\n| Cell culture | MUST be a CL term appended with \\" (cell culture)\\" <br />(e.g. [`CL:0000057`](http://purl.obolibrary.org/obo/CL_0000057) **(cell culture)** for the *WTC-11* cell line) |\n| Organoid | MUST be an UBERON term appended with \\" (organoid)\\" <br />(e.g. [`UBERON:0000955`](http://purl.obolibrary.org/obo/UBERON_0000955) **(organoid)** for a *brain organoid*) |\n| Enriched / sorted / isolated cells from a tissue | MUST be an UBERON or CL term and **SHOULD NOT** use terms that do not capture the tissue of origin.<br /><br />• *CD3+ kidney cells* → [`UBERON:0002113`](https://www.ebi.ac.uk/ols/ontologies/uberon/terms?iri=http://purl.obolibrary.org/obo/UBERON_0002113) (*kidney*) instead of [`CL:000084`](https://www.ebi.ac.uk/ols/ontologies/cl/terms?iri=http://purl.obolibrary.org/obo/CL_0000084) (*T cell*).<br />• *EPCAM+ cervical cells* → [`CL:0000066`](https://www.ebi.ac.uk/ols/ontologies/cl/terms?iri=http://purl.obolibrary.org/obo/CL_0000066) (*epithelial cell* of the cervix). |\n\n---\n\nWhen a dataset is uploaded, the **cellxgene Data Portal** MUST automatically add the matching human-readable name for the corresponding ontology term to the `obs` dataframe. Curators **MUST NOT** annotate the following columns.\n\n### `assay`\n\n| Key | Annotator | Value |\n| --- | --- | --- |\n| `assay` | Data Portal | categorical with `str` categories. This **MUST** be the human-readable name assigned to the value of `assay_ontology_term_id`. |',
|
|
9
|
+
})) as GetValue,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const WITH_HTML_ARGS: Partial<ComponentProps<typeof MarkdownCell>> = {
|
|
13
|
+
getValue: (() => ({
|
|
14
|
+
values:
|
|
15
|
+
"Hello <br />World <a href='https://www.example.com'>example link</a>",
|
|
16
|
+
})) as GetValue,
|
|
17
|
+
};
|
package/src/components/Table/components/TableCell/components/MarkdownCell/stories/constants.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Anchor } from "../../../../../../MarkdownRenderer/components/Anchor/anchor";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Styled anchor component for testing purposes.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const STYLED_ANCHOR = styled(Anchor)`
|
|
9
|
+
background-color: green;
|
|
10
|
+
color: white;
|
|
11
|
+
` as typeof Anchor;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { PALETTE } from "../../../../../../../styles/common/constants/palette";
|
|
5
|
+
import { MarkdownCell } from "../markdownCell";
|
|
6
|
+
import { DEFAULT_ARGS, WITH_HTML_ARGS } from "./args";
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof MarkdownCell> = {
|
|
9
|
+
component: MarkdownCell,
|
|
10
|
+
decorators: [
|
|
11
|
+
(Story): JSX.Element => (
|
|
12
|
+
<Box
|
|
13
|
+
sx={{
|
|
14
|
+
backgroundColor: PALETTE.COMMON_WHITE,
|
|
15
|
+
fontSize: "14px",
|
|
16
|
+
lineHeight: "20px",
|
|
17
|
+
padding: 3,
|
|
18
|
+
width: 480,
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<Story />
|
|
22
|
+
</Box>
|
|
23
|
+
),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: DEFAULT_ARGS,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const WithHtml: Story = {
|
|
36
|
+
args: WITH_HTML_ARGS,
|
|
37
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getMemoOptions, memo, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns an array of two numbers, the minimum and maximum values for the column, or undefined if the column does not exist or has no values.
|
|
5
|
+
* Customized version of the default getFacetedMinMaxValues function from tanstack table handling mixed null and possible NaN values.
|
|
6
|
+
* See https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues.
|
|
7
|
+
* @returns An array of two numbers, the minimum and maximum values for the column, or undefined if the column does not exist or has no values.
|
|
8
|
+
*/
|
|
9
|
+
export function getFacetedMinMaxValues<TData extends RowData>(): (
|
|
10
|
+
table: Table<TData>,
|
|
11
|
+
columnId: string
|
|
12
|
+
) => () => undefined | [number, number] {
|
|
13
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- Customized copy of tanstack table function.
|
|
14
|
+
return (table, columnId) =>
|
|
15
|
+
memo(
|
|
16
|
+
() => [table.getColumn(columnId)?.getFacetedRowModel()],
|
|
17
|
+
(facetedRowModel) => {
|
|
18
|
+
if (!facetedRowModel) return undefined;
|
|
19
|
+
|
|
20
|
+
// Initialize with the smallest and largest possible numbers.
|
|
21
|
+
const facetedMinMaxValues: [number, number] = [Infinity, -Infinity];
|
|
22
|
+
|
|
23
|
+
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
24
|
+
const values =
|
|
25
|
+
facetedRowModel.flatRows[i]!.getUniqueValues<number>(columnId);
|
|
26
|
+
|
|
27
|
+
for (let j = 0; j < values.length; j++) {
|
|
28
|
+
const value = values[j]!;
|
|
29
|
+
// Convert value to a number.
|
|
30
|
+
const numericValue = Number(value);
|
|
31
|
+
|
|
32
|
+
// Skip null and NaN values.
|
|
33
|
+
if (value === null || isNaN(numericValue)) continue;
|
|
34
|
+
|
|
35
|
+
if (numericValue < facetedMinMaxValues[0]) {
|
|
36
|
+
facetedMinMaxValues[0] = numericValue;
|
|
37
|
+
}
|
|
38
|
+
if (numericValue > facetedMinMaxValues[1]) {
|
|
39
|
+
facetedMinMaxValues[1] = numericValue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Return undefined if all values are null or NaN.
|
|
45
|
+
if (
|
|
46
|
+
facetedMinMaxValues[0] === Infinity &&
|
|
47
|
+
facetedMinMaxValues[1] === -Infinity
|
|
48
|
+
) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Normalize -0 to 0.
|
|
53
|
+
if (Object.is(facetedMinMaxValues[0], -0)) {
|
|
54
|
+
facetedMinMaxValues[0] = 0;
|
|
55
|
+
}
|
|
56
|
+
if (Object.is(facetedMinMaxValues[1], -0)) {
|
|
57
|
+
facetedMinMaxValues[1] = 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return facetedMinMaxValues;
|
|
61
|
+
},
|
|
62
|
+
getMemoOptions(table.options, "debugTable", "getFacetedMinMaxValues")
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ANCHOR_TARGET, REL_ATTRIBUTE } from "../../Links/common/entities";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Asserts that the given value is a valid REL_ATTRIBUTE.
|
|
5
|
+
* @param value - Value to assert.
|
|
6
|
+
* @throws Error if the value is not a valid REL_ATTRIBUTE.
|
|
7
|
+
*/
|
|
8
|
+
export function assertAnchorRelAttribute(
|
|
9
|
+
value: string
|
|
10
|
+
): asserts value is REL_ATTRIBUTE {
|
|
11
|
+
if (!Object.values(REL_ATTRIBUTE).includes(value as REL_ATTRIBUTE)) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
`Expecting rel attribute: ${value} to be one of ${Object.values(
|
|
14
|
+
REL_ATTRIBUTE
|
|
15
|
+
)}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Asserts that the given value is a valid ANCHOR_TARGET.
|
|
22
|
+
* @param value - Value to assert.
|
|
23
|
+
* @throws Error if the value is not a valid ANCHOR_TARGET.
|
|
24
|
+
*/
|
|
25
|
+
export function assertAnchorTargetAttribute(
|
|
26
|
+
value: string
|
|
27
|
+
): asserts value is ANCHOR_TARGET {
|
|
28
|
+
if (!Object.values(ANCHOR_TARGET).includes(value as ANCHOR_TARGET)) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`Expecting anchor target: ${value} to be one of ${Object.values(
|
|
31
|
+
ANCHOR_TARGET
|
|
32
|
+
)}`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/config/entities.ts
CHANGED
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
TableOptions,
|
|
11
11
|
} from "@tanstack/react-table";
|
|
12
12
|
import { JSXElementConstructor, ReactNode } from "react";
|
|
13
|
+
import { CategoryConfig } from "../common/categories/config/types";
|
|
13
14
|
import {
|
|
14
15
|
DataDictionaryAnnotation,
|
|
15
16
|
DataDictionaryConfig,
|
|
16
|
-
SelectCategoryValueView,
|
|
17
17
|
SelectedFilter,
|
|
18
18
|
} from "../common/entities";
|
|
19
19
|
import { HeroTitle } from "../components/common/Title/title";
|
|
@@ -88,19 +88,6 @@ export interface CategoryGroup {
|
|
|
88
88
|
label?: string;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/**
|
|
92
|
-
* Model of category configured in site config.
|
|
93
|
-
*/
|
|
94
|
-
export interface CategoryConfig {
|
|
95
|
-
annotation?: DataDictionaryAnnotation;
|
|
96
|
-
enableChartView?: boolean;
|
|
97
|
-
key: string;
|
|
98
|
-
label: string;
|
|
99
|
-
mapSelectCategoryValue?: (
|
|
100
|
-
selectCategoryValue: SelectCategoryValueView
|
|
101
|
-
) => SelectCategoryValueView;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
91
|
/**
|
|
105
92
|
* Column configuration.
|
|
106
93
|
* TanStack ColumnDef properties not currently supported include:
|