@vue-dnd-kit/core 0.1.5-beta → 0.2.5-beta
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.
- package/LICENSE +21 -21
- package/README.md +252 -252
- package/dist/composables/useDnDStore.d.ts +2315 -2326
- package/dist/composables/useDragContainer.d.ts +622 -624
- package/dist/composables/useDraggable.d.ts +40 -39
- package/dist/composables/useDroppable.d.ts +90 -89
- package/dist/composables/usePointer.d.ts +6 -5
- package/dist/composables/useSelection.d.ts +13 -12
- package/dist/composables/useSensor.d.ts +7 -5
- package/dist/index.d.ts +4 -3
- package/dist/managers/useElementManager.d.ts +17 -16
- package/dist/managers/useInteractionManager.d.ts +4 -4
- package/dist/managers/useZoneManager.d.ts +8 -7
- package/dist/plugin.d.ts +12 -11
- package/dist/types/index.d.ts +111 -169
- package/dist/utils/dom.d.ts +1 -1
- package/dist/utils/events.d.ts +1 -1
- package/dist/utils/geometry.d.ts +16 -14
- package/dist/utils/namespaces.d.ts +2 -2
- package/dist/utils/sensor.d.ts +3 -0
- package/dist/vue-dnd-kit-core.cjs.js +1 -1
- package/dist/vue-dnd-kit-core.es.js +383 -464
- package/dist/vue-shims.d.ts +5 -5
- package/package.json +73 -72
|
@@ -1,196 +1,85 @@
|
|
|
1
|
-
import { effectScope as
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
import { effectScope as G, isRef as W, toValue as J, ref as y, computed as I, onMounted as V, onBeforeUnmount as H, defineComponent as q, createElementBlock as z, createCommentVNode as Q, unref as U, openBlock as k, normalizeStyle as Y, Fragment as B, renderList as ee, createBlock as te, resolveDynamicComponent as ne, createVNode as re, render as F, markRaw as le } from "vue";
|
|
2
|
+
function oe(e) {
|
|
3
|
+
let t = !1, n;
|
|
4
|
+
const i = G(!0);
|
|
5
|
+
return (...a) => (t || (n = i.run(() => e(...a)), t = !0), n);
|
|
4
6
|
}
|
|
5
|
-
function Se(t) {
|
|
6
|
-
let e = !1, r;
|
|
7
|
-
const o = ge(!0);
|
|
8
|
-
return (...u) => (e || (r = o.run(() => t(...u)), e = !0), r);
|
|
9
|
-
}
|
|
10
|
-
const Me = typeof window < "u" && typeof document < "u";
|
|
11
7
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
12
|
-
const
|
|
8
|
+
const N = () => {
|
|
13
9
|
};
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
return new Promise((
|
|
17
|
-
Promise.resolve(
|
|
10
|
+
function ie(e, t) {
|
|
11
|
+
function n(...i) {
|
|
12
|
+
return new Promise((a, l) => {
|
|
13
|
+
Promise.resolve(e(() => t.apply(this, i), { fn: t, thisArg: this, args: i })).then(a).catch(l);
|
|
18
14
|
});
|
|
19
15
|
}
|
|
20
|
-
return
|
|
16
|
+
return n;
|
|
21
17
|
}
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
!
|
|
25
|
-
const
|
|
26
|
-
|
|
18
|
+
function se(...e) {
|
|
19
|
+
let t = 0, n, i = !0, a = N, l, s, d, v, h;
|
|
20
|
+
!W(e[0]) && typeof e[0] == "object" ? { delay: s, trailing: d = !0, leading: v = !0, rejectOnCancel: h = !1 } = e[0] : [s, d = !0, v = !0, h = !1] = e;
|
|
21
|
+
const u = () => {
|
|
22
|
+
n && (clearTimeout(n), n = void 0, a(), a = N);
|
|
27
23
|
};
|
|
28
|
-
return (
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, Math.max(0,
|
|
34
|
-
})), !v && !
|
|
24
|
+
return (r) => {
|
|
25
|
+
const o = J(s), f = Date.now() - t, p = () => l = r();
|
|
26
|
+
return u(), o <= 0 ? (t = Date.now(), p()) : (f > o && (v || !i) ? (t = Date.now(), p()) : d && (l = new Promise((D, x) => {
|
|
27
|
+
a = h ? x : D, n = setTimeout(() => {
|
|
28
|
+
t = Date.now(), i = !0, D(p()), u();
|
|
29
|
+
}, Math.max(0, o - f));
|
|
30
|
+
})), !v && !n && (n = setTimeout(() => i = !0, o)), i = !1, l);
|
|
35
31
|
};
|
|
36
32
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return Oe(
|
|
42
|
-
Te(e, r, o, u),
|
|
43
|
-
t
|
|
33
|
+
function ae(e, t = 200, n = !1, i = !0, a = !1) {
|
|
34
|
+
return ie(
|
|
35
|
+
se(t, n, i, a),
|
|
36
|
+
e
|
|
44
37
|
);
|
|
45
38
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, e), t;
|
|
57
|
-
}
|
|
58
|
-
function be(t) {
|
|
59
|
-
const e = Ve();
|
|
60
|
-
return P(() => (e.value, !!t()));
|
|
61
|
-
}
|
|
62
|
-
function ze(t, e, r = {}) {
|
|
63
|
-
const {
|
|
64
|
-
root: o,
|
|
65
|
-
rootMargin: u = "0px",
|
|
66
|
-
threshold: n = 0,
|
|
67
|
-
window: s = Re,
|
|
68
|
-
immediate: g = !0
|
|
69
|
-
} = r, v = be(() => s && "IntersectionObserver" in s), y = P(() => {
|
|
70
|
-
const w = K(t);
|
|
71
|
-
return Ae(w).map(Z).filter(Ce);
|
|
72
|
-
});
|
|
73
|
-
let l = b;
|
|
74
|
-
const p = ce(g), E = v.value ? ve(
|
|
75
|
-
() => [y.value, Z(o), p.value],
|
|
76
|
-
([w, i]) => {
|
|
77
|
-
if (l(), !p.value || !w.length)
|
|
78
|
-
return;
|
|
79
|
-
const d = new IntersectionObserver(
|
|
80
|
-
e,
|
|
81
|
-
{
|
|
82
|
-
root: Z(i),
|
|
83
|
-
rootMargin: u,
|
|
84
|
-
threshold: n
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
w.forEach((f) => f && d.observe(f)), l = () => {
|
|
88
|
-
d.disconnect(), l = b;
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
{ immediate: g, flush: "post" }
|
|
92
|
-
) : b, m = () => {
|
|
93
|
-
l(), E(), p.value = !1;
|
|
94
|
-
};
|
|
95
|
-
return Le(m), {
|
|
96
|
-
isSupported: v,
|
|
97
|
-
isActive: p,
|
|
98
|
-
pause() {
|
|
99
|
-
l(), p.value = !1;
|
|
100
|
-
},
|
|
101
|
-
resume() {
|
|
102
|
-
p.value = !0;
|
|
103
|
-
},
|
|
104
|
-
stop: m
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
const C = Se(() => {
|
|
108
|
-
const t = D([]), e = P(() => t.value.length > 0), r = {
|
|
109
|
-
component: D(null),
|
|
110
|
-
ref: D(null)
|
|
111
|
-
}, o = D([]), u = P(() => {
|
|
112
|
-
const m = /* @__PURE__ */ new Map();
|
|
113
|
-
return o.value.forEach((w, i) => {
|
|
114
|
-
w.node && m.set(w.node, i);
|
|
115
|
-
}), m;
|
|
116
|
-
}), n = D(/* @__PURE__ */ new Set()), s = P(
|
|
117
|
-
() => Array.from(n.value).sort((m, w) => m - w)
|
|
118
|
-
), g = P(
|
|
119
|
-
() => o.value.filter((m) => m.node).map((m) => m.node)
|
|
120
|
-
);
|
|
121
|
-
ve(
|
|
122
|
-
() => g.value.length,
|
|
123
|
-
(m) => {
|
|
124
|
-
if (m === 0) return;
|
|
125
|
-
v && (v(), v = null);
|
|
126
|
-
const { stop: w } = ze(
|
|
127
|
-
g,
|
|
128
|
-
(i) => {
|
|
129
|
-
let d = !1;
|
|
130
|
-
i.forEach((f) => {
|
|
131
|
-
const h = f.target, _ = u.value.get(h);
|
|
132
|
-
_ !== void 0 && o.value[_].isVisible !== f.isIntersecting && (o.value[_].isVisible = f.isIntersecting, d = !0, f.isIntersecting ? n.value.add(_) : n.value.delete(_));
|
|
133
|
-
}), d && (n.value = new Set(n.value));
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
threshold: 0.1,
|
|
137
|
-
// Элемент считается видимым, если видно хотя бы 10%
|
|
138
|
-
immediate: !0
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
v = w;
|
|
142
|
-
},
|
|
143
|
-
{ immediate: !0 }
|
|
144
|
-
);
|
|
145
|
-
let v = null;
|
|
146
|
-
const y = D([]), l = D([]), p = {
|
|
147
|
-
zone: D(null),
|
|
148
|
-
element: D(null)
|
|
149
|
-
}, E = {
|
|
150
|
-
current: D(null),
|
|
151
|
-
start: D(null),
|
|
39
|
+
const T = oe(() => {
|
|
40
|
+
const e = y([]), t = I(() => e.value.length > 0), n = {
|
|
41
|
+
component: y(null),
|
|
42
|
+
ref: y(null)
|
|
43
|
+
}, i = y([]), a = y([]), l = y([]), s = {
|
|
44
|
+
zone: y(null),
|
|
45
|
+
element: y(null)
|
|
46
|
+
}, d = {
|
|
47
|
+
current: y(null),
|
|
48
|
+
start: y(null),
|
|
152
49
|
offset: {
|
|
153
|
-
percent:
|
|
154
|
-
pixel:
|
|
50
|
+
percent: y(null),
|
|
51
|
+
pixel: y(null)
|
|
155
52
|
}
|
|
156
53
|
};
|
|
157
54
|
return {
|
|
158
|
-
isDragging:
|
|
159
|
-
activeContainer:
|
|
160
|
-
elements:
|
|
161
|
-
draggingElements:
|
|
162
|
-
selectedElements:
|
|
55
|
+
isDragging: t,
|
|
56
|
+
activeContainer: n,
|
|
57
|
+
elements: i,
|
|
58
|
+
draggingElements: e,
|
|
59
|
+
selectedElements: a,
|
|
163
60
|
zones: l,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
hovered: p,
|
|
167
|
-
pointerPosition: E,
|
|
168
|
-
// Экспортируем Map для быстрого доступа
|
|
169
|
-
elementNodeMap: u,
|
|
170
|
-
// Добавляем метод для очистки ресурсов
|
|
171
|
-
cleanup: () => {
|
|
172
|
-
v && (v(), v = null);
|
|
173
|
-
}
|
|
61
|
+
hovered: s,
|
|
62
|
+
pointerPosition: d
|
|
174
63
|
};
|
|
175
|
-
}),
|
|
176
|
-
const
|
|
177
|
-
return
|
|
178
|
-
|
|
179
|
-
}),
|
|
180
|
-
|
|
64
|
+
}), ue = () => {
|
|
65
|
+
const e = y(null), { draggingElements: t, pointerPosition: n, isDragging: i, activeContainer: a } = T();
|
|
66
|
+
return V(() => {
|
|
67
|
+
a.ref = e;
|
|
68
|
+
}), H(() => {
|
|
69
|
+
a.ref.value = null;
|
|
181
70
|
}), {
|
|
182
|
-
elementRef:
|
|
183
|
-
draggingElements:
|
|
184
|
-
pointerPosition:
|
|
185
|
-
isDragging:
|
|
71
|
+
elementRef: e,
|
|
72
|
+
draggingElements: t,
|
|
73
|
+
pointerPosition: n,
|
|
74
|
+
isDragging: i
|
|
186
75
|
};
|
|
187
|
-
},
|
|
76
|
+
}, ce = ["innerHTML"], de = /* @__PURE__ */ q({
|
|
188
77
|
__name: "DefaultOverlay",
|
|
189
|
-
setup(
|
|
190
|
-
const { elementRef:
|
|
191
|
-
var s,
|
|
78
|
+
setup(e) {
|
|
79
|
+
const { elementRef: t, pointerPosition: n, isDragging: i, draggingElements: a } = ue(), l = I(() => {
|
|
80
|
+
var s, d, v, h;
|
|
192
81
|
return {
|
|
193
|
-
transform: `translate3d(${(((s =
|
|
82
|
+
transform: `translate3d(${(((s = n.current.value) == null ? void 0 : s.x) ?? 0) - (((d = n.offset.pixel.value) == null ? void 0 : d.x) ?? 0)}px, ${(((v = n.current.value) == null ? void 0 : v.y) ?? 0) - (((h = n.offset.pixel.value) == null ? void 0 : h.y) ?? 0)}px, 0)`,
|
|
194
83
|
zIndex: 1e3,
|
|
195
84
|
position: "fixed",
|
|
196
85
|
top: 0,
|
|
@@ -198,123 +87,122 @@ const C = Se(() => {
|
|
|
198
87
|
transition: "0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"
|
|
199
88
|
};
|
|
200
89
|
});
|
|
201
|
-
return (s,
|
|
90
|
+
return (s, d) => U(i) ? (k(), z("div", {
|
|
202
91
|
key: 0,
|
|
203
92
|
ref_key: "elementRef",
|
|
204
|
-
ref:
|
|
205
|
-
style:
|
|
93
|
+
ref: t,
|
|
94
|
+
style: Y(l.value)
|
|
206
95
|
}, [
|
|
207
|
-
(
|
|
208
|
-
var
|
|
209
|
-
return
|
|
210
|
-
key:
|
|
96
|
+
(k(!0), z(B, null, ee(U(a), (v, h) => {
|
|
97
|
+
var u, E;
|
|
98
|
+
return k(), z("div", {
|
|
99
|
+
key: h,
|
|
211
100
|
innerHTML: v.initialHTML,
|
|
212
|
-
style:
|
|
213
|
-
width: `${(
|
|
214
|
-
height: `${(
|
|
101
|
+
style: Y({
|
|
102
|
+
width: `${(u = v.initialRect) == null ? void 0 : u.width}px`,
|
|
103
|
+
height: `${(E = v.initialRect) == null ? void 0 : E.height}px`
|
|
215
104
|
})
|
|
216
|
-
}, null, 12,
|
|
105
|
+
}, null, 12, ce);
|
|
217
106
|
}), 128))
|
|
218
|
-
], 4)) :
|
|
107
|
+
], 4)) : Q("", !0);
|
|
219
108
|
}
|
|
220
|
-
}),
|
|
109
|
+
}), Z = /* @__PURE__ */ q({
|
|
221
110
|
__name: "DragOverlay",
|
|
222
|
-
setup(
|
|
223
|
-
const { activeContainer:
|
|
224
|
-
() =>
|
|
111
|
+
setup(e) {
|
|
112
|
+
const { activeContainer: t } = T(), n = I(
|
|
113
|
+
() => t.component.value ?? de
|
|
225
114
|
);
|
|
226
|
-
return (
|
|
115
|
+
return (i, a) => (k(), te(ne(n.value)));
|
|
227
116
|
}
|
|
228
|
-
}),
|
|
229
|
-
install(
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
117
|
+
}), Pe = {
|
|
118
|
+
install(e) {
|
|
119
|
+
e.component("DragOverlay", Z);
|
|
120
|
+
const t = e.mount;
|
|
121
|
+
e.mount = function(i) {
|
|
122
|
+
const a = t.call(this, i), l = typeof i == "string" ? document.querySelector(i) : i;
|
|
123
|
+
if (l && l instanceof Element && !l.querySelector("#vue-dnd-kit-overlay")) {
|
|
235
124
|
const s = document.createElement("div");
|
|
236
|
-
s.id = "vue-dnd-kit-overlay", s.style.pointerEvents = "none",
|
|
237
|
-
const
|
|
238
|
-
|
|
125
|
+
s.id = "vue-dnd-kit-overlay", s.style.pointerEvents = "none", l.appendChild(s);
|
|
126
|
+
const d = re(Z);
|
|
127
|
+
F(d, s), e.__VUE_DND_KIT_OVERLAY__ = {
|
|
239
128
|
container: s,
|
|
240
|
-
vnode:
|
|
129
|
+
vnode: d
|
|
241
130
|
};
|
|
242
131
|
}
|
|
243
|
-
return
|
|
132
|
+
return a;
|
|
244
133
|
};
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
return
|
|
134
|
+
const n = e.unmount;
|
|
135
|
+
e.unmount = function() {
|
|
136
|
+
return e.__VUE_DND_KIT_OVERLAY__ && (F(null, e.__VUE_DND_KIT_OVERLAY__.container), delete e.__VUE_DND_KIT_OVERLAY__), n.call(this);
|
|
248
137
|
};
|
|
249
138
|
}
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
},
|
|
139
|
+
}, b = "data-vue-dnd-kit-draggable", L = (e) => {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
}, ve = (e) => {
|
|
253
142
|
const {
|
|
254
|
-
elements:
|
|
255
|
-
draggingElements:
|
|
256
|
-
hovered:
|
|
257
|
-
selectedElements:
|
|
258
|
-
isDragging:
|
|
259
|
-
} =
|
|
143
|
+
elements: t,
|
|
144
|
+
draggingElements: n,
|
|
145
|
+
hovered: i,
|
|
146
|
+
selectedElements: a,
|
|
147
|
+
isDragging: l
|
|
148
|
+
} = T(), s = y(null), d = I(
|
|
260
149
|
() => {
|
|
261
|
-
var
|
|
262
|
-
return ((
|
|
150
|
+
var r;
|
|
151
|
+
return ((r = i.element.value) == null ? void 0 : r.node) === s.value;
|
|
263
152
|
}
|
|
264
|
-
), v =
|
|
265
|
-
() =>
|
|
266
|
-
),
|
|
267
|
-
if (!s.value || !
|
|
268
|
-
const
|
|
269
|
-
(
|
|
153
|
+
), v = I(
|
|
154
|
+
() => n.value.some((r) => r.node === s.value)
|
|
155
|
+
), h = I(() => {
|
|
156
|
+
if (!s.value || !l.value) return !1;
|
|
157
|
+
const r = t.value.find(
|
|
158
|
+
(o) => o.node === s.value
|
|
270
159
|
);
|
|
271
|
-
return
|
|
272
|
-
(
|
|
160
|
+
return r != null && r.groups.length ? !n.value.some((o) => o.groups.length ? !o.groups.some(
|
|
161
|
+
(f) => r.groups.includes(f)
|
|
273
162
|
) : !1) : !0;
|
|
274
163
|
});
|
|
275
164
|
return {
|
|
276
165
|
elementRef: s,
|
|
277
166
|
registerElement: () => {
|
|
278
167
|
if (!s.value) throw new Error("ElementRef is not set");
|
|
279
|
-
|
|
168
|
+
t.value.push({
|
|
280
169
|
node: s.value,
|
|
281
|
-
groups: (
|
|
282
|
-
layer: (
|
|
283
|
-
defaultLayer: (
|
|
284
|
-
events: (
|
|
285
|
-
data: (
|
|
286
|
-
|
|
287
|
-
}), s.value.addEventListener("dragstart", I), s.value.addEventListener("drag", I), s.value.setAttribute(se, "true"), s.value.setAttribute("draggable", "false");
|
|
170
|
+
groups: (e == null ? void 0 : e.groups) ?? [],
|
|
171
|
+
layer: (e == null ? void 0 : e.layer) ?? null,
|
|
172
|
+
defaultLayer: (e == null ? void 0 : e.layer) ?? null,
|
|
173
|
+
events: (e == null ? void 0 : e.events) ?? {},
|
|
174
|
+
data: (e == null ? void 0 : e.data) ?? void 0
|
|
175
|
+
}), s.value.addEventListener("dragstart", L), s.value.addEventListener("drag", L), s.value.setAttribute(b, "true"), s.value.setAttribute("draggable", "false"), s.value.style.touchAction = "none";
|
|
288
176
|
},
|
|
289
177
|
unregisterElement: () => {
|
|
290
|
-
var
|
|
291
|
-
const
|
|
292
|
-
(
|
|
178
|
+
var f, p, D, x;
|
|
179
|
+
const r = t.value.findIndex(
|
|
180
|
+
(c) => c.node === s.value
|
|
293
181
|
);
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
(
|
|
182
|
+
r !== -1 && t.value.splice(r, 1);
|
|
183
|
+
const o = a.value.findIndex(
|
|
184
|
+
(c) => c.node === s.value
|
|
297
185
|
);
|
|
298
|
-
|
|
186
|
+
o !== -1 && a.value.splice(o, 1), (f = s.value) == null || f.removeEventListener("dragstart", L), (p = s.value) == null || p.removeEventListener("drag", L), (D = s.value) == null || D.removeAttribute(b), (x = s.value) == null || x.removeAttribute("draggable");
|
|
299
187
|
},
|
|
300
188
|
isDragging: v,
|
|
301
|
-
isOvered:
|
|
302
|
-
isAllowed:
|
|
189
|
+
isOvered: d,
|
|
190
|
+
isAllowed: h
|
|
303
191
|
};
|
|
304
|
-
},
|
|
305
|
-
let
|
|
192
|
+
}, ge = () => {
|
|
193
|
+
let e = "", t = "", n = "";
|
|
306
194
|
return {
|
|
307
195
|
disableInteractions: () => {
|
|
308
|
-
const
|
|
309
|
-
|
|
196
|
+
const l = document.body;
|
|
197
|
+
e = l.style.userSelect, l.style.userSelect = "none", window.addEventListener("contextmenu", L), window.addEventListener("selectstart", L), window.addEventListener("touchstart", L), window.addEventListener("touchmove", L);
|
|
310
198
|
},
|
|
311
199
|
enableInteractions: () => {
|
|
312
|
-
const
|
|
313
|
-
|
|
200
|
+
const l = document.body;
|
|
201
|
+
l.style.userSelect = e, l.style.touchAction = t, l.style.overscrollBehavior = n, window.removeEventListener("contextmenu", L), window.removeEventListener("selectstart", L), window.removeEventListener("touchstart", L), window.removeEventListener("touchmove", L);
|
|
314
202
|
}
|
|
315
203
|
};
|
|
316
|
-
},
|
|
317
|
-
if (!
|
|
204
|
+
}, K = (e, t) => e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y, R = (e) => {
|
|
205
|
+
if (!e)
|
|
318
206
|
return {
|
|
319
207
|
x: 0,
|
|
320
208
|
y: 0,
|
|
@@ -325,277 +213,308 @@ const C = Se(() => {
|
|
|
325
213
|
right: 0,
|
|
326
214
|
top: 0
|
|
327
215
|
};
|
|
328
|
-
const
|
|
216
|
+
const t = e.getBoundingClientRect();
|
|
329
217
|
return {
|
|
330
|
-
bottom:
|
|
331
|
-
left:
|
|
332
|
-
right:
|
|
333
|
-
top:
|
|
334
|
-
x:
|
|
335
|
-
y:
|
|
336
|
-
width:
|
|
337
|
-
height:
|
|
218
|
+
bottom: t.bottom,
|
|
219
|
+
left: t.left,
|
|
220
|
+
right: t.right,
|
|
221
|
+
top: t.top,
|
|
222
|
+
x: t.x,
|
|
223
|
+
y: t.y,
|
|
224
|
+
width: t.width,
|
|
225
|
+
height: t.height
|
|
338
226
|
};
|
|
339
|
-
},
|
|
340
|
-
x:
|
|
341
|
-
y:
|
|
342
|
-
}),
|
|
343
|
-
const
|
|
227
|
+
}, A = (e) => ({
|
|
228
|
+
x: e.x + e.width / 2,
|
|
229
|
+
y: e.y + e.height / 2
|
|
230
|
+
}), fe = (e, t) => {
|
|
231
|
+
const n = R(e);
|
|
344
232
|
return {
|
|
345
233
|
pixel: {
|
|
346
|
-
x:
|
|
347
|
-
y:
|
|
234
|
+
x: t.x - n.x,
|
|
235
|
+
y: t.y - n.y
|
|
348
236
|
},
|
|
349
237
|
percent: {
|
|
350
|
-
x: (
|
|
351
|
-
y: (
|
|
238
|
+
x: (t.x - n.x) / n.width * 100,
|
|
239
|
+
y: (t.y - n.y) / n.height * 100
|
|
352
240
|
}
|
|
353
241
|
};
|
|
354
|
-
},
|
|
355
|
-
const
|
|
356
|
-
return Math.sqrt(
|
|
357
|
-
},
|
|
358
|
-
const
|
|
242
|
+
}, X = (e, t) => {
|
|
243
|
+
const n = t.x - e.x, i = t.y - e.y;
|
|
244
|
+
return Math.sqrt(n * n + i * i);
|
|
245
|
+
}, $ = (e, t) => {
|
|
246
|
+
const n = Math.max(
|
|
247
|
+
0,
|
|
248
|
+
Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
|
|
249
|
+
), i = Math.max(
|
|
250
|
+
0,
|
|
251
|
+
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
252
|
+
), a = n * i, l = e.width * e.height, s = t.width * t.height;
|
|
253
|
+
return (a / l * 100 + a / s * 100) / 2;
|
|
254
|
+
}, M = (e, t) => e ? t.contains(e) : !1, me = (e) => {
|
|
255
|
+
var u, E;
|
|
256
|
+
const t = R(e.activeContainer.ref.value), n = A(t), i = ((u = e.pointerPosition.current.value) == null ? void 0 : u.x) ?? 0, a = ((E = e.pointerPosition.current.value) == null ? void 0 : E.y) ?? 0, s = !(t && i >= t.x && i <= t.x + t.width && a >= t.y && a <= t.y + t.height), d = e.draggingElements.value.map((r) => r.node), v = e.elements.value.filter((r) => {
|
|
257
|
+
if (!r.node || d.some(
|
|
258
|
+
(f) => f && M(r.node, f)
|
|
259
|
+
))
|
|
260
|
+
return !1;
|
|
261
|
+
const o = R(r.node);
|
|
262
|
+
return o && t && K(o, t);
|
|
263
|
+
}).map((r) => {
|
|
264
|
+
const o = R(r.node), f = A(o), p = i >= o.x && i <= o.x + o.width && a >= o.y && a <= o.y + o.height, D = $(o, t), x = X(n, f), c = e.elements.value.filter(
|
|
265
|
+
(g) => g !== r && g.node && r.node && M(r.node, g.node)
|
|
266
|
+
).length;
|
|
267
|
+
return {
|
|
268
|
+
element: r,
|
|
269
|
+
node: r.node,
|
|
270
|
+
isPointerInElement: p,
|
|
271
|
+
overlapPercent: D,
|
|
272
|
+
depth: c,
|
|
273
|
+
centerDistance: x
|
|
274
|
+
};
|
|
275
|
+
}).sort((r, o) => {
|
|
276
|
+
if (!s) {
|
|
277
|
+
if (r.isPointerInElement && o.isPointerInElement)
|
|
278
|
+
return o.depth - r.depth;
|
|
279
|
+
if (r.isPointerInElement !== o.isPointerInElement)
|
|
280
|
+
return r.isPointerInElement ? -1 : 1;
|
|
281
|
+
}
|
|
282
|
+
return Math.abs(r.overlapPercent - o.overlapPercent) <= 1 ? r.centerDistance - o.centerDistance : o.overlapPercent - r.overlapPercent;
|
|
283
|
+
}), h = e.zones.value.filter((r) => {
|
|
284
|
+
if (!r.node || d.some(
|
|
285
|
+
(f) => f && M(r.node, f)
|
|
286
|
+
))
|
|
287
|
+
return !1;
|
|
288
|
+
const o = R(r.node);
|
|
289
|
+
return o && t && K(o, t);
|
|
290
|
+
}).map((r) => {
|
|
291
|
+
const o = R(r.node), f = A(o), p = i >= o.x && i <= o.x + o.width && a >= o.y && a <= o.y + o.height, D = $(o, t), x = X(n, f), c = e.zones.value.filter(
|
|
292
|
+
(g) => g !== r && g.node && r.node && M(r.node, g.node)
|
|
293
|
+
).length;
|
|
294
|
+
return {
|
|
295
|
+
zone: r,
|
|
296
|
+
node: r.node,
|
|
297
|
+
isPointerInElement: p,
|
|
298
|
+
overlapPercent: D,
|
|
299
|
+
depth: c,
|
|
300
|
+
centerDistance: x
|
|
301
|
+
};
|
|
302
|
+
}).sort((r, o) => {
|
|
303
|
+
if (!s) {
|
|
304
|
+
if (r.isPointerInElement && o.isPointerInElement)
|
|
305
|
+
return o.depth - r.depth;
|
|
306
|
+
if (r.isPointerInElement !== o.isPointerInElement)
|
|
307
|
+
return r.isPointerInElement ? -1 : 1;
|
|
308
|
+
}
|
|
309
|
+
return Math.abs(r.overlapPercent - o.overlapPercent) <= 1 ? r.centerDistance - o.centerDistance : o.overlapPercent - r.overlapPercent;
|
|
310
|
+
});
|
|
311
|
+
return [
|
|
312
|
+
...v.map((r) => r.node),
|
|
313
|
+
...h.map((r) => r.node)
|
|
314
|
+
];
|
|
315
|
+
}, he = (e) => {
|
|
316
|
+
const t = T();
|
|
359
317
|
return {
|
|
360
|
-
onPointerStart: (
|
|
361
|
-
|
|
362
|
-
x:
|
|
363
|
-
y:
|
|
318
|
+
onPointerStart: (l) => {
|
|
319
|
+
t.pointerPosition.start.value = { x: l.clientX, y: l.clientY }, t.pointerPosition.current.value = {
|
|
320
|
+
x: l.clientX,
|
|
321
|
+
y: l.clientY
|
|
364
322
|
};
|
|
365
|
-
const { pixel: s, percent:
|
|
366
|
-
x:
|
|
367
|
-
y:
|
|
323
|
+
const { pixel: s, percent: d } = fe(e.value, {
|
|
324
|
+
x: l.clientX,
|
|
325
|
+
y: l.clientY
|
|
368
326
|
});
|
|
369
|
-
|
|
327
|
+
t.pointerPosition.offset.pixel.value = s, t.pointerPosition.offset.percent.value = d;
|
|
370
328
|
},
|
|
371
|
-
onPointerMove: (
|
|
372
|
-
|
|
373
|
-
x:
|
|
374
|
-
y:
|
|
329
|
+
onPointerMove: (l) => {
|
|
330
|
+
t.pointerPosition.current.value = {
|
|
331
|
+
x: l.clientX,
|
|
332
|
+
y: l.clientY
|
|
375
333
|
};
|
|
376
334
|
},
|
|
377
335
|
onPointerEnd: () => {
|
|
378
|
-
|
|
336
|
+
t.pointerPosition.current.value = null, t.pointerPosition.start.value = null, t.pointerPosition.offset.pixel.value = null, t.pointerPosition.offset.percent.value = null;
|
|
379
337
|
}
|
|
380
338
|
};
|
|
381
|
-
},
|
|
382
|
-
const
|
|
383
|
-
let
|
|
384
|
-
const
|
|
385
|
-
var
|
|
386
|
-
const
|
|
387
|
-
(
|
|
339
|
+
}, Ee = (e, t) => {
|
|
340
|
+
const n = T(), { onPointerStart: i, onPointerMove: a, onPointerEnd: l } = he(e);
|
|
341
|
+
let s = null;
|
|
342
|
+
const d = (c) => {
|
|
343
|
+
var C, S;
|
|
344
|
+
const g = n.selectedElements.value.some(
|
|
345
|
+
(m) => m.node === c
|
|
388
346
|
);
|
|
389
|
-
if (
|
|
390
|
-
return
|
|
391
|
-
var
|
|
347
|
+
if (n.selectedElements.value.length && g)
|
|
348
|
+
return n.selectedElements.value.map((m) => {
|
|
349
|
+
var _, w;
|
|
392
350
|
return {
|
|
393
|
-
...
|
|
394
|
-
initialHTML: ((
|
|
395
|
-
initialRect: (
|
|
351
|
+
...m,
|
|
352
|
+
initialHTML: ((_ = m.node) == null ? void 0 : _.outerHTML) ?? "",
|
|
353
|
+
initialRect: (w = m.node) == null ? void 0 : w.getBoundingClientRect()
|
|
396
354
|
};
|
|
397
355
|
});
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
(
|
|
356
|
+
n.selectedElements.value = [];
|
|
357
|
+
const P = n.elements.value.find(
|
|
358
|
+
(m) => m.node === c
|
|
401
359
|
);
|
|
402
|
-
return
|
|
360
|
+
return P ? [
|
|
403
361
|
{
|
|
404
|
-
...
|
|
405
|
-
initialHTML: ((
|
|
406
|
-
initialRect: (
|
|
362
|
+
...P,
|
|
363
|
+
initialHTML: ((C = P.node) == null ? void 0 : C.outerHTML) ?? "",
|
|
364
|
+
initialRect: (S = P.node) == null ? void 0 : S.getBoundingClientRect()
|
|
407
365
|
}
|
|
408
366
|
] : [];
|
|
409
|
-
},
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
)
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
overlapPercent: T,
|
|
442
|
-
depth: Y,
|
|
443
|
-
centerDistance: U
|
|
444
|
-
};
|
|
445
|
-
}).sort((a, c) => {
|
|
446
|
-
if (!x) {
|
|
447
|
-
if (a.isPointerInElement && c.isPointerInElement) return c.depth - a.depth;
|
|
448
|
-
if (a.isPointerInElement !== c.isPointerInElement) return a.isPointerInElement ? -1 : 1;
|
|
449
|
-
}
|
|
450
|
-
return Math.abs(a.overlapPercent - c.overlapPercent) <= 1 ? a.centerDistance - c.centerDistance : c.overlapPercent - a.overlapPercent;
|
|
451
|
-
}), fe = e.zones.value.filter((a) => {
|
|
452
|
-
if (!a.node || O.some(
|
|
453
|
-
(L) => L && M(a.node, L)
|
|
454
|
-
) || a.groups.length && !!e.draggingElements.value.some((S) => S.groups.length ? !S.groups.some((T) => a.groups.includes(T)) : !1))
|
|
455
|
-
return !1;
|
|
456
|
-
const c = k(a.node);
|
|
457
|
-
return c && i && ae(c, i);
|
|
458
|
-
}).map((a) => {
|
|
459
|
-
const c = k(a.node), L = $(c), S = f >= c.x && f <= c.x + c.width && h >= c.y && h <= c.y + c.height, T = g(c, i), U = ue(d, L), Y = e.zones.value.filter(
|
|
460
|
-
(A) => A !== a && A.node && a.node && M(a.node, A.node)
|
|
461
|
-
).length;
|
|
462
|
-
return {
|
|
463
|
-
zone: a,
|
|
464
|
-
isPointerInElement: S,
|
|
465
|
-
overlapPercent: T,
|
|
466
|
-
depth: Y,
|
|
467
|
-
centerDistance: U
|
|
468
|
-
};
|
|
469
|
-
}).sort((a, c) => {
|
|
470
|
-
if (!x) {
|
|
471
|
-
if (a.isPointerInElement && c.isPointerInElement) return c.depth - a.depth;
|
|
472
|
-
if (a.isPointerInElement !== c.isPointerInElement) return a.isPointerInElement ? -1 : 1;
|
|
473
|
-
}
|
|
474
|
-
return Math.abs(a.overlapPercent - c.overlapPercent) <= 1 ? a.centerDistance - c.centerDistance : c.overlapPercent - a.overlapPercent;
|
|
475
|
-
}), R = e.hovered.element.value, V = e.hovered.zone.value;
|
|
476
|
-
e.hovered.element.value = ((j = z[0]) == null ? void 0 : j.element) ?? null, e.hovered.zone.value = ((G = fe[0]) == null ? void 0 : G.zone) ?? null, e.hovered.element.value !== R && ((B = R == null ? void 0 : R.events) != null && B.onLeave && R.events.onLeave(e), (Q = (J = e.hovered.element.value) == null ? void 0 : J.events) != null && Q.onHover && e.hovered.element.value.events.onHover(e)), e.hovered.zone.value !== V && ((ee = V == null ? void 0 : V.events) != null && ee.onLeave && V.events.onLeave(e), (ne = (te = e.hovered.zone.value) == null ? void 0 : te.events) != null && ne.onHover && e.hovered.zone.value.events.onHover(e));
|
|
477
|
-
}, 1e3), y = () => {
|
|
478
|
-
v(), n = requestAnimationFrame(y);
|
|
479
|
-
}, l = () => {
|
|
480
|
-
y();
|
|
481
|
-
}, p = () => {
|
|
482
|
-
n !== null && (cancelAnimationFrame(n), n = null);
|
|
367
|
+
}, v = (c) => {
|
|
368
|
+
if (!c)
|
|
369
|
+
return { element: null, zone: null };
|
|
370
|
+
const g = Array.isArray(c) ? c : [c], P = n.draggingElements.value.map(
|
|
371
|
+
(m) => m.node
|
|
372
|
+
), [C] = g.map(
|
|
373
|
+
(m) => n.elements.value.find((_) => _.node === m)
|
|
374
|
+
).filter((m) => m ? m.groups.length ? !n.draggingElements.value.some(
|
|
375
|
+
(w) => w.groups.length ? !w.groups.some(
|
|
376
|
+
(O) => m.groups.includes(O)
|
|
377
|
+
) : !1
|
|
378
|
+
) : !0 : !1), [S] = g.map((m) => {
|
|
379
|
+
const _ = n.zones.value.find((w) => w.node === m);
|
|
380
|
+
return !_ || P.some(
|
|
381
|
+
(w) => w && M(m, w)
|
|
382
|
+
) || _.groups.length && !!n.draggingElements.value.some((O) => O.groups.length ? !O.groups.some((j) => _.groups.includes(j)) : !1) ? null : _;
|
|
383
|
+
});
|
|
384
|
+
return {
|
|
385
|
+
element: C ?? null,
|
|
386
|
+
zone: S ?? null
|
|
387
|
+
};
|
|
388
|
+
}, h = (t == null ? void 0 : t.sensor) || me, u = (c) => {
|
|
389
|
+
var C, S, m, _, w, O;
|
|
390
|
+
const g = n.hovered.element.value, P = n.hovered.zone.value;
|
|
391
|
+
n.hovered.element.value = c.element, n.hovered.zone.value = c.zone, n.hovered.element.value !== g && ((C = g == null ? void 0 : g.events) != null && C.onLeave && g.events.onLeave(n), (m = (S = n.hovered.element.value) == null ? void 0 : S.events) != null && m.onHover && n.hovered.element.value.events.onHover(n)), n.hovered.zone.value !== P && ((_ = P == null ? void 0 : P.events) != null && _.onLeave && P.events.onLeave(n), (O = (w = n.hovered.zone.value) == null ? void 0 : w.events) != null && O.onHover && n.hovered.zone.value.events.onHover(n));
|
|
392
|
+
}, E = ae(() => {
|
|
393
|
+
const c = h(n), g = v(c);
|
|
394
|
+
u(g);
|
|
395
|
+
}, (t == null ? void 0 : t.throttle) ?? 0), r = () => {
|
|
396
|
+
E(), s = requestAnimationFrame(r);
|
|
397
|
+
}, o = () => r(), f = () => {
|
|
398
|
+
s !== null && (cancelAnimationFrame(s), s = null);
|
|
483
399
|
};
|
|
484
400
|
return {
|
|
485
|
-
activate: (
|
|
486
|
-
|
|
401
|
+
activate: (c) => {
|
|
402
|
+
n.draggingElements.value = d(e.value), i(c), o();
|
|
487
403
|
},
|
|
488
|
-
track: (
|
|
489
|
-
|
|
404
|
+
track: (c) => {
|
|
405
|
+
a(c);
|
|
490
406
|
},
|
|
491
407
|
deactivate: () => {
|
|
492
|
-
var
|
|
493
|
-
|
|
494
|
-
(
|
|
495
|
-
var
|
|
496
|
-
return (
|
|
408
|
+
var c, g;
|
|
409
|
+
l(), n.hovered.zone.value ? (g = (c = n.hovered.zone.value.events).onDrop) == null || g.call(c, n) : n.draggingElements.value.forEach(
|
|
410
|
+
(P) => {
|
|
411
|
+
var C, S;
|
|
412
|
+
return (S = (C = P.events).onEnd) == null ? void 0 : S.call(C, n);
|
|
497
413
|
}
|
|
498
|
-
),
|
|
414
|
+
), n.draggingElements.value = [], n.selectedElements.value = [], n.hovered.zone.value = null, n.hovered.element.value = null, f();
|
|
499
415
|
}
|
|
500
416
|
};
|
|
501
|
-
},
|
|
417
|
+
}, we = (e) => {
|
|
502
418
|
const {
|
|
503
|
-
elementRef:
|
|
504
|
-
registerElement:
|
|
505
|
-
unregisterElement:
|
|
506
|
-
isDragging:
|
|
507
|
-
isOvered:
|
|
419
|
+
elementRef: t,
|
|
420
|
+
registerElement: n,
|
|
421
|
+
unregisterElement: i,
|
|
422
|
+
isDragging: a,
|
|
423
|
+
isOvered: l,
|
|
508
424
|
isAllowed: s
|
|
509
|
-
} =
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
425
|
+
} = ve(e), { disableInteractions: d, enableInteractions: v } = ge(), { activeContainer: h, pointerPosition: u } = T(), { activate: E, track: r, deactivate: o } = Ee(t, {
|
|
426
|
+
throttle: e == null ? void 0 : e.throttle,
|
|
427
|
+
sensor: e == null ? void 0 : e.sensor
|
|
428
|
+
}), f = (c) => {
|
|
429
|
+
e != null && e.container && (h.component.value = le(e.container)), d(), E(c), document.addEventListener("pointermove", p), document.addEventListener("pointerup", x), document.addEventListener("wheel", D);
|
|
430
|
+
}, p = (c) => r(c), D = (c) => r(c), x = () => {
|
|
431
|
+
h.component.value = null, v(), o(), document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", x), document.removeEventListener("wheel", D);
|
|
513
432
|
};
|
|
514
|
-
return
|
|
515
|
-
pointerPosition:
|
|
516
|
-
elementRef:
|
|
517
|
-
isDragging:
|
|
518
|
-
isOvered:
|
|
433
|
+
return V(n), H(i), {
|
|
434
|
+
pointerPosition: u,
|
|
435
|
+
elementRef: t,
|
|
436
|
+
isDragging: a,
|
|
437
|
+
isOvered: l,
|
|
519
438
|
isAllowed: s,
|
|
520
|
-
handleDragStart:
|
|
439
|
+
handleDragStart: f
|
|
521
440
|
};
|
|
522
|
-
},
|
|
523
|
-
const { zones:
|
|
524
|
-
var
|
|
525
|
-
return ((
|
|
526
|
-
}),
|
|
527
|
-
if (!
|
|
528
|
-
const
|
|
529
|
-
(
|
|
441
|
+
}, ye = (e) => {
|
|
442
|
+
const { zones: t, hovered: n, draggingElements: i, isDragging: a } = T(), l = y(null), s = I(() => {
|
|
443
|
+
var u;
|
|
444
|
+
return ((u = n.zone.value) == null ? void 0 : u.node) === l.value;
|
|
445
|
+
}), d = I(() => {
|
|
446
|
+
if (!l.value || !a.value) return !1;
|
|
447
|
+
const u = t.value.find(
|
|
448
|
+
(E) => E.node === l.value
|
|
530
449
|
);
|
|
531
|
-
return
|
|
532
|
-
(
|
|
450
|
+
return u != null && u.groups.length ? !i.value.some((E) => E.groups.length ? !E.groups.some(
|
|
451
|
+
(r) => u.groups.includes(r)
|
|
533
452
|
) : !1) : !0;
|
|
534
453
|
});
|
|
535
|
-
return { elementRef:
|
|
536
|
-
if (!
|
|
537
|
-
|
|
538
|
-
node:
|
|
539
|
-
groups: (
|
|
540
|
-
events: (
|
|
541
|
-
data: (
|
|
542
|
-
}),
|
|
454
|
+
return { elementRef: l, registerZone: () => {
|
|
455
|
+
if (!l.value) throw new Error("elementRef is not set");
|
|
456
|
+
t.value.push({
|
|
457
|
+
node: l.value,
|
|
458
|
+
groups: (e == null ? void 0 : e.groups) ?? [],
|
|
459
|
+
events: (e == null ? void 0 : e.events) ?? {},
|
|
460
|
+
data: (e == null ? void 0 : e.data) ?? void 0
|
|
461
|
+
}), l.value.setAttribute("data-dnd-droppable", "true");
|
|
543
462
|
}, unregisterZone: () => {
|
|
544
|
-
if (!
|
|
545
|
-
const
|
|
546
|
-
(
|
|
463
|
+
if (!l.value) throw new Error("elementRef is not set");
|
|
464
|
+
const u = t.value.findIndex(
|
|
465
|
+
(E) => E.node === l.value
|
|
547
466
|
);
|
|
548
|
-
|
|
549
|
-
}, isOvered: s, isAllowed:
|
|
550
|
-
},
|
|
551
|
-
const { elementRef:
|
|
552
|
-
return
|
|
553
|
-
},
|
|
554
|
-
const { selectedElements:
|
|
555
|
-
() =>
|
|
556
|
-
),
|
|
557
|
-
() =>
|
|
558
|
-
),
|
|
559
|
-
(
|
|
560
|
-
|
|
561
|
-
|
|
467
|
+
u !== -1 && t.value.splice(u, 1);
|
|
468
|
+
}, isOvered: s, isAllowed: d };
|
|
469
|
+
}, De = (e) => {
|
|
470
|
+
const { elementRef: t, registerZone: n, unregisterZone: i, isOvered: a, isAllowed: l } = ye(e);
|
|
471
|
+
return V(n), H(i), { elementRef: t, isOvered: a, isAllowed: l };
|
|
472
|
+
}, _e = (e) => {
|
|
473
|
+
const { selectedElements: t, elements: n } = T(), i = I(
|
|
474
|
+
() => n.value.find((u) => u.node === e.value)
|
|
475
|
+
), a = I(
|
|
476
|
+
() => t.value.some((u) => u.node === e.value)
|
|
477
|
+
), l = I(() => e.value ? t.value.some(
|
|
478
|
+
(u) => u.node && M(
|
|
479
|
+
u.node,
|
|
480
|
+
e.value
|
|
562
481
|
)
|
|
563
|
-
) : !1), s =
|
|
564
|
-
(
|
|
565
|
-
|
|
566
|
-
|
|
482
|
+
) : !1), s = I(() => e.value ? t.value.some(
|
|
483
|
+
(u) => u.node && M(
|
|
484
|
+
e.value,
|
|
485
|
+
u.node
|
|
567
486
|
)
|
|
568
|
-
) : !1),
|
|
569
|
-
|
|
570
|
-
(
|
|
487
|
+
) : !1), d = () => {
|
|
488
|
+
i.value && (t.value = t.value.filter(
|
|
489
|
+
(u) => u.node !== e.value
|
|
571
490
|
));
|
|
572
491
|
}, v = () => {
|
|
573
|
-
|
|
574
|
-
(
|
|
575
|
-
|
|
576
|
-
|
|
492
|
+
i.value && (l.value && (t.value = t.value.filter(
|
|
493
|
+
(u) => u.node && !M(
|
|
494
|
+
u.node,
|
|
495
|
+
e.value
|
|
577
496
|
)
|
|
578
|
-
)), s.value && (
|
|
579
|
-
(
|
|
580
|
-
|
|
581
|
-
|
|
497
|
+
)), s.value && (t.value = t.value.filter(
|
|
498
|
+
(u) => u.node && !M(
|
|
499
|
+
e.value,
|
|
500
|
+
u.node
|
|
582
501
|
)
|
|
583
|
-
)),
|
|
502
|
+
)), t.value.push(i.value));
|
|
584
503
|
};
|
|
585
504
|
return {
|
|
586
|
-
handleUnselect:
|
|
505
|
+
handleUnselect: d,
|
|
587
506
|
handleSelect: v,
|
|
588
507
|
handleToggleSelect: () => {
|
|
589
|
-
|
|
508
|
+
i.value && (t.value.some((u) => u.node === e.value) ? d() : v());
|
|
590
509
|
},
|
|
591
|
-
isSelected:
|
|
592
|
-
isParentOfSelected:
|
|
510
|
+
isSelected: a,
|
|
511
|
+
isParentOfSelected: l
|
|
593
512
|
};
|
|
594
513
|
};
|
|
595
514
|
export {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
515
|
+
Pe as default,
|
|
516
|
+
T as useDnDStore,
|
|
517
|
+
we as useDraggable,
|
|
518
|
+
De as useDroppable,
|
|
519
|
+
_e as useSelection
|
|
601
520
|
};
|