@uxf/data-grid 11.61.0 → 11.64.4
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/data-grid-v2.js +1 -1
- package/data-grid-v2.stories.js +1 -1
- package/data-grid.js +1 -1
- package/package.json +1 -1
- package/selected-rows-toolbar/selected-rows-toolbar.d.ts +2 -2
- package/table/components/action-cell-wrapper.d.ts +6 -2
- package/table/no-rows-fallback.d.ts +2 -2
- package/table/types.d.ts +2 -4
- package/table-v2/components/body.d.ts +6 -2
- package/table-v2/components/header.d.ts +6 -2
- package/table-v2/components/row.d.ts +7 -2
- package/table-v2/components/row.js +2 -1
- package/table-v2/no-rows-fallback.d.ts +2 -2
- package/table-v2/styles.css +180 -127
- package/table-v2/table-v2.js +16 -13
- package/table-v2/table-v2.stories.js +1 -1
- package/table-v2/types.d.ts +3 -2
- package/types/components.d.ts +2 -2
- package/types/core.d.ts +2 -0
- package/types/data-grid-props.d.ts +4 -2
package/data-grid-v2.js
CHANGED
|
@@ -32,7 +32,7 @@ function DataGridV2(props) {
|
|
|
32
32
|
react_1.default.createElement(toolbar_customs_1.DataGridToolbarCustoms, { buttons: props.customActions })),
|
|
33
33
|
react_1.default.createElement(linear_progress_1.DataGridLinearProgress, { isLoading: props.isLoading }),
|
|
34
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 }),
|
|
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, isRowSelectable: props.isRowSelectable, keyExtractor: props.keyExtractor, reload: props.reload,
|
|
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, isRowSelectable: props.isRowSelectable, keyExtractor: props.keyExtractor, reload: props.reload, rowAccent: props.rowAccent, rowClassName: props.rowClassName, rowHeight: props.rowHeight, schema: props.schema, state: props.state }),
|
|
36
36
|
react_1.default.createElement(footer_1.DataGridFooter, null,
|
|
37
37
|
react_1.default.createElement(rows_per_page_select_1.DataGridRowsPerPageSelect, { actions: props.actions, state: props.state }),
|
|
38
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 }),
|
package/data-grid-v2.stories.js
CHANGED
|
@@ -94,6 +94,6 @@ function Default() {
|
|
|
94
94
|
});
|
|
95
95
|
return (react_1.default.createElement("div", { className: "p-10" },
|
|
96
96
|
react_1.default.createElement(radio_group_1.RadioGroup, { label: "Chov\u00E1n\u00ED p\u0159ep\u00EDn\u00E1n\u00ED tab\u016F", name: "filterBehavior", onChange: (value) => setFilterBehavior(value), options: FILTER_BEHAVIOR_OPTIONS, value: filterBehavior, variant: "row" }),
|
|
97
|
-
react_1.default.createElement(data_grid_v2_1.DataGridV2, { actionCell: actionCell, actions: actions, changeTabFilterBehavior: filterBehavior !== null && filterBehavior !== void 0 ? filterBehavior : "filtersPerTab", data: data, error: error, isLoading: isLoading, isRowSelectable: true, onCsvDownload: console.log, reload: reload, rowHeight: "auto", schema: schemaWithFrontendConfig, state: state }),
|
|
97
|
+
react_1.default.createElement(data_grid_v2_1.DataGridV2, { actionCell: actionCell, actions: actions, changeTabFilterBehavior: filterBehavior !== null && filterBehavior !== void 0 ? filterBehavior : "filtersPerTab", data: data, error: error, isLoading: isLoading, isRowSelectable: true, onCsvDownload: console.log, reload: reload, rowAccent: (row) => (row.id === 2 ? "success" : undefined), rowClassName: (row) => (row.id === 3 ? "some-custom-classname" : undefined), rowHeight: "auto", schema: schemaWithFrontendConfig, state: state }),
|
|
98
98
|
react_1.default.createElement(json_renderer_1.JsonRenderer, { value: state })));
|
|
99
99
|
}
|
package/data-grid.js
CHANGED
|
@@ -33,7 +33,7 @@ function DataGrid(props) {
|
|
|
33
33
|
react_1.default.createElement(toolbar_customs_1.DataGridToolbarCustoms, { buttons: props.customActions })),
|
|
34
34
|
react_1.default.createElement(linear_progress_1.DataGridLinearProgress, { isLoading: props.isLoading }),
|
|
35
35
|
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(table_1.DataGridTable, { NoRowsFallback: (_c = props.NoRowsFallback) !== null && _c !== void 0 ? _c : no_rows_fallback_1.NoRowsFallback, actionCell: props.actionCell, actions: props.actions, bodyCells: (_d = props.bodyCells) !== null && _d !== void 0 ? _d : body_cell_1.BodyCells, data: (_f = (_e = props.data) === null || _e === void 0 ? void 0 : _e.result) !== null && _f !== void 0 ? _f : empty_array_1.EMPTY_ARRAY, error: props.error, headerRowHeight: props.headerRowHeight, isLoading: props.isLoading, isRowSelectable: props.isRowSelectable, keyExtractor: props.keyExtractor, reload: props.reload, rowClass: props.
|
|
36
|
+
react_1.default.createElement(table_1.DataGridTable, { NoRowsFallback: (_c = props.NoRowsFallback) !== null && _c !== void 0 ? _c : no_rows_fallback_1.NoRowsFallback, actionCell: props.actionCell, actions: props.actions, bodyCells: (_d = props.bodyCells) !== null && _d !== void 0 ? _d : body_cell_1.BodyCells, data: (_f = (_e = props.data) === null || _e === void 0 ? void 0 : _e.result) !== null && _f !== void 0 ? _f : empty_array_1.EMPTY_ARRAY, error: props.error, headerRowHeight: props.headerRowHeight, isLoading: props.isLoading, isRowSelectable: props.isRowSelectable, keyExtractor: props.keyExtractor, reload: props.reload, rowClass: props.rowAccent, rowHeight: props.rowHeight === "auto" ? undefined : props.rowHeight, schema: props.schema, state: props.state }),
|
|
37
37
|
react_1.default.createElement(footer_1.DataGridFooter, null,
|
|
38
38
|
react_1.default.createElement(rows_per_page_select_1.DataGridRowsPerPageSelect, { actions: props.actions, state: props.state }),
|
|
39
39
|
react_1.default.createElement(row_counts_1.DataGridRowCounts, { count: (_h = (_g = props.data) === null || _g === void 0 ? void 0 : _g.count) !== null && _h !== void 0 ? _h : 0, state: props.state, totalCount: (_k = (_j = props.data) === null || _j === void 0 ? void 0 : _j.totalCount) !== null && _k !== void 0 ? _k : 0 }),
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { FunctionComponent } from "react";
|
|
2
2
|
import { DataGridControl } from "../use-data-grid-control";
|
|
3
3
|
export interface SelectedRowsToolbarActionsProps extends DataGridControl {
|
|
4
4
|
reload: () => Promise<any>;
|
|
5
5
|
}
|
|
6
|
-
export type SelectedRowsToolbarActionsComponent =
|
|
6
|
+
export type SelectedRowsToolbarActionsComponent = FunctionComponent<SelectedRowsToolbarActionsProps>;
|
|
7
7
|
export interface DataGridSelectedRowsToolbarProps extends DataGridControl {
|
|
8
8
|
Actions?: SelectedRowsToolbarActionsComponent;
|
|
9
9
|
reload: () => Promise<any>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface ActionCellWrapperProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function ActionCellWrapper(props: ActionCellWrapperProps): React.JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { FunctionComponent } from "react";
|
|
2
2
|
export interface NoRowsFallbackProps {
|
|
3
3
|
error?: any;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
}
|
|
6
|
-
export type NoRowsFallbackComponent =
|
|
6
|
+
export type NoRowsFallbackComponent = FunctionComponent<NoRowsFallbackProps>;
|
|
7
7
|
export declare function NoRowsFallback(props: NoRowsFallbackProps): React.JSX.Element;
|
package/table/types.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { BodyCellComponents, DataGridActionCell } from "../types
|
|
3
|
-
import { KeyExtractor } from "../types/core";
|
|
4
|
-
import { Schema } from "../types/schema";
|
|
2
|
+
import { BodyCellComponents, DataGridActionCell, KeyExtractor, RowAccent, Schema } from "../types";
|
|
5
3
|
import { DataGridControl } from "../use-data-grid-control";
|
|
6
4
|
import { NoRowsFallbackComponent } from "./no-rows-fallback";
|
|
7
5
|
export interface DataGridTableProps<Row> extends DataGridControl {
|
|
@@ -12,7 +10,7 @@ export interface DataGridTableProps<Row> extends DataGridControl {
|
|
|
12
10
|
reload: () => Promise<any>;
|
|
13
11
|
rowHeight?: number | ((row: Row) => number);
|
|
14
12
|
headerRowHeight?: number;
|
|
15
|
-
rowClass?: (row: Row) =>
|
|
13
|
+
rowClass?: (row: Row) => RowAccent;
|
|
16
14
|
keyExtractor?: KeyExtractor;
|
|
17
15
|
bodyCells?: BodyCellComponents;
|
|
18
16
|
actionCell?: DataGridActionCell<Row>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface BodyProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function Body(props: BodyProps): React.JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface HeaderProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function Header(props: HeaderProps): React.JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface RowProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function Row(props: RowProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -6,5 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Row = Row;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
function Row(props) {
|
|
9
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
return react_1.default.createElement("div", { className: `uxf-dg-table__row ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` }, props.children);
|
|
10
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { FunctionComponent } from "react";
|
|
2
2
|
export interface NoRowsFallbackProps {
|
|
3
3
|
error?: any;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
}
|
|
6
|
-
export type NoRowsFallbackComponent =
|
|
6
|
+
export type NoRowsFallbackComponent = FunctionComponent<NoRowsFallbackProps>;
|
|
7
7
|
export declare function NoRowsFallback(props: NoRowsFallbackProps): React.JSX.Element;
|
package/table-v2/styles.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--uxf-dg-table-font-size:
|
|
3
|
-
--uxf-dg-table-cell-padding:
|
|
4
|
-
--uxf-dg-table-cell-padding-first-cell:
|
|
5
|
-
--uxf-dg-table-cell-padding-last-cell:
|
|
2
|
+
--uxf-dg-table-font-size: 14px;
|
|
3
|
+
--uxf-dg-table-cell-padding: 8px;
|
|
4
|
+
--uxf-dg-table-cell-padding-first-cell: 16px;
|
|
5
|
+
--uxf-dg-table-cell-padding-last-cell: 16px;
|
|
6
6
|
--uxf-dg-table-action-cell-left-divider-size: 1px;
|
|
7
7
|
--uxf-dg-table-row-divider-size: 1px;
|
|
8
8
|
}
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
--uxf-dg-table-border-color: var(--uxf-color-base-border-border);
|
|
13
13
|
--uxf-dg-table-action-cell-left-divider-color: var(--uxf-color-base-border-border);
|
|
14
14
|
--uxf-dg-table-row-divider-color: var(--uxf-color-base-border-border);
|
|
15
|
+
--uxf-dg-table-cell-bg-color: var(--uxf-color-base-surface-main);
|
|
15
16
|
--uxf-dg-table-action-cell-bg-color: var(--uxf-color-base-surface-main);
|
|
17
|
+
--uxf-dg-table-row-bg-color-accent: var(--uxf-color-base-surface-main);
|
|
16
18
|
--uxf-dg-table-row-bg-color-odd: var(--uxf-color-base-surface-main);
|
|
17
19
|
--uxf-dg-table-row-bg-color-even: var(--uxf-color-base-surface-main);
|
|
18
20
|
--uxf-dg-table-header-action-cell-bg-color: var(--uxf-color-base-surface-background);
|
|
@@ -40,169 +42,220 @@
|
|
|
40
42
|
|
|
41
43
|
&::-webkit-scrollbar-thumb,
|
|
42
44
|
&::-webkit-scrollbar-thumb:hover {
|
|
43
|
-
background-color:
|
|
45
|
+
background-color: var(--uxf-color-base-border-input);
|
|
44
46
|
border-radius: 999px;
|
|
45
|
-
|
|
46
|
-
:root .dark & {
|
|
47
|
-
background-color: theme("colors.darkLow");
|
|
48
|
-
}
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var(--uxf-dg-table-action-cell-left-divider-color);
|
|
56
|
-
border-top: var(--uxf-dg-table-row-divider-size) solid var(--uxf-dg-table-row-divider-color);
|
|
57
|
-
display: flex;
|
|
58
|
-
height: 100%;
|
|
59
|
-
justify-content: flex-end;
|
|
60
|
-
padding: 0 theme("spacing.2");
|
|
61
|
-
position: sticky;
|
|
62
|
-
right: 0;
|
|
63
|
-
text-align: center;
|
|
64
|
-
width: 100%;
|
|
49
|
+
/* ensures no overflowing when no action cell */
|
|
50
|
+
.uxf-dg-table__row .uxf-dg-table__cell:last-child {
|
|
51
|
+
.uxf-dg-table__column-resize-handle {
|
|
52
|
+
right: 0;
|
|
65
53
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
&::before {
|
|
55
|
+
right: 0;
|
|
56
|
+
}
|
|
69
57
|
}
|
|
70
58
|
}
|
|
59
|
+
}
|
|
71
60
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
.uxf-dg-table__header {
|
|
62
|
+
display: contents;
|
|
63
|
+
}
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
.uxf-dg-table__body {
|
|
66
|
+
display: contents;
|
|
67
|
+
}
|
|
79
68
|
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
.uxf-dg-table__row {
|
|
70
|
+
display: contents;
|
|
82
71
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
&:nth-child(odd) {
|
|
73
|
+
--uxf-dg-table-cell-bg-color: color-mix(
|
|
74
|
+
in oklab,
|
|
75
|
+
var(--uxf-dg-table-row-bg-color-accent),
|
|
76
|
+
var(--uxf-dg-table-row-bg-color-odd)
|
|
77
|
+
);
|
|
78
|
+
--uxf-dg-table-action-cell-bg-color: color-mix(
|
|
79
|
+
in oklab,
|
|
80
|
+
var(--uxf-dg-table-row-bg-color-accent),
|
|
81
|
+
var(--uxf-dg-table-row-bg-color-odd)
|
|
82
|
+
);
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
84
|
+
/* remove in future */
|
|
85
|
+
@supports not (background-color: color-mix(in oklab, white, white)) {
|
|
86
|
+
--uxf-dg-table-cell-bg-color: var(--uxf-dg-table-row-bg-color-odd);
|
|
87
|
+
--uxf-dg-table-action-cell-bg-color: var(--uxf-dg-table-row-bg-color-odd);
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
90
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
&:nth-child(even) {
|
|
92
|
+
--uxf-dg-table-cell-bg-color: color-mix(
|
|
93
|
+
in oklab,
|
|
94
|
+
var(--uxf-dg-table-row-bg-color-accent),
|
|
95
|
+
var(--uxf-dg-table-row-bg-color-even)
|
|
96
|
+
);
|
|
97
|
+
--uxf-dg-table-action-cell-bg-color: color-mix(
|
|
98
|
+
in oklab,
|
|
99
|
+
var(--uxf-dg-table-row-bg-color-accent),
|
|
100
|
+
var(--uxf-dg-table-row-bg-color-even)
|
|
101
|
+
);
|
|
105
102
|
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
/* remove in future */
|
|
104
|
+
@supports not (background-color: color-mix(in oklab, white, white)) {
|
|
105
|
+
--uxf-dg-table-cell-bg-color: var(--uxf-dg-table-row-bg-color-even);
|
|
106
|
+
--uxf-dg-table-action-cell-bg-color: var(--uxf-dg-table-row-bg-color-even);
|
|
108
107
|
}
|
|
108
|
+
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
&--success {
|
|
111
|
+
--uxf-dg-table-row-bg-color-accent: var(--uxf-color-positive-surface-muted);
|
|
112
|
+
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
min-height: 36px;
|
|
118
|
-
position: relative;
|
|
119
|
-
user-select: none;
|
|
114
|
+
&--warning {
|
|
115
|
+
--uxf-dg-table-row-bg-color-accent: var(--uxf-color-warning-surface-muted);
|
|
116
|
+
}
|
|
120
117
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
118
|
+
&--error {
|
|
119
|
+
--uxf-dg-table-row-bg-color-accent: var(--uxf-color-negative-surface-muted);
|
|
120
|
+
}
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
122
|
+
&--primary {
|
|
123
|
+
--uxf-dg-table-row-bg-color-accent: var(--uxf-color-brand-surface-muted);
|
|
124
|
+
}
|
|
131
125
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
126
|
+
&--secondary {
|
|
127
|
+
--uxf-dg-table-row-bg-color-accent: var(--uxf-color-info-surface-muted);
|
|
135
128
|
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.uxf-dg-table__cell {
|
|
132
|
+
align-items: center;
|
|
133
|
+
background-color: color-mix(in oklab, var(--uxf-dg-table-cell-bg-color), var(--uxf-dg-table-row-bg-color-accent));
|
|
134
|
+
border-top: var(--uxf-dg-table-row-divider-size) solid var(--uxf-dg-table-row-divider-color);
|
|
135
|
+
display: flex;
|
|
136
|
+
padding: var(--uxf-dg-table-cell-padding);
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
/* remove in future */
|
|
139
|
+
@supports not (background-color: color-mix(in oklab, white, white)) {
|
|
140
|
+
background-color: var(--uxf-dg-table-cell-bg-color);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:first-child:not(.uxf-dg-table__select-row-cell, .uxf-dg-table__select-all-rows-cell) {
|
|
144
|
+
padding-left: var(--uxf-dg-table-cell-padding-first-cell);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:nth-last-child(1 of .uxf-dg-table__cell) {
|
|
148
|
+
padding-right: var(--uxf-dg-table-cell-padding-last-cell);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&--header {
|
|
152
|
+
background-color: var(--uxf-dg-table-header-bg-color);
|
|
153
|
+
color: var(--uxf-dg-table-header-color);
|
|
154
|
+
min-height: 36px;
|
|
138
155
|
position: relative;
|
|
156
|
+
user-select: none;
|
|
157
|
+
white-space: nowrap;
|
|
139
158
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
content: "";
|
|
144
|
-
position: absolute;
|
|
145
|
-
right: 0;
|
|
146
|
-
top: 0;
|
|
147
|
-
width: 1px;
|
|
159
|
+
&.is-sortable {
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
gap: 4px;
|
|
148
162
|
}
|
|
149
163
|
|
|
150
164
|
.uxf-icon {
|
|
151
|
-
margin-left:
|
|
165
|
+
margin-left: auto;
|
|
166
|
+
width: 8px;
|
|
152
167
|
}
|
|
153
168
|
}
|
|
154
169
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
.uxf-checkbox-input {
|
|
158
|
-
margin-top: 0;
|
|
159
|
-
}
|
|
170
|
+
span {
|
|
171
|
+
@apply truncate;
|
|
160
172
|
}
|
|
173
|
+
}
|
|
161
174
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
.uxf-dg-table__action-cell {
|
|
176
|
+
align-items: center;
|
|
177
|
+
background-color: color-mix(
|
|
178
|
+
in oklab,
|
|
179
|
+
var(--uxf-dg-table-action-cell-bg-color),
|
|
180
|
+
var(--uxf-dg-table-row-bg-color-accent)
|
|
181
|
+
);
|
|
182
|
+
border-left: var(--uxf-dg-table-action-cell-left-divider-size) solid
|
|
183
|
+
var(--uxf-dg-table-action-cell-left-divider-color);
|
|
184
|
+
border-top: var(--uxf-dg-table-row-divider-size) solid var(--uxf-dg-table-row-divider-color);
|
|
185
|
+
display: flex;
|
|
186
|
+
height: 100%;
|
|
187
|
+
justify-content: flex-end;
|
|
188
|
+
padding-inline: 8px;
|
|
189
|
+
position: sticky;
|
|
190
|
+
right: 0;
|
|
191
|
+
text-align: center;
|
|
192
|
+
width: 100%;
|
|
193
|
+
|
|
194
|
+
/* remove in future */
|
|
195
|
+
@supports not (background-color: color-mix(in oklab, white, white)) {
|
|
196
|
+
background-color: var(--uxf-dg-table-action-cell-bg-color);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&--header {
|
|
200
|
+
background-color: var(--uxf-dg-table-header-action-cell-bg-color);
|
|
169
201
|
z-index: 2;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
170
204
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
bottom: 0;
|
|
174
|
-
content: "";
|
|
175
|
-
position: absolute;
|
|
176
|
-
right: 8px;
|
|
177
|
-
top: 0;
|
|
178
|
-
width: 1px;
|
|
179
|
-
}
|
|
205
|
+
.uxf-dg-table__select-all-rows-cell {
|
|
206
|
+
position: relative;
|
|
180
207
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
208
|
+
&::before {
|
|
209
|
+
background-color: var(--uxf-color-base-border-border);
|
|
210
|
+
content: "";
|
|
211
|
+
inset-block: 0;
|
|
212
|
+
position: absolute;
|
|
213
|
+
right: 0;
|
|
214
|
+
width: 1px;
|
|
186
215
|
}
|
|
187
216
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
217
|
+
.uxf-icon {
|
|
218
|
+
margin-left: 0;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
192
221
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
222
|
+
.uxf-dg-table__select-all-rows-cell,
|
|
223
|
+
.uxf-dg-table__select-row-cell {
|
|
224
|
+
.uxf-checkbox-input {
|
|
225
|
+
margin-top: 0;
|
|
197
226
|
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.uxf-dg-table__column-resize-handle {
|
|
230
|
+
cursor: col-resize;
|
|
231
|
+
inset-block: 0;
|
|
232
|
+
position: absolute;
|
|
233
|
+
right: -8px;
|
|
234
|
+
width: 16px;
|
|
235
|
+
z-index: 2;
|
|
198
236
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
text-align: center;
|
|
237
|
+
&::before {
|
|
238
|
+
background-color: var(--uxf-color-base-border-border);
|
|
239
|
+
content: "";
|
|
240
|
+
inset-block: 0;
|
|
241
|
+
position: absolute;
|
|
242
|
+
right: 8px;
|
|
243
|
+
width: 1px;
|
|
207
244
|
}
|
|
245
|
+
|
|
246
|
+
&:hover {
|
|
247
|
+
&::before {
|
|
248
|
+
width: 2px;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.uxf-dg-table__no-rows-fallback {
|
|
254
|
+
align-items: center;
|
|
255
|
+
color: var(--uxf-color-base-text-low-emphasis);
|
|
256
|
+
display: flex;
|
|
257
|
+
grid-column: 1/-1;
|
|
258
|
+
height: 36px;
|
|
259
|
+
justify-content: center;
|
|
260
|
+
text-align: center;
|
|
208
261
|
}
|
package/table-v2/table-v2.js
CHANGED
|
@@ -72,17 +72,20 @@ function DataGridTableV2(props) {
|
|
|
72
72
|
}),
|
|
73
73
|
react_1.default.createElement(show_1.Show, { when: (0, is_not_nil_1.isNotNil)(props.actionCell) },
|
|
74
74
|
react_1.default.createElement(components_1.Table.HeaderActionCell, null)))),
|
|
75
|
-
react_1.default.createElement(components_1.Table.Body, null, (0, is_empty_1.isEmpty)(props.data) ? (react_1.default.createElement(NoRowsFallback, { error: props.error, isLoading: Boolean(props.isLoading) })) : (props.data.map((row) =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
react_1.default.createElement(components_1.Table.Body, null, (0, is_empty_1.isEmpty)(props.data) ? (react_1.default.createElement(NoRowsFallback, { error: props.error, isLoading: Boolean(props.isLoading) })) : (props.data.map((row) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
return (react_1.default.createElement(components_1.Table.Row, { className: `${(0, is_not_nil_1.isNotNil)(props.rowAccent) ? "uxf-dg-table__row--" + props.rowAccent(row) : ""} ${(_b = (_a = props.rowClassName) === null || _a === void 0 ? void 0 : _a.call(props, row)) !== null && _b !== void 0 ? _b : ""}`, key: keyExtractor(row) },
|
|
78
|
+
react_1.default.createElement(show_1.Show, { when: Boolean(props.isRowSelectable) },
|
|
79
|
+
react_1.default.createElement(select_row_checkbox_1.SelectRowCheckbox, { isRowSelected: selectedRows.find((r) => keyExtractor(r) === keyExtractor(row)), onSelectRowChange: selectRowHandler(keyExtractor(row)) })),
|
|
80
|
+
visibleColumns.map((column) => {
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
const BodyCell =
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
84
|
+
(_d = (_b = (_a = props.bodyCells) === null || _a === void 0 ? void 0 : _a[column.type]) !== null && _b !== void 0 ? _b : (_c = props.bodyCells) === null || _c === void 0 ? void 0 : _c.default) !== null && _d !== void 0 ? _d : DefaultBodyCell;
|
|
85
|
+
return (react_1.default.createElement(components_1.Table.Cell, { column: column, key: column.name },
|
|
86
|
+
react_1.default.createElement(BodyCell, { column: column, reload: props.reload, row: row, value: row[column.name] })));
|
|
87
|
+
}),
|
|
88
|
+
(0, is_not_nil_1.isNotNil)(props.actionCell) && (react_1.default.createElement(components_1.Table.ActionCellWrapper, null,
|
|
89
|
+
react_1.default.createElement(props.actionCell.Component, { reload: props.reload, row: row })))));
|
|
90
|
+
})))));
|
|
88
91
|
}
|
|
@@ -18,6 +18,6 @@ function Default() {
|
|
|
18
18
|
const reload = () => new Promise(() => null);
|
|
19
19
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
20
20
|
react_1.default.createElement(hidden_columns_button_1.DataGridHiddenColumnsButton, { actions: actions, schema: schema_1.schema, state: state }),
|
|
21
|
-
react_1.default.createElement(table_v2_1.DataGridTableV2, { actionCell: { width: 150, Component: () => react_1.default.createElement(action_cell_1.ActionCell, null, "Action cell") }, 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 }),
|
|
21
|
+
react_1.default.createElement(table_v2_1.DataGridTableV2, { actionCell: { width: 150, Component: () => react_1.default.createElement(action_cell_1.ActionCell, null, "Action cell") }, actions: actions, bodyCells: body_cell_1.BodyCells, data: data_1.data, error: undefined, isLoading: true, isRowSelectable: true, reload: reload, rowAccent: (row) => (row.id === 2 ? "success" : undefined), rowClassName: (row) => (row.id === 3 ? "some-custom-classname" : undefined), schema: schema_1.schema, state: state }),
|
|
22
22
|
react_1.default.createElement(json_renderer_1.JsonRenderer, { value: state })));
|
|
23
23
|
}
|
package/table-v2/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Nullish } from "@uxf/core/types";
|
|
2
|
-
import { ActionCellComponent, BodyCellComponents, KeyExtractor, Schema } from "../types";
|
|
2
|
+
import { ActionCellComponent, BodyCellComponents, KeyExtractor, RowAccent, Schema } from "../types";
|
|
3
3
|
import { DataGridControl } from "../use-data-grid-control";
|
|
4
4
|
import { NoRowsFallbackComponent } from "./no-rows-fallback";
|
|
5
5
|
export interface DataGridTableProps<Row> extends DataGridControl {
|
|
@@ -10,7 +10,8 @@ export interface DataGridTableProps<Row> extends DataGridControl {
|
|
|
10
10
|
reload: () => Promise<any>;
|
|
11
11
|
rowHeight?: number | ((row: Row) => number) | "auto";
|
|
12
12
|
headerRowHeight?: number;
|
|
13
|
-
|
|
13
|
+
rowAccent?: (row: Row) => RowAccent;
|
|
14
|
+
rowClassName?: (row: Row) => string | Nullish;
|
|
14
15
|
keyExtractor?: KeyExtractor;
|
|
15
16
|
bodyCells?: BodyCellComponents;
|
|
16
17
|
actionCell?: {
|
package/types/components.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComponentType,
|
|
1
|
+
import { ComponentType, FunctionComponent } from "react";
|
|
2
2
|
import { Column, Filter } from "./schema";
|
|
3
3
|
export interface ActionCellProps<R> {
|
|
4
4
|
row: R;
|
|
5
5
|
reload: () => Promise<any>;
|
|
6
6
|
}
|
|
7
|
-
export type ActionCellComponent<R> =
|
|
7
|
+
export type ActionCellComponent<R> = FunctionComponent<ActionCellProps<R>>;
|
|
8
8
|
export type DataGridActionCell<Row> = {
|
|
9
9
|
width: number;
|
|
10
10
|
Component: ActionCellComponent<Row>;
|
package/types/core.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Nullish } from "@uxf/core/types";
|
|
1
2
|
import { Request, Response, ResultItem } from "./api";
|
|
2
3
|
import { BaseGridType } from "./schema";
|
|
3
4
|
export type KeyExtractor = (row: ResultItem) => number;
|
|
@@ -6,6 +7,7 @@ export type Loader = (gridName: string | undefined, request: Request, encodedReq
|
|
|
6
7
|
export type CallbackRef = {
|
|
7
8
|
reload: () => Promise<any>;
|
|
8
9
|
};
|
|
10
|
+
export type RowAccent = "success" | "warning" | "error" | "primary" | "secondary" | Nullish;
|
|
9
11
|
export type Config<C extends BaseGridType["columns"]> = {
|
|
10
12
|
columns: Partial<{
|
|
11
13
|
[columnName in keyof C]: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Nullish } from "@uxf/core/types";
|
|
1
2
|
import { FilterHandlers } from "../filter-handler";
|
|
2
3
|
import { SelectedRowsToolbarActionsComponent } from "../selected-rows-toolbar";
|
|
3
4
|
import { NoRowsFallbackComponent } from "../table/no-rows-fallback";
|
|
@@ -6,7 +7,7 @@ import { DataGridToolbarCustomsProps } from "../toolbar-customs";
|
|
|
6
7
|
import { DataGridControl } from "../use-data-grid-control";
|
|
7
8
|
import { DataGridFetchingResult } from "../use-data-grid-fetching";
|
|
8
9
|
import { BodyCellComponents, ChangeTabFilterBehavior } from "./components";
|
|
9
|
-
import { CsvDownloadHandler, KeyExtractor } from "./core";
|
|
10
|
+
import { CsvDownloadHandler, KeyExtractor, RowAccent } from "./core";
|
|
10
11
|
import { BaseGridType, Schema } from "./schema";
|
|
11
12
|
export type DataGridControlProps = DataGridControl;
|
|
12
13
|
export type DataGridDataProps<Row> = DataGridFetchingResult<Row>;
|
|
@@ -17,7 +18,8 @@ export type DataGridBaseProps<GridType extends BaseGridType, Row> = {
|
|
|
17
18
|
onCsvDownload?: CsvDownloadHandler;
|
|
18
19
|
rowHeight?: number | ((row: Row) => number) | "auto";
|
|
19
20
|
headerRowHeight?: number;
|
|
20
|
-
|
|
21
|
+
rowAccent?: (row: Row) => RowAccent;
|
|
22
|
+
rowClassName?: (row: Row) => string | Nullish;
|
|
21
23
|
className?: string;
|
|
22
24
|
customActions?: DataGridToolbarCustomsProps["buttons"];
|
|
23
25
|
actionCell?: DataGridTableProps<Row>["actionCell"];
|