@databiosphere/findable-ui 4.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/components/ExploreViewLink/exploreViewLink.js +13 -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 +27 -39
- 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 +8 -26
- 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 +2 -2
- package/lib/providers/exploreState/payloads/entities.d.ts +7 -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 +48 -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 +18 -2
- 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 +41 -51
- 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 +8 -38
- package/src/providers/exploreState/entities.ts +7 -2
- package/src/providers/exploreState/initializer/constants.ts +1 -3
- package/src/providers/exploreState/initializer/utils.ts +3 -3
- package/src/providers/exploreState/payloads/entities.ts +8 -18
- package/src/providers/exploreState/utils.ts +25 -36
- package/src/providers/exploreState.tsx +95 -69
- 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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
3
|
+
import React, { ReactNode } from "react";
|
|
4
|
+
import { DrawerTitle as Title } from "./drawerTitle.styles";
|
|
5
|
+
|
|
6
|
+
export interface DrawerTitleProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
title?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const DrawerTitle = ({
|
|
13
|
+
className,
|
|
14
|
+
onClose,
|
|
15
|
+
title,
|
|
16
|
+
}: DrawerTitleProps): JSX.Element => {
|
|
17
|
+
return (
|
|
18
|
+
<Title className={className}>
|
|
19
|
+
{title}
|
|
20
|
+
{onClose && (
|
|
21
|
+
<IconButton color="ink" edge="end" onClick={onClose} size="xsmall">
|
|
22
|
+
<CloseRoundedIcon color="inkLight" fontSize="small" />
|
|
23
|
+
</IconButton>
|
|
24
|
+
)}
|
|
25
|
+
</Title>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Drawer as MDrawer, DrawerProps as MDrawerProps } from "@mui/material";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface DrawerProps extends MDrawerProps {
|
|
5
|
+
children?: ReactNode | ReactNode[];
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Drawer = ({
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
onClose,
|
|
13
|
+
open,
|
|
14
|
+
...props /* Spread props to allow for Mui Drawer specific prop overrides e.g. "hideBackdrop". */
|
|
15
|
+
}: DrawerProps): JSX.Element => {
|
|
16
|
+
return (
|
|
17
|
+
<MDrawer className={className} onClose={onClose} open={open} {...props}>
|
|
18
|
+
{children}
|
|
19
|
+
</MDrawer>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Box, SxProps } from "@mui/material";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
|
|
4
|
-
// TODO the prop "children" should not necessarily be optional, but it is for now to avoid typescript errors with the use of this component within site configuration files.
|
|
5
|
-
|
|
6
4
|
export interface GridProps {
|
|
7
|
-
children
|
|
5
|
+
children: ReactNode | ReactNode[];
|
|
8
6
|
gridSx?: SxProps;
|
|
9
7
|
}
|
|
10
8
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AddRoundedIcon from "@mui/icons-material/AddRounded";
|
|
2
2
|
import RemoveRoundedIcon from "@mui/icons-material/RemoveRounded";
|
|
3
|
-
import { Collapse } from "@mui/material";
|
|
4
|
-
import { CollapseProps } from "@mui/material/Collapse/Collapse";
|
|
3
|
+
import { Collapse, CollapseProps } from "@mui/material";
|
|
5
4
|
import React, { ReactNode, useEffect, useState } from "react";
|
|
6
5
|
import {
|
|
7
6
|
BREAKPOINT_FN_NAME,
|
package/src/config/entities.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { TabProps as MTabProps, Theme, ThemeOptions } from "@mui/material";
|
|
2
|
-
import { ColumnSort } from "@tanstack/react-table";
|
|
2
|
+
import { CellContext, ColumnSort, RowData } from "@tanstack/react-table";
|
|
3
3
|
import { JSXElementConstructor, ReactNode } from "react";
|
|
4
|
-
import {
|
|
5
|
-
CategoryKey,
|
|
6
|
-
SelectCategoryValueView,
|
|
7
|
-
SelectedFilter,
|
|
8
|
-
SelectedFilterValue,
|
|
9
|
-
} from "../common/entities";
|
|
4
|
+
import { SelectCategoryValueView, SelectedFilter } from "../common/entities";
|
|
10
5
|
import { HeroTitle } from "../components/common/Title/title";
|
|
11
6
|
import { FooterProps } from "../components/Layout/components/Footer/footer";
|
|
12
7
|
import { HeaderProps } from "../components/Layout/components/Header/header";
|
|
@@ -119,7 +114,7 @@ export interface ComponentConfig<
|
|
|
119
114
|
props?: React.ComponentProps<T>;
|
|
120
115
|
viewBuilder?: (
|
|
121
116
|
model: D,
|
|
122
|
-
viewContext?: ViewContext
|
|
117
|
+
viewContext?: ViewContext<D>
|
|
123
118
|
) => React.ComponentProps<T>;
|
|
124
119
|
}
|
|
125
120
|
|
|
@@ -265,9 +260,10 @@ export interface ListConfig<T = any> {
|
|
|
265
260
|
export interface ListViewConfig {
|
|
266
261
|
disablePagination?: boolean;
|
|
267
262
|
enableDownload?: boolean;
|
|
263
|
+
enableRowPreview?: boolean;
|
|
268
264
|
enableRowSelection?: boolean;
|
|
269
265
|
listHero?: ComponentsConfig;
|
|
270
|
-
|
|
266
|
+
rowPreviewView?: ComponentsConfig; // Row preview view is expected to be a modal or drawer or similar.
|
|
271
267
|
rowSelectionView?: ComponentsConfig;
|
|
272
268
|
subTitleHero?: ComponentsConfig;
|
|
273
269
|
}
|
|
@@ -304,18 +300,9 @@ export interface Override {
|
|
|
304
300
|
withdrawn?: boolean;
|
|
305
301
|
}
|
|
306
302
|
|
|
307
|
-
/**
|
|
308
|
-
* Related search function.
|
|
309
|
-
*/
|
|
310
|
-
type RelatedSearchFunction = (
|
|
311
|
-
searchKey: CategoryKey | undefined,
|
|
312
|
-
resultKey: CategoryKey | undefined,
|
|
313
|
-
selectedCategoryValues: SelectedFilterValue | undefined
|
|
314
|
-
) => Promise<RelatedSearchResult | undefined>;
|
|
315
|
-
|
|
316
303
|
export interface SavedFilter {
|
|
317
304
|
filters: SelectedFilter[];
|
|
318
|
-
|
|
305
|
+
sorting?: ColumnSort[];
|
|
319
306
|
title: string;
|
|
320
307
|
}
|
|
321
308
|
/**
|
|
@@ -356,24 +343,6 @@ interface TrackingConfig {
|
|
|
356
343
|
trackFilterOpened?: TrackFilterOpenedFunction;
|
|
357
344
|
}
|
|
358
345
|
|
|
359
|
-
/**
|
|
360
|
-
* Product of the related search function.
|
|
361
|
-
*/
|
|
362
|
-
export interface RelatedSearchResult {
|
|
363
|
-
resultKey: CategoryKey; // The related search function resultant search values' category key.
|
|
364
|
-
searchKey: CategoryKey; // The related search function search parameters' category key.
|
|
365
|
-
values: string[]; // Resultant search values.
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Related view configuration.
|
|
370
|
-
*/
|
|
371
|
-
export interface RelatedViewConfig {
|
|
372
|
-
relatedSearchFn: RelatedSearchFunction;
|
|
373
|
-
resultKey: CategoryKey; // The related search function resultant search values' category key.
|
|
374
|
-
searchKey: CategoryKey; // The related search function search parameters' category key.
|
|
375
|
-
}
|
|
376
|
-
|
|
377
346
|
/**
|
|
378
347
|
* Interface that will hold the whole configuration for a given site.
|
|
379
348
|
*/
|
|
@@ -459,8 +428,9 @@ export type ThemeOptionsFn = (theme: Theme) => ThemeOptions;
|
|
|
459
428
|
/**
|
|
460
429
|
* View context.
|
|
461
430
|
*/
|
|
462
|
-
export interface ViewContext {
|
|
431
|
+
export interface ViewContext<T extends RowData, TData = unknown> {
|
|
463
432
|
authState: Pick<AuthContextProps, "authenticationStatus" | "isAuthenticated">;
|
|
433
|
+
cellContext?: CellContext<T, TData>;
|
|
464
434
|
entityConfig: EntityConfig;
|
|
465
435
|
exploreState: ExploreState;
|
|
466
436
|
fileManifestState: FileManifestState;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
ColumnSort,
|
|
3
|
+
RowSelectionState,
|
|
4
|
+
VisibilityState,
|
|
5
|
+
} from "@tanstack/react-table";
|
|
3
6
|
import {
|
|
4
7
|
CategoryValueKey,
|
|
5
8
|
SelectCategory,
|
|
6
9
|
SelectCategoryView,
|
|
7
10
|
SelectedFilter,
|
|
8
11
|
} from "../../common/entities";
|
|
12
|
+
import { RowPreviewState } from "../../components/Table/features/RowPreview/entities";
|
|
9
13
|
import {
|
|
10
14
|
CategoryConfig,
|
|
11
15
|
CategoryGroup,
|
|
@@ -18,6 +22,7 @@ export interface EntityPageState {
|
|
|
18
22
|
categoryGroupConfigKey: CategoryGroupConfigKey;
|
|
19
23
|
columnsVisibility: VisibilityState;
|
|
20
24
|
enableRowSelection: boolean;
|
|
25
|
+
rowPreview: RowPreviewState;
|
|
21
26
|
rowSelection: RowSelectionState;
|
|
22
27
|
sorting: ColumnSort[];
|
|
23
28
|
}
|
|
@@ -34,11 +34,9 @@ export const INITIAL_STATE: ExploreState = {
|
|
|
34
34
|
featureFlagState: undefined,
|
|
35
35
|
filterCount: 0,
|
|
36
36
|
filterState: [],
|
|
37
|
-
isRelatedView: false,
|
|
38
37
|
listItems: [],
|
|
39
|
-
listView: undefined,
|
|
40
38
|
loading: true,
|
|
41
39
|
paginationState: DEFAULT_PAGINATION_STATE,
|
|
42
|
-
|
|
40
|
+
rowPreview: undefined,
|
|
43
41
|
tabValue: "",
|
|
44
42
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VisibilityState } from "@tanstack/table
|
|
1
|
+
import { VisibilityState } from "@tanstack/react-table";
|
|
2
2
|
import { SelectCategory, SelectedFilter } from "../../../common/entities";
|
|
3
3
|
import { getInitialTableColumnVisibility } from "../../../components/Table/common/utils";
|
|
4
4
|
import { ACCESSOR_KEYS } from "../../../components/TableCreator/common/constants";
|
|
@@ -73,8 +73,7 @@ function buildSavedFilterByCategoryValueKey(
|
|
|
73
73
|
if (!savedFilters) return;
|
|
74
74
|
const savedFilterByCategoryValueKey: SavedFilterByCategoryValueKey =
|
|
75
75
|
new Map();
|
|
76
|
-
for (const { filters,
|
|
77
|
-
const sorting = sort ? [sort] : undefined;
|
|
76
|
+
for (const { filters, sorting, title } of savedFilters) {
|
|
78
77
|
savedFilterByCategoryValueKey.set(title, { filters, sorting, title });
|
|
79
78
|
}
|
|
80
79
|
return savedFilterByCategoryValueKey;
|
|
@@ -166,6 +165,7 @@ function initEntityPageState(config: SiteConfig): EntityPageStateMapper {
|
|
|
166
165
|
categoryGroupConfigKey: initCategoryGroupConfigKey(config, entity),
|
|
167
166
|
columnsVisibility: initColumnVisibility(entity),
|
|
168
167
|
enableRowSelection: Boolean(entity.listView?.enableRowSelection),
|
|
168
|
+
rowPreview: undefined,
|
|
169
169
|
rowSelection: {},
|
|
170
170
|
sorting: getDefaultSorting(entity),
|
|
171
171
|
},
|
|
@@ -10,12 +10,8 @@ import {
|
|
|
10
10
|
SelectCategory,
|
|
11
11
|
SelectedFilter,
|
|
12
12
|
} from "../../../common/entities";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
ListItems,
|
|
16
|
-
PaginationResponse,
|
|
17
|
-
RelatedListItems,
|
|
18
|
-
} from "../../exploreState";
|
|
13
|
+
import { RowPreviewState } from "../../../components/Table/features/RowPreview/entities";
|
|
14
|
+
import { ListItems, PaginationResponse } from "../../exploreState";
|
|
19
15
|
import { ListItem } from "../entities";
|
|
20
16
|
|
|
21
17
|
/**
|
|
@@ -50,23 +46,11 @@ export interface ProcessExploreResponsePayload {
|
|
|
50
46
|
selectCategories?: SelectCategory[];
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
/**
|
|
54
|
-
* Process related response payload
|
|
55
|
-
*/
|
|
56
|
-
export interface ProcessRelatedResponsePayload {
|
|
57
|
-
relatedListItems: RelatedListItems;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
/**
|
|
61
50
|
* Reset explore response payload.
|
|
62
51
|
*/
|
|
63
52
|
export type ResetExploreResponsePayload = undefined;
|
|
64
53
|
|
|
65
|
-
/**
|
|
66
|
-
* Toggle entity view payload.
|
|
67
|
-
*/
|
|
68
|
-
export type ToggleEntityViewPayload = ENTITY_VIEW;
|
|
69
|
-
|
|
70
54
|
/**
|
|
71
55
|
* Update column visibility payload.
|
|
72
56
|
*/
|
|
@@ -78,6 +62,7 @@ export type UpdateColumnVisibilityPayload = VisibilityState;
|
|
|
78
62
|
export interface UpdateEntityFiltersPayload {
|
|
79
63
|
entityListType: string;
|
|
80
64
|
filters: SelectedFilter[];
|
|
65
|
+
sorting?: ColumnSort[];
|
|
81
66
|
}
|
|
82
67
|
/**
|
|
83
68
|
* Update entity view access payload.
|
|
@@ -95,6 +80,11 @@ export interface UpdateFilterPayload {
|
|
|
95
80
|
selectedValue: CategoryValueKey;
|
|
96
81
|
}
|
|
97
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Update row preview payload.
|
|
85
|
+
*/
|
|
86
|
+
export type UpdateRowPreviewPayload = RowPreviewState;
|
|
87
|
+
|
|
98
88
|
/**
|
|
99
89
|
* Update row selection payload.
|
|
100
90
|
*/
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CategoryValueKey,
|
|
5
5
|
SelectedFilter,
|
|
6
6
|
} from "../../common/entities";
|
|
7
|
+
import { RowPreviewState } from "../../components/Table/features/RowPreview/entities";
|
|
7
8
|
import { ACCESSOR_KEYS } from "../../components/TableCreator/common/constants";
|
|
8
9
|
import { ExploreState, ListItems, PaginationState } from "../exploreState";
|
|
9
10
|
import {
|
|
@@ -49,6 +50,18 @@ export function buildNextSavedFilterState(
|
|
|
49
50
|
return savedFilter?.filters || [];
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Closes row preview, if row preview is enabled.
|
|
55
|
+
* If row preview is enabled, the row preview state value is set to false.
|
|
56
|
+
* @param rowPreview - Row preview state.
|
|
57
|
+
* @returns row preview state with row preview value set to false.
|
|
58
|
+
*/
|
|
59
|
+
export function closeRowPreview(rowPreview: RowPreviewState): RowPreviewState {
|
|
60
|
+
if (!rowPreview) return rowPreview;
|
|
61
|
+
const [[key]] = Object.entries(rowPreview);
|
|
62
|
+
return { [key]: false };
|
|
63
|
+
}
|
|
64
|
+
|
|
52
65
|
/**
|
|
53
66
|
* Returns the category group config key for the current entity.
|
|
54
67
|
* @param entityPath - Entity path.
|
|
@@ -155,33 +168,6 @@ export function resetPage(paginationState: PaginationState): PaginationState {
|
|
|
155
168
|
return nextPaginationState;
|
|
156
169
|
}
|
|
157
170
|
|
|
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
|
-
* @param categoryGroupConfigKey - Category group config key.
|
|
162
|
-
* @returns entity page state mapper with row selection reset.
|
|
163
|
-
*/
|
|
164
|
-
export function resetRowSelection(
|
|
165
|
-
state: ExploreState,
|
|
166
|
-
categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
|
|
167
|
-
state.tabValue,
|
|
168
|
-
state.entityPageState
|
|
169
|
-
)
|
|
170
|
-
): EntityPageStateMapper {
|
|
171
|
-
return Object.entries(state.entityPageState).reduce(
|
|
172
|
-
(acc, [entityPath, entityPageState]) => {
|
|
173
|
-
if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
|
|
174
|
-
return {
|
|
175
|
-
...acc,
|
|
176
|
-
[entityPath]: { ...entityPageState, rowSelection: {} },
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
return { ...acc, [entityPath]: entityPageState };
|
|
180
|
-
},
|
|
181
|
-
{} as EntityPageStateMapper
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
171
|
/**
|
|
186
172
|
* Sets entity state for the given category group config key.
|
|
187
173
|
* @param categoryGroupConfigKey - Category group config key.
|
|
@@ -221,24 +207,27 @@ export function updateEntityPageState(
|
|
|
221
207
|
}
|
|
222
208
|
|
|
223
209
|
/**
|
|
224
|
-
* Updates entity page state
|
|
210
|
+
* Updates entity page state for the current entity and entities that share the same category group config key.
|
|
225
211
|
* @param state - Explore state.
|
|
226
|
-
* @param
|
|
212
|
+
* @param nextEntityPageState - Partial next entity page state.
|
|
213
|
+
* @param categoryGroupConfigKey - Category group config key.
|
|
227
214
|
* @returns entity page state.
|
|
228
215
|
*/
|
|
229
|
-
export function
|
|
216
|
+
export function updateEntityPageStateWithCommonCategoryGroupConfigKey(
|
|
230
217
|
state: ExploreState,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (!sorting) return state.entityPageState;
|
|
234
|
-
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
|
|
218
|
+
nextEntityPageState: Partial<EntityPageState>,
|
|
219
|
+
categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
|
|
235
220
|
state.tabValue,
|
|
236
221
|
state.entityPageState
|
|
237
|
-
)
|
|
222
|
+
)
|
|
223
|
+
): EntityPageStateMapper {
|
|
238
224
|
return Object.entries(state.entityPageState).reduce(
|
|
239
225
|
(acc, [entityPath, entityPageState]) => {
|
|
240
226
|
if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
|
|
241
|
-
return {
|
|
227
|
+
return {
|
|
228
|
+
...acc,
|
|
229
|
+
[entityPath]: { ...entityPageState, ...nextEntityPageState },
|
|
230
|
+
};
|
|
242
231
|
}
|
|
243
232
|
return { ...acc, [entityPath]: entityPageState };
|
|
244
233
|
},
|