@vue-dnd-kit/core 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var k = (n, e, t) =>
|
|
4
|
-
import { ref as V, computed as T, shallowRef as Y, onMounted as
|
|
5
|
-
import { createGlobalState as
|
|
1
|
+
var de = Object.defineProperty;
|
|
2
|
+
var fe = (n, e, t) => e in n ? de(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var k = (n, e, t) => fe(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ref as V, computed as T, shallowRef as Y, onMounted as j, onUnmounted as ge, defineComponent as ue, createElementBlock as $, createCommentVNode as me, unref as y, openBlock as X, normalizeStyle as ee, Fragment as he, renderList as pe, createBlock as q, Transition as Ee, withCtx as ye, resolveDynamicComponent as te, createVNode as xe, render as ne, useId as we, markRaw as Me, onBeforeUnmount as ce } from "vue";
|
|
5
|
+
import { createGlobalState as ve, useMagicKeys as Pe, useThrottleFn as Le } from "@vueuse/core";
|
|
6
6
|
const x = class x {
|
|
7
7
|
};
|
|
8
8
|
k(x, "remove", (e, t) => {
|
|
@@ -34,15 +34,15 @@ k(x, "remove", (e, t) => {
|
|
|
34
34
|
Array.from(
|
|
35
35
|
e.draggingElements.value.values()
|
|
36
36
|
).sort(
|
|
37
|
-
(E,
|
|
37
|
+
(E, L) => {
|
|
38
38
|
var w, I;
|
|
39
|
-
return m * ((((w = E.data) == null ? void 0 : w.index) || 0) - (((I =
|
|
39
|
+
return m * ((((w = E.data) == null ? void 0 : w.index) || 0) - (((I = L.data) == null ? void 0 : I.index) || 0));
|
|
40
40
|
}
|
|
41
41
|
).forEach(
|
|
42
42
|
(E) => {
|
|
43
|
-
var
|
|
43
|
+
var L, w;
|
|
44
44
|
return x.move(
|
|
45
|
-
(
|
|
45
|
+
(L = E.data) == null ? void 0 : L.source,
|
|
46
46
|
(w = E.data) == null ? void 0 : w.index,
|
|
47
47
|
v,
|
|
48
48
|
a
|
|
@@ -124,8 +124,8 @@ k(x, "remove", (e, t) => {
|
|
|
124
124
|
Array.from(
|
|
125
125
|
e.draggingElements.value.values()
|
|
126
126
|
).sort((m, p) => {
|
|
127
|
-
var E,
|
|
128
|
-
return (((E = p.data) == null ? void 0 : E.index) || 0) - (((
|
|
127
|
+
var E, L;
|
|
128
|
+
return (((E = p.data) == null ? void 0 : E.index) || 0) - (((L = m.data) == null ? void 0 : L.index) || 0);
|
|
129
129
|
}).forEach(
|
|
130
130
|
(m) => {
|
|
131
131
|
var p, E;
|
|
@@ -163,8 +163,8 @@ k(x, "remove", (e, t) => {
|
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
|
-
let
|
|
167
|
-
const K =
|
|
166
|
+
let re = x;
|
|
167
|
+
const K = ve(() => {
|
|
168
168
|
const n = V(
|
|
169
169
|
/* @__PURE__ */ new Map()
|
|
170
170
|
), e = T(() => n.value.size > 0), t = {
|
|
@@ -192,7 +192,7 @@ const K = ce(() => {
|
|
|
192
192
|
percent: Y(null),
|
|
193
193
|
pixel: Y(null)
|
|
194
194
|
}
|
|
195
|
-
}, { w: u, s: f, a: m, d: p, ctrl: E, shift:
|
|
195
|
+
}, { w: u, s: f, a: m, d: p, ctrl: E, shift: L, alt: w, meta: I } = Pe(), F = {
|
|
196
196
|
zone: Y(null),
|
|
197
197
|
element: Y(null)
|
|
198
198
|
};
|
|
@@ -212,19 +212,19 @@ const K = ce(() => {
|
|
|
212
212
|
a: m,
|
|
213
213
|
d: p,
|
|
214
214
|
ctrl: E,
|
|
215
|
-
shift:
|
|
215
|
+
shift: L,
|
|
216
216
|
alt: w,
|
|
217
217
|
meta: I
|
|
218
218
|
},
|
|
219
|
-
hovered:
|
|
219
|
+
hovered: F,
|
|
220
220
|
handleDragElementIntersection: d,
|
|
221
221
|
handleDropZoneIntersection: v
|
|
222
222
|
};
|
|
223
223
|
}), Ae = (n) => {
|
|
224
224
|
const e = V(null), { draggingElements: t, pointerPosition: r, isDragging: l, activeContainer: s } = K();
|
|
225
|
-
return
|
|
225
|
+
return j(() => {
|
|
226
226
|
s.ref = e, s.options.value = n ?? null;
|
|
227
|
-
}),
|
|
227
|
+
}), ge(() => {
|
|
228
228
|
s.ref.value = null, s.options.value = null;
|
|
229
229
|
}), {
|
|
230
230
|
elementRef: e,
|
|
@@ -232,7 +232,7 @@ const K = ce(() => {
|
|
|
232
232
|
pointerPosition: r,
|
|
233
233
|
isDragging: l
|
|
234
234
|
};
|
|
235
|
-
},
|
|
235
|
+
}, _e = ["innerHTML"], Se = /* @__PURE__ */ ue({
|
|
236
236
|
__name: "DefaultOverlay",
|
|
237
237
|
setup(n) {
|
|
238
238
|
const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: l } = Ae(), s = T(() => {
|
|
@@ -246,32 +246,32 @@ const K = ce(() => {
|
|
|
246
246
|
transition: "0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
247
247
|
};
|
|
248
248
|
});
|
|
249
|
-
return (o, g) => y(r) ? (
|
|
249
|
+
return (o, g) => y(r) ? (X(), $("div", {
|
|
250
250
|
key: 0,
|
|
251
251
|
ref_key: "elementRef",
|
|
252
252
|
ref: e,
|
|
253
|
-
style:
|
|
253
|
+
style: ee(s.value)
|
|
254
254
|
}, [
|
|
255
|
-
(
|
|
255
|
+
(X(!0), $(he, null, pe(y(l), ([i, c]) => {
|
|
256
256
|
var d, v;
|
|
257
|
-
return
|
|
257
|
+
return X(), $("div", {
|
|
258
258
|
key: c.id,
|
|
259
259
|
innerHTML: c.initialHTML,
|
|
260
|
-
style:
|
|
260
|
+
style: ee({
|
|
261
261
|
width: `${(d = c.initialRect) == null ? void 0 : d.width}px`,
|
|
262
262
|
height: `${(v = c.initialRect) == null ? void 0 : v.height}px`
|
|
263
263
|
})
|
|
264
|
-
}, null, 12,
|
|
264
|
+
}, null, 12, _e);
|
|
265
265
|
}), 128))
|
|
266
|
-
], 4)) :
|
|
266
|
+
], 4)) : me("", !0);
|
|
267
267
|
}
|
|
268
|
-
}),
|
|
268
|
+
}), ae = /* @__PURE__ */ ue({
|
|
269
269
|
__name: "DragOverlay",
|
|
270
270
|
setup(n) {
|
|
271
271
|
const { activeContainer: e } = K(), t = T(
|
|
272
|
-
() => e.component.value ??
|
|
272
|
+
() => e.component.value ?? Se
|
|
273
273
|
);
|
|
274
|
-
return (r, l) => y(e).options.value ? (
|
|
274
|
+
return (r, l) => y(e).options.value ? (X(), q(Ee, {
|
|
275
275
|
key: 0,
|
|
276
276
|
name: y(e).options.value.name,
|
|
277
277
|
duration: y(e).options.value.duration,
|
|
@@ -298,23 +298,23 @@ const K = ce(() => {
|
|
|
298
298
|
onAfterLeave: y(e).options.value.onAfterLeave,
|
|
299
299
|
onAfterAppear: y(e).options.value.onAfterAppear
|
|
300
300
|
}, {
|
|
301
|
-
default:
|
|
302
|
-
(
|
|
301
|
+
default: ye(() => [
|
|
302
|
+
(X(), q(te(t.value)))
|
|
303
303
|
]),
|
|
304
304
|
_: 1
|
|
305
|
-
}, 8, ["name", "duration", "enter-from-class", "enter-to-class", "enter-active-class", "leave-from-class", "leave-to-class", "leave-active-class", "appear-active-class", "appear-from-class", "appear-to-class", "mode", "type", "css", "persisted", "onEnter", "onLeave", "onBeforeEnter", "onBeforeLeave", "onBeforeAppear", "onAfterEnter", "onAfterLeave", "onAfterAppear"])) : (
|
|
305
|
+
}, 8, ["name", "duration", "enter-from-class", "enter-to-class", "enter-active-class", "leave-from-class", "leave-to-class", "leave-active-class", "appear-active-class", "appear-from-class", "appear-to-class", "mode", "type", "css", "persisted", "onEnter", "onLeave", "onBeforeEnter", "onBeforeLeave", "onBeforeAppear", "onAfterEnter", "onAfterLeave", "onAfterAppear"])) : (X(), q(te(t.value), { key: 1 }));
|
|
306
306
|
}
|
|
307
|
-
}),
|
|
307
|
+
}), Ye = {
|
|
308
308
|
install(n) {
|
|
309
|
-
n.component("DragOverlay",
|
|
309
|
+
n.component("DragOverlay", ae);
|
|
310
310
|
const e = n.mount;
|
|
311
311
|
n.mount = function(r) {
|
|
312
312
|
const l = e.call(this, r), s = typeof r == "string" ? document.querySelector(r) : r;
|
|
313
313
|
if (s && s instanceof Element && !s.querySelector("#vue-dnd-kit-overlay")) {
|
|
314
314
|
const o = document.createElement("div");
|
|
315
315
|
o.id = "vue-dnd-kit-overlay", o.style.pointerEvents = "none", s.appendChild(o);
|
|
316
|
-
const g =
|
|
317
|
-
|
|
316
|
+
const g = xe(ae);
|
|
317
|
+
ne(g, o), n.__VUE_DND_KIT_OVERLAY__ = {
|
|
318
318
|
container: o,
|
|
319
319
|
vnode: g
|
|
320
320
|
};
|
|
@@ -325,10 +325,10 @@ const K = ce(() => {
|
|
|
325
325
|
};
|
|
326
326
|
const t = n.unmount;
|
|
327
327
|
n.unmount = function() {
|
|
328
|
-
return n.__VUE_DND_KIT_OVERLAY__ && (
|
|
328
|
+
return n.__VUE_DND_KIT_OVERLAY__ && (ne(null, n.__VUE_DND_KIT_OVERLAY__.container), delete n.__VUE_DND_KIT_OVERLAY__), t.call(this);
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
},
|
|
331
|
+
}, le = (n, e) => n.x < e.x + e.width && n.x + n.width > e.x && n.y < e.y + e.height && n.y + n.height > e.y, B = (n) => {
|
|
332
332
|
if (!n)
|
|
333
333
|
return {
|
|
334
334
|
x: 0,
|
|
@@ -351,11 +351,11 @@ const K = ce(() => {
|
|
|
351
351
|
width: e.width,
|
|
352
352
|
height: e.height
|
|
353
353
|
};
|
|
354
|
-
},
|
|
354
|
+
}, G = (n) => ({
|
|
355
355
|
x: n.x + n.width / 2,
|
|
356
356
|
y: n.y + n.height / 2
|
|
357
|
-
}),
|
|
358
|
-
const t =
|
|
357
|
+
}), Ie = (n, e) => {
|
|
358
|
+
const t = B(n);
|
|
359
359
|
return {
|
|
360
360
|
pixel: {
|
|
361
361
|
x: e.x - t.x,
|
|
@@ -366,10 +366,10 @@ const K = ce(() => {
|
|
|
366
366
|
y: (e.y - t.y) / t.height * 100
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
|
-
},
|
|
369
|
+
}, se = (n, e) => {
|
|
370
370
|
const t = e.x - n.x, r = e.y - n.y;
|
|
371
371
|
return Math.sqrt(t * t + r * r);
|
|
372
|
-
},
|
|
372
|
+
}, oe = (n, e) => {
|
|
373
373
|
const t = Math.max(
|
|
374
374
|
0,
|
|
375
375
|
Math.min(n.x + n.width, e.x + e.width) - Math.max(n.x, e.x)
|
|
@@ -378,9 +378,11 @@ const K = ce(() => {
|
|
|
378
378
|
Math.min(n.y + n.height, e.y + e.height) - Math.max(n.y, e.y)
|
|
379
379
|
), l = t * r, s = n.width * n.height, o = e.width * e.height;
|
|
380
380
|
return (l / s * 100 + l / o * 100) / 2;
|
|
381
|
-
},
|
|
381
|
+
}, ie = "data-vue-dnd-kit-draggable", z = (n) => {
|
|
382
382
|
n.preventDefault();
|
|
383
|
-
},
|
|
383
|
+
}, O = (n) => ({
|
|
384
|
+
items: Array.from(n.draggingElements.value.values())
|
|
385
|
+
}), ze = (n) => {
|
|
384
386
|
const {
|
|
385
387
|
elementsMap: e,
|
|
386
388
|
draggingElements: t,
|
|
@@ -391,12 +393,12 @@ const K = ce(() => {
|
|
|
391
393
|
handleDragElementIntersection: g
|
|
392
394
|
} = K(), i = V(null), c = T(
|
|
393
395
|
() => o.value.has(i.value) && r.element.value === i.value
|
|
394
|
-
), d = Y((n == null ? void 0 : n.id) ||
|
|
396
|
+
), d = Y((n == null ? void 0 : n.id) || we()), v = T(() => !i.value || !o.value.has(i.value) ? !1 : t.value.has(i.value)), a = T(() => {
|
|
395
397
|
if (!i.value || !s.value || !o.value.has(i.value)) return !1;
|
|
396
398
|
const m = e.value.get(i.value);
|
|
397
399
|
return m != null && m.groups.length ? !Array.from(t.value.entries()).some(
|
|
398
400
|
([p, E]) => E.groups.length ? !E.groups.some(
|
|
399
|
-
(
|
|
401
|
+
(L) => m.groups.includes(L)
|
|
400
402
|
) : !1
|
|
401
403
|
) : !0;
|
|
402
404
|
});
|
|
@@ -412,26 +414,26 @@ const K = ce(() => {
|
|
|
412
414
|
events: (n == null ? void 0 : n.events) ?? {},
|
|
413
415
|
data: (n == null ? void 0 : n.data) ?? null,
|
|
414
416
|
id: d.value
|
|
415
|
-
}), g("add", i.value), i.value.addEventListener("dragstart", z), i.value.addEventListener("drag", z), i.value.setAttribute(
|
|
417
|
+
}), g("add", i.value), i.value.addEventListener("dragstart", z), i.value.addEventListener("drag", z), i.value.setAttribute(ie, "true"), i.value.setAttribute("draggable", "false");
|
|
416
418
|
},
|
|
417
419
|
unregisterElement: () => {
|
|
418
|
-
i.value && (e.value.delete(i.value), l.value.delete(i.value), i.value.removeEventListener("dragstart", z), i.value.removeEventListener("drag", z), i.value.removeAttribute(
|
|
420
|
+
i.value && (e.value.delete(i.value), l.value.delete(i.value), i.value.removeEventListener("dragstart", z), i.value.removeEventListener("drag", z), i.value.removeAttribute(ie), i.value.removeAttribute("draggable"));
|
|
419
421
|
},
|
|
420
422
|
isDragging: v,
|
|
421
423
|
isOvered: c,
|
|
422
424
|
isAllowed: a,
|
|
423
425
|
id: d
|
|
424
426
|
};
|
|
425
|
-
}, b = (n, e) => n ? e.contains(n) : !1,
|
|
427
|
+
}, b = (n, e) => n ? e.contains(n) : !1, Ce = (n) => {
|
|
426
428
|
var d, v;
|
|
427
|
-
const e =
|
|
429
|
+
const e = B(n.activeContainer.ref.value), t = G(e), r = ((d = n.pointerPosition.current.value) == null ? void 0 : d.x) ?? 0, l = ((v = n.pointerPosition.current.value) == null ? void 0 : v.y) ?? 0, o = !(e && r >= e.x && r <= e.x + e.width && l >= e.y && l <= e.y + e.height), g = Array.from(n.draggingElements.value.keys()), i = Array.from(n.visibleElements.value.entries()).filter(([a, u]) => {
|
|
428
430
|
if (!a) return !1;
|
|
429
|
-
const f =
|
|
430
|
-
return f && e &&
|
|
431
|
+
const f = B(a);
|
|
432
|
+
return f && e && le(f, e);
|
|
431
433
|
}).map(([a, u]) => {
|
|
432
|
-
const f =
|
|
434
|
+
const f = B(a), m = G(f), p = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = oe(f, e), L = se(t, m);
|
|
433
435
|
let w = 0;
|
|
434
|
-
for (const [I,
|
|
436
|
+
for (const [I, F] of n.visibleElements.value.entries())
|
|
435
437
|
I !== a && I && a && b(a, I) && w++;
|
|
436
438
|
return {
|
|
437
439
|
element: u,
|
|
@@ -439,7 +441,7 @@ const K = ce(() => {
|
|
|
439
441
|
isPointerInElement: p,
|
|
440
442
|
overlapPercent: E,
|
|
441
443
|
depth: w,
|
|
442
|
-
centerDistance:
|
|
444
|
+
centerDistance: L
|
|
443
445
|
};
|
|
444
446
|
}).sort((a, u) => {
|
|
445
447
|
if (!o) {
|
|
@@ -454,12 +456,12 @@ const K = ce(() => {
|
|
|
454
456
|
(m) => m && b(a, m)
|
|
455
457
|
))
|
|
456
458
|
return !1;
|
|
457
|
-
const f =
|
|
458
|
-
return f && e &&
|
|
459
|
+
const f = B(a);
|
|
460
|
+
return f && e && le(f, e);
|
|
459
461
|
}).map(([a, u]) => {
|
|
460
|
-
const f =
|
|
462
|
+
const f = B(a), m = G(f), p = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = oe(f, e), L = se(t, m);
|
|
461
463
|
let w = 0;
|
|
462
|
-
for (const [I,
|
|
464
|
+
for (const [I, F] of n.visibleZones.value.entries())
|
|
463
465
|
I !== a && I && a && b(a, I) && w++;
|
|
464
466
|
return {
|
|
465
467
|
zone: u,
|
|
@@ -467,7 +469,7 @@ const K = ce(() => {
|
|
|
467
469
|
isPointerInElement: p,
|
|
468
470
|
overlapPercent: E,
|
|
469
471
|
depth: w,
|
|
470
|
-
centerDistance:
|
|
472
|
+
centerDistance: L
|
|
471
473
|
};
|
|
472
474
|
}).sort((a, u) => {
|
|
473
475
|
if (!o) {
|
|
@@ -482,13 +484,13 @@ const K = ce(() => {
|
|
|
482
484
|
...i.map((a) => a.node),
|
|
483
485
|
...c.map((a) => a.node)
|
|
484
486
|
];
|
|
485
|
-
},
|
|
487
|
+
}, De = (n, e) => {
|
|
486
488
|
const { pointerPosition: t, keyboard: r } = K(), l = (e == null ? void 0 : e.moveStep) || 10;
|
|
487
489
|
return {
|
|
488
490
|
onKeyboardStart: (i) => {
|
|
489
491
|
var a;
|
|
490
492
|
z(i);
|
|
491
|
-
const c =
|
|
493
|
+
const c = B(n.value);
|
|
492
494
|
(a = n.value) == null || a.blur();
|
|
493
495
|
const d = c.x + c.width / 2, v = c.y + c.height / 2;
|
|
494
496
|
t.start.value = {
|
|
@@ -518,7 +520,7 @@ const K = ce(() => {
|
|
|
518
520
|
t.current.value = null, t.start.value = null, t.offset.pixel.value = null, t.offset.percent.value = null;
|
|
519
521
|
}
|
|
520
522
|
};
|
|
521
|
-
},
|
|
523
|
+
}, ke = (n) => {
|
|
522
524
|
const e = K();
|
|
523
525
|
return {
|
|
524
526
|
onPointerStart: (s) => {
|
|
@@ -526,7 +528,7 @@ const K = ce(() => {
|
|
|
526
528
|
x: s.clientX,
|
|
527
529
|
y: s.clientY
|
|
528
530
|
};
|
|
529
|
-
const { pixel: o, percent: g } =
|
|
531
|
+
const { pixel: o, percent: g } = Ie(n.value, {
|
|
530
532
|
x: s.clientX,
|
|
531
533
|
y: s.clientY
|
|
532
534
|
});
|
|
@@ -542,26 +544,26 @@ const K = ce(() => {
|
|
|
542
544
|
e.pointerPosition.current.value = null, e.pointerPosition.start.value = null, e.pointerPosition.offset.pixel.value = null, e.pointerPosition.offset.percent.value = null;
|
|
543
545
|
}
|
|
544
546
|
};
|
|
545
|
-
},
|
|
546
|
-
var
|
|
547
|
-
const t = K(), { onPointerStart: r, onPointerMove: l, onPointerEnd: s } =
|
|
547
|
+
}, be = (n, e) => {
|
|
548
|
+
var F, Z;
|
|
549
|
+
const t = K(), { onPointerStart: r, onPointerMove: l, onPointerEnd: s } = ke(n), { onKeyboardStart: o, onKeyboardMove: g, onKeyboardEnd: i } = De(
|
|
548
550
|
n,
|
|
549
551
|
e == null ? void 0 : e.keyboard
|
|
550
552
|
);
|
|
551
553
|
let c = null;
|
|
552
554
|
const d = (h) => {
|
|
553
|
-
var D,
|
|
555
|
+
var D, A;
|
|
554
556
|
if (!h) return /* @__PURE__ */ new Map();
|
|
555
557
|
const _ = t.selectedElements.value.has(h);
|
|
556
558
|
if (t.selectedElements.value.size > 0 && _) {
|
|
557
559
|
const S = /* @__PURE__ */ new Map();
|
|
558
560
|
return t.selectedElements.value.forEach((C) => {
|
|
559
|
-
var
|
|
561
|
+
var R, H;
|
|
560
562
|
const U = t.elementsMap.value.get(C);
|
|
561
563
|
U && S.set(C, {
|
|
562
564
|
...U,
|
|
563
|
-
initialHTML: ((
|
|
564
|
-
initialRect: (
|
|
565
|
+
initialHTML: ((R = U.node) == null ? void 0 : R.outerHTML) ?? "",
|
|
566
|
+
initialRect: (H = U.node) == null ? void 0 : H.getBoundingClientRect()
|
|
565
567
|
});
|
|
566
568
|
}), S;
|
|
567
569
|
}
|
|
@@ -572,55 +574,39 @@ const K = ce(() => {
|
|
|
572
574
|
return M.set(h, {
|
|
573
575
|
...P,
|
|
574
576
|
initialHTML: ((D = P.node) == null ? void 0 : D.outerHTML) ?? "",
|
|
575
|
-
initialRect: (
|
|
577
|
+
initialRect: (A = P.node) == null ? void 0 : A.getBoundingClientRect()
|
|
576
578
|
}), M;
|
|
577
579
|
}, v = (h) => {
|
|
578
580
|
if (!h)
|
|
579
581
|
return { element: null, zone: null };
|
|
580
|
-
const _ = Array.isArray(h) ? h : [h], P = Array.from(t.draggingElements.value.keys()), M = _.find((
|
|
581
|
-
if (!t.visibleZones.value.has(
|
|
582
|
-
const S = t.zonesMap.value.get(
|
|
582
|
+
const _ = Array.isArray(h) ? h : [h], P = Array.from(t.draggingElements.value.keys()), M = _.find((A) => {
|
|
583
|
+
if (!t.visibleZones.value.has(A)) return !1;
|
|
584
|
+
const S = t.zonesMap.value.get(A);
|
|
583
585
|
return !(!S || P.some(
|
|
584
586
|
(C) => C && (C === S.node || b(S.node, C))
|
|
585
587
|
) || S.groups.length && !!Array.from(
|
|
586
588
|
t.draggingElements.value.values()
|
|
587
|
-
).some((U) => U.groups.length ? !U.groups.some((
|
|
589
|
+
).some((U) => U.groups.length ? !U.groups.some((R) => S.groups.includes(R)) : !1));
|
|
588
590
|
});
|
|
589
591
|
return M ? {
|
|
590
592
|
element: _.find(
|
|
591
|
-
(
|
|
592
|
-
(S) => S && (S ===
|
|
593
|
-
|
|
593
|
+
(A) => t.visibleElements.value.has(A) && t.elementsMap.value.has(A) && !P.some(
|
|
594
|
+
(S) => S && (S === A || b(
|
|
595
|
+
A,
|
|
594
596
|
S
|
|
595
|
-
) || b(S,
|
|
596
|
-
) && (
|
|
597
|
-
|
|
597
|
+
) || b(S, A))
|
|
598
|
+
) && (A === M || b(
|
|
599
|
+
A,
|
|
598
600
|
M
|
|
599
601
|
))
|
|
600
602
|
) || null,
|
|
601
603
|
zone: M
|
|
602
604
|
} : { element: null, zone: null };
|
|
603
|
-
}, a = ((
|
|
604
|
-
var M, D,
|
|
605
|
+
}, a = ((F = e == null ? void 0 : e.sensor) == null ? void 0 : F.setup) || Ce, u = (h) => {
|
|
606
|
+
var M, D, A, S, C, U, R, H, J, Q, N, W;
|
|
605
607
|
const _ = t.hovered.element.value, P = t.hovered.zone.value;
|
|
606
|
-
t.hovered.element.value = h.element, t.hovered.zone.value = h.zone, _ && t.hovered.element.value !== _ && ((
|
|
607
|
-
|
|
608
|
-
t,
|
|
609
|
-
Array.from(t.draggingElements.value.values())
|
|
610
|
-
), t.hovered.element.value && ((U = (C = (S = t.elementsMap.value.get(t.hovered.element.value)) == null ? void 0 : S.events) == null ? void 0 : C.onHover) == null || U.call(
|
|
611
|
-
C,
|
|
612
|
-
t,
|
|
613
|
-
Array.from(t.draggingElements.value.values())
|
|
614
|
-
))), P && t.hovered.zone.value !== P && ((j = (R = (O = t.zonesMap.value.get(P)) == null ? void 0 : O.events) == null ? void 0 : R.onLeave) == null || j.call(
|
|
615
|
-
R,
|
|
616
|
-
t,
|
|
617
|
-
Array.from(t.draggingElements.value.values())
|
|
618
|
-
), t.hovered.zone.value && ((Q = (X = (J = t.zonesMap.value.get(t.hovered.zone.value)) == null ? void 0 : J.events) == null ? void 0 : X.onHover) == null || Q.call(
|
|
619
|
-
X,
|
|
620
|
-
t,
|
|
621
|
-
Array.from(t.draggingElements.value.values())
|
|
622
|
-
)));
|
|
623
|
-
}, f = Pe(() => {
|
|
608
|
+
t.hovered.element.value = h.element, t.hovered.zone.value = h.zone, _ && t.hovered.element.value !== _ && ((A = (D = (M = t.elementsMap.value.get(_)) == null ? void 0 : M.events) == null ? void 0 : D.onLeave) == null || A.call(D, t, O(t)), t.hovered.element.value && ((U = (C = (S = t.elementsMap.value.get(t.hovered.element.value)) == null ? void 0 : S.events) == null ? void 0 : C.onHover) == null || U.call(C, t, O(t)))), P && t.hovered.zone.value !== P && ((J = (H = (R = t.zonesMap.value.get(P)) == null ? void 0 : R.events) == null ? void 0 : H.onLeave) == null || J.call(H, t, O(t)), t.hovered.zone.value && ((W = (N = (Q = t.zonesMap.value.get(t.hovered.zone.value)) == null ? void 0 : Q.events) == null ? void 0 : N.onHover) == null || W.call(N, t, O(t))));
|
|
609
|
+
}, f = Le(() => {
|
|
624
610
|
const h = a(t), _ = v(h);
|
|
625
611
|
u(_);
|
|
626
612
|
}, ((Z = e == null ? void 0 : e.sensor) == null ? void 0 : Z.throttle) ?? 0), m = () => {
|
|
@@ -633,11 +619,7 @@ const K = ce(() => {
|
|
|
633
619
|
t.draggingElements.value = d(n.value), t.draggingElements.value.forEach(
|
|
634
620
|
(_) => {
|
|
635
621
|
var P, M;
|
|
636
|
-
return (M = (P = _.events).onStart) == null ? void 0 : M.call(
|
|
637
|
-
P,
|
|
638
|
-
t,
|
|
639
|
-
Array.from(t.draggingElements.value.values())
|
|
640
|
-
);
|
|
622
|
+
return (M = (P = _.events).onStart) == null ? void 0 : M.call(P, t, O(t));
|
|
641
623
|
}
|
|
642
624
|
), h instanceof PointerEvent ? r(h) : o(h), p();
|
|
643
625
|
},
|
|
@@ -645,11 +627,7 @@ const K = ce(() => {
|
|
|
645
627
|
t.draggingElements.value.forEach(
|
|
646
628
|
(_) => {
|
|
647
629
|
var P, M;
|
|
648
|
-
return (M = (P = _.events).onMove) == null ? void 0 : M.call(
|
|
649
|
-
P,
|
|
650
|
-
t,
|
|
651
|
-
Array.from(t.draggingElements.value.values())
|
|
652
|
-
);
|
|
630
|
+
return (M = (P = _.events).onMove) == null ? void 0 : M.call(P, t, O(t));
|
|
653
631
|
}
|
|
654
632
|
), h instanceof KeyboardEvent ? g() : l(h);
|
|
655
633
|
},
|
|
@@ -658,20 +636,12 @@ const K = ce(() => {
|
|
|
658
636
|
if (s(), i(), h) {
|
|
659
637
|
if (t.hovered.zone.value) {
|
|
660
638
|
const M = t.zonesMap.value.get(t.hovered.zone.value);
|
|
661
|
-
(P = M == null ? void 0 : (_ = M.events).onDrop) == null || P.call(
|
|
662
|
-
_,
|
|
663
|
-
t,
|
|
664
|
-
Array.from(t.draggingElements.value.values())
|
|
665
|
-
);
|
|
639
|
+
(P = M == null ? void 0 : (_ = M.events).onDrop) == null || P.call(_, t, O(t));
|
|
666
640
|
} else
|
|
667
641
|
t.draggingElements.value.forEach(
|
|
668
642
|
(M) => {
|
|
669
|
-
var D,
|
|
670
|
-
return (
|
|
671
|
-
D,
|
|
672
|
-
t,
|
|
673
|
-
Array.from(t.draggingElements.value.values())
|
|
674
|
-
);
|
|
643
|
+
var D, A;
|
|
644
|
+
return (A = (D = M.events).onEnd) == null ? void 0 : A.call(D, t, O(t));
|
|
675
645
|
}
|
|
676
646
|
);
|
|
677
647
|
t.selectedElements.value.clear();
|
|
@@ -679,7 +649,7 @@ const K = ce(() => {
|
|
|
679
649
|
t.draggingElements.value.clear(), t.hovered.zone.value = null, t.hovered.element.value = null, E();
|
|
680
650
|
}
|
|
681
651
|
};
|
|
682
|
-
},
|
|
652
|
+
}, Te = ve(() => {
|
|
683
653
|
let n = "", e = "", t = "", r = null, l = null, s = null, o = null, g = null;
|
|
684
654
|
const { activeContainer: i } = K(), c = () => {
|
|
685
655
|
const u = document.body;
|
|
@@ -692,18 +662,18 @@ const K = ce(() => {
|
|
|
692
662
|
};
|
|
693
663
|
return {
|
|
694
664
|
handleDragStart: (u, f, m) => {
|
|
695
|
-
v(), u.target.blur(), m != null && m.container && (i.component.value =
|
|
696
|
-
const { activate: p, track: E, deactivate:
|
|
665
|
+
v(), u.target.blur(), m != null && m.container && (i.component.value = Me(m.container));
|
|
666
|
+
const { activate: p, track: E, deactivate: L } = be(f, m);
|
|
697
667
|
l = () => {
|
|
698
|
-
i.component.value = null, d(),
|
|
668
|
+
i.component.value = null, d(), L(!0), v();
|
|
699
669
|
}, s = () => {
|
|
700
|
-
i.component.value = null, d(),
|
|
670
|
+
i.component.value = null, d(), L(!1), v();
|
|
701
671
|
}, r = (w) => E(w), o = (w) => E(w), g = (w) => {
|
|
702
672
|
w.type === "keyup" && (w.code === "Escape" && (s == null || s()), w.code === "Enter" && (l == null || l())), E(w);
|
|
703
673
|
}, c(), p(u), document.addEventListener("pointermove", r), document.addEventListener("pointerup", l), document.addEventListener("wheel", o), document.addEventListener("keydown", g), document.addEventListener("keypress", g), document.addEventListener("keyup", g);
|
|
704
674
|
}
|
|
705
675
|
};
|
|
706
|
-
}),
|
|
676
|
+
}), Oe = (n) => {
|
|
707
677
|
const {
|
|
708
678
|
id: e,
|
|
709
679
|
elementRef: t,
|
|
@@ -712,8 +682,8 @@ const K = ce(() => {
|
|
|
712
682
|
isAllowed: s,
|
|
713
683
|
registerElement: o,
|
|
714
684
|
unregisterElement: g
|
|
715
|
-
} =
|
|
716
|
-
return
|
|
685
|
+
} = ze(n), { pointerPosition: i } = K(), { handleDragStart: c } = Te(), d = (v) => c(v, t, n);
|
|
686
|
+
return j(o), ce(g), {
|
|
717
687
|
pointerPosition: i,
|
|
718
688
|
elementRef: t,
|
|
719
689
|
isDragging: r,
|
|
@@ -722,7 +692,7 @@ const K = ce(() => {
|
|
|
722
692
|
handleDragStart: d,
|
|
723
693
|
id: e
|
|
724
694
|
};
|
|
725
|
-
},
|
|
695
|
+
}, Ke = (n) => {
|
|
726
696
|
const {
|
|
727
697
|
zonesMap: e,
|
|
728
698
|
hovered: t,
|
|
@@ -747,10 +717,10 @@ const K = ce(() => {
|
|
|
747
717
|
}, unregisterZone: () => {
|
|
748
718
|
o.value && (s("remove", o.value), e.value.delete(o.value));
|
|
749
719
|
}, isOvered: g, isAllowed: i };
|
|
750
|
-
}, Oe = (n) => {
|
|
751
|
-
const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: s } = Te(n);
|
|
752
|
-
return G(t), ue(r), { elementRef: e, isOvered: l, isAllowed: s };
|
|
753
720
|
}, Re = (n) => {
|
|
721
|
+
const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: s } = Ke(n);
|
|
722
|
+
return j(t), ce(r), { elementRef: e, isOvered: l, isAllowed: s };
|
|
723
|
+
}, He = (n) => {
|
|
754
724
|
const { selectedElements: e, elementsMap: t } = K(), r = T(
|
|
755
725
|
() => n.value ? e.value.has(n.value) : !1
|
|
756
726
|
), l = T(() => {
|
|
@@ -789,13 +759,13 @@ const K = ce(() => {
|
|
|
789
759
|
};
|
|
790
760
|
};
|
|
791
761
|
export {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
762
|
+
re as DnDOperations,
|
|
763
|
+
Ye as default,
|
|
764
|
+
B as getBoundingBox,
|
|
795
765
|
K as useDnDStore,
|
|
796
766
|
Ae as useDragContainer,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
767
|
+
Oe as useDraggable,
|
|
768
|
+
Re as useDroppable,
|
|
769
|
+
He as useSelection
|
|
800
770
|
};
|
|
801
771
|
//# sourceMappingURL=vue-dnd-kit-core.es.js.map
|