fluid-dnd 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{HandlerPublisher-CVvTsXrJ.js → HandlerPublisher-CRBvk0J7.js} +1 -1
- package/dist/{HandlerPublisher-CsD6p60X.cjs → HandlerPublisher-DGYFIYDd.cjs} +1 -1
- package/dist/core/index.d.ts +37 -0
- package/dist/core/useDraggable.js +2 -2
- package/dist/core/utils/SetTransform.d.ts +3 -3
- package/dist/core/utils/SetTransform.js +20 -20
- package/dist/core/utils/config.d.ts +3 -3
- package/dist/core/utils/config.js +5 -4
- package/dist/index-Dc95WWpv.js +1271 -0
- package/dist/index-DxKyk1TO.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.mjs +2 -2
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.mjs +2 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/index-C6IKL-bo.js +0 -1271
- package/dist/index-DE3X7xW4.cjs +0 -1
@@ -0,0 +1,1271 @@
|
|
1
|
+
var Ae = Object.defineProperty;
|
2
|
+
var xe = (e, t, n) => t in e ? Ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
3
|
+
var Z = (e, t, n) => xe(e, typeof t != "symbol" ? t + "" : t, n);
|
4
|
+
const q = "horizontal", nt = "vertical", et = "draggable", Xt = "droppable", Lt = "handler-class", Ft = "dragging", Wt = "dragging-handler-class", Vt = "dropping", oe = "grabbing", Be = "grab", Kt = "disable-transition", Me = (e, t) => {
|
5
|
+
const n = (c, d) => e.removeAtEvent(c, d), s = (c, d, h) => e.insertEvent(c, d, h), o = () => e.getLength(), r = (c) => e.getValue(c), a = (c) => c;
|
6
|
+
return {
|
7
|
+
direction: (t == null ? void 0 : t.direction) ?? nt,
|
8
|
+
handlerSelector: (t == null ? void 0 : t.handlerSelector) ?? et,
|
9
|
+
draggingClass: (t == null ? void 0 : t.draggingClass) ?? "dragging",
|
10
|
+
droppableClass: (t == null ? void 0 : t.droppableClass) ?? "droppable-hover",
|
11
|
+
isDraggable: (t == null ? void 0 : t.isDraggable) ?? (() => !0),
|
12
|
+
onDragStart: (t == null ? void 0 : t.onDragStart) ?? (() => {
|
13
|
+
}),
|
14
|
+
onDragEnd: (t == null ? void 0 : t.onDragEnd) ?? (() => {
|
15
|
+
}),
|
16
|
+
droppableGroup: t == null ? void 0 : t.droppableGroup,
|
17
|
+
onRemoveAtEvent: n,
|
18
|
+
onInsertEvent: s,
|
19
|
+
onGetLegth: o,
|
20
|
+
onGetValue: r,
|
21
|
+
animationDuration: (t == null ? void 0 : t.animationDuration) ?? 200,
|
22
|
+
removingClass: (t == null ? void 0 : t.removingClass) ?? "removing",
|
23
|
+
insertingFromClass: (t == null ? void 0 : t.insertingFromClass) ?? "from-inserting",
|
24
|
+
delayBeforeRemove: (t == null ? void 0 : t.delayBeforeRemove) ?? 200,
|
25
|
+
delayBeforeInsert: (t == null ? void 0 : t.delayBeforeInsert) ?? 200,
|
26
|
+
mapFrom: (t == null ? void 0 : t.mapFrom) ?? a,
|
27
|
+
delayBeforeTouchMoveEvent: (t == null ? void 0 : t.delayBeforeTouchMoveEvent) ?? 150,
|
28
|
+
coordinateTransform: (t == null ? void 0 : t.coordinateTransform) ?? [(c) => c]
|
29
|
+
};
|
30
|
+
}, we = (e, t) => {
|
31
|
+
const { config: n, droppable: s } = e, { onInsertEvent: o, onDragEnd: r } = n;
|
32
|
+
return {
|
33
|
+
...n,
|
34
|
+
onDragEnd: (d) => {
|
35
|
+
const { index: h, value: f } = d;
|
36
|
+
r({ index: h, value: t(f, s) });
|
37
|
+
},
|
38
|
+
onInsertEvent: (d, h) => o(d, t(h, s), !0)
|
39
|
+
};
|
40
|
+
}, st = (e, t) => e.classList.contains(t), Et = (e, t, n = !1) => {
|
41
|
+
e.classList.toggle(t, n);
|
42
|
+
}, ot = (e, t) => {
|
43
|
+
e.classList.add(t);
|
44
|
+
}, xt = (e, t) => {
|
45
|
+
e.classList.remove(t);
|
46
|
+
}, Re = (e, t) => Bt(t).every(
|
47
|
+
(n) => st(e, n)
|
48
|
+
), gt = (e) => e ? `.${Bt(e).join(".")}` : "", Le = (e, t) => {
|
49
|
+
if (!t)
|
50
|
+
return;
|
51
|
+
const n = Bt(t);
|
52
|
+
e.classList.add(...n);
|
53
|
+
}, Bt = (e) => e ? e.split(" ").filter((t) => t) : [], Oe = () => {
|
54
|
+
const { scrollX: e, scrollY: t } = window;
|
55
|
+
return { scrollX: e, scrollY: t };
|
56
|
+
}, zt = (e) => !e || e.trim().length == 0 || e == "normal" ? 0 : parseFloat(e), Ne = (e) => e ? parseInt(e) : -1, Fe = (e) => {
|
57
|
+
const t = getComputedStyle(e), n = new DOMMatrixReadOnly(t.transform);
|
58
|
+
return {
|
59
|
+
x: n.m41,
|
60
|
+
y: n.m42
|
61
|
+
};
|
62
|
+
}, re = (e, t) => e.x1 > t.x1 ? re(t, e) : e.x2 < t.x1 ? 0 : e.x2 >= t.x2 ? e.x2 - e.x1 : e.x2 - t.x1, pt = (e, t) => !Pe(e, t), Pe = (e, t) => {
|
63
|
+
const n = Ot(e), s = Ot(t), o = Qt(n, s, nt), r = Qt(n, s, q);
|
64
|
+
return o >= Math.min(n.height, s.height) / 2 && r >= Math.min(n.width, s.width) / 2;
|
65
|
+
}, Qt = (e, t, n) => {
|
66
|
+
const { before: s, distance: o } = M(n);
|
67
|
+
return re(
|
68
|
+
{
|
69
|
+
x1: e[s],
|
70
|
+
x2: e[s] + e[o]
|
71
|
+
},
|
72
|
+
{
|
73
|
+
x1: t[s],
|
74
|
+
x2: t[s] + t[o]
|
75
|
+
}
|
76
|
+
);
|
77
|
+
}, L = (e, t) => e ? zt(getComputedStyle(e)[t]) : 0, Ut = (e) => {
|
78
|
+
const { scrollLeft: t, scrollTop: n } = e;
|
79
|
+
return { scrollLeft: t, scrollTop: n };
|
80
|
+
}, Ot = (e) => e.getBoundingClientRect(), M = (e) => {
|
81
|
+
const t = e == q;
|
82
|
+
return {
|
83
|
+
beforeMargin: t ? "marginLeft" : "marginTop",
|
84
|
+
afterMargin: t ? "marginRight" : "marginBottom",
|
85
|
+
borderBeforeWidth: t ? "borderLeftWidth" : "borderTopWidth",
|
86
|
+
before: t ? "left" : "top",
|
87
|
+
after: t ? "right" : "down",
|
88
|
+
gap: t ? "columnGap" : "rowGap",
|
89
|
+
distance: t ? "width" : "height",
|
90
|
+
axis: t ? "x" : "y",
|
91
|
+
offset: t ? "offsetX" : "offsetY",
|
92
|
+
scroll: t ? "scrollX" : "scrollY",
|
93
|
+
scrollElement: t ? "scrollLeft" : "scrollTop",
|
94
|
+
page: t ? "pageX" : "pageY",
|
95
|
+
inner: t ? "innerWidth" : "innerHeight",
|
96
|
+
offsetElement: t ? "offsetLeft" : "offsetTop",
|
97
|
+
scrollDistance: t ? "scrollWidth" : "scrollHeight",
|
98
|
+
clientDistance: t ? "clientWidth" : "clientHeight",
|
99
|
+
paddingBefore: t ? "paddingLeft" : "paddingTop",
|
100
|
+
getRect: Ot
|
101
|
+
};
|
102
|
+
}, wt = (e, t) => $e(e, t), ie = (e) => [...e.children].filter(
|
103
|
+
(n) => st(n, et)
|
104
|
+
), $e = (e, t) => {
|
105
|
+
const n = [...t.children].filter(
|
106
|
+
(o) => st(o, et) && !o.isEqualNode(e)
|
107
|
+
).toReversed(), s = [...t.children].findLastIndex(
|
108
|
+
(o) => o.isEqualNode(e)
|
109
|
+
);
|
110
|
+
return [
|
111
|
+
n,
|
112
|
+
s,
|
113
|
+
t
|
114
|
+
];
|
115
|
+
}, Ge = (e) => {
|
116
|
+
let t = e.parentElement;
|
117
|
+
for (; t; ) {
|
118
|
+
if (window.getComputedStyle(t).position === "fixed")
|
119
|
+
return t;
|
120
|
+
t = t.parentElement;
|
121
|
+
}
|
122
|
+
return null;
|
123
|
+
}, ce = (e, t) => {
|
124
|
+
const {
|
125
|
+
before: n,
|
126
|
+
borderBeforeWidth: s
|
127
|
+
} = M(t), o = Ge(e);
|
128
|
+
return o ? Ot(o)[n] + L(o, s) : 0;
|
129
|
+
}, yt = (e) => window.TouchEvent && e instanceof TouchEvent, rt = (e) => e instanceof HTMLElement, ae = (e) => e instanceof MouseEvent, Ie = ["onmouseup", "onmousedown", "onmousemove"], Ye = (e, t, n) => {
|
130
|
+
e && (e.style.height = `${t}px`, e.style.width = `${n}px`);
|
131
|
+
}, Ct = (e, t, n) => {
|
132
|
+
!e || !rt(e) || (n == 0 && t == 0 ? e.style.transform = "" : e.style.transform = `translate(${n}px,${t}px)`);
|
133
|
+
}, Xe = (e, t, n, s) => {
|
134
|
+
e[t] = (o) => {
|
135
|
+
if (o.defaultPrevented)
|
136
|
+
return;
|
137
|
+
s && s(o);
|
138
|
+
const r = _t(o);
|
139
|
+
n(r);
|
140
|
+
};
|
141
|
+
}, It = (e, t, n, s) => {
|
142
|
+
n && (We(t) ? e[t] = n : Xe(e, t, n, s));
|
143
|
+
}, We = (e) => Ie.includes(e), Ve = (e) => {
|
144
|
+
const { target: t } = e;
|
145
|
+
return {
|
146
|
+
clientX: 0,
|
147
|
+
clientY: 0,
|
148
|
+
pageX: 0,
|
149
|
+
pageY: 0,
|
150
|
+
screenX: 0,
|
151
|
+
screenY: 0,
|
152
|
+
target: t,
|
153
|
+
offsetX: 0,
|
154
|
+
offsetY: 0
|
155
|
+
};
|
156
|
+
}, _e = (e, t) => {
|
157
|
+
const n = (s, o) => qe(t, window, o, s);
|
158
|
+
if (ae(e)) {
|
159
|
+
const { offsetX: s, offsetY: o } = e;
|
160
|
+
return [s, o];
|
161
|
+
} else {
|
162
|
+
const s = e.target;
|
163
|
+
return [
|
164
|
+
n(s, q),
|
165
|
+
n(s, nt)
|
166
|
+
];
|
167
|
+
}
|
168
|
+
}, _t = (e) => {
|
169
|
+
const t = He(e);
|
170
|
+
if (!t)
|
171
|
+
return Ve(e);
|
172
|
+
const [n, s] = _e(e, t), { clientX: o, clientY: r, pageX: a, pageY: c, screenX: d, screenY: h, target: f } = t;
|
173
|
+
return {
|
174
|
+
clientX: o,
|
175
|
+
clientY: r,
|
176
|
+
pageX: a,
|
177
|
+
pageY: c,
|
178
|
+
screenX: d,
|
179
|
+
screenY: h,
|
180
|
+
target: f,
|
181
|
+
offsetX: n,
|
182
|
+
offsetY: s
|
183
|
+
};
|
184
|
+
}, He = (e) => {
|
185
|
+
if (yt(e))
|
186
|
+
return e.touches[0] ?? e.changedTouches[0];
|
187
|
+
if (ae(e))
|
188
|
+
return e;
|
189
|
+
}, qe = (e, t, n, s) => {
|
190
|
+
const { page: o, scroll: r, before: a, borderBeforeWidth: c, getRect: d } = M(n), h = d(s);
|
191
|
+
return e[o] - t[r] - h[a] - L(s, c);
|
192
|
+
}, Pt = (e, t, n = "ease-out", s = "transform") => {
|
193
|
+
rt(e) && (e.style.transitionDuration = `${t}ms`, e.style.transitionTimingFunction = `${n}`, e.style.transitionProperty = `${s}`);
|
194
|
+
}, le = (e, t, n) => {
|
195
|
+
!e || !rt(e) || (e[t] = () => {
|
196
|
+
n();
|
197
|
+
});
|
198
|
+
}, ze = (e) => {
|
199
|
+
var t = e.querySelector("style");
|
200
|
+
if (!t) {
|
201
|
+
var n = document.createElement("style");
|
202
|
+
return e.appendChild(n), n;
|
203
|
+
}
|
204
|
+
return t;
|
205
|
+
}, je = (e, t) => {
|
206
|
+
const n = /\.-?[_a-zA-Z0-9-*\s<>():]+/g, [s] = t.match(n) || [];
|
207
|
+
for (const o of e.cssRules) {
|
208
|
+
const [r] = o.cssText.match(n) || [];
|
209
|
+
if (s === r)
|
210
|
+
return !0;
|
211
|
+
}
|
212
|
+
return !1;
|
213
|
+
}, Ze = (e, t) => {
|
214
|
+
t.forEach((n) => {
|
215
|
+
ke(e, n);
|
216
|
+
});
|
217
|
+
}, ke = (e, t) => {
|
218
|
+
var s;
|
219
|
+
var n = ze(e);
|
220
|
+
n.sheet && (je(n.sheet, t) || (s = n.sheet) == null || s.insertRule(t, n.sheet.cssRules.length));
|
221
|
+
}, ue = (e, t = {}) => {
|
222
|
+
for (const n of Object.keys(t)) {
|
223
|
+
const s = t[n];
|
224
|
+
s != null && Je(e, `--${n}`, s);
|
225
|
+
}
|
226
|
+
}, Je = (e, t, n) => e && e.style.setProperty(t, n), Ke = (e, t, n) => {
|
227
|
+
n != 0 && (t === "vertical" ? e.scrollBy(0, n) : e.scrollBy(n, 0));
|
228
|
+
}, Qe = (e, t, n) => {
|
229
|
+
const { scrollDistance: s, clientDistance: o, scrollElement: r } = M(e);
|
230
|
+
return n[r] / (t[s] - t[o]);
|
231
|
+
}, Ue = (e, t) => {
|
232
|
+
let n = { offsetX: 0, offsetY: 0 }, s = { top: 0, left: 0 }, o = { x: 0, y: 0 };
|
233
|
+
const r = (f) => {
|
234
|
+
e.style.transform = `translate( ${f.x}px, ${f.y}px)`;
|
235
|
+
}, a = (f) => {
|
236
|
+
e.style.top = `${f.top}px`, e.style.left = `${f.left}px`;
|
237
|
+
}, c = (f, E, w, R) => {
|
238
|
+
const O = (T) => {
|
239
|
+
const {
|
240
|
+
beforeMargin: b,
|
241
|
+
borderBeforeWidth: B,
|
242
|
+
before: Y,
|
243
|
+
offset: F,
|
244
|
+
scroll: P,
|
245
|
+
page: k,
|
246
|
+
inner: J,
|
247
|
+
distance: z,
|
248
|
+
axis: X,
|
249
|
+
getRect: $
|
250
|
+
} = M(T), K = w[k], _ = window[P], Q = window[J], W = $(f)[z], G = L(f, B), H = L(f, b), j = K - n[F], ut = ce(f, T);
|
251
|
+
if (j >= _ - W / 2 && j <= _ + Q) {
|
252
|
+
const u = j - s[Y] - G - H - _ - ut;
|
253
|
+
return I(T), u;
|
254
|
+
}
|
255
|
+
return o[X];
|
256
|
+
}, I = (T) => {
|
257
|
+
if (f && st(f, Ft) && T === R) {
|
258
|
+
const { before: b, distance: B, axis: Y, getRect: F } = M(R), P = F(f)[B], k = F(E), J = s[b] - k[b] + o[Y], X = k[B] - P, $ = J / X, K = P / X, _ = 0.1, Q = 0.2, W = 0.8;
|
259
|
+
let G = 0;
|
260
|
+
const H = pt(f, E);
|
261
|
+
!H && $ < Q && $ > -K ? G = $ / Q - 1 : !H && $ > W && $ < 1 + K && (G = 1 / (1 - W) * ($ - W));
|
262
|
+
const j = _ * P * G;
|
263
|
+
Ke(E, R, j);
|
264
|
+
}
|
265
|
+
}, S = (T) => {
|
266
|
+
const { axis: b } = M(T);
|
267
|
+
o[b] = O(T), r(d());
|
268
|
+
};
|
269
|
+
S(q), S(nt);
|
270
|
+
}, d = () => {
|
271
|
+
let f = o;
|
272
|
+
for (const E of t)
|
273
|
+
f = E(f, e);
|
274
|
+
return f;
|
275
|
+
};
|
276
|
+
return [c, (f, E) => {
|
277
|
+
const [w, R, O, I] = nn(f, E, e);
|
278
|
+
s = {
|
279
|
+
top: w,
|
280
|
+
left: R
|
281
|
+
}, a(s), n = { offsetX: O, offsetY: I };
|
282
|
+
}];
|
283
|
+
}, Rt = (e, t, n) => {
|
284
|
+
const { borderBeforeWidth: s, before: o, getRect: r } = M(e);
|
285
|
+
return r(t)[o] - r(n)[o] - L(n, s);
|
286
|
+
}, tn = (e, t) => {
|
287
|
+
let { offsetX: n, offsetY: s, target: o } = e, r = en(o, t);
|
288
|
+
const a = o;
|
289
|
+
return a && r && !a.isSameNode(r) && (n += Rt(q, a, r), s += Rt(nt, a, r)), r && t != o && (n += Rt(q, r, t), s += Rt(nt, r, t)), [n, s];
|
290
|
+
}, en = (e, t) => {
|
291
|
+
const n = e == null ? void 0 : e.closest(`.${Lt}`);
|
292
|
+
return n && n.isSameNode(t) ? e : n;
|
293
|
+
}, te = (e, t, n, s) => {
|
294
|
+
const { offset: o, beforeMargin: r, page: a, borderBeforeWidth: c, scroll: d } = M(e), h = ce(n, e);
|
295
|
+
return t[a] - s[o] - L(n, r) - L(n, c) - window[d] - h;
|
296
|
+
}, nn = (e, t, n) => {
|
297
|
+
const [s, o] = tn(e, n);
|
298
|
+
return [
|
299
|
+
te(nt, e, t, {
|
300
|
+
offsetX: s,
|
301
|
+
offsetY: o
|
302
|
+
}),
|
303
|
+
te(q, e, t, {
|
304
|
+
offsetX: s,
|
305
|
+
offsetY: o
|
306
|
+
}),
|
307
|
+
s,
|
308
|
+
o
|
309
|
+
];
|
310
|
+
}, fe = "startDrag", Nt = "drag", jt = "startDrop", sn = "drop", at = "temp-child", de = "cubic-bezier(0.2, 0, 0, 1)", on = (e) => e === sn || e === jt, Ht = (e) => !e || e.length == 0 ? 0 : zt(e.replace("px", "")), rn = (e, t) => {
|
311
|
+
const n = getComputedStyle(e)[t];
|
312
|
+
if (n.match("%")) {
|
313
|
+
const o = zt(n.replace("%", "")), { width: r } = e.getBoundingClientRect();
|
314
|
+
return r * (o / 100);
|
315
|
+
}
|
316
|
+
return Ht(n);
|
317
|
+
}, Zt = (e, t) => {
|
318
|
+
if (!(e instanceof Element))
|
319
|
+
return [
|
320
|
+
0,
|
321
|
+
!1
|
322
|
+
];
|
323
|
+
const n = rn(e, t), s = getComputedStyle(e).display, o = n > 0 || s === "flex";
|
324
|
+
return [n, o];
|
325
|
+
}, cn = (e) => {
|
326
|
+
const { top: t, left: n } = getComputedStyle(e);
|
327
|
+
return [Ht(t), Ht(n)];
|
328
|
+
}, an = (e, t) => {
|
329
|
+
const { gap: n } = M(t), [s, o] = Zt(e, n);
|
330
|
+
return o ? s : 0;
|
331
|
+
};
|
332
|
+
function At(e, t, n, s, o = e.previousElementSibling, r = e.nextElementSibling) {
|
333
|
+
let { height: a, width: c } = ln(
|
334
|
+
n,
|
335
|
+
e,
|
336
|
+
o,
|
337
|
+
r
|
338
|
+
);
|
339
|
+
return pt(e, s) && t == Nt && (a = 0, c = 0), { height: a, width: c };
|
340
|
+
}
|
341
|
+
const ln = (e, t, n, s) => {
|
342
|
+
const {
|
343
|
+
afterMargin: o,
|
344
|
+
beforeMargin: r,
|
345
|
+
distance: a,
|
346
|
+
gap: c,
|
347
|
+
getRect: d
|
348
|
+
} = M(e), h = L(t, o), f = L(t, r), E = L(s, r), [w, R] = Zt(
|
349
|
+
t.parentElement,
|
350
|
+
c
|
351
|
+
), O = d(t)[a];
|
352
|
+
if (R)
|
353
|
+
return ee(O, f, h, w, 0, e);
|
354
|
+
const [I, S, T] = un(
|
355
|
+
n,
|
356
|
+
E,
|
357
|
+
h,
|
358
|
+
f,
|
359
|
+
o
|
360
|
+
);
|
361
|
+
return ee(O, S, I, 0, T, e);
|
362
|
+
}, un = (e, t, n, s, o) => {
|
363
|
+
const r = Math.max(t, n);
|
364
|
+
let a = s, c = t;
|
365
|
+
if (e) {
|
366
|
+
const d = L(
|
367
|
+
e,
|
368
|
+
o
|
369
|
+
);
|
370
|
+
a = Math.max(d, s), c = Math.max(c, d);
|
371
|
+
}
|
372
|
+
return [r, a, c];
|
373
|
+
}, ee = (e, t, n, s, o, r) => fn(r, e + t + n + s - o), fn = (e, t) => e == q ? { width: t, height: 0 } : { width: 0, height: t }, ne = (e, t) => {
|
374
|
+
const {
|
375
|
+
borderBeforeWidth: n,
|
376
|
+
paddingBefore: s,
|
377
|
+
axis: o,
|
378
|
+
getRect: r
|
379
|
+
} = M(e), a = L(t, n), c = L(t, s), d = r(t)[o];
|
380
|
+
return a + c + d;
|
381
|
+
}, dn = (e, t) => {
|
382
|
+
const [n, s] = cn(t), o = ne(nt, e);
|
383
|
+
return [
|
384
|
+
ne(q, e) - s,
|
385
|
+
o - n
|
386
|
+
];
|
387
|
+
};
|
388
|
+
function gn(e, t, n, s, o, r, a, c, d) {
|
389
|
+
let h = 0, f = 0;
|
390
|
+
const E = !!(n < 0 && d);
|
391
|
+
if (n === s && !E)
|
392
|
+
return se(
|
393
|
+
{ height: h, width: f },
|
394
|
+
e,
|
395
|
+
o,
|
396
|
+
a,
|
397
|
+
E
|
398
|
+
);
|
399
|
+
const [w, R, O, I] = mn(t, n, s, d);
|
400
|
+
if (E) {
|
401
|
+
const [H, j] = dn(c, d);
|
402
|
+
h += j, f += H;
|
403
|
+
}
|
404
|
+
const {
|
405
|
+
scrollElement: S,
|
406
|
+
beforeMargin: T,
|
407
|
+
afterMargin: b,
|
408
|
+
distance: B,
|
409
|
+
gap: Y
|
410
|
+
} = M(e), [F, P] = Zt(c, Y), [
|
411
|
+
k,
|
412
|
+
J,
|
413
|
+
z
|
414
|
+
] = vn(
|
415
|
+
T,
|
416
|
+
b,
|
417
|
+
w,
|
418
|
+
R == null ? void 0 : R.previousElementSibling,
|
419
|
+
I,
|
420
|
+
P,
|
421
|
+
E
|
422
|
+
), [X, $, K] = Sn(
|
423
|
+
T,
|
424
|
+
b,
|
425
|
+
B,
|
426
|
+
O,
|
427
|
+
F,
|
428
|
+
P
|
429
|
+
), _ = hn(
|
430
|
+
$,
|
431
|
+
X,
|
432
|
+
K,
|
433
|
+
J,
|
434
|
+
k,
|
435
|
+
F
|
436
|
+
), Q = E ? c[S] : pn(S, c, r), G = (I ? _ - z : z - _) - Q;
|
437
|
+
return e === nt ? h += G : e === q && (f += G), se(
|
438
|
+
{ height: h, width: f },
|
439
|
+
e,
|
440
|
+
o,
|
441
|
+
a,
|
442
|
+
E
|
443
|
+
);
|
444
|
+
}
|
445
|
+
const pn = (e, t, n) => {
|
446
|
+
const s = t[e], o = n[e];
|
447
|
+
return s - o;
|
448
|
+
}, hn = (e, t, n, s, o, r) => {
|
449
|
+
const a = Math.max(t, o);
|
450
|
+
return Math.max(n, s) + e + a + r;
|
451
|
+
}, mn = (e, t, n, s) => {
|
452
|
+
const o = t < n, [r, a] = [t, n].toSorted(
|
453
|
+
(f, E) => f - E
|
454
|
+
), c = e[t] ?? s, d = e[n];
|
455
|
+
let h = o ? e.slice(r + 1, a + 1) : e.slice(r, a);
|
456
|
+
return r < 0 && s && (h = e.slice(r + 1, a)), [
|
457
|
+
c,
|
458
|
+
d,
|
459
|
+
h,
|
460
|
+
o
|
461
|
+
];
|
462
|
+
}, Sn = (e, t, n, s, o, r) => {
|
463
|
+
if (s.length == 0)
|
464
|
+
return [0, 0, 0];
|
465
|
+
const a = L(s[0], e);
|
466
|
+
let c = 0, d = -a;
|
467
|
+
for (const [h, f] of s.entries()) {
|
468
|
+
const E = f.getBoundingClientRect()[n], w = L(f, e);
|
469
|
+
r && (c += w), r && h > 0 ? c += o : c = Math.max(c, w), d += c + E, c = L(f, t);
|
470
|
+
}
|
471
|
+
return [a, d, c];
|
472
|
+
}, se = (e, t, n, s, o) => {
|
473
|
+
const { scroll: r, distance: a } = M(t), c = window[r], d = n[r], h = o ? 0 : d - 2 * c + s[r];
|
474
|
+
return e[a] += h, e;
|
475
|
+
}, vn = (e, t, n, s, o, r, a) => {
|
476
|
+
const c = o ? n.previousElementSibling : s;
|
477
|
+
return Dn(
|
478
|
+
e,
|
479
|
+
t,
|
480
|
+
c,
|
481
|
+
n,
|
482
|
+
r,
|
483
|
+
a
|
484
|
+
);
|
485
|
+
}, Dn = (e, t, n, s, o, r) => {
|
486
|
+
if (o)
|
487
|
+
return [0, 0, 0];
|
488
|
+
const a = L(
|
489
|
+
r ? null : n,
|
490
|
+
t
|
491
|
+
), c = L(s, e);
|
492
|
+
let d = Math.max(a, c);
|
493
|
+
return [a, c, d];
|
494
|
+
}, kt = (e, t, n, s = () => !0) => {
|
495
|
+
const o = new MutationObserver((r) => {
|
496
|
+
if (r = r.filter(s), r.length > 0) {
|
497
|
+
const a = r[0];
|
498
|
+
e(o, a);
|
499
|
+
}
|
500
|
+
});
|
501
|
+
return o.observe(t, n), o;
|
502
|
+
}, Tn = "startDrag", ge = "cubic-bezier(0.2, 0, 0, 1)", pe = 50, qt = (e) => rt(e) ? e.classList.contains(at) : !1, bn = (e, t, n) => {
|
503
|
+
let s = At(
|
504
|
+
t,
|
505
|
+
Tn,
|
506
|
+
n,
|
507
|
+
e
|
508
|
+
);
|
509
|
+
const o = an(e, n), { distance: r } = M(n);
|
510
|
+
s[r] -= o;
|
511
|
+
const [a, c] = En(n, t);
|
512
|
+
return s[c] = a, s;
|
513
|
+
}, En = (e, t) => {
|
514
|
+
const n = e == q ? nt : q, { distance: s, getRect: o } = M(n);
|
515
|
+
return [
|
516
|
+
o(t)[s],
|
517
|
+
s
|
518
|
+
];
|
519
|
+
}, ht = (e, t, n) => {
|
520
|
+
Ye(e, t, n), e.style.minWidth = `${n}px`;
|
521
|
+
}, yn = (e, t, n) => (s) => {
|
522
|
+
t.contains(e) && (ht(e, n.height, n.width), s.disconnect());
|
523
|
+
}, Cn = (e, t) => {
|
524
|
+
if (!t)
|
525
|
+
return;
|
526
|
+
const { droppable: n, config: s, scroll: o } = e, { direction: r } = s, a = Qe(s.direction, n, o) > 0.99, { scrollDistance: c, clientDistance: d, scrollElement: h } = M(r);
|
527
|
+
a && (n[h] = n[c] - n[d]);
|
528
|
+
}, he = (e, t, n, s) => {
|
529
|
+
if (!n)
|
530
|
+
return;
|
531
|
+
const { droppable: o, config: r } = n, { direction: a, animationDuration: c } = r;
|
532
|
+
if (Cn(n, t), o.querySelector(`.${at}`) || !e)
|
533
|
+
return;
|
534
|
+
var d = e.tagName == "LI" ? "DIV" : e.tagName, h = document.createElement(d);
|
535
|
+
ot(h, at), ht(h, 0, 0);
|
536
|
+
const f = bn(o, e, a);
|
537
|
+
return Pt(
|
538
|
+
h,
|
539
|
+
c,
|
540
|
+
ge,
|
541
|
+
"width, min-width, height"
|
542
|
+
), [h, f, o];
|
543
|
+
}, Yt = (e, t, n, s, o) => {
|
544
|
+
const r = he(e, n, s);
|
545
|
+
if (!r)
|
546
|
+
return;
|
547
|
+
const [a, c, d] = r;
|
548
|
+
t.isSameNode(d) && ht(a, c.height, c.width), kt(
|
549
|
+
yn(a, d, c),
|
550
|
+
d,
|
551
|
+
{
|
552
|
+
childList: !0,
|
553
|
+
subtree: !0
|
554
|
+
}
|
555
|
+
), d.appendChild(a);
|
556
|
+
}, An = (e, t, n) => {
|
557
|
+
const s = he(e, t, n);
|
558
|
+
if (!s)
|
559
|
+
return;
|
560
|
+
const [o, r, a] = s;
|
561
|
+
a.appendChild(o), xn(o, r);
|
562
|
+
}, xn = (e, t) => requestAnimationFrame(() => {
|
563
|
+
ht(e, t.height, t.width), requestAnimationFrame(() => {
|
564
|
+
Pt(
|
565
|
+
e,
|
566
|
+
0,
|
567
|
+
ge,
|
568
|
+
"width, min-width, height"
|
569
|
+
);
|
570
|
+
});
|
571
|
+
}), Bn = (e, t, n, s, o = !0) => {
|
572
|
+
if (n) {
|
573
|
+
var r = document.querySelectorAll(
|
574
|
+
`${gt(n)} > .${at}`
|
575
|
+
);
|
576
|
+
r.forEach((a) => {
|
577
|
+
const c = a.parentElement;
|
578
|
+
if (c != null && c.isSameNode(t) || !o && (c != null && c.isSameNode(e)))
|
579
|
+
return;
|
580
|
+
ht(a, 0, 0), setTimeout(() => {
|
581
|
+
var h;
|
582
|
+
(h = a.parentNode) == null || h.removeChild(a);
|
583
|
+
}, s + pe);
|
584
|
+
});
|
585
|
+
}
|
586
|
+
}, bt = (e, t, n = !1) => {
|
587
|
+
var s = e.querySelectorAll(`.${at}`);
|
588
|
+
s.forEach((o) => {
|
589
|
+
const r = o;
|
590
|
+
n ? (ht(r, 0, 0), setTimeout(() => {
|
591
|
+
e.contains(r) && e.removeChild(r);
|
592
|
+
}, t + pe)) : e.removeChild(o);
|
593
|
+
});
|
594
|
+
}, Mn = 50;
|
595
|
+
function wn(e, t, n, s, o, r) {
|
596
|
+
let a = t;
|
597
|
+
const {
|
598
|
+
direction: c,
|
599
|
+
handlerSelector: d,
|
600
|
+
onRemoveAtEvent: h,
|
601
|
+
animationDuration: f,
|
602
|
+
delayBeforeInsert: E,
|
603
|
+
draggingClass: w
|
604
|
+
} = e, R = (l, u, p, v, m) => {
|
605
|
+
if (!v)
|
606
|
+
return;
|
607
|
+
const { droppable: y, config: C } = v, A = At(
|
608
|
+
l,
|
609
|
+
u,
|
610
|
+
C.direction,
|
611
|
+
y
|
612
|
+
);
|
613
|
+
on(u) ? P(
|
614
|
+
l,
|
615
|
+
u,
|
616
|
+
A,
|
617
|
+
p,
|
618
|
+
v,
|
619
|
+
m
|
620
|
+
) : T(
|
621
|
+
l,
|
622
|
+
u,
|
623
|
+
A,
|
624
|
+
v
|
625
|
+
);
|
626
|
+
}, O = (l, u, p, v, m) => {
|
627
|
+
const y = At(
|
628
|
+
u,
|
629
|
+
"insert",
|
630
|
+
e.direction,
|
631
|
+
p
|
632
|
+
), { onInsertEvent: C } = e, A = ie(p);
|
633
|
+
for (const [N, x] of A.entries())
|
634
|
+
st(x, et) && N >= l && F(x, y);
|
635
|
+
m(), setTimeout(() => {
|
636
|
+
C(l, v), me(l, p, e), H(u), W(u, n), bt(n, 0, !0);
|
637
|
+
}, E);
|
638
|
+
}, I = (l, u, p, v) => {
|
639
|
+
if (!p || !p.droppable || !p.config)
|
640
|
+
return;
|
641
|
+
const { droppable: m, config: y } = p;
|
642
|
+
let [C] = wt(u, m);
|
643
|
+
C = [u, ...C].toReversed();
|
644
|
+
const A = At(
|
645
|
+
u,
|
646
|
+
"remove",
|
647
|
+
y.direction,
|
648
|
+
m
|
649
|
+
);
|
650
|
+
for (const [N, x] of C.entries())
|
651
|
+
N >= l && (Y(x, A), setTimeout(() => {
|
652
|
+
v(x);
|
653
|
+
}, f));
|
654
|
+
}, S = (l) => {
|
655
|
+
bt(n, f, !0), setTimeout(() => {
|
656
|
+
H(l), W(l, n);
|
657
|
+
}, f);
|
658
|
+
}, T = (l, u, p, v) => {
|
659
|
+
const { config: m, droppable: y } = v, [C] = wt(l, y), A = pt(l, y);
|
660
|
+
C.length == 0 && B(
|
661
|
+
p,
|
662
|
+
1,
|
663
|
+
m.direction,
|
664
|
+
C
|
665
|
+
);
|
666
|
+
for (const [N, x] of C.entries()) {
|
667
|
+
if (!st(x, et))
|
668
|
+
continue;
|
669
|
+
const V = b(
|
670
|
+
m.direction,
|
671
|
+
l,
|
672
|
+
x,
|
673
|
+
p
|
674
|
+
);
|
675
|
+
if (!A && V)
|
676
|
+
p = V;
|
677
|
+
else if (!A)
|
678
|
+
continue;
|
679
|
+
const U = C.length - N;
|
680
|
+
B(
|
681
|
+
p,
|
682
|
+
U,
|
683
|
+
m.direction,
|
684
|
+
C
|
685
|
+
), u === fe ? Y(x, p) : u === Nt && F(x, p);
|
686
|
+
}
|
687
|
+
}, b = (l, u, p, v) => {
|
688
|
+
const { before: m, distance: y, axis: C, getRect: A } = M(l), N = A(u), x = A(p), V = N[m], U = x[m], mt = x[y], St = U + mt / 2, ft = Fe(p)[C], it = St - ft;
|
689
|
+
return V > it ? { height: 0, width: 0 } : v;
|
690
|
+
}, B = (l, u, p, v) => {
|
691
|
+
const m = v.filter(
|
692
|
+
(C) => st(C, et)
|
693
|
+
).length, { distance: y } = M(p);
|
694
|
+
l[y] == 0 ? a = Math.max(a, u) : a = Math.min(a, u - 1), a = Math.min(a, m);
|
695
|
+
}, Y = (l, u) => {
|
696
|
+
const { width: p, height: v } = u;
|
697
|
+
Ct(l, v, p);
|
698
|
+
}, F = (l, u) => {
|
699
|
+
const { width: p, height: v } = u;
|
700
|
+
Ct(l, v, p), Pt(l, f, de);
|
701
|
+
}, P = (l, u, p, v, m, y) => {
|
702
|
+
const { droppable: C, scroll: A, config: N } = m, [x, V] = wt(
|
703
|
+
l,
|
704
|
+
C
|
705
|
+
), U = x.toReversed(), mt = V === -1 ? U.length : V;
|
706
|
+
U.splice(mt, 0, l);
|
707
|
+
const [St, ft, it] = k(
|
708
|
+
l,
|
709
|
+
V,
|
710
|
+
U,
|
711
|
+
C
|
712
|
+
);
|
713
|
+
p = At(
|
714
|
+
l,
|
715
|
+
u,
|
716
|
+
N.direction,
|
717
|
+
n,
|
718
|
+
St,
|
719
|
+
ft
|
720
|
+
);
|
721
|
+
const $t = Oe(), vt = gn(
|
722
|
+
N.direction,
|
723
|
+
U,
|
724
|
+
V,
|
725
|
+
it,
|
726
|
+
$t,
|
727
|
+
A,
|
728
|
+
v,
|
729
|
+
C,
|
730
|
+
l
|
731
|
+
);
|
732
|
+
x.length == 0 && J(
|
733
|
+
void 0,
|
734
|
+
p,
|
735
|
+
l,
|
736
|
+
vt
|
737
|
+
);
|
738
|
+
for (const [Gt, Dt] of x.toReversed().entries()) {
|
739
|
+
let Mt = p;
|
740
|
+
it - 1 >= Gt && (Mt = { height: 0, width: 0 }), u === jt && !st(Dt, at) && J(
|
741
|
+
Dt,
|
742
|
+
Mt,
|
743
|
+
l,
|
744
|
+
vt
|
745
|
+
);
|
746
|
+
}
|
747
|
+
z(
|
748
|
+
it,
|
749
|
+
l,
|
750
|
+
N,
|
751
|
+
C,
|
752
|
+
y
|
753
|
+
);
|
754
|
+
}, k = (l, u, p, v) => {
|
755
|
+
const y = pt(l, v) ? u : a, C = () => u < y ? [y, y + 1] : u > y ? [y - 1, y] : [y - 1, y + 1], [A, N] = C(), x = p[A] ?? null, V = p[N] ?? null;
|
756
|
+
return [
|
757
|
+
x,
|
758
|
+
V,
|
759
|
+
y
|
760
|
+
];
|
761
|
+
}, J = (l, u, p, v) => {
|
762
|
+
Ct(l, u.height, u.width), Ct(
|
763
|
+
p,
|
764
|
+
v.height,
|
765
|
+
v.width
|
766
|
+
);
|
767
|
+
}, z = (l, u, p, v, m) => {
|
768
|
+
const { onInsertEvent: y, onDragEnd: C } = p;
|
769
|
+
ot(u, Vt), K(u, n, v, () => {
|
770
|
+
if (xt(u, Vt), m != null) {
|
771
|
+
const A = h(m, !0);
|
772
|
+
A != null && (y(l, A, !0), C({ value: A, index: l })), $(u), X();
|
773
|
+
}
|
774
|
+
});
|
775
|
+
}, X = () => {
|
776
|
+
if (s) {
|
777
|
+
var l = document.querySelectorAll(
|
778
|
+
`${gt(s)} > .${et}`
|
779
|
+
);
|
780
|
+
for (const u of l)
|
781
|
+
G(u);
|
782
|
+
}
|
783
|
+
}, $ = (l) => {
|
784
|
+
setTimeout(() => {
|
785
|
+
xt(l, w);
|
786
|
+
}, Mn);
|
787
|
+
}, K = (l, u, p, v) => {
|
788
|
+
setTimeout(() => {
|
789
|
+
v && v(), _(u, p), Q(p), H(l), W(l, u), W(l, p);
|
790
|
+
}, f);
|
791
|
+
}, _ = (l, u) => {
|
792
|
+
l.isSameNode(u) ? bt(l, f) : (bt(l, f, !0), bt(u, f));
|
793
|
+
}, Q = (l) => {
|
794
|
+
if (n.isSameNode(l))
|
795
|
+
return;
|
796
|
+
var [u] = n.querySelectorAll(`.${at}`);
|
797
|
+
if (!u)
|
798
|
+
return;
|
799
|
+
const { distance: p } = M(c);
|
800
|
+
rt(u) && (u.style[p] = "0px");
|
801
|
+
}, W = (l, u) => {
|
802
|
+
const [p] = wt(l, u);
|
803
|
+
for (const v of [...p, l])
|
804
|
+
G(v);
|
805
|
+
}, G = (l) => {
|
806
|
+
rt(l) && (l.style.transition = "", l.style.transform = "");
|
807
|
+
}, H = (l) => {
|
808
|
+
r(), ut(l, !1), l.style.transform = "", l.style.transition = "", l.style.top = "", l.style.left = "", ue(l, {
|
809
|
+
fixedHeight: "",
|
810
|
+
fixedWidth: ""
|
811
|
+
});
|
812
|
+
}, j = (l, u) => {
|
813
|
+
const p = u.querySelector(d);
|
814
|
+
Et(document.body, oe, l), Et(p || u, Wt, l);
|
815
|
+
}, ut = (l, u) => {
|
816
|
+
Et(l, Ft, u), j(u, l), o.toggleGrabClass(!u);
|
817
|
+
};
|
818
|
+
return [
|
819
|
+
R,
|
820
|
+
I,
|
821
|
+
O,
|
822
|
+
S,
|
823
|
+
ut
|
824
|
+
];
|
825
|
+
}
|
826
|
+
const Rn = (e) => e.addedNodes.values().filter((n) => !qt(n)).toArray().length > 0, me = (e, t, n) => {
|
827
|
+
const { insertingFromClass: s, animationDuration: o } = n, r = kt(() => {
|
828
|
+
const c = ie(t)[e];
|
829
|
+
ot(c, s), ot(c, Kt), setTimeout(() => {
|
830
|
+
xt(c, Kt), xt(c, s), r.disconnect();
|
831
|
+
}, o);
|
832
|
+
}, t, {
|
833
|
+
childList: !0
|
834
|
+
}, Rn);
|
835
|
+
}, Gn = (e, t, n, s) => {
|
836
|
+
if (!t)
|
837
|
+
return;
|
838
|
+
const { onInsertEvent: o, delayBeforeInsert: r } = e;
|
839
|
+
setTimeout(() => {
|
840
|
+
o(n, s), me(n, t, e);
|
841
|
+
}, r);
|
842
|
+
}, tt = class tt {
|
843
|
+
static addConfig(t, n) {
|
844
|
+
const s = tt.configs.filter(
|
845
|
+
(r) => !r.droppable.isSameNode(t)
|
846
|
+
), o = Ut(t);
|
847
|
+
s.push({
|
848
|
+
droppable: t,
|
849
|
+
config: n,
|
850
|
+
scroll: o
|
851
|
+
}), tt.configs = s;
|
852
|
+
}
|
853
|
+
static updateScrolls(t, n) {
|
854
|
+
for (const s of tt.configs) {
|
855
|
+
const { droppable: o } = s;
|
856
|
+
(n && Re(o, n) || o.isSameNode(t)) && (s.scroll = Ut(o));
|
857
|
+
}
|
858
|
+
}
|
859
|
+
static getConfig(t) {
|
860
|
+
return tt.configs.find(
|
861
|
+
({ droppable: s }) => s.isSameNode(t)
|
862
|
+
);
|
863
|
+
}
|
864
|
+
};
|
865
|
+
Z(tt, "configs", []), Z(tt, "removeObsoleteConfigs", () => {
|
866
|
+
const t = tt.configs.filter(
|
867
|
+
({ droppable: n }) => document.contains(n)
|
868
|
+
);
|
869
|
+
tt.configs = t;
|
870
|
+
});
|
871
|
+
let lt = tt;
|
872
|
+
class Ln {
|
873
|
+
constructor(t, n, s, o, r, a) {
|
874
|
+
Z(this, "initial");
|
875
|
+
Z(this, "current");
|
876
|
+
Z(this, "parent");
|
877
|
+
Z(this, "draggableElement");
|
878
|
+
Z(this, "groupClass");
|
879
|
+
Z(this, "dragEvent");
|
880
|
+
Z(this, "changeDroppable");
|
881
|
+
Z(this, "mapFrom");
|
882
|
+
this.parent = s, this.draggableElement = t, this.groupClass = n, this.dragEvent = o, this.mapFrom = a, this.initial = s ? lt.getConfig(s) : void 0, this.changeDroppable = r;
|
883
|
+
}
|
884
|
+
getDraggableAncestor(t, n, s) {
|
885
|
+
return document.elementsFromPoint(t, n).filter((o) => !o.isSameNode(s));
|
886
|
+
}
|
887
|
+
getElementBelow(t, n, s = !0) {
|
888
|
+
const o = (a) => {
|
889
|
+
const [c] = a.getDraggableAncestor(
|
890
|
+
n.clientX,
|
891
|
+
n.clientY,
|
892
|
+
t
|
893
|
+
);
|
894
|
+
return c;
|
895
|
+
};
|
896
|
+
let r = null;
|
897
|
+
return s ? (t.hidden = !0, r = o(this), t.hidden = !1) : r = o(this), r;
|
898
|
+
}
|
899
|
+
getCurrent(t, n, s = !0) {
|
900
|
+
const o = this.getElementBelow(t, n, s);
|
901
|
+
return !this.groupClass || !o ? void 0 : o.closest(
|
902
|
+
gt(this.groupClass)
|
903
|
+
);
|
904
|
+
}
|
905
|
+
isOutsideOfAllDroppables(t) {
|
906
|
+
return (this.groupClass ? Array.from(
|
907
|
+
document.querySelectorAll(gt(this.groupClass))
|
908
|
+
) : [this.parent]).every(
|
909
|
+
(s) => pt(t, s)
|
910
|
+
);
|
911
|
+
}
|
912
|
+
isNotInsideAnotherDroppable(t, n) {
|
913
|
+
return !pt(t, n) || this.isOutsideOfAllDroppables(t);
|
914
|
+
}
|
915
|
+
onScrollEvent() {
|
916
|
+
this.dragEvent();
|
917
|
+
}
|
918
|
+
setOnScroll(t) {
|
919
|
+
le(t, "onscroll", () => {
|
920
|
+
this.onScrollEvent();
|
921
|
+
});
|
922
|
+
}
|
923
|
+
getConfigFrom(t) {
|
924
|
+
const n = lt.getConfig(t);
|
925
|
+
if (n)
|
926
|
+
return t.isSameNode(this.parent) ? n : {
|
927
|
+
...n,
|
928
|
+
config: we(n, this.mapFrom)
|
929
|
+
};
|
930
|
+
}
|
931
|
+
getCurrentConfig(t) {
|
932
|
+
var o;
|
933
|
+
const n = this.draggableElement;
|
934
|
+
if (this.current && this.isNotInsideAnotherDroppable(
|
935
|
+
n,
|
936
|
+
(o = this.current) == null ? void 0 : o.droppable
|
937
|
+
))
|
938
|
+
return this.current;
|
939
|
+
const s = this.getCurrent(n, t);
|
940
|
+
return s ? (rt(s) && !s.onscroll && this.setOnScroll(s), this.getConfigFrom(s)) : this.getConfigFrom(this.parent);
|
941
|
+
}
|
942
|
+
updateConfig(t) {
|
943
|
+
const n = this.current;
|
944
|
+
this.current = this.getCurrentConfig(t), this.changeDroppable(this.current, n);
|
945
|
+
}
|
946
|
+
isOutside(t, n = !0) {
|
947
|
+
const s = this.draggableElement;
|
948
|
+
return !this.getCurrent(s, t, n);
|
949
|
+
}
|
950
|
+
}
|
951
|
+
function On(e, t, n, s, o) {
|
952
|
+
const {
|
953
|
+
handlerSelector: r,
|
954
|
+
isDraggable: a,
|
955
|
+
droppableGroup: c,
|
956
|
+
animationDuration: d,
|
957
|
+
delayBeforeRemove: h,
|
958
|
+
draggingClass: f,
|
959
|
+
removingClass: E,
|
960
|
+
onRemoveAtEvent: w,
|
961
|
+
droppableClass: R,
|
962
|
+
onDragStart: O,
|
963
|
+
delayBeforeTouchMoveEvent: I,
|
964
|
+
coordinateTransform: S
|
965
|
+
} = n, T = Bt(c).map((i) => `droppable-group-${i}`).join(" ");
|
966
|
+
let b = 0, B = {
|
967
|
+
scrollX: 0,
|
968
|
+
scrollY: 0
|
969
|
+
}, Y = { pageX: 0, pageY: 0 }, F, P;
|
970
|
+
const [k, J] = Ue(e, S), z = () => {
|
971
|
+
b = 0;
|
972
|
+
}, [
|
973
|
+
X,
|
974
|
+
$,
|
975
|
+
K,
|
976
|
+
_,
|
977
|
+
Q
|
978
|
+
] = wn(
|
979
|
+
n,
|
980
|
+
t,
|
981
|
+
s,
|
982
|
+
T,
|
983
|
+
o,
|
984
|
+
z
|
985
|
+
), W = () => {
|
986
|
+
ot(e, et);
|
987
|
+
}, G = (i) => {
|
988
|
+
ot(i, Lt), o.addSubscriber(i);
|
989
|
+
}, H = () => {
|
990
|
+
if (a(e)) {
|
991
|
+
const i = e.querySelector(r);
|
992
|
+
G(i || e);
|
993
|
+
}
|
994
|
+
}, j = () => {
|
995
|
+
H(), W();
|
996
|
+
}, ut = (i) => {
|
997
|
+
const g = i == null ? void 0 : i.querySelector(`.${Lt}`), D = g == null ? void 0 : g.parentElement;
|
998
|
+
return g && D && st(D, Xt) && !D.isSameNode(s) ? null : g;
|
999
|
+
}, l = (i) => {
|
1000
|
+
const g = ut(i) ?? i;
|
1001
|
+
g && a(i) && (It(g, "onmousedown", ft("mousemove", "mouseup")), It(
|
1002
|
+
g,
|
1003
|
+
"ontouchstart",
|
1004
|
+
ft("touchmove", "touchend"),
|
1005
|
+
(D) => {
|
1006
|
+
P = {
|
1007
|
+
x: D.touches[0].clientX,
|
1008
|
+
y: D.touches[0].clientY
|
1009
|
+
};
|
1010
|
+
}
|
1011
|
+
), u(g)), i != null && i.isSameNode(g) || It(i, "onmousedown", it), ot(s, Xt);
|
1012
|
+
}, u = (i) => {
|
1013
|
+
const g = i.querySelectorAll("img");
|
1014
|
+
Array.from(g).forEach((D) => {
|
1015
|
+
D.onmousedown = () => !1;
|
1016
|
+
});
|
1017
|
+
}, p = () => {
|
1018
|
+
if (Y.pageX == 0 && Y.pageY == 0 || !m.current)
|
1019
|
+
return;
|
1020
|
+
const { droppable: i, config: g } = m.current;
|
1021
|
+
k(e, i, Y, g.direction), X(e, Nt, B, m.current);
|
1022
|
+
}, v = (i, g) => {
|
1023
|
+
g && b == 2 && !(i != null && i.droppable.isSameNode(g.droppable)) && X(e, Nt, B, g);
|
1024
|
+
}, m = new Ln(
|
1025
|
+
e,
|
1026
|
+
T,
|
1027
|
+
s,
|
1028
|
+
p,
|
1029
|
+
v,
|
1030
|
+
n.mapFrom
|
1031
|
+
), y = (i) => {
|
1032
|
+
if (!m.current)
|
1033
|
+
return;
|
1034
|
+
const g = T ? Array.from(document.querySelectorAll(gt(T))) : [s];
|
1035
|
+
for (const D of g)
|
1036
|
+
D.classList.toggle(
|
1037
|
+
R,
|
1038
|
+
!i && D.isSameNode(m.current.droppable)
|
1039
|
+
);
|
1040
|
+
}, C = (i, g = !1) => {
|
1041
|
+
m.updateConfig(i);
|
1042
|
+
const D = m.isOutside(i);
|
1043
|
+
y(D), b === 1 && !g ? Dt(i) : b === 2 && (A(D), Se(i));
|
1044
|
+
}, A = (i = !0) => {
|
1045
|
+
if (!m.current)
|
1046
|
+
return;
|
1047
|
+
const { droppable: g } = m.current;
|
1048
|
+
Bn(g, s, T, d, i), !i && Yt(
|
1049
|
+
e,
|
1050
|
+
s,
|
1051
|
+
b == 1,
|
1052
|
+
m.current
|
1053
|
+
);
|
1054
|
+
}, N = (i) => {
|
1055
|
+
if (yt(i) && P && b == 1) {
|
1056
|
+
const g = Math.abs(i.touches[0].clientX - P.x), D = Math.abs(i.touches[0].clientY - P.y);
|
1057
|
+
if (Math.abs(g) > 5 && Math.abs(D) > 5)
|
1058
|
+
return clearTimeout(F), !1;
|
1059
|
+
}
|
1060
|
+
return !0;
|
1061
|
+
}, x = (i) => {
|
1062
|
+
clearTimeout(F);
|
1063
|
+
const g = _t(i);
|
1064
|
+
if (yt(i) && i.cancelable && b == 2 && i.preventDefault(), yt(i) && !i.cancelable || !N(i)) {
|
1065
|
+
vt("touchmove", i);
|
1066
|
+
return;
|
1067
|
+
}
|
1068
|
+
C(g, yt(i));
|
1069
|
+
}, V = (i, g) => {
|
1070
|
+
i == "touchmove" ? F = setTimeout(() => {
|
1071
|
+
g();
|
1072
|
+
}, I) : g();
|
1073
|
+
}, U = (i, g) => {
|
1074
|
+
const { clientX: D, clientY: dt } = i, ct = document.elementFromPoint(D, dt), Tt = ct == null ? void 0 : ct.closest(`.${et}`);
|
1075
|
+
return Tt && g.isSameNode(Tt);
|
1076
|
+
}, mt = (i) => {
|
1077
|
+
const g = n.onGetValue(t);
|
1078
|
+
return { index: t, element: i, value: g };
|
1079
|
+
}, St = (i) => {
|
1080
|
+
m.updateConfig(i), y(m.isOutside(i)), Dt(i);
|
1081
|
+
}, ft = (i, g) => (D) => {
|
1082
|
+
if (!U(D, e))
|
1083
|
+
return;
|
1084
|
+
lt.updateScrolls(s, T);
|
1085
|
+
const { scrollX: dt, scrollY: ct } = window;
|
1086
|
+
if (B = { scrollX: dt, scrollY: ct }, b === 0) {
|
1087
|
+
b = 1;
|
1088
|
+
const Tt = mt(e);
|
1089
|
+
Tt && O(Tt), V(i, () => {
|
1090
|
+
i == "touchmove" && St(D);
|
1091
|
+
}), document.addEventListener(i, x, {
|
1092
|
+
passive: !1
|
1093
|
+
}), ve(s), document.addEventListener(g, $t(i), {
|
1094
|
+
once: !0
|
1095
|
+
});
|
1096
|
+
}
|
1097
|
+
}, it = (i) => m.updateConfig(i), $t = (i) => (g) => {
|
1098
|
+
vt(i, g);
|
1099
|
+
}, vt = (i, g) => {
|
1100
|
+
y(!0);
|
1101
|
+
const D = _t(g);
|
1102
|
+
Te(m.isOutside(D, !1)), clearTimeout(F), document.removeEventListener(i, x), m.updateConfig(D);
|
1103
|
+
const dt = m.getCurrentConfig(D);
|
1104
|
+
if (dt) {
|
1105
|
+
const { droppable: ct } = dt;
|
1106
|
+
Gt(ct);
|
1107
|
+
}
|
1108
|
+
s.onscroll = null, z();
|
1109
|
+
}, Gt = (i) => {
|
1110
|
+
if (i.onscroll = null, !T)
|
1111
|
+
return;
|
1112
|
+
const g = Array.from(
|
1113
|
+
document.querySelectorAll(gt(T))
|
1114
|
+
);
|
1115
|
+
for (const D of g)
|
1116
|
+
rt(D) && (D.onscroll = null);
|
1117
|
+
}, Dt = (i) => {
|
1118
|
+
Yt(
|
1119
|
+
e,
|
1120
|
+
s,
|
1121
|
+
b == 1,
|
1122
|
+
m.current
|
1123
|
+
), Mt(), X(
|
1124
|
+
e,
|
1125
|
+
fe,
|
1126
|
+
B,
|
1127
|
+
m.current
|
1128
|
+
), be(e), J(i, e);
|
1129
|
+
}, Mt = () => {
|
1130
|
+
b = 2;
|
1131
|
+
}, Se = (i) => {
|
1132
|
+
const { pageX: g, pageY: D } = i;
|
1133
|
+
Y = { pageX: g, pageY: D }, p();
|
1134
|
+
}, ve = (i) => le(i, "onscroll", De), De = () => p(), Te = (i) => {
|
1135
|
+
if (b !== 2 && b !== 1) {
|
1136
|
+
z();
|
1137
|
+
return;
|
1138
|
+
}
|
1139
|
+
b = 3, Jt(e), e.classList.contains(Ft) && X(
|
1140
|
+
e,
|
1141
|
+
jt,
|
1142
|
+
B,
|
1143
|
+
i ? m.initial : m.current,
|
1144
|
+
t
|
1145
|
+
);
|
1146
|
+
}, Jt = (i) => {
|
1147
|
+
Pt(i, d, de), Ct(i, 0, 0);
|
1148
|
+
}, be = (i) => {
|
1149
|
+
const { height: g, width: D } = i.getBoundingClientRect();
|
1150
|
+
ue(i, {
|
1151
|
+
fixedHeight: `${g}px`,
|
1152
|
+
fixedWidth: `${D}px`
|
1153
|
+
}), Q(i, !0), Et(i, f, !0), i.style.transition = "";
|
1154
|
+
}, Ee = (i, g) => {
|
1155
|
+
xt(e, E), Yt(
|
1156
|
+
e,
|
1157
|
+
s,
|
1158
|
+
b == 1,
|
1159
|
+
m.initial
|
1160
|
+
), $(i, e, g, (D) => {
|
1161
|
+
Jt(D), _(e);
|
1162
|
+
}), w(t, !0);
|
1163
|
+
}, ye = (i) => {
|
1164
|
+
if (!m.initial)
|
1165
|
+
return;
|
1166
|
+
const g = m.initial;
|
1167
|
+
i == t && (ot(e, E), setTimeout(() => {
|
1168
|
+
Ee(i, g);
|
1169
|
+
}, h));
|
1170
|
+
}, Ce = (i, g) => {
|
1171
|
+
(i === t || i === n.onGetLegth() && t === i - 1) && K(i, e, s, g, () => {
|
1172
|
+
An(
|
1173
|
+
e,
|
1174
|
+
b == 1,
|
1175
|
+
m.initial
|
1176
|
+
);
|
1177
|
+
});
|
1178
|
+
};
|
1179
|
+
return j(), l(e), [ye, Ce];
|
1180
|
+
}
|
1181
|
+
const Nn = (e, t) => {
|
1182
|
+
e && Le(t, e);
|
1183
|
+
}, Fn = () => {
|
1184
|
+
Ze(document.body, [
|
1185
|
+
`.${et}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,
|
1186
|
+
`.${Lt}{pointer-events:auto!important;}`,
|
1187
|
+
`.${Be}{cursor:grab;}`,
|
1188
|
+
".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",
|
1189
|
+
".droppable{box-sizing:border-box!important;}",
|
1190
|
+
`.${Ft}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,
|
1191
|
+
`.${Wt}{pointer-events:none!important;}`,
|
1192
|
+
`.${Vt}{pointer-events:none!important;}`,
|
1193
|
+
`.${oe}{cursor:grabbing;}`,
|
1194
|
+
".disable-transition{transition:none!important;}"
|
1195
|
+
]);
|
1196
|
+
};
|
1197
|
+
function Pn(e, t, n, s = "index") {
|
1198
|
+
const o = s;
|
1199
|
+
let r = [], a = [];
|
1200
|
+
const { droppableGroup: c } = e;
|
1201
|
+
if (!n)
|
1202
|
+
return [
|
1203
|
+
r,
|
1204
|
+
a
|
1205
|
+
];
|
1206
|
+
const d = Bt(c).map((h) => `droppable-group-${h}`).join(" ");
|
1207
|
+
Fn(), Nn(d, n);
|
1208
|
+
for (const h of n.children) {
|
1209
|
+
const f = h.getAttribute(o), E = Ne(f), w = h;
|
1210
|
+
if (w && E >= 0) {
|
1211
|
+
const [R, O] = On(
|
1212
|
+
w,
|
1213
|
+
E,
|
1214
|
+
e,
|
1215
|
+
n,
|
1216
|
+
t
|
1217
|
+
);
|
1218
|
+
r.push(R), a.push(O);
|
1219
|
+
}
|
1220
|
+
}
|
1221
|
+
return [
|
1222
|
+
r,
|
1223
|
+
a
|
1224
|
+
];
|
1225
|
+
}
|
1226
|
+
function In(e, t, n, s = "index") {
|
1227
|
+
let o = [], r = [], a;
|
1228
|
+
const c = Me(e, n), d = (S) => {
|
1229
|
+
for (const T of o)
|
1230
|
+
T(S);
|
1231
|
+
}, h = (S, T) => {
|
1232
|
+
if (c.onGetLegth() === 0)
|
1233
|
+
e.insertToListEmpty(c, S, T);
|
1234
|
+
else
|
1235
|
+
for (const B of r)
|
1236
|
+
B(S, T);
|
1237
|
+
}, f = (S) => {
|
1238
|
+
const [T, b] = Pn(c, t, S, s);
|
1239
|
+
o = T, r = b;
|
1240
|
+
}, E = (S) => {
|
1241
|
+
const T = S.addedNodes.values().filter((B) => !qt(B)).toArray(), b = S.removedNodes.values().filter((B) => !qt(B)).toArray();
|
1242
|
+
return T.length > 0 || b.length > 0;
|
1243
|
+
}, w = (S) => {
|
1244
|
+
a = kt(
|
1245
|
+
() => {
|
1246
|
+
f(S);
|
1247
|
+
},
|
1248
|
+
S,
|
1249
|
+
{ childList: !0 },
|
1250
|
+
E
|
1251
|
+
);
|
1252
|
+
}, R = (S) => {
|
1253
|
+
ot(S, Xt);
|
1254
|
+
}, O = (S) => {
|
1255
|
+
lt.addConfig(
|
1256
|
+
S,
|
1257
|
+
c
|
1258
|
+
);
|
1259
|
+
};
|
1260
|
+
return [d, h, (S) => {
|
1261
|
+
if (S)
|
1262
|
+
return R(S), O(S), w(S), f(S), lt.removeObsoleteConfigs(), a;
|
1263
|
+
}];
|
1264
|
+
}
|
1265
|
+
export {
|
1266
|
+
Be as G,
|
1267
|
+
ot as a,
|
1268
|
+
In as d,
|
1269
|
+
Gn as i,
|
1270
|
+
Et as t
|
1271
|
+
};
|