@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { COMPONENTS } from "../../../../../MarkdownRenderer/constants";
|
|
3
|
+
import { StyledMarkdownRenderer } from "./markdownCell.styles";
|
|
4
|
+
export const MarkdownCell = ({ className, column, getValue, }) => {
|
|
5
|
+
const props = getValue();
|
|
6
|
+
if (!props)
|
|
7
|
+
return null;
|
|
8
|
+
const { values } = props;
|
|
9
|
+
const columnDef = column?.columnDef;
|
|
10
|
+
const columnMeta = columnDef?.meta;
|
|
11
|
+
const components = columnMeta?.components;
|
|
12
|
+
return (React.createElement(StyledMarkdownRenderer, { className: className, components: { ...COMPONENTS, ...components }, value: values }));
|
|
13
|
+
};
|
package/lib/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
3
|
+
import { MarkdownRenderer } from "../../../../../MarkdownRenderer/markdownRenderer";
|
|
4
|
+
export const StyledMarkdownRenderer = styled(MarkdownRenderer) `
|
|
5
|
+
align-self: flex-start;
|
|
6
|
+
|
|
7
|
+
code {
|
|
8
|
+
all: unset;
|
|
9
|
+
font: inherit;
|
|
10
|
+
font-family: Roboto Mono, monospace;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
h2,
|
|
14
|
+
h3,
|
|
15
|
+
h4,
|
|
16
|
+
h5,
|
|
17
|
+
h6 {
|
|
18
|
+
margin: 8px 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
hr {
|
|
22
|
+
border: none;
|
|
23
|
+
border-bottom: 1px solid ${PALETTE.SMOKE_MAIN};
|
|
24
|
+
margin: 16px 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
p {
|
|
28
|
+
font: inherit;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const DEFAULT_ARGS = {
|
|
2
|
+
getValue: (() => ({
|
|
3
|
+
values: '| 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`. |',
|
|
4
|
+
})),
|
|
5
|
+
};
|
|
6
|
+
export const WITH_HTML_ARGS = {
|
|
7
|
+
getValue: (() => ({
|
|
8
|
+
values: "Hello <br />World <a href='https://www.example.com'>example link</a>",
|
|
9
|
+
})),
|
|
10
|
+
};
|
package/lib/components/Table/components/TableCell/components/MarkdownCell/stories/constants.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Anchor } from "../../../../../../MarkdownRenderer/components/Anchor/anchor";
|
|
3
|
+
/**
|
|
4
|
+
* Styled anchor component for testing purposes.
|
|
5
|
+
*/
|
|
6
|
+
export const STYLED_ANCHOR = styled(Anchor) `
|
|
7
|
+
background-color: green;
|
|
8
|
+
color: white;
|
|
9
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { MarkdownCell } from "../markdownCell";
|
|
3
|
+
declare const meta: Meta<typeof MarkdownCell>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithHtml: Story;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { PALETTE } from "../../../../../../../styles/common/constants/palette";
|
|
4
|
+
import { MarkdownCell } from "../markdownCell";
|
|
5
|
+
import { DEFAULT_ARGS, WITH_HTML_ARGS } from "./args";
|
|
6
|
+
const meta = {
|
|
7
|
+
component: MarkdownCell,
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (React.createElement(Box, { sx: {
|
|
10
|
+
backgroundColor: PALETTE.COMMON_WHITE,
|
|
11
|
+
fontSize: "14px",
|
|
12
|
+
lineHeight: "20px",
|
|
13
|
+
padding: 3,
|
|
14
|
+
width: 480,
|
|
15
|
+
} },
|
|
16
|
+
React.createElement(Story, null))),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Default = {
|
|
21
|
+
args: DEFAULT_ARGS,
|
|
22
|
+
};
|
|
23
|
+
export const WithHtml = {
|
|
24
|
+
args: WITH_HTML_ARGS,
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* 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.
|
|
4
|
+
* Customized version of the default getFacetedMinMaxValues function from tanstack table handling mixed null and possible NaN values.
|
|
5
|
+
* See https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues.
|
|
6
|
+
* @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.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFacetedMinMaxValues<TData extends RowData>(): (table: Table<TData>, columnId: string) => () => undefined | [number, number];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getMemoOptions, memo } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* 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.
|
|
4
|
+
* Customized version of the default getFacetedMinMaxValues function from tanstack table handling mixed null and possible NaN values.
|
|
5
|
+
* See https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues.
|
|
6
|
+
* @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.
|
|
7
|
+
*/
|
|
8
|
+
export function getFacetedMinMaxValues() {
|
|
9
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- Customized copy of tanstack table function.
|
|
10
|
+
return (table, columnId) => memo(() => [table.getColumn(columnId)?.getFacetedRowModel()], (facetedRowModel) => {
|
|
11
|
+
if (!facetedRowModel)
|
|
12
|
+
return undefined;
|
|
13
|
+
// Initialize with the smallest and largest possible numbers.
|
|
14
|
+
const facetedMinMaxValues = [Infinity, -Infinity];
|
|
15
|
+
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
16
|
+
const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
|
|
17
|
+
for (let j = 0; j < values.length; j++) {
|
|
18
|
+
const value = values[j];
|
|
19
|
+
// Convert value to a number.
|
|
20
|
+
const numericValue = Number(value);
|
|
21
|
+
// Skip null and NaN values.
|
|
22
|
+
if (value === null || isNaN(numericValue))
|
|
23
|
+
continue;
|
|
24
|
+
if (numericValue < facetedMinMaxValues[0]) {
|
|
25
|
+
facetedMinMaxValues[0] = numericValue;
|
|
26
|
+
}
|
|
27
|
+
if (numericValue > facetedMinMaxValues[1]) {
|
|
28
|
+
facetedMinMaxValues[1] = numericValue;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Return undefined if all values are null or NaN.
|
|
33
|
+
if (facetedMinMaxValues[0] === Infinity &&
|
|
34
|
+
facetedMinMaxValues[1] === -Infinity) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
// Normalize -0 to 0.
|
|
38
|
+
if (Object.is(facetedMinMaxValues[0], -0)) {
|
|
39
|
+
facetedMinMaxValues[0] = 0;
|
|
40
|
+
}
|
|
41
|
+
if (Object.is(facetedMinMaxValues[1], -0)) {
|
|
42
|
+
facetedMinMaxValues[1] = 0;
|
|
43
|
+
}
|
|
44
|
+
return facetedMinMaxValues;
|
|
45
|
+
}, getMemoOptions(table.options, "debugTable", "getFacetedMinMaxValues"));
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ANCHOR_TARGET, REL_ATTRIBUTE } from "../../Links/common/entities";
|
|
2
|
+
/**
|
|
3
|
+
* Asserts that the given value is a valid REL_ATTRIBUTE.
|
|
4
|
+
* @param value - Value to assert.
|
|
5
|
+
* @throws Error if the value is not a valid REL_ATTRIBUTE.
|
|
6
|
+
*/
|
|
7
|
+
export declare function assertAnchorRelAttribute(value: string): asserts value is REL_ATTRIBUTE;
|
|
8
|
+
/**
|
|
9
|
+
* Asserts that the given value is a valid ANCHOR_TARGET.
|
|
10
|
+
* @param value - Value to assert.
|
|
11
|
+
* @throws Error if the value is not a valid ANCHOR_TARGET.
|
|
12
|
+
*/
|
|
13
|
+
export declare function assertAnchorTargetAttribute(value: string): asserts value is ANCHOR_TARGET;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ANCHOR_TARGET, REL_ATTRIBUTE } from "../../Links/common/entities";
|
|
2
|
+
/**
|
|
3
|
+
* Asserts that the given value is a valid REL_ATTRIBUTE.
|
|
4
|
+
* @param value - Value to assert.
|
|
5
|
+
* @throws Error if the value is not a valid REL_ATTRIBUTE.
|
|
6
|
+
*/
|
|
7
|
+
export function assertAnchorRelAttribute(value) {
|
|
8
|
+
if (!Object.values(REL_ATTRIBUTE).includes(value)) {
|
|
9
|
+
throw new Error(`Expecting rel attribute: ${value} to be one of ${Object.values(REL_ATTRIBUTE)}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Asserts that the given value is a valid ANCHOR_TARGET.
|
|
14
|
+
* @param value - Value to assert.
|
|
15
|
+
* @throws Error if the value is not a valid ANCHOR_TARGET.
|
|
16
|
+
*/
|
|
17
|
+
export function assertAnchorTargetAttribute(value) {
|
|
18
|
+
if (!Object.values(ANCHOR_TARGET).includes(value)) {
|
|
19
|
+
throw new Error(`Expecting anchor target: ${value} to be one of ${Object.values(ANCHOR_TARGET)}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
package/lib/config/entities.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { TabProps as MTabProps, Theme, ThemeOptions } from "@mui/material";
|
|
2
2
|
import { CellContext, ColumnDef, ColumnMeta, ColumnSort, GroupingState, RowData, Table, TableOptions } from "@tanstack/react-table";
|
|
3
3
|
import { JSXElementConstructor, ReactNode } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { CategoryConfig } from "../common/categories/config/types";
|
|
5
|
+
import { DataDictionaryAnnotation, DataDictionaryConfig, SelectedFilter } from "../common/entities";
|
|
5
6
|
import { HeroTitle } from "../components/common/Title/title";
|
|
6
7
|
import { FooterProps } from "../components/Layout/components/Footer/footer";
|
|
7
8
|
import { HeaderProps } from "../components/Layout/components/Header/header";
|
|
@@ -66,16 +67,6 @@ export interface CategoryGroup {
|
|
|
66
67
|
categoryConfigs: CategoryConfig[];
|
|
67
68
|
label?: string;
|
|
68
69
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Model of category configured in site config.
|
|
71
|
-
*/
|
|
72
|
-
export interface CategoryConfig {
|
|
73
|
-
annotation?: DataDictionaryAnnotation;
|
|
74
|
-
enableChartView?: boolean;
|
|
75
|
-
key: string;
|
|
76
|
-
label: string;
|
|
77
|
-
mapSelectCategoryValue?: (selectCategoryValue: SelectCategoryValueView) => SelectCategoryValueView;
|
|
78
|
-
}
|
|
79
70
|
/**
|
|
80
71
|
* Column configuration.
|
|
81
72
|
* TanStack ColumnDef properties not currently supported include:
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CategoryConfig } from "../common/categories/config/types";
|
|
2
|
+
import { Category } from "../common/categories/models/types";
|
|
3
|
+
import { CategoryView, VIEW_KIND } from "../common/categories/views/types";
|
|
4
|
+
import { CategoryKey, CategoryValueKey, Filters, SelectCategoryValue } from "../common/entities";
|
|
3
5
|
/**
|
|
4
6
|
* State backing filter functionality and calculations. Converted to view model for display.
|
|
5
7
|
*/
|
|
6
8
|
export type FilterState = Filters;
|
|
7
|
-
/**
|
|
8
|
-
* Shape of return value from this useCategoryFilter hook.
|
|
9
|
-
*/
|
|
10
|
-
export interface FilterInstance {
|
|
11
|
-
categories: SelectCategoryView[];
|
|
12
|
-
filter: FilterState;
|
|
13
|
-
onFilter: OnFilterFn;
|
|
14
|
-
}
|
|
15
9
|
/**
|
|
16
10
|
* Function invoked when selected state of a category value is toggled or range is selected.
|
|
17
11
|
*/
|
|
18
|
-
export type OnFilterFn = (categoryKey: CategoryKey, selectedCategoryValue: CategoryValueKey, selected: boolean, categorySection?: string, searchTerm?: string) => void;
|
|
12
|
+
export type OnFilterFn = (categoryKey: CategoryKey, selectedCategoryValue: CategoryValueKey, selected: boolean, categorySection?: string, viewKind?: VIEW_KIND, searchTerm?: string) => void;
|
|
19
13
|
/**
|
|
20
14
|
* Build view-specific models from filter state, to facilitate easy rendering.
|
|
21
15
|
* @param categories - Categories, category value and their counts with the current filter applied.
|
|
@@ -23,16 +17,17 @@ export type OnFilterFn = (categoryKey: CategoryKey, selectedCategoryValue: Categ
|
|
|
23
17
|
* @param filterState - Current set of selected category and category values.
|
|
24
18
|
* @returns Array of category view objects.
|
|
25
19
|
*/
|
|
26
|
-
export declare function buildCategoryViews(categories:
|
|
20
|
+
export declare function buildCategoryViews(categories: Category[], categoryConfigs: CategoryConfig[] | undefined, filterState: FilterState): CategoryView[];
|
|
27
21
|
/**
|
|
28
22
|
* Build new set of selected filters on de/select of filter.
|
|
29
23
|
* @param filterState - Current set of selected category and category values.
|
|
30
24
|
* @param categoryKey - Key of category that has been de/selected.
|
|
31
25
|
* @param selectedValue - Key of category value that has been de/selected
|
|
32
26
|
* @param selected - True if value is selected, false if de-selected.
|
|
27
|
+
* @param viewKind - View kind.
|
|
33
28
|
* @returns New filter state generated from the current set of selected values and the newly selected value.
|
|
34
29
|
*/
|
|
35
|
-
export declare function buildNextFilterState(filterState: FilterState, categoryKey: CategoryKey, selectedValue: CategoryValueKey, selected: boolean): FilterState;
|
|
30
|
+
export declare function buildNextFilterState(filterState: FilterState, categoryKey: CategoryKey, selectedValue: CategoryValueKey, selected: boolean, viewKind?: VIEW_KIND): FilterState;
|
|
36
31
|
/**
|
|
37
32
|
* Default function returning select category value, unmodified.
|
|
38
33
|
* @param selectCategoryValue - Select category value.
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { findSelectCategoryConfig } from "../common/categories/config/utils";
|
|
2
|
+
import { isRangeCategory } from "../common/categories/models/range/typeGuards";
|
|
3
|
+
import { buildNextRangeFilterState } from "../common/categories/models/range/utils";
|
|
4
|
+
import { buildNextSelectFilterState } from "../common/categories/models/select/utils";
|
|
5
|
+
import { buildRangeCategoryView } from "../common/categories/views/range/utils";
|
|
6
|
+
import { VIEW_KIND } from "../common/categories/views/types";
|
|
1
7
|
import { COLLATOR_CASE_INSENSITIVE } from "../common/constants";
|
|
2
8
|
/**
|
|
3
9
|
* Build the view-specific model of the given category value.
|
|
@@ -17,22 +23,22 @@ function buildCategoryValueView(categoryValue, categorySelectedFilter) {
|
|
|
17
23
|
};
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
|
-
* Build the view-specific model of the given category, including the category label pulled from the config.
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
26
|
+
* Build the view-specific model of the given select category, including the category label pulled from the config.
|
|
27
|
+
* @param selectCategory - The select category to build a view model of.
|
|
28
|
+
* @param selectCategoryValueViews - Set of select category value view models for the given category.
|
|
23
29
|
* @param categoryConfigs - Category configs indicating accept list as well as label configuration.
|
|
24
|
-
* @returns Full built category
|
|
30
|
+
* @returns Full built select category view, ready for display.
|
|
25
31
|
*/
|
|
26
|
-
function buildCategoryView(
|
|
27
|
-
const
|
|
28
|
-
const mapSelectCategoryValue =
|
|
32
|
+
function buildCategoryView(selectCategory, selectCategoryValueViews, categoryConfigs) {
|
|
33
|
+
const selectCategoryConfig = findSelectCategoryConfig(selectCategory.key, categoryConfigs);
|
|
34
|
+
const mapSelectCategoryValue = selectCategoryConfig?.mapSelectCategoryValue || getSelectCategoryValue;
|
|
29
35
|
return {
|
|
30
|
-
annotation:
|
|
31
|
-
enableChartView:
|
|
36
|
+
annotation: selectCategoryConfig?.annotation,
|
|
37
|
+
enableChartView: selectCategoryConfig?.enableChartView,
|
|
32
38
|
isDisabled: false,
|
|
33
|
-
key:
|
|
34
|
-
label: getCategoryLabel(
|
|
35
|
-
values:
|
|
39
|
+
key: selectCategory.key,
|
|
40
|
+
label: getCategoryLabel(selectCategory.key, selectCategoryConfig),
|
|
41
|
+
values: selectCategoryValueViews.map(mapSelectCategoryValue),
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
44
|
/**
|
|
@@ -52,7 +58,11 @@ export function buildCategoryViews(categories, categoryConfigs, filterState) {
|
|
|
52
58
|
const views = acceptListCategories.map((category) => {
|
|
53
59
|
// Get the set of selected values for this category, if any.
|
|
54
60
|
const categorySelectedFilter = getCategorySelectedFilter(category.key, filterState);
|
|
55
|
-
// Build view
|
|
61
|
+
// Build view model for range categories.
|
|
62
|
+
if (isRangeCategory(category)) {
|
|
63
|
+
return buildRangeCategoryView(category, categoryConfigs, categorySelectedFilter);
|
|
64
|
+
}
|
|
65
|
+
// Build view model for single or multiselect categories.
|
|
56
66
|
const categoryValueViews = category.values.map((categoryValue) => buildCategoryValueView(categoryValue, categorySelectedFilter));
|
|
57
67
|
categoryValueViews.sort(sortCategoryValueViews);
|
|
58
68
|
// Build category view model.
|
|
@@ -68,9 +78,10 @@ export function buildCategoryViews(categories, categoryConfigs, filterState) {
|
|
|
68
78
|
* @param categoryKey - Key of category that has been de/selected.
|
|
69
79
|
* @param selectedValue - Key of category value that has been de/selected
|
|
70
80
|
* @param selected - True if value is selected, false if de-selected.
|
|
81
|
+
* @param viewKind - View kind.
|
|
71
82
|
* @returns New filter state generated from the current set of selected values and the newly selected value.
|
|
72
83
|
*/
|
|
73
|
-
export function buildNextFilterState(filterState, categoryKey, selectedValue, selected) {
|
|
84
|
+
export function buildNextFilterState(filterState, categoryKey, selectedValue, selected, viewKind) {
|
|
74
85
|
// Check if the selected category already has selected values.
|
|
75
86
|
const categorySelectedFilter = getCategorySelectedFilter(categoryKey, filterState);
|
|
76
87
|
// Create a copy of the current filter state. Remove the selected filter for the selected category, if any.
|
|
@@ -80,13 +91,14 @@ export function buildNextFilterState(filterState, categoryKey, selectedValue, se
|
|
|
80
91
|
categoryKey,
|
|
81
92
|
value: categorySelectedFilter ? [...categorySelectedFilter.value] : [],
|
|
82
93
|
};
|
|
83
|
-
//
|
|
84
|
-
if (
|
|
85
|
-
|
|
94
|
+
// Build next filter state for category.
|
|
95
|
+
if (viewKind === VIEW_KIND.RANGE) {
|
|
96
|
+
// Handle range category.
|
|
97
|
+
buildNextRangeFilterState(nextCategorySelectedFilter, selectedValue, selected);
|
|
86
98
|
}
|
|
87
|
-
// Otherwise, category value has been de-selected; remove the selected value from the selected set of values.
|
|
88
99
|
else {
|
|
89
|
-
|
|
100
|
+
// Handle select category.
|
|
101
|
+
buildNextSelectFilterState(nextCategorySelectedFilter, selectedValue, selected);
|
|
90
102
|
}
|
|
91
103
|
// Add the new selected filter for this category to the set of selected filters, if there are selected values for it.
|
|
92
104
|
if (nextCategorySelectedFilter.value.length) {
|
|
@@ -123,15 +135,6 @@ function getCategoryLabel(key, categoryConfig) {
|
|
|
123
135
|
export function getSelectCategoryValue(selectCategoryValue) {
|
|
124
136
|
return selectCategoryValue;
|
|
125
137
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns the category config for the given category config key.
|
|
128
|
-
* @param key - Category config key.
|
|
129
|
-
* @param categoryConfigs - Category configs.
|
|
130
|
-
* @returns category config.
|
|
131
|
-
*/
|
|
132
|
-
function findCategoryConfig(key, categoryConfigs) {
|
|
133
|
-
return categoryConfigs.find((categoryConfig) => categoryConfig.key === key);
|
|
134
|
-
}
|
|
135
138
|
/**
|
|
136
139
|
* Determine if given category value is selected.
|
|
137
140
|
* @param categoryValueKey - The key of the category value to check if selected in the filter state.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ColumnSort, GroupingState, RowSelectionState, VisibilityState } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import { CategoryConfig } from "../../common/categories/config/types";
|
|
3
|
+
import { CategoryView } from "../../common/categories/views/types";
|
|
4
|
+
import { CategoryValueKey, SelectCategory, SelectedFilter } from "../../common/entities";
|
|
3
5
|
import { RowPreviewState } from "../../components/Table/features/RowPreview/entities";
|
|
4
|
-
import {
|
|
6
|
+
import { CategoryGroup, CategoryGroupConfig, EntityPath, SavedFilter } from "../../config/entities";
|
|
5
7
|
export interface EntityPageState {
|
|
6
8
|
categoryGroupConfigKey: CategoryGroupConfigKey;
|
|
7
9
|
columnVisibility: VisibilityState;
|
|
@@ -17,7 +19,7 @@ export interface EntityPageStateMapper {
|
|
|
17
19
|
export interface EntityState {
|
|
18
20
|
categoryConfigs?: CategoryConfig[];
|
|
19
21
|
categoryGroups?: CategoryGroup[];
|
|
20
|
-
categoryViews:
|
|
22
|
+
categoryViews: CategoryView[];
|
|
21
23
|
filterState: SelectedFilter[];
|
|
22
24
|
savedFilterByCategoryValueKey?: SavedFilterByCategoryValueKey;
|
|
23
25
|
savedFilterState: SelectedFilter[];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ColumnSort, GroupingState, RowSelectionState } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
2
|
+
import { Category } from "../../../common/categories/models/types";
|
|
3
|
+
import { VIEW_KIND } from "../../../common/categories/views/types";
|
|
4
|
+
import { CategoryKey, CategoryValueKey, PaginationDirectionType, SelectedFilter } from "../../../common/entities";
|
|
3
5
|
import { RowPreviewState } from "../../../components/Table/features/RowPreview/entities";
|
|
4
6
|
import { ListItems, PaginationResponse } from "../../exploreState";
|
|
5
7
|
import { ListItem } from "../entities";
|
|
@@ -10,6 +12,7 @@ export interface ApplySavedFilterPayload {
|
|
|
10
12
|
categoryKey: CategoryKey;
|
|
11
13
|
selected: boolean;
|
|
12
14
|
selectedValue: CategoryValueKey;
|
|
15
|
+
viewKind?: VIEW_KIND;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Paginate table payload.
|
|
@@ -29,7 +32,7 @@ export interface ProcessExploreResponsePayload {
|
|
|
29
32
|
listItems: ListItems;
|
|
30
33
|
loading: boolean;
|
|
31
34
|
paginationResponse: PaginationResponse;
|
|
32
|
-
selectCategories?:
|
|
35
|
+
selectCategories?: Category[];
|
|
33
36
|
}
|
|
34
37
|
/**
|
|
35
38
|
* Reset explore response payload.
|
|
@@ -57,6 +60,7 @@ export interface UpdateFilterPayload {
|
|
|
57
60
|
categoryKey: CategoryKey;
|
|
58
61
|
selected: boolean;
|
|
59
62
|
selectedValue: CategoryValueKey;
|
|
63
|
+
viewKind?: VIEW_KIND;
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Update row preview payload.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Dispatch, ReactNode } from "react";
|
|
2
2
|
import { AzulSearchIndex } from "../apis/azul/common/entities";
|
|
3
|
-
import {
|
|
3
|
+
import { CategoryView } from "../common/categories/views/types";
|
|
4
|
+
import { SelectedFilter } from "../common/entities";
|
|
4
5
|
import { RowPreviewState } from "../components/Table/features/RowPreview/entities";
|
|
5
6
|
import { CategoryGroup, SiteConfig } from "../config/entities";
|
|
6
7
|
import { UpdateGroupingAction } from "./exploreState/actions/updateGrouping/types";
|
|
@@ -21,7 +22,7 @@ export interface ExploreContext {
|
|
|
21
22
|
export type ExploreState = {
|
|
22
23
|
catalogState: CatalogState;
|
|
23
24
|
categoryGroups?: CategoryGroup[];
|
|
24
|
-
categoryViews:
|
|
25
|
+
categoryViews: CategoryView[];
|
|
25
26
|
entityPageState: EntityPageStateMapper;
|
|
26
27
|
entityStateByCategoryGroupConfigKey: EntityStateByCategoryGroupConfigKey;
|
|
27
28
|
featureFlagState: FeatureFlagState;
|
|
@@ -277,7 +277,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
277
277
|
* Update filter
|
|
278
278
|
**/
|
|
279
279
|
case ExploreActionKind.UpdateFilter: {
|
|
280
|
-
const filterState = buildNextFilterState(state.filterState, payload.categoryKey, payload.selectedValue, payload.selected);
|
|
280
|
+
const filterState = buildNextFilterState(state.filterState, payload.categoryKey, payload.selectedValue, payload.selected, payload.viewKind);
|
|
281
281
|
const rowPreview = closeRowPreview(state.rowPreview);
|
|
282
282
|
const rowSelection = {};
|
|
283
283
|
const savedFilterState = []; // Clear saved filter state.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves a button by its name.
|
|
3
|
+
* @param name - The name of the button.
|
|
4
|
+
* @returns The button element.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getButton<T extends HTMLElement = HTMLElement>(name: string | RegExp): T;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves an input element by its label text.
|
|
9
|
+
* @param text - The label text of the input element.
|
|
10
|
+
* @returns The input element.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getLabelText<T extends HTMLElement = HTMLElement>(text: string): T;
|
|
13
|
+
/**
|
|
14
|
+
* Returns regex that matches the start of the given text.
|
|
15
|
+
* @param text - Text to match.
|
|
16
|
+
* @returns RegExp.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getStartsWithRegex(text: string): RegExp;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves an element by its text content.
|
|
21
|
+
* @param text - The text content of the element.
|
|
22
|
+
* @returns The element.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getText<T extends HTMLElement = HTMLElement>(text: string | RegExp): T;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { screen } from "@testing-library/react";
|
|
2
|
+
import { escapeRegExp } from "../common/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves a button by its name.
|
|
5
|
+
* @param name - The name of the button.
|
|
6
|
+
* @returns The button element.
|
|
7
|
+
*/
|
|
8
|
+
export function getButton(name) {
|
|
9
|
+
return screen.getByRole("button", { name });
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves an input element by its label text.
|
|
13
|
+
* @param text - The label text of the input element.
|
|
14
|
+
* @returns The input element.
|
|
15
|
+
*/
|
|
16
|
+
export function getLabelText(text) {
|
|
17
|
+
return screen.getByLabelText(text);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns regex that matches the start of the given text.
|
|
21
|
+
* @param text - Text to match.
|
|
22
|
+
* @returns RegExp.
|
|
23
|
+
*/
|
|
24
|
+
export function getStartsWithRegex(text) {
|
|
25
|
+
return new RegExp(`^${escapeRegExp(text)}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves an element by its text content.
|
|
29
|
+
* @param text - The text content of the element.
|
|
30
|
+
* @returns The element.
|
|
31
|
+
*/
|
|
32
|
+
export function getText(text) {
|
|
33
|
+
return screen.getByText(text);
|
|
34
|
+
}
|
|
@@ -388,6 +388,14 @@ export const MuiChip = (theme) => {
|
|
|
388
388
|
},
|
|
389
389
|
label: {
|
|
390
390
|
...theme.typography[TEXT_BODY_SMALL_400],
|
|
391
|
+
variants: [
|
|
392
|
+
{
|
|
393
|
+
props: { variant: "status" },
|
|
394
|
+
style: {
|
|
395
|
+
...theme.typography[TEXT_BODY_SMALL_500],
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
],
|
|
391
399
|
},
|
|
392
400
|
},
|
|
393
401
|
variants: [
|
|
@@ -467,13 +475,18 @@ export const MuiChip = (theme) => {
|
|
|
467
475
|
{
|
|
468
476
|
props: { variant: "status" },
|
|
469
477
|
style: {
|
|
470
|
-
...theme.typography[TEXT_BODY_SMALL_500],
|
|
471
478
|
boxShadow: `0 0 0 2px ${PALETTE.COMMON_WHITE}`,
|
|
472
479
|
height: 20,
|
|
473
480
|
maxWidth: "fit-content",
|
|
474
481
|
minWidth: 0,
|
|
475
482
|
},
|
|
476
483
|
},
|
|
484
|
+
{
|
|
485
|
+
props: { color: "default", variant: "status" },
|
|
486
|
+
style: {
|
|
487
|
+
color: PALETTE.INK_LIGHT,
|
|
488
|
+
},
|
|
489
|
+
},
|
|
477
490
|
],
|
|
478
491
|
};
|
|
479
492
|
};
|
|
@@ -858,6 +871,11 @@ export const MuiLink = {
|
|
|
858
871
|
textDecorationSkipInk: "none",
|
|
859
872
|
textUnderlinePosition: "from-font",
|
|
860
873
|
},
|
|
874
|
+
underlineNone: {
|
|
875
|
+
"&:hover": {
|
|
876
|
+
textDecoration: "none",
|
|
877
|
+
},
|
|
878
|
+
},
|
|
861
879
|
},
|
|
862
880
|
};
|
|
863
881
|
/**
|