@para-ui/core 4.0.20 → 4.0.22

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