@databiosphere/findable-ui 3.2.0 → 5.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/lib/components/Detail/components/DetailViewTable/detailViewTable.d.ts +3 -2
- package/lib/components/Detail/components/DetailViewTable/detailViewTable.js +14 -2
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +4 -1
- package/lib/components/Detail/components/Table/components/TableRows/tableRows.d.ts +1 -1
- package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +21 -2
- package/lib/components/Detail/components/Table/table.d.ts +3 -1
- package/lib/components/Detail/components/Table/table.js +3 -7
- package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +13 -1
- package/lib/components/Table/common/gridTable.styles.js +9 -1
- package/lib/components/Table/common/utils.d.ts +6 -0
- package/lib/components/Table/common/utils.js +10 -1
- package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.d.ts +4 -3
- package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.js +21 -3
- package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.styles.js +4 -0
- package/lib/components/Table/components/TableHead/tableHead.js +4 -1
- package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -1
- package/lib/components/Table/table.js +1 -1
- package/lib/components/TableCreator/common/utils.js +1 -5
- package/lib/components/common/CustomIcon/components/AddLinkIcon/addLinkIcon.d.ts +3 -0
- package/lib/components/common/CustomIcon/components/AddLinkIcon/addLinkIcon.js +25 -0
- package/lib/components/common/CustomIcon/components/UnLinkIcon/unLinkIcon.d.ts +3 -0
- package/lib/components/common/CustomIcon/components/UnLinkIcon/unLinkIcon.js +25 -0
- package/lib/config/entities.d.ts +1 -1
- package/lib/providers/exploreState/initializer/utils.js +1 -2
- package/lib/providers/exploreState/payloads/entities.d.ts +1 -0
- package/lib/providers/exploreState.js +3 -2
- package/package.json +1 -1
- package/src/components/Detail/components/DetailViewTable/detailViewTable.tsx +4 -2
- package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +6 -1
- package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +29 -6
- package/src/components/Detail/components/Table/table.tsx +6 -1
- package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +17 -1
- package/src/components/Table/common/gridTable.styles.ts +9 -1
- package/src/components/Table/common/utils.ts +9 -0
- package/src/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.styles.ts +4 -0
- package/src/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.tsx +26 -4
- package/src/components/Table/components/TableHead/tableHead.tsx +32 -21
- package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +5 -1
- package/src/components/Table/table.tsx +1 -1
- package/src/components/TableCreator/common/utils.ts +1 -0
- package/src/components/common/CustomIcon/components/AddLinkIcon/addLinkIcon.tsx +18 -0
- package/src/components/common/CustomIcon/components/UnLinkIcon/unLinkIcon.tsx +18 -0
- package/src/config/entities.ts +1 -1
- package/src/providers/exploreState/initializer/utils.ts +1 -2
- package/src/providers/exploreState/payloads/entities.ts +1 -0
- package/src/providers/exploreState.tsx +8 -2
- package/types/data-explorer-ui.d.ts +2 -0
- package/src/components/Detail/components/Table/components/TableHead/tableHead.tsx +0 -34
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { FlatPaper, FluidPaper, RoundedPaper } from "../../../common/Paper/paper.styles";
|
|
4
|
-
|
|
4
|
+
import { TableProps } from "../Table/table";
|
|
5
|
+
interface DetailViewTableProps<T extends object> extends TableProps<T> {
|
|
5
6
|
className?: string;
|
|
6
7
|
columns: ColumnDef<T>[];
|
|
7
8
|
gridTemplateColumns: string;
|
|
@@ -10,5 +11,5 @@ interface DetailViewTableProps<T extends object> {
|
|
|
10
11
|
Paper?: typeof FlatPaper | typeof FluidPaper | typeof RoundedPaper;
|
|
11
12
|
tools?: ReactNode;
|
|
12
13
|
}
|
|
13
|
-
export declare const DetailViewTable: <T extends object>({ className, columns, gridTemplateColumns, items, noResultsTitle, Paper, tools, }: DetailViewTableProps<T>) => JSX.Element;
|
|
14
|
+
export declare const DetailViewTable: <T extends object>({ className, columns, gridTemplateColumns, items, noResultsTitle, Paper, tools, ...tableProps }: DetailViewTableProps<T>) => JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -9,10 +20,11 @@ const paper_styles_1 = require("../../../common/Paper/paper.styles");
|
|
|
9
20
|
const noResults_1 = require("../../../NoResults/noResults");
|
|
10
21
|
const tableToolbar_styles_1 = require("../../../Table/components/TableToolbar/tableToolbar.styles");
|
|
11
22
|
const table_1 = require("../Table/table");
|
|
12
|
-
const DetailViewTable = (
|
|
23
|
+
const DetailViewTable = (_a) => {
|
|
24
|
+
var { className, columns, gridTemplateColumns, items, noResultsTitle, Paper = paper_styles_1.RoundedPaper, tools } = _a, tableProps = __rest(_a, ["className", "columns", "gridTemplateColumns", "items", "noResultsTitle", "Paper", "tools"]);
|
|
13
25
|
return items.length > 0 ? (react_1.default.createElement(Paper, { className: className },
|
|
14
26
|
react_1.default.createElement(paper_styles_1.GridPaper, null,
|
|
15
27
|
tools && react_1.default.createElement(tableToolbar_styles_1.Toolbar, { variant: "table" }, tools),
|
|
16
|
-
react_1.default.createElement(table_1.Table, { columns: columns, gridTemplateColumns: gridTemplateColumns, items: items })))) : (react_1.default.createElement(noResults_1.NoResults, { Paper: Paper, title: noResultsTitle }));
|
|
28
|
+
react_1.default.createElement(table_1.Table, Object.assign({ columns: columns, gridTemplateColumns: gridTemplateColumns, items: items }, tableProps))))) : (react_1.default.createElement(noResults_1.NoResults, { Paper: Paper, title: noResultsTitle }));
|
|
17
29
|
};
|
|
18
30
|
exports.DetailViewTable = DetailViewTable;
|
|
@@ -27,14 +27,17 @@ exports.CollapsableRows = void 0;
|
|
|
27
27
|
const material_1 = require("@mui/material");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const uuid_1 = require("uuid");
|
|
30
|
+
const utils_1 = require("../../../../../../../Table/common/utils");
|
|
30
31
|
const collapsableCell_1 = require("../../../../../../../Table/components/TableCell/components/CollapsableCell/collapsableCell");
|
|
31
32
|
const CollapsableRows = ({ tableInstance, }) => {
|
|
32
33
|
const { getRowModel } = tableInstance;
|
|
33
34
|
const { rows } = getRowModel();
|
|
34
35
|
const uuid = (0, uuid_1.v4)(); // Generate a unique ID for the collapsable rows.
|
|
35
36
|
return (react_1.default.createElement(react_1.Fragment, null, rows.map((row) => {
|
|
37
|
+
if (row.depth > 0)
|
|
38
|
+
return null; // Hide sub rows.
|
|
36
39
|
return (react_1.default.createElement(material_1.TableRow, { key: `${uuid}${row.id}` },
|
|
37
|
-
react_1.default.createElement(collapsableCell_1.CollapsableCell, { row: row })));
|
|
40
|
+
react_1.default.createElement(collapsableCell_1.CollapsableCell, { isDisabled: (0, utils_1.isCollapsableRowDisabled)(tableInstance), row: row })));
|
|
38
41
|
})));
|
|
39
42
|
};
|
|
40
43
|
exports.CollapsableRows = CollapsableRows;
|
|
@@ -5,4 +5,4 @@ export interface TableRowsProps<T> {
|
|
|
5
5
|
tableInstance: Table<T>;
|
|
6
6
|
tableView?: TableView;
|
|
7
7
|
}
|
|
8
|
-
export declare const TableRows: <T extends
|
|
8
|
+
export declare const TableRows: <T extends unknown>({ tableInstance, tableView, }: TableRowsProps<T>) => JSX.Element;
|
|
@@ -27,15 +27,34 @@ exports.TableRows = void 0;
|
|
|
27
27
|
const material_1 = require("@mui/material");
|
|
28
28
|
const react_table_1 = require("@tanstack/react-table");
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
|
+
const utils_1 = require("../../../../../Table/components/TableCell/common/utils");
|
|
30
31
|
const TableRows = ({ tableInstance, tableView, }) => {
|
|
31
32
|
const { getRowModel } = tableInstance;
|
|
32
33
|
const { rows } = getRowModel();
|
|
33
34
|
const { tableCell } = tableView || {};
|
|
34
35
|
const { size: tableCellSize = "medium" } = tableCell || {};
|
|
35
36
|
return (react_1.default.createElement(react_1.Fragment, null, rows.map((row) => {
|
|
36
|
-
return (react_1.default.createElement(material_1.TableRow, { key: row.id }, row.getVisibleCells().map((cell) => {
|
|
37
|
-
|
|
37
|
+
return (react_1.default.createElement(material_1.TableRow, { id: getRowId(row), key: row.id }, row.getVisibleCells().map((cell) => {
|
|
38
|
+
if (cell.getIsAggregated())
|
|
39
|
+
return null; // Display of aggregated cells is currently not supported.
|
|
40
|
+
if (cell.getIsPlaceholder())
|
|
41
|
+
return null; // Display of placeholder cells is currently not supported.
|
|
42
|
+
return (react_1.default.createElement(material_1.TableCell, { key: cell.id, padding: (0, utils_1.getTableCellPadding)(cell.column.id), size: tableCellSize }, (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext())));
|
|
38
43
|
})));
|
|
39
44
|
})));
|
|
40
45
|
};
|
|
41
46
|
exports.TableRows = TableRows;
|
|
47
|
+
/**
|
|
48
|
+
* Returns identifier for a row.
|
|
49
|
+
* @param row - Row.
|
|
50
|
+
* @returns row identifier.
|
|
51
|
+
*/
|
|
52
|
+
function getRowId(row) {
|
|
53
|
+
const { depth, getIsGrouped, id } = row;
|
|
54
|
+
if (getIsGrouped()) {
|
|
55
|
+
return `grouped-row-${id}`;
|
|
56
|
+
}
|
|
57
|
+
if (depth > 0) {
|
|
58
|
+
return `sub-row-${id}`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TableCellProps as MTableCellProps, TableContainerProps as MTableContainerProps, TableProps as MTableProps } from "@mui/material";
|
|
3
3
|
import { ColumnDef } from "@tanstack/react-table";
|
|
4
|
+
import { TableOptions } from "@tanstack/table-core";
|
|
4
5
|
export interface TableView {
|
|
5
6
|
table?: Partial<MTableProps>;
|
|
6
7
|
tableCell?: Partial<MTableCellProps>;
|
|
@@ -12,6 +13,7 @@ export interface TableProps<T extends object> {
|
|
|
12
13
|
columns: ColumnDef<T>[];
|
|
13
14
|
gridTemplateColumns: string;
|
|
14
15
|
items: T[];
|
|
16
|
+
tableOptions?: Partial<TableOptions<T>>;
|
|
15
17
|
tableView?: TableView;
|
|
16
18
|
}
|
|
17
|
-
export declare const Table: <T extends object>({ className, collapsable, columns, gridTemplateColumns, items, tableView, }: TableProps<T>) => JSX.Element;
|
|
19
|
+
export declare const Table: <T extends object>({ className, collapsable, columns, gridTemplateColumns, items, tableOptions, tableView, }: TableProps<T>) => JSX.Element;
|
|
@@ -10,21 +10,17 @@ const react_1 = __importDefault(require("react"));
|
|
|
10
10
|
const useBreakpointHelper_1 = require("../../../../hooks/useBreakpointHelper");
|
|
11
11
|
const breakpoints_1 = require("../../../../theme/common/breakpoints");
|
|
12
12
|
const entities_1 = require("../../../Table/common/entities");
|
|
13
|
+
const tableHead_1 = require("../../../Table/components/TableHead/tableHead");
|
|
13
14
|
const table_styles_1 = require("../../../Table/table.styles");
|
|
14
15
|
const utils_1 = require("./common/utils");
|
|
15
16
|
const tableBody_1 = require("./components/TableBody/tableBody");
|
|
16
|
-
const
|
|
17
|
-
const Table = ({ className, collapsable = true, columns, gridTemplateColumns, items, tableView, }) => {
|
|
17
|
+
const Table = ({ className, collapsable = true, columns, gridTemplateColumns, items, tableOptions, tableView, }) => {
|
|
18
18
|
const tabletDown = (0, useBreakpointHelper_1.useBreakpointHelper)(useBreakpointHelper_1.BREAKPOINT_FN_NAME.DOWN, breakpoints_1.TABLET);
|
|
19
19
|
const rowDirection = collapsable && tabletDown ? entities_1.ROW_DIRECTION.VERTICAL : entities_1.ROW_DIRECTION.DEFAULT;
|
|
20
20
|
const { table, tableContainer } = tableView || {};
|
|
21
21
|
const { stickyHeader = false } = table || {};
|
|
22
22
|
const { sx: tableContainerSx } = tableContainer || {};
|
|
23
|
-
const tableInstance = (0, react_table_1.useReactTable)({
|
|
24
|
-
columns: (0, utils_1.generateColumnDefinitions)(columns),
|
|
25
|
-
data: items,
|
|
26
|
-
getCoreRowModel: (0, react_table_1.getCoreRowModel)(),
|
|
27
|
-
});
|
|
23
|
+
const tableInstance = (0, react_table_1.useReactTable)(Object.assign({ columns: (0, utils_1.generateColumnDefinitions)(columns), data: items, enableSorting: false, getCoreRowModel: (0, react_table_1.getCoreRowModel)() }, tableOptions));
|
|
28
24
|
return (react_1.default.createElement(material_1.TableContainer, { className: className, sx: tableContainerSx },
|
|
29
25
|
react_1.default.createElement(table_styles_1.GridTable, { collapsable: collapsable, gridTemplateColumns: gridTemplateColumns, stickyHeader: rowDirection === entities_1.ROW_DIRECTION.DEFAULT && stickyHeader },
|
|
30
26
|
react_1.default.createElement(tableHead_1.TableHead, { rowDirection: rowDirection, tableInstance: tableInstance }),
|
|
@@ -33,6 +33,7 @@ const useExploreState_1 = require("../../../../../../hooks/useExploreState");
|
|
|
33
33
|
const exploreState_1 = require("../../../../../../providers/exploreState");
|
|
34
34
|
const entities_1 = require("../../../../common/entities");
|
|
35
35
|
const PARAM_FILTER = "filter";
|
|
36
|
+
const PARAM_SORTING = "sorting";
|
|
36
37
|
const ExploreViewLink = ({ className, label, onClick, target = entities_1.ANCHOR_TARGET.SELF, url, }) => {
|
|
37
38
|
const { exploreDispatch, exploreState } = (0, useExploreState_1.useExploreState)();
|
|
38
39
|
if (!isValidExploreURL(url, exploreState)) {
|
|
@@ -41,8 +42,9 @@ const ExploreViewLink = ({ className, label, onClick, target = entities_1.ANCHOR
|
|
|
41
42
|
const onNavigate = (0, react_1.useCallback)(() => {
|
|
42
43
|
const entityListType = getEntityListType(url.href);
|
|
43
44
|
const filters = getSelectedFilters(url.query);
|
|
45
|
+
const sorting = getSorting(url.query);
|
|
44
46
|
exploreDispatch({
|
|
45
|
-
payload: { entityListType, filters },
|
|
47
|
+
payload: { entityListType, filters, sorting },
|
|
46
48
|
type: exploreState_1.ExploreActionKind.UpdateEntityFilters,
|
|
47
49
|
});
|
|
48
50
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -68,6 +70,16 @@ function getSelectedFilters(query) {
|
|
|
68
70
|
const parsedQuery = JSON.parse(decodedQuery);
|
|
69
71
|
return parsedQuery[PARAM_FILTER];
|
|
70
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns the sorting from the given query.
|
|
75
|
+
* @param query - Query.
|
|
76
|
+
* @returns sorting.
|
|
77
|
+
*/
|
|
78
|
+
function getSorting(query) {
|
|
79
|
+
const decodedQuery = decodeURIComponent(query);
|
|
80
|
+
const parsedQuery = JSON.parse(decodedQuery);
|
|
81
|
+
return parsedQuery[PARAM_SORTING];
|
|
82
|
+
}
|
|
71
83
|
/**
|
|
72
84
|
* Returns true if the given value is a SelectedFilter.
|
|
73
85
|
* @param value - Value.
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.GridTable = void 0;
|
|
7
7
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
8
|
const material_1 = require("@mui/material");
|
|
9
|
+
const colors_1 = require("../../../styles/common/mixins/colors");
|
|
9
10
|
exports.GridTable = (0, styled_1.default)(material_1.Table, {
|
|
10
11
|
shouldForwardProp: (prop) => prop !== "gridTemplateColumns",
|
|
11
12
|
}) `
|
|
@@ -22,7 +23,7 @@ exports.GridTable = (0, styled_1.default)(material_1.Table, {
|
|
|
22
23
|
|
|
23
24
|
td,
|
|
24
25
|
th {
|
|
25
|
-
background-color: ${
|
|
26
|
+
background-color: ${colors_1.white};
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
td,
|
|
@@ -36,4 +37,11 @@ exports.GridTable = (0, styled_1.default)(material_1.Table, {
|
|
|
36
37
|
min-width: 0; /* required; flexbox child min-width property is "auto" by default making overflow-wrap ineffectual */
|
|
37
38
|
}
|
|
38
39
|
}
|
|
40
|
+
|
|
41
|
+
[id^="grouped-row"] {
|
|
42
|
+
td {
|
|
43
|
+
background-color: ${colors_1.smokeLightest};
|
|
44
|
+
grid-column: 1 / -1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
`;
|
|
@@ -103,6 +103,12 @@ export declare function isAnyRowSelected<T>(table: Table<T>): boolean;
|
|
|
103
103
|
* @returns true if client-side filtering is enabled.
|
|
104
104
|
*/
|
|
105
105
|
export declare function isClientFilteringEnabled(exploreMode: ExploreMode): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Returns true if the collapsable row is disabled; i.e. only one column is visible.
|
|
108
|
+
* @param tableInstance - Table instance.
|
|
109
|
+
* @returns true if the collapsable row is disabled.
|
|
110
|
+
*/
|
|
111
|
+
export declare function isCollapsableRowDisabled<T>(tableInstance: Table<T>): boolean;
|
|
106
112
|
/**
|
|
107
113
|
* Returns true if column has a sort direction.
|
|
108
114
|
* @param sortDirection - Column sort direction.
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getInitialTableColumnVisibility = exports.sortingFn = exports.isColumnSortActive = exports.isClientFilteringEnabled = exports.isAnyRowSelected = exports.getTableSortLabelProps = exports.getPinnedCellIndex = exports.getInitialTableStateSorting = exports.getInitialState = exports.getGridTemplateColumns = exports.getFacetedUniqueValuesWithArrayValues = exports.getEditColumnOptions = exports.generateDownloadBlob = exports.getColumnSortDirection = exports.buildCategoryViews = exports.arrIncludesSome = void 0;
|
|
6
|
+
exports.getInitialTableColumnVisibility = exports.sortingFn = exports.isColumnSortActive = exports.isCollapsableRowDisabled = exports.isClientFilteringEnabled = exports.isAnyRowSelected = exports.getTableSortLabelProps = exports.getPinnedCellIndex = exports.getInitialTableStateSorting = exports.getInitialState = exports.getGridTemplateColumns = exports.getFacetedUniqueValuesWithArrayValues = exports.getEditColumnOptions = exports.generateDownloadBlob = exports.getColumnSortDirection = exports.buildCategoryViews = exports.arrIncludesSome = void 0;
|
|
7
7
|
const SouthRounded_1 = __importDefault(require("@mui/icons-material/SouthRounded"));
|
|
8
8
|
const react_table_1 = require("@tanstack/react-table");
|
|
9
9
|
const useExploreMode_1 = require("../../../hooks/useExploreMode");
|
|
@@ -283,6 +283,15 @@ function isClientFilteringEnabled(exploreMode) {
|
|
|
283
283
|
exploreMode === useExploreMode_1.EXPLORE_MODE.SS_FETCH_CS_FILTERING);
|
|
284
284
|
}
|
|
285
285
|
exports.isClientFilteringEnabled = isClientFilteringEnabled;
|
|
286
|
+
/**
|
|
287
|
+
* Returns true if the collapsable row is disabled; i.e. only one column is visible.
|
|
288
|
+
* @param tableInstance - Table instance.
|
|
289
|
+
* @returns true if the collapsable row is disabled.
|
|
290
|
+
*/
|
|
291
|
+
function isCollapsableRowDisabled(tableInstance) {
|
|
292
|
+
return tableInstance.getVisibleLeafColumns().length === 1;
|
|
293
|
+
}
|
|
294
|
+
exports.isCollapsableRowDisabled = isCollapsableRowDisabled;
|
|
286
295
|
/**
|
|
287
296
|
* Returns true if column has a sort direction.
|
|
288
297
|
* @param sortDirection - Column sort direction.
|
package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Row } from "@tanstack/react-table";
|
|
3
|
-
export interface CollapsableCellProps<T> {
|
|
2
|
+
import { Row, RowData } from "@tanstack/react-table";
|
|
3
|
+
export interface CollapsableCellProps<T extends RowData> {
|
|
4
|
+
isDisabled?: boolean;
|
|
4
5
|
row: Row<T>;
|
|
5
6
|
}
|
|
6
|
-
export declare const CollapsableCell: <T extends
|
|
7
|
+
export declare const CollapsableCell: <T extends unknown>({ isDisabled, row, }: CollapsableCellProps<T>) => JSX.Element;
|
package/lib/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.js
CHANGED
|
@@ -31,7 +31,7 @@ const typography_1 = require("../../../../../../theme/common/typography");
|
|
|
31
31
|
const unfoldMoreIcon_1 = require("../../../../../common/CustomIcon/components/UnfoldMoreIcon/unfoldMoreIcon");
|
|
32
32
|
const utils_1 = require("../../../../common/utils");
|
|
33
33
|
const collapsableCell_styles_1 = require("./collapsableCell.styles");
|
|
34
|
-
const CollapsableCell = ({ row, }) => {
|
|
34
|
+
const CollapsableCell = ({ isDisabled = false, row, }) => {
|
|
35
35
|
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
36
36
|
const [pinnedCell, pinnedIndex] = (0, utils_1.getPinnedCellIndex)(row);
|
|
37
37
|
// Toggles open/close table cell.
|
|
@@ -41,11 +41,15 @@ const CollapsableCell = ({ row, }) => {
|
|
|
41
41
|
return (react_1.default.createElement(collapsableCell_styles_1.TableCell, { isExpanded: isExpanded },
|
|
42
42
|
react_1.default.createElement(collapsableCell_styles_1.PinnedCell, null,
|
|
43
43
|
(0, react_table_1.flexRender)(pinnedCell.column.columnDef.cell, pinnedCell.getContext()),
|
|
44
|
-
react_1.default.createElement(material_1.IconButton, { color: "ink", edge: "end", onClick: onToggleExpanded, size: "large" },
|
|
44
|
+
react_1.default.createElement(material_1.IconButton, { color: "ink", disabled: isDisabled, edge: "end", onClick: onToggleExpanded, size: "large" },
|
|
45
45
|
react_1.default.createElement(unfoldMoreIcon_1.UnfoldMoreIcon, { fontSize: "small" }))),
|
|
46
46
|
react_1.default.createElement(material_1.Collapse, { in: isExpanded },
|
|
47
|
-
react_1.default.createElement(collapsableCell_styles_1.CollapsedContents, null, row
|
|
47
|
+
react_1.default.createElement(collapsableCell_styles_1.CollapsedContents, null, getRowVisibleCells(row).map((cell, i) => {
|
|
48
48
|
var _a;
|
|
49
|
+
if (cell.getIsAggregated())
|
|
50
|
+
return null; // Display of aggregated cells is currently not supported.
|
|
51
|
+
if (cell.getIsPlaceholder())
|
|
52
|
+
return null; // Display of placeholder cells is currently not supported.
|
|
49
53
|
const header = (_a = cell.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.header;
|
|
50
54
|
return (i !== pinnedIndex && (react_1.default.createElement(collapsableCell_styles_1.Content, { key: cell.id },
|
|
51
55
|
header && (react_1.default.createElement(material_1.Typography, { component: "div", color: "ink.light", variant: typography_1.TEXT_BODY_400_2_LINES }, header)),
|
|
@@ -53,3 +57,17 @@ const CollapsableCell = ({ row, }) => {
|
|
|
53
57
|
})))));
|
|
54
58
|
};
|
|
55
59
|
exports.CollapsableCell = CollapsableCell;
|
|
60
|
+
/**
|
|
61
|
+
* Returns row or sub row visible cells.
|
|
62
|
+
* @param row - Row.
|
|
63
|
+
* @returns row or sub row visible cells.
|
|
64
|
+
*/
|
|
65
|
+
function getRowVisibleCells(row) {
|
|
66
|
+
if (row.getIsGrouped()) {
|
|
67
|
+
return row
|
|
68
|
+
.getLeafRows()
|
|
69
|
+
.map((leafRow) => leafRow.getVisibleCells())
|
|
70
|
+
.flat();
|
|
71
|
+
}
|
|
72
|
+
return row.getVisibleCells();
|
|
73
|
+
}
|
|
@@ -48,6 +48,10 @@ exports.PinnedCell = styled_1.default.div `
|
|
|
48
48
|
justify-content: space-between;
|
|
49
49
|
padding: 12px 16px;
|
|
50
50
|
word-break: break-word;
|
|
51
|
+
|
|
52
|
+
.MuiIconButton-root.Mui-disabled {
|
|
53
|
+
opacity: 0.5;
|
|
54
|
+
}
|
|
51
55
|
`;
|
|
52
56
|
exports.CollapsedContents = styled_1.default.div `
|
|
53
57
|
${fonts_1.textBody4002Lines};
|
|
@@ -33,6 +33,9 @@ const utils_2 = require("../TableCell/common/utils");
|
|
|
33
33
|
const TableHead = ({ rowDirection, tableInstance, }) => {
|
|
34
34
|
return (react_1.default.createElement(react_1.Fragment, null, rowDirection === entities_1.ROW_DIRECTION.DEFAULT &&
|
|
35
35
|
tableInstance.getHeaderGroups().map((headerGroup) => (react_1.default.createElement(material_1.TableHead, { key: headerGroup.id },
|
|
36
|
-
react_1.default.createElement(material_1.TableRow, null, headerGroup.headers.map((header) =>
|
|
36
|
+
react_1.default.createElement(material_1.TableRow, null, headerGroup.headers.map((header) => {
|
|
37
|
+
const { column: { columnDef: { meta: { enableSortingInteraction = true } = {}, }, }, } = header;
|
|
38
|
+
return header.column.getIsGrouped() ? null : (react_1.default.createElement(material_1.TableCell, { key: header.id, padding: (0, utils_2.getTableCellPadding)(header.id) }, header.column.getCanSort() && enableSortingInteraction ? (react_1.default.createElement(material_1.TableSortLabel, Object.assign({}, (0, utils_1.getTableSortLabelProps)(header.column)), (0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()))) : ((0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()))));
|
|
39
|
+
})))))));
|
|
37
40
|
};
|
|
38
41
|
exports.TableHead = TableHead;
|
package/lib/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js
CHANGED
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.CollapsableRows = void 0;
|
|
27
27
|
const material_1 = require("@mui/material");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
|
+
const utils_1 = require("../../../../common/utils");
|
|
29
30
|
const collapsableCell_1 = require("../../../TableCell/components/CollapsableCell/collapsableCell");
|
|
30
31
|
const CollapsableRows = ({ tableInstance, virtualizer, }) => {
|
|
31
32
|
const { getRowModel } = tableInstance;
|
|
@@ -34,7 +35,7 @@ const CollapsableRows = ({ tableInstance, virtualizer, }) => {
|
|
|
34
35
|
return (react_1.default.createElement(react_1.Fragment, null, virtualItems.map((virtualRow) => {
|
|
35
36
|
const row = rows[virtualRow.index];
|
|
36
37
|
return (react_1.default.createElement(material_1.TableRow, { key: row.id, "data-index": virtualRow.index, ref: virtualizer.measureElement },
|
|
37
|
-
react_1.default.createElement(collapsableCell_1.CollapsableCell, { row: row })));
|
|
38
|
+
react_1.default.createElement(collapsableCell_1.CollapsableCell, { isDisabled: (0, utils_1.isCollapsableRowDisabled)(tableInstance), row: row })));
|
|
38
39
|
})));
|
|
39
40
|
};
|
|
40
41
|
exports.CollapsableRows = CollapsableRows;
|
|
@@ -110,7 +110,7 @@ const TableComponent = ({ columns, getRowId, initialState, items, listView, tota
|
|
|
110
110
|
data: items,
|
|
111
111
|
enableColumnFilters: true,
|
|
112
112
|
enableFilters: true,
|
|
113
|
-
enableMultiSort:
|
|
113
|
+
enableMultiSort: clientFiltering,
|
|
114
114
|
enableRowSelection,
|
|
115
115
|
enableSorting: true,
|
|
116
116
|
enableSortingRemoval: false,
|
|
@@ -14,11 +14,7 @@ function buildBaseColumnDef(baseColumnConfig) {
|
|
|
14
14
|
enableSorting: !disableSorting,
|
|
15
15
|
header,
|
|
16
16
|
id,
|
|
17
|
-
meta: {
|
|
18
|
-
columnPinned,
|
|
19
|
-
header: meta ? meta.header : header,
|
|
20
|
-
width,
|
|
21
|
-
},
|
|
17
|
+
meta: Object.assign(Object.assign({}, meta), { columnPinned, header: meta ? meta.header : header, width }),
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
exports.buildBaseColumnDef = buildBaseColumnDef;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AddLinkIcon = void 0;
|
|
18
|
+
const material_1 = require("@mui/material");
|
|
19
|
+
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const AddLinkIcon = (_a) => {
|
|
21
|
+
var { fontSize = "xsmall", viewBox = "0 0 18 18" } = _a, props = __rest(_a, ["fontSize", "viewBox"]) /* Spread props to allow for Mui SvgIconProps specific prop overrides e.g. "htmlColor". */;
|
|
22
|
+
return (react_1.default.createElement(material_1.SvgIcon, Object.assign({ fontSize: fontSize, viewBox: viewBox }, props),
|
|
23
|
+
react_1.default.createElement("path", { d: "M12.8248 12.6004H11.4561C11.2811 12.6004 11.1279 12.5357 10.9967 12.4063C10.8654 12.277 10.7998 12.1166 10.7998 11.9254C10.7998 11.7504 10.8645 11.5941 10.9939 11.4566C11.1232 11.3191 11.2836 11.2504 11.4748 11.2504H12.8248V9.90039C12.8248 9.70914 12.8891 9.54883 13.0177 9.41945C13.1464 9.29008 13.3057 9.22539 13.4959 9.22539C13.686 9.22539 13.8459 9.29008 13.9755 9.41945C14.1052 9.54883 14.1701 9.70914 14.1701 9.90039V11.2504H15.5233C15.7149 11.2504 15.8756 11.3151 16.0054 11.4445C16.135 11.5738 16.1998 11.7341 16.1998 11.9254C16.1998 12.1166 16.135 12.277 16.0054 12.4063C15.8756 12.5357 15.7149 12.6004 15.5233 12.6004H14.1701V13.9504C14.1701 14.1416 14.1052 14.302 13.9755 14.4313C13.8459 14.5607 13.686 14.6254 13.4959 14.6254C13.3057 14.6254 13.1464 14.5607 13.0177 14.4313C12.8891 14.302 12.8248 14.1416 12.8248 13.9504V12.6004ZM7.4248 12.6004H5.3998C4.4038 12.6004 3.5548 12.249 2.8528 11.5461C2.1508 10.8433 1.7998 9.99333 1.7998 8.99608C1.7998 7.99895 2.1508 7.15039 2.8528 6.45039C3.5548 5.75039 4.4038 5.40039 5.3998 5.40039H7.4248C7.5998 5.40039 7.75605 5.46914 7.89355 5.60664C8.03105 5.74414 8.0998 5.90352 8.0998 6.08477C8.0998 6.26602 8.03105 6.42227 7.89355 6.55352C7.75605 6.68477 7.5998 6.75039 7.4248 6.75039H5.3998C4.7748 6.75039 4.24355 6.96914 3.80605 7.40664C3.36855 7.84414 3.1498 8.37539 3.1498 9.00039C3.1498 9.62539 3.36855 10.1566 3.80605 10.5941C4.24355 11.0316 4.7748 11.2504 5.3998 11.2504H7.4248C7.5998 11.2504 7.75605 11.3191 7.89355 11.4566C8.03105 11.5941 8.0998 11.7535 8.0998 11.9348C8.0998 12.116 8.03105 12.2723 7.89355 12.4035C7.75605 12.5348 7.5998 12.6004 7.4248 12.6004ZM6.98005 9.67539C6.78905 9.67539 6.62793 9.61108 6.49668 9.48245C6.36543 9.35383 6.2998 9.19445 6.2998 9.00433C6.2998 8.8142 6.36443 8.65352 6.49368 8.52227C6.62293 8.39102 6.78305 8.32539 6.97405 8.32539H11.0196C11.2106 8.32539 11.3717 8.3897 11.5029 8.51833C11.6342 8.64695 11.6998 8.80633 11.6998 8.99645C11.6998 9.18658 11.6352 9.34727 11.5059 9.47852C11.3767 9.60977 11.2166 9.67539 11.0256 9.67539H6.98005ZM16.1998 9.00039H14.8498C14.8498 8.37539 14.6311 7.84414 14.1936 7.40664C13.7561 6.96914 13.2248 6.75039 12.5998 6.75039H10.5561C10.3811 6.75039 10.2279 6.6857 10.0967 6.55633C9.96543 6.42695 9.8998 6.26664 9.8998 6.07539C9.8998 5.90039 9.96449 5.74414 10.0939 5.60664C10.2232 5.46914 10.3836 5.40039 10.5748 5.40039H12.5998C13.5958 5.40039 14.4448 5.75139 15.1468 6.45339C15.8488 7.15539 16.1998 8.00439 16.1998 9.00039Z", fill: "currentColor" })));
|
|
24
|
+
};
|
|
25
|
+
exports.AddLinkIcon = AddLinkIcon;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.UnLinkIcon = void 0;
|
|
18
|
+
const material_1 = require("@mui/material");
|
|
19
|
+
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const UnLinkIcon = (_a) => {
|
|
21
|
+
var { fontSize = "xsmall", viewBox = "0 0 18 18" } = _a, props = __rest(_a, ["fontSize", "viewBox"]) /* Spread props to allow for Mui SvgIconProps specific prop overrides e.g. "htmlColor". */;
|
|
22
|
+
return (react_1.default.createElement(material_1.SvgIcon, Object.assign({ fontSize: fontSize, viewBox: viewBox }, props),
|
|
23
|
+
react_1.default.createElement("path", { d: "M11.4561 9.52501L10.2373 8.325H11.0196C11.2123 8.325 11.3738 8.38968 11.5042 8.51905C11.6346 8.64843 11.6998 8.80875 11.6998 9C11.6998 9.11245 11.6748 9.21253 11.6248 9.30001C11.5748 9.38749 11.5123 9.46246 11.4373 9.52501H11.4561ZM14.8873 15.825C14.7498 15.9625 14.5904 16.0312 14.4092 16.0312C14.2279 16.0312 14.0685 15.9625 13.9311 15.825L2.15605 4.06874C2.01856 3.93124 1.94981 3.77187 1.94981 3.59062C1.94981 3.40937 2.01856 3.25 2.15605 3.11249C2.29355 2.97499 2.45293 2.90625 2.63418 2.90625C2.81543 2.90625 2.97481 2.97499 3.1123 3.11249L14.8873 14.8875C15.0248 15.025 15.0935 15.1812 15.0935 15.3562C15.0935 15.5313 15.0248 15.6875 14.8873 15.825ZM5.3998 12.6C4.4038 12.6 3.5548 12.249 2.8528 11.547C2.1508 10.845 1.7998 9.99598 1.7998 9C1.7998 8.20087 2.03731 7.48855 2.51231 6.86305C2.9873 6.23768 3.6623 5.74374 4.53731 5.38125L5.8498 6.75H5.41855C4.78105 6.75 4.24356 6.96874 3.80606 7.40625C3.36856 7.84375 3.1498 8.37499 3.1498 9C3.1498 9.625 3.36856 10.1563 3.80606 10.5938C4.24356 11.0313 4.77481 11.25 5.3998 11.25H7.4248C7.61605 11.25 7.77636 11.3143 7.90575 11.4429C8.03512 11.5715 8.0998 11.7309 8.0998 11.9211C8.0998 12.1112 8.03512 12.2719 7.90575 12.4031C7.77636 12.5343 7.61605 12.6 7.4248 12.6H5.3998ZM6.97274 9.67495C6.78661 9.67495 6.62793 9.61069 6.49668 9.48208C6.36543 9.35347 6.2998 9.19408 6.2998 9.00391C6.2998 8.81381 6.3645 8.65312 6.49387 8.52187C6.62325 8.39062 6.78355 8.325 6.9748 8.325H7.34981L8.68105 9.67495H6.97274ZM13.6686 11.775C13.5686 11.625 13.5342 11.4594 13.5654 11.2781C13.5966 11.0969 13.6873 10.9563 13.8373 10.8562C14.1498 10.6437 14.3967 10.375 14.5779 10.05C14.7592 9.72499 14.8498 9.37498 14.8498 9C14.8498 8.37499 14.631 7.84375 14.1935 7.40625C13.756 6.96874 13.2248 6.75 12.5998 6.75H10.5748C10.3836 6.75 10.2233 6.68568 10.0938 6.55705C9.96451 6.42844 9.8998 6.26905 9.8998 6.07893C9.8998 5.8888 9.96451 5.72812 10.0938 5.59687C10.2233 5.46563 10.3836 5.4 10.5748 5.4H12.5998C13.5958 5.4 14.4448 5.751 15.1468 6.453C15.8488 7.155 16.1998 8.00399 16.1998 9C16.1998 9.6034 16.0561 10.1667 15.7685 10.69C15.4811 11.2133 15.0873 11.6375 14.5873 11.9625C14.4373 12.0625 14.2716 12.0937 14.0904 12.0563C13.9092 12.0187 13.7685 11.925 13.6686 11.775Z", fill: "currentColor" })));
|
|
24
|
+
};
|
|
25
|
+
exports.UnLinkIcon = UnLinkIcon;
|
package/lib/config/entities.d.ts
CHANGED
|
@@ -250,7 +250,7 @@ export interface Override {
|
|
|
250
250
|
declare type RelatedSearchFunction = (searchKey: CategoryKey | undefined, resultKey: CategoryKey | undefined, selectedCategoryValues: SelectedFilterValue | undefined) => Promise<RelatedSearchResult | undefined>;
|
|
251
251
|
export interface SavedFilter {
|
|
252
252
|
filters: SelectedFilter[];
|
|
253
|
-
|
|
253
|
+
sorting?: ColumnSort[];
|
|
254
254
|
title: string;
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
@@ -48,8 +48,7 @@ function buildSavedFilterByCategoryValueKey(savedFilters) {
|
|
|
48
48
|
if (!savedFilters)
|
|
49
49
|
return;
|
|
50
50
|
const savedFilterByCategoryValueKey = new Map();
|
|
51
|
-
for (const { filters,
|
|
52
|
-
const sorting = sort ? [sort] : undefined;
|
|
51
|
+
for (const { filters, sorting, title } of savedFilters) {
|
|
53
52
|
savedFilterByCategoryValueKey.set(title, { filters, sorting, title });
|
|
54
53
|
}
|
|
55
54
|
return savedFilterByCategoryValueKey;
|
|
@@ -229,13 +229,14 @@ function exploreReducer(state, action, exploreContext) {
|
|
|
229
229
|
* Update entity filters.
|
|
230
230
|
*/
|
|
231
231
|
case ExploreActionKind.UpdateEntityFilters: {
|
|
232
|
-
const { entityListType, filters: filterState } = payload;
|
|
232
|
+
const { entityListType, filters: filterState, sorting } = payload;
|
|
233
233
|
const categoryGroupConfigKey = (0, utils_2.getEntityCategoryGroupConfigKey)(entityListType, state.entityPageState);
|
|
234
234
|
(0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
|
|
235
235
|
filterState,
|
|
236
236
|
savedFilterState: [], // Clear saved filter state.
|
|
237
237
|
}, categoryGroupConfigKey);
|
|
238
|
-
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.resetRowSelection)(state, categoryGroupConfigKey) }
|
|
238
|
+
return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(entityListType, Object.assign({}, (0, utils_2.resetRowSelection)(state, categoryGroupConfigKey)), { sorting } // Update sorting for the entity.
|
|
239
|
+
) });
|
|
239
240
|
}
|
|
240
241
|
/**
|
|
241
242
|
* Update entity view access
|
package/package.json
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "../../../common/Paper/paper.styles";
|
|
9
9
|
import { NoResults } from "../../../NoResults/noResults";
|
|
10
10
|
import { Toolbar } from "../../../Table/components/TableToolbar/tableToolbar.styles";
|
|
11
|
-
import { Table } from "../Table/table";
|
|
11
|
+
import { Table, TableProps } from "../Table/table";
|
|
12
12
|
|
|
13
|
-
interface DetailViewTableProps<T extends object> {
|
|
13
|
+
interface DetailViewTableProps<T extends object> extends TableProps<T> {
|
|
14
14
|
className?: string;
|
|
15
15
|
columns: ColumnDef<T>[];
|
|
16
16
|
gridTemplateColumns: string;
|
|
@@ -28,6 +28,7 @@ export const DetailViewTable = <T extends object>({
|
|
|
28
28
|
noResultsTitle,
|
|
29
29
|
Paper = RoundedPaper,
|
|
30
30
|
tools,
|
|
31
|
+
...tableProps
|
|
31
32
|
}: DetailViewTableProps<T>): JSX.Element => {
|
|
32
33
|
return items.length > 0 ? (
|
|
33
34
|
<Paper className={className}>
|
|
@@ -37,6 +38,7 @@ export const DetailViewTable = <T extends object>({
|
|
|
37
38
|
columns={columns}
|
|
38
39
|
gridTemplateColumns={gridTemplateColumns}
|
|
39
40
|
items={items}
|
|
41
|
+
{...tableProps}
|
|
40
42
|
/>
|
|
41
43
|
</GridPaper>
|
|
42
44
|
</Paper>
|
|
@@ -2,6 +2,7 @@ import { TableRow } from "@mui/material";
|
|
|
2
2
|
import { Table } from "@tanstack/react-table";
|
|
3
3
|
import React, { Fragment } from "react";
|
|
4
4
|
import { v4 as uuid4 } from "uuid";
|
|
5
|
+
import { isCollapsableRowDisabled } from "../../../../../../../Table/common/utils";
|
|
5
6
|
import { CollapsableCell } from "../../../../../../../Table/components/TableCell/components/CollapsableCell/collapsableCell";
|
|
6
7
|
|
|
7
8
|
export interface CollapsableRowsProps<T> {
|
|
@@ -17,9 +18,13 @@ export const CollapsableRows = <T extends object>({
|
|
|
17
18
|
return (
|
|
18
19
|
<Fragment>
|
|
19
20
|
{rows.map((row) => {
|
|
21
|
+
if (row.depth > 0) return null; // Hide sub rows.
|
|
20
22
|
return (
|
|
21
23
|
<TableRow key={`${uuid}${row.id}`}>
|
|
22
|
-
<CollapsableCell
|
|
24
|
+
<CollapsableCell
|
|
25
|
+
isDisabled={isCollapsableRowDisabled(tableInstance)}
|
|
26
|
+
row={row}
|
|
27
|
+
/>
|
|
23
28
|
</TableRow>
|
|
24
29
|
);
|
|
25
30
|
})}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { TableCell, TableRow as MTableRow } from "@mui/material";
|
|
2
|
-
import { flexRender, Table } from "@tanstack/react-table";
|
|
1
|
+
import { TableCell as MTableCell, TableRow as MTableRow } from "@mui/material";
|
|
2
|
+
import { flexRender, Row, Table } from "@tanstack/react-table";
|
|
3
|
+
import { RowData } from "@tanstack/table-core";
|
|
3
4
|
import React, { Fragment } from "react";
|
|
5
|
+
import { getTableCellPadding } from "../../../../../Table/components/TableCell/common/utils";
|
|
4
6
|
import { TableView } from "../../table";
|
|
5
7
|
|
|
6
8
|
export interface TableRowsProps<T> {
|
|
@@ -8,7 +10,7 @@ export interface TableRowsProps<T> {
|
|
|
8
10
|
tableView?: TableView;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export const TableRows = <T extends
|
|
13
|
+
export const TableRows = <T extends RowData>({
|
|
12
14
|
tableInstance,
|
|
13
15
|
tableView,
|
|
14
16
|
}: TableRowsProps<T>): JSX.Element => {
|
|
@@ -20,12 +22,18 @@ export const TableRows = <T extends object>({
|
|
|
20
22
|
<Fragment>
|
|
21
23
|
{rows.map((row) => {
|
|
22
24
|
return (
|
|
23
|
-
<MTableRow key={row.id}>
|
|
25
|
+
<MTableRow id={getRowId(row)} key={row.id}>
|
|
24
26
|
{row.getVisibleCells().map((cell) => {
|
|
27
|
+
if (cell.getIsAggregated()) return null; // Display of aggregated cells is currently not supported.
|
|
28
|
+
if (cell.getIsPlaceholder()) return null; // Display of placeholder cells is currently not supported.
|
|
25
29
|
return (
|
|
26
|
-
<
|
|
30
|
+
<MTableCell
|
|
31
|
+
key={cell.id}
|
|
32
|
+
padding={getTableCellPadding(cell.column.id)}
|
|
33
|
+
size={tableCellSize}
|
|
34
|
+
>
|
|
27
35
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
28
|
-
</
|
|
36
|
+
</MTableCell>
|
|
29
37
|
);
|
|
30
38
|
})}
|
|
31
39
|
</MTableRow>
|
|
@@ -34,3 +42,18 @@ export const TableRows = <T extends object>({
|
|
|
34
42
|
</Fragment>
|
|
35
43
|
);
|
|
36
44
|
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Returns identifier for a row.
|
|
48
|
+
* @param row - Row.
|
|
49
|
+
* @returns row identifier.
|
|
50
|
+
*/
|
|
51
|
+
function getRowId<T extends RowData>(row: Row<T>): string | undefined {
|
|
52
|
+
const { depth, getIsGrouped, id } = row;
|
|
53
|
+
if (getIsGrouped()) {
|
|
54
|
+
return `grouped-row-${id}`;
|
|
55
|
+
}
|
|
56
|
+
if (depth > 0) {
|
|
57
|
+
return `sub-row-${id}`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getCoreRowModel,
|
|
10
10
|
useReactTable,
|
|
11
11
|
} from "@tanstack/react-table";
|
|
12
|
+
import { TableOptions } from "@tanstack/table-core";
|
|
12
13
|
import React from "react";
|
|
13
14
|
import {
|
|
14
15
|
BREAKPOINT_FN_NAME,
|
|
@@ -16,10 +17,10 @@ import {
|
|
|
16
17
|
} from "../../../../hooks/useBreakpointHelper";
|
|
17
18
|
import { TABLET } from "../../../../theme/common/breakpoints";
|
|
18
19
|
import { ROW_DIRECTION } from "../../../Table/common/entities";
|
|
20
|
+
import { TableHead } from "../../../Table/components/TableHead/tableHead";
|
|
19
21
|
import { GridTable } from "../../../Table/table.styles";
|
|
20
22
|
import { generateColumnDefinitions } from "./common/utils";
|
|
21
23
|
import { TableBody } from "./components/TableBody/tableBody";
|
|
22
|
-
import { TableHead } from "./components/TableHead/tableHead";
|
|
23
24
|
|
|
24
25
|
export interface TableView {
|
|
25
26
|
table?: Partial<MTableProps>;
|
|
@@ -33,6 +34,7 @@ export interface TableProps<T extends object> {
|
|
|
33
34
|
columns: ColumnDef<T>[];
|
|
34
35
|
gridTemplateColumns: string;
|
|
35
36
|
items: T[];
|
|
37
|
+
tableOptions?: Partial<TableOptions<T>>;
|
|
36
38
|
tableView?: TableView;
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -42,6 +44,7 @@ export const Table = <T extends object>({
|
|
|
42
44
|
columns,
|
|
43
45
|
gridTemplateColumns,
|
|
44
46
|
items,
|
|
47
|
+
tableOptions,
|
|
45
48
|
tableView,
|
|
46
49
|
}: TableProps<T>): JSX.Element => {
|
|
47
50
|
const tabletDown = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, TABLET);
|
|
@@ -53,7 +56,9 @@ export const Table = <T extends object>({
|
|
|
53
56
|
const tableInstance = useReactTable({
|
|
54
57
|
columns: generateColumnDefinitions(columns),
|
|
55
58
|
data: items,
|
|
59
|
+
enableSorting: false,
|
|
56
60
|
getCoreRowModel: getCoreRowModel(),
|
|
61
|
+
...tableOptions,
|
|
57
62
|
});
|
|
58
63
|
return (
|
|
59
64
|
<TableContainer className={className} sx={tableContainerSx}>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ColumnSort } from "@tanstack/react-table";
|
|
1
2
|
import Link from "next/link";
|
|
2
3
|
import React, { useCallback } from "react";
|
|
3
4
|
import { UrlObject } from "url";
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
import { LinkProps } from "../../link";
|
|
15
16
|
|
|
16
17
|
const PARAM_FILTER = "filter";
|
|
18
|
+
const PARAM_SORTING = "sorting";
|
|
17
19
|
|
|
18
20
|
export interface ExploreViewLinkProps
|
|
19
21
|
extends Omit<LinkProps, "copyable" | "noWrap" | "url"> {
|
|
@@ -36,8 +38,9 @@ export const ExploreViewLink = ({
|
|
|
36
38
|
const onNavigate = useCallback(() => {
|
|
37
39
|
const entityListType = getEntityListType(url.href);
|
|
38
40
|
const filters = getSelectedFilters(url.query);
|
|
41
|
+
const sorting = getSorting(url.query);
|
|
39
42
|
exploreDispatch({
|
|
40
|
-
payload: { entityListType, filters },
|
|
43
|
+
payload: { entityListType, filters, sorting },
|
|
41
44
|
type: ExploreActionKind.UpdateEntityFilters,
|
|
42
45
|
});
|
|
43
46
|
onClick?.();
|
|
@@ -78,6 +81,19 @@ function getSelectedFilters(
|
|
|
78
81
|
return parsedQuery[PARAM_FILTER];
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Returns the sorting from the given query.
|
|
86
|
+
* @param query - Query.
|
|
87
|
+
* @returns sorting.
|
|
88
|
+
*/
|
|
89
|
+
function getSorting(
|
|
90
|
+
query: UrlObjectWithHrefAndQuery["query"]
|
|
91
|
+
): ColumnSort[] | undefined {
|
|
92
|
+
const decodedQuery = decodeURIComponent(query);
|
|
93
|
+
const parsedQuery = JSON.parse(decodedQuery);
|
|
94
|
+
return parsedQuery[PARAM_SORTING];
|
|
95
|
+
}
|
|
96
|
+
|
|
81
97
|
/**
|
|
82
98
|
* Returns true if the given value is a SelectedFilter.
|
|
83
99
|
* @param value - Value.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
2
|
import { Table as MTable } from "@mui/material";
|
|
3
|
+
import { smokeLightest, white } from "../../../styles/common/mixins/colors";
|
|
3
4
|
|
|
4
5
|
export interface GridTableProps {
|
|
5
6
|
gridTemplateColumns: string;
|
|
@@ -21,7 +22,7 @@ export const GridTable = styled(MTable, {
|
|
|
21
22
|
|
|
22
23
|
td,
|
|
23
24
|
th {
|
|
24
|
-
background-color: ${
|
|
25
|
+
background-color: ${white};
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
td,
|
|
@@ -35,4 +36,11 @@ export const GridTable = styled(MTable, {
|
|
|
35
36
|
min-width: 0; /* required; flexbox child min-width property is "auto" by default making overflow-wrap ineffectual */
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
|
|
40
|
+
[id^="grouped-row"] {
|
|
41
|
+
td {
|
|
42
|
+
background-color: ${smokeLightest};
|
|
43
|
+
grid-column: 1 / -1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
38
46
|
`;
|
|
@@ -363,6 +363,15 @@ export function isClientFilteringEnabled(exploreMode: ExploreMode): boolean {
|
|
|
363
363
|
);
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
+
/**
|
|
367
|
+
* Returns true if the collapsable row is disabled; i.e. only one column is visible.
|
|
368
|
+
* @param tableInstance - Table instance.
|
|
369
|
+
* @returns true if the collapsable row is disabled.
|
|
370
|
+
*/
|
|
371
|
+
export function isCollapsableRowDisabled<T>(tableInstance: Table<T>): boolean {
|
|
372
|
+
return tableInstance.getVisibleLeafColumns().length === 1;
|
|
373
|
+
}
|
|
374
|
+
|
|
366
375
|
/**
|
|
367
376
|
* Returns true if column has a sort direction.
|
|
368
377
|
* @param sortDirection - Column sort direction.
|
package/src/components/Table/components/TableCell/components/CollapsableCell/collapsableCell.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Collapse, IconButton, Typography } from "@mui/material";
|
|
2
|
-
import { flexRender, Row } from "@tanstack/react-table";
|
|
2
|
+
import { Cell, flexRender, Row, RowData } from "@tanstack/react-table";
|
|
3
3
|
import React, { useState } from "react";
|
|
4
4
|
import { TEXT_BODY_400_2_LINES } from "../../../../../../theme/common/typography";
|
|
5
5
|
import { UnfoldMoreIcon } from "../../../../../common/CustomIcon/components/UnfoldMoreIcon/unfoldMoreIcon";
|
|
@@ -11,11 +11,13 @@ import {
|
|
|
11
11
|
TableCell,
|
|
12
12
|
} from "./collapsableCell.styles";
|
|
13
13
|
|
|
14
|
-
export interface CollapsableCellProps<T> {
|
|
14
|
+
export interface CollapsableCellProps<T extends RowData> {
|
|
15
|
+
isDisabled?: boolean;
|
|
15
16
|
row: Row<T>;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export const CollapsableCell = <T extends
|
|
19
|
+
export const CollapsableCell = <T extends RowData>({
|
|
20
|
+
isDisabled = false,
|
|
19
21
|
row,
|
|
20
22
|
}: CollapsableCellProps<T>): JSX.Element => {
|
|
21
23
|
const [isExpanded, setIsExpanded] = useState<boolean>(false);
|
|
@@ -32,6 +34,7 @@ export const CollapsableCell = <T extends object>({
|
|
|
32
34
|
{flexRender(pinnedCell.column.columnDef.cell, pinnedCell.getContext())}
|
|
33
35
|
<IconButton
|
|
34
36
|
color="ink"
|
|
37
|
+
disabled={isDisabled}
|
|
35
38
|
edge="end"
|
|
36
39
|
onClick={onToggleExpanded}
|
|
37
40
|
size="large"
|
|
@@ -41,7 +44,9 @@ export const CollapsableCell = <T extends object>({
|
|
|
41
44
|
</PinnedCell>
|
|
42
45
|
<Collapse in={isExpanded}>
|
|
43
46
|
<CollapsedContents>
|
|
44
|
-
{row
|
|
47
|
+
{getRowVisibleCells(row).map((cell, i) => {
|
|
48
|
+
if (cell.getIsAggregated()) return null; // Display of aggregated cells is currently not supported.
|
|
49
|
+
if (cell.getIsPlaceholder()) return null; // Display of placeholder cells is currently not supported.
|
|
45
50
|
const header = cell.column.columnDef.meta?.header;
|
|
46
51
|
return (
|
|
47
52
|
i !== pinnedIndex && (
|
|
@@ -65,3 +70,20 @@ export const CollapsableCell = <T extends object>({
|
|
|
65
70
|
</TableCell>
|
|
66
71
|
);
|
|
67
72
|
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns row or sub row visible cells.
|
|
76
|
+
* @param row - Row.
|
|
77
|
+
* @returns row or sub row visible cells.
|
|
78
|
+
*/
|
|
79
|
+
function getRowVisibleCells<T extends RowData>(
|
|
80
|
+
row: Row<T>
|
|
81
|
+
): Cell<T, unknown>[] {
|
|
82
|
+
if (row.getIsGrouped()) {
|
|
83
|
+
return row
|
|
84
|
+
.getLeafRows()
|
|
85
|
+
.map((leafRow) => leafRow.getVisibleCells())
|
|
86
|
+
.flat();
|
|
87
|
+
}
|
|
88
|
+
return row.getVisibleCells();
|
|
89
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TableCell as MTableCell,
|
|
3
3
|
TableHead as MTableHead,
|
|
4
|
-
TableRow,
|
|
4
|
+
TableRow as MTableRow,
|
|
5
5
|
TableSortLabel,
|
|
6
6
|
} from "@mui/material";
|
|
7
7
|
import { flexRender, Table } from "@tanstack/react-table";
|
|
@@ -24,28 +24,39 @@ export const TableHead = <T extends object>({
|
|
|
24
24
|
{rowDirection === ROW_DIRECTION.DEFAULT &&
|
|
25
25
|
tableInstance.getHeaderGroups().map((headerGroup) => (
|
|
26
26
|
<MTableHead key={headerGroup.id}>
|
|
27
|
-
<
|
|
28
|
-
{headerGroup.headers.map((header) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
<MTableRow>
|
|
28
|
+
{headerGroup.headers.map((header) => {
|
|
29
|
+
const {
|
|
30
|
+
column: {
|
|
31
|
+
columnDef: {
|
|
32
|
+
meta: { enableSortingInteraction = true } = {},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} = header;
|
|
36
|
+
return header.column.getIsGrouped() ? null : (
|
|
37
|
+
<MTableCell
|
|
38
|
+
key={header.id}
|
|
39
|
+
padding={getTableCellPadding(header.id)}
|
|
40
|
+
>
|
|
41
|
+
{header.column.getCanSort() && enableSortingInteraction ? (
|
|
42
|
+
<TableSortLabel
|
|
43
|
+
{...getTableSortLabelProps(header.column)}
|
|
44
|
+
>
|
|
45
|
+
{flexRender(
|
|
46
|
+
header.column.columnDef.header,
|
|
47
|
+
header.getContext()
|
|
48
|
+
)}
|
|
49
|
+
</TableSortLabel>
|
|
50
|
+
) : (
|
|
51
|
+
flexRender(
|
|
36
52
|
header.column.columnDef.header,
|
|
37
53
|
header.getContext()
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
)}
|
|
46
|
-
</MTableCell>
|
|
47
|
-
))}
|
|
48
|
-
</TableRow>
|
|
54
|
+
)
|
|
55
|
+
)}
|
|
56
|
+
</MTableCell>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
59
|
+
</MTableRow>
|
|
49
60
|
</MTableHead>
|
|
50
61
|
))}
|
|
51
62
|
</Fragment>
|
package/src/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { TableRow as MTableRow } from "@mui/material";
|
|
|
2
2
|
import { Row, Table } from "@tanstack/react-table";
|
|
3
3
|
import { Virtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
import React, { Fragment } from "react";
|
|
5
|
+
import { isCollapsableRowDisabled } from "../../../../common/utils";
|
|
5
6
|
import { CollapsableCell } from "../../../TableCell/components/CollapsableCell/collapsableCell";
|
|
6
7
|
|
|
7
8
|
export interface CollapsableRowsProps<T> {
|
|
@@ -26,7 +27,10 @@ export const CollapsableRows = <T extends object>({
|
|
|
26
27
|
data-index={virtualRow.index}
|
|
27
28
|
ref={virtualizer.measureElement}
|
|
28
29
|
>
|
|
29
|
-
<CollapsableCell
|
|
30
|
+
<CollapsableCell
|
|
31
|
+
isDisabled={isCollapsableRowDisabled(tableInstance)}
|
|
32
|
+
row={row}
|
|
33
|
+
/>
|
|
30
34
|
</MTableRow>
|
|
31
35
|
);
|
|
32
36
|
})}
|
|
@@ -153,7 +153,7 @@ TableProps<T>): JSX.Element => {
|
|
|
153
153
|
data: items,
|
|
154
154
|
enableColumnFilters: true, // client-side filtering.
|
|
155
155
|
enableFilters: true, // client-side filtering.
|
|
156
|
-
enableMultiSort:
|
|
156
|
+
enableMultiSort: clientFiltering,
|
|
157
157
|
enableRowSelection,
|
|
158
158
|
enableSorting: true, // client-side filtering.
|
|
159
159
|
enableSortingRemoval: false, // client-side filtering.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvgIcon } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CustomSVGIconProps } from "../../common/entities";
|
|
4
|
+
|
|
5
|
+
export const AddLinkIcon = ({
|
|
6
|
+
fontSize = "xsmall",
|
|
7
|
+
viewBox = "0 0 18 18",
|
|
8
|
+
...props /* Spread props to allow for Mui SvgIconProps specific prop overrides e.g. "htmlColor". */
|
|
9
|
+
}: CustomSVGIconProps): JSX.Element => {
|
|
10
|
+
return (
|
|
11
|
+
<SvgIcon fontSize={fontSize} viewBox={viewBox} {...props}>
|
|
12
|
+
<path
|
|
13
|
+
d="M12.8248 12.6004H11.4561C11.2811 12.6004 11.1279 12.5357 10.9967 12.4063C10.8654 12.277 10.7998 12.1166 10.7998 11.9254C10.7998 11.7504 10.8645 11.5941 10.9939 11.4566C11.1232 11.3191 11.2836 11.2504 11.4748 11.2504H12.8248V9.90039C12.8248 9.70914 12.8891 9.54883 13.0177 9.41945C13.1464 9.29008 13.3057 9.22539 13.4959 9.22539C13.686 9.22539 13.8459 9.29008 13.9755 9.41945C14.1052 9.54883 14.1701 9.70914 14.1701 9.90039V11.2504H15.5233C15.7149 11.2504 15.8756 11.3151 16.0054 11.4445C16.135 11.5738 16.1998 11.7341 16.1998 11.9254C16.1998 12.1166 16.135 12.277 16.0054 12.4063C15.8756 12.5357 15.7149 12.6004 15.5233 12.6004H14.1701V13.9504C14.1701 14.1416 14.1052 14.302 13.9755 14.4313C13.8459 14.5607 13.686 14.6254 13.4959 14.6254C13.3057 14.6254 13.1464 14.5607 13.0177 14.4313C12.8891 14.302 12.8248 14.1416 12.8248 13.9504V12.6004ZM7.4248 12.6004H5.3998C4.4038 12.6004 3.5548 12.249 2.8528 11.5461C2.1508 10.8433 1.7998 9.99333 1.7998 8.99608C1.7998 7.99895 2.1508 7.15039 2.8528 6.45039C3.5548 5.75039 4.4038 5.40039 5.3998 5.40039H7.4248C7.5998 5.40039 7.75605 5.46914 7.89355 5.60664C8.03105 5.74414 8.0998 5.90352 8.0998 6.08477C8.0998 6.26602 8.03105 6.42227 7.89355 6.55352C7.75605 6.68477 7.5998 6.75039 7.4248 6.75039H5.3998C4.7748 6.75039 4.24355 6.96914 3.80605 7.40664C3.36855 7.84414 3.1498 8.37539 3.1498 9.00039C3.1498 9.62539 3.36855 10.1566 3.80605 10.5941C4.24355 11.0316 4.7748 11.2504 5.3998 11.2504H7.4248C7.5998 11.2504 7.75605 11.3191 7.89355 11.4566C8.03105 11.5941 8.0998 11.7535 8.0998 11.9348C8.0998 12.116 8.03105 12.2723 7.89355 12.4035C7.75605 12.5348 7.5998 12.6004 7.4248 12.6004ZM6.98005 9.67539C6.78905 9.67539 6.62793 9.61108 6.49668 9.48245C6.36543 9.35383 6.2998 9.19445 6.2998 9.00433C6.2998 8.8142 6.36443 8.65352 6.49368 8.52227C6.62293 8.39102 6.78305 8.32539 6.97405 8.32539H11.0196C11.2106 8.32539 11.3717 8.3897 11.5029 8.51833C11.6342 8.64695 11.6998 8.80633 11.6998 8.99645C11.6998 9.18658 11.6352 9.34727 11.5059 9.47852C11.3767 9.60977 11.2166 9.67539 11.0256 9.67539H6.98005ZM16.1998 9.00039H14.8498C14.8498 8.37539 14.6311 7.84414 14.1936 7.40664C13.7561 6.96914 13.2248 6.75039 12.5998 6.75039H10.5561C10.3811 6.75039 10.2279 6.6857 10.0967 6.55633C9.96543 6.42695 9.8998 6.26664 9.8998 6.07539C9.8998 5.90039 9.96449 5.74414 10.0939 5.60664C10.2232 5.46914 10.3836 5.40039 10.5748 5.40039H12.5998C13.5958 5.40039 14.4448 5.75139 15.1468 6.45339C15.8488 7.15539 16.1998 8.00439 16.1998 9.00039Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
</SvgIcon>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvgIcon } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CustomSVGIconProps } from "../../common/entities";
|
|
4
|
+
|
|
5
|
+
export const UnLinkIcon = ({
|
|
6
|
+
fontSize = "xsmall",
|
|
7
|
+
viewBox = "0 0 18 18",
|
|
8
|
+
...props /* Spread props to allow for Mui SvgIconProps specific prop overrides e.g. "htmlColor". */
|
|
9
|
+
}: CustomSVGIconProps): JSX.Element => {
|
|
10
|
+
return (
|
|
11
|
+
<SvgIcon fontSize={fontSize} viewBox={viewBox} {...props}>
|
|
12
|
+
<path
|
|
13
|
+
d="M11.4561 9.52501L10.2373 8.325H11.0196C11.2123 8.325 11.3738 8.38968 11.5042 8.51905C11.6346 8.64843 11.6998 8.80875 11.6998 9C11.6998 9.11245 11.6748 9.21253 11.6248 9.30001C11.5748 9.38749 11.5123 9.46246 11.4373 9.52501H11.4561ZM14.8873 15.825C14.7498 15.9625 14.5904 16.0312 14.4092 16.0312C14.2279 16.0312 14.0685 15.9625 13.9311 15.825L2.15605 4.06874C2.01856 3.93124 1.94981 3.77187 1.94981 3.59062C1.94981 3.40937 2.01856 3.25 2.15605 3.11249C2.29355 2.97499 2.45293 2.90625 2.63418 2.90625C2.81543 2.90625 2.97481 2.97499 3.1123 3.11249L14.8873 14.8875C15.0248 15.025 15.0935 15.1812 15.0935 15.3562C15.0935 15.5313 15.0248 15.6875 14.8873 15.825ZM5.3998 12.6C4.4038 12.6 3.5548 12.249 2.8528 11.547C2.1508 10.845 1.7998 9.99598 1.7998 9C1.7998 8.20087 2.03731 7.48855 2.51231 6.86305C2.9873 6.23768 3.6623 5.74374 4.53731 5.38125L5.8498 6.75H5.41855C4.78105 6.75 4.24356 6.96874 3.80606 7.40625C3.36856 7.84375 3.1498 8.37499 3.1498 9C3.1498 9.625 3.36856 10.1563 3.80606 10.5938C4.24356 11.0313 4.77481 11.25 5.3998 11.25H7.4248C7.61605 11.25 7.77636 11.3143 7.90575 11.4429C8.03512 11.5715 8.0998 11.7309 8.0998 11.9211C8.0998 12.1112 8.03512 12.2719 7.90575 12.4031C7.77636 12.5343 7.61605 12.6 7.4248 12.6H5.3998ZM6.97274 9.67495C6.78661 9.67495 6.62793 9.61069 6.49668 9.48208C6.36543 9.35347 6.2998 9.19408 6.2998 9.00391C6.2998 8.81381 6.3645 8.65312 6.49387 8.52187C6.62325 8.39062 6.78355 8.325 6.9748 8.325H7.34981L8.68105 9.67495H6.97274ZM13.6686 11.775C13.5686 11.625 13.5342 11.4594 13.5654 11.2781C13.5966 11.0969 13.6873 10.9563 13.8373 10.8562C14.1498 10.6437 14.3967 10.375 14.5779 10.05C14.7592 9.72499 14.8498 9.37498 14.8498 9C14.8498 8.37499 14.631 7.84375 14.1935 7.40625C13.756 6.96874 13.2248 6.75 12.5998 6.75H10.5748C10.3836 6.75 10.2233 6.68568 10.0938 6.55705C9.96451 6.42844 9.8998 6.26905 9.8998 6.07893C9.8998 5.8888 9.96451 5.72812 10.0938 5.59687C10.2233 5.46563 10.3836 5.4 10.5748 5.4H12.5998C13.5958 5.4 14.4448 5.751 15.1468 6.453C15.8488 7.155 16.1998 8.00399 16.1998 9C16.1998 9.6034 16.0561 10.1667 15.7685 10.69C15.4811 11.2133 15.0873 11.6375 14.5873 11.9625C14.4373 12.0625 14.2716 12.0937 14.0904 12.0563C13.9092 12.0187 13.7685 11.925 13.6686 11.775Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
</SvgIcon>
|
|
17
|
+
);
|
|
18
|
+
};
|
package/src/config/entities.ts
CHANGED
|
@@ -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;
|
|
@@ -601,7 +601,7 @@ function exploreReducer(
|
|
|
601
601
|
* Update entity filters.
|
|
602
602
|
*/
|
|
603
603
|
case ExploreActionKind.UpdateEntityFilters: {
|
|
604
|
-
const { entityListType, filters: filterState } = payload;
|
|
604
|
+
const { entityListType, filters: filterState, sorting } = payload;
|
|
605
605
|
const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
|
|
606
606
|
entityListType,
|
|
607
607
|
state.entityPageState
|
|
@@ -616,7 +616,13 @@ function exploreReducer(
|
|
|
616
616
|
);
|
|
617
617
|
return {
|
|
618
618
|
...state,
|
|
619
|
-
entityPageState:
|
|
619
|
+
entityPageState: updateEntityPageState(
|
|
620
|
+
entityListType,
|
|
621
|
+
{
|
|
622
|
+
...resetRowSelection(state, categoryGroupConfigKey), // Reset row selection for all entities with the same category group config key.
|
|
623
|
+
},
|
|
624
|
+
{ sorting } // Update sorting for the entity.
|
|
625
|
+
),
|
|
620
626
|
};
|
|
621
627
|
}
|
|
622
628
|
/**
|
|
@@ -15,6 +15,7 @@ import type {} from "@mui/material/Tabs";
|
|
|
15
15
|
import type {} from "@mui/material/Toolbar";
|
|
16
16
|
import type {} from "@mui/material/Typography";
|
|
17
17
|
import { RowData } from "@tanstack/react-table";
|
|
18
|
+
import type {} from "@tanstack/table-core";
|
|
18
19
|
import { DataLayer } from "../src/common/analytics/entities";
|
|
19
20
|
import { GridTrackSize } from "../src/config/entities";
|
|
20
21
|
|
|
@@ -255,6 +256,7 @@ declare module "@tanstack/table-core" {
|
|
|
255
256
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TData and TValue are unused variables.
|
|
256
257
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
257
258
|
columnPinned?: boolean;
|
|
259
|
+
enableSortingInteraction?: boolean; // Flag to enable sorting interaction UI (e.g. sort icon) button; defaults to true.
|
|
258
260
|
header?: string;
|
|
259
261
|
width?: GridTrackSize;
|
|
260
262
|
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { TableCell, TableHead as MTableHead, TableRow } from "@mui/material";
|
|
2
|
-
import { flexRender, Table } from "@tanstack/react-table";
|
|
3
|
-
import React, { Fragment } from "react";
|
|
4
|
-
import { ROW_DIRECTION } from "../../../../../Table/common/entities";
|
|
5
|
-
|
|
6
|
-
export interface TableBodyProps<T> {
|
|
7
|
-
rowDirection: ROW_DIRECTION;
|
|
8
|
-
tableInstance: Table<T>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const TableHead = <T extends object>({
|
|
12
|
-
rowDirection,
|
|
13
|
-
tableInstance,
|
|
14
|
-
}: TableBodyProps<T>): JSX.Element => {
|
|
15
|
-
return (
|
|
16
|
-
<Fragment>
|
|
17
|
-
{rowDirection === ROW_DIRECTION.DEFAULT &&
|
|
18
|
-
tableInstance.getHeaderGroups().map((headerGroup) => (
|
|
19
|
-
<MTableHead key={headerGroup.id}>
|
|
20
|
-
<TableRow>
|
|
21
|
-
{headerGroup.headers.map((header) => (
|
|
22
|
-
<TableCell key={header.id}>
|
|
23
|
-
{flexRender(
|
|
24
|
-
header.column.columnDef.header,
|
|
25
|
-
header.getContext()
|
|
26
|
-
)}
|
|
27
|
-
</TableCell>
|
|
28
|
-
))}
|
|
29
|
-
</TableRow>
|
|
30
|
-
</MTableHead>
|
|
31
|
-
))}
|
|
32
|
-
</Fragment>
|
|
33
|
-
);
|
|
34
|
-
};
|