blazer 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +23 -27
- data/app/assets/javascripts/blazer/Sortable.js +826 -1162
- data/app/assets/javascripts/blazer/ace/ace.js +15775 -13360
- data/app/assets/javascripts/blazer/ace/ext-language_tools.js +1411 -668
- data/app/assets/javascripts/blazer/ace/mode-sql.js +12 -6
- data/app/assets/javascripts/blazer/ace/theme-twilight.js +3 -3
- data/app/assets/javascripts/blazer/application.js +94 -52
- data/app/assets/javascripts/blazer/chart.umd.js +6 -6
- data/app/assets/javascripts/blazer/daterangepicker.js +193 -199
- data/app/assets/javascripts/blazer/highlight.min.js +235 -373
- data/app/assets/javascripts/blazer/moment-timezone-with-data.js +116 -82
- data/app/assets/javascripts/blazer/moment.js +368 -365
- data/app/assets/javascripts/blazer/queries.js +68 -58
- data/app/assets/javascripts/blazer/routes.js +11 -11
- data/app/assets/javascripts/blazer/tablesort.js +42 -0
- data/app/assets/javascripts/blazer/tom-select.base.js +4175 -0
- data/app/assets/stylesheets/blazer/application.css +114 -5
- data/app/assets/stylesheets/blazer/tom-select.css +502 -0
- data/app/controllers/blazer/base_controller.rb +1 -1
- data/app/controllers/blazer/checks_controller.rb +5 -2
- data/app/controllers/blazer/queries_controller.rb +3 -1
- data/app/helpers/blazer/base_helper.rb +1 -1
- data/app/models/blazer/check.rb +35 -57
- data/app/views/blazer/_nav.html.erb +1 -1
- data/app/views/blazer/_variables.html.erb +57 -42
- data/app/views/blazer/checks/_form.html.erb +20 -16
- data/app/views/blazer/checks/index.html.erb +17 -20
- data/app/views/blazer/dashboards/_form.html.erb +63 -48
- data/app/views/blazer/dashboards/show.html.erb +23 -16
- data/app/views/blazer/queries/_caching.html.erb +1 -1
- data/app/views/blazer/queries/_chart.html.erb +8 -0
- data/app/views/blazer/queries/_form.html.erb +153 -180
- data/app/views/blazer/queries/_map.html.erb +8 -0
- data/app/views/blazer/queries/docs.html.erb +6 -6
- data/app/views/blazer/queries/edit.html.erb +1 -0
- data/app/views/blazer/queries/home.html.erb +101 -102
- data/app/views/blazer/queries/new.html.erb +1 -0
- data/app/views/blazer/queries/run.html.erb +23 -34
- data/app/views/blazer/queries/schema.html.erb +20 -20
- data/app/views/blazer/queries/show.html.erb +19 -12
- data/app/views/blazer/uploads/index.html.erb +10 -10
- data/app/views/layouts/blazer/application.html.erb +3 -3
- data/lib/blazer/adapters/athena_adapter.rb +12 -6
- data/lib/blazer/adapters/clickhouse_adapter.rb +136 -0
- data/lib/blazer/adapters/druid_adapter.rb +0 -2
- data/lib/blazer/adapters/snowflake2_adapter.rb +198 -0
- data/lib/blazer/adapters/soda_adapter.rb +0 -2
- data/lib/blazer/adapters/sql_adapter.rb +4 -0
- data/lib/blazer/adapters.rb +2 -0
- data/lib/blazer/check_types.rb +20 -0
- data/lib/blazer/email_notifier.rb +49 -0
- data/lib/blazer/result.rb +15 -0
- data/lib/blazer/slack_notifier.rb +39 -7
- data/lib/blazer/version.rb +1 -1
- data/lib/blazer.rb +32 -26
- data/lib/generators/blazer/templates/config.yml.tt +0 -2
- data/licenses/LICENSE-chart.js.txt +1 -1
- metadata +12 -31
- data/app/assets/javascripts/blazer/bootstrap.js +0 -2580
- data/app/assets/javascripts/blazer/jquery.js +0 -10872
- data/app/assets/javascripts/blazer/jquery.stickytableheaders.js +0 -325
- data/app/assets/javascripts/blazer/rails-ujs.js +0 -746
- data/app/assets/javascripts/blazer/selectize.js +0 -3891
- data/app/assets/javascripts/blazer/stupidtable-custom-settings.js +0 -13
- data/app/assets/javascripts/blazer/stupidtable.js +0 -281
- data/app/assets/javascripts/blazer/vue.global.prod.js +0 -1
- data/app/assets/stylesheets/blazer/selectize.css +0 -403
- data/licenses/LICENSE-jquery.txt +0 -20
- data/licenses/LICENSE-rails-ujs.txt +0 -20
- data/licenses/LICENSE-stickytableheaders.txt +0 -20
- data/licenses/LICENSE-stupidtable.txt +0 -19
- data/licenses/LICENSE-vue.txt +0 -21
- /data/licenses/{LICENSE-selectize.txt → LICENSE-tom-select.txt} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
* Sortable 1.
|
|
2
|
+
* Sortable 1.15.7
|
|
3
3
|
* @author RubaXa <trash@rubaxa.org>
|
|
4
4
|
* @author owenm <owen23355@gmail.com>
|
|
5
5
|
* @license MIT
|
|
@@ -8,140 +8,121 @@
|
|
|
8
8
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
9
9
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
10
10
|
(global = global || self, global.Sortable = factory());
|
|
11
|
-
}(this, function () { 'use strict';
|
|
11
|
+
}(this, (function () { 'use strict';
|
|
12
12
|
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
} else {
|
|
19
|
-
_typeof = function (obj) {
|
|
20
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return _typeof(obj);
|
|
13
|
+
function _arrayLikeToArray(r, a) {
|
|
14
|
+
(null == a || a > r.length) && (a = r.length);
|
|
15
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
16
|
+
return n;
|
|
25
17
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
obj[key] = value;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return obj;
|
|
18
|
+
function _arrayWithoutHoles(r) {
|
|
19
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
20
|
+
}
|
|
21
|
+
function _defineProperty(e, r, t) {
|
|
22
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
23
|
+
value: t,
|
|
24
|
+
enumerable: !0,
|
|
25
|
+
configurable: !0,
|
|
26
|
+
writable: !0
|
|
27
|
+
}) : e[r] = t, e;
|
|
40
28
|
}
|
|
41
|
-
|
|
42
29
|
function _extends() {
|
|
43
|
-
_extends = Object.assign
|
|
44
|
-
for (var
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
for (var key in source) {
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
49
|
-
target[key] = source[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
30
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
31
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
32
|
+
var t = arguments[e];
|
|
33
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
52
34
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return _extends.apply(this, arguments);
|
|
35
|
+
return n;
|
|
36
|
+
}, _extends.apply(null, arguments);
|
|
58
37
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_defineProperty(target, key, source[key]);
|
|
73
|
-
});
|
|
38
|
+
function _iterableToArray(r) {
|
|
39
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
40
|
+
}
|
|
41
|
+
function _nonIterableSpread() {
|
|
42
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
43
|
+
}
|
|
44
|
+
function ownKeys(e, r) {
|
|
45
|
+
var t = Object.keys(e);
|
|
46
|
+
if (Object.getOwnPropertySymbols) {
|
|
47
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
48
|
+
r && (o = o.filter(function (r) {
|
|
49
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
50
|
+
})), t.push.apply(t, o);
|
|
74
51
|
}
|
|
75
|
-
|
|
76
|
-
return target;
|
|
52
|
+
return t;
|
|
77
53
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
key = sourceKeys[i];
|
|
87
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
88
|
-
target[key] = source[key];
|
|
54
|
+
function _objectSpread2(e) {
|
|
55
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
56
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
57
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
58
|
+
_defineProperty(e, r, t[r]);
|
|
59
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
60
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
61
|
+
});
|
|
89
62
|
}
|
|
90
|
-
|
|
91
|
-
return target;
|
|
63
|
+
return e;
|
|
92
64
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var key, i;
|
|
100
|
-
|
|
65
|
+
function _objectWithoutProperties(e, t) {
|
|
66
|
+
if (null == e) return {};
|
|
67
|
+
var o,
|
|
68
|
+
r,
|
|
69
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
101
70
|
if (Object.getOwnPropertySymbols) {
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
105
|
-
key = sourceSymbolKeys[i];
|
|
106
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
107
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
108
|
-
target[key] = source[key];
|
|
109
|
-
}
|
|
71
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
72
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
110
73
|
}
|
|
111
|
-
|
|
112
|
-
return target;
|
|
74
|
+
return i;
|
|
113
75
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
76
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
77
|
+
if (null == r) return {};
|
|
78
|
+
var t = {};
|
|
79
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
80
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
81
|
+
t[n] = r[n];
|
|
82
|
+
}
|
|
83
|
+
return t;
|
|
117
84
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
85
|
+
function _toConsumableArray(r) {
|
|
86
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
87
|
+
}
|
|
88
|
+
function _toPrimitive(t, r) {
|
|
89
|
+
if ("object" != typeof t || !t) return t;
|
|
90
|
+
var e = t[Symbol.toPrimitive];
|
|
91
|
+
if (void 0 !== e) {
|
|
92
|
+
var i = e.call(t, r || "default");
|
|
93
|
+
if ("object" != typeof i) return i;
|
|
94
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
124
95
|
}
|
|
96
|
+
return ("string" === r ? String : Number)(t);
|
|
125
97
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
98
|
+
function _toPropertyKey(t) {
|
|
99
|
+
var i = _toPrimitive(t, "string");
|
|
100
|
+
return "symbol" == typeof i ? i : i + "";
|
|
129
101
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
102
|
+
function _typeof(o) {
|
|
103
|
+
"@babel/helpers - typeof";
|
|
104
|
+
|
|
105
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
106
|
+
return typeof o;
|
|
107
|
+
} : function (o) {
|
|
108
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
109
|
+
}, _typeof(o);
|
|
110
|
+
}
|
|
111
|
+
function _unsupportedIterableToArray(r, a) {
|
|
112
|
+
if (r) {
|
|
113
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
114
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
115
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
116
|
+
}
|
|
133
117
|
}
|
|
134
118
|
|
|
135
|
-
var version = "1.
|
|
119
|
+
var version = "1.15.7";
|
|
136
120
|
|
|
137
121
|
function userAgent(pattern) {
|
|
138
122
|
if (typeof window !== 'undefined' && window.navigator) {
|
|
139
|
-
return !!
|
|
140
|
-
/*@__PURE__*/
|
|
141
|
-
navigator.userAgent.match(pattern);
|
|
123
|
+
return !! /*@__PURE__*/navigator.userAgent.match(pattern);
|
|
142
124
|
}
|
|
143
125
|
}
|
|
144
|
-
|
|
145
126
|
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
|
|
146
127
|
var Edge = userAgent(/Edge/i);
|
|
147
128
|
var FireFox = userAgent(/firefox/i);
|
|
@@ -153,23 +134,15 @@
|
|
|
153
134
|
capture: false,
|
|
154
135
|
passive: false
|
|
155
136
|
};
|
|
156
|
-
|
|
157
137
|
function on(el, event, fn) {
|
|
158
138
|
el.addEventListener(event, fn, !IE11OrLess && captureMode);
|
|
159
139
|
}
|
|
160
|
-
|
|
161
140
|
function off(el, event, fn) {
|
|
162
141
|
el.removeEventListener(event, fn, !IE11OrLess && captureMode);
|
|
163
142
|
}
|
|
164
|
-
|
|
165
|
-
function matches(
|
|
166
|
-
/**HTMLElement*/
|
|
167
|
-
el,
|
|
168
|
-
/**String*/
|
|
169
|
-
selector) {
|
|
143
|
+
function matches( /**HTMLElement*/el, /**String*/selector) {
|
|
170
144
|
if (!selector) return;
|
|
171
145
|
selector[0] === '>' && (selector = selector.substring(1));
|
|
172
|
-
|
|
173
146
|
if (el) {
|
|
174
147
|
try {
|
|
175
148
|
if (el.matches) {
|
|
@@ -183,39 +156,25 @@
|
|
|
183
156
|
return false;
|
|
184
157
|
}
|
|
185
158
|
}
|
|
186
|
-
|
|
187
159
|
return false;
|
|
188
160
|
}
|
|
189
|
-
|
|
190
161
|
function getParentOrHost(el) {
|
|
191
|
-
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
|
|
162
|
+
return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
|
|
192
163
|
}
|
|
193
|
-
|
|
194
|
-
function closest(
|
|
195
|
-
/**HTMLElement*/
|
|
196
|
-
el,
|
|
197
|
-
/**String*/
|
|
198
|
-
selector,
|
|
199
|
-
/**HTMLElement*/
|
|
200
|
-
ctx, includeCTX) {
|
|
164
|
+
function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
|
|
201
165
|
if (el) {
|
|
202
166
|
ctx = ctx || document;
|
|
203
|
-
|
|
204
167
|
do {
|
|
205
168
|
if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
|
|
206
169
|
return el;
|
|
207
170
|
}
|
|
208
|
-
|
|
209
171
|
if (el === ctx) break;
|
|
210
172
|
/* jshint boss:true */
|
|
211
173
|
} while (el = getParentOrHost(el));
|
|
212
174
|
}
|
|
213
|
-
|
|
214
175
|
return null;
|
|
215
176
|
}
|
|
216
|
-
|
|
217
177
|
var R_SPACE = /\s+/g;
|
|
218
|
-
|
|
219
178
|
function toggleClass(el, name, state) {
|
|
220
179
|
if (el && name) {
|
|
221
180
|
if (el.classList) {
|
|
@@ -226,10 +185,8 @@
|
|
|
226
185
|
}
|
|
227
186
|
}
|
|
228
187
|
}
|
|
229
|
-
|
|
230
188
|
function css(el, prop, val) {
|
|
231
189
|
var style = el && el.style;
|
|
232
|
-
|
|
233
190
|
if (style) {
|
|
234
191
|
if (val === void 0) {
|
|
235
192
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
|
@@ -237,84 +194,68 @@
|
|
|
237
194
|
} else if (el.currentStyle) {
|
|
238
195
|
val = el.currentStyle;
|
|
239
196
|
}
|
|
240
|
-
|
|
241
197
|
return prop === void 0 ? val : val[prop];
|
|
242
198
|
} else {
|
|
243
199
|
if (!(prop in style) && prop.indexOf('webkit') === -1) {
|
|
244
200
|
prop = '-webkit-' + prop;
|
|
245
201
|
}
|
|
246
|
-
|
|
247
202
|
style[prop] = val + (typeof val === 'string' ? '' : 'px');
|
|
248
203
|
}
|
|
249
204
|
}
|
|
250
205
|
}
|
|
251
|
-
|
|
252
206
|
function matrix(el, selfOnly) {
|
|
253
207
|
var appliedTransforms = '';
|
|
254
|
-
|
|
255
208
|
if (typeof el === 'string') {
|
|
256
209
|
appliedTransforms = el;
|
|
257
210
|
} else {
|
|
258
211
|
do {
|
|
259
212
|
var transform = css(el, 'transform');
|
|
260
|
-
|
|
261
213
|
if (transform && transform !== 'none') {
|
|
262
214
|
appliedTransforms = transform + ' ' + appliedTransforms;
|
|
263
215
|
}
|
|
264
216
|
/* jshint boss:true */
|
|
265
|
-
|
|
266
217
|
} while (!selfOnly && (el = el.parentNode));
|
|
267
218
|
}
|
|
268
|
-
|
|
269
219
|
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
|
270
220
|
/*jshint -W056 */
|
|
271
|
-
|
|
272
221
|
return matrixFn && new matrixFn(appliedTransforms);
|
|
273
222
|
}
|
|
274
|
-
|
|
275
223
|
function find(ctx, tagName, iterator) {
|
|
276
224
|
if (ctx) {
|
|
277
225
|
var list = ctx.getElementsByTagName(tagName),
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
226
|
+
i = 0,
|
|
227
|
+
n = list.length;
|
|
281
228
|
if (iterator) {
|
|
282
229
|
for (; i < n; i++) {
|
|
283
230
|
iterator(list[i], i);
|
|
284
231
|
}
|
|
285
232
|
}
|
|
286
|
-
|
|
287
233
|
return list;
|
|
288
234
|
}
|
|
289
|
-
|
|
290
235
|
return [];
|
|
291
236
|
}
|
|
292
|
-
|
|
293
237
|
function getWindowScrollingElement() {
|
|
294
238
|
var scrollingElement = document.scrollingElement;
|
|
295
|
-
|
|
296
239
|
if (scrollingElement) {
|
|
297
240
|
return scrollingElement;
|
|
298
241
|
} else {
|
|
299
242
|
return document.documentElement;
|
|
300
243
|
}
|
|
301
244
|
}
|
|
302
|
-
/**
|
|
303
|
-
* Returns the "bounding client rect" of given element
|
|
304
|
-
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
|
305
|
-
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
|
306
|
-
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
|
307
|
-
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
|
308
|
-
* @param {[HTMLElement]} container The parent the element will be placed in
|
|
309
|
-
* @return {Object} The boundingClientRect of el, with specified adjustments
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Returns the "bounding client rect" of given element
|
|
248
|
+
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
|
249
|
+
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
|
250
|
+
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
|
251
|
+
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
|
252
|
+
* @param {[HTMLElement]} container The parent the element will be placed in
|
|
253
|
+
* @return {Object} The boundingClientRect of el, with specified adjustments
|
|
254
|
+
*/
|
|
313
255
|
function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
|
|
314
256
|
if (!el.getBoundingClientRect && el !== window) return;
|
|
315
257
|
var elRect, top, left, bottom, right, height, width;
|
|
316
|
-
|
|
317
|
-
if (el !== window && el !== getWindowScrollingElement()) {
|
|
258
|
+
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
|
|
318
259
|
elRect = el.getBoundingClientRect();
|
|
319
260
|
top = elRect.top;
|
|
320
261
|
left = elRect.left;
|
|
@@ -330,17 +271,18 @@
|
|
|
330
271
|
height = window.innerHeight;
|
|
331
272
|
width = window.innerWidth;
|
|
332
273
|
}
|
|
333
|
-
|
|
334
274
|
if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
|
|
335
275
|
// Adjust for translate()
|
|
336
|
-
container = container || el.parentNode;
|
|
337
|
-
// Not needed on <= IE11
|
|
276
|
+
container = container || el.parentNode;
|
|
338
277
|
|
|
278
|
+
// solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
|
|
279
|
+
// Not needed on <= IE11
|
|
339
280
|
if (!IE11OrLess) {
|
|
340
281
|
do {
|
|
341
282
|
if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
|
|
342
|
-
var containerRect = container.getBoundingClientRect();
|
|
283
|
+
var containerRect = container.getBoundingClientRect();
|
|
343
284
|
|
|
285
|
+
// Set relative to edges of padding box of container
|
|
344
286
|
top -= containerRect.top + parseInt(css(container, 'border-top-width'));
|
|
345
287
|
left -= containerRect.left + parseInt(css(container, 'border-left-width'));
|
|
346
288
|
bottom = top + elRect.height;
|
|
@@ -348,17 +290,14 @@
|
|
|
348
290
|
break;
|
|
349
291
|
}
|
|
350
292
|
/* jshint boss:true */
|
|
351
|
-
|
|
352
293
|
} while (container = container.parentNode);
|
|
353
294
|
}
|
|
354
295
|
}
|
|
355
|
-
|
|
356
296
|
if (undoScale && el !== window) {
|
|
357
297
|
// Adjust for scale()
|
|
358
298
|
var elMatrix = matrix(container || el),
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
299
|
+
scaleX = elMatrix && elMatrix.a,
|
|
300
|
+
scaleY = elMatrix && elMatrix.d;
|
|
362
301
|
if (elMatrix) {
|
|
363
302
|
top /= scaleY;
|
|
364
303
|
left /= scaleX;
|
|
@@ -368,7 +307,6 @@
|
|
|
368
307
|
right = left + width;
|
|
369
308
|
}
|
|
370
309
|
}
|
|
371
|
-
|
|
372
310
|
return {
|
|
373
311
|
top: top,
|
|
374
312
|
left: left,
|
|
@@ -378,165 +316,140 @@
|
|
|
378
316
|
height: height
|
|
379
317
|
};
|
|
380
318
|
}
|
|
381
|
-
/**
|
|
382
|
-
* Checks if a side of an element is scrolled past a side of its parents
|
|
383
|
-
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
|
384
|
-
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
|
385
|
-
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
|
386
|
-
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
|
387
|
-
*/
|
|
388
|
-
|
|
389
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Checks if a side of an element is scrolled past a side of its parents
|
|
322
|
+
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
|
323
|
+
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
|
324
|
+
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
|
325
|
+
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
|
326
|
+
*/
|
|
390
327
|
function isScrolledPast(el, elSide, parentSide) {
|
|
391
328
|
var parent = getParentAutoScrollElement(el, true),
|
|
392
|
-
|
|
393
|
-
/* jshint boss:true */
|
|
329
|
+
elSideVal = getRect(el)[elSide];
|
|
394
330
|
|
|
331
|
+
/* jshint boss:true */
|
|
395
332
|
while (parent) {
|
|
396
333
|
var parentSideVal = getRect(parent)[parentSide],
|
|
397
|
-
|
|
398
|
-
|
|
334
|
+
visible = void 0;
|
|
399
335
|
if (parentSide === 'top' || parentSide === 'left') {
|
|
400
336
|
visible = elSideVal >= parentSideVal;
|
|
401
337
|
} else {
|
|
402
338
|
visible = elSideVal <= parentSideVal;
|
|
403
339
|
}
|
|
404
|
-
|
|
405
340
|
if (!visible) return parent;
|
|
406
341
|
if (parent === getWindowScrollingElement()) break;
|
|
407
342
|
parent = getParentAutoScrollElement(parent, false);
|
|
408
343
|
}
|
|
409
|
-
|
|
410
344
|
return false;
|
|
411
345
|
}
|
|
412
|
-
/**
|
|
413
|
-
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
|
414
|
-
* and non-draggable elements
|
|
415
|
-
* @param {HTMLElement} el The parent element
|
|
416
|
-
* @param {Number} childNum The index of the child
|
|
417
|
-
* @param {Object} options Parent Sortable's options
|
|
418
|
-
* @return {HTMLElement} The child at index childNum, or null if not found
|
|
419
|
-
*/
|
|
420
|
-
|
|
421
346
|
|
|
422
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
|
349
|
+
* and non-draggable elements
|
|
350
|
+
* @param {HTMLElement} el The parent element
|
|
351
|
+
* @param {Number} childNum The index of the child
|
|
352
|
+
* @param {Object} options Parent Sortable's options
|
|
353
|
+
* @return {HTMLElement} The child at index childNum, or null if not found
|
|
354
|
+
*/
|
|
355
|
+
function getChild(el, childNum, options, includeDragEl) {
|
|
423
356
|
var currentChild = 0,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
357
|
+
i = 0,
|
|
358
|
+
children = el.children;
|
|
427
359
|
while (i < children.length) {
|
|
428
|
-
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) {
|
|
360
|
+
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
|
|
429
361
|
if (currentChild === childNum) {
|
|
430
362
|
return children[i];
|
|
431
363
|
}
|
|
432
|
-
|
|
433
364
|
currentChild++;
|
|
434
365
|
}
|
|
435
|
-
|
|
436
366
|
i++;
|
|
437
367
|
}
|
|
438
|
-
|
|
439
368
|
return null;
|
|
440
369
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
|
443
|
-
* @param {HTMLElement} el Parent element
|
|
444
|
-
* @param {selector} selector Any other elements that should be ignored
|
|
445
|
-
* @return {HTMLElement} The last child, ignoring ghostEl
|
|
446
|
-
*/
|
|
447
|
-
|
|
448
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
|
373
|
+
* @param {HTMLElement} el Parent element
|
|
374
|
+
* @param {selector} selector Any other elements that should be ignored
|
|
375
|
+
* @return {HTMLElement} The last child, ignoring ghostEl
|
|
376
|
+
*/
|
|
449
377
|
function lastChild(el, selector) {
|
|
450
378
|
var last = el.lastElementChild;
|
|
451
|
-
|
|
452
379
|
while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
|
|
453
380
|
last = last.previousElementSibling;
|
|
454
381
|
}
|
|
455
|
-
|
|
456
382
|
return last || null;
|
|
457
383
|
}
|
|
458
|
-
/**
|
|
459
|
-
* Returns the index of an element within its parent for a selected set of
|
|
460
|
-
* elements
|
|
461
|
-
* @param {HTMLElement} el
|
|
462
|
-
* @param {selector} selector
|
|
463
|
-
* @return {number}
|
|
464
|
-
*/
|
|
465
|
-
|
|
466
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Returns the index of an element within its parent for a selected set of
|
|
387
|
+
* elements
|
|
388
|
+
* @param {HTMLElement} el
|
|
389
|
+
* @param {selector} selector
|
|
390
|
+
* @return {number}
|
|
391
|
+
*/
|
|
467
392
|
function index(el, selector) {
|
|
468
393
|
var index = 0;
|
|
469
|
-
|
|
470
394
|
if (!el || !el.parentNode) {
|
|
471
395
|
return -1;
|
|
472
396
|
}
|
|
473
|
-
/* jshint boss:true */
|
|
474
|
-
|
|
475
397
|
|
|
398
|
+
/* jshint boss:true */
|
|
476
399
|
while (el = el.previousElementSibling) {
|
|
477
400
|
if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
|
|
478
401
|
index++;
|
|
479
402
|
}
|
|
480
403
|
}
|
|
481
|
-
|
|
482
404
|
return index;
|
|
483
405
|
}
|
|
484
|
-
/**
|
|
485
|
-
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
|
486
|
-
* The value is returned in real pixels.
|
|
487
|
-
* @param {HTMLElement} el
|
|
488
|
-
* @return {Array} Offsets in the format of [left, top]
|
|
489
|
-
*/
|
|
490
|
-
|
|
491
406
|
|
|
407
|
+
/**
|
|
408
|
+
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
|
409
|
+
* The value is returned in real pixels.
|
|
410
|
+
* @param {HTMLElement} el
|
|
411
|
+
* @return {Array} Offsets in the format of [left, top]
|
|
412
|
+
*/
|
|
492
413
|
function getRelativeScrollOffset(el) {
|
|
493
414
|
var offsetLeft = 0,
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
415
|
+
offsetTop = 0,
|
|
416
|
+
winScroller = getWindowScrollingElement();
|
|
497
417
|
if (el) {
|
|
498
418
|
do {
|
|
499
419
|
var elMatrix = matrix(el),
|
|
500
|
-
|
|
501
|
-
|
|
420
|
+
scaleX = elMatrix.a,
|
|
421
|
+
scaleY = elMatrix.d;
|
|
502
422
|
offsetLeft += el.scrollLeft * scaleX;
|
|
503
423
|
offsetTop += el.scrollTop * scaleY;
|
|
504
424
|
} while (el !== winScroller && (el = el.parentNode));
|
|
505
425
|
}
|
|
506
|
-
|
|
507
426
|
return [offsetLeft, offsetTop];
|
|
508
427
|
}
|
|
509
|
-
/**
|
|
510
|
-
* Returns the index of the object within the given array
|
|
511
|
-
* @param {Array} arr Array that may or may not hold the object
|
|
512
|
-
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
|
513
|
-
* @return {Number} The index of the object in the array, or -1
|
|
514
|
-
*/
|
|
515
|
-
|
|
516
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Returns the index of the object within the given array
|
|
431
|
+
* @param {Array} arr Array that may or may not hold the object
|
|
432
|
+
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
|
433
|
+
* @return {Number} The index of the object in the array, or -1
|
|
434
|
+
*/
|
|
517
435
|
function indexOfObject(arr, obj) {
|
|
518
436
|
for (var i in arr) {
|
|
519
437
|
if (!arr.hasOwnProperty(i)) continue;
|
|
520
|
-
|
|
521
438
|
for (var key in obj) {
|
|
522
439
|
if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
|
|
523
440
|
}
|
|
524
441
|
}
|
|
525
|
-
|
|
526
442
|
return -1;
|
|
527
443
|
}
|
|
528
|
-
|
|
529
444
|
function getParentAutoScrollElement(el, includeSelf) {
|
|
530
445
|
// skip to window
|
|
531
446
|
if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
|
|
532
447
|
var elem = el;
|
|
533
448
|
var gotSelf = false;
|
|
534
|
-
|
|
535
449
|
do {
|
|
536
450
|
// we don't need to get elem css if it isn't even overflowing in the first place (performance)
|
|
537
451
|
if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
|
|
538
452
|
var elemCSS = css(elem);
|
|
539
|
-
|
|
540
453
|
if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
|
|
541
454
|
if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
|
|
542
455
|
if (gotSelf || includeSelf) return elem;
|
|
@@ -544,12 +457,9 @@
|
|
|
544
457
|
}
|
|
545
458
|
}
|
|
546
459
|
/* jshint boss:true */
|
|
547
|
-
|
|
548
460
|
} while (elem = elem.parentNode);
|
|
549
|
-
|
|
550
461
|
return getWindowScrollingElement();
|
|
551
462
|
}
|
|
552
|
-
|
|
553
463
|
function extend(dst, src) {
|
|
554
464
|
if (dst && src) {
|
|
555
465
|
for (var key in src) {
|
|
@@ -558,49 +468,39 @@
|
|
|
558
468
|
}
|
|
559
469
|
}
|
|
560
470
|
}
|
|
561
|
-
|
|
562
471
|
return dst;
|
|
563
472
|
}
|
|
564
|
-
|
|
565
473
|
function isRectEqual(rect1, rect2) {
|
|
566
474
|
return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
|
|
567
475
|
}
|
|
568
|
-
|
|
569
476
|
var _throttleTimeout;
|
|
570
|
-
|
|
571
477
|
function throttle(callback, ms) {
|
|
572
478
|
return function () {
|
|
573
479
|
if (!_throttleTimeout) {
|
|
574
480
|
var args = arguments,
|
|
575
|
-
|
|
576
|
-
|
|
481
|
+
_this = this;
|
|
577
482
|
if (args.length === 1) {
|
|
578
483
|
callback.call(_this, args[0]);
|
|
579
484
|
} else {
|
|
580
485
|
callback.apply(_this, args);
|
|
581
486
|
}
|
|
582
|
-
|
|
583
487
|
_throttleTimeout = setTimeout(function () {
|
|
584
488
|
_throttleTimeout = void 0;
|
|
585
489
|
}, ms);
|
|
586
490
|
}
|
|
587
491
|
};
|
|
588
492
|
}
|
|
589
|
-
|
|
590
493
|
function cancelThrottle() {
|
|
591
494
|
clearTimeout(_throttleTimeout);
|
|
592
495
|
_throttleTimeout = void 0;
|
|
593
496
|
}
|
|
594
|
-
|
|
595
497
|
function scrollBy(el, x, y) {
|
|
596
498
|
el.scrollLeft += x;
|
|
597
499
|
el.scrollTop += y;
|
|
598
500
|
}
|
|
599
|
-
|
|
600
501
|
function clone(el) {
|
|
601
502
|
var Polymer = window.Polymer;
|
|
602
503
|
var $ = window.jQuery || window.Zepto;
|
|
603
|
-
|
|
604
504
|
if (Polymer && Polymer.dom) {
|
|
605
505
|
return Polymer.dom(el).cloneNode(true);
|
|
606
506
|
} else if ($) {
|
|
@@ -609,7 +509,6 @@
|
|
|
609
509
|
return el.cloneNode(true);
|
|
610
510
|
}
|
|
611
511
|
}
|
|
612
|
-
|
|
613
512
|
function setRect(el, rect) {
|
|
614
513
|
css(el, 'position', 'absolute');
|
|
615
514
|
css(el, 'top', rect.top);
|
|
@@ -617,7 +516,6 @@
|
|
|
617
516
|
css(el, 'width', rect.width);
|
|
618
517
|
css(el, 'height', rect.height);
|
|
619
518
|
}
|
|
620
|
-
|
|
621
519
|
function unsetRect(el) {
|
|
622
520
|
css(el, 'position', '');
|
|
623
521
|
css(el, 'top', '');
|
|
@@ -625,12 +523,28 @@
|
|
|
625
523
|
css(el, 'width', '');
|
|
626
524
|
css(el, 'height', '');
|
|
627
525
|
}
|
|
628
|
-
|
|
526
|
+
function getChildContainingRectFromElement(container, options, ghostEl) {
|
|
527
|
+
var rect = {};
|
|
528
|
+
Array.from(container.children).forEach(function (child) {
|
|
529
|
+
var _rect$left, _rect$top, _rect$right, _rect$bottom;
|
|
530
|
+
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
|
|
531
|
+
var childRect = getRect(child);
|
|
532
|
+
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
|
|
533
|
+
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
|
|
534
|
+
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
|
|
535
|
+
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
|
|
536
|
+
});
|
|
537
|
+
rect.width = rect.right - rect.left;
|
|
538
|
+
rect.height = rect.bottom - rect.top;
|
|
539
|
+
rect.x = rect.left;
|
|
540
|
+
rect.y = rect.top;
|
|
541
|
+
return rect;
|
|
542
|
+
}
|
|
629
543
|
var expando = 'Sortable' + new Date().getTime();
|
|
630
544
|
|
|
631
545
|
function AnimationStateManager() {
|
|
632
546
|
var animationStates = [],
|
|
633
|
-
|
|
547
|
+
animationCallbackId;
|
|
634
548
|
return {
|
|
635
549
|
captureAnimationState: function captureAnimationState() {
|
|
636
550
|
animationStates = [];
|
|
@@ -642,19 +556,16 @@
|
|
|
642
556
|
target: child,
|
|
643
557
|
rect: getRect(child)
|
|
644
558
|
});
|
|
559
|
+
var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
|
|
645
560
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
561
|
+
// If animating: compensate for current animation
|
|
649
562
|
if (child.thisAnimationDuration) {
|
|
650
563
|
var childMatrix = matrix(child, true);
|
|
651
|
-
|
|
652
564
|
if (childMatrix) {
|
|
653
565
|
fromRect.top -= childMatrix.f;
|
|
654
566
|
fromRect.left -= childMatrix.e;
|
|
655
567
|
}
|
|
656
568
|
}
|
|
657
|
-
|
|
658
569
|
child.fromRect = fromRect;
|
|
659
570
|
});
|
|
660
571
|
},
|
|
@@ -668,54 +579,47 @@
|
|
|
668
579
|
},
|
|
669
580
|
animateAll: function animateAll(callback) {
|
|
670
581
|
var _this = this;
|
|
671
|
-
|
|
672
582
|
if (!this.options.animation) {
|
|
673
583
|
clearTimeout(animationCallbackId);
|
|
674
584
|
if (typeof callback === 'function') callback();
|
|
675
585
|
return;
|
|
676
586
|
}
|
|
677
|
-
|
|
678
587
|
var animating = false,
|
|
679
|
-
|
|
588
|
+
animationTime = 0;
|
|
680
589
|
animationStates.forEach(function (state) {
|
|
681
590
|
var time = 0,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
591
|
+
target = state.target,
|
|
592
|
+
fromRect = target.fromRect,
|
|
593
|
+
toRect = getRect(target),
|
|
594
|
+
prevFromRect = target.prevFromRect,
|
|
595
|
+
prevToRect = target.prevToRect,
|
|
596
|
+
animatingRect = state.rect,
|
|
597
|
+
targetMatrix = matrix(target, true);
|
|
690
598
|
if (targetMatrix) {
|
|
691
599
|
// Compensate for current animation
|
|
692
600
|
toRect.top -= targetMatrix.f;
|
|
693
601
|
toRect.left -= targetMatrix.e;
|
|
694
602
|
}
|
|
695
|
-
|
|
696
603
|
target.toRect = toRect;
|
|
697
|
-
|
|
698
604
|
if (target.thisAnimationDuration) {
|
|
699
605
|
// Could also check if animatingRect is between fromRect and toRect
|
|
700
|
-
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
|
606
|
+
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
|
607
|
+
// Make sure animatingRect is on line between toRect & fromRect
|
|
701
608
|
(animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
|
|
702
609
|
// If returning to same place as started from animation and on same axis
|
|
703
610
|
time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
|
|
704
611
|
}
|
|
705
|
-
}
|
|
706
|
-
|
|
612
|
+
}
|
|
707
613
|
|
|
614
|
+
// if fromRect != toRect: animate
|
|
708
615
|
if (!isRectEqual(toRect, fromRect)) {
|
|
709
616
|
target.prevFromRect = fromRect;
|
|
710
617
|
target.prevToRect = toRect;
|
|
711
|
-
|
|
712
618
|
if (!time) {
|
|
713
619
|
time = _this.options.animation;
|
|
714
620
|
}
|
|
715
|
-
|
|
716
621
|
_this.animate(target, animatingRect, toRect, time);
|
|
717
622
|
}
|
|
718
|
-
|
|
719
623
|
if (time) {
|
|
720
624
|
animating = true;
|
|
721
625
|
animationTime = Math.max(animationTime, time);
|
|
@@ -731,7 +635,6 @@
|
|
|
731
635
|
}
|
|
732
636
|
});
|
|
733
637
|
clearTimeout(animationCallbackId);
|
|
734
|
-
|
|
735
638
|
if (!animating) {
|
|
736
639
|
if (typeof callback === 'function') callback();
|
|
737
640
|
} else {
|
|
@@ -739,7 +642,6 @@
|
|
|
739
642
|
if (typeof callback === 'function') callback();
|
|
740
643
|
}, animationTime);
|
|
741
644
|
}
|
|
742
|
-
|
|
743
645
|
animationStates = [];
|
|
744
646
|
},
|
|
745
647
|
animate: function animate(target, currentRect, toRect, duration) {
|
|
@@ -747,14 +649,14 @@
|
|
|
747
649
|
css(target, 'transition', '');
|
|
748
650
|
css(target, 'transform', '');
|
|
749
651
|
var elMatrix = matrix(this.el),
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
652
|
+
scaleX = elMatrix && elMatrix.a,
|
|
653
|
+
scaleY = elMatrix && elMatrix.d,
|
|
654
|
+
translateX = (currentRect.left - toRect.left) / (scaleX || 1),
|
|
655
|
+
translateY = (currentRect.top - toRect.top) / (scaleY || 1);
|
|
754
656
|
target.animatingX = !!translateX;
|
|
755
657
|
target.animatingY = !!translateY;
|
|
756
658
|
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
|
|
757
|
-
repaint(target); // repaint
|
|
659
|
+
this.forRepaintDummy = repaint(target); // repaint
|
|
758
660
|
|
|
759
661
|
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
|
|
760
662
|
css(target, 'transform', 'translate3d(0,0,0)');
|
|
@@ -770,11 +672,9 @@
|
|
|
770
672
|
}
|
|
771
673
|
};
|
|
772
674
|
}
|
|
773
|
-
|
|
774
675
|
function repaint(target) {
|
|
775
676
|
return target.offsetWidth;
|
|
776
677
|
}
|
|
777
|
-
|
|
778
678
|
function calculateRealTime(animatingRect, fromRect, toRect, options) {
|
|
779
679
|
return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
|
|
780
680
|
}
|
|
@@ -791,32 +691,33 @@
|
|
|
791
691
|
plugin[option] = defaults[option];
|
|
792
692
|
}
|
|
793
693
|
}
|
|
794
|
-
|
|
694
|
+
plugins.forEach(function (p) {
|
|
695
|
+
if (p.pluginName === plugin.pluginName) {
|
|
696
|
+
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
|
|
697
|
+
}
|
|
698
|
+
});
|
|
795
699
|
plugins.push(plugin);
|
|
796
700
|
},
|
|
797
701
|
pluginEvent: function pluginEvent(eventName, sortable, evt) {
|
|
798
702
|
var _this = this;
|
|
799
|
-
|
|
800
703
|
this.eventCanceled = false;
|
|
801
|
-
|
|
802
704
|
evt.cancel = function () {
|
|
803
705
|
_this.eventCanceled = true;
|
|
804
706
|
};
|
|
805
|
-
|
|
806
707
|
var eventNameGlobal = eventName + 'Global';
|
|
807
708
|
plugins.forEach(function (plugin) {
|
|
808
|
-
if (!sortable[plugin.pluginName]) return;
|
|
809
|
-
|
|
709
|
+
if (!sortable[plugin.pluginName]) return;
|
|
710
|
+
// Fire global events if it exists in this sortable
|
|
810
711
|
if (sortable[plugin.pluginName][eventNameGlobal]) {
|
|
811
|
-
sortable[plugin.pluginName][eventNameGlobal](
|
|
712
|
+
sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
|
|
812
713
|
sortable: sortable
|
|
813
714
|
}, evt));
|
|
814
|
-
}
|
|
815
|
-
// and plugin has event defined
|
|
816
|
-
|
|
715
|
+
}
|
|
817
716
|
|
|
717
|
+
// Only fire plugin event if plugin is enabled in this sortable,
|
|
718
|
+
// and plugin has event defined
|
|
818
719
|
if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
|
|
819
|
-
sortable[plugin.pluginName][eventName](
|
|
720
|
+
sortable[plugin.pluginName][eventName](_objectSpread2({
|
|
820
721
|
sortable: sortable
|
|
821
722
|
}, evt));
|
|
822
723
|
}
|
|
@@ -829,15 +730,14 @@
|
|
|
829
730
|
var initialized = new plugin(sortable, el, sortable.options);
|
|
830
731
|
initialized.sortable = sortable;
|
|
831
732
|
initialized.options = sortable.options;
|
|
832
|
-
sortable[pluginName] = initialized;
|
|
733
|
+
sortable[pluginName] = initialized;
|
|
833
734
|
|
|
735
|
+
// Add default options from plugin
|
|
834
736
|
_extends(defaults, initialized.defaults);
|
|
835
737
|
});
|
|
836
|
-
|
|
837
738
|
for (var option in sortable.options) {
|
|
838
739
|
if (!sortable.options.hasOwnProperty(option)) continue;
|
|
839
740
|
var modified = this.modifyOption(sortable, option, sortable.options[option]);
|
|
840
|
-
|
|
841
741
|
if (typeof modified !== 'undefined') {
|
|
842
742
|
sortable.options[option] = modified;
|
|
843
743
|
}
|
|
@@ -847,7 +747,6 @@
|
|
|
847
747
|
var eventProperties = {};
|
|
848
748
|
plugins.forEach(function (plugin) {
|
|
849
749
|
if (typeof plugin.eventProperties !== 'function') return;
|
|
850
|
-
|
|
851
750
|
_extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
|
|
852
751
|
});
|
|
853
752
|
return eventProperties;
|
|
@@ -856,8 +755,9 @@
|
|
|
856
755
|
var modifiedValue;
|
|
857
756
|
plugins.forEach(function (plugin) {
|
|
858
757
|
// Plugin must exist on the Sortable
|
|
859
|
-
if (!sortable[plugin.pluginName]) return;
|
|
758
|
+
if (!sortable[plugin.pluginName]) return;
|
|
860
759
|
|
|
760
|
+
// If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
|
|
861
761
|
if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
|
|
862
762
|
modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
|
|
863
763
|
}
|
|
@@ -868,25 +768,25 @@
|
|
|
868
768
|
|
|
869
769
|
function dispatchEvent(_ref) {
|
|
870
770
|
var sortable = _ref.sortable,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
771
|
+
rootEl = _ref.rootEl,
|
|
772
|
+
name = _ref.name,
|
|
773
|
+
targetEl = _ref.targetEl,
|
|
774
|
+
cloneEl = _ref.cloneEl,
|
|
775
|
+
toEl = _ref.toEl,
|
|
776
|
+
fromEl = _ref.fromEl,
|
|
777
|
+
oldIndex = _ref.oldIndex,
|
|
778
|
+
newIndex = _ref.newIndex,
|
|
779
|
+
oldDraggableIndex = _ref.oldDraggableIndex,
|
|
780
|
+
newDraggableIndex = _ref.newDraggableIndex,
|
|
781
|
+
originalEvent = _ref.originalEvent,
|
|
782
|
+
putSortable = _ref.putSortable,
|
|
783
|
+
extraEventProperties = _ref.extraEventProperties;
|
|
884
784
|
sortable = sortable || rootEl && rootEl[expando];
|
|
885
785
|
if (!sortable) return;
|
|
886
786
|
var evt,
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
787
|
+
options = sortable.options,
|
|
788
|
+
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
|
|
789
|
+
// Support for new CustomEvent feature
|
|
890
790
|
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
|
891
791
|
evt = new CustomEvent(name, {
|
|
892
792
|
bubbles: true,
|
|
@@ -896,7 +796,6 @@
|
|
|
896
796
|
evt = document.createEvent('Event');
|
|
897
797
|
evt.initEvent(name, true, true);
|
|
898
798
|
}
|
|
899
|
-
|
|
900
799
|
evt.to = toEl || rootEl;
|
|
901
800
|
evt.from = fromEl || rootEl;
|
|
902
801
|
evt.item = targetEl || rootEl;
|
|
@@ -907,28 +806,24 @@
|
|
|
907
806
|
evt.newDraggableIndex = newDraggableIndex;
|
|
908
807
|
evt.originalEvent = originalEvent;
|
|
909
808
|
evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
|
|
910
|
-
|
|
911
|
-
var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable));
|
|
912
|
-
|
|
809
|
+
var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
|
|
913
810
|
for (var option in allEventProperties) {
|
|
914
811
|
evt[option] = allEventProperties[option];
|
|
915
812
|
}
|
|
916
|
-
|
|
917
813
|
if (rootEl) {
|
|
918
814
|
rootEl.dispatchEvent(evt);
|
|
919
815
|
}
|
|
920
|
-
|
|
921
816
|
if (options[onName]) {
|
|
922
817
|
options[onName].call(sortable, evt);
|
|
923
818
|
}
|
|
924
819
|
}
|
|
925
820
|
|
|
821
|
+
var _excluded = ["evt"];
|
|
926
822
|
var pluginEvent = function pluginEvent(eventName, sortable) {
|
|
927
823
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({
|
|
824
|
+
originalEvent = _ref.evt,
|
|
825
|
+
data = _objectWithoutProperties(_ref, _excluded);
|
|
826
|
+
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
|
|
932
827
|
dragEl: dragEl,
|
|
933
828
|
parentEl: parentEl,
|
|
934
829
|
ghostEl: ghostEl,
|
|
@@ -962,9 +857,8 @@
|
|
|
962
857
|
}
|
|
963
858
|
}, data));
|
|
964
859
|
};
|
|
965
|
-
|
|
966
860
|
function _dispatchEvent(info) {
|
|
967
|
-
dispatchEvent(
|
|
861
|
+
dispatchEvent(_objectSpread2({
|
|
968
862
|
putSortable: putSortable,
|
|
969
863
|
cloneEl: cloneEl,
|
|
970
864
|
targetEl: dragEl,
|
|
@@ -975,62 +869,61 @@
|
|
|
975
869
|
newDraggableIndex: newDraggableIndex
|
|
976
870
|
}, info));
|
|
977
871
|
}
|
|
978
|
-
|
|
979
872
|
var dragEl,
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
873
|
+
parentEl,
|
|
874
|
+
ghostEl,
|
|
875
|
+
rootEl,
|
|
876
|
+
nextEl,
|
|
877
|
+
lastDownEl,
|
|
878
|
+
cloneEl,
|
|
879
|
+
cloneHidden,
|
|
880
|
+
oldIndex,
|
|
881
|
+
newIndex,
|
|
882
|
+
oldDraggableIndex,
|
|
883
|
+
newDraggableIndex,
|
|
884
|
+
activeGroup,
|
|
885
|
+
putSortable,
|
|
886
|
+
awaitingDragStarted = false,
|
|
887
|
+
ignoreNextClick = false,
|
|
888
|
+
sortables = [],
|
|
889
|
+
tapEvt,
|
|
890
|
+
touchEvt,
|
|
891
|
+
lastDx,
|
|
892
|
+
lastDy,
|
|
893
|
+
tapDistanceLeft,
|
|
894
|
+
tapDistanceTop,
|
|
895
|
+
moved,
|
|
896
|
+
lastTarget,
|
|
897
|
+
lastDirection,
|
|
898
|
+
pastFirstInvertThresh = false,
|
|
899
|
+
isCircumstantialInvert = false,
|
|
900
|
+
targetMoveDistance,
|
|
901
|
+
// For positioning ghost absolutely
|
|
902
|
+
ghostRelativeParent,
|
|
903
|
+
ghostRelativeParentInitialScroll = [],
|
|
904
|
+
// (left, top)
|
|
905
|
+
|
|
906
|
+
_silent = false,
|
|
907
|
+
savedInputChecked = [];
|
|
1015
908
|
|
|
909
|
+
/** @const */
|
|
1016
910
|
var documentExists = typeof document !== 'undefined',
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
var elCSS = css(el),
|
|
911
|
+
PositionGhostAbsolutely = IOS,
|
|
912
|
+
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
|
|
913
|
+
// This will not pass for IE9, because IE9 DnD only works on anchors
|
|
914
|
+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
|
|
915
|
+
supportCssPointerEvents = function () {
|
|
916
|
+
if (!documentExists) return;
|
|
917
|
+
// false when <= IE11
|
|
918
|
+
if (IE11OrLess) {
|
|
919
|
+
return false;
|
|
920
|
+
}
|
|
921
|
+
var el = document.createElement('x');
|
|
922
|
+
el.style.cssText = 'pointer-events:auto';
|
|
923
|
+
return el.style.pointerEvents === 'auto';
|
|
924
|
+
}(),
|
|
925
|
+
_detectDirection = function _detectDirection(el, options) {
|
|
926
|
+
var elCSS = css(el),
|
|
1034
927
|
elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
|
|
1035
928
|
child1 = getChild(el, 0, options),
|
|
1036
929
|
child2 = getChild(el, 1, options),
|
|
@@ -1038,103 +931,93 @@
|
|
|
1038
931
|
secondChildCSS = child2 && css(child2),
|
|
1039
932
|
firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
|
|
1040
933
|
secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
|
1056
|
-
},
|
|
1057
|
-
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
|
1058
|
-
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
|
934
|
+
if (elCSS.display === 'flex') {
|
|
935
|
+
return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
|
|
936
|
+
}
|
|
937
|
+
if (elCSS.display === 'grid') {
|
|
938
|
+
return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
|
|
939
|
+
}
|
|
940
|
+
if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
|
|
941
|
+
var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
|
|
942
|
+
return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
|
|
943
|
+
}
|
|
944
|
+
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
|
945
|
+
},
|
|
946
|
+
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
|
947
|
+
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
|
1059
948
|
dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
|
|
1060
949
|
dragElOppLength = vertical ? dragRect.width : dragRect.height,
|
|
1061
950
|
targetS1Opp = vertical ? targetRect.left : targetRect.top,
|
|
1062
951
|
targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
|
|
1063
952
|
targetOppLength = vertical ? targetRect.width : targetRect.height;
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
threshold = sortable[expando].options.emptyInsertThreshold,
|
|
953
|
+
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
|
954
|
+
},
|
|
955
|
+
/**
|
|
956
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
|
957
|
+
* @param {Number} x X position
|
|
958
|
+
* @param {Number} y Y position
|
|
959
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
|
960
|
+
*/
|
|
961
|
+
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
|
962
|
+
var ret;
|
|
963
|
+
sortables.some(function (sortable) {
|
|
964
|
+
var threshold = sortable[expando].options.emptyInsertThreshold;
|
|
965
|
+
if (!threshold || lastChild(sortable)) return;
|
|
966
|
+
var rect = getRect(sortable),
|
|
1079
967
|
insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
|
|
1080
968
|
insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
return ret = sortable;
|
|
1084
|
-
}
|
|
1085
|
-
});
|
|
1086
|
-
return ret;
|
|
1087
|
-
},
|
|
1088
|
-
_prepareGroup = function _prepareGroup(options) {
|
|
1089
|
-
function toFn(value, pull) {
|
|
1090
|
-
return function (to, from, dragEl, evt) {
|
|
1091
|
-
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
|
1092
|
-
|
|
1093
|
-
if (value == null && (pull || sameGroup)) {
|
|
1094
|
-
// Default pull value
|
|
1095
|
-
// Default pull and put value if same group
|
|
1096
|
-
return true;
|
|
1097
|
-
} else if (value == null || value === false) {
|
|
1098
|
-
return false;
|
|
1099
|
-
} else if (pull && value === 'clone') {
|
|
1100
|
-
return value;
|
|
1101
|
-
} else if (typeof value === 'function') {
|
|
1102
|
-
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
|
1103
|
-
} else {
|
|
1104
|
-
var otherGroup = (pull ? to : from).options.group.name;
|
|
1105
|
-
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
|
969
|
+
if (insideHorizontally && insideVertically) {
|
|
970
|
+
return ret = sortable;
|
|
1106
971
|
}
|
|
1107
|
-
};
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
972
|
+
});
|
|
973
|
+
return ret;
|
|
974
|
+
},
|
|
975
|
+
_prepareGroup = function _prepareGroup(options) {
|
|
976
|
+
function toFn(value, pull) {
|
|
977
|
+
return function (to, from, dragEl, evt) {
|
|
978
|
+
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
|
979
|
+
if (value == null && (pull || sameGroup)) {
|
|
980
|
+
// Default pull value
|
|
981
|
+
// Default pull and put value if same group
|
|
982
|
+
return true;
|
|
983
|
+
} else if (value == null || value === false) {
|
|
984
|
+
return false;
|
|
985
|
+
} else if (pull && value === 'clone') {
|
|
986
|
+
return value;
|
|
987
|
+
} else if (typeof value === 'function') {
|
|
988
|
+
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
|
989
|
+
} else {
|
|
990
|
+
var otherGroup = (pull ? to : from).options.group.name;
|
|
991
|
+
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
var group = {};
|
|
996
|
+
var originalGroup = options.group;
|
|
997
|
+
if (!originalGroup || _typeof(originalGroup) != 'object') {
|
|
998
|
+
originalGroup = {
|
|
999
|
+
name: originalGroup
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
group.name = originalGroup.name;
|
|
1003
|
+
group.checkPull = toFn(originalGroup.pull, true);
|
|
1004
|
+
group.checkPut = toFn(originalGroup.put);
|
|
1005
|
+
group.revertClone = originalGroup.revertClone;
|
|
1006
|
+
options.group = group;
|
|
1007
|
+
},
|
|
1008
|
+
_hideGhostForTarget = function _hideGhostForTarget() {
|
|
1009
|
+
if (!supportCssPointerEvents && ghostEl) {
|
|
1010
|
+
css(ghostEl, 'display', 'none');
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
_unhideGhostForTarget = function _unhideGhostForTarget() {
|
|
1014
|
+
if (!supportCssPointerEvents && ghostEl) {
|
|
1015
|
+
css(ghostEl, 'display', '');
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1136
1018
|
|
|
1137
|
-
if
|
|
1019
|
+
// #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
|
1020
|
+
if (documentExists && !ChromeForAndroid) {
|
|
1138
1021
|
document.addEventListener('click', function (evt) {
|
|
1139
1022
|
if (ignoreNextClick) {
|
|
1140
1023
|
evt.preventDefault();
|
|
@@ -1145,53 +1028,44 @@
|
|
|
1145
1028
|
}
|
|
1146
1029
|
}, true);
|
|
1147
1030
|
}
|
|
1148
|
-
|
|
1149
1031
|
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
|
|
1150
1032
|
if (dragEl) {
|
|
1151
1033
|
evt = evt.touches ? evt.touches[0] : evt;
|
|
1152
|
-
|
|
1153
1034
|
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
|
1154
|
-
|
|
1155
1035
|
if (nearest) {
|
|
1156
1036
|
// Create imitation event
|
|
1157
1037
|
var event = {};
|
|
1158
|
-
|
|
1159
1038
|
for (var i in evt) {
|
|
1160
1039
|
if (evt.hasOwnProperty(i)) {
|
|
1161
1040
|
event[i] = evt[i];
|
|
1162
1041
|
}
|
|
1163
1042
|
}
|
|
1164
|
-
|
|
1165
1043
|
event.target = event.rootEl = nearest;
|
|
1166
1044
|
event.preventDefault = void 0;
|
|
1167
1045
|
event.stopPropagation = void 0;
|
|
1168
|
-
|
|
1169
1046
|
nearest[expando]._onDragOver(event);
|
|
1170
1047
|
}
|
|
1171
1048
|
}
|
|
1172
1049
|
};
|
|
1173
|
-
|
|
1174
1050
|
var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
|
|
1175
1051
|
if (dragEl) {
|
|
1176
1052
|
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
|
1177
1053
|
}
|
|
1178
1054
|
};
|
|
1055
|
+
|
|
1179
1056
|
/**
|
|
1180
1057
|
* @class Sortable
|
|
1181
1058
|
* @param {HTMLElement} el
|
|
1182
1059
|
* @param {Object} [options]
|
|
1183
1060
|
*/
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
1061
|
function Sortable(el, options) {
|
|
1187
1062
|
if (!(el && el.nodeType && el.nodeType === 1)) {
|
|
1188
1063
|
throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
|
|
1189
1064
|
}
|
|
1190
|
-
|
|
1191
1065
|
this.el = el; // root element
|
|
1066
|
+
this.options = options = _extends({}, options);
|
|
1192
1067
|
|
|
1193
|
-
|
|
1194
|
-
|
|
1068
|
+
// Export instance
|
|
1195
1069
|
el[expando] = this;
|
|
1196
1070
|
var defaults = {
|
|
1197
1071
|
group: null,
|
|
@@ -1235,55 +1109,52 @@
|
|
|
1235
1109
|
x: 0,
|
|
1236
1110
|
y: 0
|
|
1237
1111
|
},
|
|
1238
|
-
|
|
1112
|
+
// Disabled on Safari: #1571; Enabled on Safari IOS: #2244
|
|
1113
|
+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
|
|
1239
1114
|
emptyInsertThreshold: 5
|
|
1240
1115
|
};
|
|
1241
|
-
PluginManager.initializePlugins(this, el, defaults);
|
|
1116
|
+
PluginManager.initializePlugins(this, el, defaults);
|
|
1242
1117
|
|
|
1118
|
+
// Set default options
|
|
1243
1119
|
for (var name in defaults) {
|
|
1244
1120
|
!(name in options) && (options[name] = defaults[name]);
|
|
1245
1121
|
}
|
|
1122
|
+
_prepareGroup(options);
|
|
1246
1123
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1124
|
+
// Bind all private methods
|
|
1250
1125
|
for (var fn in this) {
|
|
1251
1126
|
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
|
1252
1127
|
this[fn] = this[fn].bind(this);
|
|
1253
1128
|
}
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1129
|
+
}
|
|
1256
1130
|
|
|
1131
|
+
// Setup drag mode
|
|
1257
1132
|
this.nativeDraggable = options.forceFallback ? false : supportDraggable;
|
|
1258
|
-
|
|
1259
1133
|
if (this.nativeDraggable) {
|
|
1260
1134
|
// Touch start threshold cannot be greater than the native dragstart threshold
|
|
1261
1135
|
this.options.touchStartThreshold = 1;
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1136
|
+
}
|
|
1264
1137
|
|
|
1138
|
+
// Bind events
|
|
1265
1139
|
if (options.supportPointer) {
|
|
1266
1140
|
on(el, 'pointerdown', this._onTapStart);
|
|
1267
1141
|
} else {
|
|
1268
1142
|
on(el, 'mousedown', this._onTapStart);
|
|
1269
1143
|
on(el, 'touchstart', this._onTapStart);
|
|
1270
1144
|
}
|
|
1271
|
-
|
|
1272
1145
|
if (this.nativeDraggable) {
|
|
1273
1146
|
on(el, 'dragover', this);
|
|
1274
1147
|
on(el, 'dragenter', this);
|
|
1275
1148
|
}
|
|
1149
|
+
sortables.push(this.el);
|
|
1276
1150
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
|
|
1151
|
+
// Restore sorting
|
|
1152
|
+
options.store && options.store.get && this.sort(options.store.get(this) || []);
|
|
1280
1153
|
|
|
1154
|
+
// Add animation state manager
|
|
1281
1155
|
_extends(this, AnimationStateManager());
|
|
1282
1156
|
}
|
|
1283
|
-
|
|
1284
|
-
Sortable.prototype =
|
|
1285
|
-
/** @lends Sortable.prototype */
|
|
1286
|
-
{
|
|
1157
|
+
Sortable.prototype = /** @lends Sortable.prototype */{
|
|
1287
1158
|
constructor: Sortable,
|
|
1288
1159
|
_isOutsideThisEl: function _isOutsideThisEl(target) {
|
|
1289
1160
|
if (!this.el.contains(target) && target !== this.el) {
|
|
@@ -1293,52 +1164,50 @@
|
|
|
1293
1164
|
_getDirection: function _getDirection(evt, target) {
|
|
1294
1165
|
return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
|
|
1295
1166
|
},
|
|
1296
|
-
_onTapStart: function _onTapStart(
|
|
1297
|
-
/** Event|TouchEvent */
|
|
1298
|
-
evt) {
|
|
1167
|
+
_onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
|
|
1299
1168
|
if (!evt.cancelable) return;
|
|
1300
|
-
|
|
1301
1169
|
var _this = this,
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1170
|
+
el = this.el,
|
|
1171
|
+
options = this.options,
|
|
1172
|
+
preventOnFilter = options.preventOnFilter,
|
|
1173
|
+
type = evt.type,
|
|
1174
|
+
touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
|
|
1175
|
+
target = (touch || evt).target,
|
|
1176
|
+
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
|
|
1177
|
+
filter = options.filter;
|
|
1178
|
+
_saveInputCheckedState(el);
|
|
1179
|
+
|
|
1180
|
+
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
|
|
1314
1181
|
if (dragEl) {
|
|
1315
1182
|
return;
|
|
1316
1183
|
}
|
|
1317
|
-
|
|
1318
1184
|
if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
|
|
1319
1185
|
return; // only left button and enabled
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1186
|
+
}
|
|
1322
1187
|
|
|
1188
|
+
// cancel dnd if original target is content editable
|
|
1323
1189
|
if (originalTarget.isContentEditable) {
|
|
1324
1190
|
return;
|
|
1325
1191
|
}
|
|
1326
1192
|
|
|
1193
|
+
// Safari ignores further event handling after mousedown
|
|
1194
|
+
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1327
1197
|
target = closest(target, options.draggable, el, false);
|
|
1328
|
-
|
|
1329
1198
|
if (target && target.animated) {
|
|
1330
1199
|
return;
|
|
1331
1200
|
}
|
|
1332
|
-
|
|
1333
1201
|
if (lastDownEl === target) {
|
|
1334
1202
|
// Ignoring duplicate `down`
|
|
1335
1203
|
return;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1204
|
+
}
|
|
1338
1205
|
|
|
1206
|
+
// Get the index of the dragged element within its parent
|
|
1339
1207
|
oldIndex = index(target);
|
|
1340
|
-
oldDraggableIndex = index(target, options.draggable);
|
|
1208
|
+
oldDraggableIndex = index(target, options.draggable);
|
|
1341
1209
|
|
|
1210
|
+
// Check filter
|
|
1342
1211
|
if (typeof filter === 'function') {
|
|
1343
1212
|
if (filter.call(this, evt, target, this)) {
|
|
1344
1213
|
_dispatchEvent({
|
|
@@ -1349,17 +1218,15 @@
|
|
|
1349
1218
|
toEl: el,
|
|
1350
1219
|
fromEl: el
|
|
1351
1220
|
});
|
|
1352
|
-
|
|
1353
1221
|
pluginEvent('filter', _this, {
|
|
1354
1222
|
evt: evt
|
|
1355
1223
|
});
|
|
1356
|
-
preventOnFilter && evt.
|
|
1224
|
+
preventOnFilter && evt.preventDefault();
|
|
1357
1225
|
return; // cancel dnd
|
|
1358
1226
|
}
|
|
1359
1227
|
} else if (filter) {
|
|
1360
1228
|
filter = filter.split(',').some(function (criteria) {
|
|
1361
1229
|
criteria = closest(originalTarget, criteria.trim(), el, false);
|
|
1362
|
-
|
|
1363
1230
|
if (criteria) {
|
|
1364
1231
|
_dispatchEvent({
|
|
1365
1232
|
sortable: _this,
|
|
@@ -1369,40 +1236,30 @@
|
|
|
1369
1236
|
fromEl: el,
|
|
1370
1237
|
toEl: el
|
|
1371
1238
|
});
|
|
1372
|
-
|
|
1373
1239
|
pluginEvent('filter', _this, {
|
|
1374
1240
|
evt: evt
|
|
1375
1241
|
});
|
|
1376
1242
|
return true;
|
|
1377
1243
|
}
|
|
1378
1244
|
});
|
|
1379
|
-
|
|
1380
1245
|
if (filter) {
|
|
1381
|
-
preventOnFilter && evt.
|
|
1246
|
+
preventOnFilter && evt.preventDefault();
|
|
1382
1247
|
return; // cancel dnd
|
|
1383
1248
|
}
|
|
1384
1249
|
}
|
|
1385
|
-
|
|
1386
1250
|
if (options.handle && !closest(originalTarget, options.handle, el, false)) {
|
|
1387
1251
|
return;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1252
|
+
}
|
|
1390
1253
|
|
|
1254
|
+
// Prepare `dragstart`
|
|
1391
1255
|
this._prepareDragStart(evt, touch, target);
|
|
1392
1256
|
},
|
|
1393
|
-
_prepareDragStart: function _prepareDragStart(
|
|
1394
|
-
/** Event */
|
|
1395
|
-
evt,
|
|
1396
|
-
/** Touch */
|
|
1397
|
-
touch,
|
|
1398
|
-
/** HTMLElement */
|
|
1399
|
-
target) {
|
|
1257
|
+
_prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
|
|
1400
1258
|
var _this = this,
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1259
|
+
el = _this.el,
|
|
1260
|
+
options = _this.options,
|
|
1261
|
+
ownerDocument = el.ownerDocument,
|
|
1262
|
+
dragStartFn;
|
|
1406
1263
|
if (target && !dragEl && target.parentNode === el) {
|
|
1407
1264
|
var dragRect = getRect(target);
|
|
1408
1265
|
rootEl = el;
|
|
@@ -1422,73 +1279,78 @@
|
|
|
1422
1279
|
this._lastX = (touch || evt).clientX;
|
|
1423
1280
|
this._lastY = (touch || evt).clientY;
|
|
1424
1281
|
dragEl.style['will-change'] = 'all';
|
|
1425
|
-
|
|
1426
1282
|
dragStartFn = function dragStartFn() {
|
|
1427
1283
|
pluginEvent('delayEnded', _this, {
|
|
1428
1284
|
evt: evt
|
|
1429
1285
|
});
|
|
1430
|
-
|
|
1431
1286
|
if (Sortable.eventCanceled) {
|
|
1432
1287
|
_this._onDrop();
|
|
1433
|
-
|
|
1434
1288
|
return;
|
|
1435
|
-
}
|
|
1289
|
+
}
|
|
1290
|
+
// Delayed drag has been triggered
|
|
1436
1291
|
// we can re-enable the events: touchmove/mousemove
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
1292
|
_this._disableDelayedDragEvents();
|
|
1440
|
-
|
|
1441
1293
|
if (!FireFox && _this.nativeDraggable) {
|
|
1442
1294
|
dragEl.draggable = true;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
_this._triggerDragStart(evt, touch); // Drag start event
|
|
1295
|
+
}
|
|
1447
1296
|
|
|
1297
|
+
// Bind the events: dragstart/dragend
|
|
1298
|
+
_this._triggerDragStart(evt, touch);
|
|
1448
1299
|
|
|
1300
|
+
// Drag start event
|
|
1449
1301
|
_dispatchEvent({
|
|
1450
1302
|
sortable: _this,
|
|
1451
1303
|
name: 'choose',
|
|
1452
1304
|
originalEvent: evt
|
|
1453
|
-
});
|
|
1454
|
-
|
|
1305
|
+
});
|
|
1455
1306
|
|
|
1307
|
+
// Chosen item
|
|
1456
1308
|
toggleClass(dragEl, options.chosenClass, true);
|
|
1457
|
-
};
|
|
1458
|
-
|
|
1309
|
+
};
|
|
1459
1310
|
|
|
1311
|
+
// Disable "draggable"
|
|
1460
1312
|
options.ignore.split(',').forEach(function (criteria) {
|
|
1461
1313
|
find(dragEl, criteria.trim(), _disableDraggable);
|
|
1462
1314
|
});
|
|
1463
1315
|
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
|
|
1464
1316
|
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
|
|
1465
1317
|
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1318
|
+
if (options.supportPointer) {
|
|
1319
|
+
on(ownerDocument, 'pointerup', _this._onDrop);
|
|
1320
|
+
// Native D&D triggers pointercancel
|
|
1321
|
+
!this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
|
|
1322
|
+
} else {
|
|
1323
|
+
on(ownerDocument, 'mouseup', _this._onDrop);
|
|
1324
|
+
on(ownerDocument, 'touchend', _this._onDrop);
|
|
1325
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
|
1326
|
+
}
|
|
1469
1327
|
|
|
1328
|
+
// Make dragEl draggable (must be before delay for FireFox)
|
|
1470
1329
|
if (FireFox && this.nativeDraggable) {
|
|
1471
1330
|
this.options.touchStartThreshold = 4;
|
|
1472
1331
|
dragEl.draggable = true;
|
|
1473
1332
|
}
|
|
1474
|
-
|
|
1475
1333
|
pluginEvent('delayStart', this, {
|
|
1476
1334
|
evt: evt
|
|
1477
|
-
});
|
|
1335
|
+
});
|
|
1478
1336
|
|
|
1337
|
+
// Delay is impossible for native DnD in Edge or IE
|
|
1479
1338
|
if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
|
|
1480
1339
|
if (Sortable.eventCanceled) {
|
|
1481
1340
|
this._onDrop();
|
|
1482
|
-
|
|
1483
1341
|
return;
|
|
1484
|
-
}
|
|
1342
|
+
}
|
|
1343
|
+
// If the user moves the pointer or let go the click or touch
|
|
1485
1344
|
// before the delay has been reached:
|
|
1486
1345
|
// disable the delayed drag
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1346
|
+
if (options.supportPointer) {
|
|
1347
|
+
on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
|
|
1348
|
+
on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
|
|
1349
|
+
} else {
|
|
1350
|
+
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
|
1351
|
+
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
|
1352
|
+
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
|
1353
|
+
}
|
|
1492
1354
|
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
|
|
1493
1355
|
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
|
|
1494
1356
|
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
|
|
@@ -1498,11 +1360,8 @@
|
|
|
1498
1360
|
}
|
|
1499
1361
|
}
|
|
1500
1362
|
},
|
|
1501
|
-
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
|
|
1502
|
-
/** TouchEvent|PointerEvent **/
|
|
1503
|
-
e) {
|
|
1363
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
|
|
1504
1364
|
var touch = e.touches ? e.touches[0] : e;
|
|
1505
|
-
|
|
1506
1365
|
if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
|
|
1507
1366
|
this._disableDelayedDrag();
|
|
1508
1367
|
}
|
|
@@ -1510,7 +1369,6 @@
|
|
|
1510
1369
|
_disableDelayedDrag: function _disableDelayedDrag() {
|
|
1511
1370
|
dragEl && _disableDraggable(dragEl);
|
|
1512
1371
|
clearTimeout(this._dragStartTimer);
|
|
1513
|
-
|
|
1514
1372
|
this._disableDelayedDragEvents();
|
|
1515
1373
|
},
|
|
1516
1374
|
_disableDelayedDragEvents: function _disableDelayedDragEvents() {
|
|
@@ -1518,17 +1376,14 @@
|
|
|
1518
1376
|
off(ownerDocument, 'mouseup', this._disableDelayedDrag);
|
|
1519
1377
|
off(ownerDocument, 'touchend', this._disableDelayedDrag);
|
|
1520
1378
|
off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
|
|
1379
|
+
off(ownerDocument, 'pointerup', this._disableDelayedDrag);
|
|
1380
|
+
off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
|
|
1521
1381
|
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
|
|
1522
1382
|
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
|
1523
1383
|
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
|
1524
1384
|
},
|
|
1525
|
-
_triggerDragStart: function _triggerDragStart(
|
|
1526
|
-
/** Event */
|
|
1527
|
-
evt,
|
|
1528
|
-
/** Touch */
|
|
1529
|
-
touch) {
|
|
1385
|
+
_triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
|
|
1530
1386
|
touch = touch || evt.pointerType == 'touch' && evt;
|
|
1531
|
-
|
|
1532
1387
|
if (!this.nativeDraggable || touch) {
|
|
1533
1388
|
if (this.options.supportPointer) {
|
|
1534
1389
|
on(document, 'pointermove', this._onTouchMove);
|
|
@@ -1541,10 +1396,8 @@
|
|
|
1541
1396
|
on(dragEl, 'dragend', this);
|
|
1542
1397
|
on(rootEl, 'dragstart', this._onDragStart);
|
|
1543
1398
|
}
|
|
1544
|
-
|
|
1545
1399
|
try {
|
|
1546
1400
|
if (document.selection) {
|
|
1547
|
-
// Timeout neccessary for IE9
|
|
1548
1401
|
_nextTick(function () {
|
|
1549
1402
|
document.selection.empty();
|
|
1550
1403
|
});
|
|
@@ -1554,25 +1407,23 @@
|
|
|
1554
1407
|
} catch (err) {}
|
|
1555
1408
|
},
|
|
1556
1409
|
_dragStarted: function _dragStarted(fallback, evt) {
|
|
1557
|
-
|
|
1558
1410
|
awaitingDragStarted = false;
|
|
1559
|
-
|
|
1560
1411
|
if (rootEl && dragEl) {
|
|
1561
1412
|
pluginEvent('dragStarted', this, {
|
|
1562
1413
|
evt: evt
|
|
1563
1414
|
});
|
|
1564
|
-
|
|
1565
1415
|
if (this.nativeDraggable) {
|
|
1566
1416
|
on(document, 'dragover', _checkOutsideTargetEl);
|
|
1567
1417
|
}
|
|
1418
|
+
var options = this.options;
|
|
1568
1419
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1420
|
+
// Apply effect
|
|
1571
1421
|
!fallback && toggleClass(dragEl, options.dragClass, false);
|
|
1572
1422
|
toggleClass(dragEl, options.ghostClass, true);
|
|
1573
1423
|
Sortable.active = this;
|
|
1574
|
-
fallback && this._appendGhost();
|
|
1424
|
+
fallback && this._appendGhost();
|
|
1575
1425
|
|
|
1426
|
+
// Drag start event
|
|
1576
1427
|
_dispatchEvent({
|
|
1577
1428
|
sortable: this,
|
|
1578
1429
|
name: 'start',
|
|
@@ -1586,20 +1437,15 @@
|
|
|
1586
1437
|
if (touchEvt) {
|
|
1587
1438
|
this._lastX = touchEvt.clientX;
|
|
1588
1439
|
this._lastY = touchEvt.clientY;
|
|
1589
|
-
|
|
1590
1440
|
_hideGhostForTarget();
|
|
1591
|
-
|
|
1592
1441
|
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
|
1593
1442
|
var parent = target;
|
|
1594
|
-
|
|
1595
1443
|
while (target && target.shadowRoot) {
|
|
1596
1444
|
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
|
1597
1445
|
if (target === parent) break;
|
|
1598
1446
|
parent = target;
|
|
1599
1447
|
}
|
|
1600
|
-
|
|
1601
1448
|
dragEl.parentNode[expando]._isOutsideThisEl(target);
|
|
1602
|
-
|
|
1603
1449
|
if (parent) {
|
|
1604
1450
|
do {
|
|
1605
1451
|
if (parent[expando]) {
|
|
@@ -1610,44 +1456,37 @@
|
|
|
1610
1456
|
target: target,
|
|
1611
1457
|
rootEl: parent
|
|
1612
1458
|
});
|
|
1613
|
-
|
|
1614
1459
|
if (inserted && !this.options.dragoverBubble) {
|
|
1615
1460
|
break;
|
|
1616
1461
|
}
|
|
1617
1462
|
}
|
|
1618
|
-
|
|
1619
1463
|
target = parent; // store last element
|
|
1620
1464
|
}
|
|
1621
|
-
/* jshint boss:true */
|
|
1622
|
-
while (parent = parent.parentNode);
|
|
1465
|
+
/* jshint boss:true */ while (parent = getParentOrHost(parent));
|
|
1623
1466
|
}
|
|
1624
|
-
|
|
1625
1467
|
_unhideGhostForTarget();
|
|
1626
1468
|
}
|
|
1627
1469
|
},
|
|
1628
|
-
_onTouchMove: function _onTouchMove(
|
|
1629
|
-
/**TouchEvent*/
|
|
1630
|
-
evt) {
|
|
1470
|
+
_onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
|
|
1631
1471
|
if (tapEvt) {
|
|
1632
1472
|
var options = this.options,
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1473
|
+
fallbackTolerance = options.fallbackTolerance,
|
|
1474
|
+
fallbackOffset = options.fallbackOffset,
|
|
1475
|
+
touch = evt.touches ? evt.touches[0] : evt,
|
|
1476
|
+
ghostMatrix = ghostEl && matrix(ghostEl, true),
|
|
1477
|
+
scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
|
|
1478
|
+
scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
|
|
1479
|
+
relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
|
|
1480
|
+
dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
|
|
1481
|
+
dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
|
|
1482
|
+
|
|
1483
|
+
// only set the status to dragging, when we are actually dragging
|
|
1643
1484
|
if (!Sortable.active && !awaitingDragStarted) {
|
|
1644
1485
|
if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
|
|
1645
1486
|
return;
|
|
1646
1487
|
}
|
|
1647
|
-
|
|
1648
1488
|
this._onDragStart(evt, true);
|
|
1649
1489
|
}
|
|
1650
|
-
|
|
1651
1490
|
if (ghostEl) {
|
|
1652
1491
|
if (ghostMatrix) {
|
|
1653
1492
|
ghostMatrix.e += dx - (lastDx || 0);
|
|
@@ -1662,7 +1501,6 @@
|
|
|
1662
1501
|
f: dy
|
|
1663
1502
|
};
|
|
1664
1503
|
}
|
|
1665
|
-
|
|
1666
1504
|
var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
|
|
1667
1505
|
css(ghostEl, 'webkitTransform', cssMatrix);
|
|
1668
1506
|
css(ghostEl, 'mozTransform', cssMatrix);
|
|
@@ -1672,7 +1510,6 @@
|
|
|
1672
1510
|
lastDy = dy;
|
|
1673
1511
|
touchEvt = touch;
|
|
1674
1512
|
}
|
|
1675
|
-
|
|
1676
1513
|
evt.cancelable && evt.preventDefault();
|
|
1677
1514
|
}
|
|
1678
1515
|
},
|
|
@@ -1681,17 +1518,16 @@
|
|
|
1681
1518
|
// Not being adjusted for
|
|
1682
1519
|
if (!ghostEl) {
|
|
1683
1520
|
var container = this.options.fallbackOnBody ? document.body : rootEl,
|
|
1684
|
-
|
|
1685
|
-
|
|
1521
|
+
rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
|
|
1522
|
+
options = this.options;
|
|
1686
1523
|
|
|
1524
|
+
// Position absolutely
|
|
1687
1525
|
if (PositionGhostAbsolutely) {
|
|
1688
1526
|
// Get relatively positioned parent
|
|
1689
1527
|
ghostRelativeParent = container;
|
|
1690
|
-
|
|
1691
1528
|
while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
|
|
1692
1529
|
ghostRelativeParent = ghostRelativeParent.parentNode;
|
|
1693
1530
|
}
|
|
1694
|
-
|
|
1695
1531
|
if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
|
|
1696
1532
|
if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
|
|
1697
1533
|
rect.top += ghostRelativeParent.scrollTop;
|
|
@@ -1699,10 +1535,8 @@
|
|
|
1699
1535
|
} else {
|
|
1700
1536
|
ghostRelativeParent = getWindowScrollingElement();
|
|
1701
1537
|
}
|
|
1702
|
-
|
|
1703
1538
|
ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
|
|
1704
1539
|
}
|
|
1705
|
-
|
|
1706
1540
|
ghostEl = dragEl.cloneNode(true);
|
|
1707
1541
|
toggleClass(ghostEl, options.ghostClass, false);
|
|
1708
1542
|
toggleClass(ghostEl, options.fallbackClass, true);
|
|
@@ -1720,61 +1554,50 @@
|
|
|
1720
1554
|
css(ghostEl, 'zIndex', '100000');
|
|
1721
1555
|
css(ghostEl, 'pointerEvents', 'none');
|
|
1722
1556
|
Sortable.ghost = ghostEl;
|
|
1723
|
-
container.appendChild(ghostEl);
|
|
1557
|
+
container.appendChild(ghostEl);
|
|
1724
1558
|
|
|
1559
|
+
// Set transform-origin
|
|
1725
1560
|
css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
|
|
1726
1561
|
}
|
|
1727
1562
|
},
|
|
1728
|
-
_onDragStart: function _onDragStart(
|
|
1729
|
-
/**Event*/
|
|
1730
|
-
evt,
|
|
1731
|
-
/**boolean*/
|
|
1732
|
-
fallback) {
|
|
1563
|
+
_onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
|
|
1733
1564
|
var _this = this;
|
|
1734
|
-
|
|
1735
1565
|
var dataTransfer = evt.dataTransfer;
|
|
1736
1566
|
var options = _this.options;
|
|
1737
1567
|
pluginEvent('dragStart', this, {
|
|
1738
1568
|
evt: evt
|
|
1739
1569
|
});
|
|
1740
|
-
|
|
1741
1570
|
if (Sortable.eventCanceled) {
|
|
1742
1571
|
this._onDrop();
|
|
1743
|
-
|
|
1744
1572
|
return;
|
|
1745
1573
|
}
|
|
1746
|
-
|
|
1747
1574
|
pluginEvent('setupClone', this);
|
|
1748
|
-
|
|
1749
1575
|
if (!Sortable.eventCanceled) {
|
|
1750
1576
|
cloneEl = clone(dragEl);
|
|
1577
|
+
cloneEl.removeAttribute("id");
|
|
1751
1578
|
cloneEl.draggable = false;
|
|
1752
1579
|
cloneEl.style['will-change'] = '';
|
|
1753
|
-
|
|
1754
1580
|
this._hideClone();
|
|
1755
|
-
|
|
1756
1581
|
toggleClass(cloneEl, this.options.chosenClass, false);
|
|
1757
1582
|
Sortable.clone = cloneEl;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1583
|
+
}
|
|
1760
1584
|
|
|
1585
|
+
// #1143: IFrame support workaround
|
|
1761
1586
|
_this.cloneId = _nextTick(function () {
|
|
1762
1587
|
pluginEvent('clone', _this);
|
|
1763
1588
|
if (Sortable.eventCanceled) return;
|
|
1764
|
-
|
|
1765
1589
|
if (!_this.options.removeCloneOnHide) {
|
|
1766
1590
|
rootEl.insertBefore(cloneEl, dragEl);
|
|
1767
1591
|
}
|
|
1768
|
-
|
|
1769
1592
|
_this._hideClone();
|
|
1770
|
-
|
|
1771
1593
|
_dispatchEvent({
|
|
1772
1594
|
sortable: _this,
|
|
1773
1595
|
name: 'clone'
|
|
1774
1596
|
});
|
|
1775
1597
|
});
|
|
1776
|
-
!fallback && toggleClass(dragEl, options.dragClass, true);
|
|
1598
|
+
!fallback && toggleClass(dragEl, options.dragClass, true);
|
|
1777
1599
|
|
|
1600
|
+
// Set proper drop events
|
|
1778
1601
|
if (fallback) {
|
|
1779
1602
|
ignoreNextClick = true;
|
|
1780
1603
|
_this._loopId = setInterval(_this._emulateDragOver, 50);
|
|
@@ -1783,49 +1606,43 @@
|
|
|
1783
1606
|
off(document, 'mouseup', _this._onDrop);
|
|
1784
1607
|
off(document, 'touchend', _this._onDrop);
|
|
1785
1608
|
off(document, 'touchcancel', _this._onDrop);
|
|
1786
|
-
|
|
1787
1609
|
if (dataTransfer) {
|
|
1788
1610
|
dataTransfer.effectAllowed = 'move';
|
|
1789
1611
|
options.setData && options.setData.call(_this, dataTransfer, dragEl);
|
|
1790
1612
|
}
|
|
1613
|
+
on(document, 'drop', _this);
|
|
1791
1614
|
|
|
1792
|
-
|
|
1793
|
-
|
|
1615
|
+
// #1276 fix:
|
|
1794
1616
|
css(dragEl, 'transform', 'translateZ(0)');
|
|
1795
1617
|
}
|
|
1796
|
-
|
|
1797
1618
|
awaitingDragStarted = true;
|
|
1798
1619
|
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
|
1799
1620
|
on(document, 'selectstart', _this);
|
|
1800
1621
|
moved = true;
|
|
1801
|
-
|
|
1622
|
+
window.getSelection().removeAllRanges();
|
|
1802
1623
|
if (Safari) {
|
|
1803
1624
|
css(document.body, 'user-select', 'none');
|
|
1804
1625
|
}
|
|
1805
1626
|
},
|
|
1806
1627
|
// Returns true - if no further action is needed (either inserted or another condition)
|
|
1807
|
-
_onDragOver: function _onDragOver(
|
|
1808
|
-
/**Event*/
|
|
1809
|
-
evt) {
|
|
1628
|
+
_onDragOver: function _onDragOver( /**Event*/evt) {
|
|
1810
1629
|
var el = this.el,
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1630
|
+
target = evt.target,
|
|
1631
|
+
dragRect,
|
|
1632
|
+
targetRect,
|
|
1633
|
+
revert,
|
|
1634
|
+
options = this.options,
|
|
1635
|
+
group = options.group,
|
|
1636
|
+
activeSortable = Sortable.active,
|
|
1637
|
+
isOwner = activeGroup === group,
|
|
1638
|
+
canSort = options.sort,
|
|
1639
|
+
fromSortable = putSortable || activeSortable,
|
|
1640
|
+
vertical,
|
|
1641
|
+
_this = this,
|
|
1642
|
+
completedFired = false;
|
|
1825
1643
|
if (_silent) return;
|
|
1826
|
-
|
|
1827
1644
|
function dragOverEvent(name, extra) {
|
|
1828
|
-
pluginEvent(name, _this,
|
|
1645
|
+
pluginEvent(name, _this, _objectSpread2({
|
|
1829
1646
|
evt: evt,
|
|
1830
1647
|
isOwner: isOwner,
|
|
1831
1648
|
axis: vertical ? 'vertical' : 'horizontal',
|
|
@@ -1841,25 +1658,22 @@
|
|
|
1841
1658
|
},
|
|
1842
1659
|
changed: changed
|
|
1843
1660
|
}, extra));
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1661
|
+
}
|
|
1846
1662
|
|
|
1663
|
+
// Capture animation state
|
|
1847
1664
|
function capture() {
|
|
1848
1665
|
dragOverEvent('dragOverAnimationCapture');
|
|
1849
|
-
|
|
1850
1666
|
_this.captureAnimationState();
|
|
1851
|
-
|
|
1852
1667
|
if (_this !== fromSortable) {
|
|
1853
1668
|
fromSortable.captureAnimationState();
|
|
1854
1669
|
}
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1670
|
+
}
|
|
1857
1671
|
|
|
1672
|
+
// Return invocation when dragEl is inserted (or completed)
|
|
1858
1673
|
function completed(insertion) {
|
|
1859
1674
|
dragOverEvent('dragOverCompleted', {
|
|
1860
1675
|
insertion: insertion
|
|
1861
1676
|
});
|
|
1862
|
-
|
|
1863
1677
|
if (insertion) {
|
|
1864
1678
|
// Clones must be hidden before folding animation to capture dragRectAbsolute properly
|
|
1865
1679
|
if (isOwner) {
|
|
@@ -1867,57 +1681,51 @@
|
|
|
1867
1681
|
} else {
|
|
1868
1682
|
activeSortable._showClone(_this);
|
|
1869
1683
|
}
|
|
1870
|
-
|
|
1871
1684
|
if (_this !== fromSortable) {
|
|
1872
1685
|
// Set ghost class to new sortable's ghost class
|
|
1873
1686
|
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
|
|
1874
1687
|
toggleClass(dragEl, options.ghostClass, true);
|
|
1875
1688
|
}
|
|
1876
|
-
|
|
1877
1689
|
if (putSortable !== _this && _this !== Sortable.active) {
|
|
1878
1690
|
putSortable = _this;
|
|
1879
1691
|
} else if (_this === Sortable.active && putSortable) {
|
|
1880
1692
|
putSortable = null;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1693
|
+
}
|
|
1883
1694
|
|
|
1695
|
+
// Animation
|
|
1884
1696
|
if (fromSortable === _this) {
|
|
1885
1697
|
_this._ignoreWhileAnimating = target;
|
|
1886
1698
|
}
|
|
1887
|
-
|
|
1888
1699
|
_this.animateAll(function () {
|
|
1889
1700
|
dragOverEvent('dragOverAnimationComplete');
|
|
1890
1701
|
_this._ignoreWhileAnimating = null;
|
|
1891
1702
|
});
|
|
1892
|
-
|
|
1893
1703
|
if (_this !== fromSortable) {
|
|
1894
1704
|
fromSortable.animateAll();
|
|
1895
1705
|
fromSortable._ignoreWhileAnimating = null;
|
|
1896
1706
|
}
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1707
|
+
}
|
|
1899
1708
|
|
|
1709
|
+
// Null lastTarget if it is not inside a previously swapped element
|
|
1900
1710
|
if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
|
|
1901
1711
|
lastTarget = null;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1712
|
+
}
|
|
1904
1713
|
|
|
1714
|
+
// no bubbling and not fallback
|
|
1905
1715
|
if (!options.dragoverBubble && !evt.rootEl && target !== document) {
|
|
1906
|
-
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
|
1907
|
-
|
|
1716
|
+
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
|
1908
1717
|
|
|
1718
|
+
// Do not detect for empty insert if already inserted
|
|
1909
1719
|
!insertion && nearestEmptyInsertDetectEvent(evt);
|
|
1910
1720
|
}
|
|
1911
|
-
|
|
1912
1721
|
!options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
|
|
1913
1722
|
return completedFired = true;
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1723
|
+
}
|
|
1916
1724
|
|
|
1725
|
+
// Call when dragEl has been inserted
|
|
1917
1726
|
function changed() {
|
|
1918
1727
|
newIndex = index(dragEl);
|
|
1919
1728
|
newDraggableIndex = index(dragEl, options.draggable);
|
|
1920
|
-
|
|
1921
1729
|
_dispatchEvent({
|
|
1922
1730
|
sortable: _this,
|
|
1923
1731
|
name: 'change',
|
|
@@ -1927,37 +1735,27 @@
|
|
|
1927
1735
|
originalEvent: evt
|
|
1928
1736
|
});
|
|
1929
1737
|
}
|
|
1930
|
-
|
|
1931
1738
|
if (evt.preventDefault !== void 0) {
|
|
1932
1739
|
evt.cancelable && evt.preventDefault();
|
|
1933
1740
|
}
|
|
1934
|
-
|
|
1935
1741
|
target = closest(target, options.draggable, el, true);
|
|
1936
1742
|
dragOverEvent('dragOver');
|
|
1937
1743
|
if (Sortable.eventCanceled) return completedFired;
|
|
1938
|
-
|
|
1939
1744
|
if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
|
|
1940
1745
|
return completed(false);
|
|
1941
1746
|
}
|
|
1942
|
-
|
|
1943
1747
|
ignoreNextClick = false;
|
|
1944
|
-
|
|
1945
|
-
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
|
|
1748
|
+
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
|
|
1946
1749
|
: putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
|
|
1947
1750
|
vertical = this._getDirection(evt, target) === 'vertical';
|
|
1948
1751
|
dragRect = getRect(dragEl);
|
|
1949
1752
|
dragOverEvent('dragOverValid');
|
|
1950
1753
|
if (Sortable.eventCanceled) return completedFired;
|
|
1951
|
-
|
|
1952
1754
|
if (revert) {
|
|
1953
1755
|
parentEl = rootEl; // actualization
|
|
1954
|
-
|
|
1955
1756
|
capture();
|
|
1956
|
-
|
|
1957
1757
|
this._hideClone();
|
|
1958
|
-
|
|
1959
1758
|
dragOverEvent('revert');
|
|
1960
|
-
|
|
1961
1759
|
if (!Sortable.eventCanceled) {
|
|
1962
1760
|
if (nextEl) {
|
|
1963
1761
|
rootEl.insertBefore(dragEl, nextEl);
|
|
@@ -1965,30 +1763,48 @@
|
|
|
1965
1763
|
rootEl.appendChild(dragEl);
|
|
1966
1764
|
}
|
|
1967
1765
|
}
|
|
1968
|
-
|
|
1969
1766
|
return completed(true);
|
|
1970
1767
|
}
|
|
1971
|
-
|
|
1972
1768
|
var elLastChild = lastChild(el, options.draggable);
|
|
1973
|
-
|
|
1974
1769
|
if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
|
|
1770
|
+
// Insert to end of list
|
|
1771
|
+
|
|
1975
1772
|
// If already at end of list: Do not insert
|
|
1976
1773
|
if (elLastChild === dragEl) {
|
|
1977
1774
|
return completed(false);
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1775
|
+
}
|
|
1980
1776
|
|
|
1777
|
+
// if there is a last element, it is the target
|
|
1981
1778
|
if (elLastChild && el === evt.target) {
|
|
1982
1779
|
target = elLastChild;
|
|
1983
1780
|
}
|
|
1984
|
-
|
|
1985
1781
|
if (target) {
|
|
1986
1782
|
targetRect = getRect(target);
|
|
1987
1783
|
}
|
|
1988
|
-
|
|
1989
1784
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
|
1990
1785
|
capture();
|
|
1991
|
-
|
|
1786
|
+
if (elLastChild && elLastChild.nextSibling) {
|
|
1787
|
+
// the last draggable element is not the last node
|
|
1788
|
+
el.insertBefore(dragEl, elLastChild.nextSibling);
|
|
1789
|
+
} else {
|
|
1790
|
+
el.appendChild(dragEl);
|
|
1791
|
+
}
|
|
1792
|
+
parentEl = el; // actualization
|
|
1793
|
+
|
|
1794
|
+
changed();
|
|
1795
|
+
return completed(true);
|
|
1796
|
+
}
|
|
1797
|
+
} else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
|
|
1798
|
+
// Insert to start of list
|
|
1799
|
+
var firstChild = getChild(el, 0, options, true);
|
|
1800
|
+
if (firstChild === dragEl) {
|
|
1801
|
+
return completed(false);
|
|
1802
|
+
}
|
|
1803
|
+
target = firstChild;
|
|
1804
|
+
targetRect = getRect(target);
|
|
1805
|
+
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
|
|
1806
|
+
capture();
|
|
1807
|
+
el.insertBefore(dragEl, firstChild);
|
|
1992
1808
|
parentEl = el; // actualization
|
|
1993
1809
|
|
|
1994
1810
|
changed();
|
|
@@ -1997,82 +1813,68 @@
|
|
|
1997
1813
|
} else if (target.parentNode === el) {
|
|
1998
1814
|
targetRect = getRect(target);
|
|
1999
1815
|
var direction = 0,
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
1816
|
+
targetBeforeFirstSwap,
|
|
1817
|
+
differentLevel = dragEl.parentNode !== el,
|
|
1818
|
+
differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
|
|
1819
|
+
side1 = vertical ? 'top' : 'left',
|
|
1820
|
+
scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
|
|
1821
|
+
scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
|
|
2007
1822
|
if (lastTarget !== target) {
|
|
2008
1823
|
targetBeforeFirstSwap = targetRect[side1];
|
|
2009
1824
|
pastFirstInvertThresh = false;
|
|
2010
1825
|
isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
|
|
2011
1826
|
}
|
|
2012
|
-
|
|
2013
1827
|
direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
|
|
2014
1828
|
var sibling;
|
|
2015
|
-
|
|
2016
1829
|
if (direction !== 0) {
|
|
2017
1830
|
// Check if target is beside dragEl in respective direction (ignoring hidden elements)
|
|
2018
1831
|
var dragIndex = index(dragEl);
|
|
2019
|
-
|
|
2020
1832
|
do {
|
|
2021
1833
|
dragIndex -= direction;
|
|
2022
1834
|
sibling = parentEl.children[dragIndex];
|
|
2023
1835
|
} while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
|
|
1836
|
+
}
|
|
1837
|
+
// If dragEl is already beside target: Do not insert
|
|
2027
1838
|
if (direction === 0 || sibling === target) {
|
|
2028
1839
|
return completed(false);
|
|
2029
1840
|
}
|
|
2030
|
-
|
|
2031
1841
|
lastTarget = target;
|
|
2032
1842
|
lastDirection = direction;
|
|
2033
1843
|
var nextSibling = target.nextElementSibling,
|
|
2034
|
-
|
|
1844
|
+
after = false;
|
|
2035
1845
|
after = direction === 1;
|
|
2036
|
-
|
|
2037
1846
|
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
|
|
2038
|
-
|
|
2039
1847
|
if (moveVector !== false) {
|
|
2040
1848
|
if (moveVector === 1 || moveVector === -1) {
|
|
2041
1849
|
after = moveVector === 1;
|
|
2042
1850
|
}
|
|
2043
|
-
|
|
2044
1851
|
_silent = true;
|
|
2045
1852
|
setTimeout(_unsilent, 30);
|
|
2046
1853
|
capture();
|
|
2047
|
-
|
|
2048
1854
|
if (after && !nextSibling) {
|
|
2049
1855
|
el.appendChild(dragEl);
|
|
2050
1856
|
} else {
|
|
2051
1857
|
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
|
|
2052
|
-
}
|
|
2053
|
-
|
|
1858
|
+
}
|
|
2054
1859
|
|
|
1860
|
+
// Undo chrome's scroll adjustment (has no effect on other browsers)
|
|
2055
1861
|
if (scrolledPastTop) {
|
|
2056
1862
|
scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
|
|
2057
1863
|
}
|
|
2058
|
-
|
|
2059
1864
|
parentEl = dragEl.parentNode; // actualization
|
|
2060
|
-
// must be done before animation
|
|
2061
1865
|
|
|
1866
|
+
// must be done before animation
|
|
2062
1867
|
if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
|
|
2063
1868
|
targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
|
|
2064
1869
|
}
|
|
2065
|
-
|
|
2066
1870
|
changed();
|
|
2067
1871
|
return completed(true);
|
|
2068
1872
|
}
|
|
2069
1873
|
}
|
|
2070
|
-
|
|
2071
1874
|
if (el.contains(dragEl)) {
|
|
2072
1875
|
return completed(false);
|
|
2073
1876
|
}
|
|
2074
1877
|
}
|
|
2075
|
-
|
|
2076
1878
|
return false;
|
|
2077
1879
|
},
|
|
2078
1880
|
_ignoreWhileAnimating: null,
|
|
@@ -2089,86 +1891,73 @@
|
|
|
2089
1891
|
off(ownerDocument, 'mouseup', this._onDrop);
|
|
2090
1892
|
off(ownerDocument, 'touchend', this._onDrop);
|
|
2091
1893
|
off(ownerDocument, 'pointerup', this._onDrop);
|
|
1894
|
+
off(ownerDocument, 'pointercancel', this._onDrop);
|
|
2092
1895
|
off(ownerDocument, 'touchcancel', this._onDrop);
|
|
2093
1896
|
off(document, 'selectstart', this);
|
|
2094
1897
|
},
|
|
2095
|
-
_onDrop: function _onDrop(
|
|
2096
|
-
/**Event*/
|
|
2097
|
-
evt) {
|
|
1898
|
+
_onDrop: function _onDrop( /**Event*/evt) {
|
|
2098
1899
|
var el = this.el,
|
|
2099
|
-
|
|
1900
|
+
options = this.options;
|
|
2100
1901
|
|
|
1902
|
+
// Get the index of the dragged element within its parent
|
|
2101
1903
|
newIndex = index(dragEl);
|
|
2102
1904
|
newDraggableIndex = index(dragEl, options.draggable);
|
|
2103
1905
|
pluginEvent('drop', this, {
|
|
2104
1906
|
evt: evt
|
|
2105
1907
|
});
|
|
2106
|
-
parentEl = dragEl && dragEl.parentNode;
|
|
1908
|
+
parentEl = dragEl && dragEl.parentNode;
|
|
2107
1909
|
|
|
1910
|
+
// Get again after plugin event
|
|
2108
1911
|
newIndex = index(dragEl);
|
|
2109
1912
|
newDraggableIndex = index(dragEl, options.draggable);
|
|
2110
|
-
|
|
2111
1913
|
if (Sortable.eventCanceled) {
|
|
2112
1914
|
this._nulling();
|
|
2113
|
-
|
|
2114
1915
|
return;
|
|
2115
1916
|
}
|
|
2116
|
-
|
|
2117
1917
|
awaitingDragStarted = false;
|
|
2118
1918
|
isCircumstantialInvert = false;
|
|
2119
1919
|
pastFirstInvertThresh = false;
|
|
2120
1920
|
clearInterval(this._loopId);
|
|
2121
1921
|
clearTimeout(this._dragStartTimer);
|
|
2122
|
-
|
|
2123
1922
|
_cancelNextTick(this.cloneId);
|
|
1923
|
+
_cancelNextTick(this._dragStartId);
|
|
2124
1924
|
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
1925
|
+
// Unbind events
|
|
2128
1926
|
if (this.nativeDraggable) {
|
|
2129
1927
|
off(document, 'drop', this);
|
|
2130
1928
|
off(el, 'dragstart', this._onDragStart);
|
|
2131
1929
|
}
|
|
2132
|
-
|
|
2133
1930
|
this._offMoveEvents();
|
|
2134
|
-
|
|
2135
1931
|
this._offUpEvents();
|
|
2136
|
-
|
|
2137
1932
|
if (Safari) {
|
|
2138
1933
|
css(document.body, 'user-select', '');
|
|
2139
1934
|
}
|
|
2140
|
-
|
|
2141
1935
|
css(dragEl, 'transform', '');
|
|
2142
|
-
|
|
2143
1936
|
if (evt) {
|
|
2144
1937
|
if (moved) {
|
|
2145
1938
|
evt.cancelable && evt.preventDefault();
|
|
2146
1939
|
!options.dropBubble && evt.stopPropagation();
|
|
2147
1940
|
}
|
|
2148
|
-
|
|
2149
1941
|
ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
|
|
2150
|
-
|
|
2151
1942
|
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
|
|
2152
1943
|
// Remove clone(s)
|
|
2153
1944
|
cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
|
|
2154
1945
|
}
|
|
2155
|
-
|
|
2156
1946
|
if (dragEl) {
|
|
2157
1947
|
if (this.nativeDraggable) {
|
|
2158
1948
|
off(dragEl, 'dragend', this);
|
|
2159
1949
|
}
|
|
2160
|
-
|
|
2161
1950
|
_disableDraggable(dragEl);
|
|
1951
|
+
dragEl.style['will-change'] = '';
|
|
2162
1952
|
|
|
2163
|
-
|
|
1953
|
+
// Remove classes
|
|
2164
1954
|
// ghostClass is added in dragStarted
|
|
2165
|
-
|
|
2166
1955
|
if (moved && !awaitingDragStarted) {
|
|
2167
1956
|
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
|
|
2168
1957
|
}
|
|
1958
|
+
toggleClass(dragEl, this.options.chosenClass, false);
|
|
2169
1959
|
|
|
2170
|
-
|
|
2171
|
-
|
|
1960
|
+
// Drag stop event
|
|
2172
1961
|
_dispatchEvent({
|
|
2173
1962
|
sortable: this,
|
|
2174
1963
|
name: 'unchoose',
|
|
@@ -2177,7 +1966,6 @@
|
|
|
2177
1966
|
newDraggableIndex: null,
|
|
2178
1967
|
originalEvent: evt
|
|
2179
1968
|
});
|
|
2180
|
-
|
|
2181
1969
|
if (rootEl !== parentEl) {
|
|
2182
1970
|
if (newIndex >= 0) {
|
|
2183
1971
|
// Add event
|
|
@@ -2187,17 +1975,17 @@
|
|
|
2187
1975
|
toEl: parentEl,
|
|
2188
1976
|
fromEl: rootEl,
|
|
2189
1977
|
originalEvent: evt
|
|
2190
|
-
});
|
|
2191
|
-
|
|
1978
|
+
});
|
|
2192
1979
|
|
|
1980
|
+
// Remove event
|
|
2193
1981
|
_dispatchEvent({
|
|
2194
1982
|
sortable: this,
|
|
2195
1983
|
name: 'remove',
|
|
2196
1984
|
toEl: parentEl,
|
|
2197
1985
|
originalEvent: evt
|
|
2198
|
-
});
|
|
2199
|
-
|
|
1986
|
+
});
|
|
2200
1987
|
|
|
1988
|
+
// drag from one list and drop into another
|
|
2201
1989
|
_dispatchEvent({
|
|
2202
1990
|
rootEl: parentEl,
|
|
2203
1991
|
name: 'sort',
|
|
@@ -2205,7 +1993,6 @@
|
|
|
2205
1993
|
fromEl: rootEl,
|
|
2206
1994
|
originalEvent: evt
|
|
2207
1995
|
});
|
|
2208
|
-
|
|
2209
1996
|
_dispatchEvent({
|
|
2210
1997
|
sortable: this,
|
|
2211
1998
|
name: 'sort',
|
|
@@ -2213,7 +2000,6 @@
|
|
|
2213
2000
|
originalEvent: evt
|
|
2214
2001
|
});
|
|
2215
2002
|
}
|
|
2216
|
-
|
|
2217
2003
|
putSortable && putSortable.save();
|
|
2218
2004
|
} else {
|
|
2219
2005
|
if (newIndex !== oldIndex) {
|
|
@@ -2225,7 +2011,6 @@
|
|
|
2225
2011
|
toEl: parentEl,
|
|
2226
2012
|
originalEvent: evt
|
|
2227
2013
|
});
|
|
2228
|
-
|
|
2229
2014
|
_dispatchEvent({
|
|
2230
2015
|
sortable: this,
|
|
2231
2016
|
name: 'sort',
|
|
@@ -2235,108 +2020,96 @@
|
|
|
2235
2020
|
}
|
|
2236
2021
|
}
|
|
2237
2022
|
}
|
|
2238
|
-
|
|
2239
2023
|
if (Sortable.active) {
|
|
2240
2024
|
/* jshint eqnull:true */
|
|
2241
2025
|
if (newIndex == null || newIndex === -1) {
|
|
2242
2026
|
newIndex = oldIndex;
|
|
2243
2027
|
newDraggableIndex = oldDraggableIndex;
|
|
2244
2028
|
}
|
|
2245
|
-
|
|
2246
2029
|
_dispatchEvent({
|
|
2247
2030
|
sortable: this,
|
|
2248
2031
|
name: 'end',
|
|
2249
2032
|
toEl: parentEl,
|
|
2250
2033
|
originalEvent: evt
|
|
2251
|
-
});
|
|
2252
|
-
|
|
2034
|
+
});
|
|
2253
2035
|
|
|
2036
|
+
// Save sorting
|
|
2254
2037
|
this.save();
|
|
2255
2038
|
}
|
|
2256
2039
|
}
|
|
2257
2040
|
}
|
|
2258
|
-
|
|
2259
2041
|
this._nulling();
|
|
2260
2042
|
},
|
|
2261
2043
|
_nulling: function _nulling() {
|
|
2262
2044
|
pluginEvent('nulling', this);
|
|
2263
2045
|
rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
|
|
2264
|
-
|
|
2265
|
-
|
|
2046
|
+
var el = this.el;
|
|
2047
|
+
savedInputChecked.forEach(function (checkEl) {
|
|
2048
|
+
if (el.contains(checkEl)) {
|
|
2049
|
+
checkEl.checked = true;
|
|
2050
|
+
}
|
|
2266
2051
|
});
|
|
2267
2052
|
savedInputChecked.length = lastDx = lastDy = 0;
|
|
2268
2053
|
},
|
|
2269
|
-
handleEvent: function handleEvent(
|
|
2270
|
-
/**Event*/
|
|
2271
|
-
evt) {
|
|
2054
|
+
handleEvent: function handleEvent( /**Event*/evt) {
|
|
2272
2055
|
switch (evt.type) {
|
|
2273
2056
|
case 'drop':
|
|
2274
2057
|
case 'dragend':
|
|
2275
2058
|
this._onDrop(evt);
|
|
2276
|
-
|
|
2277
2059
|
break;
|
|
2278
|
-
|
|
2279
2060
|
case 'dragenter':
|
|
2280
2061
|
case 'dragover':
|
|
2281
2062
|
if (dragEl) {
|
|
2282
2063
|
this._onDragOver(evt);
|
|
2283
|
-
|
|
2284
2064
|
_globalDragOver(evt);
|
|
2285
2065
|
}
|
|
2286
|
-
|
|
2287
2066
|
break;
|
|
2288
|
-
|
|
2289
2067
|
case 'selectstart':
|
|
2290
2068
|
evt.preventDefault();
|
|
2291
2069
|
break;
|
|
2292
2070
|
}
|
|
2293
2071
|
},
|
|
2294
|
-
|
|
2295
2072
|
/**
|
|
2296
2073
|
* Serializes the item into an array of string.
|
|
2297
2074
|
* @returns {String[]}
|
|
2298
2075
|
*/
|
|
2299
2076
|
toArray: function toArray() {
|
|
2300
2077
|
var order = [],
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2078
|
+
el,
|
|
2079
|
+
children = this.el.children,
|
|
2080
|
+
i = 0,
|
|
2081
|
+
n = children.length,
|
|
2082
|
+
options = this.options;
|
|
2307
2083
|
for (; i < n; i++) {
|
|
2308
2084
|
el = children[i];
|
|
2309
|
-
|
|
2310
2085
|
if (closest(el, options.draggable, this.el, false)) {
|
|
2311
2086
|
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
|
2312
2087
|
}
|
|
2313
2088
|
}
|
|
2314
|
-
|
|
2315
2089
|
return order;
|
|
2316
2090
|
},
|
|
2317
|
-
|
|
2318
2091
|
/**
|
|
2319
2092
|
* Sorts the elements according to the array.
|
|
2320
2093
|
* @param {String[]} order order of the items
|
|
2321
2094
|
*/
|
|
2322
|
-
sort: function sort(order) {
|
|
2095
|
+
sort: function sort(order, useAnimation) {
|
|
2323
2096
|
var items = {},
|
|
2324
|
-
|
|
2097
|
+
rootEl = this.el;
|
|
2325
2098
|
this.toArray().forEach(function (id, i) {
|
|
2326
2099
|
var el = rootEl.children[i];
|
|
2327
|
-
|
|
2328
2100
|
if (closest(el, this.options.draggable, rootEl, false)) {
|
|
2329
2101
|
items[id] = el;
|
|
2330
2102
|
}
|
|
2331
2103
|
}, this);
|
|
2104
|
+
useAnimation && this.captureAnimationState();
|
|
2332
2105
|
order.forEach(function (id) {
|
|
2333
2106
|
if (items[id]) {
|
|
2334
2107
|
rootEl.removeChild(items[id]);
|
|
2335
2108
|
rootEl.appendChild(items[id]);
|
|
2336
2109
|
}
|
|
2337
2110
|
});
|
|
2111
|
+
useAnimation && this.animateAll();
|
|
2338
2112
|
},
|
|
2339
|
-
|
|
2340
2113
|
/**
|
|
2341
2114
|
* Save the current sorting
|
|
2342
2115
|
*/
|
|
@@ -2344,7 +2117,6 @@
|
|
|
2344
2117
|
var store = this.options.store;
|
|
2345
2118
|
store && store.set && store.set(this);
|
|
2346
2119
|
},
|
|
2347
|
-
|
|
2348
2120
|
/**
|
|
2349
2121
|
* 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.
|
|
2350
2122
|
* @param {HTMLElement} el
|
|
@@ -2354,7 +2126,6 @@
|
|
|
2354
2126
|
closest: function closest$1(el, selector) {
|
|
2355
2127
|
return closest(el, selector || this.options.draggable, this.el, false);
|
|
2356
2128
|
},
|
|
2357
|
-
|
|
2358
2129
|
/**
|
|
2359
2130
|
* Set/get option
|
|
2360
2131
|
* @param {string} name
|
|
@@ -2363,24 +2134,20 @@
|
|
|
2363
2134
|
*/
|
|
2364
2135
|
option: function option(name, value) {
|
|
2365
2136
|
var options = this.options;
|
|
2366
|
-
|
|
2367
2137
|
if (value === void 0) {
|
|
2368
2138
|
return options[name];
|
|
2369
2139
|
} else {
|
|
2370
2140
|
var modifiedValue = PluginManager.modifyOption(this, name, value);
|
|
2371
|
-
|
|
2372
2141
|
if (typeof modifiedValue !== 'undefined') {
|
|
2373
2142
|
options[name] = modifiedValue;
|
|
2374
2143
|
} else {
|
|
2375
2144
|
options[name] = value;
|
|
2376
2145
|
}
|
|
2377
|
-
|
|
2378
2146
|
if (name === 'group') {
|
|
2379
2147
|
_prepareGroup(options);
|
|
2380
2148
|
}
|
|
2381
2149
|
}
|
|
2382
2150
|
},
|
|
2383
|
-
|
|
2384
2151
|
/**
|
|
2385
2152
|
* Destroy
|
|
2386
2153
|
*/
|
|
@@ -2391,21 +2158,16 @@
|
|
|
2391
2158
|
off(el, 'mousedown', this._onTapStart);
|
|
2392
2159
|
off(el, 'touchstart', this._onTapStart);
|
|
2393
2160
|
off(el, 'pointerdown', this._onTapStart);
|
|
2394
|
-
|
|
2395
2161
|
if (this.nativeDraggable) {
|
|
2396
2162
|
off(el, 'dragover', this);
|
|
2397
2163
|
off(el, 'dragenter', this);
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2164
|
+
}
|
|
2165
|
+
// Remove draggable attributes
|
|
2401
2166
|
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
|
|
2402
2167
|
el.removeAttribute('draggable');
|
|
2403
2168
|
});
|
|
2404
|
-
|
|
2405
2169
|
this._onDrop();
|
|
2406
|
-
|
|
2407
2170
|
this._disableDelayedDragEvents();
|
|
2408
|
-
|
|
2409
2171
|
sortables.splice(sortables.indexOf(this.el), 1);
|
|
2410
2172
|
this.el = el = null;
|
|
2411
2173
|
},
|
|
@@ -2414,59 +2176,49 @@
|
|
|
2414
2176
|
pluginEvent('hideClone', this);
|
|
2415
2177
|
if (Sortable.eventCanceled) return;
|
|
2416
2178
|
css(cloneEl, 'display', 'none');
|
|
2417
|
-
|
|
2418
2179
|
if (this.options.removeCloneOnHide && cloneEl.parentNode) {
|
|
2419
2180
|
cloneEl.parentNode.removeChild(cloneEl);
|
|
2420
2181
|
}
|
|
2421
|
-
|
|
2422
2182
|
cloneHidden = true;
|
|
2423
2183
|
}
|
|
2424
2184
|
},
|
|
2425
2185
|
_showClone: function _showClone(putSortable) {
|
|
2426
2186
|
if (putSortable.lastPutMode !== 'clone') {
|
|
2427
2187
|
this._hideClone();
|
|
2428
|
-
|
|
2429
2188
|
return;
|
|
2430
2189
|
}
|
|
2431
|
-
|
|
2432
2190
|
if (cloneHidden) {
|
|
2433
2191
|
pluginEvent('showClone', this);
|
|
2434
|
-
if (Sortable.eventCanceled) return;
|
|
2192
|
+
if (Sortable.eventCanceled) return;
|
|
2435
2193
|
|
|
2436
|
-
|
|
2194
|
+
// show clone at dragEl or original position
|
|
2195
|
+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
|
|
2437
2196
|
rootEl.insertBefore(cloneEl, dragEl);
|
|
2438
2197
|
} else if (nextEl) {
|
|
2439
2198
|
rootEl.insertBefore(cloneEl, nextEl);
|
|
2440
2199
|
} else {
|
|
2441
2200
|
rootEl.appendChild(cloneEl);
|
|
2442
2201
|
}
|
|
2443
|
-
|
|
2444
2202
|
if (this.options.group.revertClone) {
|
|
2445
2203
|
this.animate(dragEl, cloneEl);
|
|
2446
2204
|
}
|
|
2447
|
-
|
|
2448
2205
|
css(cloneEl, 'display', '');
|
|
2449
2206
|
cloneHidden = false;
|
|
2450
2207
|
}
|
|
2451
2208
|
}
|
|
2452
2209
|
};
|
|
2453
|
-
|
|
2454
|
-
function _globalDragOver(
|
|
2455
|
-
/**Event*/
|
|
2456
|
-
evt) {
|
|
2210
|
+
function _globalDragOver( /**Event*/evt) {
|
|
2457
2211
|
if (evt.dataTransfer) {
|
|
2458
2212
|
evt.dataTransfer.dropEffect = 'move';
|
|
2459
2213
|
}
|
|
2460
|
-
|
|
2461
2214
|
evt.cancelable && evt.preventDefault();
|
|
2462
2215
|
}
|
|
2463
|
-
|
|
2464
2216
|
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
|
|
2465
2217
|
var evt,
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2218
|
+
sortable = fromEl[expando],
|
|
2219
|
+
onMoveFn = sortable.options.onMove,
|
|
2220
|
+
retVal;
|
|
2221
|
+
// Support for new CustomEvent feature
|
|
2470
2222
|
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
|
2471
2223
|
evt = new CustomEvent('move', {
|
|
2472
2224
|
bubbles: true,
|
|
@@ -2476,7 +2228,6 @@
|
|
|
2476
2228
|
evt = document.createEvent('Event');
|
|
2477
2229
|
evt.initEvent('move', true, true);
|
|
2478
2230
|
}
|
|
2479
|
-
|
|
2480
2231
|
evt.to = toEl;
|
|
2481
2232
|
evt.from = fromEl;
|
|
2482
2233
|
evt.dragged = dragEl;
|
|
@@ -2486,35 +2237,35 @@
|
|
|
2486
2237
|
evt.willInsertAfter = willInsertAfter;
|
|
2487
2238
|
evt.originalEvent = originalEvent;
|
|
2488
2239
|
fromEl.dispatchEvent(evt);
|
|
2489
|
-
|
|
2490
2240
|
if (onMoveFn) {
|
|
2491
2241
|
retVal = onMoveFn.call(sortable, evt, originalEvent);
|
|
2492
2242
|
}
|
|
2493
|
-
|
|
2494
2243
|
return retVal;
|
|
2495
2244
|
}
|
|
2496
|
-
|
|
2497
2245
|
function _disableDraggable(el) {
|
|
2498
2246
|
el.draggable = false;
|
|
2499
2247
|
}
|
|
2500
|
-
|
|
2501
2248
|
function _unsilent() {
|
|
2502
2249
|
_silent = false;
|
|
2503
2250
|
}
|
|
2504
|
-
|
|
2251
|
+
function _ghostIsFirst(evt, vertical, sortable) {
|
|
2252
|
+
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
|
|
2253
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
|
2254
|
+
var spacer = 10;
|
|
2255
|
+
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
|
|
2256
|
+
}
|
|
2505
2257
|
function _ghostIsLast(evt, vertical, sortable) {
|
|
2506
|
-
var
|
|
2258
|
+
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
|
|
2259
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
|
2507
2260
|
var spacer = 10;
|
|
2508
|
-
return vertical ? evt.clientX >
|
|
2261
|
+
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
|
|
2509
2262
|
}
|
|
2510
|
-
|
|
2511
2263
|
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
|
|
2512
2264
|
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2265
|
+
targetLength = vertical ? targetRect.height : targetRect.width,
|
|
2266
|
+
targetS1 = vertical ? targetRect.top : targetRect.left,
|
|
2267
|
+
targetS2 = vertical ? targetRect.bottom : targetRect.right,
|
|
2268
|
+
invert = false;
|
|
2518
2269
|
if (!invertSwap) {
|
|
2519
2270
|
// Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
|
|
2520
2271
|
if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
|
|
@@ -2524,7 +2275,6 @@
|
|
|
2524
2275
|
// past first invert threshold, do not restrict inverted threshold to dragEl shadow
|
|
2525
2276
|
pastFirstInvertThresh = true;
|
|
2526
2277
|
}
|
|
2527
|
-
|
|
2528
2278
|
if (!pastFirstInvertThresh) {
|
|
2529
2279
|
// dragEl shadow (target move distance shadow)
|
|
2530
2280
|
if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
|
|
@@ -2541,26 +2291,22 @@
|
|
|
2541
2291
|
}
|
|
2542
2292
|
}
|
|
2543
2293
|
}
|
|
2544
|
-
|
|
2545
2294
|
invert = invert || invertSwap;
|
|
2546
|
-
|
|
2547
2295
|
if (invert) {
|
|
2548
2296
|
// Invert of regular
|
|
2549
2297
|
if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
|
|
2550
2298
|
return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
|
|
2551
2299
|
}
|
|
2552
2300
|
}
|
|
2553
|
-
|
|
2554
2301
|
return 0;
|
|
2555
2302
|
}
|
|
2303
|
+
|
|
2556
2304
|
/**
|
|
2557
2305
|
* Gets the direction dragEl must be swapped relative to target in order to make it
|
|
2558
2306
|
* seem that dragEl has been "inserted" into that element's position
|
|
2559
2307
|
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
|
2560
2308
|
* @return {Number} Direction dragEl must be swapped
|
|
2561
2309
|
*/
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
2310
|
function _getInsertDirection(target) {
|
|
2565
2311
|
if (index(dragEl) < index(target)) {
|
|
2566
2312
|
return 1;
|
|
@@ -2568,55 +2314,48 @@
|
|
|
2568
2314
|
return -1;
|
|
2569
2315
|
}
|
|
2570
2316
|
}
|
|
2317
|
+
|
|
2571
2318
|
/**
|
|
2572
2319
|
* Generate id
|
|
2573
2320
|
* @param {HTMLElement} el
|
|
2574
2321
|
* @returns {String}
|
|
2575
2322
|
* @private
|
|
2576
2323
|
*/
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
2324
|
function _generateId(el) {
|
|
2580
2325
|
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2326
|
+
i = str.length,
|
|
2327
|
+
sum = 0;
|
|
2584
2328
|
while (i--) {
|
|
2585
2329
|
sum += str.charCodeAt(i);
|
|
2586
2330
|
}
|
|
2587
|
-
|
|
2588
2331
|
return sum.toString(36);
|
|
2589
2332
|
}
|
|
2590
|
-
|
|
2591
2333
|
function _saveInputCheckedState(root) {
|
|
2592
2334
|
savedInputChecked.length = 0;
|
|
2593
2335
|
var inputs = root.getElementsByTagName('input');
|
|
2594
2336
|
var idx = inputs.length;
|
|
2595
|
-
|
|
2596
2337
|
while (idx--) {
|
|
2597
2338
|
var el = inputs[idx];
|
|
2598
2339
|
el.checked && savedInputChecked.push(el);
|
|
2599
2340
|
}
|
|
2600
2341
|
}
|
|
2601
|
-
|
|
2602
2342
|
function _nextTick(fn) {
|
|
2603
2343
|
return setTimeout(fn, 0);
|
|
2604
2344
|
}
|
|
2605
|
-
|
|
2606
2345
|
function _cancelNextTick(id) {
|
|
2607
2346
|
return clearTimeout(id);
|
|
2608
|
-
}
|
|
2609
|
-
|
|
2347
|
+
}
|
|
2610
2348
|
|
|
2349
|
+
// Fixed #973:
|
|
2611
2350
|
if (documentExists) {
|
|
2612
2351
|
on(document, 'touchmove', function (evt) {
|
|
2613
2352
|
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
|
|
2614
2353
|
evt.preventDefault();
|
|
2615
2354
|
}
|
|
2616
2355
|
});
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2356
|
+
}
|
|
2619
2357
|
|
|
2358
|
+
// Export utils
|
|
2620
2359
|
Sortable.utils = {
|
|
2621
2360
|
on: on,
|
|
2622
2361
|
off: off,
|
|
@@ -2634,81 +2373,77 @@
|
|
|
2634
2373
|
nextTick: _nextTick,
|
|
2635
2374
|
cancelNextTick: _cancelNextTick,
|
|
2636
2375
|
detectDirection: _detectDirection,
|
|
2637
|
-
getChild: getChild
|
|
2376
|
+
getChild: getChild,
|
|
2377
|
+
expando: expando
|
|
2638
2378
|
};
|
|
2379
|
+
|
|
2639
2380
|
/**
|
|
2640
2381
|
* Get the Sortable instance of an element
|
|
2641
2382
|
* @param {HTMLElement} element The element
|
|
2642
2383
|
* @return {Sortable|undefined} The instance of Sortable
|
|
2643
2384
|
*/
|
|
2644
|
-
|
|
2645
2385
|
Sortable.get = function (element) {
|
|
2646
2386
|
return element[expando];
|
|
2647
2387
|
};
|
|
2388
|
+
|
|
2648
2389
|
/**
|
|
2649
2390
|
* Mount a plugin to Sortable
|
|
2650
2391
|
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
|
2651
2392
|
*/
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
2393
|
Sortable.mount = function () {
|
|
2655
2394
|
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2656
2395
|
plugins[_key] = arguments[_key];
|
|
2657
2396
|
}
|
|
2658
|
-
|
|
2659
2397
|
if (plugins[0].constructor === Array) plugins = plugins[0];
|
|
2660
2398
|
plugins.forEach(function (plugin) {
|
|
2661
2399
|
if (!plugin.prototype || !plugin.prototype.constructor) {
|
|
2662
2400
|
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
|
|
2663
2401
|
}
|
|
2664
|
-
|
|
2665
|
-
if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils);
|
|
2402
|
+
if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
|
|
2666
2403
|
PluginManager.mount(plugin);
|
|
2667
2404
|
});
|
|
2668
2405
|
};
|
|
2406
|
+
|
|
2669
2407
|
/**
|
|
2670
2408
|
* Create sortable instance
|
|
2671
2409
|
* @param {HTMLElement} el
|
|
2672
2410
|
* @param {Object} [options]
|
|
2673
2411
|
*/
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
2412
|
Sortable.create = function (el, options) {
|
|
2677
2413
|
return new Sortable(el, options);
|
|
2678
|
-
};
|
|
2679
|
-
|
|
2414
|
+
};
|
|
2680
2415
|
|
|
2416
|
+
// Export
|
|
2681
2417
|
Sortable.version = version;
|
|
2682
2418
|
|
|
2683
2419
|
var autoScrolls = [],
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2420
|
+
scrollEl,
|
|
2421
|
+
scrollRootEl,
|
|
2422
|
+
scrolling = false,
|
|
2423
|
+
lastAutoScrollX,
|
|
2424
|
+
lastAutoScrollY,
|
|
2425
|
+
touchEvt$1,
|
|
2426
|
+
pointerElemChangedInterval;
|
|
2692
2427
|
function AutoScrollPlugin() {
|
|
2693
2428
|
function AutoScroll() {
|
|
2694
2429
|
this.defaults = {
|
|
2695
2430
|
scroll: true,
|
|
2431
|
+
forceAutoScrollFallback: false,
|
|
2696
2432
|
scrollSensitivity: 30,
|
|
2697
2433
|
scrollSpeed: 10,
|
|
2698
2434
|
bubbleScroll: true
|
|
2699
|
-
};
|
|
2435
|
+
};
|
|
2700
2436
|
|
|
2437
|
+
// Bind all private methods
|
|
2701
2438
|
for (var fn in this) {
|
|
2702
2439
|
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
|
2703
2440
|
this[fn] = this[fn].bind(this);
|
|
2704
2441
|
}
|
|
2705
2442
|
}
|
|
2706
2443
|
}
|
|
2707
|
-
|
|
2708
2444
|
AutoScroll.prototype = {
|
|
2709
2445
|
dragStarted: function dragStarted(_ref) {
|
|
2710
2446
|
var originalEvent = _ref.originalEvent;
|
|
2711
|
-
|
|
2712
2447
|
if (this.sortable.nativeDraggable) {
|
|
2713
2448
|
on(document, 'dragover', this._handleAutoScroll);
|
|
2714
2449
|
} else {
|
|
@@ -2723,7 +2458,6 @@
|
|
|
2723
2458
|
},
|
|
2724
2459
|
dragOverCompleted: function dragOverCompleted(_ref2) {
|
|
2725
2460
|
var originalEvent = _ref2.originalEvent;
|
|
2726
|
-
|
|
2727
2461
|
// For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
|
|
2728
2462
|
if (!this.options.dragOverBubble && !originalEvent.rootEl) {
|
|
2729
2463
|
this._handleAutoScroll(originalEvent);
|
|
@@ -2737,7 +2471,6 @@
|
|
|
2737
2471
|
off(document, 'touchmove', this._handleFallbackAutoScroll);
|
|
2738
2472
|
off(document, 'mousemove', this._handleFallbackAutoScroll);
|
|
2739
2473
|
}
|
|
2740
|
-
|
|
2741
2474
|
clearPointerElemChangedInterval();
|
|
2742
2475
|
clearAutoScrolls();
|
|
2743
2476
|
cancelThrottle();
|
|
@@ -2751,31 +2484,29 @@
|
|
|
2751
2484
|
},
|
|
2752
2485
|
_handleAutoScroll: function _handleAutoScroll(evt, fallback) {
|
|
2753
2486
|
var _this = this;
|
|
2754
|
-
|
|
2755
2487
|
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
touchEvt$1 = evt;
|
|
2488
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
|
2489
|
+
elem = document.elementFromPoint(x, y);
|
|
2490
|
+
touchEvt$1 = evt;
|
|
2491
|
+
|
|
2492
|
+
// IE does not seem to have native autoscroll,
|
|
2759
2493
|
// Edge's autoscroll seems too conditional,
|
|
2760
2494
|
// MACOS Safari does not have autoscroll,
|
|
2761
2495
|
// Firefox and Chrome are good
|
|
2496
|
+
if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
|
|
2497
|
+
autoScroll(evt, this.options, elem, fallback);
|
|
2762
2498
|
|
|
2763
|
-
|
|
2764
|
-
autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
|
|
2765
|
-
|
|
2499
|
+
// Listener for pointer element change
|
|
2766
2500
|
var ogElemScroller = getParentAutoScrollElement(elem, true);
|
|
2767
|
-
|
|
2768
2501
|
if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
|
|
2769
|
-
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
|
2770
|
-
|
|
2502
|
+
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
|
2503
|
+
// Detect for pointer elem change, emulating native DnD behaviour
|
|
2771
2504
|
pointerElemChangedInterval = setInterval(function () {
|
|
2772
2505
|
var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
|
|
2773
|
-
|
|
2774
2506
|
if (newElem !== ogElemScroller) {
|
|
2775
2507
|
ogElemScroller = newElem;
|
|
2776
2508
|
clearAutoScrolls();
|
|
2777
2509
|
}
|
|
2778
|
-
|
|
2779
2510
|
autoScroll(evt, _this.options, newElem, fallback);
|
|
2780
2511
|
}, 10);
|
|
2781
2512
|
lastAutoScrollX = x;
|
|
@@ -2787,7 +2518,6 @@
|
|
|
2787
2518
|
clearAutoScrolls();
|
|
2788
2519
|
return;
|
|
2789
2520
|
}
|
|
2790
|
-
|
|
2791
2521
|
autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
|
|
2792
2522
|
}
|
|
2793
2523
|
}
|
|
@@ -2797,60 +2527,54 @@
|
|
|
2797
2527
|
initializeByDefault: true
|
|
2798
2528
|
});
|
|
2799
2529
|
}
|
|
2800
|
-
|
|
2801
2530
|
function clearAutoScrolls() {
|
|
2802
2531
|
autoScrolls.forEach(function (autoScroll) {
|
|
2803
2532
|
clearInterval(autoScroll.pid);
|
|
2804
2533
|
});
|
|
2805
2534
|
autoScrolls = [];
|
|
2806
2535
|
}
|
|
2807
|
-
|
|
2808
2536
|
function clearPointerElemChangedInterval() {
|
|
2809
2537
|
clearInterval(pointerElemChangedInterval);
|
|
2810
2538
|
}
|
|
2811
|
-
|
|
2812
2539
|
var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
|
|
2813
2540
|
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
|
|
2814
2541
|
if (!options.scroll) return;
|
|
2815
2542
|
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2543
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
|
2544
|
+
sens = options.scrollSensitivity,
|
|
2545
|
+
speed = options.scrollSpeed,
|
|
2546
|
+
winScroller = getWindowScrollingElement();
|
|
2820
2547
|
var scrollThisInstance = false,
|
|
2821
|
-
|
|
2548
|
+
scrollCustomFn;
|
|
2822
2549
|
|
|
2550
|
+
// New scroll root, set scrollEl
|
|
2823
2551
|
if (scrollRootEl !== rootEl) {
|
|
2824
2552
|
scrollRootEl = rootEl;
|
|
2825
2553
|
clearAutoScrolls();
|
|
2826
2554
|
scrollEl = options.scroll;
|
|
2827
2555
|
scrollCustomFn = options.scrollFn;
|
|
2828
|
-
|
|
2829
2556
|
if (scrollEl === true) {
|
|
2830
2557
|
scrollEl = getParentAutoScrollElement(rootEl, true);
|
|
2831
2558
|
}
|
|
2832
2559
|
}
|
|
2833
|
-
|
|
2834
2560
|
var layersOut = 0;
|
|
2835
2561
|
var currentParent = scrollEl;
|
|
2836
|
-
|
|
2837
2562
|
do {
|
|
2838
2563
|
var el = currentParent,
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2564
|
+
rect = getRect(el),
|
|
2565
|
+
top = rect.top,
|
|
2566
|
+
bottom = rect.bottom,
|
|
2567
|
+
left = rect.left,
|
|
2568
|
+
right = rect.right,
|
|
2569
|
+
width = rect.width,
|
|
2570
|
+
height = rect.height,
|
|
2571
|
+
canScrollX = void 0,
|
|
2572
|
+
canScrollY = void 0,
|
|
2573
|
+
scrollWidth = el.scrollWidth,
|
|
2574
|
+
scrollHeight = el.scrollHeight,
|
|
2575
|
+
elCSS = css(el),
|
|
2576
|
+
scrollPosX = el.scrollLeft,
|
|
2577
|
+
scrollPosY = el.scrollTop;
|
|
2854
2578
|
if (el === winScroller) {
|
|
2855
2579
|
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
|
|
2856
2580
|
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
|
|
@@ -2858,10 +2582,8 @@
|
|
|
2858
2582
|
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
|
|
2859
2583
|
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
|
|
2860
2584
|
}
|
|
2861
|
-
|
|
2862
2585
|
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
|
2863
2586
|
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
|
2864
|
-
|
|
2865
2587
|
if (!autoScrolls[layersOut]) {
|
|
2866
2588
|
for (var i = 0; i <= layersOut; i++) {
|
|
2867
2589
|
if (!autoScrolls[i]) {
|
|
@@ -2869,61 +2591,51 @@
|
|
|
2869
2591
|
}
|
|
2870
2592
|
}
|
|
2871
2593
|
}
|
|
2872
|
-
|
|
2873
2594
|
if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
|
|
2874
2595
|
autoScrolls[layersOut].el = el;
|
|
2875
2596
|
autoScrolls[layersOut].vx = vx;
|
|
2876
2597
|
autoScrolls[layersOut].vy = vy;
|
|
2877
2598
|
clearInterval(autoScrolls[layersOut].pid);
|
|
2878
|
-
|
|
2879
2599
|
if (vx != 0 || vy != 0) {
|
|
2880
2600
|
scrollThisInstance = true;
|
|
2881
2601
|
/* jshint loopfunc:true */
|
|
2882
|
-
|
|
2883
2602
|
autoScrolls[layersOut].pid = setInterval(function () {
|
|
2884
2603
|
// emulate drag over during autoscroll (fallback), emulating native DnD behaviour
|
|
2885
2604
|
if (isFallback && this.layer === 0) {
|
|
2886
2605
|
Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
|
|
2887
|
-
|
|
2888
2606
|
}
|
|
2889
|
-
|
|
2890
2607
|
var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
|
|
2891
2608
|
var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
|
|
2892
|
-
|
|
2893
2609
|
if (typeof scrollCustomFn === 'function') {
|
|
2894
2610
|
if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
|
|
2895
2611
|
return;
|
|
2896
2612
|
}
|
|
2897
2613
|
}
|
|
2898
|
-
|
|
2899
2614
|
scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
|
|
2900
2615
|
}.bind({
|
|
2901
2616
|
layer: layersOut
|
|
2902
2617
|
}), 24);
|
|
2903
2618
|
}
|
|
2904
2619
|
}
|
|
2905
|
-
|
|
2906
2620
|
layersOut++;
|
|
2907
2621
|
} while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
|
|
2908
|
-
|
|
2909
2622
|
scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
|
|
2910
2623
|
}, 30);
|
|
2911
2624
|
|
|
2912
2625
|
var drop = function drop(_ref) {
|
|
2913
2626
|
var originalEvent = _ref.originalEvent,
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2627
|
+
putSortable = _ref.putSortable,
|
|
2628
|
+
dragEl = _ref.dragEl,
|
|
2629
|
+
activeSortable = _ref.activeSortable,
|
|
2630
|
+
dispatchSortableEvent = _ref.dispatchSortableEvent,
|
|
2631
|
+
hideGhostForTarget = _ref.hideGhostForTarget,
|
|
2632
|
+
unhideGhostForTarget = _ref.unhideGhostForTarget;
|
|
2920
2633
|
if (!originalEvent) return;
|
|
2921
2634
|
var toSortable = putSortable || activeSortable;
|
|
2922
2635
|
hideGhostForTarget();
|
|
2923
2636
|
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
|
|
2924
2637
|
var target = document.elementFromPoint(touch.clientX, touch.clientY);
|
|
2925
2638
|
unhideGhostForTarget();
|
|
2926
|
-
|
|
2927
2639
|
if (toSortable && !toSortable.el.contains(target)) {
|
|
2928
2640
|
dispatchSortableEvent('spill');
|
|
2929
2641
|
this.onSpill({
|
|
@@ -2932,9 +2644,7 @@
|
|
|
2932
2644
|
});
|
|
2933
2645
|
}
|
|
2934
2646
|
};
|
|
2935
|
-
|
|
2936
2647
|
function Revert() {}
|
|
2937
|
-
|
|
2938
2648
|
Revert.prototype = {
|
|
2939
2649
|
startIndex: null,
|
|
2940
2650
|
dragStart: function dragStart(_ref2) {
|
|
@@ -2943,40 +2653,32 @@
|
|
|
2943
2653
|
},
|
|
2944
2654
|
onSpill: function onSpill(_ref3) {
|
|
2945
2655
|
var dragEl = _ref3.dragEl,
|
|
2946
|
-
|
|
2656
|
+
putSortable = _ref3.putSortable;
|
|
2947
2657
|
this.sortable.captureAnimationState();
|
|
2948
|
-
|
|
2949
2658
|
if (putSortable) {
|
|
2950
2659
|
putSortable.captureAnimationState();
|
|
2951
2660
|
}
|
|
2952
|
-
|
|
2953
2661
|
var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
|
|
2954
|
-
|
|
2955
2662
|
if (nextSibling) {
|
|
2956
2663
|
this.sortable.el.insertBefore(dragEl, nextSibling);
|
|
2957
2664
|
} else {
|
|
2958
2665
|
this.sortable.el.appendChild(dragEl);
|
|
2959
2666
|
}
|
|
2960
|
-
|
|
2961
2667
|
this.sortable.animateAll();
|
|
2962
|
-
|
|
2963
2668
|
if (putSortable) {
|
|
2964
2669
|
putSortable.animateAll();
|
|
2965
2670
|
}
|
|
2966
2671
|
},
|
|
2967
2672
|
drop: drop
|
|
2968
2673
|
};
|
|
2969
|
-
|
|
2970
2674
|
_extends(Revert, {
|
|
2971
2675
|
pluginName: 'revertOnSpill'
|
|
2972
2676
|
});
|
|
2973
|
-
|
|
2974
2677
|
function Remove() {}
|
|
2975
|
-
|
|
2976
2678
|
Remove.prototype = {
|
|
2977
2679
|
onSpill: function onSpill(_ref4) {
|
|
2978
2680
|
var dragEl = _ref4.dragEl,
|
|
2979
|
-
|
|
2681
|
+
putSortable = _ref4.putSortable;
|
|
2980
2682
|
var parentSortable = putSortable || this.sortable;
|
|
2981
2683
|
parentSortable.captureAnimationState();
|
|
2982
2684
|
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
|
|
@@ -2984,20 +2686,17 @@
|
|
|
2984
2686
|
},
|
|
2985
2687
|
drop: drop
|
|
2986
2688
|
};
|
|
2987
|
-
|
|
2988
2689
|
_extends(Remove, {
|
|
2989
2690
|
pluginName: 'removeOnSpill'
|
|
2990
2691
|
});
|
|
2991
2692
|
|
|
2992
2693
|
var lastSwapEl;
|
|
2993
|
-
|
|
2994
2694
|
function SwapPlugin() {
|
|
2995
2695
|
function Swap() {
|
|
2996
2696
|
this.defaults = {
|
|
2997
2697
|
swapClass: 'sortable-swap-highlight'
|
|
2998
2698
|
};
|
|
2999
2699
|
}
|
|
3000
|
-
|
|
3001
2700
|
Swap.prototype = {
|
|
3002
2701
|
dragStart: function dragStart(_ref) {
|
|
3003
2702
|
var dragEl = _ref.dragEl;
|
|
@@ -3005,42 +2704,37 @@
|
|
|
3005
2704
|
},
|
|
3006
2705
|
dragOverValid: function dragOverValid(_ref2) {
|
|
3007
2706
|
var completed = _ref2.completed,
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2707
|
+
target = _ref2.target,
|
|
2708
|
+
onMove = _ref2.onMove,
|
|
2709
|
+
activeSortable = _ref2.activeSortable,
|
|
2710
|
+
changed = _ref2.changed,
|
|
2711
|
+
cancel = _ref2.cancel;
|
|
3013
2712
|
if (!activeSortable.options.swap) return;
|
|
3014
2713
|
var el = this.sortable.el,
|
|
3015
|
-
|
|
3016
|
-
|
|
2714
|
+
options = this.options;
|
|
3017
2715
|
if (target && target !== el) {
|
|
3018
2716
|
var prevSwapEl = lastSwapEl;
|
|
3019
|
-
|
|
3020
2717
|
if (onMove(target) !== false) {
|
|
3021
2718
|
toggleClass(target, options.swapClass, true);
|
|
3022
2719
|
lastSwapEl = target;
|
|
3023
2720
|
} else {
|
|
3024
2721
|
lastSwapEl = null;
|
|
3025
2722
|
}
|
|
3026
|
-
|
|
3027
2723
|
if (prevSwapEl && prevSwapEl !== lastSwapEl) {
|
|
3028
2724
|
toggleClass(prevSwapEl, options.swapClass, false);
|
|
3029
2725
|
}
|
|
3030
2726
|
}
|
|
3031
|
-
|
|
3032
2727
|
changed();
|
|
3033
2728
|
completed(true);
|
|
3034
2729
|
cancel();
|
|
3035
2730
|
},
|
|
3036
2731
|
drop: function drop(_ref3) {
|
|
3037
2732
|
var activeSortable = _ref3.activeSortable,
|
|
3038
|
-
|
|
3039
|
-
|
|
2733
|
+
putSortable = _ref3.putSortable,
|
|
2734
|
+
dragEl = _ref3.dragEl;
|
|
3040
2735
|
var toSortable = putSortable || this.sortable;
|
|
3041
2736
|
var options = this.options;
|
|
3042
2737
|
lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);
|
|
3043
|
-
|
|
3044
2738
|
if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {
|
|
3045
2739
|
if (dragEl !== lastSwapEl) {
|
|
3046
2740
|
toSortable.captureAnimationState();
|
|
@@ -3064,38 +2758,34 @@
|
|
|
3064
2758
|
}
|
|
3065
2759
|
});
|
|
3066
2760
|
}
|
|
3067
|
-
|
|
3068
2761
|
function swapNodes(n1, n2) {
|
|
3069
2762
|
var p1 = n1.parentNode,
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
2763
|
+
p2 = n2.parentNode,
|
|
2764
|
+
i1,
|
|
2765
|
+
i2;
|
|
3073
2766
|
if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;
|
|
3074
2767
|
i1 = index(n1);
|
|
3075
2768
|
i2 = index(n2);
|
|
3076
|
-
|
|
3077
2769
|
if (p1.isEqualNode(p2) && i1 < i2) {
|
|
3078
2770
|
i2++;
|
|
3079
2771
|
}
|
|
3080
|
-
|
|
3081
2772
|
p1.insertBefore(n2, p1.children[i1]);
|
|
3082
2773
|
p2.insertBefore(n1, p2.children[i2]);
|
|
3083
2774
|
}
|
|
3084
2775
|
|
|
3085
2776
|
var multiDragElements = [],
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
2777
|
+
multiDragClones = [],
|
|
2778
|
+
lastMultiDragSelect,
|
|
2779
|
+
// for selection with modifier key down (SHIFT)
|
|
2780
|
+
multiDragSortable,
|
|
2781
|
+
initialFolding = false,
|
|
2782
|
+
// Initial multi-drag fold when drag started
|
|
2783
|
+
folding = false,
|
|
2784
|
+
// Folding any other time
|
|
2785
|
+
dragStarted = false,
|
|
2786
|
+
dragEl$1,
|
|
2787
|
+
clonesFromRect,
|
|
2788
|
+
clonesHidden;
|
|
3099
2789
|
function MultiDragPlugin() {
|
|
3100
2790
|
function MultiDrag(sortable) {
|
|
3101
2791
|
// Bind all private methods
|
|
@@ -3104,22 +2794,22 @@
|
|
|
3104
2794
|
this[fn] = this[fn].bind(this);
|
|
3105
2795
|
}
|
|
3106
2796
|
}
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
2797
|
+
if (!sortable.options.avoidImplicitDeselect) {
|
|
2798
|
+
if (sortable.options.supportPointer) {
|
|
2799
|
+
on(document, 'pointerup', this._deselectMultiDrag);
|
|
2800
|
+
} else {
|
|
2801
|
+
on(document, 'mouseup', this._deselectMultiDrag);
|
|
2802
|
+
on(document, 'touchend', this._deselectMultiDrag);
|
|
2803
|
+
}
|
|
3113
2804
|
}
|
|
3114
|
-
|
|
3115
2805
|
on(document, 'keydown', this._checkKeyDown);
|
|
3116
2806
|
on(document, 'keyup', this._checkKeyUp);
|
|
3117
2807
|
this.defaults = {
|
|
3118
2808
|
selectedClass: 'sortable-selected',
|
|
3119
2809
|
multiDragKey: null,
|
|
2810
|
+
avoidImplicitDeselect: false,
|
|
3120
2811
|
setData: function setData(dataTransfer, dragEl) {
|
|
3121
2812
|
var data = '';
|
|
3122
|
-
|
|
3123
2813
|
if (multiDragElements.length && multiDragSortable === sortable) {
|
|
3124
2814
|
multiDragElements.forEach(function (multiDragElement, i) {
|
|
3125
2815
|
data += (!i ? '' : ', ') + multiDragElement.textContent;
|
|
@@ -3127,12 +2817,10 @@
|
|
|
3127
2817
|
} else {
|
|
3128
2818
|
data = dragEl.textContent;
|
|
3129
2819
|
}
|
|
3130
|
-
|
|
3131
2820
|
dataTransfer.setData('Text', data);
|
|
3132
2821
|
}
|
|
3133
2822
|
};
|
|
3134
2823
|
}
|
|
3135
|
-
|
|
3136
2824
|
MultiDrag.prototype = {
|
|
3137
2825
|
multiDragKeyDown: false,
|
|
3138
2826
|
isMultiDrag: false,
|
|
@@ -3145,9 +2833,8 @@
|
|
|
3145
2833
|
},
|
|
3146
2834
|
setupClone: function setupClone(_ref2) {
|
|
3147
2835
|
var sortable = _ref2.sortable,
|
|
3148
|
-
|
|
2836
|
+
cancel = _ref2.cancel;
|
|
3149
2837
|
if (!this.isMultiDrag) return;
|
|
3150
|
-
|
|
3151
2838
|
for (var i = 0; i < multiDragElements.length; i++) {
|
|
3152
2839
|
multiDragClones.push(clone(multiDragElements[i]));
|
|
3153
2840
|
multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;
|
|
@@ -3156,18 +2843,15 @@
|
|
|
3156
2843
|
toggleClass(multiDragClones[i], this.options.selectedClass, false);
|
|
3157
2844
|
multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);
|
|
3158
2845
|
}
|
|
3159
|
-
|
|
3160
2846
|
sortable._hideClone();
|
|
3161
|
-
|
|
3162
2847
|
cancel();
|
|
3163
2848
|
},
|
|
3164
2849
|
clone: function clone(_ref3) {
|
|
3165
2850
|
var sortable = _ref3.sortable,
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
2851
|
+
rootEl = _ref3.rootEl,
|
|
2852
|
+
dispatchSortableEvent = _ref3.dispatchSortableEvent,
|
|
2853
|
+
cancel = _ref3.cancel;
|
|
3169
2854
|
if (!this.isMultiDrag) return;
|
|
3170
|
-
|
|
3171
2855
|
if (!this.options.removeCloneOnHide) {
|
|
3172
2856
|
if (multiDragElements.length && multiDragSortable === sortable) {
|
|
3173
2857
|
insertMultiDragClones(true, rootEl);
|
|
@@ -3178,8 +2862,8 @@
|
|
|
3178
2862
|
},
|
|
3179
2863
|
showClone: function showClone(_ref4) {
|
|
3180
2864
|
var cloneNowShown = _ref4.cloneNowShown,
|
|
3181
|
-
|
|
3182
|
-
|
|
2865
|
+
rootEl = _ref4.rootEl,
|
|
2866
|
+
cancel = _ref4.cancel;
|
|
3183
2867
|
if (!this.isMultiDrag) return;
|
|
3184
2868
|
insertMultiDragClones(false, rootEl);
|
|
3185
2869
|
multiDragClones.forEach(function (clone) {
|
|
@@ -3191,14 +2875,12 @@
|
|
|
3191
2875
|
},
|
|
3192
2876
|
hideClone: function hideClone(_ref5) {
|
|
3193
2877
|
var _this = this;
|
|
3194
|
-
|
|
3195
2878
|
var sortable = _ref5.sortable,
|
|
3196
|
-
|
|
3197
|
-
|
|
2879
|
+
cloneNowHidden = _ref5.cloneNowHidden,
|
|
2880
|
+
cancel = _ref5.cancel;
|
|
3198
2881
|
if (!this.isMultiDrag) return;
|
|
3199
2882
|
multiDragClones.forEach(function (clone) {
|
|
3200
2883
|
css(clone, 'display', 'none');
|
|
3201
|
-
|
|
3202
2884
|
if (_this.options.removeCloneOnHide && clone.parentNode) {
|
|
3203
2885
|
clone.parentNode.removeChild(clone);
|
|
3204
2886
|
}
|
|
@@ -3209,15 +2891,14 @@
|
|
|
3209
2891
|
},
|
|
3210
2892
|
dragStartGlobal: function dragStartGlobal(_ref6) {
|
|
3211
2893
|
var sortable = _ref6.sortable;
|
|
3212
|
-
|
|
3213
2894
|
if (!this.isMultiDrag && multiDragSortable) {
|
|
3214
2895
|
multiDragSortable.multiDrag._deselectMultiDrag();
|
|
3215
2896
|
}
|
|
3216
|
-
|
|
3217
2897
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3218
2898
|
multiDragElement.sortableIndex = index(multiDragElement);
|
|
3219
|
-
});
|
|
2899
|
+
});
|
|
3220
2900
|
|
|
2901
|
+
// Sort multi-drag elements
|
|
3221
2902
|
multiDragElements = multiDragElements.sort(function (a, b) {
|
|
3222
2903
|
return a.sortableIndex - b.sortableIndex;
|
|
3223
2904
|
});
|
|
@@ -3225,10 +2906,8 @@
|
|
|
3225
2906
|
},
|
|
3226
2907
|
dragStarted: function dragStarted(_ref7) {
|
|
3227
2908
|
var _this2 = this;
|
|
3228
|
-
|
|
3229
2909
|
var sortable = _ref7.sortable;
|
|
3230
2910
|
if (!this.isMultiDrag) return;
|
|
3231
|
-
|
|
3232
2911
|
if (this.options.sort) {
|
|
3233
2912
|
// Capture rects,
|
|
3234
2913
|
// hide multi drag elements (by positioning them absolute),
|
|
@@ -3236,8 +2915,8 @@
|
|
|
3236
2915
|
// show multi drag elements,
|
|
3237
2916
|
// animate to rects,
|
|
3238
2917
|
// unset rects & remove from DOM
|
|
3239
|
-
sortable.captureAnimationState();
|
|
3240
2918
|
|
|
2919
|
+
sortable.captureAnimationState();
|
|
3241
2920
|
if (this.options.animation) {
|
|
3242
2921
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3243
2922
|
if (multiDragElement === dragEl$1) return;
|
|
@@ -3252,18 +2931,16 @@
|
|
|
3252
2931
|
initialFolding = true;
|
|
3253
2932
|
}
|
|
3254
2933
|
}
|
|
3255
|
-
|
|
3256
2934
|
sortable.animateAll(function () {
|
|
3257
2935
|
folding = false;
|
|
3258
2936
|
initialFolding = false;
|
|
3259
|
-
|
|
3260
2937
|
if (_this2.options.animation) {
|
|
3261
2938
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3262
2939
|
unsetRect(multiDragElement);
|
|
3263
2940
|
});
|
|
3264
|
-
}
|
|
3265
|
-
|
|
2941
|
+
}
|
|
3266
2942
|
|
|
2943
|
+
// Remove all auxiliary multidrag items from el, if sorting enabled
|
|
3267
2944
|
if (_this2.options.sort) {
|
|
3268
2945
|
removeMultiDragElements();
|
|
3269
2946
|
}
|
|
@@ -3271,9 +2948,8 @@
|
|
|
3271
2948
|
},
|
|
3272
2949
|
dragOver: function dragOver(_ref8) {
|
|
3273
2950
|
var target = _ref8.target,
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
2951
|
+
completed = _ref8.completed,
|
|
2952
|
+
cancel = _ref8.cancel;
|
|
3277
2953
|
if (folding && ~multiDragElements.indexOf(target)) {
|
|
3278
2954
|
completed(false);
|
|
3279
2955
|
cancel();
|
|
@@ -3281,10 +2957,9 @@
|
|
|
3281
2957
|
},
|
|
3282
2958
|
revert: function revert(_ref9) {
|
|
3283
2959
|
var fromSortable = _ref9.fromSortable,
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
2960
|
+
rootEl = _ref9.rootEl,
|
|
2961
|
+
sortable = _ref9.sortable,
|
|
2962
|
+
dragRect = _ref9.dragRect;
|
|
3288
2963
|
if (multiDragElements.length > 1) {
|
|
3289
2964
|
// Setup unfold animation
|
|
3290
2965
|
multiDragElements.forEach(function (multiDragElement) {
|
|
@@ -3302,47 +2977,44 @@
|
|
|
3302
2977
|
},
|
|
3303
2978
|
dragOverCompleted: function dragOverCompleted(_ref10) {
|
|
3304
2979
|
var sortable = _ref10.sortable,
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
2980
|
+
isOwner = _ref10.isOwner,
|
|
2981
|
+
insertion = _ref10.insertion,
|
|
2982
|
+
activeSortable = _ref10.activeSortable,
|
|
2983
|
+
parentEl = _ref10.parentEl,
|
|
2984
|
+
putSortable = _ref10.putSortable;
|
|
3310
2985
|
var options = this.options;
|
|
3311
|
-
|
|
3312
2986
|
if (insertion) {
|
|
3313
2987
|
// Clones must be hidden before folding animation to capture dragRectAbsolute properly
|
|
3314
2988
|
if (isOwner) {
|
|
3315
2989
|
activeSortable._hideClone();
|
|
3316
2990
|
}
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
2991
|
+
initialFolding = false;
|
|
2992
|
+
// If leaving sort:false root, or already folding - Fold to new location
|
|
3320
2993
|
if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {
|
|
3321
2994
|
// Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible
|
|
3322
2995
|
var dragRectAbsolute = getRect(dragEl$1, false, true, true);
|
|
3323
2996
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3324
2997
|
if (multiDragElement === dragEl$1) return;
|
|
3325
|
-
setRect(multiDragElement, dragRectAbsolute);
|
|
3326
|
-
// while folding, and so that we can capture them again because old sortable will no longer be fromSortable
|
|
2998
|
+
setRect(multiDragElement, dragRectAbsolute);
|
|
3327
2999
|
|
|
3000
|
+
// Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted
|
|
3001
|
+
// while folding, and so that we can capture them again because old sortable will no longer be fromSortable
|
|
3328
3002
|
parentEl.appendChild(multiDragElement);
|
|
3329
3003
|
});
|
|
3330
3004
|
folding = true;
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3005
|
+
}
|
|
3333
3006
|
|
|
3007
|
+
// Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out
|
|
3334
3008
|
if (!isOwner) {
|
|
3335
3009
|
// Only remove if not folding (folding will remove them anyways)
|
|
3336
3010
|
if (!folding) {
|
|
3337
3011
|
removeMultiDragElements();
|
|
3338
3012
|
}
|
|
3339
|
-
|
|
3340
3013
|
if (multiDragElements.length > 1) {
|
|
3341
3014
|
var clonesHiddenBefore = clonesHidden;
|
|
3015
|
+
activeSortable._showClone(sortable);
|
|
3342
3016
|
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3017
|
+
// Unfold animation for clones if showing from hidden
|
|
3346
3018
|
if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {
|
|
3347
3019
|
multiDragClones.forEach(function (clone) {
|
|
3348
3020
|
activeSortable.addAnimationState({
|
|
@@ -3361,12 +3033,11 @@
|
|
|
3361
3033
|
},
|
|
3362
3034
|
dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {
|
|
3363
3035
|
var dragRect = _ref11.dragRect,
|
|
3364
|
-
|
|
3365
|
-
|
|
3036
|
+
isOwner = _ref11.isOwner,
|
|
3037
|
+
activeSortable = _ref11.activeSortable;
|
|
3366
3038
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3367
3039
|
multiDragElement.thisAnimationDuration = null;
|
|
3368
3040
|
});
|
|
3369
|
-
|
|
3370
3041
|
if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {
|
|
3371
3042
|
clonesFromRect = _extends({}, dragRect);
|
|
3372
3043
|
var dragMatrix = matrix(dragEl$1, true);
|
|
@@ -3382,24 +3053,23 @@
|
|
|
3382
3053
|
},
|
|
3383
3054
|
drop: function drop(_ref12) {
|
|
3384
3055
|
var evt = _ref12.originalEvent,
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3056
|
+
rootEl = _ref12.rootEl,
|
|
3057
|
+
parentEl = _ref12.parentEl,
|
|
3058
|
+
sortable = _ref12.sortable,
|
|
3059
|
+
dispatchSortableEvent = _ref12.dispatchSortableEvent,
|
|
3060
|
+
oldIndex = _ref12.oldIndex,
|
|
3061
|
+
putSortable = _ref12.putSortable;
|
|
3391
3062
|
var toSortable = putSortable || this.sortable;
|
|
3392
3063
|
if (!evt) return;
|
|
3393
3064
|
var options = this.options,
|
|
3394
|
-
|
|
3065
|
+
children = parentEl.children;
|
|
3395
3066
|
|
|
3067
|
+
// Multi-drag selection
|
|
3396
3068
|
if (!dragStarted) {
|
|
3397
3069
|
if (options.multiDragKey && !this.multiDragKeyDown) {
|
|
3398
3070
|
this._deselectMultiDrag();
|
|
3399
3071
|
}
|
|
3400
|
-
|
|
3401
3072
|
toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));
|
|
3402
|
-
|
|
3403
3073
|
if (!~multiDragElements.indexOf(dragEl$1)) {
|
|
3404
3074
|
multiDragElements.push(dragEl$1);
|
|
3405
3075
|
dispatchEvent({
|
|
@@ -3407,43 +3077,50 @@
|
|
|
3407
3077
|
rootEl: rootEl,
|
|
3408
3078
|
name: 'select',
|
|
3409
3079
|
targetEl: dragEl$1,
|
|
3410
|
-
|
|
3411
|
-
});
|
|
3080
|
+
originalEvent: evt
|
|
3081
|
+
});
|
|
3412
3082
|
|
|
3083
|
+
// Modifier activated, select from last to dragEl
|
|
3413
3084
|
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
|
|
3414
3085
|
var lastIndex = index(lastMultiDragSelect),
|
|
3415
|
-
|
|
3416
|
-
|
|
3086
|
+
currentIndex = index(dragEl$1);
|
|
3417
3087
|
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
sortable:
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3088
|
+
(function () {
|
|
3089
|
+
// Must include lastMultiDragSelect (select it), in case modified selection from no selection
|
|
3090
|
+
// (but previous selection existed)
|
|
3091
|
+
var n, i;
|
|
3092
|
+
if (currentIndex > lastIndex) {
|
|
3093
|
+
i = lastIndex;
|
|
3094
|
+
n = currentIndex;
|
|
3095
|
+
} else {
|
|
3096
|
+
i = currentIndex;
|
|
3097
|
+
n = lastIndex + 1;
|
|
3098
|
+
}
|
|
3099
|
+
var filter = options.filter;
|
|
3100
|
+
for (; i < n; i++) {
|
|
3101
|
+
if (~multiDragElements.indexOf(children[i])) continue;
|
|
3102
|
+
// Check if element is draggable
|
|
3103
|
+
if (!closest(children[i], options.draggable, parentEl, false)) continue;
|
|
3104
|
+
// Check if element is filtered
|
|
3105
|
+
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {
|
|
3106
|
+
return closest(children[i], criteria.trim(), parentEl, false);
|
|
3107
|
+
}));
|
|
3108
|
+
if (filtered) continue;
|
|
3109
|
+
toggleClass(children[i], options.selectedClass, true);
|
|
3110
|
+
multiDragElements.push(children[i]);
|
|
3111
|
+
dispatchEvent({
|
|
3112
|
+
sortable: sortable,
|
|
3113
|
+
rootEl: rootEl,
|
|
3114
|
+
name: 'select',
|
|
3115
|
+
targetEl: children[i],
|
|
3116
|
+
originalEvent: evt
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
})();
|
|
3442
3120
|
}
|
|
3443
3121
|
} else {
|
|
3444
3122
|
lastMultiDragSelect = dragEl$1;
|
|
3445
3123
|
}
|
|
3446
|
-
|
|
3447
3124
|
multiDragSortable = toSortable;
|
|
3448
3125
|
} else {
|
|
3449
3126
|
multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);
|
|
@@ -3453,40 +3130,40 @@
|
|
|
3453
3130
|
rootEl: rootEl,
|
|
3454
3131
|
name: 'deselect',
|
|
3455
3132
|
targetEl: dragEl$1,
|
|
3456
|
-
|
|
3133
|
+
originalEvent: evt
|
|
3457
3134
|
});
|
|
3458
3135
|
}
|
|
3459
|
-
}
|
|
3460
|
-
|
|
3136
|
+
}
|
|
3461
3137
|
|
|
3138
|
+
// Multi-drag drop
|
|
3462
3139
|
if (dragStarted && this.isMultiDrag) {
|
|
3140
|
+
folding = false;
|
|
3463
3141
|
// Do not "unfold" after around dragEl if reverted
|
|
3464
3142
|
if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {
|
|
3465
3143
|
var dragRect = getRect(dragEl$1),
|
|
3466
|
-
|
|
3144
|
+
multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');
|
|
3467
3145
|
if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;
|
|
3468
3146
|
toSortable.captureAnimationState();
|
|
3469
|
-
|
|
3470
3147
|
if (!initialFolding) {
|
|
3471
3148
|
if (options.animation) {
|
|
3472
3149
|
dragEl$1.fromRect = dragRect;
|
|
3473
3150
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3474
3151
|
multiDragElement.thisAnimationDuration = null;
|
|
3475
|
-
|
|
3476
3152
|
if (multiDragElement !== dragEl$1) {
|
|
3477
3153
|
var rect = folding ? getRect(multiDragElement) : dragRect;
|
|
3478
|
-
multiDragElement.fromRect = rect;
|
|
3154
|
+
multiDragElement.fromRect = rect;
|
|
3479
3155
|
|
|
3156
|
+
// Prepare unfold animation
|
|
3480
3157
|
toSortable.addAnimationState({
|
|
3481
3158
|
target: multiDragElement,
|
|
3482
3159
|
rect: rect
|
|
3483
3160
|
});
|
|
3484
3161
|
}
|
|
3485
3162
|
});
|
|
3486
|
-
}
|
|
3487
|
-
// properly they must all be removed
|
|
3488
|
-
|
|
3163
|
+
}
|
|
3489
3164
|
|
|
3165
|
+
// Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert
|
|
3166
|
+
// properly they must all be removed
|
|
3490
3167
|
removeMultiDragElements();
|
|
3491
3168
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3492
3169
|
if (children[multiDragIndex]) {
|
|
@@ -3494,12 +3171,12 @@
|
|
|
3494
3171
|
} else {
|
|
3495
3172
|
parentEl.appendChild(multiDragElement);
|
|
3496
3173
|
}
|
|
3497
|
-
|
|
3498
3174
|
multiDragIndex++;
|
|
3499
|
-
});
|
|
3175
|
+
});
|
|
3176
|
+
|
|
3177
|
+
// If initial folding is done, the elements may have changed position because they are now
|
|
3500
3178
|
// unfolding around dragEl, even though dragEl may not have his index changed, so update event
|
|
3501
3179
|
// must be fired here as Sortable will not.
|
|
3502
|
-
|
|
3503
3180
|
if (oldIndex === index(dragEl$1)) {
|
|
3504
3181
|
var update = false;
|
|
3505
3182
|
multiDragElements.forEach(function (multiDragElement) {
|
|
@@ -3508,24 +3185,23 @@
|
|
|
3508
3185
|
return;
|
|
3509
3186
|
}
|
|
3510
3187
|
});
|
|
3511
|
-
|
|
3512
3188
|
if (update) {
|
|
3513
3189
|
dispatchSortableEvent('update');
|
|
3190
|
+
dispatchSortableEvent('sort');
|
|
3514
3191
|
}
|
|
3515
3192
|
}
|
|
3516
|
-
}
|
|
3517
|
-
|
|
3193
|
+
}
|
|
3518
3194
|
|
|
3195
|
+
// Must be done after capturing individual rects (scroll bar)
|
|
3519
3196
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3520
3197
|
unsetRect(multiDragElement);
|
|
3521
3198
|
});
|
|
3522
3199
|
toSortable.animateAll();
|
|
3523
3200
|
}
|
|
3524
|
-
|
|
3525
3201
|
multiDragSortable = toSortable;
|
|
3526
|
-
}
|
|
3527
|
-
|
|
3202
|
+
}
|
|
3528
3203
|
|
|
3204
|
+
// Remove clones if necessary
|
|
3529
3205
|
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
|
|
3530
3206
|
multiDragClones.forEach(function (clone) {
|
|
3531
3207
|
clone.parentNode && clone.parentNode.removeChild(clone);
|
|
@@ -3538,7 +3214,6 @@
|
|
|
3538
3214
|
},
|
|
3539
3215
|
destroyGlobal: function destroyGlobal() {
|
|
3540
3216
|
this._deselectMultiDrag();
|
|
3541
|
-
|
|
3542
3217
|
off(document, 'pointerup', this._deselectMultiDrag);
|
|
3543
3218
|
off(document, 'mouseup', this._deselectMultiDrag);
|
|
3544
3219
|
off(document, 'touchend', this._deselectMultiDrag);
|
|
@@ -3546,14 +3221,16 @@
|
|
|
3546
3221
|
off(document, 'keyup', this._checkKeyUp);
|
|
3547
3222
|
},
|
|
3548
3223
|
_deselectMultiDrag: function _deselectMultiDrag(evt) {
|
|
3549
|
-
if (typeof dragStarted !== "undefined" && dragStarted) return;
|
|
3224
|
+
if (typeof dragStarted !== "undefined" && dragStarted) return;
|
|
3550
3225
|
|
|
3551
|
-
|
|
3226
|
+
// Only deselect if selection is in this sortable
|
|
3227
|
+
if (multiDragSortable !== this.sortable) return;
|
|
3552
3228
|
|
|
3553
|
-
|
|
3229
|
+
// Only deselect if target is not item in this sortable
|
|
3230
|
+
if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return;
|
|
3554
3231
|
|
|
3232
|
+
// Only deselect if left click
|
|
3555
3233
|
if (evt && evt.button !== 0) return;
|
|
3556
|
-
|
|
3557
3234
|
while (multiDragElements.length) {
|
|
3558
3235
|
var el = multiDragElements[0];
|
|
3559
3236
|
toggleClass(el, this.options.selectedClass, false);
|
|
@@ -3563,7 +3240,7 @@
|
|
|
3563
3240
|
rootEl: this.sortable.el,
|
|
3564
3241
|
name: 'deselect',
|
|
3565
3242
|
targetEl: el,
|
|
3566
|
-
|
|
3243
|
+
originalEvent: evt
|
|
3567
3244
|
});
|
|
3568
3245
|
}
|
|
3569
3246
|
},
|
|
@@ -3582,31 +3259,27 @@
|
|
|
3582
3259
|
// Static methods & properties
|
|
3583
3260
|
pluginName: 'multiDrag',
|
|
3584
3261
|
utils: {
|
|
3585
|
-
/**
|
|
3586
|
-
* Selects the provided multi-drag item
|
|
3587
|
-
* @param {HTMLElement} el The element to be selected
|
|
3262
|
+
/**
|
|
3263
|
+
* Selects the provided multi-drag item
|
|
3264
|
+
* @param {HTMLElement} el The element to be selected
|
|
3588
3265
|
*/
|
|
3589
3266
|
select: function select(el) {
|
|
3590
3267
|
var sortable = el.parentNode[expando];
|
|
3591
3268
|
if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;
|
|
3592
|
-
|
|
3593
3269
|
if (multiDragSortable && multiDragSortable !== sortable) {
|
|
3594
3270
|
multiDragSortable.multiDrag._deselectMultiDrag();
|
|
3595
|
-
|
|
3596
3271
|
multiDragSortable = sortable;
|
|
3597
3272
|
}
|
|
3598
|
-
|
|
3599
3273
|
toggleClass(el, sortable.options.selectedClass, true);
|
|
3600
3274
|
multiDragElements.push(el);
|
|
3601
3275
|
},
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
*
|
|
3605
|
-
* @param {HTMLElement} el The element to be deselected
|
|
3276
|
+
/**
|
|
3277
|
+
* Deselects the provided multi-drag item
|
|
3278
|
+
* @param {HTMLElement} el The element to be deselected
|
|
3606
3279
|
*/
|
|
3607
3280
|
deselect: function deselect(el) {
|
|
3608
3281
|
var sortable = el.parentNode[expando],
|
|
3609
|
-
|
|
3282
|
+
index = multiDragElements.indexOf(el);
|
|
3610
3283
|
if (!sortable || !sortable.options.multiDrag || !~index) return;
|
|
3611
3284
|
toggleClass(el, sortable.options.selectedClass, false);
|
|
3612
3285
|
multiDragElements.splice(index, 1);
|
|
@@ -3614,17 +3287,16 @@
|
|
|
3614
3287
|
},
|
|
3615
3288
|
eventProperties: function eventProperties() {
|
|
3616
3289
|
var _this3 = this;
|
|
3617
|
-
|
|
3618
3290
|
var oldIndicies = [],
|
|
3619
|
-
|
|
3291
|
+
newIndicies = [];
|
|
3620
3292
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3621
3293
|
oldIndicies.push({
|
|
3622
3294
|
multiDragElement: multiDragElement,
|
|
3623
3295
|
index: multiDragElement.sortableIndex
|
|
3624
|
-
});
|
|
3296
|
+
});
|
|
3625
3297
|
|
|
3298
|
+
// multiDragElements will already be sorted if folding
|
|
3626
3299
|
var newIndex;
|
|
3627
|
-
|
|
3628
3300
|
if (folding && multiDragElement !== dragEl$1) {
|
|
3629
3301
|
newIndex = -1;
|
|
3630
3302
|
} else if (folding) {
|
|
@@ -3632,7 +3304,6 @@
|
|
|
3632
3304
|
} else {
|
|
3633
3305
|
newIndex = index(multiDragElement);
|
|
3634
3306
|
}
|
|
3635
|
-
|
|
3636
3307
|
newIndicies.push({
|
|
3637
3308
|
multiDragElement: multiDragElement,
|
|
3638
3309
|
index: newIndex
|
|
@@ -3648,23 +3319,19 @@
|
|
|
3648
3319
|
optionListeners: {
|
|
3649
3320
|
multiDragKey: function multiDragKey(key) {
|
|
3650
3321
|
key = key.toLowerCase();
|
|
3651
|
-
|
|
3652
3322
|
if (key === 'ctrl') {
|
|
3653
3323
|
key = 'Control';
|
|
3654
3324
|
} else if (key.length > 1) {
|
|
3655
3325
|
key = key.charAt(0).toUpperCase() + key.substr(1);
|
|
3656
3326
|
}
|
|
3657
|
-
|
|
3658
3327
|
return key;
|
|
3659
3328
|
}
|
|
3660
3329
|
}
|
|
3661
3330
|
});
|
|
3662
3331
|
}
|
|
3663
|
-
|
|
3664
3332
|
function insertMultiDragElements(clonesInserted, rootEl) {
|
|
3665
3333
|
multiDragElements.forEach(function (multiDragElement, i) {
|
|
3666
3334
|
var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];
|
|
3667
|
-
|
|
3668
3335
|
if (target) {
|
|
3669
3336
|
rootEl.insertBefore(multiDragElement, target);
|
|
3670
3337
|
} else {
|
|
@@ -3672,17 +3339,15 @@
|
|
|
3672
3339
|
}
|
|
3673
3340
|
});
|
|
3674
3341
|
}
|
|
3675
|
-
/**
|
|
3676
|
-
* Insert multi-drag clones
|
|
3677
|
-
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3678
|
-
* @param {HTMLElement} rootEl
|
|
3679
|
-
*/
|
|
3680
|
-
|
|
3681
3342
|
|
|
3343
|
+
/**
|
|
3344
|
+
* Insert multi-drag clones
|
|
3345
|
+
* @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
|
|
3346
|
+
* @param {HTMLElement} rootEl
|
|
3347
|
+
*/
|
|
3682
3348
|
function insertMultiDragClones(elementsInserted, rootEl) {
|
|
3683
3349
|
multiDragClones.forEach(function (clone, i) {
|
|
3684
3350
|
var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];
|
|
3685
|
-
|
|
3686
3351
|
if (target) {
|
|
3687
3352
|
rootEl.insertBefore(clone, target);
|
|
3688
3353
|
} else {
|
|
@@ -3690,7 +3355,6 @@
|
|
|
3690
3355
|
}
|
|
3691
3356
|
});
|
|
3692
3357
|
}
|
|
3693
|
-
|
|
3694
3358
|
function removeMultiDragElements() {
|
|
3695
3359
|
multiDragElements.forEach(function (multiDragElement) {
|
|
3696
3360
|
if (multiDragElement === dragEl$1) return;
|
|
@@ -3706,4 +3370,4 @@
|
|
|
3706
3370
|
|
|
3707
3371
|
return Sortable;
|
|
3708
3372
|
|
|
3709
|
-
}));
|
|
3373
|
+
})));
|