@vue-dnd-kit/core 1.3.2 → 1.3.3
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,32 +1,32 @@
|
|
|
1
1
|
var me = Object.defineProperty;
|
|
2
2
|
var he = (n, e, t) => e in n ? me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
import { createGlobalState as ge, useMagicKeys as
|
|
3
|
+
var k = (n, e, t) => he(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ref as O, computed as T, shallowRef as D, onMounted as Q, onUnmounted as pe, defineComponent as de, createElementBlock as q, createCommentVNode as Ee, unref as y, openBlock as R, normalizeStyle as re, Fragment as ae, renderList as ye, createBlock as G, resolveDynamicComponent as J, Transition as we, withCtx as xe, createVNode as Me, render as le, useId as Pe, onBeforeUnmount as fe } from "vue";
|
|
5
|
+
import { createGlobalState as ge, useMagicKeys as Le, useThrottleFn as Ae } from "@vueuse/core";
|
|
6
6
|
const x = class x {
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
k(x, "remove", (e, t) => {
|
|
9
9
|
if (!e || t === void 0) return;
|
|
10
10
|
const [r] = e.splice(t, 1);
|
|
11
11
|
return r;
|
|
12
|
-
}),
|
|
12
|
+
}), k(x, "insert", (e, t, r) => {
|
|
13
13
|
!e || t === void 0 || e.splice(t, 0, r);
|
|
14
|
-
}),
|
|
14
|
+
}), k(x, "move", (e, t, r, l) => {
|
|
15
15
|
if (!e || !r || t === void 0 || l === void 0)
|
|
16
16
|
return;
|
|
17
17
|
const s = x.remove(e, t);
|
|
18
18
|
x.insert(r, l, s);
|
|
19
|
-
}),
|
|
19
|
+
}), k(x, "swap", (e, t, r, l) => {
|
|
20
20
|
if (!e || !r || t === void 0 || l === void 0)
|
|
21
21
|
return;
|
|
22
22
|
const s = e[t], o = r[l];
|
|
23
23
|
e[t] = o, r[l] = s;
|
|
24
|
-
}),
|
|
24
|
+
}), k(x, "copy", (e, t, r, l) => {
|
|
25
25
|
if (!e || t === void 0 || !r || l === void 0)
|
|
26
26
|
return;
|
|
27
27
|
const s = e[t];
|
|
28
28
|
x.insert(r, l, s);
|
|
29
|
-
}),
|
|
29
|
+
}), k(x, "applyTransfer", (e) => {
|
|
30
30
|
var l, s, o, g, i, u, d;
|
|
31
31
|
const t = e.hovered.element.value, r = e.hovered.zone.value;
|
|
32
32
|
if (t) {
|
|
@@ -68,7 +68,7 @@ z(x, "remove", (e, t) => {
|
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
}),
|
|
71
|
+
}), k(x, "applyCopy", (e) => {
|
|
72
72
|
var l, s, o, g, i, u;
|
|
73
73
|
const t = e.hovered.element.value, r = e.hovered.zone.value;
|
|
74
74
|
if (t) {
|
|
@@ -108,7 +108,7 @@ z(x, "remove", (e, t) => {
|
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
}),
|
|
111
|
+
}), k(x, "applySwap", (e) => {
|
|
112
112
|
var l, s, o, g, i, u, d, v;
|
|
113
113
|
const t = e.hovered.element.value, r = e.hovered.zone.value;
|
|
114
114
|
if (t && e.draggingElements.value.size === 1) {
|
|
@@ -138,7 +138,7 @@ z(x, "remove", (e, t) => {
|
|
|
138
138
|
}
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
|
-
}),
|
|
141
|
+
}), k(x, "applyRemove", (e) => {
|
|
142
142
|
Array.from(
|
|
143
143
|
e.draggingElements.value.values()
|
|
144
144
|
).sort((r, l) => {
|
|
@@ -148,7 +148,7 @@ z(x, "remove", (e, t) => {
|
|
|
148
148
|
var l, s;
|
|
149
149
|
(l = r.data) != null && l.source && ((s = r.data) == null ? void 0 : s.index) !== void 0 && x.remove(r.data.source, r.data.index);
|
|
150
150
|
});
|
|
151
|
-
}),
|
|
151
|
+
}), k(x, "applyInsert", (e, t) => {
|
|
152
152
|
var s, o, g, i, u, d;
|
|
153
153
|
const r = e.hovered.element.value, l = e.hovered.zone.value;
|
|
154
154
|
if (r && t.length > 0) {
|
|
@@ -164,37 +164,42 @@ z(x, "remove", (e, t) => {
|
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
166
|
let se = x;
|
|
167
|
-
const
|
|
168
|
-
const n =
|
|
167
|
+
const Z = ge(() => {
|
|
168
|
+
const n = O(
|
|
169
169
|
/* @__PURE__ */ new Map()
|
|
170
|
-
), e =
|
|
171
|
-
component:
|
|
172
|
-
ref:
|
|
173
|
-
options:
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
), e = T(() => n.value.size > 0), t = {
|
|
171
|
+
component: O(null),
|
|
172
|
+
ref: D(null),
|
|
173
|
+
options: D(null),
|
|
174
|
+
animating: {
|
|
175
|
+
enter: D(!1),
|
|
176
|
+
leave: D(!1),
|
|
177
|
+
appear: D(!1)
|
|
178
|
+
}
|
|
179
|
+
}, r = O(/* @__PURE__ */ new Map()), l = O(/* @__PURE__ */ new Set()), s = O(/* @__PURE__ */ new Map()), o = O(/* @__PURE__ */ new Set()), g = O(/* @__PURE__ */ new Set()), i = new IntersectionObserver((K) => {
|
|
180
|
+
K.forEach(
|
|
176
181
|
(h) => g.value[h.isIntersecting ? "add" : "delete"](
|
|
177
182
|
h.target
|
|
178
183
|
)
|
|
179
184
|
);
|
|
180
|
-
}), u = new IntersectionObserver((
|
|
181
|
-
|
|
185
|
+
}), u = new IntersectionObserver((K) => {
|
|
186
|
+
K.forEach(
|
|
182
187
|
(h) => o.value[h.isIntersecting ? "add" : "delete"](h.target)
|
|
183
188
|
);
|
|
184
|
-
}), d = (
|
|
185
|
-
|
|
186
|
-
}, v = (
|
|
187
|
-
|
|
189
|
+
}), d = (K, h) => {
|
|
190
|
+
K === "add" ? i.observe(h) : (i.unobserve(h), g.value.delete(h));
|
|
191
|
+
}, v = (K, h) => {
|
|
192
|
+
K === "add" ? u.observe(h) : (u.unobserve(h), o.value.delete(h));
|
|
188
193
|
}, a = {
|
|
189
|
-
start:
|
|
190
|
-
current:
|
|
194
|
+
start: D(null),
|
|
195
|
+
current: D(null),
|
|
191
196
|
offset: {
|
|
192
|
-
percent:
|
|
193
|
-
pixel:
|
|
197
|
+
percent: D(null),
|
|
198
|
+
pixel: D(null)
|
|
194
199
|
}
|
|
195
|
-
}, { w: c, s: f, a: m, d: p, ctrl: E, shift: L, alt: M, meta: I } =
|
|
196
|
-
zone:
|
|
197
|
-
element:
|
|
200
|
+
}, { w: c, s: f, a: m, d: p, ctrl: E, shift: L, alt: M, meta: I } = Le(), F = {
|
|
201
|
+
zone: D(null),
|
|
202
|
+
element: D(null)
|
|
198
203
|
};
|
|
199
204
|
return {
|
|
200
205
|
draggingElements: n,
|
|
@@ -220,8 +225,8 @@ const T = ge(() => {
|
|
|
220
225
|
handleDragElementIntersection: d,
|
|
221
226
|
handleDropZoneIntersection: v
|
|
222
227
|
};
|
|
223
|
-
}),
|
|
224
|
-
const e =
|
|
228
|
+
}), Se = (n) => {
|
|
229
|
+
const e = O(null), { draggingElements: t, pointerPosition: r, isDragging: l, activeContainer: s } = Z();
|
|
225
230
|
return Q(() => {
|
|
226
231
|
s.ref = e, s.options.value = n ?? null;
|
|
227
232
|
}), pe(() => {
|
|
@@ -230,12 +235,13 @@ const T = ge(() => {
|
|
|
230
235
|
elementRef: e,
|
|
231
236
|
draggingElements: t,
|
|
232
237
|
pointerPosition: r,
|
|
233
|
-
isDragging: l
|
|
238
|
+
isDragging: l,
|
|
239
|
+
animating: s.animating
|
|
234
240
|
};
|
|
235
|
-
},
|
|
241
|
+
}, _e = ["innerHTML"], Ie = /* @__PURE__ */ de({
|
|
236
242
|
__name: "DefaultOverlay",
|
|
237
243
|
setup(n) {
|
|
238
|
-
const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: l } =
|
|
244
|
+
const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: l } = Se(), s = T(() => {
|
|
239
245
|
var o, g, i, u;
|
|
240
246
|
return {
|
|
241
247
|
transform: `translate3d(${(((o = t.current.value) == null ? void 0 : o.x) ?? 0) - (((g = t.offset.pixel.value) == null ? void 0 : g.x) ?? 0)}px, ${(((i = t.current.value) == null ? void 0 : i.y) ?? 0) - (((u = t.offset.pixel.value) == null ? void 0 : u.y) ?? 0)}px, 0)`,
|
|
@@ -246,31 +252,31 @@ const T = ge(() => {
|
|
|
246
252
|
transition: "0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
247
253
|
};
|
|
248
254
|
});
|
|
249
|
-
return (o, g) => y(r) ? (
|
|
255
|
+
return (o, g) => y(r) ? (R(), q("div", {
|
|
250
256
|
key: 0,
|
|
251
257
|
ref_key: "elementRef",
|
|
252
258
|
ref: e,
|
|
253
259
|
style: re(s.value)
|
|
254
260
|
}, [
|
|
255
|
-
(
|
|
261
|
+
(R(!0), q(ae, null, ye(y(l), ([i, u]) => {
|
|
256
262
|
var d, v;
|
|
257
|
-
return
|
|
263
|
+
return R(), q(ae, {
|
|
258
264
|
key: u.id
|
|
259
265
|
}, [
|
|
260
|
-
u.layer ? (
|
|
266
|
+
u.layer ? (R(), G(J(u.layer), {
|
|
261
267
|
key: 0,
|
|
262
268
|
node: i,
|
|
263
269
|
data: u.data,
|
|
264
270
|
id: u.id,
|
|
265
271
|
groups: u.groups
|
|
266
|
-
}, null, 8, ["node", "data", "id", "groups"])) : (
|
|
272
|
+
}, null, 8, ["node", "data", "id", "groups"])) : (R(), q("div", {
|
|
267
273
|
key: 1,
|
|
268
274
|
innerHTML: u.initialHTML,
|
|
269
275
|
style: re({
|
|
270
276
|
width: `${(d = u.initialRect) == null ? void 0 : d.width}px`,
|
|
271
277
|
height: `${(v = u.initialRect) == null ? void 0 : v.height}px`
|
|
272
278
|
})
|
|
273
|
-
}, null, 12,
|
|
279
|
+
}, null, 12, _e))
|
|
274
280
|
], 64);
|
|
275
281
|
}), 128))
|
|
276
282
|
], 4)) : Ee("", !0);
|
|
@@ -278,10 +284,10 @@ const T = ge(() => {
|
|
|
278
284
|
}), oe = /* @__PURE__ */ de({
|
|
279
285
|
__name: "DragOverlay",
|
|
280
286
|
setup(n) {
|
|
281
|
-
const { activeContainer: e } =
|
|
282
|
-
() => e.component.value ??
|
|
287
|
+
const { activeContainer: e } = Z(), t = T(
|
|
288
|
+
() => e.component.value ?? Ie
|
|
283
289
|
);
|
|
284
|
-
return (r, l) => y(e).options.value ? (
|
|
290
|
+
return (r, l) => y(e).options.value ? (R(), G(we, {
|
|
285
291
|
key: 0,
|
|
286
292
|
name: y(e).options.value.name,
|
|
287
293
|
duration: y(e).options.value.duration,
|
|
@@ -309,10 +315,10 @@ const T = ge(() => {
|
|
|
309
315
|
onAfterAppear: y(e).options.value.onAfterAppear
|
|
310
316
|
}, {
|
|
311
317
|
default: xe(() => [
|
|
312
|
-
(
|
|
318
|
+
(R(), G(J(t.value)))
|
|
313
319
|
]),
|
|
314
320
|
_: 1
|
|
315
|
-
}, 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"])) : (
|
|
321
|
+
}, 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"])) : (R(), G(J(t.value), { key: 1 }));
|
|
316
322
|
}
|
|
317
323
|
}), Ue = {
|
|
318
324
|
install(n) {
|
|
@@ -328,7 +334,7 @@ const T = ge(() => {
|
|
|
328
334
|
container: o,
|
|
329
335
|
vnode: g
|
|
330
336
|
};
|
|
331
|
-
const i =
|
|
337
|
+
const i = Z();
|
|
332
338
|
n.__VUE_DND_KIT_STORE__ = i;
|
|
333
339
|
}
|
|
334
340
|
return l;
|
|
@@ -364,7 +370,7 @@ const T = ge(() => {
|
|
|
364
370
|
}, j = (n) => ({
|
|
365
371
|
x: n.x + n.width / 2,
|
|
366
372
|
y: n.y + n.height / 2
|
|
367
|
-
}),
|
|
373
|
+
}), Ce = (n, e) => {
|
|
368
374
|
const t = B(n);
|
|
369
375
|
return {
|
|
370
376
|
pixel: {
|
|
@@ -390,9 +396,9 @@ const T = ge(() => {
|
|
|
390
396
|
return (l / s * 100 + l / o * 100) / 2;
|
|
391
397
|
}, ve = "data-vue-dnd-kit-draggable", C = (n) => {
|
|
392
398
|
n.preventDefault();
|
|
393
|
-
},
|
|
399
|
+
}, H = (n) => ({
|
|
394
400
|
items: Array.from(n.draggingElements.value.values())
|
|
395
|
-
}),
|
|
401
|
+
}), De = (n) => {
|
|
396
402
|
const {
|
|
397
403
|
elementsMap: e,
|
|
398
404
|
draggingElements: t,
|
|
@@ -401,9 +407,9 @@ const T = ge(() => {
|
|
|
401
407
|
isDragging: s,
|
|
402
408
|
visibleElements: o,
|
|
403
409
|
handleDragElementIntersection: g
|
|
404
|
-
} =
|
|
410
|
+
} = Z(), i = O(null), u = T(
|
|
405
411
|
() => o.value.has(i.value) && r.element.value === i.value
|
|
406
|
-
), d =
|
|
412
|
+
), d = D((n == null ? void 0 : n.id) || Pe()), v = T(() => !i.value || !e.value.has(i.value) ? !1 : t.value.has(i.value)), a = T(() => {
|
|
407
413
|
if (!i.value || !s.value || !o.value.has(i.value)) return !1;
|
|
408
414
|
const m = e.value.get(i.value);
|
|
409
415
|
return m != null && m.groups.length ? !Array.from(t.value.entries()).some(
|
|
@@ -434,7 +440,7 @@ const T = ge(() => {
|
|
|
434
440
|
isAllowed: a,
|
|
435
441
|
id: d
|
|
436
442
|
};
|
|
437
|
-
},
|
|
443
|
+
}, b = (n, e) => n ? e.contains(n) : !1, ze = (n) => {
|
|
438
444
|
var d, v;
|
|
439
445
|
const e = B(n.activeContainer.ref.value), t = j(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, c]) => {
|
|
440
446
|
if (!a) return !1;
|
|
@@ -444,7 +450,7 @@ const T = ge(() => {
|
|
|
444
450
|
const f = B(a), m = j(f), p = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = ce(f, e), L = ue(t, m);
|
|
445
451
|
let M = 0;
|
|
446
452
|
for (const [I, F] of n.visibleElements.value.entries())
|
|
447
|
-
I !== a && I && a &&
|
|
453
|
+
I !== a && I && a && b(a, I) && M++;
|
|
448
454
|
return {
|
|
449
455
|
element: c,
|
|
450
456
|
node: a,
|
|
@@ -463,7 +469,7 @@ const T = ge(() => {
|
|
|
463
469
|
return Math.abs(a.overlapPercent - c.overlapPercent) <= 1 ? a.centerDistance - c.centerDistance : c.overlapPercent - a.overlapPercent;
|
|
464
470
|
}), u = Array.from(n.visibleZones.value.entries()).filter(([a, c]) => {
|
|
465
471
|
if (!a || g.some(
|
|
466
|
-
(m) => m &&
|
|
472
|
+
(m) => m && b(a, m)
|
|
467
473
|
))
|
|
468
474
|
return !1;
|
|
469
475
|
const f = B(a);
|
|
@@ -472,7 +478,7 @@ const T = ge(() => {
|
|
|
472
478
|
const f = B(a), m = j(f), p = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = ce(f, e), L = ue(t, m);
|
|
473
479
|
let M = 0;
|
|
474
480
|
for (const [I, F] of n.visibleZones.value.entries())
|
|
475
|
-
I !== a && I && a &&
|
|
481
|
+
I !== a && I && a && b(a, I) && M++;
|
|
476
482
|
return {
|
|
477
483
|
zone: c,
|
|
478
484
|
node: a,
|
|
@@ -494,8 +500,8 @@ const T = ge(() => {
|
|
|
494
500
|
...i.map((a) => a.node),
|
|
495
501
|
...u.map((a) => a.node)
|
|
496
502
|
];
|
|
497
|
-
},
|
|
498
|
-
const { pointerPosition: t, keyboard: r } =
|
|
503
|
+
}, ke = (n, e) => {
|
|
504
|
+
const { pointerPosition: t, keyboard: r } = Z(), l = (e == null ? void 0 : e.moveStep) || 10;
|
|
499
505
|
return {
|
|
500
506
|
onKeyboardStart: (i) => {
|
|
501
507
|
var a;
|
|
@@ -530,15 +536,15 @@ const T = ge(() => {
|
|
|
530
536
|
t.current.value = null, t.start.value = null, t.offset.pixel.value = null, t.offset.percent.value = null;
|
|
531
537
|
}
|
|
532
538
|
};
|
|
533
|
-
},
|
|
534
|
-
const e =
|
|
539
|
+
}, be = (n) => {
|
|
540
|
+
const e = Z();
|
|
535
541
|
return {
|
|
536
542
|
onPointerStart: (s) => {
|
|
537
543
|
e.pointerPosition.start.value = { x: s.clientX, y: s.clientY }, e.pointerPosition.current.value = {
|
|
538
544
|
x: s.clientX,
|
|
539
545
|
y: s.clientY
|
|
540
546
|
};
|
|
541
|
-
const { pixel: o, percent: g } =
|
|
547
|
+
const { pixel: o, percent: g } = Ce(n.value, {
|
|
542
548
|
x: s.clientX,
|
|
543
549
|
y: s.clientY
|
|
544
550
|
});
|
|
@@ -554,26 +560,26 @@ const T = ge(() => {
|
|
|
554
560
|
e.pointerPosition.current.value = null, e.pointerPosition.start.value = null, e.pointerPosition.offset.pixel.value = null, e.pointerPosition.offset.percent.value = null;
|
|
555
561
|
}
|
|
556
562
|
};
|
|
557
|
-
},
|
|
558
|
-
var F,
|
|
559
|
-
const t =
|
|
563
|
+
}, Te = (n, e) => {
|
|
564
|
+
var F, K;
|
|
565
|
+
const t = Z(), { onPointerStart: r, onPointerMove: l, onPointerEnd: s } = be(n), { onKeyboardStart: o, onKeyboardMove: g, onKeyboardEnd: i } = ke(
|
|
560
566
|
n,
|
|
561
567
|
e == null ? void 0 : e.keyboard
|
|
562
568
|
);
|
|
563
569
|
let u = null;
|
|
564
570
|
const d = (h) => {
|
|
565
|
-
var
|
|
571
|
+
var z, A;
|
|
566
572
|
if (!h) return /* @__PURE__ */ new Map();
|
|
567
573
|
const _ = t.selectedElements.value.has(h);
|
|
568
574
|
if (t.selectedElements.value.size > 0 && _) {
|
|
569
575
|
const S = /* @__PURE__ */ new Map();
|
|
570
|
-
return t.selectedElements.value.forEach((
|
|
571
|
-
var
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
...
|
|
575
|
-
initialHTML: ((
|
|
576
|
-
initialRect: (X =
|
|
576
|
+
return t.selectedElements.value.forEach((V) => {
|
|
577
|
+
var U, X;
|
|
578
|
+
const Y = t.elementsMap.value.get(V);
|
|
579
|
+
Y && S.set(V, {
|
|
580
|
+
...Y,
|
|
581
|
+
initialHTML: ((U = Y.node) == null ? void 0 : U.outerHTML) ?? "",
|
|
582
|
+
initialRect: (X = Y.node) == null ? void 0 : X.getBoundingClientRect()
|
|
577
583
|
});
|
|
578
584
|
}), S;
|
|
579
585
|
}
|
|
@@ -583,7 +589,7 @@ const T = ge(() => {
|
|
|
583
589
|
const w = /* @__PURE__ */ new Map();
|
|
584
590
|
return w.set(h, {
|
|
585
591
|
...P,
|
|
586
|
-
initialHTML: ((
|
|
592
|
+
initialHTML: ((z = P.node) == null ? void 0 : z.outerHTML) ?? "",
|
|
587
593
|
initialRect: (A = P.node) == null ? void 0 : A.getBoundingClientRect()
|
|
588
594
|
}), w;
|
|
589
595
|
}, v = (h) => {
|
|
@@ -593,33 +599,33 @@ const T = ge(() => {
|
|
|
593
599
|
if (!t.visibleZones.value.has(A)) return !1;
|
|
594
600
|
const S = t.zonesMap.value.get(A);
|
|
595
601
|
return !(!S || P.some(
|
|
596
|
-
(
|
|
602
|
+
(V) => V && (V === S.node || b(S.node, V))
|
|
597
603
|
) || S.groups.length && !!Array.from(
|
|
598
604
|
t.draggingElements.value.values()
|
|
599
|
-
).some((
|
|
605
|
+
).some((Y) => Y.groups.length ? !Y.groups.some((U) => S.groups.includes(U)) : !1));
|
|
600
606
|
});
|
|
601
607
|
return w ? {
|
|
602
608
|
element: _.find(
|
|
603
609
|
(A) => t.visibleElements.value.has(A) && t.elementsMap.value.has(A) && !P.some(
|
|
604
|
-
(S) => S && (S === A ||
|
|
610
|
+
(S) => S && (S === A || b(
|
|
605
611
|
A,
|
|
606
612
|
S
|
|
607
|
-
) ||
|
|
608
|
-
) && (A === w ||
|
|
613
|
+
) || b(S, A))
|
|
614
|
+
) && (A === w || b(
|
|
609
615
|
A,
|
|
610
616
|
w
|
|
611
617
|
))
|
|
612
618
|
) || null,
|
|
613
619
|
zone: w
|
|
614
620
|
} : { element: null, zone: null };
|
|
615
|
-
}, a = ((F = e == null ? void 0 : e.sensor) == null ? void 0 : F.setup) ||
|
|
616
|
-
var A, S,
|
|
617
|
-
const _ = t.hovered.element.value, P = t.hovered.zone.value, w = h.element,
|
|
618
|
-
t.hovered.element.value = w, t.hovered.zone.value =
|
|
619
|
-
}, f =
|
|
621
|
+
}, a = ((F = e == null ? void 0 : e.sensor) == null ? void 0 : F.setup) || ze, c = (h) => {
|
|
622
|
+
var A, S, V, Y, U, X, W, N, ee, te, $, ne;
|
|
623
|
+
const _ = t.hovered.element.value, P = t.hovered.zone.value, w = h.element, z = h.zone;
|
|
624
|
+
t.hovered.element.value = w, t.hovered.zone.value = z, _ !== w && (_ && ((V = (S = (A = t.elementsMap.value.get(_)) == null ? void 0 : A.events) == null ? void 0 : S.onLeave) == null || V.call(S, t, H(t))), w && ((X = (U = (Y = t.elementsMap.value.get(w)) == null ? void 0 : Y.events) == null ? void 0 : U.onHover) == null || X.call(U, t, H(t)))), P !== z && (P && ((ee = (N = (W = t.zonesMap.value.get(P)) == null ? void 0 : W.events) == null ? void 0 : N.onLeave) == null || ee.call(N, t, H(t))), z && ((ne = ($ = (te = t.zonesMap.value.get(z)) == null ? void 0 : te.events) == null ? void 0 : $.onHover) == null || ne.call($, t, H(t))));
|
|
625
|
+
}, f = Ae(() => {
|
|
620
626
|
const h = a(t), _ = v(h);
|
|
621
627
|
c(_);
|
|
622
|
-
}, ((
|
|
628
|
+
}, ((K = e == null ? void 0 : e.sensor) == null ? void 0 : K.throttle) ?? 0), m = () => {
|
|
623
629
|
f(), u = requestAnimationFrame(m);
|
|
624
630
|
}, p = () => m(), E = () => {
|
|
625
631
|
u !== null && (cancelAnimationFrame(u), u = null);
|
|
@@ -629,7 +635,7 @@ const T = ge(() => {
|
|
|
629
635
|
t.draggingElements.value = d(n.value), t.draggingElements.value.forEach(
|
|
630
636
|
(_) => {
|
|
631
637
|
var P, w;
|
|
632
|
-
return (w = (P = _.events).onStart) == null ? void 0 : w.call(P, t,
|
|
638
|
+
return (w = (P = _.events).onStart) == null ? void 0 : w.call(P, t, H(t));
|
|
633
639
|
}
|
|
634
640
|
), h instanceof PointerEvent ? r(h) : o(h), p();
|
|
635
641
|
},
|
|
@@ -637,7 +643,7 @@ const T = ge(() => {
|
|
|
637
643
|
t.draggingElements.value.forEach(
|
|
638
644
|
(_) => {
|
|
639
645
|
var P, w;
|
|
640
|
-
return (w = (P = _.events).onMove) == null ? void 0 : w.call(P, t,
|
|
646
|
+
return (w = (P = _.events).onMove) == null ? void 0 : w.call(P, t, H(t));
|
|
641
647
|
}
|
|
642
648
|
), h instanceof KeyboardEvent ? g() : l(h);
|
|
643
649
|
},
|
|
@@ -646,12 +652,12 @@ const T = ge(() => {
|
|
|
646
652
|
if (s(), i(), h) {
|
|
647
653
|
if (t.hovered.zone.value) {
|
|
648
654
|
const w = t.zonesMap.value.get(t.hovered.zone.value);
|
|
649
|
-
(P = w == null ? void 0 : (_ = w.events).onDrop) == null || P.call(_, t,
|
|
655
|
+
(P = w == null ? void 0 : (_ = w.events).onDrop) == null || P.call(_, t, H(t));
|
|
650
656
|
} else
|
|
651
657
|
t.draggingElements.value.forEach(
|
|
652
658
|
(w) => {
|
|
653
|
-
var
|
|
654
|
-
return (A = (
|
|
659
|
+
var z, A;
|
|
660
|
+
return (A = (z = w.events).onEnd) == null ? void 0 : A.call(z, t, H(t));
|
|
655
661
|
}
|
|
656
662
|
);
|
|
657
663
|
t.selectedElements.value.clear();
|
|
@@ -659,9 +665,9 @@ const T = ge(() => {
|
|
|
659
665
|
t.draggingElements.value.clear(), t.hovered.zone.value = null, t.hovered.element.value = null, E();
|
|
660
666
|
}
|
|
661
667
|
};
|
|
662
|
-
},
|
|
668
|
+
}, Ze = ge(() => {
|
|
663
669
|
let n = "", e = "", t = "", r = null, l = null, s = null, o = null, g = null;
|
|
664
|
-
const { activeContainer: i } =
|
|
670
|
+
const { activeContainer: i } = Z(), u = () => {
|
|
665
671
|
const c = document.body;
|
|
666
672
|
n = c.style.userSelect, c.style.userSelect = "none", window.addEventListener("contextmenu", C), window.addEventListener("selectstart", C), window.addEventListener("touchstart", C), window.addEventListener("touchmove", C);
|
|
667
673
|
}, d = () => {
|
|
@@ -672,8 +678,8 @@ const T = ge(() => {
|
|
|
672
678
|
};
|
|
673
679
|
return {
|
|
674
680
|
handleDragStart: (c, f, m) => {
|
|
675
|
-
v(), c.target.blur(), m != null && m.container && (i.component.value =
|
|
676
|
-
const { activate: p, track: E, deactivate: L } =
|
|
681
|
+
v(), c.target.blur(), m != null && m.container && (i.component.value = m.container);
|
|
682
|
+
const { activate: p, track: E, deactivate: L } = Te(f, m);
|
|
677
683
|
l = () => {
|
|
678
684
|
i.component.value = null, d(), L(!0), v();
|
|
679
685
|
}, s = () => {
|
|
@@ -692,7 +698,7 @@ const T = ge(() => {
|
|
|
692
698
|
isAllowed: s,
|
|
693
699
|
registerElement: o,
|
|
694
700
|
unregisterElement: g
|
|
695
|
-
} =
|
|
701
|
+
} = De(n), { pointerPosition: i } = Z(), { handleDragStart: u } = Ze(), d = (v) => u(v, t, n);
|
|
696
702
|
return Q(o), fe(g), {
|
|
697
703
|
pointerPosition: i,
|
|
698
704
|
elementRef: t,
|
|
@@ -702,14 +708,14 @@ const T = ge(() => {
|
|
|
702
708
|
handleDragStart: d,
|
|
703
709
|
id: e
|
|
704
710
|
};
|
|
705
|
-
},
|
|
711
|
+
}, Ke = (n) => {
|
|
706
712
|
const {
|
|
707
713
|
zonesMap: e,
|
|
708
714
|
hovered: t,
|
|
709
715
|
draggingElements: r,
|
|
710
716
|
isDragging: l,
|
|
711
717
|
handleDropZoneIntersection: s
|
|
712
|
-
} =
|
|
718
|
+
} = Z(), o = O(null), g = T(() => t.zone.value === o.value), i = T(() => {
|
|
713
719
|
if (!o.value || !l.value) return !1;
|
|
714
720
|
const v = e.value.get(o.value);
|
|
715
721
|
return v != null && v.groups.length ? !Array.from(r.value.values()).some((a) => a.groups.length ? !a.groups.some(
|
|
@@ -727,22 +733,22 @@ const T = ge(() => {
|
|
|
727
733
|
}, unregisterZone: () => {
|
|
728
734
|
o.value && (s("remove", o.value), e.value.delete(o.value));
|
|
729
735
|
}, isOvered: g, isAllowed: i };
|
|
730
|
-
},
|
|
731
|
-
const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: s } =
|
|
736
|
+
}, Re = (n) => {
|
|
737
|
+
const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: s } = Ke(n);
|
|
732
738
|
return Q(t), fe(r), { elementRef: e, isOvered: l, isAllowed: s };
|
|
733
|
-
},
|
|
734
|
-
const { selectedElements: e, elementsMap: t } =
|
|
739
|
+
}, Be = (n) => {
|
|
740
|
+
const { selectedElements: e, elementsMap: t } = Z(), r = T(
|
|
735
741
|
() => n.value ? e.value.has(n.value) : !1
|
|
736
|
-
), l =
|
|
742
|
+
), l = T(() => {
|
|
737
743
|
if (!n.value) return !1;
|
|
738
744
|
for (const u of e.value)
|
|
739
|
-
if (u &&
|
|
745
|
+
if (u && b(u, n.value))
|
|
740
746
|
return !0;
|
|
741
747
|
return !1;
|
|
742
|
-
}), s =
|
|
748
|
+
}), s = T(() => {
|
|
743
749
|
if (!n.value) return !1;
|
|
744
750
|
for (const u of e.value)
|
|
745
|
-
if (u &&
|
|
751
|
+
if (u && b(n.value, u))
|
|
746
752
|
return !0;
|
|
747
753
|
return !1;
|
|
748
754
|
}), o = () => {
|
|
@@ -751,10 +757,10 @@ const T = ge(() => {
|
|
|
751
757
|
if (!(!n.value || !t.value.get(n.value))) {
|
|
752
758
|
if (l.value)
|
|
753
759
|
for (const d of e.value)
|
|
754
|
-
d &&
|
|
760
|
+
d && b(d, n.value) && e.value.delete(d);
|
|
755
761
|
if (s.value)
|
|
756
762
|
for (const d of e.value)
|
|
757
|
-
d &&
|
|
763
|
+
d && b(n.value, d) && e.value.delete(d);
|
|
758
764
|
e.value.add(n.value);
|
|
759
765
|
}
|
|
760
766
|
};
|
|
@@ -772,10 +778,10 @@ export {
|
|
|
772
778
|
se as DnDOperations,
|
|
773
779
|
Ue as default,
|
|
774
780
|
B as getBoundingBox,
|
|
775
|
-
|
|
776
|
-
|
|
781
|
+
Z as useDnDStore,
|
|
782
|
+
Se as useDragContainer,
|
|
777
783
|
He as useDraggable,
|
|
778
|
-
|
|
779
|
-
|
|
784
|
+
Re as useDroppable,
|
|
785
|
+
Be as useSelection
|
|
780
786
|
};
|
|
781
787
|
//# sourceMappingURL=vue-dnd-kit-core.es.js.map
|