@wallarm-org/design-system 2.5.0 → 2.6.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/TableContext/TableProvider.js +293 -289
- package/dist/components/Table/lib/createExpandColumn.d.ts +6 -2
- package/dist/components/Table/lib/createExpandColumn.js +2 -2
- package/dist/components/Table/types.d.ts +7 -0
- package/dist/metadata/components.json +13 -2
- package/package.json +1 -1
|
@@ -17,16 +17,17 @@ const toTanStackPinning = (p, pinnedLeft)=>({
|
|
|
17
17
|
});
|
|
18
18
|
const TableProvider = (props)=>{
|
|
19
19
|
const $ = compiler_runtime_c(168);
|
|
20
|
-
const { data, columns, isLoading: t0, isLoadingPrevious: t1, skeletonCount: t2, children, getRowId, sorting: sortingProp, onSortingChange, manualSorting: t3, rowSelection: rowSelectionProp, onRowSelectionChange, enableSelectAllRows: t4, onSelectAllRows, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, groupRowSpan: t5, getSubRows, showEmptyGroups:
|
|
20
|
+
const { data, columns, isLoading: t0, isLoadingPrevious: t1, skeletonCount: t2, children, getRowId, sorting: sortingProp, onSortingChange, manualSorting: t3, rowSelection: rowSelectionProp, onRowSelectionChange, enableSelectAllRows: t4, onSelectAllRows, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, groupRowSpan: t5, groupExpandColumn: t6, getSubRows, showEmptyGroups: t7, renderExpandedRow, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, defaultColumnVisibility, defaultColumnOrder, columnGroups, virtualized, stretch: t8, estimateRowHeight, overscan: t9, onEndReached, onEndReachedThreshold, onStartReached, onStartReachedThreshold, initialScrollToRowId, onRowReorder, getRowCanDrag, renderFullWidthRow, onMasterCellClick, activeRowId: activeRowIdProp, onSettingsOpenChange } = props;
|
|
21
21
|
const isLoading = void 0 === t0 ? false : t0;
|
|
22
22
|
const isLoadingPrevious = void 0 === t1 ? false : t1;
|
|
23
23
|
const skeletonCount = void 0 === t2 ? TABLE_SKELETON_ROWS : t2;
|
|
24
24
|
const manualSorting = void 0 === t3 ? false : t3;
|
|
25
25
|
const enableSelectAllRows = void 0 === t4 ? true : t4;
|
|
26
26
|
const groupRowSpan = void 0 === t5 ? "master" : t5;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
27
|
+
const groupExpandColumn = void 0 === t6 ? false : t6;
|
|
28
|
+
const showEmptyGroups = void 0 === t7 ? false : t7;
|
|
29
|
+
const stretch = void 0 === t8 ? true : t8;
|
|
30
|
+
const overscan = void 0 === t9 ? TABLE_VIRTUALIZATION_OVERSCAN : t9;
|
|
30
31
|
const masterCellActiveRowId = activeRowIdProp ?? null;
|
|
31
32
|
const sortingEnabled = !!onSortingChange;
|
|
32
33
|
const selectionEnabled = !!onRowSelectionChange;
|
|
@@ -38,47 +39,51 @@ const TableProvider = (props)=>{
|
|
|
38
39
|
const rowDndEnabled = !!onRowReorder;
|
|
39
40
|
const expandingEnabled = !!renderExpandedRow || !!onExpandedChange || subRowGroupingEnabled;
|
|
40
41
|
const visibilityEnabled = !!onColumnVisibilityChange;
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const expandColumnEnabled = expandingEnabled && (!subRowGroupingEnabled || groupExpandColumn);
|
|
43
|
+
let t10;
|
|
44
|
+
if ($[0] !== columns || $[1] !== data[0] || $[2] !== expandColumnEnabled || $[3] !== rowDndEnabled || $[4] !== selectionEnabled || $[5] !== subRowGroupingEnabled) {
|
|
43
45
|
bb0: {
|
|
44
46
|
const cols = columns;
|
|
45
47
|
let prefix;
|
|
46
|
-
if ($[7] !==
|
|
48
|
+
if ($[7] !== expandColumnEnabled || $[8] !== rowDndEnabled || $[9] !== selectionEnabled || $[10] !== subRowGroupingEnabled) {
|
|
47
49
|
prefix = [];
|
|
48
|
-
if (
|
|
49
|
-
let
|
|
50
|
-
if ($[12]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if (expandColumnEnabled) {
|
|
51
|
+
let t11;
|
|
52
|
+
if ($[12] !== subRowGroupingEnabled) {
|
|
53
|
+
t11 = createExpandColumn({
|
|
54
|
+
groupsOnly: subRowGroupingEnabled
|
|
55
|
+
});
|
|
56
|
+
$[12] = subRowGroupingEnabled;
|
|
57
|
+
$[13] = t11;
|
|
58
|
+
} else t11 = $[13];
|
|
59
|
+
prefix.push(t11);
|
|
55
60
|
}
|
|
56
61
|
if (selectionEnabled) {
|
|
57
|
-
let
|
|
58
|
-
if ($[
|
|
59
|
-
|
|
60
|
-
$[
|
|
61
|
-
} else
|
|
62
|
-
prefix.push(
|
|
62
|
+
let t11;
|
|
63
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t11 = createSelectionColumn();
|
|
65
|
+
$[14] = t11;
|
|
66
|
+
} else t11 = $[14];
|
|
67
|
+
prefix.push(t11);
|
|
63
68
|
}
|
|
64
69
|
if (rowDndEnabled) {
|
|
65
|
-
let
|
|
66
|
-
if ($[
|
|
67
|
-
|
|
68
|
-
$[
|
|
69
|
-
} else
|
|
70
|
-
prefix.push(
|
|
70
|
+
let t11;
|
|
71
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
72
|
+
t11 = createDragHandleColumn();
|
|
73
|
+
$[15] = t11;
|
|
74
|
+
} else t11 = $[15];
|
|
75
|
+
prefix.push(t11);
|
|
71
76
|
}
|
|
72
|
-
$[7] =
|
|
77
|
+
$[7] = expandColumnEnabled;
|
|
73
78
|
$[8] = rowDndEnabled;
|
|
74
79
|
$[9] = selectionEnabled;
|
|
75
80
|
$[10] = subRowGroupingEnabled;
|
|
76
81
|
$[11] = prefix;
|
|
77
82
|
} else prefix = $[11];
|
|
78
83
|
const firstRow = data[0];
|
|
79
|
-
let
|
|
80
|
-
if ($[
|
|
81
|
-
|
|
84
|
+
let t11;
|
|
85
|
+
if ($[16] !== firstRow) {
|
|
86
|
+
t11 = (col)=>{
|
|
82
87
|
if (!firstRow || !("accessorKey" in col) || col.meta?.sortType) return col;
|
|
83
88
|
const value = firstRow[col.accessorKey];
|
|
84
89
|
if ("number" == typeof value) return {
|
|
@@ -90,17 +95,17 @@ const TableProvider = (props)=>{
|
|
|
90
95
|
};
|
|
91
96
|
return col;
|
|
92
97
|
};
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
} else
|
|
96
|
-
const withAutoMeta = cols.map(
|
|
98
|
+
$[16] = firstRow;
|
|
99
|
+
$[17] = t11;
|
|
100
|
+
} else t11 = $[17];
|
|
101
|
+
const withAutoMeta = cols.map(t11);
|
|
97
102
|
const masterOverrides = {
|
|
98
103
|
enableColumnPinning: false,
|
|
99
104
|
enableHiding: false
|
|
100
105
|
};
|
|
101
106
|
if (0 === prefix.length) {
|
|
102
107
|
if (withAutoMeta.length > 0) {
|
|
103
|
-
|
|
108
|
+
t10 = [
|
|
104
109
|
{
|
|
105
110
|
...withAutoMeta[0],
|
|
106
111
|
...masterOverrides
|
|
@@ -109,118 +114,117 @@ const TableProvider = (props)=>{
|
|
|
109
114
|
];
|
|
110
115
|
break bb0;
|
|
111
116
|
}
|
|
112
|
-
|
|
117
|
+
t10 = withAutoMeta;
|
|
113
118
|
break bb0;
|
|
114
119
|
}
|
|
115
120
|
const userCols = withAutoMeta.length > 0 ? withAutoMeta.map((col_0, index)=>0 === index ? {
|
|
116
121
|
...col_0,
|
|
117
122
|
...masterOverrides
|
|
118
123
|
} : col_0) : withAutoMeta;
|
|
119
|
-
|
|
124
|
+
t10 = [
|
|
120
125
|
...prefix,
|
|
121
126
|
...userCols
|
|
122
127
|
];
|
|
123
128
|
}
|
|
124
129
|
$[0] = columns;
|
|
125
130
|
$[1] = data[0];
|
|
126
|
-
$[2] =
|
|
131
|
+
$[2] = expandColumnEnabled;
|
|
127
132
|
$[3] = rowDndEnabled;
|
|
128
133
|
$[4] = selectionEnabled;
|
|
129
134
|
$[5] = subRowGroupingEnabled;
|
|
130
|
-
$[6] =
|
|
131
|
-
} else
|
|
132
|
-
const mergedColumns =
|
|
133
|
-
let
|
|
135
|
+
$[6] = t10;
|
|
136
|
+
} else t10 = $[6];
|
|
137
|
+
const mergedColumns = t10;
|
|
138
|
+
let t11;
|
|
134
139
|
bb1: {
|
|
135
140
|
if (0 === columns.length) {
|
|
136
|
-
|
|
141
|
+
t11 = null;
|
|
137
142
|
break bb1;
|
|
138
143
|
}
|
|
139
144
|
const firstCol = columns[0];
|
|
140
145
|
if (!firstCol) {
|
|
141
|
-
|
|
146
|
+
t11 = null;
|
|
142
147
|
break bb1;
|
|
143
148
|
}
|
|
144
|
-
|
|
149
|
+
t11 = ("accessorKey" in firstCol ? String(firstCol.accessorKey) : firstCol.id) ?? null;
|
|
145
150
|
}
|
|
146
|
-
const masterColumnId =
|
|
151
|
+
const masterColumnId = t11;
|
|
147
152
|
let ids;
|
|
148
|
-
if ($[
|
|
153
|
+
if ($[18] !== expandColumnEnabled || $[19] !== masterColumnId || $[20] !== rowDndEnabled || $[21] !== selectionEnabled) {
|
|
149
154
|
ids = [];
|
|
150
|
-
if (
|
|
155
|
+
if (expandColumnEnabled) ids.push(TABLE_EXPAND_COLUMN_ID);
|
|
151
156
|
if (selectionEnabled) ids.push(TABLE_SELECT_COLUMN_ID);
|
|
152
157
|
if (rowDndEnabled) ids.push(TABLE_DRAG_HANDLE_COLUMN_ID);
|
|
153
158
|
if (masterColumnId) ids.push(masterColumnId);
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[21] = subRowGroupingEnabled;
|
|
159
|
+
$[18] = expandColumnEnabled;
|
|
160
|
+
$[19] = masterColumnId;
|
|
161
|
+
$[20] = rowDndEnabled;
|
|
162
|
+
$[21] = selectionEnabled;
|
|
159
163
|
$[22] = ids;
|
|
160
164
|
} else ids = $[22];
|
|
161
165
|
const alwaysPinnedLeft = ids;
|
|
162
|
-
let t11;
|
|
163
|
-
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
164
|
-
t11 = [];
|
|
165
|
-
$[23] = t11;
|
|
166
|
-
} else t11 = $[23];
|
|
167
|
-
const [sorting, handleSortingChange] = useTableState(sortingProp, t11, onSortingChange);
|
|
168
166
|
let t12;
|
|
169
|
-
if ($[
|
|
170
|
-
t12 =
|
|
171
|
-
$[
|
|
172
|
-
} else t12 = $[
|
|
173
|
-
const [
|
|
167
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
168
|
+
t12 = [];
|
|
169
|
+
$[23] = t12;
|
|
170
|
+
} else t12 = $[23];
|
|
171
|
+
const [sorting, handleSortingChange] = useTableState(sortingProp, t12, onSortingChange);
|
|
174
172
|
let t13;
|
|
175
|
-
if ($[
|
|
173
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
176
174
|
t13 = {};
|
|
177
|
-
$[
|
|
178
|
-
} else t13 = $[
|
|
179
|
-
const [
|
|
175
|
+
$[24] = t13;
|
|
176
|
+
} else t13 = $[24];
|
|
177
|
+
const [rowSelection, handleRowSelectionChange] = useTableState(rowSelectionProp, t13, onRowSelectionChange);
|
|
180
178
|
let t14;
|
|
179
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
180
|
+
t14 = {};
|
|
181
|
+
$[25] = t14;
|
|
182
|
+
} else t14 = $[25];
|
|
183
|
+
const [columnSizing, handleColumnSizingChange] = useTableState(columnSizingProp, t14, onColumnSizingChange);
|
|
184
|
+
let t15;
|
|
181
185
|
if ($[26] !== defaultColumnOrder) {
|
|
182
|
-
|
|
186
|
+
t15 = defaultColumnOrder ?? [];
|
|
183
187
|
$[26] = defaultColumnOrder;
|
|
184
|
-
$[27] =
|
|
185
|
-
} else
|
|
186
|
-
const [columnOrder, handleColumnOrderChange] = useTableState(columnOrderProp,
|
|
187
|
-
let t15;
|
|
188
|
-
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
189
|
-
t15 = [];
|
|
190
|
-
$[28] = t15;
|
|
191
|
-
} else t15 = $[28];
|
|
192
|
-
const [grouping, handleGroupingChange] = useTableState(groupingProp, t15, onGroupingChange);
|
|
188
|
+
$[27] = t15;
|
|
189
|
+
} else t15 = $[27];
|
|
190
|
+
const [columnOrder, handleColumnOrderChange] = useTableState(columnOrderProp, t15, onColumnOrderChange);
|
|
193
191
|
let t16;
|
|
194
|
-
if ($[
|
|
195
|
-
t16 =
|
|
196
|
-
$[
|
|
197
|
-
} else t16 = $[
|
|
198
|
-
const [
|
|
192
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
193
|
+
t16 = [];
|
|
194
|
+
$[28] = t16;
|
|
195
|
+
} else t16 = $[28];
|
|
196
|
+
const [grouping, handleGroupingChange] = useTableState(groupingProp, t16, onGroupingChange);
|
|
199
197
|
let t17;
|
|
198
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
199
|
+
t17 = {};
|
|
200
|
+
$[29] = t17;
|
|
201
|
+
} else t17 = $[29];
|
|
202
|
+
const [expanded, handleExpandedChange] = useTableState(expandedProp, t17, onExpandedChange);
|
|
203
|
+
let t18;
|
|
200
204
|
if ($[30] !== defaultColumnVisibility) {
|
|
201
|
-
|
|
205
|
+
t18 = defaultColumnVisibility ?? {};
|
|
202
206
|
$[30] = defaultColumnVisibility;
|
|
203
|
-
$[31] =
|
|
204
|
-
} else
|
|
205
|
-
const [columnVisibility, handleColumnVisibilityChange] = useTableState(columnVisibilityProp,
|
|
206
|
-
let t18;
|
|
207
|
-
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
208
|
-
t18 = {};
|
|
209
|
-
$[32] = t18;
|
|
210
|
-
} else t18 = $[32];
|
|
207
|
+
$[31] = t18;
|
|
208
|
+
} else t18 = $[31];
|
|
209
|
+
const [columnVisibility, handleColumnVisibilityChange] = useTableState(columnVisibilityProp, t18, onColumnVisibilityChange);
|
|
211
210
|
let t19;
|
|
211
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
212
|
+
t19 = {};
|
|
213
|
+
$[32] = t19;
|
|
214
|
+
} else t19 = $[32];
|
|
215
|
+
let t20;
|
|
212
216
|
if ($[33] !== columnPinningProp) {
|
|
213
|
-
|
|
217
|
+
t20 = {
|
|
214
218
|
controlled: columnPinningProp,
|
|
215
|
-
default:
|
|
219
|
+
default: t19
|
|
216
220
|
};
|
|
217
221
|
$[33] = columnPinningProp;
|
|
218
|
-
$[34] =
|
|
219
|
-
} else
|
|
220
|
-
const [columnPinning, setColumnPinningInternal] = useControlled(
|
|
221
|
-
let
|
|
222
|
+
$[34] = t20;
|
|
223
|
+
} else t20 = $[34];
|
|
224
|
+
const [columnPinning, setColumnPinningInternal] = useControlled(t20);
|
|
225
|
+
let t21;
|
|
222
226
|
if ($[35] !== alwaysPinnedLeft || $[36] !== columnPinning || $[37] !== onColumnPinningChange || $[38] !== setColumnPinningInternal) {
|
|
223
|
-
|
|
227
|
+
t21 = (updater)=>{
|
|
224
228
|
const prevTanStackShape = toTanStackPinning(columnPinning, alwaysPinnedLeft);
|
|
225
229
|
const newValue = "function" == typeof updater ? updater(prevTanStackShape) : updater;
|
|
226
230
|
const enforcedStart = [
|
|
@@ -238,12 +242,12 @@ const TableProvider = (props)=>{
|
|
|
238
242
|
$[36] = columnPinning;
|
|
239
243
|
$[37] = onColumnPinningChange;
|
|
240
244
|
$[38] = setColumnPinningInternal;
|
|
241
|
-
$[39] =
|
|
242
|
-
} else
|
|
243
|
-
const handleColumnPinningChange =
|
|
244
|
-
let
|
|
245
|
+
$[39] = t21;
|
|
246
|
+
} else t21 = $[39];
|
|
247
|
+
const handleColumnPinningChange = t21;
|
|
248
|
+
let t22;
|
|
245
249
|
if ($[40] !== alwaysPinnedLeft || $[41] !== handleColumnOrderChange) {
|
|
246
|
-
|
|
250
|
+
t22 = (newOrder)=>{
|
|
247
251
|
const rest = newOrder.filter((id_0)=>!alwaysPinnedLeft.includes(id_0));
|
|
248
252
|
handleColumnOrderChange([
|
|
249
253
|
...alwaysPinnedLeft,
|
|
@@ -252,142 +256,142 @@ const TableProvider = (props)=>{
|
|
|
252
256
|
};
|
|
253
257
|
$[40] = alwaysPinnedLeft;
|
|
254
258
|
$[41] = handleColumnOrderChange;
|
|
255
|
-
$[42] =
|
|
256
|
-
} else
|
|
257
|
-
const setColumnOrder =
|
|
258
|
-
let
|
|
259
|
+
$[42] = t22;
|
|
260
|
+
} else t22 = $[42];
|
|
261
|
+
const setColumnOrder = t22;
|
|
262
|
+
let t23;
|
|
259
263
|
if ($[43] !== sorting) {
|
|
260
|
-
|
|
264
|
+
t23 = sorting ?? [];
|
|
261
265
|
$[43] = sorting;
|
|
262
|
-
$[44] =
|
|
263
|
-
} else
|
|
264
|
-
let
|
|
266
|
+
$[44] = t23;
|
|
267
|
+
} else t23 = $[44];
|
|
268
|
+
let t24;
|
|
265
269
|
if ($[45] !== rowSelection) {
|
|
266
|
-
|
|
270
|
+
t24 = rowSelection ?? {};
|
|
267
271
|
$[45] = rowSelection;
|
|
268
|
-
$[46] =
|
|
269
|
-
} else
|
|
270
|
-
let
|
|
272
|
+
$[46] = t24;
|
|
273
|
+
} else t24 = $[46];
|
|
274
|
+
let t25;
|
|
271
275
|
if ($[47] !== columnSizing) {
|
|
272
|
-
|
|
276
|
+
t25 = columnSizing ?? {};
|
|
273
277
|
$[47] = columnSizing;
|
|
274
|
-
$[48] =
|
|
275
|
-
} else
|
|
276
|
-
let
|
|
278
|
+
$[48] = t25;
|
|
279
|
+
} else t25 = $[48];
|
|
280
|
+
let t26;
|
|
277
281
|
if ($[49] !== alwaysPinnedLeft || $[50] !== columnPinning) {
|
|
278
|
-
|
|
282
|
+
t26 = toTanStackPinning(columnPinning, alwaysPinnedLeft);
|
|
279
283
|
$[49] = alwaysPinnedLeft;
|
|
280
284
|
$[50] = columnPinning;
|
|
281
|
-
$[51] =
|
|
282
|
-
} else
|
|
283
|
-
let
|
|
285
|
+
$[51] = t26;
|
|
286
|
+
} else t26 = $[51];
|
|
287
|
+
let t27;
|
|
284
288
|
if ($[52] !== columnOrder) {
|
|
285
|
-
|
|
289
|
+
t27 = columnOrder ?? [];
|
|
286
290
|
$[52] = columnOrder;
|
|
287
|
-
$[53] =
|
|
288
|
-
} else
|
|
289
|
-
let
|
|
291
|
+
$[53] = t27;
|
|
292
|
+
} else t27 = $[53];
|
|
293
|
+
let t28;
|
|
290
294
|
if ($[54] !== grouping) {
|
|
291
|
-
|
|
295
|
+
t28 = grouping ?? [];
|
|
292
296
|
$[54] = grouping;
|
|
293
|
-
$[55] =
|
|
294
|
-
} else
|
|
295
|
-
let
|
|
297
|
+
$[55] = t28;
|
|
298
|
+
} else t28 = $[55];
|
|
299
|
+
let t29;
|
|
296
300
|
if ($[56] !== expanded) {
|
|
297
|
-
|
|
301
|
+
t29 = expanded ?? {};
|
|
298
302
|
$[56] = expanded;
|
|
299
|
-
$[57] =
|
|
300
|
-
} else
|
|
301
|
-
let
|
|
303
|
+
$[57] = t29;
|
|
304
|
+
} else t29 = $[57];
|
|
305
|
+
let t30;
|
|
302
306
|
if ($[58] !== columnVisibility) {
|
|
303
|
-
|
|
307
|
+
t30 = columnVisibility ?? {};
|
|
304
308
|
$[58] = columnVisibility;
|
|
305
|
-
$[59] =
|
|
306
|
-
} else
|
|
307
|
-
let
|
|
308
|
-
if ($[60] !==
|
|
309
|
-
|
|
310
|
-
sorting:
|
|
311
|
-
rowSelection:
|
|
312
|
-
columnSizing:
|
|
313
|
-
columnPinning:
|
|
314
|
-
columnOrder:
|
|
315
|
-
grouping:
|
|
316
|
-
expanded:
|
|
317
|
-
columnVisibility:
|
|
309
|
+
$[59] = t30;
|
|
310
|
+
} else t30 = $[59];
|
|
311
|
+
let t31;
|
|
312
|
+
if ($[60] !== t23 || $[61] !== t24 || $[62] !== t25 || $[63] !== t26 || $[64] !== t27 || $[65] !== t28 || $[66] !== t29 || $[67] !== t30) {
|
|
313
|
+
t31 = {
|
|
314
|
+
sorting: t23,
|
|
315
|
+
rowSelection: t24,
|
|
316
|
+
columnSizing: t25,
|
|
317
|
+
columnPinning: t26,
|
|
318
|
+
columnOrder: t27,
|
|
319
|
+
grouping: t28,
|
|
320
|
+
expanded: t29,
|
|
321
|
+
columnVisibility: t30
|
|
318
322
|
};
|
|
319
|
-
$[60] =
|
|
320
|
-
$[61] =
|
|
321
|
-
$[62] =
|
|
322
|
-
$[63] =
|
|
323
|
-
$[64] =
|
|
324
|
-
$[65] =
|
|
325
|
-
$[66] =
|
|
326
|
-
$[67] =
|
|
327
|
-
$[68] =
|
|
328
|
-
} else
|
|
329
|
-
const
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
const
|
|
333
|
-
const
|
|
334
|
-
const
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
let
|
|
323
|
+
$[60] = t23;
|
|
324
|
+
$[61] = t24;
|
|
325
|
+
$[62] = t25;
|
|
326
|
+
$[63] = t26;
|
|
327
|
+
$[64] = t27;
|
|
328
|
+
$[65] = t28;
|
|
329
|
+
$[66] = t29;
|
|
330
|
+
$[67] = t30;
|
|
331
|
+
$[68] = t31;
|
|
332
|
+
} else t31 = $[68];
|
|
333
|
+
const t32 = sortingEnabled ? handleSortingChange : void 0;
|
|
334
|
+
const t33 = selectionEnabled ? handleRowSelectionChange : void 0;
|
|
335
|
+
const t34 = resizingEnabled ? handleColumnSizingChange : void 0;
|
|
336
|
+
const t35 = pinningEnabled ? handleColumnPinningChange : void 0;
|
|
337
|
+
const t36 = columnDndEnabled ? handleColumnOrderChange : void 0;
|
|
338
|
+
const t37 = groupingEnabled ? handleGroupingChange : void 0;
|
|
339
|
+
const t38 = expandingEnabled ? handleExpandedChange : void 0;
|
|
340
|
+
const t39 = visibilityEnabled ? handleColumnVisibilityChange : void 0;
|
|
341
|
+
let t40;
|
|
338
342
|
if ($[69] !== expandingEnabled) {
|
|
339
|
-
|
|
343
|
+
t40 = expandingEnabled ? {
|
|
340
344
|
autoResetExpanded: false
|
|
341
345
|
} : {};
|
|
342
346
|
$[69] = expandingEnabled;
|
|
343
|
-
$[70] =
|
|
344
|
-
} else
|
|
345
|
-
let
|
|
347
|
+
$[70] = t40;
|
|
348
|
+
} else t40 = $[70];
|
|
349
|
+
let t41;
|
|
346
350
|
if ($[71] !== expandingEnabled || $[72] !== renderExpandedRow || $[73] !== subRowGroupingEnabled) {
|
|
347
|
-
|
|
351
|
+
t41 = expandingEnabled && (renderExpandedRow || subRowGroupingEnabled) ? {
|
|
348
352
|
getRowCanExpand: _temp
|
|
349
353
|
} : {};
|
|
350
354
|
$[71] = expandingEnabled;
|
|
351
355
|
$[72] = renderExpandedRow;
|
|
352
356
|
$[73] = subRowGroupingEnabled;
|
|
353
|
-
$[74] =
|
|
354
|
-
} else
|
|
355
|
-
let
|
|
357
|
+
$[74] = t41;
|
|
358
|
+
} else t41 = $[74];
|
|
359
|
+
let t42;
|
|
356
360
|
if ($[75] === Symbol.for("react.memo_cache_sentinel")) {
|
|
357
|
-
|
|
361
|
+
t42 = {
|
|
358
362
|
minSize: TABLE_MIN_COLUMN_WIDTH
|
|
359
363
|
};
|
|
360
|
-
$[75] =
|
|
361
|
-
} else
|
|
362
|
-
let
|
|
363
|
-
if ($[76] !== data || $[77] !== expandingEnabled || $[78] !== getRowId || $[79] !== getSubRows || $[80] !== groupingEnabled || $[81] !== manualSorting || $[82] !== mergedColumns || $[83] !== resizingEnabled || $[84] !== selectionEnabled || $[85] !== sortingEnabled || $[86] !==
|
|
364
|
-
|
|
364
|
+
$[75] = t42;
|
|
365
|
+
} else t42 = $[75];
|
|
366
|
+
let t43;
|
|
367
|
+
if ($[76] !== data || $[77] !== expandingEnabled || $[78] !== getRowId || $[79] !== getSubRows || $[80] !== groupingEnabled || $[81] !== manualSorting || $[82] !== mergedColumns || $[83] !== resizingEnabled || $[84] !== selectionEnabled || $[85] !== sortingEnabled || $[86] !== t31 || $[87] !== t32 || $[88] !== t33 || $[89] !== t34 || $[90] !== t35 || $[91] !== t36 || $[92] !== t37 || $[93] !== t38 || $[94] !== t39 || $[95] !== t40 || $[96] !== t41 || $[97] !== visibilityEnabled) {
|
|
368
|
+
t43 = {
|
|
365
369
|
features: dsTableFeatures,
|
|
366
370
|
data,
|
|
367
371
|
columns: mergedColumns,
|
|
368
372
|
getRowId,
|
|
369
373
|
getSubRows,
|
|
370
374
|
manualSorting,
|
|
371
|
-
state:
|
|
372
|
-
onSortingChange:
|
|
373
|
-
onRowSelectionChange:
|
|
374
|
-
onColumnSizingChange:
|
|
375
|
-
onColumnPinningChange:
|
|
376
|
-
onColumnOrderChange:
|
|
377
|
-
onGroupingChange:
|
|
378
|
-
onExpandedChange:
|
|
379
|
-
onColumnVisibilityChange:
|
|
375
|
+
state: t31,
|
|
376
|
+
onSortingChange: t32,
|
|
377
|
+
onRowSelectionChange: t33,
|
|
378
|
+
onColumnSizingChange: t34,
|
|
379
|
+
onColumnPinningChange: t35,
|
|
380
|
+
onColumnOrderChange: t36,
|
|
381
|
+
onGroupingChange: t37,
|
|
382
|
+
onExpandedChange: t38,
|
|
383
|
+
onColumnVisibilityChange: t39,
|
|
380
384
|
enableSorting: sortingEnabled,
|
|
381
385
|
enableRowSelection: selectionEnabled,
|
|
382
386
|
enableColumnResizing: resizingEnabled,
|
|
383
387
|
enableColumnPinning: true,
|
|
384
388
|
enableGrouping: groupingEnabled,
|
|
385
389
|
enableExpanding: expandingEnabled,
|
|
386
|
-
...t39,
|
|
387
390
|
...t40,
|
|
391
|
+
...t41,
|
|
388
392
|
enableHiding: visibilityEnabled,
|
|
389
393
|
columnResizeMode: "onChange",
|
|
390
|
-
defaultColumn:
|
|
394
|
+
defaultColumn: t42
|
|
391
395
|
};
|
|
392
396
|
$[76] = data;
|
|
393
397
|
$[77] = expandingEnabled;
|
|
@@ -399,41 +403,41 @@ const TableProvider = (props)=>{
|
|
|
399
403
|
$[83] = resizingEnabled;
|
|
400
404
|
$[84] = selectionEnabled;
|
|
401
405
|
$[85] = sortingEnabled;
|
|
402
|
-
$[86] =
|
|
403
|
-
$[87] =
|
|
404
|
-
$[88] =
|
|
405
|
-
$[89] =
|
|
406
|
-
$[90] =
|
|
407
|
-
$[91] =
|
|
408
|
-
$[92] =
|
|
409
|
-
$[93] =
|
|
410
|
-
$[94] =
|
|
411
|
-
$[95] =
|
|
412
|
-
$[96] =
|
|
406
|
+
$[86] = t31;
|
|
407
|
+
$[87] = t32;
|
|
408
|
+
$[88] = t33;
|
|
409
|
+
$[89] = t34;
|
|
410
|
+
$[90] = t35;
|
|
411
|
+
$[91] = t36;
|
|
412
|
+
$[92] = t37;
|
|
413
|
+
$[93] = t38;
|
|
414
|
+
$[94] = t39;
|
|
415
|
+
$[95] = t40;
|
|
416
|
+
$[96] = t41;
|
|
413
417
|
$[97] = visibilityEnabled;
|
|
414
|
-
$[98] =
|
|
415
|
-
} else
|
|
416
|
-
const table = useTable(
|
|
417
|
-
let
|
|
418
|
+
$[98] = t43;
|
|
419
|
+
} else t43 = $[98];
|
|
420
|
+
const table = useTable(t43);
|
|
421
|
+
let t44;
|
|
418
422
|
if ($[99] !== table) {
|
|
419
|
-
|
|
423
|
+
t44 = table.getAllLeafColumns();
|
|
420
424
|
$[99] = table;
|
|
421
|
-
$[100] =
|
|
422
|
-
} else
|
|
423
|
-
const allLeafColumns =
|
|
425
|
+
$[100] = t44;
|
|
426
|
+
} else t44 = $[100];
|
|
427
|
+
const allLeafColumns = t44;
|
|
424
428
|
const lastSelectedRowIndexRef = useRef(null);
|
|
425
429
|
const containerRef = useRef(null);
|
|
426
430
|
const headerScrollRef = useRef(null);
|
|
427
431
|
const tbodyRef = useRef(null);
|
|
428
432
|
const virtualizerRef = useRef(null);
|
|
429
|
-
const
|
|
430
|
-
const
|
|
431
|
-
const
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
let
|
|
435
|
-
if ($[101] !== allLeafColumns || $[102] !== alwaysPinnedLeft || $[103] !== columnDndEnabled || $[104] !== columnGroups || $[105] !== defaultColumnOrder || $[106] !== defaultColumnVisibility || $[107] !== enableSelectAllRows || $[108] !== estimateRowHeight || $[109] !== expandingEnabled || $[110] !== groupingEnabled || $[111] !== initialScrollToRowId || $[112] !== isLoading || $[113] !== isLoadingPrevious || $[114] !== masterCellActiveRowId || $[115] !== masterColumnId || $[116] !== onEndReached || $[117] !== onEndReachedThreshold || $[118] !== onMasterCellClick || $[119] !== onRowReorder || $[120] !== onSelectAllRows || $[121] !== onSettingsOpenChange || $[122] !== onStartReached || $[123] !== onStartReachedThreshold || $[124] !== overscan || $[125] !== pinningEnabled || $[126] !== resizingEnabled || $[127] !== rowDndEnabled || $[128] !== selectionEnabled || $[129] !== setColumnOrder || $[130] !== showEmptyGroups || $[131] !== skeletonCount || $[132] !== sortingEnabled || $[133] !== stretch || $[134] !==
|
|
436
|
-
|
|
433
|
+
const t45 = !!getSubRows;
|
|
434
|
+
const t46 = renderExpandedRow;
|
|
435
|
+
const t47 = getRowCanDrag;
|
|
436
|
+
const t48 = "full" === groupRowSpan ? renderGroupRow : void 0;
|
|
437
|
+
const t49 = renderFullWidthRow;
|
|
438
|
+
let t50;
|
|
439
|
+
if ($[101] !== allLeafColumns || $[102] !== alwaysPinnedLeft || $[103] !== columnDndEnabled || $[104] !== columnGroups || $[105] !== defaultColumnOrder || $[106] !== defaultColumnVisibility || $[107] !== enableSelectAllRows || $[108] !== estimateRowHeight || $[109] !== expandingEnabled || $[110] !== groupingEnabled || $[111] !== initialScrollToRowId || $[112] !== isLoading || $[113] !== isLoadingPrevious || $[114] !== masterCellActiveRowId || $[115] !== masterColumnId || $[116] !== onEndReached || $[117] !== onEndReachedThreshold || $[118] !== onMasterCellClick || $[119] !== onRowReorder || $[120] !== onSelectAllRows || $[121] !== onSettingsOpenChange || $[122] !== onStartReached || $[123] !== onStartReachedThreshold || $[124] !== overscan || $[125] !== pinningEnabled || $[126] !== resizingEnabled || $[127] !== rowDndEnabled || $[128] !== selectionEnabled || $[129] !== setColumnOrder || $[130] !== showEmptyGroups || $[131] !== skeletonCount || $[132] !== sortingEnabled || $[133] !== stretch || $[134] !== t45 || $[135] !== t46 || $[136] !== t47 || $[137] !== t48 || $[138] !== t49 || $[139] !== table || $[140] !== virtualized || $[141] !== visibilityEnabled) {
|
|
440
|
+
t50 = {
|
|
437
441
|
table,
|
|
438
442
|
isLoading,
|
|
439
443
|
isLoadingPrevious,
|
|
@@ -447,11 +451,11 @@ const TableProvider = (props)=>{
|
|
|
447
451
|
groupingEnabled,
|
|
448
452
|
expandingEnabled,
|
|
449
453
|
visibilityEnabled,
|
|
450
|
-
hasSubRowGrouping:
|
|
454
|
+
hasSubRowGrouping: t45,
|
|
451
455
|
showEmptyGroups,
|
|
452
456
|
virtualized,
|
|
453
457
|
stretch,
|
|
454
|
-
renderExpandedRow:
|
|
458
|
+
renderExpandedRow: t46,
|
|
455
459
|
estimateRowHeight,
|
|
456
460
|
overscan,
|
|
457
461
|
allLeafColumns,
|
|
@@ -474,9 +478,9 @@ const TableProvider = (props)=>{
|
|
|
474
478
|
onStartReachedThreshold,
|
|
475
479
|
initialScrollToRowId,
|
|
476
480
|
onRowReorder,
|
|
477
|
-
getRowCanDrag:
|
|
478
|
-
renderFullWidthGroupRow:
|
|
479
|
-
renderFullWidthRow:
|
|
481
|
+
getRowCanDrag: t47,
|
|
482
|
+
renderFullWidthGroupRow: t48,
|
|
483
|
+
renderFullWidthRow: t49,
|
|
480
484
|
onMasterCellClick,
|
|
481
485
|
activeRowId: masterCellActiveRowId,
|
|
482
486
|
onSettingsOpenChange
|
|
@@ -514,21 +518,21 @@ const TableProvider = (props)=>{
|
|
|
514
518
|
$[131] = skeletonCount;
|
|
515
519
|
$[132] = sortingEnabled;
|
|
516
520
|
$[133] = stretch;
|
|
517
|
-
$[134] =
|
|
518
|
-
$[135] =
|
|
519
|
-
$[136] =
|
|
520
|
-
$[137] =
|
|
521
|
-
$[138] =
|
|
521
|
+
$[134] = t45;
|
|
522
|
+
$[135] = t46;
|
|
523
|
+
$[136] = t47;
|
|
524
|
+
$[137] = t48;
|
|
525
|
+
$[138] = t49;
|
|
522
526
|
$[139] = table;
|
|
523
527
|
$[140] = virtualized;
|
|
524
528
|
$[141] = visibilityEnabled;
|
|
525
|
-
$[142] =
|
|
526
|
-
} else
|
|
527
|
-
const contextValue =
|
|
528
|
-
let t50;
|
|
529
|
+
$[142] = t50;
|
|
530
|
+
} else t50 = $[142];
|
|
531
|
+
const contextValue = t50;
|
|
529
532
|
let t51;
|
|
533
|
+
let t52;
|
|
530
534
|
if ($[143] !== selectionEnabled || $[144] !== table) {
|
|
531
|
-
|
|
535
|
+
t51 = ()=>{
|
|
532
536
|
if (!selectionEnabled) return;
|
|
533
537
|
const container = containerRef.current;
|
|
534
538
|
if (!container) return;
|
|
@@ -538,39 +542,39 @@ const TableProvider = (props)=>{
|
|
|
538
542
|
container.addEventListener("keydown", handleKeyDown);
|
|
539
543
|
return ()=>container.removeEventListener("keydown", handleKeyDown);
|
|
540
544
|
};
|
|
541
|
-
|
|
545
|
+
t52 = [
|
|
542
546
|
selectionEnabled,
|
|
543
547
|
table
|
|
544
548
|
];
|
|
545
549
|
$[143] = selectionEnabled;
|
|
546
550
|
$[144] = table;
|
|
547
|
-
$[145] =
|
|
548
|
-
$[146] =
|
|
551
|
+
$[145] = t51;
|
|
552
|
+
$[146] = t52;
|
|
549
553
|
} else {
|
|
550
|
-
|
|
551
|
-
|
|
554
|
+
t51 = $[145];
|
|
555
|
+
t52 = $[146];
|
|
552
556
|
}
|
|
553
|
-
useEffect(
|
|
554
|
-
let
|
|
557
|
+
useEffect(t51, t52);
|
|
558
|
+
let t53;
|
|
555
559
|
if ($[147] === Symbol.for("react.memo_cache_sentinel")) {
|
|
556
|
-
|
|
560
|
+
t53 = {
|
|
557
561
|
activationConstraint: {
|
|
558
562
|
distance: 5
|
|
559
563
|
}
|
|
560
564
|
};
|
|
561
|
-
$[147] =
|
|
562
|
-
} else
|
|
563
|
-
let
|
|
565
|
+
$[147] = t53;
|
|
566
|
+
} else t53 = $[147];
|
|
567
|
+
let t54;
|
|
564
568
|
if ($[148] === Symbol.for("react.memo_cache_sentinel")) {
|
|
565
|
-
|
|
569
|
+
t54 = {
|
|
566
570
|
coordinateGetter: sortableKeyboardCoordinates
|
|
567
571
|
};
|
|
568
|
-
$[148] =
|
|
569
|
-
} else
|
|
570
|
-
const sensors = useSensors(useSensor(PointerSensor,
|
|
571
|
-
let
|
|
572
|
+
$[148] = t54;
|
|
573
|
+
} else t54 = $[148];
|
|
574
|
+
const sensors = useSensors(useSensor(PointerSensor, t53), useSensor(KeyboardSensor, t54));
|
|
575
|
+
let t55;
|
|
572
576
|
if ($[149] !== allLeafColumns || $[150] !== setColumnOrder || $[151] !== table.atoms) {
|
|
573
|
-
|
|
577
|
+
t55 = (event)=>{
|
|
574
578
|
const { active, over } = event;
|
|
575
579
|
if (!over || active.id === over.id) return;
|
|
576
580
|
const columnOrderAtom = table.atoms.columnOrder.get();
|
|
@@ -583,57 +587,57 @@ const TableProvider = (props)=>{
|
|
|
583
587
|
$[149] = allLeafColumns;
|
|
584
588
|
$[150] = setColumnOrder;
|
|
585
589
|
$[151] = table.atoms;
|
|
586
|
-
$[152] =
|
|
587
|
-
} else
|
|
588
|
-
const handleDragEnd =
|
|
589
|
-
let
|
|
590
|
+
$[152] = t55;
|
|
591
|
+
} else t55 = $[152];
|
|
592
|
+
const handleDragEnd = t55;
|
|
593
|
+
let t56;
|
|
590
594
|
if ($[153] !== allLeafColumns || $[154] !== alwaysPinnedLeft || $[155] !== columnDndEnabled) {
|
|
591
|
-
|
|
595
|
+
t56 = columnDndEnabled ? allLeafColumns.filter((c_0)=>!alwaysPinnedLeft.includes(c_0.id)).map(_temp3) : [];
|
|
592
596
|
$[153] = allLeafColumns;
|
|
593
597
|
$[154] = alwaysPinnedLeft;
|
|
594
598
|
$[155] = columnDndEnabled;
|
|
595
|
-
$[156] =
|
|
596
|
-
} else
|
|
597
|
-
const columnIds =
|
|
598
|
-
const
|
|
599
|
-
const
|
|
600
|
-
const
|
|
601
|
-
let
|
|
599
|
+
$[156] = t56;
|
|
600
|
+
} else t56 = $[156];
|
|
601
|
+
const columnIds = t56;
|
|
602
|
+
const t57 = columnDndEnabled ? sensors : void 0;
|
|
603
|
+
const t58 = columnDndEnabled ? closestCenter : void 0;
|
|
604
|
+
const t59 = columnDndEnabled ? handleDragEnd : void 0;
|
|
605
|
+
let t60;
|
|
602
606
|
if ($[157] !== children || $[158] !== columnIds) {
|
|
603
|
-
|
|
607
|
+
t60 = /*#__PURE__*/ jsx(SortableContext, {
|
|
604
608
|
items: columnIds,
|
|
605
609
|
strategy: horizontalListSortingStrategy,
|
|
606
610
|
children: children
|
|
607
611
|
});
|
|
608
612
|
$[157] = children;
|
|
609
613
|
$[158] = columnIds;
|
|
610
|
-
$[159] =
|
|
611
|
-
} else
|
|
612
|
-
let t60;
|
|
613
|
-
if ($[160] !== t56 || $[161] !== t57 || $[162] !== t58 || $[163] !== t59) {
|
|
614
|
-
t60 = /*#__PURE__*/ jsx(DndContext, {
|
|
615
|
-
sensors: t56,
|
|
616
|
-
collisionDetection: t57,
|
|
617
|
-
onDragEnd: t58,
|
|
618
|
-
children: t59
|
|
619
|
-
});
|
|
620
|
-
$[160] = t56;
|
|
621
|
-
$[161] = t57;
|
|
622
|
-
$[162] = t58;
|
|
623
|
-
$[163] = t59;
|
|
624
|
-
$[164] = t60;
|
|
625
|
-
} else t60 = $[164];
|
|
614
|
+
$[159] = t60;
|
|
615
|
+
} else t60 = $[159];
|
|
626
616
|
let t61;
|
|
627
|
-
if ($[
|
|
628
|
-
t61 = /*#__PURE__*/ jsx(
|
|
629
|
-
|
|
617
|
+
if ($[160] !== t57 || $[161] !== t58 || $[162] !== t59 || $[163] !== t60) {
|
|
618
|
+
t61 = /*#__PURE__*/ jsx(DndContext, {
|
|
619
|
+
sensors: t57,
|
|
620
|
+
collisionDetection: t58,
|
|
621
|
+
onDragEnd: t59,
|
|
630
622
|
children: t60
|
|
631
623
|
});
|
|
624
|
+
$[160] = t57;
|
|
625
|
+
$[161] = t58;
|
|
626
|
+
$[162] = t59;
|
|
627
|
+
$[163] = t60;
|
|
628
|
+
$[164] = t61;
|
|
629
|
+
} else t61 = $[164];
|
|
630
|
+
let t62;
|
|
631
|
+
if ($[165] !== contextValue || $[166] !== t61) {
|
|
632
|
+
t62 = /*#__PURE__*/ jsx(TableContext.Provider, {
|
|
633
|
+
value: contextValue,
|
|
634
|
+
children: t61
|
|
635
|
+
});
|
|
632
636
|
$[165] = contextValue;
|
|
633
|
-
$[166] =
|
|
634
|
-
$[167] =
|
|
635
|
-
} else
|
|
636
|
-
return
|
|
637
|
+
$[166] = t61;
|
|
638
|
+
$[167] = t62;
|
|
639
|
+
} else t62 = $[167];
|
|
640
|
+
return t62;
|
|
637
641
|
};
|
|
638
642
|
function _temp() {
|
|
639
643
|
return true;
|
|
@@ -2,6 +2,10 @@ import type { ColumnDef, RowData } from '@tanstack/react-table';
|
|
|
2
2
|
import type { DSTableFeatures } from './dsTableFeatures.js';
|
|
3
3
|
/**
|
|
4
4
|
* Creates an expand/collapse column for use in Table.
|
|
5
|
-
* Automatically injected by Table when `renderExpandedRow` is provided
|
|
5
|
+
* Automatically injected by Table when `renderExpandedRow` is provided, or
|
|
6
|
+
* with `groupExpandColumn` in sub-row grouping mode — where every row can
|
|
7
|
+
* expand, so `groupsOnly` limits the toggle to rows that have sub-rows.
|
|
6
8
|
*/
|
|
7
|
-
export declare const createExpandColumn: <T extends RowData>(
|
|
9
|
+
export declare const createExpandColumn: <T extends RowData>({ groupsOnly, }?: {
|
|
10
|
+
groupsOnly?: boolean;
|
|
11
|
+
}) => ColumnDef<DSTableFeatures, T, unknown>;
|
|
@@ -3,7 +3,7 @@ import { ChevronDown, ChevronRight } from "../../../icons/index.js";
|
|
|
3
3
|
import { ToggleButton } from "../../ToggleButton/index.js";
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../Tooltip/index.js";
|
|
5
5
|
import { TABLE_EXPAND_COLUMN_ID, TABLE_EXPAND_COLUMN_WIDTH } from "./constants.js";
|
|
6
|
-
const createExpandColumn = ()=>({
|
|
6
|
+
const createExpandColumn = ({ groupsOnly = false } = {})=>({
|
|
7
7
|
id: TABLE_EXPAND_COLUMN_ID,
|
|
8
8
|
size: TABLE_EXPAND_COLUMN_WIDTH,
|
|
9
9
|
minSize: TABLE_EXPAND_COLUMN_WIDTH,
|
|
@@ -18,7 +18,7 @@ const createExpandColumn = ()=>({
|
|
|
18
18
|
},
|
|
19
19
|
header: ()=>null,
|
|
20
20
|
cell: ({ row })=>{
|
|
21
|
-
if (!row.getCanExpand()) return null;
|
|
21
|
+
if (!row.getCanExpand() || groupsOnly && 0 === row.subRows.length) return null;
|
|
22
22
|
const expanded = row.getIsExpanded();
|
|
23
23
|
return /*#__PURE__*/ jsxs(Tooltip, {
|
|
24
24
|
children: [
|
|
@@ -241,6 +241,13 @@ export interface TableProps<T> extends TestableProps {
|
|
|
241
241
|
* right edge of the table. Requires `renderGroupRow`.
|
|
242
242
|
*/
|
|
243
243
|
groupRowSpan?: 'master' | 'full';
|
|
244
|
+
/**
|
|
245
|
+
* Keep the expand column in sub-row grouping mode (`renderGroupRow`), which
|
|
246
|
+
* otherwise drops it and leaves the toggle to the group row's content. The
|
|
247
|
+
* column comes first, ahead of the drag handle, and shows a toggle on group
|
|
248
|
+
* rows only — so the rows of a group, drag handle included, sit inside it.
|
|
249
|
+
*/
|
|
250
|
+
groupExpandColumn?: boolean;
|
|
244
251
|
/** Sub-row accessor for hierarchical/tree data (used with renderGroupRow) */
|
|
245
252
|
getSubRows?: (row: T) => T[] | undefined;
|
|
246
253
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
3
|
-
"generatedAt": "2026-10-
|
|
2
|
+
"version": "2.5.0",
|
|
3
|
+
"generatedAt": "2026-10-13T13:29:53.372Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -101537,6 +101537,12 @@
|
|
|
101537
101537
|
"required": false,
|
|
101538
101538
|
"description": "How a group row lays out its content.\n\n- `'master'` (default): the master column's cell, then empty filler cells —\n the content is confined to the master column width.\n- `'full'`: `renderGroupRow(row)` in a single cell spanning every data\n column (system cells — selection, drag handle — keep their own cells).\n Use for a group header with a title on the left and actions pinned to the\n right edge of the table. Requires `renderGroupRow`."
|
|
101539
101539
|
},
|
|
101540
|
+
{
|
|
101541
|
+
"name": "groupExpandColumn",
|
|
101542
|
+
"type": "boolean | undefined",
|
|
101543
|
+
"required": false,
|
|
101544
|
+
"description": "Keep the expand column in sub-row grouping mode (`renderGroupRow`), which\notherwise drops it and leaves the toggle to the group row's content. The\ncolumn comes first, ahead of the drag handle, and shows a toggle on group\nrows only — so the rows of a group, drag handle included, sit inside it."
|
|
101545
|
+
},
|
|
101540
101546
|
{
|
|
101541
101547
|
"name": "getSubRows",
|
|
101542
101548
|
"type": "((row: T) => T[] | undefined) | undefined",
|
|
@@ -107828,6 +107834,11 @@
|
|
|
107828
107834
|
"code": "() => {\n const [data, setData] = useState<SecurityHeaderEntry[]>(() => [\n {\n ...groupedHeaderData[0]!,\n children: [\n { ...groupedHeaderData[0]!, id: `${BANNER_ROW_PREFIX}csp`, children: undefined },\n ...(groupedHeaderData[0]!.children ?? []),\n ],\n },\n ...groupedHeaderData.slice(1, 3),\n { ...groupedHeaderData[0]!, id: 'group-empty', objectName: 'Nothing here yet', children: [] },\n ]);\n const [expanded, setExpanded] = useState<TableExpandedState>(true);\n\n const handleRowReorder = useCallback((event: TableRowReorderEvent) => {\n setData(prev =>\n prev.map(group => {\n const children = group.children ?? [];\n const oldIndex = children.findIndex(row => row.id === event.activeRowId);\n const newIndex = children.findIndex(row => row.id === event.overRowId);\n if (oldIndex === -1 || newIndex === -1) return group;\n return { ...group, children: arrayMove(children, oldIndex, newIndex) };\n }),\n );\n }, []);\n\n return (\n <Table<SecurityHeaderEntry>\n data={data}\n columns={headerColumns}\n getRowId={row => row.id}\n getSubRows={row => row.children}\n showEmptyGroups\n expanded={expanded}\n onExpandedChange={setExpanded}\n onRowReorder={handleRowReorder}\n groupRowSpan='full'\n renderGroupRow={row => {\n const isExpanded = row.getIsExpanded();\n return (\n <HStack gap={8} align='center'>\n <Button\n variant='ghost'\n color='neutral'\n size='small'\n aria-expanded={isExpanded}\n aria-label={isExpanded ? 'Collapse group' : 'Expand group'}\n onClick={row.getToggleExpandedHandler()}\n >\n {isExpanded ? <ChevronDown /> : <ChevronRight />}\n </Button>\n <Text weight='medium'>{row.original.objectName}</Text>\n <Badge color='gray' type='secondary' size='medium'>\n {row.subRows.filter(r => !r.id.startsWith(BANNER_ROW_PREFIX)).length}\n </Badge>\n <HStack gap={4} className='ml-auto'>\n <Button variant='ghost' color='neutral' size='small'>\n <Plus />\n Add header\n </Button>\n <Button variant='ghost' color='neutral' size='small' aria-label='More actions'>\n <Ellipsis />\n </Button>\n </HStack>\n </HStack>\n );\n }}\n renderFullWidthRow={row =>\n row.id.startsWith(BANNER_ROW_PREFIX) ? (\n <HStack gap={8} align='center'>\n <Shield size='sm' />\n <Text size='sm' weight='medium'>\n Wallarm baseline headers\n </Text>\n <Text size='sm' color='secondary'>\n · applied first · built-in, always on\n </Text>\n <Button variant='ghost' color='neutral' size='small' className='ml-auto'>\n Manage baseline →\n </Button>\n </HStack>\n ) : undefined\n }\n getRowCanDrag={row => !row.id.startsWith(BANNER_ROW_PREFIX) && !LOCKED_ROW_IDS.has(row.id)}\n data-testid='grouped-full-width-table'\n />\n );\n}",
|
|
107829
107835
|
"description": "`groupRowSpan: 'full'` draws `renderGroupRow` across every data column — title on the left,\nactions on the right edge; the content owns the collapse toggle. `renderFullWidthRow` turns a\nregular row into a single spanning banner, and `getRowCanDrag` keeps the banner and the locked\nfirst header in place while the other rows of the group reorder around them."
|
|
107830
107836
|
},
|
|
107837
|
+
{
|
|
107838
|
+
"name": "GroupedWithExpandColumn",
|
|
107839
|
+
"code": "() => {\n const [data, setData] = useState<SecurityHeaderEntry[]>(() => [\n ...groupedHeaderData,\n { ...groupedHeaderData[0]!, id: 'group-empty', objectName: 'Nothing here yet', children: [] },\n ]);\n const [expanded, setExpanded] = useState<TableExpandedState>(true);\n\n const handleRowReorder = useCallback((event: TableRowReorderEvent) => {\n setData(prev =>\n prev.map(group => {\n const children = group.children ?? [];\n const oldIndex = children.findIndex(row => row.id === event.activeRowId);\n const newIndex = children.findIndex(row => row.id === event.overRowId);\n if (oldIndex === -1 || newIndex === -1) return group;\n return { ...group, children: arrayMove(children, oldIndex, newIndex) };\n }),\n );\n }, []);\n\n return (\n <Table<SecurityHeaderEntry>\n data={data}\n columns={headerColumns}\n getRowId={row => row.id}\n getSubRows={row => row.children}\n showEmptyGroups\n expanded={expanded}\n onExpandedChange={setExpanded}\n onRowReorder={handleRowReorder}\n groupRowSpan='full'\n groupExpandColumn\n renderGroupRow={row => (\n <HStack gap={8} align='center'>\n <Text weight='medium'>{row.original.objectName}</Text>\n <Badge color='gray' type='secondary' size='medium'>\n {row.subRows.length}\n </Badge>\n <Button variant='ghost' color='neutral' size='small' className='ml-auto'>\n <Plus />\n Add header\n </Button>\n </HStack>\n )}\n data-testid='grouped-expand-column-table'\n />\n );\n}",
|
|
107840
|
+
"description": "`groupExpandColumn` keeps the expand column in grouping mode: the toggle sits in its own column,\nfirst, and every row of a group — drag handle included — sits to the right of it, while\n`renderGroupRow` keeps the title and the actions."
|
|
107841
|
+
},
|
|
107831
107842
|
{
|
|
107832
107843
|
"name": "RowReorderingWithSelection",
|
|
107833
107844
|
"code": "() => {\n const [data, setData] = useState(() => securityEvents.slice(0, 6));\n const [rowSelection, setRowSelection] = useState<TableRowSelectionState>({});\n\n const handleRowReorder = useCallback((event: TableRowReorderEvent) => {\n setData(prev => {\n const oldIndex = prev.findIndex(row => row.id === event.activeRowId);\n const newIndex = prev.findIndex(row => row.id === event.overRowId);\n if (oldIndex === -1 || newIndex === -1) return prev;\n return arrayMove(prev, oldIndex, newIndex);\n });\n }, []);\n\n return (\n <Table\n data={data}\n columns={securityColumns}\n getRowId={row => row.id}\n onRowReorder={handleRowReorder}\n rowSelection={rowSelection}\n onRowSelectionChange={setRowSelection}\n />\n );\n}",
|