@databiosphere/findable-ui 2.1.0 → 3.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/lib/components/Detail/components/DetailViewTable/detailViewTable.js +1 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Filter/components/Filters/filters.d.ts +1 -1
- package/lib/components/Filter/components/Filters/filters.styles.js +1 -1
- package/lib/components/Filter/components/VariableSizeListItem/variableSizeListItem.js +2 -1
- package/lib/components/Index/index.d.ts +2 -1
- package/lib/components/Index/index.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +3 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +1 -1
- package/lib/components/Layout/components/Outline/components/ContentsTab/contentsTab.styles.d.ts +1 -1
- package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
- package/lib/components/Table/common/utils.d.ts +6 -0
- package/lib/components/Table/common/utils.js +12 -1
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +2 -2
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +1 -1
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +3 -3
- package/lib/components/Table/components/TableCell/common/utils.d.ts +8 -0
- package/lib/components/Table/components/TableCell/common/utils.js +15 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.d.ts +6 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.js +15 -0
- package/lib/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.d.ts +6 -0
- package/lib/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.js +16 -0
- package/lib/components/Table/components/TableHead/tableHead.js +2 -2
- package/lib/components/Table/components/TableRows/tableRows.js +2 -3
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.d.ts +10 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.js +37 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.styles.d.ts +3 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.styles.js +13 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.d.ts +9 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.js +19 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.styles.d.ts +5 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.styles.js +13 -0
- package/lib/components/Table/components/TableToolbar/tableToolbar.js +5 -5
- package/lib/components/Table/components/TableToolbar/tableToolbar.styles.d.ts +1 -5
- package/lib/components/Table/components/TableToolbar/tableToolbar.styles.js +10 -7
- package/lib/components/Table/table.d.ts +5 -2
- package/lib/components/Table/table.js +13 -2
- package/lib/components/TableCreator/common/constants.d.ts +6 -0
- package/lib/components/TableCreator/common/constants.js +22 -0
- package/lib/components/TableCreator/common/entities.d.ts +5 -0
- package/lib/components/TableCreator/common/entities.js +2 -0
- package/lib/components/TableCreator/common/utils.d.ts +8 -0
- package/lib/components/TableCreator/common/utils.js +24 -0
- package/lib/components/TableCreator/tableCreator.d.ts +3 -1
- package/lib/components/TableCreator/tableCreator.js +19 -34
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +5 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +25 -0
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.d.ts +4 -2
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.js +2 -2
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.styles.d.ts +5 -1
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.styles.js +24 -1
- package/lib/components/common/CustomIcon/components/IndeterminateIcon/indeterminateIcon.d.ts +6 -0
- package/lib/components/common/CustomIcon/components/IndeterminateIcon/indeterminateIcon.js +29 -0
- package/lib/components/common/Dialog/dialog.d.ts +7 -0
- package/lib/components/common/Dialog/dialog.js +24 -0
- package/lib/components/common/DropdownMenu/common/constants.d.ts +2 -0
- package/lib/components/common/DropdownMenu/common/constants.js +8 -0
- package/lib/components/common/DropdownMenu/common/entities.d.ts +10 -0
- package/lib/components/common/DropdownMenu/common/entities.js +2 -0
- package/lib/components/common/DropdownMenu/components/MenuItem/menuItem.d.ts +7 -0
- package/lib/components/common/DropdownMenu/components/MenuItem/menuItem.js +25 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.d.ts +9 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.js +49 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.styles.d.ts +3 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.styles.js +13 -0
- package/lib/components/common/IconButton/iconButton.d.ts +4 -3
- package/lib/components/common/IconButton/iconButton.js +4 -4
- package/lib/components/common/IconButton/iconButton.styles.d.ts +34 -0
- package/lib/components/common/IconButton/iconButton.styles.js +27 -1
- package/lib/components/common/Tabs/tabs.styles.d.ts +1 -1
- package/lib/config/entities.d.ts +9 -1
- package/lib/providers/exploreState/constants.d.ts +3 -3
- package/lib/providers/exploreState/constants.js +3 -26
- package/lib/providers/exploreState/entities.d.ts +16 -5
- package/lib/providers/exploreState/initializer/constants.js +2 -0
- package/lib/providers/exploreState/initializer/utils.js +77 -5
- package/lib/providers/exploreState/payloads/entities.d.ts +32 -6
- package/lib/providers/exploreState/utils.d.ts +65 -11
- package/lib/providers/exploreState/utils.js +126 -15
- package/lib/providers/exploreState.d.ts +39 -7
- package/lib/providers/exploreState.js +58 -11
- package/lib/theme/common/components.js +4 -0
- package/lib/views/ExploreView/exploreView.d.ts +3 -1
- package/lib/views/ExploreView/exploreView.js +17 -11
- package/package.json +1 -1
- package/src/components/Detail/components/DetailViewTable/detailViewTable.tsx +2 -2
- package/src/components/Filter/components/Filters/filters.styles.ts +1 -1
- package/src/components/Filter/components/Filters/filters.tsx +1 -1
- package/src/components/Filter/components/VariableSizeListItem/variableSizeListItem.tsx +6 -3
- package/src/components/Index/index.tsx +3 -1
- package/src/components/Table/common/utils.ts +17 -0
- package/src/components/Table/components/CheckboxMenu/checkboxMenu.styles.ts +3 -3
- package/src/components/Table/components/CheckboxMenu/checkboxMenu.tsx +4 -2
- package/src/components/Table/components/TableCell/common/utils.ts +16 -0
- package/src/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.tsx +24 -0
- package/src/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.tsx +31 -0
- package/src/components/Table/components/TableHead/tableHead.tsx +18 -7
- package/src/components/Table/components/TableRows/tableRows.tsx +10 -8
- package/src/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.styles.ts +8 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.tsx +50 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/rowSelection.styles.ts +8 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/rowSelection.tsx +30 -0
- package/src/components/Table/components/TableToolbar/tableToolbar.styles.ts +10 -7
- package/src/components/Table/components/TableToolbar/tableToolbar.tsx +11 -8
- package/src/components/Table/table.tsx +18 -1
- package/src/components/TableCreator/common/constants.ts +26 -0
- package/src/components/TableCreator/common/entities.ts +6 -0
- package/src/components/TableCreator/common/utils.ts +33 -0
- package/src/components/TableCreator/tableCreator.tsx +38 -17
- package/src/components/common/Alert/components/AlertText/alertText.styles.ts +20 -0
- package/src/components/common/Button/components/DropdownButton/dropdownButton.styles.ts +15 -1
- package/src/components/common/Button/components/DropdownButton/dropdownButton.tsx +10 -2
- package/src/components/common/CustomIcon/components/IndeterminateIcon/indeterminateIcon.tsx +23 -0
- package/src/components/common/Dialog/dialog.tsx +21 -0
- package/src/components/common/DropdownMenu/common/constants.ts +7 -0
- package/src/components/common/DropdownMenu/common/entities.ts +11 -0
- package/src/components/common/DropdownMenu/components/MenuItem/menuItem.tsx +24 -0
- package/src/components/common/DropdownMenu/dropdownMenu.styles.ts +8 -0
- package/src/components/common/DropdownMenu/dropdownMenu.tsx +48 -0
- package/src/components/common/IconButton/iconButton.styles.ts +18 -0
- package/src/components/common/IconButton/iconButton.tsx +10 -11
- package/src/config/entities.ts +13 -1
- package/src/providers/exploreState/constants.ts +3 -0
- package/src/providers/exploreState/entities.ts +28 -4
- package/src/providers/exploreState/initializer/constants.ts +2 -0
- package/src/providers/exploreState/initializer/utils.ts +94 -3
- package/src/providers/exploreState/payloads/entities.ts +41 -7
- package/src/providers/exploreState/utils.ts +185 -21
- package/src/providers/exploreState.tsx +155 -21
- package/src/theme/common/components.ts +4 -0
- package/src/views/ExploreView/exploreView.tsx +22 -10
- package/types/data-explorer-ui.d.ts +10 -0
- package/src/components/Table/components/EntityViewToggle/entityViewToggle.tsx +0 -36
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
open: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
children?: import("react").ReactNode;
|
|
7
|
+
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
8
|
+
color?: "inherit" | "default" | "primary" | "secondary" | "error" | "info" | "success" | "warning" | "inkLight" | "ink" | undefined;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
disableFocusRipple?: boolean | undefined;
|
|
11
|
+
edge?: false | "end" | "start" | undefined;
|
|
12
|
+
size?: "large" | "medium" | "small" | "xsmall" | "xxsmall" | "xlarge" | undefined;
|
|
13
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
|
+
} & Omit<{
|
|
15
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
16
|
+
centerRipple?: boolean | undefined;
|
|
17
|
+
children?: import("react").ReactNode;
|
|
18
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
disableRipple?: boolean | undefined;
|
|
21
|
+
disableTouchRipple?: boolean | undefined;
|
|
22
|
+
focusRipple?: boolean | undefined;
|
|
23
|
+
focusVisibleClassName?: string | undefined;
|
|
24
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
25
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
26
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
27
|
+
tabIndex?: number | undefined;
|
|
28
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
29
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
30
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
31
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
32
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "sx" | "disabled" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge"> & {
|
|
33
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
34
|
+
} & Props, {}, {}>;
|
|
2
35
|
export declare const IconButtonPrimary: import("@emotion/styled").StyledComponent<import("./iconButton").IconButtonProps & {
|
|
3
36
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
37
|
}, {}, {}>;
|
|
@@ -14,3 +47,4 @@ export declare const CloseDrawerIconButton: import("@emotion/styled").StyledComp
|
|
|
14
47
|
}, {}, {}>;
|
|
15
48
|
export declare const IconButtonSocials: import("@mui/material").ExtendButtonBase<import("@mui/material").IconButtonTypeMap<{}, "button">>;
|
|
16
49
|
export declare const IconButtonSocialsFooter: import("@mui/material").ExtendButtonBase<import("@mui/material").IconButtonTypeMap<{}, "button">>;
|
|
50
|
+
export {};
|
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IconButtonSocialsFooter = exports.IconButtonSocials = exports.CloseDrawerIconButton = exports.MockIconButtonPrimary = exports.IconButtonSecondary = exports.IconButtonPrimary = void 0;
|
|
17
|
+
exports.IconButtonSocialsFooter = exports.IconButtonSocials = exports.CloseDrawerIconButton = exports.MockIconButtonPrimary = exports.IconButtonSecondary = exports.IconButtonPrimary = exports.Button = void 0;
|
|
18
|
+
const react_1 = require("@emotion/react");
|
|
7
19
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
20
|
const material_1 = require("@mui/material");
|
|
21
|
+
const colors_1 = require("../../../styles/common/mixins/colors");
|
|
9
22
|
const iconButton_1 = require("./iconButton");
|
|
23
|
+
exports.Button = (0, styled_1.default)(material_1.IconButton, {
|
|
24
|
+
shouldForwardProp: (prop) => prop !== "open",
|
|
25
|
+
}) `
|
|
26
|
+
${(_a) => {
|
|
27
|
+
var { open } = _a, props = __rest(_a, ["open"]);
|
|
28
|
+
return open &&
|
|
29
|
+
(0, react_1.css) `
|
|
30
|
+
&.MuiIconButton-root {
|
|
31
|
+
background-color: ${(0, colors_1.smokeLightest)(props)};
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
}}
|
|
35
|
+
`;
|
|
10
36
|
// Primary icon button.
|
|
11
37
|
exports.IconButtonPrimary = (0, styled_1.default)(iconButton_1.IconButton) `
|
|
12
38
|
background-color: ${({ theme }) => theme.palette.primary.main};
|
|
@@ -37,7 +37,7 @@ export declare const Tab: import("@emotion/styled").StyledComponent<{
|
|
|
37
37
|
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
38
38
|
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
39
39
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
40
|
-
}, "label" | keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "sx" | "disabled" | "value" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "
|
|
40
|
+
}, "label" | keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "sx" | "disabled" | "value" | "action" | "icon" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "wrapped" | "iconPosition"> & {
|
|
41
41
|
theme?: import("@emotion/react").Theme | undefined;
|
|
42
42
|
}, {}, {}>;
|
|
43
43
|
export {};
|
package/lib/config/entities.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TabProps as MTabProps, Theme, ThemeOptions } from "@mui/material";
|
|
2
2
|
import { ColumnSort } from "@tanstack/react-table";
|
|
3
3
|
import { JSXElementConstructor, ReactNode } from "react";
|
|
4
|
-
import { CategoryKey, SelectedFilterValue } from "../common/entities";
|
|
4
|
+
import { CategoryKey, SelectedFilter, SelectedFilterValue } from "../common/entities";
|
|
5
5
|
import { HeroTitle } from "../components/common/Title/title";
|
|
6
6
|
import { FooterProps } from "../components/Layout/components/Footer/footer";
|
|
7
7
|
import { HeaderProps } from "../components/Layout/components/Header/header";
|
|
@@ -51,6 +51,7 @@ export interface BackPageTabConfig extends TabConfig {
|
|
|
51
51
|
export interface CategoryGroupConfig {
|
|
52
52
|
categoryGroups: CategoryGroup[];
|
|
53
53
|
key: string;
|
|
54
|
+
savedFilters?: SavedFilter[];
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Model of grouped configured categories in site config.
|
|
@@ -208,8 +209,10 @@ export interface ListConfig<T = any> {
|
|
|
208
209
|
export interface ListViewConfig {
|
|
209
210
|
disablePagination?: boolean;
|
|
210
211
|
enableDownload?: boolean;
|
|
212
|
+
enableRowSelection?: boolean;
|
|
211
213
|
listHero?: ComponentsConfig;
|
|
212
214
|
relatedView?: RelatedViewConfig;
|
|
215
|
+
rowSelectionView?: ComponentsConfig;
|
|
213
216
|
subTitleHero?: ComponentsConfig;
|
|
214
217
|
}
|
|
215
218
|
/**
|
|
@@ -244,6 +247,11 @@ export interface Override {
|
|
|
244
247
|
* Related search function.
|
|
245
248
|
*/
|
|
246
249
|
declare type RelatedSearchFunction = (searchKey: CategoryKey | undefined, resultKey: CategoryKey | undefined, selectedCategoryValues: SelectedFilterValue | undefined) => Promise<RelatedSearchResult | undefined>;
|
|
250
|
+
export interface SavedFilter {
|
|
251
|
+
filters: SelectedFilter[];
|
|
252
|
+
sort?: ColumnSort;
|
|
253
|
+
title: string;
|
|
254
|
+
}
|
|
247
255
|
/**
|
|
248
256
|
* Filter applied tracking payload
|
|
249
257
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare const SELECT_CATEGORY_KEY: {
|
|
2
|
+
SAVED_FILTERS: string;
|
|
3
|
+
};
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
currentPage: 1,
|
|
7
|
-
index: null,
|
|
8
|
-
nextIndex: null,
|
|
9
|
-
pageSize: 25,
|
|
10
|
-
pages: 1,
|
|
11
|
-
previousIndex: null,
|
|
12
|
-
rows: 0,
|
|
13
|
-
};
|
|
14
|
-
// Initial state
|
|
15
|
-
exports.INITIAL_STATE = {
|
|
16
|
-
catalogState: undefined,
|
|
17
|
-
categoryViews: [],
|
|
18
|
-
entityPageState: {},
|
|
19
|
-
featureFlagState: undefined,
|
|
20
|
-
filterCount: 0,
|
|
21
|
-
filterState: [],
|
|
22
|
-
isRelatedView: false,
|
|
23
|
-
listItems: [],
|
|
24
|
-
listView: undefined,
|
|
25
|
-
loading: true,
|
|
26
|
-
paginationState: exports.DEFAULT_PAGINATION_STATE,
|
|
27
|
-
relatedListItems: undefined,
|
|
28
|
-
tabValue: "",
|
|
3
|
+
exports.SELECT_CATEGORY_KEY = void 0;
|
|
4
|
+
exports.SELECT_CATEGORY_KEY = {
|
|
5
|
+
SAVED_FILTERS: "savedFilters",
|
|
29
6
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ColumnSort } from "@tanstack/react-table";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ColumnSort, RowSelectionState } from "@tanstack/react-table";
|
|
2
|
+
import { VisibilityState } from "@tanstack/table-core/src/features/Visibility";
|
|
3
|
+
import { CategoryValueKey, SelectCategory, SelectCategoryView, SelectedFilter } from "../../common/entities";
|
|
4
|
+
import { CategoryConfig, CategoryGroup, CategoryGroupConfig, EntityPath, SavedFilter } from "../../config/entities";
|
|
4
5
|
export interface EntityPageState {
|
|
5
6
|
categoryGroupConfigKey: CategoryGroupConfigKey;
|
|
6
|
-
columnsVisibility:
|
|
7
|
+
columnsVisibility: VisibilityState;
|
|
8
|
+
enableRowSelection: boolean;
|
|
9
|
+
rowSelection: RowSelectionState;
|
|
7
10
|
sorting: ColumnSort[];
|
|
8
11
|
}
|
|
9
12
|
export interface EntityPageStateMapper {
|
|
@@ -12,8 +15,16 @@ export interface EntityPageStateMapper {
|
|
|
12
15
|
export interface EntityState {
|
|
13
16
|
categoryConfigs?: CategoryConfig[];
|
|
14
17
|
categoryGroups?: CategoryGroup[];
|
|
15
|
-
categoryViews:
|
|
18
|
+
categoryViews: SelectCategoryView[];
|
|
16
19
|
filterState: SelectedFilter[];
|
|
20
|
+
savedFilterByCategoryValueKey?: SavedFilterByCategoryValueKey;
|
|
21
|
+
savedFilterState: SelectedFilter[];
|
|
22
|
+
savedSelectCategories: SelectCategory[];
|
|
17
23
|
}
|
|
18
24
|
export declare type EntityStateByCategoryGroupConfigKey = Map<CategoryGroupConfigKey, EntityState>;
|
|
19
25
|
export declare type CategoryGroupConfigKey = CategoryGroupConfig["key"];
|
|
26
|
+
export interface EntityStateSavedFilter extends Omit<SavedFilter, "sort"> {
|
|
27
|
+
sorting?: ColumnSort[];
|
|
28
|
+
}
|
|
29
|
+
export declare type ListItem = any;
|
|
30
|
+
export declare type SavedFilterByCategoryValueKey = Map<CategoryValueKey, EntityStateSavedFilter>;
|
|
@@ -4,6 +4,8 @@ exports.INITIAL_STATE = exports.DEFAULT_PAGINATION_STATE = exports.DEFAULT_ENTIT
|
|
|
4
4
|
exports.DEFAULT_ENTITY_STATE = {
|
|
5
5
|
categoryViews: [],
|
|
6
6
|
filterState: [],
|
|
7
|
+
savedFilterState: [],
|
|
8
|
+
savedSelectCategories: [],
|
|
7
9
|
};
|
|
8
10
|
exports.DEFAULT_PAGINATION_STATE = {
|
|
9
11
|
currentPage: 1,
|
|
@@ -2,9 +2,65 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initReducerArguments = void 0;
|
|
4
4
|
const utils_1 = require("../../../components/Table/common/utils");
|
|
5
|
+
const constants_1 = require("../../../components/TableCreator/common/constants");
|
|
5
6
|
const utils_2 = require("../../../config/utils");
|
|
7
|
+
const constants_2 = require("../constants");
|
|
6
8
|
const utils_3 = require("../utils");
|
|
7
|
-
const
|
|
9
|
+
const constants_3 = require("./constants");
|
|
10
|
+
/**
|
|
11
|
+
* Builds category groups from the given category group config (adds the saved filters category to the category groups).
|
|
12
|
+
* @param categoryGroupConfig - Category group config.
|
|
13
|
+
* @returns category groups with saved filters category.
|
|
14
|
+
*/
|
|
15
|
+
function buildCategoryGroups(categoryGroupConfig) {
|
|
16
|
+
const { categoryGroups, savedFilters } = categoryGroupConfig;
|
|
17
|
+
if (!savedFilters)
|
|
18
|
+
return categoryGroups;
|
|
19
|
+
const clonedCategoryGroups = [...categoryGroups];
|
|
20
|
+
const savedFiltersCategoryGroup = {
|
|
21
|
+
categoryConfigs: [
|
|
22
|
+
{ key: constants_2.SELECT_CATEGORY_KEY.SAVED_FILTERS, label: "Saved Filters" },
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
clonedCategoryGroups.unshift(savedFiltersCategoryGroup);
|
|
26
|
+
return clonedCategoryGroups;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns the saved filters as select categories.
|
|
30
|
+
* @param savedFilters - Saved filters.
|
|
31
|
+
* @returns select categories.
|
|
32
|
+
*/
|
|
33
|
+
function buildSavedSelectCategories(savedFilters) {
|
|
34
|
+
if (!savedFilters)
|
|
35
|
+
return [];
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
key: constants_2.SELECT_CATEGORY_KEY.SAVED_FILTERS,
|
|
39
|
+
label: "",
|
|
40
|
+
values: savedFilters.map(({ title }) => ({
|
|
41
|
+
count: 1,
|
|
42
|
+
key: title,
|
|
43
|
+
label: title,
|
|
44
|
+
selected: false, // Selected state updated in filter hook.
|
|
45
|
+
})),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Builds saved filter by category value key.
|
|
51
|
+
* @param savedFilters - Saved filters.
|
|
52
|
+
* @returns saved filter by category value key.
|
|
53
|
+
*/
|
|
54
|
+
function buildSavedFilterByCategoryValueKey(savedFilters) {
|
|
55
|
+
if (!savedFilters)
|
|
56
|
+
return;
|
|
57
|
+
const savedFilterByCategoryValueKey = new Map();
|
|
58
|
+
for (const { filters, sort, title } of savedFilters) {
|
|
59
|
+
const sorting = sort ? [sort] : undefined;
|
|
60
|
+
savedFilterByCategoryValueKey.set(title, { filters, sorting, title });
|
|
61
|
+
}
|
|
62
|
+
return savedFilterByCategoryValueKey;
|
|
63
|
+
}
|
|
8
64
|
/**
|
|
9
65
|
* Returns entity related configured category group config where entity config takes precedence over site config.
|
|
10
66
|
* @param siteConfig - Site config.
|
|
@@ -44,6 +100,15 @@ function initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupCo
|
|
|
44
100
|
var _a;
|
|
45
101
|
return (_a = entityStateByCategoryGroupConfigKey.get(categoryGroupConfigKey)) === null || _a === void 0 ? void 0 : _a.categoryGroups;
|
|
46
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Initializes column visibility for the given entity.
|
|
105
|
+
* @param entityConfig - Entity config.
|
|
106
|
+
* @returns column visibility.
|
|
107
|
+
*/
|
|
108
|
+
function initColumnVisibility(entityConfig) {
|
|
109
|
+
const { list: { columns }, listView: { enableRowSelection = false } = {}, } = entityConfig;
|
|
110
|
+
return Object.assign({ [constants_1.ACCESSOR_KEYS.SELECT]: enableRowSelection }, (0, utils_1.getInitialTableColumnVisibility)(columns));
|
|
111
|
+
}
|
|
47
112
|
/**
|
|
48
113
|
* Initializes entity page state.
|
|
49
114
|
* @param config - Site config.
|
|
@@ -51,9 +116,12 @@ function initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupCo
|
|
|
51
116
|
*/
|
|
52
117
|
function initEntityPageState(config) {
|
|
53
118
|
return config.entities.reduce((acc, entity) => {
|
|
119
|
+
var _a;
|
|
54
120
|
return Object.assign(Object.assign({}, acc), { [entity.route]: {
|
|
55
121
|
categoryGroupConfigKey: initCategoryGroupConfigKey(config, entity),
|
|
56
|
-
columnsVisibility: (
|
|
122
|
+
columnsVisibility: initColumnVisibility(entity),
|
|
123
|
+
enableRowSelection: Boolean((_a = entity.listView) === null || _a === void 0 ? void 0 : _a.enableRowSelection),
|
|
124
|
+
rowSelection: {},
|
|
57
125
|
sorting: (0, utils_2.getDefaultSorting)(entity),
|
|
58
126
|
} });
|
|
59
127
|
}, {});
|
|
@@ -71,10 +139,14 @@ function initEntityStateByCategoryGroupConfigKey(config, categoryGroupConfigKey,
|
|
|
71
139
|
const categoryGroupConfig = getEntityCategoryGroupConfig(config, entity);
|
|
72
140
|
if (!categoryGroupConfig)
|
|
73
141
|
continue;
|
|
74
|
-
const {
|
|
142
|
+
const { key, savedFilters } = categoryGroupConfig;
|
|
75
143
|
if (entityStateByCategoryGroupConfigKey.has(key))
|
|
76
144
|
continue;
|
|
77
|
-
|
|
145
|
+
const categoryGroups = buildCategoryGroups(categoryGroupConfig);
|
|
146
|
+
const savedSelectCategories = buildSavedSelectCategories(savedFilters);
|
|
147
|
+
const savedFilterByCategoryValueKey = buildSavedFilterByCategoryValueKey(savedFilters);
|
|
148
|
+
entityStateByCategoryGroupConfigKey.set(key, Object.assign(Object.assign({}, constants_3.DEFAULT_ENTITY_STATE), { categoryConfigs: flattenCategoryGroups(categoryGroups), categoryGroups, filterState: key === categoryGroupConfigKey ? filterState : [], savedFilterByCategoryValueKey,
|
|
149
|
+
savedSelectCategories }));
|
|
78
150
|
}
|
|
79
151
|
return entityStateByCategoryGroupConfigKey;
|
|
80
152
|
}
|
|
@@ -109,7 +181,7 @@ function initReducerArguments(config, entityListType, decodedFilterParam, decode
|
|
|
109
181
|
const categoryGroupConfigKey = (0, utils_3.getEntityCategoryGroupConfigKey)(entityListType, entityPageState);
|
|
110
182
|
const entityStateByCategoryGroupConfigKey = initEntityStateByCategoryGroupConfigKey(config, categoryGroupConfigKey, filterState);
|
|
111
183
|
const categoryGroups = initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupConfigKey);
|
|
112
|
-
return Object.assign(Object.assign({},
|
|
184
|
+
return Object.assign(Object.assign({}, constants_3.INITIAL_STATE), { catalogState: decodedCatalogParam, categoryGroups,
|
|
113
185
|
entityPageState,
|
|
114
186
|
entityStateByCategoryGroupConfigKey, featureFlagState: decodedFeatureFlagParam, filterCount: (0, utils_3.getFilterCount)(filterState), filterState, tabValue: entityListType });
|
|
115
187
|
}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
import { ColumnSort } from "@tanstack/react-table";
|
|
1
|
+
import { ColumnSort, RowSelectionState, VisibilityState } from "@tanstack/react-table";
|
|
2
2
|
import { CategoryKey, CategoryValueKey, PaginationDirectionType, SelectCategory } from "../../../common/entities";
|
|
3
3
|
import { ENTITY_VIEW, ListItems, PaginationResponse, RelatedListItems } from "../../exploreState";
|
|
4
|
+
import { ListItem } from "../entities";
|
|
5
|
+
/**
|
|
6
|
+
* Apply saved filter payload.
|
|
7
|
+
*/
|
|
8
|
+
export interface ApplySavedFilterPayload {
|
|
9
|
+
categoryKey: CategoryKey;
|
|
10
|
+
selected: boolean;
|
|
11
|
+
selectedValue: CategoryValueKey;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Paginate table payload.
|
|
15
|
+
*/
|
|
16
|
+
export declare type PaginateTablePayload = PaginationDirectionType;
|
|
17
|
+
/**
|
|
18
|
+
* Patch explore response payload.
|
|
19
|
+
*/
|
|
20
|
+
export interface PatchExploreResponsePayload {
|
|
21
|
+
listItemKey: keyof ListItem;
|
|
22
|
+
updatedListItems: ListItems;
|
|
23
|
+
}
|
|
4
24
|
/**
|
|
5
25
|
* Process explore response payload.
|
|
6
26
|
*/
|
|
@@ -16,10 +36,6 @@ export interface ProcessExploreResponsePayload {
|
|
|
16
36
|
export interface ProcessRelatedResponsePayload {
|
|
17
37
|
relatedListItems: RelatedListItems;
|
|
18
38
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Paginate table payload.
|
|
21
|
-
*/
|
|
22
|
-
export declare type PaginateTablePayload = PaginationDirectionType;
|
|
23
39
|
/**
|
|
24
40
|
* Reset explore response payload.
|
|
25
41
|
*/
|
|
@@ -31,7 +47,13 @@ export declare type ToggleEntityViewPayload = ENTITY_VIEW;
|
|
|
31
47
|
/**
|
|
32
48
|
* Update column visibility payload.
|
|
33
49
|
*/
|
|
34
|
-
export declare type UpdateColumnVisibilityPayload =
|
|
50
|
+
export declare type UpdateColumnVisibilityPayload = VisibilityState;
|
|
51
|
+
/**
|
|
52
|
+
* Update entity view access payload.
|
|
53
|
+
*/
|
|
54
|
+
export interface UpdateEntityViewAccessPayload {
|
|
55
|
+
canEdit: boolean;
|
|
56
|
+
}
|
|
35
57
|
/**
|
|
36
58
|
* Update filter payload.
|
|
37
59
|
*/
|
|
@@ -40,6 +62,10 @@ export interface UpdateFilterPayload {
|
|
|
40
62
|
selected: boolean;
|
|
41
63
|
selectedValue: CategoryValueKey;
|
|
42
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Update row selection payload.
|
|
67
|
+
*/
|
|
68
|
+
export declare type UpdateRowSelectionPayload = RowSelectionState;
|
|
43
69
|
/**
|
|
44
70
|
* Update sorting payload.
|
|
45
71
|
*/
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ExploreState, PaginationState } from "../exploreState";
|
|
4
|
-
import { CategoryGroupConfigKey, EntityPageState, EntityPageStateMapper, EntityState } from "./entities";
|
|
1
|
+
import { ColumnSort } from "@tanstack/react-table";
|
|
2
|
+
import { CategoryKey, CategoryValueKey, SelectedFilter } from "../../common/entities";
|
|
3
|
+
import { ExploreState, ListItems, PaginationState } from "../exploreState";
|
|
4
|
+
import { CategoryGroupConfigKey, EntityPageState, EntityPageStateMapper, EntityState, EntityStateSavedFilter, ListItem } from "./entities";
|
|
5
|
+
/**
|
|
6
|
+
* Returns the entity state saved filter state for the given category key.
|
|
7
|
+
* @param categoryKey - Category key.
|
|
8
|
+
* @param selectedValue - Key of category value that has been de/selected.
|
|
9
|
+
* @param selected - True if value is selected, false if de-selected.
|
|
10
|
+
* @returns entity state saved filter state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildEntityStateSavedFilterState(categoryKey: CategoryKey, selectedValue: CategoryValueKey, selected: boolean): SelectedFilter[];
|
|
13
|
+
/**
|
|
14
|
+
* Build new set of selected filters on de/select of a "saved filter" filter.
|
|
15
|
+
* @param state - Explore state.
|
|
16
|
+
* @param selectedValue - Key of category value that has been de/selected.
|
|
17
|
+
* @param selected - True if value is selected, false if de-selected.
|
|
18
|
+
* @returns new selected filters.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildNextSavedFilterState(state: ExploreState, selectedValue: CategoryValueKey, selected: boolean): SelectedFilter[];
|
|
5
21
|
/**
|
|
6
22
|
* Returns the category group config key for the current entity.
|
|
7
23
|
* @param entityPath - Entity path.
|
|
@@ -10,30 +26,53 @@ import { CategoryGroupConfigKey, EntityPageState, EntityPageStateMapper, EntityS
|
|
|
10
26
|
*/
|
|
11
27
|
export declare function getEntityCategoryGroupConfigKey(entityPath: string, entityPageState: EntityPageStateMapper): CategoryGroupConfigKey;
|
|
12
28
|
/**
|
|
13
|
-
* Returns the
|
|
29
|
+
* Returns the entity state for the current entity.
|
|
30
|
+
* @param state - Explore state.
|
|
31
|
+
* @param categoryGroupConfigKey - Category group config key.
|
|
32
|
+
* @returns entity state.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getEntityState(state: ExploreState, categoryGroupConfigKey?: string): EntityState;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the saved filter/sorting for the given category key.
|
|
14
37
|
* @param state - Explore state.
|
|
15
|
-
* @
|
|
38
|
+
* @param categoryValueKey - Category key.
|
|
39
|
+
* @returns saved filter/sorting for the category key.
|
|
16
40
|
*/
|
|
17
|
-
export declare function
|
|
41
|
+
export declare function getEntityStateSavedFilter(state: ExploreState, categoryValueKey: CategoryValueKey): EntityStateSavedFilter | undefined;
|
|
18
42
|
/**
|
|
19
|
-
* Returns
|
|
20
|
-
* @param categoryGroupConfigKey - Category group config key.
|
|
43
|
+
* Returns entity state "saved filter" sorting for the given category value key.
|
|
21
44
|
* @param state - Explore state.
|
|
22
|
-
* @
|
|
45
|
+
* @param selectedValue - Key of category value that has been de/selected.
|
|
46
|
+
* @param selected - True if value is selected, false if de-selected.
|
|
47
|
+
* @returns sorting.
|
|
23
48
|
*/
|
|
24
|
-
export declare function
|
|
49
|
+
export declare function getEntityStateSavedSorting(state: ExploreState, selectedValue: CategoryValueKey, selected: boolean): ColumnSort[] | undefined;
|
|
25
50
|
/**
|
|
26
51
|
* Returns the filter count.
|
|
27
52
|
* @param filterState - Filter state.
|
|
28
53
|
* @returns filter count.
|
|
29
54
|
*/
|
|
30
55
|
export declare function getFilterCount(filterState: SelectedFilter[]): number;
|
|
56
|
+
/**
|
|
57
|
+
* Returns list items with updated list items patched.
|
|
58
|
+
* @param listItems - List items.
|
|
59
|
+
* @param updatedListItems - List items to patch.
|
|
60
|
+
* @param listItemKey - List item key identifier to map list items.
|
|
61
|
+
* @returns list items with updated list items patched.
|
|
62
|
+
*/
|
|
63
|
+
export declare function patchEntityListItems(listItems: ListItems, updatedListItems: ListItems, listItemKey: keyof ListItem): ListItems;
|
|
31
64
|
/**
|
|
32
65
|
* Resets pagination.
|
|
33
66
|
* @param paginationState - Pagination state.
|
|
34
67
|
* @returns a reset pagination state.
|
|
35
68
|
*/
|
|
36
69
|
export declare function resetPage(paginationState: PaginationState): PaginationState;
|
|
70
|
+
/**
|
|
71
|
+
* Resets row selection for the current entity and entities that share the same category group config key.
|
|
72
|
+
* @param state - Explore state.
|
|
73
|
+
* @returns entity page state mapper with row selection reset.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resetRowSelection(state: ExploreState): EntityPageStateMapper;
|
|
37
76
|
/**
|
|
38
77
|
* Updates entity page state for the given entity path.
|
|
39
78
|
* @param entityPath - Entity path.
|
|
@@ -43,6 +82,13 @@ export declare function resetPage(paginationState: PaginationState): PaginationS
|
|
|
43
82
|
*/
|
|
44
83
|
export declare function updateEntityPageState(entityPath: string, // entityListType.
|
|
45
84
|
entityPageState: EntityPageStateMapper, nextEntityPageState: Partial<EntityPageState>): EntityPageStateMapper;
|
|
85
|
+
/**
|
|
86
|
+
* Updates entity page state sorting for all entities with the same category group config key.
|
|
87
|
+
* @param state - Explore state.
|
|
88
|
+
* @param sorting - Sorting.
|
|
89
|
+
* @returns entity page state.
|
|
90
|
+
*/
|
|
91
|
+
export declare function updateEntityPageStateSorting(state: ExploreState, sorting?: EntityPageState["sorting"]): EntityPageStateMapper;
|
|
46
92
|
/**
|
|
47
93
|
* Updates entity state by category group config key.
|
|
48
94
|
* @param state - Explore state.
|
|
@@ -50,3 +96,11 @@ entityPageState: EntityPageStateMapper, nextEntityPageState: Partial<EntityPageS
|
|
|
50
96
|
* @returns updated entity state by category group config key.
|
|
51
97
|
*/
|
|
52
98
|
export declare function updateEntityStateByCategoryGroupConfigKey(state: ExploreState, nextEntityState: Partial<EntityState>): void;
|
|
99
|
+
/**
|
|
100
|
+
* Updates the entity page state for each entity with row selection enabled,
|
|
101
|
+
* by updating the visibility of the "select" column based on user access and resetting row selection state.
|
|
102
|
+
* @param state - Explore state.
|
|
103
|
+
* @param canEdit - User has edit access.
|
|
104
|
+
* @returns new entity page state mapper with updated column visibility and row selection state.
|
|
105
|
+
*/
|
|
106
|
+
export declare function updateSelectColumnVisibility(state: ExploreState, canEdit: boolean): EntityPageStateMapper;
|