@uxf/data-grid 11.60.4 → 11.63.1

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 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, rowClass: props.rowClass, rowHeight: props.rowHeight, 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, 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 }),
@@ -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.rowClass, rowHeight: props.rowHeight === "auto" ? undefined : props.rowHeight, 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.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/data-grid",
3
- "version": "11.60.4",
3
+ "version": "11.63.1",
4
4
  "description": "UXF DataGrid",
5
5
  "homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
6
6
  "main": "index.js",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@uxf/core": "11.60.1",
35
35
  "@uxf/core-react": "11.60.1",
36
- "@uxf/ui": "11.60.4",
36
+ "@uxf/ui": "11.61.0",
37
37
  "dayjs": "1.11.13",
38
38
  "deepmerge": "4.3.1",
39
39
  "fast-glob": "3.3.2",
@@ -1,9 +1,9 @@
1
- import React, { FC } from "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 = FC<SelectedRowsToolbarActionsProps>;
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, { PropsWithChildren } from "react";
2
- export declare function ActionCellWrapper(props: PropsWithChildren): React.JSX.Element;
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, { FC } from "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 = FC<NoRowsFallbackProps>;
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/components";
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) => "success" | "warning" | "error" | "primary" | "secondary" | string | null | undefined;
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, { PropsWithChildren } from "react";
2
- export declare function Body(props: PropsWithChildren): React.JSX.Element;
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, { PropsWithChildren } from "react";
2
- export declare function Header(props: PropsWithChildren): React.JSX.Element;
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, { PropsWithChildren } from "react";
2
- export declare function Row(props: PropsWithChildren): React.JSX.Element;
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
- return react_1.default.createElement("div", { className: "uxf-dg-table__row" }, props.children);
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, { FC } from "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 = FC<NoRowsFallbackProps>;
6
+ export type NoRowsFallbackComponent = FunctionComponent<NoRowsFallbackProps>;
7
7
  export declare function NoRowsFallback(props: NoRowsFallbackProps): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  :root {
2
- --uxf-dg-table-font-size: theme("fontSize.sm");
3
- --uxf-dg-table-cell-padding: theme("spacing.2");
4
- --uxf-dg-table-cell-padding-first-cell: theme("spacing.4");
5
- --uxf-dg-table-cell-padding-last-cell: theme("spacing.4");
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,219 @@
40
42
 
41
43
  &::-webkit-scrollbar-thumb,
42
44
  &::-webkit-scrollbar-thumb:hover {
43
- background-color: theme("colors.lightLow");
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
- &__action-cell {
52
- align-items: center;
53
- background-color: var(--uxf-dg-table-action-cell-bg-color);
54
- border-left: var(--uxf-dg-table-action-cell-left-divider-size) solid
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
- &--header {
67
- background-color: var(--uxf-dg-table-header-action-cell-bg-color);
68
- z-index: 2;
54
+ &::before {
55
+ right: 0;
56
+ }
69
57
  }
70
58
  }
59
+ }
71
60
 
72
- &__row {
73
- display: contents;
74
- }
61
+ .uxf-dg-table__header {
62
+ display: contents;
63
+ }
75
64
 
76
- &__header {
77
- display: contents;
78
- }
65
+ .uxf-dg-table__body {
66
+ display: contents;
67
+ }
79
68
 
80
- &__body {
81
- display: contents;
69
+ .uxf-dg-table__row {
70
+ display: contents;
82
71
 
83
- .uxf-dg-table__row {
84
- &:nth-child(odd) {
85
- .uxf-dg-table__cell,
86
- .uxf-dg-table__action-cell {
87
- background-color: var(--uxf-dg-table-row-bg-color-odd);
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
- &:nth-child(even) {
92
- .uxf-dg-table__cell,
93
- .uxf-dg-table__action-cell {
94
- background-color: var(--uxf-dg-table-row-bg-color-even);
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
- &__cell {
101
- align-items: center;
102
- border-top: var(--uxf-dg-table-row-divider-size) solid var(--uxf-dg-table-row-divider-color);
103
- display: flex;
104
- padding: var(--uxf-dg-table-cell-padding);
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
- &:first-child:not(.uxf-dg-table__select-row-cell, .uxf-dg-table__select-all-rows-cell) {
107
- padding-left: var(--uxf-dg-table-cell-padding-first-cell);
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
- &:nth-last-child(1 of .uxf-dg-table__cell) {
111
- padding-right: var(--uxf-dg-table-cell-padding-last-cell);
112
- }
110
+ &--success {
111
+ --uxf-dg-table-row-bg-color-accent: var(--uxf-color-positive-surface-muted);
112
+ }
113
113
 
114
- &--header {
115
- background-color: var(--uxf-dg-table-header-bg-color);
116
- color: var(--uxf-dg-table-header-color);
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
- &.is-sortable {
122
- cursor: pointer;
123
- gap: 4px;
124
- }
118
+ &--error {
119
+ --uxf-dg-table-row-bg-color-accent: var(--uxf-color-negative-surface-muted);
120
+ }
125
121
 
126
- .uxf-icon {
127
- margin-left: auto;
128
- width: 8px;
129
- }
130
- }
122
+ &--primary {
123
+ --uxf-dg-table-row-bg-color-accent: var(--uxf-color-brand-surface-muted);
124
+ }
131
125
 
132
- span {
133
- @apply truncate;
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
- &__select-all-rows-cell {
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;
139
157
 
140
- &::before {
141
- background-color: var(--uxf-color-base-border-border);
142
- bottom: 0;
143
- content: "";
144
- position: absolute;
145
- right: 0;
146
- top: 0;
147
- width: 1px;
158
+ &.is-sortable {
159
+ cursor: pointer;
160
+ gap: 4px;
148
161
  }
149
162
 
150
163
  .uxf-icon {
151
- margin-left: 0;
164
+ margin-left: auto;
165
+ width: 8px;
152
166
  }
153
167
  }
154
168
 
155
- &__select-all-rows-cell,
156
- &__select-row-cell {
157
- .uxf-checkbox-input {
158
- margin-top: 0;
159
- }
169
+ span {
170
+ @apply truncate;
160
171
  }
172
+ }
161
173
 
162
- &__column-resize-handle {
163
- bottom: 0;
164
- cursor: col-resize;
165
- position: absolute;
166
- right: -8px;
167
- top: 0;
168
- width: 16px;
174
+ .uxf-dg-table__action-cell {
175
+ align-items: center;
176
+ background-color: color-mix(
177
+ in oklab,
178
+ var(--uxf-dg-table-action-cell-bg-color),
179
+ var(--uxf-dg-table-row-bg-color-accent)
180
+ );
181
+ border-left: var(--uxf-dg-table-action-cell-left-divider-size) solid
182
+ var(--uxf-dg-table-action-cell-left-divider-color);
183
+ border-top: var(--uxf-dg-table-row-divider-size) solid var(--uxf-dg-table-row-divider-color);
184
+ display: flex;
185
+ height: 100%;
186
+ justify-content: flex-end;
187
+ padding-inline: 8px;
188
+ position: sticky;
189
+ right: 0;
190
+ text-align: center;
191
+ width: 100%;
192
+
193
+ /* remove in future */
194
+ @supports not (background-color: color-mix(in oklab, white, white)) {
195
+ background-color: var(--uxf-dg-table-action-cell-bg-color);
196
+ }
197
+
198
+ &--header {
199
+ background-color: var(--uxf-dg-table-header-action-cell-bg-color);
169
200
  z-index: 2;
201
+ }
202
+ }
170
203
 
171
- &::before {
172
- background-color: var(--uxf-color-base-border-border);
173
- bottom: 0;
174
- content: "";
175
- position: absolute;
176
- right: 8px;
177
- top: 0;
178
- width: 1px;
179
- }
204
+ .uxf-dg-table__select-all-rows-cell {
205
+ position: relative;
180
206
 
181
- &:hover {
182
- &::before {
183
- width: 2px;
184
- }
185
- }
207
+ &::before {
208
+ background-color: var(--uxf-color-base-border-border);
209
+ content: "";
210
+ inset-block: 0;
211
+ position: absolute;
212
+ right: 0;
213
+ width: 1px;
186
214
  }
187
215
 
188
- /* ensures no overflowing when no action cell */
189
- .uxf-dg-table__row .uxf-dg-table__cell:last-child {
190
- .uxf-dg-table__column-resize-handle {
191
- right: 0;
216
+ .uxf-icon {
217
+ margin-left: 0;
218
+ }
219
+ }
192
220
 
193
- &::before {
194
- right: 0;
195
- }
196
- }
221
+ .uxf-dg-table__select-all-rows-cell,
222
+ .uxf-dg-table__select-row-cell {
223
+ .uxf-checkbox-input {
224
+ margin-top: 0;
197
225
  }
226
+ }
227
+
228
+ .uxf-dg-table__column-resize-handle {
229
+ cursor: col-resize;
230
+ inset-block: 0;
231
+ position: absolute;
232
+ right: -8px;
233
+ width: 16px;
234
+ z-index: 2;
198
235
 
199
- &__no-rows-fallback {
200
- align-items: center;
201
- color: theme("colors.gray.600"); /* ?? */
202
- display: flex;
203
- grid-column: 1/-1;
204
- height: 36px;
205
- justify-content: center;
206
- text-align: center;
236
+ &::before {
237
+ background-color: var(--uxf-color-base-border-border);
238
+ content: "";
239
+ inset-block: 0;
240
+ position: absolute;
241
+ right: 8px;
242
+ width: 1px;
207
243
  }
244
+
245
+ &:hover {
246
+ &::before {
247
+ width: 2px;
248
+ }
249
+ }
250
+ }
251
+
252
+ .uxf-dg-table__no-rows-fallback {
253
+ align-items: center;
254
+ color: var(--uxf-color-base-text-low-emphasis);
255
+ display: flex;
256
+ grid-column: 1/-1;
257
+ height: 36px;
258
+ justify-content: center;
259
+ text-align: center;
208
260
  }
@@ -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) => (react_1.default.createElement(components_1.Table.Row, { key: keyExtractor(row) },
76
- react_1.default.createElement(show_1.Show, { when: Boolean(props.isRowSelectable) },
77
- react_1.default.createElement(select_row_checkbox_1.SelectRowCheckbox, { isRowSelected: selectedRows.find((r) => keyExtractor(r) === keyExtractor(row)), onSelectRowChange: selectRowHandler(keyExtractor(row)) })),
78
- visibleColumns.map((column) => {
79
- var _a, _b, _c, _d;
80
- const BodyCell =
81
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
82
- (_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;
83
- return (react_1.default.createElement(components_1.Table.Cell, { column: column, key: column.name },
84
- react_1.default.createElement(BodyCell, { column: column, reload: props.reload, row: row, value: row[column.name] })));
85
- }),
86
- (0, is_not_nil_1.isNotNil)(props.actionCell) && (react_1.default.createElement(components_1.Table.ActionCellWrapper, null,
87
- react_1.default.createElement(props.actionCell.Component, { reload: props.reload, row: row }))))))))));
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
  }
@@ -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
- rowClass?: (row: Row) => "success" | "warning" | "error" | "primary" | "secondary" | string | null | undefined;
13
+ rowAccent?: (row: Row) => RowAccent;
14
+ rowClassName?: (row: Row) => string | Nullish;
14
15
  keyExtractor?: KeyExtractor;
15
16
  bodyCells?: BodyCellComponents;
16
17
  actionCell?: {
@@ -1,10 +1,10 @@
1
- import { ComponentType, FC } from "react";
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> = FC<ActionCellProps<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
- rowClass?: (row: Row) => "success" | "warning" | "error" | "primary" | "secondary" | string | null | undefined;
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"];