@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,7 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEntityStateByCategoryGroupConfigKey = exports.updateEntityPageState = exports.resetPage = exports.getFilterCount = exports.
|
|
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");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the entity state saved filter state for the given category key.
|
|
8
|
+
* @param categoryKey - Category key.
|
|
9
|
+
* @param selectedValue - Key of category value that has been de/selected.
|
|
10
|
+
* @param selected - True if value is selected, false if de-selected.
|
|
11
|
+
* @returns entity state saved filter state.
|
|
12
|
+
*/
|
|
13
|
+
function buildEntityStateSavedFilterState(categoryKey, selectedValue, selected) {
|
|
14
|
+
if (!selected)
|
|
15
|
+
return [];
|
|
16
|
+
return [{ categoryKey, value: [selectedValue] }];
|
|
17
|
+
}
|
|
18
|
+
exports.buildEntityStateSavedFilterState = buildEntityStateSavedFilterState;
|
|
19
|
+
/**
|
|
20
|
+
* Build new set of selected filters on de/select of a "saved filter" filter.
|
|
21
|
+
* @param state - Explore state.
|
|
22
|
+
* @param selectedValue - Key of category value that has been de/selected.
|
|
23
|
+
* @param selected - True if value is selected, false if de-selected.
|
|
24
|
+
* @returns new selected filters.
|
|
25
|
+
*/
|
|
26
|
+
function buildNextSavedFilterState(state, selectedValue, selected) {
|
|
27
|
+
if (!selected)
|
|
28
|
+
return []; // Clears all filters on de-select of saved filter.
|
|
29
|
+
const savedFilter = getEntityStateSavedFilter(state, selectedValue);
|
|
30
|
+
return (savedFilter === null || savedFilter === void 0 ? void 0 : savedFilter.filters) || [];
|
|
31
|
+
}
|
|
32
|
+
exports.buildNextSavedFilterState = buildNextSavedFilterState;
|
|
5
33
|
/**
|
|
6
34
|
* Returns the category group config key for the current entity.
|
|
7
35
|
* @param entityPath - Entity path.
|
|
@@ -13,25 +41,42 @@ function getEntityCategoryGroupConfigKey(entityPath, entityPageState) {
|
|
|
13
41
|
}
|
|
14
42
|
exports.getEntityCategoryGroupConfigKey = getEntityCategoryGroupConfigKey;
|
|
15
43
|
/**
|
|
16
|
-
* Returns the
|
|
44
|
+
* Returns the entity state for the current entity.
|
|
17
45
|
* @param state - Explore state.
|
|
18
|
-
* @returns category configs.
|
|
19
|
-
*/
|
|
20
|
-
function getEntityCategoryConfigs(state) {
|
|
21
|
-
return getEntityState(getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState), state).categoryConfigs;
|
|
22
|
-
}
|
|
23
|
-
exports.getEntityCategoryConfigs = getEntityCategoryConfigs;
|
|
24
|
-
/**
|
|
25
|
-
* Returns the entity state for the given category group config key.
|
|
26
46
|
* @param categoryGroupConfigKey - Category group config key.
|
|
27
|
-
* @param state - Explore state.
|
|
28
47
|
* @returns entity state.
|
|
29
48
|
*/
|
|
30
|
-
function getEntityState(categoryGroupConfigKey, state) {
|
|
49
|
+
function getEntityState(state, categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState)) {
|
|
31
50
|
return (state.entityStateByCategoryGroupConfigKey.get(categoryGroupConfigKey) ||
|
|
32
|
-
|
|
51
|
+
constants_2.DEFAULT_ENTITY_STATE);
|
|
33
52
|
}
|
|
34
53
|
exports.getEntityState = getEntityState;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the saved filter/sorting for the given category key.
|
|
56
|
+
* @param state - Explore state.
|
|
57
|
+
* @param categoryValueKey - Category key.
|
|
58
|
+
* @returns saved filter/sorting for the category key.
|
|
59
|
+
*/
|
|
60
|
+
function getEntityStateSavedFilter(state, categoryValueKey) {
|
|
61
|
+
var _a;
|
|
62
|
+
const entityState = getEntityState(state);
|
|
63
|
+
return (_a = entityState.savedFilterByCategoryValueKey) === null || _a === void 0 ? void 0 : _a.get(categoryValueKey);
|
|
64
|
+
}
|
|
65
|
+
exports.getEntityStateSavedFilter = getEntityStateSavedFilter;
|
|
66
|
+
/**
|
|
67
|
+
* Returns entity state "saved filter" sorting for the given category value key.
|
|
68
|
+
* @param state - Explore state.
|
|
69
|
+
* @param selectedValue - Key of category value that has been de/selected.
|
|
70
|
+
* @param selected - True if value is selected, false if de-selected.
|
|
71
|
+
* @returns sorting.
|
|
72
|
+
*/
|
|
73
|
+
function getEntityStateSavedSorting(state, selectedValue, selected) {
|
|
74
|
+
if (!selected)
|
|
75
|
+
return;
|
|
76
|
+
const savedFilter = getEntityStateSavedFilter(state, selectedValue);
|
|
77
|
+
return savedFilter === null || savedFilter === void 0 ? void 0 : savedFilter.sorting;
|
|
78
|
+
}
|
|
79
|
+
exports.getEntityStateSavedSorting = getEntityStateSavedSorting;
|
|
35
80
|
/**
|
|
36
81
|
* Returns the filter count.
|
|
37
82
|
* @param filterState - Filter state.
|
|
@@ -41,6 +86,23 @@ function getFilterCount(filterState) {
|
|
|
41
86
|
return filterState.reduce((acc, filter) => acc + filter.value.length, 0);
|
|
42
87
|
}
|
|
43
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;
|
|
44
106
|
/**
|
|
45
107
|
* Resets pagination.
|
|
46
108
|
* @param paginationState - Pagination state.
|
|
@@ -53,6 +115,21 @@ function resetPage(paginationState) {
|
|
|
53
115
|
return nextPaginationState;
|
|
54
116
|
}
|
|
55
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;
|
|
56
133
|
/**
|
|
57
134
|
* Sets entity state for the given category group config key.
|
|
58
135
|
* @param categoryGroupConfigKey - Category group config key.
|
|
@@ -74,6 +151,24 @@ entityPageState, nextEntityPageState) {
|
|
|
74
151
|
return Object.assign(Object.assign({}, entityPageState), { [entityPath]: Object.assign(Object.assign({}, entityPageState[entityPath]), nextEntityPageState) });
|
|
75
152
|
}
|
|
76
153
|
exports.updateEntityPageState = updateEntityPageState;
|
|
154
|
+
/**
|
|
155
|
+
* Updates entity page state sorting for all entities with the same category group config key.
|
|
156
|
+
* @param state - Explore state.
|
|
157
|
+
* @param sorting - Sorting.
|
|
158
|
+
* @returns entity page state.
|
|
159
|
+
*/
|
|
160
|
+
function updateEntityPageStateSorting(state, sorting) {
|
|
161
|
+
if (!sorting)
|
|
162
|
+
return state.entityPageState;
|
|
163
|
+
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState);
|
|
164
|
+
return Object.entries(state.entityPageState).reduce((acc, [entityPath, entityPageState]) => {
|
|
165
|
+
if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
|
|
166
|
+
return Object.assign(Object.assign({}, acc), { [entityPath]: Object.assign(Object.assign({}, entityPageState), { sorting }) });
|
|
167
|
+
}
|
|
168
|
+
return Object.assign(Object.assign({}, acc), { [entityPath]: entityPageState });
|
|
169
|
+
}, {});
|
|
170
|
+
}
|
|
171
|
+
exports.updateEntityPageStateSorting = updateEntityPageStateSorting;
|
|
77
172
|
/**
|
|
78
173
|
* Updates entity state by category group config key.
|
|
79
174
|
* @param state - Explore state.
|
|
@@ -82,9 +177,25 @@ exports.updateEntityPageState = updateEntityPageState;
|
|
|
82
177
|
*/
|
|
83
178
|
function updateEntityStateByCategoryGroupConfigKey(state, nextEntityState) {
|
|
84
179
|
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState);
|
|
85
|
-
const entityState = getEntityState(
|
|
180
|
+
const entityState = getEntityState(state, categoryGroupConfigKey);
|
|
86
181
|
if (entityState) {
|
|
87
182
|
setEntityStateByCategoryGroupConfigKey(categoryGroupConfigKey, state, Object.assign(Object.assign({}, entityState), nextEntityState));
|
|
88
183
|
}
|
|
89
184
|
}
|
|
90
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;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { Dispatch, ReactNode } from "react";
|
|
2
2
|
import { AzulSearchIndex } from "../apis/azul/common/entities";
|
|
3
|
-
import {
|
|
3
|
+
import { SelectCategoryView, SelectedFilter } from "../common/entities";
|
|
4
4
|
import { CategoryGroup, SiteConfig } from "../config/entities";
|
|
5
|
-
import { EntityPageStateMapper, EntityStateByCategoryGroupConfigKey } from "./exploreState/entities";
|
|
6
|
-
import { 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.
|
|
@@ -25,7 +25,7 @@ export interface ExploreContext {
|
|
|
25
25
|
export declare type ExploreState = {
|
|
26
26
|
catalogState: CatalogState;
|
|
27
27
|
categoryGroups?: CategoryGroup[];
|
|
28
|
-
categoryViews:
|
|
28
|
+
categoryViews: SelectCategoryView[];
|
|
29
29
|
entityPageState: EntityPageStateMapper;
|
|
30
30
|
entityStateByCategoryGroupConfigKey: EntityStateByCategoryGroupConfigKey;
|
|
31
31
|
featureFlagState: FeatureFlagState;
|
|
@@ -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
|
*/
|
|
@@ -103,8 +103,10 @@ export declare function ExploreStateProvider({ children, entityListType, }: {
|
|
|
103
103
|
* Explore action kind.
|
|
104
104
|
*/
|
|
105
105
|
export declare enum ExploreActionKind {
|
|
106
|
+
ApplySavedFilter = "APPLY_SAVED_FILTER",
|
|
106
107
|
ClearFilters = "CLEAR_FILTERS",
|
|
107
108
|
PaginateTable = "PAGINATE_TABLE",
|
|
109
|
+
PatchExploreResponse = "PATCH_EXPLORE_RESPONSE",
|
|
108
110
|
ProcessExploreResponse = "PROCESS_EXPLORE_RESPONSE",
|
|
109
111
|
ProcessRelatedResponse = "PROCESS_RELATED_RESPONSE",
|
|
110
112
|
ResetExploreResponse = "RESET_EXPLORE_RESPONSE",
|
|
@@ -112,13 +114,22 @@ export declare enum ExploreActionKind {
|
|
|
112
114
|
SelectEntityType = "SELECT_ENTITY_TYPE",
|
|
113
115
|
ToggleEntityView = "TOGGLE_ENTITY_VIEW",
|
|
114
116
|
UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
|
|
117
|
+
UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
|
|
115
118
|
UpdateFilter = "UPDATE_FILTER",
|
|
119
|
+
UpdateRowSelection = "UPDATE_ROW_SELECTION",
|
|
116
120
|
UpdateSorting = "UPDATE_SORTING"
|
|
117
121
|
}
|
|
118
122
|
/**
|
|
119
123
|
* Explore action.
|
|
120
124
|
*/
|
|
121
|
-
export declare type ExploreAction = 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;
|
|
126
|
+
/**
|
|
127
|
+
* Apply saved filter action.
|
|
128
|
+
*/
|
|
129
|
+
declare type ApplySavedFilterAction = {
|
|
130
|
+
payload: ApplySavedFilterPayload;
|
|
131
|
+
type: ExploreActionKind.ApplySavedFilter;
|
|
132
|
+
};
|
|
122
133
|
/**
|
|
123
134
|
* Clear filters action.
|
|
124
135
|
*/
|
|
@@ -133,6 +144,13 @@ declare type PaginateTableAction = {
|
|
|
133
144
|
payload: PaginateTablePayload;
|
|
134
145
|
type: ExploreActionKind.PaginateTable;
|
|
135
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* Patch explore response action.
|
|
149
|
+
*/
|
|
150
|
+
declare type PatchExploreResponseAction = {
|
|
151
|
+
payload: PatchExploreResponsePayload;
|
|
152
|
+
type: ExploreActionKind.PatchExploreResponse;
|
|
153
|
+
};
|
|
136
154
|
/**
|
|
137
155
|
* Process explore response action.
|
|
138
156
|
*/
|
|
@@ -169,7 +187,7 @@ declare type SelectEntityTypeAction = {
|
|
|
169
187
|
type: ExploreActionKind.SelectEntityType;
|
|
170
188
|
};
|
|
171
189
|
/**
|
|
172
|
-
* Toggle entity view.
|
|
190
|
+
* Toggle entity view action.
|
|
173
191
|
*/
|
|
174
192
|
declare type ToggleEntityViewAction = {
|
|
175
193
|
payload: ToggleEntityViewPayload;
|
|
@@ -182,6 +200,13 @@ declare type UpdateColumnVisibilityAction = {
|
|
|
182
200
|
payload: UpdateColumnVisibilityPayload;
|
|
183
201
|
type: ExploreActionKind.UpdateColumnVisibility;
|
|
184
202
|
};
|
|
203
|
+
/**
|
|
204
|
+
* Update entity view access action.
|
|
205
|
+
*/
|
|
206
|
+
declare type UpdateEntityViewAccessAction = {
|
|
207
|
+
payload: UpdateEntityViewAccessPayload;
|
|
208
|
+
type: ExploreActionKind.UpdateEntityViewAccess;
|
|
209
|
+
};
|
|
185
210
|
/**
|
|
186
211
|
* Update filter action.
|
|
187
212
|
*/
|
|
@@ -189,6 +214,13 @@ declare type UpdateFilterAction = {
|
|
|
189
214
|
payload: UpdateFilterPayload;
|
|
190
215
|
type: ExploreActionKind.UpdateFilter;
|
|
191
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* Update row selection action.
|
|
219
|
+
*/
|
|
220
|
+
declare type UpdateRowSelectionAction = {
|
|
221
|
+
payload: UpdateRowSelectionPayload;
|
|
222
|
+
type: ExploreActionKind.UpdateRowSelection;
|
|
223
|
+
};
|
|
192
224
|
/**
|
|
193
225
|
* Update sorting action.
|
|
194
226
|
*/
|
|
@@ -93,8 +93,10 @@ exports.ExploreStateProvider = ExploreStateProvider;
|
|
|
93
93
|
*/
|
|
94
94
|
var ExploreActionKind;
|
|
95
95
|
(function (ExploreActionKind) {
|
|
96
|
+
ExploreActionKind["ApplySavedFilter"] = "APPLY_SAVED_FILTER";
|
|
96
97
|
ExploreActionKind["ClearFilters"] = "CLEAR_FILTERS";
|
|
97
98
|
ExploreActionKind["PaginateTable"] = "PAGINATE_TABLE";
|
|
99
|
+
ExploreActionKind["PatchExploreResponse"] = "PATCH_EXPLORE_RESPONSE";
|
|
98
100
|
ExploreActionKind["ProcessExploreResponse"] = "PROCESS_EXPLORE_RESPONSE";
|
|
99
101
|
ExploreActionKind["ProcessRelatedResponse"] = "PROCESS_RELATED_RESPONSE";
|
|
100
102
|
ExploreActionKind["ResetExploreResponse"] = "RESET_EXPLORE_RESPONSE";
|
|
@@ -102,7 +104,9 @@ var ExploreActionKind;
|
|
|
102
104
|
ExploreActionKind["SelectEntityType"] = "SELECT_ENTITY_TYPE";
|
|
103
105
|
ExploreActionKind["ToggleEntityView"] = "TOGGLE_ENTITY_VIEW";
|
|
104
106
|
ExploreActionKind["UpdateColumnVisibility"] = "UPDATE_COLUMN_VISIBILITY";
|
|
107
|
+
ExploreActionKind["UpdateEntityViewAccess"] = "UPDATE_ENTITY_VIEW_ACCESS";
|
|
105
108
|
ExploreActionKind["UpdateFilter"] = "UPDATE_FILTER";
|
|
109
|
+
ExploreActionKind["UpdateRowSelection"] = "UPDATE_ROW_SELECTION";
|
|
106
110
|
ExploreActionKind["UpdateSorting"] = "UPDATE_SORTING";
|
|
107
111
|
})(ExploreActionKind = exports.ExploreActionKind || (exports.ExploreActionKind = {}));
|
|
108
112
|
/**
|
|
@@ -116,13 +120,30 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
116
120
|
const { payload, type } = action;
|
|
117
121
|
const { config, entityList } = exploreContext;
|
|
118
122
|
switch (type) {
|
|
123
|
+
/**
|
|
124
|
+
* Apply saved filter
|
|
125
|
+
**/
|
|
126
|
+
case ExploreActionKind.ApplySavedFilter: {
|
|
127
|
+
const filterState = (0, utils_2.buildNextSavedFilterState)(state, payload.selectedValue, payload.selected);
|
|
128
|
+
const savedFilterState = (0, utils_2.buildEntityStateSavedFilterState)(payload.categoryKey, payload.selectedValue, payload.selected);
|
|
129
|
+
const savedSorting = (0, utils_2.getEntityStateSavedSorting)(state, payload.selectedValue, payload.selected);
|
|
130
|
+
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
131
|
+
filterState,
|
|
132
|
+
savedFilterState,
|
|
133
|
+
});
|
|
134
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageStateSorting)(state, savedSorting), filterCount: (0, utils_2.getFilterCount)(filterState), filterState, paginationState: (0, utils_2.resetPage)(state.paginationState) });
|
|
135
|
+
}
|
|
119
136
|
/**
|
|
120
137
|
* Clear all filters
|
|
121
138
|
**/
|
|
122
139
|
case ExploreActionKind.ClearFilters: {
|
|
123
140
|
const filterCount = 0;
|
|
124
141
|
const filterState = [];
|
|
125
|
-
|
|
142
|
+
const savedFilterState = [];
|
|
143
|
+
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
144
|
+
filterState,
|
|
145
|
+
savedFilterState,
|
|
146
|
+
});
|
|
126
147
|
return Object.assign(Object.assign({}, state), { filterCount,
|
|
127
148
|
filterState, paginationState: (0, utils_2.resetPage)(state.paginationState) });
|
|
128
149
|
}
|
|
@@ -141,12 +162,22 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
141
162
|
}
|
|
142
163
|
return Object.assign(Object.assign({}, state), { paginationState: nextPaginationState });
|
|
143
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
|
+
}
|
|
144
171
|
/**
|
|
145
172
|
* Process explore response
|
|
146
173
|
**/
|
|
147
174
|
case ExploreActionKind.ProcessExploreResponse: {
|
|
175
|
+
const entityState = (0, utils_2.getEntityState)(state);
|
|
148
176
|
const nextCategoryViews = payload.selectCategories
|
|
149
|
-
? (0, useCategoryFilter_1.buildCategoryViews)(
|
|
177
|
+
? (0, useCategoryFilter_1.buildCategoryViews)([
|
|
178
|
+
...payload.selectCategories,
|
|
179
|
+
...entityState.savedSelectCategories, // "savedFilter" select categories are built from config at reducer initialization.
|
|
180
|
+
], entityState.categoryConfigs, [...state.filterState, ...entityState.savedFilterState])
|
|
150
181
|
: state.categoryViews;
|
|
151
182
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
152
183
|
categoryViews: nextCategoryViews,
|
|
@@ -178,7 +209,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
178
209
|
if (payload === state.tabValue) {
|
|
179
210
|
return state;
|
|
180
211
|
}
|
|
181
|
-
const entityState = (0, utils_2.getEntityState)((0, utils_2.getEntityCategoryGroupConfigKey)(payload, state.entityPageState)
|
|
212
|
+
const entityState = (0, utils_2.getEntityState)(state, (0, utils_2.getEntityCategoryGroupConfigKey)(payload, state.entityPageState));
|
|
182
213
|
return Object.assign(Object.assign({}, state), { categoryGroups: entityState.categoryGroups, categoryViews: entityState.categoryViews, filterCount: (0, utils_2.getFilterCount)(entityState.filterState), filterState: entityState.filterState, listItems: [], loading: true, paginationState: (0, utils_2.resetPage)(state.paginationState), tabValue: payload });
|
|
183
214
|
}
|
|
184
215
|
/**
|
|
@@ -187,13 +218,35 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
187
218
|
case ExploreActionKind.ToggleEntityView: {
|
|
188
219
|
return Object.assign(Object.assign({}, state), { isRelatedView: payload === ENTITY_VIEW.RELATED, listView: payload });
|
|
189
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
|
+
}
|
|
190
233
|
/**
|
|
191
234
|
* Update filter
|
|
192
235
|
**/
|
|
193
236
|
case ExploreActionKind.UpdateFilter: {
|
|
194
237
|
const filterState = (0, useCategoryFilter_1.buildNextFilterState)(state.filterState, payload.categoryKey, payload.selectedValue, payload.selected);
|
|
195
|
-
|
|
196
|
-
|
|
238
|
+
const savedFilterState = []; // Clear saved filter state.
|
|
239
|
+
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
240
|
+
filterState,
|
|
241
|
+
savedFilterState,
|
|
242
|
+
});
|
|
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 }) });
|
|
197
250
|
}
|
|
198
251
|
/**
|
|
199
252
|
* Update sorting
|
|
@@ -201,12 +254,6 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
201
254
|
case ExploreActionKind.UpdateSorting: {
|
|
202
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) });
|
|
203
256
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Update column visibility
|
|
206
|
-
**/
|
|
207
|
-
case ExploreActionKind.UpdateColumnVisibility: {
|
|
208
|
-
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { columnsVisibility: payload }) });
|
|
209
|
-
}
|
|
210
257
|
default:
|
|
211
258
|
return state;
|
|
212
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;
|
|
@@ -46,6 +46,7 @@ const useEntityListRelatedView_1 = require("../../hooks/useEntityListRelatedView
|
|
|
46
46
|
const useExploreState_1 = require("../../hooks/useExploreState");
|
|
47
47
|
const useSummary_1 = require("../../hooks/useSummary");
|
|
48
48
|
const exploreState_1 = require("../../providers/exploreState");
|
|
49
|
+
const constants_1 = require("../../providers/exploreState/constants");
|
|
49
50
|
const breakpoints_1 = require("../../theme/common/breakpoints");
|
|
50
51
|
/**
|
|
51
52
|
* Returns tabs to be used as a prop for the Tabs component.
|
|
@@ -93,13 +94,16 @@ const ExploreView = (props) => {
|
|
|
93
94
|
*/
|
|
94
95
|
const onFilterChange = (fromSearchAll, categoryKey, selectedCategoryValue, selected, categorySection, searchTerm) => {
|
|
95
96
|
var _a;
|
|
97
|
+
const dispatchType = categoryKey === constants_1.SELECT_CATEGORY_KEY.SAVED_FILTERS
|
|
98
|
+
? exploreState_1.ExploreActionKind.ApplySavedFilter
|
|
99
|
+
: exploreState_1.ExploreActionKind.UpdateFilter;
|
|
96
100
|
exploreDispatch({
|
|
97
101
|
payload: {
|
|
98
102
|
categoryKey,
|
|
99
103
|
selected,
|
|
100
104
|
selectedValue: selectedCategoryValue,
|
|
101
105
|
},
|
|
102
|
-
type:
|
|
106
|
+
type: dispatchType,
|
|
103
107
|
});
|
|
104
108
|
(_a = trackingConfig === null || trackingConfig === void 0 ? void 0 : trackingConfig.trackFilterApplied) === null || _a === void 0 ? void 0 : _a.call(trackingConfig, {
|
|
105
109
|
category: categoryKey,
|
|
@@ -153,7 +157,7 @@ const ExploreView = (props) => {
|
|
|
153
157
|
react_1.default.createElement(clearAllFilters_1.ClearAllFilters, null),
|
|
154
158
|
react_1.default.createElement(searchAllFilters_1.SearchAllFilters, { categoryViews: categoryViews, drawerOpen: isDrawerOpen, onFilter: onFilterChange.bind(null, true) })),
|
|
155
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 }))),
|
|
156
|
-
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 })));
|
|
157
161
|
};
|
|
158
162
|
exports.ExploreView = ExploreView;
|
|
159
163
|
/**
|
|
@@ -166,18 +170,20 @@ function buildCategoryFilters(selectCategoryViews, categoryGroups) {
|
|
|
166
170
|
if (!categoryGroups) {
|
|
167
171
|
return [{ categoryViews: selectCategoryViews }];
|
|
168
172
|
}
|
|
169
|
-
return categoryGroups.
|
|
173
|
+
return categoryGroups.reduce((accGroups, { categoryConfigs, label }) => {
|
|
170
174
|
// Grab the category views for the configured grouped categories.
|
|
171
|
-
const categoryViews = categoryConfigs.reduce((
|
|
175
|
+
const categoryViews = categoryConfigs.reduce((accViews, { key: categoryKey }) => {
|
|
172
176
|
const categoryView = selectCategoryViews.find(({ key }) => key === categoryKey);
|
|
173
177
|
if (categoryView) {
|
|
174
|
-
|
|
178
|
+
accViews.push(categoryView);
|
|
175
179
|
}
|
|
176
|
-
return
|
|
180
|
+
return accViews;
|
|
177
181
|
}, []);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
if (categoryViews.length > 0) {
|
|
183
|
+
accGroups.push({ categoryViews, label });
|
|
184
|
+
}
|
|
185
|
+
return accGroups;
|
|
186
|
+
}, []);
|
|
181
187
|
}
|
|
182
188
|
/**
|
|
183
189
|
* Optionally renders component config.
|
|
@@ -200,7 +206,7 @@ function renderComponent(componentsConfig, response) {
|
|
|
200
206
|
*/
|
|
201
207
|
function renderList(exploreState, entityConfig, entityListType) {
|
|
202
208
|
const { isRelatedView, listItems, loading, paginationState, relatedListItems, tabValue, } = exploreState;
|
|
203
|
-
const { list, listView } = entityConfig;
|
|
209
|
+
const { getId: getRowId, list, listView } = entityConfig;
|
|
204
210
|
const { columns: columnsConfig, defaultSort } = list;
|
|
205
211
|
if (!exploreState || !tabValue) {
|
|
206
212
|
return react_1.default.createElement(react_1.default.Fragment, null); //TODO: return the loading UI component
|
|
@@ -210,7 +216,7 @@ function renderList(exploreState, entityConfig, entityListType) {
|
|
|
210
216
|
// loads with the previous tabs data on the first render after switching tabs. (or similar)
|
|
211
217
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
212
218
|
}
|
|
213
|
-
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 }));
|
|
214
220
|
}
|
|
215
221
|
/**
|
|
216
222
|
* Renders Summaries component when all the following requirements are fulfilled:
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
RoundedPaper,
|
|
8
8
|
} from "../../../common/Paper/paper.styles";
|
|
9
9
|
import { NoResults } from "../../../NoResults/noResults";
|
|
10
|
-
import {
|
|
10
|
+
import { Toolbar } from "../../../Table/components/TableToolbar/tableToolbar.styles";
|
|
11
11
|
import { Table } from "../Table/table";
|
|
12
12
|
|
|
13
13
|
interface DetailViewTableProps<T extends object> {
|
|
@@ -32,7 +32,7 @@ export const DetailViewTable = <T extends object>({
|
|
|
32
32
|
return items.length > 0 ? (
|
|
33
33
|
<Paper className={className}>
|
|
34
34
|
<GridPaper>
|
|
35
|
-
{tools && <
|
|
35
|
+
{tools && <Toolbar variant="table">{tools}</Toolbar>}
|
|
36
36
|
<Table
|
|
37
37
|
columns={columns}
|
|
38
38
|
gridTemplateColumns={gridTemplateColumns}
|
|
@@ -14,7 +14,7 @@ interface Props {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const Filters = styled("div", {
|
|
17
|
-
shouldForwardProp: (prop) => prop !== "height",
|
|
17
|
+
shouldForwardProp: (prop) => prop !== "height" && prop !== "isBaseStyle",
|
|
18
18
|
})<Props>`
|
|
19
19
|
${(props) => (props.isBaseStyle ? textBody500(props) : textBody400(props))};
|
|
20
20
|
color: ${(props) => (props.isBaseStyle ? inkMain(props) : inkLight(props))};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Divider } from "@mui/material";
|
|
2
|
-
import { TrackFilterOpenedFunction } from "config/entities";
|
|
3
2
|
import React, { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { CategoryTag, SelectCategoryView } from "../../../../common/entities";
|
|
4
|
+
import { TrackFilterOpenedFunction } from "../../../../config/entities";
|
|
5
5
|
import {
|
|
6
6
|
BREAKPOINT_FN_NAME,
|
|
7
7
|
useBreakpointHelper,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import React, { CSSProperties, useEffect, useRef } from "react";
|
|
8
8
|
import { CategoryKey } from "../../../../common/entities";
|
|
9
9
|
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
10
|
+
import { SELECT_CATEGORY_KEY } from "../../../../providers/exploreState/constants";
|
|
10
11
|
import { TEXT_BODY_SMALL_400 } from "../../../../theme/common/typography";
|
|
11
12
|
import { CheckedIcon } from "../../../common/CustomIcon/components/CheckedIcon/checkedIcon";
|
|
12
13
|
import { UncheckedIcon } from "../../../common/CustomIcon/components/UncheckedIcon/uncheckedIcon";
|
|
@@ -62,9 +63,11 @@ export default function VariableSizeListItem({
|
|
|
62
63
|
disableTypography
|
|
63
64
|
primary={<HighlightedLabel label={label} ranges={labelRanges} />}
|
|
64
65
|
secondary={
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
66
|
+
categoryKey !== SELECT_CATEGORY_KEY.SAVED_FILTERS && (
|
|
67
|
+
<Typography color="ink.light" variant={TEXT_BODY_SMALL_400}>
|
|
68
|
+
{count}
|
|
69
|
+
</Typography>
|
|
70
|
+
)
|
|
68
71
|
}
|
|
69
72
|
/>
|
|
70
73
|
</ListItemButton>
|
|
@@ -5,6 +5,7 @@ import { Hero } from "./components/Hero/hero";
|
|
|
5
5
|
import { Index as IndexLayout } from "./index.styles";
|
|
6
6
|
|
|
7
7
|
export interface IndexProps {
|
|
8
|
+
className?: string;
|
|
8
9
|
List?: ReactNode;
|
|
9
10
|
ListHero?: ReactNode | ReactNode[];
|
|
10
11
|
SideBarButton?: ReactNode;
|
|
@@ -15,6 +16,7 @@ export interface IndexProps {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const Index = ({
|
|
19
|
+
className,
|
|
18
20
|
List,
|
|
19
21
|
ListHero,
|
|
20
22
|
SideBarButton,
|
|
@@ -26,7 +28,7 @@ export const Index = ({
|
|
|
26
28
|
const { layoutState } = useLayoutState();
|
|
27
29
|
const { headerHeight } = layoutState;
|
|
28
30
|
return (
|
|
29
|
-
<IndexLayout marginTop={headerHeight}>
|
|
31
|
+
<IndexLayout className={className} marginTop={headerHeight}>
|
|
30
32
|
<Hero SideBarButton={SideBarButton} Summaries={Summaries} title={title} />
|
|
31
33
|
{SubTitleHero}
|
|
32
34
|
{Tabs}
|