@uxf/data-grid 11.90.0 → 11.91.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/components.d.ts +0 -5
- package/components.js +0 -5
- package/data-grid-v2.js +1 -0
- package/data-grid.js +7 -8
- package/data-grid.stories.js +2 -2
- package/package.json +4 -5
- package/styles.css +0 -67
- package/types/data-grid-props.d.ts +2 -2
- package/table/components/action-cell-wrapper.d.ts +0 -6
- package/table/components/action-cell-wrapper.js +0 -67
- package/table/components/action-cell.d.ts +0 -7
- package/table/components/action-cell.js +0 -13
- package/table/components/select-row-checkbox.d.ts +0 -3
- package/table/components/select-row-checkbox.js +0 -50
- package/table/hooks/use-rdg-visuals.d.ts +0 -16
- package/table/hooks/use-rdg-visuals.js +0 -46
- package/table/hooks/use-react-data-grid-columns.d.ts +0 -4
- package/table/hooks/use-react-data-grid-columns.js +0 -96
- package/table/index.d.ts +0 -3
- package/table/index.js +0 -19
- package/table/no-rows-fallback.d.ts +0 -7
- package/table/no-rows-fallback.js +0 -16
- package/table/table.d.ts +0 -4
- package/table/table.js +0 -101
- package/table/table.stories.d.ts +0 -2
- package/table/table.stories.js +0 -20
- package/table/types.d.ts +0 -19
- package/table/types.js +0 -2
package/components.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ import * as paginationStories from "./pagination/pagination.stories";
|
|
|
12
12
|
import * as rowCountsStories from "./row-counts/row-counts.stories";
|
|
13
13
|
import * as rowsPerPageSelectStories from "./rows-per-page-select/rows-per-page-select.stories";
|
|
14
14
|
import * as selectedRowsToolbarStories from "./selected-rows-toolbar/selected-rows-toolbar.stories";
|
|
15
|
-
import * as tableStories from "./table/table.stories";
|
|
16
15
|
import * as tableV2Stories from "./table-v2/table-v2.stories";
|
|
17
16
|
import * as toolbarControlStories from "./toolbar-control/toolbar-control.stories";
|
|
18
17
|
import * as toolbarCustomsStories from "./toolbar-customs/toolbar-customs.stories";
|
|
@@ -74,10 +73,6 @@ export declare const components: {
|
|
|
74
73
|
readonly title: "SelectedRowsToolbar";
|
|
75
74
|
readonly stories: typeof selectedRowsToolbarStories;
|
|
76
75
|
};
|
|
77
|
-
readonly table: {
|
|
78
|
-
readonly title: "Table";
|
|
79
|
-
readonly stories: typeof tableStories;
|
|
80
|
-
};
|
|
81
76
|
readonly "table-v2": {
|
|
82
77
|
readonly title: "TableV2";
|
|
83
78
|
readonly stories: typeof tableV2Stories;
|
package/components.js
CHANGED
|
@@ -49,7 +49,6 @@ const paginationStories = __importStar(require("./pagination/pagination.stories"
|
|
|
49
49
|
const rowCountsStories = __importStar(require("./row-counts/row-counts.stories"));
|
|
50
50
|
const rowsPerPageSelectStories = __importStar(require("./rows-per-page-select/rows-per-page-select.stories"));
|
|
51
51
|
const selectedRowsToolbarStories = __importStar(require("./selected-rows-toolbar/selected-rows-toolbar.stories"));
|
|
52
|
-
const tableStories = __importStar(require("./table/table.stories"));
|
|
53
52
|
const tableV2Stories = __importStar(require("./table-v2/table-v2.stories"));
|
|
54
53
|
const toolbarControlStories = __importStar(require("./toolbar-control/toolbar-control.stories"));
|
|
55
54
|
const toolbarCustomsStories = __importStar(require("./toolbar-customs/toolbar-customs.stories"));
|
|
@@ -111,10 +110,6 @@ exports.components = {
|
|
|
111
110
|
title: "SelectedRowsToolbar",
|
|
112
111
|
stories: selectedRowsToolbarStories
|
|
113
112
|
},
|
|
114
|
-
"table": {
|
|
115
|
-
title: "Table",
|
|
116
|
-
stories: tableStories
|
|
117
|
-
},
|
|
118
113
|
"table-v2": {
|
|
119
114
|
title: "TableV2",
|
|
120
115
|
stories: tableV2Stories
|
package/data-grid-v2.js
CHANGED
|
@@ -22,6 +22,7 @@ const toolbar_control_1 = require("./toolbar-control");
|
|
|
22
22
|
const toolbar_customs_1 = require("./toolbar-customs");
|
|
23
23
|
const toolbar_tabs_1 = require("./toolbar-tabs");
|
|
24
24
|
const DefaultSelectedRowsToolbarActions = () => null;
|
|
25
|
+
// TODO remove (DataGrid is now identical with DataGridV2)
|
|
25
26
|
function DataGridV2(props) {
|
|
26
27
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
27
28
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
package/data-grid.js
CHANGED
|
@@ -16,27 +16,26 @@ const root_1 = require("./root");
|
|
|
16
16
|
const row_counts_1 = require("./row-counts");
|
|
17
17
|
const rows_per_page_select_1 = require("./rows-per-page-select");
|
|
18
18
|
const selected_rows_toolbar_1 = require("./selected-rows-toolbar");
|
|
19
|
-
const
|
|
20
|
-
const no_rows_fallback_1 = require("./table/no-rows-fallback");
|
|
19
|
+
const table_v2_1 = require("./table-v2");
|
|
21
20
|
const toolbar_1 = require("./toolbar");
|
|
22
21
|
const toolbar_control_1 = require("./toolbar-control");
|
|
23
22
|
const toolbar_customs_1 = require("./toolbar-customs");
|
|
24
23
|
const toolbar_tabs_1 = require("./toolbar-tabs");
|
|
25
24
|
const DefaultSelectedRowsToolbarActions = () => null;
|
|
26
25
|
function DataGrid(props) {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
28
27
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
29
28
|
react_1.default.createElement(root_1.DataGridRoot, { className: props.className },
|
|
30
29
|
react_1.default.createElement(toolbar_1.DataGridToolbar, null,
|
|
31
|
-
react_1.default.createElement(toolbar_tabs_1.DataGridToolbarTabs, { actions: props.actions, changeTabFilterBehavior: props.changeTabFilterBehavior, schema: props.schema, state: props.state }),
|
|
30
|
+
react_1.default.createElement(toolbar_tabs_1.DataGridToolbarTabs, { actions: props.actions, changeTabFilterBehavior: props.changeTabFilterBehavior, schema: props.schema, state: props.state, variant: props.tabsVariant }),
|
|
32
31
|
react_1.default.createElement(toolbar_control_1.DataGridToolbarControl, { actions: props.actions, filterHandlers: (_a = props.filterHandlers) !== null && _a !== void 0 ? _a : filter_handler_1.defaultFilterHandlers, getCsvDownloadUrl: props.getCsvDownloadUrl, schema: props.schema, state: props.state }),
|
|
33
32
|
react_1.default.createElement(toolbar_customs_1.DataGridToolbarCustoms, { buttons: props.customActions })),
|
|
34
33
|
react_1.default.createElement(linear_progress_1.DataGridLinearProgress, { isLoading: props.isLoading }),
|
|
35
34
|
react_1.default.createElement(filter_list_1.DataGridFilterList, { actions: props.actions, filterHandlers: (_b = props.filterHandlers) !== null && _b !== void 0 ? _b : filter_handler_1.defaultFilterHandlers, schema: props.schema, state: props.state }),
|
|
36
|
-
react_1.default.createElement(
|
|
35
|
+
react_1.default.createElement(table_v2_1.DataGridTableV2, { NoRowsFallback: props.NoRowsFallback, actionCell: props.actionCell, actions: props.actions, bodyCells: (_c = props.bodyCells) !== null && _c !== void 0 ? _c : body_cell_1.BodyCells, data: (_e = (_d = props.data) === null || _d === void 0 ? void 0 : _d.result) !== null && _e !== void 0 ? _e : empty_array_1.EMPTY_ARRAY, error: props.error, headerRowHeight: props.headerRowHeight, isLoading: props.isLoading, isRowSelectDisabled: props.isRowSelectDisabled, isRowsSelectable: props.isRowsSelectable, keyExtractor: props.keyExtractor, reload: props.reload, rowAccent: props.rowAccent, rowClassName: props.rowClassName, rowHeight: props.rowHeight, schema: props.schema, state: props.state }),
|
|
37
36
|
react_1.default.createElement(footer_1.DataGridFooter, null,
|
|
38
37
|
react_1.default.createElement(rows_per_page_select_1.DataGridRowsPerPageSelect, { actions: props.actions, state: props.state }),
|
|
39
|
-
react_1.default.createElement(row_counts_1.DataGridRowCounts, { count: (
|
|
40
|
-
react_1.default.createElement(pagination_1.DataGridPagination, { actions: props.actions, count: (
|
|
41
|
-
react_1.default.createElement(selected_rows_toolbar_1.DataGridSelectedRowsToolbar, { Actions: (
|
|
38
|
+
react_1.default.createElement(row_counts_1.DataGridRowCounts, { count: (_g = (_f = props.data) === null || _f === void 0 ? void 0 : _f.count) !== null && _g !== void 0 ? _g : 0, state: props.state, totalCount: (_j = (_h = props.data) === null || _h === void 0 ? void 0 : _h.totalCount) !== null && _j !== void 0 ? _j : 0 }),
|
|
39
|
+
react_1.default.createElement(pagination_1.DataGridPagination, { actions: props.actions, count: (_l = (_k = props.data) === null || _k === void 0 ? void 0 : _k.count) !== null && _l !== void 0 ? _l : 0, showFirstButton: true, showLastButton: true, size: "sm", state: props.state }))),
|
|
40
|
+
react_1.default.createElement(selected_rows_toolbar_1.DataGridSelectedRowsToolbar, { Actions: (_m = props.SelectedRowsToolbarActions) !== null && _m !== void 0 ? _m : DefaultSelectedRowsToolbarActions, actions: props.actions, reload: props.reload, state: props.state })));
|
|
42
41
|
}
|
package/data-grid.stories.js
CHANGED
|
@@ -41,7 +41,7 @@ const json_renderer_1 = require("./_story-utils/json-renderer");
|
|
|
41
41
|
const loader_1 = require("./_story-utils/loader");
|
|
42
42
|
const schema_1 = require("./_story-utils/schema");
|
|
43
43
|
const data_grid_1 = require("./data-grid");
|
|
44
|
-
const
|
|
44
|
+
const action_cell_1 = require("./table-v2/components/action-cell");
|
|
45
45
|
const use_data_grid_control_1 = require("./use-data-grid-control");
|
|
46
46
|
const use_data_grid_fetching_1 = require("./use-data-grid-fetching");
|
|
47
47
|
const merge_schema_with_config_1 = require("./utils/merge-schema-with-config");
|
|
@@ -65,7 +65,7 @@ const actionCell = {
|
|
|
65
65
|
label: "Reload",
|
|
66
66
|
onClick: console.log,
|
|
67
67
|
});
|
|
68
|
-
return react_1.default.createElement(
|
|
68
|
+
return react_1.default.createElement(action_cell_1.ActionCell, { buttons: actionCellActions, visibleButtonsCount: 1 });
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
71
|
const schemaWithFrontendConfig = (0, merge_schema_with_config_1.mergeSchemaWithConfig)(schema_1.schema, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/data-grid",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.91.0",
|
|
4
4
|
"description": "UXF DataGrid",
|
|
5
5
|
"homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -31,14 +31,13 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@uxf/core": "11.
|
|
35
|
-
"@uxf/core-react": "11.
|
|
36
|
-
"@uxf/ui": "11.
|
|
34
|
+
"@uxf/core": "11.91.0",
|
|
35
|
+
"@uxf/core-react": "11.91.0",
|
|
36
|
+
"@uxf/ui": "11.91.0",
|
|
37
37
|
"dayjs": "1.11.19",
|
|
38
38
|
"deepmerge": "4.3.1",
|
|
39
39
|
"fast-glob": "3.3.3",
|
|
40
40
|
"qs": "6.14.0",
|
|
41
|
-
"react-data-grid": "7.0.0-beta.39",
|
|
42
41
|
"yargs": "18.0.0"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
package/styles.css
CHANGED
|
@@ -1,66 +1,8 @@
|
|
|
1
|
-
@import url("react-data-grid/lib/styles.css");
|
|
2
1
|
@import url("./table-v2/styles.css");
|
|
3
2
|
|
|
4
|
-
/* stylelint-disable-next-line layer-name-pattern */
|
|
5
|
-
@layer rdg.Root {
|
|
6
|
-
.uxf-data-grid__table {
|
|
7
|
-
--rdg-color-scheme: light;
|
|
8
|
-
--rdg-color: theme("colors.lightHigh");
|
|
9
|
-
--rdg-border-color: theme("colors.lightBorder");
|
|
10
|
-
--rdg-summary-border-color: theme("colors.lightBorder");
|
|
11
|
-
--rdg-background-color: theme("colors.white");
|
|
12
|
-
--rdg-header-background-color: theme("colors.gray.50");
|
|
13
|
-
--rdg-row-hover-background-color: theme("colors.gray.50");
|
|
14
|
-
--rdg-row-selected-background-color: theme("colors.gray.100/.75");
|
|
15
|
-
--rdg-row-selected-hover-background-color: theme("colors.gray.200/.75");
|
|
16
|
-
--rdg-selection-color: theme("colors.lightBorder");
|
|
17
|
-
--rdg-font-size: 14px;
|
|
18
|
-
|
|
19
|
-
:root .dark & {
|
|
20
|
-
--rdg-color-scheme: dark;
|
|
21
|
-
--rdg-color: theme("colors.darkHigh");
|
|
22
|
-
--rdg-border-color: theme("colors.darkBorder");
|
|
23
|
-
--rdg-summary-border-color: theme("colors.darkBorder");
|
|
24
|
-
--rdg-background-color: theme("colors.gray.950");
|
|
25
|
-
--rdg-header-background-color: theme("colors.gray.900");
|
|
26
|
-
--rdg-row-hover-background-color: theme("colors.gray.950");
|
|
27
|
-
--rdg-row-selected-background-color: theme("colors.gray.900/.75");
|
|
28
|
-
--rdg-row-selected-hover-background-color: theme("colors.gray.800/.75");
|
|
29
|
-
--rdg-selection-color: theme("colors.darkBorder");
|
|
30
|
-
--rdg-font-size: 14px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
3
|
.uxf-data-grid {
|
|
36
4
|
border-radius: theme("borderRadius.DEFAULT");
|
|
37
5
|
|
|
38
|
-
&__action-cell {
|
|
39
|
-
background-color: var(--rdg-background-color);
|
|
40
|
-
border-inline-start: 1px solid var(--rdg-border-color);
|
|
41
|
-
position: sticky;
|
|
42
|
-
right: 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&__action-cell-wrapper {
|
|
46
|
-
@apply space-x-2;
|
|
47
|
-
|
|
48
|
-
align-items: center;
|
|
49
|
-
display: flex;
|
|
50
|
-
height: 100%;
|
|
51
|
-
justify-content: center;
|
|
52
|
-
text-align: center;
|
|
53
|
-
width: 100%;
|
|
54
|
-
|
|
55
|
-
.uxf-icon {
|
|
56
|
-
color: theme("colors.lightMedium");
|
|
57
|
-
|
|
58
|
-
:root .dark & {
|
|
59
|
-
color: theme("colors.darkMedium");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
6
|
&__body-cell {
|
|
65
7
|
&--boolean {
|
|
66
8
|
align-items: center;
|
|
@@ -135,15 +77,6 @@ o
|
|
|
135
77
|
}
|
|
136
78
|
}
|
|
137
79
|
|
|
138
|
-
&__fallback {
|
|
139
|
-
align-items: center;
|
|
140
|
-
color: theme("colors.gray.600"); /* ?? */
|
|
141
|
-
display: flex;
|
|
142
|
-
grid-column: 1/-1;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
text-align: center;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
80
|
&__filter {
|
|
148
81
|
&--date,
|
|
149
82
|
&--datetime,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Nullish } from "@uxf/core/types";
|
|
2
2
|
import { FilterHandlers } from "../filter-handler";
|
|
3
3
|
import { SelectedRowsToolbarActionsComponent } from "../selected-rows-toolbar";
|
|
4
|
-
import { NoRowsFallbackComponent } from "../table/no-rows-fallback";
|
|
5
|
-
import { DataGridTableProps } from "../table/types";
|
|
4
|
+
import { NoRowsFallbackComponent } from "../table-v2/no-rows-fallback";
|
|
5
|
+
import { DataGridTableProps } from "../table-v2/types";
|
|
6
6
|
import { DataGridToolbarCustomsProps } from "../toolbar-customs";
|
|
7
7
|
import { DataGridControl } from "../use-data-grid-control";
|
|
8
8
|
import { DataGridFetchingResult } from "../use-data-grid-fetching";
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ActionCellWrapper = ActionCellWrapper;
|
|
37
|
-
const react_1 = __importStar(require("react"));
|
|
38
|
-
function ActionCellWrapper(props) {
|
|
39
|
-
const innerRef = (0, react_1.useRef)(null);
|
|
40
|
-
(0, react_1.useEffect)(() => {
|
|
41
|
-
var _a;
|
|
42
|
-
let scrollLeft = 0;
|
|
43
|
-
let grid = null;
|
|
44
|
-
const node = innerRef.current;
|
|
45
|
-
if (!node) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const scrollHandler = () => {
|
|
49
|
-
grid === null || grid === void 0 ? void 0 : grid.scrollTo({ left: scrollLeft });
|
|
50
|
-
grid === null || grid === void 0 ? void 0 : grid.removeEventListener("scroll", scrollHandler);
|
|
51
|
-
};
|
|
52
|
-
const focusHandler = () => {
|
|
53
|
-
grid = node.closest(".rdg");
|
|
54
|
-
if (grid) {
|
|
55
|
-
scrollLeft = grid.scrollLeft;
|
|
56
|
-
grid.addEventListener("scroll", scrollHandler);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
(_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.addEventListener("focus", focusHandler, { capture: true });
|
|
60
|
-
return () => {
|
|
61
|
-
var _a;
|
|
62
|
-
grid === null || grid === void 0 ? void 0 : grid.removeEventListener("scroll", scrollHandler);
|
|
63
|
-
(_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.removeEventListener("focus", focusHandler);
|
|
64
|
-
};
|
|
65
|
-
}, []);
|
|
66
|
-
return (react_1.default.createElement("div", { className: "uxf-data-grid__action-cell-wrapper", ref: innerRef }, props.children));
|
|
67
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ButtonListProps } from "@uxf/ui/button-list";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export interface ActionCellProps {
|
|
4
|
-
buttons: ButtonListProps["buttons"];
|
|
5
|
-
visibleButtonsCount: ButtonListProps["visibleButtonsCount"];
|
|
6
|
-
}
|
|
7
|
-
export declare function ActionCell(props: ActionCellProps): React.JSX.Element;
|
|
@@ -1,13 +0,0 @@
|
|
|
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.ActionCell = ActionCell;
|
|
7
|
-
const button_list_1 = require("@uxf/ui/button-list");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const action_cell_wrapper_1 = require("./action-cell-wrapper");
|
|
10
|
-
function ActionCell(props) {
|
|
11
|
-
return (react_1.default.createElement(action_cell_wrapper_1.ActionCellWrapper, null,
|
|
12
|
-
react_1.default.createElement(button_list_1.ButtonList, { buttons: props.buttons, size: "sm", variant: "secondary", visibleButtonsCount: props.visibleButtonsCount })));
|
|
13
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SelectRowCheckbox = SelectRowCheckbox;
|
|
37
|
-
const checkbox_1 = require("@uxf/ui/checkbox");
|
|
38
|
-
const react_1 = __importStar(require("react"));
|
|
39
|
-
function SelectRowCheckbox(props) {
|
|
40
|
-
var _a;
|
|
41
|
-
const handleChange = (value, e) => {
|
|
42
|
-
if (typeof value !== "undefined") {
|
|
43
|
-
const shiftKey = (e === null || e === void 0 ? void 0 : e.nativeEvent) && e.nativeEvent instanceof MouseEvent ? e.nativeEvent.shiftKey : false;
|
|
44
|
-
props.onChange(value, shiftKey);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const id = (0, react_1.useId)();
|
|
48
|
-
return (react_1.default.createElement("div", { className: "uxf-data-grid__select-row-checkbox-wrapper" },
|
|
49
|
-
react_1.default.createElement(checkbox_1.Checkbox, { ...props, name: id, onChange: handleChange, value: (_a = props.checked) !== null && _a !== void 0 ? _a : false })));
|
|
50
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DataGridHandle } from "react-data-grid";
|
|
2
|
-
import { BaseGridType, DataGridBaseProps } from "../../types";
|
|
3
|
-
export declare function useRdgVisuals(props: {
|
|
4
|
-
headerRowHeight?: DataGridBaseProps<BaseGridType, any>["headerRowHeight"];
|
|
5
|
-
rowHeight?: Exclude<DataGridBaseProps<BaseGridType, any>["rowHeight"], "auto">;
|
|
6
|
-
rows: any[];
|
|
7
|
-
}): {
|
|
8
|
-
className: string;
|
|
9
|
-
headerRowHeight: number;
|
|
10
|
-
ready: boolean;
|
|
11
|
-
ref: import("react").RefObject<DataGridHandle>;
|
|
12
|
-
rowHeight: number | ((row: any) => number);
|
|
13
|
-
style: {
|
|
14
|
-
height: number | undefined;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRdgVisuals = useRdgVisuals;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useRdgVisuals(props) {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
const [mounted, setMounted] = (0, react_1.useState)(false);
|
|
8
|
-
(0, react_1.useEffect)(() => setMounted(true), []);
|
|
9
|
-
const rowHeight = (_a = props.rowHeight) !== null && _a !== void 0 ? _a : 44;
|
|
10
|
-
const headerRowHeight = (_b = props.headerRowHeight) !== null && _b !== void 0 ? _b : 36;
|
|
11
|
-
const contentHeight = typeof rowHeight === "function"
|
|
12
|
-
? props.rows.reduce((prev, curr) => prev + rowHeight(curr))
|
|
13
|
-
: rowHeight * props.rows.length;
|
|
14
|
-
const ref = (0, react_1.useRef)(null);
|
|
15
|
-
const size = {
|
|
16
|
-
contentHeight,
|
|
17
|
-
headerRowHeight,
|
|
18
|
-
rowsCount: props.rows.length,
|
|
19
|
-
};
|
|
20
|
-
const storedSize = (0, react_1.useRef)(size);
|
|
21
|
-
storedSize.current = size;
|
|
22
|
-
const [height, setHeight] = (0, react_1.useState)();
|
|
23
|
-
(0, react_1.useEffect)(() => {
|
|
24
|
-
var _a;
|
|
25
|
-
const node = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.element;
|
|
26
|
-
if (!(mounted && node)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const observer = new MutationObserver((mutations) => mutations.forEach(() => {
|
|
30
|
-
const currentSize = storedSize.current;
|
|
31
|
-
const scrollbarHeight = node.scrollWidth > node.clientWidth ? 8 : 0;
|
|
32
|
-
const emptyRowHeight = currentSize.rowsCount === 0 ? 44 : 0;
|
|
33
|
-
setHeight(currentSize.headerRowHeight + currentSize.contentHeight + emptyRowHeight + scrollbarHeight);
|
|
34
|
-
}));
|
|
35
|
-
observer.observe(node, { attributes: true, attributeFilter: ["style"] });
|
|
36
|
-
return () => observer.disconnect();
|
|
37
|
-
}, [mounted, storedSize]);
|
|
38
|
-
return {
|
|
39
|
-
className: "uxf-data-grid__table rdg-light",
|
|
40
|
-
headerRowHeight,
|
|
41
|
-
ready: mounted,
|
|
42
|
-
ref,
|
|
43
|
-
rowHeight,
|
|
44
|
-
style: { height },
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.useReactDataGridColumns = useReactDataGridColumns;
|
|
37
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
38
|
-
const react_1 = __importStar(require("react"));
|
|
39
|
-
const react_data_grid_1 = require("react-data-grid");
|
|
40
|
-
function useReactDataGridColumns(props, state) {
|
|
41
|
-
const { reload, schema, isRowSelectable, bodyCells, actionCell } = props;
|
|
42
|
-
const userConfigColumns = state.userConfig.columns;
|
|
43
|
-
return (0, react_1.useMemo)(() => {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
45
|
-
const columns = [];
|
|
46
|
-
if (isRowSelectable) {
|
|
47
|
-
columns.push(react_data_grid_1.SelectColumn);
|
|
48
|
-
}
|
|
49
|
-
for (const schemaColumn of schema.columns) {
|
|
50
|
-
if (schemaColumn.hidden) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const isHidden = (_b = (_a = userConfigColumns === null || userConfigColumns === void 0 ? void 0 : userConfigColumns[schemaColumn.name]) === null || _a === void 0 ? void 0 : _a.isHidden) !== null && _b !== void 0 ? _b : (_c = schemaColumn.config) === null || _c === void 0 ? void 0 : _c.isHidden;
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
55
|
-
if (isHidden) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
columns.push({
|
|
59
|
-
key: schemaColumn.name,
|
|
60
|
-
name: schemaColumn.label,
|
|
61
|
-
headerCellClass: (0, cx_1.cx)("uxf-data-grid__cell", "uxf-data-grid__cell--header", `uxf-data-grid__cell--type-${schemaColumn.type}`, `uxf-data-grid__cell--name-${schemaColumn.name}`),
|
|
62
|
-
resizable: true,
|
|
63
|
-
sortable: schemaColumn.sort,
|
|
64
|
-
width: (_f = (_e = (_d = state.userConfig.columns) === null || _d === void 0 ? void 0 : _d[schemaColumn.name]) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : (_g = schemaColumn.config) === null || _g === void 0 ? void 0 : _g.width,
|
|
65
|
-
minWidth: (_k = (_j = (_h = state.userConfig.columns) === null || _h === void 0 ? void 0 : _h[schemaColumn.name]) === null || _j === void 0 ? void 0 : _j.minWidth) !== null && _k !== void 0 ? _k : (_l = schemaColumn.config) === null || _l === void 0 ? void 0 : _l.minWidth,
|
|
66
|
-
cellClass: (0, cx_1.cx)("uxf-data-grid__cell", `uxf-data-grid__cell--type-${schemaColumn.type}`, `uxf-data-grid__cell--name-${schemaColumn.name}`),
|
|
67
|
-
renderCell: (p) => {
|
|
68
|
-
var _a;
|
|
69
|
-
const columnType = schemaColumn.type;
|
|
70
|
-
const BodyCell = (_a = bodyCells === null || bodyCells === void 0 ? void 0 : bodyCells[columnType]) !== null && _a !== void 0 ? _a : bodyCells === null || bodyCells === void 0 ? void 0 : bodyCells.default;
|
|
71
|
-
if (!BodyCell) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
return (react_1.default.createElement(BodyCell, { column: {
|
|
75
|
-
name: p.column.key,
|
|
76
|
-
label: p.column.name,
|
|
77
|
-
sort: p.column.sortable,
|
|
78
|
-
type: columnType,
|
|
79
|
-
}, reload: reload, row: p.row, value: p.row[p.column.key] }));
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if (actionCell) {
|
|
84
|
-
columns.push({
|
|
85
|
-
key: "__action_column",
|
|
86
|
-
name: "",
|
|
87
|
-
resizable: false,
|
|
88
|
-
headerCellClass: "uxf-data-grid__action-cell",
|
|
89
|
-
cellClass: "uxf-data-grid__action-cell",
|
|
90
|
-
width: actionCell.width,
|
|
91
|
-
renderCell: (p) => react_1.default.createElement(actionCell.Component, { reload: reload, row: p.row }),
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return columns;
|
|
95
|
-
}, [userConfigColumns, actionCell, schema.columns, bodyCells, isRowSelectable, reload, state.userConfig.columns]);
|
|
96
|
-
}
|
package/table/index.d.ts
DELETED
package/table/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./components/action-cell"), exports);
|
|
18
|
-
__exportStar(require("./components/action-cell-wrapper"), exports);
|
|
19
|
-
__exportStar(require("./table"), exports);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React, { FunctionComponent } from "react";
|
|
2
|
-
export interface NoRowsFallbackProps {
|
|
3
|
-
error?: any;
|
|
4
|
-
isLoading: boolean;
|
|
5
|
-
}
|
|
6
|
-
export type NoRowsFallbackComponent = FunctionComponent<NoRowsFallbackProps>;
|
|
7
|
-
export declare function NoRowsFallback(props: NoRowsFallbackProps): React.JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
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.NoRowsFallback = NoRowsFallback;
|
|
7
|
-
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
-
const icon_1 = require("@uxf/ui/icon");
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
function NoRowsFallback(props) {
|
|
12
|
-
const t = (0, translations_1.useUxfTranslation)();
|
|
13
|
-
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-data-grid__fallback", props.isLoading && "is-loading", props.error && "is-error") }, props.isLoading ? (react_1.default.createElement(react_1.default.Fragment, null, t("uxf-data-grid-no-rows-fallback:loading"))) : props.error ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
14
|
-
react_1.default.createElement(icon_1.Icon, { name: "warning", size: 24 }),
|
|
15
|
-
react_1.default.createElement("p", null, t("uxf-data-grid-no-rows-fallback:error")))) : (react_1.default.createElement(react_1.default.Fragment, null, t("uxf-data-grid-no-rows-fallback:no-records")))));
|
|
16
|
-
}
|
package/table/table.d.ts
DELETED
package/table/table.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.DataGridTable = DataGridTable;
|
|
41
|
-
const show_1 = require("@uxf/core-react/components/show");
|
|
42
|
-
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
43
|
-
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
44
|
-
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
45
|
-
const react_1 = __importStar(require("react"));
|
|
46
|
-
const react_data_grid_1 = __importDefault(require("react-data-grid"));
|
|
47
|
-
const select_row_checkbox_1 = require("./components/select-row-checkbox");
|
|
48
|
-
const use_rdg_visuals_1 = require("./hooks/use-rdg-visuals");
|
|
49
|
-
const use_react_data_grid_columns_1 = require("./hooks/use-react-data-grid-columns");
|
|
50
|
-
const no_rows_fallback_1 = require("./no-rows-fallback");
|
|
51
|
-
const defaultKeyExtractor = (r) => r.id;
|
|
52
|
-
const DefaultNoRowsFallback = no_rows_fallback_1.NoRowsFallback;
|
|
53
|
-
/** @deprecated will be remove, use DataGridTableV2 */
|
|
54
|
-
function DataGridTable(props) {
|
|
55
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
56
|
-
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
57
|
-
const rowHeight = (_a = props.rowHeight) !== null && _a !== void 0 ? _a : 44;
|
|
58
|
-
const headerRowHeight = (_b = props.headerRowHeight) !== null && _b !== void 0 ? _b : 36;
|
|
59
|
-
const keyExtractor = (_c = props.keyExtractor) !== null && _c !== void 0 ? _c : defaultKeyExtractor;
|
|
60
|
-
const contentHeight = typeof rowHeight === "function"
|
|
61
|
-
? props.data.reduce((prev, curr) => prev + rowHeight(curr))
|
|
62
|
-
: (rowHeight + 1) * props.data.length;
|
|
63
|
-
const reactDataGridStyles = {
|
|
64
|
-
height: contentHeight + headerRowHeight + (props.data.length === 0 ? 44 : 0) + 4,
|
|
65
|
-
overflowY: "hidden",
|
|
66
|
-
};
|
|
67
|
-
const NoRowsFallback = (_d = props.NoRowsFallback) !== null && _d !== void 0 ? _d : DefaultNoRowsFallback;
|
|
68
|
-
const isLoading = Boolean(props.isLoading);
|
|
69
|
-
const error = props.error;
|
|
70
|
-
const components = (0, react_1.useMemo)(() => ({
|
|
71
|
-
renderCheckbox: (args) => react_1.default.createElement(select_row_checkbox_1.SelectRowCheckbox, { ...args }),
|
|
72
|
-
noRowsFallback: react_1.default.createElement(NoRowsFallback, { error: error, isLoading: isLoading }),
|
|
73
|
-
}), [NoRowsFallback, error, isLoading]);
|
|
74
|
-
const columns = (0, use_react_data_grid_columns_1.useReactDataGridColumns)(props, props.state);
|
|
75
|
-
const onSelectRows = (value) => {
|
|
76
|
-
const selectedRows = Array.from(value).map((id) => {
|
|
77
|
-
var _a, _b;
|
|
78
|
-
return (_b = (_a = props.state.selectedRows) === null || _a === void 0 ? void 0 : _a.find((row) => keyExtractor(row) === id)) !== null && _b !== void 0 ? _b : props.data.find((row) => keyExtractor(row) === id);
|
|
79
|
-
});
|
|
80
|
-
props.actions.setSelectedRows(selectedRows);
|
|
81
|
-
};
|
|
82
|
-
const onSortColumnChange = (sortColumns) => {
|
|
83
|
-
const firstSortColumn = sortColumns.at(0);
|
|
84
|
-
if ((0, is_not_nil_1.isNotNil)(firstSortColumn)) {
|
|
85
|
-
props.actions.sort(firstSortColumn.columnKey, firstSortColumn.direction.toLowerCase());
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
props.actions.sortClear();
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
const sortColumns = props.state.request.s
|
|
92
|
-
? [{ columnKey: props.state.request.s.name, direction: props.state.request.s.dir.toUpperCase() }]
|
|
93
|
-
: empty_array_1.EMPTY_ARRAY;
|
|
94
|
-
const rdgVisuals = (0, use_rdg_visuals_1.useRdgVisuals)({
|
|
95
|
-
headerRowHeight: props.headerRowHeight,
|
|
96
|
-
rowHeight: props.rowHeight,
|
|
97
|
-
rows: props.data,
|
|
98
|
-
});
|
|
99
|
-
return (react_1.default.createElement(show_1.Show, { when: isMounted },
|
|
100
|
-
react_1.default.createElement(react_data_grid_1.default, { className: rdgVisuals.className, columns: columns, enableVirtualization: false, headerRowHeight: rdgVisuals.headerRowHeight, onSelectedRowsChange: onSelectRows, onSortColumnsChange: onSortColumnChange, ref: rdgVisuals.ref, renderers: components, rowClass: props.rowClass, rowHeight: rdgVisuals.rowHeight, rowKeyGetter: (_e = props.keyExtractor) !== null && _e !== void 0 ? _e : defaultKeyExtractor, rows: props.data, selectedRows: new Set((_g = (_f = props.state.selectedRows) === null || _f === void 0 ? void 0 : _f.map(keyExtractor)) !== null && _g !== void 0 ? _g : empty_array_1.EMPTY_ARRAY), sortColumns: sortColumns, style: reactDataGridStyles })));
|
|
101
|
-
}
|
package/table/table.stories.d.ts
DELETED
package/table/table.stories.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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.Default = Default;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const data_1 = require("../_story-utils/data");
|
|
9
|
-
const json_renderer_1 = require("../_story-utils/json-renderer");
|
|
10
|
-
const schema_1 = require("../_story-utils/schema");
|
|
11
|
-
const body_cell_1 = require("../body-cell");
|
|
12
|
-
const use_data_grid_control_1 = require("../use-data-grid-control");
|
|
13
|
-
const table_1 = require("./table");
|
|
14
|
-
function Default() {
|
|
15
|
-
const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)({ schema: schema_1.schema });
|
|
16
|
-
const reload = () => new Promise(() => null);
|
|
17
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
|
-
react_1.default.createElement(table_1.DataGridTable, { actions: actions, bodyCells: body_cell_1.BodyCells, data: data_1.data, error: undefined, isLoading: true, isRowSelectable: true, reload: reload, schema: schema_1.schema, state: state }),
|
|
19
|
-
react_1.default.createElement(json_renderer_1.JsonRenderer, { value: state })));
|
|
20
|
-
}
|
package/table/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { BodyCellComponents, DataGridActionCell, KeyExtractor, RowAccent, Schema } from "../types";
|
|
3
|
-
import { DataGridControl } from "../use-data-grid-control";
|
|
4
|
-
import { NoRowsFallbackComponent } from "./no-rows-fallback";
|
|
5
|
-
export interface DataGridTableProps<Row> extends DataGridControl {
|
|
6
|
-
schema: Schema<any>;
|
|
7
|
-
data: Row[];
|
|
8
|
-
isLoading?: boolean;
|
|
9
|
-
error?: any | Nullish;
|
|
10
|
-
reload: () => Promise<any>;
|
|
11
|
-
rowHeight?: number | ((row: Row) => number);
|
|
12
|
-
headerRowHeight?: number;
|
|
13
|
-
rowClass?: (row: Row) => RowAccent;
|
|
14
|
-
keyExtractor?: KeyExtractor;
|
|
15
|
-
bodyCells?: BodyCellComponents;
|
|
16
|
-
actionCell?: DataGridActionCell<Row>;
|
|
17
|
-
NoRowsFallback?: NoRowsFallbackComponent;
|
|
18
|
-
isRowSelectable?: boolean;
|
|
19
|
-
}
|
package/table/types.js
DELETED