Socket
Socket
Sign inDemoInstall

vue-virtual-draglist

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-virtual-draglist - npm Package Compare versions

Comparing version 2.8.3 to 2.8.4

2

dist/virtual-drag-list.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):(t=t||self).VirtualDragList=e(t.Vue)}(this,function(t){"use strict";function n(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function d(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){o(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function o(t,e,i){(e=function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);i=i.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}function r(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var i;if(t)return"string"==typeof t?s(t,e):"Map"===(i="Object"===(i=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,e):void 0}(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 s(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}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;(function(t){function R(t){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i,n=arguments[e];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function e(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}function P(t,e){t.style["".concat(J.css,"transition-duration")]=null==e?"":"".concat(e,"ms")}function a(t,e){t.style["".concat(J.css,"transform")]=e?"".concat(e):""}function l(t,e,i){window.addEventListener?t.addEventListener(e,i,!(!Z&&g)&&$):window.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i}function n(t,e,i){window.removeEventListener?t.removeEventListener(e,i,!(!Z&&g)&&$):window.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null}function j(){return document.scrollingElement||document.documentElement}function m(t,e,i){if(t.getBoundingClientRect||t===window){var n,o,s,r,l,a,c=t!==window&&t.parentNode&&t!==j()?(o=(n=t.getBoundingClientRect()).top,s=n.left,r=n.bottom,l=n.right,a=n.height,n.width):(s=o=0,r=window.innerHeight,l=window.innerWidth,a=window.innerHeight,window.innerWidth);if(e&&t!==window){i=i||t.parentNode;do{if(i&&i.getBoundingClientRect){var h=i.getBoundingClientRect();o-=h.top+parseInt(d(i,"border-top-width")),s-=h.left+parseInt(d(i,"border-left-width")),r=o+n.height,l=s+n.width;break}}while(i=i.parentNode)}return{top:o,left:s,bottom:r,right:l,width:c,height:a}}}function c(t,e,i,n){if(t){i=i||document;do{if(null==e){var o=Array.prototype.slice.call(i.children),s=o.indexOf(t);if(-1<s)return o[s];for(var r=0;r<o.length;r++)if(K(t,o[r]))return o[r]}else if((">"!==e[0]||t.parentNode===i)&&u(t,e)||n&&t===i)return t}while(t=t.parentNode)}return null}function K(t,e){if(t&&e){if(e.compareDocumentPosition)return e===t||16&e.compareDocumentPosition(t);if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return 1}}function o(t,e){var i=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!u(t,e)||"none"===d(t,"display")||i++;return i}function F(t,e,i,n){for(var o=0,s=0,r=t.children;o<r.length;){if(r[o]!==p.ghost&&"none"!==d(r[o],"display")&&c(r[o],i,t,!1)&&(n||r[o]!==p.dragged)){if(s===e)return r[o];s++}o++}return null}function H(t,e){var i,n=d(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),s=F(t,0,e),t=F(t,1,e),e=s&&d(s),r=t&&d(t),l=e&&parseInt(e.marginLeft)+parseInt(e.marginRight)+m(s).width,a=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+m(t).width,c=V||g?"cssFloat":"float";return"flex"===n.display?"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal":"grid"===n.display?n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal":s&&e.float&&"none"!==e.float?(i="left"===e.float?"left":"right",!t||"both"!==r.clear&&r.clear!==i?"horizontal":"vertical"):s&&("block"===e.display||"flex"===e.display||"table"===e.display||"grid"===e.display||o<=l&&"none"===n[c]||t&&"none"===n[c]&&o<l+a)?"vertical":"horizontal"}function h(t,e,i){var n;t&&e&&(t.classList?t.classList[i?"add":"remove"](e):(n=(" "+t.className+" ").replace(U," ").replace(" "+e+" "," "),t.className=(n+(i?" "+e:"")).replace(U," ")))}function u(t,e){if(e&&(">"===e[0]&&(e=e.substring(1)),t))try{return t.matches?t.matches(e):t.msMatchesSelector?t.msMatchesSelector(e):t.webkitMatchesSelector&&t.webkitMatchesSelector(e)}catch(t){}}function d(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];n[e=e in n||-1!==e.indexOf("webkit")?e:"-webkit-"+e]=i+("string"==typeof i?"":"px")}}function s(t,e){return 2===(t=t.compareDocumentPosition?t.compareDocumentPosition(e):t.contains?(t!=e&&t.contains(e)&&16)+(t!=e&&e.contains(t)&&8)+(0<=t.sourceIndex&&0<=e.sourceIndex?(t.sourceIndex<e.sourceIndex&&4)+(t.sourceIndex>e.sourceIndex&&2):1)+0:0)?1:4===t?-1:0}function W(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function f(t){var e=t.sortable,i=t.name,t=t.params;"function"==typeof(e=e.options[i])&&e(r({},t))}function Y(t){this.options=t,this.autoScrollAnimationFrame=null}function X(t){this.options=t,this.animations=[]}function q(t){this.options=t||{},this.selectedElements=[]}function p(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(t));(t[S]=this).el=t,this.options=e=r({},e);var i,n,o={store:null,disabled:!1,group:"",animation:150,draggable:null,handle:null,multiple:!1,selectHandle:null,customGhost:null,direction:function(){return H(t,e.draggable)},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(i in o)i in this.options||(this.options[i]=o[i]);for(n in nt(e),this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));var s=this.options.supportTouch;l(t,s?"touchstart":"mousedown",this._onDrag),A.push(t),this.autoScroller=new Y(this.options),this.multiplayer=new q(this.options),this.animator=new X(this.options)}var $,U,i,g,V,G,Z,J,y,v,S,b,_,w,Q,x,T,O,E,z,tt,I,C,et,D,k,B,M,L,it,N,A,nt;t.exports=($={capture:!1,passive:!1},U=/\s+/g,g=e(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),V=e(/Edge/i),G=e(/safari/i)&&!e(/chrome/i)&&!e(/android/i),i=!1,document.addEventListener("checkIfSupportPassive",null,{get passive(){return i=!0}}),Z=i,J="undefined"==typeof window||"undefined"==typeof document?{}:(t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],t=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1],{dom:"WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1],lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}),S="Sortable"+Date.now(),window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),Y.prototype={destroy:function(){null!=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){var i,n,o,s,r,l,a,c,h,u,d,f,p;t&&void 0!==e.clientX&&void 0!==e.clientY&&(u=m(t))&&(i=e.clientX,e=e.clientY,n=u.top,o=u.right,s=u.bottom,r=u.left,f=u.height,u=u.width,e<n||o<i||s<e||i<r||(l=(a=this.options).scrollThreshold,a=a.scrollSpeed,d=t.scrollTop,c=t.scrollLeft,p=t.scrollHeight,h=0<d&&n<=e&&e<=n+l,u=c+u<t.scrollWidth&&i<=o&&o-l<=i,d=d+f<p&&e<=s&&s-l<=e,(p=f=0)<c&&r<=i&&i<=r+l&&(f=Math.floor(Math.max(-1,(i-r)/l-1)*a.x)),u&&(f=Math.ceil(Math.min(1,(i-o)/l+1)*a.x)),h&&(p=Math.floor(Math.max(-1,(e-n)/l-1)*a.y)),(p=d?Math.ceil(Math.min(1,(e-s)/l+1)*a.y):p)&&(t.scrollTop+=p),f&&(t.scrollLeft+=f)))}},X.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),s=Math.min(e.bottom,n),r=Array.prototype.slice.call(t.children),l=[],a=0;a<=r.length;a++){var c=r[a];if(c&&c!==p.ghost&&"none"!==d(c,"display")){var h=m(c);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>s||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=(o=t[e]).node,o=o.rect;this._excute(n,o)}},_excute:function(t,e){var i=e.left,e=e.top,n=m(t);n.top===e&&n.left===i||(e-=n.top,i-=n.left,P(t),a(t,"translate3d(".concat(i,"px, ").concat(e,"px, 0)")),t.offsetWidth,P(t,this.options.animation),a(t,"translate3d(0px, 0px, 0px)"),clearTimeout(t.animated),t.animated=setTimeout(function(){P(t),a(t,""),t.animated=null},this.options.animation))}},q.prototype={destroy:function(){y=v=null},active:function(){return!!y},setParams:function(t){t.nodes=y||[],t.clones=v||[]},select:function(t){h(t,this.options.selectedClass,!0),this.selectedElements.push(t),this.selectedElements.sort(s)},deselect:function(t){var e=this.selectedElements.indexOf(t);-1<e&&(h(t,this.options.selectedClass,!1),this.selectedElements.splice(e,1))},getGhostElement:function(){var i;return y?(i=document.createElement("div"),this.selectedElements.forEach(function(t,e){(t=t.cloneNode(!0)).style="position: absolute;left: 0;top: 0;bottom: 0;right: 0;opacity: ".concat(0===e?1:.5,";z-index: ").concat(e,";"),i.appendChild(t)}),i):null},toggleSelected:function(e,t){var i=this;t?e.forEach(function(t){return i.selectedElements.push(t)}):this.selectedElements=this.selectedElements.filter(function(t){return e.indexOf(t)<0})},toggleClass:function(t){if(y)for(var e=0;e<y.length;e++)h(y[e],this.options.chosenClass,t)},toggleVisible:function(t){y&&(t?(t=y.indexOf(p.dragged),this._viewElements(y,t,p.dragged)):this._hideElements(y))},onChoose:function(){!this.options.multiple||!this.selectedElements.length||this.selectedElements.indexOf(p.dragged)<0||(this.selectedElements.sort(s),y=this.selectedElements,this.toggleClass(!0))},onDrag:function(t){y&&(t.animator.collect(p.dragged.parentNode),this._hideElements(y),t.animator.animate(),this.toggleClass(!1))},onDrop:function(t,e,i){var n,o,s;y&&(o=p.clone,s=y.indexOf(n=p.dragged),e[S].animator.collect(o.parentNode),t!==e&&"clone"===i?(d(o,"display","none"),v=y.map(function(t){return t.cloneNode(!0)}),this._viewElements(v,s,o),this._viewElements(y,s,n)):this._viewElements(y,s,o),e[S].animator.animate(),t!==e)&&(e[S].multiplayer.toggleSelected(v||y,!0),"clone"!==i)&&t[S].multiplayer.toggleSelected(y,!1)},onSelect:function(t,e,i){var n=this.selectedElements.indexOf(e),t=(h(e,this.options.selectedClass,n<0),{from:i.el,event:t,node:e,index:o(e)});n<0?(this.selectedElements.push(e),f({sortable:i,name:"onSelect",params:t})):(this.selectedElements.splice(n,1),f({sortable:i,name:"onDeselect",params:t})),this.selectedElements.sort(s)},_viewElements:function(t,e,i){for(var n,o=0;o<t.length;o++)d(t[o],"display",""),o<e?i.parentNode.insertBefore(t[o],i):(n=0<o?t[o-1]:i,i.parentNode.insertBefore(t[o],n.nextSibling))},_hideElements:function(t){for(var e=0;e<t.length;e++)t[e]!=p.dragged&&d(t[e],"display","none")}},A=[],nt=function(t){var e={},i=t.group;i&&"object"==R(i)||(i={name:i,pull:!0,put:!0,revertDrag:!0}),e.name=i.name,e.pull=i.pull,e.put=i.put,e.revertDrag=i.revertDrag,t.group=e},p.prototype={constructor:p,_onDrag:function(t){var e,i,n,o,s=this;_||this.options.disabled||!this.options.group.pull||/mousedown|pointerdown/.test(t.type)&&0!==t.button||(n=((e=t.touches&&t.touches[0])||t).target,G&&n&&"SELECT"===n.tagName.toUpperCase())||!(i=c(n,this.options.draggable,this.el))||i.animated||(E={original:t,clientX:(e||t).clientX,clientY:(e||t).clientY},_=i,l(I=e?_:document,"mouseup",this._onDrop),l(I,"touchend",this._onDrop),l(I,"touchcancel",this._onDrop),o=(i=this.options).handle,"function"==typeof(i=i.selectHandle)&&i(t))||"string"==typeof i&&u(n,i)||"function"==typeof o&&!o(t)||"string"==typeof o&&!u(n,o)||(n=(i=this.options).delay,o=i.delayOnTouchOnly,!n||o&&!e||V||g?this._onStart(e,t):(l(this.el.ownerDocument,"touchmove",this._delayMoveHandler),l(this.el.ownerDocument,"mousemove",this._delayMoveHandler),l(this.el.ownerDocument,"mouseup",this._cancelStart),l(this.el.ownerDocument,"touchend",this._cancelStart),l(this.el.ownerDocument,"touchcancel",this._cancelStart),et=setTimeout(function(){return s._onStart(e,t)},n)))},_delayMoveHandler:function(t){t=t.touches?t.touches[0]:t,Math.max(Math.abs(t.clientX-E.clientX),Math.abs(t.clientY-E.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(et),n(this.el.ownerDocument,"touchmove",this._delayMoveHandler),n(this.el.ownerDocument,"mousemove",this._delayMoveHandler),n(this.el.ownerDocument,"mouseup",this._cancelStart),n(this.el.ownerDocument,"touchend",this._cancelStart),n(this.el.ownerDocument,"touchcancel",this._cancelStart)},_onStart:function(t,e){var i=o(_);D=this.el,k=this.el,it=L=M=i,N=_,b=this.el,x=_.cloneNode(!0),O=_.parentNode,B=this.options.group.pull,p.clone=x,p.active=this,h(p.dragged=_,this.options.chosenClass,!0),this.multiplayer.onChoose(),f({sortable:this,name:"onChoose",params:this._getParams(e)}),l(I,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout(function(){return document.selection.empty()},0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){h(x,this.options.chosenClass,!0),this._appendGhost(),this.multiplayer.onDrag(this),f({sortable:this,name:"onDrag",params:this._getParams(E.original)}),d(_,"display","none"),h(_,this.options.chosenClass,!1),_.parentNode.insertBefore(x,_),G&&d(document.body,"user-select","none")},_getGhostElement:function(){var t=this.options.customGhost;return"function"==typeof t?t((t=this.multiplayer.selectedElements).length?t:[_]):this.multiplayer.getGhostElement()||_},_appendGhost:function(){if(!T){var t,e=(n=this.options).fallbackOnBody,i=n.ghostClass,n=n.ghostStyle,e=e?document.body:this.el,o=this._getGhostElement();h(T=o.cloneNode(!0),i,!0);var s=r({position:"fixed",top:(o=m(_)).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"},n);for(t in s)d(T,t,s[t]);T.style["".concat(J.css,"transition")]="none",a(T,"translate3d(0px, 0px, 0px)"),p.ghost=T,e.appendChild(T),n=(E.clientX-o.left)/parseInt(T.style.width)*100,i=(E.clientY-o.top)/parseInt(T.style.height)*100,d(T,"transform-origin","".concat(n,"% ").concat(i,"%")),d(T,"transform","translateZ(0)"),d(T,"will-change","transform")}},_nearestSortable:function(t){W(t);var e,i,o,s,r,n=t.touches&&t.touches[0],l=n||t;!E||!_||(i=z||E,void 0!==(e=l).clientX&&void 0!==e.clientY&&Math.abs(e.clientX-i.clientX)<=0&&Math.abs(e.clientY-i.clientY)<=0)||(z||this._onStarted(),z={original:t,clientX:l.clientX,clientY:l.clientY},e=n?document.elementFromPoint(l.clientX,l.clientY):l.target,i=l.clientX-E.clientX,n=l.clientY-E.clientY,a(T,"translate3d(".concat(i,"px, ").concat(n,"px, 0)")),this.options.autoScroll&&(i=function(t){if(t&&t.getBoundingClientRect){var e=t;do{if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var i=d(e);if(e.clientWidth<e.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||e.clientHeight<e.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY))return e.getBoundingClientRect&&e!==document.body?e:j()}}while(e=e.parentNode)}return j()}(e),this.autoScroller.update(i,E,z)),o=l.clientX,s=l.clientY,A.some(function(t){var e,i,n=t[S].options.emptyInsertThreshold;if(null!=n)return i=m(t),e=o>=i.left-n&&o<=i.right+n,i=s>=i.top-n&&s<=i.bottom+n,e&&i?r=t:void 0}),r&&r[S]._onMove(t,e))},_allowPut:function(){var t,e,i;return b===this.el||!!this.options.group.put&&(t=(e=this.options.group).name,e=e.put,i=b[S].options.group,e.join&&-1<e.indexOf(i.name)||i.name&&t&&i.name===t)},_allowSwap:function(){var t=s(x,w),e=(Q=t<0?w.nextSibling:w,m(w)),i="vertical"===(o="function"==typeof this.options.direction?this.options.direction.call(z.original,_,this):this.options.direction),n=i?z.clientY:z.clientX,o=w["vertical"===o?"offsetHeight":"offsetWidth"],n=n>=(i?e.top:e.left)&&n<(i?e.bottom:e.right)-o/2?-1:1;return tt!==w?(C=n,!0):C!==n&&((C=n)<0?0<t:t<0)},_onMove:function(t,e){var i,n;this._allowPut()&&(f({sortable:this,name:"onMove",params:this._getParams(t)}),this.el===k||e!==this.el&&function(t){for(var e=t.lastElementChild;e&&(e===p.ghost||"none"===d(e,"display"));)e=e.previousElementSibling;return e}(this.el)?(w=c(e,this.options.draggable,this.el))&&!w.animated&&this._allowSwap()&&(w===x||K(w,x)||(this.el!==k?this._onInsert(t):(i=t,n=n||m(O),i.clientX<=n.right&&i.clientX>=n.left&&i.clientY>=n.top&&i.clientY<=n.bottom&&e===O||this._onChange(t))),tt=w):(w=tt=null,this._onInsert(t)))},_onInsert:function(t){var e=w||x,i="clone"===B&&this.el!==b&&k===b,n="clone"===B&&this.el===b&&k!==b;D=this.el,M=o(x),N=e,O=w?w.parentNode:this.el,k[S].animator.collect(x.parentNode),this.animator.collect(O),i&&(d(_,"display",""),b[S].multiplayer.toggleVisible(!0),b[S].options.group.revertDrag||k.insertBefore(_,x)),n&&(M=o(_),d(_,"display","none"),this.multiplayer.toggleVisible(!1)),w?O.insertBefore(x,C<0?w:w.nextSibling):O.appendChild(x),L=o(x),i&&b[S].options.group.revertDrag&&f({sortable:b[S],name:"onChange",params:this._getParams(t,{to:b,target:_,newIndex:it,revertDrag:!0})}),i||f({sortable:k[S],name:"onRemove",params:this._getParams(t)}),n&&w!==_&&f({sortable:this,name:"onChange",params:this._getParams(t,{from:b,backToOrigin:!0})}),n||f({sortable:this,name:"onAdd",params:this._getParams(t)}),k[S].animator.animate(),this.animator.animate(),k=this.el},_onChange:function(t){w!==_&&(O=w.parentNode,M=o(x),N=w,this.animator.collect(O),O.insertBefore(x,Q),L=o(x),f({sortable:this,name:"onChange",params:this._getParams(t)}),this.animator.animate(),k=this.el)},_onDrop:function(t){var e,i;W(t),this._cancelStart(),n(I,"touchmove",this._nearestSortable),n(I,"mousemove",this._nearestSortable),n(I,"mouseup",this._onDrop),n(I,"touchend",this._onDrop),n(I,"touchcancel",this._onDrop),h(_,this.options.chosenClass,!1),b&&(k=b,M=it,N===x&&(N=_),this.multiplayer.toggleClass(!1),f({sortable:this,name:"onUnchoose",params:this._getParams(t)}),z)&&this._onEnd(t),b||z||!this.options.multiple||(i=(e=t.changedTouches?t.changedTouches[0]:t).clientX-E.clientX,e=e.clientY-E.clientY,0<=(i=Math.sqrt(i*i+e*e))&&i<=1&&this.multiplayer.onSelect(t,_,this)),T&&T.parentNode&&T.parentNode.removeChild(T),this.multiplayer.destroy(),this.autoScroller.destroy(),this._nulling()},_onEnd:function(t){var t=this._getParams(t),e=(this.multiplayer.onDrop(k,D,B),this.options.swapOnDrop);("clone"!==B||k===D)&&("function"==typeof e?e(t):e)&&O.insertBefore(_,x),"clone"!==B||k===D||this.multiplayer.active()?x&&x.parentNode&&x.parentNode.removeChild(x):h(x,this.options.chosenClass,!1),d(_,"display",""),G&&d(document.body,"user-select",""),k!==D&&f({sortable:k[S],name:"onDrop",params:t}),f({sortable:D[S],name:"onDrop",params:t})},_getParams:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i={};return i.event=t,i.to=D,i.from=k,i.node=_,i.clone=x,i.target=N,i.oldIndex=M,i.newIndex=L,i.pullMode=B,this.multiplayer.setParams(i),r(i,e),i.relative=i.target===_?0:s(i.target,x),i},_nulling:function(){D=k=b=_=w=Q=x=T=O=B=M=L=it=E=z=N=tt=I=C=et=p.clone=p.ghost=p.active=p.dragged=null},destroy:function(){this._nulling(),this._cancelStart(),n(this.el,"touchstart",this._onDrag),n(this.el,"mousedown",this._onDrag),A.splice(A.indexOf(this.el),1),this.el[S]=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&&nt(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selectedElements}},p.utils={on:l,off:n,css:d,index:o,closest:c,getRect:m,toggleClass:h,detectDirection:H},p.get=function(t){return t[S]},p.create=function(t,e){return new p(t,e)},p)})(e={exports:{}});var l=e.exports;function a(s,t,e){function i(){for(var t,e=this,i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];return c&&clearTimeout(c),a?(t=!c,c=setTimeout(function(){c=null},l),t&&(r=s.apply(this,n))):c=setTimeout(function(){s.apply(e,n)},l),r}var r,l=1<arguments.length&&void 0!==t?t:50,a=2<arguments.length&&void 0!==e&&e,c=null;return i.cancel=function(){clearTimeout(c),c=null},i}function f(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce(function(t,e){return(t||{})[e]},t)}var c="INIT",i="FIXED",h="DYNAMIC",u="FRONT",p="BEHIND",m="STATIONARY",e="horizontal",g="vertical",y=(o(O={},g,"scrollTop"),o(O,e,"scrollLeft"),O),v=(o(O={},g,"scrollHeight"),o(O,e,"scrollWidth"),O),S=(o(O={},g,"offsetHeight"),o(O,e,"offsetWidth"),O),b=(o(O={},g,"offsetTop"),o(O,e,"offsetLeft"),O),_=["size","keeps","scroller","direction","debounceTime","throttleTime"];function w(t){this.options=t;var e,i={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(e in i)e in this.options||(this.options[e]=i[e]);this.sizes=new Map,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.calcType=c,this.calcSize={average:0,total:0,fixed:0,header:0},this.direction="",this.useWindowScroll=null,this._updateScrollElement(),this._updateOnScrollFunction(),this.addScrollEventListener(),this._checkIfUpdate(0,t.keeps-1)}w.prototype={constructor:w,isFront:function(){return this.direction===u},isBehind:function(){return this.direction===p},isFixed:function(){return this.calcType===i},getSize:function(t){return this.sizes.get(t)||this._getItemSize()},getOffset:function(){return this.scrollEl[y[this.options.direction]]},getScrollSize:function(){return this.scrollEl[v[this.options.direction]]},getClientSize:function(){return this.scrollEl[S[this.options.direction]]},scrollToOffset:function(t){this.scrollEl[y[this.options.direction]]=t},scrollToIndex:function(t){t>=this.options.uniqueKeys.length-1?this.scrollToBottom():(t=this._getOffsetByIndex(t),this.scrollToOffset(t))},scrollToBottom:function(){var i=this,t=this.getScrollSize();this.scrollToOffset(t),setTimeout(function(){var t=i.getClientSize(),e=i.getScrollSize();i.getOffset()+t+1<e&&i.scrollToBottom()},5)},updateOptions:function(t,i){var n=this,e=this.options[t];this.options[t]=i,"uniqueKeys"===t?this.sizes.forEach(function(t,e){i.includes(e)||n.sizes.delete(e)}):"scroller"===t&&(null!=e&&e.removeEventListener("scroll",this._onScroll),this._updateScrollElement(),this.addScrollEventListener())},updateRange:function(t){t?this._handleUpdate(t.start,t.end):(t=this.range.start,t=Math.max(t,0),this._handleUpdate(t,this._getEndByStart(t)))},handleItemSizeChange:function(t,e){this.sizes.set(t,e),this.calcType===c?(this.calcType=i,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=h,this.calcSize.fixed=void 0),this.calcType!==i&&(this.calcSize.total=r(this.sizes.values()).reduce(function(t,e){return t+e},0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},handleSlotSizeChange:function(t,e){this.calcSize[t]=e},addScrollEventListener:function(){var t;null!=(t=this.options.scroller)&&t.addEventListener("scroll",this._onScroll,!1)},removeScrollEventListener:function(){var t;null!=(t=this.options.scroller)&&t.removeEventListener("scroll",this._onScroll)},_updateOnScrollFunction:function(){var i,n,o,t=this,e=this.options,s=e.debounceTime,e=e.throttleTime;this._onScroll=s?a(function(){return t._handleScroll()},s):e?(i=function(){return t._handleScroll()},n=e,o=null,function(){var t=this,e=arguments;o=o||setTimeout(function(){o=null,i.apply(t,e)},n)}):function(){return t._handleScroll()},this._onScroll=this._onScroll.bind(this)},_updateScrollElement:function(){this.scrollEl=this._getScrollElement(this.options.scroller)},_handleScroll:function(){var t=this.getOffset(),e=this.getClientSize(),i=this.getScrollSize(),n=(t===this.offset?this.direction=m:this.direction=t<this.offset?u:p,this.offset=t,this.isFront()&&t<=0),i=this.isBehind()&&i<=e+t;this.options.onScroll({top:n,bottom:i,offset:t,direction:this.direction}),this.isFront()?this._handleScrollFront():this.isBehind()&&this._handleScrollBehind()},_handleScrollFront:function(){var t=this._getScrollItems();t>this.range.start||(t=Math.max(t-this.options.buffer,0),this._checkIfUpdate(t,this._getEndByStart(t)))},_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,i,n=0,o=this.options.uniqueKeys.length;n<=o;){if(e=n+Math.floor((o-n)/2),(i=this._getOffsetByIndex(e))===t)return e;i<t?n=e+1:t<i&&(o=e-1)}return 0<n?--n: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(d({},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,t=t.keeps;return 0<e.length?e.length-1:t-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?(this.useWindowScroll=!0,document.scrollingElement||document.documentElement||document.body):(this.useWindowScroll=!1,t)},_getScrollStartOffset:function(){var t=this.calcSize.header;if(this.useWindowScroll&&this.options.wrapper)for(var e=this.options.wrapper;t+=e[b[this.options.direction]],(e=e.offsetParent)&&e!==this.options.wrapper.ownerDocument;);return t}};var x=["delay","group","handle","disabled","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","fallbackOnBody","scrollThreshold","delayOnTouchOnly"];function T(t,e,i){var n=this,e=(this.ctx=t,this.onDrag=e,this.onDrop=i,this.list=r(t.list),this.store={},this.reRendered=!1,x.reduce(function(t,e){return t[e]=n.ctx[e],t},{}));this.sortable=new l(this.ctx.$refs.groupRef,d(d({},e),{},{swapOnDrop:function(t){return t.from===t.to},onDrag:function(t){return n._onDrag(t)},onAdd:function(t){return n._onAdd(t)},onRemove:function(t){return n._onRemove(t)},onChange:function(t){return n._onChange(t)},onDrop:function(t){return n._onDrop(t)}}))}T.prototype={constructor:T,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=this.store=null},setValue:function(t,e){"list"===t?this.list=r(e):this.sortable.option(t,e)},_onDrag:function(t){var t=t.node.dataset.key,e=this._getIndex(this.list,t),i=this.list[e];this.store={item:i,key:t,origin:{index:e,list:this.list},from:{index:e,list:this.list},to:{index:e,list:this.list}},this.sortable.option("store",this.store),this.onDrag({list:this.list}),this.ctx.$emit("drag",{item:i,key:t,index:e})},_onRemove:function(t){var t=t.node.dataset.key,e=this._getIndex(this.list,t),i=this.list[e];this.list.splice(e,1),Object.assign(this.store,{key:t,item:i}),this.sortable.option("store",this.store),this.ctx.$emit("remove",{item:i,index:e,key:t})},_onAdd:function(t){var e=t.from,i=t.target,t=t.relative,e=l.get(e).option("store"),n=e.key,e=e.item,i=this._getIndex(this.list,i.dataset.key);-1===t&&(i+=1),this.list.splice(i,0,e),Object.assign(this.store,{to:{index:i,list:this.list}}),this.sortable.option("store",this.store),this.ctx.$emit("add",{item:e,index:i,key:n})},_onChange:function(t){var e,i,n,o,s=l.get(t.from).option("store");t.revertDrag?(this.list=r(this.ctx.list),Object.assign(this.store,{from:s.origin})):(i=t.node,o=t.target,e=t.relative,t=t.backToOrigin,i=this._getIndex(this.list,i.dataset.key),n=this.list[i],o=this._getIndex(this.list,o.dataset.key),t&&(1===e&&s.from.index<o&&--o,-1===e)&&s.from.index>o&&(o+=1),this.list.splice(i,1),this.list.splice(o,0,n),Object.assign(this.store,{from:{index:o,list:this.list},to:{index:o,list:this.list}}))},_onDrop:function(t){var e=this._getStore(t),i=e.from,e=e.to,n=t.from!==t.to||i.origin.index!==e.to.index;this.onDrop({list:this.list}),this.ctx.$emit("drop",{changed:n,list:this.list,item:i.item,key:i.key,from:i.origin,to:e.to}),this.reRendered&&null!=(n=l.dragged)&&n.remove(),t.from!==t.to&&"clone"===t.pullMode&&null!=(i=l.clone)&&i.remove(),this.reRendered=!1},_getIndex:function(t,e){for(var i=0;i<t.length;i++)if(f(t[i],this.ctx.dataKey)==e)return i;return-1},_getStore:function(t){return{from:l.get(t.from).option("store"),to:l.get(t.to).option("store")}}};var g={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},scroller:{type:[Window,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]},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"},headerTag:{type:String,default:"div"},footerTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemStyle:{type:Object},headerStyle:{type:Object},footerStyle:{type:Object},itemClass:{type:String,default:""},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},e={tag:{type:String,default:"div"},event:{type:String},dataKey:{type:[String,Number]},sizeKey:{type:String}},O={inject:["virtualList"],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.virtualList[this.event](this.dataKey,this.getCurrentSize())},getCurrentSize:function(){return this.$el?this.$el[this.sizeKey]:0}}},E=t.component("virtual-draglist-items",{mixins:[O],props:e,render:function(t){var e=this.tag,i=this.dataKey;return t(e,{key:i,attrs:{"data-key":i}},this.$slots.default)}}),z=t.component("virtual-draglist-slots",{mixins:[O],props:e,render:function(t){var e=this.tag,i=this.dataKey;return t(e,{key:i,attrs:{role:i}},this.$slots.default)}});return t.component("virtual-drag-list",{model:{prop:"dataSource",event:"updateDataSource"},props:g,data:function(){return{list:[],start:0,timer:null,range:{start:0,end:0,front:0,behind:0},virtual:null,sortable:null,lastLength:null,uniqueKeys:[]}},provide:function(){return{virtualList:this}},computed:{isHorizontal:function(){return"vertical"!==this.direction},itemSizeKey:function(){return this.isHorizontal?"offsetWidth":"offsetHeight"},virtualAttributes:function(){var i=this;return _.reduce(function(t,e){return t[e]=i[e],t},{})},sortableAttributes:function(){var i=this;return x.reduce(function(t,e){return t[e]=i[e],t},{})}},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.updateOptions(i,t[i])},deep:!0},sortableAttributes:{handler:function(t,e){if(this.sortable)for(var i in t)t[i]!=e[i]&&this.sortable.setValue(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.updateOptions("wrapper",this.$refs.groupRef),this.scroller||this.virtual.updateOptions("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){t=this.uniqueKeys.indexOf(t);-1<t&&this.virtual.scrollToIndex(t)},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=r(this.list);this.list=this.dataSource,this._updateUniqueKeys(),this.virtual.sizes.size?this._updateRange(e,this.list):(clearTimeout(this.timer),this.timer=setTimeout(function(){return t.virtual.updateRange()},17)),this.sortable?this.sortable.setValue("list",this.list):this.$nextTick(function(){return t._initSortable()}),this.lastLength&&this.keepOffset&&(0<(e=this.list.length-this.lastLength)&&this.scrollToIndex(e),this.lastLength=null)},_initVirtual:function(){var e=this;this.virtual=new w({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(t){e.lastLength=null,e.list.length&&t.top?e._handleToTop():t.bottom&&e._handleToBottom()},onUpdate:function(t){l.dragged&&t.start!==e.range.start&&(e.sortable.reRendered=!0),e.range=t}})},_initSortable:function(){var e=this;this.sortable=new T(this,function(){e.start=e.range.start},function(t){t=t.list;t.length===e.list.length&&e.start<e.range.start&&(e.range.front+=l.clone[e.isHorizontal?"offsetWidth":"offsetHeight"],e.start=e.range.start),e.$emit("updateDataSource",t)})},_updateRange:function(t,e){var i,n=d({},this.range);0<this.range.start&&-1<(i=e.indexOf(t[this.range.start]))&&(n.start=i,n.end=i+this.keeps-1),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.virtual.updateRange(n)},_scrolledToBottom:function(){var t=this.getOffset(),e=this.getClientSize();return this.getScrollSize()<=t+e+1},_handleToTop:a(function(){this.$emit("top"),this.lastLength=this.list.length}),_handleToBottom:a(function(){this.$emit("bottom")}),_onItemResized:function(t,e){this.virtual.handleItemSizeChange(t,e)},_onSlotResized:function(t,e){this.virtual.handleSlotSizeChange(t,e)},_updateUniqueKeys:function(){var e=this;this.uniqueKeys=this.list.map(function(t){return f(t,e.dataKey)}),this.virtual.updateOptions("uniqueKeys",this.uniqueKeys)},_getItemStyle:function(t){return t==(null==(t=l.dragged)?void 0:t.dataset.key)?{display:"none"}:{}},_renderSlots:function(t,e,i){var n=this.itemSizeKey,o=this.$slots[e],s=d({},this.headerStyle),r=d({},this.footerStyle);return o?t(z,{props:{tag:i,dataKey:e,sizeKey:n,event:"_onSlotResized"},style:"header"===e?s:"footer"===e?r:void 0},o):null},_renderItems:function(t){for(var e=[],i=this.range,n=i.start,o=i.end,s=this.itemTag,r=this.itemClass,l=this.itemSizeKey,a=n;a<=o;a++){var c,h,u=this.list[a];u&&(c=f(u,this.dataKey),h=d(d({},this.itemStyle),this._getItemStyle(c)),e.push(this.$scopedSlots.item?t(E,{key:c,props:{dataKey:c,tag:s,sizeKey:l,event:"_onItemResized"},style:h,class:r},this.$scopedSlots.item({record:u,index:a,dataKey:c})):null))}return e}},render:function(t){var e=this.virtual.useWindowScroll,i=this.range,n=i.front,i=i.behind,o=this.isHorizontal,s=this.headerTag,r=this.footerTag,l=this.rootTag,a=this.wrapTag,c=this.wrapClass,n=d(d({},this.wrapStyle),{},{padding:o?"0px ".concat(i,"px 0px ").concat(n,"px"):"".concat(n,"px 0px ").concat(i,"px")});return t(l,{ref:"rootRef",style:!e&&{overflow:o?"auto hidden":"hidden auto"}},[this._renderSlots(t,"header",s),t(a,{ref:"groupRef",class:c,style:n},this._renderItems(t)),this._renderSlots(t,"footer",r)])}})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):(t=t||self).VirtualDragList=e(t.Vue)}(this,function(t){"use strict";function n(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function d(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){o(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function o(t,e,i){(e=function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0===i)return("string"===e?String:Number)(t);i=i.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}function r(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var i;if(t)return"string"==typeof t?s(t,e):"Map"===(i="Object"===(i=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,e):void 0}(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 s(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}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;(function(t){function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i,n=arguments[e];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function e(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}function K(t,e){t.style["".concat(J.css,"transition-duration")]=null==e?"":"".concat(e,"ms")}function a(t,e){t.style["".concat(J.css,"transform")]=e?"".concat(e):""}function l(t,e,i){window.addEventListener?t.addEventListener(e,i,!(!Z&&g)&&$):window.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i}function n(t,e,i){window.removeEventListener?t.removeEventListener(e,i,!(!Z&&g)&&$):window.detachEvent?t.detachEvent("on"+e,i):t["on"+e]=null}function P(){return document.scrollingElement||document.documentElement}function m(t,e,i){if(t.getBoundingClientRect||t===window){var n,o,s,r,l,a,c=t!==window&&t.parentNode&&t!==P()?(o=(n=t.getBoundingClientRect()).top,s=n.left,r=n.bottom,l=n.right,a=n.height,n.width):(s=o=0,r=window.innerHeight,l=window.innerWidth,a=window.innerHeight,window.innerWidth);if(e&&t!==window){i=i||t.parentNode;do{if(i&&i.getBoundingClientRect){var h=i.getBoundingClientRect();o-=h.top+parseInt(d(i,"border-top-width")),s-=h.left+parseInt(d(i,"border-left-width")),r=o+n.height,l=s+n.width;break}}while(i=i.parentNode)}return{top:o,left:s,bottom:r,right:l,width:c,height:a}}}function c(t,e,i,n){if(t){i=i||document;do{if(null==e){var o=Array.prototype.slice.call(i.children),s=o.indexOf(t);if(-1<s)return o[s];for(var r=0;r<o.length;r++)if(j(t,o[r]))return o[r]}else if((">"!==e[0]||t.parentNode===i)&&u(t,e)||n&&t===i)return t}while(t=t.parentNode)}return null}function j(t,e){if(t&&e){if(e.compareDocumentPosition)return e===t||16&e.compareDocumentPosition(t);if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return 1}}function o(t,e){var i=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!u(t,e)||"none"===d(t,"display")||i++;return i}function F(t,e,i,n){for(var o=0,s=0,r=t.children;o<r.length;){if(r[o]!==p.ghost&&"none"!==d(r[o],"display")&&c(r[o],i,t,!1)&&(n||r[o]!==p.dragged)){if(s===e)return r[o];s++}o++}return null}function H(t,e){var i,n=d(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),s=F(t,0,e),t=F(t,1,e),e=s&&d(s),r=t&&d(t),l=e&&parseInt(e.marginLeft)+parseInt(e.marginRight)+m(s).width,a=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+m(t).width,c=V||g?"cssFloat":"float";return"flex"===n.display?"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal":"grid"===n.display?n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal":s&&e.float&&"none"!==e.float?(i="left"===e.float?"left":"right",!t||"both"!==r.clear&&r.clear!==i?"horizontal":"vertical"):s&&("block"===e.display||"flex"===e.display||"table"===e.display||"grid"===e.display||o<=l&&"none"===n[c]||t&&"none"===n[c]&&o<l+a)?"vertical":"horizontal"}function h(t,e,i){var n;t&&e&&(t.classList?t.classList[i?"add":"remove"](e):(n=(" "+t.className+" ").replace(U," ").replace(" "+e+" "," "),t.className=(n+(i?" "+e:"")).replace(U," ")))}function u(t,e){if(e&&(">"===e[0]&&(e=e.substring(1)),t))try{return t.matches?t.matches(e):t.msMatchesSelector?t.msMatchesSelector(e):t.webkitMatchesSelector&&t.webkitMatchesSelector(e)}catch(t){}}function d(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];n[e=e in n||-1!==e.indexOf("webkit")?e:"-webkit-"+e]=i+("string"==typeof i?"":"px")}}function s(t,e){return 2===(t=t.compareDocumentPosition?t.compareDocumentPosition(e):t.contains?(t!=e&&t.contains(e)&&16)+(t!=e&&e.contains(t)&&8)+(0<=t.sourceIndex&&0<=e.sourceIndex?(t.sourceIndex<e.sourceIndex&&4)+(t.sourceIndex>e.sourceIndex&&2):1)+0:0)?1:4===t?-1:0}function W(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function f(t){var e=t.sortable,i=t.name,t=t.params;"function"==typeof(e=e.options[i])&&e(r({},t))}function Y(t){this.options=t,this.autoScrollAnimationFrame=null}function X(t){this.options=t,this.animations=[]}function q(t){this.options=t||{},this.selectedElements=[]}function p(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(t));(t[S]=this).el=t,this.options=e=r({},e);var i,n,o={store:null,disabled:!1,group:"",animation:150,draggable:null,handle:null,multiple:!1,selectHandle:null,customGhost:null,direction:function(){return H(t,e.draggable)},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(i in o)i in this.options||(this.options[i]=o[i]);for(n in nt(e),this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));var s=this.options.supportTouch;l(t,s?"touchstart":"mousedown",this._onDrag),N.push(t),this.autoScroller=new Y(this.options),this.multiplayer=new q(this.options),this.animator=new X(this.options)}var $,U,i,g,V,G,Z,J,y,v,S,b,w,x,Q,_,T,O,E,z,tt,I,D,et,C,k,R,B,M,it,A,N,nt;t.exports=($={capture:!1,passive:!1},U=/\s+/g,g=e(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),V=e(/Edge/i),G=e(/safari/i)&&!e(/chrome/i)&&!e(/android/i),i=!1,document.addEventListener("checkIfSupportPassive",null,{get passive(){return i=!0}}),Z=i,J="undefined"==typeof window||"undefined"==typeof document?{}:(t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],t=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1],{dom:"WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1],lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}),S="Sortable"+Date.now(),window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),Y.prototype={destroy:function(){null!=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){var i,n,o,s,r,l,a,c,h,u,d,f,p;t&&void 0!==e.clientX&&void 0!==e.clientY&&(u=m(t))&&(i=e.clientX,e=e.clientY,n=u.top,o=u.right,s=u.bottom,r=u.left,f=u.height,u=u.width,e<n||o<i||s<e||i<r||(l=(a=this.options).scrollThreshold,a=a.scrollSpeed,d=t.scrollTop,c=t.scrollLeft,p=t.scrollHeight,h=0<d&&n<=e&&e<=n+l,u=c+u<t.scrollWidth&&i<=o&&o-l<=i,d=d+f<p&&e<=s&&s-l<=e,(p=f=0)<c&&r<=i&&i<=r+l&&(f=Math.floor(Math.max(-1,(i-r)/l-1)*a.x)),u&&(f=Math.ceil(Math.min(1,(i-o)/l+1)*a.x)),h&&(p=Math.floor(Math.max(-1,(e-n)/l-1)*a.y)),(p=d?Math.ceil(Math.min(1,(e-s)/l+1)*a.y):p)&&(t.scrollTop+=p),f&&(t.scrollLeft+=f)))}},X.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),s=Math.min(e.bottom,n),r=Array.prototype.slice.call(t.children),l=[],a=0;a<=r.length;a++){var c=r[a];if(c&&c!==p.ghost&&"none"!==d(c,"display")){var h=m(c);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>s||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=(o=t[e]).node,o=o.rect;this._excute(n,o)}},_excute:function(t,e){var i=e.left,e=e.top,n=m(t);n.top===e&&n.left===i||(e-=n.top,i-=n.left,K(t),a(t,"translate3d(".concat(i,"px, ").concat(e,"px, 0)")),t.offsetWidth,K(t,this.options.animation),a(t,"translate3d(0px, 0px, 0px)"),clearTimeout(t.animated),t.animated=setTimeout(function(){K(t),a(t,""),t.animated=null},this.options.animation))}},q.prototype={destroy:function(){y=v=null},active:function(){return!!y},setParams:function(t){t.nodes=y||[],t.clones=v||[]},select:function(t){h(t,this.options.selectedClass,!0),this.selectedElements.push(t),this.selectedElements.sort(s)},deselect:function(t){var e=this.selectedElements.indexOf(t);-1<e&&(h(t,this.options.selectedClass,!1),this.selectedElements.splice(e,1))},getGhostElement:function(){var i;return y?(i=document.createElement("div"),this.selectedElements.forEach(function(t,e){(t=t.cloneNode(!0)).style="position: absolute;left: 0;top: 0;bottom: 0;right: 0;opacity: ".concat(0===e?1:.5,";z-index: ").concat(e,";"),i.appendChild(t)}),i):null},toggleSelected:function(e,t){var i=this;t?e.forEach(function(t){return i.selectedElements.push(t)}):this.selectedElements=this.selectedElements.filter(function(t){return e.indexOf(t)<0})},toggleClass:function(t){if(y)for(var e=0;e<y.length;e++)h(y[e],this.options.chosenClass,t)},toggleVisible:function(t){y&&(t?(t=y.indexOf(p.dragged),this._viewElements(y,t,p.dragged)):this._hideElements(y))},onChoose:function(){!this.options.multiple||!this.selectedElements.length||this.selectedElements.indexOf(p.dragged)<0||(this.selectedElements.sort(s),y=this.selectedElements,this.toggleClass(!0))},onDrag:function(t){y&&(t.animator.collect(p.dragged.parentNode),this._hideElements(y),t.animator.animate(),this.toggleClass(!1))},onDrop:function(t,e,i){var n,o,s;y&&(o=p.clone,s=y.indexOf(n=p.dragged),e[S].animator.collect(o.parentNode),t!==e&&"clone"===i?(d(o,"display","none"),v=y.map(function(t){return t.cloneNode(!0)}),this._viewElements(v,s,o),this._viewElements(y,s,n)):this._viewElements(y,s,o),e[S].animator.animate(),t!==e)&&(e[S].multiplayer.toggleSelected(v||y,!0),"clone"!==i)&&t[S].multiplayer.toggleSelected(y,!1)},onSelect:function(t,e,i){var n=this.selectedElements.indexOf(e),t=(h(e,this.options.selectedClass,n<0),{from:i.el,event:t,node:e,index:o(e)});n<0?(this.selectedElements.push(e),f({sortable:i,name:"onSelect",params:t})):(this.selectedElements.splice(n,1),f({sortable:i,name:"onDeselect",params:t})),this.selectedElements.sort(s)},_viewElements:function(t,e,i){for(var n,o=0;o<t.length;o++)d(t[o],"display",""),o<e?i.parentNode.insertBefore(t[o],i):(n=0<o?t[o-1]:i,i.parentNode.insertBefore(t[o],n.nextSibling))},_hideElements:function(t){for(var e=0;e<t.length;e++)t[e]!=p.dragged&&d(t[e],"display","none")}},N=[],nt=function(t){var e={},i=t.group;i&&"object"==L(i)||(i={name:i,pull:!0,put:!0,revertDrag:!0}),e.name=i.name,e.pull=i.pull,e.put=i.put,e.revertDrag=i.revertDrag,t.group=e},p.prototype={constructor:p,_onDrag:function(t){var e,i,n,o,s=this;w||this.options.disabled||!this.options.group.pull||/mousedown|pointerdown/.test(t.type)&&0!==t.button||(n=((e=t.touches&&t.touches[0])||t).target,G&&n&&"SELECT"===n.tagName.toUpperCase())||!(i=c(n,this.options.draggable,this.el))||i.animated||(E={original:t,clientX:(e||t).clientX,clientY:(e||t).clientY},w=i,l(I=e?w:document,"mouseup",this._onDrop),l(I,"touchend",this._onDrop),l(I,"touchcancel",this._onDrop),o=(i=this.options).handle,"function"==typeof(i=i.selectHandle)&&i(t))||"string"==typeof i&&u(n,i)||"function"==typeof o&&!o(t)||"string"==typeof o&&!u(n,o)||(n=(i=this.options).delay,o=i.delayOnTouchOnly,!n||o&&!e||V||g?this._onStart(e,t):(l(this.el.ownerDocument,"touchmove",this._delayMoveHandler),l(this.el.ownerDocument,"mousemove",this._delayMoveHandler),l(this.el.ownerDocument,"mouseup",this._cancelStart),l(this.el.ownerDocument,"touchend",this._cancelStart),l(this.el.ownerDocument,"touchcancel",this._cancelStart),et=setTimeout(function(){return s._onStart(e,t)},n)))},_delayMoveHandler:function(t){t=t.touches?t.touches[0]:t,Math.max(Math.abs(t.clientX-E.clientX),Math.abs(t.clientY-E.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(et),n(this.el.ownerDocument,"touchmove",this._delayMoveHandler),n(this.el.ownerDocument,"mousemove",this._delayMoveHandler),n(this.el.ownerDocument,"mouseup",this._cancelStart),n(this.el.ownerDocument,"touchend",this._cancelStart),n(this.el.ownerDocument,"touchcancel",this._cancelStart)},_onStart:function(t,e){var i=o(w);C=this.el,k=this.el,it=M=B=i,A=w,b=this.el,_=w.cloneNode(!0),O=w.parentNode,R=this.options.group.pull,p.clone=_,p.active=this,h(p.dragged=w,this.options.chosenClass,!0),this.multiplayer.onChoose(),f({sortable:this,name:"onChoose",params:this._getParams(e)}),l(I,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout(function(){return document.selection.empty()},0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){h(_,this.options.chosenClass,!0),this._appendGhost(),this.multiplayer.onDrag(this),f({sortable:this,name:"onDrag",params:this._getParams(E.original)}),d(w,"display","none"),h(w,this.options.chosenClass,!1),w.parentNode.insertBefore(_,w),G&&d(document.body,"user-select","none")},_getGhostElement:function(){var t=this.options.customGhost;return"function"==typeof t?t((t=this.multiplayer.selectedElements).length?t:[w]):this.multiplayer.getGhostElement()||w},_appendGhost:function(){if(!T){var t,e=(n=this.options).fallbackOnBody,i=n.ghostClass,n=n.ghostStyle,e=e?document.body:this.el,o=this._getGhostElement();h(T=o.cloneNode(!0),i,!0);var s=r({position:"fixed",top:(o=m(w)).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"},n);for(t in s)d(T,t,s[t]);T.style["".concat(J.css,"transition")]="none",a(T,"translate3d(0px, 0px, 0px)"),p.ghost=T,e.appendChild(T),n=(E.clientX-o.left)/parseInt(T.style.width)*100,i=(E.clientY-o.top)/parseInt(T.style.height)*100,d(T,"transform-origin","".concat(n,"% ").concat(i,"%")),d(T,"transform","translateZ(0)"),d(T,"will-change","transform")}},_nearestSortable:function(t){W(t);var e,i,o,s,r,n=t.touches&&t.touches[0],l=n||t;!E||!w||(i=z||E,void 0!==(e=l).clientX&&void 0!==e.clientY&&Math.abs(e.clientX-i.clientX)<=0&&Math.abs(e.clientY-i.clientY)<=0)||(z||this._onStarted(),z={original:t,clientX:l.clientX,clientY:l.clientY},e=n?document.elementFromPoint(l.clientX,l.clientY):l.target,i=l.clientX-E.clientX,n=l.clientY-E.clientY,a(T,"translate3d(".concat(i,"px, ").concat(n,"px, 0)")),this.options.autoScroll&&(i=function(t){if(t&&t.getBoundingClientRect){var e=t;do{if(e.clientWidth<e.scrollWidth||e.clientHeight<e.scrollHeight){var i=d(e);if(e.clientWidth<e.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||e.clientHeight<e.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY))return e.getBoundingClientRect&&e!==document.body?e:P()}}while(e=e.parentNode)}return P()}(e),this.autoScroller.update(i,E,z)),o=l.clientX,s=l.clientY,N.some(function(t){var e,i,n=t[S].options.emptyInsertThreshold;if(null!=n)return i=m(t),e=o>=i.left-n&&o<=i.right+n,i=s>=i.top-n&&s<=i.bottom+n,e&&i?r=t:void 0}),r&&r[S]._onMove(t,e))},_allowPut:function(){var t,e,i;return b===this.el||!!this.options.group.put&&(t=(e=this.options.group).name,e=e.put,i=b[S].options.group,e.join&&-1<e.indexOf(i.name)||i.name&&t&&i.name===t)},_allowSwap:function(){var t=s(_,x),e=(Q=t<0?x.nextSibling:x,m(x)),i="vertical"===(o="function"==typeof this.options.direction?this.options.direction.call(z.original,w,this):this.options.direction),n=i?z.clientY:z.clientX,o=x["vertical"===o?"offsetHeight":"offsetWidth"],n=n>=(i?e.top:e.left)&&n<(i?e.bottom:e.right)-o/2?-1:1;return tt!==x?(D=n,!0):D!==n&&((D=n)<0?0<t:t<0)},_onMove:function(t,e){var i,n;this._allowPut()&&(f({sortable:this,name:"onMove",params:this._getParams(t)}),this.el===k||e!==this.el&&function(t){for(var e=t.lastElementChild;e&&(e===p.ghost||"none"===d(e,"display"));)e=e.previousElementSibling;return e}(this.el)?(x=c(e,this.options.draggable,this.el))&&!x.animated&&this._allowSwap()&&(x===_||j(x,_)||(this.el!==k?this._onInsert(t):(i=t,n=n||m(O),i.clientX<=n.right&&i.clientX>=n.left&&i.clientY>=n.top&&i.clientY<=n.bottom&&e===O||this._onChange(t))),tt=x):(x=tt=null,this._onInsert(t)))},_onInsert:function(t){var e=x||_,i="clone"===R&&this.el!==b&&k===b,n="clone"===R&&this.el===b&&k!==b;C=this.el,B=o(_),A=e,O=x?x.parentNode:this.el,k[S].animator.collect(_.parentNode),this.animator.collect(O),i&&(d(w,"display",""),b[S].multiplayer.toggleVisible(!0),b[S].options.group.revertDrag||k.insertBefore(w,_)),n&&(B=o(w),d(w,"display","none"),this.multiplayer.toggleVisible(!1)),x?O.insertBefore(_,D<0?x:x.nextSibling):O.appendChild(_),M=o(_),i&&b[S].options.group.revertDrag&&f({sortable:b[S],name:"onChange",params:this._getParams(t,{to:b,target:w,newIndex:it,revertDrag:!0})}),i||f({sortable:k[S],name:"onRemove",params:this._getParams(t)}),n&&x!==w&&f({sortable:this,name:"onChange",params:this._getParams(t,{from:b,backToOrigin:!0})}),n||f({sortable:this,name:"onAdd",params:this._getParams(t)}),k[S].animator.animate(),this.animator.animate(),k=this.el},_onChange:function(t){x!==w&&(O=x.parentNode,B=o(_),A=x,this.animator.collect(O),O.insertBefore(_,Q),M=o(_),f({sortable:this,name:"onChange",params:this._getParams(t)}),this.animator.animate(),k=this.el)},_onDrop:function(t){var e,i;W(t),this._cancelStart(),n(I,"touchmove",this._nearestSortable),n(I,"mousemove",this._nearestSortable),n(I,"mouseup",this._onDrop),n(I,"touchend",this._onDrop),n(I,"touchcancel",this._onDrop),h(w,this.options.chosenClass,!1),b&&(k=b,B=it,A===_&&(A=w),this.multiplayer.toggleClass(!1),f({sortable:this,name:"onUnchoose",params:this._getParams(t)}),z)&&this._onEnd(t),b||z||!this.options.multiple||(i=(e=t.changedTouches?t.changedTouches[0]:t).clientX-E.clientX,e=e.clientY-E.clientY,0<=(i=Math.sqrt(i*i+e*e))&&i<=1&&this.multiplayer.onSelect(t,w,this)),T&&T.parentNode&&T.parentNode.removeChild(T),this.multiplayer.destroy(),this.autoScroller.destroy(),this._nulling()},_onEnd:function(t){var t=this._getParams(t),e=(this.multiplayer.onDrop(k,C,R),this.options.swapOnDrop);("clone"!==R||k===C)&&("function"==typeof e?e(t):e)&&O.insertBefore(w,_),"clone"!==R||k===C||this.multiplayer.active()?_&&_.parentNode&&_.parentNode.removeChild(_):h(_,this.options.chosenClass,!1),d(w,"display",""),G&&d(document.body,"user-select",""),k!==C&&f({sortable:k[S],name:"onDrop",params:t}),f({sortable:C[S],name:"onDrop",params:t})},_getParams:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i={};return i.event=t,i.to=C,i.from=k,i.node=w,i.clone=_,i.target=A,i.oldIndex=B,i.newIndex=M,i.pullMode=R,this.multiplayer.setParams(i),r(i,e),i.relative=i.target===w?0:s(i.target,_),i},_nulling:function(){C=k=b=w=x=Q=_=T=O=R=B=M=it=E=z=A=tt=I=D=et=p.clone=p.ghost=p.active=p.dragged=null},destroy:function(){this._nulling(),this._cancelStart(),n(this.el,"touchstart",this._onDrag),n(this.el,"mousedown",this._onDrag),N.splice(N.indexOf(this.el),1),this.el[S]=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&&nt(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selectedElements}},p.utils={on:l,off:n,css:d,index:o,closest:c,getRect:m,toggleClass:h,detectDirection:H},p.get=function(t){return t[S]},p.create=function(t,e){return new p(t,e)},p)})(e={exports:{}});var l=e.exports,e={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},scroller:{type:[Window,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]},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"},headerTag:{type:String,default:"div"},footerTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemStyle:{type:Object},headerStyle:{type:Object},footerStyle:{type:Object},itemClass:{type:String,default:""},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},i={tag:{type:String,default:"div"},event:{type:String},dataKey:{type:[String,Number]},sizeKey:{type:String}};function a(o,s){function t(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];r||(s<=0?o.apply(this,i):r=setTimeout(function(){r=void 0,o.apply(t,i)},s))}var r=null;return t.cancel=function(){r&&(clearTimeout(r),r=null)},t}function c(t,e){function i(){n.cancel(),n.apply(this,arguments)}var n=a(t,e);return i.cancel=function(){n.cancel()},i}function f(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce(function(t,e){return(t||{})[e]},t)}var h,u=["delay","group","handle","disabled","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","fallbackOnBody","scrollThreshold","delayOnTouchOnly"];function p(t,e){this.el=t,this.options=e,this.list=[],this.store={},this.reRendered=!1,this.attrs=u,this.init()}p.prototype={constructor:p,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=this.store=this.reRendered=null},option:function(t,e){"list"===t?this.list=r(e):this.sortable.option(t,e)},init:function(){for(var e=this,t={},i=0;i<u.length;i++){var n=u[i];t[n]=this.options[n]}this.sortable=new l(this.el,d(d({},t),{},{swapOnDrop:function(t){return t.from===t.to},onDrag:function(t){return e.onDrag(t)},onAdd:function(t){return e.onAdd(t)},onRemove:function(t){return e.onRemove(t)},onChange:function(t){return e.onChange(t)},onDrop:function(t){return e.onDrop(t)}})),this.list=r(this.options.list)},onDrag:function(t){var t=t.node.dataset.key,e=this.getIndex(this.list,t),i=this.list[e];this.store={item:i,key:t,origin:{index:e,list:this.list},from:{index:e,list:this.list},to:{index:e,list:this.list}},this.sortable.option("store",this.store),this.dispatchEvent("onDrag",{item:i,key:t,index:e})},onRemove:function(t){var t=t.node.dataset.key,e=this.getIndex(this.list,t),i=this.list[e];this.list.splice(e,1),Object.assign(this.store,{key:t,item:i}),this.sortable.option("store",this.store),this.dispatchEvent("onRemove",{item:i,key:t,index:e})},onAdd:function(t){var e=t.from,i=t.target,t=t.relative,e=l.get(e).option("store"),n=e.key,e=e.item,i=this.getIndex(this.list,i.dataset.key);0===t?i=this.list.length:-1===t&&(i+=1),this.list.splice(i,0,e),Object.assign(this.store,{to:{index:i,list:this.list}}),this.sortable.option("store",this.store),this.dispatchEvent("onAdd",{item:e,key:n,index:i})},onChange:function(t){var e,i,n,o,s=l.get(t.from).option("store");t.revertDrag?(this.list=r(this.options.list),Object.assign(this.store,{from:s.origin})):(i=t.node,o=t.target,e=t.relative,t=t.backToOrigin,i=this.getIndex(this.list,i.dataset.key),n=this.list[i],o=this.getIndex(this.list,o.dataset.key),t&&(1===e&&s.from.index<o&&--o,-1===e)&&s.from.index>o&&(o+=1),this.list.splice(i,1),this.list.splice(o,0,n),Object.assign(this.store,{from:{index:o,list:this.list},to:{index:o,list:this.list}}))},onDrop:function(t){var e=this.getStore(t),i=e.from,e=e.to,n=t.from!==t.to||i.origin.index!==e.to.index;this.dispatchEvent("onDrop",{changed:n,list:this.list,item:i.item,key:i.key,from:i.origin,to:e.to}),t.from===this.el&&this.reRendered&&null!=(n=l.dragged)&&n.remove(),t.from!==t.to&&"clone"===t.pullMode&&null!=(i=l.clone)&&i.remove(),this.reRendered=!1},getIndex:function(t,e){for(var i=0;i<t.length;i++)if(f(t[i],this.options.dataKey)==e)return i;return-1},getStore:function(t){return{from:l.get(t.from).option("store"),to:l.get(t.to).option("store")}},dispatchEvent:function(t,e){t=this.options[t];t&&t(e)}};var m=["size","keeps","scroller","direction","debounceTime","throttleTime"],g="INIT",y="FIXED",v="DYNAMIC",S="FRONT",b="BEHIND",w="STATIONARY",x="horizontal",_="vertical",T=(o(h={},_,"scrollTop"),o(h,x,"scrollLeft"),h),O=(o(h={},_,"offsetTop"),o(h,x,"offsetLeft"),h),E=(o(h={},_,"scrollHeight"),o(h,x,"scrollWidth"),h),z=(o(h={},_,"offsetHeight"),o(h,x,"offsetWidth"),h);function I(t){this.options=t;var e,i={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(e in i)e in this.options||(this.options[e]=i[e]);this.sizes=new Map,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.calcType=g,this.calcSize={average:0,total:0,fixed:0,header:0},this.scrollEl=this.getScrollElement(t.scroller),this.direction="",this.useWindowScroll=null,this.onScroll=null,this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,t.keeps-1)}I.prototype={constructor:I,isFront:function(){return this.direction===S},isBehind:function(){return this.direction===b},isFixed:function(){return this.calcType===y},getSize:function(t){return this.sizes.get(t)||this.getItemSize()},getOffset:function(){return this.scrollEl[T[this.options.direction]]},getScrollSize:function(){return this.scrollEl[E[this.options.direction]]},getClientSize:function(){return this.scrollEl[z[this.options.direction]]},scrollToOffset:function(t){this.scrollEl[T[this.options.direction]]=t},scrollToIndex:function(t){t>=this.options.uniqueKeys.length-1?this.scrollToBottom():(t=this.getOffsetByIndex(t),this.scrollToOffset(t))},scrollToBottom:function(){var i=this,t=this.getScrollSize();this.scrollToOffset(t),setTimeout(function(){var t=i.getClientSize(),e=i.getScrollSize();i.getOffset()+t+1<e&&i.scrollToBottom()},5)},option:function(t,i){var n=this,e=this.options[t];this.options[t]=i,"uniqueKeys"===t&&this.sizes.forEach(function(t,e){i.includes(e)||n.sizes.delete(e)}),"scroller"===t&&(e&&l.utils.off(e,"scroll",this.onScroll),this.scrollEl=this.getScrollElement(i),this.addScrollEventListener())},updateRange:function(t){t?this.handleUpdate(t.start,t.end):(t=this.range.start,t=Math.max(t,0),this.handleUpdate(t,this.getEndByStart(t)))},onItemResized:function(t,e){this.sizes.set(t,e),this.calcType===g?(this.calcType=y,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=v,this.calcSize.fixed=void 0),this.calcType!==y&&(this.calcSize.total=r(this.sizes.values()).reduce(function(t,e){return t+e},0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},onSlotResized:function(t,e){this.calcSize[t]=e},addScrollEventListener:function(){this.options.scroller&&l.utils.on(this.options.scroller,"scroll",this.onScroll)},removeScrollEventListener:function(){this.options.scroller&&l.utils.off(this.options.scroller,"scroll",this.onScroll)},updateOnScrollFunction:function(){var t=this,e=this.options,i=e.debounceTime,e=e.throttleTime;this.onScroll=i?c(function(){return t.handleScroll()},i):e?a(function(){return t.handleScroll()},e):function(){return t.handleScroll()}},handleScroll:function(){var t=this.getOffset(),e=this.getClientSize(),i=this.getScrollSize(),n=(t===this.offset?this.direction=w:this.direction=t<this.offset?S:b,this.offset=t,this.isFront()&&t<=0),i=this.isBehind()&&i<=e+t;this.options.onScroll({top:n,bottom:i,offset:t,direction:this.direction}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()},handleScrollFront:function(){var t=this.getScrollItems();t>this.range.start||(t=Math.max(t-this.options.buffer,0),this.checkIfUpdate(t,this.getEndByStart(t)))},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,i,n=0,o=this.options.uniqueKeys.length;n<=o;){if(e=n+Math.floor((o-n)/2),(i=this.getOffsetByIndex(e))===t)return e;i<t?n=e+1:t<i&&(o=e-1)}return 0<n?--n: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(d({},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,t=t.keeps;return 0<e.length?e.length-1:t-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?(this.useWindowScroll=!0,document.scrollingElement||document.documentElement||document.body):(this.useWindowScroll=!1,t)},getScrollStartOffset:function(){var t=this.calcSize.header;if(this.useWindowScroll&&this.options.wrapper)for(var e=this.options.wrapper;t+=e[O[this.options.direction]],(e=e.offsetParent)&&e!==this.options.wrapper.ownerDocument;);return t}};var _={inject:["virtualList"],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.virtualList[this.event](this.dataKey,this.getCurrentSize())},getCurrentSize:function(){return this.$el?this.$el[this.sizeKey]:0}}},D=t.component("virtual-draglist-items",{mixins:[_],props:i,render:function(t){var e=this.tag,i=this.dataKey;return t(e,{key:i,attrs:{"data-key":i}},this.$slots.default)}}),C=t.component("virtual-draglist-slots",{mixins:[_],props:i,render:function(t){var e=this.tag,i=this.dataKey;return t(e,{key:i,attrs:{role:i}},this.$slots.default)}});return t.component("virtual-drag-list",{model:{prop:"dataSource",event:"updateDataSource"},props:e,data:function(){return{list:[],start:0,range:{start:0,end:0,front:0,behind:0},virtual:null,sortable:null,lastLength:null,uniqueKeys:[]}},provide:function(){return{virtualList:this}},computed:{isHorizontal:function(){return"vertical"!==this.direction},itemSizeKey:function(){return this.isHorizontal?"offsetWidth":"offsetHeight"},virtualAttributes:function(){var i=this;return m.reduce(function(t,e){return t[e]=i[e],t},{})},sortableAttributes:function(){var i=this;return u.reduce(function(t,e){return t[e]=i[e],t},{})}},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){t=this.uniqueKeys.indexOf(t);-1<t&&this.virtual.scrollToIndex(t)},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=r(this.list);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&&(0<(e=this.list.length-this.lastLength)&&this.scrollToIndex(e),this.lastLength=null)},_initVirtual:function(){var e=this;this.virtual=new I({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(t){e.lastLength=null,e.list.length&&t.top?e._handleToTop():t.bottom&&e._handleToBottom()},onUpdate:function(t){l.dragged&&t.start!==e.range.start&&(e.sortable.reRendered=!0),e.range=t}})},_initSortable:function(){var e=this;this.sortable=new p(this.$refs.groupRef,d(d({list:this.list,dataKey:this.dataKey},this.sortableAttributes),{},{onDrag:function(t){e.start=e.range.start,e.$emit("drag",t)},onAdd:function(t){e.$emit("add",t)},onRemove:function(t){e.$emit("remove",t)},onDrop:function(t){t.list.length===e.list.length&&e.start<e.range.start&&(e.range.front+=l.clone[e.itemSizeKey],e.start=e.range.start),e.$emit("updateDataSource",t.list),e.$emit("drop",t)}}))},_updateRange:function(t,e){var i=d({},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)),this.virtual.updateRange(i)},_scrolledToBottom:function(){var t=this.getOffset(),e=this.getClientSize();return this.getScrollSize()<=t+e+1},_handleToTop:c(function(){this.$emit("top"),this.lastLength=this.list.length}),_handleToBottom:c(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)},_onSlotResized:function(t,e){this.virtual.onSlotResized(t,e)},_updateUniqueKeys:function(){var e=this;this.uniqueKeys=this.list.map(function(t){return f(t,e.dataKey)}),this.virtual.option("uniqueKeys",this.uniqueKeys)},_getItemStyle:function(t){return t==(null==(t=l.dragged)?void 0:t.dataset.key)?{display:"none"}:{}},_renderSlots:function(t,e,i){var n=this.itemSizeKey,o=this.$slots[e],s=d({},this.headerStyle),r=d({},this.footerStyle);return o?t(C,{props:{tag:i,dataKey:e,sizeKey:n,event:"_onSlotResized"},style:"header"===e?s:"footer"===e?r:void 0},o):null},_renderItems:function(t){for(var e=[],i=this.range,n=i.start,o=i.end,s=this.itemTag,r=this.itemClass,l=this.itemSizeKey,a=n;a<=o;a++){var c,h,u=this.list[a];u&&(c=f(u,this.dataKey),h=d(d({},this.itemStyle),this._getItemStyle(c)),e.push(this.$scopedSlots.item?t(D,{key:c,props:{dataKey:c,tag:s,sizeKey:l,event:"_onItemResized"},style:h,class:r},this.$scopedSlots.item({record:u,index:a,dataKey:c})):null))}return e}},render:function(t){var e=this.virtual.useWindowScroll,i=this.range,n=i.front,i=i.behind,o=this.isHorizontal,s=this.headerTag,r=this.footerTag,l=this.rootTag,a=this.wrapTag,c=this.wrapClass,n=d(d({},this.wrapStyle),{},{padding:o?"0px ".concat(i,"px 0px ").concat(n,"px"):"".concat(n,"px 0px ").concat(i,"px")});return t(l,{ref:"rootRef",style:!e&&{overflow:o?"auto hidden":"hidden auto"}},[this._renderSlots(t,"header",s),t(a,{ref:"groupRef",class:c,style:n},this._renderItems(t)),this._renderSlots(t,"footer",r)])}})});
{
"name": "vue-virtual-draglist",
"version": "2.8.3",
"version": "2.8.4",
"description": "A virtual scrolling list component that can be sorted by dragging",

@@ -12,3 +12,4 @@ "main": "dist/virtual-drag-list.min.js",

"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup --config"
"build": "rollup --config",
"updateSubtree": "git subtree pull --prefix=src/core https://github.com/mfuu/virtual-dnd-list-core.git master --squash"
},

@@ -15,0 +16,0 @@ "repository": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc