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