@vue-dnd-kit/core 2.4.6 → 2.4.7
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.
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-preview{transform-origin:0 0;will-change:transform}.dnd-kit-preview-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
import { shallowRef as
|
|
3
|
-
const
|
|
2
|
+
import { shallowRef as X, ref as q, reactive as $, computed as b, watch as te, onScopeDispose as tt, onMounted as Y, onBeforeUnmount as Z, inject as Be, defineComponent as Oe, useTemplateRef as Fe, unref as j, openBlock as L, createElementBlock as W, normalizeStyle as Ie, renderSlot as de, Fragment as me, renderList as nt, createBlock as J, resolveDynamicComponent as he, createCommentVNode as st, provide as at, Teleport as it, createElementVNode as ot, mergeProps as rt } from "vue";
|
|
3
|
+
const C = {
|
|
4
4
|
SELECT_AREA: "data-dnd-kit-select-area",
|
|
5
5
|
DRAGGABLE: "data-dnd-kit-draggable",
|
|
6
6
|
DROPPABLE: "data-dnd-kit-droppable",
|
|
7
7
|
CONSTRAINT_AREA: "data-dnd-kit-constraint-area"
|
|
8
8
|
}, G = {
|
|
9
|
-
SELECT_AREA: `[${
|
|
10
|
-
DRAGGABLE: `[${
|
|
11
|
-
CONSTRAINT_AREA: `[${
|
|
12
|
-
}, xe = "VueDnDKitProvider",
|
|
13
|
-
const
|
|
9
|
+
SELECT_AREA: `[${C.SELECT_AREA}]`,
|
|
10
|
+
DRAGGABLE: `[${C.DRAGGABLE}]`,
|
|
11
|
+
CONSTRAINT_AREA: `[${C.CONSTRAINT_AREA}]`
|
|
12
|
+
}, xe = "VueDnDKitProvider", Ce = (e, t, n, s) => {
|
|
13
|
+
const a = /* @__PURE__ */ new Set();
|
|
14
14
|
return t.forEach((r) => {
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const l =
|
|
15
|
+
const i = e.get(r), o = s ? s(r) : i?.disabled;
|
|
16
|
+
if (!i || o) return;
|
|
17
|
+
const l = i.modifier?.keys, c = i.modifier?.method;
|
|
18
18
|
if (!l || !c || l.length === 0) {
|
|
19
|
-
|
|
19
|
+
a.add(r);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
l[c]((g) => n.value.has(g)) &&
|
|
23
|
-
}),
|
|
22
|
+
l[c]((g) => n.value.has(g)) && a.add(r);
|
|
23
|
+
}), a;
|
|
24
24
|
};
|
|
25
|
-
let ze = "",
|
|
26
|
-
const S = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, H = (e, t) => e !== t && e.contains(t),
|
|
25
|
+
let ze = "", lt = "", ct = "";
|
|
26
|
+
const S = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, H = (e, t) => e !== t && e.contains(t), gt = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), be = () => {
|
|
27
27
|
const e = document.body;
|
|
28
28
|
ze = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", M), window.addEventListener("selectstart", M), window.addEventListener("touchstart", M), window.addEventListener("touchmove", M);
|
|
29
|
-
},
|
|
29
|
+
}, pe = () => {
|
|
30
30
|
const e = document.body;
|
|
31
|
-
e.style.userSelect = ze, e.style.touchAction =
|
|
31
|
+
e.style.userSelect = ze, e.style.touchAction = lt, e.style.overscrollBehavior = ct, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
|
|
32
32
|
}, M = (e) => e.preventDefault(), Ee = (e, t) => {
|
|
33
33
|
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
34
34
|
for (const s of t.entities.visibleDraggableSet)
|
|
@@ -39,38 +39,38 @@ const S = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
39
39
|
for (const s of t.entities.visibleDroppableSet)
|
|
40
40
|
if (t.entities.droppableMap.get(s)?.disabled && H(s, e)) return !0;
|
|
41
41
|
return !1;
|
|
42
|
-
},
|
|
42
|
+
}, ne = (e, t) => {
|
|
43
43
|
if (!e.length || !t.length) return !0;
|
|
44
44
|
const n = new Set(t);
|
|
45
45
|
return e.some((s) => n.has(s));
|
|
46
46
|
};
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
for (const
|
|
50
|
-
const o = n.get(
|
|
51
|
-
|
|
47
|
+
function ut(e, t, n, s) {
|
|
48
|
+
const a = [];
|
|
49
|
+
for (const i of t.keys()) {
|
|
50
|
+
const o = n.get(i);
|
|
51
|
+
a.push({ groups: o?.groups ?? [] });
|
|
52
52
|
}
|
|
53
53
|
const r = /* @__PURE__ */ new Set();
|
|
54
|
-
for (const
|
|
55
|
-
const o = s.get(
|
|
56
|
-
(!
|
|
54
|
+
for (const i of e) {
|
|
55
|
+
const o = s.get(i), l = o?.groups ?? [], c = o?.groupMatch ?? "every";
|
|
56
|
+
(!a.length || a[c]((g) => ne(g.groups, l))) && r.add(i);
|
|
57
57
|
}
|
|
58
58
|
return r;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function ft(e, t, n) {
|
|
61
61
|
const s = /* @__PURE__ */ new Set();
|
|
62
|
-
for (const
|
|
63
|
-
const o = n.get(
|
|
62
|
+
for (const i of t.keys()) {
|
|
63
|
+
const o = n.get(i);
|
|
64
64
|
for (const l of o?.groups ?? []) s.add(l);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
for (const
|
|
68
|
-
const l = n.get(
|
|
69
|
-
|
|
66
|
+
const a = [...s], r = /* @__PURE__ */ new Set();
|
|
67
|
+
for (const i of e) {
|
|
68
|
+
const l = n.get(i)?.groups ?? [];
|
|
69
|
+
ne(a, l) && r.add(i);
|
|
70
70
|
}
|
|
71
71
|
return r;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const oe = (e) => {
|
|
74
74
|
if (typeof IntersectionObserver > "u")
|
|
75
75
|
return { observe: () => {
|
|
76
76
|
}, unobserve: () => {
|
|
@@ -78,8 +78,8 @@ const re = (e) => {
|
|
|
78
78
|
} };
|
|
79
79
|
const t = new IntersectionObserver((n) => {
|
|
80
80
|
n.forEach((s) => {
|
|
81
|
-
const
|
|
82
|
-
e[s.isIntersecting ? "add" : "delete"](
|
|
81
|
+
const a = s.target;
|
|
82
|
+
e[s.isIntersecting ? "add" : "delete"](a);
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
return {
|
|
@@ -88,7 +88,7 @@ const re = (e) => {
|
|
|
88
88
|
disconnect: () => t.disconnect()
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
function
|
|
91
|
+
function ye(e, t = 0, n = 0) {
|
|
92
92
|
return {
|
|
93
93
|
start: { x: e.clientX, y: e.clientY },
|
|
94
94
|
current: { x: e.clientX, y: e.clientY },
|
|
@@ -96,8 +96,8 @@ function De(e, t = 0, n = 0) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
function _e(e, t) {
|
|
99
|
-
const n = t.getBoundingClientRect(), s = n.width > 0 ? (e.clientX - n.left) / n.width : 0.5,
|
|
100
|
-
return { x: s, y:
|
|
99
|
+
const n = t.getBoundingClientRect(), s = n.width > 0 ? (e.clientX - n.left) / n.width : 0.5, a = n.height > 0 ? (e.clientY - n.top) / n.height : 0.5;
|
|
100
|
+
return { x: s, y: a };
|
|
101
101
|
}
|
|
102
102
|
function Ge(e, t) {
|
|
103
103
|
return {
|
|
@@ -107,34 +107,34 @@ function Ge(e, t) {
|
|
|
107
107
|
initialOuterHTML: e.outerHTML
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function dt(e, t, n) {
|
|
111
111
|
e.forEach((s) => {
|
|
112
|
-
const
|
|
113
|
-
n.set(s, Ge(s,
|
|
112
|
+
const a = t.get(s);
|
|
113
|
+
n.set(s, Ge(s, a));
|
|
114
114
|
}), e.clear();
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function mt(e, t, n) {
|
|
117
117
|
n.clear();
|
|
118
118
|
const s = t.get(e);
|
|
119
119
|
n.set(e, Ge(e, s));
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
e.entities.initiatingDraggable && (e.state.value = "dragging",
|
|
121
|
+
function Q(e) {
|
|
122
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", ht(
|
|
123
123
|
e.entities.initiatingDraggable,
|
|
124
124
|
e.entities.selectedSet,
|
|
125
125
|
e.entities.draggableMap,
|
|
126
126
|
e.entities.draggingMap
|
|
127
127
|
));
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
t.has(e) ?
|
|
129
|
+
function ht(e, t, n, s) {
|
|
130
|
+
t.has(e) ? dt(t, n, s) : (t.clear(), mt(e, n, s));
|
|
131
131
|
}
|
|
132
132
|
function He(e, t, n, s) {
|
|
133
133
|
if (s || !n) return !0;
|
|
134
|
-
const
|
|
135
|
-
return
|
|
134
|
+
const a = e.closest(n);
|
|
135
|
+
return a ? t.contains(a) : !1;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function bt(e, t) {
|
|
138
138
|
if (!e || !t) return 1;
|
|
139
139
|
const n = Math.abs(e.current.x - e.start.x), s = Math.abs(e.current.y - e.start.y);
|
|
140
140
|
if (typeof t == "number") {
|
|
@@ -142,20 +142,20 @@ function dt(e, t) {
|
|
|
142
142
|
return Math.min(c / t, 1);
|
|
143
143
|
}
|
|
144
144
|
const {
|
|
145
|
-
x:
|
|
145
|
+
x: a = 0,
|
|
146
146
|
y: r = 0,
|
|
147
|
-
condition:
|
|
147
|
+
condition: i = "any"
|
|
148
148
|
} = t;
|
|
149
|
-
if (
|
|
150
|
-
const o =
|
|
151
|
-
return
|
|
149
|
+
if (a === 0 && r === 0) return 1;
|
|
150
|
+
const o = a > 0 ? Math.min(n / a, 1) : 1, l = r > 0 ? Math.min(s / r, 1) : 1;
|
|
151
|
+
return i === "both" ? Math.min(o, l) : Math.max(o, l);
|
|
152
152
|
}
|
|
153
153
|
function Ke(e, t, n) {
|
|
154
154
|
if (!n) return !0;
|
|
155
|
-
const s = n.distance != null,
|
|
156
|
-
return !s && !
|
|
155
|
+
const s = n.distance != null, a = n.delay != null;
|
|
156
|
+
return !s && !a ? !0 : s && !a ? e >= 1 : !s && a ? t >= 1 : (n.condition ?? "both") === "both" ? e >= 1 && t >= 1 : e >= 1 || t >= 1;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function pt(e) {
|
|
159
159
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
160
160
|
return !1;
|
|
161
161
|
const t = e.entities.draggableMap.get(
|
|
@@ -165,18 +165,18 @@ function mt(e) {
|
|
|
165
165
|
e.distanceProgress.value,
|
|
166
166
|
e.delay.progress,
|
|
167
167
|
t?.activation
|
|
168
|
-
) ? (
|
|
168
|
+
) ? (Q(e), !0) : !1;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function yt(e, t) {
|
|
171
171
|
let n = null;
|
|
172
172
|
const s = () => {
|
|
173
173
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
174
174
|
n = null;
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
const
|
|
177
|
+
const a = e.entities.draggableMap.get(
|
|
178
178
|
e.entities.initiatingDraggable
|
|
179
|
-
), r =
|
|
179
|
+
), r = a?.activation?.delay;
|
|
180
180
|
if (!r) {
|
|
181
181
|
n = null;
|
|
182
182
|
return;
|
|
@@ -187,7 +187,7 @@ function ht(e, t) {
|
|
|
187
187
|
), Ke(
|
|
188
188
|
e.distanceProgress.value,
|
|
189
189
|
e.delay.progress,
|
|
190
|
-
|
|
190
|
+
a?.activation
|
|
191
191
|
) ? (t(), n = null) : n = requestAnimationFrame(s);
|
|
192
192
|
};
|
|
193
193
|
return n = requestAnimationFrame(s), {
|
|
@@ -196,7 +196,7 @@ function ht(e, t) {
|
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Dt(e, t) {
|
|
200
200
|
const n = e.closest(
|
|
201
201
|
G.CONSTRAINT_AREA
|
|
202
202
|
);
|
|
@@ -205,36 +205,36 @@ function bt(e, t) {
|
|
|
205
205
|
entity: t.get(n)
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function wt(e, t, n, s) {
|
|
209
209
|
return n === "x" ? { x: e, y: s.top } : n === "y" ? { x: s.left, y: t } : { x: e, y: t };
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
let r = e,
|
|
211
|
+
function St(e, t, n, s, a) {
|
|
212
|
+
let r = e, i = t;
|
|
213
213
|
return n !== "y" && (r = Math.max(
|
|
214
214
|
s.left,
|
|
215
|
-
Math.min(s.right -
|
|
216
|
-
)), n !== "x" && (
|
|
215
|
+
Math.min(s.right - a.width, e)
|
|
216
|
+
)), n !== "x" && (i = Math.max(
|
|
217
217
|
s.top,
|
|
218
|
-
Math.min(s.bottom -
|
|
219
|
-
)), { x: r, y:
|
|
218
|
+
Math.min(s.bottom - a.height, t)
|
|
219
|
+
)), { x: r, y: i };
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Mt(e, t, n, s) {
|
|
222
222
|
if (!e)
|
|
223
223
|
return { x: 0, y: 0 };
|
|
224
|
-
const
|
|
225
|
-
let
|
|
224
|
+
const a = t?.width ?? 0, r = t?.height ?? 0;
|
|
225
|
+
let i = e.current.x - a * e.offset.x, o = e.current.y - r * e.offset.y;
|
|
226
226
|
if (!n)
|
|
227
|
-
return { x:
|
|
228
|
-
const l =
|
|
227
|
+
return { x: i, y: o };
|
|
228
|
+
const l = Dt(n, s);
|
|
229
229
|
if (!l)
|
|
230
|
-
return { x:
|
|
231
|
-
const { element: c, entity: u } = l, g = c.getBoundingClientRect(), f = n.getBoundingClientRect(), d =
|
|
232
|
-
|
|
230
|
+
return { x: i, y: o };
|
|
231
|
+
const { element: c, entity: u } = l, g = c.getBoundingClientRect(), f = n.getBoundingClientRect(), d = wt(
|
|
232
|
+
i,
|
|
233
233
|
o,
|
|
234
234
|
u.axis || "both",
|
|
235
235
|
f
|
|
236
236
|
);
|
|
237
|
-
return u.restrictToArea ?
|
|
237
|
+
return u.restrictToArea ? St(
|
|
238
238
|
d.x,
|
|
239
239
|
d.y,
|
|
240
240
|
u.axis || "both",
|
|
@@ -242,7 +242,7 @@ function Dt(e, t, n, s) {
|
|
|
242
242
|
t ?? { width: 0, height: 0 }
|
|
243
243
|
) : d;
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const V = {
|
|
246
246
|
forDrag: ["Enter", "Space"],
|
|
247
247
|
forCancel: ["Escape"],
|
|
248
248
|
forDrop: ["Enter", "Space"],
|
|
@@ -258,19 +258,19 @@ const X = {
|
|
|
258
258
|
],
|
|
259
259
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
260
260
|
};
|
|
261
|
-
function
|
|
262
|
-
const n =
|
|
261
|
+
function vt(e, t) {
|
|
262
|
+
const n = X(), s = q(), r = {
|
|
263
263
|
keys: {
|
|
264
264
|
pressedKeys: q(/* @__PURE__ */ new Set()),
|
|
265
|
-
forDrag: [...
|
|
266
|
-
forCancel: [...
|
|
267
|
-
forDrop: [...
|
|
268
|
-
forMove: [...
|
|
269
|
-
forMoveFaster: [...
|
|
265
|
+
forDrag: [...V.forDrag],
|
|
266
|
+
forCancel: [...V.forCancel],
|
|
267
|
+
forDrop: [...V.forDrop],
|
|
268
|
+
forMove: [...V.forMove],
|
|
269
|
+
forMoveFaster: [...V.forMoveFaster]
|
|
270
270
|
},
|
|
271
271
|
step: 8,
|
|
272
272
|
moveFaster: 4
|
|
273
|
-
},
|
|
273
|
+
}, i = $({
|
|
274
274
|
draggableMap: /* @__PURE__ */ new Map(),
|
|
275
275
|
droppableMap: /* @__PURE__ */ new Map(),
|
|
276
276
|
selectableAreaMap: /* @__PURE__ */ new Map(),
|
|
@@ -280,27 +280,27 @@ function wt(e, t) {
|
|
|
280
280
|
draggingMap: /* @__PURE__ */ new Map(),
|
|
281
281
|
selectedSet: /* @__PURE__ */ new Set(),
|
|
282
282
|
selectionBase: /* @__PURE__ */ new Set(),
|
|
283
|
-
allowedDroppableSet: b(() => n.value ?
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
allowedDroppableSet: b(() => n.value ? ut(
|
|
284
|
+
i.visibleDroppableSet,
|
|
285
|
+
i.draggingMap,
|
|
286
|
+
i.draggableMap,
|
|
287
|
+
i.droppableMap
|
|
288
288
|
) : /* @__PURE__ */ new Set()),
|
|
289
|
-
allowedDraggableSet: b(() => n.value ?
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
allowedDraggableSet: b(() => n.value ? ft(
|
|
290
|
+
i.visibleDraggableSet,
|
|
291
|
+
i.draggingMap,
|
|
292
|
+
i.draggableMap
|
|
293
293
|
) : /* @__PURE__ */ new Set()),
|
|
294
|
-
modifiersSelectableAreaSet: b(() =>
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
modifiersSelectableAreaSet: b(() => Ce(
|
|
295
|
+
i.selectableAreaMap,
|
|
296
|
+
i.visibleSelectableAreaSet,
|
|
297
297
|
r.keys.pressedKeys
|
|
298
298
|
)),
|
|
299
|
-
modifiersDraggableSet: b(() =>
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
modifiersDraggableSet: b(() => Ce(
|
|
300
|
+
i.draggableMap,
|
|
301
|
+
i.visibleDraggableSet,
|
|
302
302
|
r.keys.pressedKeys,
|
|
303
|
-
(w) => Ee(w, { entities:
|
|
303
|
+
(w) => Ee(w, { entities: i })
|
|
304
304
|
)),
|
|
305
305
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
306
306
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
@@ -309,7 +309,7 @@ function wt(e, t) {
|
|
|
309
309
|
draggable: /* @__PURE__ */ new Map(),
|
|
310
310
|
droppable: /* @__PURE__ */ new Map()
|
|
311
311
|
}), l = {
|
|
312
|
-
throttle:
|
|
312
|
+
throttle: X(0)
|
|
313
313
|
}, c = $({
|
|
314
314
|
x: typeof window < "u" ? window.scrollX : 0,
|
|
315
315
|
y: typeof window < "u" ? window.scrollY : 0
|
|
@@ -317,23 +317,23 @@ function wt(e, t) {
|
|
|
317
317
|
progress: 0,
|
|
318
318
|
startTime: 0
|
|
319
319
|
}), g = b(() => {
|
|
320
|
-
if (!s.value || !
|
|
321
|
-
const w =
|
|
322
|
-
return w ?
|
|
323
|
-
}), f =
|
|
324
|
-
|
|
325
|
-
), d =
|
|
326
|
-
|
|
327
|
-
), h =
|
|
328
|
-
|
|
329
|
-
), m = q(), y =
|
|
320
|
+
if (!s.value || !i.initiatingDraggable) return 0;
|
|
321
|
+
const w = i.draggableMap.get(i.initiatingDraggable)?.activation?.distance;
|
|
322
|
+
return w ? bt(s.value, w) : 1;
|
|
323
|
+
}), f = oe(
|
|
324
|
+
i.visibleDraggableSet
|
|
325
|
+
), d = oe(
|
|
326
|
+
i.visibleDroppableSet
|
|
327
|
+
), h = oe(
|
|
328
|
+
i.visibleSelectableAreaSet
|
|
329
|
+
), m = q(), y = X(typeof DOMRect < "u" ? new DOMRect() : {}), p = b(() => {
|
|
330
330
|
c.x, c.y;
|
|
331
|
-
const D = y.value, w =
|
|
332
|
-
return
|
|
331
|
+
const D = y.value, w = i.initiatingDraggable, T = w ? i.draggingMap.get(w) : null, P = D.width && D.height ? D : T?.initialRect ?? null;
|
|
332
|
+
return Mt(
|
|
333
333
|
s.value,
|
|
334
334
|
P,
|
|
335
335
|
w || null,
|
|
336
|
-
|
|
336
|
+
i.constraintsAreaMap
|
|
337
337
|
);
|
|
338
338
|
}), x = b({
|
|
339
339
|
get: () => t?.previewTo,
|
|
@@ -342,7 +342,7 @@ function wt(e, t) {
|
|
|
342
342
|
return {
|
|
343
343
|
state: n,
|
|
344
344
|
pointer: s,
|
|
345
|
-
entities:
|
|
345
|
+
entities: i,
|
|
346
346
|
keyboard: r,
|
|
347
347
|
scrollPosition: c,
|
|
348
348
|
delay: u,
|
|
@@ -365,7 +365,7 @@ function wt(e, t) {
|
|
|
365
365
|
autoScrollViewport: k
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
const
|
|
368
|
+
const ee = (e) => {
|
|
369
369
|
const t = e.hovered.draggable.keys().next().value;
|
|
370
370
|
if (t) {
|
|
371
371
|
const s = e.entities.draggableMap.get(t);
|
|
@@ -378,14 +378,14 @@ const te = (e) => {
|
|
|
378
378
|
}
|
|
379
379
|
e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, e.entities.selectionBase.clear(), e.entities.initiatingDraggable = void 0, e.delay.progress = 0, e.delay.startTime = 0, e.entities.draggingMap.clear(), e.hovered.draggable.clear(), e.hovered.droppable.clear();
|
|
380
380
|
};
|
|
381
|
-
function
|
|
381
|
+
function At(e) {
|
|
382
382
|
return e.parentElement?.closest(
|
|
383
383
|
G.SELECT_AREA
|
|
384
384
|
) ?? null;
|
|
385
385
|
}
|
|
386
|
-
const
|
|
386
|
+
const xt = (e, t, n) => {
|
|
387
387
|
if (!n) return {};
|
|
388
|
-
const s = n.getBoundingClientRect(),
|
|
388
|
+
const s = n.getBoundingClientRect(), a = Math.max(s.left, Math.min(e.x, t.x)), r = Math.max(s.top, Math.min(e.y, t.y)), i = Math.min(s.right, Math.max(e.x, t.x)), o = Math.min(s.bottom, Math.max(e.y, t.y)), l = Math.max(0, i - a), c = Math.max(0, o - r), u = a - s.left + n.scrollLeft, g = r - s.top + n.scrollTop;
|
|
389
389
|
return {
|
|
390
390
|
position: "absolute",
|
|
391
391
|
left: `${u}px`,
|
|
@@ -398,14 +398,14 @@ const Mt = (e, t, n) => {
|
|
|
398
398
|
};
|
|
399
399
|
}, Ne = (e) => {
|
|
400
400
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
401
|
-
const { selectingArea: t } = e.entities, n =
|
|
401
|
+
const { selectingArea: t } = e.entities, n = Et(
|
|
402
402
|
e.pointer.value.start,
|
|
403
403
|
e.pointer.value.current
|
|
404
|
-
), s = e.entities.selectableAreaMap.get(t)?.groups ?? [],
|
|
404
|
+
), s = e.entities.selectableAreaMap.get(t)?.groups ?? [], a = e.lib.rectCache;
|
|
405
405
|
e.entities.visibleDraggableSet.forEach((r) => {
|
|
406
406
|
if (r === t || !t.contains(r)) return;
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
407
|
+
const i = At(r);
|
|
408
|
+
if (i && i !== t) {
|
|
409
409
|
e.entities.selectedSet.delete(r);
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
@@ -414,13 +414,13 @@ const Mt = (e, t, n) => {
|
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
const l = e.entities.draggableMap.get(r)?.groups ?? [];
|
|
417
|
-
if (!
|
|
417
|
+
if (!ne(s, l)) {
|
|
418
418
|
e.entities.selectedSet.delete(r);
|
|
419
419
|
return;
|
|
420
420
|
}
|
|
421
|
-
let c =
|
|
422
|
-
c || (c = r.getBoundingClientRect(),
|
|
423
|
-
const u = e.entities.selectionBase.has(r), g =
|
|
421
|
+
let c = a.get(r);
|
|
422
|
+
c || (c = r.getBoundingClientRect(), a.set(r, c));
|
|
423
|
+
const u = e.entities.selectionBase.has(r), g = gt(n, c);
|
|
424
424
|
switch (e.entities.selectableAreaMap.get(t)?.strategy) {
|
|
425
425
|
case "toggle":
|
|
426
426
|
e.entities.selectedSet[g !== u ? "add" : "delete"](
|
|
@@ -432,22 +432,22 @@ const Mt = (e, t, n) => {
|
|
|
432
432
|
break;
|
|
433
433
|
}
|
|
434
434
|
});
|
|
435
|
-
},
|
|
436
|
-
const n = Math.min(e.x, t.x), s = Math.min(e.y, t.y),
|
|
437
|
-
return new DOMRect(n, s,
|
|
435
|
+
}, Et = (e, t) => {
|
|
436
|
+
const n = Math.min(e.x, t.x), s = Math.min(e.y, t.y), a = Math.max(e.x, t.x), r = Math.max(e.y, t.y), i = a - n, o = r - s;
|
|
437
|
+
return new DOMRect(n, s, i, o);
|
|
438
438
|
};
|
|
439
|
-
function
|
|
439
|
+
function I(e, t, n) {
|
|
440
440
|
const s = Math.max(0, Math.min(t, e.length));
|
|
441
441
|
return [...e.slice(0, s), ...n, ...e.slice(s)];
|
|
442
442
|
}
|
|
443
443
|
function Le(e, t, n = 1) {
|
|
444
|
-
const s = Math.max(0, Math.min(t, e.length - 1)),
|
|
445
|
-
return [...e.slice(0, s), ...e.slice(s +
|
|
444
|
+
const s = Math.max(0, Math.min(t, e.length - 1)), a = Math.max(0, Math.min(n, e.length - s));
|
|
445
|
+
return [...e.slice(0, s), ...e.slice(s + a)];
|
|
446
446
|
}
|
|
447
447
|
function N(e, t) {
|
|
448
|
-
const n = [...new Set(t)].filter((
|
|
448
|
+
const n = [...new Set(t)].filter((a) => a >= 0 && a < e.length).sort((a, r) => r - a);
|
|
449
449
|
let s = e;
|
|
450
|
-
for (const
|
|
450
|
+
for (const a of n) s = Le(s, a, 1);
|
|
451
451
|
return s;
|
|
452
452
|
}
|
|
453
453
|
function Ye(e, t, n) {
|
|
@@ -467,15 +467,15 @@ const R = {
|
|
|
467
467
|
return R.getInsertSide(e, t) === "after" && !e?.center;
|
|
468
468
|
}
|
|
469
469
|
};
|
|
470
|
-
function
|
|
471
|
-
const { draggedItems: n, dropZone: s, hoveredDraggable:
|
|
470
|
+
function Ve(e, t) {
|
|
471
|
+
const { draggedItems: n, dropZone: s, hoveredDraggable: a } = e;
|
|
472
472
|
if (!n.length) return null;
|
|
473
|
-
const r =
|
|
474
|
-
if (!
|
|
475
|
-
const o = n[0].items, l = n.map((f) => f.index), c =
|
|
473
|
+
const r = a?.placement.center === !0 && s != null && s.items !== a.items, i = r ? s.items : a?.items ?? s?.items;
|
|
474
|
+
if (!i) return null;
|
|
475
|
+
const o = n[0].items, l = n.map((f) => f.index), c = i.length;
|
|
476
476
|
let u, g;
|
|
477
|
-
if (
|
|
478
|
-
const f =
|
|
477
|
+
if (a && !r) {
|
|
478
|
+
const f = a.items === o && l.includes(a.index);
|
|
479
479
|
if (f && n.length === 1) {
|
|
480
480
|
const d = R.isAtZoneStart(s?.placement, t);
|
|
481
481
|
u = d ? 0 : c, g = d ? "prepend" : "append";
|
|
@@ -483,7 +483,7 @@ function Xe(e, t) {
|
|
|
483
483
|
if (f)
|
|
484
484
|
return null;
|
|
485
485
|
{
|
|
486
|
-
const d = R.getInsertSide(
|
|
486
|
+
const d = R.getInsertSide(a.placement, t), h = a.index;
|
|
487
487
|
d === "before" ? (u = Math.max(0, h), g = "insert") : d === "after" ? (u = Math.min(c, h + 1), g = "insert") : (u = c, g = "append");
|
|
488
488
|
}
|
|
489
489
|
}
|
|
@@ -492,75 +492,75 @@ function Xe(e, t) {
|
|
|
492
492
|
const f = R.isAtZoneStart(s.placement, t);
|
|
493
493
|
u = f ? 0 : c, g = f ? "prepend" : "append";
|
|
494
494
|
}
|
|
495
|
-
return { targetIndex: u, mode: g, targetArr:
|
|
495
|
+
return { targetIndex: u, mode: g, targetArr: i };
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Lt(e, t = "vertical") {
|
|
498
498
|
const { draggedItems: n } = e;
|
|
499
499
|
if (!n.length) return null;
|
|
500
|
-
const s =
|
|
500
|
+
const s = Ve(e, t);
|
|
501
501
|
if (!s) return null;
|
|
502
|
-
const { targetArr:
|
|
503
|
-
let { targetIndex:
|
|
502
|
+
const { targetArr: a, mode: r } = s;
|
|
503
|
+
let { targetIndex: i } = s;
|
|
504
504
|
const o = n.map((g) => g.index), l = n.map((g) => g.item), c = n[0].items;
|
|
505
|
-
if (c ===
|
|
506
|
-
const g = o.filter((d) => d <
|
|
507
|
-
|
|
508
|
-
const f =
|
|
509
|
-
return { sourceItems: f, targetItems: f, draggedItems: l, sourceIndexes: o, targetIndex:
|
|
505
|
+
if (c === a) {
|
|
506
|
+
const g = o.filter((d) => d < i).length;
|
|
507
|
+
i = Math.max(0, i - g);
|
|
508
|
+
const f = I(N(c, o), i, l);
|
|
509
|
+
return { sourceItems: f, targetItems: f, draggedItems: l, sourceIndexes: o, targetIndex: i, mode: r, sameList: !0 };
|
|
510
510
|
} else {
|
|
511
|
-
const g = N(c, o), f =
|
|
512
|
-
return { sourceItems: g, targetItems: f, draggedItems: l, sourceIndexes: o, targetIndex:
|
|
511
|
+
const g = N(c, o), f = I(a, i, l);
|
|
512
|
+
return { sourceItems: g, targetItems: f, draggedItems: l, sourceIndexes: o, targetIndex: i, mode: r, sameList: !1 };
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function It(e) {
|
|
516
516
|
const { draggedItems: t, hoveredDraggable: n } = e;
|
|
517
517
|
if (!t.length || !n) return null;
|
|
518
|
-
const s = t.map((u) => u.index),
|
|
519
|
-
if (c && s.includes(
|
|
518
|
+
const s = t.map((u) => u.index), a = n.index, r = t.map((u) => u.item), i = n.item, o = t[0].items, l = n.items, c = o === l;
|
|
519
|
+
if (c && s.includes(a)) return null;
|
|
520
520
|
if (t.length === 1) {
|
|
521
521
|
const u = s[0];
|
|
522
522
|
if (c) {
|
|
523
|
-
const g = Ye(o, u,
|
|
524
|
-
return { sourceItems: g, targetItems: g, sourceIndexes: s, targetIndex:
|
|
523
|
+
const g = Ye(o, u, a);
|
|
524
|
+
return { sourceItems: g, targetItems: g, sourceIndexes: s, targetIndex: a, sameList: !0 };
|
|
525
525
|
} else {
|
|
526
526
|
const g = [...o], f = [...l];
|
|
527
|
-
return g[u] = l[
|
|
527
|
+
return g[u] = l[a], f[a] = o[u], { sourceItems: g, targetItems: f, sourceIndexes: s, targetIndex: a, sameList: !1 };
|
|
528
528
|
}
|
|
529
529
|
} else {
|
|
530
530
|
const u = Math.min(...s);
|
|
531
531
|
if (c) {
|
|
532
|
-
const g = s.filter((p) => p <
|
|
532
|
+
const g = s.filter((p) => p < a).length, f = Math.max(0, a - g), d = s.filter((p) => p < u).length, h = Math.max(0, u - d);
|
|
533
533
|
let m = N(o, s);
|
|
534
|
-
m =
|
|
534
|
+
m = I(m, f, r);
|
|
535
535
|
const y = h >= f ? h + r.length : h;
|
|
536
|
-
return m =
|
|
536
|
+
return m = I(m, y, [i]), { sourceItems: m, targetItems: m, sourceIndexes: s, targetIndex: f, sameList: !0 };
|
|
537
537
|
} else {
|
|
538
538
|
const g = s.filter((m) => m < u).length, f = Math.max(0, u - g);
|
|
539
539
|
let d = N(o, s);
|
|
540
|
-
d =
|
|
541
|
-
let h = Le(l,
|
|
542
|
-
return h =
|
|
540
|
+
d = I(d, f, [i]);
|
|
541
|
+
let h = Le(l, a);
|
|
542
|
+
return h = I(h, a, r), { sourceItems: d, targetItems: h, sourceIndexes: s, targetIndex: a, sameList: !1 };
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Ct(e, t = "vertical") {
|
|
547
547
|
const { draggedItems: n } = e;
|
|
548
548
|
if (!n.length) return null;
|
|
549
|
-
const s =
|
|
549
|
+
const s = Ve(e, t);
|
|
550
550
|
if (!s) return null;
|
|
551
|
-
const { targetArr:
|
|
552
|
-
return { targetItems:
|
|
551
|
+
const { targetArr: a, targetIndex: r, mode: i } = s, o = n.map((c) => c.item);
|
|
552
|
+
return { targetItems: I(a, r, o), copiedItems: o, targetIndex: r, mode: i };
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Rt(e) {
|
|
555
555
|
const { draggedItems: t } = e;
|
|
556
556
|
if (!t.length) return null;
|
|
557
|
-
const n = t.map((
|
|
558
|
-
return { sourceItems: N(
|
|
557
|
+
const n = t.map((i) => i.index), s = t.map((i) => i.item), a = t[0].items;
|
|
558
|
+
return { sourceItems: N(a, n), removedItems: s, sourceIndexes: n };
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Xe(e) {
|
|
561
561
|
return {
|
|
562
562
|
// Low-level array ops
|
|
563
|
-
insertAt:
|
|
563
|
+
insertAt: I,
|
|
564
564
|
removeAt: Le,
|
|
565
565
|
removeIndexes: N,
|
|
566
566
|
swapAt: Ye,
|
|
@@ -569,33 +569,33 @@ function Ve(e) {
|
|
|
569
569
|
isAtZoneStart: (t, n) => R.isAtZoneStart(t, n),
|
|
570
570
|
isAtZoneEnd: (t, n) => R.isAtZoneEnd(t, n),
|
|
571
571
|
// High-level (event-bound)
|
|
572
|
-
suggestSort: (t) =>
|
|
573
|
-
suggestSwap: () =>
|
|
574
|
-
suggestCopy: (t) =>
|
|
575
|
-
suggestRemove: () =>
|
|
572
|
+
suggestSort: (t) => Lt(e, t),
|
|
573
|
+
suggestSwap: () => It(e),
|
|
574
|
+
suggestCopy: (t) => Ct(e, t),
|
|
575
|
+
suggestRemove: () => Rt(e)
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
|
-
const O = (e) => e.keys().next().value,
|
|
578
|
+
const O = (e) => e.keys().next().value, kt = (e) => e.target.closest(
|
|
579
579
|
G.DRAGGABLE
|
|
580
580
|
);
|
|
581
581
|
function Ze(e, t) {
|
|
582
582
|
const n = t.entities.draggingMap.get(e);
|
|
583
583
|
if (n) return n;
|
|
584
|
-
const s = e.getAttribute(
|
|
584
|
+
const s = e.getAttribute(C.DRAGGABLE);
|
|
585
585
|
if (s) {
|
|
586
|
-
for (const [,
|
|
587
|
-
if (
|
|
586
|
+
for (const [, a] of t.entities.draggingMap)
|
|
587
|
+
if (a.id === s) return a;
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function Tt(e) {
|
|
591
591
|
const t = e.entities.initiatingDraggable;
|
|
592
592
|
if (!t) return [];
|
|
593
593
|
const n = Ze(t, e) ?? e.entities.draggableMap.get(t), s = n?.payload;
|
|
594
594
|
if (!s)
|
|
595
595
|
return n?.data ? [{ index: -1, item: void 0, items: [], data: n.data() }] : [];
|
|
596
|
-
const
|
|
597
|
-
if (!Array.isArray(
|
|
598
|
-
const [r,
|
|
596
|
+
const a = s();
|
|
597
|
+
if (!Array.isArray(a) || a.length < 2) return [];
|
|
598
|
+
const [r, i] = a, o = Number(r), l = i, c = /* @__PURE__ */ new Map();
|
|
599
599
|
return c.set(o, {
|
|
600
600
|
index: o,
|
|
601
601
|
item: l[o],
|
|
@@ -618,8 +618,8 @@ function It(e) {
|
|
|
618
618
|
}), [...c.values()].sort((u, g) => u.index - g.index);
|
|
619
619
|
}
|
|
620
620
|
const A = (e, t) => {
|
|
621
|
-
const n =
|
|
622
|
-
let s,
|
|
621
|
+
const n = Tt(e);
|
|
622
|
+
let s, a;
|
|
623
623
|
if (t) {
|
|
624
624
|
const r = e.entities.droppableMap.get(t);
|
|
625
625
|
if (r) {
|
|
@@ -630,15 +630,15 @@ const A = (e, t) => {
|
|
|
630
630
|
data: r.data?.()
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
635
|
-
const l = e.entities.draggableMap.get(
|
|
633
|
+
const i = O(e.hovered.draggable);
|
|
634
|
+
if (i && (i === t || t.contains(i)) && i) {
|
|
635
|
+
const l = e.entities.draggableMap.get(i), c = l?.payload, u = e.hovered.draggable.get(i), g = { top: !1, right: !1, bottom: !1, left: !1, center: !1 };
|
|
636
636
|
if (c) {
|
|
637
637
|
const f = c();
|
|
638
638
|
if (Array.isArray(f) && f.length >= 2) {
|
|
639
639
|
const [d, h] = f, m = Number(d);
|
|
640
|
-
|
|
641
|
-
element:
|
|
640
|
+
a = {
|
|
641
|
+
element: i,
|
|
642
642
|
placement: u ?? g,
|
|
643
643
|
index: m,
|
|
644
644
|
item: h[m],
|
|
@@ -646,8 +646,8 @@ const A = (e, t) => {
|
|
|
646
646
|
data: l?.data?.()
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
|
-
} else l?.data && (
|
|
650
|
-
element:
|
|
649
|
+
} else l?.data && (a = {
|
|
650
|
+
element: i,
|
|
651
651
|
placement: u ?? g,
|
|
652
652
|
index: -1,
|
|
653
653
|
item: void 0,
|
|
@@ -659,9 +659,9 @@ const A = (e, t) => {
|
|
|
659
659
|
return {
|
|
660
660
|
draggedItems: n,
|
|
661
661
|
dropZone: s,
|
|
662
|
-
hoveredDraggable:
|
|
662
|
+
hoveredDraggable: a,
|
|
663
663
|
provider: e,
|
|
664
|
-
helpers:
|
|
664
|
+
helpers: Xe({ draggedItems: n, dropZone: s, hoveredDraggable: a })
|
|
665
665
|
};
|
|
666
666
|
}, F = (e, t, n) => {
|
|
667
667
|
if (!t) return;
|
|
@@ -672,7 +672,7 @@ const A = (e, t) => {
|
|
|
672
672
|
e.entities.draggingMap.forEach((s) => {
|
|
673
673
|
s.disabled || s.events?.[t]?.(n);
|
|
674
674
|
});
|
|
675
|
-
},
|
|
675
|
+
}, Pt = (e, t, n) => {
|
|
676
676
|
if (t !== n) {
|
|
677
677
|
if (t && !K(t, e)) {
|
|
678
678
|
const s = A(e, t);
|
|
@@ -683,28 +683,28 @@ const A = (e, t) => {
|
|
|
683
683
|
e.entities.droppableMap.get(n)?.events?.onEnter?.(s);
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
},
|
|
686
|
+
}, Bt = (e, t, n) => {
|
|
687
687
|
if (t !== n) {
|
|
688
688
|
const s = A(e);
|
|
689
689
|
if (t) {
|
|
690
|
-
const
|
|
691
|
-
|
|
690
|
+
const a = e.entities.draggableMap.get(t);
|
|
691
|
+
a && !a.disabled && a.events?.onLeave?.(s);
|
|
692
692
|
}
|
|
693
693
|
if (n) {
|
|
694
|
-
const
|
|
695
|
-
|
|
694
|
+
const a = e.entities.draggableMap.get(n);
|
|
695
|
+
a && !a.disabled && a.events?.onHover?.(s);
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
},
|
|
699
|
-
const s =
|
|
698
|
+
}, re = (e, t, n) => {
|
|
699
|
+
const s = kt(t);
|
|
700
700
|
!s || !e.entities.draggingMap.has(s) || e.entities.draggingMap.get(s)?.events?.[n]?.(A(e));
|
|
701
|
-
},
|
|
701
|
+
}, Ot = (e, t) => {
|
|
702
702
|
const n = O(t.droppable);
|
|
703
703
|
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e, n));
|
|
704
|
-
},
|
|
704
|
+
}, De = (e, t) => {
|
|
705
705
|
const n = O(t.droppable);
|
|
706
706
|
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e, n));
|
|
707
|
-
},
|
|
707
|
+
}, Ft = (e, t, n = 5) => {
|
|
708
708
|
const s = n / 2;
|
|
709
709
|
return {
|
|
710
710
|
left: e - s,
|
|
@@ -712,14 +712,14 @@ const A = (e, t) => {
|
|
|
712
712
|
width: n,
|
|
713
713
|
height: n
|
|
714
714
|
};
|
|
715
|
-
},
|
|
715
|
+
}, zt = (e) => {
|
|
716
716
|
const t = e.pointer.value?.current, n = t?.x ?? 0, s = t?.y ?? 0;
|
|
717
|
-
return
|
|
717
|
+
return Ft(n, s, 5);
|
|
718
718
|
}, B = (e, t, n) => {
|
|
719
|
-
const s = e.left + e.width / 2,
|
|
719
|
+
const s = e.left + e.width / 2, a = e.top + e.height / 2;
|
|
720
720
|
if (n) {
|
|
721
721
|
const o = n.top ?? 0, l = n.right ?? 0, c = n.bottom ?? 0, u = n.left ?? 0, g = t.left + u, f = t.right - l, d = t.top + o, h = t.bottom - c;
|
|
722
|
-
if (g < f && d < h && s >= g && s <= f &&
|
|
722
|
+
if (g < f && d < h && s >= g && s <= f && a >= d && a <= h)
|
|
723
723
|
return {
|
|
724
724
|
top: !1,
|
|
725
725
|
right: !1,
|
|
@@ -728,36 +728,36 @@ const A = (e, t) => {
|
|
|
728
728
|
center: !0
|
|
729
729
|
};
|
|
730
730
|
}
|
|
731
|
-
const r = t.left + t.width / 2,
|
|
731
|
+
const r = t.left + t.width / 2, i = t.top + t.height / 2;
|
|
732
732
|
return {
|
|
733
|
-
top:
|
|
734
|
-
bottom:
|
|
733
|
+
top: a <= i,
|
|
734
|
+
bottom: a > i,
|
|
735
735
|
left: s <= r,
|
|
736
736
|
right: s > r,
|
|
737
737
|
center: !1
|
|
738
738
|
};
|
|
739
|
-
},
|
|
739
|
+
}, _t = (e) => ({
|
|
740
740
|
x: e.left + e.width / 2,
|
|
741
741
|
y: e.top + e.height / 2
|
|
742
742
|
}), Re = (e, t) => {
|
|
743
|
-
const n =
|
|
743
|
+
const n = _t(t);
|
|
744
744
|
return Math.hypot(e.x - n.x, e.y - n.y);
|
|
745
745
|
};
|
|
746
|
-
function
|
|
746
|
+
function Gt(e, t) {
|
|
747
747
|
return e === t ? !0 : !e || !t ? !1 : e.top === t.top && e.right === t.right && e.bottom === t.bottom && e.left === t.left && e.center === t.center;
|
|
748
748
|
}
|
|
749
749
|
function U(e, t) {
|
|
750
|
-
|
|
750
|
+
Gt(e.hoveredPlacement, t) || (e.hoveredPlacement = t);
|
|
751
751
|
}
|
|
752
|
-
const
|
|
753
|
-
const s = O(t.droppable),
|
|
754
|
-
|
|
755
|
-
const r =
|
|
756
|
-
if (
|
|
757
|
-
const g =
|
|
752
|
+
const Ht = (e, t) => e.find((n) => n !== t && H(t, n)), we = (e, t, n) => {
|
|
753
|
+
const s = O(t.droppable), a = O(t.draggable);
|
|
754
|
+
a && t.draggable.delete(a), s && t.droppable.delete(s);
|
|
755
|
+
const r = zt(e), i = n.zones[0], o = n.elements[0];
|
|
756
|
+
if (i && o && i === o && e.entities.droppableMap.has(i) && i) {
|
|
757
|
+
const g = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins, d = B(r, g, f);
|
|
758
758
|
if (d.center) {
|
|
759
|
-
t.droppable.set(
|
|
760
|
-
const h =
|
|
759
|
+
t.droppable.set(i, d);
|
|
760
|
+
const h = Ht(n.elements, i);
|
|
761
761
|
if (h) {
|
|
762
762
|
const m = h.getBoundingClientRect();
|
|
763
763
|
t.draggable.set(
|
|
@@ -767,7 +767,7 @@ const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
767
767
|
}
|
|
768
768
|
} else {
|
|
769
769
|
t.draggable.set(o, d);
|
|
770
|
-
const h = n.zones.find((m) => m !==
|
|
770
|
+
const h = n.zones.find((m) => m !== i);
|
|
771
771
|
if (h) {
|
|
772
772
|
const m = h.getBoundingClientRect();
|
|
773
773
|
t.droppable.set(
|
|
@@ -777,20 +777,20 @@ const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
} else {
|
|
780
|
-
if (
|
|
781
|
-
const g =
|
|
782
|
-
t.droppable.set(
|
|
780
|
+
if (i) {
|
|
781
|
+
const g = i.getBoundingClientRect();
|
|
782
|
+
t.droppable.set(i, B(r, g));
|
|
783
783
|
}
|
|
784
784
|
if (o)
|
|
785
|
-
if (
|
|
786
|
-
if (H(
|
|
785
|
+
if (i)
|
|
786
|
+
if (H(i, o)) {
|
|
787
787
|
const g = o.getBoundingClientRect(), f = e.entities.draggableMap.get(o)?.placementMargins;
|
|
788
788
|
t.draggable.set(
|
|
789
789
|
o,
|
|
790
790
|
B(r, g, f)
|
|
791
791
|
);
|
|
792
792
|
} else {
|
|
793
|
-
const g = e.pointer.value?.current ?? { x: 0, y: 0 }, f =
|
|
793
|
+
const g = e.pointer.value?.current ?? { x: 0, y: 0 }, f = i.getBoundingClientRect(), d = o.getBoundingClientRect(), h = Re(g, f);
|
|
794
794
|
if (Re(g, d) < h) {
|
|
795
795
|
t.droppable.clear();
|
|
796
796
|
const y = e.entities.draggableMap.get(o)?.placementMargins;
|
|
@@ -809,8 +809,8 @@ const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
const c = O(t.droppable), u = O(t.draggable);
|
|
812
|
-
if (
|
|
813
|
-
const g = e.entities.draggableMap.get(
|
|
812
|
+
if (a && a !== u) {
|
|
813
|
+
const g = e.entities.draggableMap.get(a);
|
|
814
814
|
g && U(g, void 0);
|
|
815
815
|
}
|
|
816
816
|
if (s && s !== c) {
|
|
@@ -825,8 +825,8 @@ const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
825
825
|
const g = e.entities.droppableMap.get(c);
|
|
826
826
|
g && U(g, t.droppable.get(c));
|
|
827
827
|
}
|
|
828
|
-
|
|
829
|
-
},
|
|
828
|
+
Pt(e, s, c), Bt(e, a, u);
|
|
829
|
+
}, le = (e, t) => e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y, ce = (e) => {
|
|
830
830
|
if (!e)
|
|
831
831
|
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
832
832
|
const t = e.getBoundingClientRect();
|
|
@@ -840,41 +840,41 @@ const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
840
840
|
right: t.right,
|
|
841
841
|
bottom: t.bottom
|
|
842
842
|
};
|
|
843
|
-
},
|
|
843
|
+
}, ge = (e, t) => {
|
|
844
844
|
const n = Math.max(
|
|
845
845
|
0,
|
|
846
846
|
Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
|
|
847
847
|
), s = Math.max(
|
|
848
848
|
0,
|
|
849
849
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
850
|
-
),
|
|
851
|
-
return r === 0 ||
|
|
852
|
-
},
|
|
853
|
-
const t = e.preview.position?.value ?? { x: 0, y: 0 }, { x: n, y: s } = t,
|
|
854
|
-
let r,
|
|
855
|
-
if (
|
|
856
|
-
r =
|
|
850
|
+
), a = n * s, r = e.width * e.height, i = t.width * t.height;
|
|
851
|
+
return r === 0 || i === 0 ? 0 : (a / r * 100 + a / i * 100) / 2;
|
|
852
|
+
}, Kt = (e) => e.preview.ref?.value ?? null, ke = (e) => {
|
|
853
|
+
const t = e.preview.position?.value ?? { x: 0, y: 0 }, { x: n, y: s } = t, a = e.preview.size?.value;
|
|
854
|
+
let r, i;
|
|
855
|
+
if (a)
|
|
856
|
+
r = a.width, i = a.height;
|
|
857
857
|
else {
|
|
858
858
|
const o = e.preview.ref?.value?.getBoundingClientRect();
|
|
859
|
-
r = o?.width ?? 0,
|
|
859
|
+
r = o?.width ?? 0, i = o?.height ?? 0;
|
|
860
860
|
}
|
|
861
861
|
return {
|
|
862
862
|
x: n,
|
|
863
863
|
y: s,
|
|
864
864
|
width: r,
|
|
865
|
-
height:
|
|
865
|
+
height: i,
|
|
866
866
|
top: s,
|
|
867
867
|
left: n,
|
|
868
868
|
right: n + r,
|
|
869
|
-
bottom: s +
|
|
869
|
+
bottom: s + i
|
|
870
870
|
};
|
|
871
|
-
},
|
|
871
|
+
}, Se = (e) => e.entities.allowedDraggableSet, $e = (e) => e.entities.allowedDroppableSet, Ue = (e, t) => !t.entities.draggingMap.has(e), qe = (e, t) => ![...t.entities.draggingMap.keys()].some((n) => {
|
|
872
872
|
if (H(n, e)) return !0;
|
|
873
873
|
const s = n.parentElement;
|
|
874
874
|
return !!(s && e !== n && !t.entities.draggableMap.has(s) && !t.entities.droppableMap.has(s) && H(s, e) && [
|
|
875
875
|
...t.entities.draggableMap.keys()
|
|
876
876
|
].filter((r) => r.parentElement === s).length === 1);
|
|
877
|
-
}),
|
|
877
|
+
}), Nt = (e, t) => !Ee(e, t), Yt = (e, t) => !K(e, t), Me = (e, t) => Ue(e, t) && qe(e, t) && Nt(e, t), je = (e, t) => Ue(e, t) && qe(e, t) && Yt(e, t), ue = 10;
|
|
878
878
|
function _(e, t) {
|
|
879
879
|
return Math.hypot(
|
|
880
880
|
t.x - (e.x + e.width / 2),
|
|
@@ -885,45 +885,45 @@ function Te(e, t) {
|
|
|
885
885
|
const n = Math.max(e.x, Math.min(t.x, e.x + e.width)), s = Math.max(e.y, Math.min(t.y, e.y + e.height));
|
|
886
886
|
return Math.hypot(t.x - n, t.y - s);
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function Vt(e) {
|
|
889
889
|
const t = e.pointer.value?.current ?? { x: 0, y: 0 }, n = document.elementFromPoint(t.x, t.y);
|
|
890
890
|
if (!n) return null;
|
|
891
|
-
const s =
|
|
891
|
+
const s = Se(e), a = $e(e), r = [], i = [];
|
|
892
892
|
let o = n;
|
|
893
893
|
for (; o; )
|
|
894
|
-
|
|
895
|
-
return r.length === 0 &&
|
|
894
|
+
s.has(o) && Me(o, e) && r.push(o), a.has(o) && je(o, e) && i.push(o), o = o.parentElement;
|
|
895
|
+
return r.length === 0 && i.length === 0 ? null : { elements: r, zones: i };
|
|
896
896
|
}
|
|
897
897
|
const ve = (e) => {
|
|
898
|
-
if (!
|
|
899
|
-
const n = e.pointer.value?.current ?? { x: 0, y: 0 }, s =
|
|
898
|
+
if (!Kt(e)) return { elements: [], zones: [] };
|
|
899
|
+
const n = e.pointer.value?.current ?? { x: 0, y: 0 }, s = Vt(e);
|
|
900
900
|
if (s) {
|
|
901
901
|
if (s.elements.length > 0) return s;
|
|
902
902
|
const c = s.zones[0];
|
|
903
903
|
if (!c) return s;
|
|
904
|
-
const u = ke(e), f = [...
|
|
905
|
-
(m) => c.contains(m) &&
|
|
906
|
-
).map((m) => ({ el: m, box:
|
|
907
|
-
({ box: m }) =>
|
|
904
|
+
const u = ke(e), f = [...Se(e)].filter(
|
|
905
|
+
(m) => c.contains(m) && Me(m, e)
|
|
906
|
+
).map((m) => ({ el: m, box: ce(m) })), d = f.filter(
|
|
907
|
+
({ box: m }) => le(m, u) && ge(m, u) >= ue
|
|
908
908
|
).sort((m, y) => _(m.box, n) - _(y.box, n)).map(({ el: m }) => m);
|
|
909
909
|
return d.length > 0 ? { elements: d, zones: s.zones } : { elements: f.sort((m, y) => Te(m.box, n) - Te(y.box, n)).map(({ el: m }) => m), zones: s.zones };
|
|
910
910
|
}
|
|
911
|
-
const
|
|
912
|
-
(c) =>
|
|
913
|
-
),
|
|
914
|
-
(c) =>
|
|
915
|
-
), o = r.map((c) => ({ n: c, box:
|
|
916
|
-
({ box: c }) =>
|
|
917
|
-
).sort((c, u) => _(c.box, n) - _(u.box, n)).map(({ n: c }) => c), l =
|
|
918
|
-
({ box: c }) =>
|
|
911
|
+
const a = ke(e), r = [...Se(e)].filter(
|
|
912
|
+
(c) => Me(c, e)
|
|
913
|
+
), i = [...$e(e)].filter(
|
|
914
|
+
(c) => je(c, e)
|
|
915
|
+
), o = r.map((c) => ({ n: c, box: ce(c) })).filter(
|
|
916
|
+
({ box: c }) => le(c, a) && ge(c, a) >= ue
|
|
917
|
+
).sort((c, u) => _(c.box, n) - _(u.box, n)).map(({ n: c }) => c), l = i.map((c) => ({ n: c, box: ce(c) })).filter(
|
|
918
|
+
({ box: c }) => le(c, a) && ge(c, a) >= ue
|
|
919
919
|
).sort((c, u) => _(c.box, n) - _(u.box, n)).map(({ n: c }) => c);
|
|
920
920
|
return { elements: o, zones: l };
|
|
921
921
|
};
|
|
922
922
|
function Ae(e) {
|
|
923
923
|
const t = ve(e);
|
|
924
|
-
|
|
924
|
+
we(e, e.hovered, t);
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function Xt(e, t) {
|
|
927
927
|
const n = e.collision?.throttle?.value ?? 0;
|
|
928
928
|
if (n <= 0) {
|
|
929
929
|
Ae(e);
|
|
@@ -932,17 +932,17 @@ function Yt(e, t) {
|
|
|
932
932
|
const s = Date.now();
|
|
933
933
|
s - t.value >= n && (t.value = s, Ae(e));
|
|
934
934
|
}
|
|
935
|
-
async function
|
|
935
|
+
async function We(e) {
|
|
936
936
|
const t = e.hovered.droppable.keys().next().value;
|
|
937
937
|
if (!t || K(t, e)) return "accept";
|
|
938
938
|
const n = e.entities.droppableMap.get(t), s = A(e, t);
|
|
939
|
-
let
|
|
939
|
+
let a = s;
|
|
940
940
|
if (n?.groupMatch === "some" && (n.groups?.length ?? 0) > 0) {
|
|
941
941
|
const o = n.groups, l = s.draggedItems.filter((u) => {
|
|
942
942
|
for (const [, g] of e.entities.draggingMap) {
|
|
943
943
|
const f = g.payload?.();
|
|
944
944
|
if (!(!Array.isArray(f) || f.length < 2) && Number(f[0]) === u.index && f[1] === u.items)
|
|
945
|
-
return
|
|
945
|
+
return ne(g.groups ?? [], o);
|
|
946
946
|
}
|
|
947
947
|
return !0;
|
|
948
948
|
}), c = s.draggedItems.filter(
|
|
@@ -952,7 +952,7 @@ async function Ue(e) {
|
|
|
952
952
|
const u = (g) => ({
|
|
953
953
|
...s,
|
|
954
954
|
draggedItems: g,
|
|
955
|
-
helpers:
|
|
955
|
+
helpers: Xe({ ...s, draggedItems: g })
|
|
956
956
|
});
|
|
957
957
|
if (n.events?.onValidate) {
|
|
958
958
|
const g = n.events.onValidate({
|
|
@@ -968,7 +968,7 @@ async function Ue(e) {
|
|
|
968
968
|
d = await g;
|
|
969
969
|
} catch {
|
|
970
970
|
const m = e.entities.initiatingDraggable;
|
|
971
|
-
return F(e, m, "onSelfDragCancel"), v(e, "onDragCancel"),
|
|
971
|
+
return F(e, m, "onSelfDragCancel"), v(e, "onDragCancel"), De(e, e.hovered), "cancel";
|
|
972
972
|
}
|
|
973
973
|
} else
|
|
974
974
|
d = g;
|
|
@@ -976,14 +976,14 @@ async function Ue(e) {
|
|
|
976
976
|
return e.state.value = "dragging", "decline";
|
|
977
977
|
const h = Array.isArray(d) ? d : l;
|
|
978
978
|
if (h.length === 0) return "accept";
|
|
979
|
-
|
|
979
|
+
a = u(h);
|
|
980
980
|
} else {
|
|
981
981
|
if (l.length === 0) return "accept";
|
|
982
|
-
|
|
982
|
+
a = u(l);
|
|
983
983
|
}
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
const r = n?.events?.onDrop?.(
|
|
986
|
+
const r = n?.events?.onDrop?.(a);
|
|
987
987
|
if (r != null && typeof r.then == "function") {
|
|
988
988
|
e.state.value = "pending";
|
|
989
989
|
let o;
|
|
@@ -991,45 +991,45 @@ async function Ue(e) {
|
|
|
991
991
|
o = await r;
|
|
992
992
|
} catch {
|
|
993
993
|
const l = e.entities.initiatingDraggable;
|
|
994
|
-
return F(e, l, "onSelfDragCancel"), v(e, "onDragCancel"),
|
|
994
|
+
return F(e, l, "onSelfDragCancel"), v(e, "onDragCancel"), De(e, e.hovered), "cancel";
|
|
995
995
|
}
|
|
996
996
|
return o === !1 ? (e.state.value = "dragging", "decline") : "accept";
|
|
997
997
|
}
|
|
998
998
|
return r === !1 ? "decline" : "accept";
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function Je(e) {
|
|
1001
1001
|
const t = e.entities.initiatingDraggable;
|
|
1002
|
-
F(e, t, "onSelfDragEnd"), v(e, "onDragEnd"),
|
|
1002
|
+
F(e, t, "onSelfDragEnd"), v(e, "onDragEnd"), Ot(e, e.hovered);
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1004
|
+
function Zt(e) {
|
|
1005
1005
|
const t = e.entities.selectingArea;
|
|
1006
1006
|
if (!t) return;
|
|
1007
1007
|
const n = e.entities.selectableAreaMap.get(t), s = [...e.entities.selectedSet];
|
|
1008
1008
|
n?.events?.onSelected?.(s);
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1010
|
+
const $t = (e) => {
|
|
1011
1011
|
const t = {
|
|
1012
1012
|
current: null
|
|
1013
1013
|
}, n = { value: 0 }, s = async () => {
|
|
1014
|
-
|
|
1014
|
+
pe(), t.current?.cancel(), t.current = null;
|
|
1015
1015
|
const o = e.state.value;
|
|
1016
1016
|
if (o === "dragging") {
|
|
1017
|
-
const l = await
|
|
1018
|
-
if (l === "accept" &&
|
|
1019
|
-
|
|
1017
|
+
const l = await We(e);
|
|
1018
|
+
if (l === "accept" && Je(e), l === "accept" || l === "cancel") {
|
|
1019
|
+
ee(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", a);
|
|
1020
1020
|
return;
|
|
1021
1021
|
}
|
|
1022
1022
|
return;
|
|
1023
|
-
} else o === "selecting" &&
|
|
1024
|
-
|
|
1025
|
-
},
|
|
1023
|
+
} else o === "selecting" && Zt(e);
|
|
1024
|
+
ee(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", a);
|
|
1025
|
+
}, a = (o) => {
|
|
1026
1026
|
if (e.pointer.value && e.state.value !== "pending") {
|
|
1027
|
-
if (e.pointer.value.current = { x: o.clientX, y: o.clientY },
|
|
1028
|
-
|
|
1027
|
+
if (e.pointer.value.current = { x: o.clientX, y: o.clientY }, pt(e)) {
|
|
1028
|
+
re(e, o, "onSelfDragStart"), v(e, "onDragStart");
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
1031
|
if (e.state.value === "dragging") {
|
|
1032
|
-
|
|
1032
|
+
Xt(e, n);
|
|
1033
1033
|
const l = e.entities.initiatingDraggable;
|
|
1034
1034
|
F(e, l, "onSelfDragMove"), v(e, "onDragMove");
|
|
1035
1035
|
}
|
|
@@ -1037,30 +1037,30 @@ const Vt = (e) => {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
};
|
|
1039
1039
|
return { pointerDown: (o) => {
|
|
1040
|
-
document.addEventListener("pointerup", s), document.addEventListener("pointermove",
|
|
1040
|
+
document.addEventListener("pointerup", s), document.addEventListener("pointermove", a);
|
|
1041
1041
|
const l = o.composedPath?.()[0] ?? o.target, c = l.closest(
|
|
1042
1042
|
G.SELECT_AREA
|
|
1043
1043
|
), u = l.closest(
|
|
1044
1044
|
G.DRAGGABLE
|
|
1045
1045
|
);
|
|
1046
1046
|
if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(c)) {
|
|
1047
|
-
|
|
1047
|
+
be(), e.pointer.value = ye(o), e.state.value = "selecting", e.entities.selectingArea = c, e.entities.selectionBase = new Set(e.entities.selectedSet);
|
|
1048
1048
|
return;
|
|
1049
1049
|
}
|
|
1050
1050
|
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(u)) {
|
|
1051
1051
|
const g = e.entities.draggableMap.get(u);
|
|
1052
1052
|
if (!He(l, u, g?.dragHandle))
|
|
1053
1053
|
return;
|
|
1054
|
-
|
|
1054
|
+
be(), e.entities.initiatingDraggable = u;
|
|
1055
1055
|
const f = _e(o, u);
|
|
1056
|
-
e.pointer.value =
|
|
1057
|
-
|
|
1058
|
-
}))) : (
|
|
1056
|
+
e.pointer.value = ye(o, f.x, f.y), g?.activation?.distance || g?.activation?.delay ? (e.state.value = "activating", g?.activation?.delay && (e.delay.startTime = Date.now(), t.current = yt(e, () => {
|
|
1057
|
+
Q(e), re(e, o, "onSelfDragStart"), v(e, "onDragStart");
|
|
1058
|
+
}))) : (Q(e), re(e, o, "onSelfDragStart"), v(e, "onDragStart"));
|
|
1059
1059
|
}
|
|
1060
|
-
}, pointerUp: s, pointerMove:
|
|
1061
|
-
t.current?.cancel(), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove",
|
|
1060
|
+
}, pointerUp: s, pointerMove: a, cleanup: () => {
|
|
1061
|
+
t.current?.cancel(), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", a), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect();
|
|
1062
1062
|
} };
|
|
1063
|
-
},
|
|
1063
|
+
}, Ut = {
|
|
1064
1064
|
ArrowUp: { dx: 0, dy: -1 },
|
|
1065
1065
|
ArrowDown: { dx: 0, dy: 1 },
|
|
1066
1066
|
ArrowLeft: { dx: -1, dy: 0 },
|
|
@@ -1069,33 +1069,33 @@ const Vt = (e) => {
|
|
|
1069
1069
|
KeyA: { dx: -1, dy: 0 },
|
|
1070
1070
|
KeyS: { dx: 0, dy: 1 },
|
|
1071
1071
|
KeyD: { dx: 1, dy: 0 }
|
|
1072
|
-
},
|
|
1072
|
+
}, qt = (e) => (t) => {
|
|
1073
1073
|
const { keys: n } = e.keyboard;
|
|
1074
1074
|
if (n.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
1075
1075
|
if (n.forCancel.includes(t.code)) {
|
|
1076
|
-
t.preventDefault(),
|
|
1076
|
+
t.preventDefault(), pe(), F(
|
|
1077
1077
|
e,
|
|
1078
1078
|
e.entities.initiatingDraggable,
|
|
1079
1079
|
"onSelfDragCancel"
|
|
1080
|
-
), v(e, "onDragCancel"),
|
|
1080
|
+
), v(e, "onDragCancel"), De(e, e.hovered), ee(e);
|
|
1081
1081
|
return;
|
|
1082
1082
|
}
|
|
1083
1083
|
if (n.forDrop.includes(t.code)) {
|
|
1084
|
-
t.preventDefault(), (async () => (await
|
|
1084
|
+
t.preventDefault(), (async () => (await We(e) && Je(e), pe(), ee(e)))();
|
|
1085
1085
|
return;
|
|
1086
1086
|
}
|
|
1087
|
-
const
|
|
1088
|
-
if (
|
|
1087
|
+
const a = Ut[t.code];
|
|
1088
|
+
if (a && n.forMove.includes(t.code) && e.pointer.value) {
|
|
1089
1089
|
t.preventDefault();
|
|
1090
1090
|
const r = n.forMoveFaster.some(
|
|
1091
1091
|
(l) => n.pressedKeys.value.has(l)
|
|
1092
|
-
),
|
|
1092
|
+
), i = e.keyboard.step * (r ? e.keyboard.moveFaster : 1);
|
|
1093
1093
|
e.pointer.value.current = {
|
|
1094
|
-
x: e.pointer.value.current.x +
|
|
1095
|
-
y: e.pointer.value.current.y +
|
|
1094
|
+
x: e.pointer.value.current.x + a.dx * i,
|
|
1095
|
+
y: e.pointer.value.current.y + a.dy * i
|
|
1096
1096
|
};
|
|
1097
1097
|
const o = ve(e);
|
|
1098
|
-
|
|
1098
|
+
we(e, e.hovered, o), F(
|
|
1099
1099
|
e,
|
|
1100
1100
|
e.entities.initiatingDraggable,
|
|
1101
1101
|
"onSelfDragMove"
|
|
@@ -1105,40 +1105,40 @@ const Vt = (e) => {
|
|
|
1105
1105
|
return;
|
|
1106
1106
|
}
|
|
1107
1107
|
if (n.forDrag.includes(t.code)) {
|
|
1108
|
-
const
|
|
1109
|
-
if (!
|
|
1110
|
-
const r =
|
|
1108
|
+
const a = document.activeElement;
|
|
1109
|
+
if (!a) return;
|
|
1110
|
+
const r = a.closest(
|
|
1111
1111
|
G.DRAGGABLE
|
|
1112
1112
|
);
|
|
1113
1113
|
if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
|
|
1114
1114
|
return;
|
|
1115
|
-
const
|
|
1116
|
-
if (!He(
|
|
1115
|
+
const i = e.entities.draggableMap.get(r);
|
|
1116
|
+
if (!He(a, r, i?.dragHandle, !0))
|
|
1117
1117
|
return;
|
|
1118
|
-
t.preventDefault(),
|
|
1118
|
+
t.preventDefault(), be();
|
|
1119
1119
|
const o = r.getBoundingClientRect(), l = o.left + o.width / 2, c = o.top + o.height / 2, u = {
|
|
1120
1120
|
clientX: l,
|
|
1121
1121
|
clientY: c
|
|
1122
1122
|
};
|
|
1123
1123
|
e.entities.initiatingDraggable = r;
|
|
1124
1124
|
const g = _e(u, r);
|
|
1125
|
-
e.pointer.value =
|
|
1125
|
+
e.pointer.value = ye(
|
|
1126
1126
|
u,
|
|
1127
1127
|
g.x,
|
|
1128
1128
|
g.y
|
|
1129
|
-
),
|
|
1129
|
+
), Q(e);
|
|
1130
1130
|
const f = ve(e);
|
|
1131
|
-
|
|
1131
|
+
we(e, e.hovered, f), F(e, r, "onSelfDragStart"), v(e, "onDragStart");
|
|
1132
1132
|
}
|
|
1133
|
-
},
|
|
1133
|
+
}, jt = (e) => (t) => {
|
|
1134
1134
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
1135
|
-
},
|
|
1135
|
+
}, Wt = (e) => () => {
|
|
1136
1136
|
e.keyboard.keys.pressedKeys.value.clear();
|
|
1137
|
-
},
|
|
1138
|
-
keyDown:
|
|
1139
|
-
keyUp:
|
|
1140
|
-
clear:
|
|
1141
|
-
},
|
|
1137
|
+
}, fe = {
|
|
1138
|
+
keyDown: qt,
|
|
1139
|
+
keyUp: jt,
|
|
1140
|
+
clear: Wt
|
|
1141
|
+
}, Jt = (e) => () => {
|
|
1142
1142
|
if (!e.state.value) return;
|
|
1143
1143
|
const t = e.scrollPosition.x, n = e.scrollPosition.y;
|
|
1144
1144
|
if (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging") {
|
|
@@ -1146,11 +1146,11 @@ const Vt = (e) => {
|
|
|
1146
1146
|
return;
|
|
1147
1147
|
}
|
|
1148
1148
|
if (e.state.value === "selecting" && e.pointer.value) {
|
|
1149
|
-
const s = window.scrollX - t,
|
|
1150
|
-
e.pointer.value.start.x -= s, e.pointer.value.start.y -=
|
|
1149
|
+
const s = window.scrollX - t, a = window.scrollY - n;
|
|
1150
|
+
e.pointer.value.start.x -= s, e.pointer.value.start.y -= a, Ne(e);
|
|
1151
1151
|
}
|
|
1152
|
-
}, E = 50,
|
|
1153
|
-
function
|
|
1152
|
+
}, E = 50, Qt = 144, Pe = 1e3 / Qt;
|
|
1153
|
+
function en(e) {
|
|
1154
1154
|
return e == null ? {
|
|
1155
1155
|
top: E,
|
|
1156
1156
|
right: E,
|
|
@@ -1168,7 +1168,7 @@ function Jt(e) {
|
|
|
1168
1168
|
left: e.left ?? E
|
|
1169
1169
|
};
|
|
1170
1170
|
}
|
|
1171
|
-
const
|
|
1171
|
+
const tn = {
|
|
1172
1172
|
getScrollState(e) {
|
|
1173
1173
|
return {
|
|
1174
1174
|
scrollTop: e.scrollTop,
|
|
@@ -1179,14 +1179,14 @@ const Qt = {
|
|
|
1179
1179
|
e.scrollTop = t, e.scrollLeft = n;
|
|
1180
1180
|
}
|
|
1181
1181
|
};
|
|
1182
|
-
function
|
|
1183
|
-
const { speed: r = 10, disabled:
|
|
1182
|
+
function Qe(e, t, n, s = tn, a) {
|
|
1183
|
+
const { speed: r = 10, disabled: i = !1 } = t, o = en(t.threshold);
|
|
1184
1184
|
let l = null, c = null, u = null, g = 0, f = 0;
|
|
1185
1185
|
const d = (p) => {
|
|
1186
|
-
|
|
1186
|
+
a && (a.value = p);
|
|
1187
1187
|
}, h = (p) => {
|
|
1188
1188
|
const x = e.value, k = n();
|
|
1189
|
-
if (!x || !k ||
|
|
1189
|
+
if (!x || !k || i) {
|
|
1190
1190
|
d(!1);
|
|
1191
1191
|
return;
|
|
1192
1192
|
}
|
|
@@ -1200,8 +1200,8 @@ function je(e, t, n, s = Qt, i) {
|
|
|
1200
1200
|
c = p;
|
|
1201
1201
|
const { scrollTop: T, scrollLeft: P } = s.getScrollState(x);
|
|
1202
1202
|
(!u || g !== T || f !== P) && (u = s.getRect ? s.getRect(x) : x.getBoundingClientRect(), g = T, f = P);
|
|
1203
|
-
let z = !1, ae = T,
|
|
1204
|
-
o.top > 0 && k.y - u.top < o.top ? (ae = T - w, z = !0) : o.bottom > 0 && u.bottom - k.y < o.bottom && (ae = T + w, z = !0), o.left > 0 && k.x - u.left < o.left ? (
|
|
1203
|
+
let z = !1, ae = T, ie = P;
|
|
1204
|
+
o.top > 0 && k.y - u.top < o.top ? (ae = T - w, z = !0) : o.bottom > 0 && u.bottom - k.y < o.bottom && (ae = T + w, z = !0), o.left > 0 && k.x - u.left < o.left ? (ie = P - w, z = !0) : o.right > 0 && u.right - k.x < o.right && (ie = P + w, z = !0), z && s.setScroll(x, ae, ie), d(z), l = requestAnimationFrame(h);
|
|
1205
1205
|
};
|
|
1206
1206
|
return { run: () => {
|
|
1207
1207
|
c = null, l = requestAnimationFrame(h);
|
|
@@ -1209,7 +1209,7 @@ function je(e, t, n, s = Qt, i) {
|
|
|
1209
1209
|
l && (cancelAnimationFrame(l), l = null), u = null, g = 0, f = 0, c = null, d(!1);
|
|
1210
1210
|
} };
|
|
1211
1211
|
}
|
|
1212
|
-
const
|
|
1212
|
+
const nn = {
|
|
1213
1213
|
getScrollState() {
|
|
1214
1214
|
return {
|
|
1215
1215
|
scrollTop: window.scrollY ?? document.documentElement.scrollTop,
|
|
@@ -1222,14 +1222,14 @@ const en = {
|
|
|
1222
1222
|
getRect() {
|
|
1223
1223
|
return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
1224
1224
|
}
|
|
1225
|
-
},
|
|
1225
|
+
}, sn = {
|
|
1226
1226
|
get value() {
|
|
1227
1227
|
return typeof document < "u" ? document.documentElement : null;
|
|
1228
1228
|
}
|
|
1229
1229
|
};
|
|
1230
|
-
function
|
|
1231
|
-
const n =
|
|
1232
|
-
|
|
1230
|
+
function an(e, t) {
|
|
1231
|
+
const n = X(!1), a = Qe(
|
|
1232
|
+
sn,
|
|
1233
1233
|
t ?? {},
|
|
1234
1234
|
() => {
|
|
1235
1235
|
if (e.state.value !== "dragging") return null;
|
|
@@ -1239,41 +1239,41 @@ function nn(e, t) {
|
|
|
1239
1239
|
y: o.y + l.height / 2
|
|
1240
1240
|
} : o : null;
|
|
1241
1241
|
},
|
|
1242
|
-
|
|
1242
|
+
nn,
|
|
1243
1243
|
n
|
|
1244
|
-
), r =
|
|
1244
|
+
), r = te(
|
|
1245
1245
|
() => e.state.value,
|
|
1246
1246
|
(o) => {
|
|
1247
|
-
o === "dragging" ?
|
|
1247
|
+
o === "dragging" ? a.run() : a.stop();
|
|
1248
1248
|
}
|
|
1249
|
-
),
|
|
1250
|
-
r(),
|
|
1249
|
+
), i = () => {
|
|
1250
|
+
r(), a.stop();
|
|
1251
1251
|
};
|
|
1252
|
-
return
|
|
1252
|
+
return tt(i), { isScrolling: n, stop: i };
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1255
|
-
const t =
|
|
1256
|
-
let
|
|
1257
|
-
|
|
1254
|
+
const on = (e) => {
|
|
1255
|
+
const t = $t(e), n = fe.keyDown(e), s = fe.keyUp(e), a = fe.clear(e), r = Jt(e);
|
|
1256
|
+
let i = null;
|
|
1257
|
+
te(
|
|
1258
1258
|
e.autoScrollViewport,
|
|
1259
1259
|
(o) => {
|
|
1260
|
-
|
|
1260
|
+
i?.(), i = null, (o === !0 || o && typeof o == "object") && (i = an(
|
|
1261
1261
|
e,
|
|
1262
1262
|
o === !0 ? {} : o
|
|
1263
1263
|
).stop);
|
|
1264
1264
|
},
|
|
1265
1265
|
{ immediate: !0 }
|
|
1266
1266
|
), Y(() => {
|
|
1267
|
-
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", n), document.addEventListener("keyup", s), document.addEventListener("blur",
|
|
1267
|
+
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", n), document.addEventListener("keyup", s), document.addEventListener("blur", a), document.addEventListener("scroll", r, !0);
|
|
1268
1268
|
}), Z(() => {
|
|
1269
|
-
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", n), document.removeEventListener("keyup", s), document.removeEventListener("blur",
|
|
1269
|
+
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", n), document.removeEventListener("keyup", s), document.removeEventListener("blur", a), document.removeEventListener("scroll", r, !0), i?.(), t.cleanup();
|
|
1270
1270
|
});
|
|
1271
|
-
},
|
|
1271
|
+
}, se = () => {
|
|
1272
1272
|
const e = Be(xe);
|
|
1273
1273
|
if (!e) throw Error("DnD provider not found");
|
|
1274
1274
|
return e;
|
|
1275
|
-
},
|
|
1276
|
-
const e =
|
|
1275
|
+
}, et = () => {
|
|
1276
|
+
const e = se();
|
|
1277
1277
|
return {
|
|
1278
1278
|
preview: e.preview,
|
|
1279
1279
|
delay: e.delay,
|
|
@@ -1287,21 +1287,21 @@ const sn = (e) => {
|
|
|
1287
1287
|
collision: e.collision,
|
|
1288
1288
|
autoScrollViewport: e.autoScrollViewport
|
|
1289
1289
|
};
|
|
1290
|
-
},
|
|
1290
|
+
}, rn = /* @__PURE__ */ Oe({
|
|
1291
1291
|
__name: "DragPreview",
|
|
1292
1292
|
props: {
|
|
1293
1293
|
grid: {}
|
|
1294
1294
|
},
|
|
1295
1295
|
setup(e) {
|
|
1296
|
-
const { state: t, entities: n, preview: s } =
|
|
1297
|
-
|
|
1298
|
-
() =>
|
|
1296
|
+
const { state: t, entities: n, preview: s } = et(), a = Fe("contentRef");
|
|
1297
|
+
te(
|
|
1298
|
+
() => a.value,
|
|
1299
1299
|
() => {
|
|
1300
|
-
const o =
|
|
1300
|
+
const o = a.value?.getBoundingClientRect();
|
|
1301
1301
|
o && (s.size.value = o);
|
|
1302
1302
|
}
|
|
1303
1303
|
);
|
|
1304
|
-
const r = (o, l) => !l || l <= 0 ? o : Math.round(o / l) * l,
|
|
1304
|
+
const r = (o, l) => !l || l <= 0 ? o : Math.round(o / l) * l, i = b(() => {
|
|
1305
1305
|
const { x: o, y: l } = s.position.value, c = typeof e.grid == "object" ? e.grid.x : e.grid, u = typeof e.grid == "object" ? e.grid.y : e.grid;
|
|
1306
1306
|
return { x: r(o, c), y: r(l, u) };
|
|
1307
1307
|
});
|
|
@@ -1309,28 +1309,28 @@ const sn = (e) => {
|
|
|
1309
1309
|
key: 0,
|
|
1310
1310
|
class: "dnd-kit-preview",
|
|
1311
1311
|
ref_key: "contentRef",
|
|
1312
|
-
ref:
|
|
1313
|
-
style:
|
|
1314
|
-
transform: `translate3d(${
|
|
1312
|
+
ref: a,
|
|
1313
|
+
style: Ie({
|
|
1314
|
+
transform: `translate3d(${i.value.x}px, ${i.value.y}px, 0)`
|
|
1315
1315
|
})
|
|
1316
1316
|
}, [
|
|
1317
|
-
|
|
1317
|
+
de(o.$slots, "default", {
|
|
1318
1318
|
draggingMap: j(n).draggingMap
|
|
1319
1319
|
}, () => [
|
|
1320
|
-
(L(!0), W(
|
|
1321
|
-
u.render ? (L(),
|
|
1320
|
+
(L(!0), W(me, null, nt(j(n).draggingMap, ([c, u]) => (L(), W(me, { key: c }, [
|
|
1321
|
+
u.render ? (L(), J(he(u.render), { key: 0 })) : (L(), J(he(c.tagName), {
|
|
1322
1322
|
key: 1,
|
|
1323
1323
|
innerHTML: u.initialOuterHTML,
|
|
1324
|
-
style:
|
|
1324
|
+
style: Ie({
|
|
1325
1325
|
width: u.initialRect.width + "px",
|
|
1326
1326
|
height: u.initialRect.height + "px"
|
|
1327
1327
|
})
|
|
1328
1328
|
}, null, 8, ["innerHTML", "style"]))
|
|
1329
1329
|
], 64))), 128))
|
|
1330
1330
|
])
|
|
1331
|
-
], 4)) :
|
|
1331
|
+
], 4)) : st("", !0);
|
|
1332
1332
|
}
|
|
1333
|
-
}),
|
|
1333
|
+
}), cn = /* @__PURE__ */ Oe({
|
|
1334
1334
|
__name: "DnDProvider",
|
|
1335
1335
|
props: {
|
|
1336
1336
|
autoScrollViewport: { type: [Object, Boolean, null] },
|
|
@@ -1339,35 +1339,35 @@ const sn = (e) => {
|
|
|
1339
1339
|
class: {}
|
|
1340
1340
|
},
|
|
1341
1341
|
setup(e) {
|
|
1342
|
-
const t = e, n = Fe("previewRef"), s =
|
|
1343
|
-
|
|
1344
|
-
const
|
|
1345
|
-
Y(() =>
|
|
1346
|
-
const r = b(() => s.preview.render.value ??
|
|
1347
|
-
return
|
|
1348
|
-
|
|
1349
|
-
(L(),
|
|
1350
|
-
disabled: !
|
|
1342
|
+
const t = e, n = Fe("previewRef"), s = vt(n, t);
|
|
1343
|
+
on(s);
|
|
1344
|
+
const a = q(!1);
|
|
1345
|
+
Y(() => a.value = !0);
|
|
1346
|
+
const r = b(() => s.preview.render.value ?? rn);
|
|
1347
|
+
return at(xe, s), (i, o) => (L(), W(me, null, [
|
|
1348
|
+
de(i.$slots, "default"),
|
|
1349
|
+
(L(), J(it, {
|
|
1350
|
+
disabled: !a.value,
|
|
1351
1351
|
to: j(s).preview.to.value || "body"
|
|
1352
1352
|
}, [
|
|
1353
|
-
|
|
1353
|
+
ot("div", rt({
|
|
1354
1354
|
ref_key: "previewRef",
|
|
1355
1355
|
ref: n,
|
|
1356
1356
|
class: "dnd-kit-preview-container"
|
|
1357
1357
|
}, t), [
|
|
1358
|
-
|
|
1359
|
-
(L(),
|
|
1358
|
+
de(i.$slots, "preview", { preview: r.value }, () => [
|
|
1359
|
+
(L(), J(he(r.value)))
|
|
1360
1360
|
])
|
|
1361
1361
|
], 16)
|
|
1362
1362
|
], 8, ["disabled", "to"]))
|
|
1363
1363
|
], 64));
|
|
1364
1364
|
}
|
|
1365
1365
|
});
|
|
1366
|
-
function
|
|
1367
|
-
const s =
|
|
1368
|
-
let
|
|
1369
|
-
typeof t == "function" ? (
|
|
1370
|
-
const o =
|
|
1366
|
+
function gn(e, t, n) {
|
|
1367
|
+
const s = se();
|
|
1368
|
+
let a, r, i;
|
|
1369
|
+
typeof t == "function" ? (a = {}, r = t) : (a = t ?? {}, r = n);
|
|
1370
|
+
const o = a.id ?? Math.random().toString(36).slice(2), l = b({
|
|
1371
1371
|
get() {
|
|
1372
1372
|
const f = S(e);
|
|
1373
1373
|
return f ? s.entities.selectedSet.has(f) : !1;
|
|
@@ -1388,28 +1388,28 @@ function ln(e, t, n) {
|
|
|
1388
1388
|
return s.entities.draggableMap.get(f)?.hoveredPlacement;
|
|
1389
1389
|
});
|
|
1390
1390
|
return Y(() => {
|
|
1391
|
-
if (
|
|
1391
|
+
if (i = S(e), !!i && (i.addEventListener("dragstart", M), i.addEventListener("drag", M), i.addEventListener("dragend", M), i.setAttribute(C.DRAGGABLE, o), s.lib.draggableObserver.observe(i), s.entities.draggableMap.set(i, {
|
|
1392
1392
|
id: o,
|
|
1393
|
-
render:
|
|
1394
|
-
disabled:
|
|
1395
|
-
groups:
|
|
1396
|
-
modifier:
|
|
1397
|
-
events:
|
|
1393
|
+
render: a.render,
|
|
1394
|
+
disabled: a.disabled ?? !1,
|
|
1395
|
+
groups: a.groups ?? [],
|
|
1396
|
+
modifier: a.modifier,
|
|
1397
|
+
events: a.events,
|
|
1398
1398
|
payload: r,
|
|
1399
|
-
data:
|
|
1400
|
-
dragHandle:
|
|
1401
|
-
activation:
|
|
1402
|
-
placementMargins:
|
|
1399
|
+
data: a.data,
|
|
1400
|
+
dragHandle: a.dragHandle,
|
|
1401
|
+
activation: a.activation,
|
|
1402
|
+
placementMargins: a.placementMargins,
|
|
1403
1403
|
hoveredPlacement: void 0
|
|
1404
1404
|
}), o)) {
|
|
1405
1405
|
for (const [f, d] of s.entities.draggingMap)
|
|
1406
|
-
if (d.id === o && f !==
|
|
1407
|
-
s.entities.draggingMap.delete(f), s.entities.draggingMap.set(
|
|
1406
|
+
if (d.id === o && f !== i) {
|
|
1407
|
+
s.entities.draggingMap.delete(f), s.entities.draggingMap.set(i, d);
|
|
1408
1408
|
break;
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
1411
|
}), Z(() => {
|
|
1412
|
-
|
|
1412
|
+
i && (s.lib.draggableObserver.unobserve(i), s.entities.visibleDraggableSet.delete(i), s.entities.draggableMap.delete(i), s.entities.modifiersDraggableSet.delete(i));
|
|
1413
1413
|
}), {
|
|
1414
1414
|
selected: l,
|
|
1415
1415
|
isDragging: c,
|
|
@@ -1417,11 +1417,11 @@ function ln(e, t, n) {
|
|
|
1417
1417
|
isDragOver: g
|
|
1418
1418
|
};
|
|
1419
1419
|
}
|
|
1420
|
-
const
|
|
1421
|
-
const n =
|
|
1422
|
-
let
|
|
1420
|
+
const un = (e, t) => {
|
|
1421
|
+
const n = se(), s = b(() => e.value === n.entities.selectingArea);
|
|
1422
|
+
let a = null;
|
|
1423
1423
|
Y(() => {
|
|
1424
|
-
|
|
1424
|
+
a = S(e), a && (a.setAttribute(C.SELECT_AREA, ""), n.lib.selectableAreaObserver.observe(a), n.entities.selectableAreaMap.set(a, {
|
|
1425
1425
|
modifier: t?.modifier ?? {
|
|
1426
1426
|
keys: ["ControlLeft"],
|
|
1427
1427
|
method: "every"
|
|
@@ -1432,24 +1432,24 @@ const cn = (e, t) => {
|
|
|
1432
1432
|
strategy: t?.strategy ?? "toggle"
|
|
1433
1433
|
}));
|
|
1434
1434
|
}), Z(() => {
|
|
1435
|
-
|
|
1435
|
+
a && (n.lib.selectableAreaObserver.unobserve(a), n.entities.visibleSelectableAreaSet.delete(a), n.entities.modifiersSelectableAreaSet.delete(a), n.entities.selectableAreaMap.delete(a));
|
|
1436
1436
|
});
|
|
1437
1437
|
const r = b(() => {
|
|
1438
1438
|
n.scrollPosition.x, n.scrollPosition.y;
|
|
1439
|
-
const
|
|
1440
|
-
return !
|
|
1439
|
+
const i = n.pointer.value;
|
|
1440
|
+
return !i || n.state.value !== "selecting" || !a || !s.value ? {} : xt(i.start, i.current, a);
|
|
1441
1441
|
});
|
|
1442
1442
|
return {
|
|
1443
1443
|
isSelecting: s,
|
|
1444
1444
|
style: r
|
|
1445
1445
|
};
|
|
1446
1446
|
};
|
|
1447
|
-
function
|
|
1447
|
+
function fn(e, t) {
|
|
1448
1448
|
const n = Be(xe);
|
|
1449
1449
|
if (!n) throw Error("DnD provider not found");
|
|
1450
1450
|
let s = null;
|
|
1451
1451
|
return Y(() => {
|
|
1452
|
-
s = S(e), s && (s.setAttribute(
|
|
1452
|
+
s = S(e), s && (s.setAttribute(C.CONSTRAINT_AREA, ""), n.entities.constraintsAreaMap.set(s, {
|
|
1453
1453
|
axis: t?.axis || "both",
|
|
1454
1454
|
restrictToArea: t?.restrictToArea || !1
|
|
1455
1455
|
}));
|
|
@@ -1457,10 +1457,10 @@ function gn(e, t) {
|
|
|
1457
1457
|
s && n.entities.constraintsAreaMap.delete(s);
|
|
1458
1458
|
}), {};
|
|
1459
1459
|
}
|
|
1460
|
-
function
|
|
1461
|
-
const s =
|
|
1462
|
-
let
|
|
1463
|
-
typeof t == "function" ? (r = {},
|
|
1460
|
+
function dn(e, t, n) {
|
|
1461
|
+
const s = se();
|
|
1462
|
+
let a = null, r, i;
|
|
1463
|
+
typeof t == "function" ? (r = {}, i = t) : (r = t ?? {}, i = n);
|
|
1464
1464
|
const o = b(() => {
|
|
1465
1465
|
const c = S(e);
|
|
1466
1466
|
return c ? s.entities.allowedDroppableSet.has(c) : !1;
|
|
@@ -1470,24 +1470,24 @@ function un(e, t, n) {
|
|
|
1470
1470
|
return s.entities.droppableMap.get(c)?.hoveredPlacement;
|
|
1471
1471
|
});
|
|
1472
1472
|
return Y(() => {
|
|
1473
|
-
|
|
1473
|
+
a = S(e), a && (a.setAttribute(C.DROPPABLE, ""), s.lib.droppableObserver.observe(a), s.entities.droppableMap.set(a, {
|
|
1474
1474
|
disabled: r.disabled ?? !1,
|
|
1475
1475
|
groups: r.groups ?? [],
|
|
1476
1476
|
groupMatch: r.groupMatch ?? "every",
|
|
1477
1477
|
events: r.events,
|
|
1478
|
-
payload:
|
|
1478
|
+
payload: i,
|
|
1479
1479
|
data: r.data,
|
|
1480
1480
|
hoveredPlacement: void 0
|
|
1481
1481
|
}));
|
|
1482
1482
|
}), Z(() => {
|
|
1483
|
-
|
|
1483
|
+
a && (s.lib.droppableObserver.unobserve(a), s.entities.visibleDroppableSet.delete(a), s.entities.droppableMap.delete(a));
|
|
1484
1484
|
}), {
|
|
1485
1485
|
isAllowed: o,
|
|
1486
1486
|
isDragOver: l
|
|
1487
1487
|
};
|
|
1488
1488
|
}
|
|
1489
|
-
const
|
|
1490
|
-
const n =
|
|
1489
|
+
const mn = (e, t) => {
|
|
1490
|
+
const n = et(), s = X(!1), r = Qe(
|
|
1491
1491
|
e,
|
|
1492
1492
|
t ?? {},
|
|
1493
1493
|
() => {
|
|
@@ -1500,25 +1500,25 @@ const fn = (e, t) => {
|
|
|
1500
1500
|
},
|
|
1501
1501
|
void 0,
|
|
1502
1502
|
s
|
|
1503
|
-
),
|
|
1503
|
+
), i = b(() => {
|
|
1504
1504
|
const o = e.value;
|
|
1505
1505
|
return o != null && n.hovered.droppable.has(o);
|
|
1506
1506
|
});
|
|
1507
|
-
return
|
|
1508
|
-
[() => n.state.value,
|
|
1507
|
+
return te(
|
|
1508
|
+
[() => n.state.value, i],
|
|
1509
1509
|
([o, l]) => {
|
|
1510
1510
|
o === "dragging" && l ? r.run() : r.stop();
|
|
1511
1511
|
}
|
|
1512
1512
|
), { isScrolling: s };
|
|
1513
1513
|
};
|
|
1514
1514
|
export {
|
|
1515
|
-
|
|
1516
|
-
|
|
1515
|
+
cn as DnDProvider,
|
|
1516
|
+
rn as DragPreview,
|
|
1517
1517
|
xe as injectionKey,
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1518
|
+
mn as makeAutoScroll,
|
|
1519
|
+
fn as makeConstraintArea,
|
|
1520
|
+
gn as makeDraggable,
|
|
1521
|
+
dn as makeDroppable,
|
|
1522
|
+
un as makeSelectionArea,
|
|
1523
|
+
et as useDnDProvider
|
|
1524
1524
|
};
|