|  | 
| 1 | 1 | /**! | 
| 2 |  | - * Sortable 1.10.0-rc1 | 
|  | 2 | + * Sortable 1.10.0-rc2 | 
| 3 | 3 |  * @author	RubaXa   <[email protected]> | 
| 4 | 4 |  * @author	owenm    <[email protected]> | 
| 5 | 5 |  * @license MIT | 
|  | 
| 132 | 132 |     throw new TypeError("Invalid attempt to spread non-iterable instance"); | 
| 133 | 133 |   } | 
| 134 | 134 | 
 | 
| 135 |  | -  var version = "1.10.0-rc1"; | 
|  | 135 | +  var version = "1.10.0-rc2"; | 
| 136 | 136 | 
 | 
| 137 | 137 |   function userAgent(pattern) { | 
| 138 | 138 |     return !!navigator.userAgent.match(pattern); | 
|  | 
| 425 | 425 |         children = el.children; | 
| 426 | 426 | 
 | 
| 427 | 427 |     while (i < children.length) { | 
| 428 |  | -      if (children[i].style.display !== 'none' && children[i] !== Sortable$1.ghost && children[i] !== Sortable$1.dragged && closest(children[i], options.draggable, el, false)) { | 
|  | 428 | +      if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { | 
| 429 | 429 |         if (currentChild === childNum) { | 
| 430 | 430 |           return children[i]; | 
| 431 | 431 |         } | 
|  | 
| 449 | 449 |   function lastChild(el, selector) { | 
| 450 | 450 |     var last = el.lastElementChild; | 
| 451 | 451 | 
 | 
| 452 |  | -    while (last && (last === Sortable$1.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { | 
|  | 452 | +    while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { | 
| 453 | 453 |       last = last.previousElementSibling; | 
| 454 | 454 |     } | 
| 455 | 455 | 
 | 
|  | 
| 474 | 474 | 
 | 
| 475 | 475 | 
 | 
| 476 | 476 |     while (el = el.previousElementSibling) { | 
| 477 |  | -      if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable$1.clone && (!selector || matches(el, selector))) { | 
|  | 477 | +      if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { | 
| 478 | 478 |         index++; | 
| 479 | 479 |       } | 
| 480 | 480 |     } | 
|  | 
| 636 | 636 |         var children = [].slice.call(this.el.children); | 
| 637 | 637 | 
 | 
| 638 | 638 |         for (var i in children) { | 
| 639 |  | -          if (css(children[i], 'display') === 'none' || children[i] === Sortable$1.ghost) continue; | 
|  | 639 | +          if (css(children[i], 'display') === 'none' || children[i] === Sortable.ghost) continue; | 
| 640 | 640 |           animationStates.push({ | 
| 641 | 641 |             target: children[i], | 
| 642 | 642 |             rect: getRect(children[i]) | 
|  | 
| 924 | 924 |         originalEvent = _ref.evt, | 
| 925 | 925 |         data = _objectWithoutProperties(_ref, ["evt"]); | 
| 926 | 926 | 
 | 
| 927 |  | -    PluginManager.pluginEvent.bind(Sortable$1)(eventName, sortable, _objectSpread({ | 
|  | 927 | +    PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ | 
| 928 | 928 |       dragEl: dragEl, | 
| 929 | 929 |       parentEl: parentEl, | 
| 930 | 930 |       ghostEl: ghostEl, | 
|  | 
| 935 | 935 |       cloneHidden: cloneHidden, | 
| 936 | 936 |       dragStarted: moved, | 
| 937 | 937 |       putSortable: putSortable, | 
| 938 |  | -      activeSortable: Sortable$1.active, | 
|  | 938 | +      activeSortable: Sortable.active, | 
| 939 | 939 |       originalEvent: originalEvent, | 
| 940 | 940 |       oldIndex: oldIndex, | 
| 941 | 941 |       oldDraggableIndex: oldDraggableIndex, | 
|  | 
| 1171 | 1171 |    */ | 
| 1172 | 1172 | 
 | 
| 1173 | 1173 | 
 | 
| 1174 |  | -  function Sortable$1(el, options) { | 
|  | 1174 | +  function Sortable(el, options) { | 
| 1175 | 1175 |     if (!(el && el.nodeType && el.nodeType === 1)) { | 
| 1176 | 1176 |       throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); | 
| 1177 | 1177 |     } | 
|  | 
| 1223 | 1223 |         x: 0, | 
| 1224 | 1224 |         y: 0 | 
| 1225 | 1225 |       }, | 
| 1226 |  | -      supportPointer: Sortable$1.supportPointer !== false && 'PointerEvent' in window, | 
|  | 1226 | +      supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, | 
| 1227 | 1227 |       emptyInsertThreshold: 5 | 
| 1228 | 1228 |     }; | 
| 1229 | 1229 |     PluginManager.initializePlugins(this, el, defaults); // Set default options | 
|  | 
| 1269 | 1269 |     _extends(this, AnimationStateManager()); | 
| 1270 | 1270 |   } | 
| 1271 | 1271 | 
 | 
| 1272 |  | -  Sortable$1.prototype = | 
|  | 1272 | +  Sortable.prototype = | 
| 1273 | 1273 |   /** @lends Sortable.prototype */ | 
| 1274 | 1274 |   { | 
| 1275 |  | -    constructor: Sortable$1, | 
|  | 1275 | +    constructor: Sortable, | 
| 1276 | 1276 |     _isOutsideThisEl: function _isOutsideThisEl(target) { | 
| 1277 | 1277 |       if (!this.el.contains(target) && target !== this.el) { | 
| 1278 | 1278 |         lastTarget = null; | 
|  | 
| 1398 | 1398 |         nextEl = dragEl.nextSibling; | 
| 1399 | 1399 |         lastDownEl = target; | 
| 1400 | 1400 |         activeGroup = options.group; | 
| 1401 |  | -        Sortable$1.dragged = dragEl; | 
|  | 1401 | +        Sortable.dragged = dragEl; | 
| 1402 | 1402 |         tapEvt = { | 
| 1403 | 1403 |           target: dragEl, | 
| 1404 | 1404 |           clientX: (touch || evt).clientX, | 
|  | 
| 1413 | 1413 |             evt: evt | 
| 1414 | 1414 |           }); | 
| 1415 | 1415 | 
 | 
| 1416 |  | -          if (Sortable$1.eventCanceled) { | 
|  | 1416 | +          if (Sortable.eventCanceled) { | 
| 1417 | 1417 |             _this._onDrop(); | 
| 1418 | 1418 | 
 | 
| 1419 | 1419 |             return; | 
|  | 
| 1462 | 1462 |         }); // Delay is impossible for native DnD in Edge or IE | 
| 1463 | 1463 | 
 | 
| 1464 | 1464 |         if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { | 
| 1465 |  | -          if (Sortable$1.eventCanceled) { | 
|  | 1465 | +          if (Sortable.eventCanceled) { | 
| 1466 | 1466 |             this._onDrop(); | 
| 1467 | 1467 | 
 | 
| 1468 | 1468 |             return; | 
|  | 
| 1555 | 1555 | 
 | 
| 1556 | 1556 |         !fallback && toggleClass(dragEl, options.dragClass, false); | 
| 1557 | 1557 |         toggleClass(dragEl, options.ghostClass, true); | 
| 1558 |  | -        Sortable$1.active = this; | 
|  | 1558 | +        Sortable.active = this; | 
| 1559 | 1559 |         fallback && this._appendGhost(); // Drag start event | 
| 1560 | 1560 | 
 | 
| 1561 | 1561 |         _dispatchEvent({ | 
|  | 
| 1626 | 1626 |             dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1), | 
| 1627 | 1627 |             translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)'; // only set the status to dragging, when we are actually dragging | 
| 1628 | 1628 | 
 | 
| 1629 |  | -        if (!Sortable$1.active && !awaitingDragStarted) { | 
|  | 1629 | +        if (!Sortable.active && !awaitingDragStarted) { | 
| 1630 | 1630 |           if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { | 
| 1631 | 1631 |             return; | 
| 1632 | 1632 |           } | 
|  | 
| 1685 | 1685 |         css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); | 
| 1686 | 1686 |         css(ghostEl, 'zIndex', '100000'); | 
| 1687 | 1687 |         css(ghostEl, 'pointerEvents', 'none'); | 
| 1688 |  | -        Sortable$1.ghost = ghostEl; | 
|  | 1688 | +        Sortable.ghost = ghostEl; | 
| 1689 | 1689 |         container.appendChild(ghostEl); | 
| 1690 | 1690 |       } | 
| 1691 | 1691 |     }, | 
|  | 
| 1702 | 1702 |         evt: evt | 
| 1703 | 1703 |       }); | 
| 1704 | 1704 | 
 | 
| 1705 |  | -      if (Sortable$1.eventCanceled) { | 
|  | 1705 | +      if (Sortable.eventCanceled) { | 
| 1706 | 1706 |         this._onDrop(); | 
| 1707 | 1707 | 
 | 
| 1708 | 1708 |         return; | 
| 1709 | 1709 |       } | 
| 1710 | 1710 | 
 | 
| 1711 | 1711 |       pluginEvent('setupClone', this); | 
| 1712 | 1712 | 
 | 
| 1713 |  | -      if (!Sortable$1.eventCanceled) { | 
|  | 1713 | +      if (!Sortable.eventCanceled) { | 
| 1714 | 1714 |         cloneEl = clone(dragEl); | 
| 1715 | 1715 |         cloneEl.draggable = false; | 
| 1716 | 1716 |         cloneEl.style['will-change'] = ''; | 
| 1717 | 1717 | 
 | 
| 1718 | 1718 |         this._hideClone(); | 
| 1719 | 1719 | 
 | 
| 1720 | 1720 |         toggleClass(cloneEl, this.options.chosenClass, false); | 
| 1721 |  | -        Sortable$1.clone = cloneEl; | 
|  | 1721 | +        Sortable.clone = cloneEl; | 
| 1722 | 1722 |       } // #1143: IFrame support workaround | 
| 1723 | 1723 | 
 | 
| 1724 | 1724 | 
 | 
| 1725 | 1725 |       _this.cloneId = _nextTick(function () { | 
| 1726 | 1726 |         pluginEvent('clone', _this); | 
| 1727 |  | -        if (Sortable$1.eventCanceled) return; | 
|  | 1727 | +        if (Sortable.eventCanceled) return; | 
| 1728 | 1728 | 
 | 
| 1729 | 1729 |         if (!_this.options.removeCloneOnHide) { | 
| 1730 | 1730 |           rootEl.insertBefore(cloneEl, dragEl); | 
|  | 
| 1778 | 1778 |           revert, | 
| 1779 | 1779 |           options = this.options, | 
| 1780 | 1780 |           group = options.group, | 
| 1781 |  | -          activeSortable = Sortable$1.active, | 
|  | 1781 | +          activeSortable = Sortable.active, | 
| 1782 | 1782 |           isOwner = activeGroup === group, | 
| 1783 | 1783 |           canSort = options.sort, | 
| 1784 | 1784 |           fromSortable = putSortable || activeSortable, | 
|  | 
| 1838 | 1838 |             toggleClass(dragEl, options.ghostClass, true); | 
| 1839 | 1839 |           } | 
| 1840 | 1840 | 
 | 
| 1841 |  | -          if (putSortable !== _this && _this !== Sortable$1.active) { | 
|  | 1841 | +          if (putSortable !== _this && _this !== Sortable.active) { | 
| 1842 | 1842 |             putSortable = _this; | 
| 1843 |  | -          } else if (_this === Sortable$1.active && putSortable) { | 
|  | 1843 | +          } else if (_this === Sortable.active && putSortable) { | 
| 1844 | 1844 |             putSortable = null; | 
| 1845 | 1845 |           } // Animation | 
| 1846 | 1846 | 
 | 
|  | 
| 1898 | 1898 | 
 | 
| 1899 | 1899 |       target = closest(target, options.draggable, el, true); | 
| 1900 | 1900 |       dragOverEvent('dragOver'); | 
| 1901 |  | -      if (Sortable$1.eventCanceled) return completedFired; | 
|  | 1901 | +      if (Sortable.eventCanceled) return completedFired; | 
| 1902 | 1902 | 
 | 
| 1903 | 1903 |       if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { | 
| 1904 | 1904 |         return completed(false); | 
|  | 
| 1911 | 1911 |         vertical = this._getDirection(evt, target) === 'vertical'; | 
| 1912 | 1912 |         dragRect = getRect(dragEl); | 
| 1913 | 1913 |         dragOverEvent('dragOverValid'); | 
| 1914 |  | -        if (Sortable$1.eventCanceled) return completedFired; | 
|  | 1914 | +        if (Sortable.eventCanceled) return completedFired; | 
| 1915 | 1915 | 
 | 
| 1916 | 1916 |         if (revert) { | 
| 1917 | 1917 |           parentEl = rootEl; // actualization | 
|  | 
| 1922 | 1922 | 
 | 
| 1923 | 1923 |           dragOverEvent('revert'); | 
| 1924 | 1924 | 
 | 
| 1925 |  | -          if (!Sortable$1.eventCanceled) { | 
|  | 1925 | +          if (!Sortable.eventCanceled) { | 
| 1926 | 1926 |             if (nextEl) { | 
| 1927 | 1927 |               rootEl.insertBefore(dragEl, nextEl); | 
| 1928 | 1928 |             } else { | 
|  | 
| 2071 | 2071 |       newIndex = index(dragEl); | 
| 2072 | 2072 |       newDraggableIndex = index(dragEl, options.draggable); | 
| 2073 | 2073 | 
 | 
| 2074 |  | -      if (Sortable$1.eventCanceled) { | 
|  | 2074 | +      if (Sortable.eventCanceled) { | 
| 2075 | 2075 |         this._nulling(); | 
| 2076 | 2076 | 
 | 
| 2077 | 2077 |         return; | 
|  | 
| 2197 | 2197 |             } | 
| 2198 | 2198 |           } | 
| 2199 | 2199 | 
 | 
| 2200 |  | -          if (Sortable$1.active) { | 
|  | 2200 | +          if (Sortable.active) { | 
| 2201 | 2201 |             /* jshint eqnull:true */ | 
| 2202 | 2202 |             if (newIndex == null || newIndex === -1) { | 
| 2203 | 2203 |               newIndex = oldIndex; | 
|  | 
| 2221 | 2221 |     }, | 
| 2222 | 2222 |     _nulling: function _nulling() { | 
| 2223 | 2223 |       pluginEvent('nulling', this); | 
| 2224 |  | -      rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable$1.dragged = Sortable$1.ghost = Sortable$1.clone = Sortable$1.active = null; | 
|  | 2224 | +      rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; | 
| 2225 | 2225 |       savedInputChecked.forEach(function (el) { | 
| 2226 | 2226 |         el.checked = true; | 
| 2227 | 2227 |       }); | 
|  | 
| 2371 | 2371 |     _hideClone: function _hideClone() { | 
| 2372 | 2372 |       if (!cloneHidden) { | 
| 2373 | 2373 |         pluginEvent('hideClone', this); | 
| 2374 |  | -        if (Sortable$1.eventCanceled) return; | 
|  | 2374 | +        if (Sortable.eventCanceled) return; | 
| 2375 | 2375 |         css(cloneEl, 'display', 'none'); | 
| 2376 | 2376 | 
 | 
| 2377 | 2377 |         if (this.options.removeCloneOnHide && cloneEl.parentNode) { | 
|  | 
| 2390 | 2390 | 
 | 
| 2391 | 2391 |       if (cloneHidden) { | 
| 2392 | 2392 |         pluginEvent('showClone', this); | 
| 2393 |  | -        if (Sortable$1.eventCanceled) return; // show clone at dragEl or original position | 
|  | 2393 | +        if (Sortable.eventCanceled) return; // show clone at dragEl or original position | 
| 2394 | 2394 | 
 | 
| 2395 | 2395 |         if (rootEl.contains(dragEl) && !this.options.group.revertClone) { | 
| 2396 | 2396 |           rootEl.insertBefore(cloneEl, dragEl); | 
|  | 
| 2569 | 2569 | 
 | 
| 2570 | 2570 | 
 | 
| 2571 | 2571 |   on(document, 'touchmove', function (evt) { | 
| 2572 |  | -    if ((Sortable$1.active || awaitingDragStarted) && evt.cancelable) { | 
|  | 2572 | +    if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { | 
| 2573 | 2573 |       evt.preventDefault(); | 
| 2574 | 2574 |     } | 
| 2575 | 2575 |   }); // Export utils | 
| 2576 | 2576 | 
 | 
| 2577 |  | -  Sortable$1.utils = { | 
|  | 2577 | +  Sortable.utils = { | 
| 2578 | 2578 |     on: on, | 
| 2579 | 2579 |     off: off, | 
| 2580 | 2580 |     css: css, | 
|  | 
| 2598 | 2598 |    * @param  {...SortablePlugin|SortablePlugin[]} plugins       Plugins being mounted | 
| 2599 | 2599 |    */ | 
| 2600 | 2600 | 
 | 
| 2601 |  | -  Sortable$1.mount = function () { | 
|  | 2601 | +  Sortable.mount = function () { | 
| 2602 | 2602 |     for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { | 
| 2603 | 2603 |       plugins[_key] = arguments[_key]; | 
| 2604 | 2604 |     } | 
|  | 
| 2612 | 2612 |         throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(el)); | 
| 2613 | 2613 |       } | 
| 2614 | 2614 | 
 | 
| 2615 |  | -      if (plugin.utils) Sortable$1.utils = _objectSpread({}, Sortable$1.utils, plugin.utils); | 
|  | 2615 | +      if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); | 
| 2616 | 2616 |       PluginManager.mount(plugin); | 
| 2617 | 2617 |     } | 
| 2618 | 2618 |   }; | 
|  | 
| 2623 | 2623 |    */ | 
| 2624 | 2624 | 
 | 
| 2625 | 2625 | 
 | 
| 2626 |  | -  Sortable$1.create = function (el, options) { | 
| 2627 |  | -    return new Sortable$1(el, options); | 
|  | 2626 | +  Sortable.create = function (el, options) { | 
|  | 2627 | +    return new Sortable(el, options); | 
| 2628 | 2628 |   }; // Export | 
| 2629 | 2629 | 
 | 
| 2630 | 2630 | 
 | 
| 2631 |  | -  Sortable$1.version = version; | 
|  | 2631 | +  Sortable.version = version; | 
| 2632 | 2632 | 
 | 
| 2633 | 2633 |   var autoScrolls = [], | 
| 2634 | 2634 |       scrollEl, | 
|  | 
| 3392 | 3392 |           // Do not "unfold" after around dragEl if reverted | 
| 3393 | 3393 |           if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { | 
| 3394 | 3394 |             var dragRect = getRect(dragEl$1), | 
| 3395 |  | -                multiDragIndex = index(dragEl$1, ':not(.' + Sortable.active.options.selectedClass + ')'); | 
|  | 3395 | +                multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); | 
| 3396 | 3396 |             if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; | 
| 3397 | 3397 |             toSortable.captureAnimationState(); | 
| 3398 | 3398 | 
 | 
|  | 
| 3632 | 3632 |     } | 
| 3633 | 3633 |   } | 
| 3634 | 3634 | 
 | 
| 3635 |  | -  Sortable$1.mount(new AutoScrollPlugin()); | 
| 3636 |  | -  Sortable$1.mount(Remove, Revert); | 
|  | 3635 | +  Sortable.mount(new AutoScrollPlugin()); | 
|  | 3636 | +  Sortable.mount(Remove, Revert); | 
| 3637 | 3637 | 
 | 
| 3638 |  | -  Sortable$1.mount(new SwapPlugin()); | 
| 3639 |  | -  Sortable$1.mount(new MultiDragPlugin()); | 
|  | 3638 | +  Sortable.mount(new SwapPlugin()); | 
|  | 3639 | +  Sortable.mount(new MultiDragPlugin()); | 
| 3640 | 3640 | 
 | 
| 3641 |  | -  return Sortable$1; | 
|  | 3641 | +  return Sortable; | 
| 3642 | 3642 | 
 | 
| 3643 | 3643 | })); | 
0 commit comments