@databiosphere/findable-ui 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Detail/components/DetailViewTable/detailViewTable.js +1 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Index/index.d.ts +2 -1
- package/lib/components/Index/index.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +3 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +1 -1
- package/lib/components/Layout/components/Outline/components/ContentsTab/contentsTab.styles.d.ts +1 -1
- package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
- package/lib/components/Table/common/utils.d.ts +6 -0
- package/lib/components/Table/common/utils.js +12 -1
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +2 -2
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +1 -1
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +3 -3
- package/lib/components/Table/components/TableCell/common/utils.d.ts +8 -0
- package/lib/components/Table/components/TableCell/common/utils.js +15 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.d.ts +6 -0
- package/lib/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.js +15 -0
- package/lib/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.d.ts +6 -0
- package/lib/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.js +16 -0
- package/lib/components/Table/components/TableHead/tableHead.js +2 -2
- package/lib/components/Table/components/TableRows/tableRows.js +2 -3
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.d.ts +10 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.js +37 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.styles.d.ts +3 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.styles.js +13 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.d.ts +9 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.js +19 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.styles.d.ts +5 -0
- package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.styles.js +13 -0
- package/lib/components/Table/components/TableToolbar/tableToolbar.js +5 -5
- package/lib/components/Table/components/TableToolbar/tableToolbar.styles.d.ts +1 -5
- package/lib/components/Table/components/TableToolbar/tableToolbar.styles.js +10 -7
- package/lib/components/Table/table.d.ts +5 -2
- package/lib/components/Table/table.js +13 -2
- package/lib/components/TableCreator/common/constants.d.ts +6 -0
- package/lib/components/TableCreator/common/constants.js +22 -0
- package/lib/components/TableCreator/common/entities.d.ts +5 -0
- package/lib/components/TableCreator/common/entities.js +2 -0
- package/lib/components/TableCreator/common/utils.d.ts +8 -0
- package/lib/components/TableCreator/common/utils.js +24 -0
- package/lib/components/TableCreator/tableCreator.d.ts +3 -1
- package/lib/components/TableCreator/tableCreator.js +19 -34
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +5 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +25 -0
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.d.ts +4 -2
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.js +2 -2
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.styles.d.ts +5 -1
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.styles.js +24 -1
- package/lib/components/common/CustomIcon/components/IndeterminateIcon/indeterminateIcon.d.ts +6 -0
- package/lib/components/common/CustomIcon/components/IndeterminateIcon/indeterminateIcon.js +29 -0
- package/lib/components/common/Dialog/dialog.d.ts +7 -0
- package/lib/components/common/Dialog/dialog.js +24 -0
- package/lib/components/common/DropdownMenu/common/constants.d.ts +2 -0
- package/lib/components/common/DropdownMenu/common/constants.js +8 -0
- package/lib/components/common/DropdownMenu/common/entities.d.ts +10 -0
- package/lib/components/common/DropdownMenu/common/entities.js +2 -0
- package/lib/components/common/DropdownMenu/components/MenuItem/menuItem.d.ts +7 -0
- package/lib/components/common/DropdownMenu/components/MenuItem/menuItem.js +25 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.d.ts +9 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.js +49 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.styles.d.ts +3 -0
- package/lib/components/common/DropdownMenu/dropdownMenu.styles.js +13 -0
- package/lib/components/common/IconButton/iconButton.d.ts +4 -3
- package/lib/components/common/IconButton/iconButton.js +4 -4
- package/lib/components/common/IconButton/iconButton.styles.d.ts +34 -0
- package/lib/components/common/IconButton/iconButton.styles.js +27 -1
- package/lib/components/common/Tabs/tabs.styles.d.ts +1 -1
- package/lib/config/entities.d.ts +4 -1
- package/lib/hooks/useCategoryFilter.d.ts +7 -1
- package/lib/hooks/useCategoryFilter.js +25 -6
- package/lib/providers/exploreState/entities.d.ts +6 -2
- package/lib/providers/exploreState/initializer/utils.js +20 -7
- package/lib/providers/exploreState/payloads/entities.d.ts +24 -6
- package/lib/providers/exploreState/utils.d.ts +24 -2
- package/lib/providers/exploreState/utils.js +52 -3
- package/lib/providers/exploreState.d.ts +29 -5
- package/lib/providers/exploreState.js +28 -7
- package/lib/theme/common/components.js +4 -0
- package/lib/views/ExploreView/exploreView.d.ts +3 -1
- package/lib/views/ExploreView/exploreView.js +3 -3
- package/package.json +1 -1
- package/src/components/Detail/components/DetailViewTable/detailViewTable.tsx +2 -2
- package/src/components/Index/index.tsx +3 -1
- package/src/components/Table/common/utils.ts +17 -0
- package/src/components/Table/components/CheckboxMenu/checkboxMenu.styles.ts +3 -3
- package/src/components/Table/components/CheckboxMenu/checkboxMenu.tsx +4 -2
- package/src/components/Table/components/TableCell/common/utils.ts +16 -0
- package/src/components/Table/components/TableCell/components/RowSelectionCell/rowSelectionCell.tsx +24 -0
- package/src/components/Table/components/TableHead/components/HeadSelectionCell/headSelectionCell.tsx +31 -0
- package/src/components/Table/components/TableHead/tableHead.tsx +18 -7
- package/src/components/Table/components/TableRows/tableRows.tsx +10 -8
- package/src/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.styles.ts +8 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/components/DropdownMenu/dropdownMenu.tsx +50 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/rowSelection.styles.ts +8 -0
- package/src/components/Table/components/TableToolbar/components/RowSelection/rowSelection.tsx +30 -0
- package/src/components/Table/components/TableToolbar/tableToolbar.styles.ts +10 -7
- package/src/components/Table/components/TableToolbar/tableToolbar.tsx +11 -8
- package/src/components/Table/table.tsx +18 -1
- package/src/components/TableCreator/common/constants.ts +26 -0
- package/src/components/TableCreator/common/entities.ts +6 -0
- package/src/components/TableCreator/common/utils.ts +33 -0
- package/src/components/TableCreator/tableCreator.tsx +38 -17
- package/src/components/common/Alert/components/AlertText/alertText.styles.ts +20 -0
- package/src/components/common/Button/components/DropdownButton/dropdownButton.styles.ts +15 -1
- package/src/components/common/Button/components/DropdownButton/dropdownButton.tsx +10 -2
- package/src/components/common/CustomIcon/components/IndeterminateIcon/indeterminateIcon.tsx +23 -0
- package/src/components/common/Dialog/dialog.tsx +21 -0
- package/src/components/common/DropdownMenu/common/constants.ts +7 -0
- package/src/components/common/DropdownMenu/common/entities.ts +11 -0
- package/src/components/common/DropdownMenu/components/MenuItem/menuItem.tsx +24 -0
- package/src/components/common/DropdownMenu/dropdownMenu.styles.ts +8 -0
- package/src/components/common/DropdownMenu/dropdownMenu.tsx +48 -0
- package/src/components/common/IconButton/iconButton.styles.ts +18 -0
- package/src/components/common/IconButton/iconButton.tsx +10 -11
- package/src/config/entities.ts +6 -0
- package/src/hooks/useCategoryFilter.ts +31 -7
- package/src/providers/exploreState/entities.ts +8 -2
- package/src/providers/exploreState/initializer/utils.ts +21 -1
- package/src/providers/exploreState/payloads/entities.ts +32 -7
- package/src/providers/exploreState/utils.ts +81 -1
- package/src/providers/exploreState.tsx +88 -11
- package/src/theme/common/components.ts +4 -0
- package/src/views/ExploreView/exploreView.tsx +6 -2
- package/types/data-explorer-ui.d.ts +10 -0
- package/src/components/Table/components/EntityViewToggle/entityViewToggle.tsx +0 -36
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ColumnSort,
|
|
3
|
+
RowSelectionState,
|
|
4
|
+
VisibilityState,
|
|
5
|
+
} from "@tanstack/react-table";
|
|
2
6
|
import {
|
|
3
7
|
CategoryKey,
|
|
4
8
|
CategoryValueKey,
|
|
@@ -11,6 +15,7 @@ import {
|
|
|
11
15
|
PaginationResponse,
|
|
12
16
|
RelatedListItems,
|
|
13
17
|
} from "../../exploreState";
|
|
18
|
+
import { ListItem } from "../entities";
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* Apply saved filter payload.
|
|
@@ -21,6 +26,19 @@ export interface ApplySavedFilterPayload {
|
|
|
21
26
|
selectedValue: CategoryValueKey;
|
|
22
27
|
}
|
|
23
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Paginate table payload.
|
|
31
|
+
*/
|
|
32
|
+
export type PaginateTablePayload = PaginationDirectionType;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Patch explore response payload.
|
|
36
|
+
*/
|
|
37
|
+
export interface PatchExploreResponsePayload {
|
|
38
|
+
listItemKey: keyof ListItem;
|
|
39
|
+
updatedListItems: ListItems;
|
|
40
|
+
}
|
|
41
|
+
|
|
24
42
|
/**
|
|
25
43
|
* Process explore response payload.
|
|
26
44
|
*/
|
|
@@ -38,11 +56,6 @@ export interface ProcessRelatedResponsePayload {
|
|
|
38
56
|
relatedListItems: RelatedListItems;
|
|
39
57
|
}
|
|
40
58
|
|
|
41
|
-
/**
|
|
42
|
-
* Paginate table payload.
|
|
43
|
-
*/
|
|
44
|
-
export type PaginateTablePayload = PaginationDirectionType;
|
|
45
|
-
|
|
46
59
|
/**
|
|
47
60
|
* Reset explore response payload.
|
|
48
61
|
*/
|
|
@@ -56,7 +69,14 @@ export type ToggleEntityViewPayload = ENTITY_VIEW;
|
|
|
56
69
|
/**
|
|
57
70
|
* Update column visibility payload.
|
|
58
71
|
*/
|
|
59
|
-
export type UpdateColumnVisibilityPayload =
|
|
72
|
+
export type UpdateColumnVisibilityPayload = VisibilityState;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Update entity view access payload.
|
|
76
|
+
*/
|
|
77
|
+
export interface UpdateEntityViewAccessPayload {
|
|
78
|
+
canEdit: boolean;
|
|
79
|
+
}
|
|
60
80
|
|
|
61
81
|
/**
|
|
62
82
|
* Update filter payload.
|
|
@@ -67,6 +87,11 @@ export interface UpdateFilterPayload {
|
|
|
67
87
|
selectedValue: CategoryValueKey;
|
|
68
88
|
}
|
|
69
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Update row selection payload.
|
|
92
|
+
*/
|
|
93
|
+
export type UpdateRowSelectionPayload = RowSelectionState;
|
|
94
|
+
|
|
70
95
|
/**
|
|
71
96
|
* Update sorting payload.
|
|
72
97
|
*/
|
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
CategoryValueKey,
|
|
5
5
|
SelectedFilter,
|
|
6
6
|
} from "../../common/entities";
|
|
7
|
-
import {
|
|
7
|
+
import { ACCESSOR_KEYS } from "../../components/TableCreator/common/constants";
|
|
8
|
+
import { ExploreState, ListItems, PaginationState } from "../exploreState";
|
|
8
9
|
import {
|
|
9
10
|
CategoryGroupConfigKey,
|
|
10
11
|
EntityPageState,
|
|
11
12
|
EntityPageStateMapper,
|
|
12
13
|
EntityState,
|
|
13
14
|
EntityStateSavedFilter,
|
|
15
|
+
ListItem,
|
|
14
16
|
} from "./entities";
|
|
15
17
|
import { DEFAULT_ENTITY_STATE } from "./initializer/constants";
|
|
16
18
|
|
|
@@ -119,6 +121,28 @@ export function getFilterCount(filterState: SelectedFilter[]): number {
|
|
|
119
121
|
return filterState.reduce((acc, filter) => acc + filter.value.length, 0);
|
|
120
122
|
}
|
|
121
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Returns list items with updated list items patched.
|
|
126
|
+
* @param listItems - List items.
|
|
127
|
+
* @param updatedListItems - List items to patch.
|
|
128
|
+
* @param listItemKey - List item key identifier to map list items.
|
|
129
|
+
* @returns list items with updated list items patched.
|
|
130
|
+
*/
|
|
131
|
+
export function patchEntityListItems(
|
|
132
|
+
listItems: ListItems,
|
|
133
|
+
updatedListItems: ListItems,
|
|
134
|
+
listItemKey: keyof ListItem
|
|
135
|
+
): ListItems {
|
|
136
|
+
if (!listItems || !updatedListItems) return listItems;
|
|
137
|
+
const listItemById = new Map(
|
|
138
|
+
listItems.map((listItem) => [listItem[listItemKey], listItem])
|
|
139
|
+
);
|
|
140
|
+
updatedListItems.forEach((listItem) => {
|
|
141
|
+
listItemById.set(listItem[listItemKey], listItem);
|
|
142
|
+
});
|
|
143
|
+
return [...listItemById.values()];
|
|
144
|
+
}
|
|
145
|
+
|
|
122
146
|
/**
|
|
123
147
|
* Resets pagination.
|
|
124
148
|
* @param paginationState - Pagination state.
|
|
@@ -131,6 +155,30 @@ export function resetPage(paginationState: PaginationState): PaginationState {
|
|
|
131
155
|
return nextPaginationState;
|
|
132
156
|
}
|
|
133
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Resets row selection for the current entity and entities that share the same category group config key.
|
|
160
|
+
* @param state - Explore state.
|
|
161
|
+
* @returns entity page state mapper with row selection reset.
|
|
162
|
+
*/
|
|
163
|
+
export function resetRowSelection(state: ExploreState): EntityPageStateMapper {
|
|
164
|
+
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
|
|
165
|
+
state.tabValue,
|
|
166
|
+
state.entityPageState
|
|
167
|
+
);
|
|
168
|
+
return Object.entries(state.entityPageState).reduce(
|
|
169
|
+
(acc, [entityPath, entityPageState]) => {
|
|
170
|
+
if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
|
|
171
|
+
return {
|
|
172
|
+
...acc,
|
|
173
|
+
[entityPath]: { ...entityPageState, rowSelection: {} },
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return { ...acc, [entityPath]: entityPageState };
|
|
177
|
+
},
|
|
178
|
+
{} as EntityPageStateMapper
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
134
182
|
/**
|
|
135
183
|
* Sets entity state for the given category group config key.
|
|
136
184
|
* @param categoryGroupConfigKey - Category group config key.
|
|
@@ -217,3 +265,35 @@ export function updateEntityStateByCategoryGroupConfigKey(
|
|
|
217
265
|
});
|
|
218
266
|
}
|
|
219
267
|
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Updates the entity page state for each entity with row selection enabled,
|
|
271
|
+
* by updating the visibility of the "select" column based on user access and resetting row selection state.
|
|
272
|
+
* @param state - Explore state.
|
|
273
|
+
* @param canEdit - User has edit access.
|
|
274
|
+
* @returns new entity page state mapper with updated column visibility and row selection state.
|
|
275
|
+
*/
|
|
276
|
+
export function updateSelectColumnVisibility(
|
|
277
|
+
state: ExploreState,
|
|
278
|
+
canEdit: boolean
|
|
279
|
+
): EntityPageStateMapper {
|
|
280
|
+
return Object.entries(state.entityPageState).reduce(
|
|
281
|
+
(acc, [entityPath, entityPageState]) => {
|
|
282
|
+
if (entityPageState.enableRowSelection) {
|
|
283
|
+
return {
|
|
284
|
+
...acc,
|
|
285
|
+
[entityPath]: {
|
|
286
|
+
...entityPageState,
|
|
287
|
+
columnsVisibility: {
|
|
288
|
+
...entityPageState.columnsVisibility,
|
|
289
|
+
[ACCESSOR_KEYS.SELECT]: canEdit,
|
|
290
|
+
},
|
|
291
|
+
rowSelection: {},
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return { ...acc, [entityPath]: entityPageState };
|
|
296
|
+
},
|
|
297
|
+
{} as EntityPageStateMapper
|
|
298
|
+
);
|
|
299
|
+
}
|
|
@@ -20,6 +20,7 @@ import { useURLFilterParams } from "../hooks/useURLFilterParams";
|
|
|
20
20
|
import {
|
|
21
21
|
EntityPageStateMapper,
|
|
22
22
|
EntityStateByCategoryGroupConfigKey,
|
|
23
|
+
ListItem,
|
|
23
24
|
} from "./exploreState/entities";
|
|
24
25
|
import {
|
|
25
26
|
DEFAULT_PAGINATION_STATE,
|
|
@@ -29,12 +30,15 @@ import { initReducerArguments } from "./exploreState/initializer/utils";
|
|
|
29
30
|
import {
|
|
30
31
|
ApplySavedFilterPayload,
|
|
31
32
|
PaginateTablePayload,
|
|
33
|
+
PatchExploreResponsePayload,
|
|
32
34
|
ProcessExploreResponsePayload,
|
|
33
35
|
ProcessRelatedResponsePayload,
|
|
34
36
|
ResetExploreResponsePayload,
|
|
35
37
|
ToggleEntityViewPayload,
|
|
36
38
|
UpdateColumnVisibilityPayload,
|
|
39
|
+
UpdateEntityViewAccessPayload,
|
|
37
40
|
UpdateFilterPayload,
|
|
41
|
+
UpdateRowSelectionPayload,
|
|
38
42
|
UpdateSortingPayload,
|
|
39
43
|
} from "./exploreState/payloads/entities";
|
|
40
44
|
import {
|
|
@@ -44,10 +48,13 @@ import {
|
|
|
44
48
|
getEntityState,
|
|
45
49
|
getEntityStateSavedSorting,
|
|
46
50
|
getFilterCount,
|
|
51
|
+
patchEntityListItems,
|
|
47
52
|
resetPage,
|
|
53
|
+
resetRowSelection,
|
|
48
54
|
updateEntityPageState,
|
|
49
55
|
updateEntityPageStateSorting,
|
|
50
56
|
updateEntityStateByCategoryGroupConfigKey,
|
|
57
|
+
updateSelectColumnVisibility,
|
|
51
58
|
} from "./exploreState/utils";
|
|
52
59
|
|
|
53
60
|
export type CatalogState = string | undefined;
|
|
@@ -102,8 +109,7 @@ export type FeatureFlagState = string | undefined;
|
|
|
102
109
|
/**
|
|
103
110
|
* List items.
|
|
104
111
|
*/
|
|
105
|
-
|
|
106
|
-
export type ListItems = any[] | undefined;
|
|
112
|
+
export type ListItems = ListItem[] | undefined;
|
|
107
113
|
|
|
108
114
|
/**
|
|
109
115
|
* Pagination index.
|
|
@@ -225,6 +231,7 @@ export enum ExploreActionKind {
|
|
|
225
231
|
ApplySavedFilter = "APPLY_SAVED_FILTER",
|
|
226
232
|
ClearFilters = "CLEAR_FILTERS",
|
|
227
233
|
PaginateTable = "PAGINATE_TABLE",
|
|
234
|
+
PatchExploreResponse = "PATCH_EXPLORE_RESPONSE",
|
|
228
235
|
ProcessExploreResponse = "PROCESS_EXPLORE_RESPONSE",
|
|
229
236
|
ProcessRelatedResponse = "PROCESS_RELATED_RESPONSE",
|
|
230
237
|
ResetExploreResponse = "RESET_EXPLORE_RESPONSE",
|
|
@@ -232,7 +239,9 @@ export enum ExploreActionKind {
|
|
|
232
239
|
SelectEntityType = "SELECT_ENTITY_TYPE",
|
|
233
240
|
ToggleEntityView = "TOGGLE_ENTITY_VIEW",
|
|
234
241
|
UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
|
|
242
|
+
UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
|
|
235
243
|
UpdateFilter = "UPDATE_FILTER",
|
|
244
|
+
UpdateRowSelection = "UPDATE_ROW_SELECTION",
|
|
236
245
|
UpdateSorting = "UPDATE_SORTING",
|
|
237
246
|
}
|
|
238
247
|
|
|
@@ -243,6 +252,7 @@ export type ExploreAction =
|
|
|
243
252
|
| ApplySavedFilterAction
|
|
244
253
|
| ClearFiltersAction
|
|
245
254
|
| PaginateTableAction
|
|
255
|
+
| PatchExploreResponseAction
|
|
246
256
|
| ProcessExploreResponseAction
|
|
247
257
|
| ProcessRelatedResponseAction
|
|
248
258
|
| ResetExploreResponseAction
|
|
@@ -250,7 +260,9 @@ export type ExploreAction =
|
|
|
250
260
|
| SelectEntityTypeAction
|
|
251
261
|
| ToggleEntityViewAction
|
|
252
262
|
| UpdateColumnVisibilityAction
|
|
263
|
+
| UpdateEntityViewAccessAction
|
|
253
264
|
| UpdateFilterAction
|
|
265
|
+
| UpdateRowSelectionAction
|
|
254
266
|
| UpdateSortingAction;
|
|
255
267
|
|
|
256
268
|
/**
|
|
@@ -277,6 +289,14 @@ type PaginateTableAction = {
|
|
|
277
289
|
type: ExploreActionKind.PaginateTable;
|
|
278
290
|
};
|
|
279
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Patch explore response action.
|
|
294
|
+
*/
|
|
295
|
+
type PatchExploreResponseAction = {
|
|
296
|
+
payload: PatchExploreResponsePayload;
|
|
297
|
+
type: ExploreActionKind.PatchExploreResponse;
|
|
298
|
+
};
|
|
299
|
+
|
|
280
300
|
/**
|
|
281
301
|
* Process explore response action.
|
|
282
302
|
*/
|
|
@@ -318,7 +338,7 @@ type SelectEntityTypeAction = {
|
|
|
318
338
|
};
|
|
319
339
|
|
|
320
340
|
/**
|
|
321
|
-
* Toggle entity view.
|
|
341
|
+
* Toggle entity view action.
|
|
322
342
|
*/
|
|
323
343
|
type ToggleEntityViewAction = {
|
|
324
344
|
payload: ToggleEntityViewPayload;
|
|
@@ -333,6 +353,14 @@ type UpdateColumnVisibilityAction = {
|
|
|
333
353
|
type: ExploreActionKind.UpdateColumnVisibility;
|
|
334
354
|
};
|
|
335
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Update entity view access action.
|
|
358
|
+
*/
|
|
359
|
+
type UpdateEntityViewAccessAction = {
|
|
360
|
+
payload: UpdateEntityViewAccessPayload;
|
|
361
|
+
type: ExploreActionKind.UpdateEntityViewAccess;
|
|
362
|
+
};
|
|
363
|
+
|
|
336
364
|
/**
|
|
337
365
|
* Update filter action.
|
|
338
366
|
*/
|
|
@@ -341,6 +369,14 @@ type UpdateFilterAction = {
|
|
|
341
369
|
type: ExploreActionKind.UpdateFilter;
|
|
342
370
|
};
|
|
343
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Update row selection action.
|
|
374
|
+
*/
|
|
375
|
+
type UpdateRowSelectionAction = {
|
|
376
|
+
payload: UpdateRowSelectionPayload;
|
|
377
|
+
type: ExploreActionKind.UpdateRowSelection;
|
|
378
|
+
};
|
|
379
|
+
|
|
344
380
|
/**
|
|
345
381
|
* Update sorting action.
|
|
346
382
|
*/
|
|
@@ -431,6 +467,24 @@ function exploreReducer(
|
|
|
431
467
|
paginationState: nextPaginationState,
|
|
432
468
|
};
|
|
433
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Patch explore response
|
|
472
|
+
*/
|
|
473
|
+
case ExploreActionKind.PatchExploreResponse: {
|
|
474
|
+
return {
|
|
475
|
+
...state,
|
|
476
|
+
entityPageState: updateEntityPageState(
|
|
477
|
+
state.tabValue,
|
|
478
|
+
state.entityPageState,
|
|
479
|
+
{ rowSelection: {} }
|
|
480
|
+
),
|
|
481
|
+
listItems: patchEntityListItems(
|
|
482
|
+
state.listItems,
|
|
483
|
+
payload.updatedListItems,
|
|
484
|
+
payload.listItemKey
|
|
485
|
+
),
|
|
486
|
+
};
|
|
487
|
+
}
|
|
434
488
|
/**
|
|
435
489
|
* Process explore response
|
|
436
490
|
**/
|
|
@@ -519,6 +573,28 @@ function exploreReducer(
|
|
|
519
573
|
listView: payload,
|
|
520
574
|
};
|
|
521
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Update column visibility
|
|
578
|
+
**/
|
|
579
|
+
case ExploreActionKind.UpdateColumnVisibility: {
|
|
580
|
+
return {
|
|
581
|
+
...state,
|
|
582
|
+
entityPageState: updateEntityPageState(
|
|
583
|
+
state.tabValue,
|
|
584
|
+
state.entityPageState,
|
|
585
|
+
{ columnsVisibility: payload }
|
|
586
|
+
),
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Update entity view access
|
|
591
|
+
**/
|
|
592
|
+
case ExploreActionKind.UpdateEntityViewAccess: {
|
|
593
|
+
return {
|
|
594
|
+
...state,
|
|
595
|
+
entityPageState: updateSelectColumnVisibility(state, payload.canEdit),
|
|
596
|
+
};
|
|
597
|
+
}
|
|
522
598
|
/**
|
|
523
599
|
* Update filter
|
|
524
600
|
**/
|
|
@@ -536,36 +612,37 @@ function exploreReducer(
|
|
|
536
612
|
});
|
|
537
613
|
return {
|
|
538
614
|
...state,
|
|
615
|
+
entityPageState: resetRowSelection(state),
|
|
539
616
|
filterCount: getFilterCount(filterState),
|
|
540
617
|
filterState,
|
|
541
618
|
paginationState: resetPage(state.paginationState),
|
|
542
619
|
};
|
|
543
620
|
}
|
|
544
621
|
/**
|
|
545
|
-
* Update
|
|
546
|
-
|
|
547
|
-
case ExploreActionKind.
|
|
622
|
+
* Update row selection
|
|
623
|
+
*/
|
|
624
|
+
case ExploreActionKind.UpdateRowSelection: {
|
|
548
625
|
return {
|
|
549
626
|
...state,
|
|
550
627
|
entityPageState: updateEntityPageState(
|
|
551
628
|
state.tabValue,
|
|
552
629
|
state.entityPageState,
|
|
553
|
-
{
|
|
630
|
+
{ rowSelection: payload }
|
|
554
631
|
),
|
|
555
|
-
paginationState: resetPage(state.paginationState),
|
|
556
632
|
};
|
|
557
633
|
}
|
|
558
634
|
/**
|
|
559
|
-
* Update
|
|
635
|
+
* Update sorting
|
|
560
636
|
**/
|
|
561
|
-
case ExploreActionKind.
|
|
637
|
+
case ExploreActionKind.UpdateSorting: {
|
|
562
638
|
return {
|
|
563
639
|
...state,
|
|
564
640
|
entityPageState: updateEntityPageState(
|
|
565
641
|
state.tabValue,
|
|
566
642
|
state.entityPageState,
|
|
567
|
-
{
|
|
643
|
+
{ sorting: payload }
|
|
568
644
|
),
|
|
645
|
+
paginationState: resetPage(state.paginationState),
|
|
569
646
|
};
|
|
570
647
|
}
|
|
571
648
|
|
|
@@ -1324,6 +1324,10 @@ export const MuiTableCell = (theme: Theme): Components["MuiTableCell"] => {
|
|
|
1324
1324
|
...theme.typography[TEXT_BODY_SMALL_500],
|
|
1325
1325
|
padding: "20px",
|
|
1326
1326
|
},
|
|
1327
|
+
paddingCheckbox: {
|
|
1328
|
+
paddingRight: 0,
|
|
1329
|
+
width: "unset",
|
|
1330
|
+
},
|
|
1327
1331
|
root: {
|
|
1328
1332
|
padding: "18px 20px",
|
|
1329
1333
|
},
|
|
@@ -44,7 +44,9 @@ import { ExploreActionKind, ExploreState } from "../../providers/exploreState";
|
|
|
44
44
|
import { SELECT_CATEGORY_KEY } from "../../providers/exploreState/constants";
|
|
45
45
|
import { DESKTOP_SM } from "../../theme/common/breakpoints";
|
|
46
46
|
|
|
47
|
-
export
|
|
47
|
+
export interface ExploreViewProps extends AzulEntitiesStaticResponse {
|
|
48
|
+
className?: string;
|
|
49
|
+
}
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* Returns tabs to be used as a prop for the Tabs component.
|
|
@@ -199,6 +201,7 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
|
|
|
199
201
|
</Sidebar>
|
|
200
202
|
)}
|
|
201
203
|
<IndexView
|
|
204
|
+
className={props.className}
|
|
202
205
|
List={renderList(exploreState, entityConfig, entityListType)}
|
|
203
206
|
ListHero={renderComponent(listHero)}
|
|
204
207
|
SideBarButton={
|
|
@@ -289,7 +292,7 @@ function renderList(
|
|
|
289
292
|
relatedListItems,
|
|
290
293
|
tabValue,
|
|
291
294
|
} = exploreState;
|
|
292
|
-
const { list, listView } = entityConfig;
|
|
295
|
+
const { getId: getRowId, list, listView } = entityConfig;
|
|
293
296
|
const { columns: columnsConfig, defaultSort } = list;
|
|
294
297
|
|
|
295
298
|
if (!exploreState || !tabValue) {
|
|
@@ -306,6 +309,7 @@ function renderList(
|
|
|
306
309
|
<TableCreator
|
|
307
310
|
columns={columnsConfig}
|
|
308
311
|
defaultSort={defaultSort}
|
|
312
|
+
getRowId={getRowId}
|
|
309
313
|
items={
|
|
310
314
|
isRelatedView && relatedListItems ? relatedListItems : listItems ?? []
|
|
311
315
|
}
|
|
@@ -11,6 +11,7 @@ import { PaletteColorOptions } from "@mui/material/styles/createPalette";
|
|
|
11
11
|
import { TypographyStyleOptions } from "@mui/material/styles/createTypography";
|
|
12
12
|
import type {} from "@mui/material/SvgIcon";
|
|
13
13
|
import type {} from "@mui/material/Tabs";
|
|
14
|
+
import type {} from "@mui/material/Toolbar";
|
|
14
15
|
import type {} from "@mui/material/Typography";
|
|
15
16
|
import { RowData } from "@tanstack/react-table";
|
|
16
17
|
import { DataLayer } from "../src/common/analytics/entities";
|
|
@@ -200,6 +201,15 @@ declare module "@mui/material/styles" {
|
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Toolbar prop options.
|
|
206
|
+
*/
|
|
207
|
+
declare module "@mui/material/Toolbar" {
|
|
208
|
+
interface ToolbarPropsVariantOverrides {
|
|
209
|
+
table: true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
203
213
|
/**
|
|
204
214
|
* Typography variant overrides.
|
|
205
215
|
*/
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { useExploreState } from "../../../../hooks/useExploreState";
|
|
3
|
-
import {
|
|
4
|
-
ENTITY_VIEW,
|
|
5
|
-
ExploreActionKind,
|
|
6
|
-
} from "../../../../providers/exploreState";
|
|
7
|
-
import { ToggleButtonGroup } from "../../../common/ToggleButtonGroup/toggleButtonGroup";
|
|
8
|
-
|
|
9
|
-
export const EntityViewToggle = (): JSX.Element => {
|
|
10
|
-
const { exploreDispatch } = useExploreState();
|
|
11
|
-
const toggleButtons = [
|
|
12
|
-
{
|
|
13
|
-
label: "Exact Match",
|
|
14
|
-
onToggle: () => onChange(ENTITY_VIEW.EXACT),
|
|
15
|
-
value: ENTITY_VIEW.EXACT,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
label: "Related Match",
|
|
19
|
-
onToggle: () => onChange(ENTITY_VIEW.RELATED),
|
|
20
|
-
value: ENTITY_VIEW.RELATED,
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Callback fired when toggle button value changes.
|
|
26
|
-
* @param entityView - Entity list view.
|
|
27
|
-
*/
|
|
28
|
-
const onChange = (entityView: ENTITY_VIEW): void => {
|
|
29
|
-
exploreDispatch({
|
|
30
|
-
payload: entityView,
|
|
31
|
-
type: ExploreActionKind.ToggleEntityView,
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return <ToggleButtonGroup toggleButtons={toggleButtons} />;
|
|
36
|
-
};
|