diff --git a/Sortable.js b/Sortable.js index 207940ea2..df659924e 100644 --- a/Sortable.js +++ b/Sortable.js @@ -1,5 +1,5 @@ /**! - * Sortable 1.10.0-rc1 + * Sortable 1.10.0-rc2 * @author RubaXa * @author owenm * @license MIT @@ -132,7 +132,7 @@ throw new TypeError("Invalid attempt to spread non-iterable instance"); } - var version = "1.10.0-rc1"; + var version = "1.10.0-rc2"; function userAgent(pattern) { return !!navigator.userAgent.match(pattern); @@ -425,7 +425,7 @@ children = el.children; while (i < children.length) { - if (children[i].style.display !== 'none' && children[i] !== Sortable$1.ghost && children[i] !== Sortable$1.dragged && closest(children[i], options.draggable, el, false)) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { if (currentChild === childNum) { return children[i]; } @@ -449,7 +449,7 @@ function lastChild(el, selector) { var last = el.lastElementChild; - while (last && (last === Sortable$1.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { last = last.previousElementSibling; } @@ -474,7 +474,7 @@ while (el = el.previousElementSibling) { - if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable$1.clone && (!selector || matches(el, selector))) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { index++; } } @@ -636,7 +636,7 @@ var children = [].slice.call(this.el.children); for (var i in children) { - if (css(children[i], 'display') === 'none' || children[i] === Sortable$1.ghost) continue; + if (css(children[i], 'display') === 'none' || children[i] === Sortable.ghost) continue; animationStates.push({ target: children[i], rect: getRect(children[i]) @@ -924,7 +924,7 @@ originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, ["evt"]); - PluginManager.pluginEvent.bind(Sortable$1)(eventName, sortable, _objectSpread({ + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ dragEl: dragEl, parentEl: parentEl, ghostEl: ghostEl, @@ -935,7 +935,7 @@ cloneHidden: cloneHidden, dragStarted: moved, putSortable: putSortable, - activeSortable: Sortable$1.active, + activeSortable: Sortable.active, originalEvent: originalEvent, oldIndex: oldIndex, oldDraggableIndex: oldDraggableIndex, @@ -1171,7 +1171,7 @@ */ - function Sortable$1(el, options) { + function Sortable(el, options) { if (!(el && el.nodeType && el.nodeType === 1)) { throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); } @@ -1223,7 +1223,7 @@ x: 0, y: 0 }, - supportPointer: Sortable$1.supportPointer !== false && 'PointerEvent' in window, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, emptyInsertThreshold: 5 }; PluginManager.initializePlugins(this, el, defaults); // Set default options @@ -1269,10 +1269,10 @@ _extends(this, AnimationStateManager()); } - Sortable$1.prototype = + Sortable.prototype = /** @lends Sortable.prototype */ { - constructor: Sortable$1, + constructor: Sortable, _isOutsideThisEl: function _isOutsideThisEl(target) { if (!this.el.contains(target) && target !== this.el) { lastTarget = null; @@ -1398,7 +1398,7 @@ nextEl = dragEl.nextSibling; lastDownEl = target; activeGroup = options.group; - Sortable$1.dragged = dragEl; + Sortable.dragged = dragEl; tapEvt = { target: dragEl, clientX: (touch || evt).clientX, @@ -1413,7 +1413,7 @@ evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { _this._onDrop(); return; @@ -1462,7 +1462,7 @@ }); // Delay is impossible for native DnD in Edge or IE if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1555,7 +1555,7 @@ !fallback && toggleClass(dragEl, options.dragClass, false); toggleClass(dragEl, options.ghostClass, true); - Sortable$1.active = this; + Sortable.active = this; fallback && this._appendGhost(); // Drag start event _dispatchEvent({ @@ -1626,7 +1626,7 @@ dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1), 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 - if (!Sortable$1.active && !awaitingDragStarted) { + if (!Sortable.active && !awaitingDragStarted) { if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { return; } @@ -1685,7 +1685,7 @@ css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); css(ghostEl, 'zIndex', '100000'); css(ghostEl, 'pointerEvents', 'none'); - Sortable$1.ghost = ghostEl; + Sortable.ghost = ghostEl; container.appendChild(ghostEl); } }, @@ -1702,7 +1702,7 @@ evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1710,7 +1710,7 @@ pluginEvent('setupClone', this); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { cloneEl = clone(dragEl); cloneEl.draggable = false; cloneEl.style['will-change'] = ''; @@ -1718,13 +1718,13 @@ this._hideClone(); toggleClass(cloneEl, this.options.chosenClass, false); - Sortable$1.clone = cloneEl; + Sortable.clone = cloneEl; } // #1143: IFrame support workaround _this.cloneId = _nextTick(function () { pluginEvent('clone', _this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; if (!_this.options.removeCloneOnHide) { rootEl.insertBefore(cloneEl, dragEl); @@ -1778,7 +1778,7 @@ revert, options = this.options, group = options.group, - activeSortable = Sortable$1.active, + activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, @@ -1838,9 +1838,9 @@ toggleClass(dragEl, options.ghostClass, true); } - if (putSortable !== _this && _this !== Sortable$1.active) { + if (putSortable !== _this && _this !== Sortable.active) { putSortable = _this; - } else if (_this === Sortable$1.active && putSortable) { + } else if (_this === Sortable.active && putSortable) { putSortable = null; } // Animation @@ -1898,7 +1898,7 @@ target = closest(target, options.draggable, el, true); dragOverEvent('dragOver'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { return completed(false); @@ -1911,7 +1911,7 @@ vertical = this._getDirection(evt, target) === 'vertical'; dragRect = getRect(dragEl); dragOverEvent('dragOverValid'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (revert) { parentEl = rootEl; // actualization @@ -1922,7 +1922,7 @@ dragOverEvent('revert'); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { if (nextEl) { rootEl.insertBefore(dragEl, nextEl); } else { @@ -2071,7 +2071,7 @@ newIndex = index(dragEl); newDraggableIndex = index(dragEl, options.draggable); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._nulling(); return; @@ -2197,7 +2197,7 @@ } } - if (Sortable$1.active) { + if (Sortable.active) { /* jshint eqnull:true */ if (newIndex == null || newIndex === -1) { newIndex = oldIndex; @@ -2221,7 +2221,7 @@ }, _nulling: function _nulling() { pluginEvent('nulling', this); - 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; + 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; savedInputChecked.forEach(function (el) { el.checked = true; }); @@ -2371,7 +2371,7 @@ _hideClone: function _hideClone() { if (!cloneHidden) { pluginEvent('hideClone', this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; css(cloneEl, 'display', 'none'); if (this.options.removeCloneOnHide && cloneEl.parentNode) { @@ -2390,7 +2390,7 @@ if (cloneHidden) { pluginEvent('showClone', this); - if (Sortable$1.eventCanceled) return; // show clone at dragEl or original position + if (Sortable.eventCanceled) return; // show clone at dragEl or original position if (rootEl.contains(dragEl) && !this.options.group.revertClone) { rootEl.insertBefore(cloneEl, dragEl); @@ -2569,12 +2569,12 @@ on(document, 'touchmove', function (evt) { - if ((Sortable$1.active || awaitingDragStarted) && evt.cancelable) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { evt.preventDefault(); } }); // Export utils - Sortable$1.utils = { + Sortable.utils = { on: on, off: off, css: css, @@ -2598,7 +2598,7 @@ * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted */ - Sortable$1.mount = function () { + Sortable.mount = function () { for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { plugins[_key] = arguments[_key]; } @@ -2612,7 +2612,7 @@ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(el)); } - if (plugin.utils) Sortable$1.utils = _objectSpread({}, Sortable$1.utils, plugin.utils); + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); PluginManager.mount(plugin); } }; @@ -2623,12 +2623,12 @@ */ - Sortable$1.create = function (el, options) { - return new Sortable$1(el, options); + Sortable.create = function (el, options) { + return new Sortable(el, options); }; // Export - Sortable$1.version = version; + Sortable.version = version; var autoScrolls = [], scrollEl, @@ -3392,7 +3392,7 @@ // Do not "unfold" after around dragEl if reverted if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { var dragRect = getRect(dragEl$1), - multiDragIndex = index(dragEl$1, ':not(.' + Sortable.active.options.selectedClass + ')'); + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; toSortable.captureAnimationState(); @@ -3632,12 +3632,12 @@ } } - Sortable$1.mount(new AutoScrollPlugin()); - Sortable$1.mount(Remove, Revert); + Sortable.mount(new AutoScrollPlugin()); + Sortable.mount(Remove, Revert); - Sortable$1.mount(new SwapPlugin()); - Sortable$1.mount(new MultiDragPlugin()); + Sortable.mount(new SwapPlugin()); + Sortable.mount(new MultiDragPlugin()); - return Sortable$1; + return Sortable; })); diff --git a/Sortable.min.js b/Sortable.min.js index 341947cd1..a2783397f 100644 --- a/Sortable.min.js +++ b/Sortable.min.js @@ -1,2 +1,2 @@ -/*! Sortable 1.10.0-rc1 - MIT | git://github.com/SortableJS/Sortable.git */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(){return(s=Object.assign||function(t){for(var e=1;e"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function k(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&d(t,e):d(t,e))||o&&t===n)return t;if(t===n)break}while(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode)}var i;return null}var h,f=/\s+/g;function P(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(f," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(f," ")}}function R(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function b(t,e){var n="";do{var o=R(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix;return i&&new i(n)}function p(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(i&&r&&a)return ft[n]}}((t=t.touches?t.touches[0]:t).clientX,t.clientY);if(e){var n={};for(var o in t)n[o]=t[o];n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[L]._onDragOver(n)}}}function Ot(t){W&&W.parentNode[L]._isOutsideThisEl(t.target)}function Mt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=s({},e),t[L]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return St(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:Number.parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Mt.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var o in O.initializePlugins(this,t,n),n)o in e||(e[o]=n[o]);for(var i in _t(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Dt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?u(t,"pointerdown",this._onTapStart):(u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),ft.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),s(this,C())}function At(t,e,n,o,i,r,a,l){var s,c,u=t[L],d=u.options.onMove;return!window.CustomEvent||w||D?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||X(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(c=d.call(u,s,a)),c}function Nt(t){t.draggable=!1}function It(){mt=!1}function kt(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Pt(t){return setTimeout(t,0)}function Rt(t){return clearTimeout(t)}Mt.prototype={constructor:Mt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(lt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,W):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0],l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(function(t){bt.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&bt.push(o)}}(o),!W&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled||s.isContentEditable||(l=k(l,t.draggable,o,!1))&&l.animated||V===l)){if($=F(l),tt=F(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return K({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),j("filter",n,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(t){if(t=k(s,t.trim(),o,!1))return K({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),j("filter",n,{evt:e}),!0})))return void(i&&e.cancelable&&e.preventDefault());t.handle&&!k(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;if(n&&!W&&n.parentNode===r)if(U=r,z=(W=n).parentNode,q=W.nextSibling,V=n,nt=a.group,it={target:Mt.dragged=W,clientX:(e||t).clientX,clientY:(e||t).clientY},this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,W.style["will-change"]="all",o=function(){j("delayEnded",i,{evt:t}),Mt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!c&&i.nativeDraggable&&(W.draggable=!0),i._triggerDragStart(t,e),K({sortable:i,name:"choose",originalEvent:t}),P(W,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){p(W,t.trim(),Nt)}),u(l,"dragover",xt),u(l,"mousemove",xt),u(l,"touchmove",xt),u(l,"mouseup",i._onDrop),u(l,"touchend",i._onDrop),u(l,"touchcancel",i._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,W.draggable=!0),j("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(D||w))o();else{if(Mt.eventCanceled)return void this._onDrop();u(l,"mouseup",i._disableDelayedDrag),u(l,"touchend",i._disableDelayedDrag),u(l,"touchcancel",i._disableDelayedDrag),u(l,"mousemove",i._delayedDragTouchMoveHandler),u(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&u(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){W&&Nt(W),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;r(t,"mouseup",this._disableDelayedDrag),r(t,"touchend",this._disableDelayedDrag),r(t,"touchcancel",this._disableDelayedDrag),r(t,"mousemove",this._delayedDragTouchMoveHandler),r(t,"touchmove",this._delayedDragTouchMoveHandler),r(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||("touch"==t.pointerType?t:null),!this.nativeDraggable||e?this.options.supportPointer?u(document,"pointermove",this._onTouchMove):u(document,e?"touchmove":"mousemove",this._onTouchMove):(u(W,"dragend",this),u(U,"dragstart",this._onDragStart));try{document.selection?Pt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(dt=!1,U&&W){j("dragStarted",this,{evt:e}),this.nativeDraggable&&u(document,"dragover",Ot);var n=this.options;t||P(W,n.dragClass,!1),P(W,n.ghostClass,!0),Mt.active=this,t&&this._appendGhost(),K({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(rt){this._lastX=rt.clientX,this._lastY=rt.clientY,Ct();for(var t=document.elementFromPoint(rt.clientX,rt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(rt.clientX,rt.clientY))!==e;)e=t;if(W.parentNode[L]._isOutsideThisEl(t),e)do{if(e[L]){if(e[L]._onDragOver({clientX:rt.clientX,clientY:rt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Tt()}},_onTouchMove:function(t){if(it){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=G&&b(G),a=G&&r&&r.a,l=G&&r&&r.d,s=yt&&ut&&v(ut),c=(i.clientX-it.clientX+o.x)/(a||1)+(s?s[0]-vt[0]:0)/(a||1),u=(i.clientY-it.clientY+o.y)/(l||1)+(s?s[1]-vt[1]:0)/(l||1),d=t.touches?"translate3d("+c+"px,"+u+"px,0)":"translate("+c+"px,"+u+"px)";if(!Mt.active&&!dt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(n,a,this)&&!g.animated){if(g===W)return A(!1);if(g&&l===n.target&&(s=g),s&&(i=X(s)),!1!==At(U,l,W,o,s,i,n,!!s))return M(),l.appendChild(W),z=l,N(),A(!0)}else if(s.parentNode===l){i=X(s);var v,m,b,y=W.parentNode!==l,w=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,s=n?e.width:e.height;return o===a||i===l||o+r/2===a+s/2}(W.animated&&W.toRect||o,s.animated&&s.toRect||i,a),D=a?"top":"left",E=Y(s,null,"top","top")||Y(W,null,"top","top"),S=E?E.scrollTop:void 0;if(lt!==s&&(m=i[D],pt=!1,gt=!w&&e.invertSwap||y),0!==(v=function(t,e,n,o,i,r,a){var l=X(e),s=n?t.clientY:t.clientX,c=n?l.height:l.width,u=n?l.top:l.left,d=n?l.bottom:l.right,h=!1;if(!r)if(a&&ct"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function k(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&d(t,e):d(t,e))||o&&t===n)return t;if(t===n)break}while(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode)}var i;return null}var h,f=/\s+/g;function P(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(f," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(f," ")}}function R(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function b(t,e){var n="";do{var o=R(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix;return i&&new i(n)}function p(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(i&&r&&a)return ft[n]}}((t=t.touches?t.touches[0]:t).clientX,t.clientY);if(e){var n={};for(var o in t)n[o]=t[o];n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[L]._onDragOver(n)}}}function Ot(t){W&&W.parentNode[L]._isOutsideThisEl(t.target)}function Mt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=s({},e),t[L]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return St(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:Number.parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Mt.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var o in O.initializePlugins(this,t,n),n)o in e||(e[o]=n[o]);for(var i in _t(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Dt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?u(t,"pointerdown",this._onTapStart):(u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),ft.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),s(this,C())}function At(t,e,n,o,i,r,a,l){var s,c,u=t[L],d=u.options.onMove;return!window.CustomEvent||w||D?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||X(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(c=d.call(u,s,a)),c}function Nt(t){t.draggable=!1}function It(){mt=!1}function kt(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Pt(t){return setTimeout(t,0)}function Rt(t){return clearTimeout(t)}Mt.prototype={constructor:Mt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(lt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,W):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0],l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(function(t){bt.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&bt.push(o)}}(o),!W&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled||s.isContentEditable||(l=k(l,t.draggable,o,!1))&&l.animated||V===l)){if($=F(l),tt=F(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return K({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),j("filter",n,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(t){if(t=k(s,t.trim(),o,!1))return K({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),j("filter",n,{evt:e}),!0})))return void(i&&e.cancelable&&e.preventDefault());t.handle&&!k(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;if(n&&!W&&n.parentNode===r)if(U=r,z=(W=n).parentNode,q=W.nextSibling,V=n,nt=a.group,it={target:Mt.dragged=W,clientX:(e||t).clientX,clientY:(e||t).clientY},this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,W.style["will-change"]="all",o=function(){j("delayEnded",i,{evt:t}),Mt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!c&&i.nativeDraggable&&(W.draggable=!0),i._triggerDragStart(t,e),K({sortable:i,name:"choose",originalEvent:t}),P(W,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){p(W,t.trim(),Nt)}),u(l,"dragover",xt),u(l,"mousemove",xt),u(l,"touchmove",xt),u(l,"mouseup",i._onDrop),u(l,"touchend",i._onDrop),u(l,"touchcancel",i._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,W.draggable=!0),j("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(D||w))o();else{if(Mt.eventCanceled)return void this._onDrop();u(l,"mouseup",i._disableDelayedDrag),u(l,"touchend",i._disableDelayedDrag),u(l,"touchcancel",i._disableDelayedDrag),u(l,"mousemove",i._delayedDragTouchMoveHandler),u(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&u(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){W&&Nt(W),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;r(t,"mouseup",this._disableDelayedDrag),r(t,"touchend",this._disableDelayedDrag),r(t,"touchcancel",this._disableDelayedDrag),r(t,"mousemove",this._delayedDragTouchMoveHandler),r(t,"touchmove",this._delayedDragTouchMoveHandler),r(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||("touch"==t.pointerType?t:null),!this.nativeDraggable||e?this.options.supportPointer?u(document,"pointermove",this._onTouchMove):u(document,e?"touchmove":"mousemove",this._onTouchMove):(u(W,"dragend",this),u(U,"dragstart",this._onDragStart));try{document.selection?Pt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(dt=!1,U&&W){j("dragStarted",this,{evt:e}),this.nativeDraggable&&u(document,"dragover",Ot);var n=this.options;t||P(W,n.dragClass,!1),P(W,n.ghostClass,!0),Mt.active=this,t&&this._appendGhost(),K({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(rt){this._lastX=rt.clientX,this._lastY=rt.clientY,Ct();for(var t=document.elementFromPoint(rt.clientX,rt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(rt.clientX,rt.clientY))!==e;)e=t;if(W.parentNode[L]._isOutsideThisEl(t),e)do{if(e[L]){if(e[L]._onDragOver({clientX:rt.clientX,clientY:rt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Tt()}},_onTouchMove:function(t){if(it){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=G&&b(G),a=G&&r&&r.a,l=G&&r&&r.d,s=yt&&ut&&v(ut),c=(i.clientX-it.clientX+o.x)/(a||1)+(s?s[0]-vt[0]:0)/(a||1),u=(i.clientY-it.clientY+o.y)/(l||1)+(s?s[1]-vt[1]:0)/(l||1),d=t.touches?"translate3d("+c+"px,"+u+"px,0)":"translate("+c+"px,"+u+"px)";if(!Mt.active&&!dt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(n,a,this)&&!g.animated){if(g===W)return A(!1);if(g&&l===n.target&&(s=g),s&&(i=X(s)),!1!==At(U,l,W,o,s,i,n,!!s))return M(),l.appendChild(W),z=l,N(),A(!0)}else if(s.parentNode===l){i=X(s);var v,m,b,y=W.parentNode!==l,w=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,s=n?e.width:e.height;return o===a||i===l||o+r/2===a+s/2}(W.animated&&W.toRect||o,s.animated&&s.toRect||i,a),D=a?"top":"left",E=Y(s,null,"top","top")||Y(W,null,"top","top"),S=E?E.scrollTop:void 0;if(lt!==s&&(m=i[D],pt=!1,gt=!w&&e.invertSwap||y),0!==(v=function(t,e,n,o,i,r,a){var l=X(e),s=n?t.clientY:t.clientX,c=n?l.height:l.width,u=n?l.top:l.left,d=n?l.bottom:l.right,h=!1;if(!r)if(a&&ct * @author owenm * @license MIT @@ -126,7 +126,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } -var version = "1.10.0-rc1"; +var version = "1.10.0-rc2"; function userAgent(pattern) { return !!navigator.userAgent.match(pattern); @@ -419,7 +419,7 @@ function getChild(el, childNum, options) { children = el.children; while (i < children.length) { - if (children[i].style.display !== 'none' && children[i] !== Sortable$1.ghost && children[i] !== Sortable$1.dragged && closest(children[i], options.draggable, el, false)) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { if (currentChild === childNum) { return children[i]; } @@ -443,7 +443,7 @@ function getChild(el, childNum, options) { function lastChild(el, selector) { var last = el.lastElementChild; - while (last && (last === Sortable$1.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { last = last.previousElementSibling; } @@ -468,7 +468,7 @@ function index(el, selector) { while (el = el.previousElementSibling) { - if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable$1.clone && (!selector || matches(el, selector))) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { index++; } } @@ -630,7 +630,7 @@ function AnimationStateManager() { var children = [].slice.call(this.el.children); for (var i in children) { - if (css(children[i], 'display') === 'none' || children[i] === Sortable$1.ghost) continue; + if (css(children[i], 'display') === 'none' || children[i] === Sortable.ghost) continue; animationStates.push({ target: children[i], rect: getRect(children[i]) @@ -918,7 +918,7 @@ var pluginEvent = function pluginEvent(eventName, sortable) { originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, ["evt"]); - PluginManager.pluginEvent.bind(Sortable$1)(eventName, sortable, _objectSpread({ + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ dragEl: dragEl, parentEl: parentEl, ghostEl: ghostEl, @@ -929,7 +929,7 @@ var pluginEvent = function pluginEvent(eventName, sortable) { cloneHidden: cloneHidden, dragStarted: moved, putSortable: putSortable, - activeSortable: Sortable$1.active, + activeSortable: Sortable.active, originalEvent: originalEvent, oldIndex: oldIndex, oldDraggableIndex: oldDraggableIndex, @@ -1165,7 +1165,7 @@ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { */ -function Sortable$1(el, options) { +function Sortable(el, options) { if (!(el && el.nodeType && el.nodeType === 1)) { throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); } @@ -1217,7 +1217,7 @@ function Sortable$1(el, options) { x: 0, y: 0 }, - supportPointer: Sortable$1.supportPointer !== false && 'PointerEvent' in window, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, emptyInsertThreshold: 5 }; PluginManager.initializePlugins(this, el, defaults); // Set default options @@ -1263,10 +1263,10 @@ function Sortable$1(el, options) { _extends(this, AnimationStateManager()); } -Sortable$1.prototype = +Sortable.prototype = /** @lends Sortable.prototype */ { - constructor: Sortable$1, + constructor: Sortable, _isOutsideThisEl: function _isOutsideThisEl(target) { if (!this.el.contains(target) && target !== this.el) { lastTarget = null; @@ -1392,7 +1392,7 @@ Sortable$1.prototype = nextEl = dragEl.nextSibling; lastDownEl = target; activeGroup = options.group; - Sortable$1.dragged = dragEl; + Sortable.dragged = dragEl; tapEvt = { target: dragEl, clientX: (touch || evt).clientX, @@ -1407,7 +1407,7 @@ Sortable$1.prototype = evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { _this._onDrop(); return; @@ -1456,7 +1456,7 @@ Sortable$1.prototype = }); // Delay is impossible for native DnD in Edge or IE if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1549,7 +1549,7 @@ Sortable$1.prototype = !fallback && toggleClass(dragEl, options.dragClass, false); toggleClass(dragEl, options.ghostClass, true); - Sortable$1.active = this; + Sortable.active = this; fallback && this._appendGhost(); // Drag start event _dispatchEvent({ @@ -1620,7 +1620,7 @@ Sortable$1.prototype = dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1), 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 - if (!Sortable$1.active && !awaitingDragStarted) { + if (!Sortable.active && !awaitingDragStarted) { if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { return; } @@ -1679,7 +1679,7 @@ Sortable$1.prototype = css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); css(ghostEl, 'zIndex', '100000'); css(ghostEl, 'pointerEvents', 'none'); - Sortable$1.ghost = ghostEl; + Sortable.ghost = ghostEl; container.appendChild(ghostEl); } }, @@ -1696,7 +1696,7 @@ Sortable$1.prototype = evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1704,7 +1704,7 @@ Sortable$1.prototype = pluginEvent('setupClone', this); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { cloneEl = clone(dragEl); cloneEl.draggable = false; cloneEl.style['will-change'] = ''; @@ -1712,13 +1712,13 @@ Sortable$1.prototype = this._hideClone(); toggleClass(cloneEl, this.options.chosenClass, false); - Sortable$1.clone = cloneEl; + Sortable.clone = cloneEl; } // #1143: IFrame support workaround _this.cloneId = _nextTick(function () { pluginEvent('clone', _this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; if (!_this.options.removeCloneOnHide) { rootEl.insertBefore(cloneEl, dragEl); @@ -1772,7 +1772,7 @@ Sortable$1.prototype = revert, options = this.options, group = options.group, - activeSortable = Sortable$1.active, + activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, @@ -1832,9 +1832,9 @@ Sortable$1.prototype = toggleClass(dragEl, options.ghostClass, true); } - if (putSortable !== _this && _this !== Sortable$1.active) { + if (putSortable !== _this && _this !== Sortable.active) { putSortable = _this; - } else if (_this === Sortable$1.active && putSortable) { + } else if (_this === Sortable.active && putSortable) { putSortable = null; } // Animation @@ -1892,7 +1892,7 @@ Sortable$1.prototype = target = closest(target, options.draggable, el, true); dragOverEvent('dragOver'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { return completed(false); @@ -1905,7 +1905,7 @@ Sortable$1.prototype = vertical = this._getDirection(evt, target) === 'vertical'; dragRect = getRect(dragEl); dragOverEvent('dragOverValid'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (revert) { parentEl = rootEl; // actualization @@ -1916,7 +1916,7 @@ Sortable$1.prototype = dragOverEvent('revert'); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { if (nextEl) { rootEl.insertBefore(dragEl, nextEl); } else { @@ -2065,7 +2065,7 @@ Sortable$1.prototype = newIndex = index(dragEl); newDraggableIndex = index(dragEl, options.draggable); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._nulling(); return; @@ -2191,7 +2191,7 @@ Sortable$1.prototype = } } - if (Sortable$1.active) { + if (Sortable.active) { /* jshint eqnull:true */ if (newIndex == null || newIndex === -1) { newIndex = oldIndex; @@ -2215,7 +2215,7 @@ Sortable$1.prototype = }, _nulling: function _nulling() { pluginEvent('nulling', this); - 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; + 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; savedInputChecked.forEach(function (el) { el.checked = true; }); @@ -2365,7 +2365,7 @@ Sortable$1.prototype = _hideClone: function _hideClone() { if (!cloneHidden) { pluginEvent('hideClone', this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; css(cloneEl, 'display', 'none'); if (this.options.removeCloneOnHide && cloneEl.parentNode) { @@ -2384,7 +2384,7 @@ Sortable$1.prototype = if (cloneHidden) { pluginEvent('showClone', this); - if (Sortable$1.eventCanceled) return; // show clone at dragEl or original position + if (Sortable.eventCanceled) return; // show clone at dragEl or original position if (rootEl.contains(dragEl) && !this.options.group.revertClone) { rootEl.insertBefore(cloneEl, dragEl); @@ -2563,12 +2563,12 @@ function _cancelNextTick(id) { on(document, 'touchmove', function (evt) { - if ((Sortable$1.active || awaitingDragStarted) && evt.cancelable) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { evt.preventDefault(); } }); // Export utils -Sortable$1.utils = { +Sortable.utils = { on: on, off: off, css: css, @@ -2592,7 +2592,7 @@ Sortable$1.utils = { * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted */ -Sortable$1.mount = function () { +Sortable.mount = function () { for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { plugins[_key] = arguments[_key]; } @@ -2606,7 +2606,7 @@ Sortable$1.mount = function () { throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(el)); } - if (plugin.utils) Sortable$1.utils = _objectSpread({}, Sortable$1.utils, plugin.utils); + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); PluginManager.mount(plugin); } }; @@ -2617,12 +2617,12 @@ Sortable$1.mount = function () { */ -Sortable$1.create = function (el, options) { - return new Sortable$1(el, options); +Sortable.create = function (el, options) { + return new Sortable(el, options); }; // Export -Sortable$1.version = version; +Sortable.version = version; var autoScrolls = [], scrollEl, @@ -3386,7 +3386,7 @@ function MultiDragPlugin() { // Do not "unfold" after around dragEl if reverted if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { var dragRect = getRect(dragEl$1), - multiDragIndex = index(dragEl$1, ':not(.' + Sortable.active.options.selectedClass + ')'); + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; toSortable.captureAnimationState(); @@ -3626,10 +3626,10 @@ function removeMultiDragElements() { } } -Sortable$1.mount(new AutoScrollPlugin()); -Sortable$1.mount(Remove, Revert); +Sortable.mount(new AutoScrollPlugin()); +Sortable.mount(Remove, Revert); -Sortable$1.mount(new SwapPlugin()); -Sortable$1.mount(new MultiDragPlugin()); +Sortable.mount(new SwapPlugin()); +Sortable.mount(new MultiDragPlugin()); -export default Sortable$1; +export default Sortable; diff --git a/modular/sortable.core.esm.js b/modular/sortable.core.esm.js index 8a24051a6..7f61eade8 100644 --- a/modular/sortable.core.esm.js +++ b/modular/sortable.core.esm.js @@ -1,5 +1,5 @@ /**! - * Sortable 1.10.0-rc1 + * Sortable 1.10.0-rc2 * @author RubaXa * @author owenm * @license MIT @@ -126,7 +126,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } -var version = "1.10.0-rc1"; +var version = "1.10.0-rc2"; function userAgent(pattern) { return !!navigator.userAgent.match(pattern); @@ -419,7 +419,7 @@ function getChild(el, childNum, options) { children = el.children; while (i < children.length) { - if (children[i].style.display !== 'none' && children[i] !== Sortable$1.ghost && children[i] !== Sortable$1.dragged && closest(children[i], options.draggable, el, false)) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { if (currentChild === childNum) { return children[i]; } @@ -443,7 +443,7 @@ function getChild(el, childNum, options) { function lastChild(el, selector) { var last = el.lastElementChild; - while (last && (last === Sortable$1.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { last = last.previousElementSibling; } @@ -468,7 +468,7 @@ function index(el, selector) { while (el = el.previousElementSibling) { - if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable$1.clone && (!selector || matches(el, selector))) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { index++; } } @@ -630,7 +630,7 @@ function AnimationStateManager() { var children = [].slice.call(this.el.children); for (var i in children) { - if (css(children[i], 'display') === 'none' || children[i] === Sortable$1.ghost) continue; + if (css(children[i], 'display') === 'none' || children[i] === Sortable.ghost) continue; animationStates.push({ target: children[i], rect: getRect(children[i]) @@ -918,7 +918,7 @@ var pluginEvent = function pluginEvent(eventName, sortable) { originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, ["evt"]); - PluginManager.pluginEvent.bind(Sortable$1)(eventName, sortable, _objectSpread({ + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ dragEl: dragEl, parentEl: parentEl, ghostEl: ghostEl, @@ -929,7 +929,7 @@ var pluginEvent = function pluginEvent(eventName, sortable) { cloneHidden: cloneHidden, dragStarted: moved, putSortable: putSortable, - activeSortable: Sortable$1.active, + activeSortable: Sortable.active, originalEvent: originalEvent, oldIndex: oldIndex, oldDraggableIndex: oldDraggableIndex, @@ -1165,7 +1165,7 @@ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { */ -function Sortable$1(el, options) { +function Sortable(el, options) { if (!(el && el.nodeType && el.nodeType === 1)) { throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); } @@ -1217,7 +1217,7 @@ function Sortable$1(el, options) { x: 0, y: 0 }, - supportPointer: Sortable$1.supportPointer !== false && 'PointerEvent' in window, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, emptyInsertThreshold: 5 }; PluginManager.initializePlugins(this, el, defaults); // Set default options @@ -1263,10 +1263,10 @@ function Sortable$1(el, options) { _extends(this, AnimationStateManager()); } -Sortable$1.prototype = +Sortable.prototype = /** @lends Sortable.prototype */ { - constructor: Sortable$1, + constructor: Sortable, _isOutsideThisEl: function _isOutsideThisEl(target) { if (!this.el.contains(target) && target !== this.el) { lastTarget = null; @@ -1392,7 +1392,7 @@ Sortable$1.prototype = nextEl = dragEl.nextSibling; lastDownEl = target; activeGroup = options.group; - Sortable$1.dragged = dragEl; + Sortable.dragged = dragEl; tapEvt = { target: dragEl, clientX: (touch || evt).clientX, @@ -1407,7 +1407,7 @@ Sortable$1.prototype = evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { _this._onDrop(); return; @@ -1456,7 +1456,7 @@ Sortable$1.prototype = }); // Delay is impossible for native DnD in Edge or IE if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1549,7 +1549,7 @@ Sortable$1.prototype = !fallback && toggleClass(dragEl, options.dragClass, false); toggleClass(dragEl, options.ghostClass, true); - Sortable$1.active = this; + Sortable.active = this; fallback && this._appendGhost(); // Drag start event _dispatchEvent({ @@ -1620,7 +1620,7 @@ Sortable$1.prototype = dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1), 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 - if (!Sortable$1.active && !awaitingDragStarted) { + if (!Sortable.active && !awaitingDragStarted) { if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { return; } @@ -1679,7 +1679,7 @@ Sortable$1.prototype = css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); css(ghostEl, 'zIndex', '100000'); css(ghostEl, 'pointerEvents', 'none'); - Sortable$1.ghost = ghostEl; + Sortable.ghost = ghostEl; container.appendChild(ghostEl); } }, @@ -1696,7 +1696,7 @@ Sortable$1.prototype = evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1704,7 +1704,7 @@ Sortable$1.prototype = pluginEvent('setupClone', this); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { cloneEl = clone(dragEl); cloneEl.draggable = false; cloneEl.style['will-change'] = ''; @@ -1712,13 +1712,13 @@ Sortable$1.prototype = this._hideClone(); toggleClass(cloneEl, this.options.chosenClass, false); - Sortable$1.clone = cloneEl; + Sortable.clone = cloneEl; } // #1143: IFrame support workaround _this.cloneId = _nextTick(function () { pluginEvent('clone', _this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; if (!_this.options.removeCloneOnHide) { rootEl.insertBefore(cloneEl, dragEl); @@ -1772,7 +1772,7 @@ Sortable$1.prototype = revert, options = this.options, group = options.group, - activeSortable = Sortable$1.active, + activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, @@ -1832,9 +1832,9 @@ Sortable$1.prototype = toggleClass(dragEl, options.ghostClass, true); } - if (putSortable !== _this && _this !== Sortable$1.active) { + if (putSortable !== _this && _this !== Sortable.active) { putSortable = _this; - } else if (_this === Sortable$1.active && putSortable) { + } else if (_this === Sortable.active && putSortable) { putSortable = null; } // Animation @@ -1892,7 +1892,7 @@ Sortable$1.prototype = target = closest(target, options.draggable, el, true); dragOverEvent('dragOver'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { return completed(false); @@ -1905,7 +1905,7 @@ Sortable$1.prototype = vertical = this._getDirection(evt, target) === 'vertical'; dragRect = getRect(dragEl); dragOverEvent('dragOverValid'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (revert) { parentEl = rootEl; // actualization @@ -1916,7 +1916,7 @@ Sortable$1.prototype = dragOverEvent('revert'); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { if (nextEl) { rootEl.insertBefore(dragEl, nextEl); } else { @@ -2065,7 +2065,7 @@ Sortable$1.prototype = newIndex = index(dragEl); newDraggableIndex = index(dragEl, options.draggable); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._nulling(); return; @@ -2191,7 +2191,7 @@ Sortable$1.prototype = } } - if (Sortable$1.active) { + if (Sortable.active) { /* jshint eqnull:true */ if (newIndex == null || newIndex === -1) { newIndex = oldIndex; @@ -2215,7 +2215,7 @@ Sortable$1.prototype = }, _nulling: function _nulling() { pluginEvent('nulling', this); - 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; + 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; savedInputChecked.forEach(function (el) { el.checked = true; }); @@ -2365,7 +2365,7 @@ Sortable$1.prototype = _hideClone: function _hideClone() { if (!cloneHidden) { pluginEvent('hideClone', this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; css(cloneEl, 'display', 'none'); if (this.options.removeCloneOnHide && cloneEl.parentNode) { @@ -2384,7 +2384,7 @@ Sortable$1.prototype = if (cloneHidden) { pluginEvent('showClone', this); - if (Sortable$1.eventCanceled) return; // show clone at dragEl or original position + if (Sortable.eventCanceled) return; // show clone at dragEl or original position if (rootEl.contains(dragEl) && !this.options.group.revertClone) { rootEl.insertBefore(cloneEl, dragEl); @@ -2563,12 +2563,12 @@ function _cancelNextTick(id) { on(document, 'touchmove', function (evt) { - if ((Sortable$1.active || awaitingDragStarted) && evt.cancelable) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { evt.preventDefault(); } }); // Export utils -Sortable$1.utils = { +Sortable.utils = { on: on, off: off, css: css, @@ -2592,7 +2592,7 @@ Sortable$1.utils = { * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted */ -Sortable$1.mount = function () { +Sortable.mount = function () { for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { plugins[_key] = arguments[_key]; } @@ -2606,7 +2606,7 @@ Sortable$1.mount = function () { throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(el)); } - if (plugin.utils) Sortable$1.utils = _objectSpread({}, Sortable$1.utils, plugin.utils); + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); PluginManager.mount(plugin); } }; @@ -2617,12 +2617,12 @@ Sortable$1.mount = function () { */ -Sortable$1.create = function (el, options) { - return new Sortable$1(el, options); +Sortable.create = function (el, options) { + return new Sortable(el, options); }; // Export -Sortable$1.version = version; +Sortable.version = version; var autoScrolls = [], scrollEl, @@ -3388,7 +3388,7 @@ function MultiDragPlugin() { // Do not "unfold" after around dragEl if reverted if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { var dragRect = getRect(dragEl$1), - multiDragIndex = index(dragEl$1, ':not(.' + Sortable.active.options.selectedClass + ')'); + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; toSortable.captureAnimationState(); @@ -3628,5 +3628,5 @@ function removeMultiDragElements() { } } -export default Sortable$1; -export { AutoScrollPlugin as AutoScroll, MultiDragPlugin as MultiDrag, OnSpill, Sortable$1 as Sortable, SwapPlugin as Swap }; +export default Sortable; +export { AutoScrollPlugin as AutoScroll, MultiDragPlugin as MultiDrag, OnSpill, Sortable, SwapPlugin as Swap }; diff --git a/modular/sortable.esm.js b/modular/sortable.esm.js index 024cbe1ce..bee79fae9 100644 --- a/modular/sortable.esm.js +++ b/modular/sortable.esm.js @@ -1,5 +1,5 @@ /**! - * Sortable 1.10.0-rc1 + * Sortable 1.10.0-rc2 * @author RubaXa * @author owenm * @license MIT @@ -126,7 +126,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } -var version = "1.10.0-rc1"; +var version = "1.10.0-rc2"; function userAgent(pattern) { return !!navigator.userAgent.match(pattern); @@ -419,7 +419,7 @@ function getChild(el, childNum, options) { children = el.children; while (i < children.length) { - if (children[i].style.display !== 'none' && children[i] !== Sortable$1.ghost && children[i] !== Sortable$1.dragged && closest(children[i], options.draggable, el, false)) { + if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) { if (currentChild === childNum) { return children[i]; } @@ -443,7 +443,7 @@ function getChild(el, childNum, options) { function lastChild(el, selector) { var last = el.lastElementChild; - while (last && (last === Sortable$1.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { + while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) { last = last.previousElementSibling; } @@ -468,7 +468,7 @@ function index(el, selector) { while (el = el.previousElementSibling) { - if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable$1.clone && (!selector || matches(el, selector))) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) { index++; } } @@ -630,7 +630,7 @@ function AnimationStateManager() { var children = [].slice.call(this.el.children); for (var i in children) { - if (css(children[i], 'display') === 'none' || children[i] === Sortable$1.ghost) continue; + if (css(children[i], 'display') === 'none' || children[i] === Sortable.ghost) continue; animationStates.push({ target: children[i], rect: getRect(children[i]) @@ -918,7 +918,7 @@ var pluginEvent = function pluginEvent(eventName, sortable) { originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, ["evt"]); - PluginManager.pluginEvent.bind(Sortable$1)(eventName, sortable, _objectSpread({ + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({ dragEl: dragEl, parentEl: parentEl, ghostEl: ghostEl, @@ -929,7 +929,7 @@ var pluginEvent = function pluginEvent(eventName, sortable) { cloneHidden: cloneHidden, dragStarted: moved, putSortable: putSortable, - activeSortable: Sortable$1.active, + activeSortable: Sortable.active, originalEvent: originalEvent, oldIndex: oldIndex, oldDraggableIndex: oldDraggableIndex, @@ -1165,7 +1165,7 @@ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) { */ -function Sortable$1(el, options) { +function Sortable(el, options) { if (!(el && el.nodeType && el.nodeType === 1)) { throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); } @@ -1217,7 +1217,7 @@ function Sortable$1(el, options) { x: 0, y: 0 }, - supportPointer: Sortable$1.supportPointer !== false && 'PointerEvent' in window, + supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window, emptyInsertThreshold: 5 }; PluginManager.initializePlugins(this, el, defaults); // Set default options @@ -1263,10 +1263,10 @@ function Sortable$1(el, options) { _extends(this, AnimationStateManager()); } -Sortable$1.prototype = +Sortable.prototype = /** @lends Sortable.prototype */ { - constructor: Sortable$1, + constructor: Sortable, _isOutsideThisEl: function _isOutsideThisEl(target) { if (!this.el.contains(target) && target !== this.el) { lastTarget = null; @@ -1392,7 +1392,7 @@ Sortable$1.prototype = nextEl = dragEl.nextSibling; lastDownEl = target; activeGroup = options.group; - Sortable$1.dragged = dragEl; + Sortable.dragged = dragEl; tapEvt = { target: dragEl, clientX: (touch || evt).clientX, @@ -1407,7 +1407,7 @@ Sortable$1.prototype = evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { _this._onDrop(); return; @@ -1456,7 +1456,7 @@ Sortable$1.prototype = }); // Delay is impossible for native DnD in Edge or IE if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1549,7 +1549,7 @@ Sortable$1.prototype = !fallback && toggleClass(dragEl, options.dragClass, false); toggleClass(dragEl, options.ghostClass, true); - Sortable$1.active = this; + Sortable.active = this; fallback && this._appendGhost(); // Drag start event _dispatchEvent({ @@ -1620,7 +1620,7 @@ Sortable$1.prototype = dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1), 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 - if (!Sortable$1.active && !awaitingDragStarted) { + if (!Sortable.active && !awaitingDragStarted) { if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { return; } @@ -1679,7 +1679,7 @@ Sortable$1.prototype = css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed'); css(ghostEl, 'zIndex', '100000'); css(ghostEl, 'pointerEvents', 'none'); - Sortable$1.ghost = ghostEl; + Sortable.ghost = ghostEl; container.appendChild(ghostEl); } }, @@ -1696,7 +1696,7 @@ Sortable$1.prototype = evt: evt }); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._onDrop(); return; @@ -1704,7 +1704,7 @@ Sortable$1.prototype = pluginEvent('setupClone', this); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { cloneEl = clone(dragEl); cloneEl.draggable = false; cloneEl.style['will-change'] = ''; @@ -1712,13 +1712,13 @@ Sortable$1.prototype = this._hideClone(); toggleClass(cloneEl, this.options.chosenClass, false); - Sortable$1.clone = cloneEl; + Sortable.clone = cloneEl; } // #1143: IFrame support workaround _this.cloneId = _nextTick(function () { pluginEvent('clone', _this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; if (!_this.options.removeCloneOnHide) { rootEl.insertBefore(cloneEl, dragEl); @@ -1772,7 +1772,7 @@ Sortable$1.prototype = revert, options = this.options, group = options.group, - activeSortable = Sortable$1.active, + activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, @@ -1832,9 +1832,9 @@ Sortable$1.prototype = toggleClass(dragEl, options.ghostClass, true); } - if (putSortable !== _this && _this !== Sortable$1.active) { + if (putSortable !== _this && _this !== Sortable.active) { putSortable = _this; - } else if (_this === Sortable$1.active && putSortable) { + } else if (_this === Sortable.active && putSortable) { putSortable = null; } // Animation @@ -1892,7 +1892,7 @@ Sortable$1.prototype = target = closest(target, options.draggable, el, true); dragOverEvent('dragOver'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { return completed(false); @@ -1905,7 +1905,7 @@ Sortable$1.prototype = vertical = this._getDirection(evt, target) === 'vertical'; dragRect = getRect(dragEl); dragOverEvent('dragOverValid'); - if (Sortable$1.eventCanceled) return completedFired; + if (Sortable.eventCanceled) return completedFired; if (revert) { parentEl = rootEl; // actualization @@ -1916,7 +1916,7 @@ Sortable$1.prototype = dragOverEvent('revert'); - if (!Sortable$1.eventCanceled) { + if (!Sortable.eventCanceled) { if (nextEl) { rootEl.insertBefore(dragEl, nextEl); } else { @@ -2065,7 +2065,7 @@ Sortable$1.prototype = newIndex = index(dragEl); newDraggableIndex = index(dragEl, options.draggable); - if (Sortable$1.eventCanceled) { + if (Sortable.eventCanceled) { this._nulling(); return; @@ -2191,7 +2191,7 @@ Sortable$1.prototype = } } - if (Sortable$1.active) { + if (Sortable.active) { /* jshint eqnull:true */ if (newIndex == null || newIndex === -1) { newIndex = oldIndex; @@ -2215,7 +2215,7 @@ Sortable$1.prototype = }, _nulling: function _nulling() { pluginEvent('nulling', this); - 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; + 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; savedInputChecked.forEach(function (el) { el.checked = true; }); @@ -2365,7 +2365,7 @@ Sortable$1.prototype = _hideClone: function _hideClone() { if (!cloneHidden) { pluginEvent('hideClone', this); - if (Sortable$1.eventCanceled) return; + if (Sortable.eventCanceled) return; css(cloneEl, 'display', 'none'); if (this.options.removeCloneOnHide && cloneEl.parentNode) { @@ -2384,7 +2384,7 @@ Sortable$1.prototype = if (cloneHidden) { pluginEvent('showClone', this); - if (Sortable$1.eventCanceled) return; // show clone at dragEl or original position + if (Sortable.eventCanceled) return; // show clone at dragEl or original position if (rootEl.contains(dragEl) && !this.options.group.revertClone) { rootEl.insertBefore(cloneEl, dragEl); @@ -2563,12 +2563,12 @@ function _cancelNextTick(id) { on(document, 'touchmove', function (evt) { - if ((Sortable$1.active || awaitingDragStarted) && evt.cancelable) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { evt.preventDefault(); } }); // Export utils -Sortable$1.utils = { +Sortable.utils = { on: on, off: off, css: css, @@ -2592,7 +2592,7 @@ Sortable$1.utils = { * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted */ -Sortable$1.mount = function () { +Sortable.mount = function () { for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) { plugins[_key] = arguments[_key]; } @@ -2606,7 +2606,7 @@ Sortable$1.mount = function () { throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(el)); } - if (plugin.utils) Sortable$1.utils = _objectSpread({}, Sortable$1.utils, plugin.utils); + if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils); PluginManager.mount(plugin); } }; @@ -2617,12 +2617,12 @@ Sortable$1.mount = function () { */ -Sortable$1.create = function (el, options) { - return new Sortable$1(el, options); +Sortable.create = function (el, options) { + return new Sortable(el, options); }; // Export -Sortable$1.version = version; +Sortable.version = version; var autoScrolls = [], scrollEl, @@ -3386,7 +3386,7 @@ function MultiDragPlugin() { // Do not "unfold" after around dragEl if reverted if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) { var dragRect = getRect(dragEl$1), - multiDragIndex = index(dragEl$1, ':not(.' + Sortable.active.options.selectedClass + ')'); + multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')'); if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null; toSortable.captureAnimationState(); @@ -3626,8 +3626,8 @@ function removeMultiDragElements() { } } -Sortable$1.mount(new AutoScrollPlugin()); -Sortable$1.mount(Remove, Revert); +Sortable.mount(new AutoScrollPlugin()); +Sortable.mount(Remove, Revert); -export default Sortable$1; -export { MultiDragPlugin as MultiDrag, Sortable$1 as Sortable, SwapPlugin as Swap }; +export default Sortable; +export { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap }; diff --git a/package.json b/package.json index d9bf7bf02..6f54741f3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sortablejs", "exportName": "Sortable", - "version": "1.10.0-rc1", + "version": "1.10.0-rc2", "devDependencies": { "@babel/core": "^7.4.4", "@babel/plugin-transform-object-assign": "^7.2.0", diff --git a/plugins/OnSpill/README.md b/plugins/OnSpill/README.md index 2553888b6..088d0c6ff 100644 --- a/plugins/OnSpill/README.md +++ b/plugins/OnSpill/README.md @@ -3,12 +3,13 @@ This file contains two seperate plugins, RemoveOnSpill and RevertOnSpill. They c **These plugins are default plugins, and are included in the default UMD and ESM builds of Sortable** + --- ### Mounting ```js -import { Sortable, OnSpill } from 'sortablejs'; +import { Sortable, OnSpill } from 'sortablejs/modular/sortable.core.esm'; Sortable.mount(OnSpill); ``` @@ -21,7 +22,6 @@ Sortable.mount(OnSpill); This plugin, when enabled, will cause the dragged item to be reverted to it's original position if it is spilled (ie. it is dropped outside of a valid Sortable drop target) ---- ### Options diff --git a/plugins/Swap/README.md b/plugins/Swap/README.md index 56d43e1d8..c55fe80a2 100644 --- a/plugins/Swap/README.md +++ b/plugins/Swap/README.md @@ -9,7 +9,7 @@ Demo: https://jsbin.com/yejehog/edit?html,js,output ### Mounting ```js -import { Sortable, Swap } from 'sortablejs'; +import { Sortable, Swap } from 'sortablejs/modular/sortable.core.esm'; Sortable.mount(new Swap()); ```