You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7 lines
41 KiB
7 lines
41 KiB
/**!
|
|
* Sortable 1.10.2
|
|
* @author RubaXa <trash@rubaxa.org>
|
|
* @author owenm <owen23355@gmail.com>
|
|
* @license MIT
|
|
*/
|
|
function t(e){return(t="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})(e)}function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}function o(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{},i=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),i.forEach((function(n){e(t,n,o[n])}))}return t}function i(t,e){if(null==t)return{};var n,o,i=function(t,e){if(null==t)return{};var n,o,i={},r=Object.keys(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function r(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var a=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),l=r(/Edge/i),s=r(/firefox/i),c=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),d=r(/iP(ad|od|hone)/i),u=r(/chrome/i)&&r(/android/i),h={capture:!1,passive:!1};function f(t,e,n){t.addEventListener(e,n,!a&&h)}function p(t,e,n){t.removeEventListener(e,n,!a&&h)}function g(t,e){if(e){if(">"===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(n){return!1}return!1}}function m(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function v(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&g(t,e):g(t,e))||o&&t===n)return t;if(t===n)break}while(t=m(t))}return null}var b,y=/\s+/g;function w(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(y," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(y," ")}}function E(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 D(t,e){var n="";if("string"==typeof t)n=t;else do{var o=E(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function _(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function S(){var t=document.scrollingElement;return t||document.documentElement}function C(t,e,n,o,i){if(t.getBoundingClientRect||t===window){var r,l,s,c,d,u,h;if(t!==window&&t!==S()?(l=(r=t.getBoundingClientRect()).top,s=r.left,c=r.bottom,d=r.right,u=r.height,h=r.width):(l=0,s=0,c=window.innerHeight,d=window.innerWidth,u=window.innerHeight,h=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!a))do{if(i&&i.getBoundingClientRect&&("none"!==E(i,"transform")||n&&"static"!==E(i,"position"))){var f=i.getBoundingClientRect();l-=f.top+parseInt(E(i,"border-top-width")),s-=f.left+parseInt(E(i,"border-left-width")),c=l+r.height,d=s+r.width;break}}while(i=i.parentNode);if(o&&t!==window){var p=D(i||t),g=p&&p.a,m=p&&p.d;p&&(c=(l/=m)+(u/=m),d=(s/=g)+(h/=g))}return{top:l,left:s,bottom:c,right:d,width:h,height:u}}}function x(t,e,n){for(var o=N(t,!0),i=C(t)[e];o;){var r=C(o)[n];if(!("top"===n||"left"===n?i>=r:i<=r))return o;if(o===S())break;o=N(o,!1)}return!1}function T(t,e,n){for(var o=0,i=0,r=t.children;i<r.length;){if("none"!==r[i].style.display&&r[i]!==At.ghost&&r[i]!==At.dragged&&v(r[i],n.draggable,t,!1)){if(o===e)return r[i];o++}i++}return null}function O(t,e){for(var n=t.lastElementChild;n&&(n===At.ghost||"none"===E(n,"display")||e&&!g(n,e));)n=n.previousElementSibling;return n||null}function I(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===At.clone||e&&!g(t,e)||n++;return n}function M(t){var e=0,n=0,o=S();if(t)do{var i=D(t),r=i.a,a=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*a}while(t!==o&&(t=t.parentNode));return[e,n]}function N(t,e){if(!t||!t.getBoundingClientRect)return S();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=E(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return S();if(o||e)return n;o=!0}}}while(n=n.parentNode);return S()}function P(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function A(t,e){return function(){if(!b){var n=arguments;1===n.length?t.call(this,n[0]):t.apply(this,n),b=setTimeout((function(){b=void 0}),e)}}}function k(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function F(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var R="Sortable"+(new Date).getTime();function X(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==E(t,"display")&&t!==At.ghost){e.push({target:t,rect:C(t)});var n=o({},e[e.length-1].rect);if(t.thisAnimationDuration){var i=D(t,!0);i&&(n.top-=i.f,n.left-=i.e)}t.fromRect=n}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(e,{target:t}),1)},animateAll:function(n){var o=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof n&&n());var i=!1,r=0;e.forEach((function(t){var e=0,n=t.target,a=n.fromRect,l=C(n),s=n.prevFromRect,c=n.prevToRect,d=t.rect,u=D(n,!0);u&&(l.top-=u.f,l.left-=u.e),n.toRect=l,n.thisAnimationDuration&&P(s,l)&&!P(a,l)&&(d.top-l.top)/(d.left-l.left)==(a.top-l.top)/(a.left-l.left)&&(e=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(d,s,c,o.options)),P(l,a)||(n.prevFromRect=a,n.prevToRect=l,e||(e=o.options.animation),o.animate(n,d,l,e)),e&&(i=!0,r=Math.max(r,e),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),e),n.thisAnimationDuration=e)})),clearTimeout(t),i?t=setTimeout((function(){"function"==typeof n&&n()}),r):"function"==typeof n&&n(),e=[]},animate:function(t,e,n,o){if(o){E(t,"transition",""),E(t,"transform","");var i=D(this.el),r=i&&i.a,a=i&&i.d,l=(e.left-n.left)/(r||1),s=(e.top-n.top)/(a||1);t.animatingX=!!l,t.animatingY=!!s,E(t,"transform","translate3d("+l+"px,"+s+"px,0)"),function(t){t.offsetWidth}(t),E(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),E(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){E(t,"transition",""),E(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}}var L=[],Y={initializeByDefault:!0},$={mount:function(t){for(var e in Y)Y.hasOwnProperty(e)&&!(e in t)&&(t[e]=Y[e]);L.push(t)},pluginEvent:function(t,e,n){var i=this;this.eventCanceled=!1,n.cancel=function(){i.eventCanceled=!0};var r=t+"Global";L.forEach((function(i){e[i.pluginName]&&(e[i.pluginName][r]&&e[i.pluginName][r](o({sortable:e},n)),e.options[i.pluginName]&&e[i.pluginName][t]&&e[i.pluginName][t](o({sortable:e},n)))}))},initializePlugins:function(t,e,o,i){for(var r in L.forEach((function(i){var r=i.pluginName;if(t.options[r]||i.initializeByDefault){var a=new i(t,e,t.options);a.sortable=t,a.options=t.options,t[r]=a,n(o,a.defaults)}})),t.options)if(t.options.hasOwnProperty(r)){var a=this.modifyOption(t,r,t.options[r]);void 0!==a&&(t.options[r]=a)}},getEventProperties:function(t,e){var o={};return L.forEach((function(i){"function"==typeof i.eventProperties&&n(o,i.eventProperties.call(e[i.pluginName],t))})),o},modifyOption:function(t,e,n){var o;return L.forEach((function(i){t[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[e]&&(o=i.optionListeners[e].call(t[i.pluginName],n))})),o}};var B=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=i(n,["evt"]);$.pluginEvent.bind(At)(t,e,o({dragEl:H,parentEl:W,ghostEl:V,rootEl:U,nextEl:z,lastDownEl:G,cloneEl:q,cloneHidden:J,dragStarted:ct,putSortable:nt,activeSortable:At.active,originalEvent:r,oldIndex:Z,oldDraggableIndex:Q,newIndex:K,newDraggableIndex:tt,hideGhostForTarget:It,unhideGhostForTarget:Mt,cloneNowHidden:function(){J=!0},cloneNowShown:function(){J=!1},dispatchSortableEvent:function(t){j({sortable:e,name:t,originalEvent:r})}},a))};function j(t){!function(t){var e=t.sortable,n=t.rootEl,i=t.name,r=t.targetEl,s=t.cloneEl,c=t.toEl,d=t.fromEl,u=t.oldIndex,h=t.newIndex,f=t.oldDraggableIndex,p=t.newDraggableIndex,g=t.originalEvent,m=t.putSortable,v=t.extraEventProperties;if(e=e||n&&n[R]){var b,y=e.options,w="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||a||l?(b=document.createEvent("Event")).initEvent(i,!0,!0):b=new CustomEvent(i,{bubbles:!0,cancelable:!0}),b.to=c||n,b.from=d||n,b.item=r||n,b.clone=s,b.oldIndex=u,b.newIndex=h,b.oldDraggableIndex=f,b.newDraggableIndex=p,b.originalEvent=g,b.pullMode=m?m.lastPutMode:void 0;var E=o({},v,$.getEventProperties(i,e));for(var D in E)b[D]=E[D];n&&n.dispatchEvent(b),y[w]&&y[w].call(e,b)}}(o({putSortable:nt,cloneEl:q,targetEl:H,rootEl:U,oldIndex:Z,oldDraggableIndex:Q,newIndex:K,newDraggableIndex:tt},t))}var H,W,V,U,z,G,q,J,Z,K,Q,tt,et,nt,ot,it,rt,at,lt,st,ct,dt,ut,ht,ft,pt=!1,gt=!1,mt=[],vt=!1,bt=!1,yt=[],wt=!1,Et=[],Dt="undefined"!=typeof document,_t=d,St=l||a?"cssFloat":"float",Ct=Dt&&!u&&!d&&"draggable"in document.createElement("div"),xt=function(){if(Dt){if(a)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Tt=function(t,e){var n=E(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=T(t,0,e),r=T(t,1,e),a=i&&E(i),l=r&&E(r),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+C(i).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+C(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&"none"!==a.float){var d="left"===a.float?"left":"right";return!r||"both"!==l.clear&&l.clear!==d?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||s>=o&&"none"===n[St]||r&&"none"===n[St]&&s+c>o)?"vertical":"horizontal"},Ot=function(e){function n(t,e){return function(o,i,r,a){var l=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(e||l))return!0;if(null==t||!1===t)return!1;if(e&&"clone"===t)return t;if("function"==typeof t)return n(t(o,i,r,a),e)(o,i,r,a);var s=(e?o:i).options.group.name;return!0===t||"string"==typeof t&&t===s||t.join&&t.indexOf(s)>-1}}var o={},i=e.group;i&&"object"==t(i)||(i={name:i}),o.name=i.name,o.checkPull=n(i.pull,!0),o.checkPut=n(i.put),o.revertClone=i.revertClone,e.group=o},It=function(){!xt&&V&&E(V,"display","none")},Mt=function(){!xt&&V&&E(V,"display","")};Dt&&document.addEventListener("click",(function(t){if(gt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),gt=!1,!1}),!0);var Nt=function(t){if(H){t=t.touches?t.touches[0]:t;var e=(i=t.clientX,r=t.clientY,mt.some((function(t){if(!O(t)){var e=C(t),n=t[R].options.emptyInsertThreshold,o=i>=e.left-n&&i<=e.right+n,l=r>=e.top-n&&r<=e.bottom+n;return n&&o&&l?a=t:void 0}})),a);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[R]._onDragOver(n)}}var i,r,a},Pt=function(t){H&&H.parentNode[R]._isOutsideThisEl(t.target)};function At(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=n({},e),t[R]=this;var o={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 Tt(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?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==At.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in $.initializePlugins(this,t,o),o)!(i in e)&&(e[i]=o[i]);for(var r in Ot(e),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!e.forceFallback&&Ct,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?f(t,"pointerdown",this._onTapStart):(f(t,"mousedown",this._onTapStart),f(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(f(t,"dragover",this),f(t,"dragenter",this)),mt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),n(this,X())}function kt(t,e,n,o,i,r,s,c){var d,u,h=t[R],f=h.options.onMove;return!window.CustomEvent||a||l?(d=document.createEvent("Event")).initEvent("move",!0,!0):d=new CustomEvent("move",{bubbles:!0,cancelable:!0}),d.to=e,d.from=t,d.dragged=n,d.draggedRect=o,d.related=i||e,d.relatedRect=r||C(e),d.willInsertAfter=c,d.originalEvent=s,t.dispatchEvent(d),f&&(u=f.call(h,d,s)),u}function Ft(t){t.draggable=!1}function Rt(){wt=!1}function Xt(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 Lt(t){return setTimeout(t,0)}function Yt(t){return clearTimeout(t)}At.prototype={constructor:At,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(dt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,H):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,l=(a||t).target,s=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,c=o.filter;if(function(t){Et.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&Et.push(o)}}(n),!H&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||o.disabled||s.isContentEditable||(l=v(l,o.draggable,n,!1))&&l.animated||G===l)){if(Z=I(l),Q=I(l,o.draggable),"function"==typeof c){if(c.call(this,t,l,this))return j({sortable:e,rootEl:s,name:"filter",targetEl:l,toEl:n,fromEl:n}),B("filter",e,{evt:t}),void(i&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=v(s,o.trim(),n,!1))return j({sortable:e,rootEl:o,name:"filter",targetEl:l,fromEl:n,toEl:n}),B("filter",e,{evt:t}),!0}))))return void(i&&t.cancelable&&t.preventDefault());o.handle&&!v(s,o.handle,n,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,c=i.options,d=r.ownerDocument;if(n&&!H&&n.parentNode===r){var u=C(n);if(U=r,W=(H=n).parentNode,z=H.nextSibling,G=n,et=c.group,At.dragged=H,ot={target:H,clientX:(e||t).clientX,clientY:(e||t).clientY},lt=ot.clientX-u.left,st=ot.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,H.style["will-change"]="all",o=function(){B("delayEnded",i,{evt:t}),At.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!s&&i.nativeDraggable&&(H.draggable=!0),i._triggerDragStart(t,e),j({sortable:i,name:"choose",originalEvent:t}),w(H,c.chosenClass,!0))},c.ignore.split(",").forEach((function(t){_(H,t.trim(),Ft)})),f(d,"dragover",Nt),f(d,"mousemove",Nt),f(d,"touchmove",Nt),f(d,"mouseup",i._onDrop),f(d,"touchend",i._onDrop),f(d,"touchcancel",i._onDrop),s&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),B("delayStart",this,{evt:t}),!c.delay||c.delayOnTouchOnly&&!e||this.nativeDraggable&&(l||a))o();else{if(At.eventCanceled)return void this._onDrop();f(d,"mouseup",i._disableDelayedDrag),f(d,"touchend",i._disableDelayedDrag),f(d,"touchcancel",i._disableDelayedDrag),f(d,"mousemove",i._delayedDragTouchMoveHandler),f(d,"touchmove",i._delayedDragTouchMoveHandler),c.supportPointer&&f(d,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,c.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(){H&&Ft(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;p(t,"mouseup",this._disableDelayedDrag),p(t,"touchend",this._disableDelayedDrag),p(t,"touchcancel",this._disableDelayedDrag),p(t,"mousemove",this._delayedDragTouchMoveHandler),p(t,"touchmove",this._delayedDragTouchMoveHandler),p(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?f(document,"pointermove",this._onTouchMove):f(document,e?"touchmove":"mousemove",this._onTouchMove):(f(H,"dragend",this),f(U,"dragstart",this._onDragStart));try{document.selection?Lt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(pt=!1,U&&H){B("dragStarted",this,{evt:e}),this.nativeDraggable&&f(document,"dragover",Pt);var n=this.options;!t&&w(H,n.dragClass,!1),w(H,n.ghostClass,!0),At.active=this,t&&this._appendGhost(),j({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(it){this._lastX=it.clientX,this._lastY=it.clientY,It();for(var t=document.elementFromPoint(it.clientX,it.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(it.clientX,it.clientY))!==e;)e=t;if(H.parentNode[R]._isOutsideThisEl(t),e)do{if(e[R]){if(e[R]._onDragOver({clientX:it.clientX,clientY:it.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Mt()}},_onTouchMove:function(t){if(ot){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=V&&D(V,!0),a=V&&r&&r.a,l=V&&r&&r.d,s=_t&&ft&&M(ft),c=(i.clientX-ot.clientX+o.x)/(a||1)+(s?s[0]-yt[0]:0)/(a||1),d=(i.clientY-ot.clientY+o.y)/(l||1)+(s?s[1]-yt[1]:0)/(l||1);if(!At.active&&!pt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(V){r?(r.e+=c-(rt||0),r.f+=d-(at||0)):r={a:1,b:0,c:0,d:1,e:c,f:d};var u="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")");E(V,"webkitTransform",u),E(V,"mozTransform",u),E(V,"msTransform",u),E(V,"transform",u),rt=c,at=d,it=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!V){var t=this.options.fallbackOnBody?document.body:U,e=C(H,!0,_t,!0,t),n=this.options;if(_t){for(ft=t;"static"===E(ft,"position")&&"none"===E(ft,"transform")&&ft!==document;)ft=ft.parentNode;ft!==document.body&&ft!==document.documentElement?(ft===document&&(ft=S()),e.top+=ft.scrollTop,e.left+=ft.scrollLeft):ft=S(),yt=M(ft)}w(V=H.cloneNode(!0),n.ghostClass,!1),w(V,n.fallbackClass,!0),w(V,n.dragClass,!0),E(V,"transition",""),E(V,"transform",""),E(V,"box-sizing","border-box"),E(V,"margin",0),E(V,"top",e.top),E(V,"left",e.left),E(V,"width",e.width),E(V,"height",e.height),E(V,"opacity","0.8"),E(V,"position",_t?"absolute":"fixed"),E(V,"zIndex","100000"),E(V,"pointerEvents","none"),At.ghost=V,t.appendChild(V),E(V,"transform-origin",lt/parseInt(V.style.width)*100+"% "+st/parseInt(V.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,o=t.dataTransfer,i=n.options;B("dragStart",this,{evt:t}),At.eventCanceled?this._onDrop():(B("setupClone",this),At.eventCanceled||((q=F(H)).draggable=!1,q.style["will-change"]="",this._hideClone(),w(q,this.options.chosenClass,!1),At.clone=q),n.cloneId=Lt((function(){B("clone",n),At.eventCanceled||(n.options.removeCloneOnHide||U.insertBefore(q,H),n._hideClone(),j({sortable:n,name:"clone"}))})),!e&&w(H,i.dragClass,!0),e?(gt=!0,n._loopId=setInterval(n._emulateDragOver,50)):(p(document,"mouseup",n._onDrop),p(document,"touchend",n._onDrop),p(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(n,o,H)),f(document,"drop",n),E(H,"transform","translateZ(0)")),pt=!0,n._dragStartId=Lt(n._dragStarted.bind(n,e,t)),f(document,"selectstart",n),ct=!0,c&&E(document.body,"user-select","none"))},_onDragOver:function(t){var e,n,i,r,a=this.el,l=t.target,s=this.options,c=s.group,d=At.active,u=et===c,h=s.sort,f=nt||d,p=this,g=!1;if(!wt){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),l=v(l,s.draggable,a,!0),L("dragOver"),At.eventCanceled)return g;if(H.contains(t.target)||l.animated&&l.animatingX&&l.animatingY||p._ignoreWhileAnimating===l)return $(!1);if(gt=!1,d&&!s.disabled&&(u?h||(i=!U.contains(H)):nt===this||(this.lastPutMode=et.checkPull(this,d,H,t))&&c.checkPut(this,d,H,t))){if(r="vertical"===this._getDirection(t,l),e=C(H),L("dragOverValid"),At.eventCanceled)return g;if(i)return W=U,Y(),this._hideClone(),L("revert"),At.eventCanceled||(z?U.insertBefore(H,z):U.appendChild(H)),$(!0);var m=O(a,s.draggable);if(!m||function(t,e,n){var o=C(O(n.el,n.options.draggable)),i=10;return e?t.clientX>o.right+i||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+i}(t,r,this)&&!m.animated){if(m===H)return $(!1);if(m&&a===t.target&&(l=m),l&&(n=C(l)),!1!==kt(U,a,H,e,l,n,t,!!l))return Y(),a.appendChild(H),W=a,G(),$(!0)}else if(l.parentNode===a){n=C(l);var b,y,D,_=H.parentNode!==a,S=!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}(H.animated&&H.toRect||e,l.animated&&l.toRect||n,r),T=r?"top":"left",M=x(l,"top","top")||x(H,"top","top"),N=M?M.scrollTop:void 0;if(dt!==l&&(y=n[T],vt=!1,bt=!S&&s.invertSwap||_),b=function(t,e,n,o,i,r,a,l){var s=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,u=o?n.bottom:n.right,h=!1;if(!a)if(l&&ht<c*i){if(!vt&&(1===ut?s>d+c*r/2:s<u-c*r/2)&&(vt=!0),vt)h=!0;else if(1===ut?s<d+ht:s>u-ht)return-ut}else if(s>d+c*(1-i)/2&&s<u-c*(1-i)/2)return function(t){return I(H)<I(t)?1:-1}(e);if((h=h||a)&&(s<d+c*r/2||s>u-c*r/2))return s>d+c/2?1:-1;return 0}(t,l,n,r,S?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,bt,dt===l),0!==b){var P=I(H);do{P-=b,D=W.children[P]}while(D&&("none"===E(D,"display")||D===V))}if(0===b||D===l)return $(!1);dt=l,ut=b;var A=l.nextElementSibling,F=!1,X=kt(U,a,H,e,l,n,t,F=1===b);if(!1!==X)return 1!==X&&-1!==X||(F=1===X),wt=!0,setTimeout(Rt,30),Y(),F&&!A?a.appendChild(H):l.parentNode.insertBefore(H,F?A:l),M&&k(M,0,N-M.scrollTop),W=H.parentNode,void 0===y||bt||(ht=Math.abs(y-C(l)[T])),G(),$(!0)}if(a.contains(H))return $(!1)}return!1}function L(s,c){B(s,p,o({evt:t,isOwner:u,axis:r?"vertical":"horizontal",revert:i,dragRect:e,targetRect:n,canSort:h,fromSortable:f,target:l,completed:$,onMove:function(n,o){return kt(U,a,H,e,n,C(n),t,o)},changed:G},c))}function Y(){L("dragOverAnimationCapture"),p.captureAnimationState(),p!==f&&f.captureAnimationState()}function $(e){return L("dragOverCompleted",{insertion:e}),e&&(u?d._hideClone():d._showClone(p),p!==f&&(w(H,nt?nt.options.ghostClass:d.options.ghostClass,!1),w(H,s.ghostClass,!0)),nt!==p&&p!==At.active?nt=p:p===At.active&&nt&&(nt=null),f===p&&(p._ignoreWhileAnimating=l),p.animateAll((function(){L("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(l===H&&!H.animated||l===a&&!l.animated)&&(dt=null),s.dragoverBubble||t.rootEl||l===document||(H.parentNode[R]._isOutsideThisEl(t.target),!e&&Nt(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function G(){K=I(H),tt=I(H,s.draggable),j({sortable:p,name:"change",toEl:a,newIndex:K,newDraggableIndex:tt,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){p(document,"mousemove",this._onTouchMove),p(document,"touchmove",this._onTouchMove),p(document,"pointermove",this._onTouchMove),p(document,"dragover",Nt),p(document,"mousemove",Nt),p(document,"touchmove",Nt)},_offUpEvents:function(){var t=this.el.ownerDocument;p(t,"mouseup",this._onDrop),p(t,"touchend",this._onDrop),p(t,"pointerup",this._onDrop),p(t,"touchcancel",this._onDrop),p(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;K=I(H),tt=I(H,n.draggable),B("drop",this,{evt:t}),W=H&&H.parentNode,K=I(H),tt=I(H,n.draggable),At.eventCanceled||(pt=!1,bt=!1,vt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Yt(this.cloneId),Yt(this._dragStartId),this.nativeDraggable&&(p(document,"drop",this),p(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),c&&E(document.body,"user-select",""),E(H,"transform",""),t&&(ct&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),V&&V.parentNode&&V.parentNode.removeChild(V),(U===W||nt&&"clone"!==nt.lastPutMode)&&q&&q.parentNode&&q.parentNode.removeChild(q),H&&(this.nativeDraggable&&p(H,"dragend",this),Ft(H),H.style["will-change"]="",ct&&!pt&&w(H,nt?nt.options.ghostClass:this.options.ghostClass,!1),w(H,this.options.chosenClass,!1),j({sortable:this,name:"unchoose",toEl:W,newIndex:null,newDraggableIndex:null,originalEvent:t}),U!==W?(K>=0&&(j({rootEl:W,name:"add",toEl:W,fromEl:U,originalEvent:t}),j({sortable:this,name:"remove",toEl:W,originalEvent:t}),j({rootEl:W,name:"sort",toEl:W,fromEl:U,originalEvent:t}),j({sortable:this,name:"sort",toEl:W,originalEvent:t})),nt&&nt.save()):K!==Z&&K>=0&&(j({sortable:this,name:"update",toEl:W,originalEvent:t}),j({sortable:this,name:"sort",toEl:W,originalEvent:t})),At.active&&(null!=K&&-1!==K||(K=Z,tt=Q),j({sortable:this,name:"end",toEl:W,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){B("nulling",this),U=H=W=V=z=q=G=J=ot=it=ct=K=tt=Z=Q=dt=ut=nt=et=At.dragged=At.ghost=At.clone=At.active=null,Et.forEach((function(t){t.checked=!0})),Et.length=rt=at=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o<i;o++)v(t=n[o],r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||Xt(t));return e},sort:function(t){var e={},n=this.el;this.toArray().forEach((function(t,o){var i=n.children[o];v(i,this.options.draggable,n,!1)&&(e[t]=i)}),this),t.forEach((function(t){e[t]&&(n.removeChild(e[t]),n.appendChild(e[t]))}))},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return v(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];var o=$.modifyOption(this,t,e);n[t]=void 0!==o?o:e,"group"===t&&Ot(n)},destroy:function(){B("destroy",this);var t=this.el;t[R]=null,p(t,"mousedown",this._onTapStart),p(t,"touchstart",this._onTapStart),p(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(p(t,"dragover",this),p(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),mt.splice(mt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!J){if(B("hideClone",this),At.eventCanceled)return;E(q,"display","none"),this.options.removeCloneOnHide&&q.parentNode&&q.parentNode.removeChild(q),J=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(J){if(B("showClone",this),At.eventCanceled)return;U.contains(H)&&!this.options.group.revertClone?U.insertBefore(q,H):z?U.insertBefore(q,z):U.appendChild(q),this.options.group.revertClone&&this.animate(H,q),E(q,"display",""),J=!1}}else this._hideClone()}},Dt&&f(document,"touchmove",(function(t){(At.active||pt)&&t.cancelable&&t.preventDefault()})),At.utils={on:f,off:p,css:E,find:_,is:function(t,e){return!!v(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},throttle:A,closest:v,toggleClass:w,clone:F,index:I,nextTick:Lt,cancelNextTick:Yt,detectDirection:Tt,getChild:T},At.get=function(t){return t[R]},At.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(At.utils=o({},At.utils,t.utils)),$.mount(t)}))},At.create=function(t,e){return new At(t,e)},At.version="1.10.2";var $t,Bt,jt,Ht,Wt,Vt,Ut=[],zt=!1;function Gt(){Ut.forEach((function(t){clearInterval(t.pid)})),Ut=[]}function qt(){clearInterval(Vt)}var Jt=A((function(t,e,n,o){if(e.scroll){var i,r=(t.touches?t.touches[0]:t).clientX,a=(t.touches?t.touches[0]:t).clientY,l=e.scrollSensitivity,s=e.scrollSpeed,c=S(),d=!1;Bt!==n&&(Bt=n,Gt(),$t=e.scroll,i=e.scrollFn,!0===$t&&($t=N(n,!0)));var u=0,h=$t;do{var f=h,p=C(f),g=p.top,m=p.bottom,v=p.left,b=p.right,y=p.width,w=p.height,D=void 0,_=void 0,x=f.scrollWidth,T=f.scrollHeight,O=E(f),I=f.scrollLeft,M=f.scrollTop;f===c?(D=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX||"visible"===O.overflowX),_=w<T&&("auto"===O.overflowY||"scroll"===O.overflowY||"visible"===O.overflowY)):(D=y<x&&("auto"===O.overflowX||"scroll"===O.overflowX),_=w<T&&("auto"===O.overflowY||"scroll"===O.overflowY));var P=D&&(Math.abs(b-r)<=l&&I+y<x)-(Math.abs(v-r)<=l&&!!I),A=_&&(Math.abs(m-a)<=l&&M+w<T)-(Math.abs(g-a)<=l&&!!M);if(!Ut[u])for(var F=0;F<=u;F++)Ut[F]||(Ut[F]={});Ut[u].vx==P&&Ut[u].vy==A&&Ut[u].el===f||(Ut[u].el=f,Ut[u].vx=P,Ut[u].vy=A,clearInterval(Ut[u].pid),0==P&&0==A||(d=!0,Ut[u].pid=setInterval(function(){o&&0===this.layer&&At.active._onTouchMove(Wt);var e=Ut[this.layer].vy?Ut[this.layer].vy*s:0,n=Ut[this.layer].vx?Ut[this.layer].vx*s:0;"function"==typeof i&&"continue"!==i.call(At.dragged.parentNode[R],n,e,t,Wt,Ut[this.layer].el)||k(Ut[this.layer].el,n,e)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==c&&(h=N(h,!1)));zt=d}}),30),Zt=function(t){var e=t.originalEvent,n=t.putSortable,o=t.dragEl,i=t.activeSortable,r=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(e){var s=n||i;a();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,d=document.elementFromPoint(c.clientX,c.clientY);l(),s&&!s.el.contains(d)&&(r("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function Kt(){}function Qt(){}Kt.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=T(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(e,o):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Zt},n(Kt,{pluginName:"revertOnSpill"}),Qt.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable||this.sortable;n.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),n.animateAll()},drop:Zt},n(Qt,{pluginName:"removeOnSpill"}),At.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?f(document,"dragover",this._handleAutoScroll):this.options.supportPointer?f(document,"pointermove",this._handleFallbackAutoScroll):e.touches?f(document,"touchmove",this._handleFallbackAutoScroll):f(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?p(document,"dragover",this._handleAutoScroll):(p(document,"pointermove",this._handleFallbackAutoScroll),p(document,"touchmove",this._handleFallbackAutoScroll),p(document,"mousemove",this._handleFallbackAutoScroll)),qt(),Gt(),clearTimeout(b),b=void 0},nulling:function(){Wt=Bt=$t=zt=Vt=jt=Ht=null,Ut.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var n=this,o=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,r=document.elementFromPoint(o,i);if(Wt=t,e||l||a||c){Jt(t,this.options,r,e);var s=N(r,!0);!zt||Vt&&o===jt&&i===Ht||(Vt&&qt(),Vt=setInterval((function(){var r=N(document.elementFromPoint(o,i),!0);r!==s&&(s=r,Gt()),Jt(t,n.options,r,e)}),10),jt=o,Ht=i)}else{if(!this.options.bubbleScroll||N(r,!0)===S())return void Gt();Jt(t,this.options,N(r,!1),!1)}}},n(t,{pluginName:"scroll",initializeByDefault:!0})}),At.mount(Qt,Kt);const te="undefined"!=typeof window?window.console:global.console;const ee=/-(\w)/g,ne=function(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}((t=>t.replace(ee,((t,e)=>e?e.toUpperCase():""))));function oe(t){null!==t.parentElement&&t.parentElement.removeChild(t)}function ie(t,e,n){const o=0===n?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,o)}function re(t,e){this.$nextTick((()=>this.$emit(t.toLowerCase(),e)))}function ae(t){return e=>{null!==this.realList&&this["onDrag"+t](e),re.call(this,t,e)}}function le(t){return["transition-group","TransitionGroup"].includes(t)}function se(t,e,n){return t[n]||(e[n]?e[n]():void 0)}const ce=["Start","Add","Remove","Update","End"],de=["Choose","Unchoose","Sort","Filter","Clone"],ue=["Move",...ce,...de].map((t=>"on"+t));var he=null;const fe={name:"draggable",inheritAttrs:!1,props:{options:Object,list:{type:Array,required:!1,default:null},value:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:t=>t},element:{type:String,default:"div"},tag:{type:String,default:null},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},data:()=>({transitionMode:!1,noneFunctionalComponentMode:!1}),render(t){const e=this.$slots.default;this.transitionMode=function(t){if(!t||1!==t.length)return!1;const[{componentOptions:e}]=t;return!!e&&le(e.tag)}(e);const{children:n,headerOffset:o,footerOffset:i}=function(t,e,n){let o=0,i=0;const r=se(e,n,"header");r&&(o=r.length,t=t?[...r,...t]:[...r]);const a=se(e,n,"footer");return a&&(i=a.length,t=t?[...t,...a]:[...a]),{children:t,headerOffset:o,footerOffset:i}}(e,this.$slots,this.$scopedSlots);this.headerOffset=o,this.footerOffset=i;const r=function(t,e){let n=null;const o=(t,e)=>{n=function(t,e,n){return void 0===n||((t=t||{})[e]=n),t}(n,t,e)};if(o("attrs",Object.keys(t).filter((t=>"id"===t||t.startsWith("data-"))).reduce(((e,n)=>(e[n]=t[n],e)),{})),!e)return n;const{on:i,props:r,attrs:a}=e;return o("on",i),o("props",r),Object.assign(n.attrs,a),n}(this.$attrs,this.componentData);return t(this.getTag(),r,n)},created(){null!==this.list&&null!==this.value&&te.error("Value and list props are mutually exclusive! Please set one or another."),"div"!==this.element&&te.warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props"),void 0!==this.options&&te.warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props")},mounted(){if(this.noneFunctionalComponentMode=this.getTag().toLowerCase()!==this.$el.nodeName.toLowerCase()&&!this.getIsFunctional(),this.noneFunctionalComponentMode&&this.transitionMode)throw new Error(`Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ${this.getTag()}`);const t={};ce.forEach((e=>{t["on"+e]=ae.call(this,e)})),de.forEach((e=>{t["on"+e]=re.bind(this,e)}));const e=Object.keys(this.$attrs).reduce(((t,e)=>(t[ne(e)]=this.$attrs[e],t)),{}),n=Object.assign({},this.options,e,t,{onMove:(t,e)=>this.onDragMove(t,e)});!("draggable"in n)&&(n.draggable=">*"),this._sortable=new At(this.rootContainer,n),this.computeIndexes()},beforeDestroy(){void 0!==this._sortable&&this._sortable.destroy()},computed:{rootContainer(){return this.transitionMode?this.$el.children[0]:this.$el},realList(){return this.list?this.list:this.value}},watch:{options:{handler(t){this.updateOptions(t)},deep:!0},$attrs:{handler(t){this.updateOptions(t)},deep:!0},realList(){this.computeIndexes()}},methods:{getIsFunctional(){const{fnOptions:t}=this._vnode;return t&&t.functional},getTag(){return this.tag||this.element},updateOptions(t){for(var e in t){const n=ne(e);-1===ue.indexOf(n)&&this._sortable.option(n,t[e])}},getChildrenNodes(){if(this.noneFunctionalComponentMode)return this.$children[0].$slots.default;const t=this.$slots.default;return this.transitionMode?t[0].child.$slots.default:t},computeIndexes(){this.$nextTick((()=>{this.visibleIndexes=function(t,e,n,o){if(!t)return[];const i=t.map((t=>t.elm)),r=e.length-o,a=[...e].map(((t,e)=>e>=r?i.length:i.indexOf(t)));return n?a.filter((t=>-1!==t)):a}(this.getChildrenNodes(),this.rootContainer.children,this.transitionMode,this.footerOffset)}))},getUnderlyingVm(t){const e=function(t,e){return t.map((t=>t.elm)).indexOf(e)}(this.getChildrenNodes()||[],t);if(-1===e)return null;return{index:e,element:this.realList[e]}},getUnderlyingPotencialDraggableComponent:({__vue__:t})=>t&&t.$options&&le(t.$options._componentTag)?t.$parent:!("realList"in t)&&1===t.$children.length&&"realList"in t.$children[0]?t.$children[0]:t,emitChanges(t){this.$nextTick((()=>{this.$emit("change",t)}))},alterList(t){if(this.list)return void t(this.list);const e=[...this.value];t(e),this.$emit("input",e)},spliceList(){this.alterList((t=>t.splice(...arguments)))},updatePosition(t,e){this.alterList((n=>n.splice(e,0,n.splice(t,1)[0])))},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getUnderlyingPotencialDraggableComponent(t);if(!n)return{component:n};const o=n.realList,i={list:o,component:n};if(t!==e&&o&&n.getUnderlyingVm){const t=n.getUnderlyingVm(e);if(t)return Object.assign(t,i)}return i},getVmIndex(t){const e=this.visibleIndexes,n=e.length;return t>n-1?n:e[t]},getComponent(){return this.$slots.default[0].componentInstance},resetTransitionData(t){if(!this.noTransitionOnDrag||!this.transitionMode)return;this.getChildrenNodes()[t].data=null;const e=this.getComponent();e.children=[],e.kept=void 0},onDragStart(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),he=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(void 0===e)return;oe(t.item);const n=this.getVmIndex(t.newIndex);this.spliceList(n,0,e),this.computeIndexes();const o={element:e,newIndex:n};this.emitChanges({added:o})},onDragRemove(t){if(ie(this.rootContainer,t.item,t.oldIndex),"clone"===t.pullMode)return void oe(t.clone);const e=this.context.index;this.spliceList(e,1);const n={element:this.context.element,oldIndex:e};this.resetTransitionData(e),this.emitChanges({removed:n})},onDragUpdate(t){oe(t.item),ie(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndex(t.newIndex);this.updatePosition(e,n);const o={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:o})},updateProperty(t,e){t.hasOwnProperty(e)&&(t[e]+=this.headerOffset)},computeFutureIndex(t,e){if(!t.element)return 0;const n=[...e.to.children].filter((t=>"none"!==t.style.display)),o=n.indexOf(e.related),i=t.component.getVmIndex(o);return-1!==n.indexOf(he)||!e.willInsertAfter?i:i+1},onDragMove(t,e){const n=this.move;if(!n||!this.realList)return!0;const o=this.getRelatedContextFromMoveEvent(t),i=this.context,r=this.computeFutureIndex(o,t);Object.assign(i,{futureIndex:r});return n(Object.assign({},t,{relatedContext:o,draggedContext:i}),e)},onDragEnd(){this.computeIndexes(),he=null}}};"undefined"!=typeof window&&"Vue"in window&&window.Vue.component("draggable",fe);export{fe as default};
|
|
|