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