@wallarm-org/design-system 2.4.0-rc-feature-page-header-group.1 → 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
3
3
|
import { createContext, useContext, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
4
5
|
import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
5
6
|
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
6
7
|
import { useTableContext } from "../TableContext/index.js";
|
|
@@ -22,7 +23,7 @@ function resetCursor() {
|
|
|
22
23
|
document.head.querySelector(`style[${CURSOR_STYLE_ATTR}]`)?.remove();
|
|
23
24
|
}
|
|
24
25
|
const TableBodyRowDndContext = (t0)=>{
|
|
25
|
-
const $ =
|
|
26
|
+
const $ = compiler_runtime_c(3);
|
|
26
27
|
const { children } = t0;
|
|
27
28
|
const { rowDndEnabled, onRowReorder } = useTableContext();
|
|
28
29
|
if (!rowDndEnabled) return children;
|
|
@@ -39,7 +40,7 @@ const TableBodyRowDndContext = (t0)=>{
|
|
|
39
40
|
return t1;
|
|
40
41
|
};
|
|
41
42
|
const TableBodyRowDndContextInner = (t0)=>{
|
|
42
|
-
const $ =
|
|
43
|
+
const $ = compiler_runtime_c(38);
|
|
43
44
|
const { children, onRowReorder } = t0;
|
|
44
45
|
const { table } = useTableContext();
|
|
45
46
|
let t1;
|
|
@@ -71,135 +72,169 @@ const TableBodyRowDndContextInner = (t0)=>{
|
|
|
71
72
|
} else t3 = $[6];
|
|
72
73
|
const indicatorState = t3;
|
|
73
74
|
let t4;
|
|
74
|
-
if ($[7]
|
|
75
|
-
t4 =
|
|
75
|
+
if ($[7] !== rows) {
|
|
76
|
+
t4 = new Map(rows.map(_temp2));
|
|
77
|
+
$[7] = rows;
|
|
78
|
+
$[8] = t4;
|
|
79
|
+
} else t4 = $[8];
|
|
80
|
+
const parentOf = t4;
|
|
81
|
+
let t5;
|
|
82
|
+
if ($[9] !== parentOf) {
|
|
83
|
+
t5 = (args)=>closestCenter({
|
|
84
|
+
...args,
|
|
85
|
+
droppableContainers: args.droppableContainers.filter((c)=>parentOf.get(String(c.id)) === parentOf.get(String(args.active.id)))
|
|
86
|
+
});
|
|
87
|
+
$[9] = parentOf;
|
|
88
|
+
$[10] = t5;
|
|
89
|
+
} else t5 = $[10];
|
|
90
|
+
const collisionDetection = t5;
|
|
91
|
+
let t6;
|
|
92
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
|
+
t6 = {
|
|
76
94
|
activationConstraint: {
|
|
77
95
|
distance: 5
|
|
78
96
|
}
|
|
79
97
|
};
|
|
80
|
-
$[
|
|
81
|
-
} else
|
|
82
|
-
const sensors = useSensors(useSensor(PointerSensor,
|
|
83
|
-
let
|
|
84
|
-
if ($[
|
|
85
|
-
|
|
98
|
+
$[11] = t6;
|
|
99
|
+
} else t6 = $[11];
|
|
100
|
+
const sensors = useSensors(useSensor(PointerSensor, t6), useSensor(KeyboardSensor));
|
|
101
|
+
let t7;
|
|
102
|
+
if ($[12] !== rows) {
|
|
103
|
+
t7 = (event)=>{
|
|
86
104
|
const id = String(event.active.id);
|
|
87
|
-
const row = rows.find((
|
|
105
|
+
const row = rows.find((r_1)=>r_1.id === id);
|
|
88
106
|
setActiveRow(row ?? null);
|
|
89
107
|
setActiveId(id);
|
|
90
108
|
setCursorGrabbing();
|
|
91
109
|
};
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
} else
|
|
95
|
-
const handleDragStart =
|
|
96
|
-
let
|
|
97
|
-
if ($[
|
|
98
|
-
|
|
110
|
+
$[12] = rows;
|
|
111
|
+
$[13] = t7;
|
|
112
|
+
} else t7 = $[13];
|
|
113
|
+
const handleDragStart = t7;
|
|
114
|
+
let t8;
|
|
115
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
|
+
t8 = (event_0)=>{
|
|
99
117
|
setOverId(event_0.over ? String(event_0.over.id) : null);
|
|
100
118
|
};
|
|
101
|
-
$[
|
|
102
|
-
} else
|
|
103
|
-
const handleDragOver =
|
|
104
|
-
let
|
|
105
|
-
if ($[
|
|
106
|
-
|
|
119
|
+
$[14] = t8;
|
|
120
|
+
} else t8 = $[14];
|
|
121
|
+
const handleDragOver = t8;
|
|
122
|
+
let t9;
|
|
123
|
+
if ($[15] !== onRowReorder || $[16] !== parentOf) {
|
|
124
|
+
t9 = (event_1)=>{
|
|
107
125
|
setActiveRow(null);
|
|
108
126
|
setActiveId(null);
|
|
109
127
|
setOverId(null);
|
|
110
128
|
resetCursor();
|
|
111
129
|
const { active, over } = event_1;
|
|
112
130
|
if (!over || active.id === over.id) return;
|
|
131
|
+
if (parentOf.get(String(active.id)) !== parentOf.get(String(over.id))) return;
|
|
113
132
|
onRowReorder?.({
|
|
114
133
|
activeRowId: String(active.id),
|
|
115
134
|
overRowId: String(over.id)
|
|
116
135
|
});
|
|
117
136
|
};
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
137
|
+
$[15] = onRowReorder;
|
|
138
|
+
$[16] = parentOf;
|
|
139
|
+
$[17] = t9;
|
|
140
|
+
} else t9 = $[17];
|
|
141
|
+
const handleDragEnd = t9;
|
|
142
|
+
let t10;
|
|
143
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
144
|
+
t10 = ()=>{
|
|
125
145
|
setActiveRow(null);
|
|
126
146
|
setActiveId(null);
|
|
127
147
|
setOverId(null);
|
|
128
148
|
resetCursor();
|
|
129
149
|
};
|
|
130
|
-
$[
|
|
131
|
-
} else
|
|
132
|
-
const handleDragCancel =
|
|
133
|
-
let
|
|
134
|
-
if ($[
|
|
135
|
-
|
|
150
|
+
$[18] = t10;
|
|
151
|
+
} else t10 = $[18];
|
|
152
|
+
const handleDragCancel = t10;
|
|
153
|
+
let t11;
|
|
154
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
155
|
+
t11 = {
|
|
156
|
+
container: document.body
|
|
157
|
+
};
|
|
158
|
+
$[19] = t11;
|
|
159
|
+
} else t11 = $[19];
|
|
160
|
+
let t12;
|
|
161
|
+
if ($[20] !== children || $[21] !== rowIds) {
|
|
162
|
+
t12 = /*#__PURE__*/ jsx(SortableContext, {
|
|
136
163
|
items: rowIds,
|
|
137
164
|
strategy: verticalListSortingStrategy,
|
|
138
165
|
children: children
|
|
139
166
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
} else
|
|
144
|
-
let
|
|
145
|
-
if ($[
|
|
146
|
-
|
|
167
|
+
$[20] = children;
|
|
168
|
+
$[21] = rowIds;
|
|
169
|
+
$[22] = t12;
|
|
170
|
+
} else t12 = $[22];
|
|
171
|
+
let t13;
|
|
172
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
173
|
+
t13 = {
|
|
147
174
|
cursor: "grabbing"
|
|
148
175
|
};
|
|
149
|
-
$[
|
|
150
|
-
} else
|
|
151
|
-
let
|
|
152
|
-
if ($[
|
|
153
|
-
|
|
176
|
+
$[23] = t13;
|
|
177
|
+
} else t13 = $[23];
|
|
178
|
+
let t14;
|
|
179
|
+
if ($[24] !== activeRow) {
|
|
180
|
+
t14 = activeRow ? /*#__PURE__*/ jsx(TableRowOverlay, {
|
|
154
181
|
row: activeRow
|
|
155
182
|
}) : null;
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
} else
|
|
159
|
-
let
|
|
160
|
-
if ($[
|
|
161
|
-
|
|
162
|
-
style:
|
|
163
|
-
children:
|
|
164
|
-
});
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
} else
|
|
168
|
-
let
|
|
169
|
-
if ($[
|
|
170
|
-
|
|
183
|
+
$[24] = activeRow;
|
|
184
|
+
$[25] = t14;
|
|
185
|
+
} else t14 = $[25];
|
|
186
|
+
let t15;
|
|
187
|
+
if ($[26] !== t14) {
|
|
188
|
+
t15 = /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(DragOverlay, {
|
|
189
|
+
style: t13,
|
|
190
|
+
children: t14
|
|
191
|
+
}), document.body);
|
|
192
|
+
$[26] = t14;
|
|
193
|
+
$[27] = t15;
|
|
194
|
+
} else t15 = $[27];
|
|
195
|
+
let t16;
|
|
196
|
+
if ($[28] !== collisionDetection || $[29] !== handleDragEnd || $[30] !== handleDragStart || $[31] !== sensors || $[32] !== t12 || $[33] !== t15) {
|
|
197
|
+
t16 = /*#__PURE__*/ jsxs(DndContext, {
|
|
171
198
|
sensors: sensors,
|
|
172
|
-
collisionDetection:
|
|
199
|
+
collisionDetection: collisionDetection,
|
|
200
|
+
accessibility: t11,
|
|
173
201
|
onDragStart: handleDragStart,
|
|
174
202
|
onDragOver: handleDragOver,
|
|
175
203
|
onDragEnd: handleDragEnd,
|
|
176
204
|
onDragCancel: handleDragCancel,
|
|
177
205
|
children: [
|
|
178
|
-
|
|
179
|
-
|
|
206
|
+
t12,
|
|
207
|
+
t15
|
|
180
208
|
]
|
|
181
209
|
});
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
210
|
+
$[28] = collisionDetection;
|
|
211
|
+
$[29] = handleDragEnd;
|
|
212
|
+
$[30] = handleDragStart;
|
|
213
|
+
$[31] = sensors;
|
|
214
|
+
$[32] = t12;
|
|
215
|
+
$[33] = t15;
|
|
216
|
+
$[34] = t16;
|
|
217
|
+
} else t16 = $[34];
|
|
218
|
+
let t17;
|
|
219
|
+
if ($[35] !== indicatorState || $[36] !== t16) {
|
|
220
|
+
t17 = /*#__PURE__*/ jsx(RowDndIndicatorContext.Provider, {
|
|
192
221
|
value: indicatorState,
|
|
193
|
-
children:
|
|
222
|
+
children: t16
|
|
194
223
|
});
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
} else
|
|
199
|
-
return
|
|
224
|
+
$[35] = indicatorState;
|
|
225
|
+
$[36] = t16;
|
|
226
|
+
$[37] = t17;
|
|
227
|
+
} else t17 = $[37];
|
|
228
|
+
return t17;
|
|
200
229
|
};
|
|
201
230
|
TableBodyRowDndContext.displayName = "TableBodyRowDndContext";
|
|
202
231
|
function _temp(r) {
|
|
203
232
|
return r.id;
|
|
204
233
|
}
|
|
234
|
+
function _temp2(r_0) {
|
|
235
|
+
return [
|
|
236
|
+
r_0.id,
|
|
237
|
+
r_0.parentId
|
|
238
|
+
];
|
|
239
|
+
}
|
|
205
240
|
export { TableBodyRowDndContext, useRowDndIndicator };
|