@vue-dnd-kit/core 1.1.8 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as V, computed as
|
|
5
|
-
import { createGlobalState as
|
|
6
|
-
const
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var de = (n, e, t) => e in n ? ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var k = (n, e, t) => de(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ref as V, computed as T, shallowRef as Y, onMounted as G, onUnmounted as fe, defineComponent as ie, createElementBlock as N, createCommentVNode as ge, unref as y, openBlock as F, normalizeStyle as W, Fragment as me, renderList as he, createBlock as $, Transition as pe, withCtx as Ee, resolveDynamicComponent as ee, createVNode as ye, render as te, useId as xe, markRaw as we, onBeforeUnmount as ue } from "vue";
|
|
5
|
+
import { createGlobalState as ce, useMagicKeys as Me, useThrottleFn as Pe } from "@vueuse/core";
|
|
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
|
-
const o =
|
|
18
|
-
|
|
19
|
-
}),
|
|
17
|
+
const o = x.remove(e, t);
|
|
18
|
+
x.insert(r, l, o);
|
|
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 o = e[t], s = r[l];
|
|
23
23
|
e[t] = s, r[l] = o;
|
|
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 o = e[t];
|
|
28
|
-
|
|
29
|
-
}),
|
|
30
|
-
var l, o, s,
|
|
28
|
+
x.insert(r, l, o);
|
|
29
|
+
}), k(x, "applyTransfer", (e) => {
|
|
30
|
+
var l, o, s, g, i, c, d;
|
|
31
31
|
const t = e.hovered.element.value, r = e.hovered.zone.value;
|
|
32
32
|
if (t) {
|
|
33
|
-
const v = (o = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : o.source, a = (
|
|
33
|
+
const v = (o = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : o.source, a = (g = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : g.index, u = e.draggingElements.value.values().next().value, f = (i = u == null ? void 0 : u.data) == null ? void 0 : i.index, m = f !== void 0 && a !== void 0 && f > a ? 1 : -1;
|
|
34
34
|
Array.from(
|
|
35
35
|
e.draggingElements.value.values()
|
|
36
36
|
).sort(
|
|
37
|
-
(
|
|
38
|
-
var
|
|
39
|
-
return m * ((((
|
|
37
|
+
(E, L) => {
|
|
38
|
+
var w, 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
|
-
(
|
|
43
|
-
var
|
|
44
|
-
return
|
|
45
|
-
(
|
|
46
|
-
(
|
|
42
|
+
(E) => {
|
|
43
|
+
var L, w;
|
|
44
|
+
return x.move(
|
|
45
|
+
(L = E.data) == null ? void 0 : L.source,
|
|
46
|
+
(w = E.data) == null ? void 0 : w.index,
|
|
47
47
|
v,
|
|
48
48
|
a
|
|
49
49
|
);
|
|
@@ -53,36 +53,36 @@ b(p, "remove", (e, t) => {
|
|
|
53
53
|
const v = (d = (c = e.zonesMap.value.get(r)) == null ? void 0 : c.data) == null ? void 0 : d.source, a = v == null ? void 0 : v.length;
|
|
54
54
|
Array.from(
|
|
55
55
|
e.draggingElements.value.values()
|
|
56
|
-
).sort((
|
|
57
|
-
var
|
|
58
|
-
return (((
|
|
56
|
+
).sort((f, m) => {
|
|
57
|
+
var p, E;
|
|
58
|
+
return (((p = m.data) == null ? void 0 : p.index) || 0) - (((E = f.data) == null ? void 0 : E.index) || 0);
|
|
59
59
|
}).forEach(
|
|
60
|
-
(
|
|
61
|
-
var m,
|
|
62
|
-
return
|
|
63
|
-
(m =
|
|
64
|
-
(
|
|
60
|
+
(f) => {
|
|
61
|
+
var m, p;
|
|
62
|
+
return x.move(
|
|
63
|
+
(m = f.data) == null ? void 0 : m.source,
|
|
64
|
+
(p = f.data) == null ? void 0 : p.index,
|
|
65
65
|
v,
|
|
66
66
|
a
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
}),
|
|
72
|
-
var l, o, s,
|
|
71
|
+
}), k(x, "applyCopy", (e) => {
|
|
72
|
+
var l, o, s, g, i, c;
|
|
73
73
|
const t = e.hovered.element.value, r = e.hovered.zone.value;
|
|
74
74
|
if (t) {
|
|
75
|
-
const d = (o = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : o.source, v = (
|
|
75
|
+
const d = (o = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : o.source, v = (g = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : g.index;
|
|
76
76
|
Array.from(
|
|
77
77
|
e.draggingElements.value.values()
|
|
78
|
-
).sort((u,
|
|
79
|
-
var m,
|
|
80
|
-
return (((m =
|
|
78
|
+
).sort((u, f) => {
|
|
79
|
+
var m, p;
|
|
80
|
+
return (((m = f.data) == null ? void 0 : m.index) || 0) - (((p = u.data) == null ? void 0 : p.index) || 0);
|
|
81
81
|
}).forEach(
|
|
82
82
|
(u) => {
|
|
83
|
-
var
|
|
84
|
-
return
|
|
85
|
-
(
|
|
83
|
+
var f, m;
|
|
84
|
+
return x.copy(
|
|
85
|
+
(f = u.data) == null ? void 0 : f.source,
|
|
86
86
|
(m = u.data) == null ? void 0 : m.index,
|
|
87
87
|
d,
|
|
88
88
|
v
|
|
@@ -93,14 +93,14 @@ b(p, "remove", (e, t) => {
|
|
|
93
93
|
const d = (c = (i = e.zonesMap.value.get(r)) == null ? void 0 : i.data) == null ? void 0 : c.source, v = d == null ? void 0 : d.length;
|
|
94
94
|
Array.from(
|
|
95
95
|
e.draggingElements.value.values()
|
|
96
|
-
).sort((u,
|
|
97
|
-
var m,
|
|
98
|
-
return (((m =
|
|
96
|
+
).sort((u, f) => {
|
|
97
|
+
var m, p;
|
|
98
|
+
return (((m = f.data) == null ? void 0 : m.index) || 0) - (((p = u.data) == null ? void 0 : p.index) || 0);
|
|
99
99
|
}).forEach(
|
|
100
100
|
(u) => {
|
|
101
|
-
var
|
|
102
|
-
return
|
|
103
|
-
(
|
|
101
|
+
var f, m;
|
|
102
|
+
return x.copy(
|
|
103
|
+
(f = u.data) == null ? void 0 : f.source,
|
|
104
104
|
(m = u.data) == null ? void 0 : m.index,
|
|
105
105
|
d,
|
|
106
106
|
v
|
|
@@ -108,37 +108,37 @@ b(p, "remove", (e, t) => {
|
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
}),
|
|
112
|
-
var l, o, s,
|
|
111
|
+
}), k(x, "applySwap", (e) => {
|
|
112
|
+
var l, o, s, g, i, c, d, v;
|
|
113
113
|
const t = e.hovered.element.value, r = e.hovered.zone.value;
|
|
114
114
|
if (t && e.draggingElements.value.size === 1) {
|
|
115
115
|
const a = e.draggingElements.value.values().next().value;
|
|
116
|
-
|
|
116
|
+
x.swap(
|
|
117
117
|
(l = a == null ? void 0 : a.data) == null ? void 0 : l.source,
|
|
118
118
|
(o = a == null ? void 0 : a.data) == null ? void 0 : o.index,
|
|
119
|
-
(
|
|
119
|
+
(g = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : g.source,
|
|
120
120
|
(c = (i = e.elementsMap.value.get(t)) == null ? void 0 : i.data) == null ? void 0 : c.index
|
|
121
121
|
);
|
|
122
122
|
} else if (r) {
|
|
123
123
|
const a = (v = (d = e.zonesMap.value.get(r)) == null ? void 0 : d.data) == null ? void 0 : v.source, u = a == null ? void 0 : a.length;
|
|
124
124
|
Array.from(
|
|
125
125
|
e.draggingElements.value.values()
|
|
126
|
-
).sort((m,
|
|
127
|
-
var
|
|
128
|
-
return (((
|
|
126
|
+
).sort((m, p) => {
|
|
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
|
-
var
|
|
132
|
-
return
|
|
133
|
-
(
|
|
134
|
-
(
|
|
131
|
+
var p, E;
|
|
132
|
+
return x.move(
|
|
133
|
+
(p = m.data) == null ? void 0 : p.source,
|
|
134
|
+
(E = m.data) == null ? void 0 : E.index,
|
|
135
135
|
a,
|
|
136
136
|
u
|
|
137
137
|
);
|
|
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) => {
|
|
@@ -146,33 +146,34 @@ b(p, "remove", (e, t) => {
|
|
|
146
146
|
return (((o = l.data) == null ? void 0 : o.index) || 0) - (((s = r.data) == null ? void 0 : s.index) || 0);
|
|
147
147
|
}).forEach((r) => {
|
|
148
148
|
var l, o;
|
|
149
|
-
(l = r.data) != null && l.source && ((o = r.data) == null ? void 0 : o.index) !== void 0 &&
|
|
149
|
+
(l = r.data) != null && l.source && ((o = r.data) == null ? void 0 : o.index) !== void 0 && x.remove(r.data.source, r.data.index);
|
|
150
150
|
});
|
|
151
|
-
}),
|
|
152
|
-
var o, s,
|
|
151
|
+
}), k(x, "applyInsert", (e, t) => {
|
|
152
|
+
var o, s, g, i, c, d;
|
|
153
153
|
const r = e.hovered.element.value, l = e.hovered.zone.value;
|
|
154
154
|
if (r && t.length > 0) {
|
|
155
|
-
const v = (s = (o = e.elementsMap.value.get(r)) == null ? void 0 : o.data) == null ? void 0 : s.source, a = (i = (
|
|
155
|
+
const v = (s = (o = e.elementsMap.value.get(r)) == null ? void 0 : o.data) == null ? void 0 : s.source, a = (i = (g = e.elementsMap.value.get(r)) == null ? void 0 : g.data) == null ? void 0 : i.index;
|
|
156
156
|
t.forEach((u) => {
|
|
157
|
-
|
|
157
|
+
x.insert(v, a, u);
|
|
158
158
|
});
|
|
159
159
|
} else if (l) {
|
|
160
160
|
const v = (d = (c = e.zonesMap.value.get(l)) == null ? void 0 : c.data) == null ? void 0 : d.source, a = v == null ? void 0 : v.length;
|
|
161
161
|
t.forEach((u) => {
|
|
162
|
-
|
|
162
|
+
x.insert(v, a, u);
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
|
-
let
|
|
167
|
-
const K =
|
|
166
|
+
let ne = x;
|
|
167
|
+
const K = ce(() => {
|
|
168
168
|
const n = V(
|
|
169
169
|
/* @__PURE__ */ new Map()
|
|
170
|
-
), e =
|
|
170
|
+
), e = T(() => n.value.size > 0), t = {
|
|
171
171
|
component: V(null),
|
|
172
|
-
ref: Y(null)
|
|
173
|
-
|
|
172
|
+
ref: Y(null),
|
|
173
|
+
options: Y(null)
|
|
174
|
+
}, r = V(/* @__PURE__ */ new Map()), l = V(/* @__PURE__ */ new Set()), o = V(/* @__PURE__ */ new Map()), s = V(/* @__PURE__ */ new Set()), g = V(/* @__PURE__ */ new Set()), i = new IntersectionObserver((Z) => {
|
|
174
175
|
Z.forEach(
|
|
175
|
-
(h) =>
|
|
176
|
+
(h) => g.value[h.isIntersecting ? "add" : "delete"](
|
|
176
177
|
h.target
|
|
177
178
|
)
|
|
178
179
|
);
|
|
@@ -181,7 +182,7 @@ const K = ie(() => {
|
|
|
181
182
|
(h) => s.value[h.isIntersecting ? "add" : "delete"](h.target)
|
|
182
183
|
);
|
|
183
184
|
}), d = (Z, h) => {
|
|
184
|
-
Z === "add" ? i.observe(h) : (i.unobserve(h),
|
|
185
|
+
Z === "add" ? i.observe(h) : (i.unobserve(h), g.value.delete(h));
|
|
185
186
|
}, v = (Z, h) => {
|
|
186
187
|
Z === "add" ? c.observe(h) : (c.unobserve(h), s.value.delete(h));
|
|
187
188
|
}, a = {
|
|
@@ -191,7 +192,7 @@ const K = ie(() => {
|
|
|
191
192
|
percent: Y(null),
|
|
192
193
|
pixel: Y(null)
|
|
193
194
|
}
|
|
194
|
-
}, { w: u, s:
|
|
195
|
+
}, { w: u, s: f, a: m, d: p, ctrl: E, shift: L, alt: w, meta: I } = Me(), B = {
|
|
195
196
|
zone: Y(null),
|
|
196
197
|
element: Y(null)
|
|
197
198
|
};
|
|
@@ -203,41 +204,41 @@ const K = ie(() => {
|
|
|
203
204
|
selectedElements: l,
|
|
204
205
|
zonesMap: o,
|
|
205
206
|
visibleZones: s,
|
|
206
|
-
visibleElements:
|
|
207
|
+
visibleElements: g,
|
|
207
208
|
pointerPosition: a,
|
|
208
209
|
keyboard: {
|
|
209
210
|
w: u,
|
|
210
|
-
s:
|
|
211
|
+
s: f,
|
|
211
212
|
a: m,
|
|
212
|
-
d:
|
|
213
|
-
ctrl:
|
|
214
|
-
shift:
|
|
215
|
-
alt:
|
|
213
|
+
d: p,
|
|
214
|
+
ctrl: E,
|
|
215
|
+
shift: L,
|
|
216
|
+
alt: w,
|
|
216
217
|
meta: I
|
|
217
218
|
},
|
|
218
|
-
hovered:
|
|
219
|
+
hovered: B,
|
|
219
220
|
handleDragElementIntersection: d,
|
|
220
221
|
handleDropZoneIntersection: v
|
|
221
222
|
};
|
|
222
|
-
}),
|
|
223
|
-
const
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
}),
|
|
227
|
-
|
|
223
|
+
}), Le = (n) => {
|
|
224
|
+
const e = V(null), { draggingElements: t, pointerPosition: r, isDragging: l, activeContainer: o } = K();
|
|
225
|
+
return G(() => {
|
|
226
|
+
o.ref = e, o.options.value = n ?? null;
|
|
227
|
+
}), fe(() => {
|
|
228
|
+
o.ref.value = null, o.options.value = null;
|
|
228
229
|
}), {
|
|
229
|
-
elementRef:
|
|
230
|
-
draggingElements:
|
|
231
|
-
pointerPosition:
|
|
232
|
-
isDragging:
|
|
230
|
+
elementRef: e,
|
|
231
|
+
draggingElements: t,
|
|
232
|
+
pointerPosition: r,
|
|
233
|
+
isDragging: l
|
|
233
234
|
};
|
|
234
|
-
},
|
|
235
|
+
}, Ae = ["innerHTML"], _e = /* @__PURE__ */ ie({
|
|
235
236
|
__name: "DefaultOverlay",
|
|
236
237
|
setup(n) {
|
|
237
|
-
const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: l } =
|
|
238
|
-
var s,
|
|
238
|
+
const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: l } = Le(), o = T(() => {
|
|
239
|
+
var s, g, i, c;
|
|
239
240
|
return {
|
|
240
|
-
transform: `translate3d(${(((s = t.current.value) == null ? void 0 : s.x) ?? 0) - (((
|
|
241
|
+
transform: `translate3d(${(((s = t.current.value) == null ? void 0 : s.x) ?? 0) - (((g = t.offset.pixel.value) == null ? void 0 : g.x) ?? 0)}px, ${(((i = t.current.value) == null ? void 0 : i.y) ?? 0) - (((c = t.offset.pixel.value) == null ? void 0 : c.y) ?? 0)}px, 0)`,
|
|
241
242
|
zIndex: 1e3,
|
|
242
243
|
position: "fixed",
|
|
243
244
|
top: 0,
|
|
@@ -245,46 +246,75 @@ const K = ie(() => {
|
|
|
245
246
|
transition: "0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
246
247
|
};
|
|
247
248
|
});
|
|
248
|
-
return (s,
|
|
249
|
+
return (s, g) => y(r) ? (F(), N("div", {
|
|
249
250
|
key: 0,
|
|
250
251
|
ref_key: "elementRef",
|
|
251
252
|
ref: e,
|
|
252
|
-
style:
|
|
253
|
+
style: W(o.value)
|
|
253
254
|
}, [
|
|
254
|
-
(
|
|
255
|
+
(F(!0), N(me, null, he(y(l), ([i, c]) => {
|
|
255
256
|
var d, v;
|
|
256
|
-
return
|
|
257
|
+
return F(), N("div", {
|
|
257
258
|
key: c.id,
|
|
258
259
|
innerHTML: c.initialHTML,
|
|
259
|
-
style:
|
|
260
|
+
style: W({
|
|
260
261
|
width: `${(d = c.initialRect) == null ? void 0 : d.width}px`,
|
|
261
262
|
height: `${(v = c.initialRect) == null ? void 0 : v.height}px`
|
|
262
263
|
})
|
|
263
|
-
}, null, 12,
|
|
264
|
+
}, null, 12, Ae);
|
|
264
265
|
}), 128))
|
|
265
|
-
], 4)) :
|
|
266
|
+
], 4)) : ge("", !0);
|
|
266
267
|
}
|
|
267
|
-
}),
|
|
268
|
+
}), re = /* @__PURE__ */ ie({
|
|
268
269
|
__name: "DragOverlay",
|
|
269
270
|
setup(n) {
|
|
270
|
-
const { activeContainer: e } = K(), t =
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
const { activeContainer: e } = K(), t = T(() => e.component.value ?? _e);
|
|
272
|
+
return (r, l) => y(e).options.value ? (F(), $(pe, {
|
|
273
|
+
key: 0,
|
|
274
|
+
name: y(e).options.value.name,
|
|
275
|
+
duration: y(e).options.value.duration,
|
|
276
|
+
"enter-from-class": y(e).options.value.enterFromClass,
|
|
277
|
+
"enter-to-class": y(e).options.value.enterToClass,
|
|
278
|
+
"enter-active-class": y(e).options.value.enterActiveClass,
|
|
279
|
+
"leave-from-class": y(e).options.value.leaveFromClass,
|
|
280
|
+
"leave-to-class": y(e).options.value.leaveToClass,
|
|
281
|
+
"leave-active-class": y(e).options.value.leaveActiveClass,
|
|
282
|
+
mode: y(e).options.value.mode,
|
|
283
|
+
type: y(e).options.value.type,
|
|
284
|
+
css: y(e).options.value.css,
|
|
285
|
+
appear: y(e).options.value.appear,
|
|
286
|
+
"appear-active-class": y(e).options.value.appearActiveClass,
|
|
287
|
+
"appear-from-class": y(e).options.value.appearFromClass,
|
|
288
|
+
"appear-to-class": y(e).options.value.appearToClass,
|
|
289
|
+
persisted: y(e).options.value.persisted,
|
|
290
|
+
onEnter: y(e).options.value.onEnter,
|
|
291
|
+
onLeave: y(e).options.value.onLeave,
|
|
292
|
+
onBeforeEnter: y(e).options.value.onBeforeEnter,
|
|
293
|
+
onBeforeLeave: y(e).options.value.onBeforeLeave,
|
|
294
|
+
onBeforeAppear: y(e).options.value.onBeforeAppear,
|
|
295
|
+
onAfterEnter: y(e).options.value.onAfterEnter,
|
|
296
|
+
onAfterLeave: y(e).options.value.onAfterLeave,
|
|
297
|
+
onAfterAppear: y(e).options.value.onAfterAppear
|
|
298
|
+
}, {
|
|
299
|
+
default: Ee(() => [
|
|
300
|
+
(F(), $(ee(t.value)))
|
|
301
|
+
]),
|
|
302
|
+
_: 1
|
|
303
|
+
}, 8, ["name", "duration", "enter-from-class", "enter-to-class", "enter-active-class", "leave-from-class", "leave-to-class", "leave-active-class", "mode", "type", "css", "appear", "appear-active-class", "appear-from-class", "appear-to-class", "persisted", "onEnter", "onLeave", "onBeforeEnter", "onBeforeLeave", "onBeforeAppear", "onAfterEnter", "onAfterLeave", "onAfterAppear"])) : (F(), $(ee(t.value), { key: 1 }));
|
|
274
304
|
}
|
|
275
|
-
}),
|
|
305
|
+
}), Ve = {
|
|
276
306
|
install(n) {
|
|
277
|
-
n.component("DragOverlay",
|
|
307
|
+
n.component("DragOverlay", re);
|
|
278
308
|
const e = n.mount;
|
|
279
309
|
n.mount = function(r) {
|
|
280
310
|
const l = e.call(this, r), o = typeof r == "string" ? document.querySelector(r) : r;
|
|
281
311
|
if (o && o instanceof Element && !o.querySelector("#vue-dnd-kit-overlay")) {
|
|
282
312
|
const s = document.createElement("div");
|
|
283
313
|
s.id = "vue-dnd-kit-overlay", s.style.pointerEvents = "none", o.appendChild(s);
|
|
284
|
-
const
|
|
285
|
-
|
|
314
|
+
const g = ye(re);
|
|
315
|
+
te(g, s), n.__VUE_DND_KIT_OVERLAY__ = {
|
|
286
316
|
container: s,
|
|
287
|
-
vnode:
|
|
317
|
+
vnode: g
|
|
288
318
|
};
|
|
289
319
|
const i = K();
|
|
290
320
|
n.__VUE_DND_KIT_STORE__ = i;
|
|
@@ -293,10 +323,10 @@ const K = ie(() => {
|
|
|
293
323
|
};
|
|
294
324
|
const t = n.unmount;
|
|
295
325
|
n.unmount = function() {
|
|
296
|
-
return n.__VUE_DND_KIT_OVERLAY__ && (
|
|
326
|
+
return n.__VUE_DND_KIT_OVERLAY__ && (te(null, n.__VUE_DND_KIT_OVERLAY__.container), delete n.__VUE_DND_KIT_OVERLAY__), t.call(this);
|
|
297
327
|
};
|
|
298
328
|
}
|
|
299
|
-
},
|
|
329
|
+
}, ae = (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, H = (n) => {
|
|
300
330
|
if (!n)
|
|
301
331
|
return {
|
|
302
332
|
x: 0,
|
|
@@ -319,11 +349,11 @@ const K = ie(() => {
|
|
|
319
349
|
width: e.width,
|
|
320
350
|
height: e.height
|
|
321
351
|
};
|
|
322
|
-
},
|
|
352
|
+
}, q = (n) => ({
|
|
323
353
|
x: n.x + n.width / 2,
|
|
324
354
|
y: n.y + n.height / 2
|
|
325
|
-
}),
|
|
326
|
-
const t =
|
|
355
|
+
}), Se = (n, e) => {
|
|
356
|
+
const t = H(n);
|
|
327
357
|
return {
|
|
328
358
|
pixel: {
|
|
329
359
|
x: e.x - t.x,
|
|
@@ -334,10 +364,10 @@ const K = ie(() => {
|
|
|
334
364
|
y: (e.y - t.y) / t.height * 100
|
|
335
365
|
}
|
|
336
366
|
};
|
|
337
|
-
},
|
|
367
|
+
}, le = (n, e) => {
|
|
338
368
|
const t = e.x - n.x, r = e.y - n.y;
|
|
339
369
|
return Math.sqrt(t * t + r * r);
|
|
340
|
-
},
|
|
370
|
+
}, oe = (n, e) => {
|
|
341
371
|
const t = Math.max(
|
|
342
372
|
0,
|
|
343
373
|
Math.min(n.x + n.width, e.x + e.width) - Math.max(n.x, e.x)
|
|
@@ -348,23 +378,23 @@ const K = ie(() => {
|
|
|
348
378
|
return (l / o * 100 + l / s * 100) / 2;
|
|
349
379
|
}, se = "data-vue-dnd-kit-draggable", z = (n) => {
|
|
350
380
|
n.preventDefault();
|
|
351
|
-
},
|
|
381
|
+
}, Ie = (n) => {
|
|
352
382
|
const {
|
|
353
383
|
elementsMap: e,
|
|
354
384
|
draggingElements: t,
|
|
355
385
|
hovered: r,
|
|
356
|
-
|
|
386
|
+
selectedElements: l,
|
|
357
387
|
isDragging: o,
|
|
358
388
|
visibleElements: s,
|
|
359
|
-
handleDragElementIntersection:
|
|
360
|
-
} = K(), i = V(null), c =
|
|
389
|
+
handleDragElementIntersection: g
|
|
390
|
+
} = K(), i = V(null), c = T(
|
|
361
391
|
() => s.value.has(i.value) && r.element.value === i.value
|
|
362
|
-
), d = Y((n == null ? void 0 : n.id) ||
|
|
392
|
+
), d = Y((n == null ? void 0 : n.id) || xe()), v = T(() => !i.value || !s.value.has(i.value) ? !1 : t.value.has(i.value)), a = T(() => {
|
|
363
393
|
if (!i.value || !o.value || !s.value.has(i.value)) return !1;
|
|
364
394
|
const m = e.value.get(i.value);
|
|
365
395
|
return m != null && m.groups.length ? !Array.from(t.value.entries()).some(
|
|
366
|
-
([
|
|
367
|
-
(
|
|
396
|
+
([p, E]) => E.groups.length ? !E.groups.some(
|
|
397
|
+
(L) => m.groups.includes(L)
|
|
368
398
|
) : !1
|
|
369
399
|
) : !0;
|
|
370
400
|
});
|
|
@@ -380,7 +410,7 @@ const K = ie(() => {
|
|
|
380
410
|
events: (n == null ? void 0 : n.events) ?? {},
|
|
381
411
|
data: (n == null ? void 0 : n.data) ?? null,
|
|
382
412
|
id: d.value
|
|
383
|
-
}),
|
|
413
|
+
}), g("add", i.value), i.value.addEventListener("dragstart", z), i.value.addEventListener("drag", z), i.value.setAttribute(se, "true"), i.value.setAttribute("draggable", "false");
|
|
384
414
|
},
|
|
385
415
|
unregisterElement: () => {
|
|
386
416
|
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(se), i.value.removeAttribute("draggable"));
|
|
@@ -390,24 +420,24 @@ const K = ie(() => {
|
|
|
390
420
|
isAllowed: a,
|
|
391
421
|
id: d
|
|
392
422
|
};
|
|
393
|
-
},
|
|
423
|
+
}, b = (n, e) => n ? e.contains(n) : !1, ze = (n) => {
|
|
394
424
|
var d, v;
|
|
395
|
-
const e =
|
|
425
|
+
const e = H(n.activeContainer.ref.value), t = q(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, s = !(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]) => {
|
|
396
426
|
if (!a) return !1;
|
|
397
|
-
const
|
|
398
|
-
return
|
|
427
|
+
const f = H(a);
|
|
428
|
+
return f && e && ae(f, e);
|
|
399
429
|
}).map(([a, u]) => {
|
|
400
|
-
const
|
|
401
|
-
let
|
|
402
|
-
for (const [I,
|
|
403
|
-
I !== a && I && a &&
|
|
430
|
+
const f = H(a), m = q(f), p = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = oe(f, e), L = le(t, m);
|
|
431
|
+
let w = 0;
|
|
432
|
+
for (const [I, B] of n.visibleElements.value.entries())
|
|
433
|
+
I !== a && I && a && b(a, I) && w++;
|
|
404
434
|
return {
|
|
405
435
|
element: u,
|
|
406
436
|
node: a,
|
|
407
|
-
isPointerInElement:
|
|
408
|
-
overlapPercent:
|
|
409
|
-
depth:
|
|
410
|
-
centerDistance:
|
|
437
|
+
isPointerInElement: p,
|
|
438
|
+
overlapPercent: E,
|
|
439
|
+
depth: w,
|
|
440
|
+
centerDistance: L
|
|
411
441
|
};
|
|
412
442
|
}).sort((a, u) => {
|
|
413
443
|
if (!s) {
|
|
@@ -418,24 +448,24 @@ const K = ie(() => {
|
|
|
418
448
|
}
|
|
419
449
|
return Math.abs(a.overlapPercent - u.overlapPercent) <= 1 ? a.centerDistance - u.centerDistance : u.overlapPercent - a.overlapPercent;
|
|
420
450
|
}), c = Array.from(n.visibleZones.value.entries()).filter(([a, u]) => {
|
|
421
|
-
if (!a ||
|
|
422
|
-
(m) => m &&
|
|
451
|
+
if (!a || g.some(
|
|
452
|
+
(m) => m && b(a, m)
|
|
423
453
|
))
|
|
424
454
|
return !1;
|
|
425
|
-
const
|
|
426
|
-
return
|
|
455
|
+
const f = H(a);
|
|
456
|
+
return f && e && ae(f, e);
|
|
427
457
|
}).map(([a, u]) => {
|
|
428
|
-
const
|
|
429
|
-
let
|
|
430
|
-
for (const [I,
|
|
431
|
-
I !== a && I && a &&
|
|
458
|
+
const f = H(a), m = q(f), p = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = oe(f, e), L = le(t, m);
|
|
459
|
+
let w = 0;
|
|
460
|
+
for (const [I, B] of n.visibleZones.value.entries())
|
|
461
|
+
I !== a && I && a && b(a, I) && w++;
|
|
432
462
|
return {
|
|
433
463
|
zone: u,
|
|
434
464
|
node: a,
|
|
435
|
-
isPointerInElement:
|
|
436
|
-
overlapPercent:
|
|
437
|
-
depth:
|
|
438
|
-
centerDistance:
|
|
465
|
+
isPointerInElement: p,
|
|
466
|
+
overlapPercent: E,
|
|
467
|
+
depth: w,
|
|
468
|
+
centerDistance: L
|
|
439
469
|
};
|
|
440
470
|
}).sort((a, u) => {
|
|
441
471
|
if (!s) {
|
|
@@ -450,13 +480,13 @@ const K = ie(() => {
|
|
|
450
480
|
...i.map((a) => a.node),
|
|
451
481
|
...c.map((a) => a.node)
|
|
452
482
|
];
|
|
453
|
-
},
|
|
483
|
+
}, Ce = (n, e) => {
|
|
454
484
|
const { pointerPosition: t, keyboard: r } = K(), l = (e == null ? void 0 : e.moveStep) || 10;
|
|
455
485
|
return {
|
|
456
486
|
onKeyboardStart: (i) => {
|
|
457
487
|
var a;
|
|
458
488
|
z(i);
|
|
459
|
-
const c =
|
|
489
|
+
const c = H(n.value);
|
|
460
490
|
(a = n.value) == null || a.blur();
|
|
461
491
|
const d = c.x + c.width / 2, v = c.y + c.height / 2;
|
|
462
492
|
t.start.value = {
|
|
@@ -486,7 +516,7 @@ const K = ie(() => {
|
|
|
486
516
|
t.current.value = null, t.start.value = null, t.offset.pixel.value = null, t.offset.percent.value = null;
|
|
487
517
|
}
|
|
488
518
|
};
|
|
489
|
-
},
|
|
519
|
+
}, De = (n) => {
|
|
490
520
|
const e = K();
|
|
491
521
|
return {
|
|
492
522
|
onPointerStart: (o) => {
|
|
@@ -494,11 +524,11 @@ const K = ie(() => {
|
|
|
494
524
|
x: o.clientX,
|
|
495
525
|
y: o.clientY
|
|
496
526
|
};
|
|
497
|
-
const { pixel: s, percent:
|
|
527
|
+
const { pixel: s, percent: g } = Se(n.value, {
|
|
498
528
|
x: o.clientX,
|
|
499
529
|
y: o.clientY
|
|
500
530
|
});
|
|
501
|
-
e.pointerPosition.offset.pixel.value = s, e.pointerPosition.offset.percent.value =
|
|
531
|
+
e.pointerPosition.offset.pixel.value = s, e.pointerPosition.offset.percent.value = g;
|
|
502
532
|
},
|
|
503
533
|
onPointerMove: (o) => {
|
|
504
534
|
e.pointerPosition.current.value = {
|
|
@@ -510,113 +540,113 @@ const K = ie(() => {
|
|
|
510
540
|
e.pointerPosition.current.value = null, e.pointerPosition.start.value = null, e.pointerPosition.offset.pixel.value = null, e.pointerPosition.offset.percent.value = null;
|
|
511
541
|
}
|
|
512
542
|
};
|
|
513
|
-
},
|
|
514
|
-
var
|
|
515
|
-
const t = K(), { onPointerStart: r, onPointerMove: l, onPointerEnd: o } =
|
|
543
|
+
}, ke = (n, e) => {
|
|
544
|
+
var B, Z;
|
|
545
|
+
const t = K(), { onPointerStart: r, onPointerMove: l, onPointerEnd: o } = De(n), { onKeyboardStart: s, onKeyboardMove: g, onKeyboardEnd: i } = Ce(
|
|
516
546
|
n,
|
|
517
547
|
e == null ? void 0 : e.keyboard
|
|
518
548
|
);
|
|
519
549
|
let c = null;
|
|
520
550
|
const d = (h) => {
|
|
521
|
-
var
|
|
551
|
+
var D, A;
|
|
522
552
|
if (!h) return /* @__PURE__ */ new Map();
|
|
523
|
-
const
|
|
524
|
-
if (t.selectedElements.value.size > 0 &&
|
|
525
|
-
const
|
|
526
|
-
return t.selectedElements.value.forEach((
|
|
553
|
+
const _ = t.selectedElements.value.has(h);
|
|
554
|
+
if (t.selectedElements.value.size > 0 && _) {
|
|
555
|
+
const S = /* @__PURE__ */ new Map();
|
|
556
|
+
return t.selectedElements.value.forEach((C) => {
|
|
527
557
|
var O, R;
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
...
|
|
531
|
-
initialHTML: ((O =
|
|
532
|
-
initialRect: (R =
|
|
558
|
+
const U = t.elementsMap.value.get(C);
|
|
559
|
+
U && S.set(C, {
|
|
560
|
+
...U,
|
|
561
|
+
initialHTML: ((O = U.node) == null ? void 0 : O.outerHTML) ?? "",
|
|
562
|
+
initialRect: (R = U.node) == null ? void 0 : R.getBoundingClientRect()
|
|
533
563
|
});
|
|
534
|
-
}),
|
|
564
|
+
}), S;
|
|
535
565
|
}
|
|
536
566
|
t.selectedElements.value.clear();
|
|
537
|
-
const
|
|
538
|
-
if (!
|
|
539
|
-
const
|
|
540
|
-
return
|
|
541
|
-
...
|
|
542
|
-
initialHTML: ((
|
|
543
|
-
initialRect: (
|
|
544
|
-
}),
|
|
567
|
+
const P = t.elementsMap.value.get(h);
|
|
568
|
+
if (!P) return /* @__PURE__ */ new Map();
|
|
569
|
+
const M = /* @__PURE__ */ new Map();
|
|
570
|
+
return M.set(h, {
|
|
571
|
+
...P,
|
|
572
|
+
initialHTML: ((D = P.node) == null ? void 0 : D.outerHTML) ?? "",
|
|
573
|
+
initialRect: (A = P.node) == null ? void 0 : A.getBoundingClientRect()
|
|
574
|
+
}), M;
|
|
545
575
|
}, v = (h) => {
|
|
546
576
|
if (!h)
|
|
547
577
|
return { element: null, zone: null };
|
|
548
|
-
const
|
|
549
|
-
if (!t.visibleZones.value.has(
|
|
550
|
-
const
|
|
551
|
-
return !(!
|
|
552
|
-
(
|
|
553
|
-
) ||
|
|
578
|
+
const _ = Array.isArray(h) ? h : [h], P = Array.from(t.draggingElements.value.keys()), M = _.find((A) => {
|
|
579
|
+
if (!t.visibleZones.value.has(A)) return !1;
|
|
580
|
+
const S = t.zonesMap.value.get(A);
|
|
581
|
+
return !(!S || P.some(
|
|
582
|
+
(C) => C && (C === S.node || b(S.node, C))
|
|
583
|
+
) || S.groups.length && !!Array.from(
|
|
554
584
|
t.draggingElements.value.values()
|
|
555
|
-
).some((
|
|
585
|
+
).some((U) => U.groups.length ? !U.groups.some((O) => S.groups.includes(O)) : !1));
|
|
556
586
|
});
|
|
557
|
-
return
|
|
558
|
-
element:
|
|
559
|
-
(
|
|
560
|
-
(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
) ||
|
|
564
|
-
) && (
|
|
565
|
-
|
|
566
|
-
|
|
587
|
+
return M ? {
|
|
588
|
+
element: _.find(
|
|
589
|
+
(A) => t.visibleElements.value.has(A) && t.elementsMap.value.has(A) && !P.some(
|
|
590
|
+
(S) => S && (S === A || b(
|
|
591
|
+
A,
|
|
592
|
+
S
|
|
593
|
+
) || b(S, A))
|
|
594
|
+
) && (A === M || b(
|
|
595
|
+
A,
|
|
596
|
+
M
|
|
567
597
|
))
|
|
568
598
|
) || null,
|
|
569
|
-
zone:
|
|
599
|
+
zone: M
|
|
570
600
|
} : { element: null, zone: null };
|
|
571
|
-
}, a = ((
|
|
572
|
-
var
|
|
573
|
-
const
|
|
574
|
-
t.hovered.element.value = h.element, t.hovered.zone.value = h.zone,
|
|
575
|
-
},
|
|
576
|
-
const h = a(t),
|
|
577
|
-
u(
|
|
601
|
+
}, a = ((B = e == null ? void 0 : e.sensor) == null ? void 0 : B.setup) || ze, u = (h) => {
|
|
602
|
+
var M, D, A, S, C, U, O, R, j, J, X, Q;
|
|
603
|
+
const _ = t.hovered.element.value, P = t.hovered.zone.value;
|
|
604
|
+
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), 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))), 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(R, t), 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(X, t)));
|
|
605
|
+
}, f = Pe(() => {
|
|
606
|
+
const h = a(t), _ = v(h);
|
|
607
|
+
u(_);
|
|
578
608
|
}, ((Z = e == null ? void 0 : e.sensor) == null ? void 0 : Z.throttle) ?? 0), m = () => {
|
|
579
|
-
|
|
580
|
-
},
|
|
609
|
+
f(), c = requestAnimationFrame(m);
|
|
610
|
+
}, p = () => m(), E = () => {
|
|
581
611
|
c !== null && (cancelAnimationFrame(c), c = null);
|
|
582
612
|
};
|
|
583
613
|
return {
|
|
584
614
|
activate: (h) => {
|
|
585
615
|
t.draggingElements.value = d(n.value), t.draggingElements.value.forEach(
|
|
586
|
-
(
|
|
587
|
-
var
|
|
588
|
-
return (
|
|
616
|
+
(_) => {
|
|
617
|
+
var P, M;
|
|
618
|
+
return (M = (P = _.events).onStart) == null ? void 0 : M.call(P, t);
|
|
589
619
|
}
|
|
590
|
-
), h instanceof PointerEvent ? r(h) : s(h),
|
|
620
|
+
), h instanceof PointerEvent ? r(h) : s(h), p();
|
|
591
621
|
},
|
|
592
622
|
track: (h) => {
|
|
593
623
|
t.draggingElements.value.forEach(
|
|
594
|
-
(
|
|
595
|
-
var
|
|
596
|
-
return (
|
|
624
|
+
(_) => {
|
|
625
|
+
var P, M;
|
|
626
|
+
return (M = (P = _.events).onMove) == null ? void 0 : M.call(P, t);
|
|
597
627
|
}
|
|
598
|
-
), h instanceof KeyboardEvent ?
|
|
628
|
+
), h instanceof KeyboardEvent ? g() : l(h);
|
|
599
629
|
},
|
|
600
630
|
deactivate: (h = !0) => {
|
|
601
|
-
var
|
|
631
|
+
var _, P;
|
|
602
632
|
if (o(), i(), h) {
|
|
603
633
|
if (t.hovered.zone.value) {
|
|
604
|
-
const
|
|
605
|
-
(
|
|
634
|
+
const M = t.zonesMap.value.get(t.hovered.zone.value);
|
|
635
|
+
(P = M == null ? void 0 : (_ = M.events).onDrop) == null || P.call(_, t);
|
|
606
636
|
} else
|
|
607
637
|
t.draggingElements.value.forEach(
|
|
608
|
-
(
|
|
609
|
-
var
|
|
610
|
-
return (
|
|
638
|
+
(M) => {
|
|
639
|
+
var D, A;
|
|
640
|
+
return (A = (D = M.events).onEnd) == null ? void 0 : A.call(D, t);
|
|
611
641
|
}
|
|
612
642
|
);
|
|
613
643
|
t.selectedElements.value.clear();
|
|
614
644
|
}
|
|
615
|
-
t.draggingElements.value.clear(), t.hovered.zone.value = null, t.hovered.element.value = null,
|
|
645
|
+
t.draggingElements.value.clear(), t.hovered.zone.value = null, t.hovered.element.value = null, E();
|
|
616
646
|
}
|
|
617
647
|
};
|
|
618
|
-
},
|
|
619
|
-
let n = "", e = "", t = "", r = null, l = null, o = null, s = null,
|
|
648
|
+
}, be = ce(() => {
|
|
649
|
+
let n = "", e = "", t = "", r = null, l = null, o = null, s = null, g = null;
|
|
620
650
|
const { activeContainer: i } = K(), c = () => {
|
|
621
651
|
const u = document.body;
|
|
622
652
|
n = u.style.userSelect, u.style.userSelect = "none", window.addEventListener("contextmenu", z), window.addEventListener("selectstart", z), window.addEventListener("touchstart", z), window.addEventListener("touchmove", z);
|
|
@@ -624,22 +654,22 @@ const K = ie(() => {
|
|
|
624
654
|
const u = document.body;
|
|
625
655
|
u.style.userSelect = n, u.style.touchAction = e, u.style.overscrollBehavior = t, window.removeEventListener("contextmenu", z), window.removeEventListener("selectstart", z), window.removeEventListener("touchstart", z), window.removeEventListener("touchmove", z);
|
|
626
656
|
}, v = () => {
|
|
627
|
-
r && (document.removeEventListener("pointermove", r), r = null), l && (document.removeEventListener("pointerup", l), l = null), o && (o = null), s && (document.removeEventListener("wheel", s), s = null),
|
|
657
|
+
r && (document.removeEventListener("pointermove", r), r = null), l && (document.removeEventListener("pointerup", l), l = null), o && (o = null), s && (document.removeEventListener("wheel", s), s = null), g && (document.removeEventListener("keydown", g), document.removeEventListener("keypress", g), document.removeEventListener("keyup", g), g = null);
|
|
628
658
|
};
|
|
629
659
|
return {
|
|
630
|
-
handleDragStart: (u,
|
|
631
|
-
v(), u.target.blur(), m != null && m.container && (i.component.value =
|
|
632
|
-
const { activate:
|
|
660
|
+
handleDragStart: (u, f, m) => {
|
|
661
|
+
v(), u.target.blur(), m != null && m.container && (i.component.value = we(m.container));
|
|
662
|
+
const { activate: p, track: E, deactivate: L } = ke(f, m);
|
|
633
663
|
l = () => {
|
|
634
|
-
i.component.value = null, d(),
|
|
664
|
+
i.component.value = null, d(), L(!0), v();
|
|
635
665
|
}, o = () => {
|
|
636
|
-
i.component.value = null, d(),
|
|
637
|
-
}, r = (
|
|
638
|
-
|
|
639
|
-
}, c(),
|
|
666
|
+
i.component.value = null, d(), L(!1), v();
|
|
667
|
+
}, r = (w) => E(w), s = (w) => E(w), g = (w) => {
|
|
668
|
+
w.type === "keyup" && (w.code === "Escape" && (o == null || o()), w.code === "Enter" && (l == null || l())), E(w);
|
|
669
|
+
}, c(), p(u), document.addEventListener("pointermove", r), document.addEventListener("pointerup", l), document.addEventListener("wheel", s), document.addEventListener("keydown", g), document.addEventListener("keypress", g), document.addEventListener("keyup", g);
|
|
640
670
|
}
|
|
641
671
|
};
|
|
642
|
-
}),
|
|
672
|
+
}), Ye = (n) => {
|
|
643
673
|
const {
|
|
644
674
|
id: e,
|
|
645
675
|
elementRef: t,
|
|
@@ -647,9 +677,9 @@ const K = ie(() => {
|
|
|
647
677
|
isOvered: l,
|
|
648
678
|
isAllowed: o,
|
|
649
679
|
registerElement: s,
|
|
650
|
-
unregisterElement:
|
|
651
|
-
} =
|
|
652
|
-
return
|
|
680
|
+
unregisterElement: g
|
|
681
|
+
} = Ie(n), { pointerPosition: i } = K(), { handleDragStart: c } = be(), d = (v) => c(v, t, n);
|
|
682
|
+
return G(s), ue(g), {
|
|
653
683
|
pointerPosition: i,
|
|
654
684
|
elementRef: t,
|
|
655
685
|
isDragging: r,
|
|
@@ -658,14 +688,14 @@ const K = ie(() => {
|
|
|
658
688
|
handleDragStart: d,
|
|
659
689
|
id: e
|
|
660
690
|
};
|
|
661
|
-
},
|
|
691
|
+
}, Te = (n) => {
|
|
662
692
|
const {
|
|
663
693
|
zonesMap: e,
|
|
664
694
|
hovered: t,
|
|
665
695
|
draggingElements: r,
|
|
666
696
|
isDragging: l,
|
|
667
697
|
handleDropZoneIntersection: o
|
|
668
|
-
} = K(), s = V(null),
|
|
698
|
+
} = K(), s = V(null), g = T(() => t.zone.value === s.value), i = T(() => {
|
|
669
699
|
if (!s.value || !l.value) return !1;
|
|
670
700
|
const v = e.value.get(s.value);
|
|
671
701
|
return v != null && v.groups.length ? !Array.from(r.value.values()).some((a) => a.groups.length ? !a.groups.some(
|
|
@@ -682,56 +712,56 @@ const K = ie(() => {
|
|
|
682
712
|
}), s.value.setAttribute("data-dnd-droppable", "true");
|
|
683
713
|
}, unregisterZone: () => {
|
|
684
714
|
s.value && (o("remove", s.value), e.value.delete(s.value));
|
|
685
|
-
}, isOvered:
|
|
686
|
-
},
|
|
687
|
-
const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: o } =
|
|
688
|
-
return
|
|
689
|
-
},
|
|
690
|
-
const { selectedElements: e, elementsMap: t } = K(), r =
|
|
715
|
+
}, isOvered: g, isAllowed: i };
|
|
716
|
+
}, Oe = (n) => {
|
|
717
|
+
const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: o } = Te(n);
|
|
718
|
+
return G(t), ue(r), { elementRef: e, isOvered: l, isAllowed: o };
|
|
719
|
+
}, Re = (n) => {
|
|
720
|
+
const { selectedElements: e, elementsMap: t } = K(), r = T(
|
|
691
721
|
() => n.value ? e.value.has(n.value) : !1
|
|
692
|
-
), l =
|
|
722
|
+
), l = T(() => {
|
|
693
723
|
if (!n.value) return !1;
|
|
694
724
|
for (const c of e.value)
|
|
695
|
-
if (c &&
|
|
725
|
+
if (c && b(c, n.value))
|
|
696
726
|
return !0;
|
|
697
727
|
return !1;
|
|
698
|
-
}), o =
|
|
728
|
+
}), o = T(() => {
|
|
699
729
|
if (!n.value) return !1;
|
|
700
730
|
for (const c of e.value)
|
|
701
|
-
if (c &&
|
|
731
|
+
if (c && b(n.value, c))
|
|
702
732
|
return !0;
|
|
703
733
|
return !1;
|
|
704
734
|
}), s = () => {
|
|
705
735
|
n.value && e.value.delete(n.value);
|
|
706
|
-
},
|
|
736
|
+
}, g = () => {
|
|
707
737
|
if (!(!n.value || !t.value.get(n.value))) {
|
|
708
738
|
if (l.value)
|
|
709
739
|
for (const d of e.value)
|
|
710
|
-
d &&
|
|
740
|
+
d && b(d, n.value) && e.value.delete(d);
|
|
711
741
|
if (o.value)
|
|
712
742
|
for (const d of e.value)
|
|
713
|
-
d &&
|
|
743
|
+
d && b(n.value, d) && e.value.delete(d);
|
|
714
744
|
e.value.add(n.value);
|
|
715
745
|
}
|
|
716
746
|
};
|
|
717
747
|
return {
|
|
718
748
|
handleUnselect: s,
|
|
719
|
-
handleSelect:
|
|
749
|
+
handleSelect: g,
|
|
720
750
|
handleToggleSelect: () => {
|
|
721
|
-
n.value && (e.value.has(n.value) ? s() :
|
|
751
|
+
n.value && (e.value.has(n.value) ? s() : g());
|
|
722
752
|
},
|
|
723
753
|
isSelected: r,
|
|
724
754
|
isParentOfSelected: l
|
|
725
755
|
};
|
|
726
756
|
};
|
|
727
757
|
export {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
758
|
+
ne as DnDOperations,
|
|
759
|
+
Ve as default,
|
|
760
|
+
H as getBoundingBox,
|
|
731
761
|
K as useDnDStore,
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
762
|
+
Le as useDragContainer,
|
|
763
|
+
Ye as useDraggable,
|
|
764
|
+
Oe as useDroppable,
|
|
765
|
+
Re as useSelection
|
|
736
766
|
};
|
|
737
767
|
//# sourceMappingURL=vue-dnd-kit-core.es.js.map
|