@wallarm-org/design-system 2.7.2 → 2.8.0-rc-fix-table-dnd.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/dist/components/Table/TableBody/TableBodyCell.d.ts +3 -1
- package/dist/components/Table/TableBody/TableBodyCell.js +24 -23
- package/dist/components/Table/TableRow.js +3 -1
- package/dist/components/Table/lib/createDragHandleColumn.js +34 -4
- package/dist/components/Table/types.d.ts +1 -1
- package/dist/metadata/components.json +3 -3
- package/package.json +1 -1
|
@@ -12,8 +12,10 @@ interface TableBodyCellProps<T extends RowData> {
|
|
|
12
12
|
dragAttributes?: ReturnType<typeof useSortable>['attributes'];
|
|
13
13
|
/** Orange line indicator for row drag-and-drop placement */
|
|
14
14
|
dropIndicator?: 'above' | 'below';
|
|
15
|
+
/** Keep the cell (column alignment, borders) but render no content */
|
|
16
|
+
empty?: boolean;
|
|
15
17
|
}
|
|
16
|
-
export declare function TableBodyCell<T extends RowData>({ cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, dropIndicator, }: TableBodyCellProps<T>): import("react").JSX.Element;
|
|
18
|
+
export declare function TableBodyCell<T extends RowData>({ cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, dropIndicator, empty, }: TableBodyCellProps<T>): import("react").JSX.Element;
|
|
17
19
|
export declare namespace TableBodyCell {
|
|
18
20
|
var displayName: string;
|
|
19
21
|
}
|
|
@@ -11,8 +11,8 @@ import { Td } from "../primitives/index.js";
|
|
|
11
11
|
import { useTableContext } from "../TableContext/index.js";
|
|
12
12
|
import { TableMasterCellActions } from "../TableMasterCellActions.js";
|
|
13
13
|
const TableBodyCell = (t0)=>{
|
|
14
|
-
const $ = c(
|
|
15
|
-
const { cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, dropIndicator } = t0;
|
|
14
|
+
const $ = c(55);
|
|
15
|
+
const { cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, dropIndicator, empty } = t0;
|
|
16
16
|
const { masterColumnId } = useTableContext();
|
|
17
17
|
const testId = useTestId("body-cell");
|
|
18
18
|
const column = cell.column;
|
|
@@ -153,13 +153,14 @@ const TableBodyCell = (t0)=>{
|
|
|
153
153
|
$[37] = t13;
|
|
154
154
|
} else t13 = $[37];
|
|
155
155
|
let t14;
|
|
156
|
-
if ($[38] !== renderContent) {
|
|
157
|
-
t14 = renderContent();
|
|
158
|
-
$[38] =
|
|
159
|
-
$[39] =
|
|
160
|
-
|
|
156
|
+
if ($[38] !== empty || $[39] !== renderContent) {
|
|
157
|
+
t14 = !empty && renderContent();
|
|
158
|
+
$[38] = empty;
|
|
159
|
+
$[39] = renderContent;
|
|
160
|
+
$[40] = t14;
|
|
161
|
+
} else t14 = $[40];
|
|
161
162
|
let t15;
|
|
162
|
-
if ($[
|
|
163
|
+
if ($[41] !== colSpan || $[42] !== dragAttributes || $[43] !== dragListeners || $[44] !== isExpandedToggle || $[45] !== lastRow || $[46] !== t10 || $[47] !== t13 || $[48] !== t14 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8 || $[52] !== t9 || $[53] !== testId) {
|
|
163
164
|
t15 = /*#__PURE__*/ jsx(Td, {
|
|
164
165
|
"data-testid": testId,
|
|
165
166
|
className: t6,
|
|
@@ -175,21 +176,21 @@ const TableBodyCell = (t0)=>{
|
|
|
175
176
|
...dragAttributes,
|
|
176
177
|
children: t14
|
|
177
178
|
});
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
} else t15 = $[
|
|
179
|
+
$[41] = colSpan;
|
|
180
|
+
$[42] = dragAttributes;
|
|
181
|
+
$[43] = dragListeners;
|
|
182
|
+
$[44] = isExpandedToggle;
|
|
183
|
+
$[45] = lastRow;
|
|
184
|
+
$[46] = t10;
|
|
185
|
+
$[47] = t13;
|
|
186
|
+
$[48] = t14;
|
|
187
|
+
$[49] = t6;
|
|
188
|
+
$[50] = t7;
|
|
189
|
+
$[51] = t8;
|
|
190
|
+
$[52] = t9;
|
|
191
|
+
$[53] = testId;
|
|
192
|
+
$[54] = t15;
|
|
193
|
+
} else t15 = $[54];
|
|
193
194
|
return t15;
|
|
194
195
|
};
|
|
195
196
|
TableBodyCell.displayName = "TableBodyCell";
|
|
@@ -348,9 +348,11 @@ const TableRowInner = (t0)=>{
|
|
|
348
348
|
style: dndStyle,
|
|
349
349
|
children: [
|
|
350
350
|
t9.map((cell_1)=>{
|
|
351
|
-
const
|
|
351
|
+
const isDragHandleColumn = cell_1.column.id === TABLE_DRAG_HANDLE_COLUMN_ID;
|
|
352
|
+
const isDragHandle = canDnd && isDragHandleColumn;
|
|
352
353
|
return /*#__PURE__*/ jsx(TableBodyCell, {
|
|
353
354
|
cell: cell_1,
|
|
355
|
+
empty: isFullWidth && isDragHandleColumn && !canDnd,
|
|
354
356
|
dragListeners: isDragHandle ? listeners : void 0,
|
|
355
357
|
dragAttributes: isDragHandle ? attributes : void 0,
|
|
356
358
|
disablePinnedShadow: isFullWidth,
|
|
@@ -1,13 +1,43 @@
|
|
|
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 { cn } from "../../../utils/cn.js";
|
|
5
|
+
import { useTableContext } from "../TableContext/useTableContext.js";
|
|
3
6
|
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH } from "./constants.js";
|
|
7
|
+
import { isGroupRow } from "./isGroupRow.js";
|
|
8
|
+
import { useTableValue } from "./tableReactivity.js";
|
|
4
9
|
import { useRowCanDrag } from "./useRowDnd.js";
|
|
5
10
|
const DragHandle = (t0)=>{
|
|
11
|
+
const $ = c(7);
|
|
6
12
|
const { row } = t0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
const { showEmptyGroups } = useTableContext();
|
|
14
|
+
const canDrag = useRowCanDrag(row);
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== row || $[1] !== showEmptyGroups) {
|
|
17
|
+
t1 = ()=>isGroupRow(row, showEmptyGroups);
|
|
18
|
+
$[0] = row;
|
|
19
|
+
$[1] = showEmptyGroups;
|
|
20
|
+
$[2] = t1;
|
|
21
|
+
} else t1 = $[2];
|
|
22
|
+
const isGroup = useTableValue(t1);
|
|
23
|
+
if (isGroup) return null;
|
|
24
|
+
const t2 = !canDrag && "cursor-not-allowed opacity-50";
|
|
25
|
+
let t3;
|
|
26
|
+
if ($[3] !== t2) {
|
|
27
|
+
t3 = cn("text-text-secondary", t2);
|
|
28
|
+
$[3] = t2;
|
|
29
|
+
$[4] = t3;
|
|
30
|
+
} else t3 = $[4];
|
|
31
|
+
let t4;
|
|
32
|
+
if ($[5] !== t3) {
|
|
33
|
+
t4 = /*#__PURE__*/ jsx(GripVertical, {
|
|
34
|
+
size: "sm",
|
|
35
|
+
className: t3
|
|
36
|
+
});
|
|
37
|
+
$[5] = t3;
|
|
38
|
+
$[6] = t4;
|
|
39
|
+
} else t4 = $[6];
|
|
40
|
+
return t4;
|
|
11
41
|
};
|
|
12
42
|
const createDragHandleColumn = ()=>({
|
|
13
43
|
id: TABLE_DRAG_HANDLE_COLUMN_ID,
|
|
@@ -323,7 +323,7 @@ export interface TableProps<T> extends TestableProps {
|
|
|
323
323
|
onRowReorder?: (event: TableRowReorderEvent) => void;
|
|
324
324
|
/**
|
|
325
325
|
* Per-row drag control for `onRowReorder`. A row for which it returns
|
|
326
|
-
* `false` shows
|
|
326
|
+
* `false` shows a disabled grip (none on a full-width row), cannot be dragged and is not a drop target — the
|
|
327
327
|
* other rows of its group move around it. Group rows never move regardless.
|
|
328
328
|
*
|
|
329
329
|
* Default: every non-group row can be dragged.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.7.
|
|
3
|
-
"generatedAt": "2026-10-
|
|
2
|
+
"version": "2.7.2",
|
|
3
|
+
"generatedAt": "2026-10-14T09:31:48.262Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -101624,7 +101624,7 @@
|
|
|
101624
101624
|
"name": "getRowCanDrag",
|
|
101625
101625
|
"type": "((row: TableRow<T>) => boolean) | undefined",
|
|
101626
101626
|
"required": false,
|
|
101627
|
-
"description": "Per-row drag control for `onRowReorder`. A row for which it returns\n`false` shows
|
|
101627
|
+
"description": "Per-row drag control for `onRowReorder`. A row for which it returns\n`false` shows a disabled grip (none on a full-width row), cannot be dragged and is not a drop target — the\nother rows of its group move around it. Group rows never move regardless.\n\nDefault: every non-group row can be dragged."
|
|
101628
101628
|
},
|
|
101629
101629
|
{
|
|
101630
101630
|
"name": "renderFullWidthRow",
|
package/package.json
CHANGED