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