@uxf/data-grid 11.35.0 → 11.37.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/_store/reducer.js +17 -14
- package/components.d.ts +4 -9
- package/components.js +25 -30
- package/data-grid-custom-example.stories.js +2 -2
- package/data-grid.js +7 -8
- package/data-grid.stories.js +3 -3
- package/export-button/export-button.d.ts +1 -3
- package/export-button/export-button.js +2 -5
- package/filter-list/filter-list.d.ts +2 -6
- package/filter-list/filter-list.js +2 -5
- package/filters/filters.d.ts +1 -3
- package/filters/filters.js +2 -5
- package/filters-button/filters-button.d.ts +1 -3
- package/filters-button/filters-button.js +2 -5
- package/footer/footer.d.ts +0 -2
- package/footer/footer.js +1 -3
- package/fulltext-input/fulltext-input.d.ts +1 -3
- package/fulltext-input/fulltext-input.js +2 -5
- package/linear-progress/linear-progress.d.ts +2 -6
- package/linear-progress/linear-progress.js +2 -5
- package/package.json +54 -54
- package/pagination/pagination.d.ts +2 -6
- package/pagination/pagination.js +2 -5
- package/root/root.d.ts +0 -2
- package/root/root.js +1 -2
- package/row-counts/row-counts.d.ts +2 -6
- package/row-counts/row-counts.js +2 -5
- package/rows-per-page-select/rows-per-page-select.d.ts +1 -3
- package/rows-per-page-select/rows-per-page-select.js +2 -5
- package/selected-rows-toolbar/selected-rows-toolbar.d.ts +2 -6
- package/selected-rows-toolbar/selected-rows-toolbar.js +2 -5
- package/styles.css +4 -12
- package/table/hooks/use-react-data-grid-columns.d.ts +2 -2
- package/table/hooks/use-react-data-grid-columns.js +1 -1
- package/table/table.d.ts +1 -3
- package/table/table.js +2 -5
- package/table/types.d.ts +1 -3
- package/table-v2/hooks/use-resizable-columns.js +6 -9
- package/table-v2/styles.css +6 -0
- package/table-v2/table-v2.d.ts +1 -3
- package/table-v2/table-v2.js +12 -15
- package/table-v2/types.d.ts +1 -3
- package/table-v2/utils/get-grid-template-columns.d.ts +6 -0
- package/table-v2/utils/get-grid-template-columns.js +14 -0
- package/table-v2/utils/get-grid-template-rows.d.ts +2 -2
- package/toolbar/toolbar.d.ts +0 -1
- package/toolbar/toolbar.js +1 -3
- package/toolbar-control/toolbar-control.d.ts +2 -6
- package/toolbar-control/toolbar-control.js +2 -5
- package/toolbar-customs/toolbar-customs.d.ts +2 -6
- package/toolbar-customs/toolbar-customs.js +2 -5
- package/toolbar-tabs/toolbar-tabs.d.ts +4 -6
- package/toolbar-tabs/toolbar-tabs.js +8 -10
- package/types/components.d.ts +1 -0
- package/types/data-grid-props.d.ts +2 -3
- package/types/index.d.ts +6 -6
- package/types/index.js +0 -20
- package/types/schema.d.ts +0 -5
- package/types/schema.js +0 -7
- package/use-data-grid-control/actions-factory.d.ts +2 -1
- package/use-data-grid-control/actions-factory.js +1 -1
- package/use-data-grid-control/use-data-grid-control.d.ts +1 -1
- package/data-grid-v2.d.ts +0 -3
- package/data-grid-v2.js +0 -43
- package/data-grid-v2.stories.d.ts +0 -2
- package/data-grid-v2.stories.js +0 -92
- package/utils/classes.d.ts +0 -1
- package/utils/classes.js +0 -4
|
@@ -2,15 +2,11 @@ import { Nullish } from "@uxf/core/types";
|
|
|
2
2
|
import { PaginationSizes } from "@uxf/ui/pagination/theme";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { DataGridControl } from "../use-data-grid-control";
|
|
5
|
-
|
|
6
|
-
interface PaginationProps extends DataGridControl {
|
|
5
|
+
interface DataGridPaginationProps extends DataGridControl {
|
|
7
6
|
count: number | Nullish;
|
|
8
7
|
showFirstButton?: boolean;
|
|
9
8
|
showLastButton?: boolean;
|
|
10
9
|
size?: keyof PaginationSizes;
|
|
11
10
|
}
|
|
12
|
-
export
|
|
13
|
-
/** @deprecated Use DataGridPagination */
|
|
14
|
-
export declare function Pagination(props: PaginationProps): React.JSX.Element;
|
|
15
|
-
export declare const DataGridPagination: typeof Pagination;
|
|
11
|
+
export declare function DataGridPagination(props: DataGridPaginationProps): React.JSX.Element;
|
|
16
12
|
export {};
|
package/pagination/pagination.js
CHANGED
|
@@ -3,16 +3,13 @@ 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.DataGridPagination =
|
|
7
|
-
exports.Pagination = Pagination;
|
|
6
|
+
exports.DataGridPagination = DataGridPagination;
|
|
8
7
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
9
8
|
const pagination_1 = require("@uxf/ui/pagination");
|
|
10
9
|
const react_1 = __importDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
function Pagination(props) {
|
|
10
|
+
function DataGridPagination(props) {
|
|
13
11
|
const pageCount = (0, is_not_nil_1.isNotNil)(props.count) && props.count > 0
|
|
14
12
|
? Math.max(Math.ceil(props.count / props.state.request.perPage), 1)
|
|
15
13
|
: 1;
|
|
16
14
|
return (react_1.default.createElement(pagination_1.Pagination, { count: pageCount, onPageChange: (value) => props.actions.changePage(value - 1), page: props.state.request.page + 1, showFirstButton: props.showFirstButton, showLastButton: props.showLastButton, size: props.size }));
|
|
17
15
|
}
|
|
18
|
-
exports.DataGridPagination = Pagination;
|
package/root/root.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
export interface DataGridRootProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
/** @deprecated will be remove, create custom data grid https://fe.uxf.dev/docs/data-grid/data-grid-custom-example */
|
|
5
|
-
noBorder?: boolean;
|
|
6
4
|
className?: string;
|
|
7
5
|
}
|
|
8
6
|
export declare function DataGridRoot(props: DataGridRootProps): React.JSX.Element;
|
package/root/root.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.DataGridRoot = DataGridRoot;
|
|
7
7
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const classes_1 = require("../utils/classes");
|
|
10
9
|
function DataGridRoot(props) {
|
|
11
|
-
return
|
|
10
|
+
return react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-data-grid", props.className) }, props.children);
|
|
12
11
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DataGridControl } from "../use-data-grid-control";
|
|
3
|
-
|
|
4
|
-
export interface RowCountsProps {
|
|
3
|
+
export interface DataGridRowCountsProps {
|
|
5
4
|
state: DataGridControl["state"];
|
|
6
5
|
totalCount: number;
|
|
7
6
|
count: number;
|
|
8
7
|
}
|
|
9
|
-
export
|
|
10
|
-
/** @deprecated Use DataGridRowCounts */
|
|
11
|
-
export declare function RowCounts(props: RowCountsProps): React.JSX.Element;
|
|
12
|
-
export declare const DataGridRowCounts: typeof RowCounts;
|
|
8
|
+
export declare function DataGridRowCounts(props: DataGridRowCountsProps): React.JSX.Element;
|
package/row-counts/row-counts.js
CHANGED
|
@@ -3,12 +3,10 @@ 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.DataGridRowCounts =
|
|
7
|
-
exports.RowCounts = RowCounts;
|
|
6
|
+
exports.DataGridRowCounts = DataGridRowCounts;
|
|
8
7
|
const show_1 = require("@uxf/core-react/components/show");
|
|
9
8
|
const react_1 = __importDefault(require("react"));
|
|
10
|
-
|
|
11
|
-
function RowCounts(props) {
|
|
9
|
+
function DataGridRowCounts(props) {
|
|
12
10
|
const fromNumber = props.state.request.page * props.state.request.perPage + 1;
|
|
13
11
|
const toNumber = Math.min(props.state.request.page * props.state.request.perPage + props.state.request.perPage, props.totalCount);
|
|
14
12
|
return (react_1.default.createElement("p", { className: "uxf-data-grid__pagination-counts" },
|
|
@@ -23,4 +21,3 @@ function RowCounts(props) {
|
|
|
23
21
|
props.totalCount,
|
|
24
22
|
")")));
|
|
25
23
|
}
|
|
26
|
-
exports.DataGridRowCounts = RowCounts;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DataGridControl } from "../use-data-grid-control";
|
|
3
|
-
|
|
4
|
-
export declare function RowsPerPageSelect(props: DataGridControl): React.JSX.Element;
|
|
5
|
-
export declare const DataGridRowsPerPageSelect: typeof RowsPerPageSelect;
|
|
3
|
+
export declare function DataGridRowsPerPageSelect(props: DataGridControl): React.JSX.Element;
|
|
@@ -3,8 +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.DataGridRowsPerPageSelect =
|
|
7
|
-
exports.RowsPerPageSelect = RowsPerPageSelect;
|
|
6
|
+
exports.DataGridRowsPerPageSelect = DataGridRowsPerPageSelect;
|
|
8
7
|
const select_1 = require("@uxf/ui/select");
|
|
9
8
|
const react_1 = __importDefault(require("react"));
|
|
10
9
|
const PER_PAGE_OPTIONS = [
|
|
@@ -13,10 +12,8 @@ const PER_PAGE_OPTIONS = [
|
|
|
13
12
|
{ id: 50, label: "50" },
|
|
14
13
|
{ id: 100, label: "100" },
|
|
15
14
|
];
|
|
16
|
-
|
|
17
|
-
function RowsPerPageSelect(props) {
|
|
15
|
+
function DataGridRowsPerPageSelect(props) {
|
|
18
16
|
return (react_1.default.createElement("div", { className: "uxf-data-grid__rows-per-page" },
|
|
19
17
|
react_1.default.createElement("label", { htmlFor: "uxf-data-grid--select-per-page" }, "Po\u010Det \u0159\u00E1dk\u016F"),
|
|
20
18
|
react_1.default.createElement(select_1.Select, { hiddenLabel: true, id: "uxf-data-grid--select-per-page", label: "Po\u010Det \u0159\u00E1dk\u016F", name: "rows-per-page", onChange: (value) => props.actions.changePerPage(value !== null && value !== void 0 ? value : 10), options: PER_PAGE_OPTIONS, size: "small", value: props.state.request.perPage })));
|
|
21
19
|
}
|
|
22
|
-
exports.DataGridRowsPerPageSelect = RowsPerPageSelect;
|
|
@@ -4,12 +4,8 @@ export interface SelectedRowsToolbarActionsProps extends DataGridControl {
|
|
|
4
4
|
reload: () => void;
|
|
5
5
|
}
|
|
6
6
|
export type SelectedRowsToolbarActionsComponent = FC<SelectedRowsToolbarActionsProps>;
|
|
7
|
-
|
|
8
|
-
export interface SelectedRowsToolbarProps extends DataGridControl {
|
|
7
|
+
export interface DataGridSelectedRowsToolbarProps extends DataGridControl {
|
|
9
8
|
Actions?: SelectedRowsToolbarActionsComponent;
|
|
10
9
|
onReload?: () => void;
|
|
11
10
|
}
|
|
12
|
-
export
|
|
13
|
-
/** @deprecated Use DataGridSelectedRowsToolbar */
|
|
14
|
-
export declare function SelectedRowsToolbar(props: SelectedRowsToolbarProps): React.JSX.Element | null;
|
|
15
|
-
export declare const DataGridSelectedRowsToolbar: typeof SelectedRowsToolbar;
|
|
11
|
+
export declare function DataGridSelectedRowsToolbar(props: DataGridSelectedRowsToolbarProps): React.JSX.Element | null;
|
|
@@ -3,8 +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.DataGridSelectedRowsToolbar =
|
|
7
|
-
exports.SelectedRowsToolbar = SelectedRowsToolbar;
|
|
6
|
+
exports.DataGridSelectedRowsToolbar = DataGridSelectedRowsToolbar;
|
|
8
7
|
const button_1 = require("@uxf/ui/button");
|
|
9
8
|
const react_1 = __importDefault(require("react"));
|
|
10
9
|
const getText = (count) => {
|
|
@@ -16,8 +15,7 @@ const getText = (count) => {
|
|
|
16
15
|
}
|
|
17
16
|
return `Vybráno ${count} záznamů`;
|
|
18
17
|
};
|
|
19
|
-
|
|
20
|
-
function SelectedRowsToolbar(props) {
|
|
18
|
+
function DataGridSelectedRowsToolbar(props) {
|
|
21
19
|
if (!props.state.selectedRows) {
|
|
22
20
|
return null;
|
|
23
21
|
}
|
|
@@ -31,4 +29,3 @@ function SelectedRowsToolbar(props) {
|
|
|
31
29
|
props.Actions && (react_1.default.createElement(props.Actions, { actions: props.actions, reload: () => { var _a; return (_a = props.onReload) === null || _a === void 0 ? void 0 : _a.call(props); }, state: props.state })),
|
|
32
30
|
react_1.default.createElement(button_1.Button, { onClick: () => props.actions.setSelectedRows([]) }, "Zru\u0161it v\u00FDb\u011Br")))));
|
|
33
31
|
}
|
|
34
|
-
exports.DataGridSelectedRowsToolbar = SelectedRowsToolbar;
|
package/styles.css
CHANGED
|
@@ -35,10 +35,6 @@
|
|
|
35
35
|
border: 1px solid var(--rdg-border-color);
|
|
36
36
|
border-radius: theme("borderRadius.DEFAULT");
|
|
37
37
|
|
|
38
|
-
&.no-border {
|
|
39
|
-
border-style: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
&__action-cell {
|
|
43
39
|
background-color: var(--rdg-background-color);
|
|
44
40
|
border-inline-start: 1px solid var(--rdg-border-color);
|
|
@@ -321,10 +317,6 @@
|
|
|
321
317
|
justify-content: flex-end;
|
|
322
318
|
padding: theme("spacing.2");
|
|
323
319
|
|
|
324
|
-
&.no-border {
|
|
325
|
-
padding-right: 0;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
320
|
:root .dark & {
|
|
329
321
|
border-bottom-color: theme("colors.darkBorder");
|
|
330
322
|
}
|
|
@@ -489,17 +481,17 @@
|
|
|
489
481
|
}
|
|
490
482
|
|
|
491
483
|
&__hidden-columns-empty-box {
|
|
492
|
-
background-color:
|
|
493
|
-
border: theme("borderWidth.DEFAULT") solid
|
|
484
|
+
background-color: theme("colors.warning_surface_muted");
|
|
485
|
+
border: theme("borderWidth.DEFAULT") solid theme("colors.warning_border");
|
|
494
486
|
border-radius: theme("borderRadius.lg");
|
|
495
|
-
color:
|
|
487
|
+
color: theme("colors.base_text_high_emphasis");
|
|
496
488
|
display: flex;
|
|
497
489
|
gap: 12px;
|
|
498
490
|
margin: 8px 0;
|
|
499
491
|
padding: 8px 16px;
|
|
500
492
|
|
|
501
493
|
.uxf-icon {
|
|
502
|
-
color:
|
|
494
|
+
color: theme("colors.warning_icon_on_muted");
|
|
503
495
|
margin-top: 4px;
|
|
504
496
|
}
|
|
505
497
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Column } from "react-data-grid";
|
|
2
2
|
import { DataGridState } from "../../types";
|
|
3
|
-
import {
|
|
4
|
-
export declare function useReactDataGridColumns(props:
|
|
3
|
+
import { DataGridTableProps } from "../types";
|
|
4
|
+
export declare function useReactDataGridColumns(props: DataGridTableProps<any>, state: DataGridState<any>): Column<any>[];
|
|
@@ -46,7 +46,7 @@ function useReactDataGridColumns(props, state) {
|
|
|
46
46
|
continue;
|
|
47
47
|
}
|
|
48
48
|
columns.push({
|
|
49
|
-
key: schemaColumn.name,
|
|
49
|
+
key: schemaColumn.name,
|
|
50
50
|
name: schemaColumn.label,
|
|
51
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
52
|
resizable: true,
|
package/table/table.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DataGridTableProps } from "./types";
|
|
3
3
|
/** @deprecated will be remove, use DataGridTableV2 */
|
|
4
|
-
export declare function
|
|
5
|
-
/** @deprecated will be remove, use DataGridTableV2 */
|
|
6
|
-
export declare const DataGridTable: typeof Table;
|
|
4
|
+
export declare function DataGridTable(props: DataGridTableProps<any>): React.JSX.Element;
|
package/table/table.js
CHANGED
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DataGridTable =
|
|
30
|
-
exports.Table = Table;
|
|
29
|
+
exports.DataGridTable = DataGridTable;
|
|
31
30
|
const show_1 = require("@uxf/core-react/components/show");
|
|
32
31
|
const use_is_mounted_1 = require("@uxf/core-react/hooks/use-is-mounted");
|
|
33
32
|
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
@@ -41,7 +40,7 @@ const no_rows_fallback_1 = require("./no-rows-fallback");
|
|
|
41
40
|
const defaultKeyExtractor = (r) => r.id;
|
|
42
41
|
const DefaultNoRowsFallback = no_rows_fallback_1.NoRowsFallback;
|
|
43
42
|
/** @deprecated will be remove, use DataGridTableV2 */
|
|
44
|
-
function
|
|
43
|
+
function DataGridTable(props) {
|
|
45
44
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
46
45
|
const isMounted = (0, use_is_mounted_1.useIsMounted)();
|
|
47
46
|
const rowHeight = (_a = props.rowHeight) !== null && _a !== void 0 ? _a : 44;
|
|
@@ -91,5 +90,3 @@ function Table(props) {
|
|
|
91
90
|
return (react_1.default.createElement(show_1.Show, { when: isMounted },
|
|
92
91
|
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 })));
|
|
93
92
|
}
|
|
94
|
-
/** @deprecated will be remove, use DataGridTableV2 */
|
|
95
|
-
exports.DataGridTable = Table;
|
package/table/types.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ import { KeyExtractor } from "../types/core";
|
|
|
4
4
|
import { Schema } from "../types/schema";
|
|
5
5
|
import { DataGridControl } from "../use-data-grid-control";
|
|
6
6
|
import { NoRowsFallbackComponent } from "./no-rows-fallback";
|
|
7
|
-
|
|
8
|
-
export interface TableProps<Row> extends DataGridControl {
|
|
7
|
+
export interface DataGridTableProps<Row> extends DataGridControl {
|
|
9
8
|
schema: Schema<any>;
|
|
10
9
|
data: Row[];
|
|
11
10
|
isLoading?: boolean;
|
|
@@ -20,4 +19,3 @@ export interface TableProps<Row> extends DataGridControl {
|
|
|
20
19
|
NoRowsFallback?: NoRowsFallbackComponent;
|
|
21
20
|
isRowSelectable?: boolean;
|
|
22
21
|
}
|
|
23
|
-
export type DataGridTableProps<Row> = TableProps<Row>;
|
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useResizableColumns = useResizableColumns;
|
|
4
4
|
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
5
|
-
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
6
5
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
7
6
|
const rem_1 = require("@uxf/styles/units/rem");
|
|
8
7
|
const react_1 = require("react");
|
|
9
|
-
|
|
10
|
-
const normalizedColumnSizes = columnSizes.map((size) => ((0, is_not_nil_1.isNotNil)(size) ? (0, rem_1.rem)(size) : "1fr"));
|
|
11
|
-
const columnSizesWithSelectRows = (0, is_not_nil_1.isNotNil)(selectRowCheckboxWidth)
|
|
12
|
-
? `${(0, rem_1.rem)(selectRowCheckboxWidth)} ${normalizedColumnSizes.join(" ")}`
|
|
13
|
-
: normalizedColumnSizes.join(" ");
|
|
14
|
-
return (0, is_nil_1.isNil)(actionCellWidth) ? columnSizesWithSelectRows : `${columnSizesWithSelectRows} ${(0, rem_1.rem)(actionCellWidth)}`;
|
|
15
|
-
}
|
|
8
|
+
const get_grid_template_columns_1 = require("../utils/get-grid-template-columns");
|
|
16
9
|
function useResizableColumns(columns, actionCell, actions, selectRowsCellWidth) {
|
|
17
10
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(null);
|
|
18
11
|
const tableRef = (0, react_1.useRef)(null);
|
|
@@ -36,7 +29,11 @@ function useResizableColumns(columns, actionCell, actions, selectRowsCellWidth)
|
|
|
36
29
|
// TODO @vejvis - jak tohle udělat lépe??
|
|
37
30
|
tempColumnSizes = gridColumns;
|
|
38
31
|
if (tableRef.current) {
|
|
39
|
-
tableRef.current.style.gridTemplateColumns =
|
|
32
|
+
tableRef.current.style.gridTemplateColumns = (0, get_grid_template_columns_1.getGridTemplateColumns)({
|
|
33
|
+
actionColumnWidth: actionCellWidth,
|
|
34
|
+
columns: gridColumns.map((size) => ((0, is_not_nil_1.isNotNil)(size) ? (0, rem_1.rem)(size) : "1fr")),
|
|
35
|
+
selectRowColumnWidth: selectRowsCellWidth,
|
|
36
|
+
});
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
39
|
const onMouseUp = () => {
|
package/table-v2/styles.css
CHANGED
package/table-v2/table-v2.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DataGridTableProps } from "./types";
|
|
3
|
-
|
|
4
|
-
export declare function TableV2(props: DataGridTableProps<any>): React.JSX.Element;
|
|
5
|
-
export declare const DataGridTableV2: typeof TableV2;
|
|
3
|
+
export declare function DataGridTableV2(props: DataGridTableProps<any>): React.JSX.Element;
|
package/table-v2/table-v2.js
CHANGED
|
@@ -3,8 +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.DataGridTableV2 =
|
|
7
|
-
exports.TableV2 = TableV2;
|
|
6
|
+
exports.DataGridTableV2 = DataGridTableV2;
|
|
8
7
|
const show_1 = require("@uxf/core-react/components/show");
|
|
9
8
|
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
10
9
|
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
@@ -15,29 +14,28 @@ const components_1 = require("./components");
|
|
|
15
14
|
const header_select_all_rows_checkbox_1 = require("./components/header-select-all-rows-checkbox");
|
|
16
15
|
const select_row_checkbox_1 = require("./components/select-row-checkbox");
|
|
17
16
|
const use_resizable_columns_1 = require("./hooks/use-resizable-columns");
|
|
17
|
+
const get_grid_template_columns_1 = require("./utils/get-grid-template-columns");
|
|
18
18
|
const get_grid_template_rows_1 = require("./utils/get-grid-template-rows");
|
|
19
19
|
const SELECT_ROWS_CELL_WIDTH = 40;
|
|
20
20
|
const defaultKeyExtractor = (r) => r.id;
|
|
21
21
|
const DefaultBodyCell = () => "Unknown body cell.";
|
|
22
|
-
|
|
23
|
-
function TableV2(props) {
|
|
22
|
+
function DataGridTableV2(props) {
|
|
24
23
|
var _a, _b, _c, _d, _e;
|
|
25
24
|
const keyExtractor = (_a = props.keyExtractor) !== null && _a !== void 0 ? _a : defaultKeyExtractor;
|
|
26
25
|
const visibleColumns = props.schema.columns
|
|
27
26
|
.filter((column) => !column.hidden)
|
|
28
27
|
.filter((column) => { var _a, _b, _c, _d; return !((_c = (_b = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b.isHidden) !== null && _c !== void 0 ? _c : (_d = column.config) === null || _d === void 0 ? void 0 : _d.isHidden); });
|
|
29
|
-
const
|
|
28
|
+
const selectedRowColumnWidth = props.isRowSelectable ? SELECT_ROWS_CELL_WIDTH : null;
|
|
29
|
+
const { tableRef, columnRefs, onResizeStart } = (0, use_resizable_columns_1.useResizableColumns)(visibleColumns, props.actionCell, props.actions, selectedRowColumnWidth);
|
|
30
30
|
const gridTemplateRows = (0, get_grid_template_rows_1.getGridTemplateRows)(props.data, (_b = props.headerRowHeight) !== null && _b !== void 0 ? _b : 36, (_c = props.rowHeight) !== null && _c !== void 0 ? _c : 44);
|
|
31
|
-
const
|
|
31
|
+
const gridTemplateBasicColumns = visibleColumns
|
|
32
32
|
.map((column) => { var _a, _b, _c, _d; return (_c = (_b = (_a = props.state.userConfig.columns) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : (_d = column.config) === null || _d === void 0 ? void 0 : _d.width; })
|
|
33
|
-
.map((width) => ((0, is_nil_1.isNil)(width) ? "1fr" : (0, rem_1.rem)(width)))
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
:
|
|
38
|
-
|
|
39
|
-
? `${(0, rem_1.rem)(SELECT_ROWS_CELL_WIDTH)} ${gridTemplateColumnsWithoutSelectable}`
|
|
40
|
-
: gridTemplateColumnsWithoutSelectable;
|
|
33
|
+
.map((width) => ((0, is_nil_1.isNil)(width) ? "1fr" : (0, rem_1.rem)(width)));
|
|
34
|
+
const gridTemplateColumns = (0, get_grid_template_columns_1.getGridTemplateColumns)({
|
|
35
|
+
columns: gridTemplateBasicColumns,
|
|
36
|
+
selectRowColumnWidth: selectedRowColumnWidth,
|
|
37
|
+
actionColumnWidth: (_d = props.actionCell) === null || _d === void 0 ? void 0 : _d.width,
|
|
38
|
+
});
|
|
41
39
|
const selectedRows = (_e = props.state.selectedRows) !== null && _e !== void 0 ? _e : empty_array_1.EMPTY_ARRAY;
|
|
42
40
|
const selectRowHandler = (rowId) => () => {
|
|
43
41
|
const isRowSelected = selectedRows.find((r) => keyExtractor(r) === rowId);
|
|
@@ -73,4 +71,3 @@ function TableV2(props) {
|
|
|
73
71
|
(0, is_not_nil_1.isNotNil)(props.actionCell) && (react_1.default.createElement(components_1.Table.ActionCell, null,
|
|
74
72
|
react_1.default.createElement(props.actionCell.Component, { reload: () => { var _a; return (_a = props.onReload) === null || _a === void 0 ? void 0 : _a.call(props); }, row: row })))))))));
|
|
75
73
|
}
|
|
76
|
-
exports.DataGridTableV2 = TableV2;
|
package/table-v2/types.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ import { KeyExtractor } from "../types/core";
|
|
|
4
4
|
import { Schema } from "../types/schema";
|
|
5
5
|
import { DataGridControl } from "../use-data-grid-control";
|
|
6
6
|
import { NoRowsFallbackComponent } from "./no-rows-fallback";
|
|
7
|
-
|
|
8
|
-
export interface TableProps<Row> extends DataGridControl {
|
|
7
|
+
export interface DataGridTableProps<Row> extends DataGridControl {
|
|
9
8
|
schema: Schema<any>;
|
|
10
9
|
data: Row[];
|
|
11
10
|
isLoading?: boolean;
|
|
@@ -23,4 +22,3 @@ export interface TableProps<Row> extends DataGridControl {
|
|
|
23
22
|
NoRowsFallback?: NoRowsFallbackComponent;
|
|
24
23
|
isRowSelectable?: boolean;
|
|
25
24
|
}
|
|
26
|
-
export type DataGridTableProps<Row> = TableProps<Row>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGridTemplateColumns = getGridTemplateColumns;
|
|
4
|
+
const buildArray_1 = require("@uxf/core/utils/buildArray");
|
|
5
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
6
|
+
const rem_1 = require("@uxf/styles/units/rem");
|
|
7
|
+
function getGridTemplateColumns(config) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
return (0, buildArray_1.buildArray)()
|
|
10
|
+
.when((0, is_not_nil_1.isNotNil)(config.selectRowColumnWidth), (0, rem_1.rem)((_a = config.selectRowColumnWidth) !== null && _a !== void 0 ? _a : 0))
|
|
11
|
+
.add(config.columns.join(" "))
|
|
12
|
+
.when((0, is_not_nil_1.isNotNil)(config.actionColumnWidth), `minmax(${(0, rem_1.rem)((_b = config.actionColumnWidth) !== null && _b !== void 0 ? _b : 0)}, auto)`)
|
|
13
|
+
.join(" ");
|
|
14
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getGridTemplateRows(rows: any[], headerRowHeight: number, rowHeight:
|
|
1
|
+
import { DataGridTableProps } from "../types";
|
|
2
|
+
export declare function getGridTemplateRows(rows: any[], headerRowHeight: number, rowHeight: DataGridTableProps<any>["rowHeight"]): string | undefined;
|
package/toolbar/toolbar.d.ts
CHANGED
package/toolbar/toolbar.js
CHANGED
|
@@ -4,9 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataGridToolbar = DataGridToolbar;
|
|
7
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const classes_1 = require("../utils/classes");
|
|
10
8
|
function DataGridToolbar(props) {
|
|
11
|
-
return react_1.default.createElement("div", { className:
|
|
9
|
+
return react_1.default.createElement("div", { className: "uxf-data-grid__toolbar" }, props.children);
|
|
12
10
|
}
|
|
@@ -3,14 +3,10 @@ import React from "react";
|
|
|
3
3
|
import { FilterHandlers } from "../filter-handler";
|
|
4
4
|
import { CsvDownloadHandler, Schema } from "../types";
|
|
5
5
|
import { DataGridControl } from "../use-data-grid-control";
|
|
6
|
-
|
|
7
|
-
export interface ToolbarControlProps extends DataGridControl {
|
|
6
|
+
export interface DataGridToolbarControlProps extends DataGridControl {
|
|
8
7
|
schema: Schema<any>;
|
|
9
8
|
filterHandlers: FilterHandlers;
|
|
10
9
|
onCsvDownload?: CsvDownloadHandler;
|
|
11
10
|
isBorderHidden?: boolean | Nullish;
|
|
12
11
|
}
|
|
13
|
-
export
|
|
14
|
-
/** @deprecated Use DataGridToolbarControl */
|
|
15
|
-
export declare function ToolbarControl(props: ToolbarControlProps): React.JSX.Element;
|
|
16
|
-
export declare const DataGridToolbarControl: typeof ToolbarControl;
|
|
12
|
+
export declare function DataGridToolbarControl(props: DataGridToolbarControlProps): React.JSX.Element;
|
|
@@ -3,8 +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.DataGridToolbarControl =
|
|
7
|
-
exports.ToolbarControl = ToolbarControl;
|
|
6
|
+
exports.DataGridToolbarControl = DataGridToolbarControl;
|
|
8
7
|
const hide_1 = require("@uxf/core-react/components/hide");
|
|
9
8
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
10
9
|
const react_1 = __importDefault(require("react"));
|
|
@@ -12,8 +11,7 @@ const export_button_1 = require("../export-button");
|
|
|
12
11
|
const filters_button_1 = require("../filters-button");
|
|
13
12
|
const fulltext_input_1 = require("../fulltext-input");
|
|
14
13
|
const hidden_columns_button_1 = require("../hidden-columns-button");
|
|
15
|
-
|
|
16
|
-
function ToolbarControl(props) {
|
|
14
|
+
function DataGridToolbarControl(props) {
|
|
17
15
|
return (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-control" },
|
|
18
16
|
react_1.default.createElement(hide_1.Hide, { when: !props.schema.fullText },
|
|
19
17
|
react_1.default.createElement(fulltext_input_1.DataGridFulltextInput, { actions: props.actions, state: props.state })),
|
|
@@ -21,4 +19,3 @@ function ToolbarControl(props) {
|
|
|
21
19
|
react_1.default.createElement(hidden_columns_button_1.DataGridHiddenColumnsButton, { actions: props.actions, schema: props.schema, state: props.state }),
|
|
22
20
|
react_1.default.createElement(filters_button_1.DataGridFiltersButton, { actions: props.actions, filterHandlers: props.filterHandlers, schema: props.schema, state: props.state })));
|
|
23
21
|
}
|
|
24
|
-
exports.DataGridToolbarControl = ToolbarControl;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ButtonVariant } from "@uxf/ui/button";
|
|
2
2
|
import React, { ReactElement } from "react";
|
|
3
|
-
|
|
4
|
-
export interface ToolbarCustomsProps {
|
|
3
|
+
export interface DataGridToolbarCustomsProps {
|
|
5
4
|
buttons?: {
|
|
6
5
|
label: string | ReactElement;
|
|
7
6
|
onClick?: () => void;
|
|
@@ -9,7 +8,4 @@ export interface ToolbarCustomsProps {
|
|
|
9
8
|
variant?: ButtonVariant;
|
|
10
9
|
}[];
|
|
11
10
|
}
|
|
12
|
-
export
|
|
13
|
-
/** @deprecated Use DataGridToolbarCustoms */
|
|
14
|
-
export declare function ToolbarCustoms(props: ToolbarCustomsProps): React.JSX.Element | null;
|
|
15
|
-
export declare const DataGridToolbarCustoms: typeof ToolbarCustoms;
|
|
11
|
+
export declare function DataGridToolbarCustoms(props: DataGridToolbarCustomsProps): React.JSX.Element | null;
|
|
@@ -3,14 +3,12 @@ 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.DataGridToolbarCustoms =
|
|
7
|
-
exports.ToolbarCustoms = ToolbarCustoms;
|
|
6
|
+
exports.DataGridToolbarCustoms = DataGridToolbarCustoms;
|
|
8
7
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
9
8
|
const button_1 = require("@uxf/ui/button");
|
|
10
9
|
const button_list_1 = require("@uxf/ui/button-list");
|
|
11
10
|
const react_1 = __importDefault(require("react"));
|
|
12
|
-
|
|
13
|
-
function ToolbarCustoms(props) {
|
|
11
|
+
function DataGridToolbarCustoms(props) {
|
|
14
12
|
if (!props.buttons) {
|
|
15
13
|
return null;
|
|
16
14
|
}
|
|
@@ -19,4 +17,3 @@ function ToolbarCustoms(props) {
|
|
|
19
17
|
react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-customs-mobile" }, (0, is_not_nil_1.isNotNil)(firstButton) ? (react_1.default.createElement(button_1.Button, { href: firstButton.href, onClick: firstButton.onClick, size: "sm", variant: firstButton.variant }, firstButton.label)) : (react_1.default.createElement(button_list_1.ButtonList, { buttons: props.buttons, openButton: { variant: "secondary" }, size: "sm", visibleButtonsCount: 1 }))),
|
|
20
18
|
react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-customs-desktop" }, props.buttons.map((button, index) => (react_1.default.createElement(button_1.Button, { href: button.href, key: index, onClick: button.onClick, size: "sm", variant: button.variant }, button.label))))));
|
|
21
19
|
}
|
|
22
|
-
exports.DataGridToolbarCustoms = ToolbarCustoms;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ChangeTabFilterBehavior } from "../types";
|
|
2
3
|
import { Schema } from "../types/schema";
|
|
3
4
|
import { DataGridControl } from "../use-data-grid-control";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
export interface DataGridToolbarTabsProps extends DataGridControl {
|
|
6
|
+
changeTabFilterBehavior?: ChangeTabFilterBehavior;
|
|
6
7
|
schema: Schema<any>;
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
-
/** @deprecated Use DataGridToolbarTabs */
|
|
10
|
-
export declare function ToolbarTabs(props: DataGridToolbarTabsProps): React.JSX.Element;
|
|
11
|
-
export declare const DataGridToolbarTabs: typeof ToolbarTabs;
|
|
9
|
+
export declare function DataGridToolbarTabs(props: DataGridToolbarTabsProps): React.JSX.Element;
|
|
@@ -3,8 +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.DataGridToolbarTabs =
|
|
7
|
-
exports.ToolbarTabs = ToolbarTabs;
|
|
6
|
+
exports.DataGridToolbarTabs = DataGridToolbarTabs;
|
|
8
7
|
const show_1 = require("@uxf/core-react/components/show");
|
|
9
8
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
10
9
|
const button_1 = require("@uxf/ui/button");
|
|
@@ -14,25 +13,24 @@ const react_1 = __importDefault(require("react"));
|
|
|
14
13
|
function Tab(props) {
|
|
15
14
|
return (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-data-grid__toolbar-tab", props.isActive && "is-active"), onClick: props.onClick }, props.title));
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
function ToolbarTabs(props) {
|
|
16
|
+
function DataGridToolbarTabs(props) {
|
|
19
17
|
var _a, _b, _c, _d;
|
|
20
18
|
return (react_1.default.createElement(show_1.Show, { when: Boolean((_a = props.schema.tabs) === null || _a === void 0 ? void 0 : _a.length) },
|
|
21
19
|
react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-tabs" },
|
|
22
|
-
react_1.default.createElement("nav", { "aria-label": "Tabs", className: "uxf-data-grid__toolbar-tabs-nav uxf-data-grid__toolbar-tabs-nav--desktop" }, (_b = props.schema.tabs) === null || _b === void 0 ? void 0 : _b.map((
|
|
20
|
+
react_1.default.createElement("nav", { "aria-label": "Tabs", className: "uxf-data-grid__toolbar-tabs-nav uxf-data-grid__toolbar-tabs-nav--desktop" }, (_b = props.schema.tabs) === null || _b === void 0 ? void 0 : _b.map((tab) => (react_1.default.createElement(Tab, { isActive: props.state.request.tab === tab.name, key: tab.name, onClick: () => { var _a; return props.actions.changeTab(tab, (_a = props.changeTabFilterBehavior) !== null && _a !== void 0 ? _a : "filtersPerTab"); }, title: tab.label })))),
|
|
23
21
|
react_1.default.createElement("nav", { className: "uxf-data-grid__toolbar-tabs-nav uxf-data-grid__toolbar-tabs-nav--mobile" },
|
|
24
22
|
react_1.default.createElement(button_1.Button, { className: "uxf-data-grid__toolbar-tabs-button", onClick: () => {
|
|
25
23
|
var _a;
|
|
26
24
|
return (0, modal_service_1.openModal)({
|
|
27
|
-
children: (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-tabs-modal-content" }, (_a = props.schema.tabs) === null || _a === void 0 ? void 0 : _a.map((
|
|
28
|
-
|
|
25
|
+
children: (react_1.default.createElement("div", { className: "uxf-data-grid__toolbar-tabs-modal-content" }, (_a = props.schema.tabs) === null || _a === void 0 ? void 0 : _a.map((tab) => (react_1.default.createElement(button_1.Button, { className: "uxf-data-grid__toolbar-tabs-modal-button", key: tab.name, onClick: () => {
|
|
26
|
+
var _a;
|
|
27
|
+
props.actions.changeTab(tab, (_a = props.changeTabFilterBehavior) !== null && _a !== void 0 ? _a : "filtersPerTab");
|
|
29
28
|
(0, modal_service_1.closeModal)();
|
|
30
29
|
}, size: "xl", variant: "text" },
|
|
31
|
-
|
|
32
|
-
react_1.default.createElement("span", { className: "uxf-data-grid__toolbar-tabs-modal-button-text" },
|
|
30
|
+
tab.name === props.state.request.tab && (react_1.default.createElement(icon_1.Icon, { className: "uxf-data-grid__toolbar-tabs-modal-active-tab-icon", name: "check", size: 20 })),
|
|
31
|
+
react_1.default.createElement("span", { className: "uxf-data-grid__toolbar-tabs-modal-button-text" }, tab.label)))))),
|
|
33
32
|
});
|
|
34
33
|
}, size: "sm", variant: "text" },
|
|
35
34
|
react_1.default.createElement("span", { className: "uxf-data-grid__toolbar-tabs-nav-text" }, (_d = (_c = props.schema.tabs) === null || _c === void 0 ? void 0 : _c.find((t) => t.name === props.state.request.tab)) === null || _d === void 0 ? void 0 : _d.label),
|
|
36
35
|
react_1.default.createElement(icon_1.Icon, { className: "uxf-data-grid__toolbar-tabs-button-icon", name: "caretDown", size: 16 }))))));
|
|
37
36
|
}
|
|
38
|
-
exports.DataGridToolbarTabs = ToolbarTabs;
|
package/types/components.d.ts
CHANGED