vue-virtual-draglist
Advanced tools
Comparing version 2.8.5 to 2.8.6
/*! | ||
* vue-virtual-drag-list v2.8.5 | ||
* vue-virtual-drag-list v2.8.6 | ||
* open source under the MIT license | ||
* https://github.com/mfuu/vue-virtual-drag-list#readme | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).VirtualDragList=e(t.Vue)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=e(t);function n(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function o(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function s(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c={exports:{}}; | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).VirtualDragList=e(t.Vue)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c={exports:{}}; | ||
/*! | ||
* sortable-dnd v0.6.6 | ||
* sortable-dnd v0.6.12 | ||
* open source under the MIT license | ||
* https://github.com/mfuu/sortable-dnd#readme | ||
*/!function(t,e){t.exports=function(){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(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},e.apply(this,arguments)}var i={capture:!1,passive:!1},n=/\s+/g;function o(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r=o(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),s=o(/Edge/i),l=o(/safari/i)&&!o(/chrome/i)&&!o(/android/i),a=function(){var t=!1;return document.addEventListener("checkIfSupportPassive",null,{get passive(){return t=!0,!0}}),t}(),c=function(){if("undefined"==typeof window||"undefined"==typeof document)return{};var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],e=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1];return{dom:"WebKit|Moz|MS|O".match(new RegExp("("+e+")","i"))[1],lowercase:e,css:"-"+e+"-",js:e[0].toUpperCase()+e.substr(1)}}();function h(t,e){t.style["".concat(c.css,"transition-duration")]=e?"".concat(e,"ms"):""}function u(t,e){t.style["".concat(c.css,"transform")]=e?"".concat(e):""}function d(t,e,n){window.addEventListener?t.addEventListener(e,n,!(!a&&r)&&i):window.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function f(t,e,n){window.removeEventListener?t.removeEventListener(e,n,!(!a&&r)&&i):window.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function p(){return document.scrollingElement||document.documentElement}function m(t,e,i){if(t.getBoundingClientRect||t===window){var n,o,r,s,l,a,c;if(t!==window&&t.parentNode&&t!==p()?(o=(n=t.getBoundingClientRect()).top,r=n.left,s=n.bottom,l=n.right,a=n.height,c=n.width):(o=0,r=0,s=window.innerHeight,l=window.innerWidth,a=window.innerHeight,c=window.innerWidth),e&&t!==window){i=i||t.parentNode;do{if(i&&i.getBoundingClientRect){var h=i.getBoundingClientRect();o-=h.top+parseInt(T(i,"border-top-width")),r-=h.left+parseInt(T(i,"border-left-width")),s=o+n.height,l=r+n.width;break}}while(i=i.parentNode)}return{top:o,left:r,bottom:s,right:l,width:c,height:a}}}function g(t,e,i,n){if(!t)return null;if(i&&!e){var o=Array.prototype.slice.call(i.children),r=o.indexOf(t);if(r>-1)return o[r];for(var s=0;s<o.length;s++)if(v(t,o[s]))return o[s]}i=i||document;do{if(null!=e&&(">"===e[0]?t.parentNode===i&&_(t,e):_(t,e))||n&&t===i)return t;if(t===i)break}while(t=t.parentNode);return null}function v(t,e){if(!t||!e)return!1;if(e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return!0;return!1}function y(t,e){for(var i=t.lastElementChild;i&&(i===nt.ghost||"none"===T(i,"display")||e&&!_(i,e));)i=i.previousElementSibling;return i||null}function b(t,e){if(!t||!t.parentNode)return-1;for(var i=0;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!_(t,e)||"none"===T(t,"display")||i++;return i}function S(t,e,i,n){for(var o=0,r=0,s=t.children;o<s.length;){if(s[o]!==nt.ghost&&"none"!==T(s[o],"display")&&g(s[o],i,t,!1)&&(n||s[o]!==nt.dragged)){if(r===e)return s[o];r++}o++}return null}function w(t,e){var i=T(t),n=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),o=S(t,0,e),l=S(t,1,e),a=o&&T(o),c=l&&T(l),h=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+m(o).width,u=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+m(l).width,d=s||r?"cssFloat":"float";if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&"none"!==a.float){var f="left"===a.float?"left":"right";return!l||"both"!==c.clear&&c.clear!==f?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||h>=n&&"none"===i[d]||l&&"none"===i[d]&&h+u>n)?"vertical":"horizontal"}function x(t,e,i){if(t&&e)if(t.classList)t.classList[i?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(n," ").replace(" "+e+" "," ");t.className=(o+(i?" "+e:"")).replace(n," ")}}function _(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(t){return!1}return!1}}function T(t,e,i){var n=t&&t.style;if(n){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(i=t.currentStyle),void 0===e?i:i[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=i+("string"==typeof i?"":"px")}}function E(t,e){var i,n,o=(n=e,(i=t).compareDocumentPosition?i.compareDocumentPosition(n):i.contains?(i!=n&&i.contains(n)&&16)+(i!=n&&n.contains(i)&&8)+(i.sourceIndex>=0&&n.sourceIndex>=0?(i.sourceIndex<n.sourceIndex&&4)+(i.sourceIndex>n.sourceIndex&&2):1):0);return 2===o?1:4===o?-1:0}function O(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function z(t){var i=t.sortable,n=t.name,o=t.params,r=i.options[n];"function"==typeof r&&r(e({},o))}var D,I,C="Sortable"+Date.now();function k(t){this.options=t,this.autoScrollAnimationFrame=null}function A(t){this.options=t,this.animations=[]}function M(t){this.options=t||{},this.selectedElements=[]}window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),k.prototype={destroy:function(){this.autoScrollAnimationFrame&&(cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=null)},update:function(t,e,i){var n=this;cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=requestAnimationFrame((function(){e&&i&&n.autoScroll(t,i),n.update(t,e,i)}))},autoScroll:function(t,e){if(t&&void 0!==e.clientX&&void 0!==e.clientY){var i=m(t);if(i){var n=e.clientX,o=e.clientY,r=i.top,s=i.right,l=i.bottom,a=i.left,c=i.height,h=i.width;if(!(o<r||n>s||o>l||n<a)){var u=this.options,d=u.scrollThreshold,f=u.scrollSpeed,p=t.scrollTop,g=t.scrollLeft,v=t.scrollHeight,y=p>0&&o>=r&&o<=r+d,b=g+h<t.scrollWidth&&n<=s&&n>=s-d,S=p+c<v&&o<=l&&o>=l-d,w=0,x=0;g>0&&n>=a&&n<=a+d&&(w=Math.floor(Math.max(-1,(n-a)/d-1)*f.x)),b&&(w=Math.ceil(Math.min(1,(n-s)/d+1)*f.x)),y&&(x=Math.floor(Math.max(-1,(o-r)/d-1)*f.y)),S&&(x=Math.ceil(Math.min(1,(o-l)/d+1)*f.y)),t.scrollTop+=x,t.scrollLeft+=w}}}}},A.prototype={collect:function(t){if(t){for(var e=m(t),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,o=Math.min(e.right,i),r=Math.min(e.bottom,n),s=Array.prototype.slice.call(t.children),l=[],a=0;a<=s.length;a++){var c=s[a];if(c&&c!==nt.ghost&&"none"!==T(c,"display")){var h=m(c);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>r||h.left-h.width>o)break;l.push({node:c,rect:h})}}}this.animations.push(l)}},animate:function(){for(var t=this.animations.pop(),e=0,i=t.length;e<i;e++){var n=t[e],o=n.node,r=n.rect;this._excute(o,r)}},_excute:function(t,e){var i=e.left,n=e.top,o=m(t);if(o.top!==n||o.left!==i){var r=n-o.top,s=i-o.left;h(t),u(t,"translate3d(".concat(s,"px, ").concat(r,"px, 0)")),t.offsetWidth,h(t,this.options.animation),u(t,"translate3d(0px, 0px, 0px)"),clearTimeout(t.animated),t.animated=setTimeout((function(){h(t),u(t,""),t.animated=null}),this.options.animation)}}},M.prototype={destroy:function(){D=I=null},active:function(){return!!D},setParams:function(t){t.nodes=D||[],t.clones=I||[]},select:function(t){x(t,this.options.selectedClass,!0),this.selectedElements.push(t),this.selectedElements.sort((function(t,e){return E(t,e)}))},deselect:function(t){var e=this.selectedElements.indexOf(t);e>-1&&(x(t,this.options.selectedClass,!1),this.selectedElements.splice(e,1))},getGhostElement:function(){if(!D)return null;var t=document.createElement("div");return this.selectedElements.forEach((function(e,i){var n=e.cloneNode(!0),o=0===i?1:.5;n.style="position: absolute;left: 0;top: 0;bottom: 0;right: 0;opacity: ".concat(o,";z-index: ").concat(i,";"),t.appendChild(n)})),t},toggleSelected:function(t,e){var i=this;e?t.forEach((function(t){return i.selectedElements.push(t)})):this.selectedElements=this.selectedElements.filter((function(e){return t.indexOf(e)<0}))},toggleClass:function(t){if(D)for(var e=0;e<D.length;e++)x(D[e],this.options.chosenClass,t)},toggleVisible:function(t){if(D)if(t){var e=D.indexOf(nt.dragged);this._viewElements(D,e,nt.dragged)}else this._hideElements(D)},onChoose:function(){!this.options.multiple||!this.selectedElements.length||this.selectedElements.indexOf(nt.dragged)<0||(this.selectedElements.sort((function(t,e){return E(t,e)})),D=this.selectedElements,this.toggleClass(!0))},onDrag:function(t){D&&(t.animator.collect(nt.dragged.parentNode),this._hideElements(D),t.animator.animate(),this.toggleClass(!1))},onDrop:function(t,e,i){if(D){var n=nt.dragged,o=nt.clone,r=D.indexOf(n);e[C].animator.collect(o.parentNode),t!==e&&"clone"===i?(T(o,"display","none"),I=D.map((function(t){return t.cloneNode(!0)})),this._viewElements(I,r,o),this._viewElements(D,r,n)):this._viewElements(D,r,o),e[C].animator.animate(),t!==e&&(e[C].multiplayer.toggleSelected(I||D,!0),"clone"!==i&&t[C].multiplayer.toggleSelected(D,!1))}},onSelect:function(t,e,i){var n=this.selectedElements.indexOf(e);x(e,this.options.selectedClass,n<0);var o={from:i.el,event:t,node:e,index:b(e)};n<0?(this.selectedElements.push(e),z({sortable:i,name:"onSelect",params:o})):(this.selectedElements.splice(n,1),z({sortable:i,name:"onDeselect",params:o})),this.selectedElements.sort((function(t,e){return E(t,e)}))},_viewElements:function(t,e,i){for(var n=0;n<t.length;n++)if(T(t[n],"display",""),n<e)i.parentNode.insertBefore(t[n],i);else{var o=n>0?t[n-1]:i;i.parentNode.insertBefore(t[n],o.nextSibling)}},_hideElements:function(t){for(var e=0;e<t.length;e++)t[e]!=nt.dragged&&T(t[e],"display","none")}};var B,R,N,P,L,j,F,K,H,q,$,W,Y,U,X,V,G,Z,J,Q,tt,et=[],it=function(e){var i={},n=e.group;n&&"object"==t(n)||(n={name:n,pull:!0,put:!0,revertDrag:!0}),i.name=n.name,i.pull=n.pull,i.put=n.put,i.revertDrag=n.revertDrag,e.group=i};function nt(t,i){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(t));t[C]=this,this.el=t,this.options=i=e({},i);var n={store:null,disabled:!1,group:"",lockAxis:"",animation:150,draggable:null,handle:null,multiple:!1,selectHandle:null,customGhost:null,direction:"",autoScroll:!0,scrollThreshold:55,scrollSpeed:{x:10,y:10},delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",swapOnDrop:!0,fallbackOnBody:!1,supportTouch:"ontouchstart"in window,emptyInsertThreshold:-5};for(var o in n)!(o in this.options)&&(this.options[o]=n[o]);for(var r in it(i),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));d(t,this.options.supportTouch?"touchstart":"mousedown",this._onDrag),et.push(t),this.autoScroller=new k(this.options),this.multiplayer=new M(this.options),this.animator=new A(this.options)}return nt.prototype={constructor:nt,_onDrag:function(t){var e=this;if(!R&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var i=t.touches&&t.touches[0],n=(i||t).target;if(!l||!n||"SELECT"!==n.tagName.toUpperCase()){var o=g(n,this.options.draggable,this.el);if(o&&!o.animated){K={original:t,clientX:(i||t).clientX,clientY:(i||t).clientY},R=o,d($=i?R:document,"mouseup",this._onDrop),d($,"touchend",this._onDrop),d($,"touchcancel",this._onDrop);var a=this.options,c=a.handle,h=a.selectHandle;if("function"==typeof h&&h(t)||"string"==typeof h&&_(n,h))U=!0;else if(("function"!=typeof c||c(t))&&("string"!=typeof c||_(n,c))){var u=this.options,f=u.delay,p=u.delayOnTouchOnly;!f||p&&!i||s||r?this._onStart(i,t):(d(this.el.ownerDocument,"touchmove",this._delayMoveHandler),d(this.el.ownerDocument,"mousemove",this._delayMoveHandler),d(this.el.ownerDocument,"mouseup",this._cancelStart),d(this.el.ownerDocument,"touchend",this._cancelStart),d(this.el.ownerDocument,"touchcancel",this._cancelStart),Y=setTimeout((function(){return e._onStart(i,t)}),f)),d(document,"selectstart",O),l&&T(document.body,"user-select","none")}}}}},_delayMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-K.clientX),Math.abs(e.clientY-K.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(Y),f(this.el.ownerDocument,"touchmove",this._delayMoveHandler),f(this.el.ownerDocument,"mousemove",this._delayMoveHandler),f(this.el.ownerDocument,"mouseup",this._cancelStart),f(this.el.ownerDocument,"touchend",this._cancelStart),f(this.el.ownerDocument,"touchcancel",this._cancelStart),f(document,"selectstart",O),l&&T(document.body,"user-select","")},_onStart:function(t,e){var i=b(R);X=this.el,V=this.el,Z=i,J=i,Q=i,tt=R,B=this.el,L=R.cloneNode(!0),F=R.parentNode,G=this.options.group.pull,nt.clone=L,nt.active=this,nt.dragged=R,x(R,this.options.chosenClass,!0),this.multiplayer.onChoose(),z({sortable:this,name:"onChoose",params:this._getParams(e)}),d($,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout((function(){return document.selection.empty()}),0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){x(L,this.options.chosenClass,!0),this._appendGhost(),this.multiplayer.onDrag(this),z({sortable:this,name:"onDrag",params:this._getParams(K.original)}),T(R,"display","none"),x(R,this.options.chosenClass,!1),R.parentNode.insertBefore(L,R)},_getGhostElement:function(){var t=this.options.customGhost;if("function"==typeof t){var e=this.multiplayer.selectedElements;return t(e.length?e:[R])}return this.multiplayer.getGhostElement()||R},_appendGhost:function(){if(!j){var t=this.options.fallbackOnBody?document.body:this.el,i=this._getGhostElement();x(j=i.cloneNode(!0),this.options.ghostClass,!0);var n,o=m(R),r=e({position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,minWidth:o.width,minHeight:o.height,opacity:"0.8",overflow:"hidden","z-index":"100000","box-sizing":"border-box","pointer-events":"none"},this.options.ghostStyle);for(var s in r)T(j,s,r[s]);n="none",j.style["".concat(c.css,"transition")]=n?"none"===n?"none":"".concat(n):"",u(j,"translate3d(0px, 0px, 0px)"),nt.ghost=j,t.appendChild(j);var l=(K.clientX-o.left)/parseInt(j.style.width)*100,a=(K.clientY-o.top)/parseInt(j.style.height)*100;T(j,"transform-origin","".concat(l,"% ").concat(a,"%")),T(j,"transform","translateZ(0)"),T(j,"will-change","transform")}},_nearestSortable:function(t){O(t);var e=t.touches&&t.touches[0]||t;if(R&&function(t){var e=H||K;return!(void 0!==t.clientX&&void 0!==t.clientY&&Math.abs(t.clientX-e.clientX)<=0&&Math.abs(t.clientY-e.clientY)<=0)}(e)){!H&&this._onStarted();var i=this.options.lockAxis,n="x"===i?K.clientX:e.clientX,o="y"===i?K.clientY:e.clientY,r=document.elementFromPoint(n,o),s=n-K.clientX,l=o-K.clientY;if(H={original:t,clientX:n,clientY:o},u(j,"translate3d(".concat(s,"px, ").concat(l,"px, 0)")),this.options.autoScroll){var a=function(t,e){if(!t||!t.getBoundingClientRect)return p();var i=t,n=!1;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var o=T(i);if(i.clientWidth<i.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!i.getBoundingClientRect||i===document.body)return p();if(n||e)return i;n=!0}}}while(i=i.parentNode);return p()}(r,!0);this.autoScroller.update(a,K,H)}var c,h,d,f=(c=n,h=o,et.some((function(t){var e=t[C].options.emptyInsertThreshold;if(null!=e){var i=m(t),n=c>=i.left-e&&c<=i.right+e,o=h>=i.top-e&&h<=i.bottom+e;return n&&o?d=t:void 0}})),d);f&&f[C]._onMove(t,r)}},_allowPut:function(){if(B===this.el)return!0;if(this.options.group.put){var t=this.options.group,e=t.name,i=t.put,n=B[C].options.group;return i.join&&i.indexOf(n.name)>-1||n.name&&e&&n.name===e}return!1},_getDirection:function(){var t=this.options,e=t.draggable,i=t.direction;return i?"function"==typeof i?i.call(H.original,R,this):i:w(F,e)},_allowSwap:function(){var t=m(N),e="vertical"===this._getDirection(),i=e?"top":"left",n=e?"bottom":"right",o=N[e?"offsetHeight":"offsetWidth"],r=e?H.clientY:H.clientX,s=r>=t[i]&&r<t[n]-o/2?-1:1,l=S(F,0,this.options.draggable),a=y(F),c=m(l),h=m(a);if(N===F||v(F,N))return L===l&&r<c[i]?(P=N,!0):L===a&&r>h[n]&&(P=N.nextSibling,!0);var u=E(L,N);return P=u<0?N.nextSibling:N,q!==N?(W=s,!0):W!==s&&(W=s,s<0?u>0:u<0)},_onMove:function(t,e){if(this._allowPut()){if(z({sortable:this,name:"onMove",params:this._getParams(t)}),this.el!==V&&(e===this.el||!y(this.el)))return N=q=null,void this._onInsert(t);(N=g(e,this.options.draggable,this.el))&&!N.animated&&this._allowSwap()&&(N!==L&&P!==L?(this.el!==V?this._onInsert(t):N!==R&&this._onChange(t),q=N):q=N)}},_onInsert:function(t){var e=N||L,i="clone"===G&&this.el!==B&&V===B,n="clone"===G&&this.el===B&&V!==B;X=this.el,Z=b(L),tt=e,F=N?N.parentNode:this.el,V[C].animator.collect(L.parentNode),this.animator.collect(F),i&&(T(R,"display",""),B[C].multiplayer.toggleVisible(!0),B[C].options.group.revertDrag||V.insertBefore(R,L)),n&&(Z=b(R),T(R,"display","none"),this.multiplayer.toggleVisible(!1)),N?F.insertBefore(L,W<0?N:N.nextSibling):F.appendChild(L),J=b(L),i&&B[C].options.group.revertDrag&&z({sortable:B[C],name:"onChange",params:this._getParams(t,{to:B,target:R,newIndex:Q,revertDrag:!0})}),i||z({sortable:V[C],name:"onRemove",params:this._getParams(t)}),n&&N!==R&&z({sortable:this,name:"onChange",params:this._getParams(t,{from:B,backToOrigin:!0})}),n||z({sortable:this,name:"onAdd",params:this._getParams(t)}),V[C].animator.animate(),this.animator.animate(),V=this.el},_onChange:function(t){F=N.parentNode,Z=b(L),tt=N,this.animator.collect(F),F.insertBefore(L,P),J=b(L),z({sortable:this,name:"onChange",params:this._getParams(t)}),this.animator.animate(),V=this.el},_onDrop:function(t){O(t),this._cancelStart(),f($,"touchmove",this._nearestSortable),f($,"mousemove",this._nearestSortable),f($,"mouseup",this._onDrop),f($,"touchend",this._onDrop),f($,"touchcancel",this._onDrop),x(R,this.options.chosenClass,!1),B&&(V=B,Z=Q,tt===L&&(tt=R),this.multiplayer.toggleClass(!1),z({sortable:this,name:"onUnchoose",params:this._getParams(t)}),H&&this._onEnd(t));var e=this.options,i=e.multiple,n=e.selectHandle;if(i&&(n&&U||!n&&!B)){var o=t.changedTouches?t.changedTouches[0]:t,r=o.clientX-K.clientX,s=o.clientY-K.clientY,l=Math.sqrt(r*r+s*s);l>=0&&l<=1&&this.multiplayer.onSelect(t,R,this)}j&&j.parentNode&&j.parentNode.removeChild(j),this.multiplayer.destroy(),this.autoScroller.destroy(),this._nulling()},_onEnd:function(t){var e=this._getParams(t);this.multiplayer.onDrop(V,X,G);var i=this.options.swapOnDrop;"clone"===G&&V!==X||!("function"==typeof i?i(e):i)||F.insertBefore(R,L),"clone"!==G||V===X||this.multiplayer.active()?L&&L.parentNode&&L.parentNode.removeChild(L):x(L,this.options.chosenClass,!1),T(R,"display",""),V!==X&&z({sortable:V[C],name:"onDrop",params:e}),z({sortable:X[C],name:"onDrop",params:e})},_getParams:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};return n.event=t,n.to=X,n.from=V,n.node=R,n.clone=L,n.target=tt,n.oldIndex=Z,n.newIndex=J,n.pullMode=G,this.multiplayer.setParams(n),e(n,i),n.relative=n.target===R?0:E(n.target,L),n},_nulling:function(){X=V=B=R=N=P=L=j=F=G=Z=J=Q=K=H=tt=q=$=W=Y=U=nt.clone=nt.ghost=nt.active=nt.dragged=null},destroy:function(){this._cancelStart(),this._nulling(),f(this.el,"touchstart",this._onDrag),f(this.el,"mousedown",this._onDrag),et.splice(et.indexOf(this.el),1),this.el[C]=this.animator=this.multiplayer=this.autoScroller=null},option:function(t,e){if(void 0===e)return this.options[t];this.options[t]=e,this.animator.options[t]=e,this.multiplayer.options[t]=e,this.autoScroller.options[t]=e,"group"===t&&it(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selectedElements}},nt.utils={on:d,off:f,css:T,index:b,closest:g,getRect:m,toggleClass:x,detectDirection:w},nt.get=function(t){return t[C]},nt.create=function(t,e){return new nt(t,e)},nt}()}(c);var h=a(c.exports),u={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},scroller:{type:[Document,HTMLElement]},direction:{type:String,default:"vertical"},keeps:{type:Number,default:30},size:{type:Number},draggable:{type:[Function,String]},handle:{type:[Function,String]},group:{type:[String,Object]},lockAxis:{type:String,default:""},debounceTime:{type:Number,default:0},animation:{type:Number,default:150},autoScroll:{type:Boolean,default:!0},scrollThreshold:{type:Number,default:55},keepOffset:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fallbackOnBody:{type:Boolean,default:!1},delay:{type:Number,default:0},delayOnTouchOnly:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemStyle:{type:Object},itemClass:{type:String,default:""},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},d={tag:{type:String,default:"div"},dataKey:{type:[String,Number]},sizeKey:{type:String}};function f(t,e){var i=null,n=function(){for(var n=this,o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];i||(e<=0?t.apply(this,r):i=setTimeout((function(){i=void 0,t.apply(n,r)}),e))};return n.cancel=function(){i&&(clearTimeout(i),i=null)},n}function p(t,e){var i=f(t,e),n=function(){i.cancel(),i.apply(this,arguments)};return n.cancel=function(){i.cancel()},n}function m(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce((function(t,e){return(t||{})[e]}),t)}var g,v,y,b,S=["delay","group","handle","lockAxis","disabled","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","fallbackOnBody","scrollThreshold","delayOnTouchOnly"];function w(t,e){this.el=t,this.options=e,this.list=[],this.store={},this.reRendered=!1,this.init()}w.prototype={constructor:w,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=this.store=this.reRendered=null},option:function(t,e){"list"===t?this.list=s(e):this.sortable.option(t,e)},init:function(){var t=this,e=S.reduce((function(e,i){return e[i]=t.options[i],e}),{});this.sortable=new h(this.el,o(o({},e),{},{swapOnDrop:function(t){return t.from===t.to},onDrag:function(e){return t.onDrag(e)},onAdd:function(e){return t.onAdd(e)},onRemove:function(e){return t.onRemove(e)},onChange:function(e){return t.onChange(e)},onDrop:function(e){return t.onDrop(e)}})),this.list=s(this.options.list)},onDrag:function(t){var e=t.node.dataset.key,i=this.getIndex(this.list,e),n=this.list[i];this.store={item:n,key:e,start:{index:i,list:this.list},from:{index:i,list:this.list},to:{index:i,list:this.list}},this.sortable.option("store",this.store),this.dispatchEvent("onDrag",{item:n,key:e,index:i})},onRemove:function(t){var e=t.node.dataset.key,i=this.getIndex(this.list,e),n=this.list[i];this.list.splice(i,1),Object.assign(this.store,{key:e,item:n}),this.sortable.option("store",this.store),this.dispatchEvent("onRemove",{item:n,key:e,index:i})},onAdd:function(t){var e=t.from,i=t.target,n=t.relative,o=h.get(e).option("store"),r=o.key,s=o.item,l=this.getIndex(this.list,i.dataset.key);0===n?l=this.list.length:-1===n&&(l+=1),this.list.splice(l,0,s),Object.assign(this.store,{to:{index:l,list:this.list}}),this.sortable.option("store",this.store),this.dispatchEvent("onAdd",{item:s,key:r,index:l})},onChange:function(t){var e=h.get(t.from).option("store");if(t.revertDrag)return this.list=s(this.options.list),void Object.assign(this.store,{from:e.start});var i=t.node,n=t.target,o=t.relative,r=t.backToOrigin,l=this.getIndex(this.list,i.dataset.key),a=this.list[l],c=this.getIndex(this.list,n.dataset.key);r&&(1===o&&e.from.index<c&&(c-=1),-1===o&&e.from.index>c&&(c+=1)),this.list.splice(l,1),this.list.splice(c,0,a),Object.assign(this.store,{from:{index:c,list:this.list},to:{index:c,list:this.list}})},onDrop:function(t){var e,i,n=h.get(t.from).option("store"),o=n.start,r=n.item,s=n.key,l=h.get(t.to).option("store").to,a=t.from!==t.to||o.index!==l.index;(this.dispatchEvent("onDrop",{changed:a,list:this.list,item:r,key:s,from:o,to:l}),t.from===this.el&&this.reRendered)&&(null===(e=h.dragged)||void 0===e||e.remove());t.from!==t.to&&"clone"===t.pullMode&&(null===(i=h.clone)||void 0===i||i.remove());this.reRendered=!1},getIndex:function(t,e){for(var i=0;i<t.length;i++)if(m(t[i],this.options.dataKey)==e)return i;return-1},dispatchEvent:function(t,e){var i=this.options[t];i&&i(e)}};var x=["size","keeps","scroller","direction","debounceTime","throttleTime"],_="INIT",T="FIXED",E="DYNAMIC",O="FRONT",z="BEHIND",D="STATIONARY",I="horizontal",C="vertical",k=(r(g={},C,"top"),r(g,I,"left"),g),A=(r(v={},C,"scrollTop"),r(v,I,"scrollLeft"),v),M=(r(y={},C,"scrollHeight"),r(y,I,"scrollWidth"),y),B=(r(b={},C,"offsetHeight"),r(b,I,"offsetWidth"),b);function R(t){this.options=t;var e={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(var i in e)!(i in this.options)&&(this.options[i]=e[i]);this.sizes=new Map,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.calcType=_,this.calcSize={average:0,total:0,fixed:0},this.scrollEl=this.getScrollElement(t.scroller),this.scrollDir="",this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,t.keeps-1)}R.prototype={constructor:R,isFront:function(){return this.scrollDir===O},isBehind:function(){return this.scrollDir===z},isFixed:function(){return this.calcType===T},getSize:function(t){return this.sizes.get(t)||this.getItemSize()},getOffset:function(){return this.scrollEl[A[this.options.direction]]},getScrollSize:function(){return this.scrollEl[M[this.options.direction]]},getClientSize:function(){return this.scrollEl[B[this.options.direction]]},scrollToOffset:function(t){this.scrollEl[A[this.options.direction]]=t},scrollToIndex:function(t){if(t>=this.options.uniqueKeys.length-1)this.scrollToBottom();else{var e=this.getOffsetByIndex(t),i=this.getScrollStartOffset();this.scrollToOffset(e+i)}},scrollToBottom:function(){var t=this,e=this.getScrollSize();this.scrollToOffset(e),setTimeout((function(){var e=t.getClientSize(),i=t.getScrollSize();t.getOffset()+e+1<i&&t.scrollToBottom()}),5)},option:function(t,e){var i=this,n=this.options[t];this.options[t]=e,"uniqueKeys"===t&&this.sizes.forEach((function(t,n){e.includes(n)||i.sizes.delete(n)})),"scroller"===t&&(n&&h.utils.off(n,"scroll",this.onScroll),this.scrollEl=this.getScrollElement(e),this.addScrollEventListener())},updateRange:function(t){if(t)this.handleUpdate(t.start,t.end);else{var e=this.range.start;e=Math.max(e,0),this.handleUpdate(e,this.getEndByStart(e))}},onItemResized:function(t,e){this.sizes.set(t,e),this.calcType===_?(this.calcType=T,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=E,this.calcSize.fixed=void 0),this.calcType!==T&&(this.calcSize.total=s(this.sizes.values()).reduce((function(t,e){return t+e}),0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},addScrollEventListener:function(){this.options.scroller&&h.utils.on(this.options.scroller,"scroll",this.onScroll)},removeScrollEventListener:function(){this.options.scroller&&h.utils.off(this.options.scroller,"scroll",this.onScroll)},updateOnScrollFunction:function(){var t=this,e=this.options,i=e.debounceTime,n=e.throttleTime;this.onScroll=i?p((function(){return t.handleScroll()}),i):n?f((function(){return t.handleScroll()}),n):function(){return t.handleScroll()}},handleScroll:function(){var t=this.getOffset(),e=this.getClientSize(),i=this.getScrollSize();t===this.offset?this.scrollDir=D:this.scrollDir=t<this.offset?O:z,this.offset=t;var n=this.isFront()&&t<=0,o=this.isBehind()&&e+t>=i;this.options.onScroll({top:n,bottom:o,offset:t,direction:this.scrollDir}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()},handleScrollFront:function(){var t=this.getScrollItems();if(!(t>this.range.start)){var e=Math.max(t-this.options.buffer,0);this.checkIfUpdate(e,this.getEndByStart(e))}},handleScrollBehind:function(){var t=this.getScrollItems();t<this.range.start+this.options.buffer||this.checkIfUpdate(t,this.getEndByStart(t))},getScrollItems:function(){var t=this.offset-this.getScrollStartOffset();if(t<=0)return 0;if(this.isFixed())return Math.floor(t/this.calcSize.fixed);for(var e=0,i=this.options.uniqueKeys.length,n=0,o=0;e<=i;){if(n=e+Math.floor((i-e)/2),(o=this.getOffsetByIndex(n))===t)return n;o<t?e=n+1:o>t&&(i=n-1)}return e>0?--e:0},checkIfUpdate:function(t,e){var i=this.options.keeps;this.options.uniqueKeys.length<=i?(t=0,e=this.getLastIndex()):e-t<i-1&&(t=e-i+1),this.range.start!==t&&this.handleUpdate(t,e)},handleUpdate:function(t,e){this.range.start=t,this.range.end=e,this.range.front=this.getFrontOffset(),this.range.behind=this.getBehindOffset(),this.options.onUpdate(o({},this.range))},getFrontOffset:function(){return this.isFixed()?this.calcSize.fixed*this.range.start:this.getOffsetByIndex(this.range.start)},getBehindOffset:function(){var t=this.range.end,e=this.getLastIndex();return this.isFixed()?(e-t)*this.calcSize.fixed:(e-t)*this.getItemSize()},getOffsetByIndex:function(t){if(!t)return 0;for(var e=0,i=0;i<t;i++){var n=this.sizes.get(this.options.uniqueKeys[i]);e+="number"==typeof n?n:this.getItemSize()}return e},getEndByStart:function(t){return Math.min(t+this.options.keeps-1,this.getLastIndex())},getLastIndex:function(){var t=this.options,e=t.uniqueKeys,i=t.keeps;return e.length>0?e.length-1:i-1},getItemSize:function(){return this.isFixed()?this.calcSize.fixed:this.calcSize.average||this.options.size},getScrollElement:function(t){return t instanceof Document&&9===t.nodeType||t instanceof Window?document.scrollingElement||document.documentElement||document.body:t},getScrollStartOffset:function(){var t=0,e=this.options,i=e.wrapper,n=e.scroller;if(i&&i){var o=h.utils.getRect(i,!0,n);t=this.offset+o[k[this.options.direction]]}return t}};var N={data:function(){return{observer:null}},mounted:function(){var t=this;"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((function(){t.onSizeChange()})),this.$el&&this.observer.observe(this.$el))},updated:function(){this.onSizeChange()},beforeDestroy:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},methods:{onSizeChange:function(){this.$emit("resized",this.dataKey,this.getCurrentSize())},getCurrentSize:function(){return this.$el?this.$el[this.sizeKey]:0}}},P=i.default.component("virtual-draglist-items",{mixins:[N],props:d,render:function(t){var e=this.tag,i=this.dataKey;return t(e,{key:i,attrs:{"data-key":i}},this.$slots.default)}});return i.default.component("virtual-drag-list",{model:{prop:"dataSource",event:"updateDataSource"},props:u,data:function(){return{list:[],range:{start:0,end:0,front:0,behind:0},virtual:null,sortable:null,lastLength:null,uniqueKeys:[]}},computed:{isHorizontal:function(){return"vertical"!==this.direction},itemSizeKey:function(){return this.isHorizontal?"offsetWidth":"offsetHeight"},virtualAttributes:function(){var t=this;return x.reduce((function(e,i){return e[i]=t[i],e}),{})},sortableAttributes:function(){var t=this;return S.reduce((function(e,i){return e[i]=t[i],e}),{})}},watch:{dataSource:{handler:function(){this._onUpdate()},deep:!0},virtualAttributes:{handler:function(t,e){if(this.virtual)for(var i in t)t[i]!=e[i]&&this.virtual.option(i,t[i])},deep:!0},sortableAttributes:{handler:function(t,e){if(this.sortable)for(var i in t)t[i]!=e[i]&&this.sortable.option(i,t[i])},deep:!0}},activated:function(){this.scrollToOffset(this.virtual.offset),this.virtual.addScrollEventListener()},deactivated:function(){this.virtual.removeScrollEventListener()},created:function(){this.range.end=this.keeps-1,this._initVirtual(),this._onUpdate()},mounted:function(){this.virtual.option("wrapper",this.$refs.groupRef),this.scroller||this.virtual.option("scroller",this.$refs.rootRef)},beforeDestroy:function(){this.sortable&&this.sortable.destroy(),this.virtual.removeScrollEventListener(),this.sortable=this.virtual=null},methods:{getSize:function(t){return this.virtual.getSize(t)},getOffset:function(){return this.virtual.getOffset()},getClientSize:function(){return this.virtual.getClientSize()},getScrollSize:function(){return this.virtual.getScrollSize()},scrollToKey:function(t){var e=this.uniqueKeys.indexOf(t);e>-1&&this.virtual.scrollToIndex(e)},scrollToIndex:function(t){this.virtual.scrollToIndex(t)},scrollToOffset:function(t){this.virtual.scrollToOffset(t)},scrollToTop:function(){this.virtual.scrollToOffset(0)},scrollToBottom:function(){this.virtual.scrollToBottom()},_onUpdate:function(){var t=this,e=s(this.list);if(this.list=this.dataSource,this._updateUniqueKeys(),this._updateRange(e,this.list),this.sortable?this.sortable.option("list",this.list):this.$nextTick((function(){return t._initSortable()})),this.lastLength&&this.keepOffset){var i=this.list.length-this.lastLength;i>0&&this.scrollToIndex(i),this.lastLength=null}},_initVirtual:function(){var t=this;this.virtual=new R({size:this.size,keeps:this.keeps,buffer:Math.round(this.keeps/3),scroller:this.scroller,direction:this.direction,uniqueKeys:this.uniqueKeys,debounceTime:this.debounceTime,throttleTime:this.throttleTime,onScroll:function(e){t.lastLength=null,t.list.length&&e.top?t._handleToTop():e.bottom&&t._handleToBottom()},onUpdate:function(e){h.dragged&&e.start!==t.range.start&&(t.sortable.reRendered=!0),t.range=e}})},_initSortable:function(){var t=this;this.sortable=new w(this.$refs.groupRef,o(o({list:this.list,dataKey:this.dataKey},this.sortableAttributes),{},{onDrag:function(e){t.$emit("drag",e)},onAdd:function(e){t.$emit("add",e)},onRemove:function(e){t.$emit("remove",e)},onDrop:function(e){e.changed&&t.$emit("updateDataSource",e.list),t.$emit("drop",e)}}))},_updateRange:function(t,e){var i=o({},this.range);e.length>t.length&&this.range.end===t.length-1&&this._scrolledToBottom()&&(i.end++,i.start=Math.max(0,i.end-this.keeps+1)),this.virtual.updateRange(i)},_scrolledToBottom:function(){return this.getOffset()+this.getClientSize()+1>=this.getScrollSize()},_handleToTop:p((function(){this.$emit("top"),this.lastLength=this.list.length})),_handleToBottom:p((function(){this.$emit("bottom")})),_onItemResized:function(t,e){var i=this.virtual.sizes.size;this.virtual.onItemResized(t,e),0===i&&this._updateRange(this.list,this.list)},_updateUniqueKeys:function(){var t=this;this.uniqueKeys=this.list.map((function(e){return m(e,t.dataKey)})),this.virtual.option("uniqueKeys",this.uniqueKeys)},_getItemStyle:function(t){var e;return t==(null===(e=h.dragged)||void 0===e?void 0:e.dataset.key)?{display:"none"}:{}},_renderItems:function(t){for(var e=[],i=this.range,n=i.start,r=i.end,s=n;s<=r;s++){var l=this.list[s];if(l){var a=m(l,this.dataKey),c=o(o({},this.itemStyle),this._getItemStyle(a));e.push(this.$scopedSlots.item?t(P,{key:a,props:{dataKey:a,tag:this.itemTag,sizeKey:this.itemSizeKey},on:{resized:this._onItemResized},style:c,class:this.itemClass},this.$scopedSlots.item({record:l,index:s,dataKey:a})):null)}}return e}},render:function(t){var e=this.range,i=e.front,n=e.behind,r=this.isHorizontal,s=this.rootTag,l=this.wrapTag,a=r?"0px ".concat(n,"px 0px ").concat(i,"px"):"".concat(i,"px 0px ").concat(n,"px");return t(s,{ref:"rootRef",style:!this.scroller&&{overflow:r?"auto hidden":"hidden auto"}},[this.$slots.header,t(l,{ref:"groupRef",class:this.wrapClass,style:o(o({},this.wrapStyle),{},{padding:a})},this._renderItems(t)),this.$slots.footer])}})})); | ||
*/!function(t,e){t.exports=function(){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(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},e.apply(this,arguments)}var n={capture:!1,passive:!1},i=/\s+/g;function o(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r=o(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),s=o(/Edge/i),l=o(/safari/i)&&!o(/chrome/i)&&!o(/android/i),a=function(){var t=!1;return document.addEventListener("checkIfSupportPassive",null,{get passive(){return t=!0,!0}}),t}();function c(t,e,i){window.addEventListener?t.addEventListener(e,i,!(!a&&r)&&n):window.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i}function h(t,e,i){window.removeEventListener?t.removeEventListener(e,i,!(!a&&r)&&n):window.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null}function u(){return document.scrollingElement||document.documentElement}function d(t,e,n){if(t.getBoundingClientRect||t===window){var i,o,r,s,l,a,c;if(t!==window&&t.parentNode&&t!==u()?(o=(i=t.getBoundingClientRect()).top,r=i.left,s=i.bottom,l=i.right,a=i.height,c=i.width):(o=0,r=0,s=window.innerHeight,l=window.innerWidth,a=window.innerHeight,c=window.innerWidth),e&&t!==window){n=n||t.parentNode;do{if(n&&n.getBoundingClientRect){var h=n.getBoundingClientRect();o-=h.top+parseInt(w(n,"border-top-width")),r-=h.left+parseInt(w(n,"border-left-width")),s=o+i.height,l=r+i.width;break}}while(n=n.parentNode)}return{top:o,left:r,bottom:s,right:l,width:c,height:a}}}function f(t,e,n,i){if(!t)return null;if(n&&!e){var o=Array.prototype.slice.call(n.children),r=o.indexOf(t);if(r>-1)return o[r];for(var s=0,l=o.length;s<l;s++)if(p(t,o[s]))return o[s]}n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&S(t,e):S(t,e))||i&&t===n)return t;if(t===n)break}while(t=t.parentNode);return null}function p(t,e){if(!t||!e)return!1;if(e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return!0;return!1}function m(t,e){for(var n=t.lastElementChild;n&&(n===it.ghost||"none"===w(n,"display")||e&&!S(n,e));)n=n.previousElementSibling;return n||null}function g(t,e){if(!t||!t.parentNode)return-1;for(var n=0;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!S(t,e)||"none"===w(t,"display")||n++;return n}function v(t,e,n,i){for(var o=0,r=0,s=t.children;o<s.length;){if(s[o]!==it.ghost&&"none"!==w(s[o],"display")&&f(s[o],n,t,!1)&&(i||s[o]!==it.dragged)){if(r===e)return s[o];r++}o++}return null}function y(t,e){var n=w(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=v(t,0,e),l=v(t,1,e),a=o&&w(o),c=l&&w(l),h=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+d(o).width,u=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+d(l).width,f=s||r?"cssFloat":"float";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(o&&a.float&&"none"!==a.float){var p="left"===a.float?"left":"right";return!l||"both"!==c.clear&&c.clear!==p?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||h>=i&&"none"===n[f]||l&&"none"===n[f]&&h+u>i)?"vertical":"horizontal"}function b(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(i," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(i," ")}}function S(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(t){return!1}return!1}}function w(t,e,n){var i=t&&t.style;if(i){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 i||-1!==e.indexOf("webkit")||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function x(t,e){var n,i,o=(i=e,(n=t).compareDocumentPosition?n.compareDocumentPosition(i):n.contains?(n!=i&&n.contains(i)&&16)+(n!=i&&i.contains(n)&&8)+(n.sourceIndex>=0&&i.sourceIndex>=0?(n.sourceIndex<i.sourceIndex&&4)+(n.sourceIndex>i.sourceIndex&&2):1):0);return 2===o?1:4===o?-1:0}function _(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function T(t){var n=t.sortable,i=t.name,o=t.params,r=n.options[i];"function"==typeof r&&r(e({},o))}!function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1]}();var E,D,I="Sortable"+Date.now();function O(t){this.options=t,this.autoScrollAnimationFrame=null}function z(t){this.options=t,this.stack=[]}function R(t){this.options=t||{},this.selectedElements=[]}window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),O.prototype={destroy:function(){this.autoScrollAnimationFrame&&(cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=null)},update:function(t,e,n){var i=this;cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=requestAnimationFrame((function(){e&&n&&i.autoScroll(t,n),i.update(t,e,n)}))},autoScroll:function(t,e){if(t&&void 0!==e.clientX&&void 0!==e.clientY){var n=d(t);if(n){var i=e.clientX,o=e.clientY,r=n.top,s=n.right,l=n.bottom,a=n.left,c=n.height,h=n.width;if(!(o<r||i>s||o>l||i<a)){var u=this.options,f=u.scrollThreshold,p=u.scrollSpeed,m=t.scrollTop,g=t.scrollLeft,v=t.scrollHeight,y=m>0&&o>=r&&o<=r+f,b=g+h<t.scrollWidth&&i<=s&&i>=s-f,S=m+c<v&&o<=l&&o>=l-f;g>0&&i>=a&&i<=a+f&&(t.scrollLeft+=Math.floor(Math.max(-1,(i-a)/f-1)*p.x)),b&&(t.scrollLeft+=Math.ceil(Math.min(1,(i-s)/f+1)*p.x)),y&&(t.scrollTop+=Math.floor(Math.max(-1,(o-r)/f-1)*p.y)),S&&(t.scrollTop+=Math.ceil(Math.min(1,(o-l)/f+1)*p.y))}}}}},z.prototype={collect:function(t){if(t){for(var e=d(t),n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,o=Math.min(e.right,n),r=Math.min(e.bottom,i),s=Array.prototype.slice.call(t.children),l=[],a=0,c=s.length;a<=c;a++){var h=s[a];if(h&&h!==it.ghost&&"none"!==w(h,"display")){var u=d(h);if(!(u.bottom<0||u.right<0)){if(u.top-u.height>r||u.left-u.width>o)break;l.push({el:h,rect:u})}}}this.stack.push(l)}},animate:function(){for(var t=this.stack.pop(),e=0,n=t.length;e<n;e++){var i=t[e],o=i.el,r=i.rect;this.options.animation&&this._excute(o,r)}},_excute:function(t,e){var n=d(t);if(n.top!==e.top||n.left!==e.left){var i=e.left-n.left,o=e.top-n.top;w(t,"transition",""),w(t,"transform","translate3d("+i+"px, "+o+"px, 0)"),t.offsetWidth;var r=this.options,s=r.animation,l=r.easing;w(t,"transition","transform "+s+"ms"+(l?" "+l:"")),w(t,"transform","translate3d(0px, 0px, 0px)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){w(t,"transition",""),w(t,"transform",""),t.animated=null}),s)}}},R.prototype={destroy:function(){E=D=null},active:function(){return!!E},setParams:function(t){t.nodes=E||[],t.clones=D||[]},select:function(t){b(t,this.options.selectedClass,!0),this.selectedElements.push(t),this.selectedElements.sort((function(t,e){return x(t,e)}))},deselect:function(t){var e=this.selectedElements.indexOf(t);e>-1&&(b(t,this.options.selectedClass,!1),this.selectedElements.splice(e,1))},getGhostElement:function(){if(!E)return null;var t=document.createElement("div");return this.selectedElements.forEach((function(e,n){var i=e.cloneNode(!0),o=0===n?1:.5;i.style="position: absolute;left: 0;top: 0;bottom: 0;right: 0;opacity: ".concat(o,";z-index: ").concat(n,";"),t.appendChild(i)})),t},toggleSelected:function(t,e){var n=this;e?t.forEach((function(t){return n.selectedElements.push(t)})):this.selectedElements=this.selectedElements.filter((function(e){return t.indexOf(e)<0}))},toggleClass:function(t){if(E)for(var e=0;e<E.length;e++)b(E[e],this.options.chosenClass,t)},toggleVisible:function(t){if(E)if(t){var e=E.indexOf(it.dragged);this._viewElements(E,e,it.dragged)}else this._hideElements(E)},onChoose:function(){!this.options.multiple||!this.selectedElements.length||this.selectedElements.indexOf(it.dragged)<0||(this.selectedElements.sort((function(t,e){return x(t,e)})),E=this.selectedElements,this.toggleClass(!0))},onDrag:function(t){E&&(t.animator.collect(it.dragged.parentNode),this._hideElements(E),t.animator.animate(),this.toggleClass(!1))},onDrop:function(t,e,n){if(E){var i=it.dragged,o=it.clone,r=E.indexOf(i);e[I].animator.collect(o.parentNode),t!==e&&"clone"===n?(w(o,"display","none"),D=E.map((function(t){return t.cloneNode(!0)})),this._viewElements(D,r,o),this._viewElements(E,r,i)):this._viewElements(E,r,o),e[I].animator.animate(),t!==e&&(e[I].multiplayer.toggleSelected(D||E,!0),"clone"!==n&&t[I].multiplayer.toggleSelected(E,!1))}},onSelect:function(t,e,n){var i=this.selectedElements.indexOf(e);b(e,this.options.selectedClass,i<0);var o={from:n.el,event:t,node:e,index:g(e)};i<0?(this.selectedElements.push(e),T({sortable:n,name:"onSelect",params:o})):(this.selectedElements.splice(i,1),T({sortable:n,name:"onDeselect",params:o})),this.selectedElements.sort((function(t,e){return x(t,e)}))},_viewElements:function(t,e,n){for(var i=0;i<t.length;i++)if(w(t[i],"display",""),i<e)n.parentNode.insertBefore(t[i],n);else{var o=i>0?t[i-1]:n;n.parentNode.insertBefore(t[i],o.nextSibling)}},_hideElements:function(t){for(var e=0;e<t.length;e++)t[e]!=it.dragged&&w(t[e],"display","none")}};var C,k,A,B,M,N,P,L,F,K,j,H,q,$,W,U,Y,X,V,G,J,Q,Z,tt=[];function et(e){var n={},i=e.group;i&&"object"==t(i)||(i={name:i,pull:!0,put:!0,revertDrag:!0}),n.name=i.name,n.pull=i.pull,n.put=i.put,n.revertDrag=i.revertDrag,e.group=n}function nt(t){var e=U||W;return!(void 0!==t.clientX&&void 0!==t.clientY&&Math.abs(t.clientX-e.clientX)<=0&&Math.abs(t.clientY-e.clientY)<=0)}function it(t,n){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(t));t[I]=this,this.el=t,this.options=n=e({},n);var i={store:null,group:"",handle:null,sortable:!0,disabled:!1,multiple:!1,lockAxis:"",direction:"",animation:150,easing:"",draggable:null,selectHandle:null,customGhost:null,autoScroll:!0,scrollThreshold:55,scrollSpeed:{x:10,y:10},delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",swapOnDrop:!0,fallbackOnBody:!1,supportTouch:"ontouchstart"in window,emptyInsertThreshold:-1};for(var o in i)!(o in this.options)&&(this.options[o]=i[o]);for(var r in et(n),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));c(t,this.options.supportTouch?"touchstart":"mousedown",this._onDrag),tt.push(t),this.autoScroller=new O(this.options),this.multiplayer=new R(this.options),this.animator=new z(this.options)}return it.prototype={constructor:it,_onDrag:function(t){var e=this;if(!B&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var n=t.touches&&t.touches[0],i=(n||t).target;if(!l||!i||"SELECT"!==i.tagName.toUpperCase()){var o=f(i,this.options.draggable,this.el);if(o&&!o.animated){W={origin:t,clientX:(n||t).clientX,clientY:(n||t).clientY},B=o,c(G=n?B:document,"mouseup",this._onDrop),c(G,"touchend",this._onDrop),c(G,"touchcancel",this._onDrop);var a=this.options,h=a.handle,u=a.selectHandle;if("function"==typeof u&&u(t)||"string"==typeof u&&S(i,u))Z=!0;else if(("function"!=typeof h||h(t))&&("string"!=typeof h||S(i,h))){var d=this.options,p=d.delay,m=d.delayOnTouchOnly;!p||m&&!n||s||r?this._onStart(n,t):(c(this.el.ownerDocument,"touchmove",this._delayMoveHandler),c(this.el.ownerDocument,"mousemove",this._delayMoveHandler),c(this.el.ownerDocument,"mouseup",this._cancelStart),c(this.el.ownerDocument,"touchend",this._cancelStart),c(this.el.ownerDocument,"touchcancel",this._cancelStart),Q=setTimeout((function(){return e._onStart(n,t)}),p)),c(document,"selectstart",_),l&&w(document.body,"user-select","none")}}}}},_delayMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-W.clientX),Math.abs(e.clientY-W.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(Q),h(this.el.ownerDocument,"touchmove",this._delayMoveHandler),h(this.el.ownerDocument,"mousemove",this._delayMoveHandler),h(this.el.ownerDocument,"mouseup",this._cancelStart),h(this.el.ownerDocument,"touchend",this._cancelStart),h(this.el.ownerDocument,"touchcancel",this._cancelStart),h(document,"selectstart",_),l&&w(document.body,"user-select","")},_onStart:function(t,e){var n=g(B);C=this.el,k=this.el,F=B,H=n,q=n,$=n,X={to:this.el,target:B,newIndex:n,relative:0},V=B,A=this.el,P=B.cloneNode(!0),K=B.parentNode,j=this.options.group.pull,it.clone=P,it.active=this,it.dragged=B,b(B,this.options.chosenClass,!0),this.multiplayer.onChoose(),T({sortable:this,name:"onChoose",params:this._getParams(e)}),c(G,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout((function(){return document.selection.empty()}),0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){b(P,this.options.chosenClass,!0),this._appendGhost(),this.multiplayer.onDrag(this),T({sortable:this,name:"onDrag",params:this._getParams(W.origin)}),w(B,"display","none"),b(B,this.options.chosenClass,!1),B.parentNode.insertBefore(P,B)},_getGhostElement:function(){var t=this.options.customGhost;if("function"==typeof t){var e=this.multiplayer.selectedElements;return t(e.length?e:[B])}return this.multiplayer.getGhostElement()||B},_appendGhost:function(){if(!L){var t=this.options.fallbackOnBody?document.body:this.el,n=this._getGhostElement();b(L=n.cloneNode(!0),this.options.ghostClass,!0);var i=d(B),o=e({position:"fixed",top:i.top,left:i.left,width:i.width,height:i.height,zIndex:"100000",opacity:"0.8",overflow:"hidden",boxSizing:"border-box",transform:"translate3d(0px, 0px, 0px)",transition:"none",pointerEvents:"none"},this.options.ghostStyle);for(var r in o)w(L,r,o[r]);it.ghost=L,t.appendChild(L);var s=(W.clientX-i.left)/parseInt(L.style.width)*100,l=(W.clientY-i.top)/parseInt(L.style.height)*100;w(L,"transform-origin",s+"% "+l+"%"),w(L,"will-change","transform")}},_nearestSortable:function(t){_(t);var e=t.touches&&t.touches[0]||t;if(B&&nt(e)){!U&&this._onStarted();var n=this.options.lockAxis,i="x"===n?W.clientX:e.clientX,o="y"===n?W.clientY:e.clientY,r=document.elementFromPoint(i,o),s=i-W.clientX,l=o-W.clientY;U={origin:t,clientX:i,clientY:o},w(L,"transform","translate3d("+s+"px, "+l+"px, 0)");var a,c,h,f=(a=i,c=o,tt.reduce((function(t,e){var n=e[I].options.emptyInsertThreshold;if(null!=n){var i=d(e),o=a>=i.left-n&&a<=i.right+n,r=c>=i.top-n&&c<=i.bottom+n;return o&&r&&(!h||h&&i.left>=h.left&&i.right<=h.right&&i.top>=h.top&&i.bottom<=h.bottom)&&(t=e,h=i),t}}),null));if(f&&f[I]._onMove(t,r),!f||f[I].options.autoScroll){var p=function(t,e){if(!t||!t.getBoundingClientRect)return u();var n=t,i=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return u();if(i||e)return n;i=!0}}}while(n=n.parentNode);return u()}(r,!0);this.autoScroller.update(p,W,U)}else this.autoScroller.destroy()}},_allowPut:function(){if(A===this.el)return!0;if(this.options.group.put){var t=this.options.group,e=t.name,n=t.put,i=A[I].options.group;return n.join&&n.indexOf(i.name)>-1||i.name&&e&&i.name===e}return!1},_getDirection:function(){var t=this.options,e=t.draggable,n=t.direction;return n?"function"==typeof n?n.call(U.origin,B,this):n:y(K,e)},_allowSwap:function(){var t=d(M),e="vertical"===this._getDirection(),n=e?"top":"left",i=e?"bottom":"right",o=M[e?"offsetHeight":"offsetWidth"],r=e?U.clientY:U.clientX,s=r>=t[n]&&r<t[i]-o/2?-1:1,l=v(K,0,this.options.draggable),a=m(K),c=d(l),h=d(a);if(M===K||p(K,M))return P===l&&r<c[n]?(N=M,!0):P===a&&r>h[i]&&(N=M.nextSibling,!0);var u=x(P,M);return N=u<0?M.nextSibling:M,Y!==M?(J=s,!0):J!==s&&(J=s,s<0?u>0:u<0)},_onMove:function(t,e){if(!this.options.disabled&&this._allowPut()){if(M=f(e,this.options.draggable,this.el),T({sortable:this,name:"onMove",params:this._getParams(t,{target:M})}),this.options.sortable||this.el!==A)return this.el===k||e!==this.el&&m(this.el)?void(M&&!M.animated&&!p(M,P)&&this._allowSwap()&&(M!==P&&N!==P?(this.el!==k?this._onInsert(t):M!==B&&this._onChange(t),Y=M):Y=M)):(M=Y=null,void this._onInsert(t));k!==A&&(M=Y=B,J=0,this._onInsert(t))}},_onInsert:function(t){var e=M||P,n="clone"===j&&this.el!==A&&k===A,i="clone"===j&&this.el===A&&k!==A;C=this.el,H=g(P),F=e,K=M?M.parentNode:this.el,k[I].animator.collect(P.parentNode),this.animator.collect(K),n&&(X.target=V,X.newIndex=H,X.relative=V===B?0:x(P,V),w(B,"display",""),A[I].multiplayer.toggleVisible(!0),A[I].options.group.revertDrag||P.parentNode.insertBefore(B,P)),i&&(H=g(B),w(B,"display","none"),this.multiplayer.toggleVisible(!1)),M?K.insertBefore(P,J<0?M:M.nextSibling):K.appendChild(P),q=g(P),n&&A[I].options.group.revertDrag&&(X.target=B,X.newIndex=$,X.relative=0,T({sortable:A[I],name:"onChange",params:this._getParams(t,{to:A,target:B,newIndex:$,revertDrag:!0})})),n||T({sortable:k[I],name:"onRemove",params:this._getParams(t,{newIndex:-1})}),i&&e!==B&&(V=e,T({sortable:this,name:"onChange",params:this._getParams(t,{from:A,backToOrigin:!0})})),i||T({sortable:this,name:"onAdd",params:this._getParams(t,{oldIndex:-1})}),k[I].animator.animate(),this.animator.animate(),k=this.el},_onChange:function(t){H=g(P),K=M.parentNode,F=M,this.el===A&&(V=M),this.animator.collect(K),K.insertBefore(P,N),q=g(P),T({sortable:this,name:"onChange",params:this._getParams(t)}),this.animator.animate(),k=this.el},_onDrop:function(t){_(t),this._cancelStart(),h(G,"touchmove",this._nearestSortable),h(G,"mousemove",this._nearestSortable),h(G,"mouseup",this._onDrop),h(G,"touchend",this._onDrop),h(G,"touchcancel",this._onDrop),b(B,this.options.chosenClass,!1),A&&(k=A,H=$,F===P&&(F=B),this.multiplayer.toggleClass(!1),T({sortable:this,name:"onUnchoose",params:this._getParams(t)}),U&&this._onEnd(t));var e=this.options,n=e.multiple,i=e.selectHandle;n&&(i&&Z||!i&&!A)&&!nt(t.changedTouches?t.changedTouches[0]:t)&&this.multiplayer.onSelect(t,B,this),L&&L.parentNode&&L.parentNode.removeChild(L),this.autoScroller.destroy(),this.multiplayer.destroy(),this._nulling()},_onEnd:function(t){var n=this._getParams(t);this.multiplayer.onDrop(k,C,j);var i=this.options.swapOnDrop;"clone"===j&&k!==C||!("function"==typeof i?i(n):i)||K.insertBefore(B,P),"clone"!==j||k===C||this.multiplayer.active()?P&&P.parentNode&&P.parentNode.removeChild(P):b(P,this.options.chosenClass,!1),w(B,"display",""),k!==C&&T({sortable:k[I],name:"onDrop",params:e({},n,"clone"===j?X:{newIndex:-1})}),T({sortable:C[I],name:"onDrop",params:e({},n,k===C?{}:{oldIndex:-1})})},_getParams:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={};return i.event=t,i.to=C,i.from=k,i.node=B,i.clone=P,i.target=F,i.oldIndex=H,i.newIndex=q,i.pullMode=j,this.multiplayer.setParams(i),e(i,n),i.relative=F===B?0:x(P,F),i},_nulling:function(){C=k=A=B=M=N=P=L=F=K=j=H=q=$=W=U=Y=X=V=G=J=Q=Z=it.clone=it.ghost=it.active=it.dragged=null},destroy:function(){this._cancelStart(),this._nulling(),h(this.el,"touchstart",this._onDrag),h(this.el,"mousedown",this._onDrag),tt.splice(tt.indexOf(this.el),1),this.el[I]=this.animator=this.multiplayer=this.autoScroller=null},option:function(t,e){if(void 0===e)return this.options[t];this.options[t]=e,this.animator.options[t]=e,this.multiplayer.options[t]=e,this.autoScroller.options[t]=e,"group"===t&&et(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selectedElements}},it.utils={on:c,off:h,css:w,index:g,closest:f,getRect:d,toggleClass:b,detectDirection:y},it.get=function(t){return t[I]},it.create=function(t,e){return new it(t,e)},it}()}(c);var h=a(c.exports),u={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},scroller:{type:[Document,HTMLElement]},direction:{type:String,default:"vertical"},keeps:{type:Number,default:30},size:{type:Number},draggable:{type:String,default:".virtual-dnd-list-item"},sortable:{type:Boolean,default:!0},handle:{type:[Function,String]},group:{type:[String,Object]},lockAxis:{type:String,default:""},debounceTime:{type:Number,default:0},animation:{type:Number,default:150},autoScroll:{type:Boolean,default:!0},scrollThreshold:{type:Number,default:55},keepOffset:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},fallbackOnBody:{type:Boolean,default:!1},delay:{type:Number,default:0},delayOnTouchOnly:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemStyle:{type:Object},itemClass:{type:String,default:""},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},d={tag:{type:String,default:"div"},dataKey:{type:[String,Number]},sizeKey:{type:String}};function f(t,e){var n=null,i=function(){for(var i=this,o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];n||(e<=0?t.apply(this,r):n=setTimeout((function(){n=void 0,t.apply(i,r)}),e))};return i.cancel=function(){n&&(clearTimeout(n),n=null)},i}function p(t,e){var n=f(t,e),i=function(){n.cancel(),n.apply(this,arguments)};return i.cancel=function(){n.cancel()},i}function m(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce((function(t,e){return(t||{})[e]}),t)}var g,v,y,b,S=["delay","group","handle","lockAxis","disabled","sortable","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","fallbackOnBody","scrollThreshold","delayOnTouchOnly"];function w(t,e){this.el=t,this.list=e.list,this.options=e,this.reRendered=!1,this.init()}w.prototype={constructor:w,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=this.reRendered=null},option:function(t,e){"list"===t?this.list=e:this.sortable.option(t,e)},init:function(){var t=this,e=S.reduce((function(e,n){return e[n]=t.options[n],e}),{});this.sortable=new h(this.el,o(o({},e),{},{emptyInsertThreshold:0,swapOnDrop:function(t){return t.from===t.to},onDrag:function(e){return t.onDrag(e)},onDrop:function(e){return t.onDrop(e)},onAdd:function(e){return t.onAdd(e)},onRemove:function(e){return t.onRemove(e)}}))},onAdd:function(t){var e=h.get(t.from).option("store"),n=e.item,i=e.key;this.sortable.option("store",{item:n,key:i}),this.dispatchEvent("onAdd",{item:n,key:i,event:t})},onRemove:function(t){var e=h.get(t.from).option("store"),n=e.item,i=e.key;this.dispatchEvent("onRemove",{item:n,key:i,event:t})},onDrag:function(t){var e=t.node.getAttribute("data-key"),n=this.getIndex(this.list,e),i=this.list[n];this.sortable.option("store",{item:i,key:e,index:n,list:this.list}),this.dispatchEvent("onDrag",{item:i,key:e,index:n,event:t}),this.options.sortable||this.sortable.option("autoScroll",!1)},onDrop:function(t){var e=h.get(t.from).option("store");e.list;var n,i,o=e.item,r=e.key,l=e.index,a=s(this.list),c={key:r,item:o,event:t,changed:!1,list:a,oldList:this.list,oldIndex:l,newIndex:l};(t.from===t.to&&t.node===t.target||this.getDropParams(c,t,o,r,l,a),this.dispatchEvent("onDrop",c),t.from===this.el&&this.reRendered)&&(null===(n=h.dragged)||void 0===n||n.remove());t.from!==t.to&&"clone"===t.pullMode&&(null===(i=h.clone)||void 0===i||i.remove());this.reRendered=!1,this.sortable.option("autoScroll",this.options.autoScroll)},getDropParams:function(t,e,n,i,o,r){var s=e.target.getAttribute("data-key"),l=-1,a=o;e.from===e.to?(((a=this.getIndex(r,i))<(l=this.getIndex(r,s))&&-1===e.relative||a>l&&1===e.relative)&&(l+=e.relative),l!==a&&(r.splice(a,1),r.splice(l,0,n))):(e.from===this.el&&(a=this.getIndex(r,i),r.splice(a,1)),e.to===this.el&&(a=-1,l=this.getIndex(r,s),0===e.relative?l=r.length:1===e.relative&&(l+=e.relative),r.splice(l,0,n))),t.changed=e.from!==e.to||l!==a,t.list=r,t.oldIndex=a,t.newIndex=l},getIndex:function(t,e){for(var n=0;n<t.length;n++)if(m(t[n],this.options.dataKey)==e)return n;return-1},dispatchEvent:function(t,e){var n=this.options[t];n&&n(e)}};var x=["size","keeps","scroller","direction","debounceTime","throttleTime"],_="INIT",T="FIXED",E="DYNAMIC",D="FRONT",I="BEHIND",O="STATIONARY",z="horizontal",R="vertical",C=(r(g={},R,"top"),r(g,z,"left"),g),k=(r(v={},R,"scrollTop"),r(v,z,"scrollLeft"),v),A=(r(y={},R,"scrollHeight"),r(y,z,"scrollWidth"),y),B=(r(b={},R,"offsetHeight"),r(b,z,"offsetWidth"),b);function M(t){this.options=t;var e={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(var n in e)!(n in this.options)&&(this.options[n]=e[n]);this.sizes=new Map,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.calcType=_,this.calcSize={average:0,total:0,fixed:0},this.scrollEl=this.getScrollElement(t.scroller),this.scrollDir="",this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,t.keeps-1)}M.prototype={constructor:M,isFront:function(){return this.scrollDir===D},isBehind:function(){return this.scrollDir===I},isFixed:function(){return this.calcType===T},getSize:function(t){return this.sizes.get(t)||this.getItemSize()},getOffset:function(){return this.scrollEl[k[this.options.direction]]},getScrollSize:function(){return this.scrollEl[A[this.options.direction]]},getClientSize:function(){return this.scrollEl[B[this.options.direction]]},scrollToOffset:function(t){this.scrollEl[k[this.options.direction]]=t},scrollToIndex:function(t){if(t>=this.options.uniqueKeys.length-1)this.scrollToBottom();else{var e=this.getOffsetByIndex(t),n=this.getScrollStartOffset();this.scrollToOffset(e+n)}},scrollToBottom:function(){var t=this,e=this.getScrollSize();this.scrollToOffset(e),setTimeout((function(){var e=t.getClientSize(),n=t.getScrollSize();t.getOffset()+e+1<n&&t.scrollToBottom()}),5)},option:function(t,e){var n=this,i=this.options[t];this.options[t]=e,"uniqueKeys"===t&&this.sizes.forEach((function(t,i){e.includes(i)||n.sizes.delete(i)})),"scroller"===t&&(i&&h.utils.off(i,"scroll",this.onScroll),this.scrollEl=this.getScrollElement(e),this.addScrollEventListener())},updateRange:function(t){if(t)this.handleUpdate(t.start,t.end);else{var e=this.range.start;e=Math.max(e,0),this.handleUpdate(e,this.getEndByStart(e))}},onItemResized:function(t,e){this.sizes.set(t,e),this.calcType===_?(this.calcType=T,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=E,this.calcSize.fixed=void 0),this.calcType!==T&&(this.calcSize.total=s(this.sizes.values()).reduce((function(t,e){return t+e}),0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},addScrollEventListener:function(){this.options.scroller&&h.utils.on(this.options.scroller,"scroll",this.onScroll)},removeScrollEventListener:function(){this.options.scroller&&h.utils.off(this.options.scroller,"scroll",this.onScroll)},enableScroll:function(t){var e=this.options.scroller,n=t?h.utils.off:h.utils.on,i="onwheel"in document.createElement("div")?"wheel":"mousewheel";n(e,"DOMMouseScroll",this.preventDefault),n(e,i,this.preventDefault),n(e,"touchmove",this.preventDefault),n(e,"keydown",this.preventDefaultForKeyDown)},preventDefault:function(t){t.preventDefault()},preventDefaultForKeyDown:function(t){if({37:1,38:1,39:1,40:1}[t.keyCode])return this.preventDefault(t),!1},updateOnScrollFunction:function(){var t=this,e=this.options,n=e.debounceTime,i=e.throttleTime;this.onScroll=n?p((function(){return t.handleScroll()}),n):i?f((function(){return t.handleScroll()}),i):function(){return t.handleScroll()}},handleScroll:function(){var t=this.getOffset(),e=this.getClientSize(),n=this.getScrollSize();t===this.offset?this.scrollDir=O:this.scrollDir=t<this.offset?D:I,this.offset=t;var i=this.isFront()&&t<=0,o=this.isBehind()&&e+t>=n;this.options.onScroll({top:i,bottom:o,offset:t,direction:this.scrollDir}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()},handleScrollFront:function(){var t=this.getScrollItems();if(!(t>this.range.start)){var e=Math.max(t-this.options.buffer,0);this.checkIfUpdate(e,this.getEndByStart(e))}},handleScrollBehind:function(){var t=this.getScrollItems();t<this.range.start+this.options.buffer||this.checkIfUpdate(t,this.getEndByStart(t))},getScrollItems:function(){var t=this.offset-this.getScrollStartOffset();if(t<=0)return 0;if(this.isFixed())return Math.floor(t/this.calcSize.fixed);for(var e=0,n=this.options.uniqueKeys.length,i=0,o=0;e<=n;){if(i=e+Math.floor((n-e)/2),(o=this.getOffsetByIndex(i))===t)return i;o<t?e=i+1:o>t&&(n=i-1)}return e>0?--e:0},checkIfUpdate:function(t,e){var n=this.options.keeps;this.options.uniqueKeys.length<=n?(t=0,e=this.getLastIndex()):e-t<n-1&&(t=e-n+1),this.range.start!==t&&this.handleUpdate(t,e)},handleUpdate:function(t,e){this.range.start=t,this.range.end=e,this.range.front=this.getFrontOffset(),this.range.behind=this.getBehindOffset(),this.options.onUpdate(o({},this.range))},getFrontOffset:function(){return this.isFixed()?this.calcSize.fixed*this.range.start:this.getOffsetByIndex(this.range.start)},getBehindOffset:function(){var t=this.range.end,e=this.getLastIndex();return this.isFixed()?(e-t)*this.calcSize.fixed:(e-t)*this.getItemSize()},getOffsetByIndex:function(t){if(!t)return 0;for(var e=0,n=0;n<t;n++){var i=this.sizes.get(this.options.uniqueKeys[n]);e+="number"==typeof i?i:this.getItemSize()}return e},getEndByStart:function(t){return Math.min(t+this.options.keeps-1,this.getLastIndex())},getLastIndex:function(){var t=this.options,e=t.uniqueKeys,n=t.keeps;return e.length>0?e.length-1:n-1},getItemSize:function(){return this.isFixed()?this.calcSize.fixed:this.options.size||this.calcSize.average},getScrollElement:function(t){return t instanceof Document&&9===t.nodeType||t instanceof Window?document.scrollingElement||document.documentElement||document.body:t},getScrollStartOffset:function(){var t=0,e=this.options,n=e.wrapper,i=e.scroller,o=e.direction;if(n&&n){var r=i instanceof Window?h.utils.getRect(n):h.utils.getRect(n,!0,i);t=this.offset+r[C[o]]}return t}};var N={data:function(){return{observer:null}},mounted:function(){var t=this;"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((function(){t.onSizeChange()})),this.$el&&this.observer.observe(this.$el))},updated:function(){this.onSizeChange()},beforeDestroy:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},methods:{onSizeChange:function(){this.$emit("resized",this.dataKey,this.getCurrentSize())},getCurrentSize:function(){return this.$el?this.$el[this.sizeKey]:0}}},P=n.default.component("virtual-draglist-items",{mixins:[N],props:d,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{"data-key":n},class:"virtual-dnd-list-item"},this.$slots.default)}});return n.default.component("virtual-drag-list",{model:{prop:"dataSource",event:"updateDataSource"},props:u,data:function(){return{list:[],range:{start:0,end:0,front:0,behind:0},lastLength:null,uniqueKeys:[],virtualRef:null,sortableRef:null}},computed:{isHorizontal:function(){return"vertical"!==this.direction},itemSizeKey:function(){return this.isHorizontal?"offsetWidth":"offsetHeight"},virtualAttributes:function(){var t=this;return x.reduce((function(e,n){return e[n]=t[n],e}),{})},sortableAttributes:function(){var t=this;return S.reduce((function(e,n){return e[n]=t[n],e}),{})}},watch:{dataSource:{handler:function(){this._onUpdate()},deep:!0},virtualAttributes:{handler:function(t,e){if(this.virtualRef)for(var n in t)t[n]!=e[n]&&this.virtualRef.option(n,t[n])}},sortableAttributes:{handler:function(t,e){if(this.sortableRef)for(var n in t)t[n]!=e[n]&&this.sortableRef.option(n,t[n])}}},activated:function(){this.scrollToOffset(this.virtualRef.offset),this.virtualRef.addScrollEventListener()},deactivated:function(){this.virtualRef.removeScrollEventListener()},created:function(){this.range.end=this.keeps-1,this._initVirtual(),this._onUpdate()},mounted:function(){this._initSortable(),this.virtualRef.option("wrapper",this.$refs.wrapRef),this.scroller||this.virtualRef.option("scroller",this.$refs.rootRef)},beforeDestroy:function(){this.sortableRef&&this.sortableRef.destroy(),this.virtualRef.removeScrollEventListener(),this.sortableRef=this.virtual=null},methods:{getSize:function(t){return this.virtualRef.getSize(t)},getOffset:function(){return this.virtualRef.getOffset()},getClientSize:function(){return this.virtualRef.getClientSize()},getScrollSize:function(){return this.virtualRef.getScrollSize()},scrollToKey:function(t){var e=this.uniqueKeys.indexOf(t);e>-1&&this.virtualRef.scrollToIndex(e)},scrollToIndex:function(t){this.virtualRef.scrollToIndex(t)},scrollToOffset:function(t){this.virtualRef.scrollToOffset(t)},scrollToTop:function(){this.virtualRef.scrollToOffset(0)},scrollToBottom:function(){this.virtualRef.scrollToBottom()},_onUpdate:function(){var t,e=s(this.list);if(this.list=this.dataSource,this._updateUniqueKeys(),this._updateRange(e,this.list),null===(t=this.sortableRef)||void 0===t||t.option("list",this.list),this.lastLength&&this.keepOffset){var n=this.list.length-this.lastLength;n>0&&this.scrollToIndex(n),this.lastLength=null}},_initVirtual:function(){var t=this;this.virtualRef=new M({size:this.size,keeps:this.keeps,buffer:Math.round(this.keeps/3),scroller:this.scroller,direction:this.direction,uniqueKeys:this.uniqueKeys,debounceTime:this.debounceTime,throttleTime:this.throttleTime,onScroll:function(e){t.lastLength=null,t.list.length&&e.top?t._handleToTop():e.bottom&&t._handleToBottom()},onUpdate:function(e){h.dragged&&e.start!==t.range.start&&(t.sortableRef.reRendered=!0),t.range=e}})},_initSortable:function(){var t=this;this.sortableRef=new w(this.$refs.rootRef,o(o({list:this.list,dataKey:this.dataKey},this.sortableAttributes),{},{onDrag:function(e){t.sortable||t.virtualRef.enableScroll(!1),t.$emit("drag",e)},onAdd:function(e){t.$emit("add",e)},onRemove:function(e){t.$emit("remove",e)},onDrop:function(e){t.sortable||t.virtualRef.enableScroll(!0),e.changed&&t.$emit("updateDataSource",e.list),t.$emit("drop",e)}}))},_updateRange:function(t,e){var n=o({},this.range);e.length>t.length&&this.range.end===t.length-1&&this._scrolledToBottom()&&(n.end++,n.start=Math.max(0,n.end-this.keeps+1)),this.virtualRef.updateRange(n)},_scrolledToBottom:function(){return this.getOffset()+this.getClientSize()+1>=this.getScrollSize()},_handleToTop:p((function(){this.$emit("top"),this.lastLength=this.list.length})),_handleToBottom:p((function(){this.$emit("bottom")})),_onItemResized:function(t,e){var n=this.virtualRef.sizes.size,i=Math.min(this.keeps,this.list.length);this.virtualRef.onItemResized(t,e),n===i-1&&this._updateRange(this.list,this.list)},_updateUniqueKeys:function(){var t=this;this.uniqueKeys=this.list.map((function(e){return m(e,t.dataKey)})),this.virtualRef.option("uniqueKeys",this.uniqueKeys)},_getItemStyle:function(t){var e;return t==(null===(e=h.dragged)||void 0===e?void 0:e.dataset.key)?{display:"none"}:{}},_renderItems:function(t){for(var e=[],n=this.range,i=n.start,r=n.end,s=i;s<=r;s++){var l=this.list[s];if(l){var a=m(l,this.dataKey),c=o(o({},this.itemStyle),this._getItemStyle(a));e.push(this.$scopedSlots.item?t(P,{key:a,props:{dataKey:a,tag:this.itemTag,sizeKey:this.itemSizeKey},on:{resized:this._onItemResized},style:c,class:this.itemClass},this.$scopedSlots.item({record:l,index:s,dataKey:a})):null)}}return e}},render:function(t){var e=this.range,n=e.front,i=e.behind,r=this.isHorizontal,s=this.rootTag,l=this.wrapTag,a=r?"0px ".concat(i,"px 0px ").concat(n,"px"):"".concat(n,"px 0px ").concat(i,"px");return t(s,{ref:"rootRef",style:!this.scroller&&{overflow:r?"auto hidden":"hidden auto"}},[this.$slots.header,t(l,{ref:"wrapRef",class:this.wrapClass,style:o(o({},this.wrapStyle),{},{padding:a})},this._renderItems(t)),this.$slots.footer])}})})); |
{ | ||
"name": "vue-virtual-draglist", | ||
"version": "2.8.5", | ||
"version": "2.8.6", | ||
"description": "A virtual scrolling list component that can be sorted by dragging", | ||
@@ -39,3 +39,3 @@ "main": "dist/virtual-drag-list.min.js", | ||
"dependencies": { | ||
"sortable-dnd": "0.6.6" | ||
"sortable-dnd": "0.6.12" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119280
2083
+ Addedsortable-dnd@0.6.12(transitive)
- Removedsortable-dnd@0.6.6(transitive)
Updatedsortable-dnd@0.6.12