@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
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
} from "../../hooks/useBreakpointHelper";
|
|
38
38
|
import { useConfig } from "../../hooks/useConfig";
|
|
39
39
|
import { useEntityList } from "../../hooks/useEntityList";
|
|
40
|
-
import { useEntityListRelatedView } from "../../hooks/useEntityListRelatedView";
|
|
41
40
|
import { useExploreState } from "../../hooks/useExploreState";
|
|
42
41
|
import { useSummary } from "../../hooks/useSummary";
|
|
43
42
|
import { ExploreActionKind, ExploreState } from "../../providers/exploreState";
|
|
@@ -72,18 +71,11 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
|
|
|
72
71
|
const { entities, explorerTitle, summaryConfig, trackingConfig } = config;
|
|
73
72
|
const { listView } = entityConfig;
|
|
74
73
|
const { listHero, subTitleHero } = listView || {};
|
|
75
|
-
const {
|
|
76
|
-
categoryGroups,
|
|
77
|
-
categoryViews,
|
|
78
|
-
filterCount,
|
|
79
|
-
isRelatedView,
|
|
80
|
-
tabValue,
|
|
81
|
-
} = exploreState;
|
|
74
|
+
const { categoryGroups, categoryViews, filterCount, tabValue } = exploreState;
|
|
82
75
|
const { push } = useRouter();
|
|
83
76
|
const tabs = getTabs(entities);
|
|
84
77
|
const { response: summaryResponse } = useSummary(); // Fetch summary.
|
|
85
78
|
useEntityList(props); // Fetch entities.
|
|
86
|
-
useEntityListRelatedView(); // Fetch related entities.
|
|
87
79
|
const { entityListType } = props;
|
|
88
80
|
const categoryFilters = useMemo(
|
|
89
81
|
() => buildCategoryFilters(categoryViews, categoryGroups),
|
|
@@ -194,7 +186,6 @@ export const ExploreView = (props: ExploreViewProps): JSX.Element => {
|
|
|
194
186
|
<Filters
|
|
195
187
|
categoryFilters={categoryFilters}
|
|
196
188
|
closeAncestor={onCloseDrawer}
|
|
197
|
-
disabled={isRelatedView}
|
|
198
189
|
onFilter={onFilterChange.bind(null, false)}
|
|
199
190
|
trackFilterOpened={trackingConfig?.trackFilterOpened}
|
|
200
191
|
/>
|
|
@@ -284,14 +275,7 @@ function renderList(
|
|
|
284
275
|
entityConfig: EntityConfig,
|
|
285
276
|
entityListType: string
|
|
286
277
|
): JSX.Element {
|
|
287
|
-
const {
|
|
288
|
-
isRelatedView,
|
|
289
|
-
listItems,
|
|
290
|
-
loading,
|
|
291
|
-
paginationState,
|
|
292
|
-
relatedListItems,
|
|
293
|
-
tabValue,
|
|
294
|
-
} = exploreState;
|
|
278
|
+
const { listItems, loading, tabValue } = exploreState;
|
|
295
279
|
const { getId: getRowId, list, listView } = entityConfig;
|
|
296
280
|
const { columns: columnsConfig, defaultSort } = list;
|
|
297
281
|
|
|
@@ -310,15 +294,9 @@ function renderList(
|
|
|
310
294
|
columns={columnsConfig}
|
|
311
295
|
defaultSort={defaultSort}
|
|
312
296
|
getRowId={getRowId}
|
|
313
|
-
items={
|
|
314
|
-
isRelatedView && relatedListItems ? relatedListItems : listItems ?? []
|
|
315
|
-
}
|
|
297
|
+
items={listItems ?? []}
|
|
316
298
|
listView={listView}
|
|
317
299
|
loading={loading}
|
|
318
|
-
pages={paginationState.pages}
|
|
319
|
-
pageSize={paginationState.pageSize}
|
|
320
|
-
pagination={undefined}
|
|
321
|
-
total={paginationState.rows}
|
|
322
300
|
/>
|
|
323
301
|
);
|
|
324
302
|
}
|
|
@@ -14,9 +14,16 @@ import type {} from "@mui/material/SvgIcon";
|
|
|
14
14
|
import type {} from "@mui/material/Tabs";
|
|
15
15
|
import type {} from "@mui/material/Toolbar";
|
|
16
16
|
import type {} from "@mui/material/Typography";
|
|
17
|
+
import type {} from "@tanstack/react-table";
|
|
17
18
|
import { RowData } from "@tanstack/react-table";
|
|
18
|
-
import type {} from "@tanstack/table-core";
|
|
19
19
|
import { DataLayer } from "../src/common/analytics/entities";
|
|
20
|
+
import {
|
|
21
|
+
CustomFeatureInitialTableState,
|
|
22
|
+
CustomFeatureInstance,
|
|
23
|
+
CustomFeatureOptions,
|
|
24
|
+
CustomFeatureRow,
|
|
25
|
+
CustomFeatureTableState,
|
|
26
|
+
} from "../src/components/Table/features/entities";
|
|
20
27
|
import { GridTrackSize } from "../src/config/entities";
|
|
21
28
|
|
|
22
29
|
/**
|
|
@@ -141,6 +148,7 @@ declare module "@mui/material/Paper" {
|
|
|
141
148
|
menu: true;
|
|
142
149
|
panel: true;
|
|
143
150
|
searchbar: true;
|
|
151
|
+
table: true;
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
154
|
|
|
@@ -252,7 +260,7 @@ declare module "@emotion/react" {
|
|
|
252
260
|
}
|
|
253
261
|
}
|
|
254
262
|
|
|
255
|
-
declare module "@tanstack/table
|
|
263
|
+
declare module "@tanstack/react-table" {
|
|
256
264
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TData and TValue are unused variables.
|
|
257
265
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
258
266
|
columnPinned?: boolean;
|
|
@@ -260,6 +268,17 @@ declare module "@tanstack/table-core" {
|
|
|
260
268
|
header?: string;
|
|
261
269
|
width?: GridTrackSize;
|
|
262
270
|
}
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- empty interface is needed for extending.
|
|
272
|
+
interface InitialTableState extends CustomFeatureInitialTableState {}
|
|
273
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars -- empty interface is needed for extending, TData is an unused variable.
|
|
274
|
+
interface Row<TData extends RowData> extends CustomFeatureRow {}
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- empty interface is needed for extending.
|
|
276
|
+
interface Table<TData extends RowData> extends CustomFeatureInstance<TData> {}
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars -- empty interface is needed for extending, TData is an unused variable.
|
|
278
|
+
interface TableOptionsResolved<TData extends RowData>
|
|
279
|
+
extends CustomFeatureOptions {}
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- empty interface is needed for extending.
|
|
281
|
+
interface TableState extends CustomFeatureTableState {}
|
|
263
282
|
}
|
|
264
283
|
|
|
265
284
|
/**
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { SelectedFilterValue } from "../common/entities";
|
|
3
|
-
import { RelatedSearchResult } from "../config/entities";
|
|
4
|
-
import {
|
|
5
|
-
ExploreActionKind,
|
|
6
|
-
ListItems,
|
|
7
|
-
RelatedListItems,
|
|
8
|
-
} from "../providers/exploreState";
|
|
9
|
-
import { useAsync } from "./useAsync";
|
|
10
|
-
import { useConfig } from "./useConfig";
|
|
11
|
-
import { useExploreState } from "./useExploreState";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns related entity lists filtered by related search results.
|
|
15
|
-
* @param listItems - Entity list items.
|
|
16
|
-
* @param relatedSearchResult - Related search result.
|
|
17
|
-
* @param excludedValues - Selected category values to be excluded from related entity lists.
|
|
18
|
-
* @returns related entities.
|
|
19
|
-
*/
|
|
20
|
-
export function buildRelatedEntityList(
|
|
21
|
-
listItems: ListItems,
|
|
22
|
-
relatedSearchResult: RelatedSearchResult | undefined,
|
|
23
|
-
excludedValues: SelectedFilterValue | undefined
|
|
24
|
-
): RelatedListItems {
|
|
25
|
-
if (relatedSearchResult) {
|
|
26
|
-
const { resultKey, searchKey, values } = relatedSearchResult;
|
|
27
|
-
return listItems?.filter((listItem) => {
|
|
28
|
-
if (values.includes(listItem[resultKey].toLowerCase())) {
|
|
29
|
-
return !excludedValues?.includes(listItem[searchKey]); // Exclude any row where any of the selected category values matches the corresponding row value.
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Updates related entity list.
|
|
37
|
-
*/
|
|
38
|
-
export const useEntityListRelatedView = (): void => {
|
|
39
|
-
const { entityConfig } = useConfig();
|
|
40
|
-
const { exploreDispatch, exploreState } = useExploreState();
|
|
41
|
-
const { filterState, listItems } = exploreState;
|
|
42
|
-
const { listView } = entityConfig;
|
|
43
|
-
const relatedView = listView?.relatedView;
|
|
44
|
-
const { relatedSearchFn, resultKey, searchKey } = relatedView || {};
|
|
45
|
-
const { data: relatedSearchResult, run } = useAsync<
|
|
46
|
-
RelatedSearchResult | undefined
|
|
47
|
-
>();
|
|
48
|
-
const selectedCategoryValues = filterState.find(
|
|
49
|
-
({ categoryKey }) => categoryKey === searchKey
|
|
50
|
-
)?.value;
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (relatedSearchFn) {
|
|
54
|
-
run(relatedSearchFn(searchKey, resultKey, selectedCategoryValues));
|
|
55
|
-
}
|
|
56
|
-
}, [relatedSearchFn, resultKey, run, searchKey, selectedCategoryValues]);
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (relatedSearchFn) {
|
|
60
|
-
exploreDispatch({
|
|
61
|
-
payload: {
|
|
62
|
-
relatedListItems: buildRelatedEntityList(
|
|
63
|
-
listItems,
|
|
64
|
-
relatedSearchResult,
|
|
65
|
-
selectedCategoryValues
|
|
66
|
-
),
|
|
67
|
-
},
|
|
68
|
-
type: ExploreActionKind.ProcessRelatedResponse,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}, [
|
|
72
|
-
exploreDispatch,
|
|
73
|
-
listItems,
|
|
74
|
-
relatedSearchFn,
|
|
75
|
-
relatedSearchResult,
|
|
76
|
-
selectedCategoryValues,
|
|
77
|
-
]);
|
|
78
|
-
};
|