vue-dndrop
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueDndrop={},e.vue)}(this,function(e,o){"use strict";var r="dndrop-container-instance",v="dndrop-draggable-wrapper",i="animated",u="__smooth_dnd_draggable_translation_value",a="__smooth_dnd_draggable_visibility_value",f="dndrop-ghost",y="dndrop-container",d="dndrop-stretcher-element",c="dndrop-stretcher-instance",s="dndrop-disable-touch-action",g="dndrop-no-user-select",p="dndrop-drop-preview-default-class",m="dndrop-drop-preview-inner-class",h="dndrop-drop-preview-constant-class",b="dndrop-drop-preview-flex-container-class",w={groupName:void 0,behaviour:"move",orientation:"vertical",getChildPayload:void 0,animationDuration:250,autoScrollEnabled:!0,shouldAcceptDrop:void 0,shouldAnimateDrop:void 0};function x(e){var l=e.element,s=e.draggables;return function(e,t){var n,o=e.removedIndex,r=e.addedIndex,i=e.droppedElement,a=null;null!==o&&(a=l.removeChild(l.children[o]),s.splice(o,1)),null!==r&&((n=window.document.createElement("div")).className="dndrop-draggable-wrapper",n.appendChild(a&&a.firstElementChild?a.firstElementChild:i),o=n,(a=r)>=(i=l).children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),r>=s.length?s.push(n):s.splice(r,0,n)),t&&t(e)}}function l(e,t){var n=window.getComputedStyle(e),e=n.overflow,t=n["overflow-"+t];return"auto"===e||"scroll"===e||("auto"===t||"scroll"===t)}function E(e,t){for(var n=e,o=t||C(e),n=e.parentElement;n;)A(n,"x")&&R(n,"x")&&(o=S(o,n.getBoundingClientRect(),"x")),A(n,"y")&&R(n,"y")&&(o=S(o,n.getBoundingClientRect(),"y")),n=n.parentElement;return o}function D(e,t){return-1<e.className.split(" ").map(function(e){return e}).indexOf(t)}var O={x:"x",y:"y",xy:"xy"},S=function(e,t,n){return"x"===n?{left:Math.max(e.left,t.left),top:e.top,right:Math.min(e.right,t.right),bottom:e.bottom}:{left:e.left,top:Math.max(e.top,t.top),right:e.right,bottom:Math.min(e.bottom,t.bottom)}},C=function(e){var t,n=e.getBoundingClientRect(),n={left:n.left,right:n.right,top:n.top,bottom:n.bottom};return A(e,"x")&&!R(e,"x")&&(t=n.right-n.left,n.right=n.right+e.scrollWidth-t),A(e,"y")&&!R(e,"y")&&(t=n.bottom-n.top,n.bottom=n.bottom+e.scrollHeight-t),n},R=function(e,t){var n=window.getComputedStyle(e),e=n.overflow,t=n["overflow-"+t];return"auto"===e||"scroll"===e||"hidden"===e||("auto"===t||"scroll"===t||"hidden"===t)},A=function(e,t){return"x"===t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight},B=function(t,n){var o=[];function e(){o&&(o.forEach(function(e){return e.removeEventListener("scroll",n)}),window.removeEventListener("scroll",n))}return function(){var e=t;for(;e;)(l(e,"x")||l(e,"y"))&&o.push(e),e=e.parentElement}(),{dispose:function(){e(),o=null},start:function(){o&&(o.forEach(function(e){return e.addEventListener("scroll",n)}),window.addEventListener("scroll",n))},stop:e}},I=function(e,t){for(var n=e;n;){if(n.matches(t))return n;n=n.parentElement}return null},T=function(e,t){var n;!e||-1===(n=e.className.split(" ").filter(function(e){return e})).indexOf(t)&&(n.unshift(t),e.className=n.join(" "))},P=function(e,t){var n;e&&(n=e.className.split(" ").filter(function(e){return e&&e!==t}),e.className=n.join(" "))},N=function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():window.document.selection&&window.document.selection.empty()},z=function(e){if(e){e=window.getComputedStyle(e);if(e)return e.cursor}return null};function L(e){return!(e.bottom<=e.top||e.right<=e.left)}var M={size:"offsetWidth",distanceToParent:"offsetLeft",translate:"transform",begin:"left",end:"right",dragPosition:"x",scrollSize:"scrollWidth",offsetSize:"offsetWidth",scrollValue:"scrollLeft",scale:"scaleX",setSize:"width",setters:{translate:function(e){return"translate3d("+e+"px, 0, 0)"}}},F={size:"offsetHeight",distanceToParent:"offsetTop",translate:"transform",begin:"top",end:"bottom",dragPosition:"y",scrollSize:"scrollHeight",offsetSize:"offsetHeight",scrollValue:"scrollTop",scale:"scaleY",setSize:"height",setters:{translate:function(e){return"translate3d(0,"+e+"px, 0)"}}};function j(o){return{get:function(e,t){return e[o[t]||t]},set:function(e,t,n){e[o[t]]=o.setters[t]?o.setters[t](n):n}}}function _(n,l){n["dndrop-extra-size-for-insertion"]=0;var o=j("horizontal"===l?M:F),s={translation:0};function e(){var e,t;r(n),t=(e=n).getBoundingClientRect(),s.scaleX=e.offsetWidth?(t.right-t.left)/e.offsetWidth:1,s.scaleY=e.offsetHeight?(t.bottom-t.top)/e.offsetHeight:1}function r(e){s.rect=C(e);e=E(e,s.rect);L(e)&&(s.lastVisibleRect=s.visibleRect),s.visibleRect=e}function i(e){var t=e;if(t.tagName){t=t.getBoundingClientRect();return"vertical"===l?t.bottom-t.top:t.right-t.left}return o.get(e,"size")*o.get(s,"scale")}function t(e){return o.get(e,"dragPosition")}return window.addEventListener("resize",function(){r(n)}),setTimeout(function(){e()},10),{getSize:i,getContainerRectangles:function(){return{rect:s.rect,visibleRect:s.visibleRect,lastVisibleRect:s.lastVisibleRect}},getBeginEndOfDOMRect:function(e){return{begin:o.get(e,"begin"),end:o.get(e,"end")}},getBeginEndOfContainer:function(){return{begin:o.get(s.rect,"begin")+s.translation,end:o.get(s.rect,"end")+s.translation}},getBeginEndOfContainerVisibleRect:function(){return{begin:o.get(s.visibleRect,"begin")+s.translation,end:o.get(s.visibleRect,"end")+s.translation}},getBeginEnd:function(e){var t=(t=e,(o.get(t,"distanceToParent")+(t[u]||0))*o.get(s,"scale")+(o.get(s.rect,"begin")+s.translation)-o.get(n,"scrollValue"));return{begin:t,end:t+i(e)*o.get(s,"scale")}},getAxisValue:t,setTranslation:function(e,t){t?o.set(e.style,"translate",t):e.style.removeProperty("transform"),e[u]=t},getTranslation:function(e){return e[u]},setVisibility:function(e,t){void 0!==e[a]&&e[a]===t||(t?e.style.removeProperty("visibility"):e.style.visibility="hidden",e[a]=t)},isVisible:function(e){return void 0===e[a]||e[a]},isInVisibleRect:function(e,t){var n=s.visibleRect,o=n.left,r=n.top,i=n.right,a=n.bottom;return a-r<2&&(a=r+30),n=s.rect,"vertical"===l?e>n.left&&e<n.right&&r<t&&t<a:o<e&&e<i&&t>n.top&&t<n.bottom},setSize:function(e,t){o.set(e,"setSize",t)},getTopLeftOfElementBegin:function(e){var t=0;return{top:"horizontal"===l?(t=e,s.rect.top):(t=s.rect.left,e),left:t}},getScrollSize:function(e){return o.get(e,"scrollSize")},getScrollValue:function(e){return o.get(e,"scrollValue")},setScrollValue:function(e,t){return o.set(e,"scrollValue",t)},invalidate:e,invalidateRects:function(){r(n)},getPosition:t,setBegin:function(e,t){o.set(e,"begin",t)}}}var V="x",X="y",k="xy";function Y(e,t,n){var o,r,i=n.left,a=n.right,l=n.top,s=n.bottom,n=e.x,e=e.y;if(n<i||a<n||e<l||s<e)return null;s="x"===t?(o=i,r=a,n):(o=l,r=s,e),e=r-o,e=400<e?100:e/4;return r-s<e?{direction:"end",speedFactor:(e-(r-s))/e}:s-o<e?{direction:"begin",speedFactor:(e-(s-o))/e}:null}function H(e,t,n){e&&(e!==window?"x"===t?e.scrollLeft+=n:e.scrollTop+=n:"x"===t?e.scrollBy(n,0):e.scrollBy(0,n))}function G(o,r){void 0===r&&(r="y");var i=null,a=null,l=null,s=null;return{animate:function(e,t){l=e,s=t,function n(){null===i&&(i=requestAnimationFrame(function(e){var t=e-(a=null===a?e:a);a=e;t=t/1e3*s;H(o,r,t="begin"===l?0-t:t),i=null,n()}))}()},stop:function(){null!==i&&(cancelAnimationFrame(i),i=null),a=null}}}var t;function n(e){for(var t=[],n=e.element;n;){var o=function(e){var t=window.getComputedStyle(e),e=t.overflow;if("auto"===e||"scroll"===e)return O.xy;e=t["overflow-x"],e="auto"===e||"scroll"===e,t=t["overflow-y"],t="auto"===t||"scroll"===t;return e&&t?O.xy:e?O.x:t?O.y:null}(n);if(o&&!D(n,"dndrop-prevent-auto-scroll-class")){var r={};switch(o){case k:r.x={animator:G(n,"x")},r.y={animator:G(n,"y")};break;case V:r.x={animator:G(n,"x")};break;case X:r.y={animator:G(n,"y")}}t.push({axisAnimations:r,getRect:function(e){return function(){return E(e,e.getBoundingClientRect())}}(n),scrollerElement:n})}n=n.parentElement}return t}function $(e,r){void 0===r&&(r=1500);var i=e.reduce(function(e,t){t=n(t).filter(function(t){return!e.find(function(e){return e.scrollerElement===t.scrollerElement})});return e.concat(t)},[]);return function(e){var t,o,n=e.draggableInfo;e.reset?i.forEach(function(e){e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop()}):n&&(o=n.mousePosition,i.forEach(function(e){var t=e.axisAnimations,n=(0,e.getRect)();t.x&&(t.x.scrollParams=Y(o,"x",n),e.cachedRect=n),t.y&&(t.y.scrollParams=Y(o,"y",n),e.cachedRect=n)}),i.forEach(function(e){var t,n=e.axisAnimations,o=n.x,e=n.y;o&&(o.scrollParams?(n=(t=o.scrollParams).direction,t=t.speedFactor,o.animator.animate(n,t*r)):o.animator.stop()),e&&(e.scrollParams?(o=(t=e.scrollParams).direction,t=t.speedFactor,e.animator.animate(o,t*r)):e.animator.stop())}),(e=i.filter(function(e){return e.cachedRect})).length&&1<e.length&&((t=function(e,t){for(var n=document.elementFromPoint(t.x,t.y);n;){var o=e.find(function(e){return e.scrollerElement===n});if(o)return o;n=n.parentElement}return null}(e,n.mousePosition))&&e.forEach(function(e){e!==t&&(e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop())})))}}"undefined"!=typeof window&&((t=Element)&&t.prototype&&!t.prototype.matches&&(t.prototype.matches=t.prototype.matchesSelector||t.prototype.mozMatchesSelector||t.prototype.msMatchesSelector||t.prototype.oMatchesSelector||t.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n}),Array.prototype.some||(Array.prototype.some=function(e){if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");if("function"!=typeof e)throw new TypeError;for(var t=Object(this),n=t.length>>>0,o=2<=arguments.length?arguments[1]:void 0,r=0;r<n;r++)if(r in t&&e.call(o,t[r],r,t))return!0;return!1}));var W={overflow:"hidden",display:"block"},q={height:"100%",display:"table-cell","vertical-align":"top"},U={};function J(o){return Object.keys(o).reduce(function(e,t){var n=o[t];return"object"==typeof n?""+e+t+"{"+J(n)+"}":""+e+t+":"+n+";"},"")}function K(e){if(e&&"undefined"!=typeof window){var t=window.document.head||window.document.getElementsByTagName("head")[0],n=window.document.createElement("style"),e=J({"body *":{cursor:e+" !important"}});return n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(window.document.createTextNode(e)),t.appendChild(n),n}return null}U["."+y]={position:"relative","min-height":"30px","min-width":"30px"},U["."+y+".horizontal"]={display:"table"},U["."+y+".horizontal > ."+d]={display:"inline-block"},U["."+y+".horizontal > ."+v]=q,U["."+y+".vertical > ."+v]=W,U["."+v]={"box-sizing":"border-box"},U["."+v+".horizontal"]=q,U["."+v+".vertical"]=W,U["."+v+".animated"]={transition:"transform ease"},U["."+f]={"box-sizing":"border-box"},U["."+f+".animated"]={transition:"all ease-in-out"},U["."+f+" *"]={"pointer-events":"none"},U["."+s+" *"]={"touch-action":"none","-ms-touch-action":"none"},U["."+g]={"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},U["."+m]={flex:"1"},U["."+y+".horizontal > ."+h]={height:"100%",overflow:"hidden",display:"table-cell","vertical-align":"top"},U["."+y+".vertical > ."+h]={overflow:"hidden",display:"block",width:"100%"},U["."+b]={width:"100%",height:"100%",display:"flex","justify-content":"stretch","align-items":"stretch"},U["."+p]={"background-color":"rgba(150, 150, 150, 0.1)",border:"1px solid #ccc"};var Q,Z,ee=["mousedown","touchstart"],te=["mousemove","touchmove"],ne=["mouseup","touchend"],oe=null,re=null,ie=null,ae=null,le=[],se=!1,ue=!1,de=!1,ce=!1,fe=null,ge=null,pe=null,me=null,he=(Q=null,Z=!1,{start:function(){Z||(Z=!0,function e(){Q=requestAnimationFrame(function(){oe.forEach(function(e){return e.layout.invalidateRects()}),setTimeout(function(){null!==Q&&e()},50)})}())},stop:function(){null!==Q&&(cancelAnimationFrame(Q),Q=null),Z=!1}}),ve="undefined"!=typeof window&&!!(window.navigator.userAgent.match(/Android/i)||window.navigator.userAgent.match(/webOS/i)||window.navigator.userAgent.match(/iPhone/i)||window.navigator.userAgent.match(/iPad/i)||window.navigator.userAgent.match(/iPod/i)||window.navigator.userAgent.match(/BlackBerry/i)||window.navigator.userAgent.match(/Windows Phone/i));function ye(){"undefined"!=typeof window&&ee.forEach(function(e){window.document.addEventListener(e,ze,{passive:!1})})}function be(){return ae&&ae.ghostParent?ae.ghostParent:re&&re.parentElement||window.document.body}function we(e,t,n,o){var r=t.x,i=t.y,a=e.getBoundingClientRect(),l=a.left,s=a.top,u=a.right,d=a.bottom,t=(t=n.layout.getContainerRectangles().visibleRect,a=a,{left:Math.max(t.left,a.left),top:Math.max(t.top,a.top),right:Math.min(t.right,a.right),bottom:Math.min(t.bottom,a.bottom)}),a=t.left+(t.right-t.left)/2,t=t.top+(t.bottom-t.top)/2,c=e.cloneNode(!0);return c.style.zIndex="1000",c.style.boxSizing="border-box",c.style.position="fixed",c.style.top="0px",c.style.left="0px",c.style.transform="none",c.style.removeProperty("transform"),n.shouldUseTransformForGhost()?c.style.transform="translate3d("+l+"px, "+s+"px, 0)":(c.style.top=s+"px",c.style.left=l+"px"),c.style.width=u-l+"px",c.style.height=d-s+"px",c.style.overflow="visible",c.style.transition=null,c.style.removeProperty("transition"),c.style.pointerEvents="none",c.style.userSelect="none",n.getOptions().dragClass?setTimeout(function(){T(c.firstElementChild,n.getOptions().dragClass);var e=window.getComputedStyle(c.firstElementChild).cursor;me=K(e)}):me=K(o),T(c,n.getOptions().orientation||"vertical"),T(c,f),{ghost:c,centerDelta:{x:a-r,y:t-i},positionDelta:{left:l-r,top:s-i},topLeft:{x:l,y:s}}}function xe(e){function r(){P(ie.ghost,"animated"),ie.ghost.style.transitionDuration=null,be().removeChild(ie.ghost),e()}function t(e,t,n){var o=e.top,e=e.left;T(ie.ghost,"animated"),n&&T(ie.ghost.firstElementChild,n),ie.topLeft.x=e,ie.topLeft.y=o,Ze(t),setTimeout(function(){r()},t+20)}function n(e,t){T(ie.ghost,"animated"),Ze(e,.9,!0),setTimeout(function(){t()},e+20)}var o,i,a,l,s,u;ae.targetElement?(o=le.filter(function(e){return e.element===ae.targetElement})[0],!(u=o.getOptions()).shouldAnimateDrop||u.shouldAnimateDrop(ae.container.getOptions(),ae.payload)?t(o.getDragResult().shadowBeginEnd.rect,Math.max(150,o.getOptions().animationDuration/2),o.getOptions().dropClass):r()):(i=le.filter(function(e){return e===ae.container})[0])?(l=(a=i.getOptions()).behaviour,s=a.removeOnDropOut,"move"!==l&&"contain"!==l||!ue&&s||!i.getDragResult()?n(i.getOptions().animationDuration,r):!L((a=i.layout.getContainerRectangles()).visibleRect)&&L(a.lastVisibleRect)?t({top:a.lastVisibleRect.top,left:a.lastVisibleRect.left},i.getOptions().animationDuration,i.getOptions().dropClass):(s=(l=i.getDragResult()).removedIndex,a=l.elementSize,l=i.layout,i.getTranslateCalculator({dragResult:{removedIndex:s,addedIndex:s,elementSize:a,pos:void 0,shadowBeginEnd:void 0}}),s=0<s?l.getBeginEnd(i.draggables[s-1]).end:l.getBeginEndOfContainer().begin,t(l.getTopLeftOfElementBegin(s),i.getOptions().animationDuration,i.getOptions().dropClass))):n(w.animationDuration,r)}var Ee,De,Oe,Se,Ce,Re,Ae=(Ce=1,Re=5,function(e,t,n){Ee=Ye(e),Oe=n,(De="number"==typeof t?t:ve?200:0)&&(Se=setTimeout(Ne,De)),te.forEach(function(e){return window.document.addEventListener(e,Be)},{passive:!1}),ne.forEach(function(e){return window.document.addEventListener(e,Ie)},{passive:!1}),window.document.addEventListener("drag",Te,{passive:!1})});function Be(e){var t=Ye(e),e=t.clientX,t=t.clientY;if(De)(Math.abs(Ee.clientX-e)>Re||Math.abs(Ee.clientY-t)>Re)&&Pe();else if(Math.abs(Ee.clientX-e)>Ce||Math.abs(Ee.clientY-t)>Ce)return Ne()}function Ie(){Pe()}function Te(){Pe()}function Pe(){clearTimeout(Se),te.forEach(function(e){return window.document.removeEventListener(e,Be)},{passive:!1}),ne.forEach(function(e){return window.document.removeEventListener(e,Ie)},{passive:!1}),window.document.removeEventListener("drag",Te,{passive:!1})}function Ne(){clearTimeout(Se),Pe(),Oe()}function ze(e){var t,n,o,r,i,a,l=Ye(e);se||void 0!==l.button&&0!==l.button||(re=I(l.target,"."+v))&&(t=I(re,"."+y),o=(n=le.filter(function(e){return e.element===t})[0]).getOptions().dragHandleSelector,r=n.getOptions().nonDragAreaSelector,i=!0,o&&!I(l.target,o)&&(i=!1),(i=r&&I(l.target,r)?!1:i)&&(n.layout.invalidate(),T(window.document.body,s),T(window.document.body,g),a=function(){P(window.document.body,s),P(window.document.body,g),window.document.removeEventListener("mouseup",a)},window.document.addEventListener("mouseup",a)),i&&Ae(l,n.getOptions().dragBeginDelay,function(){N(),qe(l,z(e.target)),te.forEach(function(e){window.document.addEventListener(e,Le,{passive:!1})}),ne.forEach(function(e){window.document.addEventListener(e,ke,{passive:!1})})}))}function Le(e){e.preventDefault();var t,n=Ye(e);ae?("contain"===(t=ae.container.getOptions()).behaviour?function(e,t){var n=e.clientX,o=e.clientY;void 0===t&&(t="vertical");var r,i,e=ae.container.layout.getBeginEndOfContainerVisibleRect(),t="vertical"===t?(r=o,i="y",a="top",ae.size.offsetHeight):(r=n,i="x",a="left",ae.size.offsetWidth),o=e.begin,n=e.end-t,a=Math.max(o,Math.min(n,r+ie.positionDelta[a]));ie.topLeft[i]=a,ae.position[i]=Math.max(e.begin,Math.min(e.end,r+ie.centerDelta[i])),ae.mousePosition[i]=Math.max(e.begin,Math.min(e.end,r)),ae.position[i]<e.begin+t/2&&(ae.position[i]=e.begin+2),ae.position[i]>e.end-t/2&&(ae.position[i]=e.end-2)}(n,t.orientation):pe?"y"===pe?(ie.topLeft.y=n.clientY+ie.positionDelta.top,ae.position.y=n.clientY+ie.centerDelta.y,ae.mousePosition.y=n.clientY):"x"===pe&&(ie.topLeft.x=n.clientX+ie.positionDelta.left,ae.position.x=n.clientX+ie.centerDelta.x,ae.mousePosition.x=n.clientX):(ie.topLeft.x=n.clientX+ie.positionDelta.left,ie.topLeft.y=n.clientY+ie.positionDelta.top,ae.position.x=n.clientX+ie.centerDelta.x,ae.position.y=n.clientY+ie.centerDelta.y,ae.mousePosition.x=n.clientX,ae.mousePosition.y=n.clientY),Ze(),(ce=!fe(ae))&&Ve()):qe(n,z(e.target))}var Me,Fe,je,_e,Ve=(Me=Xe,je=!(Fe=20),function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];_e&&clearTimeout(_e),je&&!_e?Me.call.apply(Me,[null].concat(e)):_e=setTimeout(function(){_e=null,Me.call.apply(Me,[null].concat(e))},Fe)});function Xe(){ce&&(ce=!1,He(ae,oe))}function ke(){var e;te.forEach(function(e){window.document.removeEventListener(e,Le,{passive:!1})}),ne.forEach(function(e){window.document.removeEventListener(e,ke,{passive:!1})}),ge&&"function"==typeof ge&&ge({reset:!0}),me&&((e=me)&&"undefined"!=typeof window&&(window.document.head||window.document.getElementsByTagName("head")[0]).removeChild(e),me=null),ae&&(he.stop(),Xe(),de=!0,xe(function(){We(se=!1);for(var e=oe||[],t=e.shift();void 0!==t;)t.handleDrop(ae),t=e.shift();fe=pe=ae=ie=re=oe=null,de=!1}))}function Ye(e){return e.touches?e.touches[0]:e}function He(t,e){var n=!1;e.forEach(function(e){e=e.handleDrag(t);n=!!e.containerBoxChanged||!1,e.containerBoxChanged=!1}),n&&(n=!1,requestAnimationFrame(function(){le.forEach(function(e){e.layout.invalidateRects(),e.onTranslated()})}))}function Ge(e){var t=e,n=null;return function(e){return!(null!==n||!se||de)&&(n=requestAnimationFrame(function(){se&&!de&&(He(e,t),ge({draggableInfo:e})),n=null}),!0)}}function $e(e,t){return e.getOptions().autoScrollEnabled?$(t,e.getScrollMaxSpeed()):function(e){return null}}function We(o){var r=ae.container,i=ae.payload;le.forEach(function(e){var t,n;r.getOptions().fireRelatedEventsOnly&&e!==r||(t=(n=e.getOptions()).onDragStart,n=n.onDragEnd,(t=o?t:n)&&(n={isSource:e===r,payload:i,willAcceptDrop:!1},e.isDragRelevant(r,i)&&(n.willAcceptDrop=!0),t(n)))})}function qe(e,t){var n,o,r,i,a,l;null!==re&&(re.classList.contains("dndrop-not-draggable")||(se=!0,(n=le.filter(function(e){return re.parentElement===e.element})[0]).setDraggables(),pe=n.getOptions().lockAxis?n.getOptions().lockAxis.toLowerCase():null,o=re,r=le.filter(function(e){return o.parentElement===e.element})[0],i=r.draggables.indexOf(o),a=r.getOptions().getGhostParent,l=o.getBoundingClientRect(),ae={container:r,element:o,size:{offsetHeight:l.bottom-l.top,offsetWidth:l.right-l.left},elementIndex:i,payload:r.getOptions().getChildPayload?r.getOptions().getChildPayload(i):void 0,targetElement:null,position:{x:0,y:0},groupName:r.getOptions().groupName,ghostParent:a?a():null,invalidateShadow:null,mousePosition:null,relevantContainers:null},ie=we(re,{x:e.clientX,y:e.clientY},ae.container,t),ae.position={x:e.clientX+ie.centerDelta.x,y:e.clientY+ie.centerDelta.y},ae.mousePosition={x:e.clientX,y:e.clientY},oe=le.filter(function(e){return e.isDragRelevant(n,ae.payload)}),ae.relevantContainers=oe,fe=Ge(oe),ge&&"function"==typeof ge&&ge({reset:!0,draggableInfo:void 0}),ge=$e(n,oe),oe.forEach(function(e){return e.prepareDrag(e,oe)}),We(!0),fe(ae),be().appendChild(ie.ghost),he.start()))}var Ue,Je,Ke,Qe=_e=Se=null;function Ze(e,t,n){void 0===e&&(e=0),void 0===t&&(t=1),void 0===n&&(n=!1);var o=ie.ghost,r=ie.topLeft,i=r.x,a=r.y,l=!ae.container||ae.container.shouldUseTransformForGhost(),s=l?"translate3d("+i+"px,"+a+"px, 0)":null;if(1!==t&&(s=s?s+" scale("+t+")":"scale("+t+")"),0<e)return ie.ghost.style.transitionDuration=e+"ms",void requestAnimationFrame(function(){s&&(o.style.transform=s),l||(o.style.left=i+"px",o.style.top=a+"px"),Qe=null,n&&(o.style.opacity="0")});null===Qe&&(Qe=requestAnimationFrame(function(){s&&(o.style.transform=s),l||(o.style.left=i+"px",o.style.top=a+"px"),Qe=null,n&&(o.style.opacity="0")}))}function et(){var t;!se||ue||de||(ce=!(ue=!0),t=Object.assign({},ae,{targetElement:null,position:{x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER},mousePosition:{x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER}}),oe.forEach(function(e){e.handleDrag(t)}),ae&&(ae.targetElement=null,ae.cancelDrop=!0,ke(),ue=!1))}"undefined"!=typeof window&&"undefined"!=typeof window&&(Ue=window.document.head||window.document.getElementsByTagName("head")[0],(Je=window.document.createElement("style")).id="dndrop-style-definitions",Ke=J(U),Je.type="text/css",Je.styleSheet?Je.styleSheet.cssText=Ke:Je.appendChild(window.document.createTextNode(Ke)),Ue.appendChild(Je));var tt=(ye(),{register:function(e){e=e,le.push(e),se&&ae&&e.isDragRelevant(ae.container,ae.payload)&&(oe.push(e),e.prepareDrag(e,oe),ge&&"function"==typeof ge&&ge({reset:!0,draggableInfo:void 0}),ge=$e(e,oe),fe=Ge(oe),e.handleDrag(ae))},unregister:function(e){var t;t=e,le.splice(le.indexOf(t),1),se&&ae&&(ae.container===t&&t.fireRemoveElement(),ae.targetElement===t.element&&(ae.targetElement=null),-1<(e=oe.indexOf(t))&&(oe.splice(e,1),ge&&"function"==typeof ge&&ge({reset:!0,draggableInfo:void 0}),ge=$e(t,oe),fe=Ge(oe)))},isDragging:function(){return se},cancelDrag:et});function nt(e,t,n){void 0===n&&(n=w.animationDuration),t?(T(e,i),e.style.transitionDuration=n+"ms"):(P(e,i),e.style.removeProperty("transition-duration"))}function ot(n){var o=[];return Array.prototype.forEach.call(n.children,function(e){var t;e.nodeType===Node.ELEMENT_NODE?((t=!D(t=e,v)?function(e){if(Ct.wrapChild){var t=window.document.createElement("div");return t.className=""+v,e.parentElement.insertBefore(t,e),t.appendChild(e),t}return e}(e):t)[u]=0,o.push(t)):n.removeChild(e)}),o}function rt(e){function s(e,t,n,o,r){if(void 0===r&&(r=!1),o<n)return n;if(n!==o)return i=Math.floor((o+n)/2),l=u.getBeginEnd(e[i]),a=l.begin,l=l.end,t<a?s(e,t,n,i-1,r):l<t?s(e,t,i+1,o,r):!r||t<(l+a)/2?i:i+1;var i=u.getBeginEnd(e[n]),a=i.begin,l=i.end;return!r||t<(l+a)/2?n:n+1}var u=e.layout;return function(e,t,n){return s(e,t,0,e.length-1,n=void 0===n?!1:n)}}function it(e){var t,n,o,r=e.element,i=e.draggables,a=e.layout,l=e.getOptions,s=(t=(e={element:r,draggables:i,layout:a,getOptions:l}).element,n=e.draggables,o=e.layout,function(){n.forEach(function(e){nt(e,!1),o.setTranslation(e,0),o.setVisibility(e,!0)}),t[c]&&(t[c].parentNode.removeChild(t[c]),t[c]=null)}),u=(Ct.dropHandler||x)({element:r,draggables:i,layout:a,getOptions:l});return function(e,t,n){var o=t.addedIndex,t=t.removedIndex;if(void 0===n&&(n=!1),s(),e&&!e.cancelDrop)if(e.targetElement||l().removeOnDropOut||n){var n=function(e){return null!==e},o=n(o)?n(t)&&t<o?o-1:o:null,r={removedIndex:t,addedIndex:o,payload:e.payload};(!e.container.getOptions().fireRelatedEventsOnly||n(t)||n(o))&&u(r,l().onDrop)}else if(l().dropNotAllowed){r=e.payload,e=e.container;return l().dropNotAllowed({payload:r,container:e})}}}function at(e){var n=e.element,o=e.getOptions,r=null;return function(e){var t=e.draggableInfo,e=r;return{removedIndex:e=null==r&&t.container.element===n&&"copy"!==o().behaviour?r=t.elementIndex:e}}}function lt(e){var t=e.draggables,n=e.layout;return function(e){e=e.dragResult;null!==e.removedIndex&&n.setVisibility(t[e.removedIndex],!1)}}function st(e){var n=e.element,o=e.layout;return function(e){var t=e.draggableInfo,e=document.elementFromPoint(t.position.x,t.position.y);if(e){e=function(e,t){for(var n=e;n;){if(n[r]){var o=n[r];if(t.some(function(e){return e===o}))return o}n=n.parentElement}return null}(e,t.relevantContainers);if(e&&e.element===n)return{pos:o.getPosition(t.position)}}return{pos:null}}}function ut(e){var n=e.layout,o=null;return function(e){var t=e.draggableInfo;return null===e.dragResult.pos?o=null:{elementSize:o=o||n.getSize(t.size)}}}function dt(e){var o=e.element;return function(e){var t=e.draggableInfo,n=e.dragResult;e=t,t=o,void 0===(n=!!n.pos)&&(n=!0),t&&n?e.targetElement=t:e.targetElement===t&&(e.targetElement=null)}}function ct(){return function(e){return null!==e.dragResult.pos?{addedIndex:0}:{addedIndex:null}}}function ft(e){var t=e.layout,n=null;return function(e){e=e.dragResult.addedIndex;if(e===n)return null;n=e;e=t.getBeginEndOfContainer().begin;return{shadowBeginEnd:{rect:t.getTopLeftOfElementBegin(e)}}}}function gt(e){var u=e.layout,d=e.element,c=e.getOptions,f=null;return function(e){var t=e.dragResult,n=t.elementSize,o=t.shadowBeginEnd,r=t.addedIndex,i=t.dropPlaceholderContainer,a=c();if(a.dropPlaceholder){var l="boolean"==typeof a.dropPlaceholder?{}:a.dropPlaceholder,s=l.animationDuration,e=l.className,t=l.showOnTop;return null===r?(i&&null!==f&&d.removeChild(i),f=null,{dropPlaceholderContainer:void 0}):(i||(a=document.createElement("div"),(l=document.createElement("div")).className=b,a.className=m+" "+(e||p),(i=document.createElement("div")).className=h,i.style.position="absolute",void 0!==s&&(i.style.transition="all "+s+"ms ease"),i.appendChild(l),l.appendChild(a),u.setSize(i.style,n+"px"),i.style.pointerEvents="none",t?d.appendChild(i):d.insertBefore(i,d.firstElementChild)),f!==r&&o.dropArea&&u.setBegin(i.style,o.dropArea.begin-u.getBeginEndOfContainer().begin+"px"),f=r,{dropPlaceholderContainer:i})}return null}}function pt(e){var n=bt(e);return function(e){var t=e.draggableInfo,e=e.dragResult;return t.invalidateShadow?n({draggableInfo:t,dragResult:e}):null}}function mt(e){var n,o,r=(n=e.draggables,o=rt({layout:e.layout}),function(e){var t=e.dragResult,e=t.shadowBeginEnd,t=t.pos;if(e)return e.begin+e.beginAdjustment<=t&&e.end>=t?null:t<e.begin+e.beginAdjustment?o(n,t):t>e.end?o(n,t)+1:n.length;t=o(n,t,!0);return null!==t?t:n.length});return function(e){var t=e.dragResult,e=null;return{addedIndex:e=null!==t.pos&&null===(e=r({dragResult:t}))?t.addedIndex:e}}}function ht(){var n=null;return function(e){var t=e.dragResult,e=t.addedIndex,t=t.shadowBeginEnd;e!==n&&null!==n&&t&&(t.beginAdjustment=0),n=e}}function vt(e){var r=e.element,i=e.draggables,a=e.layout,l=e.getOptions,s=null;return function(e){var t=e.dragResult,n=t.addedIndex,e=t.removedIndex,t=t.elementSize;if(null===e)if(null!==n){if(!s){e=a.getBeginEndOfContainer();e.end=e.begin+a.getSize(r);n=a.getScrollSize(r)>a.getSize(r)?e.begin+a.getScrollSize(r)-a.getScrollValue(r):e.end,e=0<i.length?a.getBeginEnd(i[i.length-1]).end-i[i.length-1][u]:e.begin;if(n<e+t){(s=window.document.createElement("div")).className=d+" "+l().orientation;var o=0<i.length?t+e-n:t;return a.setSize(s.style,o+"px"),r.appendChild(s),r[c]=s,{containerBoxChanged:!0}}}}else if(s){a.setTranslation(s,0);o=s;return s=null,r.removeChild(o),{containerBoxChanged:!(r[c]=null)}}}}function yt(e){var l=e.draggables,s=e.layout,u=null,d=null;return function(e){var e=e.dragResult,t=e.addedIndex,n=e.removedIndex,o=e.elementSize;if(t!==u||n!==d){for(var r,i,a=0;a<l.length;a++)a!==n&&(r=l[a],i=0,null!==n&&n<a&&(i-=o),null!==t&&t<=a&&(i+=o),s.setTranslation(r,i));return{addedIndex:u=t,removedIndex:d=n}}}}function bt(e){var c=e.draggables,f=e.layout,g=null;return function(e){var t=e.draggableInfo,n=e.dragResult,o=n.addedIndex,r=n.removedIndex,i=n.elementSize,a=n.pos,l=n.shadowBeginEnd;if(null===a)return{shadowBeginEnd:g=null};if(null===o||!t.invalidateShadow&&o===g)return null;var s=o-1,u=Number.MIN_SAFE_INTEGER,e=0,n=0,a=null,t=null;s===r&&s--;var e=-1<s?(d=f.getSize(c[s]),t=f.getBeginEnd(c[s]),u=i<d?t.end-(d-i)/2:t.end,t.end):(t={end:f.getBeginEndOfContainer().begin},f.getBeginEndOfContainer().begin),s=Number.MAX_SAFE_INTEGER,d=o;d===r&&d++;n=d<c.length?(r=f.getSize(c[d]),a=f.getBeginEnd(c[d]),s=i<r?a.begin+(r-i)/2:a.begin,a.begin):(a={begin:f.getContainerRectangles().rect.end},f.getContainerRectangles().rect.end-f.getContainerRectangles().rect.begin),t=t&&a?f.getTopLeftOfElementBegin(t.end):null;return g=o,{shadowBeginEnd:{dropArea:{begin:e,end:n},begin:u,end:s,rect:t,beginAdjustment:l?l.beginAdjustment:0}}}}function wt(){var o=null;return function(e){var t=e.dragResult,n=t.pos,e=t.addedIndex,t=t.shadowBeginEnd;null!==n?null!=e&&null===o&&(n<t.begin&&(n=n-t.begin-5,t.beginAdjustment=n),o=e):o=null}}function xt(e){var e=e.getOptions,t=!1,n=e();return function(e){e=!!e.dragResult.pos;e!==t&&((t=e)?n.onDragEnter&&n.onDragEnter():n.onDragLeave&&n.onDragLeave())}}function Et(e){var e=e.getOptions,i=null,a=e();return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=e.draggableInfo,t=r.payload,e=r.element;a.onDropReady&&null!==n&&i!==n&&(r=i=n,null!==o&&o<n&&r--,a.onDropReady({addedIndex:r,removedIndex:o,payload:t,element:e?e.firstElementChild:void 0}))}}function Dt(e){return"drop-zone"===e.getOptions().behaviour?Ot(e)(at,lt,st,ut,dt,ct,ft,xt,Et):Ot(e)(at,lt,st,ut,dt,pt,mt,ht,vt,yt,bt,gt,wt,xt,Et)}function Ot(n){return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var o=e.map(function(e){return e(n)}),r=null;return function(n){return r=o.reduce(function(e,t){return Object.assign(e,t({draggableInfo:n,dragResult:e}))},r||{addedIndex:null,removedIndex:null,elementSize:null,pos:null,shadowBeginEnd:null})}}}function St(h){return function(e){var t,n,o,r,i,a=Object.assign({},w,e),l=null,s=null,u=(n=m,o=ot(t=h),e=n(),T(t,y+" "+e.orientation),{element:t,draggables:o,getOptions:n,layout:_(t,e.orientation,e.animationDuration)}),d=Dt(u),c=it(u),f=B(h,function(){u.layout.invalidateRects(),g()});function g(){null!==s&&(s.invalidateShadow=!0,l=d(s),s.invalidateShadow=!1)}function p(e,t){for(var n=ot(t),o=0;o<n.length;o++)e[o]=n[o];for(var r=0;r<e.length-n.length;r++)e.pop()}function m(){return a}return{element:h,draggables:u.draggables,isDragRelevant:(r=(e=u).element,i=e.getOptions,function(e,t){var n=i();if(n.shouldAcceptDrop)return n.shouldAcceptDrop(e.getOptions(),t);t=e.getOptions();return"copy"!==n.behaviour&&(I(r,"."+v)!==e.element&&(e.element===r||!(!t.groupName||t.groupName!==n.groupName)))}),layout:u.layout,dispose:function(e){var t;f.dispose(),t=e.element,Ct.wrapChild&&Array.prototype.forEach.call(t.children,function(e){e.nodeType===Node.ELEMENT_NODE&&D(e,v)&&(t.insertBefore(e.firstElementChild,e),t.removeChild(e))})},prepareDrag:function(e,t){var n=e.element,o=u.draggables;p(o,n),e.layout.invalidateRects(),o.forEach(function(e){return nt(e,!0,a.animationDuration)}),f.start()},handleDrag:function(e){return l=d(s=e)},handleDrop:function(e){f.stop(),l&&l.dropPlaceholderContainer&&h.removeChild(l.dropPlaceholderContainer),s=null,d=Dt(u),c(e,l),l=null},fireRemoveElement:function(){c(s,Object.assign({},l,{addedIndex:null}),!0),l=null},getDragResult:function(){return l},getTranslateCalculator:function(e){return yt(u)(e)},onTranslated:function(){g()},setDraggables:function(){p(u.draggables,h)},getScrollMaxSpeed:function(){return Ct.maxScrollSpeed},shouldUseTransformForGhost:function(){return!0===Ct.useTransformForGhost},getOptions:m,setOptions:function(e,t){a=!1===(t=void 0===t?!0:t)?Object.assign({},w,e):Object.assign({},w,a,e)}}}}var Ct=function(e,t){var n=St(e)(t);return e[r]=n,tt.register(n),{dispose:function(){tt.unregister(n),n.dispose(n)},setOptions:function(e,t){n.setOptions(e,t)}}};Ct.wrapChild=!0,Ct.cancelDrag=function(){tt.cancelDrag()},Ct.isDragging=function(){return tt.isDragging()};function Rt(e,t){e=e.$props.tag;if(e){if("string"==typeof e){var n={value:e};return t&&(n.props={class:t}),n}if("object"==typeof e){n={value:e.value||"div",props:e.props||{}};return t&&(n.props.class?(e=n.props.class,"[object Array]"===Object.prototype.toString.call(e)?n.props.class.push(t):n.props.class=[t,n.props.class]):n.props.class=t),n}}return{value:"div"}}function At(e){return!e||("string"==typeof e||"object"==typeof e&&("string"==typeof e.value||"function"==typeof e.value||"object"==typeof e.value))}Ct.dropHandler=function(){return function(e,t){t&&t(e)}},Ct.wrapChild=!1;var Bt={drop:"onDrop","drag-end":"onDragEnd","drag-start":"onDragStart","drag-enter":"onDragEnter","drag-leave":"onDragLeave","drop-ready":"onDropReady","drop-not-allowed":"dropNotAllowed"};function It(e){var r,i,t=Object.assign({},e.$props,e.$attrs);return r=t,i=e,Object.keys(r).reduce(function(e,t){var n=t,o=r[n];return void 0!==o&&("function"==typeof o?Bt[n]?e[Bt[n]]=function(e){i.$emit(n,e)}:e[n]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return o.apply(void 0,e)}:e[n]=o),e},{})}q={name:"Container",mounted:function(){this.containerElement=this.$refs.container||this.$el,this.container=Ct(this.containerElement,It(this))},updated:function(){if(this.$refs.container!==this.containerElement&&this.$el!==this.containerElement)return this.container&&this.container.dispose(),this.containerElement=this.$refs.container||this.$el,void(this.container=Ct(this.containerElement,It(this)));this.container.setOptions(It(this))},destroyed:function(){this.container&&this.container.dispose()},props:{behaviour:String,groupName:String,orientation:String,dragHandleSelector:String,nonDragAreaSelector:String,dragBeginDelay:Number,animationDuration:Number,autoScrollEnabled:{type:Boolean,default:!0},lockAxis:String,dragClass:String,dropClass:String,removeOnDropOut:{type:Boolean,default:!1},"drag-start":Function,"drag-end":Function,drop:Function,getChildPayload:Function,shouldAnimateDrop:Function,fireRelatedEventsOnly:{type:Boolean,default:!1},shouldAcceptDrop:Function,"drag-enter":Function,"drag-leave":Function,tag:{validator:At,default:"div"},getGhostParent:Function,"drop-ready":Function,dropPlaceholder:[Object,Boolean]},render:function(){var e=Rt(this);return o.h(e.value,Object.assign({},{ref:"container"},e.props),this.$slots.default())}},W={name:"Draggable",props:{tag:{validator:At,default:"div"},dragNotAllowed:{type:Boolean,default:!1}},render:function(){return e=o.h,n=Rt(t=this,["dndrop-draggable-wrapper",t.dragNotAllowed?"dndrop-not-draggable":""]),e(n.value,Object.assign({},n.props),t.$slots.default());var e,t,n}};e.Container=q,e.Draggable=W,e.smoothDnD=Ct,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueDndrop={})}(this,function(e){"use strict";var i="dndrop-container-instance",v="dndrop-draggable-wrapper",o="animated",u="__smooth_dnd_draggable_translation_value",a="__smooth_dnd_draggable_visibility_value",f="dndrop-ghost",y="dndrop-container",d="dndrop-stretcher-element",c="dndrop-stretcher-instance",s="dndrop-disable-touch-action",g="dndrop-no-user-select",p="dndrop-drop-preview-default-class",m="dndrop-drop-preview-inner-class",h="dndrop-drop-preview-constant-class",b="dndrop-drop-preview-flex-container-class",w={groupName:void 0,behaviour:"move",orientation:"vertical",getChildPayload:void 0,animationDuration:250,autoScrollEnabled:!0,shouldAcceptDrop:void 0,shouldAnimateDrop:void 0};function x(e){e.element;var l=e.draggables;return function(e,t){var n,o=e.removedIndex,i=e.addedIndex,r=e.element,a=null;null!==o&&(a=r.removeChild(r.children[o]),l.splice(o,1)),null!==i&&((n=window.document.createElement("div")).className="dndrop-draggable-wrapper",n.appendChild(a&&a.firstElementChild?a.firstElementChild:r),o=n,(a=i)>=(r=r).children.length?r.appendChild(o):r.insertBefore(o,r.children[a]),i>=l.length?l.push(n):l.splice(i,0,n)),t&&t(e)}}function r(e,t){var n=window.getComputedStyle(e),e=n.overflow,t=n["overflow-"+t];return"auto"===e||"scroll"===e||("auto"===t||"scroll"===t)}function E(e,t){for(var n=e,o=t||S(e),n=e.parentElement;n;)R(n,"x")&&C(n,"x")&&(o=O(o,n.getBoundingClientRect(),"x")),R(n,"y")&&C(n,"y")&&(o=O(o,n.getBoundingClientRect(),"y")),n=n.parentElement;return o}function D(e,t){return-1<e.className.split(" ").map(function(e){return e}).indexOf(t)}var l={x:"x",y:"y",xy:"xy"},O=function(e,t,n){return"x"===n?{left:Math.max(e.left,t.left),top:e.top,right:Math.min(e.right,t.right),bottom:e.bottom}:{left:e.left,top:Math.max(e.top,t.top),right:e.right,bottom:Math.min(e.bottom,t.bottom)}},S=function(e){var t,n=e.getBoundingClientRect(),n={left:n.left,right:n.right,top:n.top,bottom:n.bottom};return R(e,"x")&&!C(e,"x")&&(t=n.right-n.left,n.right=n.right+e.scrollWidth-t),R(e,"y")&&!C(e,"y")&&(t=n.bottom-n.top,n.bottom=n.bottom+e.scrollHeight-t),n},C=function(e,t){var n=window.getComputedStyle(e),e=n.overflow,t=n["overflow-"+t];return"auto"===e||"scroll"===e||"hidden"===e||("auto"===t||"scroll"===t||"hidden"===t)},R=function(e,t){return"x"===t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight},A=function(t,n){var o=[];function e(){o&&(o.forEach(function(e){return e.removeEventListener("scroll",n)}),window.removeEventListener("scroll",n))}return function(){var e=t;for(;e;)(r(e,"x")||r(e,"y"))&&o.push(e),e=e.parentElement}(),{dispose:function(){e(),o=null},start:function(){o&&(o.forEach(function(e){return e.addEventListener("scroll",n)}),window.addEventListener("scroll",n))},stop:e}},B=function(e,t){for(var n=e;n;){if(n.matches(t))return n;n=n.parentElement}return null},I=function(e,t){var n;!e||-1===(n=e.className.split(" ").filter(function(e){return e})).indexOf(t)&&(n.unshift(t),e.className=n.join(" "))},T=function(e,t){var n;e&&(n=e.className.split(" ").filter(function(e){return e&&e!==t}),e.className=n.join(" "))},P=function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():window.document.selection&&window.document.selection.empty()},N=function(e){if(e){e=window.getComputedStyle(e);if(e)return e.cursor}return null};function z(e){return!(e.bottom<=e.top||e.right<=e.left)}var L={size:"offsetWidth",distanceToParent:"offsetLeft",translate:"transform",begin:"left",end:"right",dragPosition:"x",scrollSize:"scrollWidth",offsetSize:"offsetWidth",scrollValue:"scrollLeft",scale:"scaleX",setSize:"width",setters:{translate:function(e){return"translate3d("+e+"px, 0, 0)"}}},M={size:"offsetHeight",distanceToParent:"offsetTop",translate:"transform",begin:"top",end:"bottom",dragPosition:"y",scrollSize:"scrollHeight",offsetSize:"offsetHeight",scrollValue:"scrollTop",scale:"scaleY",setSize:"height",setters:{translate:function(e){return"translate3d(0,"+e+"px, 0)"}}};function F(o){return{get:function(e,t){return e[o[t]||t]},set:function(e,t,n){e[o[t]]=o.setters[t]?o.setters[t](n):n}}}function j(n,l){n["dndrop-extra-size-for-insertion"]=0;var o=F("horizontal"===l?L:M),s={translation:0};function e(){var e,t;i(n),t=(e=n).getBoundingClientRect(),s.scaleX=e.offsetWidth?(t.right-t.left)/e.offsetWidth:1,s.scaleY=e.offsetHeight?(t.bottom-t.top)/e.offsetHeight:1}function i(e){s.rect=S(e);e=E(e,s.rect);z(e)&&(s.lastVisibleRect=s.visibleRect),s.visibleRect=e}function r(e){var t=e;if(t.tagName){t=t.getBoundingClientRect();return"vertical"===l?t.bottom-t.top:t.right-t.left}return o.get(e,"size")*o.get(s,"scale")}function t(e){return o.get(e,"dragPosition")}return window.addEventListener("resize",function(){i(n)}),setTimeout(function(){e()},10),{getSize:r,getContainerRectangles:function(){return{rect:s.rect,visibleRect:s.visibleRect,lastVisibleRect:s.lastVisibleRect}},getBeginEndOfDOMRect:function(e){return{begin:o.get(e,"begin"),end:o.get(e,"end")}},getBeginEndOfContainer:function(){return{begin:o.get(s.rect,"begin")+s.translation,end:o.get(s.rect,"end")+s.translation}},getBeginEndOfContainerVisibleRect:function(){return{begin:o.get(s.visibleRect,"begin")+s.translation,end:o.get(s.visibleRect,"end")+s.translation}},getBeginEnd:function(e){var t=(t=e,(o.get(t,"distanceToParent")+(t[u]||0))*o.get(s,"scale")+(o.get(s.rect,"begin")+s.translation)-o.get(n,"scrollValue"));return{begin:t,end:t+r(e)*o.get(s,"scale")}},getAxisValue:t,setTranslation:function(e,t){t?o.set(e.style,"translate",t):e.style.removeProperty("transform"),e[u]=t},getTranslation:function(e){return e[u]},setVisibility:function(e,t){void 0!==e[a]&&e[a]===t||(t?e.style.removeProperty("visibility"):e.style.visibility="hidden",e[a]=t)},isVisible:function(e){return void 0===e[a]||e[a]},isInVisibleRect:function(e,t){var n=s.visibleRect,o=n.left,i=n.top,r=n.right,a=n.bottom;return a-i<2&&(a=i+30),n=s.rect,"vertical"===l?e>n.left&&e<n.right&&i<t&&t<a:o<e&&e<r&&t>n.top&&t<n.bottom},setSize:function(e,t){o.set(e,"setSize",t)},getTopLeftOfElementBegin:function(e){var t=0;return{top:"horizontal"===l?(t=e,s.rect.top):(t=s.rect.left,e),left:t}},getScrollSize:function(e){return o.get(e,"scrollSize")},getScrollValue:function(e){return o.get(e,"scrollValue")},setScrollValue:function(e,t){return o.set(e,"scrollValue",t)},invalidate:e,invalidateRects:function(){i(n)},getPosition:t,setBegin:function(e,t){o.set(e,"begin",t)}}}var _="x",V="y",X="xy";function k(e,t,n){var o,i,r=n.left,a=n.right,l=n.top,s=n.bottom,n=e.x,e=e.y;if(n<r||a<n||e<l||s<e)return null;s="x"===t?(o=r,i=a,n):(o=l,i=s,e),e=i-o,e=400<e?100:e/4;return i-s<e?{direction:"end",speedFactor:(e-(i-s))/e}:s-o<e?{direction:"begin",speedFactor:(e-(s-o))/e}:null}function Y(e,t,n){e&&(e!==window?"x"===t?e.scrollLeft+=n:e.scrollTop+=n:"x"===t?e.scrollBy(n,0):e.scrollBy(0,n))}function H(o,i){void 0===i&&(i="y");var r=null,a=null,l=null,s=null;return{animate:function(e,t){l=e,s=t,function n(){null===r&&(r=requestAnimationFrame(function(e){var t=e-(a=null===a?e:a);a=e;t=t/1e3*s;Y(o,i,t="begin"===l?0-t:t),r=null,n()}))}()},stop:function(){null!==r&&(cancelAnimationFrame(r),r=null),a=null}}}var t;function n(e){for(var t=[],n=e.element;n;){var o=function(e){var t=window.getComputedStyle(e),e=t.overflow;if("auto"===e||"scroll"===e)return l.xy;e=t["overflow-x"],e="auto"===e||"scroll"===e,t=t["overflow-y"],t="auto"===t||"scroll"===t;return e&&t?l.xy:e?l.x:t?l.y:null}(n);if(o&&!D(n,"dndrop-prevent-auto-scroll-class")){var i={};switch(o){case X:i.x={animator:H(n,"x")},i.y={animator:H(n,"y")};break;case _:i.x={animator:H(n,"x")};break;case V:i.y={animator:H(n,"y")}}t.push({axisAnimations:i,getRect:function(e){return function(){return E(e,e.getBoundingClientRect())}}(n),scrollerElement:n})}n=n.parentElement}return t}function G(e,i){void 0===i&&(i=1500);var r=e.reduce(function(e,t){t=n(t).filter(function(t){return!e.find(function(e){return e.scrollerElement===t.scrollerElement})});return e.concat(t)},[]);return function(e){var t,o,n=e.draggableInfo;e.reset?r.forEach(function(e){e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop()}):n&&(o=n.mousePosition,r.forEach(function(e){var t=e.axisAnimations,n=(0,e.getRect)();t.x&&(t.x.scrollParams=k(o,"x",n),e.cachedRect=n),t.y&&(t.y.scrollParams=k(o,"y",n),e.cachedRect=n)}),r.forEach(function(e){var t,n=e.axisAnimations,o=n.x,e=n.y;o&&(o.scrollParams?(n=(t=o.scrollParams).direction,t=t.speedFactor,o.animator.animate(n,t*i)):o.animator.stop()),e&&(e.scrollParams?(o=(t=e.scrollParams).direction,t=t.speedFactor,e.animator.animate(o,t*i)):e.animator.stop())}),(e=r.filter(function(e){return e.cachedRect})).length&&1<e.length&&((t=function(e,t){for(var n=document.elementFromPoint(t.x,t.y);n;){var o=e.find(function(e){return e.scrollerElement===n});if(o)return o;n=n.parentElement}return null}(e,n.mousePosition))&&e.forEach(function(e){e!==t&&(e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop())})))}}"undefined"!=typeof window&&((t=Element)&&t.prototype&&!t.prototype.matches&&(t.prototype.matches=t.prototype.matchesSelector||t.prototype.mozMatchesSelector||t.prototype.msMatchesSelector||t.prototype.oMatchesSelector||t.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n}),Array.prototype.some||(Array.prototype.some=function(e){if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");if("function"!=typeof e)throw new TypeError;for(var t=Object(this),n=t.length>>>0,o=2<=arguments.length?arguments[1]:void 0,i=0;i<n;i++)if(i in t&&e.call(o,t[i],i,t))return!0;return!1}));var $={overflow:"hidden",display:"block"},W={height:"100%",display:"table-cell","vertical-align":"top"},q={};function U(o){return Object.keys(o).reduce(function(e,t){var n=o[t];return"object"==typeof n?""+e+t+"{"+U(n)+"}":""+e+t+":"+n+";"},"")}function J(e){if(e&&"undefined"!=typeof window){var t=window.document.head||window.document.getElementsByTagName("head")[0],n=window.document.createElement("style"),e=U({"body *":{cursor:e+" !important"}});return n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(window.document.createTextNode(e)),t.appendChild(n),n}return null}q["."+y]={position:"relative","min-height":"30px","min-width":"30px"},q["."+y+".horizontal"]={display:"table"},q["."+y+".horizontal > ."+d]={display:"inline-block"},q["."+y+".horizontal > ."+v]=W,q["."+y+".vertical > ."+v]=$,q["."+v]={"box-sizing":"border-box"},q["."+v+".horizontal"]=W,q["."+v+".vertical"]=$,q["."+v+".animated"]={transition:"transform ease"},q["."+f]={"box-sizing":"border-box"},q["."+f+".animated"]={transition:"all ease-in-out"},q["."+f+" *"]={"pointer-events":"none"},q["."+s+" *"]={"touch-action":"none","-ms-touch-action":"none"},q["."+g]={"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},q["."+m]={flex:"1"},q["."+y+".horizontal > ."+h]={height:"100%",overflow:"hidden",display:"table-cell","vertical-align":"top"},q["."+y+".vertical > ."+h]={overflow:"hidden",display:"block",width:"100%"},q["."+b]={width:"100%",height:"100%",display:"flex","justify-content":"stretch","align-items":"stretch"},q["."+p]={"background-color":"rgba(150, 150, 150, 0.1)",border:"1px solid #ccc"};var K,Q,Z=["mousedown","touchstart"],ee=["mousemove","touchmove"],te=["mouseup","touchend"],ne=null,oe=null,ie=null,re=null,ae=[],le=!1,se=!1,ue=!1,de=!1,ce=null,fe=null,ge=null,pe=null,me=(K=null,Q=!1,{start:function(){Q||(Q=!0,function e(){K=requestAnimationFrame(function(){ne.forEach(function(e){return e.layout.invalidateRects()}),setTimeout(function(){null!==K&&e()},50)})}())},stop:function(){null!==K&&(cancelAnimationFrame(K),K=null),Q=!1}}),he="undefined"!=typeof window&&!!(window.navigator.userAgent.match(/Android/i)||window.navigator.userAgent.match(/webOS/i)||window.navigator.userAgent.match(/iPhone/i)||window.navigator.userAgent.match(/iPad/i)||window.navigator.userAgent.match(/iPod/i)||window.navigator.userAgent.match(/BlackBerry/i)||window.navigator.userAgent.match(/Windows Phone/i));function ve(){"undefined"!=typeof window&&Z.forEach(function(e){window.document.addEventListener(e,Ne,{passive:!1})})}function ye(){return re&&re.ghostParent?re.ghostParent:oe&&oe.parentElement||window.document.body}function be(e,t,n,o){var i=t.x,r=t.y,a=e.getBoundingClientRect(),l=a.left,s=a.top,u=a.right,d=a.bottom,t=(t=n.layout.getContainerRectangles().visibleRect,a=a,{left:Math.max(t.left,a.left),top:Math.max(t.top,a.top),right:Math.min(t.right,a.right),bottom:Math.min(t.bottom,a.bottom)}),a=t.left+(t.right-t.left)/2,t=t.top+(t.bottom-t.top)/2,c=e.cloneNode(!0);return c.style.zIndex="1000",c.style.boxSizing="border-box",c.style.position="fixed",c.style.top="0px",c.style.left="0px",c.style.transform="none",c.style.removeProperty("transform"),n.shouldUseTransformForGhost()?c.style.transform="translate3d("+l+"px, "+s+"px, 0)":(c.style.top=s+"px",c.style.left=l+"px"),c.style.width=u-l+"px",c.style.height=d-s+"px",c.style.overflow="visible",c.style.transition=null,c.style.removeProperty("transition"),c.style.pointerEvents="none",c.style.userSelect="none",n.getOptions().dragClass?setTimeout(function(){I(c.firstElementChild,n.getOptions().dragClass);var e=window.getComputedStyle(c.firstElementChild).cursor;pe=J(e)}):pe=J(o),I(c,n.getOptions().orientation||"vertical"),I(c,f),{ghost:c,centerDelta:{x:a-i,y:t-r},positionDelta:{left:l-i,top:s-r},topLeft:{x:l,y:s}}}function we(e){function i(){T(ie.ghost,"animated"),ie.ghost.style.transitionDuration=null,ye().removeChild(ie.ghost),e()}function t(e,t,n){var o=e.top,e=e.left;I(ie.ghost,"animated"),n&&I(ie.ghost.firstElementChild,n),ie.topLeft.x=e,ie.topLeft.y=o,Qe(t),setTimeout(function(){i()},t+20)}function n(e,t){I(ie.ghost,"animated"),Qe(e,.9,!0),setTimeout(function(){t()},e+20)}var o,r,a,l,s,u;re.targetElement?(o=ae.filter(function(e){return e.element===re.targetElement})[0],!(u=o.getOptions()).shouldAnimateDrop||u.shouldAnimateDrop(re.container.getOptions(),re.payload)?t(o.getDragResult().shadowBeginEnd.rect,Math.max(150,o.getOptions().animationDuration/2),o.getOptions().dropClass):i()):(r=ae.filter(function(e){return e===re.container})[0])?(l=(a=r.getOptions()).behaviour,s=a.removeOnDropOut,"move"!==l&&"contain"!==l||!se&&s||!r.getDragResult()?n(r.getOptions().animationDuration,i):!z((a=r.layout.getContainerRectangles()).visibleRect)&&z(a.lastVisibleRect)?t({top:a.lastVisibleRect.top,left:a.lastVisibleRect.left},r.getOptions().animationDuration,r.getOptions().dropClass):(s=(l=r.getDragResult()).removedIndex,a=l.elementSize,l=r.layout,r.getTranslateCalculator({dragResult:{removedIndex:s,addedIndex:s,elementSize:a,pos:void 0,shadowBeginEnd:void 0}}),s=0<s?l.getBeginEnd(r.draggables[s-1]).end:l.getBeginEndOfContainer().begin,t(l.getTopLeftOfElementBegin(s),r.getOptions().animationDuration,r.getOptions().dropClass))):n(w.animationDuration,i)}var xe,Ee,De,Oe,Se,Ce,Re=(Se=1,Ce=5,function(e,t,n){xe=ke(e),De=n,(Ee="number"==typeof t?t:he?200:0)&&(Oe=setTimeout(Pe,Ee)),ee.forEach(function(e){return window.document.addEventListener(e,Ae)},{passive:!1}),te.forEach(function(e){return window.document.addEventListener(e,Be)},{passive:!1}),window.document.addEventListener("drag",Ie,{passive:!1})});function Ae(e){var t=ke(e),e=t.clientX,t=t.clientY;if(Ee)(Math.abs(xe.clientX-e)>Ce||Math.abs(xe.clientY-t)>Ce)&&Te();else if(Math.abs(xe.clientX-e)>Se||Math.abs(xe.clientY-t)>Se)return Pe()}function Be(){Te()}function Ie(){Te()}function Te(){clearTimeout(Oe),ee.forEach(function(e){return window.document.removeEventListener(e,Ae)},{passive:!1}),te.forEach(function(e){return window.document.removeEventListener(e,Be)},{passive:!1}),window.document.removeEventListener("drag",Ie,{passive:!1})}function Pe(){clearTimeout(Oe),Te(),De()}function Ne(e){var t,n,o,i,r,a,l=ke(e);le||void 0!==l.button&&0!==l.button||(oe=B(l.target,"."+v))&&(t=B(oe,"."+y),o=(n=ae.filter(function(e){return e.element===t})[0]).getOptions().dragHandleSelector,i=n.getOptions().nonDragAreaSelector,r=!0,o&&!B(l.target,o)&&(r=!1),(r=i&&B(l.target,i)?!1:r)&&(n.layout.invalidate(),I(window.document.body,s),I(window.document.body,g),a=function(){T(window.document.body,s),T(window.document.body,g),window.document.removeEventListener("mouseup",a)},window.document.addEventListener("mouseup",a)),r&&Re(l,n.getOptions().dragBeginDelay,function(){P(),We(l,N(e.target)),ee.forEach(function(e){window.document.addEventListener(e,ze,{passive:!1})}),te.forEach(function(e){window.document.addEventListener(e,Xe,{passive:!1})})}))}function ze(e){e.preventDefault();var t,n=ke(e);re?("contain"===(t=re.container.getOptions()).behaviour?function(e,t){var n=e.clientX,o=e.clientY;void 0===t&&(t="vertical");var i,r,e=re.container.layout.getBeginEndOfContainerVisibleRect(),t="vertical"===t?(i=o,r="y",a="top",re.size.offsetHeight):(i=n,r="x",a="left",re.size.offsetWidth),o=e.begin,n=e.end-t,a=Math.max(o,Math.min(n,i+ie.positionDelta[a]));ie.topLeft[r]=a,re.position[r]=Math.max(e.begin,Math.min(e.end,i+ie.centerDelta[r])),re.mousePosition[r]=Math.max(e.begin,Math.min(e.end,i)),re.position[r]<e.begin+t/2&&(re.position[r]=e.begin+2),re.position[r]>e.end-t/2&&(re.position[r]=e.end-2)}(n,t.orientation):ge?"y"===ge?(ie.topLeft.y=n.clientY+ie.positionDelta.top,re.position.y=n.clientY+ie.centerDelta.y,re.mousePosition.y=n.clientY):"x"===ge&&(ie.topLeft.x=n.clientX+ie.positionDelta.left,re.position.x=n.clientX+ie.centerDelta.x,re.mousePosition.x=n.clientX):(ie.topLeft.x=n.clientX+ie.positionDelta.left,ie.topLeft.y=n.clientY+ie.positionDelta.top,re.position.x=n.clientX+ie.centerDelta.x,re.position.y=n.clientY+ie.centerDelta.y,re.mousePosition.x=n.clientX,re.mousePosition.y=n.clientY),Qe(),(de=!ce(re))&&_e()):We(n,N(e.target))}var Le,Me,Fe,je,_e=(Le=Ve,Fe=!(Me=20),function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];je&&clearTimeout(je),Fe&&!je?Le.call.apply(Le,[null].concat(e)):je=setTimeout(function(){je=null,Le.call.apply(Le,[null].concat(e))},Me)});function Ve(){de&&(de=!1,Ye(re,ne))}function Xe(){var e;ee.forEach(function(e){window.document.removeEventListener(e,ze,{passive:!1})}),te.forEach(function(e){window.document.removeEventListener(e,Xe,{passive:!1})}),fe&&"function"==typeof fe&&fe({reset:!0}),pe&&((e=pe)&&"undefined"!=typeof window&&(window.document.head||window.document.getElementsByTagName("head")[0]).removeChild(e),pe=null),re&&(me.stop(),Ve(),ue=!0,we(function(){$e(le=!1);for(var e=ne||[],t=e.shift();void 0!==t;)t.handleDrop(re),t=e.shift();ce=ge=re=ie=oe=ne=null,ue=!1}))}function ke(e){return e.touches?e.touches[0]:e}function Ye(t,e){var n=!1;e.forEach(function(e){e=e.handleDrag(t);n=!!e.containerBoxChanged||!1,e.containerBoxChanged=!1}),n&&(n=!1,requestAnimationFrame(function(){ae.forEach(function(e){e.layout.invalidateRects(),e.onTranslated()})}))}function He(e){var t=e,n=null;return function(e){return!(null!==n||!le||ue)&&(n=requestAnimationFrame(function(){le&&!ue&&(Ye(e,t),fe({draggableInfo:e})),n=null}),!0)}}function Ge(e,t){return e.getOptions().autoScrollEnabled?G(t,e.getScrollMaxSpeed()):function(e){return null}}function $e(o){var i=re.container,r=re.payload;ae.forEach(function(e){var t,n;i.getOptions().fireRelatedEventsOnly&&e!==i||(t=(n=e.getOptions()).onDragStart,n=n.onDragEnd,(t=o?t:n)&&(n={isSource:e===i,payload:r,willAcceptDrop:!1},e.isDragRelevant(i,r)&&(n.willAcceptDrop=!0),t(n)))})}function We(e,t){var n,o,i,r,a,l;null!==oe&&(oe.classList.contains("dndrop-not-draggable")||(le=!0,(n=ae.filter(function(e){return oe.parentElement===e.element})[0]).setDraggables(),ge=n.getOptions().lockAxis?n.getOptions().lockAxis.toLowerCase():null,o=oe,i=ae.filter(function(e){return o.parentElement===e.element})[0],r=i.draggables.indexOf(o),a=i.getOptions().getGhostParent,l=o.getBoundingClientRect(),re={container:i,element:o,size:{offsetHeight:l.bottom-l.top,offsetWidth:l.right-l.left},elementIndex:r,payload:i.getOptions().getChildPayload?i.getOptions().getChildPayload(r):void 0,targetElement:null,position:{x:0,y:0},groupName:i.getOptions().groupName,ghostParent:a?a():null,invalidateShadow:null,mousePosition:null,relevantContainers:null},ie=be(oe,{x:e.clientX,y:e.clientY},re.container,t),re.position={x:e.clientX+ie.centerDelta.x,y:e.clientY+ie.centerDelta.y},re.mousePosition={x:e.clientX,y:e.clientY},ne=ae.filter(function(e){return e.isDragRelevant(n,re.payload)}),re.relevantContainers=ne,ce=He(ne),fe&&"function"==typeof fe&&fe({reset:!0,draggableInfo:void 0}),fe=Ge(n,ne),ne.forEach(function(e){return e.prepareDrag(e,ne)}),$e(!0),ce(re),ye().appendChild(ie.ghost),me.start()))}var qe,Ue,Je,Ke=je=Oe=null;function Qe(e,t,n){void 0===e&&(e=0),void 0===t&&(t=1),void 0===n&&(n=!1);var o=ie.ghost,i=ie.topLeft,r=i.x,a=i.y,l=!re.container||re.container.shouldUseTransformForGhost(),s=l?"translate3d("+r+"px,"+a+"px, 0)":null;if(1!==t&&(s=s?s+" scale("+t+")":"scale("+t+")"),0<e)return ie.ghost.style.transitionDuration=e+"ms",void requestAnimationFrame(function(){s&&(o.style.transform=s),l||(o.style.left=r+"px",o.style.top=a+"px"),Ke=null,n&&(o.style.opacity="0")});null===Ke&&(Ke=requestAnimationFrame(function(){s&&(o.style.transform=s),l||(o.style.left=r+"px",o.style.top=a+"px"),Ke=null,n&&(o.style.opacity="0")}))}function Ze(){var t;!le||se||ue||(de=!(se=!0),t=Object.assign({},re,{targetElement:null,position:{x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER},mousePosition:{x:Number.MAX_SAFE_INTEGER,y:Number.MAX_SAFE_INTEGER}}),ne.forEach(function(e){e.handleDrag(t)}),re&&(re.targetElement=null,re.cancelDrop=!0,Xe(),se=!1))}"undefined"!=typeof window&&"undefined"!=typeof window&&(qe=window.document.head||window.document.getElementsByTagName("head")[0],(Ue=window.document.createElement("style")).id="dndrop-style-definitions",Je=U(q),Ue.type="text/css",Ue.styleSheet?Ue.styleSheet.cssText=Je:Ue.appendChild(window.document.createTextNode(Je)),qe.appendChild(Ue));var et=(ve(),{register:function(e){e=e,ae.push(e),le&&re&&e.isDragRelevant(re.container,re.payload)&&(ne.push(e),e.prepareDrag(e,ne),fe&&"function"==typeof fe&&fe({reset:!0,draggableInfo:void 0}),fe=Ge(e,ne),ce=He(ne),e.handleDrag(re))},unregister:function(e){var t;t=e,ae.splice(ae.indexOf(t),1),le&&re&&(re.container===t&&t.fireRemoveElement(),re.targetElement===t.element&&(re.targetElement=null),-1<(e=ne.indexOf(t))&&(ne.splice(e,1),fe&&"function"==typeof fe&&fe({reset:!0,draggableInfo:void 0}),fe=Ge(t,ne),ce=He(ne)))},isDragging:function(){return le},cancelDrag:Ze});function tt(e,t,n){void 0===n&&(n=w.animationDuration),t?(I(e,o),e.style.transitionDuration=n+"ms"):(T(e,o),e.style.removeProperty("transition-duration"))}function nt(n){var o=[];return Array.prototype.forEach.call(n.children,function(e){var t;e.nodeType===Node.ELEMENT_NODE?((t=!D(t=e,v)?function(e){if(St.wrapChild){var t=window.document.createElement("div");return t.className=""+v,e.parentElement.insertBefore(t,e),t.appendChild(e),t}return e}(e):t)[u]=0,o.push(t)):n.removeChild(e)}),o}function ot(e){function s(e,t,n,o,i){if(void 0===i&&(i=!1),o<n)return n;if(n!==o)return r=Math.floor((o+n)/2),l=u.getBeginEnd(e[r]),a=l.begin,l=l.end,t<a?s(e,t,n,r-1,i):l<t?s(e,t,r+1,o,i):!i||t<(l+a)/2?r:r+1;var r=u.getBeginEnd(e[n]),a=r.begin,l=r.end;return!i||t<(l+a)/2?n:n+1}var u=e.layout;return function(e,t,n){return s(e,t,0,e.length-1,n=void 0===n?!1:n)}}function it(e){var t,n,o,i=e.element,r=e.draggables,a=e.layout,l=e.getOptions,s=(t=(e={element:i,draggables:r,layout:a,getOptions:l}).element,n=e.draggables,o=e.layout,function(){n.forEach(function(e){tt(e,!1),o.setTranslation(e,0),o.setVisibility(e,!0)}),t[c]&&(t[c].parentNode.removeChild(t[c]),t[c]=null)}),u=(St.dropHandler||x)({element:i,draggables:r,layout:a,getOptions:l});return function(e,t,n){var o=t.addedIndex,t=t.removedIndex;if(void 0===n&&(n=!1),s(),e&&!e.cancelDrop)if(e.targetElement||l().removeOnDropOut||n){n=function(e){return null!==e},o=n(o)?n(t)&&t<o?o-1:o:null;console.log("draggable info",e.element);var i={removedIndex:t,addedIndex:o,payload:e.payload,element:e.element&&e.element.firstElementChild?e.element.firstElementChild:void 0};(!e.container.getOptions().fireRelatedEventsOnly||n(t)||n(o))&&u(i,l().onDrop)}else if(l().dropNotAllowed){i=e.payload,e=e.container;return l().dropNotAllowed({payload:i,container:e})}}}function rt(e){var n=e.element,o=e.getOptions,i=null;return function(e){var t=e.draggableInfo,e=i;return{removedIndex:e=null==i&&t.container.element===n&&"copy"!==o().behaviour?i=t.elementIndex:e}}}function at(e){var t=e.draggables,n=e.layout;return function(e){e=e.dragResult;null!==e.removedIndex&&n.setVisibility(t[e.removedIndex],!1)}}function lt(e){var n=e.element,o=e.layout;return function(e){var t=e.draggableInfo,e=document.elementFromPoint(t.position.x,t.position.y);if(e){e=function(e,t){for(var n=e;n;){if(n[i]){var o=n[i];if(t.some(function(e){return e===o}))return o}n=n.parentElement}return null}(e,t.relevantContainers);if(e&&e.element===n)return{pos:o.getPosition(t.position)}}return{pos:null}}}function st(e){var n=e.layout,o=null;return function(e){var t=e.draggableInfo;return null===e.dragResult.pos?o=null:{elementSize:o=o||n.getSize(t.size)}}}function ut(e){var o=e.element;return function(e){var t=e.draggableInfo,n=e.dragResult;e=t,t=o,void 0===(n=!!n.pos)&&(n=!0),t&&n?e.targetElement=t:e.targetElement===t&&(e.targetElement=null)}}function dt(){return function(e){return null!==e.dragResult.pos?{addedIndex:0}:{addedIndex:null}}}function ct(e){var t=e.layout,n=null;return function(e){e=e.dragResult.addedIndex;if(e===n)return null;n=e;e=t.getBeginEndOfContainer().begin;return{shadowBeginEnd:{rect:t.getTopLeftOfElementBegin(e)}}}}function ft(e){var u=e.layout,d=e.element,c=e.getOptions,f=null;return function(e){var t=e.dragResult,n=t.elementSize,o=t.shadowBeginEnd,i=t.addedIndex,r=t.dropPlaceholderContainer,a=c();if(a.dropPlaceholder){var l="boolean"==typeof a.dropPlaceholder?{}:a.dropPlaceholder,s=l.animationDuration,e=l.className,t=l.showOnTop;return null===i?(r&&null!==f&&d.removeChild(r),f=null,{dropPlaceholderContainer:void 0}):(r||(a=document.createElement("div"),(l=document.createElement("div")).className=b,a.className=m+" "+(e||p),(r=document.createElement("div")).className=h,r.style.position="absolute",void 0!==s&&(r.style.transition="all "+s+"ms ease"),r.appendChild(l),l.appendChild(a),u.setSize(r.style,n+"px"),r.style.pointerEvents="none",t?d.appendChild(r):d.insertBefore(r,d.firstElementChild)),f!==i&&o.dropArea&&u.setBegin(r.style,o.dropArea.begin-u.getBeginEndOfContainer().begin+"px"),f=i,{dropPlaceholderContainer:r})}return null}}function gt(e){var n=yt(e);return function(e){var t=e.draggableInfo,e=e.dragResult;return t.invalidateShadow?n({draggableInfo:t,dragResult:e}):null}}function pt(e){var n,o,i=(n=e.draggables,o=ot({layout:e.layout}),function(e){var t=e.dragResult,e=t.shadowBeginEnd,t=t.pos;if(e)return e.begin+e.beginAdjustment<=t&&e.end>=t?null:t<e.begin+e.beginAdjustment?o(n,t):t>e.end?o(n,t)+1:n.length;t=o(n,t,!0);return null!==t?t:n.length});return function(e){var t=e.dragResult,e=null;return{addedIndex:e=null!==t.pos&&null===(e=i({dragResult:t}))?t.addedIndex:e}}}function mt(){var n=null;return function(e){var t=e.dragResult,e=t.addedIndex,t=t.shadowBeginEnd;e!==n&&null!==n&&t&&(t.beginAdjustment=0),n=e}}function ht(e){var i=e.element,r=e.draggables,a=e.layout,l=e.getOptions,s=null;return function(e){var t=e.dragResult,n=t.addedIndex,e=t.removedIndex,t=t.elementSize;if(null===e)if(null!==n){if(!s){e=a.getBeginEndOfContainer();e.end=e.begin+a.getSize(i);n=a.getScrollSize(i)>a.getSize(i)?e.begin+a.getScrollSize(i)-a.getScrollValue(i):e.end,e=0<r.length?a.getBeginEnd(r[r.length-1]).end-r[r.length-1][u]:e.begin;if(n<e+t){(s=window.document.createElement("div")).className=d+" "+l().orientation;var o=0<r.length?t+e-n:t;return a.setSize(s.style,o+"px"),i.appendChild(s),i[c]=s,{containerBoxChanged:!0}}}}else if(s){a.setTranslation(s,0);o=s;return s=null,i.removeChild(o),{containerBoxChanged:!(i[c]=null)}}}}function vt(e){var l=e.draggables,s=e.layout,u=null,d=null;return function(e){var e=e.dragResult,t=e.addedIndex,n=e.removedIndex,o=e.elementSize;if(t!==u||n!==d){for(var i,r,a=0;a<l.length;a++)a!==n&&(i=l[a],r=0,null!==n&&n<a&&(r-=o),null!==t&&t<=a&&(r+=o),s.setTranslation(i,r));return{addedIndex:u=t,removedIndex:d=n}}}}function yt(e){var c=e.draggables,f=e.layout,g=null;return function(e){var t=e.draggableInfo,n=e.dragResult,o=n.addedIndex,i=n.removedIndex,r=n.elementSize,a=n.pos,l=n.shadowBeginEnd;if(null===a)return{shadowBeginEnd:g=null};if(null===o||!t.invalidateShadow&&o===g)return null;var s=o-1,u=Number.MIN_SAFE_INTEGER,e=0,n=0,a=null,t=null;s===i&&s--;var e=-1<s?(d=f.getSize(c[s]),t=f.getBeginEnd(c[s]),u=r<d?t.end-(d-r)/2:t.end,t.end):(t={end:f.getBeginEndOfContainer().begin},f.getBeginEndOfContainer().begin),s=Number.MAX_SAFE_INTEGER,d=o;d===i&&d++;n=d<c.length?(i=f.getSize(c[d]),a=f.getBeginEnd(c[d]),s=r<i?a.begin+(i-r)/2:a.begin,a.begin):(a={begin:f.getContainerRectangles().rect.end},f.getContainerRectangles().rect.end-f.getContainerRectangles().rect.begin),t=t&&a?f.getTopLeftOfElementBegin(t.end):null;return g=o,{shadowBeginEnd:{dropArea:{begin:e,end:n},begin:u,end:s,rect:t,beginAdjustment:l?l.beginAdjustment:0}}}}function bt(){var o=null;return function(e){var t=e.dragResult,n=t.pos,e=t.addedIndex,t=t.shadowBeginEnd;null!==n?null!=e&&null===o&&(n<t.begin&&(n=n-t.begin-5,t.beginAdjustment=n),o=e):o=null}}function wt(e){var e=e.getOptions,t=!1,n=e();return function(e){e=!!e.dragResult.pos;e!==t&&((t=e)?n.onDragEnter&&n.onDragEnter():n.onDragLeave&&n.onDragLeave())}}function xt(e){var e=e.getOptions,r=null,a=e();return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,i=e.draggableInfo,t=i.payload,e=i.element;a.onDropReady&&null!==n&&r!==n&&(i=r=n,null!==o&&o<n&&i--,a.onDropReady({addedIndex:i,removedIndex:o,payload:t,element:e?e.firstElementChild:void 0}))}}function Et(e){return"drop-zone"===e.getOptions().behaviour?Dt(e)(rt,at,lt,st,ut,dt,ct,wt,xt):Dt(e)(rt,at,lt,st,ut,gt,pt,mt,ht,vt,yt,ft,bt,wt,xt)}function Dt(n){return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var o=e.map(function(e){return e(n)}),i=null;return function(n){return i=o.reduce(function(e,t){return Object.assign(e,t({draggableInfo:n,dragResult:e}))},i||{addedIndex:null,removedIndex:null,elementSize:null,pos:null,shadowBeginEnd:null})}}}function Ot(h){return function(e){var t,n,o,i,r,a=Object.assign({},w,e),l=null,s=null,u=(n=m,o=nt(t=h),e=n(),I(t,y+" "+e.orientation),{element:t,draggables:o,getOptions:n,layout:j(t,e.orientation,e.animationDuration)}),d=Et(u),c=it(u),f=A(h,function(){u.layout.invalidateRects(),g()});function g(){null!==s&&(s.invalidateShadow=!0,l=d(s),s.invalidateShadow=!1)}function p(e,t){for(var n=nt(t),o=0;o<n.length;o++)e[o]=n[o];for(var i=0;i<e.length-n.length;i++)e.pop()}function m(){return a}return{element:h,draggables:u.draggables,isDragRelevant:(i=(e=u).element,r=e.getOptions,function(e,t){var n=r();if(n.shouldAcceptDrop)return n.shouldAcceptDrop(e.getOptions(),t);t=e.getOptions();return"copy"!==n.behaviour&&(B(i,"."+v)!==e.element&&(e.element===i||!(!t.groupName||t.groupName!==n.groupName)))}),layout:u.layout,dispose:function(e){var t;f.dispose(),t=e.element,St.wrapChild&&Array.prototype.forEach.call(t.children,function(e){e.nodeType===Node.ELEMENT_NODE&&D(e,v)&&(t.insertBefore(e.firstElementChild,e),t.removeChild(e))})},prepareDrag:function(e,t){var n=e.element,o=u.draggables;p(o,n),e.layout.invalidateRects(),o.forEach(function(e){return tt(e,!0,a.animationDuration)}),f.start()},handleDrag:function(e){return l=d(s=e)},handleDrop:function(e){f.stop(),l&&l.dropPlaceholderContainer&&h.removeChild(l.dropPlaceholderContainer),s=null,d=Et(u),c(e,l),l=null},fireRemoveElement:function(){c(s,Object.assign({},l,{addedIndex:null}),!0),l=null},getDragResult:function(){return l},getTranslateCalculator:function(e){return vt(u)(e)},onTranslated:function(){g()},setDraggables:function(){p(u.draggables,h)},getScrollMaxSpeed:function(){return St.maxScrollSpeed},shouldUseTransformForGhost:function(){return!0===St.useTransformForGhost},getOptions:m,setOptions:function(e,t){a=!1===(t=void 0===t?!0:t)?Object.assign({},w,e):Object.assign({},w,a,e)}}}}var St=function(e,t){var n=Ot(e)(t);return e[i]=n,et.register(n),{dispose:function(){et.unregister(n),n.dispose(n)},setOptions:function(e,t){n.setOptions(e,t)}}};St.wrapChild=!0,St.cancelDrag=function(){et.cancelDrag()},St.isDragging=function(){return et.isDragging()};function Ct(e,t){e=e.$props.tag;if(e){if("string"==typeof e){var n={value:e};return t&&(n.props={class:t}),n}if("object"==typeof e){n={value:e.value||"div",props:e.props||{}};return t&&(n.props.class?(e=n.props.class,"[object Array]"===Object.prototype.toString.call(e)?n.props.class.push(t):n.props.class=[t,n.props.class]):n.props.class=t),n}}return{value:"div"}}function Rt(e){return!e||("string"==typeof e||"object"==typeof e&&("string"==typeof e.value||"function"==typeof e.value||"object"==typeof e.value))}St.dropHandler=function(){return function(e,t){t&&t(e)}},St.wrapChild=!1;var At={drop:"onDrop","drag-end":"onDragEnd","drag-start":"onDragStart","drag-enter":"onDragEnter","drag-leave":"onDragLeave","drop-ready":"onDropReady","drop-not-allowed":"dropNotAllowed"};function Bt(e){var i,r,t=Object.assign({},e.$props,e.$listeners);return i=t,r=e,Object.keys(i).reduce(function(e,t){var n=t,o=i[n];return void 0!==o&&("function"==typeof o?At[n]?e[At[n]]=function(e){r.$emit(n,e)}:e[n]=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return o.apply(void 0,e)}:e[n]=o),e},{})}W={name:"Container",mounted:function(){this.containerElement=this.$refs.container||this.$el,this.container=St(this.containerElement,Bt(this))},updated:function(){if(this.$refs.container!==this.containerElement&&this.$el!==this.containerElement)return this.container&&this.container.dispose(),this.containerElement=this.$refs.container||this.$el,void(this.container=St(this.containerElement,Bt(this)));this.container.setOptions(Bt(this))},destroyed:function(){this.container&&this.container.dispose()},props:{behaviour:String,groupName:String,orientation:String,dragHandleSelector:String,nonDragAreaSelector:String,dragBeginDelay:Number,animationDuration:Number,autoScrollEnabled:{type:Boolean,default:!0},lockAxis:String,dragClass:String,dropClass:String,removeOnDropOut:{type:Boolean,default:!1},"drag-start":Function,"drag-end":Function,drop:Function,getChildPayload:Function,shouldAnimateDrop:Function,fireRelatedEventsOnly:{type:Boolean,default:!1},shouldAcceptDrop:Function,"drag-enter":Function,"drag-leave":Function,tag:{validator:Rt,default:"div"},getGhostParent:Function,"drop-ready":Function,dropPlaceholder:[Object,Boolean]},render:function(e){var t=Ct(this);return e(t.value,Object.assign({},{ref:"container"},t.props),this.$slots.default)}},$={name:"Draggable",props:{tag:{validator:Rt,default:"div"},dragNotAllowed:{type:Boolean,default:!1}},render:function(e){return t=e,e=Ct(n=this,["dndrop-draggable-wrapper",n.dragNotAllowed?"dndrop-not-draggable":""]),t(e.value,Object.assign({},e.props),n.$slots.default);var t,n}};e.Container=W,e.Draggable=$,e.smoothDnD=St,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "vue-dndrop", | ||
"version": "1.1.7", | ||
"description": "Vue wrappers for drag n drop", | ||
"version": "1.1.8", | ||
"description": "Vue wrappers for drag n droppin", | ||
"author": "amendx && kutlugsahin", | ||
@@ -20,5 +20,2 @@ "repository": { | ||
"Vue.js", | ||
"vue3", | ||
"vue3.js", | ||
"vue 3.x", | ||
"sortable", | ||
@@ -25,0 +22,0 @@ "drag and drop", |
@@ -44,3 +44,3 @@ <p align="center"> | ||
```shell | ||
npm i vue-dndrop@next | ||
npm i vue-dndrop | ||
``` | ||
@@ -109,7 +109,7 @@ | ||
> Component that contains the draggable elements or components. Each of its children should be wrapped by **Draggable** component | ||
Component that contains the draggable elements or components. Each of its children should be wrapped by **Draggable** component | ||
### Properties | ||
> Properties define the visual behaviour of the library: | ||
Properties define the visual behaviour of the library: | ||
@@ -136,4 +136,4 @@ | Property | Type | Default | Description | | ||
> Tag name or the node definition to render the root element of the Container. | ||
> Default value is 'div'. | ||
Tag name or the node definition to render the root element of the Container. | ||
Default value is 'div'. | ||
@@ -159,3 +159,3 @@ ```ts | ||
> The lifecycle of a drag is both described, and can be controlled, by a series of [callbacks](#callbacks) and [events](#events), which are illustrated below for a example **containing 3 containers**: | ||
The lifecycle of a drag is both described, and can be controlled, by a series of [callbacks](#callbacks) and [events](#events), which are illustrated below for a example **containing 3 containers**: | ||
@@ -212,3 +212,3 @@ ``` | ||
payload, | ||
droppedElement, | ||
element, | ||
} | ||
@@ -229,11 +229,11 @@ ``` | ||
> This can provide handler functions context-sensitive data, such as the loop index or current item. | ||
This can provide handler functions context-sensitive data, such as the loop index or current item. | ||
## Callbacks | ||
> Callbacks provide additional logic and checks before and during user interaction. | ||
Callbacks provide additional logic and checks before and during user interaction. | ||
### `get-child-payload()` | ||
> The function to be called to get the payload object to be passed **onDrop** function. | ||
The function to be called to get the payload object to be passed **onDrop** function. | ||
@@ -262,3 +262,3 @@ ```jsx | ||
> The function to be called by all containers before drag starts to determine the containers to which the drop is possible. Setting this function will override the **group-name** property and only the return value of this function will be taken into account. | ||
The function to be called by all containers before drag starts to determine the containers to which the drop is possible. Setting this function will override the **group-name** property and only the return value of this function will be taken into account. | ||
@@ -286,4 +286,4 @@ ```jsx | ||
> The function to be called by the target container to which the dragged item will be dropped. | ||
> Sometimes dragged item's dimensions are not suitable with the target container and dropping animation can be wierd. So it can be disabled by returning **false**. If not set drop animations are enabled. | ||
The function to be called by the target container to which the dragged item will be dropped. | ||
Sometimes dragged item's dimensions are not suitable with the target container and dropping animation can be wierd. So it can be disabled by returning **false**. If not set drop animations are enabled. | ||
@@ -311,5 +311,5 @@ ```jsx | ||
> The function to be called to get the element that the dragged ghost will be appended. Default parent element is the container itself. | ||
> The ghost element is positioned as 'fixed' and appended to given parent element. | ||
> But if any anchestor of container has a transform property, ghost element will be positioned relative to that element which breaks the calculations. Thats why if you have any transformed parent element of Containers you should set this property so that it returns any element that has not transformed parent element. | ||
The function to be called to get the element that the dragged ghost will be appended. Default parent element is the container itself. | ||
The ghost element is positioned as 'fixed' and appended to given parent element. | ||
But if any anchestor of container has a transform property, ghost element will be positioned relative to that element which breaks the calculations. Thats why if you have any transformed parent element of Containers you should set this property so that it returns any element that has not transformed parent element. | ||
@@ -334,7 +334,7 @@ ```jsx | ||
> Events may call user-defined handlers at particular points in the drag-and-drop lifecycle. | ||
Events may call user-defined handlers at particular points in the drag-and-drop lifecycle. | ||
### `@drag-start` | ||
> Event to be emitted by all containers on drag start. | ||
Event to be emitted by all containers on drag start. | ||
@@ -361,3 +361,3 @@ ```jsx | ||
> The function to be called by all containers on drag end. Called before [drop](#drop) event. | ||
The function to be called by all containers on drag end. Called before [drop](#drop) event. | ||
@@ -398,3 +398,3 @@ ```jsx | ||
> The event to be emitted by the relevant container whenever a dragged item leaves its boundaries while dragging. | ||
The event to be emitted by the relevant container whenever a dragged item leaves its boundaries while dragging. | ||
@@ -413,3 +413,3 @@ ```jsx | ||
> The function to be called by the container which is being drag over, when the index of possible drop position changed in container. Basically it is called each time the draggables in a container slides for opening a space for dragged item. **dropResult** is the only parameter passed to the function which contains the following properties. | ||
The function to be called by the container which is being drag over, when the index of possible drop position changed in container. Basically it is called each time the draggables in a container slides for opening a space for dragged item. **dropResult** is the only parameter passed to the function which contains the following properties. | ||
@@ -437,3 +437,3 @@ ```jsx | ||
> The event to be emitted by any relevant container when drop is over. (After drop animation ends). Source container and any container that could accept drop is considered relevant. | ||
The event to be emitted by any relevant container when drop is over. (After drop animation ends). Source container and any container that could accept drop is considered relevant. | ||
@@ -458,7 +458,7 @@ ```jsx | ||
- **payload** : `object` : the payload object retrieved by calling [get-child-payload](#get-child-payload) function. | ||
- **droppedElement** : `DOMElement` : the DOM element that is moved | ||
- **element** : `DOMElement` : the DOM element that is moved | ||
### `@drop-not-allowed` | ||
> Event to be emitted by the current container when drop is not allowed or does not fit the rule applied inside the column/element validation. | ||
Event to be emitted by the current container when drop is not allowed or does not fit the rule applied inside the column/element validation. | ||
@@ -496,4 +496,4 @@ ```jsx | ||
> Tag name or the node definition to render the root element of the Draggable. | ||
> Default value is 'div'. | ||
Tag name or the node definition to render the root element of the Draggable. | ||
Default value is 'div'. | ||
@@ -500,0 +500,0 @@ ```jsx |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
242945
5663
0