@wallarm-org/design-system 2.4.0 → 2.5.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/CodeSnippet/internal/CodeSnippetFrame.js +101 -66
- package/dist/components/Table/StickyGroupParent.js +11 -4
- package/dist/components/Table/TableBody/TableRowOverlay.js +46 -30
- package/dist/components/Table/TableContext/TableProvider.js +294 -284
- package/dist/components/Table/TableContext/types.d.ts +3 -0
- package/dist/components/Table/TableRow.d.ts +12 -1
- package/dist/components/Table/TableRow.js +264 -177
- package/dist/components/Table/lib/createDragHandleColumn.js +5 -24
- package/dist/components/Table/lib/useRowDnd.d.ts +2 -0
- package/dist/components/Table/lib/useRowDnd.js +46 -41
- package/dist/components/Table/types.d.ts +39 -0
- package/dist/metadata/components.json +37 -3
- package/package.json +3 -1
|
@@ -50,6 +50,9 @@ export interface TableContextValue<T extends RowData> {
|
|
|
50
50
|
onStartReachedThreshold?: number;
|
|
51
51
|
initialScrollToRowId?: string;
|
|
52
52
|
onRowReorder?: (event: TableRowReorderEvent) => void;
|
|
53
|
+
getRowCanDrag?: (row: Row<DSTableFeatures, T>) => boolean;
|
|
54
|
+
renderFullWidthGroupRow?: (row: Row<DSTableFeatures, T>) => ReactNode;
|
|
55
|
+
renderFullWidthRow?: (row: Row<DSTableFeatures, T>) => ReactNode | undefined;
|
|
53
56
|
onMasterCellClick?: (rowId: string) => void;
|
|
54
57
|
activeRowId: string | null;
|
|
55
58
|
onSettingsOpenChange?: (open: boolean) => void;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { type Ref } from 'react';
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
2
|
import type { Row, RowData } from '@tanstack/react-table';
|
|
3
3
|
import { type DSTableFeatures } from './lib/index.js';
|
|
4
|
+
interface TableFullWidthCellProps {
|
|
5
|
+
colSpan: number;
|
|
6
|
+
lastRow?: boolean;
|
|
7
|
+
dropIndicator?: 'above' | 'below';
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* One cell spanning every data column — the body of a full-width row
|
|
12
|
+
* (`renderFullWidthRow`) or of a full-width group row (`groupRowSpan: 'full'`).
|
|
13
|
+
*/
|
|
14
|
+
export declare const TableFullWidthCell: ({ colSpan, lastRow, dropIndicator, children, }: TableFullWidthCellProps) => import("react").JSX.Element;
|
|
4
15
|
interface TableRowProps<T extends RowData> {
|
|
5
16
|
row: Row<DSTableFeatures, T>;
|
|
6
17
|
ref?: Ref<HTMLTableRowElement>;
|
|
@@ -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, isGroupRow, useRowDnd, useTableValue, withTableState } from "./lib/index.js";
|
|
7
|
+
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, isGroupRow, useRenderEveryTime, 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";
|
|
@@ -15,10 +15,51 @@ const SYSTEM_COLUMN_IDS = new Set([
|
|
|
15
15
|
TABLE_SELECT_COLUMN_ID,
|
|
16
16
|
TABLE_DRAG_HANDLE_COLUMN_ID
|
|
17
17
|
]);
|
|
18
|
+
const TableFullWidthCell = (t0)=>{
|
|
19
|
+
const $ = compiler_runtime_c(12);
|
|
20
|
+
const { colSpan, lastRow, dropIndicator, children } = t0;
|
|
21
|
+
const t1 = dropIndicator && DROP_INDICATOR_BASE;
|
|
22
|
+
const t2 = "above" === dropIndicator && "after:top-0";
|
|
23
|
+
const t3 = "below" === dropIndicator && "after:-bottom-px";
|
|
24
|
+
let t4;
|
|
25
|
+
if ($[0] !== t1 || $[1] !== t2 || $[2] !== t3) {
|
|
26
|
+
t4 = cn("align-middle", t1, t2, t3);
|
|
27
|
+
$[0] = t1;
|
|
28
|
+
$[1] = t2;
|
|
29
|
+
$[2] = t3;
|
|
30
|
+
$[3] = t4;
|
|
31
|
+
} else t4 = $[3];
|
|
32
|
+
let t5;
|
|
33
|
+
if ($[4] !== dropIndicator) {
|
|
34
|
+
t5 = dropIndicator ? {
|
|
35
|
+
overflow: "visible"
|
|
36
|
+
} : void 0;
|
|
37
|
+
$[4] = dropIndicator;
|
|
38
|
+
$[5] = t5;
|
|
39
|
+
} else t5 = $[5];
|
|
40
|
+
let t6;
|
|
41
|
+
if ($[6] !== children || $[7] !== colSpan || $[8] !== lastRow || $[9] !== t4 || $[10] !== t5) {
|
|
42
|
+
t6 = /*#__PURE__*/ jsx(Td, {
|
|
43
|
+
pinned: false,
|
|
44
|
+
lastRow: lastRow,
|
|
45
|
+
colSpan: colSpan,
|
|
46
|
+
className: t4,
|
|
47
|
+
style: t5,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
$[6] = children;
|
|
51
|
+
$[7] = colSpan;
|
|
52
|
+
$[8] = lastRow;
|
|
53
|
+
$[9] = t4;
|
|
54
|
+
$[10] = t5;
|
|
55
|
+
$[11] = t6;
|
|
56
|
+
} else t6 = $[11];
|
|
57
|
+
return t6;
|
|
58
|
+
};
|
|
18
59
|
const TableRowInner = (t0)=>{
|
|
19
|
-
const $ = compiler_runtime_c(
|
|
60
|
+
const $ = compiler_runtime_c(112);
|
|
20
61
|
const { row, ref, "data-index": dataIndex } = t0;
|
|
21
|
-
const { table, expandingEnabled, activeRowId, isLoading, renderExpandedRow, stretch, hasSubRowGrouping, showEmptyGroups, allLeafColumns } = useTableContext();
|
|
62
|
+
const { table, expandingEnabled, activeRowId, isLoading, renderExpandedRow, stretch, hasSubRowGrouping, showEmptyGroups, allLeafColumns, renderFullWidthGroupRow, renderFullWidthRow } = useTableContext();
|
|
22
63
|
const testId = useTestId("row");
|
|
23
64
|
const { canDnd, isDragging, setNodeRef, style: dndStyle, attributes, listeners } = useRowDnd(row);
|
|
24
65
|
const { activeId, overId } = useRowDndIndicator();
|
|
@@ -63,23 +104,34 @@ const TableRowInner = (t0)=>{
|
|
|
63
104
|
} else t5 = $[11];
|
|
64
105
|
const isLastModelRow = useTableValue(t5);
|
|
65
106
|
const isPreviewActive = activeRowId === row.id;
|
|
107
|
+
let t6;
|
|
108
|
+
if ($[12] !== isGroupParent || $[13] !== renderFullWidthGroupRow || $[14] !== renderFullWidthRow || $[15] !== row) {
|
|
109
|
+
t6 = ()=>isGroupParent ? renderFullWidthGroupRow?.(row) : renderFullWidthRow?.(row);
|
|
110
|
+
$[12] = isGroupParent;
|
|
111
|
+
$[13] = renderFullWidthGroupRow;
|
|
112
|
+
$[14] = renderFullWidthRow;
|
|
113
|
+
$[15] = row;
|
|
114
|
+
$[16] = t6;
|
|
115
|
+
} else t6 = $[16];
|
|
116
|
+
const fullWidthContent = useRenderEveryTime(t6);
|
|
117
|
+
const isFullWidth = void 0 !== fullWidthContent;
|
|
66
118
|
const isLastTableRow = !isLoading && isLastModelRow;
|
|
67
119
|
const hasExpandedContent = expandingEnabled && !!renderExpandedRow && isExpanded;
|
|
68
120
|
const isLastRow = isLastTableRow && !hasExpandedContent;
|
|
69
121
|
const isLastRowExpanded = isLastTableRow && hasExpandedContent;
|
|
70
|
-
let
|
|
71
|
-
if ($[
|
|
72
|
-
|
|
122
|
+
let t7;
|
|
123
|
+
if ($[17] !== canDnd || $[18] !== ref || $[19] !== setNodeRef) {
|
|
124
|
+
t7 = (node)=>{
|
|
73
125
|
if (canDnd) setNodeRef(node);
|
|
74
126
|
if ("function" == typeof ref) ref(node);
|
|
75
127
|
else if (ref) ref.current = node;
|
|
76
128
|
};
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
} else
|
|
82
|
-
const composedRef =
|
|
129
|
+
$[17] = canDnd;
|
|
130
|
+
$[18] = ref;
|
|
131
|
+
$[19] = setNodeRef;
|
|
132
|
+
$[20] = t7;
|
|
133
|
+
} else t7 = $[20];
|
|
134
|
+
const composedRef = t7;
|
|
83
135
|
if (isGroupParent) {
|
|
84
136
|
let T0;
|
|
85
137
|
let t10;
|
|
@@ -91,171 +143,183 @@ const TableRowInner = (t0)=>{
|
|
|
91
143
|
let t16;
|
|
92
144
|
let t17;
|
|
93
145
|
let t18;
|
|
94
|
-
let
|
|
146
|
+
let t19;
|
|
147
|
+
let t20;
|
|
95
148
|
let t8;
|
|
96
149
|
let t9;
|
|
97
|
-
if ($[
|
|
150
|
+
if ($[21] !== allLeafColumns || $[22] !== cells || $[23] !== composedRef || $[24] !== dataIndex || $[25] !== fullWidthContent || $[26] !== hasSubRowGrouping || $[27] !== isExpanded || $[28] !== isFullWidth || $[29] !== isLastRow || $[30] !== isPreviewActive || $[31] !== isSelected || $[32] !== row.id || $[33] !== table.state || $[34] !== testId) {
|
|
98
151
|
const systemCells = cells.filter(_temp);
|
|
99
152
|
const dataCells = cells.filter(_temp2);
|
|
100
153
|
const firstDataCell = dataCells[0];
|
|
101
|
-
let
|
|
102
|
-
if ($[
|
|
103
|
-
|
|
154
|
+
let t21;
|
|
155
|
+
if ($[49] !== allLeafColumns || $[50] !== hasSubRowGrouping || $[51] !== isExpanded) {
|
|
156
|
+
t21 = hasSubRowGrouping && isExpanded ? {
|
|
104
157
|
position: "sticky",
|
|
105
158
|
top: allLeafColumns.some(_temp3) ? 48 : 32,
|
|
106
159
|
zIndex: 20
|
|
107
160
|
} : void 0;
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
} else
|
|
113
|
-
const stickyStyle =
|
|
161
|
+
$[49] = allLeafColumns;
|
|
162
|
+
$[50] = hasSubRowGrouping;
|
|
163
|
+
$[51] = isExpanded;
|
|
164
|
+
$[52] = t21;
|
|
165
|
+
} else t21 = $[52];
|
|
166
|
+
const stickyStyle = t21;
|
|
114
167
|
T0 = Tr;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
let
|
|
125
|
-
if ($[
|
|
126
|
-
|
|
168
|
+
t8 = composedRef;
|
|
169
|
+
t9 = dataIndex;
|
|
170
|
+
t10 = row.id;
|
|
171
|
+
t11 = testId;
|
|
172
|
+
t12 = "group/row";
|
|
173
|
+
t13 = isSelected || void 0;
|
|
174
|
+
t14 = isPreviewActive || void 0;
|
|
175
|
+
t15 = isSelected || void 0;
|
|
176
|
+
t16 = stickyStyle;
|
|
177
|
+
let t22;
|
|
178
|
+
if ($[53] !== isLastRow) {
|
|
179
|
+
t22 = (cell)=>/*#__PURE__*/ jsx(TableBodyCell, {
|
|
127
180
|
cell: cell,
|
|
128
181
|
disablePinnedShadow: true,
|
|
129
182
|
lastRow: isLastRow
|
|
130
183
|
}, cell.id);
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
} else
|
|
134
|
-
|
|
135
|
-
|
|
184
|
+
$[53] = isLastRow;
|
|
185
|
+
$[54] = t22;
|
|
186
|
+
} else t22 = $[54];
|
|
187
|
+
t17 = systemCells.map(t22);
|
|
188
|
+
t18 = isFullWidth && /*#__PURE__*/ jsx(TableFullWidthCell, {
|
|
189
|
+
colSpan: dataCells.length,
|
|
190
|
+
lastRow: isLastRow,
|
|
191
|
+
children: fullWidthContent
|
|
192
|
+
});
|
|
193
|
+
t19 = !isFullWidth && firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
|
|
136
194
|
cell: firstDataCell,
|
|
137
195
|
className: "border-r-0",
|
|
138
196
|
disablePinnedShadow: true,
|
|
139
197
|
lastRow: isLastRow
|
|
140
198
|
});
|
|
141
|
-
|
|
199
|
+
t20 = withTableState(table.state, ()=>(isFullWidth ? [] : dataCells).slice(1).map((cell_0)=>/*#__PURE__*/ jsx(Td, {
|
|
142
200
|
className: cn("border-b border-border-primary-light bg-bg-surface-2 overlay", "group-hover/row:overlay-states-primary-hover group-data-[selected]/row:overlay-states-primary-active", "group-data-[preview-active]/row:overlay-states-primary-hover group-has-[[data-state=open]]/row:overlay-states-primary-hover", isLastRow && "border-b-0"),
|
|
143
201
|
style: {
|
|
144
202
|
width: cell_0.column.getSize()
|
|
145
203
|
},
|
|
146
204
|
"aria-hidden": "true"
|
|
147
205
|
}, cell_0.id)));
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
206
|
+
$[21] = allLeafColumns;
|
|
207
|
+
$[22] = cells;
|
|
208
|
+
$[23] = composedRef;
|
|
209
|
+
$[24] = dataIndex;
|
|
210
|
+
$[25] = fullWidthContent;
|
|
211
|
+
$[26] = hasSubRowGrouping;
|
|
212
|
+
$[27] = isExpanded;
|
|
213
|
+
$[28] = isFullWidth;
|
|
214
|
+
$[29] = isLastRow;
|
|
215
|
+
$[30] = isPreviewActive;
|
|
216
|
+
$[31] = isSelected;
|
|
217
|
+
$[32] = row.id;
|
|
218
|
+
$[33] = table.state;
|
|
219
|
+
$[34] = testId;
|
|
220
|
+
$[35] = T0;
|
|
221
|
+
$[36] = t10;
|
|
222
|
+
$[37] = t11;
|
|
223
|
+
$[38] = t12;
|
|
224
|
+
$[39] = t13;
|
|
225
|
+
$[40] = t14;
|
|
226
|
+
$[41] = t15;
|
|
227
|
+
$[42] = t16;
|
|
228
|
+
$[43] = t17;
|
|
229
|
+
$[44] = t18;
|
|
230
|
+
$[45] = t19;
|
|
231
|
+
$[46] = t20;
|
|
232
|
+
$[47] = t8;
|
|
233
|
+
$[48] = t9;
|
|
173
234
|
} else {
|
|
174
|
-
T0 = $[
|
|
175
|
-
t10 = $[
|
|
176
|
-
t11 = $[
|
|
177
|
-
t12 = $[
|
|
178
|
-
t13 = $[
|
|
179
|
-
t14 = $[
|
|
180
|
-
t15 = $[
|
|
181
|
-
t16 = $[
|
|
182
|
-
t17 = $[
|
|
183
|
-
t18 = $[
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
235
|
+
T0 = $[35];
|
|
236
|
+
t10 = $[36];
|
|
237
|
+
t11 = $[37];
|
|
238
|
+
t12 = $[38];
|
|
239
|
+
t13 = $[39];
|
|
240
|
+
t14 = $[40];
|
|
241
|
+
t15 = $[41];
|
|
242
|
+
t16 = $[42];
|
|
243
|
+
t17 = $[43];
|
|
244
|
+
t18 = $[44];
|
|
245
|
+
t19 = $[45];
|
|
246
|
+
t20 = $[46];
|
|
247
|
+
t8 = $[47];
|
|
248
|
+
t9 = $[48];
|
|
187
249
|
}
|
|
188
|
-
let
|
|
189
|
-
if ($[
|
|
190
|
-
|
|
250
|
+
let t21;
|
|
251
|
+
if ($[55] !== stretch) {
|
|
252
|
+
t21 = !stretch && /*#__PURE__*/ jsx(Td, {
|
|
191
253
|
pinned: false,
|
|
192
254
|
"aria-hidden": true
|
|
193
255
|
});
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
} else
|
|
197
|
-
let
|
|
198
|
-
if ($[
|
|
199
|
-
|
|
200
|
-
ref:
|
|
201
|
-
"data-index":
|
|
202
|
-
"data-row-id":
|
|
203
|
-
"data-testid":
|
|
204
|
-
className:
|
|
205
|
-
"data-selected":
|
|
206
|
-
"data-preview-active":
|
|
207
|
-
"aria-selected":
|
|
208
|
-
style:
|
|
256
|
+
$[55] = stretch;
|
|
257
|
+
$[56] = t21;
|
|
258
|
+
} else t21 = $[56];
|
|
259
|
+
let t22;
|
|
260
|
+
if ($[57] !== T0 || $[58] !== t10 || $[59] !== t11 || $[60] !== t12 || $[61] !== t13 || $[62] !== t14 || $[63] !== t15 || $[64] !== t16 || $[65] !== t17 || $[66] !== t18 || $[67] !== t19 || $[68] !== t20 || $[69] !== t21 || $[70] !== t8 || $[71] !== t9) {
|
|
261
|
+
t22 = /*#__PURE__*/ jsxs(T0, {
|
|
262
|
+
ref: t8,
|
|
263
|
+
"data-index": t9,
|
|
264
|
+
"data-row-id": t10,
|
|
265
|
+
"data-testid": t11,
|
|
266
|
+
className: t12,
|
|
267
|
+
"data-selected": t13,
|
|
268
|
+
"data-preview-active": t14,
|
|
269
|
+
"aria-selected": t15,
|
|
270
|
+
style: t16,
|
|
209
271
|
children: [
|
|
210
|
-
t16,
|
|
211
272
|
t17,
|
|
212
273
|
t18,
|
|
213
|
-
t19
|
|
274
|
+
t19,
|
|
275
|
+
t20,
|
|
276
|
+
t21
|
|
214
277
|
]
|
|
215
278
|
});
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
279
|
+
$[57] = T0;
|
|
280
|
+
$[58] = t10;
|
|
281
|
+
$[59] = t11;
|
|
282
|
+
$[60] = t12;
|
|
283
|
+
$[61] = t13;
|
|
284
|
+
$[62] = t14;
|
|
285
|
+
$[63] = t15;
|
|
286
|
+
$[64] = t16;
|
|
287
|
+
$[65] = t17;
|
|
288
|
+
$[66] = t18;
|
|
289
|
+
$[67] = t19;
|
|
290
|
+
$[68] = t20;
|
|
291
|
+
$[69] = t21;
|
|
292
|
+
$[70] = t8;
|
|
293
|
+
$[71] = t9;
|
|
294
|
+
$[72] = t22;
|
|
295
|
+
} else t22 = $[72];
|
|
296
|
+
let t23;
|
|
297
|
+
if ($[73] !== expandingEnabled || $[74] !== isLastRowExpanded || $[75] !== row) {
|
|
298
|
+
t23 = expandingEnabled && /*#__PURE__*/ jsx(TableRowExpanded, {
|
|
235
299
|
row: row,
|
|
236
300
|
lastRow: isLastRowExpanded
|
|
237
301
|
});
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
} else
|
|
243
|
-
let
|
|
244
|
-
if ($[
|
|
245
|
-
|
|
302
|
+
$[73] = expandingEnabled;
|
|
303
|
+
$[74] = isLastRowExpanded;
|
|
304
|
+
$[75] = row;
|
|
305
|
+
$[76] = t23;
|
|
306
|
+
} else t23 = $[76];
|
|
307
|
+
let t24;
|
|
308
|
+
if ($[77] !== t22 || $[78] !== t23) {
|
|
309
|
+
t24 = /*#__PURE__*/ jsxs(Fragment, {
|
|
246
310
|
children: [
|
|
247
|
-
|
|
248
|
-
|
|
311
|
+
t22,
|
|
312
|
+
t23
|
|
249
313
|
]
|
|
250
314
|
});
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
} else
|
|
255
|
-
return
|
|
315
|
+
$[77] = t22;
|
|
316
|
+
$[78] = t23;
|
|
317
|
+
$[79] = t24;
|
|
318
|
+
} else t24 = $[79];
|
|
319
|
+
return t24;
|
|
256
320
|
}
|
|
257
|
-
let
|
|
258
|
-
if ($[
|
|
321
|
+
let t8;
|
|
322
|
+
if ($[80] !== activeId || $[81] !== attributes || $[82] !== canDnd || $[83] !== cells || $[84] !== composedRef || $[85] !== dataIndex || $[86] !== dndStyle || $[87] !== fullWidthContent || $[88] !== isDragging || $[89] !== isFullWidth || $[90] !== isLastRow || $[91] !== isPreviewActive || $[92] !== isSelected || $[93] !== listeners || $[94] !== overId || $[95] !== row.depth || $[96] !== row.id || $[97] !== stretch || $[98] !== table || $[99] !== testId) {
|
|
259
323
|
let dropIndicator;
|
|
260
324
|
if (overId === row.id && null != activeId && activeId !== row.id) {
|
|
261
325
|
const modelRows = table.getRowModel().rows;
|
|
@@ -263,7 +327,14 @@ const TableRowInner = (t0)=>{
|
|
|
263
327
|
const overIndex = modelRows.findIndex((r_0)=>r_0.id === row.id);
|
|
264
328
|
if (-1 !== activeIndex && -1 !== overIndex) dropIndicator = activeIndex < overIndex ? "below" : "above";
|
|
265
329
|
}
|
|
266
|
-
|
|
330
|
+
let t9;
|
|
331
|
+
if ($[101] !== cells || $[102] !== isFullWidth) {
|
|
332
|
+
t9 = isFullWidth ? cells.filter(_temp4) : cells;
|
|
333
|
+
$[101] = cells;
|
|
334
|
+
$[102] = isFullWidth;
|
|
335
|
+
$[103] = t9;
|
|
336
|
+
} else t9 = $[103];
|
|
337
|
+
t8 = /*#__PURE__*/ jsxs(Tr, {
|
|
267
338
|
ref: composedRef,
|
|
268
339
|
"data-index": dataIndex,
|
|
269
340
|
"data-row-id": row.id,
|
|
@@ -276,16 +347,23 @@ const TableRowInner = (t0)=>{
|
|
|
276
347
|
"data-depth": row.depth > 0 ? row.depth : void 0,
|
|
277
348
|
style: dndStyle,
|
|
278
349
|
children: [
|
|
279
|
-
|
|
280
|
-
const isDragHandle = cell_1.column.id === TABLE_DRAG_HANDLE_COLUMN_ID;
|
|
350
|
+
t9.map((cell_1)=>{
|
|
351
|
+
const isDragHandle = canDnd && cell_1.column.id === TABLE_DRAG_HANDLE_COLUMN_ID;
|
|
281
352
|
return /*#__PURE__*/ jsx(TableBodyCell, {
|
|
282
353
|
cell: cell_1,
|
|
283
354
|
dragListeners: isDragHandle ? listeners : void 0,
|
|
284
355
|
dragAttributes: isDragHandle ? attributes : void 0,
|
|
356
|
+
disablePinnedShadow: isFullWidth,
|
|
285
357
|
lastRow: isLastRow,
|
|
286
358
|
dropIndicator: dropIndicator
|
|
287
359
|
}, cell_1.id);
|
|
288
360
|
}),
|
|
361
|
+
isFullWidth && /*#__PURE__*/ jsx(TableFullWidthCell, {
|
|
362
|
+
colSpan: cells.filter(_temp5).length,
|
|
363
|
+
lastRow: isLastRow,
|
|
364
|
+
dropIndicator: dropIndicator,
|
|
365
|
+
children: fullWidthContent
|
|
366
|
+
}),
|
|
289
367
|
!stretch && /*#__PURE__*/ jsx(Td, {
|
|
290
368
|
pinned: false,
|
|
291
369
|
"aria-hidden": true,
|
|
@@ -296,51 +374,54 @@ const TableRowInner = (t0)=>{
|
|
|
296
374
|
})
|
|
297
375
|
]
|
|
298
376
|
});
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
377
|
+
$[80] = activeId;
|
|
378
|
+
$[81] = attributes;
|
|
379
|
+
$[82] = canDnd;
|
|
380
|
+
$[83] = cells;
|
|
381
|
+
$[84] = composedRef;
|
|
382
|
+
$[85] = dataIndex;
|
|
383
|
+
$[86] = dndStyle;
|
|
384
|
+
$[87] = fullWidthContent;
|
|
385
|
+
$[88] = isDragging;
|
|
386
|
+
$[89] = isFullWidth;
|
|
387
|
+
$[90] = isLastRow;
|
|
388
|
+
$[91] = isPreviewActive;
|
|
389
|
+
$[92] = isSelected;
|
|
390
|
+
$[93] = listeners;
|
|
391
|
+
$[94] = overId;
|
|
392
|
+
$[95] = row.depth;
|
|
393
|
+
$[96] = row.id;
|
|
394
|
+
$[97] = stretch;
|
|
395
|
+
$[98] = table;
|
|
396
|
+
$[99] = testId;
|
|
397
|
+
$[100] = t8;
|
|
398
|
+
} else t8 = $[100];
|
|
399
|
+
let t9;
|
|
400
|
+
if ($[104] !== dndStyle || $[105] !== expandingEnabled || $[106] !== isLastRowExpanded || $[107] !== row) {
|
|
401
|
+
t9 = expandingEnabled && /*#__PURE__*/ jsx(TableRowExpanded, {
|
|
321
402
|
row: row,
|
|
322
403
|
dndStyle: dndStyle,
|
|
323
404
|
lastRow: isLastRowExpanded
|
|
324
405
|
});
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
} else
|
|
331
|
-
let
|
|
332
|
-
if ($[
|
|
333
|
-
|
|
406
|
+
$[104] = dndStyle;
|
|
407
|
+
$[105] = expandingEnabled;
|
|
408
|
+
$[106] = isLastRowExpanded;
|
|
409
|
+
$[107] = row;
|
|
410
|
+
$[108] = t9;
|
|
411
|
+
} else t9 = $[108];
|
|
412
|
+
let t10;
|
|
413
|
+
if ($[109] !== t8 || $[110] !== t9) {
|
|
414
|
+
t10 = /*#__PURE__*/ jsxs(Fragment, {
|
|
334
415
|
children: [
|
|
335
|
-
|
|
336
|
-
|
|
416
|
+
t8,
|
|
417
|
+
t9
|
|
337
418
|
]
|
|
338
419
|
});
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
} else
|
|
343
|
-
return
|
|
420
|
+
$[109] = t8;
|
|
421
|
+
$[110] = t9;
|
|
422
|
+
$[111] = t10;
|
|
423
|
+
} else t10 = $[111];
|
|
424
|
+
return t10;
|
|
344
425
|
};
|
|
345
426
|
TableRowInner.displayName = "TableRow";
|
|
346
427
|
const TableRow = /*#__PURE__*/ memo(TableRowInner);
|
|
@@ -353,4 +434,10 @@ function _temp2(c_0) {
|
|
|
353
434
|
function _temp3(c_1) {
|
|
354
435
|
return c_1.columnDef.meta?.description?.type === "text";
|
|
355
436
|
}
|
|
356
|
-
|
|
437
|
+
function _temp4(c_2) {
|
|
438
|
+
return SYSTEM_COLUMN_IDS.has(c_2.column.id);
|
|
439
|
+
}
|
|
440
|
+
function _temp5(c_3) {
|
|
441
|
+
return !SYSTEM_COLUMN_IDS.has(c_3.column.id);
|
|
442
|
+
}
|
|
443
|
+
export { TableFullWidthCell, TableRow };
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
2
|
import { GripVertical } from "../../../icons/index.js";
|
|
4
|
-
import { useTableContext } from "../TableContext/useTableContext.js";
|
|
5
3
|
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH } from "./constants.js";
|
|
6
|
-
import {
|
|
7
|
-
import { useTableValue } from "./tableReactivity.js";
|
|
4
|
+
import { useRowCanDrag } from "./useRowDnd.js";
|
|
8
5
|
const DragHandle = (t0)=>{
|
|
9
|
-
const $ = c(5);
|
|
10
6
|
const { row } = t0;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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;
|
|
7
|
+
return useRowCanDrag(row) ? /*#__PURE__*/ jsx(GripVertical, {
|
|
8
|
+
size: "sm",
|
|
9
|
+
className: "text-text-secondary"
|
|
10
|
+
}) : null;
|
|
30
11
|
};
|
|
31
12
|
const createDragHandleColumn = ()=>({
|
|
32
13
|
id: TABLE_DRAG_HANDLE_COLUMN_ID,
|
|
@@ -11,5 +11,7 @@ export interface UseRowDndResult {
|
|
|
11
11
|
attributes: UseSortableReturn['attributes'];
|
|
12
12
|
listeners: UseSortableReturn['listeners'];
|
|
13
13
|
}
|
|
14
|
+
/** Whether the row can be dragged: never a group row, and only if `getRowCanDrag` allows it. */
|
|
15
|
+
export declare const useRowCanDrag: <T extends RowData>(row: Row<DSTableFeatures, T>) => boolean;
|
|
14
16
|
export declare const useRowDnd: <T extends RowData>(row: Row<DSTableFeatures, T>) => UseRowDndResult;
|
|
15
17
|
export {};
|