@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RowDetail = void 0;
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const typography_1 = require("../../../../../../../../../../theme/common/typography");
|
|
10
|
+
const buttonTextPrimary_1 = require("../../../../../../../../../common/Button/components/ButtonTextPrimary/buttonTextPrimary");
|
|
11
|
+
const ComponentCreator_1 = require("../../../../../../../../../ComponentCreator/ComponentCreator");
|
|
12
|
+
const rowDetail_styles_1 = require("./rowDetail.styles");
|
|
13
|
+
const MIN_COLUMNS = 6;
|
|
14
|
+
const RowDetail = ({ className, columns, expanded = true, minColumns = MIN_COLUMNS, tableInstance, }) => {
|
|
15
|
+
const [showMore, setShowMore] = react_1.default.useState(expanded);
|
|
16
|
+
const { getRowPreviewRow } = tableInstance;
|
|
17
|
+
const { original: rowData } = getRowPreviewRow() || {};
|
|
18
|
+
const visibleColumns = showMore ? columns : columns.slice(0, minColumns);
|
|
19
|
+
const buttonText = showMore ? "Show less" : "Show more";
|
|
20
|
+
const onToggleShowMore = () => setShowMore(!showMore);
|
|
21
|
+
if (!rowData)
|
|
22
|
+
return null;
|
|
23
|
+
return (react_1.default.createElement(rowDetail_styles_1.Section, { className: className },
|
|
24
|
+
visibleColumns.map(({ componentConfig, header }, i) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return (react_1.default.createElement(material_1.Grid, { key: i },
|
|
27
|
+
react_1.default.createElement(material_1.Typography, Object.assign({ color: "ink.light", variant: typography_1.TEXT_BODY_400 }, (_a = componentConfig.props) === null || _a === void 0 ? void 0 : _a.TypographyProps), header),
|
|
28
|
+
react_1.default.createElement(ComponentCreator_1.ComponentCreator, { components: [componentConfig], response: rowData })));
|
|
29
|
+
}),
|
|
30
|
+
react_1.default.createElement(buttonTextPrimary_1.ButtonTextPrimary, { onClick: onToggleShowMore }, buttonText)));
|
|
31
|
+
};
|
|
32
|
+
exports.RowDetail = RowDetail;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Section: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Section = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const breakpoints_1 = require("../../../../../../../../../../styles/common/mixins/breakpoints");
|
|
9
|
+
const fonts_1 = require("../../../../../../../../../../styles/common/mixins/fonts");
|
|
10
|
+
exports.Section = styled_1.default.div `
|
|
11
|
+
${fonts_1.textBody400};
|
|
12
|
+
display: grid;
|
|
13
|
+
gap: 16px;
|
|
14
|
+
grid-auto-rows: minmax(40px, auto);
|
|
15
|
+
grid-template-columns: minmax(0, 1fr);
|
|
16
|
+
overflow-wrap: break-word;
|
|
17
|
+
padding: 16px 24px;
|
|
18
|
+
|
|
19
|
+
> .MuiGrid-root {
|
|
20
|
+
display: grid;
|
|
21
|
+
gap: 4px;
|
|
22
|
+
grid-column: 1 / -1;
|
|
23
|
+
grid-template-columns: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
> .MuiButton-textPrimary {
|
|
27
|
+
grid-column: 1 / -1;
|
|
28
|
+
justify-self: flex-start;
|
|
29
|
+
text-align: left;
|
|
30
|
+
text-transform: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
${breakpoints_1.mediaTabletUp} {
|
|
34
|
+
gap: 0 8px;
|
|
35
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
36
|
+
padding: 8px 24px;
|
|
37
|
+
|
|
38
|
+
> .MuiGrid-root {
|
|
39
|
+
display: contents;
|
|
40
|
+
|
|
41
|
+
> * {
|
|
42
|
+
margin: 10px 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
${breakpoints_1.mediaDesktopSmallUp} {
|
|
48
|
+
grid-template-columns: 194px minmax(0, 1fr);
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Section = void 0;
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const typography_1 = require("../../../../../../../../theme/common/typography");
|
|
10
|
+
const section_styles_1 = require("./section.styles");
|
|
11
|
+
const Section = ({ children, className, title, }) => {
|
|
12
|
+
return (react_1.default.createElement(section_styles_1.Section, { className: className },
|
|
13
|
+
react_1.default.createElement(material_1.Typography, { component: "div", variant: typography_1.TEXT_HEADING_SMALL }, title),
|
|
14
|
+
children));
|
|
15
|
+
};
|
|
16
|
+
exports.Section = Section;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Section: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Section = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
exports.Section = styled_1.default.div `
|
|
9
|
+
display: grid;
|
|
10
|
+
gap: 16px;
|
|
11
|
+
padding: 16px 24px 24px;
|
|
12
|
+
|
|
13
|
+
.MuiTypography-text-heading-small {
|
|
14
|
+
font-size: 18px;
|
|
15
|
+
line-height: 26px;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
3
|
+
import { ComponentsConfig } from "../../../../../../config/entities";
|
|
4
|
+
export interface RowPreviewProps<T extends RowData> {
|
|
5
|
+
rowPreviewView?: ComponentsConfig;
|
|
6
|
+
tableInstance: Table<T>;
|
|
7
|
+
}
|
|
8
|
+
export declare const RowPreview: <T extends unknown>({ rowPreviewView, tableInstance, }: RowPreviewProps<T>) => JSX.Element | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RowPreview = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ComponentCreator_1 = require("../../../../../ComponentCreator/ComponentCreator");
|
|
9
|
+
const RowPreview = ({ rowPreviewView, tableInstance, }) => {
|
|
10
|
+
if (!rowPreviewView)
|
|
11
|
+
return null;
|
|
12
|
+
return (react_1.default.createElement(ComponentCreator_1.ComponentCreator, { components: rowPreviewView, response: tableInstance }));
|
|
13
|
+
};
|
|
14
|
+
exports.RowPreview = RowPreview;
|
package/lib/components/Table/components/TableToolbar/components/RowSelection/rowSelection.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Row } from "@tanstack/react-table";
|
|
2
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
3
3
|
import { ComponentsConfig } from "../../../../../../config/entities";
|
|
4
|
-
export interface RowSelectionProps<T> {
|
|
4
|
+
export interface RowSelectionProps<T extends RowData> {
|
|
5
5
|
className?: string;
|
|
6
6
|
rows: Row<T>[];
|
|
7
7
|
rowSelectionView?: ComponentsConfig;
|
|
8
8
|
}
|
|
9
|
-
export declare const RowSelection: <T extends
|
|
9
|
+
export declare const RowSelection: <T extends unknown>({ className, rows, rowSelectionView, }: RowSelectionProps<T>) => JSX.Element | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Table } from "@tanstack/react-table";
|
|
2
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
3
3
|
import { ListViewConfig } from "../../../../config/entities";
|
|
4
4
|
import { ROW_DIRECTION } from "../../common/entities";
|
|
5
|
-
export interface TableToolbarProps<T> {
|
|
5
|
+
export interface TableToolbarProps<T extends RowData> {
|
|
6
6
|
listView?: ListViewConfig;
|
|
7
7
|
rowDirection: ROW_DIRECTION;
|
|
8
8
|
tableInstance: Table<T>;
|
|
9
9
|
}
|
|
10
|
-
export declare const TableToolbar: <T extends
|
|
10
|
+
export declare const TableToolbar: <T extends unknown>({ listView, rowDirection, tableInstance, }: TableToolbarProps<T>) => JSX.Element;
|
|
@@ -31,6 +31,7 @@ const utils_1 = require("../../common/utils");
|
|
|
31
31
|
const checkboxMenu_1 = require("../CheckboxMenu/checkboxMenu");
|
|
32
32
|
const downloadEntityResults_1 = require("../DownloadEntityResults/downloadEntityResults");
|
|
33
33
|
const paginationSummary_1 = require("../PaginationSummary/paginationSummary");
|
|
34
|
+
const rowPreview_1 = require("./components/RowPreview/rowPreview");
|
|
34
35
|
const rowSelection_1 = require("./components/RowSelection/rowSelection");
|
|
35
36
|
const tableToolbar_styles_1 = require("./tableToolbar.styles");
|
|
36
37
|
const TableToolbar = ({ listView, rowDirection, tableInstance, }) => {
|
|
@@ -38,7 +39,7 @@ const TableToolbar = ({ listView, rowDirection, tableInstance, }) => {
|
|
|
38
39
|
const { paginationState } = exploreState;
|
|
39
40
|
const { currentPage, pages, pageSize, rows } = paginationState;
|
|
40
41
|
const { getSelectedRowModel, resetColumnVisibility } = tableInstance;
|
|
41
|
-
const { enableDownload } = listView || {};
|
|
42
|
+
const { enableDownload, rowPreviewView } = listView || {};
|
|
42
43
|
const isLastPage = currentPage === pages;
|
|
43
44
|
const editColumnOptions = (0, utils_1.getEditColumnOptions)(tableInstance);
|
|
44
45
|
const showToolbar = rowDirection === entities_1.ROW_DIRECTION.DEFAULT &&
|
|
@@ -49,10 +50,12 @@ const TableToolbar = ({ listView, rowDirection, tableInstance, }) => {
|
|
|
49
50
|
const onResetColumnVisibility = () => {
|
|
50
51
|
resetColumnVisibility(false);
|
|
51
52
|
};
|
|
52
|
-
return (react_1.default.createElement(react_1.Fragment, null,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
return (react_1.default.createElement(react_1.Fragment, null,
|
|
54
|
+
showToolbar && (react_1.default.createElement(tableToolbar_styles_1.Toolbar, { variant: "table" },
|
|
55
|
+
(0, utils_1.isAnyRowSelected)(tableInstance) ? (react_1.default.createElement(rowSelection_1.RowSelection, { rows: getSelectedRowModel().rows, rowSelectionView: listView === null || listView === void 0 ? void 0 : listView.rowSelectionView })) : (react_1.default.createElement(paginationSummary_1.PaginationSummary, { firstResult: (currentPage - 1) * pageSize + 1, lastResult: isLastPage ? rows : pageSize * currentPage, totalResult: rows })),
|
|
56
|
+
react_1.default.createElement(tableToolbar_styles_1.ToolbarActions, null,
|
|
57
|
+
enableDownload && (react_1.default.createElement(downloadEntityResults_1.DownloadEntityResults, { entityName: exploreState.tabValue, rows: tableInstance.getFilteredRowModel().rows })),
|
|
58
|
+
react_1.default.createElement(checkboxMenu_1.CheckboxMenu, { label: "Edit Columns", onReset: onResetColumnVisibility, options: editColumnOptions })))),
|
|
59
|
+
react_1.default.createElement(rowPreview_1.RowPreview, { rowPreviewView: rowPreviewView, tableInstance: tableInstance })));
|
|
57
60
|
};
|
|
58
61
|
exports.TableToolbar = TableToolbar;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROW_PREVIEW = void 0;
|
|
4
|
+
const react_table_1 = require("@tanstack/react-table");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
exports.ROW_PREVIEW = {
|
|
7
|
+
createRow: (row, table) => {
|
|
8
|
+
row.getIsPreview = () => {
|
|
9
|
+
return (0, utils_1.getIsPreview)(row, table);
|
|
10
|
+
};
|
|
11
|
+
row.togglePreview = () => {
|
|
12
|
+
(0, utils_1.togglePreview)(row, table);
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
createTable: (table) => {
|
|
16
|
+
table.getIsRowPreview = () => {
|
|
17
|
+
return (0, utils_1.getIsRowPreview)(table);
|
|
18
|
+
};
|
|
19
|
+
table.getRowPreviewRow = () => {
|
|
20
|
+
return (0, utils_1.getRowPreviewRow)(table);
|
|
21
|
+
};
|
|
22
|
+
table.resetRowPreview = () => {
|
|
23
|
+
table.setRowPreview(undefined);
|
|
24
|
+
};
|
|
25
|
+
table.setRowPreview = (updater) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const safeUpdater = (old) => {
|
|
28
|
+
return (0, react_table_1.functionalUpdate)(updater, old);
|
|
29
|
+
};
|
|
30
|
+
return (_b = (_a = table.options).onRowPreviewChange) === null || _b === void 0 ? void 0 : _b.call(_a, safeUpdater);
|
|
31
|
+
};
|
|
32
|
+
table.toggleRowPreview = () => {
|
|
33
|
+
(0, utils_1.toggleRowPreview)(table);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
getDefaultOptions: (table) => {
|
|
37
|
+
return {
|
|
38
|
+
enableRowPreview: true,
|
|
39
|
+
onRowPreviewChange: (0, react_table_1.makeStateUpdater)("rowPreview", table),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
getInitialState: (initialState) => {
|
|
43
|
+
return Object.assign(Object.assign({}, initialState), { rowPreview: undefined });
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OnChangeFn, Row, RowData, Updater } from "@tanstack/react-table";
|
|
2
|
+
export interface RowPreviewInstance<T extends RowData> {
|
|
3
|
+
getIsRowPreview: () => boolean;
|
|
4
|
+
getRowPreviewRow: () => Row<T> | undefined;
|
|
5
|
+
resetRowPreview: () => void;
|
|
6
|
+
setRowPreview: (updater: Updater<RowPreviewState>) => void;
|
|
7
|
+
toggleRowPreview: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface RowPreviewOptions {
|
|
10
|
+
enableRowPreview?: boolean;
|
|
11
|
+
onRowPreviewChange?: OnChangeFn<RowPreviewState>;
|
|
12
|
+
}
|
|
13
|
+
export interface RowPreviewRow {
|
|
14
|
+
getIsPreview: () => boolean;
|
|
15
|
+
togglePreview: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare type RowPreviewState = {
|
|
18
|
+
[id: string]: boolean;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export interface RowPreviewTableState {
|
|
21
|
+
rowPreview: RowPreviewState;
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Row, RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if the row is selected for preview.
|
|
4
|
+
* @param row - Row.
|
|
5
|
+
* @param table - Table.
|
|
6
|
+
* @returns true if the row is selected for preview.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getIsPreview<T extends RowData>(row: Row<T>, table: Table<T>): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if any row is selected for preview.
|
|
11
|
+
* @param table - Table.
|
|
12
|
+
* @returns true if any row is selected for preview.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getIsRowPreview<T extends RowData>(table: Table<T>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns row selected for preview. Row data is returned even if the row is no longer "previewed" i.e. selected for preview.
|
|
17
|
+
* @param table - Table.
|
|
18
|
+
* @returns row selected for preview.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getRowPreviewRow<T extends RowData>(table: Table<T>): Row<T> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Toggles the preview state of the row.
|
|
23
|
+
* If the row is already selected for preview, the preview state is toggled off.
|
|
24
|
+
* If the row is not selected for preview, the preview state is updated.
|
|
25
|
+
* @param row - Row.
|
|
26
|
+
* @param table - Table.
|
|
27
|
+
*/
|
|
28
|
+
export declare function togglePreview<T extends RowData>(row: Row<T>, table: Table<T>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Toggles the preview state of any row selected for preview.
|
|
31
|
+
* @param table - Table.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toggleRowPreview<T extends RowData>(table: Table<T>): void;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toggleRowPreview = exports.togglePreview = exports.getRowPreviewRow = exports.getIsRowPreview = exports.getIsPreview = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if the row is selected for preview.
|
|
6
|
+
* @param row - Row.
|
|
7
|
+
* @param table - Table.
|
|
8
|
+
* @returns true if the row is selected for preview.
|
|
9
|
+
*/
|
|
10
|
+
function getIsPreview(row, table) {
|
|
11
|
+
const keyValue = getRowPreviewKeyValue(table);
|
|
12
|
+
if (!keyValue)
|
|
13
|
+
return false;
|
|
14
|
+
const [key, value] = keyValue;
|
|
15
|
+
if (!value)
|
|
16
|
+
return false;
|
|
17
|
+
return key === row.id;
|
|
18
|
+
}
|
|
19
|
+
exports.getIsPreview = getIsPreview;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if any row is selected for preview.
|
|
22
|
+
* @param table - Table.
|
|
23
|
+
* @returns true if any row is selected for preview.
|
|
24
|
+
*/
|
|
25
|
+
function getIsRowPreview(table) {
|
|
26
|
+
const keyValue = getRowPreviewKeyValue(table);
|
|
27
|
+
if (!keyValue)
|
|
28
|
+
return false;
|
|
29
|
+
const [, value] = keyValue;
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
exports.getIsRowPreview = getIsRowPreview;
|
|
33
|
+
/**
|
|
34
|
+
* Returns row selected for preview. Row data is returned even if the row is no longer "previewed" i.e. selected for preview.
|
|
35
|
+
* @param table - Table.
|
|
36
|
+
* @returns row selected for preview.
|
|
37
|
+
*/
|
|
38
|
+
function getRowPreviewRow(table) {
|
|
39
|
+
const keyValue = getRowPreviewKeyValue(table);
|
|
40
|
+
if (!keyValue)
|
|
41
|
+
return;
|
|
42
|
+
const [key] = keyValue;
|
|
43
|
+
// We return the original row data, even if the row is no longer "previewed" i.e. selected for preview.
|
|
44
|
+
// This is to ensure any drawer or modal that is still open can display the row data, until the modal or drawer is closed.
|
|
45
|
+
const rowsById = table.getRowModel().rowsById;
|
|
46
|
+
return rowsById[key];
|
|
47
|
+
}
|
|
48
|
+
exports.getRowPreviewRow = getRowPreviewRow;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the key, value tuple of the row selected for preview.
|
|
51
|
+
* @param table - Table.
|
|
52
|
+
* @returns row preview key, value tuple.
|
|
53
|
+
*/
|
|
54
|
+
function getRowPreviewKeyValue(table) {
|
|
55
|
+
const { getState } = table;
|
|
56
|
+
const { rowPreview } = getState();
|
|
57
|
+
if (!rowPreview)
|
|
58
|
+
return;
|
|
59
|
+
const [[key, value]] = Object.entries(rowPreview);
|
|
60
|
+
return [key, value];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Toggles the preview state of the row.
|
|
64
|
+
* If the row is already selected for preview, the preview state is toggled off.
|
|
65
|
+
* If the row is not selected for preview, the preview state is updated.
|
|
66
|
+
* @param row - Row.
|
|
67
|
+
* @param table - Table.
|
|
68
|
+
*/
|
|
69
|
+
function togglePreview(row, table) {
|
|
70
|
+
if (row.getIsPreview()) {
|
|
71
|
+
table.toggleRowPreview();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
table.setRowPreview({ [row.id]: true });
|
|
75
|
+
}
|
|
76
|
+
exports.togglePreview = togglePreview;
|
|
77
|
+
/**
|
|
78
|
+
* Toggles the preview state of any row selected for preview.
|
|
79
|
+
* @param table - Table.
|
|
80
|
+
*/
|
|
81
|
+
function toggleRowPreview(table) {
|
|
82
|
+
const keyValue = getRowPreviewKeyValue(table);
|
|
83
|
+
if (!keyValue) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const [key, value] = keyValue;
|
|
87
|
+
table.setRowPreview({ [key]: !value });
|
|
88
|
+
}
|
|
89
|
+
exports.toggleRowPreview = toggleRowPreview;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RowData } from "@tanstack/react-table";
|
|
2
|
+
import { RowPreviewInstance, RowPreviewOptions, RowPreviewRow, RowPreviewTableState } from "./RowPreview/entities";
|
|
3
|
+
export declare type CustomFeatureInitialTableState = Partial<RowPreviewTableState>;
|
|
4
|
+
export declare type CustomFeatureInstance<T extends RowData> = RowPreviewInstance<T>;
|
|
5
|
+
export declare type CustomFeatureOptions = RowPreviewOptions;
|
|
6
|
+
export declare type CustomFeatureRow = RowPreviewRow;
|
|
7
|
+
export declare type CustomFeatureTableState = RowPreviewTableState;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ColumnDef, InitialTableState } from "@tanstack/react-table";
|
|
3
|
-
import { CoreOptions } from "@tanstack/table-core";
|
|
4
|
-
import { Pagination } from "../../common/entities";
|
|
2
|
+
import { ColumnDef, CoreOptions, InitialTableState, RowData } from "@tanstack/react-table";
|
|
5
3
|
import { ListViewConfig } from "../../config/entities";
|
|
6
|
-
export interface TableProps<T extends
|
|
4
|
+
export interface TableProps<T extends RowData> {
|
|
7
5
|
columns: ColumnDef<T>[];
|
|
8
|
-
count?: number;
|
|
9
6
|
getRowId?: CoreOptions<T>["getRowId"];
|
|
10
7
|
initialState: InitialTableState;
|
|
11
8
|
items: T[];
|
|
12
9
|
listView?: ListViewConfig;
|
|
13
10
|
loading?: boolean;
|
|
14
|
-
pages?: number;
|
|
15
|
-
pageSize: number;
|
|
16
|
-
pagination?: Pagination;
|
|
17
|
-
total?: number;
|
|
18
11
|
}
|
|
19
12
|
/**
|
|
20
13
|
* This table can be Controlled or Uncontrolled based on the set of props passed to it.
|
|
@@ -26,8 +19,7 @@ export interface TableProps<T extends object> {
|
|
|
26
19
|
* @param tableProps.initialState - Initial table state.
|
|
27
20
|
* @param tableProps.items - Row data to display.
|
|
28
21
|
* @param tableProps.listView - List view configuration.
|
|
29
|
-
* @param tableProps.total - Total number of rows in the result set.
|
|
30
22
|
* @returns Configured table element for display.
|
|
31
23
|
*/
|
|
32
|
-
export declare const TableComponent: <T extends
|
|
33
|
-
export declare const Table: <T extends
|
|
24
|
+
export declare const TableComponent: <T extends unknown>({ columns, getRowId, initialState, items, listView, }: TableProps<T>) => JSX.Element;
|
|
25
|
+
export declare const Table: <T extends unknown>({ columns, getRowId, initialState, items, listView, }: TableProps<T>) => JSX.Element;
|
|
@@ -44,6 +44,7 @@ const pagination_1 = require("./components/Pagination/pagination");
|
|
|
44
44
|
const tableBody_1 = require("./components/TableBody/tableBody");
|
|
45
45
|
const tableHead_1 = require("./components/TableHead/tableHead");
|
|
46
46
|
const tableToolbar_1 = require("./components/TableToolbar/tableToolbar");
|
|
47
|
+
const constants_2 = require("./features/RowPreview/constants");
|
|
47
48
|
const table_styles_1 = require("./table.styles");
|
|
48
49
|
/**
|
|
49
50
|
* This table can be Controlled or Uncontrolled based on the set of props passed to it.
|
|
@@ -55,21 +56,21 @@ const table_styles_1 = require("./table.styles");
|
|
|
55
56
|
* @param tableProps.initialState - Initial table state.
|
|
56
57
|
* @param tableProps.items - Row data to display.
|
|
57
58
|
* @param tableProps.listView - List view configuration.
|
|
58
|
-
* @param tableProps.total - Total number of rows in the result set.
|
|
59
59
|
* @returns Configured table element for display.
|
|
60
60
|
*/
|
|
61
|
-
const TableComponent = ({ columns, getRowId, initialState, items, listView,
|
|
61
|
+
const TableComponent = ({ columns, getRowId, initialState, items, listView, }) => {
|
|
62
62
|
const tabletDown = (0, useBreakpointHelper_1.useBreakpointHelper)(useBreakpointHelper_1.BREAKPOINT_FN_NAME.DOWN, breakpoints_1.TABLET);
|
|
63
63
|
const exploreMode = (0, useExploreMode_1.useExploreMode)();
|
|
64
64
|
const { exploreDispatch, exploreState } = (0, useExploreState_1.useExploreState)();
|
|
65
|
-
const { entityPageState, filterState,
|
|
65
|
+
const { entityPageState, filterState, listItems, loading, paginationState, rowPreview, tabValue, } = exploreState;
|
|
66
66
|
const { columnsVisibility, enableRowSelection, rowSelection, sorting } = entityPageState[tabValue];
|
|
67
|
-
const { currentPage, pages, pageSize } = paginationState;
|
|
68
|
-
const { disablePagination = false } = listView || {};
|
|
67
|
+
const { currentPage, pages, pageSize, rows: pageCount } = paginationState;
|
|
68
|
+
const { disablePagination = false, enableRowPreview = false } = listView || {};
|
|
69
69
|
const clientFiltering = (0, utils_1.isClientFilteringEnabled)(exploreMode);
|
|
70
70
|
const rowDirection = tabletDown
|
|
71
71
|
? entities_2.ROW_DIRECTION.VERTICAL
|
|
72
72
|
: entities_2.ROW_DIRECTION.DEFAULT;
|
|
73
|
+
const pagination = (0, react_1.useMemo)(() => (0, utils_1.getTableStatePagination)(currentPage - 1, pageSize), [currentPage, pageSize]);
|
|
73
74
|
const onSortingChange = (updater) => {
|
|
74
75
|
exploreDispatch({
|
|
75
76
|
payload: typeof updater === "function" ? updater(sorting) : updater,
|
|
@@ -90,6 +91,12 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
90
91
|
type: exploreState_1.ExploreActionKind.UpdateColumnVisibility,
|
|
91
92
|
});
|
|
92
93
|
};
|
|
94
|
+
const onRowPreviewChange = (updater) => {
|
|
95
|
+
exploreDispatch({
|
|
96
|
+
payload: typeof updater === "function" ? updater(rowPreview) : updater,
|
|
97
|
+
type: exploreState_1.ExploreActionKind.UpdateRowPreview,
|
|
98
|
+
});
|
|
99
|
+
};
|
|
93
100
|
const onRowSelectionChange = (updater) => {
|
|
94
101
|
exploreDispatch({
|
|
95
102
|
payload: typeof updater === "function" ? updater(rowSelection) : updater,
|
|
@@ -98,19 +105,19 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
98
105
|
};
|
|
99
106
|
const state = {
|
|
100
107
|
columnVisibility: columnsVisibility,
|
|
101
|
-
pagination
|
|
102
|
-
|
|
103
|
-
pageSize: disablePagination ? Number.MAX_SAFE_INTEGER : pageSize,
|
|
104
|
-
},
|
|
108
|
+
pagination,
|
|
109
|
+
rowPreview,
|
|
105
110
|
rowSelection,
|
|
106
111
|
sorting,
|
|
107
112
|
};
|
|
108
113
|
const tableInstance = (0, react_table_1.useReactTable)({
|
|
114
|
+
_features: [constants_2.ROW_PREVIEW],
|
|
109
115
|
columns,
|
|
110
116
|
data: items,
|
|
111
117
|
enableColumnFilters: true,
|
|
112
118
|
enableFilters: true,
|
|
113
119
|
enableMultiSort: clientFiltering,
|
|
120
|
+
enableRowPreview,
|
|
114
121
|
enableRowSelection,
|
|
115
122
|
enableSorting: true,
|
|
116
123
|
enableSortingRemoval: false,
|
|
@@ -124,12 +131,13 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
124
131
|
getRowId,
|
|
125
132
|
getSortedRowModel: clientFiltering ? (0, react_table_1.getSortedRowModel)() : undefined,
|
|
126
133
|
initialState,
|
|
127
|
-
manualPagination:
|
|
134
|
+
manualPagination: true,
|
|
128
135
|
manualSorting: !clientFiltering,
|
|
129
136
|
onColumnVisibilityChange,
|
|
137
|
+
onRowPreviewChange,
|
|
130
138
|
onRowSelectionChange,
|
|
131
139
|
onSortingChange,
|
|
132
|
-
pageCount
|
|
140
|
+
pageCount,
|
|
133
141
|
state,
|
|
134
142
|
});
|
|
135
143
|
const { getAllColumns, getRowModel, getState, getVisibleFlatColumns, nextPage: tableNextPage, previousPage: tablePreviousPage, } = tableInstance;
|
|
@@ -155,7 +163,6 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
155
163
|
[entities_1.EVENT_PARAM.PAGINATION_DIRECTION]: entities_1.PAGINATION_DIRECTION.NEXT,
|
|
156
164
|
});
|
|
157
165
|
}
|
|
158
|
-
// const nextPage = pagination?.nextPage ?? tableNextPage;
|
|
159
166
|
nextPage();
|
|
160
167
|
scrollTop();
|
|
161
168
|
};
|
|
@@ -176,26 +183,17 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
176
183
|
previousPage();
|
|
177
184
|
scrollTop();
|
|
178
185
|
};
|
|
179
|
-
// Sets
|
|
180
|
-
// - `columnFilters` state is "cleared" for related view, and
|
|
181
|
-
// - `columnFilters` state is "set" for all other views.
|
|
186
|
+
// Sets react table column filters `columnFilters` state - for client-side filtering only - with update of filterState.
|
|
182
187
|
(0, react_1.useEffect)(() => {
|
|
183
188
|
if (clientFiltering) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
tableInstance.setColumnFilters(filterState.map(({ categoryKey, value }) => ({
|
|
189
|
-
id: categoryKey,
|
|
190
|
-
value,
|
|
191
|
-
})));
|
|
192
|
-
}
|
|
189
|
+
tableInstance.setColumnFilters(filterState.map(({ categoryKey, value }) => ({
|
|
190
|
+
id: categoryKey,
|
|
191
|
+
value,
|
|
192
|
+
})));
|
|
193
193
|
}
|
|
194
|
-
}, [clientFiltering, filterState,
|
|
194
|
+
}, [clientFiltering, filterState, tableInstance]);
|
|
195
195
|
// Process explore response - client-side filtering only.
|
|
196
196
|
(0, react_1.useEffect)(() => {
|
|
197
|
-
if (isRelatedView)
|
|
198
|
-
return;
|
|
199
197
|
if (!listItems || listItems.length === 0)
|
|
200
198
|
return;
|
|
201
199
|
if (clientFiltering) {
|
|
@@ -214,26 +212,16 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
214
212
|
clientFiltering,
|
|
215
213
|
columnFilters,
|
|
216
214
|
exploreDispatch,
|
|
217
|
-
isRelatedView,
|
|
218
215
|
listItems,
|
|
219
216
|
results,
|
|
220
217
|
]);
|
|
221
|
-
// Unmount - reset entity view to "exact".
|
|
222
|
-
(0, react_1.useEffect)(() => {
|
|
223
|
-
return () => {
|
|
224
|
-
exploreDispatch({
|
|
225
|
-
payload: exploreState_1.ENTITY_VIEW.EXACT,
|
|
226
|
-
type: exploreState_1.ExploreActionKind.ToggleEntityView,
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
}, [exploreDispatch]);
|
|
230
218
|
function canNextPage() {
|
|
231
219
|
return currentPage < pages;
|
|
232
220
|
}
|
|
233
221
|
function canPreviousPage() {
|
|
234
222
|
return currentPage > 1;
|
|
235
223
|
}
|
|
236
|
-
return noResults ? (react_1.default.createElement(noResults_1.NoResults, { Paper: paper_styles_1.FluidPaper, title: "No Results found" })) : (react_1.default.createElement(paper_styles_1.FluidPaper,
|
|
224
|
+
return noResults ? (react_1.default.createElement(noResults_1.NoResults, { Paper: paper_styles_1.FluidPaper, title: "No Results found" })) : (react_1.default.createElement(paper_styles_1.FluidPaper, { variant: "table" },
|
|
237
225
|
react_1.default.createElement(paper_styles_1.GridPaper, null,
|
|
238
226
|
react_1.default.createElement(tableToolbar_1.TableToolbar, { listView: listView, rowDirection: rowDirection, tableInstance: tableInstance }),
|
|
239
227
|
react_1.default.createElement(material_1.TableContainer, null,
|