@wallarm-org/design-system 2.3.3 → 2.4.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/dist/components/Table/TableBody/TableBodyRowDndContext.js +119 -84
- package/dist/components/Table/TableContext/TableProvider.js +281 -278
- package/dist/components/Table/TableContext/types.d.ts +1 -0
- package/dist/components/Table/TableRow.js +145 -144
- package/dist/components/Table/lib/createDragHandleColumn.js +31 -5
- package/dist/components/Table/lib/index.d.ts +1 -0
- package/dist/components/Table/lib/index.js +1 -0
- package/dist/components/Table/lib/isGroupRow.d.ts +8 -0
- package/dist/components/Table/lib/isGroupRow.js +2 -0
- package/dist/components/Table/lib/useRowDnd.js +30 -28
- package/dist/components/Table/types.d.ts +8 -1
- package/dist/icons/ArrowRightAlt.d.ts +3 -0
- package/dist/icons/ArrowRightAlt.js +27 -0
- package/dist/icons/GitCompareArrowsAlt.d.ts +3 -0
- package/dist/icons/GitCompareArrowsAlt.js +27 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/module/const.js +2 -0
- package/dist/metadata/components.json +13 -2
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ export interface TableContextValue<T extends RowData> {
|
|
|
24
24
|
expandingEnabled: boolean;
|
|
25
25
|
visibilityEnabled: boolean;
|
|
26
26
|
hasSubRowGrouping: boolean;
|
|
27
|
+
showEmptyGroups: boolean;
|
|
27
28
|
virtualized: TableVirtualized | undefined;
|
|
28
29
|
stretch: boolean;
|
|
29
30
|
renderExpandedRow?: (row: Row<DSTableFeatures, T>) => ReactNode;
|
|
@@ -4,7 +4,7 @@ import { memo } from "react";
|
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
5
|
import { useTestId } from "../../utils/testId.js";
|
|
6
6
|
import { DROP_INDICATOR_BASE } from "./classes.js";
|
|
7
|
-
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useRowDnd, useTableValue, withTableState } from "./lib/index.js";
|
|
7
|
+
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, isGroupRow, useRowDnd, useTableValue, withTableState } from "./lib/index.js";
|
|
8
8
|
import { Td, Tr } from "./primitives/index.js";
|
|
9
9
|
import { TableBodyCell } from "./TableBody/TableBodyCell.js";
|
|
10
10
|
import { useRowDndIndicator } from "./TableBody/TableBodyRowDndContext.js";
|
|
@@ -16,50 +16,51 @@ const SYSTEM_COLUMN_IDS = new Set([
|
|
|
16
16
|
TABLE_DRAG_HANDLE_COLUMN_ID
|
|
17
17
|
]);
|
|
18
18
|
const TableRowInner = (t0)=>{
|
|
19
|
-
const $ = compiler_runtime_c(
|
|
19
|
+
const $ = compiler_runtime_c(97);
|
|
20
20
|
const { row, ref, "data-index": dataIndex } = t0;
|
|
21
|
-
const { table, expandingEnabled, activeRowId, isLoading, renderExpandedRow, stretch, hasSubRowGrouping, allLeafColumns } = useTableContext();
|
|
21
|
+
const { table, expandingEnabled, activeRowId, isLoading, renderExpandedRow, stretch, hasSubRowGrouping, showEmptyGroups, allLeafColumns } = useTableContext();
|
|
22
22
|
const testId = useTestId("row");
|
|
23
23
|
const { canDnd, isDragging, setNodeRef, style: dndStyle, attributes, listeners } = useRowDnd(row);
|
|
24
24
|
const { activeId, overId } = useRowDndIndicator();
|
|
25
25
|
let t1;
|
|
26
|
-
if ($[0] !== row
|
|
27
|
-
t1 = ()=>row
|
|
28
|
-
$[0] = row
|
|
29
|
-
$[1] =
|
|
30
|
-
|
|
26
|
+
if ($[0] !== row || $[1] !== showEmptyGroups) {
|
|
27
|
+
t1 = ()=>isGroupRow(row, showEmptyGroups);
|
|
28
|
+
$[0] = row;
|
|
29
|
+
$[1] = showEmptyGroups;
|
|
30
|
+
$[2] = t1;
|
|
31
|
+
} else t1 = $[2];
|
|
31
32
|
const isGroupParent = useTableValue(t1);
|
|
32
33
|
let t2;
|
|
33
|
-
if ($[
|
|
34
|
+
if ($[3] !== row) {
|
|
34
35
|
t2 = ()=>row.subRows.length > 0 ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
|
35
|
-
$[
|
|
36
|
-
$[
|
|
37
|
-
} else t2 = $[
|
|
36
|
+
$[3] = row;
|
|
37
|
+
$[4] = t2;
|
|
38
|
+
} else t2 = $[4];
|
|
38
39
|
const isSelected = useTableValue(t2);
|
|
39
40
|
let t3;
|
|
40
|
-
if ($[
|
|
41
|
+
if ($[5] !== row) {
|
|
41
42
|
t3 = ()=>row.getIsExpanded();
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
} else t3 = $[
|
|
43
|
+
$[5] = row;
|
|
44
|
+
$[6] = t3;
|
|
45
|
+
} else t3 = $[6];
|
|
45
46
|
const isExpanded = useTableValue(t3);
|
|
46
47
|
let t4;
|
|
47
|
-
if ($[
|
|
48
|
+
if ($[7] !== row) {
|
|
48
49
|
t4 = ()=>row.getVisibleCells();
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
} else t4 = $[
|
|
50
|
+
$[7] = row;
|
|
51
|
+
$[8] = t4;
|
|
52
|
+
} else t4 = $[8];
|
|
52
53
|
const cells = useTableValue(t4);
|
|
53
54
|
let t5;
|
|
54
|
-
if ($[
|
|
55
|
+
if ($[9] !== row.id || $[10] !== table) {
|
|
55
56
|
t5 = ()=>{
|
|
56
57
|
const rows = table.getRowModel().rows;
|
|
57
58
|
return rows[rows.length - 1]?.id === row.id;
|
|
58
59
|
};
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
} else t5 = $[
|
|
60
|
+
$[9] = row.id;
|
|
61
|
+
$[10] = table;
|
|
62
|
+
$[11] = t5;
|
|
63
|
+
} else t5 = $[11];
|
|
63
64
|
const isLastModelRow = useTableValue(t5);
|
|
64
65
|
const isPreviewActive = activeRowId === row.id;
|
|
65
66
|
const isLastTableRow = !isLoading && isLastModelRow;
|
|
@@ -67,17 +68,17 @@ const TableRowInner = (t0)=>{
|
|
|
67
68
|
const isLastRow = isLastTableRow && !hasExpandedContent;
|
|
68
69
|
const isLastRowExpanded = isLastTableRow && hasExpandedContent;
|
|
69
70
|
let t6;
|
|
70
|
-
if ($[
|
|
71
|
+
if ($[12] !== canDnd || $[13] !== ref || $[14] !== setNodeRef) {
|
|
71
72
|
t6 = (node)=>{
|
|
72
73
|
if (canDnd) setNodeRef(node);
|
|
73
74
|
if ("function" == typeof ref) ref(node);
|
|
74
75
|
else if (ref) ref.current = node;
|
|
75
76
|
};
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
} else t6 = $[
|
|
77
|
+
$[12] = canDnd;
|
|
78
|
+
$[13] = ref;
|
|
79
|
+
$[14] = setNodeRef;
|
|
80
|
+
$[15] = t6;
|
|
81
|
+
} else t6 = $[15];
|
|
81
82
|
const composedRef = t6;
|
|
82
83
|
if (isGroupParent) {
|
|
83
84
|
let T0;
|
|
@@ -93,22 +94,22 @@ const TableRowInner = (t0)=>{
|
|
|
93
94
|
let t7;
|
|
94
95
|
let t8;
|
|
95
96
|
let t9;
|
|
96
|
-
if ($[
|
|
97
|
+
if ($[16] !== allLeafColumns || $[17] !== cells || $[18] !== composedRef || $[19] !== dataIndex || $[20] !== hasSubRowGrouping || $[21] !== isExpanded || $[22] !== isLastRow || $[23] !== isPreviewActive || $[24] !== isSelected || $[25] !== row.id || $[26] !== table.state || $[27] !== testId) {
|
|
97
98
|
const systemCells = cells.filter(_temp);
|
|
98
99
|
const dataCells = cells.filter(_temp2);
|
|
99
100
|
const firstDataCell = dataCells[0];
|
|
100
101
|
let t19;
|
|
101
|
-
if ($[
|
|
102
|
+
if ($[41] !== allLeafColumns || $[42] !== hasSubRowGrouping || $[43] !== isExpanded) {
|
|
102
103
|
t19 = hasSubRowGrouping && isExpanded ? {
|
|
103
104
|
position: "sticky",
|
|
104
105
|
top: allLeafColumns.some(_temp3) ? 48 : 32,
|
|
105
106
|
zIndex: 20
|
|
106
107
|
} : void 0;
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else t19 = $[
|
|
108
|
+
$[41] = allLeafColumns;
|
|
109
|
+
$[42] = hasSubRowGrouping;
|
|
110
|
+
$[43] = isExpanded;
|
|
111
|
+
$[44] = t19;
|
|
112
|
+
} else t19 = $[44];
|
|
112
113
|
const stickyStyle = t19;
|
|
113
114
|
T0 = Tr;
|
|
114
115
|
t7 = composedRef;
|
|
@@ -121,15 +122,15 @@ const TableRowInner = (t0)=>{
|
|
|
121
122
|
t14 = isSelected || void 0;
|
|
122
123
|
t15 = stickyStyle;
|
|
123
124
|
let t20;
|
|
124
|
-
if ($[
|
|
125
|
+
if ($[45] !== isLastRow) {
|
|
125
126
|
t20 = (cell)=>/*#__PURE__*/ jsx(TableBodyCell, {
|
|
126
127
|
cell: cell,
|
|
127
128
|
disablePinnedShadow: true,
|
|
128
129
|
lastRow: isLastRow
|
|
129
130
|
}, cell.id);
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
} else t20 = $[
|
|
131
|
+
$[45] = isLastRow;
|
|
132
|
+
$[46] = t20;
|
|
133
|
+
} else t20 = $[46];
|
|
133
134
|
t16 = systemCells.map(t20);
|
|
134
135
|
t17 = firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
|
|
135
136
|
cell: firstDataCell,
|
|
@@ -144,57 +145,57 @@ const TableRowInner = (t0)=>{
|
|
|
144
145
|
},
|
|
145
146
|
"aria-hidden": "true"
|
|
146
147
|
}, cell_0.id)));
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
148
|
+
$[16] = allLeafColumns;
|
|
149
|
+
$[17] = cells;
|
|
150
|
+
$[18] = composedRef;
|
|
151
|
+
$[19] = dataIndex;
|
|
152
|
+
$[20] = hasSubRowGrouping;
|
|
153
|
+
$[21] = isExpanded;
|
|
154
|
+
$[22] = isLastRow;
|
|
155
|
+
$[23] = isPreviewActive;
|
|
156
|
+
$[24] = isSelected;
|
|
157
|
+
$[25] = row.id;
|
|
158
|
+
$[26] = table.state;
|
|
159
|
+
$[27] = testId;
|
|
160
|
+
$[28] = T0;
|
|
161
|
+
$[29] = t10;
|
|
162
|
+
$[30] = t11;
|
|
163
|
+
$[31] = t12;
|
|
164
|
+
$[32] = t13;
|
|
165
|
+
$[33] = t14;
|
|
166
|
+
$[34] = t15;
|
|
167
|
+
$[35] = t16;
|
|
168
|
+
$[36] = t17;
|
|
169
|
+
$[37] = t18;
|
|
170
|
+
$[38] = t7;
|
|
171
|
+
$[39] = t8;
|
|
172
|
+
$[40] = t9;
|
|
172
173
|
} else {
|
|
173
|
-
T0 = $[
|
|
174
|
-
t10 = $[
|
|
175
|
-
t11 = $[
|
|
176
|
-
t12 = $[
|
|
177
|
-
t13 = $[
|
|
178
|
-
t14 = $[
|
|
179
|
-
t15 = $[
|
|
180
|
-
t16 = $[
|
|
181
|
-
t17 = $[
|
|
182
|
-
t18 = $[
|
|
183
|
-
t7 = $[
|
|
184
|
-
t8 = $[
|
|
185
|
-
t9 = $[
|
|
174
|
+
T0 = $[28];
|
|
175
|
+
t10 = $[29];
|
|
176
|
+
t11 = $[30];
|
|
177
|
+
t12 = $[31];
|
|
178
|
+
t13 = $[32];
|
|
179
|
+
t14 = $[33];
|
|
180
|
+
t15 = $[34];
|
|
181
|
+
t16 = $[35];
|
|
182
|
+
t17 = $[36];
|
|
183
|
+
t18 = $[37];
|
|
184
|
+
t7 = $[38];
|
|
185
|
+
t8 = $[39];
|
|
186
|
+
t9 = $[40];
|
|
186
187
|
}
|
|
187
188
|
let t19;
|
|
188
|
-
if ($[
|
|
189
|
+
if ($[47] !== stretch) {
|
|
189
190
|
t19 = !stretch && /*#__PURE__*/ jsx(Td, {
|
|
190
191
|
pinned: false,
|
|
191
192
|
"aria-hidden": true
|
|
192
193
|
});
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
} else t19 = $[
|
|
194
|
+
$[47] = stretch;
|
|
195
|
+
$[48] = t19;
|
|
196
|
+
} else t19 = $[48];
|
|
196
197
|
let t20;
|
|
197
|
-
if ($[
|
|
198
|
+
if ($[49] !== T0 || $[50] !== t10 || $[51] !== t11 || $[52] !== t12 || $[53] !== t13 || $[54] !== t14 || $[55] !== t15 || $[56] !== t16 || $[57] !== t17 || $[58] !== t18 || $[59] !== t19 || $[60] !== t7 || $[61] !== t8 || $[62] !== t9) {
|
|
198
199
|
t20 = /*#__PURE__*/ jsxs(T0, {
|
|
199
200
|
ref: t7,
|
|
200
201
|
"data-index": t8,
|
|
@@ -212,49 +213,49 @@ const TableRowInner = (t0)=>{
|
|
|
212
213
|
t19
|
|
213
214
|
]
|
|
214
215
|
});
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
} else t20 = $[
|
|
216
|
+
$[49] = T0;
|
|
217
|
+
$[50] = t10;
|
|
218
|
+
$[51] = t11;
|
|
219
|
+
$[52] = t12;
|
|
220
|
+
$[53] = t13;
|
|
221
|
+
$[54] = t14;
|
|
222
|
+
$[55] = t15;
|
|
223
|
+
$[56] = t16;
|
|
224
|
+
$[57] = t17;
|
|
225
|
+
$[58] = t18;
|
|
226
|
+
$[59] = t19;
|
|
227
|
+
$[60] = t7;
|
|
228
|
+
$[61] = t8;
|
|
229
|
+
$[62] = t9;
|
|
230
|
+
$[63] = t20;
|
|
231
|
+
} else t20 = $[63];
|
|
231
232
|
let t21;
|
|
232
|
-
if ($[
|
|
233
|
+
if ($[64] !== expandingEnabled || $[65] !== isLastRowExpanded || $[66] !== row) {
|
|
233
234
|
t21 = expandingEnabled && /*#__PURE__*/ jsx(TableRowExpanded, {
|
|
234
235
|
row: row,
|
|
235
236
|
lastRow: isLastRowExpanded
|
|
236
237
|
});
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
} else t21 = $[
|
|
238
|
+
$[64] = expandingEnabled;
|
|
239
|
+
$[65] = isLastRowExpanded;
|
|
240
|
+
$[66] = row;
|
|
241
|
+
$[67] = t21;
|
|
242
|
+
} else t21 = $[67];
|
|
242
243
|
let t22;
|
|
243
|
-
if ($[
|
|
244
|
+
if ($[68] !== t20 || $[69] !== t21) {
|
|
244
245
|
t22 = /*#__PURE__*/ jsxs(Fragment, {
|
|
245
246
|
children: [
|
|
246
247
|
t20,
|
|
247
248
|
t21
|
|
248
249
|
]
|
|
249
250
|
});
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
} else t22 = $[
|
|
251
|
+
$[68] = t20;
|
|
252
|
+
$[69] = t21;
|
|
253
|
+
$[70] = t22;
|
|
254
|
+
} else t22 = $[70];
|
|
254
255
|
return t22;
|
|
255
256
|
}
|
|
256
257
|
let t7;
|
|
257
|
-
if ($[
|
|
258
|
+
if ($[71] !== activeId || $[72] !== attributes || $[73] !== cells || $[74] !== composedRef || $[75] !== dataIndex || $[76] !== dndStyle || $[77] !== isDragging || $[78] !== isLastRow || $[79] !== isPreviewActive || $[80] !== isSelected || $[81] !== listeners || $[82] !== overId || $[83] !== row.depth || $[84] !== row.id || $[85] !== stretch || $[86] !== table || $[87] !== testId) {
|
|
258
259
|
let dropIndicator;
|
|
259
260
|
if (overId === row.id && null != activeId && activeId !== row.id) {
|
|
260
261
|
const modelRows = table.getRowModel().rows;
|
|
@@ -295,50 +296,50 @@ const TableRowInner = (t0)=>{
|
|
|
295
296
|
})
|
|
296
297
|
]
|
|
297
298
|
});
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
} else t7 = $[
|
|
299
|
+
$[71] = activeId;
|
|
300
|
+
$[72] = attributes;
|
|
301
|
+
$[73] = cells;
|
|
302
|
+
$[74] = composedRef;
|
|
303
|
+
$[75] = dataIndex;
|
|
304
|
+
$[76] = dndStyle;
|
|
305
|
+
$[77] = isDragging;
|
|
306
|
+
$[78] = isLastRow;
|
|
307
|
+
$[79] = isPreviewActive;
|
|
308
|
+
$[80] = isSelected;
|
|
309
|
+
$[81] = listeners;
|
|
310
|
+
$[82] = overId;
|
|
311
|
+
$[83] = row.depth;
|
|
312
|
+
$[84] = row.id;
|
|
313
|
+
$[85] = stretch;
|
|
314
|
+
$[86] = table;
|
|
315
|
+
$[87] = testId;
|
|
316
|
+
$[88] = t7;
|
|
317
|
+
} else t7 = $[88];
|
|
317
318
|
let t8;
|
|
318
|
-
if ($[
|
|
319
|
+
if ($[89] !== dndStyle || $[90] !== expandingEnabled || $[91] !== isLastRowExpanded || $[92] !== row) {
|
|
319
320
|
t8 = expandingEnabled && /*#__PURE__*/ jsx(TableRowExpanded, {
|
|
320
321
|
row: row,
|
|
321
322
|
dndStyle: dndStyle,
|
|
322
323
|
lastRow: isLastRowExpanded
|
|
323
324
|
});
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
} else t8 = $[
|
|
325
|
+
$[89] = dndStyle;
|
|
326
|
+
$[90] = expandingEnabled;
|
|
327
|
+
$[91] = isLastRowExpanded;
|
|
328
|
+
$[92] = row;
|
|
329
|
+
$[93] = t8;
|
|
330
|
+
} else t8 = $[93];
|
|
330
331
|
let t9;
|
|
331
|
-
if ($[
|
|
332
|
+
if ($[94] !== t7 || $[95] !== t8) {
|
|
332
333
|
t9 = /*#__PURE__*/ jsxs(Fragment, {
|
|
333
334
|
children: [
|
|
334
335
|
t7,
|
|
335
336
|
t8
|
|
336
337
|
]
|
|
337
338
|
});
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
} else t9 = $[
|
|
339
|
+
$[94] = t7;
|
|
340
|
+
$[95] = t8;
|
|
341
|
+
$[96] = t9;
|
|
342
|
+
} else t9 = $[96];
|
|
342
343
|
return t9;
|
|
343
344
|
};
|
|
344
345
|
TableRowInner.displayName = "TableRow";
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { GripVertical } from "../../../icons/index.js";
|
|
4
|
+
import { useTableContext } from "../TableContext/useTableContext.js";
|
|
3
5
|
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH } from "./constants.js";
|
|
6
|
+
import { isGroupRow } from "./isGroupRow.js";
|
|
7
|
+
import { useTableValue } from "./tableReactivity.js";
|
|
8
|
+
const DragHandle = (t0)=>{
|
|
9
|
+
const $ = c(5);
|
|
10
|
+
const { row } = t0;
|
|
11
|
+
const { showEmptyGroups } = useTableContext();
|
|
12
|
+
let t1;
|
|
13
|
+
if ($[0] !== row || $[1] !== showEmptyGroups) {
|
|
14
|
+
t1 = ()=>isGroupRow(row, showEmptyGroups);
|
|
15
|
+
$[0] = row;
|
|
16
|
+
$[1] = showEmptyGroups;
|
|
17
|
+
$[2] = t1;
|
|
18
|
+
} else t1 = $[2];
|
|
19
|
+
const isGroup = useTableValue(t1);
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[3] !== isGroup) {
|
|
22
|
+
t2 = isGroup ? null : /*#__PURE__*/ jsx(GripVertical, {
|
|
23
|
+
size: "sm",
|
|
24
|
+
className: "text-text-secondary"
|
|
25
|
+
});
|
|
26
|
+
$[3] = isGroup;
|
|
27
|
+
$[4] = t2;
|
|
28
|
+
} else t2 = $[4];
|
|
29
|
+
return t2;
|
|
30
|
+
};
|
|
4
31
|
const createDragHandleColumn = ()=>({
|
|
5
32
|
id: TABLE_DRAG_HANDLE_COLUMN_ID,
|
|
6
33
|
size: TABLE_DRAG_HANDLE_COLUMN_WIDTH,
|
|
@@ -11,13 +38,12 @@ const createDragHandleColumn = ()=>({
|
|
|
11
38
|
enableHiding: false,
|
|
12
39
|
enablePinning: false,
|
|
13
40
|
meta: {
|
|
14
|
-
headerClassName:
|
|
15
|
-
cellClassName:
|
|
41
|
+
headerClassName: "px-4 py-4",
|
|
42
|
+
cellClassName: "px-4 py-8 align-middle text-center"
|
|
16
43
|
},
|
|
17
44
|
header: ()=>null,
|
|
18
|
-
cell: ()=>/*#__PURE__*/ jsx(
|
|
19
|
-
|
|
20
|
-
className: "text-text-secondary"
|
|
45
|
+
cell: ({ row })=>/*#__PURE__*/ jsx(DragHandle, {
|
|
46
|
+
row: row
|
|
21
47
|
})
|
|
22
48
|
});
|
|
23
49
|
export { createDragHandleColumn };
|
|
@@ -9,6 +9,7 @@ export { detectDataChange } from './detectDataChange.js';
|
|
|
9
9
|
export { type DSTableFeatures, dsTableFeatures } from './dsTableFeatures.js';
|
|
10
10
|
export { getDndStyles } from './getDndStyles.js';
|
|
11
11
|
export { getRowKey } from './getRowKey.js';
|
|
12
|
+
export { isGroupRow } from './isGroupRow.js';
|
|
12
13
|
export { isLastPinnedLeft } from './isLastPinnedLeft.js';
|
|
13
14
|
export { getOffsetTopInScrollRoot, getScrollMetrics, getScrollRoot, isWindowScrollRoot, type ScrollRoot, scrollRootBy, } from './scrollRoot.js';
|
|
14
15
|
export { useColumnPinning, useTableValue, withTableState } from './tableReactivity.js';
|
|
@@ -9,6 +9,7 @@ export { detectDataChange } from "./detectDataChange.js";
|
|
|
9
9
|
export { dsTableFeatures } from "./dsTableFeatures.js";
|
|
10
10
|
export { getDndStyles } from "./getDndStyles.js";
|
|
11
11
|
export { getRowKey } from "./getRowKey.js";
|
|
12
|
+
export { isGroupRow } from "./isGroupRow.js";
|
|
12
13
|
export { isLastPinnedLeft } from "./isLastPinnedLeft.js";
|
|
13
14
|
export { getOffsetTopInScrollRoot, getScrollMetrics, getScrollRoot, isWindowScrollRoot, scrollRootBy } from "./scrollRoot.js";
|
|
14
15
|
export { useColumnPinning, useTableValue, withTableState } from "./tableReactivity.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Row, RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { DSTableFeatures } from './dsTableFeatures.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a row renders as a group parent: it has sub-rows, or — with
|
|
5
|
+
* `showEmptyGroups` — it is a top-level row whose `getSubRows` returned an
|
|
6
|
+
* array, empty or not.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isGroupRow: <T extends RowData>(row: Row<DSTableFeatures, T>, showEmptyGroups: boolean) => boolean;
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
import { c } from "react/compiler-runtime";
|
|
2
2
|
import { useSortable } from "@dnd-kit/sortable";
|
|
3
3
|
import { useTableContext } from "../TableContext/useTableContext.js";
|
|
4
|
+
import { isGroupRow } from "./isGroupRow.js";
|
|
4
5
|
import { useTableValue } from "./tableReactivity.js";
|
|
5
6
|
const useRowDnd = (row)=>{
|
|
6
|
-
const $ = c(
|
|
7
|
-
const { rowDndEnabled } = useTableContext();
|
|
7
|
+
const $ = c(16);
|
|
8
|
+
const { rowDndEnabled, showEmptyGroups } = useTableContext();
|
|
8
9
|
let t0;
|
|
9
|
-
if ($[0] !== row
|
|
10
|
-
t0 = ()=>row
|
|
11
|
-
$[0] = row
|
|
12
|
-
$[1] =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
10
|
+
if ($[0] !== row || $[1] !== showEmptyGroups) {
|
|
11
|
+
t0 = ()=>isGroupRow(row, showEmptyGroups);
|
|
12
|
+
$[0] = row;
|
|
13
|
+
$[1] = showEmptyGroups;
|
|
14
|
+
$[2] = t0;
|
|
15
|
+
} else t0 = $[2];
|
|
16
|
+
const isGroup = useTableValue(t0);
|
|
17
|
+
const canDnd = rowDndEnabled && !isGroup;
|
|
16
18
|
const t1 = !canDnd;
|
|
17
19
|
let t2;
|
|
18
|
-
if ($[
|
|
20
|
+
if ($[3] !== row.id || $[4] !== t1) {
|
|
19
21
|
t2 = {
|
|
20
22
|
id: row.id,
|
|
21
23
|
disabled: t1
|
|
22
24
|
};
|
|
23
|
-
$[
|
|
24
|
-
$[
|
|
25
|
-
$[
|
|
26
|
-
} else t2 = $[
|
|
25
|
+
$[3] = row.id;
|
|
26
|
+
$[4] = t1;
|
|
27
|
+
$[5] = t2;
|
|
28
|
+
} else t2 = $[5];
|
|
27
29
|
const { attributes, listeners, setNodeRef, isDragging } = useSortable(t2);
|
|
28
30
|
let t3;
|
|
29
|
-
if ($[
|
|
31
|
+
if ($[6] !== canDnd || $[7] !== isDragging) {
|
|
30
32
|
t3 = canDnd && isDragging ? {
|
|
31
33
|
opacity: 0.4
|
|
32
34
|
} : {};
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
$[
|
|
36
|
-
} else t3 = $[
|
|
35
|
+
$[6] = canDnd;
|
|
36
|
+
$[7] = isDragging;
|
|
37
|
+
$[8] = t3;
|
|
38
|
+
} else t3 = $[8];
|
|
37
39
|
const style = t3;
|
|
38
40
|
let t4;
|
|
39
|
-
if ($[
|
|
41
|
+
if ($[9] !== attributes || $[10] !== canDnd || $[11] !== isDragging || $[12] !== listeners || $[13] !== setNodeRef || $[14] !== style) {
|
|
40
42
|
t4 = {
|
|
41
43
|
canDnd,
|
|
42
44
|
isDragging,
|
|
@@ -45,14 +47,14 @@ const useRowDnd = (row)=>{
|
|
|
45
47
|
attributes,
|
|
46
48
|
listeners
|
|
47
49
|
};
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
} else t4 = $[
|
|
50
|
+
$[9] = attributes;
|
|
51
|
+
$[10] = canDnd;
|
|
52
|
+
$[11] = isDragging;
|
|
53
|
+
$[12] = listeners;
|
|
54
|
+
$[13] = setNodeRef;
|
|
55
|
+
$[14] = style;
|
|
56
|
+
$[15] = t4;
|
|
57
|
+
} else t4 = $[15];
|
|
56
58
|
return t4;
|
|
57
59
|
};
|
|
58
60
|
export { useRowDnd };
|
|
@@ -223,6 +223,12 @@ export interface TableProps<T> extends TestableProps {
|
|
|
223
223
|
renderGroupRow?: (row: TableRow<T>) => ReactNode;
|
|
224
224
|
/** Sub-row accessor for hierarchical/tree data (used with renderGroupRow) */
|
|
225
225
|
getSubRows?: (row: T) => T[] | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Render a top-level row whose `getSubRows` returns an empty array as an
|
|
228
|
+
* (empty) group row instead of a plain row — for groups that stay visible
|
|
229
|
+
* with nothing in them yet. Return `undefined` for rows that are not groups.
|
|
230
|
+
*/
|
|
231
|
+
showEmptyGroups?: boolean;
|
|
226
232
|
expanded?: TableExpandedState;
|
|
227
233
|
onExpandedChange?: TableOnChangeFn<TableExpandedState>;
|
|
228
234
|
renderExpandedRow?: (row: TableRow<T>) => ReactNode;
|
|
@@ -277,7 +283,8 @@ export interface TableProps<T> extends TestableProps {
|
|
|
277
283
|
/**
|
|
278
284
|
* Callback fired when a row is dragged to a new position. When provided,
|
|
279
285
|
* a drag-handle column is auto-injected and row DnD is enabled.
|
|
280
|
-
*
|
|
286
|
+
* With `getSubRows` grouping, group rows stay put and a row moves only
|
|
287
|
+
* among the rows of its own group.
|
|
281
288
|
*/
|
|
282
289
|
onRowReorder?: (event: TableRowReorderEvent) => void;
|
|
283
290
|
/** Callback fired when the master cell is clicked. Receives the row ID. */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { SvgIcon } from "./SvgIcon.js";
|
|
4
|
+
const ArrowRightAlt = (props)=>{
|
|
5
|
+
const $ = c(3);
|
|
6
|
+
let t0;
|
|
7
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
8
|
+
t0 = /*#__PURE__*/ jsx("path", {
|
|
9
|
+
d: "M5.98709 12.592C5.84309 12.604 5.70509 12.616 5.57309 12.628C5.44109 12.64 5.33309 12.646 5.24909 12.646C4.97309 12.646 4.76909 12.586 4.63709 12.466C4.51709 12.346 4.45709 12.208 4.45709 12.052C4.45709 11.932 4.52909 11.812 4.67309 11.692C4.82909 11.56 5.07509 11.434 5.41109 11.314C5.68709 11.218 6.13109 11.128 6.74309 11.044C7.35509 10.96 8.06309 10.888 8.86709 10.828C9.67109 10.756 10.5051 10.696 11.3691 10.648C12.2331 10.6 13.0491 10.564 13.8171 10.54C14.5971 10.516 15.2631 10.504 15.8151 10.504C16.1151 10.504 16.3791 10.51 16.6071 10.522C16.8351 10.522 17.0391 10.528 17.2191 10.54C16.8711 10.132 16.5291 9.712 16.1931 9.28C15.8691 8.836 15.5691 8.416 15.2931 8.02C15.0291 7.624 14.8131 7.282 14.6451 6.994C14.4891 6.694 14.4111 6.49 14.4111 6.382C14.4111 6.37 14.4111 6.358 14.4111 6.346C14.4111 6.19 14.4291 6.064 14.4651 5.968C14.5011 5.86 14.6331 5.806 14.8611 5.806C14.9931 5.806 15.1971 5.926 15.4731 6.166C15.7611 6.394 16.0791 6.694 16.4271 7.066C16.7871 7.438 17.1471 7.84 17.5071 8.272C17.8671 8.704 18.1971 9.124 18.4971 9.532C18.8091 9.928 19.0611 10.276 19.2531 10.576C19.4451 10.876 19.5411 11.074 19.5411 11.17C19.5411 11.302 19.4391 11.536 19.2351 11.872C19.0311 12.196 18.7611 12.58 18.4251 13.024C18.0891 13.456 17.7291 13.9 17.3451 14.356C16.9611 14.812 16.5891 15.238 16.2291 15.634C15.8691 16.018 15.5571 16.33 15.2931 16.57C15.0291 16.81 14.8491 16.93 14.7531 16.93C14.3091 16.93 14.0871 16.738 14.0871 16.354C14.0871 16.234 14.1651 16.042 14.3211 15.778C14.4891 15.502 14.7051 15.184 14.9691 14.824C15.2451 14.452 15.5391 14.068 15.8511 13.672C16.1631 13.264 16.4751 12.874 16.7871 12.502C17.0991 12.118 17.3811 11.782 17.6331 11.494C17.2011 11.59 16.6071 11.68 15.8511 11.764C15.0951 11.836 14.2611 11.914 13.3491 11.998C12.4371 12.07 11.5191 12.142 10.5951 12.214C9.67109 12.274 8.80109 12.34 7.98509 12.412C7.18109 12.472 6.51509 12.532 5.98709 12.592Z",
|
|
10
|
+
fill: "currentColor"
|
|
11
|
+
});
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
} else t0 = $[0];
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[1] !== props) {
|
|
16
|
+
t1 = /*#__PURE__*/ jsx(SvgIcon, {
|
|
17
|
+
...props,
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
children: t0
|
|
20
|
+
});
|
|
21
|
+
$[1] = props;
|
|
22
|
+
$[2] = t1;
|
|
23
|
+
} else t1 = $[2];
|
|
24
|
+
return t1;
|
|
25
|
+
};
|
|
26
|
+
ArrowRightAlt.displayName = "ArrowRightAltIcon";
|
|
27
|
+
export { ArrowRightAlt };
|