@vue-dnd-kit/core 2.0.4 → 2.0.6
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/external/composables/makeDraggable.d.ts +1 -0
- package/dist/external/composables/makeDroppable.d.ts +1 -0
- package/dist/external/types/entities.d.ts +12 -23
- package/dist/external/types/operations.d.ts +3 -2
- package/dist/external/types/provider.d.ts +3 -8
- package/dist/internal/logic/operations.d.ts +3 -3
- package/dist/vue-dnd-kit-core.cjs.js +2 -2
- package/dist/vue-dnd-kit-core.es.js +350 -346
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}
|
|
2
|
-
import { ref as W, watch as oe, shallowRef as J, reactive as V, computed as
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { ref as W, watch as oe, shallowRef as J, reactive as V, computed as y, onScopeDispose as We, onMounted as Y, onBeforeUnmount as X, inject as Oe, defineComponent as ze, unref as k, openBlock as C, createElementBlock as j, normalizeStyle as xe, Fragment as ue, renderList as je, createBlock as Q, resolveDynamicComponent as fe, createCommentVNode as Je, useTemplateRef as Qe, provide as et, renderSlot as Ae, Teleport as tt, createElementVNode as nt, mergeProps as st } from "vue";
|
|
3
3
|
const T = {
|
|
4
4
|
SELECT_AREA: "data-dnd-kit-select-area",
|
|
5
5
|
DRAGGABLE: "data-dnd-kit-draggable",
|
|
@@ -11,25 +11,25 @@ const T = {
|
|
|
11
11
|
CONSTRAINT_AREA: `[${T.CONSTRAINT_AREA}]`
|
|
12
12
|
}, De = "VueDnDKitProvider", Ee = (e, t, s, n) => {
|
|
13
13
|
const o = /* @__PURE__ */ new Set();
|
|
14
|
-
return t.forEach((
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const g =
|
|
14
|
+
return t.forEach((r) => {
|
|
15
|
+
const a = e.get(r), i = n ? n(r) : a?.disabled;
|
|
16
|
+
if (!a || i) return;
|
|
17
|
+
const g = a.modifier?.keys, l = a.modifier?.method;
|
|
18
18
|
if (!g || !l || g.length === 0) {
|
|
19
|
-
o.add(
|
|
19
|
+
o.add(r);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
g[l]((c) => s.value.has(c)) && o.add(
|
|
22
|
+
g[l]((c) => s.value.has(c)) && o.add(r);
|
|
23
23
|
}), o;
|
|
24
24
|
};
|
|
25
|
-
let Be = "", ot = "",
|
|
26
|
-
const
|
|
25
|
+
let Be = "", ot = "", at = "";
|
|
26
|
+
const D = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, H = (e, t) => e !== t && e.contains(t), rt = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), de = () => {
|
|
27
27
|
const e = document.body;
|
|
28
|
-
Be = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu",
|
|
28
|
+
Be = 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
|
}, me = () => {
|
|
30
30
|
const e = document.body;
|
|
31
|
-
e.style.userSelect = Be, e.style.touchAction = ot, e.style.overscrollBehavior =
|
|
32
|
-
},
|
|
31
|
+
e.style.userSelect = Be, e.style.touchAction = ot, e.style.overscrollBehavior = at, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
|
|
32
|
+
}, M = (e) => e.preventDefault(), Me = (e, t) => {
|
|
33
33
|
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
34
34
|
for (const n of t.entities.visibleDraggableSet)
|
|
35
35
|
if (t.entities.draggableMap.get(n)?.disabled && H(n, e)) return !0;
|
|
@@ -44,31 +44,31 @@ const v = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
44
44
|
const s = new Set(t);
|
|
45
45
|
return e.some((n) => s.has(n));
|
|
46
46
|
};
|
|
47
|
-
function
|
|
47
|
+
function it(e, t, s, n) {
|
|
48
48
|
const o = /* @__PURE__ */ new Set();
|
|
49
49
|
for (const i of t.keys()) {
|
|
50
50
|
const g = s.get(i);
|
|
51
51
|
for (const l of g?.groups ?? []) o.add(l);
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const r = [...o], a = /* @__PURE__ */ new Set();
|
|
54
54
|
for (const i of e) {
|
|
55
55
|
const l = n.get(i)?.groups ?? [];
|
|
56
|
-
ve(
|
|
56
|
+
ve(r, l) && a.add(i);
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return a;
|
|
59
59
|
}
|
|
60
60
|
function lt(e, t, s) {
|
|
61
61
|
const n = /* @__PURE__ */ new Set();
|
|
62
|
-
for (const
|
|
63
|
-
const i = s.get(
|
|
62
|
+
for (const a of t.keys()) {
|
|
63
|
+
const i = s.get(a);
|
|
64
64
|
for (const g of i?.groups ?? []) n.add(g);
|
|
65
65
|
}
|
|
66
|
-
const o = [...n],
|
|
67
|
-
for (const
|
|
68
|
-
const g = s.get(
|
|
69
|
-
ve(o, g) &&
|
|
66
|
+
const o = [...n], r = /* @__PURE__ */ new Set();
|
|
67
|
+
for (const a of e) {
|
|
68
|
+
const g = s.get(a)?.groups ?? [];
|
|
69
|
+
ve(o, g) && r.add(a);
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return r;
|
|
72
72
|
}
|
|
73
73
|
const le = (e) => {
|
|
74
74
|
const t = new IntersectionObserver((s) => {
|
|
@@ -86,8 +86,8 @@ const le = (e) => {
|
|
|
86
86
|
const t = new ResizeObserver((s) => {
|
|
87
87
|
const n = s[0];
|
|
88
88
|
if (!n) return;
|
|
89
|
-
const { width: o, height:
|
|
90
|
-
e.value = { width: o, height:
|
|
89
|
+
const { width: o, height: r } = n.contentRect;
|
|
90
|
+
e.value = { width: o, height: r };
|
|
91
91
|
});
|
|
92
92
|
return {
|
|
93
93
|
observe: (s) => t.observe(s),
|
|
@@ -97,8 +97,8 @@ const le = (e) => {
|
|
|
97
97
|
}, gt = (e) => {
|
|
98
98
|
const t = W(null), s = ct(t), n = oe(
|
|
99
99
|
e,
|
|
100
|
-
(
|
|
101
|
-
s.disconnect(),
|
|
100
|
+
(r) => {
|
|
101
|
+
s.disconnect(), r && s.observe(r);
|
|
102
102
|
},
|
|
103
103
|
{ immediate: !0 }
|
|
104
104
|
);
|
|
@@ -163,12 +163,12 @@ function mt(e, t) {
|
|
|
163
163
|
}
|
|
164
164
|
const {
|
|
165
165
|
x: o = 0,
|
|
166
|
-
y:
|
|
167
|
-
condition:
|
|
166
|
+
y: r = 0,
|
|
167
|
+
condition: a = "any"
|
|
168
168
|
} = t;
|
|
169
|
-
if (o === 0 &&
|
|
170
|
-
const i = o > 0 ? Math.min(s / o, 1) : 1, g =
|
|
171
|
-
return
|
|
169
|
+
if (o === 0 && r === 0) return 1;
|
|
170
|
+
const i = o > 0 ? Math.min(s / o, 1) : 1, g = r > 0 ? Math.min(n / r, 1) : 1;
|
|
171
|
+
return a === "both" ? Math.min(i, g) : Math.max(i, g);
|
|
172
172
|
}
|
|
173
173
|
function He(e, t, s) {
|
|
174
174
|
if (!s) return !0;
|
|
@@ -196,13 +196,13 @@ function bt(e, t) {
|
|
|
196
196
|
}
|
|
197
197
|
const o = e.entities.draggableMap.get(
|
|
198
198
|
e.entities.initiatingDraggable
|
|
199
|
-
),
|
|
200
|
-
if (!
|
|
199
|
+
), r = o?.activation?.delay;
|
|
200
|
+
if (!r) {
|
|
201
201
|
s = null;
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
e.delay.progress = Math.min(
|
|
205
|
-
(Date.now() - e.delay.startTime) / (
|
|
205
|
+
(Date.now() - e.delay.startTime) / (r * 1e3),
|
|
206
206
|
1
|
|
207
207
|
), He(
|
|
208
208
|
e.distanceProgress.value,
|
|
@@ -229,20 +229,20 @@ function pt(e, t, s, n) {
|
|
|
229
229
|
return s === "x" ? { x: e, y: n.top } : s === "y" ? { x: n.left, y: t } : { x: e, y: t };
|
|
230
230
|
}
|
|
231
231
|
function St(e, t, s, n, o) {
|
|
232
|
-
let
|
|
233
|
-
return s !== "y" && (
|
|
232
|
+
let r = e, a = t;
|
|
233
|
+
return s !== "y" && (r = Math.max(
|
|
234
234
|
n.left,
|
|
235
235
|
Math.min(n.right - o.width, e)
|
|
236
|
-
)), s !== "x" && (
|
|
236
|
+
)), s !== "x" && (a = Math.max(
|
|
237
237
|
n.top,
|
|
238
238
|
Math.min(n.bottom - o.height, t)
|
|
239
|
-
)), { x:
|
|
239
|
+
)), { x: r, y: a };
|
|
240
240
|
}
|
|
241
241
|
function Dt(e, t, s, n, o) {
|
|
242
242
|
if (!e || !t)
|
|
243
243
|
return { x: 0, y: 0 };
|
|
244
|
-
const
|
|
245
|
-
let g = e.current.x -
|
|
244
|
+
const r = t.getBoundingClientRect(), a = r.width || o?.width || 0, i = r.height || o?.height || 0;
|
|
245
|
+
let g = e.current.x - a * e.offset.x, l = e.current.y - i * e.offset.y;
|
|
246
246
|
if (!s)
|
|
247
247
|
return { x: g, y: l };
|
|
248
248
|
const u = yt(s, n);
|
|
@@ -259,7 +259,7 @@ function Dt(e, t, s, n, o) {
|
|
|
259
259
|
h.y,
|
|
260
260
|
f.axis || "both",
|
|
261
261
|
d,
|
|
262
|
-
|
|
262
|
+
r
|
|
263
263
|
) : h;
|
|
264
264
|
}
|
|
265
265
|
const N = {
|
|
@@ -279,7 +279,7 @@ const N = {
|
|
|
279
279
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
280
280
|
};
|
|
281
281
|
function Mt(e, t) {
|
|
282
|
-
const s = J(), n = W(),
|
|
282
|
+
const s = J(), n = W(), r = {
|
|
283
283
|
keys: {
|
|
284
284
|
pressedKeys: W(/* @__PURE__ */ new Set()),
|
|
285
285
|
forDrag: [...N.forDrag],
|
|
@@ -290,7 +290,7 @@ function Mt(e, t) {
|
|
|
290
290
|
},
|
|
291
291
|
step: 8,
|
|
292
292
|
moveFaster: 4
|
|
293
|
-
},
|
|
293
|
+
}, a = V({
|
|
294
294
|
draggableMap: /* @__PURE__ */ new Map(),
|
|
295
295
|
droppableMap: /* @__PURE__ */ new Map(),
|
|
296
296
|
selectableAreaMap: /* @__PURE__ */ new Map(),
|
|
@@ -299,27 +299,27 @@ function Mt(e, t) {
|
|
|
299
299
|
selectingArea: void 0,
|
|
300
300
|
draggingMap: /* @__PURE__ */ new Map(),
|
|
301
301
|
selectedSet: /* @__PURE__ */ new Set(),
|
|
302
|
-
allowedDroppableSet:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
allowedDroppableSet: y(() => s.value ? it(
|
|
303
|
+
a.visibleDroppableSet,
|
|
304
|
+
a.draggingMap,
|
|
305
|
+
a.draggableMap,
|
|
306
|
+
a.droppableMap
|
|
307
307
|
) : /* @__PURE__ */ new Set()),
|
|
308
|
-
allowedDraggableSet:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
allowedDraggableSet: y(() => s.value ? lt(
|
|
309
|
+
a.visibleDraggableSet,
|
|
310
|
+
a.draggingMap,
|
|
311
|
+
a.draggableMap
|
|
312
312
|
) : /* @__PURE__ */ new Set()),
|
|
313
|
-
modifiersSelectableAreaSet:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
modifiersSelectableAreaSet: y(() => Ee(
|
|
314
|
+
a.selectableAreaMap,
|
|
315
|
+
a.visibleSelectableAreaSet,
|
|
316
|
+
r.keys.pressedKeys
|
|
317
317
|
)),
|
|
318
|
-
modifiersDraggableSet:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
(
|
|
318
|
+
modifiersDraggableSet: y(() => Ee(
|
|
319
|
+
a.draggableMap,
|
|
320
|
+
a.visibleDraggableSet,
|
|
321
|
+
r.keys.pressedKeys,
|
|
322
|
+
(w) => Me(w, { entities: a })
|
|
323
323
|
)),
|
|
324
324
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
325
325
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
@@ -335,34 +335,34 @@ function Mt(e, t) {
|
|
|
335
335
|
}), u = V({
|
|
336
336
|
progress: 0,
|
|
337
337
|
startTime: 0
|
|
338
|
-
}), c =
|
|
339
|
-
if (!n.value || !
|
|
340
|
-
const
|
|
341
|
-
return
|
|
338
|
+
}), c = y(() => {
|
|
339
|
+
if (!n.value || !a.initiatingDraggable) return 0;
|
|
340
|
+
const w = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
|
|
341
|
+
return w ? mt(n.value, w) : 1;
|
|
342
342
|
}), f = le(
|
|
343
|
-
|
|
343
|
+
a.visibleDraggableSet
|
|
344
344
|
), d = le(
|
|
345
|
-
|
|
345
|
+
a.visibleDroppableSet
|
|
346
346
|
), m = le(
|
|
347
|
-
|
|
348
|
-
), { overlaySize: h, overlaySizeObserver:
|
|
349
|
-
const
|
|
347
|
+
a.visibleSelectableAreaSet
|
|
348
|
+
), { overlaySize: h, overlaySizeObserver: S } = gt(e), b = W(), v = y(() => {
|
|
349
|
+
const p = a.initiatingDraggable;
|
|
350
350
|
return Dt(
|
|
351
351
|
n.value,
|
|
352
352
|
e.value,
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
p || null,
|
|
354
|
+
a.constraintsAreaMap,
|
|
355
355
|
h.value
|
|
356
356
|
);
|
|
357
|
-
}),
|
|
357
|
+
}), E = y({
|
|
358
358
|
get: () => t?.overlayTo,
|
|
359
|
-
set: (
|
|
360
|
-
}), U =
|
|
359
|
+
set: (p) => E.value = p
|
|
360
|
+
}), U = y(() => t?.autoScrollViewport);
|
|
361
361
|
return {
|
|
362
362
|
state: s,
|
|
363
363
|
pointer: n,
|
|
364
|
-
entities:
|
|
365
|
-
keyboard:
|
|
364
|
+
entities: a,
|
|
365
|
+
keyboard: r,
|
|
366
366
|
scrollPosition: l,
|
|
367
367
|
delay: u,
|
|
368
368
|
distanceProgress: c,
|
|
@@ -370,16 +370,16 @@ function Mt(e, t) {
|
|
|
370
370
|
collision: g,
|
|
371
371
|
overlay: {
|
|
372
372
|
size: h,
|
|
373
|
-
position:
|
|
374
|
-
render:
|
|
373
|
+
position: v,
|
|
374
|
+
render: b,
|
|
375
375
|
ref: e,
|
|
376
|
-
to:
|
|
376
|
+
to: E
|
|
377
377
|
},
|
|
378
378
|
lib: {
|
|
379
379
|
draggableObserver: f,
|
|
380
380
|
droppableObserver: d,
|
|
381
381
|
selectableAreaObserver: m,
|
|
382
|
-
overlaySizeObserver:
|
|
382
|
+
overlaySizeObserver: S,
|
|
383
383
|
rectCache: /* @__PURE__ */ new Map()
|
|
384
384
|
},
|
|
385
385
|
autoScrollViewport: U
|
|
@@ -407,7 +407,7 @@ function we(e, t, s = 1) {
|
|
|
407
407
|
return [...e.slice(0, n), ...e.slice(n + o)];
|
|
408
408
|
}
|
|
409
409
|
function G(e, t) {
|
|
410
|
-
const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o,
|
|
410
|
+
const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o, r) => r - o);
|
|
411
411
|
let n = e;
|
|
412
412
|
for (const o of s) n = we(n, o, 1);
|
|
413
413
|
return n;
|
|
@@ -432,11 +432,11 @@ const R = {
|
|
|
432
432
|
function Ne(e, t) {
|
|
433
433
|
const { draggedItems: s, dropZone: n, hoveredDraggable: o } = e;
|
|
434
434
|
if (!s.length) return null;
|
|
435
|
-
const
|
|
436
|
-
if (!
|
|
437
|
-
const i = s[0].items, g = s.map((f) => f.index), l =
|
|
435
|
+
const r = o?.placement.center === !0 && n != null && n.items !== o.items, a = r ? n.items : o?.items ?? n?.items;
|
|
436
|
+
if (!a) return null;
|
|
437
|
+
const i = s[0].items, g = s.map((f) => f.index), l = a.length;
|
|
438
438
|
let u, c;
|
|
439
|
-
if (o && !
|
|
439
|
+
if (o && !r) {
|
|
440
440
|
const f = o.items === i && g.includes(o.index);
|
|
441
441
|
if (f && s.length === 1) {
|
|
442
442
|
const d = R.isAtZoneStart(n?.placement, t);
|
|
@@ -454,30 +454,30 @@ function Ne(e, t) {
|
|
|
454
454
|
const f = R.isAtZoneStart(n.placement, t);
|
|
455
455
|
u = f ? 0 : l, c = f ? "prepend" : "append";
|
|
456
456
|
}
|
|
457
|
-
return { targetIndex: u, mode: c, targetArr:
|
|
457
|
+
return { targetIndex: u, mode: c, targetArr: a };
|
|
458
458
|
}
|
|
459
459
|
function vt(e, t = "vertical") {
|
|
460
460
|
const { draggedItems: s } = e;
|
|
461
461
|
if (!s.length) return null;
|
|
462
462
|
const n = Ne(e, t);
|
|
463
463
|
if (!n) return null;
|
|
464
|
-
const { targetArr: o, mode:
|
|
465
|
-
let { targetIndex:
|
|
464
|
+
const { targetArr: o, mode: r } = n;
|
|
465
|
+
let { targetIndex: a } = n;
|
|
466
466
|
const i = s.map((c) => c.index), g = s.map((c) => c.item), l = s[0].items;
|
|
467
467
|
if (l === o) {
|
|
468
|
-
const c = i.filter((d) => d <
|
|
469
|
-
|
|
470
|
-
const f = I(G(l, i),
|
|
471
|
-
return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex:
|
|
468
|
+
const c = i.filter((d) => d < a).length;
|
|
469
|
+
a = Math.max(0, a - c);
|
|
470
|
+
const f = I(G(l, i), a, g);
|
|
471
|
+
return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: a, mode: r, sameList: !0 };
|
|
472
472
|
} else {
|
|
473
|
-
const c = G(l, i), f = I(o,
|
|
474
|
-
return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex:
|
|
473
|
+
const c = G(l, i), f = I(o, a, g);
|
|
474
|
+
return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: a, mode: r, sameList: !1 };
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
function wt(e) {
|
|
478
478
|
const { draggedItems: t, hoveredDraggable: s } = e;
|
|
479
479
|
if (!t.length || !s) return null;
|
|
480
|
-
const n = t.map((u) => u.index), o = s.index,
|
|
480
|
+
const n = t.map((u) => u.index), o = s.index, r = t.map((u) => u.item), a = s.item, i = t[0].items, g = s.items, l = i === g;
|
|
481
481
|
if (l && n.includes(o)) return null;
|
|
482
482
|
if (t.length === 1) {
|
|
483
483
|
const u = n[0];
|
|
@@ -491,17 +491,17 @@ function wt(e) {
|
|
|
491
491
|
} else {
|
|
492
492
|
const u = Math.min(...n);
|
|
493
493
|
if (l) {
|
|
494
|
-
const c = n.filter((
|
|
494
|
+
const c = n.filter((b) => b < o).length, f = Math.max(0, o - c), d = n.filter((b) => b < u).length, m = Math.max(0, u - d);
|
|
495
495
|
let h = G(i, n);
|
|
496
|
-
h = I(h, f,
|
|
497
|
-
const
|
|
498
|
-
return h = I(h,
|
|
496
|
+
h = I(h, f, r);
|
|
497
|
+
const S = m >= f ? m + r.length : m;
|
|
498
|
+
return h = I(h, S, [a]), { sourceItems: h, targetItems: h, sourceIndexes: n, targetIndex: f, sameList: !0 };
|
|
499
499
|
} else {
|
|
500
500
|
const c = n.filter((h) => h < u).length, f = Math.max(0, u - c);
|
|
501
501
|
let d = G(i, n);
|
|
502
|
-
d = I(d, f, [
|
|
502
|
+
d = I(d, f, [a]);
|
|
503
503
|
let m = we(g, o);
|
|
504
|
-
return m = I(m, o,
|
|
504
|
+
return m = I(m, o, r), { sourceItems: d, targetItems: m, sourceIndexes: n, targetIndex: o, sameList: !1 };
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
}
|
|
@@ -510,13 +510,13 @@ function xt(e, t = "vertical") {
|
|
|
510
510
|
if (!s.length) return null;
|
|
511
511
|
const n = Ne(e, t);
|
|
512
512
|
if (!n) return null;
|
|
513
|
-
const { targetArr: o, targetIndex:
|
|
514
|
-
return { targetItems: I(o,
|
|
513
|
+
const { targetArr: o, targetIndex: r, mode: a } = n, i = s.map((l) => l.item);
|
|
514
|
+
return { targetItems: I(o, r, i), copiedItems: i, targetIndex: r, mode: a };
|
|
515
515
|
}
|
|
516
516
|
function At(e) {
|
|
517
517
|
const { draggedItems: t } = e;
|
|
518
518
|
if (!t.length) return null;
|
|
519
|
-
const s = t.map((
|
|
519
|
+
const s = t.map((a) => a.index), n = t.map((a) => a.item), o = t[0].items;
|
|
520
520
|
return { sourceItems: G(o, s), removedItems: n, sourceIndexes: s };
|
|
521
521
|
}
|
|
522
522
|
function Et(e) {
|
|
@@ -543,68 +543,70 @@ const P = (e) => e.keys().next().value, Lt = (e) => e.target.closest(
|
|
|
543
543
|
function Ct(e) {
|
|
544
544
|
const t = e.entities.initiatingDraggable;
|
|
545
545
|
if (!t) return [];
|
|
546
|
-
const
|
|
547
|
-
if (!n)
|
|
546
|
+
const s = e.entities.draggingMap.get(t) ?? e.entities.draggableMap.get(t), n = s?.payload;
|
|
547
|
+
if (!n)
|
|
548
|
+
return s?.data ? [{ index: -1, item: void 0, items: [], data: s.data() }] : [];
|
|
548
549
|
const o = n();
|
|
549
550
|
if (!Array.isArray(o) || o.length < 2) return [];
|
|
550
|
-
const [
|
|
551
|
-
return
|
|
552
|
-
index:
|
|
553
|
-
item:
|
|
554
|
-
items:
|
|
555
|
-
|
|
556
|
-
}), e.entities.draggingMap.forEach((
|
|
557
|
-
const
|
|
558
|
-
if (!
|
|
559
|
-
const
|
|
560
|
-
if (!Array.isArray(
|
|
561
|
-
const [
|
|
562
|
-
if (
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
index:
|
|
566
|
-
item:
|
|
567
|
-
items:
|
|
568
|
-
|
|
551
|
+
const [r, a] = o, i = Number(r), g = a, l = /* @__PURE__ */ new Map();
|
|
552
|
+
return l.set(i, {
|
|
553
|
+
index: i,
|
|
554
|
+
item: g[i],
|
|
555
|
+
items: g,
|
|
556
|
+
data: s?.data?.()
|
|
557
|
+
}), e.entities.draggingMap.forEach((u, c) => {
|
|
558
|
+
const f = e.entities.draggableMap.get(c), d = f?.payload;
|
|
559
|
+
if (!d) return;
|
|
560
|
+
const m = d();
|
|
561
|
+
if (!Array.isArray(m) || m.length < 2) return;
|
|
562
|
+
const [h, S] = m;
|
|
563
|
+
if (S !== g) return;
|
|
564
|
+
const b = Number(h);
|
|
565
|
+
l.has(b) || l.set(b, {
|
|
566
|
+
index: b,
|
|
567
|
+
item: S[b],
|
|
568
|
+
items: g,
|
|
569
|
+
data: f?.data?.()
|
|
569
570
|
});
|
|
570
|
-
}), [...
|
|
571
|
+
}), [...l.values()].sort((u, c) => u.index - c.index);
|
|
571
572
|
}
|
|
572
|
-
const
|
|
573
|
+
const A = (e, t) => {
|
|
573
574
|
const s = Ct(e);
|
|
574
575
|
let n, o;
|
|
575
576
|
if (t) {
|
|
576
|
-
const r = e.entities.droppableMap.get(t)
|
|
577
|
+
const r = e.entities.droppableMap.get(t);
|
|
577
578
|
if (r) {
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
items:
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
579
|
+
const g = r.payload;
|
|
580
|
+
n = {
|
|
581
|
+
items: g ? g() : [],
|
|
582
|
+
placement: e.hovered.droppable.get(t),
|
|
583
|
+
data: r.data?.()
|
|
584
|
+
};
|
|
584
585
|
}
|
|
585
|
-
const
|
|
586
|
-
if (
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
589
|
-
const f =
|
|
586
|
+
const a = P(e.hovered.draggable);
|
|
587
|
+
if (a && (a === t || t.contains(a)) && a) {
|
|
588
|
+
const g = e.entities.draggableMap.get(a), l = g?.payload, u = e.hovered.draggable.get(a), c = { top: !1, right: !1, bottom: !1, left: !1, center: !1 };
|
|
589
|
+
if (l) {
|
|
590
|
+
const f = l();
|
|
590
591
|
if (Array.isArray(f) && f.length >= 2) {
|
|
591
|
-
const [d, m
|
|
592
|
+
const [d, m] = f, h = Number(d);
|
|
592
593
|
o = {
|
|
593
|
-
element:
|
|
594
|
-
placement:
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
bottom: !1,
|
|
598
|
-
left: !1,
|
|
599
|
-
center: !1
|
|
600
|
-
},
|
|
601
|
-
index: p,
|
|
602
|
-
item: m[p],
|
|
594
|
+
element: a,
|
|
595
|
+
placement: u ?? c,
|
|
596
|
+
index: h,
|
|
597
|
+
item: m[h],
|
|
603
598
|
items: m,
|
|
604
|
-
|
|
599
|
+
data: g?.data?.()
|
|
605
600
|
};
|
|
606
601
|
}
|
|
607
|
-
}
|
|
602
|
+
} else g?.data && (o = {
|
|
603
|
+
element: a,
|
|
604
|
+
placement: u ?? c,
|
|
605
|
+
index: -1,
|
|
606
|
+
item: void 0,
|
|
607
|
+
items: [],
|
|
608
|
+
data: g.data()
|
|
609
|
+
});
|
|
608
610
|
}
|
|
609
611
|
}
|
|
610
612
|
return {
|
|
@@ -617,26 +619,26 @@ const E = (e, t) => {
|
|
|
617
619
|
}, B = (e, t, s) => {
|
|
618
620
|
if (!t) return;
|
|
619
621
|
const n = e.entities.draggingMap.get(t) ?? e.entities.draggableMap.get(t);
|
|
620
|
-
!n || n.disabled || n.events?.[s]?.(
|
|
621
|
-
},
|
|
622
|
-
const s =
|
|
622
|
+
!n || n.disabled || n.events?.[s]?.(A(e));
|
|
623
|
+
}, x = (e, t) => {
|
|
624
|
+
const s = A(e);
|
|
623
625
|
e.entities.draggingMap.forEach((n) => {
|
|
624
626
|
n.disabled || n.events?.[t]?.(s);
|
|
625
627
|
});
|
|
626
628
|
}, It = (e, t, s) => {
|
|
627
629
|
if (t !== s) {
|
|
628
630
|
if (t && !_(t, e)) {
|
|
629
|
-
const n =
|
|
631
|
+
const n = A(e, t);
|
|
630
632
|
e.entities.droppableMap.get(t)?.events?.onLeave?.(n);
|
|
631
633
|
}
|
|
632
634
|
if (s && !_(s, e)) {
|
|
633
|
-
const n =
|
|
635
|
+
const n = A(e, s);
|
|
634
636
|
e.entities.droppableMap.get(s)?.events?.onEnter?.(n);
|
|
635
637
|
}
|
|
636
638
|
}
|
|
637
639
|
}, Rt = (e, t, s) => {
|
|
638
640
|
if (t !== s) {
|
|
639
|
-
const n =
|
|
641
|
+
const n = A(e);
|
|
640
642
|
if (t) {
|
|
641
643
|
const o = e.entities.draggableMap.get(t);
|
|
642
644
|
o && !o.disabled && o.events?.onLeave?.(n);
|
|
@@ -648,23 +650,23 @@ const E = (e, t) => {
|
|
|
648
650
|
}
|
|
649
651
|
}, ce = (e, t, s) => {
|
|
650
652
|
const n = Lt(t);
|
|
651
|
-
!n || !e.entities.draggingMap.has(n) || e.entities.draggingMap.get(n)?.events?.[s]?.(
|
|
653
|
+
!n || !e.entities.draggingMap.has(n) || e.entities.draggingMap.get(n)?.events?.[s]?.(A(e));
|
|
652
654
|
}, kt = (e, t) => {
|
|
653
655
|
const s = P(t.droppable);
|
|
654
|
-
s && !_(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(
|
|
656
|
+
s && !_(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(A(e, s));
|
|
655
657
|
}, Ze = (e, t) => {
|
|
656
658
|
const s = P(t.droppable);
|
|
657
|
-
s && !_(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(
|
|
659
|
+
s && !_(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(A(e, s));
|
|
658
660
|
};
|
|
659
661
|
function Pt(e) {
|
|
660
662
|
return e.parentElement?.closest(F.SELECT_AREA) ?? null;
|
|
661
663
|
}
|
|
662
664
|
const Tt = (e, t, s) => {
|
|
663
665
|
if (!s) return {};
|
|
664
|
-
const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)),
|
|
666
|
+
const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)), r = Math.max(n.top, Math.min(e.y, t.y)), a = Math.min(n.right, Math.max(e.x, t.x)), i = Math.min(n.bottom, Math.max(e.y, t.y)), g = Math.max(0, a - o), l = Math.max(0, i - r);
|
|
665
667
|
return {
|
|
666
668
|
left: `${o}px`,
|
|
667
|
-
top: `${
|
|
669
|
+
top: `${r}px`,
|
|
668
670
|
width: `${g}px`,
|
|
669
671
|
height: `${l}px`,
|
|
670
672
|
position: "fixed",
|
|
@@ -672,34 +674,34 @@ const Tt = (e, t, s) => {
|
|
|
672
674
|
border: "1px solid #3b82f6",
|
|
673
675
|
backgroundColor: "#3b82f61a"
|
|
674
676
|
};
|
|
675
|
-
},
|
|
677
|
+
}, Ot = (e) => {
|
|
676
678
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
677
|
-
const { selectingArea: t } = e.entities, s =
|
|
679
|
+
const { selectingArea: t } = e.entities, s = zt(
|
|
678
680
|
e.pointer.value.start,
|
|
679
681
|
e.pointer.value.current
|
|
680
682
|
), n = e.entities.selectableAreaMap.get(t)?.groups ?? [], o = e.lib.rectCache;
|
|
681
|
-
e.entities.visibleDraggableSet.forEach((
|
|
682
|
-
if (
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
685
|
-
e.entities.selectedSet.delete(
|
|
683
|
+
e.entities.visibleDraggableSet.forEach((r) => {
|
|
684
|
+
if (r === t || !t.contains(r)) return;
|
|
685
|
+
const a = Pt(r);
|
|
686
|
+
if (a && a !== t) {
|
|
687
|
+
e.entities.selectedSet.delete(r);
|
|
686
688
|
return;
|
|
687
689
|
}
|
|
688
|
-
if (Me(
|
|
689
|
-
e.entities.selectedSet.delete(
|
|
690
|
+
if (Me(r, e)) {
|
|
691
|
+
e.entities.selectedSet.delete(r);
|
|
690
692
|
return;
|
|
691
693
|
}
|
|
692
|
-
const g = e.entities.draggableMap.get(
|
|
694
|
+
const g = e.entities.draggableMap.get(r)?.groups ?? [];
|
|
693
695
|
if (!ve(n, g)) {
|
|
694
|
-
e.entities.selectedSet.delete(
|
|
696
|
+
e.entities.selectedSet.delete(r);
|
|
695
697
|
return;
|
|
696
698
|
}
|
|
697
|
-
let l = o.get(
|
|
698
|
-
l || (l =
|
|
699
|
+
let l = o.get(r);
|
|
700
|
+
l || (l = r.getBoundingClientRect(), o.set(r, l)), rt(s, l) ? e.entities.selectedSet.add(r) : e.entities.selectedSet.delete(r);
|
|
699
701
|
});
|
|
700
|
-
},
|
|
701
|
-
const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x),
|
|
702
|
-
return new DOMRect(s, n,
|
|
702
|
+
}, zt = (e, t) => {
|
|
703
|
+
const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x), r = Math.max(e.y, t.y), a = o - s, i = r - n;
|
|
704
|
+
return new DOMRect(s, n, a, i);
|
|
703
705
|
}, Bt = (e, t, s = 5) => {
|
|
704
706
|
const n = s / 2;
|
|
705
707
|
return {
|
|
@@ -711,7 +713,7 @@ const Tt = (e, t, s) => {
|
|
|
711
713
|
}, Ft = (e) => {
|
|
712
714
|
const t = e.pointer.value?.current, s = t?.x ?? 0, n = t?.y ?? 0;
|
|
713
715
|
return Bt(s, n, 5);
|
|
714
|
-
},
|
|
716
|
+
}, z = (e, t, s) => {
|
|
715
717
|
const n = e.left + e.width / 2, o = e.top + e.height / 2;
|
|
716
718
|
if (s) {
|
|
717
719
|
const i = s.top ?? 0, g = s.right ?? 0, l = s.bottom ?? 0, u = s.left ?? 0, c = t.left + u, f = t.right - g, d = t.top + i, m = t.bottom - l;
|
|
@@ -724,12 +726,12 @@ const Tt = (e, t, s) => {
|
|
|
724
726
|
center: !0
|
|
725
727
|
};
|
|
726
728
|
}
|
|
727
|
-
const
|
|
729
|
+
const r = t.left + t.width / 2, a = t.top + t.height / 2;
|
|
728
730
|
return {
|
|
729
|
-
top: o <=
|
|
730
|
-
bottom: o >
|
|
731
|
-
left: n <=
|
|
732
|
-
right: n >
|
|
731
|
+
top: o <= a,
|
|
732
|
+
bottom: o > a,
|
|
733
|
+
left: n <= r,
|
|
734
|
+
right: n > r,
|
|
733
735
|
center: !1
|
|
734
736
|
};
|
|
735
737
|
}, _t = (e) => ({
|
|
@@ -748,42 +750,42 @@ function $(e, t) {
|
|
|
748
750
|
const Ht = (e, t) => e.find((s) => s !== t && H(t, s)), ne = (e, t, s) => {
|
|
749
751
|
const n = P(t.droppable), o = P(t.draggable);
|
|
750
752
|
o && t.draggable.delete(o), n && t.droppable.delete(n);
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
const c =
|
|
753
|
+
const r = Ft(e), a = s.zones[0], i = s.elements[0];
|
|
754
|
+
if (a && i && a === i && e.entities.droppableMap.has(a) && a) {
|
|
755
|
+
const c = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = z(r, c, f);
|
|
754
756
|
if (d.center) {
|
|
755
|
-
t.droppable.set(
|
|
756
|
-
const m = Ht(s.elements,
|
|
757
|
+
t.droppable.set(a, d);
|
|
758
|
+
const m = Ht(s.elements, a);
|
|
757
759
|
if (m) {
|
|
758
760
|
const h = m.getBoundingClientRect();
|
|
759
761
|
t.draggable.set(
|
|
760
762
|
m,
|
|
761
|
-
|
|
763
|
+
z(r, h, void 0)
|
|
762
764
|
);
|
|
763
765
|
}
|
|
764
766
|
} else
|
|
765
767
|
t.draggable.set(i, d);
|
|
766
768
|
} else {
|
|
767
|
-
if (
|
|
768
|
-
const c =
|
|
769
|
-
t.droppable.set(
|
|
769
|
+
if (a) {
|
|
770
|
+
const c = a.getBoundingClientRect();
|
|
771
|
+
t.droppable.set(a, z(r, c));
|
|
770
772
|
}
|
|
771
773
|
if (i)
|
|
772
|
-
if (
|
|
773
|
-
if (H(
|
|
774
|
+
if (a)
|
|
775
|
+
if (H(a, i)) {
|
|
774
776
|
const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
|
|
775
777
|
t.draggable.set(
|
|
776
778
|
i,
|
|
777
|
-
|
|
779
|
+
z(r, c, f)
|
|
778
780
|
);
|
|
779
781
|
} else {
|
|
780
|
-
const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f =
|
|
782
|
+
const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = i.getBoundingClientRect(), m = Le(c, f);
|
|
781
783
|
if (Le(c, d) < m) {
|
|
782
784
|
t.droppable.clear();
|
|
783
|
-
const
|
|
785
|
+
const S = e.entities.draggableMap.get(i)?.placementMargins;
|
|
784
786
|
t.draggable.set(
|
|
785
787
|
i,
|
|
786
|
-
|
|
788
|
+
z(r, d, S)
|
|
787
789
|
);
|
|
788
790
|
}
|
|
789
791
|
}
|
|
@@ -791,7 +793,7 @@ const Ht = (e, t) => e.find((s) => s !== t && H(t, s)), ne = (e, t, s) => {
|
|
|
791
793
|
const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
|
|
792
794
|
t.draggable.set(
|
|
793
795
|
i,
|
|
794
|
-
|
|
796
|
+
z(r, c, f)
|
|
795
797
|
);
|
|
796
798
|
}
|
|
797
799
|
}
|
|
@@ -837,26 +839,26 @@ const Ht = (e, t) => e.find((s) => s !== t && H(t, s)), ne = (e, t, s) => {
|
|
|
837
839
|
), n = Math.max(
|
|
838
840
|
0,
|
|
839
841
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
840
|
-
), o = s * n,
|
|
841
|
-
return
|
|
842
|
+
), o = s * n, r = e.width * e.height, a = t.width * t.height;
|
|
843
|
+
return r === 0 || a === 0 ? 0 : (o / r * 100 + o / a * 100) / 2;
|
|
842
844
|
}, Nt = (e, t, s) => t >= e.x && t <= e.x + e.width && s >= e.y && s <= e.y + e.height, Zt = (e) => e.overlay.ref?.value ?? null, Yt = (e) => {
|
|
843
845
|
const t = e.overlay.position?.value ?? { x: 0, y: 0 }, { x: s, y: n } = t, o = e.overlay.size?.value;
|
|
844
|
-
let
|
|
846
|
+
let r, a;
|
|
845
847
|
if (o)
|
|
846
|
-
|
|
848
|
+
r = o.width, a = o.height;
|
|
847
849
|
else {
|
|
848
850
|
const i = e.overlay.ref?.value?.getBoundingClientRect();
|
|
849
|
-
|
|
851
|
+
r = i?.width ?? 0, a = i?.height ?? 0;
|
|
850
852
|
}
|
|
851
853
|
return {
|
|
852
854
|
x: s,
|
|
853
855
|
y: n,
|
|
854
|
-
width:
|
|
855
|
-
height:
|
|
856
|
+
width: r,
|
|
857
|
+
height: a,
|
|
856
858
|
top: n,
|
|
857
859
|
left: s,
|
|
858
|
-
right: s +
|
|
859
|
-
bottom: n +
|
|
860
|
+
right: s + r,
|
|
861
|
+
bottom: n + a
|
|
860
862
|
};
|
|
861
863
|
}, Ye = (e) => e.entities.allowedDraggableSet, Xe = (e) => e.entities.allowedDroppableSet, Xt = (e, t) => !t.entities.draggingMap.has(e), Ut = (e, t) => ![...t.entities.draggingMap.keys()].some(
|
|
862
864
|
(s) => H(s, e)
|
|
@@ -868,24 +870,24 @@ function q(e, t) {
|
|
|
868
870
|
);
|
|
869
871
|
}
|
|
870
872
|
function $t(e) {
|
|
871
|
-
const t = e.pointer.value?.current ?? { x: 0, y: 0 }, s = document.elementsFromPoint(t.x, t.y), n = Ye(e), o = Xe(e),
|
|
873
|
+
const t = e.pointer.value?.current ?? { x: 0, y: 0 }, s = document.elementsFromPoint(t.x, t.y), n = Ye(e), o = Xe(e), r = [], a = [];
|
|
872
874
|
for (const i of s) {
|
|
873
875
|
const g = n.has(i), l = o.has(i);
|
|
874
|
-
!g && !l || ye(i, e) && (g &&
|
|
876
|
+
!g && !l || ye(i, e) && (g && r.push(i), l && a.push(i));
|
|
875
877
|
}
|
|
876
|
-
return
|
|
878
|
+
return r.length === 0 && a.length === 0 ? null : { elements: r, zones: a };
|
|
877
879
|
}
|
|
878
880
|
const pe = (e) => {
|
|
879
881
|
if (!Zt(e)) return { elements: [], zones: [] };
|
|
880
882
|
const s = $t(e);
|
|
881
883
|
if (s) return s;
|
|
882
|
-
const n = Yt(e), o = e.pointer.value?.current ?? { x: 0, y: 0 },
|
|
884
|
+
const n = Yt(e), o = e.pointer.value?.current ?? { x: 0, y: 0 }, r = [...Ye(e)].filter(
|
|
883
885
|
(l) => ye(l, e)
|
|
884
|
-
),
|
|
886
|
+
), a = [...Xe(e)].filter(
|
|
885
887
|
(l) => ye(l, e)
|
|
886
|
-
), i =
|
|
888
|
+
), i = r.map((l) => ({ n: l, box: se(l) })).filter(
|
|
887
889
|
({ box: l }) => Ce(l, n) && be(l, n) >= Ie
|
|
888
|
-
).sort((l, u) => q(l.box, o) - q(u.box, o)).map(({ n: l }) => l), g =
|
|
890
|
+
).sort((l, u) => q(l.box, o) - q(u.box, o)).map(({ n: l }) => l), g = a.map((l) => ({ n: l, box: se(l) })).filter(
|
|
889
891
|
({ box: l }) => Ce(l, n) && be(l, n) >= Ie
|
|
890
892
|
).sort((l, u) => q(l.box, o) - q(u.box, o)).map(({ n: l }) => l);
|
|
891
893
|
return { elements: i, zones: g };
|
|
@@ -911,23 +913,23 @@ function qt(e, t) {
|
|
|
911
913
|
async function Ue(e) {
|
|
912
914
|
const t = e.hovered.droppable.keys().next().value;
|
|
913
915
|
if (!t || _(t, e)) return "accept";
|
|
914
|
-
const s = e.entities.droppableMap.get(t), n =
|
|
916
|
+
const s = e.entities.droppableMap.get(t), n = A(e, t), o = s?.events?.onDrop?.(n);
|
|
915
917
|
if (o != null && typeof o.then == "function") {
|
|
916
918
|
e.state.value = "pending";
|
|
917
|
-
let
|
|
919
|
+
let a;
|
|
918
920
|
try {
|
|
919
|
-
|
|
921
|
+
a = await o;
|
|
920
922
|
} catch {
|
|
921
923
|
const i = e.entities.initiatingDraggable;
|
|
922
|
-
return B(e, i, "onSelfDragCancel"),
|
|
924
|
+
return B(e, i, "onSelfDragCancel"), x(e, "onDragCancel"), Ze(e, e.hovered), "cancel";
|
|
923
925
|
}
|
|
924
|
-
return
|
|
926
|
+
return a === !1 ? (e.state.value = "dragging", "decline") : "accept";
|
|
925
927
|
}
|
|
926
928
|
return o === !1 ? "decline" : "accept";
|
|
927
929
|
}
|
|
928
930
|
function Ve(e) {
|
|
929
931
|
const t = e.entities.initiatingDraggable;
|
|
930
|
-
B(e, t, "onSelfDragEnd"),
|
|
932
|
+
B(e, t, "onSelfDragEnd"), x(e, "onDragEnd"), kt(e, e.hovered);
|
|
931
933
|
}
|
|
932
934
|
function Wt(e) {
|
|
933
935
|
const t = e.entities.selectingArea;
|
|
@@ -953,15 +955,15 @@ const jt = (e) => {
|
|
|
953
955
|
}, o = (i) => {
|
|
954
956
|
if (e.pointer.value) {
|
|
955
957
|
if (e.pointer.value.current = { x: i.clientX, y: i.clientY }, ht(e)) {
|
|
956
|
-
ce(e, i, "onSelfDragStart"),
|
|
958
|
+
ce(e, i, "onSelfDragStart"), x(e, "onDragStart");
|
|
957
959
|
return;
|
|
958
960
|
}
|
|
959
961
|
if (e.state.value === "dragging") {
|
|
960
962
|
qt(e, s);
|
|
961
963
|
const g = e.entities.initiatingDraggable;
|
|
962
|
-
B(e, g, "onSelfDragMove"),
|
|
964
|
+
B(e, g, "onSelfDragMove"), x(e, "onDragMove");
|
|
963
965
|
}
|
|
964
|
-
e.state.value === "selecting" &&
|
|
966
|
+
e.state.value === "selecting" && Ot(e);
|
|
965
967
|
}
|
|
966
968
|
};
|
|
967
969
|
return { pointerDown: (i) => {
|
|
@@ -982,8 +984,8 @@ const jt = (e) => {
|
|
|
982
984
|
de(), e.entities.initiatingDraggable = u;
|
|
983
985
|
const f = Fe(i, u);
|
|
984
986
|
e.pointer.value = he(i, f.x, f.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = bt(e, () => {
|
|
985
|
-
ee(e), ce(e, i, "onSelfDragStart"),
|
|
986
|
-
}))) : (ee(e), ce(e, i, "onSelfDragStart"),
|
|
987
|
+
ee(e), ce(e, i, "onSelfDragStart"), x(e, "onDragStart");
|
|
988
|
+
}))) : (ee(e), ce(e, i, "onSelfDragStart"), x(e, "onDragStart"));
|
|
987
989
|
}
|
|
988
990
|
}, pointerUp: n, pointerMove: o, cleanup: () => {
|
|
989
991
|
t.current?.cancel(), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect(), e.lib.overlaySizeObserver.disconnect();
|
|
@@ -1005,7 +1007,7 @@ const jt = (e) => {
|
|
|
1005
1007
|
e,
|
|
1006
1008
|
e.entities.initiatingDraggable,
|
|
1007
1009
|
"onSelfDragCancel"
|
|
1008
|
-
),
|
|
1010
|
+
), x(e, "onDragCancel"), Ze(e, e.hovered), te(e);
|
|
1009
1011
|
return;
|
|
1010
1012
|
}
|
|
1011
1013
|
if (s.forDrop.includes(t.code)) {
|
|
@@ -1015,19 +1017,19 @@ const jt = (e) => {
|
|
|
1015
1017
|
const o = Jt[t.code];
|
|
1016
1018
|
if (o && s.forMove.includes(t.code) && e.pointer.value) {
|
|
1017
1019
|
t.preventDefault();
|
|
1018
|
-
const
|
|
1020
|
+
const r = s.forMoveFaster.some(
|
|
1019
1021
|
(l) => s.pressedKeys.value.has(l)
|
|
1020
|
-
),
|
|
1022
|
+
), a = e.keyboard.step * (r ? e.keyboard.moveFaster : 1);
|
|
1021
1023
|
e.pointer.value.current = {
|
|
1022
|
-
x: e.pointer.value.current.x + o.dx *
|
|
1023
|
-
y: e.pointer.value.current.y + o.dy *
|
|
1024
|
+
x: e.pointer.value.current.x + o.dx * a,
|
|
1025
|
+
y: e.pointer.value.current.y + o.dy * a
|
|
1024
1026
|
};
|
|
1025
1027
|
const g = (e.collision?.run ?? pe)(e);
|
|
1026
1028
|
ne(e, e.hovered, g), B(
|
|
1027
1029
|
e,
|
|
1028
1030
|
e.entities.initiatingDraggable,
|
|
1029
1031
|
"onSelfDragMove"
|
|
1030
|
-
),
|
|
1032
|
+
), x(e, "onDragMove");
|
|
1031
1033
|
return;
|
|
1032
1034
|
}
|
|
1033
1035
|
return;
|
|
@@ -1035,28 +1037,28 @@ const jt = (e) => {
|
|
|
1035
1037
|
if (s.forDrag.includes(t.code)) {
|
|
1036
1038
|
const o = document.activeElement;
|
|
1037
1039
|
if (!o) return;
|
|
1038
|
-
const
|
|
1040
|
+
const r = o.closest(
|
|
1039
1041
|
F.DRAGGABLE
|
|
1040
1042
|
);
|
|
1041
|
-
if (!
|
|
1043
|
+
if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
|
|
1042
1044
|
return;
|
|
1043
|
-
const
|
|
1044
|
-
if (!Ge(o,
|
|
1045
|
+
const a = e.entities.draggableMap.get(r);
|
|
1046
|
+
if (!Ge(o, r, a?.dragHandle, !0))
|
|
1045
1047
|
return;
|
|
1046
1048
|
t.preventDefault(), de();
|
|
1047
|
-
const i =
|
|
1049
|
+
const i = r.getBoundingClientRect(), g = i.left + i.width / 2, l = i.top + i.height / 2, u = {
|
|
1048
1050
|
clientX: g,
|
|
1049
1051
|
clientY: l
|
|
1050
1052
|
};
|
|
1051
|
-
e.entities.initiatingDraggable =
|
|
1052
|
-
const c = Fe(u,
|
|
1053
|
+
e.entities.initiatingDraggable = r;
|
|
1054
|
+
const c = Fe(u, r);
|
|
1053
1055
|
e.pointer.value = he(
|
|
1054
1056
|
u,
|
|
1055
1057
|
c.x,
|
|
1056
1058
|
c.y
|
|
1057
1059
|
), ee(e);
|
|
1058
1060
|
const d = (e.collision?.run ?? pe)(e);
|
|
1059
|
-
ne(e, e.hovered, d), B(e,
|
|
1061
|
+
ne(e, e.hovered, d), B(e, r, "onSelfDragStart"), x(e, "onDragStart");
|
|
1060
1062
|
}
|
|
1061
1063
|
}, en = (e) => (t) => {
|
|
1062
1064
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
@@ -1087,7 +1089,7 @@ function on(e) {
|
|
|
1087
1089
|
left: e.left ?? L
|
|
1088
1090
|
};
|
|
1089
1091
|
}
|
|
1090
|
-
const
|
|
1092
|
+
const an = {
|
|
1091
1093
|
getScrollState(e) {
|
|
1092
1094
|
return {
|
|
1093
1095
|
scrollTop: e.scrollTop,
|
|
@@ -1098,29 +1100,29 @@ const rn = {
|
|
|
1098
1100
|
e.scrollTop = t, e.scrollLeft = s;
|
|
1099
1101
|
}
|
|
1100
1102
|
};
|
|
1101
|
-
function $e(e, t, s, n =
|
|
1102
|
-
const { speed:
|
|
1103
|
+
function $e(e, t, s, n = an, o) {
|
|
1104
|
+
const { speed: r = 10, disabled: a = !1 } = t, i = on(t.threshold);
|
|
1103
1105
|
let g = null, l = null, u = null, c = 0, f = 0;
|
|
1104
|
-
const d = (
|
|
1105
|
-
o && (o.value =
|
|
1106
|
-
}, m = (
|
|
1107
|
-
const
|
|
1108
|
-
if (!
|
|
1106
|
+
const d = (b) => {
|
|
1107
|
+
o && (o.value = b);
|
|
1108
|
+
}, m = (b) => {
|
|
1109
|
+
const v = e.value, E = s();
|
|
1110
|
+
if (!v || !E || a) {
|
|
1109
1111
|
d(!1);
|
|
1110
1112
|
return;
|
|
1111
1113
|
}
|
|
1112
|
-
l || (l =
|
|
1113
|
-
const U =
|
|
1114
|
+
l || (l = b);
|
|
1115
|
+
const U = b - l;
|
|
1114
1116
|
if (U < Re) {
|
|
1115
1117
|
g = requestAnimationFrame(m);
|
|
1116
1118
|
return;
|
|
1117
1119
|
}
|
|
1118
|
-
const
|
|
1119
|
-
l =
|
|
1120
|
-
const { scrollTop:
|
|
1121
|
-
(!u || c !==
|
|
1122
|
-
let
|
|
1123
|
-
i.top > 0 &&
|
|
1120
|
+
const p = r * (U / Re);
|
|
1121
|
+
l = b;
|
|
1122
|
+
const { scrollTop: w, scrollLeft: K } = n.getScrollState(v);
|
|
1123
|
+
(!u || c !== w || f !== K) && (u = n.getRect ? n.getRect(v) : v.getBoundingClientRect(), c = w, f = K);
|
|
1124
|
+
let O = !1, re = w, ie = K;
|
|
1125
|
+
i.top > 0 && E.y - u.top < i.top ? (re = w - p, O = !0) : i.bottom > 0 && u.bottom - E.y < i.bottom && (re = w + p, O = !0), i.left > 0 && E.x - u.left < i.left ? (ie = K - p, O = !0) : i.right > 0 && u.right - E.x < i.right && (ie = K + p, O = !0), O && n.setScroll(v, re, ie), d(O), g = requestAnimationFrame(m);
|
|
1124
1126
|
};
|
|
1125
1127
|
return { run: () => {
|
|
1126
1128
|
l = null, g = requestAnimationFrame(m);
|
|
@@ -1128,7 +1130,7 @@ function $e(e, t, s, n = rn, o) {
|
|
|
1128
1130
|
g && (cancelAnimationFrame(g), g = null), u = null, c = 0, f = 0, l = null, d(!1);
|
|
1129
1131
|
} };
|
|
1130
1132
|
}
|
|
1131
|
-
const
|
|
1133
|
+
const rn = {
|
|
1132
1134
|
getScrollState() {
|
|
1133
1135
|
return {
|
|
1134
1136
|
scrollTop: window.scrollY ?? document.documentElement.scrollTop,
|
|
@@ -1158,41 +1160,41 @@ function cn(e, t) {
|
|
|
1158
1160
|
y: i.y + g.height / 2
|
|
1159
1161
|
} : i : null;
|
|
1160
1162
|
},
|
|
1161
|
-
|
|
1163
|
+
rn,
|
|
1162
1164
|
s
|
|
1163
|
-
),
|
|
1165
|
+
), r = oe(
|
|
1164
1166
|
() => e.state.value,
|
|
1165
1167
|
(i) => {
|
|
1166
1168
|
i === "dragging" ? o.run() : o.stop();
|
|
1167
1169
|
}
|
|
1168
|
-
),
|
|
1169
|
-
|
|
1170
|
+
), a = () => {
|
|
1171
|
+
r(), o.stop();
|
|
1170
1172
|
};
|
|
1171
|
-
return We(
|
|
1173
|
+
return We(a), { isScrolling: s, stop: a };
|
|
1172
1174
|
}
|
|
1173
1175
|
const gn = (e) => {
|
|
1174
|
-
const t = jt(e), s = ge.keyDown(e), n = ge.keyUp(e), o = ge.clear(e),
|
|
1175
|
-
let
|
|
1176
|
+
const t = jt(e), s = ge.keyDown(e), n = ge.keyUp(e), o = ge.clear(e), r = nn(e);
|
|
1177
|
+
let a = null;
|
|
1176
1178
|
oe(
|
|
1177
1179
|
e.autoScrollViewport,
|
|
1178
1180
|
(i) => {
|
|
1179
|
-
|
|
1181
|
+
a?.(), a = null, (i === !0 || i && typeof i == "object") && (a = cn(
|
|
1180
1182
|
e,
|
|
1181
1183
|
i === !0 ? {} : i
|
|
1182
1184
|
).stop);
|
|
1183
1185
|
},
|
|
1184
1186
|
{ immediate: !0 }
|
|
1185
1187
|
), Y(() => {
|
|
1186
|
-
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll",
|
|
1188
|
+
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll", r, !0);
|
|
1187
1189
|
}), X(() => {
|
|
1188
|
-
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll",
|
|
1190
|
+
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll", r, !0), a?.(), t.cleanup();
|
|
1189
1191
|
});
|
|
1190
|
-
},
|
|
1191
|
-
const e =
|
|
1192
|
+
}, ae = () => {
|
|
1193
|
+
const e = Oe(De);
|
|
1192
1194
|
if (!e) throw Error("DnD provider not found");
|
|
1193
1195
|
return e;
|
|
1194
1196
|
}, qe = () => {
|
|
1195
|
-
const e =
|
|
1197
|
+
const e = ae();
|
|
1196
1198
|
return {
|
|
1197
1199
|
overlay: e.overlay,
|
|
1198
1200
|
delay: e.delay,
|
|
@@ -1206,11 +1208,11 @@ const gn = (e) => {
|
|
|
1206
1208
|
collision: e.collision,
|
|
1207
1209
|
autoScrollViewport: e.autoScrollViewport
|
|
1208
1210
|
};
|
|
1209
|
-
}, un = /* @__PURE__ */
|
|
1211
|
+
}, un = /* @__PURE__ */ ze({
|
|
1210
1212
|
__name: "DefaultOverlay",
|
|
1211
1213
|
setup(e) {
|
|
1212
1214
|
const { entities: t, state: s, overlay: n } = qe();
|
|
1213
|
-
return (o,
|
|
1215
|
+
return (o, r) => k(s) === "dragging" ? (C(), j("div", {
|
|
1214
1216
|
key: 0,
|
|
1215
1217
|
class: "dnd-kit-default-overlay",
|
|
1216
1218
|
style: xe({
|
|
@@ -1218,8 +1220,8 @@ const gn = (e) => {
|
|
|
1218
1220
|
"--position-y": k(n).position.value.y + "px"
|
|
1219
1221
|
})
|
|
1220
1222
|
}, [
|
|
1221
|
-
(C(!0), j(ue, null, je(k(t).draggingMap, ([
|
|
1222
|
-
k(t).draggableMap.get(
|
|
1223
|
+
(C(!0), j(ue, null, je(k(t).draggingMap, ([a, i]) => (C(), j(ue, null, [
|
|
1224
|
+
k(t).draggableMap.get(a)?.render ? (C(), Q(fe(k(t).draggableMap.get(a)?.render), { key: 0 })) : (C(), Q(fe(a.tagName), {
|
|
1223
1225
|
key: 1,
|
|
1224
1226
|
innerHTML: i.initialOuterHTML,
|
|
1225
1227
|
style: xe({
|
|
@@ -1230,7 +1232,7 @@ const gn = (e) => {
|
|
|
1230
1232
|
], 64))), 256))
|
|
1231
1233
|
], 4)) : Je("", !0);
|
|
1232
1234
|
}
|
|
1233
|
-
}), hn = /* @__PURE__ */
|
|
1235
|
+
}), hn = /* @__PURE__ */ ze({
|
|
1234
1236
|
__name: "DnDProvider",
|
|
1235
1237
|
props: {
|
|
1236
1238
|
autoScrollViewport: { type: [Object, Boolean, null] },
|
|
@@ -1241,11 +1243,11 @@ const gn = (e) => {
|
|
|
1241
1243
|
setup(e) {
|
|
1242
1244
|
const t = e, s = Qe("overlayRef"), n = Mt(s, t);
|
|
1243
1245
|
gn(n);
|
|
1244
|
-
const o =
|
|
1246
|
+
const o = y(
|
|
1245
1247
|
() => n.overlay.render.value ?? un
|
|
1246
1248
|
);
|
|
1247
|
-
return et(De, n), (
|
|
1248
|
-
Ae(
|
|
1249
|
+
return et(De, n), (r, a) => (C(), j(ue, null, [
|
|
1250
|
+
Ae(r.$slots, "default"),
|
|
1249
1251
|
(C(), Q(tt, {
|
|
1250
1252
|
to: k(n).overlay.to.value || "body"
|
|
1251
1253
|
}, [
|
|
@@ -1254,7 +1256,7 @@ const gn = (e) => {
|
|
|
1254
1256
|
ref: s,
|
|
1255
1257
|
class: "dnd-kit-overlay-container"
|
|
1256
1258
|
}, t), [
|
|
1257
|
-
Ae(
|
|
1259
|
+
Ae(r.$slots, "overlay", { overlay: o.value }, () => [
|
|
1258
1260
|
(C(), Q(fe(o.value)))
|
|
1259
1261
|
])
|
|
1260
1262
|
], 16)
|
|
@@ -1263,44 +1265,45 @@ const gn = (e) => {
|
|
|
1263
1265
|
}
|
|
1264
1266
|
});
|
|
1265
1267
|
function bn(e, t, s) {
|
|
1266
|
-
const n =
|
|
1267
|
-
let o,
|
|
1268
|
-
typeof t == "function" ? (o = {},
|
|
1269
|
-
const i =
|
|
1268
|
+
const n = ae();
|
|
1269
|
+
let o, r, a;
|
|
1270
|
+
typeof t == "function" ? (o = {}, r = t) : (o = t ?? {}, r = s);
|
|
1271
|
+
const i = y({
|
|
1270
1272
|
get() {
|
|
1271
|
-
const c =
|
|
1273
|
+
const c = D(e);
|
|
1272
1274
|
return c ? n.entities.selectedSet.has(c) : !1;
|
|
1273
1275
|
},
|
|
1274
1276
|
set(c) {
|
|
1275
|
-
const f =
|
|
1277
|
+
const f = D(e);
|
|
1276
1278
|
f && n.entities.selectedSet[c ? "add" : "delete"](f);
|
|
1277
1279
|
}
|
|
1278
|
-
}), g =
|
|
1279
|
-
const c =
|
|
1280
|
+
}), g = y(() => {
|
|
1281
|
+
const c = D(e);
|
|
1280
1282
|
return c ? n.entities.draggingMap.has(c) : !1;
|
|
1281
|
-
}), l =
|
|
1282
|
-
const c =
|
|
1283
|
+
}), l = y(() => {
|
|
1284
|
+
const c = D(e);
|
|
1283
1285
|
return c ? n.entities.allowedDraggableSet.has(c) : !1;
|
|
1284
|
-
}), u =
|
|
1285
|
-
const c =
|
|
1286
|
+
}), u = y(() => {
|
|
1287
|
+
const c = D(e);
|
|
1286
1288
|
if (c)
|
|
1287
1289
|
return n.entities.draggableMap.get(c)?.hoveredPlacement;
|
|
1288
1290
|
});
|
|
1289
1291
|
return Y(() => {
|
|
1290
|
-
|
|
1292
|
+
a = D(e), a && (a.addEventListener("dragstart", M), a.addEventListener("drag", M), a.addEventListener("dragend", M), a.setAttribute(T.DRAGGABLE, ""), n.lib.draggableObserver.observe(a), n.entities.draggableMap.set(a, {
|
|
1291
1293
|
render: o.render,
|
|
1292
1294
|
disabled: o.disabled ?? !1,
|
|
1293
1295
|
groups: o.groups ?? [],
|
|
1294
1296
|
modifier: o.modifier,
|
|
1295
1297
|
events: o.events,
|
|
1296
|
-
payload:
|
|
1298
|
+
payload: r,
|
|
1299
|
+
data: o.data,
|
|
1297
1300
|
dragHandle: o.dragHandle,
|
|
1298
1301
|
activation: o.activation,
|
|
1299
1302
|
placementMargins: o.placementMargins,
|
|
1300
1303
|
hoveredPlacement: void 0
|
|
1301
1304
|
}));
|
|
1302
1305
|
}), X(() => {
|
|
1303
|
-
|
|
1306
|
+
a && (n.lib.draggableObserver.unobserve(a), n.entities.visibleDraggableSet.delete(a), n.entities.draggableMap.delete(a), n.entities.modifiersDraggableSet.delete(a));
|
|
1304
1307
|
}), {
|
|
1305
1308
|
selected: i,
|
|
1306
1309
|
isDragging: g,
|
|
@@ -1309,10 +1312,10 @@ function bn(e, t, s) {
|
|
|
1309
1312
|
};
|
|
1310
1313
|
}
|
|
1311
1314
|
const yn = (e, t) => {
|
|
1312
|
-
const s =
|
|
1315
|
+
const s = ae(), n = y(() => e.value === s.entities.selectingArea);
|
|
1313
1316
|
let o = null;
|
|
1314
1317
|
Y(() => {
|
|
1315
|
-
o =
|
|
1318
|
+
o = D(e), o && (o.setAttribute(T.SELECT_AREA, ""), s.lib.selectableAreaObserver.observe(o), s.entities.selectableAreaMap.set(o, {
|
|
1316
1319
|
modifier: t?.modifier ?? {
|
|
1317
1320
|
keys: ["ControlLeft"],
|
|
1318
1321
|
method: "every"
|
|
@@ -1324,22 +1327,22 @@ const yn = (e, t) => {
|
|
|
1324
1327
|
}), X(() => {
|
|
1325
1328
|
o && (s.lib.selectableAreaObserver.unobserve(o), s.entities.visibleSelectableAreaSet.delete(o), s.entities.modifiersSelectableAreaSet.delete(o), s.entities.selectableAreaMap.delete(o));
|
|
1326
1329
|
});
|
|
1327
|
-
const
|
|
1330
|
+
const r = y(() => {
|
|
1328
1331
|
s.scrollPosition.x, s.scrollPosition.y;
|
|
1329
|
-
const
|
|
1330
|
-
return !
|
|
1332
|
+
const a = s.pointer.value;
|
|
1333
|
+
return !a || s.state.value !== "selecting" || !o || !n.value ? {} : Tt(a.start, a.current, o);
|
|
1331
1334
|
});
|
|
1332
1335
|
return {
|
|
1333
1336
|
isSelecting: n,
|
|
1334
|
-
style:
|
|
1337
|
+
style: r
|
|
1335
1338
|
};
|
|
1336
1339
|
};
|
|
1337
1340
|
function pn(e, t) {
|
|
1338
|
-
const s =
|
|
1341
|
+
const s = Oe(De);
|
|
1339
1342
|
if (!s) throw Error("DnD provider not found");
|
|
1340
1343
|
let n = null;
|
|
1341
1344
|
return Y(() => {
|
|
1342
|
-
n =
|
|
1345
|
+
n = D(e), n && (n.setAttribute(T.CONSTRAINT_AREA, ""), s.entities.constraintsAreaMap.set(n, {
|
|
1343
1346
|
axis: t?.axis || "both",
|
|
1344
1347
|
restrictToArea: t?.restrictToArea || !1
|
|
1345
1348
|
}));
|
|
@@ -1348,23 +1351,24 @@ function pn(e, t) {
|
|
|
1348
1351
|
}), {};
|
|
1349
1352
|
}
|
|
1350
1353
|
function Sn(e, t, s) {
|
|
1351
|
-
const n =
|
|
1352
|
-
let o = null,
|
|
1353
|
-
typeof t == "function" ? (
|
|
1354
|
-
const i =
|
|
1355
|
-
const l =
|
|
1354
|
+
const n = ae();
|
|
1355
|
+
let o = null, r, a;
|
|
1356
|
+
typeof t == "function" ? (r = {}, a = t) : (r = t ?? {}, a = s);
|
|
1357
|
+
const i = y(() => {
|
|
1358
|
+
const l = D(e);
|
|
1356
1359
|
return l ? n.entities.allowedDroppableSet.has(l) : !1;
|
|
1357
|
-
}), g =
|
|
1358
|
-
const l =
|
|
1360
|
+
}), g = y(() => {
|
|
1361
|
+
const l = D(e);
|
|
1359
1362
|
if (l)
|
|
1360
1363
|
return n.entities.droppableMap.get(l)?.hoveredPlacement;
|
|
1361
1364
|
});
|
|
1362
1365
|
return Y(() => {
|
|
1363
|
-
o =
|
|
1364
|
-
disabled:
|
|
1365
|
-
groups:
|
|
1366
|
-
events:
|
|
1367
|
-
payload:
|
|
1366
|
+
o = D(e), o && (o.setAttribute(T.DROPPABLE, ""), n.lib.droppableObserver.observe(o), n.entities.droppableMap.set(o, {
|
|
1367
|
+
disabled: r.disabled ?? !1,
|
|
1368
|
+
groups: r.groups ?? [],
|
|
1369
|
+
events: r.events,
|
|
1370
|
+
payload: a,
|
|
1371
|
+
data: r.data,
|
|
1368
1372
|
hoveredPlacement: void 0
|
|
1369
1373
|
}));
|
|
1370
1374
|
}), X(() => {
|
|
@@ -1375,24 +1379,24 @@ function Sn(e, t, s) {
|
|
|
1375
1379
|
};
|
|
1376
1380
|
}
|
|
1377
1381
|
const Dn = (e, t) => {
|
|
1378
|
-
const s = qe(), n = J(!1),
|
|
1382
|
+
const s = qe(), n = J(!1), r = $e(
|
|
1379
1383
|
e,
|
|
1380
1384
|
t ?? {},
|
|
1381
1385
|
() => {
|
|
1382
1386
|
if (s.state.value !== "dragging") return null;
|
|
1383
|
-
const
|
|
1384
|
-
return
|
|
1385
|
-
x:
|
|
1386
|
-
y:
|
|
1387
|
-
} :
|
|
1387
|
+
const a = s.overlay.position.value, i = s.overlay.size.value;
|
|
1388
|
+
return a ? i?.width && i?.height ? {
|
|
1389
|
+
x: a.x + i.width / 2,
|
|
1390
|
+
y: a.y + i.height / 2
|
|
1391
|
+
} : a : null;
|
|
1388
1392
|
},
|
|
1389
1393
|
void 0,
|
|
1390
1394
|
n
|
|
1391
1395
|
);
|
|
1392
1396
|
return oe(
|
|
1393
1397
|
() => s.state.value,
|
|
1394
|
-
(
|
|
1395
|
-
|
|
1398
|
+
(a) => {
|
|
1399
|
+
a === "dragging" ? r.run() : r.stop();
|
|
1396
1400
|
}
|
|
1397
1401
|
), { isScrolling: n };
|
|
1398
1402
|
};
|
|
@@ -1401,11 +1405,11 @@ function ke(e, t) {
|
|
|
1401
1405
|
}
|
|
1402
1406
|
function Mn(e, t) {
|
|
1403
1407
|
const s = t && "grid" in t && t.grid != null, n = t ? s ? t.grid : t.gridX : 1, o = t ? s ? t.grid : t.gridY : 1;
|
|
1404
|
-
return
|
|
1405
|
-
const { x:
|
|
1408
|
+
return y(() => {
|
|
1409
|
+
const { x: r, y: a } = e.value;
|
|
1406
1410
|
return {
|
|
1407
|
-
x: ke(
|
|
1408
|
-
y: ke(
|
|
1411
|
+
x: ke(r, n),
|
|
1412
|
+
y: ke(a, o)
|
|
1409
1413
|
};
|
|
1410
1414
|
});
|
|
1411
1415
|
}
|
|
@@ -1417,24 +1421,24 @@ const Pe = () => !0, Te = () => 0, fn = "separate", dn = () => {
|
|
|
1417
1421
|
sortZones: Te,
|
|
1418
1422
|
mergeStrategy: fn,
|
|
1419
1423
|
pickClosestBetweenFirst: !1
|
|
1420
|
-
}, t = (n, o,
|
|
1421
|
-
const u =
|
|
1424
|
+
}, t = (n, o, r, a, i, g, l) => {
|
|
1425
|
+
const u = a instanceof Set ? a : new Set(a), c = { containerBox: o, pointer: r }, f = e.minOverlapPercent, d = [];
|
|
1422
1426
|
for (const m of u) {
|
|
1423
1427
|
if (!i(m, n)) continue;
|
|
1424
1428
|
const h = se(m);
|
|
1425
1429
|
if (!l(h, c)) continue;
|
|
1426
|
-
const
|
|
1427
|
-
if (f !== void 0 &&
|
|
1428
|
-
let
|
|
1429
|
-
for (const
|
|
1430
|
-
|
|
1430
|
+
const S = be(h, o);
|
|
1431
|
+
if (f !== void 0 && S < f) continue;
|
|
1432
|
+
let b = 0;
|
|
1433
|
+
for (const v of u)
|
|
1434
|
+
v !== m && H(v, m) && b++;
|
|
1431
1435
|
d.push({
|
|
1432
1436
|
node: m,
|
|
1433
1437
|
box: h,
|
|
1434
1438
|
meta: {
|
|
1435
|
-
isPointerInElement: Nt(h,
|
|
1436
|
-
overlapPercent:
|
|
1437
|
-
depth:
|
|
1439
|
+
isPointerInElement: Nt(h, r.x, r.y),
|
|
1440
|
+
overlapPercent: S,
|
|
1441
|
+
depth: b,
|
|
1438
1442
|
centerDistance: Kt(
|
|
1439
1443
|
Z(o),
|
|
1440
1444
|
Z(h)
|
|
@@ -1487,11 +1491,11 @@ const Pe = () => !0, Te = () => 0, fn = "separate", dn = () => {
|
|
|
1487
1491
|
"sensor: container, elements, zones, collision are required"
|
|
1488
1492
|
);
|
|
1489
1493
|
return (o) => {
|
|
1490
|
-
const
|
|
1491
|
-
if (!
|
|
1492
|
-
const
|
|
1494
|
+
const r = n.container(o);
|
|
1495
|
+
if (!r) return { elements: [], zones: [] };
|
|
1496
|
+
const a = n.containerBox ? n.containerBox(o) : se(r), i = o.pointer.value?.current ?? { x: 0, y: 0 }, g = t(
|
|
1493
1497
|
o,
|
|
1494
|
-
|
|
1498
|
+
a,
|
|
1495
1499
|
i,
|
|
1496
1500
|
n.elements(o),
|
|
1497
1501
|
n.filterElements,
|
|
@@ -1499,7 +1503,7 @@ const Pe = () => !0, Te = () => 0, fn = "separate", dn = () => {
|
|
|
1499
1503
|
n.collision
|
|
1500
1504
|
), l = t(
|
|
1501
1505
|
o,
|
|
1502
|
-
|
|
1506
|
+
a,
|
|
1503
1507
|
i,
|
|
1504
1508
|
n.zones(o),
|
|
1505
1509
|
n.filterZones,
|