smooth-dnd
Advanced tools
Comparing version 0.8.5 to 0.8.6
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SmoothDnD={})}(this,function(e){"use strict";var l,t,o="smooth-dnd-container-instance",g="smooth-dnd-draggable-wrapper",r="animated",p="__smooth_dnd_draggable_translation_value",c="__smooth_dnd_draggable_visibility_value",D="smooth-dnd-ghost",s="smooth-dnd-container",d="smooth-dnd-extra-size-for-insertion",v="smooth-dnd-stretcher-element",h="smooth-dnd-stretcher-instance",u="smooth-dnd-disable-touch-action",f="smooth-dnd-no-user-select",i="smooth-dnd-prevent-auto-scroll-class",n=Object.freeze({containerInstance:o,defaultGroupName:"@@smooth-dnd-default-group@@",wrapperClass:g,defaultGrabHandleClass:"smooth-dnd-default-grap-handle",animationClass:r,translationValue:p,visibilityValue:c,ghostClass:D,containerClass:s,extraSizeForInsertion:d,stretcherElementClass:v,stretcherElementInstance:h,isDraggableDetached:"smoth-dnd-is-draggable-detached",disbaleTouchActions:u,noUserSelectClass:f,preventAutoScrollClass:i}),b={groupName:void 0,behaviour:"move",orientation:"vertical",getChildPayload:void 0,animationDuration:250,autoScrollEnabled:!0,shouldAcceptDrop:void 0,shouldAnimateDrop:void 0};(t=l||(l={})).x="x",t.y="y",t.xy="xy";var a=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)}},m=function(e){var t=e.getBoundingClientRect(),n={left:t.left,right:t.right,top:t.top,bottom:t.bottom};if(C(e,"x")&&!E(e,"x")){var o=n.right-n.left;n.right=n.right+e.scrollWidth-o}if(C(e,"y")&&!E(e,"y")){var r=n.bottom-n.top;n.bottom=n.bottom+e.scrollHeight-r}return n},y=function(e){var t=global.getComputedStyle(e),n=t.overflow;if("auto"===n||"scroll"===n)return l.xy;var o=t["overflow-x"],r="auto"===o||"scroll"===o,i=t["overflow-y"],a="auto"===i||"scroll"===i;return r&&a?l.xy:r?l.x:a?l.y:null},x=function(e,t){var n=global.getComputedStyle(e),o=n.overflow,r=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||("auto"===r||"scroll"===r)},E=function(e,t){var n=global.getComputedStyle(e),o=n.overflow,r=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||"hidden"===o||("auto"===r||"scroll"===r||"hidden"===r)},C=function(e,t){return"x"===t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight},S=function(e,t){var n=e,o=t||m(e);for(n=e.parentElement;n;)C(n,"x")&&E(n,"x")&&(o=a(o,n.getBoundingClientRect(),"x")),C(n,"y")&&E(n,"y")&&(o=a(o,n.getBoundingClientRect(),"y")),n=n.parentElement;return o},R=function(e){for(var t=e;t;){if(t[o])return t[o];t=t.parentElement}return null},w=function(t,n){var o=[];function e(){o&&(o.forEach(function(e){return e.removeEventListener("scroll",n)}),global.removeEventListener("scroll",n))}return function(){var e=t;for(;e;)(x(e,"x")||x(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)}),global.addEventListener("scroll",n))},stop:e}},O=function(e,t){for(var n=e;n;){if(n.matches(t))return n;n=n.parentElement}return null},A=function(e,t){return-1<e.className.split(" ").map(function(e){return e}).indexOf(t)},I=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e});-1===n.indexOf(t)&&(n.unshift(t),e.className=n.join(" "))}},z=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e&&e!==t});e.className=n.join(" ")}},B=function(e,t){return e.removeChild(e.children[t])},T=function(e,t,n){n>=e.children.length?e.appendChild(t):e.insertBefore(t,e.children[n])},P=function(){global.getSelection?global.getSelection().empty?global.getSelection().empty():global.getSelection().removeAllRanges&&global.getSelection().removeAllRanges():global.document.selection&&global.document.selection.empty()},L=function(e){if(e){var t=global.getComputedStyle(e);if(t)return t.cursor}return null};function N(e){return!(e.bottom<=e.top||e.right<=e.left)}function M(e){var s=e.element,u=e.draggables;return function(e,t){var n=e,o=n.removedIndex,r=n.addedIndex,i=n.droppedElement,a=null;if(null!==o&&(a=B(s,o),u.splice(o,1)),null!==r){var l=global.document.createElement("div");l.className="".concat(g),l.appendChild(a&&a.firstElementChild?a.firstElementChild:i),T(s,l,r),r>=u.length?u.push(l):u.splice(r,0,l)}t&&t(e)}}var V=Object.freeze({domDropHandler:M,reactDropHandler:function(){return{handler:function(){return function(e,t){t&&t(e)}}}}}),j={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(".concat(e,"px, 0, 0)")}}},H={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,".concat(e,"px, 0)")}}};function X(o,s,e){o[d]=0;var r,i=(r="horizontal"===s?j:H,{get:function(e,t){return e[r[t]||t]},set:function(e,t,n){requestAnimationFrame(function(){e[r[t]]=r.setters[t]?r.setters[t](n):n})}}),u={translation:0};global.addEventListener("resize",function(){n(o)}),setTimeout(function(){t()},10);w(o,function(){n(o)});function t(){var e,t;n(o),t=(e=o).getBoundingClientRect(),u.scaleX=e.offsetWidth?(t.right-t.left)/e.offsetWidth:1,u.scaleY=e.offsetHeight?(t.bottom-t.top)/e.offsetHeight:1}function n(e){u.rect=m(e);var t=S(e,u.rect);N(t)&&(u.lastVisibleRect=u.visibleRect),u.visibleRect=t}function a(e){var t=e;if(t.tagName){var n=t.getBoundingClientRect();return"vertical"===s?n.bottom-n.top:n.right-n.left}return i.get(e,"size")*i.get(u,"scale")}function l(e){return i.get(e,"dragPosition")}return{getSize:a,getContainerRectangles:function(){return{rect:u.rect,visibleRect:u.visibleRect,lastVisibleRect:u.lastVisibleRect}},getBeginEndOfDOMRect:function(e){return{begin:i.get(e,"begin"),end:i.get(e,"end")}},getBeginEndOfContainer:function(){return{begin:i.get(u.rect,"begin")+u.translation,end:i.get(u.rect,"end")+u.translation}},getBeginEndOfContainerVisibleRect:function(){return{begin:i.get(u.visibleRect,"begin")+u.translation,end:i.get(u.visibleRect,"end")+u.translation}},getBeginEnd:function(e){var t,n=(t=e,(i.get(t,"distanceToParent")+(t[p]||0))*i.get(u,"scale")+(i.get(u.rect,"begin")+u.translation)-i.get(o,"scrollValue"));return{begin:n,end:n+a(e)*i.get(u,"scale")}},getAxisValue:l,setTranslation:function(e,t){t?i.set(e.style,"translate",t):e.style.removeProperty("transform"),e[p]=t},getTranslation:function(e){return e[p]},setVisibility:function(e,t){void 0!==e[c]&&e[c]===t||(t?e.style.removeProperty("visibility"):e.style.visibility="hidden",e[c]=t)},isVisible:function(e){return void 0===e[c]||e[c]},isInVisibleRect:function(e,t){var n=u.visibleRect,o=n.left,r=n.top,i=n.right,a=n.bottom;a-r<2&&(a=r+30);var l=u.rect;return"vertical"===s?e>l.left&&e<l.right&&r<t&&t<a:o<e&&e<i&&t>l.top&&t<l.bottom},setSize:function(e,t){i.set(e,"setSize",t)},getTopLeftOfElementBegin:function(e){var t=0;return{top:"horizontal"===s?(t=e,u.rect.top):(t=u.rect.left,e),left:t}},getScrollSize:function(e){return i.get(e,"scrollSize")},getScrollValue:function(e){return i.get(e,"scrollValue")},setScrollValue:function(e,t){return i.set(e,"scrollValue",t)},invalidate:t,invalidateRects:function(){n(o)},getPosition:function(e){return l(e)}}}function Y(e){return(Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function F(e,t,n){var o,r,i,a=n.left,l=n.right,s=n.top,u=n.bottom,c=e.x,d=e.y;if(c<a||l<c||d<s||u<d)return null;i="x"===t?(o=a,r=l,c):(o=s,r=u,d);var f=r-o,g=400<f?100:f/4;return r-i<g?{direction:"end",speedFactor:(g-(r-i))/g}:i-o<g?{direction:"begin",speedFactor:(g-(i-o))/g}:null}var W=function(l){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"y",n=!1,u=null,c=null,d=null,f=null;return{animate:function(e,t){d=e,f=t,(n=!0)&&function a(){null===u&&(u=requestAnimationFrame(function(e){null===c&&(c=e);var t=e-c;c=e;var n,o,r,i=t/1e3*f;o=s,r=i="begin"===d?0-i:i,(n=l)&&(n!==window?"x"===o?n.scrollLeft+=r:n.scrollTop+=r:"x"===o?n.scrollBy(r,0):n.scrollBy(0,r)),u=null,a()}))}()},stop:function(){n&&(cancelAnimationFrame(u),n=!1,u=c=null)}}};function q(e){return function(){return S(e,e.getBoundingClientRect())}}var G,U,J,K=function(e){var a=e.reduce(function(e,t){var n=function(e){for(var t=[],n=e.element;n;){var o=y(n);if(o&&!A(n,i)){var r={};switch(o){case l.xy:r.x={animator:W(n,"x")},r.y={animator:W(n,"y")};break;case l.x:r.x={animator:W(n,"x")};break;case l.y:r.y={animator:W(n,"y")}}t.push({axisAnimations:r,getRect:q(n),scrollerElement:n})}n=n.parentElement}return t}(t).filter(function(t){return!e.find(function(e){return e.scrollerElement===t.scrollerElement})});return[].concat(k(e),k(n))},[]);return function(e){var t,o,n=e.draggableInfo;if(e.reset)a.forEach(function(e){e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop()});else if(n){t=a,o=n.mousePosition,t.forEach(function(e){var t=e.axisAnimations,n=(0,e.getRect)();t.x&&(t.x.scrollParams=F(o,"x",n),e.cachedRect=n),t.y&&(t.y.scrollParams=F(o,"y",n),e.cachedRect=n)}),a.forEach(function(e){var t=e.axisAnimations,n=t.x,o=t.y;if(n)if(n.scrollParams){var r=n.scrollParams,i=r.direction,a=r.speedFactor;n.animator.animate(i,1500*a)}else n.animator.stop();if(o)if(o.scrollParams){var l=o.scrollParams,s=l.direction,u=l.speedFactor;o.animator.animate(s,1500*u)}else o.animator.stop()});var r=a.filter(function(e){return e.cachedRect});if(r.length&&1<r.length){var i=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}(r,n.mousePosition);i&&r.forEach(function(e){e!==i&&(e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop())})}}}},Q="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(G=Q.Node||Q.Element)&&G.prototype&&!G.prototype.matches&&(G.prototype.matches=G.prototype.matchesSelector||G.prototype.mozMatchesSelector||G.prototype.msMatchesSelector||G.prototype.oMatchesSelector||G.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}),(U=Q.Node||Q.Element)&&U.prototype&&null==U.prototype.firstElementChild&&Object.defineProperty(U.prototype,"firstElementChild",{get:function(){for(var e,t=this.childNodes,n=0;e=t[n++];)if(1===e.nodeType)return e;return null}}),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 Z={overflow:"hidden",display:"block"},$={height:"100%",display:"table-cell","vertical-align":"top"},ee=(_(J={},".".concat(s),{position:"relative","min-height":"30px","min-width":"30px"}),_(J,".".concat(s,".horizontal"),{display:"table"}),_(J,".".concat(s,".horizontal > .").concat(v),{display:"inline-block"}),_(J,".".concat(s,".horizontal > .").concat(g),$),_(J,".".concat(s,".vertical > .").concat(g),Z),_(J,".".concat(g),{"box-sizing":"border-box"}),_(J,".".concat(g,".horizontal"),$),_(J,".".concat(g,".vertical"),Z),_(J,".".concat(g,".animated"),{transition:"transform ease"}),_(J,".".concat(D,".animated"),{transition:"all ease-in-out"}),_(J,".".concat(D," *"),{"pointer-events":"none"}),_(J,".".concat(u," *"),{"touch-actions":"none","-ms-touch-actions":"none"}),_(J,".".concat(f),{"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),J);function te(o){return Object.keys(o).reduce(function(e,t){var n=o[t];return"object"===Y(n)?"".concat(e).concat(t,"{").concat(te(n),"}"):"".concat(e).concat(t,":").concat(n,";")},"")}function ne(e){if(e&&"undefined"!=typeof window){var t=global.document.head||global.document.getElementsByTagName("head")[0],n=global.document.createElement("style"),o=te({"body *":{cursor:"".concat(e," !important")}});return n.type="text/css",n.styleSheet?n.styleSheet.cssText=o:n.appendChild(global.document.createTextNode(o)),t.appendChild(n),n}return null}var oe,re=["mousedown","touchstart"],ie=["mousemove","touchmove"],ae=["mouseup","touchend"],le=null,se=null,ue=null,ce=null,de=[],fe=!1,ge=null,me=null,pe=null,ve=null,he=(oe=null,{start:function e(){oe=requestAnimationFrame(function(){le.forEach(function(e){return e.layout.invalidateRects()}),setTimeout(function(){null!==oe&&e()},50)})},stop:function(){null!==oe&&(cancelAnimationFrame(oe),oe=null)}}),be="undefined"!=typeof window&&!!(global.navigator.userAgent.match(/Android/i)||global.navigator.userAgent.match(/webOS/i)||global.navigator.userAgent.match(/iPhone/i)||global.navigator.userAgent.match(/iPad/i)||global.navigator.userAgent.match(/iPod/i)||global.navigator.userAgent.match(/BlackBerry/i)||global.navigator.userAgent.match(/Windows Phone/i));function ye(){"undefined"!=typeof window&&re.forEach(function(e){global.document.addEventListener(e,De,{passive:!1})})}function xe(){return ce&&ce.ghostParent?ce.ghostParent:se&&se.parentElement||global.document.body}var Ee=function(){var r,i,o,a=null,l=1,s=5;function u(e){var t=Se(e),n=t.clientX,o=t.clientY;if(i)(Math.abs(r.clientX-n)>s||Math.abs(r.clientY-o)>s)&&f();else if(Math.abs(r.clientX-n)>l||Math.abs(r.clientY-o)>l)return g()}function c(){f()}function d(){f()}function f(){clearTimeout(a),ie.forEach(function(e){return global.document.removeEventListener(e,u)},{passive:!1}),ae.forEach(function(e){return global.document.removeEventListener(e,c)},{passive:!1}),global.document.removeEventListener("drag",d,{passive:!1})}function g(){clearTimeout(a),f(),o()}return function(e,t,n){r=Se(e),o=n,(i="number"==typeof t?t:be?200:0)&&(a=setTimeout(g,i)),ie.forEach(function(e){return global.document.addEventListener(e,u)},{passive:!1}),ae.forEach(function(e){return global.document.addEventListener(e,c)},{passive:!1}),global.document.addEventListener("drag",d,{passive:!1})}}();function De(e){var t=Se(e);if(!fe&&(void 0===t.button||0===t.button)&&(se=O(t.target,"."+g))){var n=O(se,"."+s),o=de.filter(function(e){return e.element===n})[0],r=o.getOptions().dragHandleSelector,i=o.getOptions().nonDragAreaSelector,a=!0;if(r&&!O(t.target,r)&&(a=!1),i&&O(t.target,i)&&(a=!1),a){I(global.document.body,u),I(global.document.body,f);global.document.addEventListener("mouseup",function e(){z(global.document.body,u),z(global.document.body,f),global.document.removeEventListener("mouseup",e)})}a&&Ee(t,o.getOptions().dragBeginDelay,function(){P(),Ae(t,L(e.target)),ie.forEach(function(e){global.document.addEventListener(e,Ie,{passive:!1})}),ae.forEach(function(e){global.document.addEventListener(e,Ce,{passive:!1})})})}}function Ce(){var e;ie.forEach(function(e){global.document.removeEventListener(e,Ie,{passive:!1})}),ae.forEach(function(e){global.document.removeEventListener(e,Ce,{passive:!1})}),me({reset:!0}),ve&&((e=ve)&&"undefined"!=typeof window&&(global.document.head||global.document.getElementsByTagName("head")[0]).removeChild(e),ve=null),ce&&(he.stop(),function(e){function i(){z(ue.ghost,"animated"),ue.ghost.style.transitionDuration=null,xe().removeChild(ue.ghost),e()}function t(e,t,n){var o=e.top,r=e.left;I(ue.ghost,"animated"),n&&I(ue.ghost.firstElementChild,n),ue.ghost.style.transitionDuration=t+"ms",ue.ghost.style.left=r+"px",ue.ghost.style.top=o+"px",setTimeout(function(){i()},t+20)}function n(e,t){I(ue.ghost,"animated"),ue.ghost.style.transitionDuration=e+"ms",ue.ghost.style.opacity="0",ue.ghost.style.transform="scale(0.90)",setTimeout(function(){t()},e)}if(ce.targetElement){var o=de.filter(function(e){return e.element===ce.targetElement})[0];!(p=o.getOptions()).shouldAnimateDrop||p.shouldAnimateDrop(ce.container.getOptions(),ce.payload)?t(o.getDragResult().shadowBeginEnd.rect,Math.max(150,o.getOptions().animationDuration/2),o.getOptions().dropClass):i()}else{var r=de.filter(function(e){return e===ce.container})[0];if(r){var a=r.getOptions(),l=a.behaviour,s=a.removeOnDropOut;if("move"===l&&!s&&r.getDragResult()){var u=r.layout.getContainerRectangles();if(!N(u.visibleRect)&&N(u.lastVisibleRect))t({top:u.lastVisibleRect.top,left:u.lastVisibleRect.left},r.getOptions().animationDuration,r.getOptions().dropClass);else{var c=r.getDragResult(),d=c.removedIndex,f=c.elementSize,g=r.layout;r.getTranslateCalculator({dragResult:{removedIndex:d,addedIndex:d,elementSize:f,pos:void 0,shadowBeginEnd:void 0}});var m=0<d?g.getBeginEnd(r.draggables[d-1]).end:g.getBeginEndOfContainer().begin;t(g.getTopLeftOfElementBegin(m),r.getOptions().animationDuration,r.getOptions().dropClass)}}else n(r.getOptions().animationDuration,i)}else n(b.animationDuration,i)}var p}(function(){Oe(fe=!1);for(var e=le||[],t=e.shift();void 0!==t;)t.handleDrop(ce),t=e.shift();ge=pe=ce=ue=se=le=null}))}function Se(e){return e.touches?e.touches[0]:e}function Re(e){var t=e;return function(n){var o=!1;t.forEach(function(e){var t=e.handleDrag(n);o=!!t.containerBoxChanged||!1,t.containerBoxChanged=!1}),me({draggableInfo:n}),o&&(o=!1,setTimeout(function(){de.forEach(function(e){e.layout.invalidateRects(),e.onTranslated()})},10))}}function we(e,t){return e.getOptions().autoScrollEnabled?K(t):function(e){return null}}function Oe(o){de.forEach(function(e){var t=o?e.getOptions().onDragStart:e.getOptions().onDragEnd;if(t){var n={isSource:e===ce.container,payload:ce.payload};e.isDragRelevant(ce.container,ce.payload)?n.willAcceptDrop=!0:n.willAcceptDrop=!1,t(n)}})}function Ae(e,t){if(null!==se){fe=!0;var n=de.filter(function(e){return se.parentElement===e.element})[0];n.setDraggables(),pe=n.getOptions().lockAxis?n.getOptions().lockAxis.toLowerCase():null,h=se,b=de.filter(function(e){return h.parentElement===e.element})[0],y=b.draggables.indexOf(h),x=b.getOptions().getGhostParent,E=h.getBoundingClientRect(),ce={container:b,element:h,size:{offsetHeight:E.bottom-E.top,offsetWidth:E.right-E.left},elementIndex:y,payload:b.getOptions().getChildPayload?b.getOptions().getChildPayload(y):void 0,targetElement:null,position:{x:0,y:0},groupName:b.getOptions().groupName,ghostParent:x?x():null,invalidateShadow:null,mousePosition:null},o=se,r={x:e.clientX,y:e.clientY},i=ce.container,a=t,l=r.x,s=r.y,u=o.getBoundingClientRect(),c=u.left,d=u.top,f=u.right,g=u.bottom,m=c+(f-c)/2,p=d+(g-d)/2,(v=o.cloneNode(!0)).style.zIndex="1000",v.style.boxSizing="border-box",v.style.position="fixed",v.style.left=c+"px",v.style.top=d+"px",v.style.width=f-c+"px",v.style.height=g-d+"px",v.style.overflow="visible",v.style.transition=null,v.style.removeProperty("transition"),v.style.pointerEvents="none",v.style.userSelect="none",i.getOptions().dragClass?setTimeout(function(){I(v.firstElementChild,i.getOptions().dragClass);var e=global.getComputedStyle(v.firstElementChild).cursor;ve=ne(e)}):ve=ne(a),I(v,i.getOptions().orientation||"vertical"),I(v,D),ue={ghost:v,centerDelta:{x:m-l,y:p-s},positionDelta:{left:c-l,top:d-s}},ce.position={x:e.clientX+ue.centerDelta.x,y:e.clientY+ue.centerDelta.y},ce.mousePosition={x:e.clientX,y:e.clientY},le=de.filter(function(e){return e.isDragRelevant(n,ce.payload)}),ge=Re(le),me&&me({reset:!0,draggableInfo:void 0}),me=we(n,le),le.forEach(function(e){return e.prepareDrag(e,le)}),Oe(!0),ge(ce),xe().appendChild(ue.ghost),he.start()}var o,r,i,a,l,s,u,c,d,f,g,m,p,v,h,b,y,x,E}function Ie(e){e.preventDefault();var t=Se(e);if(ce){var n=ce.container.getOptions();if("contain"===n.behaviour){var o=ce.container.layout.getBeginEndOfContainerVisibleRect();if("vertical"===n.orientation){var r=o.begin-ce.size.offsetHeight/2,i=o.end-ce.size.offsetHeight/2,a=Math.max(r,Math.min(i,t.clientY+ue.positionDelta.top));ue.ghost.style.top="".concat(a,"px"),ce.position.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY+ue.centerDelta.y)),ce.mousePosition.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY))}else{var l=o.begin-ce.size.offsetWidth/2,s=o.end-ce.size.offsetWidth/2,u=Math.max(l,Math.min(s,t.clientX+ue.positionDelta.left));ue.ghost.style.left="".concat(u,"px"),ce.position.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX+ue.centerDelta.x)),ce.mousePosition.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX))}}else pe?"y"===pe?(ue.ghost.style.top="".concat(t.clientY+ue.positionDelta.top,"px"),ce.position.y=t.clientY+ue.centerDelta.y,ce.mousePosition.y=t.clientY):"x"===pe&&(ue.ghost.style.left="".concat(t.clientX+ue.positionDelta.left,"px"),ce.position.x=t.clientX+ue.centerDelta.x,ce.mousePosition.x=t.clientX):(ue.ghost.style.left="".concat(t.clientX+ue.positionDelta.left,"px"),ue.ghost.style.top="".concat(t.clientY+ue.positionDelta.top,"px"),ce.position.x=t.clientX+ue.centerDelta.x,ce.position.y=t.clientY+ue.centerDelta.y,ce.mousePosition.x=t.clientX,ce.mousePosition.y=t.clientY);ge(ce)}else Ae(t,L(e.target))}!function(){if("undefined"!=typeof window){var e=global.document.head||global.document.getElementsByTagName("head")[0],t=global.document.createElement("style");t.id="smooth-dnd-style-definitions";var n=te(ee);t.type="text/css",t.styleSheet?t.styleSheet.cssText=n:t.appendChild(global.document.createTextNode(n)),e.appendChild(t)}}();var ze=(ye(),{register:function(e){var t;t=e,de.push(t),fe&&ce&&t.isDragRelevant(ce.container,ce.payload)&&(le.push(t),t.prepareDrag(t,le),me&&me({reset:!0,draggableInfo:void 0}),me=we(t,le),ge=Re(le),t.handleDrag(ce))},unregister:function(e){!function(e){if(de.splice(de.indexOf(e),1),fe&&ce){ce.container===e&&e.fireRemoveElement(),ce.targetElement===e.element&&(ce.targetElement=null);var t=le.indexOf(e);-1<t&&(le.splice(t,1),me&&me({reset:!0,draggableInfo:void 0}),me=we(e,le),ge=Re(le))}}(e)}});function Be(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:b.animationDuration;t?(I(e,r),e.style.transitionDuration=n+"ms"):(z(e,r),e.style.removeProperty("transition-duration"))}function Te(n){var o=[];return Array.prototype.forEach.call(n.children,function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e;A(e,g)||(t=function(e){if(tt.wrapChild){var t=global.document.createElement("div");return t.className="".concat(g),e.parentElement.insertBefore(t,e),t.appendChild(e),t}return e}(e)),t[p]=0,o.push(t)}else n.removeChild(e)}),o}function Pe(e){var g=e.layout;return function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return function e(t,n,o,r){var i=4<arguments.length&&void 0!==arguments[4]&&arguments[4];if(r<o)return o;if(o===r){var a=g.getBeginEnd(t[o]),l=a.begin,s=a.end;return l<n&&n<=s?i?n<(s+l)/2?o:o+1:o:null}var u=Math.floor((r+o)/2),c=g.getBeginEnd(t[u]),d=c.begin,f=c.end;return n<d?e(t,n,o,u-1,i):f<n?e(t,n,u+1,r,i):i?n<(f+d)/2?u:u+1:u}(e,t,0,e.length-1,n)}}function Le(e){var t,n,o,r,i=e.element,a=e.draggables,l=e.layout,s=e.options,u=(n=(t={element:i,draggables:a,layout:l,options:s}).element,o=t.draggables,r=t.layout,function(){o.forEach(function(e){Be(e,!1),r.setTranslation(e,0),r.setVisibility(e,!0)}),n[h]&&(n[h].parentNode.removeChild(n[h]),n[h]=null)}),c=(tt.dropHandler||M)({element:i,draggables:a,layout:l,options:s});return function(e,t){var n=t.addedIndex,o=t.removedIndex,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(u(),e.targetElement||s.removeOnDropOut||r){var i={removedIndex:o,addedIndex:null!==n?null!==o&&o<n?n-1:n:null,payload:e.payload};c(i,s.onDrop)}}}function Ne(e,t){var n=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:b;return Object.assign({},b,e)}(t),o=Te(e);return I(e,"".concat(s," ").concat(n.orientation)),{element:e,draggables:o,options:n,layout:X(e,n.orientation,n.animationDuration)}}function Me(e){var o=e.element,r=e.options,i=null;return function(e){var t=e.draggableInfo,n=i;return null==i&&t.container.element===o&&"copy"!==r.behaviour&&(n=i=t.elementIndex),{removedIndex:n}}}function Ve(e){var n=e.draggables,o=e.layout;return function(e){var t=e.dragResult;null!==t.removedIndex&&o.setVisibility(n[t.removedIndex],!1)}}function je(e){var r=e.element,i=e.layout;return function(e){var t=e.draggableInfo,n=document.elementFromPoint(t.position.x,t.position.y);if(n){var o=R(n);if(o&&o.element===r)return{pos:i.getPosition(t.position)}}return{pos:null}}}function He(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 Xe(e){var o=e.element;return function(e){var t=e.draggableInfo,n=e.dragResult;!function(e,t){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];t&&n?e.targetElement=t:e.targetElement===t&&(e.targetElement=null)}(t,o,!!n.pos)}}function Ye(){return function(e){return null!==e.dragResult.pos?{addedIndex:0}:{addedIndex:null}}}function _e(e){e.draggables;var r=e.layout,i=null;return function(e){var t=e.dragResult.addedIndex;if(t===i)return null;i=t;var n=r.getBeginEndOfContainer(),o=n.begin;n.end;return{shadowBeginEnd:{rect:r.getTopLeftOfElementBegin(o)}}}}function ke(e){var o=Ue(e);return function(e){var t=e.draggableInfo,n=e.dragResult;return t.invalidateShadow?o({draggableInfo:t,dragResult:n}):null}}function Fe(e){var t,i,a,o=(i=(t=e).draggables,a=Pe({layout:t.layout}),function(e){var t=e.dragResult,n=t.shadowBeginEnd,o=t.pos;if(n)return n.begin+n.beginAdjustment<=o&&n.end>=o?null:o<n.begin+n.beginAdjustment?a(i,o):o>n.end?a(i,o)+1:i.length;var r=a(i,o,!0);return null!==r?r:i.length});return function(e){var t=e.dragResult,n=null;return null!==t.pos&&null===(n=o({dragResult:t}))&&(n=t.addedIndex),{addedIndex:n}}}function We(){var r=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.shadowBeginEnd;n!==r&&null!==r&&o&&(o.beginAdjustment=0),r=n}}function qe(e){var c=e.element,d=e.draggables,f=e.layout,g=e.options,m=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=t.elementSize;if(null===o)if(null!==n){if(!m){var i=f.getBeginEndOfContainer();i.end=i.begin+f.getSize(c);var a=f.getScrollSize(c)>f.getSize(c)?i.begin+f.getScrollSize(c)-f.getScrollValue(c):i.end,l=0<d.length?f.getBeginEnd(d[d.length-1]).end-d[d.length-1][p]:i.begin;if(a<l+r){(m=global.document.createElement("div")).className=v+" "+g.orientation;var s=0<d.length?r+l-a:r;return f.setSize(m.style,"".concat(s,"px")),c.appendChild(m),c[h]=m,{containerBoxChanged:!0}}}}else if(m){f.setTranslation(m,0);var u=m;return m=null,c.removeChild(u),{containerBoxChanged:!(c[h]=null)}}}}function Ge(e){var s=e.draggables,u=e.layout,c=null,d=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=t.elementSize;if(n!==c||o!==d){for(var i=0;i<s.length;i++)if(i!==o){var a=s[i],l=0;null!==o&&o<i&&(l-=r),null!==n&&n<=i&&(l+=r),u.setTranslation(a,l)}return{addedIndex:c=n,removedIndex:d=o}}}}function Ue(e){var b=e.draggables,y=e.layout,x=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:x=null};if(null===o||!t.invalidateShadow&&o===x)return null;x&&(x=o);var s=o-1,u=0,c=null,d=null;if(s===r&&s--,-1<s){var f=y.getSize(b[s]);if(d=y.getBeginEnd(b[s]),i<f){var g=(f-i)/2;u=d.end-g}else u=d.end}else d={end:y.getBeginEndOfContainer().begin};var m=1e4,p=o;if(p===r&&p++,p<b.length){var v=y.getSize(b[p]);if(c=y.getBeginEnd(b[p]),i<v){var h=(v-i)/2;m=c.begin+h}else m=c.begin}else c={begin:y.getContainerRectangles().rect.end};return{shadowBeginEnd:{begin:u,end:m,rect:d&&c?y.getTopLeftOfElementBegin(d.end):null,beginAdjustment:l?l.beginAdjustment:0}}}}function Je(){var a=null;return function(e){var t=e.dragResult,n=t.pos,o=t.addedIndex,r=t.shadowBeginEnd;if(null!==n){if(null!=o&&null===a){if(n<r.begin){var i=n-r.begin-5;r.beginAdjustment=i}a=o}}else a=null}}function Ke(e){var n=e.options,o=!1;return function(e){var t=!!e.dragResult.pos;if(t!==o){if(!(o=t))return n.onDragLeave&&n.onDragLeave(),{dragLeft:!0};n.onDragEnter&&n.onDragEnter()}}}function Qe(e){var s=e.options,u=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=e.draggableInfo,i=r.payload,a=r.element;if(s.onDropReady&&null!==n&&u!==n){var l=u=n;null!==o&&o<n&&l--,s.onDropReady({addedIndex:l,removedIndex:o,payload:i,element:a?a.firstElementChild:void 0})}}}function Ze(e){return"drop-zone"===e.options.behaviour?$e(e)(Me,Ve,je,He,Xe,Ye,_e,Ke,Qe):$e(e)(Me,Ve,je,He,Xe,ke,Fe,We,qe,Ge,Ue,Je,Ke,Qe)}function $e(i){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=t.map(function(e){return e(i)}),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 et(f){return function(e){var t,o,r,n=null,i=null,a=Ne(f,e),l=Ze(a),s=Le(a),u=w(f,function(){a.layout.invalidateRects(),c()});function c(){null!==i&&(i.invalidateShadow=!0,n=l(i),i.invalidateShadow=!1)}function d(e,t){for(var n=Te(t),o=0;o<n.length;o++)e[o]=n[o];for(var r=0;r<e.length-n.length;r++)e.pop()}return{element:f,draggables:a.draggables,isDragRelevant:(t=a,o=t.element,r=t.options,function(e,t){if(r.shouldAcceptDrop)return r.shouldAcceptDrop(e.getOptions(),t);var n=e.getOptions();return"copy"!==r.behaviour&&O(o,"."+g)!==e.element&&(e.element===o||!(!n.groupName||n.groupName!==r.groupName))}),layout:a.layout,dispose:function(e){var t;u.dispose(),t=e.element,tt.wrapChild&&Array.prototype.forEach.call(t.children,function(e){e.nodeType===Node.ELEMENT_NODE&&A(e,g)&&(t.insertBefore(e.firstElementChild,e),t.removeChild(e))})},prepareDrag:function(e,t){var n=e.element,o=a.draggables,r=e.getOptions();d(o,n),e.layout.invalidateRects(),o.forEach(function(e){return Be(e,!0,r.animationDuration)}),u.start()},handleDrag:function(e){return(n=l(i=e))&&n.dragLeft&&"drop-zone"!==a.options.behaviour&&(n.dragLeft=!1,setTimeout(function(){n&&Ge(a)({dragResult:n})},20)),n},handleDrop:function(e){u.stop(),i=null,l=Ze(a),s(e,n),n=null},fireRemoveElement:function(){s(i,Object.assign({},n,{addedIndex:null}),!0),n=null},getDragResult:function(){return n},getTranslateCalculator:function(e){return Ge(a)(e)},onTranslated:function(){c()},getOptions:function(){return a.options},setDraggables:function(){d(a.draggables,f)}}}}var tt=function(e,t){var n=et(e)(t);return e[o]=n,ze.register(n),{dispose:function(){ze.unregister(n),n.dispose(n)}}};tt.wrapChild=!0;e.smoothDnD=tt,e.constants=n,e.dropHandlers=V,e.default=function e(t,n){return console.warn('default export is deprecated. please use named export "smoothDnD"'),void 0!==e.dropHandler&&(tt.dropHandler=e.dropHandler),void 0!==e.wrapChild&&(tt.wrapChild=e.wrapChild),tt(t,n)},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=e||self).SmoothDnD={})}(this,function(e){"use strict";var l,t,r="smooth-dnd-container-instance",g="smooth-dnd-draggable-wrapper",o="animated",p="__smooth_dnd_draggable_translation_value",c="__smooth_dnd_draggable_visibility_value",D="smooth-dnd-ghost",s="smooth-dnd-container",d="smooth-dnd-extra-size-for-insertion",v="smooth-dnd-stretcher-element",h="smooth-dnd-stretcher-instance",u="smooth-dnd-disable-touch-action",f="smooth-dnd-no-user-select",i="smooth-dnd-prevent-auto-scroll-class",n=Object.freeze({containerInstance:r,defaultGroupName:"@@smooth-dnd-default-group@@",wrapperClass:g,defaultGrabHandleClass:"smooth-dnd-default-grap-handle",animationClass:o,translationValue:p,visibilityValue:c,ghostClass:D,containerClass:s,extraSizeForInsertion:d,stretcherElementClass:v,stretcherElementInstance:h,isDraggableDetached:"smoth-dnd-is-draggable-detached",disbaleTouchActions:u,noUserSelectClass:f,preventAutoScrollClass:i}),b={groupName:void 0,behaviour:"move",orientation:"vertical",getChildPayload:void 0,animationDuration:250,autoScrollEnabled:!0,shouldAcceptDrop:void 0,shouldAnimateDrop:void 0};function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}(t=l||(l={})).x="x",t.y="y",t.xy="xy";var x=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)}},E=function(e){var t=e.getBoundingClientRect(),n={left:t.left,right:t.right,top:t.top,bottom:t.bottom};if(w(e,"x")&&!R(e,"x")){var o=n.right-n.left;n.right=n.right+e.scrollWidth-o}if(w(e,"y")&&!R(e,"y")){var r=n.bottom-n.top;n.bottom=n.bottom+e.scrollHeight-r}return n},C=function(e){var t=global.getComputedStyle(e),n=t.overflow;if("auto"===n||"scroll"===n)return l.xy;var o=t["overflow-x"],r="auto"===o||"scroll"===o,i=t["overflow-y"],a="auto"===i||"scroll"===i;return r&&a?l.xy:r?l.x:a?l.y:null},S=function(e,t){var n=global.getComputedStyle(e),o=n.overflow,r=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||("auto"===r||"scroll"===r)},R=function(e,t){var n=global.getComputedStyle(e),o=n.overflow,r=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||"hidden"===o||("auto"===r||"scroll"===r||"hidden"===r)},w=function(e,t){return"x"===t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight},O=function(e,t){var n=e,o=t||E(e);for(n=e.parentElement;n;)w(n,"x")&&R(n,"x")&&(o=x(o,n.getBoundingClientRect(),"x")),w(n,"y")&&R(n,"y")&&(o=x(o,n.getBoundingClientRect(),"y")),n=n.parentElement;return o},A=function(e,n){for(var o=e;o;){if(o[r]){var t=function(){var t=o[r];if(n.some(function(e){return e===t}))return{v:t}}();if("object"===a(t))return t.v}o=o.parentElement}return null},I=function(t,n){var o=[];function e(){o&&(o.forEach(function(e){return e.removeEventListener("scroll",n)}),global.removeEventListener("scroll",n))}return function(){var e=t;for(;e;)(S(e,"x")||S(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)}),global.addEventListener("scroll",n))},stop:e}},z=function(e,t){for(var n=e;n;){if(n.matches(t))return n;n=n.parentElement}return null},B=function(e,t){return-1<e.className.split(" ").map(function(e){return e}).indexOf(t)},T=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e});-1===n.indexOf(t)&&(n.unshift(t),e.className=n.join(" "))}},P=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e&&e!==t});e.className=n.join(" ")}},L=function(e,t){return e.removeChild(e.children[t])},N=function(e,t,n){n>=e.children.length?e.appendChild(t):e.insertBefore(t,e.children[n])},M=function(){global.getSelection?global.getSelection().empty?global.getSelection().empty():global.getSelection().removeAllRanges&&global.getSelection().removeAllRanges():global.document.selection&&global.document.selection.empty()},j=function(e){if(e){var t=global.getComputedStyle(e);if(t)return t.cursor}return null};function V(e){return!(e.bottom<=e.top||e.right<=e.left)}function H(e){var s=e.element,u=e.draggables;return function(e,t){var n=e,o=n.removedIndex,r=n.addedIndex,i=n.droppedElement,a=null;if(null!==o&&(a=L(s,o),u.splice(o,1)),null!==r){var l=global.document.createElement("div");l.className="".concat(g),l.appendChild(a&&a.firstElementChild?a.firstElementChild:i),N(s,l,r),r>=u.length?u.push(l):u.splice(r,0,l)}t&&t(e)}}var X=Object.freeze({domDropHandler:H,reactDropHandler:function(){return{handler:function(){return function(e,t){t&&t(e)}}}}}),Y={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(".concat(e,"px, 0, 0)")}}},_={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,".concat(e,"px, 0)")}}};function k(o,s,e){o[d]=0;var r,i=(r="horizontal"===s?Y:_,{get:function(e,t){return e[r[t]||t]},set:function(e,t,n){requestAnimationFrame(function(){e[r[t]]=r.setters[t]?r.setters[t](n):n})}}),u={translation:0};global.addEventListener("resize",function(){n(o)}),setTimeout(function(){t()},10);I(o,function(){n(o)});function t(){var e,t;n(o),t=(e=o).getBoundingClientRect(),u.scaleX=e.offsetWidth?(t.right-t.left)/e.offsetWidth:1,u.scaleY=e.offsetHeight?(t.bottom-t.top)/e.offsetHeight:1}function n(e){u.rect=E(e);var t=O(e,u.rect);V(t)&&(u.lastVisibleRect=u.visibleRect),u.visibleRect=t}function a(e){var t=e;if(t.tagName){var n=t.getBoundingClientRect();return"vertical"===s?n.bottom-n.top:n.right-n.left}return i.get(e,"size")*i.get(u,"scale")}function l(e){return i.get(e,"dragPosition")}return{getSize:a,getContainerRectangles:function(){return{rect:u.rect,visibleRect:u.visibleRect,lastVisibleRect:u.lastVisibleRect}},getBeginEndOfDOMRect:function(e){return{begin:i.get(e,"begin"),end:i.get(e,"end")}},getBeginEndOfContainer:function(){return{begin:i.get(u.rect,"begin")+u.translation,end:i.get(u.rect,"end")+u.translation}},getBeginEndOfContainerVisibleRect:function(){return{begin:i.get(u.visibleRect,"begin")+u.translation,end:i.get(u.visibleRect,"end")+u.translation}},getBeginEnd:function(e){var t,n=(t=e,(i.get(t,"distanceToParent")+(t[p]||0))*i.get(u,"scale")+(i.get(u.rect,"begin")+u.translation)-i.get(o,"scrollValue"));return{begin:n,end:n+a(e)*i.get(u,"scale")}},getAxisValue:l,setTranslation:function(e,t){t?i.set(e.style,"translate",t):e.style.removeProperty("transform"),e[p]=t},getTranslation:function(e){return e[p]},setVisibility:function(e,t){void 0!==e[c]&&e[c]===t||(t?e.style.removeProperty("visibility"):e.style.visibility="hidden",e[c]=t)},isVisible:function(e){return void 0===e[c]||e[c]},isInVisibleRect:function(e,t){var n=u.visibleRect,o=n.left,r=n.top,i=n.right,a=n.bottom;a-r<2&&(a=r+30);var l=u.rect;return"vertical"===s?e>l.left&&e<l.right&&r<t&&t<a:o<e&&e<i&&t>l.top&&t<l.bottom},setSize:function(e,t){i.set(e,"setSize",t)},getTopLeftOfElementBegin:function(e){var t=0;return{top:"horizontal"===s?(t=e,u.rect.top):(t=u.rect.left,e),left:t}},getScrollSize:function(e){return i.get(e,"scrollSize")},getScrollValue:function(e){return i.get(e,"scrollValue")},setScrollValue:function(e,t){return i.set(e,"scrollValue",t)},invalidate:t,invalidateRects:function(){n(o)},getPosition:function(e){return l(e)}}}function F(e,t,n){var o,r,i,a=n.left,l=n.right,s=n.top,u=n.bottom,c=e.x,d=e.y;if(c<a||l<c||d<s||u<d)return null;i="x"===t?(o=a,r=l,c):(o=s,r=u,d);var f=r-o,g=400<f?100:f/4;return r-i<g?{direction:"end",speedFactor:(g-(r-i))/g}:i-o<g?{direction:"begin",speedFactor:(g-(i-o))/g}:null}var W=function(l){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"y",n=!1,u=null,c=null,d=null,f=null;return{animate:function(e,t){d=e,f=t,(n=!0)&&function a(){null===u&&(u=requestAnimationFrame(function(e){null===c&&(c=e);var t=e-c;c=e;var n,o,r,i=t/1e3*f;o=s,r=i="begin"===d?0-i:i,(n=l)&&(n!==window?"x"===o?n.scrollLeft+=r:n.scrollTop+=r:"x"===o?n.scrollBy(r,0):n.scrollBy(0,r)),u=null,a()}))}()},stop:function(){n&&(cancelAnimationFrame(u),n=!1,u=c=null)}}};function q(e){return function(){return O(e,e.getBoundingClientRect())}}var G,U,J,K=function(e){var a=e.reduce(function(e,t){var n=function(e){for(var t=[],n=e.element;n;){var o=C(n);if(o&&!B(n,i)){var r={};switch(o){case l.xy:r.x={animator:W(n,"x")},r.y={animator:W(n,"y")};break;case l.x:r.x={animator:W(n,"x")};break;case l.y:r.y={animator:W(n,"y")}}t.push({axisAnimations:r,getRect:q(n),scrollerElement:n})}n=n.parentElement}return t}(t).filter(function(t){return!e.find(function(e){return e.scrollerElement===t.scrollerElement})});return[].concat(y(e),y(n))},[]);return function(e){var t,o,n=e.draggableInfo;if(e.reset)a.forEach(function(e){e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop()});else if(n){t=a,o=n.mousePosition,t.forEach(function(e){var t=e.axisAnimations,n=(0,e.getRect)();t.x&&(t.x.scrollParams=F(o,"x",n),e.cachedRect=n),t.y&&(t.y.scrollParams=F(o,"y",n),e.cachedRect=n)}),a.forEach(function(e){var t=e.axisAnimations,n=t.x,o=t.y;if(n)if(n.scrollParams){var r=n.scrollParams,i=r.direction,a=r.speedFactor;n.animator.animate(i,1500*a)}else n.animator.stop();if(o)if(o.scrollParams){var l=o.scrollParams,s=l.direction,u=l.speedFactor;o.animator.animate(s,1500*u)}else o.animator.stop()});var r=a.filter(function(e){return e.cachedRect});if(r.length&&1<r.length){var i=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}(r,n.mousePosition);i&&r.forEach(function(e){e!==i&&(e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop())})}}}},Q="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(G=Q.Node||Q.Element)&&G.prototype&&!G.prototype.matches&&(G.prototype.matches=G.prototype.matchesSelector||G.prototype.mozMatchesSelector||G.prototype.msMatchesSelector||G.prototype.oMatchesSelector||G.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}),(U=Q.Node||Q.Element)&&U.prototype&&null==U.prototype.firstElementChild&&Object.defineProperty(U.prototype,"firstElementChild",{get:function(){for(var e,t=this.childNodes,n=0;e=t[n++];)if(1===e.nodeType)return e;return null}}),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 Z={overflow:"hidden",display:"block"},$={height:"100%",display:"table-cell","vertical-align":"top"},ee=(m(J={},".".concat(s),{position:"relative","min-height":"30px","min-width":"30px"}),m(J,".".concat(s,".horizontal"),{display:"table"}),m(J,".".concat(s,".horizontal > .").concat(v),{display:"inline-block"}),m(J,".".concat(s,".horizontal > .").concat(g),$),m(J,".".concat(s,".vertical > .").concat(g),Z),m(J,".".concat(g),{"box-sizing":"border-box"}),m(J,".".concat(g,".horizontal"),$),m(J,".".concat(g,".vertical"),Z),m(J,".".concat(g,".animated"),{transition:"transform ease"}),m(J,".".concat(D,".animated"),{transition:"all ease-in-out"}),m(J,".".concat(D," *"),{"pointer-events":"none"}),m(J,".".concat(u," *"),{"touch-actions":"none","-ms-touch-actions":"none"}),m(J,".".concat(f),{"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),J);function te(o){return Object.keys(o).reduce(function(e,t){var n=o[t];return"object"===a(n)?"".concat(e).concat(t,"{").concat(te(n),"}"):"".concat(e).concat(t,":").concat(n,";")},"")}function ne(e){if(e&&"undefined"!=typeof window){var t=global.document.head||global.document.getElementsByTagName("head")[0],n=global.document.createElement("style"),o=te({"body *":{cursor:"".concat(e," !important")}});return n.type="text/css",n.styleSheet?n.styleSheet.cssText=o:n.appendChild(global.document.createTextNode(o)),t.appendChild(n),n}return null}var oe,re=["mousedown","touchstart"],ie=["mousemove","touchmove"],ae=["mouseup","touchend"],le=null,se=null,ue=null,ce=null,de=[],fe=!1,ge=null,me=null,pe=null,ve=null,he=(oe=null,{start:function e(){oe=requestAnimationFrame(function(){le.forEach(function(e){return e.layout.invalidateRects()}),setTimeout(function(){null!==oe&&e()},50)})},stop:function(){null!==oe&&(cancelAnimationFrame(oe),oe=null)}}),be="undefined"!=typeof window&&!!(global.navigator.userAgent.match(/Android/i)||global.navigator.userAgent.match(/webOS/i)||global.navigator.userAgent.match(/iPhone/i)||global.navigator.userAgent.match(/iPad/i)||global.navigator.userAgent.match(/iPod/i)||global.navigator.userAgent.match(/BlackBerry/i)||global.navigator.userAgent.match(/Windows Phone/i));function ye(){"undefined"!=typeof window&&re.forEach(function(e){global.document.addEventListener(e,De,{passive:!1})})}function xe(){return ce&&ce.ghostParent?ce.ghostParent:se&&se.parentElement||global.document.body}var Ee=function(){var r,i,o,a=null,l=1,s=5;function u(e){var t=Se(e),n=t.clientX,o=t.clientY;if(i)(Math.abs(r.clientX-n)>s||Math.abs(r.clientY-o)>s)&&f();else if(Math.abs(r.clientX-n)>l||Math.abs(r.clientY-o)>l)return g()}function c(){f()}function d(){f()}function f(){clearTimeout(a),ie.forEach(function(e){return global.document.removeEventListener(e,u)},{passive:!1}),ae.forEach(function(e){return global.document.removeEventListener(e,c)},{passive:!1}),global.document.removeEventListener("drag",d,{passive:!1})}function g(){clearTimeout(a),f(),o()}return function(e,t,n){r=Se(e),o=n,(i="number"==typeof t?t:be?200:0)&&(a=setTimeout(g,i)),ie.forEach(function(e){return global.document.addEventListener(e,u)},{passive:!1}),ae.forEach(function(e){return global.document.addEventListener(e,c)},{passive:!1}),global.document.addEventListener("drag",d,{passive:!1})}}();function De(e){var t=Se(e);if(!fe&&(void 0===t.button||0===t.button)&&(se=z(t.target,"."+g))){var n=z(se,"."+s),o=de.filter(function(e){return e.element===n})[0],r=o.getOptions().dragHandleSelector,i=o.getOptions().nonDragAreaSelector,a=!0;if(r&&!z(t.target,r)&&(a=!1),i&&z(t.target,i)&&(a=!1),a){T(global.document.body,u),T(global.document.body,f);global.document.addEventListener("mouseup",function e(){P(global.document.body,u),P(global.document.body,f),global.document.removeEventListener("mouseup",e)})}a&&Ee(t,o.getOptions().dragBeginDelay,function(){M(),Ae(t,j(e.target)),ie.forEach(function(e){global.document.addEventListener(e,Ie,{passive:!1})}),ae.forEach(function(e){global.document.addEventListener(e,Ce,{passive:!1})})})}}function Ce(){var e;ie.forEach(function(e){global.document.removeEventListener(e,Ie,{passive:!1})}),ae.forEach(function(e){global.document.removeEventListener(e,Ce,{passive:!1})}),me({reset:!0}),ve&&((e=ve)&&"undefined"!=typeof window&&(global.document.head||global.document.getElementsByTagName("head")[0]).removeChild(e),ve=null),ce&&(he.stop(),function(e){function i(){P(ue.ghost,"animated"),ue.ghost.style.transitionDuration=null,xe().removeChild(ue.ghost),e()}function t(e,t,n){var o=e.top,r=e.left;T(ue.ghost,"animated"),n&&T(ue.ghost.firstElementChild,n),ue.ghost.style.transitionDuration=t+"ms",ue.ghost.style.left=r+"px",ue.ghost.style.top=o+"px",setTimeout(function(){i()},t+20)}function n(e,t){T(ue.ghost,"animated"),ue.ghost.style.transitionDuration=e+"ms",ue.ghost.style.opacity="0",ue.ghost.style.transform="scale(0.90)",setTimeout(function(){t()},e)}if(ce.targetElement){var o=de.filter(function(e){return e.element===ce.targetElement})[0];!(p=o.getOptions()).shouldAnimateDrop||p.shouldAnimateDrop(ce.container.getOptions(),ce.payload)?t(o.getDragResult().shadowBeginEnd.rect,Math.max(150,o.getOptions().animationDuration/2),o.getOptions().dropClass):i()}else{var r=de.filter(function(e){return e===ce.container})[0];if(r){var a=r.getOptions(),l=a.behaviour,s=a.removeOnDropOut;if("move"===l&&!s&&r.getDragResult()){var u=r.layout.getContainerRectangles();if(!V(u.visibleRect)&&V(u.lastVisibleRect))t({top:u.lastVisibleRect.top,left:u.lastVisibleRect.left},r.getOptions().animationDuration,r.getOptions().dropClass);else{var c=r.getDragResult(),d=c.removedIndex,f=c.elementSize,g=r.layout;r.getTranslateCalculator({dragResult:{removedIndex:d,addedIndex:d,elementSize:f,pos:void 0,shadowBeginEnd:void 0}});var m=0<d?g.getBeginEnd(r.draggables[d-1]).end:g.getBeginEndOfContainer().begin;t(g.getTopLeftOfElementBegin(m),r.getOptions().animationDuration,r.getOptions().dropClass)}}else n(r.getOptions().animationDuration,i)}else n(b.animationDuration,i)}var p}(function(){Oe(fe=!1);for(var e=le||[],t=e.shift();void 0!==t;)t.handleDrop(ce),t=e.shift();ge=pe=ce=ue=se=le=null}))}function Se(e){return e.touches?e.touches[0]:e}function Re(e){var t=e;return function(n){var o=!1;t.forEach(function(e){var t=e.handleDrag(n);o=!!t.containerBoxChanged||!1,t.containerBoxChanged=!1}),me({draggableInfo:n}),o&&(o=!1,setTimeout(function(){de.forEach(function(e){e.layout.invalidateRects(),e.onTranslated()})},10))}}function we(e,t){return e.getOptions().autoScrollEnabled?K(t):function(e){return null}}function Oe(o){de.forEach(function(e){var t=o?e.getOptions().onDragStart:e.getOptions().onDragEnd;if(t){var n={isSource:e===ce.container,payload:ce.payload};e.isDragRelevant(ce.container,ce.payload)?n.willAcceptDrop=!0:n.willAcceptDrop=!1,t(n)}})}function Ae(e,t){if(null!==se){fe=!0;var n=de.filter(function(e){return se.parentElement===e.element})[0];n.setDraggables(),pe=n.getOptions().lockAxis?n.getOptions().lockAxis.toLowerCase():null,h=se,b=de.filter(function(e){return h.parentElement===e.element})[0],y=b.draggables.indexOf(h),x=b.getOptions().getGhostParent,E=h.getBoundingClientRect(),ce={container:b,element:h,size:{offsetHeight:E.bottom-E.top,offsetWidth:E.right-E.left},elementIndex:y,payload:b.getOptions().getChildPayload?b.getOptions().getChildPayload(y):void 0,targetElement:null,position:{x:0,y:0},groupName:b.getOptions().groupName,ghostParent:x?x():null,invalidateShadow:null,mousePosition:null,relevantContainers:null},o=se,r={x:e.clientX,y:e.clientY},i=ce.container,a=t,l=r.x,s=r.y,u=o.getBoundingClientRect(),c=u.left,d=u.top,f=u.right,g=u.bottom,m=c+(f-c)/2,p=d+(g-d)/2,(v=o.cloneNode(!0)).style.zIndex="1000",v.style.boxSizing="border-box",v.style.position="fixed",v.style.left=c+"px",v.style.top=d+"px",v.style.width=f-c+"px",v.style.height=g-d+"px",v.style.overflow="visible",v.style.transition=null,v.style.removeProperty("transition"),v.style.pointerEvents="none",v.style.userSelect="none",i.getOptions().dragClass?setTimeout(function(){T(v.firstElementChild,i.getOptions().dragClass);var e=global.getComputedStyle(v.firstElementChild).cursor;ve=ne(e)}):ve=ne(a),T(v,i.getOptions().orientation||"vertical"),T(v,D),ue={ghost:v,centerDelta:{x:m-l,y:p-s},positionDelta:{left:c-l,top:d-s}},ce.position={x:e.clientX+ue.centerDelta.x,y:e.clientY+ue.centerDelta.y},ce.mousePosition={x:e.clientX,y:e.clientY},le=de.filter(function(e){return e.isDragRelevant(n,ce.payload)}),ce.relevantContainers=le,ge=Re(le),me&&me({reset:!0,draggableInfo:void 0}),me=we(n,le),le.forEach(function(e){return e.prepareDrag(e,le)}),Oe(!0),ge(ce),xe().appendChild(ue.ghost),he.start()}var o,r,i,a,l,s,u,c,d,f,g,m,p,v,h,b,y,x,E}function Ie(e){e.preventDefault();var t=Se(e);if(ce){var n=ce.container.getOptions();if("contain"===n.behaviour){var o=ce.container.layout.getBeginEndOfContainerVisibleRect();if("vertical"===n.orientation){var r=o.begin-ce.size.offsetHeight/2,i=o.end-ce.size.offsetHeight/2,a=Math.max(r,Math.min(i,t.clientY+ue.positionDelta.top));ue.ghost.style.top="".concat(a,"px"),ce.position.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY+ue.centerDelta.y)),ce.mousePosition.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY))}else{var l=o.begin-ce.size.offsetWidth/2,s=o.end-ce.size.offsetWidth/2,u=Math.max(l,Math.min(s,t.clientX+ue.positionDelta.left));ue.ghost.style.left="".concat(u,"px"),ce.position.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX+ue.centerDelta.x)),ce.mousePosition.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX))}}else pe?"y"===pe?(ue.ghost.style.top="".concat(t.clientY+ue.positionDelta.top,"px"),ce.position.y=t.clientY+ue.centerDelta.y,ce.mousePosition.y=t.clientY):"x"===pe&&(ue.ghost.style.left="".concat(t.clientX+ue.positionDelta.left,"px"),ce.position.x=t.clientX+ue.centerDelta.x,ce.mousePosition.x=t.clientX):(ue.ghost.style.left="".concat(t.clientX+ue.positionDelta.left,"px"),ue.ghost.style.top="".concat(t.clientY+ue.positionDelta.top,"px"),ce.position.x=t.clientX+ue.centerDelta.x,ce.position.y=t.clientY+ue.centerDelta.y,ce.mousePosition.x=t.clientX,ce.mousePosition.y=t.clientY);ge(ce)}else Ae(t,j(e.target))}!function(){if("undefined"!=typeof window){var e=global.document.head||global.document.getElementsByTagName("head")[0],t=global.document.createElement("style");t.id="smooth-dnd-style-definitions";var n=te(ee);t.type="text/css",t.styleSheet?t.styleSheet.cssText=n:t.appendChild(global.document.createTextNode(n)),e.appendChild(t)}}();var ze=(ye(),{register:function(e){var t;t=e,de.push(t),fe&&ce&&t.isDragRelevant(ce.container,ce.payload)&&(le.push(t),t.prepareDrag(t,le),me&&me({reset:!0,draggableInfo:void 0}),me=we(t,le),ge=Re(le),t.handleDrag(ce))},unregister:function(e){!function(e){if(de.splice(de.indexOf(e),1),fe&&ce){ce.container===e&&e.fireRemoveElement(),ce.targetElement===e.element&&(ce.targetElement=null);var t=le.indexOf(e);-1<t&&(le.splice(t,1),me&&me({reset:!0,draggableInfo:void 0}),me=we(e,le),ge=Re(le))}}(e)}});function Be(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:b.animationDuration;t?(T(e,o),e.style.transitionDuration=n+"ms"):(P(e,o),e.style.removeProperty("transition-duration"))}function Te(n){var o=[];return Array.prototype.forEach.call(n.children,function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e;B(e,g)||(t=function(e){if(tt.wrapChild){var t=global.document.createElement("div");return t.className="".concat(g),e.parentElement.insertBefore(t,e),t.appendChild(e),t}return e}(e)),t[p]=0,o.push(t)}else n.removeChild(e)}),o}function Pe(e){var g=e.layout;return function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return function e(t,n,o,r){var i=4<arguments.length&&void 0!==arguments[4]&&arguments[4];if(r<o)return o;if(o===r){var a=g.getBeginEnd(t[o]),l=a.begin,s=a.end;return l<n&&n<=s?i?n<(s+l)/2?o:o+1:o:null}var u=Math.floor((r+o)/2),c=g.getBeginEnd(t[u]),d=c.begin,f=c.end;return n<d?e(t,n,o,u-1,i):f<n?e(t,n,u+1,r,i):i?n<(f+d)/2?u:u+1:u}(e,t,0,e.length-1,n)}}function Le(e){var t,n,o,r,i=e.element,a=e.draggables,l=e.layout,s=e.options,u=(n=(t={element:i,draggables:a,layout:l,options:s}).element,o=t.draggables,r=t.layout,function(){o.forEach(function(e){Be(e,!1),r.setTranslation(e,0),r.setVisibility(e,!0)}),n[h]&&(n[h].parentNode.removeChild(n[h]),n[h]=null)}),c=(tt.dropHandler||H)({element:i,draggables:a,layout:l,options:s});return function(e,t){var n=t.addedIndex,o=t.removedIndex,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(u(),e.targetElement||s.removeOnDropOut||r){var i={removedIndex:o,addedIndex:null!==n?null!==o&&o<n?n-1:n:null,payload:e.payload};c(i,s.onDrop)}}}function Ne(e,t){var n=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:b;return Object.assign({},b,e)}(t),o=Te(e);return T(e,"".concat(s," ").concat(n.orientation)),{element:e,draggables:o,options:n,layout:k(e,n.orientation,n.animationDuration)}}function Me(e){var o=e.element,r=e.options,i=null;return function(e){var t=e.draggableInfo,n=i;return null==i&&t.container.element===o&&"copy"!==r.behaviour&&(n=i=t.elementIndex),{removedIndex:n}}}function je(e){var n=e.draggables,o=e.layout;return function(e){var t=e.dragResult;null!==t.removedIndex&&o.setVisibility(n[t.removedIndex],!1)}}function Ve(e){var r=e.element,i=e.layout;return function(e){var t=e.draggableInfo,n=document.elementFromPoint(t.position.x,t.position.y);if(n){var o=A(n,t.relevantContainers);if(o&&o.element===r)return{pos:i.getPosition(t.position)}}return{pos:null}}}function He(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 Xe(e){var o=e.element;return function(e){var t=e.draggableInfo,n=e.dragResult;!function(e,t){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];t&&n?e.targetElement=t:e.targetElement===t&&(e.targetElement=null)}(t,o,!!n.pos)}}function Ye(){return function(e){return null!==e.dragResult.pos?{addedIndex:0}:{addedIndex:null}}}function _e(e){e.draggables;var r=e.layout,i=null;return function(e){var t=e.dragResult.addedIndex;if(t===i)return null;i=t;var n=r.getBeginEndOfContainer(),o=n.begin;n.end;return{shadowBeginEnd:{rect:r.getTopLeftOfElementBegin(o)}}}}function ke(e){var o=Ue(e);return function(e){var t=e.draggableInfo,n=e.dragResult;return t.invalidateShadow?o({draggableInfo:t,dragResult:n}):null}}function Fe(e){var t,i,a,o=(i=(t=e).draggables,a=Pe({layout:t.layout}),function(e){var t=e.dragResult,n=t.shadowBeginEnd,o=t.pos;if(n)return n.begin+n.beginAdjustment<=o&&n.end>=o?null:o<n.begin+n.beginAdjustment?a(i,o):o>n.end?a(i,o)+1:i.length;var r=a(i,o,!0);return null!==r?r:i.length});return function(e){var t=e.dragResult,n=null;return null!==t.pos&&null===(n=o({dragResult:t}))&&(n=t.addedIndex),{addedIndex:n}}}function We(){var r=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.shadowBeginEnd;n!==r&&null!==r&&o&&(o.beginAdjustment=0),r=n}}function qe(e){var c=e.element,d=e.draggables,f=e.layout,g=e.options,m=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=t.elementSize;if(null===o)if(null!==n){if(!m){var i=f.getBeginEndOfContainer();i.end=i.begin+f.getSize(c);var a=f.getScrollSize(c)>f.getSize(c)?i.begin+f.getScrollSize(c)-f.getScrollValue(c):i.end,l=0<d.length?f.getBeginEnd(d[d.length-1]).end-d[d.length-1][p]:i.begin;if(a<l+r){(m=global.document.createElement("div")).className=v+" "+g.orientation;var s=0<d.length?r+l-a:r;return f.setSize(m.style,"".concat(s,"px")),c.appendChild(m),c[h]=m,{containerBoxChanged:!0}}}}else if(m){f.setTranslation(m,0);var u=m;return m=null,c.removeChild(u),{containerBoxChanged:!(c[h]=null)}}}}function Ge(e){var s=e.draggables,u=e.layout,c=null,d=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=t.elementSize;if(n!==c||o!==d){for(var i=0;i<s.length;i++)if(i!==o){var a=s[i],l=0;null!==o&&o<i&&(l-=r),null!==n&&n<=i&&(l+=r),u.setTranslation(a,l)}return{addedIndex:c=n,removedIndex:d=o}}}}function Ue(e){var b=e.draggables,y=e.layout,x=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:x=null};if(null===o||!t.invalidateShadow&&o===x)return null;x&&(x=o);var s=o-1,u=0,c=null,d=null;if(s===r&&s--,-1<s){var f=y.getSize(b[s]);if(d=y.getBeginEnd(b[s]),i<f){var g=(f-i)/2;u=d.end-g}else u=d.end}else d={end:y.getBeginEndOfContainer().begin};var m=1e4,p=o;if(p===r&&p++,p<b.length){var v=y.getSize(b[p]);if(c=y.getBeginEnd(b[p]),i<v){var h=(v-i)/2;m=c.begin+h}else m=c.begin}else c={begin:y.getContainerRectangles().rect.end};return{shadowBeginEnd:{begin:u,end:m,rect:d&&c?y.getTopLeftOfElementBegin(d.end):null,beginAdjustment:l?l.beginAdjustment:0}}}}function Je(){var a=null;return function(e){var t=e.dragResult,n=t.pos,o=t.addedIndex,r=t.shadowBeginEnd;if(null!==n){if(null!=o&&null===a){if(n<r.begin){var i=n-r.begin-5;r.beginAdjustment=i}a=o}}else a=null}}function Ke(e){var n=e.options,o=!1;return function(e){var t=!!e.dragResult.pos;if(t!==o){if(!(o=t))return n.onDragLeave&&n.onDragLeave(),{dragLeft:!0};n.onDragEnter&&n.onDragEnter()}}}function Qe(e){var s=e.options,u=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=e.draggableInfo,i=r.payload,a=r.element;if(s.onDropReady&&null!==n&&u!==n){var l=u=n;null!==o&&o<n&&l--,s.onDropReady({addedIndex:l,removedIndex:o,payload:i,element:a?a.firstElementChild:void 0})}}}function Ze(e){return"drop-zone"===e.options.behaviour?$e(e)(Me,je,Ve,He,Xe,Ye,_e,Ke,Qe):$e(e)(Me,je,Ve,He,Xe,ke,Fe,We,qe,Ge,Ue,Je,Ke,Qe)}function $e(i){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=t.map(function(e){return e(i)}),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 et(f){return function(e){var t,o,r,n=null,i=null,a=Ne(f,e),l=Ze(a),s=Le(a),u=I(f,function(){a.layout.invalidateRects(),c()});function c(){null!==i&&(i.invalidateShadow=!0,n=l(i),i.invalidateShadow=!1)}function d(e,t){for(var n=Te(t),o=0;o<n.length;o++)e[o]=n[o];for(var r=0;r<e.length-n.length;r++)e.pop()}return{element:f,draggables:a.draggables,isDragRelevant:(t=a,o=t.element,r=t.options,function(e,t){if(r.shouldAcceptDrop)return r.shouldAcceptDrop(e.getOptions(),t);var n=e.getOptions();return"copy"!==r.behaviour&&z(o,"."+g)!==e.element&&(e.element===o||!(!n.groupName||n.groupName!==r.groupName))}),layout:a.layout,dispose:function(e){var t;u.dispose(),t=e.element,tt.wrapChild&&Array.prototype.forEach.call(t.children,function(e){e.nodeType===Node.ELEMENT_NODE&&B(e,g)&&(t.insertBefore(e.firstElementChild,e),t.removeChild(e))})},prepareDrag:function(e,t){var n=e.element,o=a.draggables,r=e.getOptions();d(o,n),e.layout.invalidateRects(),o.forEach(function(e){return Be(e,!0,r.animationDuration)}),u.start()},handleDrag:function(e){return(n=l(i=e))&&n.dragLeft&&"drop-zone"!==a.options.behaviour&&(n.dragLeft=!1,setTimeout(function(){n&&Ge(a)({dragResult:n})},20)),n},handleDrop:function(e){u.stop(),i=null,l=Ze(a),s(e,n),n=null},fireRemoveElement:function(){s(i,Object.assign({},n,{addedIndex:null}),!0),n=null},getDragResult:function(){return n},getTranslateCalculator:function(e){return Ge(a)(e)},onTranslated:function(){c()},getOptions:function(){return a.options},setDraggables:function(){d(a.draggables,f)}}}}var tt=function(e,t){var n=et(e)(t);return e[r]=n,ze.register(n),{dispose:function(){ze.unregister(n),n.dispose(n)}}};tt.wrapChild=!0;e.smoothDnD=tt,e.constants=n,e.dropHandlers=X,e.default=function e(t,n){return console.warn('default export is deprecated. please use named export "smoothDnD"'),void 0!==e.dropHandler&&(tt.dropHandler=e.dropHandler),void 0!==e.wrapChild&&(tt.wrapChild=e.wrapChild),tt(t,n)},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -82,2 +82,3 @@ import layoutManager from './layoutManager'; | ||
ghostParent: HTMLElement | null; | ||
relevantContainers: IContainer[]; | ||
} | ||
@@ -84,0 +85,0 @@ export interface DragInfo { |
@@ -1,2 +0,2 @@ | ||
import { Rect, Axis, ScrollAxis } from './interfaces'; | ||
import { Rect, Axis, ScrollAxis, IContainer } from './interfaces'; | ||
export declare const getIntersection: (rect1: Rect, rect2: Rect) => { | ||
@@ -21,3 +21,3 @@ left: number; | ||
export declare const getVisibleRect: (element: HTMLElement, elementRect: Rect) => Rect; | ||
export declare const getParentContainerElement: (element: Element) => any; | ||
export declare const getParentRelevantContainerElement: (element: Element, relevantContainers: IContainer[]) => any; | ||
export declare const listenScrollParent: (element: HTMLElement, clb: () => void) => { | ||
@@ -24,0 +24,0 @@ dispose: () => void; |
{ | ||
"name": "smooth-dnd", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"description": "Drag and Drop library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
54849
407