@databiosphere/findable-ui 5.0.0 → 6.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/README.md +5 -1
- package/lib/components/ComponentCreator/ComponentCreator.d.ts +4 -2
- package/lib/components/ComponentCreator/ComponentCreator.js +6 -8
- package/lib/components/Detail/components/DetailViewTable/detailViewTable.d.ts +3 -3
- package/lib/components/Detail/components/DetailViewTable/detailViewTable.js +1 -1
- package/lib/components/Detail/components/Table/common/utils.d.ts +2 -2
- package/lib/components/Detail/components/Table/components/TableBody/tableBody.d.ts +3 -3
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts +3 -3
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -4
- package/lib/components/Detail/components/Table/components/TableRows/tableRows.d.ts +2 -2
- package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +2 -1
- package/lib/components/Detail/components/Table/table.d.ts +3 -4
- package/lib/components/Detail/components/Table/table.js +2 -1
- package/lib/components/Filter/components/Filters/filters.d.ts +1 -1
- package/lib/components/Index/components/Cell/cell.d.ts +3 -0
- package/lib/components/Index/components/Cell/cell.js +3 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +3 -0
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +3 -0
- package/lib/components/Index/components/NTag/nTag.d.ts +3 -0
- package/lib/components/Index/components/NTag/nTag.js +3 -0
- package/lib/components/Index/components/NTagCell/nTagCell.d.ts +6 -1
- package/lib/components/Index/components/NTagCell/nTagCell.js +6 -2
- package/lib/components/Layout/components/Outline/common/constants.d.ts +1 -1
- package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.d.ts +1 -1
- package/lib/components/Links/components/Link/link.d.ts +3 -1
- package/lib/components/Links/components/Link/link.js +4 -4
- package/lib/components/Table/common/gridTable.styles.js +8 -2
- package/lib/components/Table/common/utils.d.ts +19 -14
- package/lib/components/Table/common/utils.js +26 -11
- package/lib/components/Table/components/DownloadEntityResults/downloadEntityResults.d.ts +3 -3
- package/lib/components/Table/components/PaginationSummary/paginationSummary.js +9 -8
- package/lib/components/Table/components/TableBody/tableBody.d.ts +3 -3
- package/lib/components/Table/components/TableCell/common/utils.d.ts +3 -3
- package/lib/components/Table/components/TableCell/components/BasicCell/basicCell.d.ts +7 -0
- package/lib/components/Table/components/TableCell/components/BasicCell/basicCell.js +55 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/components/NTag/components/Tooltip/tooltip.d.ts +6 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/components/NTag/components/Tooltip/tooltip.js +93 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/components/NTag/components/Tooltip/tooltip.styles.d.ts +5 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/components/NTag/components/Tooltip/tooltip.styles.js +16 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/components/NTag/nTag.d.ts +7 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/components/NTag/nTag.js +24 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/nTagCell.d.ts +9 -0
- package/lib/components/Table/components/TableCell/components/NTagCell/nTagCell.js +53 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.d.ts +2 -2
- package/lib/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.d.ts +2 -2
- package/lib/components/Table/components/TableHead/tableHead.d.ts +3 -3
- package/lib/components/Table/components/TableRow/tableRow.styles.d.ts +16 -0
- package/lib/components/Table/components/TableRow/tableRow.styles.js +22 -0
- package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts +3 -3
- package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +3 -2
- package/lib/components/Table/components/TableRows/tableRows.d.ts +3 -3
- package/lib/components/Table/components/TableRows/tableRows.js +3 -1
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/common/constants.d.ts +2 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/common/constants.js +12 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/rowDrawer.d.ts +9 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/rowDrawer.js +32 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/rowDrawer.styles.d.ts +6 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/rowDrawer.styles.js +35 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/components/RowDetail/rowDetail.d.ts +12 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/components/RowDetail/rowDetail.js +32 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/components/RowDetail/rowDetail.styles.d.ts +5 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/components/RowDetail/rowDetail.styles.js +50 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/section.d.ts +7 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/section.js +16 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/section.styles.d.ts +5 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/components/Section/section.styles.js +17 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/rowPreview.d.ts +8 -0
- package/lib/components/Table/components/TableToolbar/components/RowPreview/rowPreview.js +14 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.d.ts +3 -3
- package/lib/components/Table/components/TableToolbar/tableToolbar.d.ts +3 -3
- package/lib/components/Table/components/TableToolbar/tableToolbar.js +9 -6
- package/lib/components/Table/features/RowPreview/constants.d.ts +2 -0
- package/lib/components/Table/features/RowPreview/constants.js +45 -0
- package/lib/components/Table/features/RowPreview/entities.d.ts +22 -0
- package/lib/components/Table/features/RowPreview/entities.js +2 -0
- package/lib/components/Table/features/RowPreview/utils.d.ts +33 -0
- package/lib/components/Table/features/RowPreview/utils.js +89 -0
- package/lib/components/Table/features/entities.d.ts +7 -0
- package/lib/components/Table/features/entities.js +2 -0
- package/lib/components/Table/table.d.ts +4 -12
- package/lib/components/Table/table.js +26 -38
- package/lib/components/TableCreator/common/entities.d.ts +1 -1
- package/lib/components/TableCreator/tableCreator.d.ts +2 -9
- package/lib/components/TableCreator/tableCreator.js +4 -4
- package/lib/components/common/Button/button.d.ts +1 -1
- package/lib/components/common/Drawer/components/DrawerTitle/drawerTitle.d.ts +7 -0
- package/lib/components/common/Drawer/components/DrawerTitle/drawerTitle.js +17 -0
- package/lib/components/common/Drawer/components/DrawerTitle/drawerTitle.styles.d.ts +5 -0
- package/lib/components/common/Drawer/components/DrawerTitle/drawerTitle.styles.js +17 -0
- package/lib/components/common/Drawer/components/drawer.styles.d.ts +5 -0
- package/lib/components/common/Drawer/components/drawer.styles.js +11 -0
- package/lib/components/common/Drawer/drawer.d.ts +7 -0
- package/lib/components/common/Drawer/drawer.js +24 -0
- package/lib/components/common/Grid/grid.d.ts +1 -1
- package/lib/components/common/Typography/common/entities.d.ts +2 -0
- package/lib/components/common/Typography/common/entities.js +2 -0
- package/lib/config/entities.d.ts +7 -25
- package/lib/providers/exploreState/entities.d.ts +3 -2
- package/lib/providers/exploreState/initializer/constants.js +1 -3
- package/lib/providers/exploreState/initializer/utils.js +1 -0
- package/lib/providers/exploreState/payloads/entities.d.ts +6 -11
- package/lib/providers/exploreState/utils.d.ts +12 -10
- package/lib/providers/exploreState/utils.js +20 -24
- package/lib/providers/exploreState.d.ts +12 -32
- package/lib/providers/exploreState.js +47 -36
- package/lib/styles/common/mixins/colors.d.ts +2 -1
- package/lib/styles/common/mixins/colors.js +3 -1
- package/lib/theme/common/components.js +11 -2
- package/lib/theme/common/palette.d.ts +3 -1
- package/lib/theme/common/palette.js +4 -1
- package/lib/views/ExploreView/exploreView.js +4 -6
- package/package.json +2 -2
- package/src/components/ComponentCreator/ComponentCreator.tsx +6 -1
- package/src/components/Detail/components/DetailViewTable/detailViewTable.tsx +4 -4
- package/src/components/Detail/components/Table/common/utils.ts +2 -2
- package/src/components/Detail/components/Table/components/TableBody/tableBody.tsx +3 -3
- package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +5 -7
- package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +10 -6
- package/src/components/Detail/components/Table/table.tsx +6 -3
- package/src/components/Filter/components/Filters/filters.tsx +1 -1
- package/src/components/Index/components/Cell/cell.tsx +4 -0
- package/src/components/Index/components/NTag/components/Tooltip/tooltip.tsx +4 -0
- package/src/components/Index/components/NTag/nTag.tsx +4 -0
- package/src/components/Index/components/NTagCell/nTagCell.tsx +22 -3
- package/src/components/Layout/components/Outline/common/constants.ts +1 -1
- package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +1 -1
- package/src/components/Links/components/Link/link.tsx +15 -2
- package/src/components/Table/common/gridTable.styles.ts +8 -2
- package/src/components/Table/common/utils.ts +55 -24
- package/src/components/Table/components/DownloadEntityResults/downloadEntityResults.tsx +3 -3
- package/src/components/Table/components/PaginationSummary/paginationSummary.tsx +11 -9
- package/src/components/Table/components/TableBody/tableBody.tsx +3 -3
- package/src/components/Table/components/TableCell/common/utils.ts +3 -3
- package/src/components/Table/components/TableCell/components/BasicCell/basicCell.tsx +52 -0
- package/src/components/Table/components/TableCell/components/NTagCell/components/NTag/components/Tooltip/tooltip.styles.ts +11 -0
- package/src/components/Table/components/TableCell/components/NTagCell/components/NTag/components/Tooltip/tooltip.tsx +86 -0
- package/src/components/Table/components/TableCell/components/NTagCell/components/NTag/nTag.tsx +21 -0
- package/src/components/Table/components/TableCell/components/NTagCell/nTagCell.tsx +70 -0
- package/src/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.tsx +2 -3
- package/src/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.tsx +2 -3
- package/src/components/Table/components/TableHead/tableHead.tsx +3 -3
- package/src/components/Table/components/TableRow/tableRow.styles.ts +22 -0
- package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +8 -6
- package/src/components/Table/components/TableRows/tableRows.tsx +9 -6
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/common/constants.ts +11 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/rowDrawer.styles.ts +31 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/RowDrawer/rowDrawer.tsx +52 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/Section/components/RowDetail/rowDetail.styles.ts +48 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/Section/components/RowDetail/rowDetail.tsx +53 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/Section/section.styles.ts +12 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/components/Section/section.tsx +25 -0
- package/src/components/Table/components/TableToolbar/components/RowPreview/rowPreview.tsx +19 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/rowSelection.tsx +3 -3
- package/src/components/Table/components/TableToolbar/tableToolbar.tsx +9 -4
- package/src/components/Table/features/RowPreview/constants.ts +65 -0
- package/src/components/Table/features/RowPreview/entities.ts +25 -0
- package/src/components/Table/features/RowPreview/utils.ts +93 -0
- package/src/components/Table/features/entities.ts +13 -0
- package/src/components/Table/table.tsx +40 -50
- package/src/components/TableCreator/common/entities.ts +1 -1
- package/src/components/TableCreator/tableCreator.tsx +15 -22
- package/src/components/common/Button/button.tsx +1 -2
- package/src/components/common/Drawer/components/DrawerTitle/drawerTitle.styles.ts +12 -0
- package/src/components/common/Drawer/components/DrawerTitle/drawerTitle.tsx +27 -0
- package/src/components/common/Drawer/components/drawer.styles.ts +6 -0
- package/src/components/common/Drawer/drawer.tsx +21 -0
- package/src/components/common/Grid/grid.tsx +1 -3
- package/src/components/common/Section/components/CollapsableSection/collapsableSection.tsx +1 -2
- package/src/components/common/Typography/common/entities.ts +5 -0
- package/src/config/entities.ts +7 -37
- package/src/providers/exploreState/entities.ts +7 -2
- package/src/providers/exploreState/initializer/constants.ts +1 -3
- package/src/providers/exploreState/initializer/utils.ts +2 -1
- package/src/providers/exploreState/payloads/entities.ts +7 -18
- package/src/providers/exploreState/utils.ts +25 -36
- package/src/providers/exploreState.tsx +93 -73
- package/src/styles/common/mixins/colors.ts +4 -1
- package/src/theme/common/components.ts +12 -0
- package/src/theme/common/palette.ts +4 -5
- package/src/theme/theme.ts +1 -2
- package/src/views/ExploreView/exploreView.tsx +3 -25
- package/types/data-explorer-ui.d.ts +21 -2
- package/src/hooks/useEntityListRelatedView.ts +0 -78
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ExploreActionKind = exports.ExploreStateProvider = exports.ExploreStateContext =
|
|
26
|
+
exports.ExploreActionKind = exports.ExploreStateProvider = exports.ExploreStateContext = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const useAuthentication_1 = require("../hooks/useAuthentication/useAuthentication");
|
|
29
29
|
const useCategoryFilter_1 = require("../hooks/useCategoryFilter");
|
|
@@ -32,14 +32,6 @@ const useURLFilterParams_1 = require("../hooks/useURLFilterParams");
|
|
|
32
32
|
const constants_1 = require("./exploreState/initializer/constants");
|
|
33
33
|
const utils_1 = require("./exploreState/initializer/utils");
|
|
34
34
|
const utils_2 = require("./exploreState/utils");
|
|
35
|
-
/**
|
|
36
|
-
* Entity view.
|
|
37
|
-
*/
|
|
38
|
-
var ENTITY_VIEW;
|
|
39
|
-
(function (ENTITY_VIEW) {
|
|
40
|
-
ENTITY_VIEW["EXACT"] = "EXACT";
|
|
41
|
-
ENTITY_VIEW["RELATED"] = "RELATED";
|
|
42
|
-
})(ENTITY_VIEW = exports.ENTITY_VIEW || (exports.ENTITY_VIEW = {}));
|
|
43
35
|
/**
|
|
44
36
|
* Explore state context for storing and using filter-related and explore state.
|
|
45
37
|
*/
|
|
@@ -98,15 +90,14 @@ var ExploreActionKind;
|
|
|
98
90
|
ExploreActionKind["PaginateTable"] = "PAGINATE_TABLE";
|
|
99
91
|
ExploreActionKind["PatchExploreResponse"] = "PATCH_EXPLORE_RESPONSE";
|
|
100
92
|
ExploreActionKind["ProcessExploreResponse"] = "PROCESS_EXPLORE_RESPONSE";
|
|
101
|
-
ExploreActionKind["ProcessRelatedResponse"] = "PROCESS_RELATED_RESPONSE";
|
|
102
93
|
ExploreActionKind["ResetExploreResponse"] = "RESET_EXPLORE_RESPONSE";
|
|
103
94
|
ExploreActionKind["ResetState"] = "RESET_STATE";
|
|
104
95
|
ExploreActionKind["SelectEntityType"] = "SELECT_ENTITY_TYPE";
|
|
105
|
-
ExploreActionKind["ToggleEntityView"] = "TOGGLE_ENTITY_VIEW";
|
|
106
96
|
ExploreActionKind["UpdateColumnVisibility"] = "UPDATE_COLUMN_VISIBILITY";
|
|
107
97
|
ExploreActionKind["UpdateEntityFilters"] = "UPDATE_ENTITY_FILTERS";
|
|
108
98
|
ExploreActionKind["UpdateEntityViewAccess"] = "UPDATE_ENTITY_VIEW_ACCESS";
|
|
109
99
|
ExploreActionKind["UpdateFilter"] = "UPDATE_FILTER";
|
|
100
|
+
ExploreActionKind["UpdateRowPreview"] = "UPDATE_ROW_PREVIEW";
|
|
110
101
|
ExploreActionKind["UpdateRowSelection"] = "UPDATE_ROW_SELECTION";
|
|
111
102
|
ExploreActionKind["UpdateSorting"] = "UPDATE_SORTING";
|
|
112
103
|
})(ExploreActionKind = exports.ExploreActionKind || (exports.ExploreActionKind = {}));
|
|
@@ -126,13 +117,16 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
126
117
|
**/
|
|
127
118
|
case ExploreActionKind.ApplySavedFilter: {
|
|
128
119
|
const filterState = (0, utils_2.buildNextSavedFilterState)(state, payload.selectedValue, payload.selected);
|
|
120
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.rowPreview);
|
|
121
|
+
const rowSelection = {};
|
|
129
122
|
const savedFilterState = (0, utils_2.buildEntityStateSavedFilterState)(payload.categoryKey, payload.selectedValue, payload.selected);
|
|
130
123
|
const savedSorting = (0, utils_2.getEntityStateSavedSorting)(state, payload.selectedValue, payload.selected);
|
|
124
|
+
const sorting = savedSorting || []; // Reset sorting to default if saved sorting is not available.
|
|
131
125
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
132
126
|
filterState,
|
|
133
127
|
savedFilterState,
|
|
134
128
|
});
|
|
135
|
-
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.
|
|
129
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageStateWithCommonCategoryGroupConfigKey)(state, { rowPreview, rowSelection, sorting }), filterCount: (0, utils_2.getFilterCount)(filterState), filterState, paginationState: (0, utils_2.resetPage)(state.paginationState), rowPreview });
|
|
136
130
|
}
|
|
137
131
|
/**
|
|
138
132
|
* Clear all filters
|
|
@@ -140,13 +134,15 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
140
134
|
case ExploreActionKind.ClearFilters: {
|
|
141
135
|
const filterCount = 0;
|
|
142
136
|
const filterState = [];
|
|
137
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.rowPreview);
|
|
138
|
+
const rowSelection = {};
|
|
143
139
|
const savedFilterState = [];
|
|
144
140
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
145
141
|
filterState,
|
|
146
142
|
savedFilterState,
|
|
147
143
|
});
|
|
148
|
-
return Object.assign(Object.assign({}, state), { filterCount,
|
|
149
|
-
filterState, paginationState: (0, utils_2.resetPage)(state.paginationState) });
|
|
144
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageStateWithCommonCategoryGroupConfigKey)(state, { rowPreview, rowSelection }), filterCount,
|
|
145
|
+
filterState, paginationState: (0, utils_2.resetPage)(state.paginationState), rowPreview });
|
|
150
146
|
}
|
|
151
147
|
/**
|
|
152
148
|
* Paginate table
|
|
@@ -161,7 +157,8 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
161
157
|
nextPaginationState.currentPage--;
|
|
162
158
|
nextPaginationState.index = nextPaginationState.previousIndex;
|
|
163
159
|
}
|
|
164
|
-
|
|
160
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.rowPreview);
|
|
161
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { rowPreview }), paginationState: nextPaginationState, rowPreview });
|
|
165
162
|
}
|
|
166
163
|
/**
|
|
167
164
|
* Patch explore response
|
|
@@ -173,6 +170,7 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
173
170
|
* Process explore response
|
|
174
171
|
**/
|
|
175
172
|
case ExploreActionKind.ProcessExploreResponse: {
|
|
173
|
+
const entityPageState = state.entityPageState[state.tabValue];
|
|
176
174
|
const entityState = (0, utils_2.getEntityState)(state);
|
|
177
175
|
const nextCategoryViews = payload.selectCategories
|
|
178
176
|
? (0, useCategoryFilter_1.buildCategoryViews)([
|
|
@@ -180,16 +178,11 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
180
178
|
...entityState.savedSelectCategories, // "savedFilter" select categories are built from config at reducer initialization.
|
|
181
179
|
], entityState.categoryConfigs, [...state.filterState, ...entityState.savedFilterState])
|
|
182
180
|
: state.categoryViews;
|
|
181
|
+
const rowPreview = entityPageState.rowPreview;
|
|
183
182
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
184
183
|
categoryViews: nextCategoryViews,
|
|
185
184
|
});
|
|
186
|
-
return Object.assign(Object.assign({}, state), { categoryViews: nextCategoryViews, listItems: payload.loading ? [] : payload.listItems, loading: payload.loading, paginationState: Object.assign(Object.assign({}, state.paginationState), payload.paginationResponse) });
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Process related response
|
|
190
|
-
*/
|
|
191
|
-
case ExploreActionKind.ProcessRelatedResponse: {
|
|
192
|
-
return Object.assign(Object.assign({}, state), { relatedListItems: payload.relatedListItems });
|
|
185
|
+
return Object.assign(Object.assign({}, state), { categoryViews: nextCategoryViews, listItems: payload.loading ? [] : payload.listItems, loading: payload.loading, paginationState: Object.assign(Object.assign({}, state.paginationState), payload.paginationResponse), rowPreview });
|
|
193
186
|
}
|
|
194
187
|
/**
|
|
195
188
|
* Reset explore response.
|
|
@@ -211,32 +204,38 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
211
204
|
return state;
|
|
212
205
|
}
|
|
213
206
|
const entityState = (0, utils_2.getEntityState)(state, (0, utils_2.getEntityCategoryGroupConfigKey)(payload, state.entityPageState));
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Toggle entity view
|
|
218
|
-
*/
|
|
219
|
-
case ExploreActionKind.ToggleEntityView: {
|
|
220
|
-
return Object.assign(Object.assign({}, state), { isRelatedView: payload === ENTITY_VIEW.RELATED, listView: payload });
|
|
207
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.rowPreview); // Close row preview, without updating the entity page state row preview.
|
|
208
|
+
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: Object.assign(Object.assign({}, (0, utils_2.resetPage)(state.paginationState)), { rows: 0 }), rowPreview, tabValue: payload });
|
|
221
209
|
}
|
|
222
210
|
/**
|
|
223
211
|
* Update column visibility
|
|
224
212
|
**/
|
|
225
213
|
case ExploreActionKind.UpdateColumnVisibility: {
|
|
226
|
-
|
|
214
|
+
const columnsVisibility = payload;
|
|
215
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { columnsVisibility }) });
|
|
227
216
|
}
|
|
228
217
|
/**
|
|
229
218
|
* Update entity filters.
|
|
219
|
+
* Updates state for the given entity and entities with the same category group config key, prior to navigation to the entity.
|
|
220
|
+
* Actions for the given entity and entities with the same category group config key:
|
|
221
|
+
* - updates filter state,
|
|
222
|
+
* - clears saved filter state,
|
|
223
|
+
* - resets row selection, and
|
|
224
|
+
* - closes row preview.
|
|
225
|
+
* Actions for the current entity:
|
|
226
|
+
* - closes row preview, without updating the entity page state row preview.
|
|
230
227
|
*/
|
|
231
228
|
case ExploreActionKind.UpdateEntityFilters: {
|
|
232
229
|
const { entityListType, filters: filterState, sorting } = payload;
|
|
233
230
|
const categoryGroupConfigKey = (0, utils_2.getEntityCategoryGroupConfigKey)(entityListType, state.entityPageState);
|
|
231
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.entityPageState[entityListType].rowPreview);
|
|
232
|
+
const rowSelection = {};
|
|
233
|
+
const savedFilterState = [];
|
|
234
234
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
235
235
|
filterState,
|
|
236
|
-
savedFilterState
|
|
236
|
+
savedFilterState,
|
|
237
237
|
}, categoryGroupConfigKey);
|
|
238
|
-
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.
|
|
239
|
-
) });
|
|
238
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageStateWithCommonCategoryGroupConfigKey)(state, { rowPreview, rowSelection, sorting }, categoryGroupConfigKey), rowPreview: (0, utils_2.closeRowPreview)(state.rowPreview) });
|
|
240
239
|
}
|
|
241
240
|
/**
|
|
242
241
|
* Update entity view access
|
|
@@ -249,24 +248,36 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
249
248
|
**/
|
|
250
249
|
case ExploreActionKind.UpdateFilter: {
|
|
251
250
|
const filterState = (0, useCategoryFilter_1.buildNextFilterState)(state.filterState, payload.categoryKey, payload.selectedValue, payload.selected);
|
|
251
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.rowPreview);
|
|
252
|
+
const rowSelection = {};
|
|
252
253
|
const savedFilterState = []; // Clear saved filter state.
|
|
253
254
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
254
255
|
filterState,
|
|
255
256
|
savedFilterState,
|
|
256
257
|
});
|
|
257
|
-
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.
|
|
258
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageStateWithCommonCategoryGroupConfigKey)(state, { rowPreview, rowSelection }), filterCount: (0, utils_2.getFilterCount)(filterState), filterState, paginationState: (0, utils_2.resetPage)(state.paginationState), rowPreview });
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Update row preview
|
|
262
|
+
*/
|
|
263
|
+
case ExploreActionKind.UpdateRowPreview: {
|
|
264
|
+
const rowPreview = payload;
|
|
265
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { rowPreview }), rowPreview });
|
|
258
266
|
}
|
|
259
267
|
/**
|
|
260
268
|
* Update row selection
|
|
261
269
|
*/
|
|
262
270
|
case ExploreActionKind.UpdateRowSelection: {
|
|
263
|
-
|
|
271
|
+
const rowSelection = payload;
|
|
272
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { rowSelection }) });
|
|
264
273
|
}
|
|
265
274
|
/**
|
|
266
275
|
* Update sorting
|
|
267
276
|
**/
|
|
268
277
|
case ExploreActionKind.UpdateSorting: {
|
|
269
|
-
|
|
278
|
+
const rowPreview = (0, utils_2.closeRowPreview)(state.rowPreview);
|
|
279
|
+
const sorting = payload;
|
|
280
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { rowPreview, sorting }), paginationState: (0, utils_2.resetPage)(state.paginationState), rowPreview });
|
|
270
281
|
}
|
|
271
282
|
default:
|
|
272
283
|
return state;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonColors, PaletteColor } from "@mui/material/styles
|
|
1
|
+
import { CommonColors, PaletteColor } from "@mui/material/styles";
|
|
2
2
|
import { ThemeProps } from "../../../theme/theme";
|
|
3
3
|
export declare const alertLight: ({ theme }: ThemeProps) => PaletteColor["light"];
|
|
4
4
|
export declare const alertLightest: ({ theme, }: ThemeProps) => PaletteColor["lightest"];
|
|
@@ -10,6 +10,7 @@ export declare const infoMain: ({ theme }: ThemeProps) => PaletteColor["main"];
|
|
|
10
10
|
export declare const inkLight: ({ theme }: ThemeProps) => PaletteColor["light"];
|
|
11
11
|
export declare const inkMain: ({ theme }: ThemeProps) => PaletteColor["main"];
|
|
12
12
|
export declare const primaryDark: ({ theme }: ThemeProps) => PaletteColor["dark"];
|
|
13
|
+
export declare const primaryLightest: ({ theme, }: ThemeProps) => PaletteColor["lightest"];
|
|
13
14
|
export declare const primaryMain: ({ theme }: ThemeProps) => PaletteColor["main"];
|
|
14
15
|
export declare const smokeDark: ({ theme }: ThemeProps) => PaletteColor["dark"];
|
|
15
16
|
export declare const smokeLight: ({ theme }: ThemeProps) => PaletteColor["light"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.white = exports.warningMain = exports.warningLightest = exports.warningLight = exports.successMain = exports.successLightest = exports.successLight = exports.smokeMain = exports.smokeLightest = exports.smokeLight = exports.smokeDark = exports.primaryMain = exports.primaryDark = exports.inkMain = exports.inkLight = exports.infoMain = exports.infoLightest = exports.infoLight = exports.errorMain = exports.alertMain = exports.alertLightest = exports.alertLight = void 0;
|
|
3
|
+
exports.white = exports.warningMain = exports.warningLightest = exports.warningLight = exports.successMain = exports.successLightest = exports.successLight = exports.smokeMain = exports.smokeLightest = exports.smokeLight = exports.smokeDark = exports.primaryMain = exports.primaryLightest = exports.primaryDark = exports.inkMain = exports.inkLight = exports.infoMain = exports.infoLightest = exports.infoLight = exports.errorMain = exports.alertMain = exports.alertLightest = exports.alertLight = void 0;
|
|
4
4
|
// Alert
|
|
5
5
|
const alertLight = ({ theme }) => theme.palette.alert.light;
|
|
6
6
|
exports.alertLight = alertLight;
|
|
@@ -26,6 +26,8 @@ exports.inkMain = inkMain;
|
|
|
26
26
|
// Primary
|
|
27
27
|
const primaryDark = ({ theme }) => theme.palette.primary.dark;
|
|
28
28
|
exports.primaryDark = primaryDark;
|
|
29
|
+
const primaryLightest = ({ theme, }) => theme.palette.primary.lightest;
|
|
30
|
+
exports.primaryLightest = primaryLightest;
|
|
29
31
|
const primaryMain = ({ theme }) => theme.palette.primary.main;
|
|
30
32
|
exports.primaryMain = primaryMain;
|
|
31
33
|
// Smoke
|
|
@@ -542,11 +542,11 @@ const MuiChip = (theme) => {
|
|
|
542
542
|
},
|
|
543
543
|
{
|
|
544
544
|
props: { variant: "ntag" },
|
|
545
|
-
style: Object.assign(Object.assign({}, theme.typography[typography_1.TEXT_BODY_SMALL_400]), { backgroundColor: theme.palette.smoke.main, boxShadow: `0 0 0 2px ${palette_1.white}`, height: 24 }),
|
|
545
|
+
style: Object.assign(Object.assign({}, theme.typography[typography_1.TEXT_BODY_SMALL_400]), { backgroundColor: theme.palette.smoke.main, boxShadow: `0 0 0 2px ${palette_1.white}`, height: 24, justifySelf: FLEX_START, minWidth: 0 }),
|
|
546
546
|
},
|
|
547
547
|
{
|
|
548
548
|
props: { variant: "status" },
|
|
549
|
-
style: Object.assign(Object.assign({}, theme.typography[typography_1.TEXT_BODY_SMALL_500]), { boxShadow: `0 0 0 2px ${palette_1.white}`, height: 20, maxWidth: "fit-content" }),
|
|
549
|
+
style: Object.assign(Object.assign({}, theme.typography[typography_1.TEXT_BODY_SMALL_500]), { boxShadow: `0 0 0 2px ${palette_1.white}`, height: 20, maxWidth: "fit-content", minWidth: 0 }),
|
|
550
550
|
},
|
|
551
551
|
],
|
|
552
552
|
};
|
|
@@ -1063,6 +1063,15 @@ const MuiPaper = (theme) => {
|
|
|
1063
1063
|
},
|
|
1064
1064
|
},
|
|
1065
1065
|
},
|
|
1066
|
+
{
|
|
1067
|
+
props: { variant: "table" },
|
|
1068
|
+
style: {
|
|
1069
|
+
borderColor: theme.palette.smoke.main,
|
|
1070
|
+
borderStyle: "solid",
|
|
1071
|
+
borderWidth: 1,
|
|
1072
|
+
boxShadow: theme.shadows[1], // elevation01
|
|
1073
|
+
},
|
|
1074
|
+
},
|
|
1066
1075
|
],
|
|
1067
1076
|
};
|
|
1068
1077
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PaletteColorOptions } from "@mui/material";
|
|
2
|
-
import { CommonColors, TypeBackground, TypeText } from "@mui/material/styles
|
|
2
|
+
import { CommonColors, TypeBackground, TypeText } from "@mui/material/styles";
|
|
3
3
|
/**
|
|
4
4
|
* Palette "Alert"
|
|
5
5
|
*/
|
|
@@ -35,6 +35,7 @@ declare enum INK {
|
|
|
35
35
|
*/
|
|
36
36
|
declare enum PRIMARY {
|
|
37
37
|
DARK = "#005EA9",
|
|
38
|
+
LIGHTEST = "#E6EFF6",
|
|
38
39
|
MAIN = "#1C7CC7"
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
@@ -106,6 +107,7 @@ export declare const infoMain = INFO.CONTRAST_TEXT;
|
|
|
106
107
|
export declare const inkLight = INK.LIGHT;
|
|
107
108
|
export declare const inkMain = INK.MAIN;
|
|
108
109
|
export declare const primaryDark = PRIMARY.DARK;
|
|
110
|
+
export declare const primaryLightest = PRIMARY.LIGHTEST;
|
|
109
111
|
export declare const primaryMain = PRIMARY.MAIN;
|
|
110
112
|
export declare const smokeDark = SMOKE.DARK;
|
|
111
113
|
export declare const smokeLight = SMOKE.LIGHT;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.warning = exports.text = exports.success = exports.smoke = exports.primary = exports.ink = exports.info = exports.common = exports.background = exports.alert = exports.black08 = exports.black04 = exports.alpha80 = exports.alpha64 = exports.alpha60 = exports.alpha32 = exports.alpha08 = exports.alpha04 = exports.white = exports.black = exports.warningMain = exports.warningLightest = exports.warningLight = exports.warningContrastText = exports.textPrimary = exports.successMain = exports.successLightest = exports.successLight = exports.smokeMain = exports.smokeLightest = exports.smokeLight = exports.smokeDark = exports.primaryMain = exports.primaryDark = exports.inkMain = exports.inkLight = exports.infoMain = exports.infoLightest = exports.infoLight = exports.infoContrastText = exports.backgroundDefault = exports.alertMain = exports.alertLightest = exports.alertLight = void 0;
|
|
3
|
+
exports.warning = exports.text = exports.success = exports.smoke = exports.primary = exports.ink = exports.info = exports.common = exports.background = exports.alert = exports.black08 = exports.black04 = exports.alpha80 = exports.alpha64 = exports.alpha60 = exports.alpha32 = exports.alpha08 = exports.alpha04 = exports.white = exports.black = exports.warningMain = exports.warningLightest = exports.warningLight = exports.warningContrastText = exports.textPrimary = exports.successMain = exports.successLightest = exports.successLight = exports.smokeMain = exports.smokeLightest = exports.smokeLight = exports.smokeDark = exports.primaryMain = exports.primaryLightest = exports.primaryDark = exports.inkMain = exports.inkLight = exports.infoMain = exports.infoLightest = exports.infoLight = exports.infoContrastText = exports.backgroundDefault = exports.alertMain = exports.alertLightest = exports.alertLight = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Palette "Alert"
|
|
6
6
|
*/
|
|
@@ -41,6 +41,7 @@ var INK;
|
|
|
41
41
|
var PRIMARY;
|
|
42
42
|
(function (PRIMARY) {
|
|
43
43
|
PRIMARY["DARK"] = "#005EA9";
|
|
44
|
+
PRIMARY["LIGHTEST"] = "#E6EFF6";
|
|
44
45
|
PRIMARY["MAIN"] = "#1C7CC7";
|
|
45
46
|
})(PRIMARY || (PRIMARY = {}));
|
|
46
47
|
/**
|
|
@@ -119,6 +120,7 @@ exports.infoMain = INFO.MAIN;
|
|
|
119
120
|
exports.inkLight = INK.LIGHT;
|
|
120
121
|
exports.inkMain = INK.MAIN;
|
|
121
122
|
exports.primaryDark = PRIMARY.DARK;
|
|
123
|
+
exports.primaryLightest = PRIMARY.LIGHTEST;
|
|
122
124
|
exports.primaryMain = PRIMARY.MAIN;
|
|
123
125
|
exports.smokeDark = SMOKE.DARK;
|
|
124
126
|
exports.smokeLight = SMOKE.LIGHT;
|
|
@@ -190,6 +192,7 @@ exports.ink = {
|
|
|
190
192
|
*/
|
|
191
193
|
exports.primary = {
|
|
192
194
|
dark: exports.primaryDark,
|
|
195
|
+
lightest: exports.primaryLightest,
|
|
193
196
|
main: exports.primaryMain,
|
|
194
197
|
};
|
|
195
198
|
/**
|
|
@@ -42,7 +42,6 @@ const tableCreator_1 = require("../../components/TableCreator/tableCreator");
|
|
|
42
42
|
const useBreakpointHelper_1 = require("../../hooks/useBreakpointHelper");
|
|
43
43
|
const useConfig_1 = require("../../hooks/useConfig");
|
|
44
44
|
const useEntityList_1 = require("../../hooks/useEntityList");
|
|
45
|
-
const useEntityListRelatedView_1 = require("../../hooks/useEntityListRelatedView");
|
|
46
45
|
const useExploreState_1 = require("../../hooks/useExploreState");
|
|
47
46
|
const useSummary_1 = require("../../hooks/useSummary");
|
|
48
47
|
const exploreState_1 = require("../../providers/exploreState");
|
|
@@ -69,12 +68,11 @@ const ExploreView = (props) => {
|
|
|
69
68
|
const { entities, explorerTitle, summaryConfig, trackingConfig } = config;
|
|
70
69
|
const { listView } = entityConfig;
|
|
71
70
|
const { listHero, subTitleHero } = listView || {};
|
|
72
|
-
const { categoryGroups, categoryViews, filterCount,
|
|
71
|
+
const { categoryGroups, categoryViews, filterCount, tabValue } = exploreState;
|
|
73
72
|
const { push } = (0, router_1.useRouter)();
|
|
74
73
|
const tabs = getTabs(entities);
|
|
75
74
|
const { response: summaryResponse } = (0, useSummary_1.useSummary)(); // Fetch summary.
|
|
76
75
|
(0, useEntityList_1.useEntityList)(props); // Fetch entities.
|
|
77
|
-
(0, useEntityListRelatedView_1.useEntityListRelatedView)(); // Fetch related entities.
|
|
78
76
|
const { entityListType } = props;
|
|
79
77
|
const categoryFilters = (0, react_1.useMemo)(() => buildCategoryFilters(categoryViews, categoryGroups), [categoryGroups, categoryViews]);
|
|
80
78
|
/**
|
|
@@ -156,7 +154,7 @@ const ExploreView = (props) => {
|
|
|
156
154
|
react_1.default.createElement(sidebarLabel_1.SidebarLabel, { label: "Filters" }),
|
|
157
155
|
react_1.default.createElement(clearAllFilters_1.ClearAllFilters, null),
|
|
158
156
|
react_1.default.createElement(searchAllFilters_1.SearchAllFilters, { categoryViews: categoryViews, drawerOpen: isDrawerOpen, onFilter: onFilterChange.bind(null, true) })),
|
|
159
|
-
react_1.default.createElement(filters_1.Filters, { categoryFilters: categoryFilters, closeAncestor: onCloseDrawer,
|
|
157
|
+
react_1.default.createElement(filters_1.Filters, { categoryFilters: categoryFilters, closeAncestor: onCloseDrawer, onFilter: onFilterChange.bind(null, false), trackFilterOpened: trackingConfig === null || trackingConfig === void 0 ? void 0 : trackingConfig.trackFilterOpened }))),
|
|
160
158
|
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
159
|
};
|
|
162
160
|
exports.ExploreView = ExploreView;
|
|
@@ -205,7 +203,7 @@ function renderComponent(componentsConfig, response) {
|
|
|
205
203
|
* @returns rendered Table component.
|
|
206
204
|
*/
|
|
207
205
|
function renderList(exploreState, entityConfig, entityListType) {
|
|
208
|
-
const {
|
|
206
|
+
const { listItems, loading, tabValue } = exploreState;
|
|
209
207
|
const { getId: getRowId, list, listView } = entityConfig;
|
|
210
208
|
const { columns: columnsConfig, defaultSort } = list;
|
|
211
209
|
if (!exploreState || !tabValue) {
|
|
@@ -216,7 +214,7 @@ function renderList(exploreState, entityConfig, entityListType) {
|
|
|
216
214
|
// loads with the previous tabs data on the first render after switching tabs. (or similar)
|
|
217
215
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
218
216
|
}
|
|
219
|
-
return (react_1.default.createElement(tableCreator_1.TableCreator, { columns: columnsConfig, defaultSort: defaultSort, getRowId: getRowId, items:
|
|
217
|
+
return (react_1.default.createElement(tableCreator_1.TableCreator, { columns: columnsConfig, defaultSort: defaultSort, getRowId: getRowId, items: listItems !== null && listItems !== void 0 ? listItems : [], listView: listView, loading: loading }));
|
|
220
218
|
}
|
|
221
219
|
/**
|
|
222
220
|
* Renders Summaries component when all the following requirements are fulfilled:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databiosphere/findable-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@emotion/styled": "11.11.0",
|
|
67
67
|
"@mui/icons-material": "5.14.1",
|
|
68
68
|
"@mui/material": "5.14.1",
|
|
69
|
-
"@tanstack/react-table": "8.
|
|
69
|
+
"@tanstack/react-table": "^8.17.3",
|
|
70
70
|
"@tanstack/react-virtual": "^3.0.0-beta.59",
|
|
71
71
|
"axios": "^1.6.7",
|
|
72
72
|
"copy-to-clipboard": "3.3.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ComponentsConfig } from "../../config/entities";
|
|
2
|
+
import { ComponentsConfig, ViewContext } from "../../config/entities";
|
|
3
3
|
import { useAuthentication } from "../../hooks/useAuthentication/useAuthentication";
|
|
4
4
|
import { useConfig } from "../../hooks/useConfig";
|
|
5
5
|
import { useExploreState } from "../../hooks/useExploreState";
|
|
@@ -9,6 +9,7 @@ import { useSystemStatus } from "../../hooks/useSystemStatus";
|
|
|
9
9
|
export interface ComponentCreatorProps<T> {
|
|
10
10
|
components: ComponentsConfig;
|
|
11
11
|
response: T;
|
|
12
|
+
viewContext?: Partial<ViewContext<T>>;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -18,11 +19,13 @@ export interface ComponentCreatorProps<T> {
|
|
|
18
19
|
* @param componentCreatorProps - Custom props required for creating component.
|
|
19
20
|
* @param componentCreatorProps.components - Component config to render as React elements.
|
|
20
21
|
* @param componentCreatorProps.response - Response returned from API endpoint, used to populate component props.
|
|
22
|
+
* @param componentCreatorProps.viewContext - Additional context to pass to the component.
|
|
21
23
|
* @returns A set of React components.
|
|
22
24
|
*/
|
|
23
25
|
export const ComponentCreator = <T,>({
|
|
24
26
|
components,
|
|
25
27
|
response,
|
|
28
|
+
viewContext,
|
|
26
29
|
}: ComponentCreatorProps<T>): JSX.Element => {
|
|
27
30
|
const { authenticationStatus, isAuthenticated } = useAuthentication();
|
|
28
31
|
const { config, entityConfig } = useConfig();
|
|
@@ -43,10 +46,12 @@ export const ComponentCreator = <T,>({
|
|
|
43
46
|
key={k}
|
|
44
47
|
components={c.children}
|
|
45
48
|
response={response}
|
|
49
|
+
viewContext={viewContext}
|
|
46
50
|
/>
|
|
47
51
|
) : null;
|
|
48
52
|
const props = c.viewBuilder
|
|
49
53
|
? c.viewBuilder(response, {
|
|
54
|
+
...viewContext,
|
|
50
55
|
authState: {
|
|
51
56
|
authenticationStatus,
|
|
52
57
|
isAuthenticated,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
1
|
+
import { ColumnDef, RowData } from "@tanstack/react-table";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
import {
|
|
4
4
|
FlatPaper,
|
|
@@ -10,7 +10,7 @@ import { NoResults } from "../../../NoResults/noResults";
|
|
|
10
10
|
import { Toolbar } from "../../../Table/components/TableToolbar/tableToolbar.styles";
|
|
11
11
|
import { Table, TableProps } from "../Table/table";
|
|
12
12
|
|
|
13
|
-
interface DetailViewTableProps<T extends
|
|
13
|
+
interface DetailViewTableProps<T extends RowData> extends TableProps<T> {
|
|
14
14
|
className?: string;
|
|
15
15
|
columns: ColumnDef<T>[];
|
|
16
16
|
gridTemplateColumns: string;
|
|
@@ -20,7 +20,7 @@ interface DetailViewTableProps<T extends object> extends TableProps<T> {
|
|
|
20
20
|
tools?: ReactNode;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const DetailViewTable = <T extends
|
|
23
|
+
export const DetailViewTable = <T extends RowData>({
|
|
24
24
|
className,
|
|
25
25
|
columns,
|
|
26
26
|
gridTemplateColumns,
|
|
@@ -31,7 +31,7 @@ export const DetailViewTable = <T extends object>({
|
|
|
31
31
|
...tableProps
|
|
32
32
|
}: DetailViewTableProps<T>): JSX.Element => {
|
|
33
33
|
return items.length > 0 ? (
|
|
34
|
-
<Paper className={className}>
|
|
34
|
+
<Paper className={className} variant="table">
|
|
35
35
|
<GridPaper>
|
|
36
36
|
{tools && <Toolbar variant="table">{tools}</Toolbar>}
|
|
37
37
|
<Table
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
1
|
+
import { ColumnDef, RowData } from "@tanstack/react-table";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates columns from column definitions with meta associated with the column.
|
|
5
5
|
* @param columns - Column configuration.
|
|
6
6
|
* @returns generated column definitions.
|
|
7
7
|
*/
|
|
8
|
-
export function generateColumnDefinitions<T>(
|
|
8
|
+
export function generateColumnDefinitions<T extends RowData>(
|
|
9
9
|
columns: ColumnDef<T>[]
|
|
10
10
|
): ColumnDef<T>[] {
|
|
11
11
|
return columns.map((column) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { TableBody as MTableBody } from "@mui/material";
|
|
2
|
-
import { Table } from "@tanstack/react-table";
|
|
2
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ROW_DIRECTION } from "../../../../../Table/common/entities";
|
|
5
5
|
import { TableView } from "../../table";
|
|
6
6
|
import { CollapsableRows } from "../TableRows/components/CollapsableRows/collapsableRows";
|
|
7
7
|
import { TableRows } from "../TableRows/tableRows";
|
|
8
8
|
|
|
9
|
-
export interface TableBodyProps<T> {
|
|
9
|
+
export interface TableBodyProps<T extends RowData> {
|
|
10
10
|
rowDirection: ROW_DIRECTION;
|
|
11
11
|
tableInstance: Table<T>;
|
|
12
12
|
tableView?: TableView;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const TableBody = <T extends
|
|
15
|
+
export const TableBody = <T extends RowData>({
|
|
16
16
|
rowDirection,
|
|
17
17
|
tableInstance,
|
|
18
18
|
tableView,
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Table } from "@tanstack/react-table";
|
|
1
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
3
2
|
import React, { Fragment } from "react";
|
|
4
|
-
import { v4 as uuid4 } from "uuid";
|
|
5
3
|
import { isCollapsableRowDisabled } from "../../../../../../../Table/common/utils";
|
|
6
4
|
import { CollapsableCell } from "../../../../../../../Table/components/TableCell/components/CollapsableCell/collapsableCell";
|
|
5
|
+
import { TableRow } from "../../../../../../../Table/components/TableRow/tableRow.styles";
|
|
7
6
|
|
|
8
|
-
export interface CollapsableRowsProps<T> {
|
|
7
|
+
export interface CollapsableRowsProps<T extends RowData> {
|
|
9
8
|
tableInstance: Table<T>;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
export const CollapsableRows = <T extends
|
|
11
|
+
export const CollapsableRows = <T extends RowData>({
|
|
13
12
|
tableInstance,
|
|
14
13
|
}: CollapsableRowsProps<T>): JSX.Element => {
|
|
15
14
|
const { getRowModel } = tableInstance;
|
|
16
15
|
const { rows } = getRowModel();
|
|
17
|
-
const uuid = uuid4(); // Generate a unique ID for the collapsable rows.
|
|
18
16
|
return (
|
|
19
17
|
<Fragment>
|
|
20
18
|
{rows.map((row) => {
|
|
21
19
|
if (row.depth > 0) return null; // Hide sub rows.
|
|
22
20
|
return (
|
|
23
|
-
<TableRow key={
|
|
21
|
+
<TableRow key={row.id} isPreview={row.getIsPreview()}>
|
|
24
22
|
<CollapsableCell
|
|
25
23
|
isDisabled={isCollapsableRowDisabled(tableInstance)}
|
|
26
24
|
row={row}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TableCell as MTableCell
|
|
2
|
-
import { flexRender, Row, Table } from "@tanstack/react-table";
|
|
3
|
-
import { RowData } from "@tanstack/table-core";
|
|
1
|
+
import { TableCell as MTableCell } from "@mui/material";
|
|
2
|
+
import { flexRender, Row, RowData, Table } from "@tanstack/react-table";
|
|
4
3
|
import React, { Fragment } from "react";
|
|
5
4
|
import { getTableCellPadding } from "../../../../../Table/components/TableCell/common/utils";
|
|
5
|
+
import { TableRow } from "../../../../../Table/components/TableRow/tableRow.styles";
|
|
6
6
|
import { TableView } from "../../table";
|
|
7
7
|
|
|
8
|
-
export interface TableRowsProps<T> {
|
|
8
|
+
export interface TableRowsProps<T extends RowData> {
|
|
9
9
|
tableInstance: Table<T>;
|
|
10
10
|
tableView?: TableView;
|
|
11
11
|
}
|
|
@@ -22,7 +22,11 @@ export const TableRows = <T extends RowData>({
|
|
|
22
22
|
<Fragment>
|
|
23
23
|
{rows.map((row) => {
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
25
|
+
<TableRow
|
|
26
|
+
id={getRowId(row)}
|
|
27
|
+
isPreview={row.getIsPreview()}
|
|
28
|
+
key={row.id}
|
|
29
|
+
>
|
|
26
30
|
{row.getVisibleCells().map((cell) => {
|
|
27
31
|
if (cell.getIsAggregated()) return null; // Display of aggregated cells is currently not supported.
|
|
28
32
|
if (cell.getIsPlaceholder()) return null; // Display of placeholder cells is currently not supported.
|
|
@@ -36,7 +40,7 @@ export const TableRows = <T extends RowData>({
|
|
|
36
40
|
</MTableCell>
|
|
37
41
|
);
|
|
38
42
|
})}
|
|
39
|
-
</
|
|
43
|
+
</TableRow>
|
|
40
44
|
);
|
|
41
45
|
})}
|
|
42
46
|
</Fragment>
|
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
ColumnDef,
|
|
9
9
|
getCoreRowModel,
|
|
10
|
+
RowData,
|
|
11
|
+
TableOptions,
|
|
10
12
|
useReactTable,
|
|
11
13
|
} from "@tanstack/react-table";
|
|
12
|
-
import { TableOptions } from "@tanstack/table-core";
|
|
13
14
|
import React from "react";
|
|
14
15
|
import {
|
|
15
16
|
BREAKPOINT_FN_NAME,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
import { TABLET } from "../../../../theme/common/breakpoints";
|
|
19
20
|
import { ROW_DIRECTION } from "../../../Table/common/entities";
|
|
20
21
|
import { TableHead } from "../../../Table/components/TableHead/tableHead";
|
|
22
|
+
import { ROW_PREVIEW } from "../../../Table/features/RowPreview/constants";
|
|
21
23
|
import { GridTable } from "../../../Table/table.styles";
|
|
22
24
|
import { generateColumnDefinitions } from "./common/utils";
|
|
23
25
|
import { TableBody } from "./components/TableBody/tableBody";
|
|
@@ -28,7 +30,7 @@ export interface TableView {
|
|
|
28
30
|
tableContainer?: Partial<MTableContainerProps>;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
export interface TableProps<T extends
|
|
33
|
+
export interface TableProps<T extends RowData> {
|
|
32
34
|
className?: string;
|
|
33
35
|
collapsable?: boolean;
|
|
34
36
|
columns: ColumnDef<T>[];
|
|
@@ -38,7 +40,7 @@ export interface TableProps<T extends object> {
|
|
|
38
40
|
tableView?: TableView;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
export const Table = <T extends
|
|
43
|
+
export const Table = <T extends RowData>({
|
|
42
44
|
className,
|
|
43
45
|
collapsable = true,
|
|
44
46
|
columns,
|
|
@@ -54,6 +56,7 @@ export const Table = <T extends object>({
|
|
|
54
56
|
const { stickyHeader = false } = table || {};
|
|
55
57
|
const { sx: tableContainerSx } = tableContainer || {};
|
|
56
58
|
const tableInstance = useReactTable({
|
|
59
|
+
_features: [ROW_PREVIEW],
|
|
57
60
|
columns: generateColumnDefinitions(columns),
|
|
58
61
|
data: items,
|
|
59
62
|
enableSorting: false,
|
|
@@ -21,7 +21,7 @@ export interface CategoryFilter {
|
|
|
21
21
|
export interface FiltersProps {
|
|
22
22
|
categoryFilters: CategoryFilter[];
|
|
23
23
|
closeAncestor?: () => void;
|
|
24
|
-
disabled
|
|
24
|
+
disabled?: boolean; // Global disabling of filters.
|
|
25
25
|
onFilter: OnFilterFn;
|
|
26
26
|
trackFilterOpened?: TrackFilterOpenedFunction;
|
|
27
27
|
}
|