vue-virtual-draglist
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -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="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}}t=e(t);function n(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function v(i){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var e,n;e=i,n=r[t=t],(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(r,t))})}return i}function O(){O=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},i=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,i){var r,o,a,s,e=e&&e.prototype instanceof f?e:f,e=Object.create(e.prototype),i=new S(i||[]);return u(e,"_invoke",{value:(r=t,o=n,a=i,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return _()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var i=n.method,r=e.iterator[i];if(void 0===r)return n.delegate=null,"throw"===i&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),h;i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,h;r=i.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(r,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function f(){}function d(){}function p(){}var e={},m=(o(e,i,function(){return this}),Object.getPrototypeOf),m=m&&m(m(x([]))),g=(m&&m!==t&&l.call(m,i)&&(e=m),p.prototype=f.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,i){function t(){return new s(function(t,e){!function e(t,n,i,r){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,i,r)},function(t){e("throw",t,i,r)}):s.resolve(n).then(function(t){o.value=t,i(o)},function(t){return e("throw",t,i,r)});r(t.arg)}(n,i,t,e)})}return e=e?e.then(t,t):t()}})}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function x(e){if(e){var n,t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:_}}function _(){return{value:void 0,done:!0}}return u(g,"constructor",{value:d.prototype=p,configurable:!0}),u(p,"constructor",{value:d,configurable:!0}),d.displayName=o(p,r,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,r,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,i,r){void 0===r&&(r=Promise);var o=new y(s(t,e,n,i),r);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(g),o(g,r,"Generator"),o(g,i,function(){return this}),o(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),i=[];for(e in n)i.push(e);return i.reverse(),function t(){for(;i.length;){var e=i.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var i=this;function t(t,e){return o.type="throw",o.arg=n,i.next=t,e&&(i.method="next",i.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e],o=r.completion;if("root"===r.tryLoc)return t("end");if(r.tryLoc<=this.prev){var a=l.call(r,"catchLoc"),s=l.call(r,"finallyLoc");if(a&&s){if(this.prev<r.catchLoc)return t(r.catchLoc,!0);if(this.prev<r.finallyLoc)return t(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return t(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return t(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&l.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}var o=(r=r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc?null:r)?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),w(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,i,r=this.tryEntries[e];if(r.tryLoc===t)return"throw"===(n=r.completion).type&&(i=n.arg,w(r)),i}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function l(t,e,n,i,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(i,r)}function u(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var i=s.apply(t,a);function r(t){l(i,e,n,r,o,"next",t)}function o(t){l(i,e,n,r,o,"throw",t)}r(void 0)})}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,s(i.key),i)}}function o(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var n;if(t)return"string"==typeof t?a(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(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 a(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}function s(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(n=n.call(t,e||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}var h={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},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]},delay:{type:Number,default:0},animation:{type:Number,default:150},autoScroll:{type:Boolean,default:!0},scrollThreshold:{type:Number,default:15},keepOffset:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},headerTag:{type:String,default:"div"},footerTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},itemStyle:{type:Object},itemClass:{type:String,default:""},disabled:{type:Boolean,default:!1},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},f={tag:{type:String,default:"div"},event:{type:String},dataKey:{type:[String,Number]},isHorizontal:{type:Boolean}};function y(o,t,e){function n(){for(var t,e=this,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return u&&clearTimeout(u),l?(t=!u,u=setTimeout(function(){u=null},s),t&&(a=o.apply(this,i))):u=setTimeout(function(){o.apply(e,i)},s),a}var a,s=1<arguments.length&&void 0!==t?t:50,l=2<arguments.length&&void 0!==e&&e,u=null;return n.cancel=function(){clearTimeout(u),u=null},n}function b(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce(function(t,e){return(t||{})[e]},t)}var d={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(){var t=this.isHorizontal?"offsetWidth":"offsetHeight";return this.$el?this.$el[t]:0}}},w=t.default.component("virtual-draglist-items",{mixins:[d],props:f,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{"data-key":n}},this.$slots.default)}}),S=t.default.component("virtual-draglist-slots",{mixins:[d],props:f,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{role:n}},this.$slots.default)}}),p=o(function t(){i(this,t),this.start=0,this.end=0,this.front=0,this.behind=0}),m=o(function t(){i(this,t),this.average=void 0,this.total=void 0,this.fixed=void 0,this.header=void 0,this.footer=void 0}),g="INIT",x="FIXED",_="DYNAMIC",T="FRONT",E="BEHIND";function D(t,e){this.options=t,this.callback=e,this.sizes=new Map,this.isHorizontal=t.isHorizontal,this.calcIndex=0,this.calcType=g,this.calcSize=new m,this.direction="",this.offset=0,this.range=new p,t&&this.checkIfUpdate(0,t.keeps-1)}D.prototype={constructor:D,updateUniqueKeys:function(t){this.options.uniqueKeys=t},updateSizes:function(n){var i=this;this.sizes.forEach(function(t,e){n.includes(e)||i.sizes.delete(e)})},updateRange:function(){var t=this,e=Math.max(this.range.start,0),n=Math.min(this.options.keeps,this.options.uniqueKeys.length);this.sizes.size>=n-1?this.handleUpdate(e,this.getEndByStart(e)):window.requestAnimationFrame?window.requestAnimationFrame(function(){return t.updateRange()}):setTimeout(function(){return t.updateRange()},3)},handleScroll:function(t){this.direction=t<this.offset?T:E,this.offset=t;t=this.getScrollItems(t);this.isFront()?this.handleScrollFront(t):this.isBehind()&&this.handleScrollBehind(t)},isFront:function(){return this.direction===T},isBehind:function(){return this.direction===E},isFixed:function(){return this.calcType===x},getScrollItems:function(t){var e=this.calcSize,n=e.fixed,e=e.header;if(e&&(t-=e),t<=0)return 0;if(this.isFixed())return Math.floor(t/n);for(var i,r,o=0,a=this.options.uniqueKeys.length;o<=a;){if(i=o+Math.floor((a-o)/2),(r=this.getOffsetByIndex(i))===t)return i;r<t?o=i+1:t<r&&(a=i-1)}return 0<o?--o:0},handleScrollFront:function(t){t>this.range.start||(t=Math.max(t-Math.round(this.options.keeps/3),0),this.checkIfUpdate(t,this.getEndByStart(t)))},handleScrollBehind:function(t){t<this.range.start+Math.round(this.options.keeps/3)||this.checkIfUpdate(t,this.getEndByStart(t))},checkIfUpdate:function(t,e){var n=this.options,i=n.uniqueKeys,n=n.keeps;i.length<=n?(t=0,e=i.length-1):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.callback(v({},this.range))},getFrontOffset:function(){return this.isFixed()?this.calcSize.fixed*this.range.start:this.getOffsetByIndex(this.range.start)},getBehindOffset:function(){var t=this.getLastIndex();return this.isFixed()?(t-this.range.end)*this.calcSize.fixed:this.calcIndex===t?this.getOffsetByIndex(t)-this.getOffsetByIndex(this.range.end):(t-this.range.end)*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 this.calcIndex=Math.max(this.calcIndex,t-1),this.calcIndex=Math.min(this.calcIndex,this.getLastIndex()),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},handleItemSizeChange:function(t,e){this.sizes.set(t,e),this.calcType===g?(this.calcType=x,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=_,this.calcSize.fixed=void 0),this.calcType!==x&&(this.calcSize.total=c(this.sizes.values()).reduce(function(t,e){return t+e},0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},handleHeaderSizeChange:function(t){this.calcSize.header=t},handleFooterSizeChange:function(t){this.calcSize.footer=t}};(function(t){t.exports=function(){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(t){"@babel/helpers - typeof";return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e,n){e=A(e);if(e in t)Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true});else t[e]=n;return t}function B(t,e){if(typeof t!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==undefined){var i=n.call(t,e||"default");if(typeof i!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function A(t){var e=B(t,"string");return typeof e==="symbol"?e:String(e)}var H={capture:false,passive:false},R=/\s+/g,n={start:["pointerdown","touchstart","mousedown"],move:["pointermove","touchmove","mousemove"],end:["pointerup","pointercancel","touchend","touchcancel","mouseup"]};function t(t){if(typeof window!=="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var v=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),q=t(/Edge/i),y=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i),$=function(){var t=false;document.addEventListener("checkIfSupportPassive",null,{get passive(){t=true;return true}});return t}(),Y=function(){if(typeof window==="undefined"||typeof document==="undefined")return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];var e=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||t.OLink===""&&["","o"])[1];switch(e){case"ms":return"ms";default:return e&&e.length?e[0].toUpperCase()+e.substr(1):""}}();function V(e){if(!e)return false;var t=document.createElement("div");try{t.appendChild(e.cloneNode(true));return e.nodeType==1?true:false}catch(t){return e==window||e==document}}function U(t,e){t.style["".concat(Y,"Transition")]=e?e==="none"?"none":"".concat(e):""}function X(t,e){t.style["".concat(Y,"TransitionDuration")]=e==null?"":"".concat(e,"ms")}function g(t,e){t.style["".concat(Y,"Transform")]=e?"".concat(e):""}function b(t,e,n){if(window.addEventListener)t.addEventListener(e,n,$||!v?H:false);else if(window.attachEvent)t.attachEvent("on"+e,n)}function i(t,e,n){if(window.removeEventListener)t.removeEventListener(e,n,$||!v?H:false);else if(window.detachEvent)t.detachEvent("on"+e,n)}function W(t){var e=t;var n=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t.pointerType&&t.pointerType==="touch"&&t;var i=n?document.elementFromPoint(n.clientX,n.clientY):t.target;if(n){e.clientX=n.clientX;e.clientY=n.clientY;e.pageX=n.pageX;e.pageY=n.pageY;e.screenX=n.screenX;e.screenY=n.screenY}return{touch:n,event:e,target:i}}function w(t){var e={top:0,left:0,height:t.offsetHeight,width:t.offsetWidth};var n=d();do{e.top+=t.offsetTop;e.left+=t.offsetLeft}while(t!==n&&(t=t.offsetParent));return e}function G(t,e){if(!t||!t.getBoundingClientRect)return d();var n=t;var i=false;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=O(n);if(n.clientWidth<n.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return d();if(i||e)return n;i=true}}}while(n=n.parentNode);return d()}function d(){var t=document.scrollingElement;if(t)return t.contains(document.body)?document:t;else return document}function _(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var n=arguments.length>2?arguments[2]:undefined;if(!t.getBoundingClientRect&&t!==window)return;var i,r,o,a,s,l,u;if(t!==window&&t.parentNode&&t!==d()){i=t.getBoundingClientRect();r=i.top;o=i.left;a=i.bottom;s=i.right;l=i.height;u=i.width;if(e.parent&&t.parentNode!==t.ownerDocument.body){var c,h=t.parentNode;while(h&&h.getBoundingClientRect&&h!==t.ownerDocument.body){c=h.getBoundingClientRect();if(c.height<l){r=c.top;o=c.left;a=c.bottom;s=c.right;l=c.height;u=c.width;return{top:r,left:o,bottom:a,right:s,width:u,height:l}}h=h.parentNode}}}else{r=0;o=0;a=window.innerHeight;s=window.innerWidth;l=window.innerHeight;u=window.innerWidth}if((e.block||e.relative)&&t!==window){n=n||t.parentNode;if(!v)do{if(n&&n.getBoundingClientRect&&(O(n,"transform")!=="none"||e.relative&&O(n,"position")!=="static")){var f=n.getBoundingClientRect();r-=f.top+parseInt(O(n,"border-top-width"));o-=f.left+parseInt(O(n,"border-left-width"));a=r+i.height;s=o+i.width;break}}while(n=n.parentNode)}return{top:r,left:o,bottom:a,right:s,width:u,height:l}}function J(t,e,n,i){if(t){n=n||document;do{if(e==null){var r=Array.prototype.slice.call(n.children);var o=r.indexOf(t);if(o>-1)return r[o];for(var a=0;a<r.length;a++)if(Z(t,r[a]))return r[a]}else if(e[0]===">"?t.parentNode===n&&x(t,e):x(t,e)||i&&t===n)return t}while(t=t.parentNode)}return null}function Z(t,e){if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16);if(e.contains&&t.nodeType===1)return e.contains(t)&&e!==t;while(t=t.parentNode)if(t===e)return true;return false}function Q(t,e,n){var i=t.lastElementChild;while(i&&(i===e||O(i,"display")==="none"||n&&!x(i,n)))i=i.previousElementSibling;return i||null}function S(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(R," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(R," ")}}function x(t,e){if(!e)return;e[0]===">"&&(e=e.substring(1));if(t)try{if(t.matches)return t.matches(e);else if(t.msMatchesSelector)return t.msMatchesSelector(e);else if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return false}return false}function tt(t,e){return t.top!==e.top||t.left!==e.left}function et(t,e){return t.top==e.top?t.left-e.left:t.top-e.top}function O(t,e,n){var i=t&&t.style;if(i)if(n===void 0){if(document.defaultView&&document.defaultView.getComputedStyle)n=document.defaultView.getComputedStyle(t,"");else if(t.currentStyle)n=t.currentStyle;return e===void 0?n:n[e]}else{if(!(e in i)&&e.indexOf("webkit")===-1)e="-webkit-"+e;i[e]=n+(typeof n==="string"?"":"px")}}function e(t){return setTimeout(t,0)}function nt(){return Number(Math.random().toString().slice(-3)+Date.now()).toString(32)}var l="Sortable"+Date.now(),it={sortable:null,nodes:[]},u=m({},it),c=m({},it),h={},rt=function t(){return{from:m({},u),to:m({},c)}};function ot(t){this.options=t||{};this.groupName=t.group.name}if(ot.prototype={allowDrag:function t(e){return this.options.multiple&&h[this.groupName]&&h[this.groupName].length&&h[this.groupName].indexOf(e)>-1},getHelper:function t(){var r=document.createElement("div");h[this.groupName].forEach(function(t,e){var n=t.cloneNode(true);var i=e===0?1:.5;n.style="\n opacity: ".concat(i,";\n position: absolute;\n z-index: ").concat(e,";\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n ");r.appendChild(n)});return r},select:function t(e,n,i){if(!n)return;if(!h[this.groupName])h[this.groupName]=[];var r=h[this.groupName].indexOf(n);S(n,this.options.selectedClass,r<0);var o=m(m({},i),{},{event:e});if(r<0){h[this.groupName].push(n);i.sortable._dispatchEvent("onSelect",o)}else{h[this.groupName].splice(r,1);i.sortable._dispatchEvent("onDeselect",o)}h[this.groupName].sort(function(t,e){return et(w(t),w(e))})},onDrag:function t(e){u.sortable=e;u.nodes=h[this.groupName].map(function(t){return{node:t,rect:_(t),offset:w(t)}});c.sortable=e},onTrulyStarted:function t(e,n){n.animator.collect(e,null,e.parentNode);h[this.groupName].forEach(function(t){if(t==e)return;t.parentNode.removeChild(t)});n.animator.animate()},onChange:function t(e,n){var i=_(e);var r=w(e);c.sortable=n;c.nodes=h[this.groupName].map(function(t){return{node:t,rect:i,offset:r}})},onDrop:function t(e,i,n,r){var o=this;c.sortable.animator.collect(i,null,i.parentNode);var a=h[this.groupName].indexOf(i);h[this.groupName].forEach(function(t,e){if(e<a)i.parentNode.insertBefore(t,i);else{var n=e>0?h[o.groupName][e-1]:i;i.parentNode.insertBefore(t,n.nextSibling)}});u.sortable=n.sortable;c.nodes=h[this.groupName].map(function(t){return{node:t,rect:_(t),offset:w(t)}});var s=this._offsetChanged(u.nodes,c.nodes);var l=m(m({},r()),{},{changed:s,event:e});if(c.sortable.el!=u.sortable.el)u.sortable._dispatchEvent("onDrop",l);c.sortable._dispatchEvent("onDrop",l);c.sortable.animator.animate()},_offsetChanged:function t(e,n){return!!e.find(function(e){var t=n.find(function(t){return t.node===e.node});return tt(t.offset,e.offset)})}},!window.requestAnimationFrame)window.requestAnimationFrame=function(t){return setTimeout(t,17)};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(t){clearTimeout(t)};function at(){this.autoScrollAnimationFrame=null;this.speed={x:10,y:10}}function st(t){this.options=t;this.animations=[]}function lt(){this.helper=null}at.prototype={clear:function t(){if(this.autoScrollAnimationFrame==null)return;cancelAnimationFrame(this.autoScrollAnimationFrame);this.autoScrollAnimationFrame=null},update:function t(e,n,i,r){var o=this;cancelAnimationFrame(this.autoScrollAnimationFrame);this.autoScrollAnimationFrame=requestAnimationFrame(function(){if(i&&r)o.autoScroll(e,n,r);o.update(e,n,i,r)})},autoScroll:function t(e,n,i){if(!e)return;var r=i.clientX,o=i.clientY;if(r===void 0||o===void 0)return;var a=_(e);if(!a)return;var s=e.scrollTop,l=e.scrollLeft,u=e.scrollHeight,c=e.scrollWidth;var h=a.top,f=a.right,d=a.bottom,p=a.left,m=a.height,g=a.width;if(o<h||r>f||o>d||r<p)return;var v=s>0&&o>=h&&o<=h+n;var y=l>0&&r>=p&&r<=p+n;var b=l+g<c&&r<=f&&r>=f-n;var w=s+m<u&&o<=d&&o>=d-n;var S=0,x=0;if(y)S=Math.floor(Math.max(-1,(r-p)/n-1)*this.speed.x);else if(b)S=Math.ceil(Math.min(1,(r-f)/n+1)*this.speed.x);else S=0;if(v)x=Math.floor(Math.max(-1,(o-h)/n-1)*this.speed.y);else if(w)x=Math.ceil(Math.min(1,(o-d)/n+1)*this.speed.y);else x=0;if(x)e.scrollTop+=x;if(S)e.scrollLeft+=S}},st.prototype={collect:function t(e,n,i,r){var o=this;if(!i)return;var a=Array.prototype.slice.call(i.children);var s=this._getRange(a,e,n,r),l=s.start,u=s.end;this.animations.length=0;a.slice(l,u+1).forEach(function(t){if(t===r||t===M.helper)return;o.animations.push({node:t,rect:_(t)})})},animate:function t(){var i=this;this.animations.forEach(function(t){var e=t.node,n=t.rect;i._excute(e,n)})},_excute:function t(e,n){var i=n.left,r=n.top;var o=_(e);var a=r-o.top;var s=i-o.left;X(e);g(e,"translate3d(".concat(s,"px, ").concat(a,"px, 0)"));e.offsetWidth;var l=this.options.animation;X(e,l);g(e,"translate3d(0px, 0px, 0px)");clearTimeout(e.animated);e.animated=setTimeout(function(){X(e);g(e,"");e.animated=null},l)},_getRange:function t(e,n,i){var r=e.indexOf(n);var o=e.indexOf(i);if(r>o){var a=[o,r];r=a[0];o=a[1]}if(r<0){r=o;o=e.length-1}if(o<0)o=e.length-1;return{start:r,end:o}}},lt.prototype={get node(){return this.helper},destroy:function t(){if(this.helper&&this.helper.parentNode)this.helper.parentNode.removeChild(this.helper);this.helper=null},move:function t(e,n){g(this.helper,"translate3d(".concat(e,"px, ").concat(n,"px, 0)"))},init:function t(e,n,i,r,o){if(this.helper)return;var a=r.fallbackOnBody,s=r.ghostClass,l=r.ghostStyle,u=l===void 0?{}:l;var c=a?document.body:i;this.helper=n.cloneNode(true);S(this.helper,s,true);var h=m({"box-sizing":"border-box",top:e.top,left:e.left,width:e.width,height:e.height,position:"fixed",opacity:"0.8","z-index":1e5,"pointer-events":"none"},u);for(var f in h)O(this.helper,f,h[f]);U(this.helper,"none");g(this.helper,"translate3d(0px, 0px, 0px)");c.appendChild(this.helper);var d=o.x/parseInt(this.helper.style.width)*100;var p=o.y/parseInt(this.helper.style.height)*100;O(this.helper,"transform-origin","".concat(d,"% ").concat(p,"%"));O(this.helper,"transform","translateZ(0)")}};var ut={sortable:null,group:null,node:null,rect:{},offset:{}},f=[],p,T,E,D,z,I,L,ct,C,N,k=new lt,j=m({},ut),P=m({},ut),ht={x:0,y:0},a={x:0,y:0},ft=function t(e,n){var i={};var r=e.group;if(!r||o(r)!="object")r={name:r,pull:true,put:true};i.name=r.name||n;i.pull=r.pull;i.put=r.put;e.group=i},F=function t(e){if(T){var n=e.touches?e.touches[0]:e;var i=dt(n.clientX,n.clientY);if(i){p=i;if(p===D.sortable.el)return;i[l]._onMove(e)}}},dt=function t(o,a){var s;f.some(function(t){var e=t[l].options.emptyInsertThreshold;if(!e)return;var n=_(t,{parent:true}),i=o>=n.left-e&&o<=n.right+e,r=a>=n.top-e&&a<=n.bottom+e;if(i&&r)return s=t});return s},pt=function t(e){var n=e.clientX,i=e.clientY;var r=n-a.x;var o=i-a.y;a.x=n;a.y=i;if(n!==void 0&&i!==void 0&&Math.abs(r)<=0&&Math.abs(o)<=0)return false;return true},K=function t(){var e={from:m({},j),to:m({},P)};if(L){var n=rt();e.from=m(m({},n.from),e.from);e.to=m(m({},n.to),e.to)}return e};function M(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));t[l]=this;this.el=t;this.ownerDocument=t.ownerDocument;this.options=e=Object.assign({},e);var n={group:"",animation:150,multiple:false,draggable:null,handle:null,onDrag:null,onMove:null,onDrop:null,onChange:null,autoScroll:true,scrollThreshold:25,delay:0,delayOnTouchOnly:false,disabled:false,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",fallbackOnBody:false,stopPropagation:false,supportPointer:"onpointerdown"in window&&!y,supportTouch:"ontouchstart"in window,emptyInsertThreshold:5};for(var i in n)!(i in this.options)&&(this.options[i]=n[i]);ft(e,"group_"+nt());for(var r in this)if(r.charAt(0)==="_"&&typeof this[r]==="function")this[r]=this[r].bind(this);var o=this.options,a=o.supportPointer,s=o.supportTouch;if(a)b(t,"pointerdown",this._onDrag);else if(s)b(t,"touchstart",this._onDrag);else b(t,"mousedown",this._onDrag);f.push(t);this.multiplayer=new ot(this.options);this.animator=new st(this.options);C=new at}return(M.prototype={constructor:M,get helper(){return k.node},destroy:function t(){this._dispatchEvent("destroy",this);this.el[l]=null;for(var e=0;e<n.start.length;e++)i(this.el,n.start[e],this._onDrag);this._clearState();f.splice(f.indexOf(this.el),1);if(f.length==0)C=null;this.el=null},_onDrag:function t(e){var n=this;if(this.options.disabled||!this.options.group.pull)return;if(/mousedown|pointerdown/.test(e.type)&&e.button!==0)return;var i=W(e),r=i.touch,o=i.event,a=i.target;if(y&&a&&a.tagName.toUpperCase()==="SELECT")return;if(a===this.el)return;var s=this.options,l=s.draggable,u=s.handle;if(typeof u==="function"&&!u(e))return;if(typeof u==="string"&&!x(a,u))return;if(typeof l==="function"){var c=l(e);if(!c)return;if(V(c))T=c}else T=J(a,l,this.el,false);if(!T||T.animated)return;if(r)O(T,"touch-action","none");var h=T.parentNode;I=r;D=o;D.sortable=this;D.group=h;L=this.options.multiple&&this.multiplayer.allowDrag(T);L&&this.multiplayer.onDrag(this);var f=_(T);var d=w(T);j={sortable:this,group:h,node:T,rect:f,offset:d};P.group=h;P.sortable=this;ht={x:o.clientX-f.left,y:o.clientY-f.top};if(this.options.supportPointer)b(this.ownerDocument,"pointermove",F);else if(r)b(this.ownerDocument,"touchmove",F);else b(this.ownerDocument,"mousemove",F);var p=this.options,m=p.delay,g=p.delayOnTouchOnly;if(m&&(!g||r)&&!(q||v)){if(this.options.supportPointer)b(this.ownerDocument,"pointerup",this._onDrop);else if(I)b(this.ownerDocument,"touchend",this._onDrop);else b(this.ownerDocument,"mouseup",this._onDrop);clearTimeout(N);N=setTimeout(function(){return n._onStart()},m)}else this._onStart()},_onStart:function t(){p=this.el;if(this.options.supportPointer){b(this.ownerDocument,"pointermove",this._onMove);b(this.ownerDocument,"pointerup",this._onDrop);b(this.ownerDocument,"pointercancel",this._onDrop)}else if(I){b(this.ownerDocument,"touchmove",this._onMove);b(this.ownerDocument,"touchend",this._onDrop);b(this.ownerDocument,"touchcancel",this._onDrop)}else{b(this.ownerDocument,"mousemove",this._onMove);b(this.ownerDocument,"mouseup",this._onDrop)}try{if(document.selection)e(function(){document.selection.empty()});else window.getSelection().removeAllRanges()}catch(t){}},_onTrulyStarted:function t(){if(!z){this._dispatchEvent("onDrag",m(m({},K()),{},{event:D}));L&&this.multiplayer.onTrulyStarted(T,this);var e=L?this.multiplayer.getHelper():T;k.init(j.rect,e,this.el,this.options,ht);M.helper=k.node;S(T,this.options.chosenClass,true);O(T,"will-change","transform");y&&O(document.body,"user-select","none")}},_allowPut:function t(){if(D.group===this.el)return true;else if(!this.options.group.put)return false;else{var e=this.options.group.name;var n=D.sortable.options.group;return n.name&&e&&n.name===e}},_onMove:function t(e){this._preventEvent(e);if(!D||!T)return;if(!pt(e))return;var n=W(e),i=n.event,r=n.target;this._onTrulyStarted();z=i;var o=e.clientX-D.clientX;var a=e.clientY-D.clientY;k.move(o,a);this._dispatchEvent("onMove",m(m({},K()),{},{event:i}));if(!this.scrollEl)this.scrollEl=G(this.el,true);var s=this.options,l=s.autoScroll,u=s.scrollThreshold;if(l)C.update(this.scrollEl,u,D,z);if(!this._allowPut())return;E=J(r,this.options.draggable,p,false);if(E){if(E===ct)return;ct=E;if(E.animated||Z(E,T))return}if(E===T)return;if(p!==j.sortable.el){if(r===p||!Q(p,k.node))this._onInsert(i,true);else if(E)this._onInsert(i,false)}else if(E)this._onChange(i)},_onInsert:function t(e,n){var i=n?T:E;var r=n?p:E.parentNode;j.sortable.animator.collect(T,null,T.parentNode,T);this.animator.collect(null,i,r,T);L&&this.multiplayer.onChange(T,this);P={sortable:this,group:r,node:i,rect:_(T),offset:w(T)};j.sortable._dispatchEvent("onRemove",m(m({},K()),{},{event:e}));if(n)r.appendChild(T);else r.insertBefore(T,i);this._dispatchEvent("onAdd",m(m({},K()),{},{event:e}));j.sortable.animator.animate();this.animator.animate();j.group=r;j.sortable=this},_onChange:function t(e){var n=E.parentNode;this.animator.collect(T,E,n);L&&this.multiplayer.onChange(T,this);P={sortable:this,group:n,node:E,rect:_(E),offset:w(E)};this._dispatchEvent("onChange",m(m({},K()),{},{event:e}));var i=w(T);var r=null;if(i.top===P.offset.top)r=i.left<P.offset.left?E.nextSibling:E;else r=i.top<P.offset.top?E.nextSibling:E;n.insertBefore(T,r);this.animator.animate();j.group=n;j.sortable=this},_onDrop:function t(e){this._unbindMoveEvents();this._unbindDropEvents();this._preventEvent(e);C.clear();clearTimeout(N);if(T){S(T,this.options.chosenClass,false);I&&O(T,"touch-action","");O(T,"will-change","")}if(T&&D&&z)this._onEnd(e);else if(this.options.multiple)this.multiplayer.select(e,T,m({},j));this._clearState()},_onEnd:function t(e){j.group=D.group;j.sortable=D.sortable;if(L)this.multiplayer.onDrop(e,T,D,K);else{P.rect=_(T);P.offset=w(T);var n=tt(j.offset,P.offset);var i=m(m({},K()),{},{changed:n,event:e});if(P.sortable.el!==j.sortable.el)j.sortable._dispatchEvent("onDrop",i);P.sortable._dispatchEvent("onDrop",i)}y&&O(document.body,"user-select","")},_preventEvent:function t(e){e.preventDefault!==void 0&&e.cancelable&&e.preventDefault();if(this.options.stopPropagation)if(e&&e.stopPropagation)e.stopPropagation();else window.event.cancelBubble=true},_dispatchEvent:function t(e,n){var i=this.options[e];if(typeof i==="function")i(n)},_clearState:function t(){T=E=D=z=I=L=ct=N=M.ghost=null;ht=a={x:0,y:0};j=P=m({},ut);k.destroy()},_unbindMoveEvents:function t(){for(var e=0;e<n.move.length;e++){i(this.ownerDocument,n.move[e],this._onMove);i(this.ownerDocument,n.move[e],F)}},_unbindDropEvents:function t(){for(var e=0;e<n.end.length;e++)i(this.ownerDocument,n.end[e],this._onDrop)}}).utils={getRect:_,getOffset:w},M}()})(d={exports:{}});var z=d.exports,I="virtualSortableState",L={from:{},to:{}};function C(){}C.prototype={constructor:C,clear:function(){localStorage.removeItem(I)},getStore:function(){try{return JSON.parse(localStorage.getItem(I))||L}catch(t){return L}},getValue:function(){return new Promise(function(t,e){try{t(JSON.parse(localStorage.getItem(I))||L)}catch(t){e(L)}})},setValue:function(r){return new Promise(function(t,e){try{var n=JSON.parse(localStorage.getItem(I)),i=JSON.stringify(v(v({},n),r));localStorage.setItem(I,i),t(i)}catch(t){e(L)}})}};var N=new C,k=["group","handle","disabled","draggable","ghostClass","ghostStyle","chosenClass","animation","autoScroll","scrollThreshold"],j=null;function P(t,e){this.context=t,this.callback=e,this.initialList=c(t.list),this.dynamicList=c(t.list),this.sortable=null,this.rangeChanged=!1,this._init()}return P.prototype={constructor:P,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=null},setValue:function(t,e){"list"===t?(this.initialList=c(e),j&&this._onDrag(j,!1)):(this.context[t]=e,this.sortable.options[t]=e)},_init:function(){var i=this,t=k.reduce(function(t,e){return t[e]=i.context[e],t},{});this.sortable=new z(this.context.$refs.group,v(v({},t),{},{fallbackOnBody:!0,list:this.dynamicList,onDrag:function(t){t=t.from;return i._onDrag(t.node)},onAdd:function(t){var e=t.from,t=t.to;return i._onAdd(e,t)},onRemove:function(t){var e=t.from,t=t.to;return i._onRemove(e,t)},onChange:function(t){var e=t.from,t=t.to;return i._onChange(e,t)},onDrop:function(t){var e=t.from,n=t.to,t=t.changed;return i._onDrop(e,n,t)}}))},_onDrag:function(r){var o=arguments,a=this;return u(O().mark(function t(){var e,n,i;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=!(1<o.length&&void 0!==o[1])||o[1],j=r,a.dynamicList=c(a.initialList),n=c(a.initialList),i=a._getFromTo({node:r},n),t.next=7,N.setValue({from:v({list:n},i)});case 7:if(e)return a.rangeChanged=!1,t.next=11,N.getValue();t.next=15;break;case 11:i=t.sent,a.context.$emit("drag",v({list:n},i)),t.next=16;break;case 15:a.rangeChanged=!0;case 16:case"end":return t.stop()}},t)}))()},_onAdd:function(r,o){var a=this;return u(O().mark(function t(){var e,n,i;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,N.getValue();case 2:e=t.sent,n=c(a.dynamicList),n=a._getIndex(n,o.node.dataset.key),i=v(v({},e.from),{},{index:n}),r.node===o.node?(i.index=a.dynamicList.length,a.dynamicList.push(e.from.item)):a.dynamicList.splice(n,0,e.from.item),a.context.$emit("add",v({},i));case 8:case"end":return t.stop()}},t)}))()},_onRemove:function(n,t){var i=this;return u(O().mark(function t(){var e;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=c(i.dynamicList),e=i._getFromTo(n,e),i.dynamicList.splice(e.index,1),i.context.$emit("remove",v({},e));case 4:case"end":return t.stop()}},t)}))()},_onChange:function(i,r){var o=this;return u(O().mark(function t(){var e,n;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=c(o.dynamicList),n=c(o.dynamicList),e=o._getFromTo(i,e),n=o._getFromTo(r,n),o.dynamicList.splice(e.index,1),o.dynamicList.splice(n.index,0,e.item);case 6:case"end":return t.stop()}},t)}))()},_onDrop:function(o,a,s){var l=this;return u(O().mark(function t(){var e,n,i,r;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(l.rangeChanged||o.sortable!==a.sortable)&&j&&j.remove(),e=c(l.dynamicList),i=l._getIndex(e,o.node.dataset.key),r=l.initialList[i],n=b(r,l.context.dataKey),t.next=7,N.setValue({to:{list:c(l.initialList),index:i,item:r,key:n}});case 7:return t.next=9,N.getValue();case 9:i=t.sent,r=v(v({list:e},i),{},{changed:s}),l.context.$emit("drop",r),l.callback&&l.callback(r),l.initialList=c(e),l._clear();case 15:case"end":return t.stop()}},t)}))()},_getFromTo:function(t,e){var t=t.node.dataset.key,n=this._getIndex(e,t);return{key:t,item:e[n],index:n}},_getIndex:function(t,e){var n=this;return t.findIndex(function(t){return b(t,n.context.dataKey)==e})},_clear:function(){j=null,N.clear(),this.rangeChanged=!1}},t.default.component("virtual-drag-list",{props:h,data:function(){return{list:[],uniqueKeys:[],virtual:null,sortable:null,lastItem:null,range:new p}},provide:function(){return{virtualList:this}},computed:{isHorizontal:function(){return"vertical"!==this.direction},scrollSizeKey:function(){return this.isHorizontal?"scrollWidth":"scrollHeight"},scrollDirectionKey:function(){return this.isHorizontal?"scrollLeft":"scrollTop"},offsetSizeKey:function(){return this.isHorizontal?"offsetLeft":"offsetTop"},clientSizeKey:function(){return this.isHorizontal?"clientWidth":"clientHeight"}},watch:{dataSource:{handler:function(t){this.init(t)},deep:!0,immediate:!0},disabled:{handler:function(t){this.sortable&&this.sortable.setValue("disabled",t)},immediate:!0}},created:function(){this.range.end=this.keeps-1},beforeDestroy:function(){this._destroySortable()},methods:{reset:function(){this.scrollToTop(),this.init(this.dataSource)},getSize:function(t){return this.virtual.sizes.get(t)},getOffset:function(){var t=this.$refs.root;return t?Math.ceil(t[this.scrollDirectionKey]):0},scrollToTop:function(){this.$refs.root[this.scrollDirectionKey]=0},scrollToBottom:function(){var t=this,e=this.$refs,n=e.bottomItem,i=e.root;n&&(e=n[this.offsetSizeKey],this.scrollToOffset(e),setTimeout(function(){t.getOffset()+Math.ceil(i[t.clientSizeKey])<Math.ceil(i[t.scrollSizeKey])&&t.scrollToBottom()},5))},scrollToIndex:function(t){var e,n=this;t>=this.list.length-1?this.scrollToBottom():(e=this.virtual.getOffsetByIndex(t),this.scrollToOffset(e),setTimeout(function(){n.getOffset()!==n.virtual.getOffsetByIndex(t)&&n.scrollToIndex(t)},5))},scrollToOffset:function(t){this.$refs.root[this.scrollDirectionKey]=t},init:function(t){var e=this;this.list=c(t),this._updateUniqueKeys(),this.virtual?(this.virtual.updateUniqueKeys(this.uniqueKeys),this.virtual.updateSizes(this.uniqueKeys),this.virtual.updateRange()):this._initVirtual(),this.sortable?this.sortable.setValue("list",c(t)):this.$nextTick(function(){return e._initSortable()}),this.lastItem&&this.keepOffset&&(t=this._getItemIndex(this.lastItem),this.scrollToIndex(t),this.lastItem=null)},_initVirtual:function(){var i=this;this.virtual=new D({size:this.size,keeps:this.keeps,uniqueKeys:this.uniqueKeys,isHorizontal:this.isHorizontal},function(t){var e,n;i.range=t,i.sortable&&(t=N.getStore(),e=(n=i.range).start,n=n.end,-1<(t=t.from.index))&&!(e<=t&&t<=n)&&(i.sortable.rangeChanged=!0)}),this.virtual.updateSizes(this.uniqueKeys),this.virtual.updateRange()},_initSortable:function(){var n=this;this.sortable=new P(this,function(t){var e=t.list;t.changed&&(n.sortable.rangeChanged&&n.virtual.direction&&0<n.range.start&&-1<(t=e.indexOf(n.list[n.range.start]))&&(n.range.start=t,n.range.end=t+n.keeps-1),n.list=[],n.$nextTick(function(){n.list=c(e),n._updateUniqueKeys(),n.virtual.updateUniqueKeys(n.uniqueKeys)}))})},_destroySortable:function(){this.sortable&&this.sortable.destroy(),this.sortable=null},_handleScroll:function(){var t=this.$refs.root,e=this.getOffset(),n=Math.ceil(t[this.clientSizeKey]),t=Math.ceil(t[this.scrollSizeKey]);!t||e<0||t+1<e+n||(this.virtual.handleScroll(e),this.virtual.isFront()?this.list.length&&e<=0&&this.handleToTop(this):this.virtual.isBehind()&&t<=n+e&&this.handleToBottom(this))},handleToTop:y(function(t){t.$emit("top"),t.lastItem=t.list[0]}),handleToBottom:y(function(t){t.$emit("bottom")}),_onItemResized:function(t,e){this.virtual.handleItemSizeChange(t,e)},_onHeaderResized:function(t,e){this.virtual.handleHeaderSizeChange(e)},_onFooterResized:function(t,e){this.virtual.handleFooterSizeChange(e)},_updateUniqueKeys:function(){var e=this;this.uniqueKeys=this.list.map(function(t){return b(t,e.dataKey)})},_getItemIndex:function(e){var n=this;return this.list.findIndex(function(t){return b(e,n.dataKey)==b(t,n.dataKey)})},_getItemStyle:function(t){var e=N.getStore().from.key;return this.sortable&&this.sortable.rangeChanged&&t==e?{display:"none"}:{}}},render:function(i){var r=this,t=this.$slots,e=t.header,t=t.footer,n=this.range,o=n.start,a=n.end,s=n.front,n=n.behind,l=this.isHorizontal,u=this.headerTag,c=this.footerTag,h=this.itemTag,f=this.rootTag,d=this.wrapTag,p=this.itemStyle,m=this.itemClass,g=this.wrapClass,s=v(v({},this.wrapStyle),{},{padding:l?"0px ".concat(n,"px 0px ").concat(s,"px"):"".concat(s,"px 0px ").concat(n,"px")});return i(f,{ref:"root",style:{overflow:l?"auto hidden":"hidden auto"},on:{"&scroll":y(this._handleScroll,this.delay)}},[e?i(S,{props:{tag:u,dataKey:"header",event:"_onHeaderResized"}},e):null,i(d,{ref:"group",attrs:{role:"group"},class:g,style:s},this.list.slice(o,a+1).map(function(t){var e=r._getItemIndex(t),n=b(t,r.dataKey);return r.$scopedSlots.item?i(w,{key:n,props:{isHorizontal:l,dataKey:n,tag:h,event:"_onItemResized"},style:v(v({},p),r._getItemStyle(n)),class:m},r.$scopedSlots.item({record:t,index:e,dataKey:n})):i(h,{key:n,attrs:{"data-key":n},style:v(v({},p),{},{height:"".concat(r.size,"px")}),class:m},n)})),t?i(S,{props:{tag:c,dataKey:"footer",event:"_onFooterResized"}},t):null,i("div",{ref:"bottomItem",style:{width:l?"0px":"100%",height:l?"100%":"0px"}})])}})}); | ||
!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}}t=e(t);function n(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function v(i){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var e,n;e=i,n=r[t=t],(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(r,t))})}return i}function O(){O=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},i=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{o({},"")}catch(t){o=function(t,e,n){return t[e]=n}}function s(t,e,n,i){var r,o,a,s,e=e&&e.prototype instanceof f?e:f,e=Object.create(e.prototype),i=new S(i||[]);return u(e,"_invoke",{value:(r=t,o=n,a=i,s="suspendedStart",function(t,e){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===t)throw e;return _()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var i=n.method,r=e.iterator[i];if(void 0===r)return n.delegate=null,"throw"===i&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),h;i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,h;r=i.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,a);if(n){if(n===h)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s="executing";n=c(r,o,a);if("normal"===n.type){if(s=a.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(s="completed",a.method="throw",a.arg=n.arg)}})}),e}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var h={};function f(){}function d(){}function p(){}var e={},g=(o(e,i,function(){return this}),Object.getPrototypeOf),g=g&&g(g(x([]))),m=(g&&g!==t&&l.call(g,i)&&(e=g),p.prototype=f.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){o(t,e,function(t){return this._invoke(e,t)})})}function y(a,s){var e;u(this,"_invoke",{value:function(n,i){function t(){return new s(function(t,e){!function e(t,n,i,r){var o,t=c(a[t],a,n);if("throw"!==t.type)return(n=(o=t.arg).value)&&"object"==typeof n&&l.call(n,"__await")?s.resolve(n.__await).then(function(t){e("next",t,i,r)},function(t){e("throw",t,i,r)}):s.resolve(n).then(function(t){o.value=t,i(o)},function(t){return e("throw",t,i,r)});r(t.arg)}(n,i,t,e)})}return e=e?e.then(t,t):t()}})}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function x(e){if(e){var n,t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(l.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:_}}function _(){return{value:void 0,done:!0}}return u(m,"constructor",{value:d.prototype=p,configurable:!0}),u(p,"constructor",{value:d,configurable:!0}),d.displayName=o(p,r,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,o(t,r,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(y.prototype),o(y.prototype,n,function(){return this}),a.AsyncIterator=y,a.async=function(t,e,n,i,r){void 0===r&&(r=Promise);var o=new y(s(t,e,n,i),r);return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},v(m),o(m,r,"Generator"),o(m,i,function(){return this}),o(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),i=[];for(e in n)i.push(e);return i.reverse(),function t(){for(;i.length;){var e=i.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var i=this;function t(t,e){return o.type="throw",o.arg=n,i.next=t,e&&(i.method="next",i.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e],o=r.completion;if("root"===r.tryLoc)return t("end");if(r.tryLoc<=this.prev){var a=l.call(r,"catchLoc"),s=l.call(r,"finallyLoc");if(a&&s){if(this.prev<r.catchLoc)return t(r.catchLoc,!0);if(this.prev<r.finallyLoc)return t(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return t(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return t(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&l.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}var o=(r=r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc?null:r)?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),w(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,i,r=this.tryEntries[e];if(r.tryLoc===t)return"throw"===(n=r.completion).type&&(i=n.arg,w(r)),i}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},a}function l(t,e,n,i,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(i,r)}function u(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var i=s.apply(t,a);function r(t){l(i,e,n,r,o,"next",t)}function o(t){l(i,e,n,r,o,"throw",t)}r(void 0)})}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,s(i.key),i)}}function o(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var n;if(t)return"string"==typeof t?a(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(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 a(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}function s(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(n=n.call(t,e||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}var h={dataSource:{type:Array,default:function(){return[]}},dataKey:{type:String,required:!0},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]},delay:{type:Number,default:0},animation:{type:Number,default:150},autoScroll:{type:Boolean,default:!0},scrollThreshold:{type:Number,default:15},keepOffset:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},headerTag:{type:String,default:"div"},footerTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},itemStyle:{type:Object},itemClass:{type:String,default:""},disabled:{type:Boolean,default:!1},ghostClass:{type:String,default:""},ghostStyle:{type:Object,default:function(){return{}}},chosenClass:{type:String,default:""}},f={tag:{type:String,default:"div"},event:{type:String},dataKey:{type:[String,Number]},isHorizontal:{type:Boolean}};function y(o,t,e){function n(){for(var t,e=this,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return u&&clearTimeout(u),l?(t=!u,u=setTimeout(function(){u=null},s),t&&(a=o.apply(this,i))):u=setTimeout(function(){o.apply(e,i)},s),a}var a,s=1<arguments.length&&void 0!==t?t:50,l=2<arguments.length&&void 0!==e&&e,u=null;return n.cancel=function(){clearTimeout(u),u=null},n}function b(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce(function(t,e){return(t||{})[e]},t)}var d={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(){var t=this.isHorizontal?"offsetWidth":"offsetHeight";return this.$el?this.$el[t]:0}}},w=t.default.component("virtual-draglist-items",{mixins:[d],props:f,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{"data-key":n}},this.$slots.default)}}),S=t.default.component("virtual-draglist-slots",{mixins:[d],props:f,render:function(t){var e=this.tag,n=this.dataKey;return t(e,{key:n,attrs:{role:n}},this.$slots.default)}}),p=o(function t(){i(this,t),this.start=0,this.end=0,this.front=0,this.behind=0}),g=o(function t(){i(this,t),this.average=void 0,this.total=void 0,this.fixed=void 0,this.header=void 0,this.footer=void 0}),m="INIT",x="FIXED",_="DYNAMIC",T="FRONT",E="BEHIND";function D(t,e){this.options=t,this.callback=e,this.sizes=new Map,this.isHorizontal=t.isHorizontal,this.calcIndex=0,this.calcType=m,this.calcSize=new g,this.direction="",this.offset=0,this.range=new p,t&&this.checkIfUpdate(0,t.keeps-1)}D.prototype={constructor:D,updateUniqueKeys:function(t){this.options.uniqueKeys=t},updateSizes:function(n){var i=this;this.sizes.forEach(function(t,e){n.includes(e)||i.sizes.delete(e)})},updateRange:function(){var t=this,e=this.range.start,n=(this.isFront()?e-=2:this.isBehind()&&(e+=2),Math.min(this.options.keeps,this.options.uniqueKeys.length));this.sizes.size>=n-2?this.handleUpdate(e,this.getEndByStart(e)):window.requestAnimationFrame?window.requestAnimationFrame(function(){return t.updateRange()}):setTimeout(function(){return t.updateRange()},3)},handleScroll:function(t){this.direction=t<this.offset?T:E,this.offset=t;t=this.getScrollItems(t);this.isFront()?this.handleScrollFront(t):this.isBehind()&&this.handleScrollBehind(t)},isFront:function(){return this.direction===T},isBehind:function(){return this.direction===E},isFixed:function(){return this.calcType===x},getScrollItems:function(t){var e=this.calcSize,n=e.fixed,e=e.header;if(e&&(t-=e),t<=0)return 0;if(this.isFixed())return Math.floor(t/n);for(var i,r,o=0,a=this.options.uniqueKeys.length;o<=a;){if(i=o+Math.floor((a-o)/2),(r=this.getOffsetByIndex(i))===t)return i;r<t?o=i+1:t<r&&(a=i-1)}return 0<o?--o:0},handleScrollFront:function(t){t>this.range.start||(t=Math.max(t-Math.round(this.options.keeps/3),0),this.checkIfUpdate(t,this.getEndByStart(t)))},handleScrollBehind:function(t){t<this.range.start+Math.round(this.options.keeps/3)||this.checkIfUpdate(t,this.getEndByStart(t))},checkIfUpdate:function(t,e){var n=this.options,i=n.uniqueKeys,n=n.keeps;i.length<=n?(t=0,e=i.length-1):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.callback(v({},this.range))},getFrontOffset:function(){return this.isFixed()?this.calcSize.fixed*this.range.start:this.getOffsetByIndex(this.range.start)},getBehindOffset:function(){var t=this.getLastIndex();return this.isFixed()?(t-this.range.end)*this.calcSize.fixed:this.calcIndex===t?this.getOffsetByIndex(t)-this.getOffsetByIndex(this.range.end):(t-this.range.end)*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 this.calcIndex=Math.max(this.calcIndex,t-1),this.calcIndex=Math.min(this.calcIndex,this.getLastIndex()),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},handleItemSizeChange:function(t,e){this.sizes.set(t,e),this.calcType===m?(this.calcType=x,this.calcSize.fixed=e):this.isFixed()&&this.calcSize.fixed!==e&&(this.calcType=_,this.calcSize.fixed=void 0),this.calcType!==x&&(this.calcSize.total=c(this.sizes.values()).reduce(function(t,e){return t+e},0),this.calcSize.average=Math.round(this.calcSize.total/this.sizes.size))},handleHeaderSizeChange:function(t){this.calcSize.header=t},handleFooterSizeChange:function(t){this.calcSize.footer=t}};(function(t){t.exports=function(){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(t){"@babel/helpers - typeof";return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e,n){e=A(e);if(e in t)Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true});else t[e]=n;return t}function M(t,e){if(typeof t!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==undefined){var i=n.call(t,e||"default");if(typeof i!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function A(t){var e=M(t,"string");return typeof e==="symbol"?e:String(e)}var H={capture:false,passive:false},R=/\s+/g,n={start:["pointerdown","touchstart","mousedown"],move:["pointermove","touchmove","mousemove"],end:["pointerup","pointercancel","touchend","touchcancel","mouseup"]};function t(t){if(typeof window!=="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var v=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),q=t(/Edge/i),y=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i),$=function(){var t=false;document.addEventListener("checkIfSupportPassive",null,{get passive(){t=true;return true}});return t}(),Y=function(){if(typeof window==="undefined"||typeof document==="undefined")return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];var e=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||t.OLink===""&&["","o"])[1];switch(e){case"ms":return"ms";default:return e&&e.length?e[0].toUpperCase()+e.substr(1):""}}();function V(e){if(!e)return false;var t=document.createElement("div");try{t.appendChild(e.cloneNode(true));return e.nodeType==1?true:false}catch(t){return e==window||e==document}}function U(t,e){t.style["".concat(Y,"Transition")]=e?e==="none"?"none":"".concat(e):""}function X(t,e){t.style["".concat(Y,"TransitionDuration")]=e==null?"":"".concat(e,"ms")}function m(t,e){t.style["".concat(Y,"Transform")]=e?"".concat(e):""}function b(t,e,n){if(window.addEventListener)t.addEventListener(e,n,$||!v?H:false);else if(window.attachEvent)t.attachEvent("on"+e,n)}function i(t,e,n){if(window.removeEventListener)t.removeEventListener(e,n,$||!v?H:false);else if(window.detachEvent)t.detachEvent("on"+e,n)}function W(t){var e=t;var n=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t.pointerType&&t.pointerType==="touch"&&t;var i=n?document.elementFromPoint(n.clientX,n.clientY):t.target;if(n){e.clientX=n.clientX;e.clientY=n.clientY;e.pageX=n.pageX;e.pageY=n.pageY;e.screenX=n.screenX;e.screenY=n.screenY}return{touch:n,event:e,target:i}}function w(t){var e={top:0,left:0,height:t.offsetHeight,width:t.offsetWidth};var n=d();do{e.top+=t.offsetTop;e.left+=t.offsetLeft}while(t!==n&&(t=t.offsetParent));return e}function G(t,e){if(!t||!t.getBoundingClientRect)return d();var n=t;var i=false;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=O(n);if(n.clientWidth<n.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return d();if(i||e)return n;i=true}}}while(n=n.parentNode);return d()}function d(){var t=document.scrollingElement;if(t)return t.contains(document.body)?document:t;else return document}function _(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var n=arguments.length>2?arguments[2]:undefined;if(!t.getBoundingClientRect&&t!==window)return;var i,r,o,a,s,l,u;if(t!==window&&t.parentNode&&t!==d()){i=t.getBoundingClientRect();r=i.top;o=i.left;a=i.bottom;s=i.right;l=i.height;u=i.width;if(e.parent&&t.parentNode!==t.ownerDocument.body){var c,h=t.parentNode;while(h&&h.getBoundingClientRect&&h!==t.ownerDocument.body){c=h.getBoundingClientRect();if(c.height<l){r=c.top;o=c.left;a=c.bottom;s=c.right;l=c.height;u=c.width;return{top:r,left:o,bottom:a,right:s,width:u,height:l}}h=h.parentNode}}}else{r=0;o=0;a=window.innerHeight;s=window.innerWidth;l=window.innerHeight;u=window.innerWidth}if((e.block||e.relative)&&t!==window){n=n||t.parentNode;if(!v)do{if(n&&n.getBoundingClientRect&&(O(n,"transform")!=="none"||e.relative&&O(n,"position")!=="static")){var f=n.getBoundingClientRect();r-=f.top+parseInt(O(n,"border-top-width"));o-=f.left+parseInt(O(n,"border-left-width"));a=r+i.height;s=o+i.width;break}}while(n=n.parentNode)}return{top:r,left:o,bottom:a,right:s,width:u,height:l}}function J(t,e,n,i){if(t){n=n||document;do{if(e==null){var r=Array.prototype.slice.call(n.children);var o=r.indexOf(t);if(o>-1)return r[o];for(var a=0;a<r.length;a++)if(Z(t,r[a]))return r[a]}else if(e[0]===">"?t.parentNode===n&&x(t,e):x(t,e)||i&&t===n)return t}while(t=t.parentNode)}return null}function Z(t,e){if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16);if(e.contains&&t.nodeType===1)return e.contains(t)&&e!==t;while(t=t.parentNode)if(t===e)return true;return false}function Q(t,e,n){var i=t.lastElementChild;while(i&&(i===e||O(i,"display")==="none"||n&&!x(i,n)))i=i.previousElementSibling;return i||null}function S(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(R," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(R," ")}}function x(t,e){if(!e)return;e[0]===">"&&(e=e.substring(1));if(t)try{if(t.matches)return t.matches(e);else if(t.msMatchesSelector)return t.msMatchesSelector(e);else if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return false}return false}function tt(t,e){return t.top!==e.top||t.left!==e.left}function et(t,e){return t.top==e.top?t.left-e.left:t.top-e.top}function O(t,e,n){var i=t&&t.style;if(i)if(n===void 0){if(document.defaultView&&document.defaultView.getComputedStyle)n=document.defaultView.getComputedStyle(t,"");else if(t.currentStyle)n=t.currentStyle;return e===void 0?n:n[e]}else{if(!(e in i)&&e.indexOf("webkit")===-1)e="-webkit-"+e;i[e]=n+(typeof n==="string"?"":"px")}}function e(t){return setTimeout(t,0)}function nt(){return Number(Math.random().toString().slice(-3)+Date.now()).toString(32)}var l="Sortable"+Date.now(),it={sortable:null,nodes:[]},u=g({},it),c=g({},it),h={},rt=function t(){return{from:g({},u),to:g({},c)}};function ot(t){this.options=t||{};this.groupName=t.group.name}if(ot.prototype={allowDrag:function t(e){return this.options.multiple&&h[this.groupName]&&h[this.groupName].length&&h[this.groupName].indexOf(e)>-1},getHelper:function t(){var r=document.createElement("div");h[this.groupName].forEach(function(t,e){var n=t.cloneNode(true);var i=e===0?1:.5;n.style="\n opacity: ".concat(i,";\n position: absolute;\n z-index: ").concat(e,";\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n ");r.appendChild(n)});return r},select:function t(e,n,i){if(!n)return;if(!h[this.groupName])h[this.groupName]=[];var r=h[this.groupName].indexOf(n);S(n,this.options.selectedClass,r<0);var o=g(g({},i),{},{event:e});if(r<0){h[this.groupName].push(n);i.sortable._dispatchEvent("onSelect",o)}else{h[this.groupName].splice(r,1);i.sortable._dispatchEvent("onDeselect",o)}h[this.groupName].sort(function(t,e){return et(w(t),w(e))})},onDrag:function t(e){u.sortable=e;u.nodes=h[this.groupName].map(function(t){return{node:t,rect:_(t),offset:w(t)}});c.sortable=e},onTrulyStarted:function t(e,n){n.animator.collect(e,null,e.parentNode);h[this.groupName].forEach(function(t){if(t==e)return;t.parentNode.removeChild(t)});n.animator.animate()},onChange:function t(e,n){var i=_(e);var r=w(e);c.sortable=n;c.nodes=h[this.groupName].map(function(t){return{node:t,rect:i,offset:r}})},onDrop:function t(e,i,n,r){var o=this;c.sortable.animator.collect(i,null,i.parentNode);var a=h[this.groupName].indexOf(i);h[this.groupName].forEach(function(t,e){if(e<a)i.parentNode.insertBefore(t,i);else{var n=e>0?h[o.groupName][e-1]:i;i.parentNode.insertBefore(t,n.nextSibling)}});u.sortable=n.sortable;c.nodes=h[this.groupName].map(function(t){return{node:t,rect:_(t),offset:w(t)}});var s=this._offsetChanged(u.nodes,c.nodes);var l=g(g({},r()),{},{changed:s,event:e});if(c.sortable.el!=u.sortable.el)u.sortable._dispatchEvent("onDrop",l);c.sortable._dispatchEvent("onDrop",l);c.sortable.animator.animate()},_offsetChanged:function t(e,n){return!!e.find(function(e){var t=n.find(function(t){return t.node===e.node});return tt(t.offset,e.offset)})}},!window.requestAnimationFrame)window.requestAnimationFrame=function(t){return setTimeout(t,17)};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(t){clearTimeout(t)};function at(){this.autoScrollAnimationFrame=null;this.speed={x:10,y:10}}function st(t){this.options=t;this.animations=[]}function lt(){this.helper=null}at.prototype={clear:function t(){if(this.autoScrollAnimationFrame==null)return;cancelAnimationFrame(this.autoScrollAnimationFrame);this.autoScrollAnimationFrame=null},update:function t(e,n,i,r){var o=this;cancelAnimationFrame(this.autoScrollAnimationFrame);this.autoScrollAnimationFrame=requestAnimationFrame(function(){if(i&&r)o.autoScroll(e,n,r);o.update(e,n,i,r)})},autoScroll:function t(e,n,i){if(!e)return;var r=i.clientX,o=i.clientY;if(r===void 0||o===void 0)return;var a=_(e);if(!a)return;var s=e.scrollTop,l=e.scrollLeft,u=e.scrollHeight,c=e.scrollWidth;var h=a.top,f=a.right,d=a.bottom,p=a.left,g=a.height,m=a.width;if(o<h||r>f||o>d||r<p)return;var v=s>0&&o>=h&&o<=h+n;var y=l>0&&r>=p&&r<=p+n;var b=l+m<c&&r<=f&&r>=f-n;var w=s+g<u&&o<=d&&o>=d-n;var S=0,x=0;if(y)S=Math.floor(Math.max(-1,(r-p)/n-1)*this.speed.x);else if(b)S=Math.ceil(Math.min(1,(r-f)/n+1)*this.speed.x);else S=0;if(v)x=Math.floor(Math.max(-1,(o-h)/n-1)*this.speed.y);else if(w)x=Math.ceil(Math.min(1,(o-d)/n+1)*this.speed.y);else x=0;if(x)e.scrollTop+=x;if(S)e.scrollLeft+=S}},st.prototype={collect:function t(e,n,i,r){var o=this;if(!i)return;var a=Array.prototype.slice.call(i.children);var s=this._getRange(a,e,n,r),l=s.start,u=s.end;this.animations.length=0;a.slice(l,u+1).forEach(function(t){if(t===r||t===B.helper)return;o.animations.push({node:t,rect:_(t)})})},animate:function t(){var i=this;this.animations.forEach(function(t){var e=t.node,n=t.rect;i._excute(e,n)})},_excute:function t(e,n){var i=n.left,r=n.top;var o=_(e);var a=r-o.top;var s=i-o.left;X(e);m(e,"translate3d(".concat(s,"px, ").concat(a,"px, 0)"));e.offsetWidth;var l=this.options.animation;X(e,l);m(e,"translate3d(0px, 0px, 0px)");clearTimeout(e.animated);e.animated=setTimeout(function(){X(e);m(e,"");e.animated=null},l)},_getRange:function t(e,n,i){var r=e.indexOf(n);var o=e.indexOf(i);if(r>o){var a=[o,r];r=a[0];o=a[1]}if(r<0){r=o;o=e.length-1}if(o<0)o=e.length-1;return{start:r,end:o}}},lt.prototype={get node(){return this.helper},destroy:function t(){if(this.helper&&this.helper.parentNode)this.helper.parentNode.removeChild(this.helper);this.helper=null},move:function t(e,n){m(this.helper,"translate3d(".concat(e,"px, ").concat(n,"px, 0)"))},init:function t(e,n,i,r,o){if(this.helper)return;var a=r.fallbackOnBody,s=r.ghostClass,l=r.ghostStyle,u=l===void 0?{}:l;var c=a?document.body:i;this.helper=n.cloneNode(true);S(this.helper,s,true);var h=g({"box-sizing":"border-box",top:e.top,left:e.left,width:e.width,height:e.height,position:"fixed",opacity:"0.8","z-index":1e5,"pointer-events":"none"},u);for(var f in h)O(this.helper,f,h[f]);U(this.helper,"none");m(this.helper,"translate3d(0px, 0px, 0px)");c.appendChild(this.helper);var d=o.x/parseInt(this.helper.style.width)*100;var p=o.y/parseInt(this.helper.style.height)*100;O(this.helper,"transform-origin","".concat(d,"% ").concat(p,"%"));O(this.helper,"transform","translateZ(0)")}};var ut={sortable:null,group:null,node:null,rect:{},offset:{}},f=[],p,T,E,D,z,I,L,ct,C,N,k=new lt,j=g({},ut),P=g({},ut),ht={x:0,y:0},a={x:0,y:0},ft=function t(e,n){var i={};var r=e.group;if(!r||o(r)!="object")r={name:r,pull:true,put:true};i.name=r.name||n;i.pull=r.pull;i.put=r.put;e.group=i},F=function t(e){if(T){var n=e.touches?e.touches[0]:e;var i=dt(n.clientX,n.clientY);if(i){p=i;if(p===D.sortable.el)return;i[l]._onMove(e)}}},dt=function t(o,a){var s;f.some(function(t){var e=t[l].options.emptyInsertThreshold;if(!e)return;var n=_(t,{parent:true}),i=o>=n.left-e&&o<=n.right+e,r=a>=n.top-e&&a<=n.bottom+e;if(i&&r)return s=t});return s},pt=function t(e){var n=e.clientX,i=e.clientY;var r=n-a.x;var o=i-a.y;a.x=n;a.y=i;if(n!==void 0&&i!==void 0&&Math.abs(r)<=0&&Math.abs(o)<=0)return false;return true},K=function t(){var e={from:g({},j),to:g({},P)};if(L){var n=rt();e.from=g(g({},n.from),e.from);e.to=g(g({},n.to),e.to)}return e};function B(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));t[l]=this;this.el=t;this.ownerDocument=t.ownerDocument;this.options=e=Object.assign({},e);var n={group:"",animation:150,multiple:false,draggable:null,handle:null,onDrag:null,onMove:null,onDrop:null,onChange:null,autoScroll:true,scrollThreshold:25,delay:0,delayOnTouchOnly:false,disabled:false,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",fallbackOnBody:false,stopPropagation:false,supportPointer:"onpointerdown"in window&&!y,supportTouch:"ontouchstart"in window,emptyInsertThreshold:5};for(var i in n)!(i in this.options)&&(this.options[i]=n[i]);ft(e,"group_"+nt());for(var r in this)if(r.charAt(0)==="_"&&typeof this[r]==="function")this[r]=this[r].bind(this);var o=this.options,a=o.supportPointer,s=o.supportTouch;if(a)b(t,"pointerdown",this._onDrag);else if(s)b(t,"touchstart",this._onDrag);else b(t,"mousedown",this._onDrag);f.push(t);this.multiplayer=new ot(this.options);this.animator=new st(this.options);C=new at}return(B.prototype={constructor:B,get helper(){return k.node},destroy:function t(){this._dispatchEvent("destroy",this);this.el[l]=null;for(var e=0;e<n.start.length;e++)i(this.el,n.start[e],this._onDrag);this._clearState();f.splice(f.indexOf(this.el),1);if(f.length==0)C=null;this.el=null},_onDrag:function t(e){var n=this;if(this.options.disabled||!this.options.group.pull)return;if(/mousedown|pointerdown/.test(e.type)&&e.button!==0)return;var i=W(e),r=i.touch,o=i.event,a=i.target;if(y&&a&&a.tagName.toUpperCase()==="SELECT")return;if(a===this.el)return;var s=this.options,l=s.draggable,u=s.handle;if(typeof u==="function"&&!u(e))return;if(typeof u==="string"&&!x(a,u))return;if(typeof l==="function"){var c=l(e);if(!c)return;if(V(c))T=c}else T=J(a,l,this.el,false);if(!T||T.animated)return;if(r)O(T,"touch-action","none");var h=T.parentNode;I=r;D=o;D.sortable=this;D.group=h;L=this.options.multiple&&this.multiplayer.allowDrag(T);L&&this.multiplayer.onDrag(this);var f=_(T);var d=w(T);j={sortable:this,group:h,node:T,rect:f,offset:d};P.group=h;P.sortable=this;ht={x:o.clientX-f.left,y:o.clientY-f.top};if(this.options.supportPointer)b(this.ownerDocument,"pointermove",F);else if(r)b(this.ownerDocument,"touchmove",F);else b(this.ownerDocument,"mousemove",F);var p=this.options,g=p.delay,m=p.delayOnTouchOnly;if(g&&(!m||r)&&!(q||v)){if(this.options.supportPointer)b(this.ownerDocument,"pointerup",this._onDrop);else if(I)b(this.ownerDocument,"touchend",this._onDrop);else b(this.ownerDocument,"mouseup",this._onDrop);clearTimeout(N);N=setTimeout(function(){return n._onStart()},g)}else this._onStart()},_onStart:function t(){p=this.el;if(this.options.supportPointer){b(this.ownerDocument,"pointermove",this._onMove);b(this.ownerDocument,"pointerup",this._onDrop);b(this.ownerDocument,"pointercancel",this._onDrop)}else if(I){b(this.ownerDocument,"touchmove",this._onMove);b(this.ownerDocument,"touchend",this._onDrop);b(this.ownerDocument,"touchcancel",this._onDrop)}else{b(this.ownerDocument,"mousemove",this._onMove);b(this.ownerDocument,"mouseup",this._onDrop)}try{if(document.selection)e(function(){document.selection.empty()});else window.getSelection().removeAllRanges()}catch(t){}},_onTrulyStarted:function t(){if(!z){this._dispatchEvent("onDrag",g(g({},K()),{},{event:D}));L&&this.multiplayer.onTrulyStarted(T,this);var e=L?this.multiplayer.getHelper():T;k.init(j.rect,e,this.el,this.options,ht);B.helper=k.node;S(T,this.options.chosenClass,true);O(T,"will-change","transform");y&&O(document.body,"user-select","none")}},_allowPut:function t(){if(D.group===this.el)return true;else if(!this.options.group.put)return false;else{var e=this.options.group.name;var n=D.sortable.options.group;return n.name&&e&&n.name===e}},_onMove:function t(e){this._preventEvent(e);if(!D||!T)return;if(!pt(e))return;var n=W(e),i=n.event,r=n.target;this._onTrulyStarted();z=i;var o=e.clientX-D.clientX;var a=e.clientY-D.clientY;k.move(o,a);this._dispatchEvent("onMove",g(g({},K()),{},{event:i}));if(!this.scrollEl)this.scrollEl=G(this.el,true);var s=this.options,l=s.autoScroll,u=s.scrollThreshold;if(l)C.update(this.scrollEl,u,D,z);if(!this._allowPut())return;E=J(r,this.options.draggable,p,false);if(E){if(E===ct)return;ct=E;if(E.animated||Z(E,T))return}if(E===T)return;if(p!==j.sortable.el){if(r===p||!Q(p,k.node))this._onInsert(i,true);else if(E)this._onInsert(i,false)}else if(E)this._onChange(i)},_onInsert:function t(e,n){var i=n?T:E;var r=n?p:E.parentNode;j.sortable.animator.collect(T,null,T.parentNode,T);this.animator.collect(null,i,r,T);L&&this.multiplayer.onChange(T,this);P={sortable:this,group:r,node:i,rect:_(T),offset:w(T)};j.sortable._dispatchEvent("onRemove",g(g({},K()),{},{event:e}));if(n)r.appendChild(T);else r.insertBefore(T,i);this._dispatchEvent("onAdd",g(g({},K()),{},{event:e}));j.sortable.animator.animate();this.animator.animate();j.group=r;j.sortable=this},_onChange:function t(e){var n=E.parentNode;this.animator.collect(T,E,n);L&&this.multiplayer.onChange(T,this);P={sortable:this,group:n,node:E,rect:_(E),offset:w(E)};this._dispatchEvent("onChange",g(g({},K()),{},{event:e}));var i=w(T);var r=null;if(i.top===P.offset.top)r=i.left<P.offset.left?E.nextSibling:E;else r=i.top<P.offset.top?E.nextSibling:E;n.insertBefore(T,r);this.animator.animate();j.group=n;j.sortable=this},_onDrop:function t(e){this._unbindMoveEvents();this._unbindDropEvents();this._preventEvent(e);C.clear();clearTimeout(N);if(T){S(T,this.options.chosenClass,false);I&&O(T,"touch-action","");O(T,"will-change","")}if(T&&D&&z)this._onEnd(e);else if(this.options.multiple)this.multiplayer.select(e,T,g({},j));this._clearState()},_onEnd:function t(e){j.group=D.group;j.sortable=D.sortable;if(L)this.multiplayer.onDrop(e,T,D,K);else{P.rect=_(T);P.offset=w(T);var n=tt(j.offset,P.offset);var i=g(g({},K()),{},{changed:n,event:e});if(P.sortable.el!==j.sortable.el)j.sortable._dispatchEvent("onDrop",i);P.sortable._dispatchEvent("onDrop",i)}y&&O(document.body,"user-select","")},_preventEvent:function t(e){e.preventDefault!==void 0&&e.cancelable&&e.preventDefault();if(this.options.stopPropagation)if(e&&e.stopPropagation)e.stopPropagation();else window.event.cancelBubble=true},_dispatchEvent:function t(e,n){var i=this.options[e];if(typeof i==="function")i(n)},_clearState:function t(){T=E=D=z=I=L=ct=N=B.ghost=null;ht=a={x:0,y:0};j=P=g({},ut);k.destroy()},_unbindMoveEvents:function t(){for(var e=0;e<n.move.length;e++){i(this.ownerDocument,n.move[e],this._onMove);i(this.ownerDocument,n.move[e],F)}},_unbindDropEvents:function t(){for(var e=0;e<n.end.length;e++)i(this.ownerDocument,n.end[e],this._onDrop)}}).utils={getRect:_,getOffset:w},B}()})(d={exports:{}});var z=d.exports,I="virtualSortableState",L={from:{},to:{}};function C(){}C.prototype={constructor:C,clear:function(){localStorage.removeItem(I)},getStore:function(){try{return JSON.parse(localStorage.getItem(I))||L}catch(t){return L}},getValue:function(){return new Promise(function(t,e){try{t(JSON.parse(localStorage.getItem(I))||L)}catch(t){e(L)}})},setValue:function(r){return new Promise(function(t,e){try{var n=JSON.parse(localStorage.getItem(I)),i=JSON.stringify(v(v({},n),r));localStorage.setItem(I,i),t(i)}catch(t){e(L)}})}};var N=new C,k=["group","handle","disabled","draggable","ghostClass","ghostStyle","chosenClass","animation","autoScroll","scrollThreshold"],j=null;function P(t,e){this.context=t,this.callback=e,this.initialList=c(t.list),this.dynamicList=c(t.list),this.sortable=null,this.rangeChanged=!1,this._init()}return P.prototype={constructor:P,destroy:function(){this.sortable&&this.sortable.destroy(),this.sortable=null},setValue:function(t,e){"list"===t?(this.initialList=c(e),j&&this._onDrag(j,!1)):(this.context[t]=e,this.sortable.options[t]=e)},_init:function(){var i=this,t=k.reduce(function(t,e){return t[e]=i.context[e],t},{});this.sortable=new z(this.context.$refs.group,v(v({},t),{},{fallbackOnBody:!0,list:this.dynamicList,onDrag:function(t){t=t.from;return i._onDrag(t.node)},onAdd:function(t){var e=t.from,t=t.to;return i._onAdd(e,t)},onRemove:function(t){var e=t.from,t=t.to;return i._onRemove(e,t)},onChange:function(t){var e=t.from,t=t.to;return i._onChange(e,t)},onDrop:function(t){var e=t.from,n=t.to,t=t.changed;return i._onDrop(e,n,t)}}))},_onDrag:function(r){var o=arguments,a=this;return u(O().mark(function t(){var e,n,i;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=!(1<o.length&&void 0!==o[1])||o[1],j=r,a.dynamicList=c(a.initialList),n=c(a.initialList),i=a._getFromTo({node:r},n),t.next=7,N.setValue({from:v({list:n},i)});case 7:if(e)return a.rangeChanged=!1,t.next=11,N.getValue();t.next=15;break;case 11:i=t.sent,a.context.$emit("drag",v({list:n},i)),t.next=16;break;case 15:a.rangeChanged=!0;case 16:case"end":return t.stop()}},t)}))()},_onAdd:function(r,o){var a=this;return u(O().mark(function t(){var e,n,i;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,N.getValue();case 2:e=t.sent,n=c(a.dynamicList),n=a._getIndex(n,o.node.dataset.key),i=v(v({},e.from),{},{index:n}),r.node===o.node?(i.index=a.dynamicList.length,a.dynamicList.push(e.from.item)):a.dynamicList.splice(n,0,e.from.item),a.context.$emit("add",v({},i));case 8:case"end":return t.stop()}},t)}))()},_onRemove:function(n,t){var i=this;return u(O().mark(function t(){var e;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=c(i.dynamicList),e=i._getFromTo(n,e),i.dynamicList.splice(e.index,1),i.context.$emit("remove",v({},e));case 4:case"end":return t.stop()}},t)}))()},_onChange:function(i,r){var o=this;return u(O().mark(function t(){var e,n;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=c(o.dynamicList),n=c(o.dynamicList),e=o._getFromTo(i,e),n=o._getFromTo(r,n),o.dynamicList.splice(e.index,1),o.dynamicList.splice(n.index,0,e.item);case 6:case"end":return t.stop()}},t)}))()},_onDrop:function(o,a,s){var l=this;return u(O().mark(function t(){var e,n,i,r;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return(l.rangeChanged||o.sortable!==a.sortable)&&j&&j.remove(),e=c(l.dynamicList),i=l._getIndex(e,o.node.dataset.key),r=l.initialList[i],n=b(r,l.context.dataKey),t.next=7,N.setValue({to:{list:c(l.initialList),index:i,item:r,key:n}});case 7:return t.next=9,N.getValue();case 9:i=t.sent,r=v(v({list:e},i),{},{changed:s}),l.context.$emit("drop",r),l.callback&&l.callback(r),l.initialList=c(e),l._clear();case 15:case"end":return t.stop()}},t)}))()},_getFromTo:function(t,e){var t=t.node.dataset.key,n=this._getIndex(e,t);return{key:t,item:e[n],index:n}},_getIndex:function(t,e){var n=this;return t.findIndex(function(t){return b(t,n.context.dataKey)==e})},_clear:function(){j=null,N.clear(),this.rangeChanged=!1}},t.default.component("virtual-drag-list",{props:h,data:function(){return{list:[],uniqueKeys:[],virtual:null,sortable:null,lastItem:null,range:new p}},provide:function(){return{virtualList:this}},computed:{isHorizontal:function(){return"vertical"!==this.direction},scrollSizeKey:function(){return this.isHorizontal?"scrollWidth":"scrollHeight"},scrollDirectionKey:function(){return this.isHorizontal?"scrollLeft":"scrollTop"},offsetSizeKey:function(){return this.isHorizontal?"offsetLeft":"offsetTop"},clientSizeKey:function(){return this.isHorizontal?"clientWidth":"clientHeight"}},watch:{dataSource:{handler:function(t){this.init(t)},deep:!0,immediate:!0},disabled:{handler:function(t){this.sortable&&this.sortable.setValue("disabled",t)},immediate:!0}},created:function(){this.range.end=this.keeps-1},beforeDestroy:function(){this._destroySortable()},methods:{reset:function(){this.scrollToTop(),this.init(this.dataSource)},getSize:function(t){return this.virtual.sizes.get(t)},getOffset:function(){var t=this.$refs.root;return t?Math.ceil(t[this.scrollDirectionKey]):0},scrollToTop:function(){this.$refs.root[this.scrollDirectionKey]=0},scrollToBottom:function(){var t=this,e=this.$refs,n=e.bottomItem,i=e.root;n&&(e=n[this.offsetSizeKey],this.scrollToOffset(e),setTimeout(function(){t.getOffset()+Math.ceil(i[t.clientSizeKey])<Math.ceil(i[t.scrollSizeKey])&&t.scrollToBottom()},5))},scrollToIndex:function(t){var e,n=this;t>=this.list.length-1?this.scrollToBottom():(e=this.virtual.getOffsetByIndex(t),this.scrollToOffset(e),setTimeout(function(){n.getOffset()!==n.virtual.getOffsetByIndex(t)&&n.scrollToIndex(t)},5))},scrollToOffset:function(t){this.$refs.root[this.scrollDirectionKey]=t},init:function(t){var e=this;this.list=c(t),this._updateUniqueKeys(),this.virtual?(this.virtual.updateUniqueKeys(this.uniqueKeys),this.virtual.updateSizes(this.uniqueKeys),this.virtual.updateRange()):this._initVirtual(),this.sortable?this.sortable.setValue("list",c(t)):this.$nextTick(function(){return e._initSortable()}),this.lastItem&&this.keepOffset&&(t=this._getItemIndex(this.lastItem),this.scrollToIndex(t),this.lastItem=null)},_initVirtual:function(){var i=this;this.virtual=new D({size:this.size,keeps:this.keeps,uniqueKeys:this.uniqueKeys,isHorizontal:this.isHorizontal},function(t){var e,n;i.range=t,i.sortable&&(t=N.getStore(),e=(n=i.range).start,n=n.end,-1<(t=t.from.index))&&!(e<=t&&t<=n)&&(i.sortable.rangeChanged=!0)}),this.virtual.updateSizes(this.uniqueKeys),this.virtual.updateRange()},_initSortable:function(){var n=this;this.sortable=new P(this,function(t){var e=t.list;t.changed&&(n.sortable.rangeChanged&&n.virtual.direction&&0<n.range.start&&-1<(t=e.indexOf(n.list[n.range.start]))&&(n.range.start=t,n.range.end=t+n.keeps-1),n.list=[],n.$nextTick(function(){n.list=c(e),n._updateUniqueKeys(),n.virtual.updateUniqueKeys(n.uniqueKeys)}))})},_destroySortable:function(){this.sortable&&this.sortable.destroy(),this.sortable=null},_handleScroll:function(){var t=this.$refs.root,e=this.getOffset(),n=Math.ceil(t[this.clientSizeKey]),t=Math.ceil(t[this.scrollSizeKey]);!t||e<0||t+1<e+n||(this.virtual.handleScroll(e),this.virtual.isFront()?this.list.length&&e<=0&&this.handleToTop(this):this.virtual.isBehind()&&t<=n+e&&this.handleToBottom(this))},handleToTop:y(function(t){t.$emit("top"),t.lastItem=t.list[0]}),handleToBottom:y(function(t){t.$emit("bottom")}),_onItemResized:function(t,e){this.virtual.handleItemSizeChange(t,e)},_onHeaderResized:function(t,e){this.virtual.handleHeaderSizeChange(e)},_onFooterResized:function(t,e){this.virtual.handleFooterSizeChange(e)},_updateUniqueKeys:function(){var e=this;this.uniqueKeys=this.list.map(function(t){return b(t,e.dataKey)})},_getItemIndex:function(e){var n=this;return this.list.findIndex(function(t){return b(e,n.dataKey)==b(t,n.dataKey)})},_getItemStyle:function(t){var e=N.getStore().from.key;return this.sortable&&this.sortable.rangeChanged&&t==e?{display:"none"}:{}}},render:function(i){var r=this,t=this.$slots,e=t.header,t=t.footer,n=this.range,o=n.start,a=n.end,s=n.front,n=n.behind,l=this.isHorizontal,u=this.headerTag,c=this.footerTag,h=this.itemTag,f=this.rootTag,d=this.wrapTag,p=this.itemStyle,g=this.itemClass,m=this.wrapClass,s=v(v({},this.wrapStyle),{},{padding:l?"0px ".concat(n,"px 0px ").concat(s,"px"):"".concat(s,"px 0px ").concat(n,"px")});return i(f,{ref:"root",style:{overflow:l?"auto hidden":"hidden auto"},on:{"&scroll":y(this._handleScroll,this.delay)}},[e?i(S,{props:{tag:u,dataKey:"header",event:"_onHeaderResized"}},e):null,i(d,{ref:"group",attrs:{role:"group"},class:m,style:s},this.list.slice(o,a+1).map(function(t){var e=r._getItemIndex(t),n=b(t,r.dataKey);return r.$scopedSlots.item?i(w,{key:n,props:{isHorizontal:l,dataKey:n,tag:h,event:"_onItemResized"},style:v(v({},p),r._getItemStyle(n)),class:g},r.$scopedSlots.item({record:t,index:e,dataKey:n})):i(h,{key:n,attrs:{"data-key":n},style:v(v({},p),{},{height:"".concat(r.size,"px")}),class:g},n)})),t?i(S,{props:{tag:c,dataKey:"footer",event:"_onFooterResized"}},t):null,i("div",{ref:"bottomItem",style:{width:l?"0px":"100%",height:l?"100%":"0px"}})])}})}); |
{ | ||
"name": "vue-virtual-draglist", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "A virtual scrolling list component that can be sorted by dragging", | ||
@@ -49,3 +49,2 @@ "main": "dist/draglist.js", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^25.5.1", | ||
"cross-env": "^7.0.3", | ||
@@ -52,0 +51,0 @@ "eslint": "^6.2.1", |
# vue-virtual-draglist | ||
[![npm](https://img.shields.io/npm/v/vue-virtual-draglist.svg)](https://www.npmjs.com/package/vue-virtual-draglist) [![npm](https://img.shields.io/npm/dt/vue-virtual-draglist.svg)](https://www.npmjs.com/package/vue-virtual-draglist) [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) | ||
[![npm](https://img.shields.io/npm/v/vue-virtual-draglist.svg)](https://www.npmjs.com/package/vue-virtual-draglist) [![npm](https://img.shields.io/npm/dt/vue-virtual-draglist.svg)](https://www.npmjs.com/package/vue-virtual-draglist) [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE) | ||
@@ -22,5 +22,5 @@ A virtual scrolling list component that can be sorted by dragging | ||
<!-- | ||
:draggable="'div'" // use tagName | ||
:draggable="'.item'" // use class | ||
:draggable="'#item'" // use id | ||
:handle="'I'" // use tagName | ||
:handle="'.handle'" // use class | ||
:handle="'#handle'" // use id | ||
--> | ||
@@ -30,5 +30,3 @@ <virtual-drag-list | ||
:data-source="list" | ||
:draggable="'.item'" | ||
:handle="'.handle'" | ||
:item-class="'item'" | ||
style="height: 500px" | ||
@@ -43,3 +41,3 @@ @top="handleToTop" | ||
<template slot="item" slot-scope="{ record, index, dataKey }"> | ||
<span class="handle">{{ record.id }}</span> | ||
<i class="handle">{{ record.id }}</span> | ||
{{ record.text }} | ||
@@ -119,7 +117,6 @@ </template> | ||
| `size` | `Number` | `-` | The estimated height of each piece of data, you can choose to pass it or not, it will be automatically calculated | | ||
| `direction` | `String` | `vertical` | `vertical/horizontal`, scroll direction | | ||
| `draggable` | `Function/String` | `-` | Specifies which items inside the element should be draggable | | ||
| `handle` | `Function/String` | `-` | Drag handle selector within list items | | ||
| `group` | `Function/String` | `-` | string: 'name' or object: `{ name: 'group', put: true/false, pull: true/false }` | | ||
| `keepOffset` | `Boolean` | `false` | When scrolling up to load data, keep the same offset as the previous scroll | | ||
| `direction` | `String` | `vertical` | `vertical/horizontal`, scroll direction | | ||
@@ -131,2 +128,3 @@ | ||
| -------- | -------- | ----------- | --------------- | | ||
| `draggable` | `Function/String` | `-` | Specifies which items inside the element should be draggable. If does not set a value, the default list element can be dragged | | ||
| `disabled` | `Boolean` | `false` | Disables the sortable if set to true | | ||
@@ -164,6 +162,1 @@ | `delay` | `Number` | `0` | Delay time of debounce function | | ||
| `scrollToOffset(offset)` | Scroll to the specified offset | | ||
## License | ||
[MIT License.](https://github.com/mfuu/vue-virtual-drag-list/blob/main/LICENSE) |
@@ -31,2 +31,4 @@ export class Range { | ||
const LEADING_BUFFER = 2; | ||
function Virtual(options, callback) { | ||
@@ -67,5 +69,10 @@ this.options = options; | ||
// check if need to update until loaded enough list item | ||
const start = Math.max(this.range.start, 0); | ||
let start = this.range.start; | ||
if (this.isFront()) { | ||
start -= LEADING_BUFFER; | ||
} else if (this.isBehind()) { | ||
start += LEADING_BUFFER; | ||
} | ||
const length = Math.min(this.options.keeps, this.options.uniqueKeys.length); | ||
if (this.sizes.size >= length - 1) { | ||
if (this.sizes.size >= length - LEADING_BUFFER) { | ||
this.handleUpdate(start, this.getEndByStart(start)); | ||
@@ -72,0 +79,0 @@ } else { |
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
184475
21
3994
157