@pantograph/sortable 2.1.1 → 2.2.1
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/README.md +3 -66
- package/dist/index.cjs +5 -0
- package/{index.d.ts → dist/index.d.ts} +7 -6
- package/dist/index.js +1596 -0
- package/package.json +36 -56
- package/Sortable.js +0 -3364
- package/modular/sortable.complete.esm.js +0 -3356
- package/modular/sortable.core.esm.js +0 -3159
- package/modular/sortable.esm.js +0 -3355
- /package/{plugins.d.ts → dist/plugins.d.ts} +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1596 @@
|
|
|
1
|
+
var Gt = Object.defineProperty;
|
|
2
|
+
var zt = (i, e, t) => e in i ? Gt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var q = (i, e, t) => zt(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const Et = "2.2.0";
|
|
5
|
+
function oe(i) {
|
|
6
|
+
if (typeof window < "u" && window.navigator)
|
|
7
|
+
return !!/* @__PURE__ */ navigator.userAgent.match(i);
|
|
8
|
+
}
|
|
9
|
+
const re = oe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ae = oe(/Edge/i), mt = oe(/firefox/i), Ce = oe(/safari/i) && !oe(/chrome/i) && !oe(/android/i), ut = oe(/iP(ad|od|hone)/i), xt = oe(/chrome/i) && oe(/android/i), Mt = {
|
|
10
|
+
capture: !1,
|
|
11
|
+
passive: !1
|
|
12
|
+
};
|
|
13
|
+
function w(i, e, t) {
|
|
14
|
+
i.addEventListener(e, t, !re && Mt);
|
|
15
|
+
}
|
|
16
|
+
function v(i, e, t) {
|
|
17
|
+
i.removeEventListener(e, t, !re && Mt);
|
|
18
|
+
}
|
|
19
|
+
function $e(i, e) {
|
|
20
|
+
if (e) {
|
|
21
|
+
if (e[0] === ">" && (e = e.substring(1)), i)
|
|
22
|
+
try {
|
|
23
|
+
if (i.matches)
|
|
24
|
+
return i.matches(e);
|
|
25
|
+
if (i.msMatchesSelector)
|
|
26
|
+
return i.msMatchesSelector(e);
|
|
27
|
+
if (i.webkitMatchesSelector)
|
|
28
|
+
return i.webkitMatchesSelector(e);
|
|
29
|
+
} catch {
|
|
30
|
+
return !1;
|
|
31
|
+
}
|
|
32
|
+
return !1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function It(i) {
|
|
36
|
+
return i.host && i !== document && i.host.nodeType && i.host !== i ? i.host : i.parentNode;
|
|
37
|
+
}
|
|
38
|
+
function R(i, e, t, n, o) {
|
|
39
|
+
if (i) {
|
|
40
|
+
t = t || document;
|
|
41
|
+
do {
|
|
42
|
+
if (!(o != null && o.some((r) => r === i)) && (e != null && (e[0] === ">" ? i.parentNode === t && $e(i, e) : $e(i, e)) || n && i === t))
|
|
43
|
+
return i;
|
|
44
|
+
if (i === t) break;
|
|
45
|
+
} while (i = It(i));
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const bt = /\s+/g;
|
|
50
|
+
function I(i, e, t) {
|
|
51
|
+
if (i && e)
|
|
52
|
+
if (i.classList)
|
|
53
|
+
i.classList[t ? "add" : "remove"](e);
|
|
54
|
+
else {
|
|
55
|
+
let n = (" " + i.className + " ").replace(bt, " ").replace(" " + e + " ", " ");
|
|
56
|
+
i.className = (n + (t ? " " + e : "")).replace(bt, " ");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function p(i, e, t) {
|
|
60
|
+
let n = i && i.style;
|
|
61
|
+
if (n) {
|
|
62
|
+
if (t === void 0)
|
|
63
|
+
return document.defaultView && document.defaultView.getComputedStyle ? t = document.defaultView.getComputedStyle(i, "") : i.currentStyle && (t = i.currentStyle), e === void 0 ? t : t[e];
|
|
64
|
+
!(e in n) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), n[e] = t + (typeof t == "string" ? "" : "px");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function Se(i, e) {
|
|
68
|
+
let t = "";
|
|
69
|
+
if (typeof i == "string")
|
|
70
|
+
t = i;
|
|
71
|
+
else
|
|
72
|
+
do {
|
|
73
|
+
let o = p(i, "transform");
|
|
74
|
+
o && o !== "none" && (t = o + " " + t);
|
|
75
|
+
} while (!e && (i = i.parentNode));
|
|
76
|
+
const n = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
|
77
|
+
return n && new n(t);
|
|
78
|
+
}
|
|
79
|
+
function lt(i, e, t) {
|
|
80
|
+
if (i) {
|
|
81
|
+
let n = i.getElementsByTagName(e), o = 0, r = n.length;
|
|
82
|
+
if (t)
|
|
83
|
+
for (; o < r; o++)
|
|
84
|
+
t(n[o], o);
|
|
85
|
+
return n;
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
function J() {
|
|
90
|
+
let i = document.scrollingElement;
|
|
91
|
+
return i || document.documentElement;
|
|
92
|
+
}
|
|
93
|
+
function P(i, e, t, n, o) {
|
|
94
|
+
if (!i.getBoundingClientRect && i !== window) return;
|
|
95
|
+
let r, l, a, s, f, d, h;
|
|
96
|
+
if (i !== window && i.parentNode && i !== J() ? (r = i.getBoundingClientRect(), l = r.top, a = r.left, s = r.bottom, f = r.right, d = r.height, h = r.width) : (l = 0, a = 0, s = window.innerHeight, f = window.innerWidth, d = window.innerHeight, h = window.innerWidth), (e || t) && i !== window && (o = o || i.parentNode, !re))
|
|
97
|
+
do
|
|
98
|
+
if (o && o.getBoundingClientRect && (p(o, "transform") !== "none" || t && p(o, "position") !== "static")) {
|
|
99
|
+
let m = o.getBoundingClientRect();
|
|
100
|
+
l -= m.top + parseInt(p(o, "border-top-width")), a -= m.left + parseInt(p(o, "border-left-width")), s = l + r.height, f = a + r.width;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
while (o = o.parentNode);
|
|
104
|
+
if (n && i !== window) {
|
|
105
|
+
let m = Se(o || i), y = m && m.a, u = m && m.d;
|
|
106
|
+
m && (l /= u, a /= y, h /= y, d /= u, s = l + d, f = a + h);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
top: l,
|
|
110
|
+
left: a,
|
|
111
|
+
bottom: s,
|
|
112
|
+
right: f,
|
|
113
|
+
width: h,
|
|
114
|
+
height: d
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function vt(i, e, t) {
|
|
118
|
+
let n = fe(i, !0), o = P(i)[e];
|
|
119
|
+
for (; n; ) {
|
|
120
|
+
let r = P(n)[t], l;
|
|
121
|
+
if (l = o >= r, !l) return n;
|
|
122
|
+
if (n === J()) break;
|
|
123
|
+
n = fe(n, !1);
|
|
124
|
+
}
|
|
125
|
+
return !1;
|
|
126
|
+
}
|
|
127
|
+
function be(i, e, t, n, o) {
|
|
128
|
+
let r = 0, l = 0, a = i.children;
|
|
129
|
+
for (; l < a.length; ) {
|
|
130
|
+
if (!(o != null && o.some((s) => s === a[l])) && a[l].style.display !== "none" && a[l] !== x.ghost && (n || a[l] !== x.dragged) && R(a[l], t.draggable, i, !1, o)) {
|
|
131
|
+
if (r === e)
|
|
132
|
+
return a[l];
|
|
133
|
+
r++;
|
|
134
|
+
}
|
|
135
|
+
l++;
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
function pt(i, e) {
|
|
140
|
+
let t = i.lastElementChild;
|
|
141
|
+
for (; t && (t === x.ghost || p(t, "display") === "none" || e && !$e(t, e)); )
|
|
142
|
+
t = t.previousElementSibling;
|
|
143
|
+
return t || null;
|
|
144
|
+
}
|
|
145
|
+
function k(i, e, t) {
|
|
146
|
+
let n = 0;
|
|
147
|
+
if (!i || !i.parentNode)
|
|
148
|
+
return -1;
|
|
149
|
+
for (; i = i.previousElementSibling; )
|
|
150
|
+
i.nodeName.toUpperCase() !== "TEMPLATE" && i !== x.clone && (!e || $e(i, e)) && !(t != null && t.some((o) => o === i)) && n++;
|
|
151
|
+
return n;
|
|
152
|
+
}
|
|
153
|
+
function wt(i) {
|
|
154
|
+
let e = 0, t = 0, n = J();
|
|
155
|
+
if (i)
|
|
156
|
+
do {
|
|
157
|
+
let o = Se(i), r = o.a, l = o.d;
|
|
158
|
+
e += i.scrollLeft * r, t += i.scrollTop * l;
|
|
159
|
+
} while (i !== n && (i = i.parentNode));
|
|
160
|
+
return [e, t];
|
|
161
|
+
}
|
|
162
|
+
function $t(i, e) {
|
|
163
|
+
for (let t in i)
|
|
164
|
+
if (i.hasOwnProperty(t)) {
|
|
165
|
+
for (let n in e)
|
|
166
|
+
if (e.hasOwnProperty(n) && e[n] === i[t][n]) return Number(t);
|
|
167
|
+
}
|
|
168
|
+
return -1;
|
|
169
|
+
}
|
|
170
|
+
function fe(i, e) {
|
|
171
|
+
if (!i || !i.getBoundingClientRect) return J();
|
|
172
|
+
let t = i, n = !1;
|
|
173
|
+
do
|
|
174
|
+
if (t.clientWidth < t.scrollWidth || t.clientHeight < t.scrollHeight) {
|
|
175
|
+
let o = p(t);
|
|
176
|
+
if (t.clientWidth < t.scrollWidth && (o.overflowX == "auto" || o.overflowX == "scroll") || t.clientHeight < t.scrollHeight && (o.overflowY == "auto" || o.overflowY == "scroll")) {
|
|
177
|
+
if (!t.getBoundingClientRect || t === document.body) return J();
|
|
178
|
+
if (n || e) return t;
|
|
179
|
+
n = !0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
while (t = t.parentNode);
|
|
183
|
+
return J();
|
|
184
|
+
}
|
|
185
|
+
function Ot(i, e) {
|
|
186
|
+
if (i && e)
|
|
187
|
+
for (let t in e)
|
|
188
|
+
e.hasOwnProperty(t) && (i[t] = e[t]);
|
|
189
|
+
return i;
|
|
190
|
+
}
|
|
191
|
+
function Ze(i, e) {
|
|
192
|
+
return Math.round(i.top) === Math.round(e.top) && Math.round(i.left) === Math.round(e.left) && Math.round(i.height) === Math.round(e.height) && Math.round(i.width) === Math.round(e.width);
|
|
193
|
+
}
|
|
194
|
+
let Me;
|
|
195
|
+
function gt(i, e) {
|
|
196
|
+
return function() {
|
|
197
|
+
if (!Me) {
|
|
198
|
+
let t = arguments, n = this;
|
|
199
|
+
t.length === 1 ? i.call(n, t[0]) : i.apply(n, t), Me = setTimeout(function() {
|
|
200
|
+
Me = void 0;
|
|
201
|
+
}, e);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function jt() {
|
|
206
|
+
clearTimeout(Me), Me = void 0;
|
|
207
|
+
}
|
|
208
|
+
function At(i, e, t) {
|
|
209
|
+
i.scrollLeft += e, i.scrollTop += t;
|
|
210
|
+
}
|
|
211
|
+
function at(i) {
|
|
212
|
+
let e = window.Polymer, t = window.jQuery || window.Zepto;
|
|
213
|
+
return e && e.dom ? e.dom(i).cloneNode(!0) : t ? t(i).clone(!0)[0] : i.cloneNode(!0);
|
|
214
|
+
}
|
|
215
|
+
function Nt(i, e, t, n) {
|
|
216
|
+
const o = {};
|
|
217
|
+
return Array.from(i.children).forEach((r) => {
|
|
218
|
+
if (!R(r, e.draggable, i, !1, n) || r.animated || r === t) return;
|
|
219
|
+
const l = P(r);
|
|
220
|
+
o.left = Math.min(o.left ?? 1 / 0, l.left), o.top = Math.min(o.top ?? 1 / 0, l.top), o.right = Math.max(o.right ?? -1 / 0, l.right), o.bottom = Math.max(o.bottom ?? -1 / 0, l.bottom);
|
|
221
|
+
}), o.width = o.right - o.left, o.height = o.bottom - o.top, o.x = o.left, o.y = o.top, o;
|
|
222
|
+
}
|
|
223
|
+
const N = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
|
|
224
|
+
function Vt() {
|
|
225
|
+
let i = [], e;
|
|
226
|
+
return {
|
|
227
|
+
captureAnimationState() {
|
|
228
|
+
if (i = [], !this.options.animation) return;
|
|
229
|
+
[].slice.call(this.el.children).forEach((n) => {
|
|
230
|
+
if (p(n, "display") === "none" || n === x.ghost) return;
|
|
231
|
+
i.push({
|
|
232
|
+
target: n,
|
|
233
|
+
rect: P(n)
|
|
234
|
+
});
|
|
235
|
+
let o = { ...i[i.length - 1].rect };
|
|
236
|
+
if (n.thisAnimationDuration) {
|
|
237
|
+
let r = Se(n, !0);
|
|
238
|
+
r && (o.top -= r.f, o.left -= r.e);
|
|
239
|
+
}
|
|
240
|
+
n.fromRect = o;
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
addAnimationState(t) {
|
|
244
|
+
i.push(t);
|
|
245
|
+
},
|
|
246
|
+
removeAnimationState(t) {
|
|
247
|
+
i.splice($t(i, { target: t }), 1);
|
|
248
|
+
},
|
|
249
|
+
animateAll(t) {
|
|
250
|
+
if (!this.options.animation) {
|
|
251
|
+
clearTimeout(e), typeof t == "function" && t();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
let n = !1, o = 0;
|
|
255
|
+
i.forEach((r) => {
|
|
256
|
+
let l = 0, a = r.target, s = a.fromRect, f = P(a), d = a.prevFromRect, h = a.prevToRect, m = r.rect, y = Se(a, !0);
|
|
257
|
+
y && (f.top -= y.f, f.left -= y.e), a.toRect = f, a.thisAnimationDuration && Ze(d, f) && !Ze(s, f) && // Make sure animatingRect is on line between toRect & fromRect
|
|
258
|
+
(m.top - f.top) / (m.left - f.left) === (s.top - f.top) / (s.left - f.left) && (l = Ut(m, d, h, this.options)), Ze(f, s) || (a.prevFromRect = s, a.prevToRect = f, l || (l = this.options.animation), this.animate(
|
|
259
|
+
a,
|
|
260
|
+
m,
|
|
261
|
+
f,
|
|
262
|
+
l
|
|
263
|
+
)), l && (n = !0, o = Math.max(o, l), clearTimeout(a.animationResetTimer), a.animationResetTimer = setTimeout(function() {
|
|
264
|
+
a.animationTime = 0, a.prevFromRect = null, a.fromRect = null, a.prevToRect = null, a.thisAnimationDuration = null;
|
|
265
|
+
}, l), a.thisAnimationDuration = l);
|
|
266
|
+
}), clearTimeout(e), n ? e = setTimeout(function() {
|
|
267
|
+
typeof t == "function" && t();
|
|
268
|
+
}, o) : typeof t == "function" && t(), i = [];
|
|
269
|
+
},
|
|
270
|
+
animate(t, n, o, r) {
|
|
271
|
+
if (r) {
|
|
272
|
+
p(t, "transition", ""), p(t, "transform", "");
|
|
273
|
+
let l = Se(this.el), a = l && l.a, s = l && l.d, f = (n.left - o.left) / (a || 1), d = (n.top - o.top) / (s || 1);
|
|
274
|
+
t.animatingX = !!f, t.animatingY = !!d, p(t, "transform", "translate3d(" + f + "px," + d + "px,0)"), this.forRepaintDummy = qt(t), p(t, "transition", "transform " + r + "ms" + (this.options.easing ? " " + this.options.easing : "")), p(t, "transform", "translate3d(0,0,0)"), typeof t.animated == "number" && clearTimeout(t.animated), t.animated = setTimeout(function() {
|
|
275
|
+
p(t, "transition", ""), p(t, "transform", ""), t.animated = !1, t.animatingX = !1, t.animatingY = !1;
|
|
276
|
+
}, r);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function qt(i) {
|
|
282
|
+
return i.offsetWidth;
|
|
283
|
+
}
|
|
284
|
+
function Ut(i, e, t, n) {
|
|
285
|
+
return Math.sqrt(Math.pow(e.top - i.top, 2) + Math.pow(e.left - i.left, 2)) / Math.sqrt(Math.pow(e.top - t.top, 2) + Math.pow(e.left - t.left, 2)) * n.animation;
|
|
286
|
+
}
|
|
287
|
+
let ve = [];
|
|
288
|
+
const Ke = {
|
|
289
|
+
initializeByDefault: !0
|
|
290
|
+
}, me = {
|
|
291
|
+
mount(i) {
|
|
292
|
+
for (let e in Ke)
|
|
293
|
+
Ke.hasOwnProperty(e) && !(e in i) && (i[e] = Ke[e]);
|
|
294
|
+
ve.some((e) => e.pluginName === i.pluginName) || ve.push(i);
|
|
295
|
+
},
|
|
296
|
+
pluginEvent(i, e, t) {
|
|
297
|
+
this.eventCanceled = !1, t.cancel = () => {
|
|
298
|
+
this.eventCanceled = !0;
|
|
299
|
+
};
|
|
300
|
+
const n = i + "Global";
|
|
301
|
+
ve.forEach((o) => {
|
|
302
|
+
e[o.pluginName] && (e[o.pluginName][n] && e[o.pluginName][n]({ sortable: e, ...t }), e.options[o.pluginName] && e[o.pluginName][i] && e[o.pluginName][i]({ sortable: e, ...t }));
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
initializePlugins(i, e, t, n) {
|
|
306
|
+
ve.forEach((o) => {
|
|
307
|
+
const r = o.pluginName;
|
|
308
|
+
if (!i.options[r] && !o.initializeByDefault) return;
|
|
309
|
+
let l = new o(i, e, i.options);
|
|
310
|
+
l.sortable = i, l.options = i.options, i[r] = l, Object.assign(t, l.defaults);
|
|
311
|
+
});
|
|
312
|
+
for (let o in i.options) {
|
|
313
|
+
if (!i.options.hasOwnProperty(o)) continue;
|
|
314
|
+
let r = this.modifyOption(i, o, i.options[o]);
|
|
315
|
+
typeof r < "u" && (i.options[o] = r);
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
getEventProperties(i, e) {
|
|
319
|
+
let t = {};
|
|
320
|
+
return ve.forEach((n) => {
|
|
321
|
+
typeof n.eventProperties == "function" && Object.assign(t, n.eventProperties.call(e[n.pluginName], i));
|
|
322
|
+
}), t;
|
|
323
|
+
},
|
|
324
|
+
modifyOption(i, e, t) {
|
|
325
|
+
let n;
|
|
326
|
+
return ve.forEach((o) => {
|
|
327
|
+
i[o.pluginName] && o.optionListeners && typeof o.optionListeners[e] == "function" && (n = o.optionListeners[e].call(i[o.pluginName], t));
|
|
328
|
+
}), n;
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
function Xt({
|
|
332
|
+
sortable: i,
|
|
333
|
+
rootEl: e,
|
|
334
|
+
name: t,
|
|
335
|
+
targetEl: n,
|
|
336
|
+
cloneEl: o,
|
|
337
|
+
toEl: r,
|
|
338
|
+
fromEl: l,
|
|
339
|
+
oldIndex: a,
|
|
340
|
+
newIndex: s,
|
|
341
|
+
oldDraggableIndex: f,
|
|
342
|
+
newDraggableIndex: d,
|
|
343
|
+
originalEvent: h,
|
|
344
|
+
putSortable: m,
|
|
345
|
+
extraEventProperties: y
|
|
346
|
+
}) {
|
|
347
|
+
if (i = i || e && e[N], !i) return;
|
|
348
|
+
let u;
|
|
349
|
+
window.CustomEvent && !re && !Ae ? u = new CustomEvent(t, {
|
|
350
|
+
bubbles: !0,
|
|
351
|
+
cancelable: !0
|
|
352
|
+
}) : (u = document.createEvent("Event"), u.initEvent(t, !0, !0)), u.to = r || e, u.from = l || e, u.item = n || e, u.clone = o, u.oldIndex = a, u.newIndex = s, u.oldDraggableIndex = f, u.newDraggableIndex = d, u.originalEvent = h, u.pullMode = m ? m.lastPutMode : void 0;
|
|
353
|
+
let X = {
|
|
354
|
+
...y,
|
|
355
|
+
...me.getEventProperties(t, i)
|
|
356
|
+
};
|
|
357
|
+
for (let E in X)
|
|
358
|
+
u[E] = X[E];
|
|
359
|
+
return u;
|
|
360
|
+
}
|
|
361
|
+
function Zt({
|
|
362
|
+
sortable: i,
|
|
363
|
+
rootEl: e,
|
|
364
|
+
name: t,
|
|
365
|
+
targetEl: n,
|
|
366
|
+
cloneEl: o,
|
|
367
|
+
toEl: r,
|
|
368
|
+
fromEl: l,
|
|
369
|
+
oldIndex: a,
|
|
370
|
+
newIndex: s,
|
|
371
|
+
oldDraggableIndex: f,
|
|
372
|
+
newDraggableIndex: d,
|
|
373
|
+
originalEvent: h,
|
|
374
|
+
putSortable: m,
|
|
375
|
+
extraEventProperties: y
|
|
376
|
+
}) {
|
|
377
|
+
if (i = i || e && e[N], !i) return;
|
|
378
|
+
let u = i.options, X = "on" + t.charAt(0).toUpperCase() + t.substr(1);
|
|
379
|
+
const E = Xt({
|
|
380
|
+
sortable: i,
|
|
381
|
+
rootEl: e,
|
|
382
|
+
name: t,
|
|
383
|
+
targetEl: n,
|
|
384
|
+
cloneEl: o,
|
|
385
|
+
toEl: r,
|
|
386
|
+
fromEl: l,
|
|
387
|
+
oldIndex: a,
|
|
388
|
+
newIndex: s,
|
|
389
|
+
oldDraggableIndex: f,
|
|
390
|
+
newDraggableIndex: d,
|
|
391
|
+
originalEvent: h,
|
|
392
|
+
putSortable: m,
|
|
393
|
+
extraEventProperties: y
|
|
394
|
+
});
|
|
395
|
+
e && e.dispatchEvent(E), u[X] && u[X].call(i, E);
|
|
396
|
+
}
|
|
397
|
+
/**!
|
|
398
|
+
* Sortable
|
|
399
|
+
* @author Sedmedgh <sedmedgh@gmail.com>
|
|
400
|
+
* @license MIT
|
|
401
|
+
*/
|
|
402
|
+
let F = function(i, e, { evt: t, ...n } = {}) {
|
|
403
|
+
me.pluginEvent.bind(x)(i, e, {
|
|
404
|
+
dragEl: c,
|
|
405
|
+
originalDragEl: g,
|
|
406
|
+
originalDragElDisplay: Re,
|
|
407
|
+
parentEl: T,
|
|
408
|
+
ghostEl: b,
|
|
409
|
+
rootEl: D,
|
|
410
|
+
nextEl: pe,
|
|
411
|
+
lastDownEl: Be,
|
|
412
|
+
cloneEl: _,
|
|
413
|
+
cloneHidden: ce,
|
|
414
|
+
dragStarted: Te,
|
|
415
|
+
putSortable: A,
|
|
416
|
+
activeSortable: x.active,
|
|
417
|
+
originalEvent: t,
|
|
418
|
+
oldIndex: ge,
|
|
419
|
+
oldDraggableIndex: De,
|
|
420
|
+
newIndex: G,
|
|
421
|
+
newDraggableIndex: ne,
|
|
422
|
+
hideGhostForTarget: kt,
|
|
423
|
+
unhideGhostForTarget: Ft,
|
|
424
|
+
cloneNowHidden() {
|
|
425
|
+
ce = !0;
|
|
426
|
+
},
|
|
427
|
+
cloneNowShown() {
|
|
428
|
+
ce = !1;
|
|
429
|
+
},
|
|
430
|
+
dispatchSortableEvent(o) {
|
|
431
|
+
Y({ sortable: e, name: o, originalEvent: t });
|
|
432
|
+
},
|
|
433
|
+
...n
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
function Y(i) {
|
|
437
|
+
Zt({
|
|
438
|
+
putSortable: A,
|
|
439
|
+
cloneEl: _,
|
|
440
|
+
targetEl: g || c,
|
|
441
|
+
rootEl: D,
|
|
442
|
+
oldIndex: ge,
|
|
443
|
+
oldDraggableIndex: De,
|
|
444
|
+
newIndex: G,
|
|
445
|
+
newDraggableIndex: ne,
|
|
446
|
+
...i
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function yt(i) {
|
|
450
|
+
return Xt({
|
|
451
|
+
putSortable: A,
|
|
452
|
+
cloneEl: _,
|
|
453
|
+
targetEl: g || c,
|
|
454
|
+
rootEl: D,
|
|
455
|
+
oldIndex: ge,
|
|
456
|
+
oldDraggableIndex: De,
|
|
457
|
+
newIndex: G,
|
|
458
|
+
newDraggableIndex: ne,
|
|
459
|
+
...i
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
let c, g, Re, T, b, D, pe, Be, _, ce, ge, G, De, ne, Xe, A, ye = !1, je = !1, He = [], he, U, Qe, Je, St, Dt, Te, we, Ie, Oe = !1, Le = !1, We, L, et = [], st = !1, Ve = [];
|
|
463
|
+
const Ue = typeof document < "u", ke = ut, _t = Ae || re ? "cssFloat" : "float", Kt = Ue && !xt && !ut && "draggable" in document.createElement("div"), Lt = function() {
|
|
464
|
+
if (!Ue) return;
|
|
465
|
+
if (re)
|
|
466
|
+
return !1;
|
|
467
|
+
let i = document.createElement("x");
|
|
468
|
+
return i.style.cssText = "pointer-events:auto", i.style.pointerEvents === "auto";
|
|
469
|
+
}(), ct = function(i, e) {
|
|
470
|
+
let t = p(i), n = parseInt(t.width) - parseInt(t.paddingLeft) - parseInt(t.paddingRight) - parseInt(t.borderLeftWidth) - parseInt(t.borderRightWidth), o = be(i, 0, e, !1, [g]), r = be(i, 1, e, !1, [g]), l = o && p(o), a = r && p(r), s = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + P(o).width, f = a && parseInt(a.marginLeft) + parseInt(a.marginRight) + P(r).width;
|
|
471
|
+
if (t.display === "flex")
|
|
472
|
+
return t.flexDirection === "column" || t.flexDirection === "column-reverse" ? "vertical" : "horizontal";
|
|
473
|
+
if (t.display === "grid")
|
|
474
|
+
return t.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
|
|
475
|
+
if (o && l.float && l.float !== "none") {
|
|
476
|
+
let d = l.float === "left" ? "left" : "right";
|
|
477
|
+
return r && (a.clear === "both" || a.clear === d) ? "vertical" : "horizontal";
|
|
478
|
+
}
|
|
479
|
+
return o && (l.display === "block" || l.display === "flex" || l.display === "table" || l.display === "grid" || s >= n && t[_t] === "none" || r && t[_t] === "none" && s + f > n) ? "vertical" : "horizontal";
|
|
480
|
+
}, Qt = function(i, e, t) {
|
|
481
|
+
let n = t ? i.left : i.top, o = t ? i.right : i.bottom, r = t ? i.width : i.height, l = t ? e.left : e.top, a = t ? e.right : e.bottom, s = t ? e.width : e.height;
|
|
482
|
+
return n === l || o === a || n + r / 2 === l + s / 2;
|
|
483
|
+
}, Jt = function(i, e) {
|
|
484
|
+
let t;
|
|
485
|
+
return He.some((n) => {
|
|
486
|
+
const o = n[N].options.emptyInsertThreshold;
|
|
487
|
+
if (!o || pt(n)) return;
|
|
488
|
+
const r = P(n), l = i >= r.left - o && i <= r.right + o, a = e >= r.top - o && e <= r.bottom + o;
|
|
489
|
+
if (l && a)
|
|
490
|
+
return t = n;
|
|
491
|
+
}), t;
|
|
492
|
+
}, Ct = function(i) {
|
|
493
|
+
function e(o, r) {
|
|
494
|
+
return function(l, a, s, f) {
|
|
495
|
+
let d = l.options.group.name && a.options.group.name && l.options.group.name === a.options.group.name;
|
|
496
|
+
if (o == null && (r || d))
|
|
497
|
+
return !0;
|
|
498
|
+
if (o == null || o === !1)
|
|
499
|
+
return !1;
|
|
500
|
+
if (r && o === "clone")
|
|
501
|
+
return o;
|
|
502
|
+
if (typeof o == "function")
|
|
503
|
+
return e(o(l, a, s, f), r)(l, a, s, f);
|
|
504
|
+
{
|
|
505
|
+
let h = (r ? l : a).options.group.name;
|
|
506
|
+
return o === !0 || typeof o == "string" && o === h || o.join && o.indexOf(h) > -1;
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
let t = {}, n = i.group;
|
|
511
|
+
(!n || typeof n != "object") && (n = { name: n }), t.name = n.name, t.checkPull = e(n.pull, !0), t.checkPut = e(n.put), t.revertClone = n.revertClone, i.group = t;
|
|
512
|
+
}, kt = function() {
|
|
513
|
+
!Lt && b && p(b, "display", "none");
|
|
514
|
+
}, Ft = function() {
|
|
515
|
+
!Lt && b && p(b, "display", "");
|
|
516
|
+
};
|
|
517
|
+
Ue && !xt && document.addEventListener(
|
|
518
|
+
"click",
|
|
519
|
+
function(i) {
|
|
520
|
+
if (je)
|
|
521
|
+
return i.preventDefault(), i.stopPropagation && i.stopPropagation(), i.stopImmediatePropagation && i.stopImmediatePropagation(), je = !1, !1;
|
|
522
|
+
},
|
|
523
|
+
!0
|
|
524
|
+
);
|
|
525
|
+
let ue = function(i) {
|
|
526
|
+
if (c) {
|
|
527
|
+
i = i.touches ? i.touches[0] : i;
|
|
528
|
+
let e = Jt(i.clientX, i.clientY);
|
|
529
|
+
if (e) {
|
|
530
|
+
let t = {};
|
|
531
|
+
for (let n in i)
|
|
532
|
+
i.hasOwnProperty(n) && (t[n] = i[n]);
|
|
533
|
+
t.target = t.rootEl = e, t.preventDefault = void 0, t.stopPropagation = void 0, e[N]._onDragOver(t);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}, ei = function(i) {
|
|
537
|
+
c && c.parentNode[N]._isOutsideThisEl(i.target);
|
|
538
|
+
};
|
|
539
|
+
const S = class S {
|
|
540
|
+
constructor(e, t) {
|
|
541
|
+
q(this, "_ignoreWhileAnimating", null);
|
|
542
|
+
if (!(e && e.nodeType && e.nodeType === 1))
|
|
543
|
+
throw `Sortable: \`el\` must be an HTMLElement, not ${{}.toString.call(e)}`;
|
|
544
|
+
this.el = e, this.options = t = Object.assign({}, t), e[N] = this;
|
|
545
|
+
let n = {
|
|
546
|
+
group: null,
|
|
547
|
+
sort: !0,
|
|
548
|
+
disabled: !1,
|
|
549
|
+
store: null,
|
|
550
|
+
handle: null,
|
|
551
|
+
draggable: /^[uo]l$/i.test(e.nodeName) ? ">li" : ">*",
|
|
552
|
+
swapThreshold: 1,
|
|
553
|
+
// percentage; 0 <= x <= 1
|
|
554
|
+
invertSwap: !1,
|
|
555
|
+
// invert always
|
|
556
|
+
invertedSwapThreshold: null,
|
|
557
|
+
// will be set to same as swapThreshold if default
|
|
558
|
+
removeCloneOnHide: !0,
|
|
559
|
+
direction: function() {
|
|
560
|
+
return ct(e, this.options);
|
|
561
|
+
},
|
|
562
|
+
ghostClass: "sortable-ghost",
|
|
563
|
+
chosenClass: "sortable-chosen",
|
|
564
|
+
dragClass: "sortable-drag",
|
|
565
|
+
ignore: "a, img",
|
|
566
|
+
filter: null,
|
|
567
|
+
preventOnFilter: !0,
|
|
568
|
+
getGhostFallback: void 0,
|
|
569
|
+
getPlaceholder: void 0,
|
|
570
|
+
getPlaceholderOnMove: void 0,
|
|
571
|
+
tree: !1,
|
|
572
|
+
treeItemLevelAttr: "data-level",
|
|
573
|
+
treeIndentThreshold: 10,
|
|
574
|
+
animation: 0,
|
|
575
|
+
easing: null,
|
|
576
|
+
setData: function(o, r) {
|
|
577
|
+
o.setData("Text", r.textContent);
|
|
578
|
+
},
|
|
579
|
+
dropBubble: !1,
|
|
580
|
+
dragoverBubble: !1,
|
|
581
|
+
dataIdAttr: "data-id",
|
|
582
|
+
delay: 0,
|
|
583
|
+
delayOnTouchOnly: !1,
|
|
584
|
+
touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
|
|
585
|
+
forceFallback: !1,
|
|
586
|
+
fallbackClass: "sortable-fallback",
|
|
587
|
+
fallbackOnBody: !1,
|
|
588
|
+
fallbackTolerance: 0,
|
|
589
|
+
fallbackOffset: { x: 0, y: 0 },
|
|
590
|
+
// Disabled on Safari: #1571; Enabled on Safari IOS: #2244
|
|
591
|
+
supportPointer: S.supportPointer !== !1 && "PointerEvent" in window && (!Ce || ut),
|
|
592
|
+
emptyInsertThreshold: 5
|
|
593
|
+
};
|
|
594
|
+
me.initializePlugins(this, e, n);
|
|
595
|
+
for (let o in n)
|
|
596
|
+
!(o in t) && (t[o] = n[o]);
|
|
597
|
+
Ct(t);
|
|
598
|
+
for (let o of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
599
|
+
o.charAt(0) === "_" && typeof this[o] == "function" && (this[o] = this[o].bind(this));
|
|
600
|
+
this.nativeDraggable = t.forceFallback ? !1 : Kt, this.nativeDraggable && (this.options.touchStartThreshold = 1), t.supportPointer ? w(e, "pointerdown", this._onTapStart) : (w(e, "mousedown", this._onTapStart), w(e, "touchstart", this._onTapStart)), this.nativeDraggable && (w(e, "dragover", this), w(e, "dragenter", this)), He.push(this.el), t.store && t.store.get && this.sort(t.store.get(this) || []), Object.assign(this, Vt());
|
|
601
|
+
}
|
|
602
|
+
static get(e) {
|
|
603
|
+
return e[N];
|
|
604
|
+
}
|
|
605
|
+
static mount(...e) {
|
|
606
|
+
e[0].constructor === Array && (e = e[0]), e.forEach((t) => {
|
|
607
|
+
if (!t.prototype || !t.prototype.constructor)
|
|
608
|
+
throw `Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(t)}`;
|
|
609
|
+
t.utils && (S.utils = { ...S.utils, ...t.utils }), me.mount(t);
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
static create(e, t) {
|
|
613
|
+
return new S(e, t);
|
|
614
|
+
}
|
|
615
|
+
// All prototype methods go here as class methods (remove prototype)
|
|
616
|
+
_isOutsideThisEl(e) {
|
|
617
|
+
!this.el.contains(e) && e !== this.el && (we = null);
|
|
618
|
+
}
|
|
619
|
+
_getDirection(e, t) {
|
|
620
|
+
return typeof this.options.direction == "function" ? this.options.direction.call(this, e, t, g || c) : this.options.direction;
|
|
621
|
+
}
|
|
622
|
+
_onTapStart(e) {
|
|
623
|
+
if (!e.cancelable) return;
|
|
624
|
+
let t = this, n = this.el, o = this.options, r = o.preventOnFilter, l = e.type, a = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (a || e).target, f = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, d = o.filter;
|
|
625
|
+
if (si(n), !c && !(/mousedown|pointerdown/.test(l) && e.button !== 0 || o.disabled) && !f.isContentEditable && !(!this.nativeDraggable && Ce && s && s.tagName.toUpperCase() === "SELECT") && (s = R(s, o.draggable, n, !1, [g]), !(s && s.animated) && Be !== s)) {
|
|
626
|
+
if (ge = k(s, void 0, [g]), De = k(s, o.draggable, [g]), typeof d == "function") {
|
|
627
|
+
if (d.call(this, e, s, this)) {
|
|
628
|
+
Y({
|
|
629
|
+
sortable: t,
|
|
630
|
+
rootEl: f,
|
|
631
|
+
name: "filter",
|
|
632
|
+
targetEl: s,
|
|
633
|
+
toEl: n,
|
|
634
|
+
fromEl: n
|
|
635
|
+
}), F("filter", t, { evt: e }), r && e.preventDefault();
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
} else if (d && (d = d.split(",").some(function(h) {
|
|
639
|
+
if (h = R(f, h.trim(), n, !1, [g]), h)
|
|
640
|
+
return Y({
|
|
641
|
+
sortable: t,
|
|
642
|
+
rootEl: h,
|
|
643
|
+
name: "filter",
|
|
644
|
+
targetEl: s,
|
|
645
|
+
fromEl: n,
|
|
646
|
+
toEl: n
|
|
647
|
+
}), F("filter", t, { evt: e }), !0;
|
|
648
|
+
}), d)) {
|
|
649
|
+
r && e.preventDefault();
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
o.handle && !R(f, o.handle, n, !1, [g]) || this._prepareDragStart(e, a, s);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
_prepareDragStart(e, t, n) {
|
|
656
|
+
let o = this, r = o.el, l = o.options, a = r.ownerDocument, s;
|
|
657
|
+
if (n && !c && n.parentNode === r) {
|
|
658
|
+
let f = P(n);
|
|
659
|
+
if (D = r, c = n, T = c.parentNode, pe = c.nextSibling, Be = n, Xe = l.group, S.dragged = c, he = {
|
|
660
|
+
target: c,
|
|
661
|
+
clientX: (t || e).clientX,
|
|
662
|
+
clientY: (t || e).clientY
|
|
663
|
+
}, St = he.clientX - f.left, Dt = he.clientY - f.top, this._lastX = (t || e).clientX, this._lastY = (t || e).clientY, c.style["will-change"] = "all", s = function() {
|
|
664
|
+
if (F("delayEnded", o, { evt: e }), S.eventCanceled) {
|
|
665
|
+
o._onDrop();
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
o._disableDelayedDragEvents(), !mt && o.nativeDraggable && (c.draggable = !0), o._triggerDragStart(e, t), Y({
|
|
669
|
+
sortable: o,
|
|
670
|
+
name: "choose",
|
|
671
|
+
originalEvent: e
|
|
672
|
+
}), I(c, l.chosenClass, !0);
|
|
673
|
+
}, l.ignore.split(",").forEach(function(d) {
|
|
674
|
+
lt(c, d.trim(), tt);
|
|
675
|
+
}), w(a, "dragover", ue), w(a, "mousemove", ue), w(a, "touchmove", ue), l.supportPointer ? (w(a, "pointerup", o._onDrop), !this.nativeDraggable && w(a, "pointercancel", o._onDrop)) : (w(a, "mouseup", o._onDrop), w(a, "touchend", o._onDrop), w(a, "touchcancel", o._onDrop)), mt && this.nativeDraggable && (this.options.touchStartThreshold = 4, c.draggable = !0), F("delayStart", this, { evt: e }), l.delay && (!l.delayOnTouchOnly || t) && (!this.nativeDraggable || !(Ae || re))) {
|
|
676
|
+
if (S.eventCanceled) {
|
|
677
|
+
this._onDrop();
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
l.supportPointer ? (w(a, "pointerup", o._disableDelayedDrag), w(a, "pointercancel", o._disableDelayedDrag)) : (w(a, "mouseup", o._disableDelayedDrag), w(a, "touchend", o._disableDelayedDrag), w(a, "touchcancel", o._disableDelayedDrag)), w(a, "mousemove", o._delayedDragTouchMoveHandler), w(a, "touchmove", o._delayedDragTouchMoveHandler), l.supportPointer && w(a, "pointermove", o._delayedDragTouchMoveHandler), o._dragStartTimer = setTimeout(s, l.delay);
|
|
681
|
+
} else
|
|
682
|
+
s();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
_delayedDragTouchMoveHandler(e) {
|
|
686
|
+
let t = e.touches ? e.touches[0] : e;
|
|
687
|
+
Math.max(Math.abs(t.clientX - this._lastX), Math.abs(t.clientY - this._lastY)) >= Math.floor(
|
|
688
|
+
this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)
|
|
689
|
+
) && this._disableDelayedDrag();
|
|
690
|
+
}
|
|
691
|
+
_disableDelayedDrag() {
|
|
692
|
+
c && tt(c), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
|
|
693
|
+
}
|
|
694
|
+
_disableDelayedDragEvents() {
|
|
695
|
+
let e = this.el.ownerDocument;
|
|
696
|
+
v(e, "mouseup", this._disableDelayedDrag), v(e, "touchend", this._disableDelayedDrag), v(e, "touchcancel", this._disableDelayedDrag), v(e, "pointerup", this._disableDelayedDrag), v(e, "pointercancel", this._disableDelayedDrag), v(e, "mousemove", this._delayedDragTouchMoveHandler), v(e, "touchmove", this._delayedDragTouchMoveHandler), v(e, "pointermove", this._delayedDragTouchMoveHandler);
|
|
697
|
+
}
|
|
698
|
+
_triggerDragStart(e, t) {
|
|
699
|
+
t = t || e.pointerType == "touch" && e, !this.nativeDraggable || t ? this.options.supportPointer ? w(document, "pointermove", this._onTouchMove) : t ? w(document, "touchmove", this._onTouchMove) : w(document, "mousemove", this._onTouchMove) : (w(c, "dragend", this), w(D, "dragstart", this._onDragStart));
|
|
700
|
+
try {
|
|
701
|
+
document.selection ? Pe(() => {
|
|
702
|
+
document.selection.empty();
|
|
703
|
+
}) : window.getSelection().removeAllRanges();
|
|
704
|
+
} catch {
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
_getPlaceholder(e) {
|
|
708
|
+
if (typeof this.options.getPlaceholder == "function") {
|
|
709
|
+
const t = this.options.getPlaceholder(
|
|
710
|
+
yt({
|
|
711
|
+
sortable: this,
|
|
712
|
+
name: "getPlaceholder",
|
|
713
|
+
originalEvent: e
|
|
714
|
+
})
|
|
715
|
+
);
|
|
716
|
+
t && (g = c, Re = c.style.display, c = t), c && g && (g.after(c), p(g, "display", "none"), p(g, "transform", ""), I(g, this.options.dragClass, !1), I(g, this.options.ghostClass, !1), I(g, this.options.chosenClass, !1)), F("getPlaceholder", this);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
_removeClonedSelectedItem() {
|
|
720
|
+
(typeof this.options.getPlaceholder == "function" || typeof this.options.getPlaceholderOnMove == "function") && c && g && (p(g, "display", Re || ""), c.remove());
|
|
721
|
+
}
|
|
722
|
+
_replacePlaceholder(e) {
|
|
723
|
+
const t = c.parentNode;
|
|
724
|
+
t ? t.replaceChild(e, c) : c.remove(), c = e;
|
|
725
|
+
}
|
|
726
|
+
_getPlaceholderOnMove(e, t, n, o, r, l) {
|
|
727
|
+
if (typeof this.options.getPlaceholderOnMove == "function") {
|
|
728
|
+
const a = this.options.getPlaceholderOnMove(
|
|
729
|
+
Yt(
|
|
730
|
+
D,
|
|
731
|
+
e,
|
|
732
|
+
g || c,
|
|
733
|
+
t,
|
|
734
|
+
n,
|
|
735
|
+
o,
|
|
736
|
+
r,
|
|
737
|
+
l
|
|
738
|
+
)
|
|
739
|
+
);
|
|
740
|
+
a && this._replacePlaceholder(a);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
_dragStarted(e, t) {
|
|
744
|
+
if (ye = !1, D && c) {
|
|
745
|
+
this._getPlaceholder(t), F("dragStarted", this, { evt: t }), this.nativeDraggable && w(document, "dragover", ei);
|
|
746
|
+
let n = this.options;
|
|
747
|
+
!e && I(c, n.dragClass, !1), I(c, n.ghostClass, !0), S.active = this, e && this._appendGhost(), Y({
|
|
748
|
+
sortable: this,
|
|
749
|
+
name: "start",
|
|
750
|
+
originalEvent: t
|
|
751
|
+
});
|
|
752
|
+
} else
|
|
753
|
+
this._nulling();
|
|
754
|
+
}
|
|
755
|
+
_emulateDragOver() {
|
|
756
|
+
if (U) {
|
|
757
|
+
this._lastX = U.clientX, this._lastY = U.clientY, kt();
|
|
758
|
+
let e = document.elementFromPoint(U.clientX, U.clientY), t = e;
|
|
759
|
+
for (; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(U.clientX, U.clientY), e !== t); )
|
|
760
|
+
t = e;
|
|
761
|
+
if (c.parentNode[N]._isOutsideThisEl(e), t)
|
|
762
|
+
do {
|
|
763
|
+
if (t[N]) {
|
|
764
|
+
let n;
|
|
765
|
+
if (n = t[N]._onDragOver({
|
|
766
|
+
clientX: U.clientX,
|
|
767
|
+
clientY: U.clientY,
|
|
768
|
+
target: e,
|
|
769
|
+
rootEl: t
|
|
770
|
+
}), n && !this.options.dragoverBubble)
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
e = t;
|
|
774
|
+
} while (
|
|
775
|
+
/* jshint boss:true */
|
|
776
|
+
t = It(t)
|
|
777
|
+
);
|
|
778
|
+
Ft();
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
_onTouchMove(e) {
|
|
782
|
+
if (he) {
|
|
783
|
+
let t = this.options, n = t.fallbackTolerance, o = t.fallbackOffset, r = e.touches ? e.touches[0] : e, l = b && Se(b, !0), a = b && l && l.a, s = b && l && l.d, f = ke && L && wt(L), d = (r.clientX - he.clientX + o.x) / (a || 1) + (f ? f[0] - et[0] : 0) / (a || 1), h = (r.clientY - he.clientY + o.y) / (s || 1) + (f ? f[1] - et[1] : 0) / (s || 1);
|
|
784
|
+
if (!S.active && !ye) {
|
|
785
|
+
if (n && Math.max(Math.abs(r.clientX - this._lastX), Math.abs(r.clientY - this._lastY)) < n)
|
|
786
|
+
return;
|
|
787
|
+
this._onDragStart(e, !0);
|
|
788
|
+
}
|
|
789
|
+
if (b) {
|
|
790
|
+
l ? (l.e += d - (Qe || 0), l.f += h - (Je || 0)) : l = {
|
|
791
|
+
a: 1,
|
|
792
|
+
b: 0,
|
|
793
|
+
c: 0,
|
|
794
|
+
d: 1,
|
|
795
|
+
e: d,
|
|
796
|
+
f: h
|
|
797
|
+
};
|
|
798
|
+
let m = `matrix(${l.a},${l.b},${l.c},${l.d},${l.e},${l.f})`;
|
|
799
|
+
p(b, "webkitTransform", m), p(b, "mozTransform", m), p(b, "msTransform", m), p(b, "transform", m), Qe = d, Je = h, U = r;
|
|
800
|
+
}
|
|
801
|
+
e.cancelable && e.preventDefault();
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
_appendGhost() {
|
|
805
|
+
if (!b) {
|
|
806
|
+
let e = this.options.fallbackOnBody ? document.body : D, t = P(c, !0, ke, !0, e), n = this.options;
|
|
807
|
+
if (ke) {
|
|
808
|
+
for (L = e; p(L, "position") === "static" && p(L, "transform") === "none" && L !== document; )
|
|
809
|
+
L = L.parentNode;
|
|
810
|
+
L !== document.body && L !== document.documentElement ? (L === document && (L = J()), t.top += L.scrollTop, t.left += L.scrollLeft) : L = J(), et = wt(L);
|
|
811
|
+
}
|
|
812
|
+
b = this.options.getGhostFallback && typeof this.options.getGhostFallback == "function" ? this.options.getGhostFallback(
|
|
813
|
+
yt({
|
|
814
|
+
sortable: this,
|
|
815
|
+
name: "getGhostFallback"
|
|
816
|
+
})
|
|
817
|
+
) : c.cloneNode(!0), I(b, n.ghostClass, !1), I(b, n.fallbackClass, !0), I(b, n.dragClass, !0), p(b, "transition", ""), p(b, "transform", ""), p(b, "box-sizing", "border-box"), p(b, "margin", 0), p(b, "top", t.top), p(b, "left", t.left), p(b, "width", t.width), p(b, "height", t.height), p(b, "opacity", "0.8"), p(b, "position", ke ? "absolute" : "fixed"), p(b, "zIndex", "100000"), p(b, "pointerEvents", "none"), S.ghost = b, e.appendChild(b), p(
|
|
818
|
+
b,
|
|
819
|
+
"transform-origin",
|
|
820
|
+
St / parseInt(b.style.width) * 100 + "% " + Dt / parseInt(b.style.height) * 100 + "%"
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
_onDragStart(e, t) {
|
|
825
|
+
let n = this, o = e.dataTransfer, r = n.options;
|
|
826
|
+
if (F("dragStart", this, { evt: e }), S.eventCanceled) {
|
|
827
|
+
this._onDrop();
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
F("setupClone", this), S.eventCanceled || (_ = at(c), _.removeAttribute("id"), _.draggable = !1, _.style["will-change"] = "", this._hideClone(), I(_, this.options.chosenClass, !1), S.clone = _), n.cloneId = Pe(function() {
|
|
831
|
+
F("clone", n), !S.eventCanceled && (n.options.removeCloneOnHide || D.insertBefore(_, c), n._hideClone(), Y({
|
|
832
|
+
sortable: n,
|
|
833
|
+
name: "clone"
|
|
834
|
+
}));
|
|
835
|
+
}), !t && I(c, r.dragClass, !0), t ? (je = !0, n._loopId = setInterval(n._emulateDragOver, 50)) : (v(document, "mouseup", n._onDrop), v(document, "touchend", n._onDrop), v(document, "touchcancel", n._onDrop), o && (o.effectAllowed = "move", r.setData && r.setData.call(n, o, c)), w(document, "drop", n), p(c, "transform", "translateZ(0)")), ye = !0, n._dragStartId = Pe(n._dragStarted.bind(n, t, e)), w(document, "selectstart", n), Te = !0, window.getSelection().removeAllRanges(), Ce && p(document.body, "user-select", "none");
|
|
836
|
+
}
|
|
837
|
+
// Returns true - if no further action is needed (either inserted or another condition)
|
|
838
|
+
_onDragOver(e) {
|
|
839
|
+
let t = this.el, n = e.target, o, r, l, a = this.options, s = a.group, f = S.active, d = Xe === s, h = a.sort, m = A || f, y, u = this, X = !1;
|
|
840
|
+
if (st) return;
|
|
841
|
+
function E(C, O) {
|
|
842
|
+
F(C, u, {
|
|
843
|
+
evt: e,
|
|
844
|
+
isOwner: d,
|
|
845
|
+
axis: y ? "vertical" : "horizontal",
|
|
846
|
+
revert: l,
|
|
847
|
+
dragRect: o,
|
|
848
|
+
targetRect: r,
|
|
849
|
+
canSort: h,
|
|
850
|
+
fromSortable: m,
|
|
851
|
+
target: n,
|
|
852
|
+
completed: B,
|
|
853
|
+
onMove(H, ee) {
|
|
854
|
+
return Fe(
|
|
855
|
+
D,
|
|
856
|
+
t,
|
|
857
|
+
g || c,
|
|
858
|
+
o,
|
|
859
|
+
H,
|
|
860
|
+
P(H),
|
|
861
|
+
e,
|
|
862
|
+
ee
|
|
863
|
+
);
|
|
864
|
+
},
|
|
865
|
+
changed: $,
|
|
866
|
+
...O
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
function V() {
|
|
870
|
+
E("dragOverAnimationCapture"), u.captureAnimationState(), u !== m && m.captureAnimationState();
|
|
871
|
+
}
|
|
872
|
+
function B(C) {
|
|
873
|
+
return E("dragOverCompleted", { insertion: C }), C && (d ? f._hideClone() : f._showClone(u), u !== m && (I(
|
|
874
|
+
c,
|
|
875
|
+
A ? A.options.ghostClass : f.options.ghostClass,
|
|
876
|
+
!1
|
|
877
|
+
), I(c, a.ghostClass, !0)), A !== u && u !== S.active ? A = u : u === S.active && A && (A = null), m === u && (u._ignoreWhileAnimating = n), u.animateAll(function() {
|
|
878
|
+
E("dragOverAnimationComplete"), u._ignoreWhileAnimating = null;
|
|
879
|
+
}), u !== m && (m.animateAll(), m._ignoreWhileAnimating = null)), (n === c && !c.animated || n === t && !n.animated) && (we = null), !a.dragoverBubble && !e.rootEl && n !== document && (c.parentNode[N]._isOutsideThisEl(e.target), !C && ue(e)), !a.dragoverBubble && e.stopPropagation && e.stopPropagation(), X = !0;
|
|
880
|
+
}
|
|
881
|
+
function $() {
|
|
882
|
+
G = k(c, void 0, [g]), ne = k(c, a.draggable, [g]), Y({
|
|
883
|
+
sortable: u,
|
|
884
|
+
name: "change",
|
|
885
|
+
toEl: t,
|
|
886
|
+
newIndex: G,
|
|
887
|
+
newDraggableIndex: ne,
|
|
888
|
+
originalEvent: e
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), n = R(n, a.draggable, t, !0, [g]), E("dragOver"), S.eventCanceled) return X;
|
|
892
|
+
if (c.contains(e.target) || n.animated && n.animatingX && n.animatingY || u._ignoreWhileAnimating === n)
|
|
893
|
+
return B(!1);
|
|
894
|
+
if (je = !1, f && !a.disabled && (d ? h || (l = T !== D) : A === this || (this.lastPutMode = Xe.checkPull(
|
|
895
|
+
this,
|
|
896
|
+
f,
|
|
897
|
+
g || c,
|
|
898
|
+
e
|
|
899
|
+
)) && s.checkPut(this, f, g || c, e))) {
|
|
900
|
+
if (y = this._getDirection(e, n) === "vertical", o = P(c), E("dragOverValid"), S.eventCanceled) return X;
|
|
901
|
+
if (l)
|
|
902
|
+
return T = D, V(), this._hideClone(), E("revert"), S.eventCanceled || (pe ? D.insertBefore(c, pe) : D.appendChild(c)), B(!0);
|
|
903
|
+
let C = pt(t, a.draggable);
|
|
904
|
+
if (!C || oi(e, y, this) && !C.animated) {
|
|
905
|
+
if (C === c)
|
|
906
|
+
return B(!1);
|
|
907
|
+
if (C && t === e.target && (n = C), n && (r = P(n)), Fe(
|
|
908
|
+
D,
|
|
909
|
+
t,
|
|
910
|
+
g || c,
|
|
911
|
+
o,
|
|
912
|
+
n,
|
|
913
|
+
r,
|
|
914
|
+
e,
|
|
915
|
+
!!n
|
|
916
|
+
) !== !1)
|
|
917
|
+
return V(), this._getPlaceholderOnMove(t, o, n, r, e, !!n), C && C.nextSibling ? t.insertBefore(c, C.nextSibling) : t.appendChild(c), T = t, $(), B(!0);
|
|
918
|
+
} else if (C && ni(e, y, this)) {
|
|
919
|
+
let O = be(t, 0, a, !0, [g]);
|
|
920
|
+
if (O === c)
|
|
921
|
+
return B(!1);
|
|
922
|
+
if (n = O, r = P(n), Fe(D, t, g || c, o, n, r, e, !1) !== !1)
|
|
923
|
+
return this._getPlaceholderOnMove(t, o, n, r, e, !1), V(), t.insertBefore(c, O), T = t, $(), B(!0);
|
|
924
|
+
} else if (n.parentNode === t) {
|
|
925
|
+
r = P(n);
|
|
926
|
+
let O = 0, H, ee = c.parentNode !== t, de = !Qt(
|
|
927
|
+
c.animated && c.toRect || o,
|
|
928
|
+
n.animated && n.toRect || r,
|
|
929
|
+
y
|
|
930
|
+
), z = y ? "top" : "left", le = vt(n, "top", "top") || vt(c, "top", "top"), Ne = le ? le.scrollTop : void 0;
|
|
931
|
+
we !== n && (H = r[z], Oe = !1, Le = !de && a.invertSwap || ee), O = ri(
|
|
932
|
+
e,
|
|
933
|
+
n,
|
|
934
|
+
r,
|
|
935
|
+
y,
|
|
936
|
+
de ? 1 : a.swapThreshold,
|
|
937
|
+
a.invertedSwapThreshold == null ? a.swapThreshold : a.invertedSwapThreshold,
|
|
938
|
+
Le,
|
|
939
|
+
we === n
|
|
940
|
+
);
|
|
941
|
+
let te;
|
|
942
|
+
if (O !== 0) {
|
|
943
|
+
let ae = k(c, void 0, [g]);
|
|
944
|
+
do
|
|
945
|
+
ae -= O, te = T.children[ae];
|
|
946
|
+
while (te && (p(te, "display") === "none" || te === b));
|
|
947
|
+
}
|
|
948
|
+
if (O === 0 || te === n)
|
|
949
|
+
return B(!1);
|
|
950
|
+
we = n, Ie = O;
|
|
951
|
+
let K = !1;
|
|
952
|
+
K = O === 1;
|
|
953
|
+
let j = Fe(
|
|
954
|
+
D,
|
|
955
|
+
t,
|
|
956
|
+
g || c,
|
|
957
|
+
o,
|
|
958
|
+
n,
|
|
959
|
+
r,
|
|
960
|
+
e,
|
|
961
|
+
K
|
|
962
|
+
);
|
|
963
|
+
if (j !== !1) {
|
|
964
|
+
(j === 1 || j === -1) && (K = j === 1), st = !0, setTimeout(ii, 30), V(), this._getPlaceholderOnMove(t, o, n, r, e, K);
|
|
965
|
+
let ae = n.nextElementSibling;
|
|
966
|
+
return K && !ae ? t.appendChild(c) : n.parentNode.insertBefore(c, K ? ae : n), le && At(le, 0, Ne - le.scrollTop), T = c.parentNode, H !== void 0 && !Le && (We = Math.abs(H - P(n)[z])), $(), B(!0);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
if (t.contains(c))
|
|
970
|
+
return B(!1);
|
|
971
|
+
}
|
|
972
|
+
return !1;
|
|
973
|
+
}
|
|
974
|
+
_offMoveEvents() {
|
|
975
|
+
v(document, "mousemove", this._onTouchMove), v(document, "touchmove", this._onTouchMove), v(document, "pointermove", this._onTouchMove), v(document, "dragover", ue), v(document, "mousemove", ue), v(document, "touchmove", ue);
|
|
976
|
+
}
|
|
977
|
+
_offUpEvents() {
|
|
978
|
+
let e = this.el.ownerDocument;
|
|
979
|
+
v(e, "mouseup", this._onDrop), v(e, "touchend", this._onDrop), v(e, "pointerup", this._onDrop), v(e, "pointercancel", this._onDrop), v(e, "touchcancel", this._onDrop), v(document, "selectstart", this);
|
|
980
|
+
}
|
|
981
|
+
_onDrop(e) {
|
|
982
|
+
let t = this.el, n = this.options;
|
|
983
|
+
if (G = k(c, void 0, [g]), ne = k(c, n.draggable, [g]), F("drop", this, {
|
|
984
|
+
evt: e
|
|
985
|
+
}), T = c && c.parentNode, G = k(c, void 0, [g]), ne = k(c, n.draggable, [g]), S.eventCanceled) {
|
|
986
|
+
this._nulling();
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
ye = !1, Le = !1, Oe = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), Ge(this.cloneId), Ge(this._dragStartId), this.nativeDraggable && (v(document, "drop", this), v(t, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), Ce && p(document.body, "user-select", ""), p(c, "transform", ""), e && (Te && (e.cancelable && e.preventDefault(), !n.dropBubble && e.stopPropagation()), b && b.parentNode && b.parentNode.removeChild(b), (D === T || A && A.lastPutMode !== "clone") && _ && _.parentNode && _.parentNode.removeChild(_), c && (this.nativeDraggable && v(c, "dragend", this), tt(c), c.style["will-change"] = "", Te && !ye && I(
|
|
990
|
+
c,
|
|
991
|
+
A ? A.options.ghostClass : this.options.ghostClass,
|
|
992
|
+
!1
|
|
993
|
+
), I(c, this.options.chosenClass, !1), Y({
|
|
994
|
+
sortable: this,
|
|
995
|
+
name: "unchoose",
|
|
996
|
+
toEl: T,
|
|
997
|
+
newIndex: null,
|
|
998
|
+
newDraggableIndex: null,
|
|
999
|
+
originalEvent: e
|
|
1000
|
+
}), D !== T ? (G >= 0 && (Y({
|
|
1001
|
+
rootEl: T,
|
|
1002
|
+
name: "add",
|
|
1003
|
+
toEl: T,
|
|
1004
|
+
fromEl: D,
|
|
1005
|
+
originalEvent: e
|
|
1006
|
+
}), Y({
|
|
1007
|
+
sortable: this,
|
|
1008
|
+
name: "remove",
|
|
1009
|
+
toEl: T,
|
|
1010
|
+
originalEvent: e
|
|
1011
|
+
}), Y({
|
|
1012
|
+
rootEl: T,
|
|
1013
|
+
name: "sort",
|
|
1014
|
+
toEl: T,
|
|
1015
|
+
fromEl: D,
|
|
1016
|
+
originalEvent: e
|
|
1017
|
+
}), Y({
|
|
1018
|
+
sortable: this,
|
|
1019
|
+
name: "sort",
|
|
1020
|
+
toEl: T,
|
|
1021
|
+
originalEvent: e
|
|
1022
|
+
})), A && A.save()) : G !== ge && G >= 0 && (Y({
|
|
1023
|
+
sortable: this,
|
|
1024
|
+
name: "update",
|
|
1025
|
+
toEl: T,
|
|
1026
|
+
originalEvent: e
|
|
1027
|
+
}), Y({
|
|
1028
|
+
sortable: this,
|
|
1029
|
+
name: "sort",
|
|
1030
|
+
toEl: T,
|
|
1031
|
+
originalEvent: e
|
|
1032
|
+
})), S.active && ((G == null || G === -1) && (G = ge, ne = De), Y({
|
|
1033
|
+
sortable: this,
|
|
1034
|
+
name: "end",
|
|
1035
|
+
toEl: T,
|
|
1036
|
+
originalEvent: e
|
|
1037
|
+
}), this.save()))), this._nulling();
|
|
1038
|
+
}
|
|
1039
|
+
_nulling() {
|
|
1040
|
+
F("nulling", this), this._removeClonedSelectedItem(), D = c = g = Re = T = b = pe = _ = Be = ce = he = U = Te = G = ne = ge = De = we = Ie = A = Xe = S.dragged = S.ghost = S.clone = S.active = null;
|
|
1041
|
+
let e = this.el;
|
|
1042
|
+
Ve.forEach(function(t) {
|
|
1043
|
+
e.contains(t) && (t.checked = !0);
|
|
1044
|
+
}), Ve.length = Qe = Je = 0;
|
|
1045
|
+
}
|
|
1046
|
+
handleEvent(e) {
|
|
1047
|
+
switch (e.type) {
|
|
1048
|
+
case "drop":
|
|
1049
|
+
case "dragend":
|
|
1050
|
+
this._onDrop(e);
|
|
1051
|
+
break;
|
|
1052
|
+
case "dragenter":
|
|
1053
|
+
case "dragover":
|
|
1054
|
+
c && (this._onDragOver(e), ti(e));
|
|
1055
|
+
break;
|
|
1056
|
+
case "selectstart":
|
|
1057
|
+
e.preventDefault();
|
|
1058
|
+
break;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Serializes the item into an array of string.
|
|
1063
|
+
* @returns {String[]}
|
|
1064
|
+
*/
|
|
1065
|
+
toArray() {
|
|
1066
|
+
let e = [], t, n = this.el.children, o = 0, r = n.length, l = this.options;
|
|
1067
|
+
for (; o < r; o++)
|
|
1068
|
+
t = n[o], R(t, l.draggable, this.el, !1, [g]) && e.push(t.getAttribute(l.dataIdAttr) || ai(t));
|
|
1069
|
+
return e;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Sorts the elements according to the array.
|
|
1073
|
+
* @param {String[]} order order of the items
|
|
1074
|
+
*/
|
|
1075
|
+
sort(e, t) {
|
|
1076
|
+
let n = {}, o = this.el;
|
|
1077
|
+
this.toArray().forEach(function(r, l) {
|
|
1078
|
+
let a = o.children[l];
|
|
1079
|
+
R(a, this.options.draggable, o, !1, [g]) && (n[r] = a);
|
|
1080
|
+
}, this), t && this.captureAnimationState(), e.forEach(function(r) {
|
|
1081
|
+
n[r] && (o.removeChild(n[r]), o.appendChild(n[r]));
|
|
1082
|
+
}), t && this.animateAll();
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Save the current sorting
|
|
1086
|
+
*/
|
|
1087
|
+
save() {
|
|
1088
|
+
let e = this.options.store;
|
|
1089
|
+
e && e.set && e.set(this);
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
|
1093
|
+
* @param {HTMLElement} el
|
|
1094
|
+
* @param {String} [selector] default: `options.draggable`
|
|
1095
|
+
* @returns {HTMLElement|null}
|
|
1096
|
+
*/
|
|
1097
|
+
closest(e, t) {
|
|
1098
|
+
return R(e, t || this.options.draggable, this.el, !1, [g]);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Set/get option
|
|
1102
|
+
* @param {string} name
|
|
1103
|
+
* @param {*} [value]
|
|
1104
|
+
* @returns {*}
|
|
1105
|
+
*/
|
|
1106
|
+
option(e, t) {
|
|
1107
|
+
let n = this.options;
|
|
1108
|
+
if (t === void 0)
|
|
1109
|
+
return n[e];
|
|
1110
|
+
{
|
|
1111
|
+
let o = me.modifyOption(this, e, t);
|
|
1112
|
+
typeof o < "u" ? n[e] = o : n[e] = t, e === "group" && Ct(n);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Destroy
|
|
1117
|
+
*/
|
|
1118
|
+
destroy() {
|
|
1119
|
+
F("destroy", this);
|
|
1120
|
+
let e = this.el;
|
|
1121
|
+
e[N] = null, v(e, "mousedown", this._onTapStart), v(e, "touchstart", this._onTapStart), v(e, "pointerdown", this._onTapStart), this.nativeDraggable && (v(e, "dragover", this), v(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(t) {
|
|
1122
|
+
t.removeAttribute("draggable");
|
|
1123
|
+
}), this._onDrop(), this._disableDelayedDragEvents(), He.splice(He.indexOf(this.el), 1), this.el = e = null;
|
|
1124
|
+
}
|
|
1125
|
+
_hideClone() {
|
|
1126
|
+
if (!ce) {
|
|
1127
|
+
if (F("hideClone", this), S.eventCanceled) return;
|
|
1128
|
+
p(_, "display", "none"), this.options.removeCloneOnHide && _.parentNode && _.parentNode.removeChild(_), ce = !0;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
_showClone(e) {
|
|
1132
|
+
if (e.lastPutMode !== "clone") {
|
|
1133
|
+
this._hideClone();
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (ce) {
|
|
1137
|
+
if (F("showClone", this), S.eventCanceled) return;
|
|
1138
|
+
typeof this.options.getPlaceholder != "function" && typeof this.options.getPlaceholderOnMove != "function" && (c.parentNode == D && !this.options.group.revertClone ? D.insertBefore(_, c) : pe ? D.insertBefore(_, pe) : D.appendChild(_)), this.options.group.revertClone && this.animate(c, _), p(_, "display", ""), ce = !1;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
q(S, "utils", {
|
|
1143
|
+
on: w,
|
|
1144
|
+
off: v,
|
|
1145
|
+
css: p,
|
|
1146
|
+
find: lt,
|
|
1147
|
+
is: function(e, t) {
|
|
1148
|
+
return !!R(e, t, e, !1, [g]);
|
|
1149
|
+
},
|
|
1150
|
+
extend: Ot,
|
|
1151
|
+
throttle: gt,
|
|
1152
|
+
closest: R,
|
|
1153
|
+
toggleClass: I,
|
|
1154
|
+
clone: at,
|
|
1155
|
+
index: k,
|
|
1156
|
+
nextTick: Pe,
|
|
1157
|
+
cancelNextTick: Ge,
|
|
1158
|
+
detectDirection: ct,
|
|
1159
|
+
getChild: be,
|
|
1160
|
+
expando: N
|
|
1161
|
+
}), q(S, "version", Et);
|
|
1162
|
+
let x = S;
|
|
1163
|
+
function ti(i) {
|
|
1164
|
+
i.dataTransfer && (i.dataTransfer.dropEffect = "move"), i.cancelable && i.preventDefault();
|
|
1165
|
+
}
|
|
1166
|
+
const Yt = (i, e, t, n, o, r, l, a) => {
|
|
1167
|
+
let s;
|
|
1168
|
+
window.CustomEvent && !re && !Ae ? s = new CustomEvent("move", {
|
|
1169
|
+
bubbles: !0,
|
|
1170
|
+
cancelable: !0
|
|
1171
|
+
}) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = e, s.from = i, s.dragged = t, s.draggedRect = n, s.related = o || e, s.relatedRect = r || P(e), s.willInsertAfter = a, s.originalEvent = l;
|
|
1172
|
+
const f = i[N];
|
|
1173
|
+
if (f) {
|
|
1174
|
+
let d = {
|
|
1175
|
+
...me.getEventProperties("move", f)
|
|
1176
|
+
};
|
|
1177
|
+
for (let h in d)
|
|
1178
|
+
s[h] = d[h];
|
|
1179
|
+
}
|
|
1180
|
+
return s;
|
|
1181
|
+
};
|
|
1182
|
+
function Fe(i, e, t, n, o, r, l, a) {
|
|
1183
|
+
let s = i[N], f = s.options.onMove, d;
|
|
1184
|
+
const h = Yt(
|
|
1185
|
+
i,
|
|
1186
|
+
e,
|
|
1187
|
+
t,
|
|
1188
|
+
n,
|
|
1189
|
+
o,
|
|
1190
|
+
r,
|
|
1191
|
+
l,
|
|
1192
|
+
a
|
|
1193
|
+
);
|
|
1194
|
+
return i.dispatchEvent(h), f && (d = f.call(s, h)), d;
|
|
1195
|
+
}
|
|
1196
|
+
function tt(i) {
|
|
1197
|
+
i.draggable = !1;
|
|
1198
|
+
}
|
|
1199
|
+
function ii() {
|
|
1200
|
+
st = !1;
|
|
1201
|
+
}
|
|
1202
|
+
function ni(i, e, t) {
|
|
1203
|
+
let n = P(be(t.el, 0, t.options, !0, [g]));
|
|
1204
|
+
const o = Nt(
|
|
1205
|
+
t.el,
|
|
1206
|
+
t.options,
|
|
1207
|
+
b,
|
|
1208
|
+
[g]
|
|
1209
|
+
), r = 10;
|
|
1210
|
+
return e ? i.clientX < o.left - r || i.clientY < n.top && i.clientX < n.right : i.clientY < o.top - r || i.clientY < n.bottom && i.clientX < n.left;
|
|
1211
|
+
}
|
|
1212
|
+
function oi(i, e, t) {
|
|
1213
|
+
const n = P(pt(t.el, t.options.draggable)), o = Nt(
|
|
1214
|
+
t.el,
|
|
1215
|
+
t.options,
|
|
1216
|
+
b,
|
|
1217
|
+
[g]
|
|
1218
|
+
), r = 10;
|
|
1219
|
+
return e ? i.clientX > o.right + r || i.clientY > n.bottom && i.clientX > n.left : i.clientY > o.bottom + r || i.clientX > n.right && i.clientY > n.top;
|
|
1220
|
+
}
|
|
1221
|
+
function ri(i, e, t, n, o, r, l, a) {
|
|
1222
|
+
let s = n ? i.clientY : i.clientX, f = n ? t.height : t.width, d = n ? t.top : t.left, h = n ? t.bottom : t.right, m = !1;
|
|
1223
|
+
if (!l) {
|
|
1224
|
+
if (a && We < f * o) {
|
|
1225
|
+
if (!Oe && (Ie === 1 ? s > d + f * r / 2 : s < h - f * r / 2) && (Oe = !0), Oe)
|
|
1226
|
+
m = !0;
|
|
1227
|
+
else if (Ie === 1 ? s < d + We : s > h - We)
|
|
1228
|
+
return -Ie;
|
|
1229
|
+
} else if (s > d + f * (1 - o) / 2 && s < h - f * (1 - o) / 2)
|
|
1230
|
+
return li(e);
|
|
1231
|
+
}
|
|
1232
|
+
return m = m || l, m && (s < d + f * r / 2 || s > h - f * r / 2) ? s > d + f / 2 ? 1 : -1 : 0;
|
|
1233
|
+
}
|
|
1234
|
+
function li(i) {
|
|
1235
|
+
return k(c, void 0, [g]) < k(i, void 0, [g]) ? 1 : -1;
|
|
1236
|
+
}
|
|
1237
|
+
function ai(i) {
|
|
1238
|
+
let e = i.tagName + i.className + i.src + i.href + i.textContent, t = e.length, n = 0;
|
|
1239
|
+
for (; t--; )
|
|
1240
|
+
n += e.charCodeAt(t);
|
|
1241
|
+
return n.toString(36);
|
|
1242
|
+
}
|
|
1243
|
+
function si(i) {
|
|
1244
|
+
Ve.length = 0;
|
|
1245
|
+
let e = i.getElementsByTagName("input"), t = e.length;
|
|
1246
|
+
for (; t--; ) {
|
|
1247
|
+
let n = e[t];
|
|
1248
|
+
n.checked && Ve.push(n);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
function Pe(i) {
|
|
1252
|
+
return setTimeout(i, 0);
|
|
1253
|
+
}
|
|
1254
|
+
function Ge(i) {
|
|
1255
|
+
return clearTimeout(i);
|
|
1256
|
+
}
|
|
1257
|
+
Ue && w(document, "touchmove", function(i) {
|
|
1258
|
+
(x.active || ye) && i.cancelable && i.preventDefault();
|
|
1259
|
+
});
|
|
1260
|
+
x.utils = {
|
|
1261
|
+
on: w,
|
|
1262
|
+
off: v,
|
|
1263
|
+
css: p,
|
|
1264
|
+
find: lt,
|
|
1265
|
+
is: function(i, e) {
|
|
1266
|
+
return !!R(i, e, i, !1, [g]);
|
|
1267
|
+
},
|
|
1268
|
+
extend: Ot,
|
|
1269
|
+
throttle: gt,
|
|
1270
|
+
closest: R,
|
|
1271
|
+
toggleClass: I,
|
|
1272
|
+
clone: at,
|
|
1273
|
+
index: k,
|
|
1274
|
+
nextTick: Pe,
|
|
1275
|
+
cancelNextTick: Ge,
|
|
1276
|
+
detectDirection: ct,
|
|
1277
|
+
getChild: be,
|
|
1278
|
+
expando: N
|
|
1279
|
+
};
|
|
1280
|
+
x.get = function(i) {
|
|
1281
|
+
return i[N];
|
|
1282
|
+
};
|
|
1283
|
+
x.mount = function(...i) {
|
|
1284
|
+
i[0].constructor === Array && (i = i[0]), i.forEach((e) => {
|
|
1285
|
+
if (!e.prototype || !e.prototype.constructor)
|
|
1286
|
+
throw `Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(e)}`;
|
|
1287
|
+
e.utils && (x.utils = { ...x.utils, ...e.utils }), me.mount(e);
|
|
1288
|
+
});
|
|
1289
|
+
};
|
|
1290
|
+
x.create = function(i, e) {
|
|
1291
|
+
return new x(i, e);
|
|
1292
|
+
};
|
|
1293
|
+
x.version = Et;
|
|
1294
|
+
let ie, _e, Ye;
|
|
1295
|
+
class Rt {
|
|
1296
|
+
static eventProperties() {
|
|
1297
|
+
const e = {
|
|
1298
|
+
swapItem: ie
|
|
1299
|
+
};
|
|
1300
|
+
return Ye !== void 0 && (e.newIndex = Ye), e;
|
|
1301
|
+
}
|
|
1302
|
+
constructor(e) {
|
|
1303
|
+
this.sortable = e, this.options = e.options, this.defaults = {
|
|
1304
|
+
swapClass: "sortable-swap-highlight"
|
|
1305
|
+
};
|
|
1306
|
+
for (let t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1307
|
+
t.charAt(0) === "_" && typeof this[t] == "function" && (this[t] = this[t].bind(this));
|
|
1308
|
+
}
|
|
1309
|
+
dragStart({ dragEl: e }) {
|
|
1310
|
+
this.setLastSwapEl(e);
|
|
1311
|
+
}
|
|
1312
|
+
getPlaceholder({ originalDragEl: e }) {
|
|
1313
|
+
_e = e;
|
|
1314
|
+
}
|
|
1315
|
+
dragOverValid({ completed: e, target: t, onMove: n, activeSortable: o, changed: r, cancel: l }) {
|
|
1316
|
+
if (!o.options.swap) return;
|
|
1317
|
+
let a = this.sortable.el, s = this.options;
|
|
1318
|
+
if (t && t !== a) {
|
|
1319
|
+
let f = ie;
|
|
1320
|
+
n(t) !== !1 ? (I(t, s.swapClass, !0), this.setLastSwapEl(t)) : this.setLastSwapEl(null), f && f !== ie && I(f, s.swapClass, !1);
|
|
1321
|
+
}
|
|
1322
|
+
r(), e(!0), l();
|
|
1323
|
+
}
|
|
1324
|
+
setLastSwapEl(e) {
|
|
1325
|
+
ie = e;
|
|
1326
|
+
const t = e == null ? void 0 : e.parentNode;
|
|
1327
|
+
let n = -1;
|
|
1328
|
+
t && e && typeof this.options.getPlaceholder == "function" && (n = k(e, this.options.draggable, [_e])), n > -1 ? Ye = n : Ye = void 0;
|
|
1329
|
+
}
|
|
1330
|
+
swapNodes(e, t, n, o) {
|
|
1331
|
+
var r;
|
|
1332
|
+
if (typeof n.options.getPlaceholder != "function" && typeof ((r = o == null ? void 0 : o.options) == null ? void 0 : r.getPlaceholder) != "function") {
|
|
1333
|
+
let l = e.parentNode, a = t.parentNode, s, f;
|
|
1334
|
+
if (!l || !a || l.isEqualNode(t) || a.isEqualNode(e)) return;
|
|
1335
|
+
s = k(e, this.options.draggable, [_e]), f = k(t, this.options.draggable, [_e]), l.isEqualNode(a) && s < f && f++, l.insertBefore(t, l.children[s]), a.insertBefore(e, a.children[f]);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
drop({ activeSortable: e, putSortable: t, dragEl: n, ...o }) {
|
|
1339
|
+
let r = t || this.sortable, l = this.options;
|
|
1340
|
+
ie && I(ie, l.swapClass, !1), ie && (l.swap || t && t.options.swap) && n !== ie && (r.captureAnimationState(), r !== e && e.captureAnimationState(), this.swapNodes(n, ie, e, t), r.animateAll(), r !== e && e.animateAll());
|
|
1341
|
+
}
|
|
1342
|
+
nulling() {
|
|
1343
|
+
this.setLastSwapEl(null), _e = null;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
q(Rt, "pluginName", "swap");
|
|
1347
|
+
let se, Q, W, Z;
|
|
1348
|
+
class Bt {
|
|
1349
|
+
static eventProperties() {
|
|
1350
|
+
const e = {};
|
|
1351
|
+
return se !== void 0 && (e.draggedTreeItemParent = se), Q !== void 0 && (e.draggedTreeItemLevel = Q), W !== void 0 && (e.draggedTreeItemBefore = W), Z !== void 0 && (e.draggedTreeItemAfter = Z), e;
|
|
1352
|
+
}
|
|
1353
|
+
constructor(e) {
|
|
1354
|
+
this.sortable = e, this.options = e.options, this.startX = 0, this.startLevel = 1, this.beforeElement = null;
|
|
1355
|
+
}
|
|
1356
|
+
mount() {
|
|
1357
|
+
this.options.tree;
|
|
1358
|
+
}
|
|
1359
|
+
dragStarted({ originalEvent: e, dragEl: t, originalDragEl: n, sortable: o }) {
|
|
1360
|
+
this.options.tree && (this.startX = e.clientX, this.startLevel = it(n || t, this.options), Q = this.startLevel, this._getDraggedTreeItemParent(t, n, o));
|
|
1361
|
+
}
|
|
1362
|
+
// dragOverValid({ completed, target, onMove, activeSortable, changed, cancel }) {
|
|
1363
|
+
// if (!this.options.tree) return;
|
|
1364
|
+
//
|
|
1365
|
+
// // Check if onMove function exists and call it
|
|
1366
|
+
// if (onMove && typeof onMove === 'function') {
|
|
1367
|
+
// const moveResult = onMove(target);
|
|
1368
|
+
//
|
|
1369
|
+
// // If onMove returns false, cancel the move
|
|
1370
|
+
// if (moveResult === false) {
|
|
1371
|
+
// cancel();
|
|
1372
|
+
// return;
|
|
1373
|
+
// }
|
|
1374
|
+
//
|
|
1375
|
+
// // If onMove returns a number (1 or -1), it indicates direction
|
|
1376
|
+
// if (moveResult === 1 || moveResult === -1) {
|
|
1377
|
+
// // Handle direction-based movement if needed
|
|
1378
|
+
// // For tree structure, we might want to adjust level based on direction
|
|
1379
|
+
// }
|
|
1380
|
+
// }
|
|
1381
|
+
//
|
|
1382
|
+
// // Continue with normal tree logic
|
|
1383
|
+
// changed();
|
|
1384
|
+
// completed(true);
|
|
1385
|
+
// }
|
|
1386
|
+
_findPrevSibling(e, t, n = void 0) {
|
|
1387
|
+
let o = e.previousElementSibling;
|
|
1388
|
+
const r = this.options.treeItemLevelAttr || "data-level";
|
|
1389
|
+
for (; o; ) {
|
|
1390
|
+
const l = R(o, this.options.draggable, this.sortable.el, !1, [t]);
|
|
1391
|
+
if (l && (typeof n == "number" && l.getAttribute(r) === n.toString() || n === void 0))
|
|
1392
|
+
return l;
|
|
1393
|
+
o = o.previousElementSibling;
|
|
1394
|
+
}
|
|
1395
|
+
return null;
|
|
1396
|
+
}
|
|
1397
|
+
_findNextSibling(e, t) {
|
|
1398
|
+
let n = e.nextElementSibling;
|
|
1399
|
+
for (; n; ) {
|
|
1400
|
+
const o = R(n, this.options.draggable, this.sortable.el, !1, [t]);
|
|
1401
|
+
if (o) return o;
|
|
1402
|
+
n = n.nextElementSibling;
|
|
1403
|
+
}
|
|
1404
|
+
return null;
|
|
1405
|
+
}
|
|
1406
|
+
_getDraggedTreeItemParent(e, t, n) {
|
|
1407
|
+
se = this._findPrevSibling(e, t, Q - 1) ?? n.el;
|
|
1408
|
+
}
|
|
1409
|
+
dragOver({
|
|
1410
|
+
axis: e,
|
|
1411
|
+
originalEvent: t,
|
|
1412
|
+
dragEl: n,
|
|
1413
|
+
originalDragEl: o,
|
|
1414
|
+
sortable: r,
|
|
1415
|
+
fromSortable: l,
|
|
1416
|
+
onMove: a,
|
|
1417
|
+
ghostEl: s,
|
|
1418
|
+
changed: f,
|
|
1419
|
+
...d
|
|
1420
|
+
}) {
|
|
1421
|
+
var C, O;
|
|
1422
|
+
if (!this.options.tree || e === "vertical") return;
|
|
1423
|
+
const h = t.clientX - this.startX, m = this.options.treeIndentThreshold || 10, y = this.options.treeItemLevelAttr || "data-level";
|
|
1424
|
+
W = this._findPrevSibling(n, o), Z = this._findNextSibling(n, o);
|
|
1425
|
+
const u = W ? it(W, this.options) : 1, X = Z ? it(Z, this.options) : 1;
|
|
1426
|
+
W && (W.level = u), Z && (Z.level = X);
|
|
1427
|
+
let E = 1, V = 1;
|
|
1428
|
+
W && Z ? (E = Math.min(u + 1, X), u >= X && (E = Math.min(E, u)), V = Math.max(u + 1, X)) : Z ? E = V = 1 : (E = 1, V = u + 1);
|
|
1429
|
+
const B = Math.floor(h / m), $ = Math.max(E, Math.min(V, this.startLevel + B));
|
|
1430
|
+
if ($ !== Q || this.beforeElement !== W || r !== l) {
|
|
1431
|
+
this.removeDragPrent(), this.beforeElement = W, Q = $, this._getDraggedTreeItemParent(n, o, r);
|
|
1432
|
+
const H = W || Z || this.sortable.el, ee = P(H);
|
|
1433
|
+
a(H, !!W) !== !1 && (o && !(typeof this.options.getPlaceholder == "function" || typeof this.options.getPlaceholderOnMove == "function") && o.setAttribute(y, Q), (C = n == null ? void 0 : n.setAttribute) == null || C.call(n, y, Q), (O = s == null ? void 0 : s.setAttribute) == null || O.call(s, y, Q), $ > 1 && se && se.setAttribute("data-drag-parent", "true"), this.sortable._getPlaceholderOnMove(
|
|
1434
|
+
this.sortable.el,
|
|
1435
|
+
P(n),
|
|
1436
|
+
H,
|
|
1437
|
+
ee,
|
|
1438
|
+
t,
|
|
1439
|
+
!!W
|
|
1440
|
+
), f());
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
drop(e) {
|
|
1444
|
+
this.options.tree;
|
|
1445
|
+
}
|
|
1446
|
+
removeDragPrent() {
|
|
1447
|
+
se && se.removeAttribute("data-drag-parent"), se = null;
|
|
1448
|
+
}
|
|
1449
|
+
nulling() {
|
|
1450
|
+
this.removeDragPrent(), this.startX = 0, this.startLevel = 1, Q = W = Z = void 0;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
q(Bt, "pluginName", "tree");
|
|
1454
|
+
function it(i, e) {
|
|
1455
|
+
const t = e.treeItemLevelAttr || "data-level";
|
|
1456
|
+
return parseInt(i.getAttribute(t)) || 1;
|
|
1457
|
+
}
|
|
1458
|
+
let Tt;
|
|
1459
|
+
class Ht {
|
|
1460
|
+
constructor(e) {
|
|
1461
|
+
q(this, "startIndex", null);
|
|
1462
|
+
this.sortable = e, this.options = e.options;
|
|
1463
|
+
}
|
|
1464
|
+
dragStart({ oldDraggableIndex: e }) {
|
|
1465
|
+
this.startIndex = e;
|
|
1466
|
+
}
|
|
1467
|
+
getPlaceholder({ originalDragEl: e }) {
|
|
1468
|
+
Tt = e;
|
|
1469
|
+
}
|
|
1470
|
+
onSpill({ dragEl: e, putSortable: t }) {
|
|
1471
|
+
this.sortable.captureAnimationState(), t && t.captureAnimationState();
|
|
1472
|
+
let n = be(this.sortable.el, this.startIndex, this.options, [Tt]);
|
|
1473
|
+
n ? this.sortable.el.insertBefore(e, n) : this.sortable.el.appendChild(e), this.sortable.animateAll(), t && t.animateAll();
|
|
1474
|
+
}
|
|
1475
|
+
drop({
|
|
1476
|
+
originalEvent: e,
|
|
1477
|
+
putSortable: t,
|
|
1478
|
+
dragEl: n,
|
|
1479
|
+
activeSortable: o,
|
|
1480
|
+
dispatchSortableEvent: r,
|
|
1481
|
+
hideGhostForTarget: l,
|
|
1482
|
+
unhideGhostForTarget: a
|
|
1483
|
+
}) {
|
|
1484
|
+
if (!e) return;
|
|
1485
|
+
let s = t || o;
|
|
1486
|
+
l();
|
|
1487
|
+
let f = e.changedTouches && e.changedTouches.length ? e.changedTouches[0] : e, d = document.elementFromPoint(f.clientX, f.clientY);
|
|
1488
|
+
a(), s && !s.el.contains(d) && (r("spill"), this.onSpill({ dragEl: n, putSortable: t }));
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
q(Ht, "pluginName", "revertOnSpill");
|
|
1492
|
+
class Wt {
|
|
1493
|
+
constructor(e) {
|
|
1494
|
+
this.sortable = e, this.options = e.options;
|
|
1495
|
+
}
|
|
1496
|
+
onSpill({ dragEl: e, putSortable: t }) {
|
|
1497
|
+
const n = t || this.sortable;
|
|
1498
|
+
n.captureAnimationState(), e.parentNode && e.parentNode.removeChild(e), n.animateAll();
|
|
1499
|
+
}
|
|
1500
|
+
drop({
|
|
1501
|
+
originalEvent: e,
|
|
1502
|
+
putSortable: t,
|
|
1503
|
+
dragEl: n,
|
|
1504
|
+
activeSortable: o,
|
|
1505
|
+
dispatchSortableEvent: r,
|
|
1506
|
+
hideGhostForTarget: l,
|
|
1507
|
+
unhideGhostForTarget: a
|
|
1508
|
+
}) {
|
|
1509
|
+
if (!e) return;
|
|
1510
|
+
let s = t || o;
|
|
1511
|
+
l();
|
|
1512
|
+
let f = e.changedTouches && e.changedTouches.length ? e.changedTouches[0] : e, d = document.elementFromPoint(f.clientX, f.clientY);
|
|
1513
|
+
a(), s && !s.el.contains(d) && (r("spill"), this.onSpill({ dragEl: n, putSortable: t }));
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
q(Wt, "pluginName", "removeOnSpill");
|
|
1517
|
+
let M = [], Ee, ft, dt = !1, nt, ot, qe, xe;
|
|
1518
|
+
class ht {
|
|
1519
|
+
constructor(e) {
|
|
1520
|
+
this.sortable = e, this.options = e.options, this.defaults = {
|
|
1521
|
+
scroll: !0,
|
|
1522
|
+
forceAutoScrollFallback: !1,
|
|
1523
|
+
scrollSensitivity: 30,
|
|
1524
|
+
scrollSpeed: 10,
|
|
1525
|
+
bubbleScroll: !0
|
|
1526
|
+
};
|
|
1527
|
+
for (let t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1528
|
+
t.charAt(0) === "_" && typeof this[t] == "function" && (this[t] = this[t].bind(this));
|
|
1529
|
+
}
|
|
1530
|
+
dragStarted({ originalEvent: e }) {
|
|
1531
|
+
this.sortable.nativeDraggable ? w(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? w(document, "pointermove", this._handleFallbackAutoScroll) : e.touches ? w(document, "touchmove", this._handleFallbackAutoScroll) : w(document, "mousemove", this._handleFallbackAutoScroll);
|
|
1532
|
+
}
|
|
1533
|
+
dragOverCompleted({ originalEvent: e }) {
|
|
1534
|
+
!this.options.dragOverBubble && !e.rootEl && this._handleAutoScroll(e);
|
|
1535
|
+
}
|
|
1536
|
+
drop() {
|
|
1537
|
+
this.sortable.nativeDraggable ? v(document, "dragover", this._handleAutoScroll) : (v(document, "pointermove", this._handleFallbackAutoScroll), v(document, "touchmove", this._handleFallbackAutoScroll), v(document, "mousemove", this._handleFallbackAutoScroll)), Pt(), ze(), jt();
|
|
1538
|
+
}
|
|
1539
|
+
nulling() {
|
|
1540
|
+
qe = ft = Ee = dt = xe = nt = ot = null, M.length = 0;
|
|
1541
|
+
}
|
|
1542
|
+
_handleFallbackAutoScroll(e) {
|
|
1543
|
+
this._handleAutoScroll(e, !0);
|
|
1544
|
+
}
|
|
1545
|
+
_handleAutoScroll(e, t) {
|
|
1546
|
+
const n = (e.touches ? e.touches[0] : e).clientX, o = (e.touches ? e.touches[0] : e).clientY, r = document.elementFromPoint(n, o);
|
|
1547
|
+
if (qe = e, t || this.options.forceAutoScrollFallback || Ae || re || Ce) {
|
|
1548
|
+
rt(e, this.options, r, t);
|
|
1549
|
+
let l = fe(r, !0);
|
|
1550
|
+
dt && (!xe || n !== nt || o !== ot) && (xe && Pt(), xe = setInterval(() => {
|
|
1551
|
+
let a = fe(document.elementFromPoint(n, o), !0);
|
|
1552
|
+
a !== l && (l = a, ze()), rt(e, this.options, a, t);
|
|
1553
|
+
}, 10), nt = n, ot = o);
|
|
1554
|
+
} else {
|
|
1555
|
+
if (!this.options.bubbleScroll || fe(r, !0) === J()) {
|
|
1556
|
+
ze();
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
rt(e, this.options, fe(r, !1), !1);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
q(ht, "pluginName", "scroll"), q(ht, "initializeByDefault", !0);
|
|
1564
|
+
function ze() {
|
|
1565
|
+
M.forEach(function(i) {
|
|
1566
|
+
clearInterval(i.pid);
|
|
1567
|
+
}), M = [];
|
|
1568
|
+
}
|
|
1569
|
+
function Pt() {
|
|
1570
|
+
clearInterval(xe);
|
|
1571
|
+
}
|
|
1572
|
+
const rt = gt(function(i, e, t, n) {
|
|
1573
|
+
if (!e.scroll) return;
|
|
1574
|
+
const o = (i.touches ? i.touches[0] : i).clientX, r = (i.touches ? i.touches[0] : i).clientY, l = e.scrollSensitivity, a = e.scrollSpeed, s = J();
|
|
1575
|
+
let f = !1, d;
|
|
1576
|
+
ft !== t && (ft = t, ze(), Ee = e.scroll, d = e.scrollFn, Ee === !0 && (Ee = fe(t, !0)));
|
|
1577
|
+
let h = 0, m = Ee;
|
|
1578
|
+
do {
|
|
1579
|
+
let y = m, u = P(y), X = u.top, E = u.bottom, V = u.left, B = u.right, $ = u.width, C = u.height, O, H, ee = y.scrollWidth, de = y.scrollHeight, z = p(y), le = y.scrollLeft, Ne = y.scrollTop;
|
|
1580
|
+
y === s ? (O = $ < ee && (z.overflowX === "auto" || z.overflowX === "scroll" || z.overflowX === "visible"), H = C < de && (z.overflowY === "auto" || z.overflowY === "scroll" || z.overflowY === "visible")) : (O = $ < ee && (z.overflowX === "auto" || z.overflowX === "scroll"), H = C < de && (z.overflowY === "auto" || z.overflowY === "scroll"));
|
|
1581
|
+
let te = O && (Math.abs(B - o) <= l && le + $ < ee) - (Math.abs(V - o) <= l && !!le), K = H && (Math.abs(E - r) <= l && Ne + C < de) - (Math.abs(X - r) <= l && !!Ne);
|
|
1582
|
+
if (!M[h])
|
|
1583
|
+
for (let j = 0; j <= h; j++)
|
|
1584
|
+
M[j] || (M[j] = {});
|
|
1585
|
+
(M[h].vx != te || M[h].vy != K || M[h].el !== y) && (M[h].el = y, M[h].vx = te, M[h].vy = K, clearInterval(M[h].pid), (te != 0 || K != 0) && (f = !0, M[h].pid = setInterval((function() {
|
|
1586
|
+
n && this.layer === 0 && x.active._onTouchMove(qe);
|
|
1587
|
+
let j = M[this.layer].vy ? M[this.layer].vy * a : 0, ae = M[this.layer].vx ? M[this.layer].vx * a : 0;
|
|
1588
|
+
typeof d == "function" && d.call(x.dragged.parentNode[N], ae, j, i, qe, M[this.layer].el) !== "continue" || At(M[this.layer].el, ae, j);
|
|
1589
|
+
}).bind({ layer: h }), 24))), h++;
|
|
1590
|
+
} while (e.bubbleScroll && m !== s && (m = fe(m, !1)));
|
|
1591
|
+
dt = f;
|
|
1592
|
+
}, 30);
|
|
1593
|
+
x.mount(ht, Wt, Ht, Bt, Rt);
|
|
1594
|
+
export {
|
|
1595
|
+
x as default
|
|
1596
|
+
};
|