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