@uxf/data-grid 11.72.3 → 11.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +3 -3
- package/translations/translations.d.ts +173 -0
- package/translations/translations.js +174 -0
- package/_api/index.d.ts +0 -8
- package/_api/index.js +0 -11
- package/_components/drawer.d.ts +0 -8
- package/_components/drawer.js +0 -19
- package/_store/reducer.d.ts +0 -8
- package/_store/reducer.js +0 -209
- package/_story-utils/data.d.ts +0 -34
- package/_story-utils/data.js +0 -229
- package/_story-utils/grid-type.d.ts +0 -32
- package/_story-utils/grid-type.js +0 -2
- package/_story-utils/json-renderer.d.ts +0 -7
- package/_story-utils/json-renderer.js +0 -12
- package/_story-utils/loader.d.ts +0 -2
- package/_story-utils/loader.js +0 -33
- package/_story-utils/schema.d.ts +0 -3
- package/_story-utils/schema.js +0 -76
- package/body-cell/body-cell-boolean.d.ts +0 -2
- package/body-cell/body-cell-boolean.js +0 -18
- package/body-cell/body-cell-chip.d.ts +0 -12
- package/body-cell/body-cell-chip.js +0 -21
- package/body-cell/body-cell-date.d.ts +0 -2
- package/body-cell/body-cell-date.js +0 -15
- package/body-cell/body-cell-datetime.d.ts +0 -2
- package/body-cell/body-cell-datetime.js +0 -15
- package/body-cell/body-cell-default.d.ts +0 -2
- package/body-cell/body-cell-default.js +0 -17
- package/body-cell/body-cell-email.d.ts +0 -2
- package/body-cell/body-cell-email.js +0 -16
- package/body-cell/body-cell-money.d.ts +0 -8
- package/body-cell/body-cell-money.js +0 -15
- package/body-cell/body-cell-phone.d.ts +0 -2
- package/body-cell/body-cell-phone.js +0 -16
- package/body-cell/body-cell-to-many.d.ts +0 -2
- package/body-cell/body-cell-to-many.js +0 -17
- package/body-cell/body-cell-to-one.d.ts +0 -2
- package/body-cell/body-cell-to-one.js +0 -14
- package/body-cell/body-cell-url.d.ts +0 -2
- package/body-cell/body-cell-url.js +0 -16
- package/body-cell/index.d.ts +0 -2
- package/body-cell/index.js +0 -33
- package/components.d.ts +0 -97
- package/components.js +0 -124
- package/data-grid-custom-example.stories.d.ts +0 -2
- package/data-grid-custom-example.stories.js +0 -58
- package/data-grid-v2.d.ts +0 -3
- package/data-grid-v2.js +0 -41
- package/data-grid-v2.stories.d.ts +0 -2
- package/data-grid-v2.stories.js +0 -99
- package/data-grid.d.ts +0 -3
- package/data-grid.js +0 -42
- package/data-grid.stories.d.ts +0 -2
- package/data-grid.stories.js +0 -106
- package/export-button/export-button.d.ts +0 -8
- package/export-button/export-button.js +0 -16
- package/export-button/export-button.stories.d.ts +0 -2
- package/export-button/export-button.stories.js +0 -17
- package/export-button/index.d.ts +0 -1
- package/export-button/index.js +0 -17
- package/filter-handler/boolean-select.d.ts +0 -4
- package/filter-handler/boolean-select.js +0 -24
- package/filter-handler/checkbox.d.ts +0 -4
- package/filter-handler/checkbox.js +0 -19
- package/filter-handler/date.d.ts +0 -7
- package/filter-handler/date.js +0 -96
- package/filter-handler/datetime.d.ts +0 -7
- package/filter-handler/datetime.js +0 -34
- package/filter-handler/entity-multi-select.d.ts +0 -5
- package/filter-handler/entity-multi-select.js +0 -27
- package/filter-handler/entity-select.d.ts +0 -5
- package/filter-handler/entity-select.js +0 -23
- package/filter-handler/index.d.ts +0 -4
- package/filter-handler/index.js +0 -41
- package/filter-handler/interval.d.ts +0 -7
- package/filter-handler/interval.js +0 -47
- package/filter-handler/multi-select.d.ts +0 -5
- package/filter-handler/multi-select.js +0 -27
- package/filter-handler/select.d.ts +0 -5
- package/filter-handler/select.js +0 -22
- package/filter-handler/string.d.ts +0 -4
- package/filter-handler/string.js +0 -26
- package/filter-handler/types.d.ts +0 -7
- package/filter-handler/types.js +0 -2
- package/filter-list/filter-list.d.ts +0 -10
- package/filter-list/filter-list.js +0 -31
- package/filter-list/filter-list.stories.d.ts +0 -2
- package/filter-list/filter-list.stories.js +0 -18
- package/filter-list/index.d.ts +0 -1
- package/filter-list/index.js +0 -17
- package/filters/filters.d.ts +0 -9
- package/filters/filters.js +0 -21
- package/filters/filters.stories.d.ts +0 -2
- package/filters/filters.stories.js +0 -18
- package/filters/index.d.ts +0 -1
- package/filters/index.js +0 -17
- package/filters-button/filters-button.d.ts +0 -10
- package/filters-button/filters-button.js +0 -45
- package/filters-button/filters-button.stories.d.ts +0 -2
- package/filters-button/filters-button.stories.js +0 -18
- package/filters-button/index.d.ts +0 -1
- package/filters-button/index.js +0 -17
- package/footer/footer.d.ts +0 -5
- package/footer/footer.js +0 -10
- package/footer/index.d.ts +0 -1
- package/footer/index.js +0 -17
- package/fulltext-input/fulltext-input.d.ts +0 -6
- package/fulltext-input/fulltext-input.js +0 -13
- package/fulltext-input/fulltext-input.stories.d.ts +0 -2
- package/fulltext-input/fulltext-input.stories.js +0 -17
- package/fulltext-input/index.d.ts +0 -1
- package/fulltext-input/index.js +0 -17
- package/hidden-columns/hidden-columns.d.ts +0 -8
- package/hidden-columns/hidden-columns.js +0 -35
- package/hidden-columns/hidden-columns.stories.d.ts +0 -2
- package/hidden-columns/hidden-columns.stories.js +0 -17
- package/hidden-columns/index.d.ts +0 -1
- package/hidden-columns/index.js +0 -17
- package/hidden-columns-button/hidden-columns-button.d.ts +0 -8
- package/hidden-columns-button/hidden-columns-button.js +0 -42
- package/hidden-columns-button/hidden-columns-button.stories.d.ts +0 -2
- package/hidden-columns-button/hidden-columns-button.stories.js +0 -17
- package/hidden-columns-button/index.d.ts +0 -1
- package/hidden-columns-button/index.js +0 -17
- package/hooks/useCallbackRef.d.ts +0 -2
- package/hooks/useCallbackRef.js +0 -6
- package/index.d.ts +0 -5
- package/index.js +0 -25
- package/linear-progress/index.d.ts +0 -1
- package/linear-progress/index.js +0 -17
- package/linear-progress/linear-progress.d.ts +0 -5
- package/linear-progress/linear-progress.js +0 -12
- package/pagination/index.d.ts +0 -1
- package/pagination/index.js +0 -17
- package/pagination/pagination.d.ts +0 -12
- package/pagination/pagination.js +0 -15
- package/pagination/pagination.stories.d.ts +0 -2
- package/pagination/pagination.stories.js +0 -17
- package/root/index.d.ts +0 -1
- package/root/index.js +0 -17
- package/root/root.d.ts +0 -6
- package/root/root.js +0 -11
- package/row-counts/index.d.ts +0 -1
- package/row-counts/index.js +0 -17
- package/row-counts/row-counts.d.ts +0 -8
- package/row-counts/row-counts.js +0 -23
- package/row-counts/row-counts.stories.d.ts +0 -2
- package/row-counts/row-counts.stories.js +0 -14
- package/rows-per-page-select/index.d.ts +0 -1
- package/rows-per-page-select/index.js +0 -17
- package/rows-per-page-select/rows-per-page-select.d.ts +0 -3
- package/rows-per-page-select/rows-per-page-select.js +0 -19
- package/rows-per-page-select/rows-per-page-select.stories.d.ts +0 -2
- package/rows-per-page-select/rows-per-page-select.stories.js +0 -17
- package/selected-rows-toolbar/index.d.ts +0 -1
- package/selected-rows-toolbar/index.js +0 -17
- package/selected-rows-toolbar/selected-rows-toolbar.d.ts +0 -11
- package/selected-rows-toolbar/selected-rows-toolbar.js +0 -31
- package/selected-rows-toolbar/selected-rows-toolbar.stories.d.ts +0 -2
- package/selected-rows-toolbar/selected-rows-toolbar.stories.js +0 -44
- package/table/components/action-cell-wrapper.d.ts +0 -6
- package/table/components/action-cell-wrapper.js +0 -57
- 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 -40
- 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 -86
- 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 -14
- package/table/table.d.ts +0 -4
- package/table/table.js +0 -91
- 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/table-v2/components/action-cell-wrapper.d.ts +0 -6
- package/table-v2/components/action-cell-wrapper.js +0 -10
- package/table-v2/components/action-cell.d.ts +0 -8
- package/table-v2/components/action-cell.js +0 -16
- package/table-v2/components/body.d.ts +0 -6
- package/table-v2/components/body.js +0 -10
- package/table-v2/components/cell.d.ts +0 -8
- package/table-v2/components/cell.js +0 -10
- package/table-v2/components/header-action-cell.d.ts +0 -2
- package/table-v2/components/header-action-cell.js +0 -10
- package/table-v2/components/header-cell.d.ts +0 -10
- package/table-v2/components/header-cell.js +0 -47
- package/table-v2/components/header-select-all-rows-checkbox.d.ts +0 -8
- package/table-v2/components/header-select-all-rows-checkbox.js +0 -22
- package/table-v2/components/header.d.ts +0 -6
- package/table-v2/components/header.js +0 -10
- package/table-v2/components/index.d.ts +0 -21
- package/table-v2/components/index.js +0 -26
- package/table-v2/components/root.d.ts +0 -7
- package/table-v2/components/root.js +0 -31
- package/table-v2/components/row.d.ts +0 -7
- package/table-v2/components/row.js +0 -11
- package/table-v2/components/select-row-checkbox.d.ts +0 -7
- package/table-v2/components/select-row-checkbox.js +0 -12
- package/table-v2/hooks/use-resizable-columns.d.ts +0 -9
- package/table-v2/hooks/use-resizable-columns.js +0 -69
- package/table-v2/index.d.ts +0 -1
- package/table-v2/index.js +0 -17
- package/table-v2/no-rows-fallback.d.ts +0 -7
- package/table-v2/no-rows-fallback.js +0 -14
- package/table-v2/table-v2.d.ts +0 -3
- package/table-v2/table-v2.js +0 -91
- package/table-v2/table-v2.stories.d.ts +0 -2
- package/table-v2/table-v2.stories.js +0 -23
- package/table-v2/types.d.ts +0 -23
- package/table-v2/types.js +0 -2
- package/table-v2/utils/get-grid-template-columns.d.ts +0 -9
- package/table-v2/utils/get-grid-template-columns.js +0 -23
- package/table-v2/utils/get-grid-template-rows.d.ts +0 -2
- package/table-v2/utils/get-grid-template-rows.js +0 -14
- package/toolbar/index.d.ts +0 -1
- package/toolbar/index.js +0 -17
- package/toolbar/toolbar.d.ts +0 -5
- package/toolbar/toolbar.js +0 -10
- package/toolbar-control/index.d.ts +0 -1
- package/toolbar-control/index.js +0 -17
- package/toolbar-control/toolbar-control.d.ts +0 -13
- package/toolbar-control/toolbar-control.js +0 -22
- package/toolbar-control/toolbar-control.stories.d.ts +0 -2
- package/toolbar-control/toolbar-control.stories.js +0 -19
- package/toolbar-customs/index.d.ts +0 -1
- package/toolbar-customs/index.js +0 -17
- package/toolbar-customs/toolbar-customs.d.ts +0 -13
- package/toolbar-customs/toolbar-customs.js +0 -20
- package/toolbar-customs/toolbar-customs.stories.d.ts +0 -2
- package/toolbar-customs/toolbar-customs.stories.js +0 -15
- package/toolbar-tabs/index.d.ts +0 -1
- package/toolbar-tabs/index.js +0 -17
- package/toolbar-tabs/toolbar-tabs.d.ts +0 -11
- package/toolbar-tabs/toolbar-tabs.js +0 -41
- package/toolbar-tabs/toolbar-tabs.stories.d.ts +0 -2
- package/toolbar-tabs/toolbar-tabs.stories.js +0 -17
- package/types/api.d.ts +0 -23
- package/types/api.js +0 -2
- package/types/components.d.ts +0 -32
- package/types/components.js +0 -2
- package/types/core.d.ts +0 -20
- package/types/core.js +0 -2
- package/types/data-grid-props.d.ts +0 -34
- package/types/data-grid-props.js +0 -2
- package/types/index.d.ts +0 -6
- package/types/index.js +0 -2
- package/types/schema.d.ts +0 -56
- package/types/schema.js +0 -2
- package/types/state.d.ts +0 -25
- package/types/state.js +0 -2
- package/types/user-config-storage-adapter.d.ts +0 -8
- package/types/user-config-storage-adapter.js +0 -2
- package/use-data-grid-control/action.d.ts +0 -47
- package/use-data-grid-control/action.js +0 -9
- package/use-data-grid-control/actions-factory.d.ts +0 -21
- package/use-data-grid-control/actions-factory.js +0 -21
- package/use-data-grid-control/index.d.ts +0 -1
- package/use-data-grid-control/index.js +0 -17
- package/use-data-grid-control/use-data-grid-control.d.ts +0 -32
- package/use-data-grid-control/use-data-grid-control.js +0 -12
- package/use-data-grid-control/use-middleware-reducer.d.ts +0 -3
- package/use-data-grid-control/use-middleware-reducer.js +0 -19
- package/use-data-grid-fetching/index.d.ts +0 -1
- package/use-data-grid-fetching/index.js +0 -17
- package/use-data-grid-fetching/loader.d.ts +0 -2
- package/use-data-grid-fetching/loader.js +0 -6
- package/use-data-grid-fetching/use-data-grid-fetching.d.ts +0 -24
- package/use-data-grid-fetching/use-data-grid-fetching.js +0 -40
- package/user-config-storage-adapters/local-storage.d.ts +0 -3
- package/user-config-storage-adapters/local-storage.js +0 -32
- package/utils/create-filter-component-props.d.ts +0 -4
- package/utils/create-filter-component-props.js +0 -15
- package/utils/get-config-key.d.ts +0 -2
- package/utils/get-config-key.js +0 -6
- package/utils/merge-schema-with-config.d.ts +0 -3
- package/utils/merge-schema-with-config.js +0 -30
- package/utils/merge-schema-with-config.test.d.ts +0 -1
- package/utils/merge-schema-with-config.test.js +0 -57
- package/utils.d.ts +0 -6
- package/utils.js +0 -37
|
@@ -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,86 +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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.useReactDataGridColumns = useReactDataGridColumns;
|
|
27
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
28
|
-
const react_1 = __importStar(require("react"));
|
|
29
|
-
const react_data_grid_1 = require("react-data-grid");
|
|
30
|
-
function useReactDataGridColumns(props, state) {
|
|
31
|
-
const { reload, schema, isRowSelectable, bodyCells, actionCell } = props;
|
|
32
|
-
const userConfigColumns = state.userConfig.columns;
|
|
33
|
-
return (0, react_1.useMemo)(() => {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
35
|
-
const columns = [];
|
|
36
|
-
if (isRowSelectable) {
|
|
37
|
-
columns.push(react_data_grid_1.SelectColumn);
|
|
38
|
-
}
|
|
39
|
-
for (const schemaColumn of schema.columns) {
|
|
40
|
-
if (schemaColumn.hidden) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
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;
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
45
|
-
if (isHidden) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
columns.push({
|
|
49
|
-
key: schemaColumn.name,
|
|
50
|
-
name: schemaColumn.label,
|
|
51
|
-
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}`),
|
|
52
|
-
resizable: true,
|
|
53
|
-
sortable: schemaColumn.sort,
|
|
54
|
-
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,
|
|
55
|
-
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,
|
|
56
|
-
cellClass: (0, cx_1.cx)("uxf-data-grid__cell", `uxf-data-grid__cell--type-${schemaColumn.type}`, `uxf-data-grid__cell--name-${schemaColumn.name}`),
|
|
57
|
-
renderCell: (p) => {
|
|
58
|
-
var _a;
|
|
59
|
-
const columnType = schemaColumn.type;
|
|
60
|
-
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;
|
|
61
|
-
if (!BodyCell) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return (react_1.default.createElement(BodyCell, { column: {
|
|
65
|
-
name: p.column.key,
|
|
66
|
-
label: p.column.name,
|
|
67
|
-
sort: p.column.sortable,
|
|
68
|
-
type: columnType,
|
|
69
|
-
}, reload: reload, row: p.row, value: p.row[p.column.key] }));
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
if (actionCell) {
|
|
74
|
-
columns.push({
|
|
75
|
-
key: "__action_column",
|
|
76
|
-
name: "",
|
|
77
|
-
resizable: false,
|
|
78
|
-
headerCellClass: "uxf-data-grid__action-cell",
|
|
79
|
-
cellClass: "uxf-data-grid__action-cell",
|
|
80
|
-
width: actionCell.width,
|
|
81
|
-
renderCell: (p) => react_1.default.createElement(actionCell.Component, { reload: reload, row: p.row }),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return columns;
|
|
85
|
-
}, [userConfigColumns, actionCell, schema.columns, bodyCells, isRowSelectable, reload, state.userConfig.columns]);
|
|
86
|
-
}
|
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,14 +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 cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
-
const icon_1 = require("@uxf/ui/icon");
|
|
9
|
-
const react_1 = __importDefault(require("react"));
|
|
10
|
-
function NoRowsFallback(props) {
|
|
11
|
-
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, "Na\u010D\u00EDt\u00E1m...")) : props.error ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
-
react_1.default.createElement(icon_1.Icon, { name: "warning", size: 24 }),
|
|
13
|
-
react_1.default.createElement("p", null, "Vyskytla se chyba"))) : (react_1.default.createElement(react_1.default.Fragment, null, "\u017D\u00E1dn\u00E9 z\u00E1znamy"))));
|
|
14
|
-
}
|
package/table/table.d.ts
DELETED
package/table/table.js
DELETED
|
@@ -1,91 +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 (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.DataGridTable = DataGridTable;
|
|
31
|
-
const show_1 = require("@uxf/core-react/components/show");
|
|
32
|
-
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
33
|
-
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
34
|
-
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
35
|
-
const react_1 = __importStar(require("react"));
|
|
36
|
-
const react_data_grid_1 = __importDefault(require("react-data-grid"));
|
|
37
|
-
const select_row_checkbox_1 = require("./components/select-row-checkbox");
|
|
38
|
-
const use_rdg_visuals_1 = require("./hooks/use-rdg-visuals");
|
|
39
|
-
const use_react_data_grid_columns_1 = require("./hooks/use-react-data-grid-columns");
|
|
40
|
-
const no_rows_fallback_1 = require("./no-rows-fallback");
|
|
41
|
-
const defaultKeyExtractor = (r) => r.id;
|
|
42
|
-
const DefaultNoRowsFallback = no_rows_fallback_1.NoRowsFallback;
|
|
43
|
-
/** @deprecated will be remove, use DataGridTableV2 */
|
|
44
|
-
function DataGridTable(props) {
|
|
45
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
46
|
-
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
47
|
-
const rowHeight = (_a = props.rowHeight) !== null && _a !== void 0 ? _a : 44;
|
|
48
|
-
const headerRowHeight = (_b = props.headerRowHeight) !== null && _b !== void 0 ? _b : 36;
|
|
49
|
-
const keyExtractor = (_c = props.keyExtractor) !== null && _c !== void 0 ? _c : defaultKeyExtractor;
|
|
50
|
-
const contentHeight = typeof rowHeight === "function"
|
|
51
|
-
? props.data.reduce((prev, curr) => prev + rowHeight(curr))
|
|
52
|
-
: (rowHeight + 1) * props.data.length;
|
|
53
|
-
const reactDataGridStyles = {
|
|
54
|
-
height: contentHeight + headerRowHeight + (props.data.length === 0 ? 44 : 0) + 4,
|
|
55
|
-
overflowY: "hidden",
|
|
56
|
-
};
|
|
57
|
-
const NoRowsFallback = (_d = props.NoRowsFallback) !== null && _d !== void 0 ? _d : DefaultNoRowsFallback;
|
|
58
|
-
const isLoading = Boolean(props.isLoading);
|
|
59
|
-
const error = props.error;
|
|
60
|
-
const components = (0, react_1.useMemo)(() => ({
|
|
61
|
-
renderCheckbox: (args) => react_1.default.createElement(select_row_checkbox_1.SelectRowCheckbox, { ...args }),
|
|
62
|
-
noRowsFallback: react_1.default.createElement(NoRowsFallback, { error: error, isLoading: isLoading }),
|
|
63
|
-
}), [NoRowsFallback, error, isLoading]);
|
|
64
|
-
const columns = (0, use_react_data_grid_columns_1.useReactDataGridColumns)(props, props.state);
|
|
65
|
-
const onSelectRows = (value) => {
|
|
66
|
-
const selectedRows = Array.from(value).map((id) => {
|
|
67
|
-
var _a, _b;
|
|
68
|
-
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);
|
|
69
|
-
});
|
|
70
|
-
props.actions.setSelectedRows(selectedRows);
|
|
71
|
-
};
|
|
72
|
-
const onSortColumnChange = (sortColumns) => {
|
|
73
|
-
const firstSortColumn = sortColumns.at(0);
|
|
74
|
-
if ((0, is_not_nil_1.isNotNil)(firstSortColumn)) {
|
|
75
|
-
props.actions.sort(firstSortColumn.columnKey, firstSortColumn.direction.toLowerCase());
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
props.actions.sortClear();
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const sortColumns = props.state.request.s
|
|
82
|
-
? [{ columnKey: props.state.request.s.name, direction: props.state.request.s.dir.toUpperCase() }]
|
|
83
|
-
: empty_array_1.EMPTY_ARRAY;
|
|
84
|
-
const rdgVisuals = (0, use_rdg_visuals_1.useRdgVisuals)({
|
|
85
|
-
headerRowHeight: props.headerRowHeight,
|
|
86
|
-
rowHeight: props.rowHeight,
|
|
87
|
-
rows: props.data,
|
|
88
|
-
});
|
|
89
|
-
return (react_1.default.createElement(show_1.Show, { when: isMounted },
|
|
90
|
-
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 })));
|
|
91
|
-
}
|
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
|
@@ -1,10 +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.ActionCellWrapper = ActionCellWrapper;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
function ActionCellWrapper(props) {
|
|
9
|
-
return react_1.default.createElement("div", { className: "uxf-dg-table__action-cell" }, props.children);
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ButtonListProps } from "@uxf/ui/button-list";
|
|
2
|
-
import React, { ReactNode } from "react";
|
|
3
|
-
export interface ActionCellProps {
|
|
4
|
-
children?: ReactNode;
|
|
5
|
-
buttons?: ButtonListProps["buttons"];
|
|
6
|
-
visibleButtonsCount?: ButtonListProps["visibleButtonsCount"];
|
|
7
|
-
}
|
|
8
|
-
export declare function ActionCell(props: ActionCellProps): 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.ActionCell = ActionCell;
|
|
7
|
-
const is_not_empty_1 = require("@uxf/core/utils/is-not-empty");
|
|
8
|
-
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
9
|
-
const button_list_1 = require("@uxf/ui/button-list");
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
function ActionCell(props) {
|
|
12
|
-
var _a;
|
|
13
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
14
|
-
(0, is_not_nil_1.isNotNil)(props.buttons) && (0, is_not_empty_1.isNotEmpty)(props.buttons) && (react_1.default.createElement(button_list_1.ButtonList, { buttons: props.buttons, size: "sm", variant: "secondary", visibleButtonsCount: (_a = props.visibleButtonsCount) !== null && _a !== void 0 ? _a : 0 })),
|
|
15
|
-
props.children));
|
|
16
|
-
}
|
|
@@ -1,10 +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.Body = Body;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
function Body(props) {
|
|
9
|
-
return react_1.default.createElement("div", { className: "uxf-dg-table__body" }, props.children);
|
|
10
|
-
}
|
|
@@ -1,10 +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.Cell = Cell;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
function Cell(props) {
|
|
9
|
-
return react_1.default.createElement("div", { className: `uxf-dg-table__cell uxf-dg-table__cell--type-${props.column.type}` }, props.children);
|
|
10
|
-
}
|
|
@@ -1,10 +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.HeaderActionCell = HeaderActionCell;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
function HeaderActionCell() {
|
|
9
|
-
return react_1.default.createElement("div", { className: "uxf-dg-table__action-cell uxf-dg-table__action-cell--header" });
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Column, DataGridSort } from "../../types";
|
|
4
|
-
export interface HeaderCellProps {
|
|
5
|
-
column: Column<any, any>;
|
|
6
|
-
onResizeStart: () => void;
|
|
7
|
-
sort: DataGridSort | Nullish;
|
|
8
|
-
onClick?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const HeaderCell: React.ForwardRefExoticComponent<HeaderCellProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,47 +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 (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.HeaderCell = void 0;
|
|
27
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
28
|
-
const icon_1 = require("@uxf/ui/icon");
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
function HeaderCellComponent(props, ref) {
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
|
-
const iconName = !props.column.sort
|
|
33
|
-
? null
|
|
34
|
-
: ((_a = props.sort) === null || _a === void 0 ? void 0 : _a.dir) === "asc"
|
|
35
|
-
? "sort-up"
|
|
36
|
-
: ((_b = props.sort) === null || _b === void 0 ? void 0 : _b.dir) === "desc"
|
|
37
|
-
? "sort-down"
|
|
38
|
-
: "sort";
|
|
39
|
-
return (
|
|
40
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
41
|
-
react_1.default.createElement("div", { className: (0, cx_1.cx)(`uxf-dg-table__cell uxf-dg-table__cell--header uxf-dg-table__cell--type-${props.column.type}`, props.column.sort && "is-sortable", ((_c = props.sort) === null || _c === void 0 ? void 0 : _c.dir) === "asc" && "is-sorted-asc", ((_d = props.sort) === null || _d === void 0 ? void 0 : _d.dir) === "desc" && "is-sorted-desc"), onClick: props.onClick, ref: ref },
|
|
42
|
-
props.column.label,
|
|
43
|
-
iconName && react_1.default.createElement(icon_1.Icon, { className: "ml-auto", name: iconName }),
|
|
44
|
-
react_1.default.createElement("button", { className: "uxf-dg-table__column-resize-handle", onClick: (event) => event.stopPropagation(), onMouseDown: props.onResizeStart })));
|
|
45
|
-
}
|
|
46
|
-
exports.HeaderCell = (0, react_1.forwardRef)(HeaderCellComponent);
|
|
47
|
-
exports.HeaderCell.displayName = "HeaderCell";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { KeyExtractor } from "../../types";
|
|
3
|
-
import { DataGridTableProps } from "../types";
|
|
4
|
-
interface SelectRowCheckboxProps extends Pick<DataGridTableProps<any>, "state" | "data" | "actions"> {
|
|
5
|
-
keyExtractor: KeyExtractor;
|
|
6
|
-
}
|
|
7
|
-
export declare function HeaderSelectAllRowsCheckbox(props: SelectRowCheckboxProps): React.JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,22 +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.HeaderSelectAllRowsCheckbox = HeaderSelectAllRowsCheckbox;
|
|
7
|
-
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
8
|
-
const is_not_empty_1 = require("@uxf/core/utils/is-not-empty");
|
|
9
|
-
const checkbox_input_1 = require("@uxf/ui/checkbox-input");
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
function HeaderSelectAllRowsCheckbox(props) {
|
|
12
|
-
var _a;
|
|
13
|
-
const selectedRows = (_a = props.state.selectedRows) !== null && _a !== void 0 ? _a : empty_array_1.EMPTY_ARRAY;
|
|
14
|
-
const isAllRowsSelected = (0, is_not_empty_1.isNotEmpty)(props.data) &&
|
|
15
|
-
props.data.every((row) => selectedRows.find((selectedRow) => props.keyExtractor(row) === props.keyExtractor(selectedRow)));
|
|
16
|
-
const isIndeterminate = !isAllRowsSelected && (0, is_not_empty_1.isNotEmpty)(selectedRows);
|
|
17
|
-
const selectAllRowsHandler = () => {
|
|
18
|
-
props.actions.setSelectedRows(isAllRowsSelected ? [] : props.data);
|
|
19
|
-
};
|
|
20
|
-
return (react_1.default.createElement("div", { className: "uxf-dg-table__cell uxf-dg-table__cell--header uxf-dg-table__select-all-rows-cell" },
|
|
21
|
-
react_1.default.createElement(checkbox_input_1.CheckboxInput, { hiddenLabel: true, indeterminate: isIndeterminate, label: "Vybrat v\u0161e", name: "select-all-rows", onChange: selectAllRowsHandler, value: isAllRowsSelected })));
|
|
22
|
-
}
|
|
@@ -1,10 +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.Header = Header;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
function Header(props) {
|
|
9
|
-
return react_1.default.createElement("div", { className: "uxf-dg-table__header" }, props.children);
|
|
10
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ActionCell } from "./action-cell";
|
|
2
|
-
import { ActionCellWrapper } from "./action-cell-wrapper";
|
|
3
|
-
import { Body } from "./body";
|
|
4
|
-
import { Cell } from "./cell";
|
|
5
|
-
import { Header } from "./header";
|
|
6
|
-
import { HeaderActionCell } from "./header-action-cell";
|
|
7
|
-
import { HeaderSelectAllRowsCheckbox } from "./header-select-all-rows-checkbox";
|
|
8
|
-
import { Row } from "./row";
|
|
9
|
-
import { SelectRowCheckbox } from "./select-row-checkbox";
|
|
10
|
-
export declare const Table: import("react").ForwardRefExoticComponent<import("./root").RootProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
11
|
-
Body: typeof Body;
|
|
12
|
-
Row: typeof Row;
|
|
13
|
-
HeaderCell: import("react").ForwardRefExoticComponent<import("./header-cell").HeaderCellProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
-
Cell: typeof Cell;
|
|
15
|
-
ActionCell: typeof ActionCell;
|
|
16
|
-
ActionCellWrapper: typeof ActionCellWrapper;
|
|
17
|
-
HeaderActionCell: typeof HeaderActionCell;
|
|
18
|
-
Header: typeof Header;
|
|
19
|
-
SelectRowCheckbox: typeof SelectRowCheckbox;
|
|
20
|
-
HeaderSelectAllRowsCheckbox: typeof HeaderSelectAllRowsCheckbox;
|
|
21
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Table = void 0;
|
|
4
|
-
const action_cell_1 = require("./action-cell");
|
|
5
|
-
const action_cell_wrapper_1 = require("./action-cell-wrapper");
|
|
6
|
-
const body_1 = require("./body");
|
|
7
|
-
const cell_1 = require("./cell");
|
|
8
|
-
const header_1 = require("./header");
|
|
9
|
-
const header_action_cell_1 = require("./header-action-cell");
|
|
10
|
-
const header_cell_1 = require("./header-cell");
|
|
11
|
-
const header_select_all_rows_checkbox_1 = require("./header-select-all-rows-checkbox");
|
|
12
|
-
const root_1 = require("./root");
|
|
13
|
-
const row_1 = require("./row");
|
|
14
|
-
const select_row_checkbox_1 = require("./select-row-checkbox");
|
|
15
|
-
exports.Table = Object.assign(root_1.Root, {
|
|
16
|
-
Body: body_1.Body,
|
|
17
|
-
Row: row_1.Row,
|
|
18
|
-
HeaderCell: header_cell_1.HeaderCell,
|
|
19
|
-
Cell: cell_1.Cell,
|
|
20
|
-
ActionCell: action_cell_1.ActionCell,
|
|
21
|
-
ActionCellWrapper: action_cell_wrapper_1.ActionCellWrapper,
|
|
22
|
-
HeaderActionCell: header_action_cell_1.HeaderActionCell,
|
|
23
|
-
Header: header_1.Header,
|
|
24
|
-
SelectRowCheckbox: select_row_checkbox_1.SelectRowCheckbox,
|
|
25
|
-
HeaderSelectAllRowsCheckbox: header_select_all_rows_checkbox_1.HeaderSelectAllRowsCheckbox,
|
|
26
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
export interface RootProps {
|
|
3
|
-
gridTemplateColumns: string;
|
|
4
|
-
gridTemplateRows?: string;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
|