Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sortable-dnd

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sortable-dnd - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

61

dist/sortable.js
/*!
* sortable-dnd v0.4.6
* sortable-dnd v0.4.7
* open source under the MIT license

@@ -659,23 +659,33 @@ * https://github.com/mfuu/sortable-dnd#readme

},
update: function update(parentNode, scrollThreshold, downEvent, moveEvent) {
update: function update(scrollEl, scrollThreshold, downEvent, moveEvent) {
var _this = this;
if (downEvent && moveEvent) {
this.autoScroll(parentNode, scrollThreshold, moveEvent);
}
cancelAnimationFrame(this.autoScrollAnimationFrame);
this.autoScrollAnimationFrame = requestAnimationFrame(function () {
return _this.update(parentNode, scrollThreshold, downEvent, moveEvent);
var _getRect = getRect(scrollEl),
top = _getRect.top,
right = _getRect.right,
bottom = _getRect.bottom,
left = _getRect.left;
var clientX = moveEvent.clientX,
clientY = moveEvent.clientY;
if (clientY < top || clientY > bottom || clientX < left || clientX > right) {
return;
}
if (downEvent && moveEvent) {
_this.autoScroll(scrollEl, scrollThreshold, moveEvent);
}
_this.update(scrollEl, scrollThreshold, downEvent, moveEvent);
});
},
autoScroll: function autoScroll(parentNode, scrollThreshold, evt) {
if (!parentNode) return;
autoScroll: function autoScroll(scrollEl, scrollThreshold, evt) {
if (!scrollEl) return;
var clientX = evt.clientX,
clientY = evt.clientY;
if (clientX === void 0 || clientY === void 0) return;
var rect = getRect(parentNode);
var rect = getRect(scrollEl);
if (!rect) return;
var scrollTop = parentNode.scrollTop,
scrollLeft = parentNode.scrollLeft,
scrollHeight = parentNode.scrollHeight,
scrollWidth = parentNode.scrollWidth;
var scrollTop = scrollEl.scrollTop,
scrollLeft = scrollEl.scrollLeft,
scrollHeight = scrollEl.scrollHeight,
scrollWidth = scrollEl.scrollWidth;
var top = rect.top,

@@ -710,6 +720,6 @@ right = rect.right,

if (scrolly) {
parentNode.scrollTop += scrolly;
scrollEl.scrollTop += scrolly;
}
if (scrollx) {
parentNode.scrollLeft += scrollx;
scrollEl.scrollLeft += scrollx;
}

@@ -723,11 +733,12 @@ }

Animation.prototype = {
collect: function collect(dragEl, dropEl, container) {
collect: function collect(dragEl, dropEl, container, except) {
var _this = this;
if (!container) return;
var children = _toConsumableArray(Array.from(container.children));
var _this$_getRange = this._getRange(children, dragEl, dropEl),
var _this$_getRange = this._getRange(children, dragEl, dropEl, except),
start = _this$_getRange.start,
end = _this$_getRange.end;
this.animations.length = 0;
var max = Math.floor(container.scrollHeight / dragEl.offsetHeight);
var offsetHeight = (dragEl || dropEl).offsetHeight;
var max = Math.floor(container.scrollHeight / offsetHeight);
var min = Math.min(children.length - 1, max);

@@ -740,2 +751,3 @@ if (start < 0) {

children.slice(start, end + 1).forEach(function (node) {
if (node === except) return;
_this.animations.push({

@@ -896,3 +908,3 @@ node: node,

rootEl = nearest;
if (rootEl === downEvent.group) return;
if (rootEl === downEvent.sortable.el) return;
nearest[expando]._onMove(evt);

@@ -1164,5 +1176,2 @@ }

if (Safari) css(document.body, 'user-select', 'none');
// re-get the scroll element, fix display 'none' to 'block'
this.scrollEl = getParentAutoScrollElement(this.el, true);
}

@@ -1190,2 +1199,6 @@ },

}));
if (!this.scrollEl) {
// get the scroll element, fix display 'none' to 'block'
this.scrollEl = getParentAutoScrollElement(this.el, true);
}

@@ -1227,3 +1240,4 @@ // auto scroll

var parentEl = insert ? rootEl : dropEl.parentNode;
from.sortable.animator.collect(dragEl, target, dragEl.parentNode);
from.sortable.animator.collect(dragEl, null, dragEl.parentNode, dragEl);
this.animator.collect(null, target, parentEl, dragEl);
if (isMultiple) this.multiplayer.onChange(dragEl, this);

@@ -1249,2 +1263,3 @@ to = {

from.sortable.animator.animate();
this.animator.animate();
from.group = parentEl;

@@ -1251,0 +1266,0 @@ from.sortable = this;

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function F(e,t){var n,o=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)),o}function c(o){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?F(Object(i),!0).forEach(function(t){var e,n;e=o,n=i[t=t],(t=function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(i,t))})}return o}function H(t){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t){return function(t){if(Array.isArray(t))return L(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var n;if(t)return"string"==typeof t?L(t,e):"Map"===(n="Object"===(n=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(t,e):void 0}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var R={capture:!1,passive:!1},k=/\s+/g,n={start:["pointerdown","touchstart","mousedown"],move:["pointermove","touchmove","mousemove"],end:["pointerup","pointercancel","touchend","touchcancel","mouseup"]};function t(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var W,f=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),z=t(/Edge/i),l=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i),q=(W=!1,document.addEventListener("checkIfSupportPassive",null,{get passive(){return W=!0}}),W),U="undefined"==typeof window||"undefined"==typeof document?"":(i=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],"ms"!==(i=(Array.prototype.slice.call(i).join("").match(/-(moz|webkit|ms)-/)||""===i.OLink&&["","o"])[1])?i&&i.length?i[0].toUpperCase()+i.substr(1):"":"ms");function u(t,e){t.style["".concat(U,"Transition")]=e?"none"===e?"none":"".concat(e):""}function h(t,e){t.style["".concat(U,"Transform")]=e?"".concat(e):""}function p(t,e,n){window.addEventListener?t.addEventListener(e,n,!(!q&&f)&&R):window.attachEvent&&t.attachEvent("on"+e,n)}function o(t,e,n){window.removeEventListener?t.removeEventListener(e,n,!(!q&&f)&&R):window.detachEvent&&t.detachEvent("on"+e,n)}function V(t){var n=t,o=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t.pointerType&&"touch"===t.pointerType&&t,t=o?document.elementFromPoint(e.clientX,e.clientY):t.target;return o&&(n.clientX=o.clientX,n.clientY=o.clientY,n.pageX=o.pageX,n.pageY=o.pageY,n.screenX=o.screenX,n.screenY=o.screenY),{touch:o,event:n,target:t}}function a(t){for(var e={top:0,left:0,height:t.offsetHeight,width:t.offsetWidth},n=d();e.top+=t.offsetTop,e.left+=t.offsetLeft,t!==n&&(t=t.offsetParent););return e}function d(){var t=document.scrollingElement;return!t||t.contains(document.body)?document:t}function m(t){var e,n,o,i,r,s,a,l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=2<arguments.length?arguments[2]:void 0;if(t.getBoundingClientRect||t===window){if(t!==window&&t.parentNode&&t!==d()){if(n=(e=t.getBoundingClientRect()).top,o=e.left,i=e.bottom,r=e.right,s=e.height,a=e.width,l.parent&&t.parentNode!==t.ownerDocument.body)for(var u,h=t.parentNode;h&&h.getBoundingClientRect&&h!==t.ownerDocument.body;){if((u=h.getBoundingClientRect()).height<s)return n=u.top,o=u.left,i=u.bottom,r=u.right,s=u.height,{top:n,left:o,bottom:i,right:r,width:a=u.width,height:s};h=h.parentNode}}else o=n=0,i=window.innerHeight,r=window.innerWidth,s=window.innerHeight,a=window.innerWidth;if((l.block||l.relative)&&t!==window&&(c=c||t.parentNode,!f))do{if(c&&c.getBoundingClientRect&&("none"!==y(c,"transform")||l.relative&&"static"!==y(c,"position"))){var p=c.getBoundingClientRect();n-=p.top+parseInt(y(c,"border-top-width")),o-=p.left+parseInt(y(c,"border-left-width")),i=n+e.height,r=o+e.width;break}}while(c=c.parentNode);return{top:n,left:o,bottom:i,right:r,width:a,height:s}}}function Z(t,e,n,o){if(t){n=n||document;do{if(null==e){var i=I(Array.from(n.children)),r=i.indexOf(t);if(-1<r)return i[r];for(var s=0;s<i.length;s++)if($(t,i[s]))return i[s]}else if(">"===e[0]?t.parentNode===n&&v(t,e):v(t,e)||o&&t===n)return t}while(t=t.parentNode)}return null}function $(t,e){if(e.compareDocumentPosition)return e===t||16&e.compareDocumentPosition(t);if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return 1}function g(t,e,n){var o;t&&e&&(t.classList?t.classList[n?"add":"remove"](e):(o=(" "+t.className+" ").replace(k," ").replace(" "+e+" "," "),t.className=(o+(n?" "+e:"")).replace(k," ")))}function v(t,e){if(e&&(">"===e[0]&&(e=e.substring(1)),t))try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return}}function G(t,e){return t.top!==e.top||t.left!==e.left}function y(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];o[e=e in o||-1!==e.indexOf("webkit")?e:"-webkit-"+e]=n+("string"==typeof n?"":"px")}}var b="Sortable"+Date.now(),i={sortable:null,nodes:[]},s=c({},i),w=c({},i),_={};function J(t){this.options=t||{},this.groupName=t.group.name}function K(){this.autoScrollAnimationFrame=null,this.speed={x:10,y:10}}function Q(){this.animations=[]}function tt(){this.helper=null}J.prototype={allowDrag:function(t){return this.options.multiple&&_[this.groupName]&&_[this.groupName].length&&-1<_[this.groupName].indexOf(t)},getHelper:function(){var n=document.createElement("div");return _[this.groupName].forEach(function(t,e){t=t.cloneNode(!0);t.style="\n opacity: ".concat(0===e?1:.5,";\n position: absolute;\n z-index: ").concat(e,";\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n "),n.appendChild(t)}),n},select:function(t,e,n){var o,i=this;e&&(_[this.groupName]||(_[this.groupName]=[]),o=_[this.groupName].indexOf(e),g(e,this.options.selectedClass,o<0),t=c(c({},n),{},{event:t}),o<0?(_[this.groupName].push(e),n.sortable._dispatchEvent("onSelect",t)):(_[this.groupName].splice(o,1),n.sortable._dispatchEvent("onDeselect",t)),_[this.groupName].sort(function(t,e){return i._sortByOffset(a(t),a(e))}))},onDrag:function(t){s.sortable=t,s.nodes=_[this.groupName].map(function(t){return{node:t,rect:m(t),offset:a(t)}}),w.sortable=t},onTrulyStarted:function(e,t){t.animator.collect(e,e,e.parentNode),_[this.groupName].forEach(function(t){t!=e&&t.parentNode.removeChild(t)}),t.animator.animate(t.options.animation)},onChange:function(t,e){var n=m(t),o=a(t);w.sortable=e,w.nodes=_[this.groupName].map(function(t){return{node:t,rect:n,offset:o}})},onDrop:function(t,n,e,o){var i=this,r=(w.sortable.animator.collect(n,n,n.parentNode),_[this.groupName].indexOf(n)),e=(_[this.groupName].forEach(function(t,e){e<r?n.parentNode.insertBefore(t,n):(e=0<e?_[i.groupName][e-1]:n,n.parentNode.insertBefore(t,e.nextSibling))}),s.sortable=e.sortable,w.nodes=_[this.groupName].map(function(t){return{node:t,rect:m(t),offset:a(t)}}),this._offsetChanged(s.nodes,w.nodes)),o=c(c({},o()),{},{changed:e,event:t});w.sortable.el!=s.sortable.el&&s.sortable._dispatchEvent("onDrop",o),w.sortable._dispatchEvent("onDrop",o),w.sortable.animator.animate(w.sortable.options.animation)},_sortByOffset:function(t,e){return t.top==e.top?t.left>e.left:t.top>e.top},_offsetChanged:function(t,n){return!!t.find(function(e){return G(n.find(function(t){return t.node===e.node}).offset,e.offset)})}},window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),K.prototype={clear:function(){null!=this.autoScrollAnimationFrame&&(cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=null)},update:function(t,e,n,o){var i=this;n&&o&&this.autoScroll(t,e,o),cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=requestAnimationFrame(function(){return i.update(t,e,n,o)})},autoScroll:function(t,e,n){var o,i,r,s,a,l,c,u,h,p,f,d;t&&(o=n.clientX,n=n.clientY,void 0!==o)&&void 0!==n&&(h=m(t))&&(f=t.scrollTop,i=t.scrollLeft,r=t.scrollHeight,p=t.scrollWidth,s=h.top,a=h.right,l=h.bottom,c=h.left,d=h.height,u=0<f&&s<=n&&n<=s+e,h=i+h.width<p&&o<=a&&a-e<=o,p=f+d<r&&n<=l&&l-e<=n,f=(d=f=0)<i&&c<=o&&o<=c+e?Math.floor(Math.max(-1,(o-c)/e-1)*this.speed.x):h?Math.ceil(Math.min(1,(o-a)/e+1)*this.speed.x):0,(d=u?Math.floor(Math.max(-1,(n-s)/e-1)*this.speed.y):p?Math.ceil(Math.min(1,(n-l)/e+1)*this.speed.y):0)&&(t.scrollTop+=d),f)&&(t.scrollLeft+=f)}},Q.prototype={collect:function(t,e,n){var o,i,r=this;n&&(o=I(Array.from(n.children)),i=(e=this._getRange(o,t,e)).start,e=e.end,this.animations.length=0,n=Math.floor(n.scrollHeight/t.offsetHeight),t=Math.min(o.length-1,n),i<0&&(i=e,e=t),o.slice(i,(e=e<0?t:e)+1).forEach(function(t){r.animations.push({node:t,rect:m(t)})}))},animate:function(n){var o=this;this.animations.forEach(function(t){var e=t.node,t=t.rect;o._excute(e,t,n)})},_excute:function(t,e){var n=e.left,e=e.top,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:150,i=m(t),e=e-i.top,n=n-i.left;u(t,"none"),h(t,"translate3d(".concat(n,"px, ").concat(e,"px, 0)")),t.offsetWidth,u(t,"".concat(o,"ms")),h(t,"translate3d(0px, 0px, 0px)"),clearTimeout(t.animated),t.animated=setTimeout(function(){u(t,""),h(t,""),t.animated=null},o)},_getRange:function(t,e,n){e=t.indexOf(e),t=t.indexOf(n);return t<e&&(e=(n=[t,e])[0],t=n[1]),{start:e,end:t}}},tt.prototype={get node(){return this.helper},destroy:function(){this.helper&&this.helper.parentNode&&this.helper.parentNode.removeChild(this.helper),this.helper=null},move:function(t,e){h(this.helper,"translate3d(".concat(t,"px, ").concat(e,"px, 0)"))},init:function(t,e,n,o,i){if(!this.helper){var r,s=o.fallbackOnBody,a=o.ghostClass,o=o.ghostStyle,o=void 0===o?{}:o,s=s?document.body:n,l=(this.helper=e.cloneNode(!0),g(this.helper,a,!0),c({"box-sizing":"border-box",top:t.top,left:t.left,width:t.width,height:t.height,position:"fixed",opacity:"0.8","z-index":1e5,"pointer-events":"none"},o));for(r in l)y(this.helper,r,l[r]);u(this.helper,"none"),h(this.helper,"translate3d(0px, 0px, 0px)"),s.appendChild(this.helper);n=i.x/parseInt(this.helper.style.width)*100,e=i.y/parseInt(this.helper.style.height)*100;y(this.helper,"transform-origin","".concat(n,"% ").concat(e,"%")),y(this.helper,"transform","translateZ(0)")}}};function et(t){var e;D&&(e=t.touches?t.touches[0]:t,e=nt(e.clientX,e.clientY))&&(S=e)!==N.group&&e[b]._onMove(t)}function nt(i,r){var s;return A.some(function(t){var e,n,o=t[b].options.emptyInsertThreshold;if(o)return n=m(t,{parent:!0}),e=i>=n.left-o&&i<=n.right+o,n=r>=n.top-o&&r<=n.bottom+o,e&&n?s=t:void 0}),s}function r(){var t,e={from:c({},j),to:c({},B)};return C&&(t={from:c({},s),to:c({},w)},e.from=c(c({},t.from),e.from),e.to=c(c({},t.to),e.to)),e}var S,D,E,N,x,O,C,T,M,ot={sortable:null,group:null,node:null,rect:{},offset:{}},A=[],P=new tt,j=c({},ot),B=c({},ot),it={x:0,y:0},X={x:0,y:0};function Y(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));(t[b]=this).el=t,this.ownerDocument=t.ownerDocument,this.options=e=Object.assign({},e);var n,o,i,r={group:"",animation:150,multiple:!1,draggable:null,handle:null,onDrag:null,onMove:null,onDrop:null,onChange:null,autoScroll:!0,scrollThreshold:25,delay:0,delayOnTouchOnly:!1,disabled:!1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",fallbackOnBody:!1,stopPropagation:!1,supportPointer:"onpointerdown"in window&&!l,supportTouch:"ontouchstart"in window,emptyInsertThreshold:5};for(n in r)n in this.options||(this.options[n]=r[n]);for(i in e=e,s="group_"+Number(Math.random().toString().slice(-3)+Date.now()).toString(32),o={},(a=e.group)&&"object"==H(a)||(a={name:a,pull:!0,put:!0}),o.name=a.name||s,o.pull=a.pull,o.put=a.put,e.group=o,this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));var s=this.options,a=s.supportPointer,e=s.supportTouch;p(t,a?"pointerdown":e?"touchstart":"mousedown",this._onDrag),A.push(t),this.multiplayer=new J(this.options),this.animator=new Q,T=new K}return(Y.prototype={constructor:Y,get helper(){return P.node},destroy:function(){this._dispatchEvent("destroy",this),this.el[b]=null;for(var t=0;t<n.start.length;t++)o(this.el,n.start[t],this._onDrag);this._clearState(),A.splice(A.indexOf(this.el),1),0==A.length&&(T=null),this.el=null},_onDrag:function(t){var e=this;if(!D&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var n=V(t),o=n.touch,i=n.event,n=n.target;if(!(l&&n&&"SELECT"===n.tagName.toUpperCase()||n===this.el)){var r=this.options,s=r.draggable,r=r.handle;if(("function"!=typeof r||r(t))&&("string"!=typeof r||v(n,r))){if("function"==typeof s){r=s(t);if(!r)return;!function(e){if(e){var t=document.createElement("div");try{return t.appendChild(e.cloneNode(!0)),1==e.nodeType}catch(t){return e==window||e==document}}}(r)||(D=r)}else D=Z(n,s,this.el,!1);D&&!D.animated&&(o&&(D.style["touch-action"]="none"),t=D.parentNode,O=o,(N=i).sortable=this,N.group=t,(C=this.options.multiple&&this.multiplayer.allowDrag(D))&&this.multiplayer.onDrag(this),r=m(D),n=a(D),j={sortable:this,group:t,node:D,rect:r,offset:n},B.group=t,B.sortable=this,it={x:i.clientX-r.left,y:i.clientY-r.top},this.options.supportPointer?p(this.ownerDocument,"pointermove",et):p(this.ownerDocument,o?"touchmove":"mousemove",et),n=(s=this.options).delay,t=s.delayOnTouchOnly,!n||t&&!o||z||f?this._onStart():(clearTimeout(M),M=setTimeout(function(){return e._onStart()},n)))}}}},_onStart:function(){S=this.el,this.options.supportPointer?(p(this.ownerDocument,"pointermove",this._onMove),p(this.ownerDocument,"pointerup",this._onDrop),p(this.ownerDocument,"pointercancel",this._onDrop)):O?(p(this.ownerDocument,"touchmove",this._onMove),p(this.ownerDocument,"touchend",this._onDrop),p(this.ownerDocument,"touchcancel",this._onDrop)):(p(this.ownerDocument,"mousemove",this._onMove),p(this.ownerDocument,"mouseup",this._onDrop));try{document.selection?setTimeout(function(){document.selection.empty()},0):window.getSelection().removeAllRanges()}catch(t){}},_onTrulyStarted:function(){var t;x||(this._dispatchEvent("onDrag",c(c({},r()),{},{event:N})),C&&this.multiplayer.onTrulyStarted(D,this),t=C?this.multiplayer.getHelper():D,P.init(j.rect,t,this.el,this.options,it),g(D,this.options.chosenClass,!0),D.style["will-change"]="transform",l&&y(document.body,"user-select","none"),this.scrollEl=function(t,e){if(t&&t.getBoundingClientRect){var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=y(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return d();if(o||e)return n;o=!0}}}while(n=n.parentNode)}return d()}(this.el,!0))},_onMove:function(t){var e,n,o,i;this._preventEvent(t),N&&D&&(i=(e=t).clientX,e=e.clientY,n=i-X.x,o=e-X.y,X.x=i,X.y=e,void 0!==i&&void 0!==e&&Math.abs(n)<=0&&Math.abs(o)<=0||(e=(i=V(t)).event,n=i.target,this._onTrulyStarted(),x=e,o=t.clientX-N.clientX,i=t.clientY-N.clientY,P.move(o,i),this._dispatchEvent("onMove",c(c({},r()),{},{event:e})),o=(t=this.options).autoScroll,i=t.scrollThreshold,o&&T.update(this.scrollEl,i,N,x),!this._allowPut())||(E=Z(n,this.options.draggable,S,!1))===D||E&&E.animated||E&&$(E,D)||(S!==j.sortable.el?n!==S&&function(t,e,n){for(var o=t.lastElementChild;o&&(o===e||"none"===y(o,"display")||n&&!v(o,n));)o=o.previousElementSibling;return o}(S,P.node)?E&&this._onInsert(e,!1):this._onInsert(e,!0):E&&this._onChange(e)))},_allowPut:function(){var t,e;return N.group===this.el||!!this.options.group.put&&(t=this.options.group.name,(e=N.sortable.options.group).name)&&t&&e.name===t},_onInsert:function(t,e){var n=e?D:E,o=e?S:E.parentNode;j.sortable.animator.collect(D,n,D.parentNode),C&&this.multiplayer.onChange(D,this),B={sortable:this,group:o,node:n,rect:m(D),offset:a(D)},j.sortable._dispatchEvent("onRemove",c(c({},r()),{},{event:t})),e?o.appendChild(D):o.insertBefore(D,n),this._dispatchEvent("onAdd",c(c({},r()),{},{event:t})),j.sortable.animator.animate(),j.group=o,j.sortable=this},_onChange:function(t){var e=E.parentNode,t=(this.animator.collect(D,E,e),C&&this.multiplayer.onChange(D,this),B={sortable:this,group:e,node:E,rect:m(E),offset:a(E)},this._dispatchEvent("onChange",c(c({},r()),{},{event:t})),a(D));t.top<B.offset.top||t.left<B.offset.left?e.insertBefore(D,E.nextSibling):e.insertBefore(D,E),this.animator.animate(),j.group=e,j.sortable=this},_onDrop:function(t){var e;this._unbindMoveEvents(),this._unbindDropEvents(),this._preventEvent(t),T.clear(),clearTimeout(M),D&&(g(D,this.options.chosenClass,!1),O&&(D.style["touch-action"]=""),D.style["will-change"]=""),D&&N&&x?(j.group=N.group,j.sortable=N.sortable,C?this.multiplayer.onDrop(t,D,N,r):(B.rect=m(D),B.offset=a(D),e=G(j.offset,B.offset),e=c(c({},r()),{},{changed:e,event:t}),B.sortable.el!==j.sortable.el&&j.sortable._dispatchEvent("onDrop",e),B.sortable._dispatchEvent("onDrop",e)),l&&y(document.body,"user-select","")):this.options.multiple&&this.multiplayer.select(t,D,c({},j)),this._clearState()},_preventEvent:function(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),this.options.stopPropagation&&t.stopPropagation&&t.stopPropagation()},_dispatchEvent:function(t,e){t=this.options[t];"function"==typeof t&&t(e)},_clearState:function(){D=E=N=x=O=C=M=Y.ghost=null,it=X={x:0,y:0},j=B=c({},ot),P.destroy()},_unbindMoveEvents:function(){for(var t=0;t<n.move.length;t++)o(this.ownerDocument,n.move[t],this._onMove),o(this.ownerDocument,n.move[t],et)},_unbindDropEvents:function(){for(var t=0;t<n.end.length;t++)o(this.ownerDocument,n.end[t],this._onDrop)}}).utils={getRect:m,getOffset:a},Y});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function F(e,t){var o,n=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)),n}function c(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?F(Object(i),!0).forEach(function(t){var e,o;e=n,o=i[t=t],(t=function(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(i,t))})}return n}function H(t){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t){return function(t){if(Array.isArray(t))return L(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var o;if(t)return"string"==typeof t?L(t,e):"Map"===(o="Object"===(o=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?L(t,e):void 0}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,n=new Array(e);o<e;o++)n[o]=t[o];return n}var R={capture:!1,passive:!1},k=/\s+/g,o={start:["pointerdown","touchstart","mousedown"],move:["pointermove","touchmove","mousemove"],end:["pointerup","pointercancel","touchend","touchcancel","mouseup"]};function t(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var W,f=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),z=t(/Edge/i),l=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i),q=(W=!1,document.addEventListener("checkIfSupportPassive",null,{get passive(){return W=!0}}),W),U="undefined"==typeof window||"undefined"==typeof document?"":(i=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],"ms"!==(i=(Array.prototype.slice.call(i).join("").match(/-(moz|webkit|ms)-/)||""===i.OLink&&["","o"])[1])?i&&i.length?i[0].toUpperCase()+i.substr(1):"":"ms");function u(t,e){t.style["".concat(U,"Transition")]=e?"none"===e?"none":"".concat(e):""}function h(t,e){t.style["".concat(U,"Transform")]=e?"".concat(e):""}function p(t,e,o){window.addEventListener?t.addEventListener(e,o,!(!q&&f)&&R):window.attachEvent&&t.attachEvent("on"+e,o)}function n(t,e,o){window.removeEventListener?t.removeEventListener(e,o,!(!q&&f)&&R):window.detachEvent&&t.detachEvent("on"+e,o)}function V(t){var o=t,n=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t.pointerType&&"touch"===t.pointerType&&t,t=n?document.elementFromPoint(e.clientX,e.clientY):t.target;return n&&(o.clientX=n.clientX,o.clientY=n.clientY,o.pageX=n.pageX,o.pageY=n.pageY,o.screenX=n.screenX,o.screenY=n.screenY),{touch:n,event:o,target:t}}function a(t){for(var e={top:0,left:0,height:t.offsetHeight,width:t.offsetWidth},o=d();e.top+=t.offsetTop,e.left+=t.offsetLeft,t!==o&&(t=t.offsetParent););return e}function d(){var t=document.scrollingElement;return!t||t.contains(document.body)?document:t}function m(t){var e,o,n,i,r,s,a,l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=2<arguments.length?arguments[2]:void 0;if(t.getBoundingClientRect||t===window){if(t!==window&&t.parentNode&&t!==d()){if(o=(e=t.getBoundingClientRect()).top,n=e.left,i=e.bottom,r=e.right,s=e.height,a=e.width,l.parent&&t.parentNode!==t.ownerDocument.body)for(var u,h=t.parentNode;h&&h.getBoundingClientRect&&h!==t.ownerDocument.body;){if((u=h.getBoundingClientRect()).height<s)return o=u.top,n=u.left,i=u.bottom,r=u.right,s=u.height,{top:o,left:n,bottom:i,right:r,width:a=u.width,height:s};h=h.parentNode}}else n=o=0,i=window.innerHeight,r=window.innerWidth,s=window.innerHeight,a=window.innerWidth;if((l.block||l.relative)&&t!==window&&(c=c||t.parentNode,!f))do{if(c&&c.getBoundingClientRect&&("none"!==y(c,"transform")||l.relative&&"static"!==y(c,"position"))){var p=c.getBoundingClientRect();o-=p.top+parseInt(y(c,"border-top-width")),n-=p.left+parseInt(y(c,"border-left-width")),i=o+e.height,r=n+e.width;break}}while(c=c.parentNode);return{top:o,left:n,bottom:i,right:r,width:a,height:s}}}function Z(t,e,o,n){if(t){o=o||document;do{if(null==e){var i=I(Array.from(o.children)),r=i.indexOf(t);if(-1<r)return i[r];for(var s=0;s<i.length;s++)if($(t,i[s]))return i[s]}else if(">"===e[0]?t.parentNode===o&&v(t,e):v(t,e)||n&&t===o)return t}while(t=t.parentNode)}return null}function $(t,e){if(e.compareDocumentPosition)return e===t||16&e.compareDocumentPosition(t);if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return 1}function g(t,e,o){var n;t&&e&&(t.classList?t.classList[o?"add":"remove"](e):(n=(" "+t.className+" ").replace(k," ").replace(" "+e+" "," "),t.className=(n+(o?" "+e:"")).replace(k," ")))}function v(t,e){if(e&&(">"===e[0]&&(e=e.substring(1)),t))try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return}}function G(t,e){return t.top!==e.top||t.left!==e.left}function y(t,e,o){var n=t&&t.style;if(n){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(o=t.currentStyle),void 0===e?o:o[e];n[e=e in n||-1!==e.indexOf("webkit")?e:"-webkit-"+e]=o+("string"==typeof o?"":"px")}}var b="Sortable"+Date.now(),i={sortable:null,nodes:[]},s=c({},i),w=c({},i),_={};function J(t){this.options=t||{},this.groupName=t.group.name}function K(){this.autoScrollAnimationFrame=null,this.speed={x:10,y:10}}function Q(){this.animations=[]}function tt(){this.helper=null}J.prototype={allowDrag:function(t){return this.options.multiple&&_[this.groupName]&&_[this.groupName].length&&-1<_[this.groupName].indexOf(t)},getHelper:function(){var o=document.createElement("div");return _[this.groupName].forEach(function(t,e){t=t.cloneNode(!0);t.style="\n opacity: ".concat(0===e?1:.5,";\n position: absolute;\n z-index: ").concat(e,";\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n "),o.appendChild(t)}),o},select:function(t,e,o){var n,i=this;e&&(_[this.groupName]||(_[this.groupName]=[]),n=_[this.groupName].indexOf(e),g(e,this.options.selectedClass,n<0),t=c(c({},o),{},{event:t}),n<0?(_[this.groupName].push(e),o.sortable._dispatchEvent("onSelect",t)):(_[this.groupName].splice(n,1),o.sortable._dispatchEvent("onDeselect",t)),_[this.groupName].sort(function(t,e){return i._sortByOffset(a(t),a(e))}))},onDrag:function(t){s.sortable=t,s.nodes=_[this.groupName].map(function(t){return{node:t,rect:m(t),offset:a(t)}}),w.sortable=t},onTrulyStarted:function(e,t){t.animator.collect(e,e,e.parentNode),_[this.groupName].forEach(function(t){t!=e&&t.parentNode.removeChild(t)}),t.animator.animate(t.options.animation)},onChange:function(t,e){var o=m(t),n=a(t);w.sortable=e,w.nodes=_[this.groupName].map(function(t){return{node:t,rect:o,offset:n}})},onDrop:function(t,o,e,n){var i=this,r=(w.sortable.animator.collect(o,o,o.parentNode),_[this.groupName].indexOf(o)),e=(_[this.groupName].forEach(function(t,e){e<r?o.parentNode.insertBefore(t,o):(e=0<e?_[i.groupName][e-1]:o,o.parentNode.insertBefore(t,e.nextSibling))}),s.sortable=e.sortable,w.nodes=_[this.groupName].map(function(t){return{node:t,rect:m(t),offset:a(t)}}),this._offsetChanged(s.nodes,w.nodes)),n=c(c({},n()),{},{changed:e,event:t});w.sortable.el!=s.sortable.el&&s.sortable._dispatchEvent("onDrop",n),w.sortable._dispatchEvent("onDrop",n),w.sortable.animator.animate(w.sortable.options.animation)},_sortByOffset:function(t,e){return t.top==e.top?t.left>e.left:t.top>e.top},_offsetChanged:function(t,o){return!!t.find(function(e){return G(o.find(function(t){return t.node===e.node}).offset,e.offset)})}},window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),K.prototype={clear:function(){null!=this.autoScrollAnimationFrame&&(cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=null)},update:function(s,a,l,c){var u=this;cancelAnimationFrame(this.autoScrollAnimationFrame),this.autoScrollAnimationFrame=requestAnimationFrame(function(){var t=m(s),e=t.top,o=t.right,n=t.bottom,t=t.left,i=c.clientX,r=c.clientY;r<e||n<r||i<t||o<i||(l&&c&&u.autoScroll(s,a,c),u.update(s,a,l,c))})},autoScroll:function(t,e,o){var n,i,r,s,a,l,c,u,h,p,f,d;t&&(n=o.clientX,o=o.clientY,void 0!==n)&&void 0!==o&&(h=m(t))&&(f=t.scrollTop,i=t.scrollLeft,r=t.scrollHeight,p=t.scrollWidth,s=h.top,a=h.right,l=h.bottom,c=h.left,d=h.height,u=0<f&&s<=o&&o<=s+e,h=i+h.width<p&&n<=a&&a-e<=n,p=f+d<r&&o<=l&&l-e<=o,f=(d=f=0)<i&&c<=n&&n<=c+e?Math.floor(Math.max(-1,(n-c)/e-1)*this.speed.x):h?Math.ceil(Math.min(1,(n-a)/e+1)*this.speed.x):0,(d=u?Math.floor(Math.max(-1,(o-s)/e-1)*this.speed.y):p?Math.ceil(Math.min(1,(o-l)/e+1)*this.speed.y):0)&&(t.scrollTop+=d),f)&&(t.scrollLeft+=f)}},Q.prototype={collect:function(t,e,o,n){var i,r,s,a=this;o&&(i=I(Array.from(o.children)),r=(s=this._getRange(i,t,e,n)).start,s=s.end,this.animations.length=0,t=(t||e).offsetHeight,e=Math.floor(o.scrollHeight/t),o=Math.min(i.length-1,e),r<0&&(r=s,s=o),i.slice(r,(s=s<0?o:s)+1).forEach(function(t){t!==n&&a.animations.push({node:t,rect:m(t)})}))},animate:function(o){var n=this;this.animations.forEach(function(t){var e=t.node,t=t.rect;n._excute(e,t,o)})},_excute:function(t,e){var o=e.left,e=e.top,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:150,i=m(t),e=e-i.top,o=o-i.left;u(t,"none"),h(t,"translate3d(".concat(o,"px, ").concat(e,"px, 0)")),t.offsetWidth,u(t,"".concat(n,"ms")),h(t,"translate3d(0px, 0px, 0px)"),clearTimeout(t.animated),t.animated=setTimeout(function(){u(t,""),h(t,""),t.animated=null},n)},_getRange:function(t,e,o){e=t.indexOf(e),t=t.indexOf(o);return t<e&&(e=(o=[t,e])[0],t=o[1]),{start:e,end:t}}},tt.prototype={get node(){return this.helper},destroy:function(){this.helper&&this.helper.parentNode&&this.helper.parentNode.removeChild(this.helper),this.helper=null},move:function(t,e){h(this.helper,"translate3d(".concat(t,"px, ").concat(e,"px, 0)"))},init:function(t,e,o,n,i){if(!this.helper){var r,s=n.fallbackOnBody,a=n.ghostClass,n=n.ghostStyle,n=void 0===n?{}:n,s=s?document.body:o,l=(this.helper=e.cloneNode(!0),g(this.helper,a,!0),c({"box-sizing":"border-box",top:t.top,left:t.left,width:t.width,height:t.height,position:"fixed",opacity:"0.8","z-index":1e5,"pointer-events":"none"},n));for(r in l)y(this.helper,r,l[r]);u(this.helper,"none"),h(this.helper,"translate3d(0px, 0px, 0px)"),s.appendChild(this.helper);o=i.x/parseInt(this.helper.style.width)*100,e=i.y/parseInt(this.helper.style.height)*100;y(this.helper,"transform-origin","".concat(o,"% ").concat(e,"%")),y(this.helper,"transform","translateZ(0)")}}};function et(t){var e;D&&(e=t.touches?t.touches[0]:t,e=ot(e.clientX,e.clientY))&&(S=e)!==N.sortable.el&&e[b]._onMove(t)}function ot(i,r){var s;return A.some(function(t){var e,o,n=t[b].options.emptyInsertThreshold;if(n)return o=m(t,{parent:!0}),e=i>=o.left-n&&i<=o.right+n,o=r>=o.top-n&&r<=o.bottom+n,e&&o?s=t:void 0}),s}function r(){var t,e={from:c({},j),to:c({},B)};return C&&(t={from:c({},s),to:c({},w)},e.from=c(c({},t.from),e.from),e.to=c(c({},t.to),e.to)),e}var S,D,E,N,x,O,C,T,M,nt={sortable:null,group:null,node:null,rect:{},offset:{}},A=[],P=new tt,j=c({},nt),B=c({},nt),it={x:0,y:0},X={x:0,y:0};function Y(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));(t[b]=this).el=t,this.ownerDocument=t.ownerDocument,this.options=e=Object.assign({},e);var o,n,i,r={group:"",animation:150,multiple:!1,draggable:null,handle:null,onDrag:null,onMove:null,onDrop:null,onChange:null,autoScroll:!0,scrollThreshold:25,delay:0,delayOnTouchOnly:!1,disabled:!1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",fallbackOnBody:!1,stopPropagation:!1,supportPointer:"onpointerdown"in window&&!l,supportTouch:"ontouchstart"in window,emptyInsertThreshold:5};for(o in r)o in this.options||(this.options[o]=r[o]);for(i in e=e,s="group_"+Number(Math.random().toString().slice(-3)+Date.now()).toString(32),n={},(a=e.group)&&"object"==H(a)||(a={name:a,pull:!0,put:!0}),n.name=a.name||s,n.pull=a.pull,n.put=a.put,e.group=n,this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));var s=this.options,a=s.supportPointer,e=s.supportTouch;p(t,a?"pointerdown":e?"touchstart":"mousedown",this._onDrag),A.push(t),this.multiplayer=new J(this.options),this.animator=new Q,T=new K}return(Y.prototype={constructor:Y,get helper(){return P.node},destroy:function(){this._dispatchEvent("destroy",this),this.el[b]=null;for(var t=0;t<o.start.length;t++)n(this.el,o.start[t],this._onDrag);this._clearState(),A.splice(A.indexOf(this.el),1),0==A.length&&(T=null),this.el=null},_onDrag:function(t){var e=this;if(!D&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var o=V(t),n=o.touch,i=o.event,o=o.target;if(!(l&&o&&"SELECT"===o.tagName.toUpperCase()||o===this.el)){var r=this.options,s=r.draggable,r=r.handle;if(("function"!=typeof r||r(t))&&("string"!=typeof r||v(o,r))){if("function"==typeof s){r=s(t);if(!r)return;!function(e){if(e){var t=document.createElement("div");try{return t.appendChild(e.cloneNode(!0)),1==e.nodeType}catch(t){return e==window||e==document}}}(r)||(D=r)}else D=Z(o,s,this.el,!1);D&&!D.animated&&(n&&(D.style["touch-action"]="none"),t=D.parentNode,O=n,(N=i).sortable=this,N.group=t,(C=this.options.multiple&&this.multiplayer.allowDrag(D))&&this.multiplayer.onDrag(this),r=m(D),o=a(D),j={sortable:this,group:t,node:D,rect:r,offset:o},B.group=t,B.sortable=this,it={x:i.clientX-r.left,y:i.clientY-r.top},this.options.supportPointer?p(this.ownerDocument,"pointermove",et):p(this.ownerDocument,n?"touchmove":"mousemove",et),o=(s=this.options).delay,t=s.delayOnTouchOnly,!o||t&&!n||z||f?this._onStart():(clearTimeout(M),M=setTimeout(function(){return e._onStart()},o)))}}}},_onStart:function(){S=this.el,this.options.supportPointer?(p(this.ownerDocument,"pointermove",this._onMove),p(this.ownerDocument,"pointerup",this._onDrop),p(this.ownerDocument,"pointercancel",this._onDrop)):O?(p(this.ownerDocument,"touchmove",this._onMove),p(this.ownerDocument,"touchend",this._onDrop),p(this.ownerDocument,"touchcancel",this._onDrop)):(p(this.ownerDocument,"mousemove",this._onMove),p(this.ownerDocument,"mouseup",this._onDrop));try{document.selection?setTimeout(function(){document.selection.empty()},0):window.getSelection().removeAllRanges()}catch(t){}},_onTrulyStarted:function(){var t;x||(this._dispatchEvent("onDrag",c(c({},r()),{},{event:N})),C&&this.multiplayer.onTrulyStarted(D,this),t=C?this.multiplayer.getHelper():D,P.init(j.rect,t,this.el,this.options,it),g(D,this.options.chosenClass,!0),D.style["will-change"]="transform",l&&y(document.body,"user-select","none"))},_onMove:function(t){var e,o,n,i;this._preventEvent(t),N&&D&&(i=(e=t).clientX,e=e.clientY,o=i-X.x,n=e-X.y,X.x=i,X.y=e,void 0!==i&&void 0!==e&&Math.abs(o)<=0&&Math.abs(n)<=0||(e=(i=V(t)).event,o=i.target,this._onTrulyStarted(),x=e,n=t.clientX-N.clientX,i=t.clientY-N.clientY,P.move(n,i),this._dispatchEvent("onMove",c(c({},r()),{},{event:e})),this.scrollEl||(this.scrollEl=function(t,e){if(t&&t.getBoundingClientRect){var o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var i=y(o);if(o.clientWidth<o.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!o.getBoundingClientRect||o===document.body)return d();if(n||e)return o;n=!0}}}while(o=o.parentNode)}return d()}(this.el,!0)),n=(t=this.options).autoScroll,i=t.scrollThreshold,n&&T.update(this.scrollEl,i,N,x),!this._allowPut())||(E=Z(o,this.options.draggable,S,!1))===D||E&&E.animated||E&&$(E,D)||(S!==j.sortable.el?o!==S&&function(t,e,o){for(var n=t.lastElementChild;n&&(n===e||"none"===y(n,"display")||o&&!v(n,o));)n=n.previousElementSibling;return n}(S,P.node)?E&&this._onInsert(e,!1):this._onInsert(e,!0):E&&this._onChange(e)))},_allowPut:function(){var t,e;return N.group===this.el||!!this.options.group.put&&(t=this.options.group.name,(e=N.sortable.options.group).name)&&t&&e.name===t},_onInsert:function(t,e){var o=e?D:E,n=e?S:E.parentNode;j.sortable.animator.collect(D,null,D.parentNode,D),this.animator.collect(null,o,n,D),C&&this.multiplayer.onChange(D,this),B={sortable:this,group:n,node:o,rect:m(D),offset:a(D)},j.sortable._dispatchEvent("onRemove",c(c({},r()),{},{event:t})),e?n.appendChild(D):n.insertBefore(D,o),this._dispatchEvent("onAdd",c(c({},r()),{},{event:t})),j.sortable.animator.animate(),this.animator.animate(),j.group=n,j.sortable=this},_onChange:function(t){var e=E.parentNode,t=(this.animator.collect(D,E,e),C&&this.multiplayer.onChange(D,this),B={sortable:this,group:e,node:E,rect:m(E),offset:a(E)},this._dispatchEvent("onChange",c(c({},r()),{},{event:t})),a(D));t.top<B.offset.top||t.left<B.offset.left?e.insertBefore(D,E.nextSibling):e.insertBefore(D,E),this.animator.animate(),j.group=e,j.sortable=this},_onDrop:function(t){var e;this._unbindMoveEvents(),this._unbindDropEvents(),this._preventEvent(t),T.clear(),clearTimeout(M),D&&(g(D,this.options.chosenClass,!1),O&&(D.style["touch-action"]=""),D.style["will-change"]=""),D&&N&&x?(j.group=N.group,j.sortable=N.sortable,C?this.multiplayer.onDrop(t,D,N,r):(B.rect=m(D),B.offset=a(D),e=G(j.offset,B.offset),e=c(c({},r()),{},{changed:e,event:t}),B.sortable.el!==j.sortable.el&&j.sortable._dispatchEvent("onDrop",e),B.sortable._dispatchEvent("onDrop",e)),l&&y(document.body,"user-select","")):this.options.multiple&&this.multiplayer.select(t,D,c({},j)),this._clearState()},_preventEvent:function(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),this.options.stopPropagation&&t.stopPropagation&&t.stopPropagation()},_dispatchEvent:function(t,e){t=this.options[t];"function"==typeof t&&t(e)},_clearState:function(){D=E=N=x=O=C=M=Y.ghost=null,it=X={x:0,y:0},j=B=c({},nt),P.destroy()},_unbindMoveEvents:function(){for(var t=0;t<o.move.length;t++)n(this.ownerDocument,o.move[t],this._onMove),n(this.ownerDocument,o.move[t],et)},_unbindDropEvents:function(){for(var t=0;t<o.end.length;t++)n(this.ownerDocument,o.end[t],this._onDrop)}}).utils={getRect:m,getOffset:a},Y});
{
"name": "sortable-dnd",
"version": "0.4.6",
"version": "0.4.7",
"description": "JS library for drag-and-drop lists, supports sortable and draggable",

@@ -5,0 +5,0 @@ "main": "dist/sortable.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc