@databiosphere/findable-ui 2.2.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/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 +2 -0
- package/lib/providers/exploreState/entities.d.ts +6 -2
- package/lib/providers/exploreState/initializer/utils.js +20 -7
- package/lib/providers/exploreState/payloads/entities.d.ts +24 -6
- package/lib/providers/exploreState/utils.d.ts +24 -2
- package/lib/providers/exploreState/utils.js +52 -3
- package/lib/providers/exploreState.d.ts +29 -5
- package/lib/providers/exploreState.js +28 -7
- package/lib/theme/common/components.js +4 -0
- package/lib/views/ExploreView/exploreView.d.ts +3 -1
- package/lib/views/ExploreView/exploreView.js +3 -3
- package/package.json +1 -1
- package/src/components/Detail/components/DetailViewTable/detailViewTable.tsx +2 -2
- 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 +2 -0
- package/src/providers/exploreState/entities.ts +8 -2
- package/src/providers/exploreState/initializer/utils.ts +21 -1
- package/src/providers/exploreState/payloads/entities.ts +32 -7
- package/src/providers/exploreState/utils.ts +81 -1
- package/src/providers/exploreState.tsx +88 -11
- package/src/theme/common/components.ts +4 -0
- package/src/views/ExploreView/exploreView.tsx +6 -2
- 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
|
@@ -209,8 +209,10 @@ export interface ListConfig<T = any> {
|
|
|
209
209
|
export interface ListViewConfig {
|
|
210
210
|
disablePagination?: boolean;
|
|
211
211
|
enableDownload?: boolean;
|
|
212
|
+
enableRowSelection?: boolean;
|
|
212
213
|
listHero?: ComponentsConfig;
|
|
213
214
|
relatedView?: RelatedViewConfig;
|
|
215
|
+
rowSelectionView?: ComponentsConfig;
|
|
214
216
|
subTitleHero?: ComponentsConfig;
|
|
215
217
|
}
|
|
216
218
|
/**
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ColumnSort } from "@tanstack/react-table";
|
|
1
|
+
import { ColumnSort, RowSelectionState } from "@tanstack/react-table";
|
|
2
|
+
import { VisibilityState } from "@tanstack/table-core/src/features/Visibility";
|
|
2
3
|
import { CategoryValueKey, SelectCategory, SelectCategoryView, SelectedFilter } from "../../common/entities";
|
|
3
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 {
|
|
@@ -23,4 +26,5 @@ export declare type CategoryGroupConfigKey = CategoryGroupConfig["key"];
|
|
|
23
26
|
export interface EntityStateSavedFilter extends Omit<SavedFilter, "sort"> {
|
|
24
27
|
sorting?: ColumnSort[];
|
|
25
28
|
}
|
|
29
|
+
export declare type ListItem = any;
|
|
26
30
|
export declare type SavedFilterByCategoryValueKey = Map<CategoryValueKey, EntityStateSavedFilter>;
|
|
@@ -2,10 +2,11 @@
|
|
|
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");
|
|
6
|
-
const
|
|
7
|
+
const constants_2 = require("../constants");
|
|
7
8
|
const utils_3 = require("../utils");
|
|
8
|
-
const
|
|
9
|
+
const constants_3 = require("./constants");
|
|
9
10
|
/**
|
|
10
11
|
* Builds category groups from the given category group config (adds the saved filters category to the category groups).
|
|
11
12
|
* @param categoryGroupConfig - Category group config.
|
|
@@ -18,7 +19,7 @@ function buildCategoryGroups(categoryGroupConfig) {
|
|
|
18
19
|
const clonedCategoryGroups = [...categoryGroups];
|
|
19
20
|
const savedFiltersCategoryGroup = {
|
|
20
21
|
categoryConfigs: [
|
|
21
|
-
{ key:
|
|
22
|
+
{ key: constants_2.SELECT_CATEGORY_KEY.SAVED_FILTERS, label: "Saved Filters" },
|
|
22
23
|
],
|
|
23
24
|
};
|
|
24
25
|
clonedCategoryGroups.unshift(savedFiltersCategoryGroup);
|
|
@@ -34,7 +35,7 @@ function buildSavedSelectCategories(savedFilters) {
|
|
|
34
35
|
return [];
|
|
35
36
|
return [
|
|
36
37
|
{
|
|
37
|
-
key:
|
|
38
|
+
key: constants_2.SELECT_CATEGORY_KEY.SAVED_FILTERS,
|
|
38
39
|
label: "",
|
|
39
40
|
values: savedFilters.map(({ title }) => ({
|
|
40
41
|
count: 1,
|
|
@@ -99,6 +100,15 @@ function initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupCo
|
|
|
99
100
|
var _a;
|
|
100
101
|
return (_a = entityStateByCategoryGroupConfigKey.get(categoryGroupConfigKey)) === null || _a === void 0 ? void 0 : _a.categoryGroups;
|
|
101
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
|
+
}
|
|
102
112
|
/**
|
|
103
113
|
* Initializes entity page state.
|
|
104
114
|
* @param config - Site config.
|
|
@@ -106,9 +116,12 @@ function initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupCo
|
|
|
106
116
|
*/
|
|
107
117
|
function initEntityPageState(config) {
|
|
108
118
|
return config.entities.reduce((acc, entity) => {
|
|
119
|
+
var _a;
|
|
109
120
|
return Object.assign(Object.assign({}, acc), { [entity.route]: {
|
|
110
121
|
categoryGroupConfigKey: initCategoryGroupConfigKey(config, entity),
|
|
111
|
-
columnsVisibility: (
|
|
122
|
+
columnsVisibility: initColumnVisibility(entity),
|
|
123
|
+
enableRowSelection: Boolean((_a = entity.listView) === null || _a === void 0 ? void 0 : _a.enableRowSelection),
|
|
124
|
+
rowSelection: {},
|
|
112
125
|
sorting: (0, utils_2.getDefaultSorting)(entity),
|
|
113
126
|
} });
|
|
114
127
|
}, {});
|
|
@@ -132,7 +145,7 @@ function initEntityStateByCategoryGroupConfigKey(config, categoryGroupConfigKey,
|
|
|
132
145
|
const categoryGroups = buildCategoryGroups(categoryGroupConfig);
|
|
133
146
|
const savedSelectCategories = buildSavedSelectCategories(savedFilters);
|
|
134
147
|
const savedFilterByCategoryValueKey = buildSavedFilterByCategoryValueKey(savedFilters);
|
|
135
|
-
entityStateByCategoryGroupConfigKey.set(key, Object.assign(Object.assign({},
|
|
148
|
+
entityStateByCategoryGroupConfigKey.set(key, Object.assign(Object.assign({}, constants_3.DEFAULT_ENTITY_STATE), { categoryConfigs: flattenCategoryGroups(categoryGroups), categoryGroups, filterState: key === categoryGroupConfigKey ? filterState : [], savedFilterByCategoryValueKey,
|
|
136
149
|
savedSelectCategories }));
|
|
137
150
|
}
|
|
138
151
|
return entityStateByCategoryGroupConfigKey;
|
|
@@ -168,7 +181,7 @@ function initReducerArguments(config, entityListType, decodedFilterParam, decode
|
|
|
168
181
|
const categoryGroupConfigKey = (0, utils_3.getEntityCategoryGroupConfigKey)(entityListType, entityPageState);
|
|
169
182
|
const entityStateByCategoryGroupConfigKey = initEntityStateByCategoryGroupConfigKey(config, categoryGroupConfigKey, filterState);
|
|
170
183
|
const categoryGroups = initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupConfigKey);
|
|
171
|
-
return Object.assign(Object.assign({},
|
|
184
|
+
return Object.assign(Object.assign({}, constants_3.INITIAL_STATE), { catalogState: decodedCatalogParam, categoryGroups,
|
|
172
185
|
entityPageState,
|
|
173
186
|
entityStateByCategoryGroupConfigKey, featureFlagState: decodedFeatureFlagParam, filterCount: (0, utils_3.getFilterCount)(filterState), filterState, tabValue: entityListType });
|
|
174
187
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
/**
|
|
5
6
|
* Apply saved filter payload.
|
|
6
7
|
*/
|
|
@@ -9,6 +10,17 @@ export interface ApplySavedFilterPayload {
|
|
|
9
10
|
selected: boolean;
|
|
10
11
|
selectedValue: CategoryValueKey;
|
|
11
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
|
+
}
|
|
12
24
|
/**
|
|
13
25
|
* Process explore response payload.
|
|
14
26
|
*/
|
|
@@ -24,10 +36,6 @@ export interface ProcessExploreResponsePayload {
|
|
|
24
36
|
export interface ProcessRelatedResponsePayload {
|
|
25
37
|
relatedListItems: RelatedListItems;
|
|
26
38
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Paginate table payload.
|
|
29
|
-
*/
|
|
30
|
-
export declare type PaginateTablePayload = PaginationDirectionType;
|
|
31
39
|
/**
|
|
32
40
|
* Reset explore response payload.
|
|
33
41
|
*/
|
|
@@ -39,7 +47,13 @@ export declare type ToggleEntityViewPayload = ENTITY_VIEW;
|
|
|
39
47
|
/**
|
|
40
48
|
* Update column visibility payload.
|
|
41
49
|
*/
|
|
42
|
-
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
|
+
}
|
|
43
57
|
/**
|
|
44
58
|
* Update filter payload.
|
|
45
59
|
*/
|
|
@@ -48,6 +62,10 @@ export interface UpdateFilterPayload {
|
|
|
48
62
|
selected: boolean;
|
|
49
63
|
selectedValue: CategoryValueKey;
|
|
50
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Update row selection payload.
|
|
67
|
+
*/
|
|
68
|
+
export declare type UpdateRowSelectionPayload = RowSelectionState;
|
|
51
69
|
/**
|
|
52
70
|
* Update sorting payload.
|
|
53
71
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ColumnSort } from "@tanstack/react-table";
|
|
2
2
|
import { CategoryKey, CategoryValueKey, SelectedFilter } from "../../common/entities";
|
|
3
|
-
import { ExploreState, PaginationState } from "../exploreState";
|
|
4
|
-
import { CategoryGroupConfigKey, EntityPageState, EntityPageStateMapper, EntityState, EntityStateSavedFilter } from "./entities";
|
|
3
|
+
import { ExploreState, ListItems, PaginationState } from "../exploreState";
|
|
4
|
+
import { CategoryGroupConfigKey, EntityPageState, EntityPageStateMapper, EntityState, EntityStateSavedFilter, ListItem } from "./entities";
|
|
5
5
|
/**
|
|
6
6
|
* Returns the entity state saved filter state for the given category key.
|
|
7
7
|
* @param categoryKey - Category key.
|
|
@@ -53,12 +53,26 @@ export declare function getEntityStateSavedSorting(state: ExploreState, selected
|
|
|
53
53
|
* @returns filter count.
|
|
54
54
|
*/
|
|
55
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;
|
|
56
64
|
/**
|
|
57
65
|
* Resets pagination.
|
|
58
66
|
* @param paginationState - Pagination state.
|
|
59
67
|
* @returns a reset pagination state.
|
|
60
68
|
*/
|
|
61
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;
|
|
62
76
|
/**
|
|
63
77
|
* Updates entity page state for the given entity path.
|
|
64
78
|
* @param entityPath - Entity path.
|
|
@@ -82,3 +96,11 @@ export declare function updateEntityPageStateSorting(state: ExploreState, sortin
|
|
|
82
96
|
* @returns updated entity state by category group config key.
|
|
83
97
|
*/
|
|
84
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;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEntityStateByCategoryGroupConfigKey = exports.updateEntityPageStateSorting = exports.updateEntityPageState = exports.resetPage = exports.getFilterCount = exports.getEntityStateSavedSorting = exports.getEntityStateSavedFilter = exports.getEntityState = exports.getEntityCategoryGroupConfigKey = exports.buildNextSavedFilterState = exports.buildEntityStateSavedFilterState = void 0;
|
|
4
|
-
const constants_1 = require("
|
|
3
|
+
exports.updateSelectColumnVisibility = exports.updateEntityStateByCategoryGroupConfigKey = exports.updateEntityPageStateSorting = exports.updateEntityPageState = exports.resetRowSelection = exports.resetPage = exports.patchEntityListItems = exports.getFilterCount = exports.getEntityStateSavedSorting = exports.getEntityStateSavedFilter = exports.getEntityState = exports.getEntityCategoryGroupConfigKey = exports.buildNextSavedFilterState = exports.buildEntityStateSavedFilterState = void 0;
|
|
4
|
+
const constants_1 = require("../../components/TableCreator/common/constants");
|
|
5
|
+
const constants_2 = require("./initializer/constants");
|
|
5
6
|
/**
|
|
6
7
|
* Returns the entity state saved filter state for the given category key.
|
|
7
8
|
* @param categoryKey - Category key.
|
|
@@ -47,7 +48,7 @@ exports.getEntityCategoryGroupConfigKey = getEntityCategoryGroupConfigKey;
|
|
|
47
48
|
*/
|
|
48
49
|
function getEntityState(state, categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState)) {
|
|
49
50
|
return (state.entityStateByCategoryGroupConfigKey.get(categoryGroupConfigKey) ||
|
|
50
|
-
|
|
51
|
+
constants_2.DEFAULT_ENTITY_STATE);
|
|
51
52
|
}
|
|
52
53
|
exports.getEntityState = getEntityState;
|
|
53
54
|
/**
|
|
@@ -85,6 +86,23 @@ function getFilterCount(filterState) {
|
|
|
85
86
|
return filterState.reduce((acc, filter) => acc + filter.value.length, 0);
|
|
86
87
|
}
|
|
87
88
|
exports.getFilterCount = getFilterCount;
|
|
89
|
+
/**
|
|
90
|
+
* Returns list items with updated list items patched.
|
|
91
|
+
* @param listItems - List items.
|
|
92
|
+
* @param updatedListItems - List items to patch.
|
|
93
|
+
* @param listItemKey - List item key identifier to map list items.
|
|
94
|
+
* @returns list items with updated list items patched.
|
|
95
|
+
*/
|
|
96
|
+
function patchEntityListItems(listItems, updatedListItems, listItemKey) {
|
|
97
|
+
if (!listItems || !updatedListItems)
|
|
98
|
+
return listItems;
|
|
99
|
+
const listItemById = new Map(listItems.map((listItem) => [listItem[listItemKey], listItem]));
|
|
100
|
+
updatedListItems.forEach((listItem) => {
|
|
101
|
+
listItemById.set(listItem[listItemKey], listItem);
|
|
102
|
+
});
|
|
103
|
+
return [...listItemById.values()];
|
|
104
|
+
}
|
|
105
|
+
exports.patchEntityListItems = patchEntityListItems;
|
|
88
106
|
/**
|
|
89
107
|
* Resets pagination.
|
|
90
108
|
* @param paginationState - Pagination state.
|
|
@@ -97,6 +115,21 @@ function resetPage(paginationState) {
|
|
|
97
115
|
return nextPaginationState;
|
|
98
116
|
}
|
|
99
117
|
exports.resetPage = resetPage;
|
|
118
|
+
/**
|
|
119
|
+
* Resets row selection for the current entity and entities that share the same category group config key.
|
|
120
|
+
* @param state - Explore state.
|
|
121
|
+
* @returns entity page state mapper with row selection reset.
|
|
122
|
+
*/
|
|
123
|
+
function resetRowSelection(state) {
|
|
124
|
+
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState);
|
|
125
|
+
return Object.entries(state.entityPageState).reduce((acc, [entityPath, entityPageState]) => {
|
|
126
|
+
if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
|
|
127
|
+
return Object.assign(Object.assign({}, acc), { [entityPath]: Object.assign(Object.assign({}, entityPageState), { rowSelection: {} }) });
|
|
128
|
+
}
|
|
129
|
+
return Object.assign(Object.assign({}, acc), { [entityPath]: entityPageState });
|
|
130
|
+
}, {});
|
|
131
|
+
}
|
|
132
|
+
exports.resetRowSelection = resetRowSelection;
|
|
100
133
|
/**
|
|
101
134
|
* Sets entity state for the given category group config key.
|
|
102
135
|
* @param categoryGroupConfigKey - Category group config key.
|
|
@@ -150,3 +183,19 @@ function updateEntityStateByCategoryGroupConfigKey(state, nextEntityState) {
|
|
|
150
183
|
}
|
|
151
184
|
}
|
|
152
185
|
exports.updateEntityStateByCategoryGroupConfigKey = updateEntityStateByCategoryGroupConfigKey;
|
|
186
|
+
/**
|
|
187
|
+
* Updates the entity page state for each entity with row selection enabled,
|
|
188
|
+
* by updating the visibility of the "select" column based on user access and resetting row selection state.
|
|
189
|
+
* @param state - Explore state.
|
|
190
|
+
* @param canEdit - User has edit access.
|
|
191
|
+
* @returns new entity page state mapper with updated column visibility and row selection state.
|
|
192
|
+
*/
|
|
193
|
+
function updateSelectColumnVisibility(state, canEdit) {
|
|
194
|
+
return Object.entries(state.entityPageState).reduce((acc, [entityPath, entityPageState]) => {
|
|
195
|
+
if (entityPageState.enableRowSelection) {
|
|
196
|
+
return Object.assign(Object.assign({}, acc), { [entityPath]: Object.assign(Object.assign({}, entityPageState), { columnsVisibility: Object.assign(Object.assign({}, entityPageState.columnsVisibility), { [constants_1.ACCESSOR_KEYS.SELECT]: canEdit }), rowSelection: {} }) });
|
|
197
|
+
}
|
|
198
|
+
return Object.assign(Object.assign({}, acc), { [entityPath]: entityPageState });
|
|
199
|
+
}, {});
|
|
200
|
+
}
|
|
201
|
+
exports.updateSelectColumnVisibility = updateSelectColumnVisibility;
|
|
@@ -2,8 +2,8 @@ import React, { Dispatch, ReactNode } from "react";
|
|
|
2
2
|
import { AzulSearchIndex } from "../apis/azul/common/entities";
|
|
3
3
|
import { SelectCategoryView, SelectedFilter } from "../common/entities";
|
|
4
4
|
import { CategoryGroup, SiteConfig } from "../config/entities";
|
|
5
|
-
import { EntityPageStateMapper, EntityStateByCategoryGroupConfigKey } from "./exploreState/entities";
|
|
6
|
-
import { ApplySavedFilterPayload, PaginateTablePayload, ProcessExploreResponsePayload, ProcessRelatedResponsePayload, ResetExploreResponsePayload, ToggleEntityViewPayload, UpdateColumnVisibilityPayload, UpdateFilterPayload, UpdateSortingPayload } from "./exploreState/payloads/entities";
|
|
5
|
+
import { EntityPageStateMapper, EntityStateByCategoryGroupConfigKey, ListItem } from "./exploreState/entities";
|
|
6
|
+
import { ApplySavedFilterPayload, PaginateTablePayload, PatchExploreResponsePayload, ProcessExploreResponsePayload, ProcessRelatedResponsePayload, ResetExploreResponsePayload, ToggleEntityViewPayload, UpdateColumnVisibilityPayload, UpdateEntityViewAccessPayload, UpdateFilterPayload, UpdateRowSelectionPayload, UpdateSortingPayload } from "./exploreState/payloads/entities";
|
|
7
7
|
export declare type CatalogState = string | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* Entity view.
|
|
@@ -50,7 +50,7 @@ export declare type FeatureFlagState = string | undefined;
|
|
|
50
50
|
/**
|
|
51
51
|
* List items.
|
|
52
52
|
*/
|
|
53
|
-
export declare type ListItems =
|
|
53
|
+
export declare type ListItems = ListItem[] | undefined;
|
|
54
54
|
/**
|
|
55
55
|
* Pagination index.
|
|
56
56
|
*/
|
|
@@ -106,6 +106,7 @@ export declare enum ExploreActionKind {
|
|
|
106
106
|
ApplySavedFilter = "APPLY_SAVED_FILTER",
|
|
107
107
|
ClearFilters = "CLEAR_FILTERS",
|
|
108
108
|
PaginateTable = "PAGINATE_TABLE",
|
|
109
|
+
PatchExploreResponse = "PATCH_EXPLORE_RESPONSE",
|
|
109
110
|
ProcessExploreResponse = "PROCESS_EXPLORE_RESPONSE",
|
|
110
111
|
ProcessRelatedResponse = "PROCESS_RELATED_RESPONSE",
|
|
111
112
|
ResetExploreResponse = "RESET_EXPLORE_RESPONSE",
|
|
@@ -113,13 +114,15 @@ export declare enum ExploreActionKind {
|
|
|
113
114
|
SelectEntityType = "SELECT_ENTITY_TYPE",
|
|
114
115
|
ToggleEntityView = "TOGGLE_ENTITY_VIEW",
|
|
115
116
|
UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
|
|
117
|
+
UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
|
|
116
118
|
UpdateFilter = "UPDATE_FILTER",
|
|
119
|
+
UpdateRowSelection = "UPDATE_ROW_SELECTION",
|
|
117
120
|
UpdateSorting = "UPDATE_SORTING"
|
|
118
121
|
}
|
|
119
122
|
/**
|
|
120
123
|
* Explore action.
|
|
121
124
|
*/
|
|
122
|
-
export declare type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | PaginateTableAction | ProcessExploreResponseAction | ProcessRelatedResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | ToggleEntityViewAction | UpdateColumnVisibilityAction | UpdateFilterAction | UpdateSortingAction;
|
|
125
|
+
export declare type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ProcessRelatedResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | ToggleEntityViewAction | UpdateColumnVisibilityAction | UpdateEntityViewAccessAction | UpdateFilterAction | UpdateRowSelectionAction | UpdateSortingAction;
|
|
123
126
|
/**
|
|
124
127
|
* Apply saved filter action.
|
|
125
128
|
*/
|
|
@@ -141,6 +144,13 @@ declare type PaginateTableAction = {
|
|
|
141
144
|
payload: PaginateTablePayload;
|
|
142
145
|
type: ExploreActionKind.PaginateTable;
|
|
143
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* Patch explore response action.
|
|
149
|
+
*/
|
|
150
|
+
declare type PatchExploreResponseAction = {
|
|
151
|
+
payload: PatchExploreResponsePayload;
|
|
152
|
+
type: ExploreActionKind.PatchExploreResponse;
|
|
153
|
+
};
|
|
144
154
|
/**
|
|
145
155
|
* Process explore response action.
|
|
146
156
|
*/
|
|
@@ -177,7 +187,7 @@ declare type SelectEntityTypeAction = {
|
|
|
177
187
|
type: ExploreActionKind.SelectEntityType;
|
|
178
188
|
};
|
|
179
189
|
/**
|
|
180
|
-
* Toggle entity view.
|
|
190
|
+
* Toggle entity view action.
|
|
181
191
|
*/
|
|
182
192
|
declare type ToggleEntityViewAction = {
|
|
183
193
|
payload: ToggleEntityViewPayload;
|
|
@@ -190,6 +200,13 @@ declare type UpdateColumnVisibilityAction = {
|
|
|
190
200
|
payload: UpdateColumnVisibilityPayload;
|
|
191
201
|
type: ExploreActionKind.UpdateColumnVisibility;
|
|
192
202
|
};
|
|
203
|
+
/**
|
|
204
|
+
* Update entity view access action.
|
|
205
|
+
*/
|
|
206
|
+
declare type UpdateEntityViewAccessAction = {
|
|
207
|
+
payload: UpdateEntityViewAccessPayload;
|
|
208
|
+
type: ExploreActionKind.UpdateEntityViewAccess;
|
|
209
|
+
};
|
|
193
210
|
/**
|
|
194
211
|
* Update filter action.
|
|
195
212
|
*/
|
|
@@ -197,6 +214,13 @@ declare type UpdateFilterAction = {
|
|
|
197
214
|
payload: UpdateFilterPayload;
|
|
198
215
|
type: ExploreActionKind.UpdateFilter;
|
|
199
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* Update row selection action.
|
|
219
|
+
*/
|
|
220
|
+
declare type UpdateRowSelectionAction = {
|
|
221
|
+
payload: UpdateRowSelectionPayload;
|
|
222
|
+
type: ExploreActionKind.UpdateRowSelection;
|
|
223
|
+
};
|
|
200
224
|
/**
|
|
201
225
|
* Update sorting action.
|
|
202
226
|
*/
|
|
@@ -96,6 +96,7 @@ var ExploreActionKind;
|
|
|
96
96
|
ExploreActionKind["ApplySavedFilter"] = "APPLY_SAVED_FILTER";
|
|
97
97
|
ExploreActionKind["ClearFilters"] = "CLEAR_FILTERS";
|
|
98
98
|
ExploreActionKind["PaginateTable"] = "PAGINATE_TABLE";
|
|
99
|
+
ExploreActionKind["PatchExploreResponse"] = "PATCH_EXPLORE_RESPONSE";
|
|
99
100
|
ExploreActionKind["ProcessExploreResponse"] = "PROCESS_EXPLORE_RESPONSE";
|
|
100
101
|
ExploreActionKind["ProcessRelatedResponse"] = "PROCESS_RELATED_RESPONSE";
|
|
101
102
|
ExploreActionKind["ResetExploreResponse"] = "RESET_EXPLORE_RESPONSE";
|
|
@@ -103,7 +104,9 @@ var ExploreActionKind;
|
|
|
103
104
|
ExploreActionKind["SelectEntityType"] = "SELECT_ENTITY_TYPE";
|
|
104
105
|
ExploreActionKind["ToggleEntityView"] = "TOGGLE_ENTITY_VIEW";
|
|
105
106
|
ExploreActionKind["UpdateColumnVisibility"] = "UPDATE_COLUMN_VISIBILITY";
|
|
107
|
+
ExploreActionKind["UpdateEntityViewAccess"] = "UPDATE_ENTITY_VIEW_ACCESS";
|
|
106
108
|
ExploreActionKind["UpdateFilter"] = "UPDATE_FILTER";
|
|
109
|
+
ExploreActionKind["UpdateRowSelection"] = "UPDATE_ROW_SELECTION";
|
|
107
110
|
ExploreActionKind["UpdateSorting"] = "UPDATE_SORTING";
|
|
108
111
|
})(ExploreActionKind = exports.ExploreActionKind || (exports.ExploreActionKind = {}));
|
|
109
112
|
/**
|
|
@@ -159,6 +162,12 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
159
162
|
}
|
|
160
163
|
return Object.assign(Object.assign({}, state), { paginationState: nextPaginationState });
|
|
161
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Patch explore response
|
|
167
|
+
*/
|
|
168
|
+
case ExploreActionKind.PatchExploreResponse: {
|
|
169
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { rowSelection: {} }), listItems: (0, utils_2.patchEntityListItems)(state.listItems, payload.updatedListItems, payload.listItemKey) });
|
|
170
|
+
}
|
|
162
171
|
/**
|
|
163
172
|
* Process explore response
|
|
164
173
|
**/
|
|
@@ -209,6 +218,18 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
209
218
|
case ExploreActionKind.ToggleEntityView: {
|
|
210
219
|
return Object.assign(Object.assign({}, state), { isRelatedView: payload === ENTITY_VIEW.RELATED, listView: payload });
|
|
211
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Update column visibility
|
|
223
|
+
**/
|
|
224
|
+
case ExploreActionKind.UpdateColumnVisibility: {
|
|
225
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { columnsVisibility: payload }) });
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Update entity view access
|
|
229
|
+
**/
|
|
230
|
+
case ExploreActionKind.UpdateEntityViewAccess: {
|
|
231
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateSelectColumnVisibility)(state, payload.canEdit) });
|
|
232
|
+
}
|
|
212
233
|
/**
|
|
213
234
|
* Update filter
|
|
214
235
|
**/
|
|
@@ -219,7 +240,13 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
219
240
|
filterState,
|
|
220
241
|
savedFilterState,
|
|
221
242
|
});
|
|
222
|
-
return Object.assign(Object.assign({}, state), { filterCount: (0, utils_2.getFilterCount)(filterState), filterState, paginationState: (0, utils_2.resetPage)(state.paginationState) });
|
|
243
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.resetRowSelection)(state), filterCount: (0, utils_2.getFilterCount)(filterState), filterState, paginationState: (0, utils_2.resetPage)(state.paginationState) });
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Update row selection
|
|
247
|
+
*/
|
|
248
|
+
case ExploreActionKind.UpdateRowSelection: {
|
|
249
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { rowSelection: payload }) });
|
|
223
250
|
}
|
|
224
251
|
/**
|
|
225
252
|
* Update sorting
|
|
@@ -227,12 +254,6 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
227
254
|
case ExploreActionKind.UpdateSorting: {
|
|
228
255
|
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { sorting: payload }), paginationState: (0, utils_2.resetPage)(state.paginationState) });
|
|
229
256
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Update column visibility
|
|
232
|
-
**/
|
|
233
|
-
case ExploreActionKind.UpdateColumnVisibility: {
|
|
234
|
-
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { columnsVisibility: payload }) });
|
|
235
|
-
}
|
|
236
257
|
default:
|
|
237
258
|
return state;
|
|
238
259
|
}
|
|
@@ -1198,6 +1198,10 @@ const MuiTableCell = (theme) => {
|
|
|
1198
1198
|
styleOverrides: {
|
|
1199
1199
|
body: Object.assign({}, theme.typography[typography_1.TEXT_BODY_400]),
|
|
1200
1200
|
head: Object.assign(Object.assign({}, theme.typography[typography_1.TEXT_BODY_SMALL_500]), { padding: "20px" }),
|
|
1201
|
+
paddingCheckbox: {
|
|
1202
|
+
paddingRight: 0,
|
|
1203
|
+
width: "unset",
|
|
1204
|
+
},
|
|
1201
1205
|
root: {
|
|
1202
1206
|
padding: "18px 20px",
|
|
1203
1207
|
},
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AzulEntitiesStaticResponse } from "../../apis/azul/common/entities";
|
|
3
|
-
export
|
|
3
|
+
export interface ExploreViewProps extends AzulEntitiesStaticResponse {
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
4
6
|
export declare const ExploreView: (props: ExploreViewProps) => JSX.Element;
|
|
@@ -157,7 +157,7 @@ const ExploreView = (props) => {
|
|
|
157
157
|
react_1.default.createElement(clearAllFilters_1.ClearAllFilters, null),
|
|
158
158
|
react_1.default.createElement(searchAllFilters_1.SearchAllFilters, { categoryViews: categoryViews, drawerOpen: isDrawerOpen, onFilter: onFilterChange.bind(null, true) })),
|
|
159
159
|
react_1.default.createElement(filters_1.Filters, { categoryFilters: categoryFilters, closeAncestor: onCloseDrawer, disabled: isRelatedView, onFilter: onFilterChange.bind(null, false), trackFilterOpened: trackingConfig === null || trackingConfig === void 0 ? void 0 : trackingConfig.trackFilterOpened }))),
|
|
160
|
-
react_1.default.createElement(index_1.Index, { List: renderList(exploreState, entityConfig, entityListType), ListHero: renderComponent(listHero), SideBarButton: tabletDown ? (react_1.default.createElement(sidebarButton_1.SidebarButton, { count: filterCount, label: "Filter", onClick: onOpenDrawer })) : undefined, SubTitleHero: renderComponent(subTitleHero), Summaries: renderSummary(summaryConfig, summaryResponse), Tabs: react_1.default.createElement(tabs_1.Tabs, { onTabChange: onTabChange, tabs: tabs, value: tabValue }), title: explorerTitle })));
|
|
160
|
+
react_1.default.createElement(index_1.Index, { className: props.className, List: renderList(exploreState, entityConfig, entityListType), ListHero: renderComponent(listHero), SideBarButton: tabletDown ? (react_1.default.createElement(sidebarButton_1.SidebarButton, { count: filterCount, label: "Filter", onClick: onOpenDrawer })) : undefined, SubTitleHero: renderComponent(subTitleHero), Summaries: renderSummary(summaryConfig, summaryResponse), Tabs: react_1.default.createElement(tabs_1.Tabs, { onTabChange: onTabChange, tabs: tabs, value: tabValue }), title: explorerTitle })));
|
|
161
161
|
};
|
|
162
162
|
exports.ExploreView = ExploreView;
|
|
163
163
|
/**
|
|
@@ -206,7 +206,7 @@ function renderComponent(componentsConfig, response) {
|
|
|
206
206
|
*/
|
|
207
207
|
function renderList(exploreState, entityConfig, entityListType) {
|
|
208
208
|
const { isRelatedView, listItems, loading, paginationState, relatedListItems, tabValue, } = exploreState;
|
|
209
|
-
const { list, listView } = entityConfig;
|
|
209
|
+
const { getId: getRowId, list, listView } = entityConfig;
|
|
210
210
|
const { columns: columnsConfig, defaultSort } = list;
|
|
211
211
|
if (!exploreState || !tabValue) {
|
|
212
212
|
return react_1.default.createElement(react_1.default.Fragment, null); //TODO: return the loading UI component
|
|
@@ -216,7 +216,7 @@ function renderList(exploreState, entityConfig, entityListType) {
|
|
|
216
216
|
// loads with the previous tabs data on the first render after switching tabs. (or similar)
|
|
217
217
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
218
218
|
}
|
|
219
|
-
return (react_1.default.createElement(tableCreator_1.TableCreator, { columns: columnsConfig, defaultSort: defaultSort, items: isRelatedView && relatedListItems ? relatedListItems : listItems !== null && listItems !== void 0 ? listItems : [], listView: listView, loading: loading, pages: paginationState.pages, pageSize: paginationState.pageSize, pagination: undefined, total: paginationState.rows }));
|
|
219
|
+
return (react_1.default.createElement(tableCreator_1.TableCreator, { columns: columnsConfig, defaultSort: defaultSort, getRowId: getRowId, items: isRelatedView && relatedListItems ? relatedListItems : listItems !== null && listItems !== void 0 ? listItems : [], listView: listView, loading: loading, pages: paginationState.pages, pageSize: paginationState.pageSize, pagination: undefined, total: paginationState.rows }));
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Renders Summaries component when all the following requirements are fulfilled:
|