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.3.5 to 0.3.6

73

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

@@ -712,9 +712,22 @@ * https://github.com/mfuu/sortable-dnd#readme

var State = /*#__PURE__*/_createClass(function State() {
_classCallCheck(this, State);
var State = /*#__PURE__*/function () {
function State() {
_classCallCheck(this, State);
this.sortableDown = undefined;
this.sortableMove = undefined;
this.animationEnd = undefined;
});
this.sortableDown = undefined;
this.sortableMove = undefined;
this.animationEnd = undefined;
}
_createClass(State, [{
key: "destroy",
value: function destroy() {
this.sortableDown = undefined;
this.sortableMove = undefined;
this.animationEnd = undefined;
}
}]);
return State;
}();
/**

@@ -777,2 +790,3 @@ * Difference before and after dragging

fromGroup,
fromSortable,
activeGroup,

@@ -886,2 +900,9 @@ state = new State(),

};
var _emitDiffer = function _emitDiffer() {
return {
from: _objectSpread2({}, differ.from),
to: _objectSpread2({}, differ.to)
};
};
/**

@@ -1039,3 +1060,4 @@ * @class Sortable

if (touch) dragEl.style['touch-action'] = 'none';
fromGroup = this.el; // get the position of the dragged element in the list
fromGroup = this.el;
fromSortable = this; // get the position of the dragged element in the list

@@ -1167,3 +1189,3 @@ var _getElement = getElement(this.el, dragEl),

// onMove callback
this._dispatchEvent('onMove', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onMove', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
ghostEl: ghostEl,

@@ -1199,3 +1221,3 @@ event: e,

// onMove callback
this._dispatchEvent('onMove', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onMove', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
ghostEl: ghostEl,

@@ -1225,3 +1247,3 @@ event: evt,

// onDrag callback
this._dispatchEvent('onDrag', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onDrag', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
event: e,

@@ -1304,3 +1326,3 @@ originalEvent: evt

differ.from.sortable._dispatchEvent('onRemove', _objectSpread2(_objectSpread2({}, differ), {}, {
differ.from.sortable._dispatchEvent('onRemove', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
event: e,

@@ -1311,3 +1333,3 @@ originalEvent: evt

this._dispatchEvent('onAdd', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onAdd', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
event: e,

@@ -1320,5 +1342,2 @@ originalEvent: evt

differ.from.sortable._rangeAnimate();
differ.from.sortable = this;
differ.from.group = rootEl;
} else {

@@ -1353,3 +1372,3 @@ var _getElement2 = getElement(rootEl, target),

differ.from.sortable._dispatchEvent('onRemove', _objectSpread2(_objectSpread2({}, differ), {}, {
differ.from.sortable._dispatchEvent('onRemove', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
event: e,

@@ -1360,3 +1379,3 @@ originalEvent: evt

this._dispatchEvent('onAdd', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onAdd', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
event: e,

@@ -1371,3 +1390,3 @@ originalEvent: evt

// onChange callback
this._dispatchEvent('onChange', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onChange', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
event: e,

@@ -1387,8 +1406,8 @@ originalEvent: evt

differ.from.sortable = this;
differ.from.group = rootEl;
this._rangeAnimate();
}
}
differ.from.sortable = this;
differ.from.group = rootEl;
}, 3),

@@ -1421,7 +1440,9 @@ // -------------------------------- on drop ----------------------------------

// re-acquire the offset and rect values of the dragged element as the value after the drag is completed
differ.to.rect = getRect(dragEl);
differ.to.offset = getOffset(dragEl);
differ.to.rect = getRect(dragEl);
differ.from.group = fromGroup;
differ.from.sortable = fromSortable;
var changed = offsetChanged(differ.from.offset, differ.to.offset);
this._dispatchEvent('onDrop', _objectSpread2(_objectSpread2({}, differ), {}, {
this._dispatchEvent('onDrop', _objectSpread2(_objectSpread2({}, _emitDiffer()), {}, {
changed: changed,

@@ -1450,3 +1471,3 @@ event: evt,

ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
dragEl = dropEl = ghostEl = fromGroup = activeGroup = Sortable.ghostEl = null;
dragEl = dropEl = ghostEl = fromGroup = fromSortable = activeGroup = Sortable.ghostEl = null;
distance = lastPosition = {

@@ -1456,3 +1477,3 @@ x: 0,

};
state = new State();
state.destroy();
differ.destroy();

@@ -1459,0 +1480,0 @@ },

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Sortable=e()}(this,function(){"use strict";function e(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 r=null!=arguments[t]?arguments[t]:{};t%2?e(Object(r),!0).forEach(function(t){var e,o;e=n,o=r[t=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(r)):e(Object(r)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(r,t))})}return n}function s(t){return(s="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 o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function B(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(o="Object"===o&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?i(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 i(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}function t(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var a,l=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),I=t(/Edge/i),u=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i),R=t(/iP(ad|od|hone)/i),W=t(/chrome/i)&&t(/android/i),X={capture:!1,passive:!1},Y=/\s+/g,h=["-webkit-transition","-moz-transition","-ms-transition","-o-transition","transition"],H=["-webkit-transform","-moz-transform","-ms-transform","-o-transform","transform"],F=(a=!1,document.addEventListener("checkIfSupportPassive",null,{get passive(){return a=!0}}),a);function f(e,o){o?"none"===o?h.forEach(function(t){return _(e,t,"none")}):h.forEach(function(t){return _(e,t,"".concat(t.split("transition")[0],"transform ").concat(o))}):h.forEach(function(t){return _(e,t,"")})}function d(e,o){o?H.forEach(function(t){return _(e,t,"".concat(t.split("transform")[0]).concat(o))}):H.forEach(function(t){return _(e,t,"")})}function p(t){var e=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,t=e||t;return{touch:e,e:t,target:e?document.elementFromPoint(t.clientX,t.clientY):t.target}}function m(t,e,o){window.addEventListener?t.addEventListener(e,o,!(!F&&l)&&X):window.attachEvent&&t.attachEvent("on"+e,o)}function g(t,e,o){window.removeEventListener?t.removeEventListener(e,o,!(!F&&l)&&X):window.detachEvent&&t.detachEvent("on"+e,o)}function v(t){for(var e={top:0,left:0,height:0,width:0},o=(e.height=t.offsetHeight,e.width=t.offsetWidth,e.top=t.offsetTop,e.left=t.offsetLeft,t.offsetParent);null!==o;)e.top+=o.offsetTop,e.left+=o.offsetLeft,o=o.offsetParent;return e}function b(){var t=document.scrollingElement;return!t||t.contains(document.body)?document:t}function w(t,e){if(t.getBoundingClientRect||t===window){var o,n={top:0,left:0,bottom:0,right:0,height:0,width:0};if(t!==window&&t.parentNode&&t!==b()){if(o=t.getBoundingClientRect(),n.top=o.top,n.left=o.left,n.bottom=o.bottom,n.right=o.right,n.height=o.height,n.width=o.width,e&&t.parentNode!==t.ownerDocument.body)for(var r,i=t.parentNode;i&&i.getBoundingClientRect&&i!==t.ownerDocument.body;){if((r=i.getBoundingClientRect()).height<n.height)return n.top=r.top,n.left=r.left,n.bottom=r.bottom,n.right=r.right,n.height=r.height,n.width=r.width,n;i=i.parentNode}}else n.top=0,n.left=0,n.bottom=window.innerHeight,n.right=window.innerWidth,n.height=window.innerHeight,n.width=window.innerWidth;return n}}function y(t,e,o){var n=B(Array.from(t.children)),t=n.indexOf(e);if(-1<t)return o?n[t]:{index:t,el:n[t],rect:w(n[t]),offset:v(n[t])};for(var r=0;r<n.length;r++)if(function(t,e){var o;if(t&&e)for(o=t.parentNode;o;){if(e===o)return 1;o=o.parentNode}return}(e,n[r]))return o?n[r]:{index:r,el:n[r],rect:w(n[r]),offset:v(n[r])};return o?null:{index:-1,el:null,rect:{},offset:{}}}function D(t,e,o){var n;t&&e&&(t.classList?t.classList[o?"add":"remove"](e):(n=(" "+t.className+" ").replace(Y," ").replace(" "+e+" "," "),t.className=(n+(o?" "+e:"")).replace(Y," ")))}function q(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 _(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")}}function z(o,n,r){var i=null;return function(){var t=this,e=arguments;i&&clearTimeout(i),r&&!i&&o.apply(t,e),i=setTimeout(function(){o.apply(t,e)},n)}}function V(o,n){var r=null;return function(){var t=this,e=arguments;r=r||setTimeout(function(){r=null,o.apply(t,e)},n)}}var E="Sortable"+Date.now();function G(){var r=[];return{_captureAnimationState:function(t,e){var o=B(Array.from(this.el.children)),e=(t=t,e=e,t=(n=o).indexOf(t),n=n.indexOf(e),t<n?{start:t,end:n}:{start:n,end:t}),n=e.start,t=e.end;n<(r.length=0)&&(n=t,t=Math.min(o.length-1,100)),o.slice(n,t+1).forEach(function(t){r.push({target:t,rect:w(t)})})},_rangeAnimate:function(){var o=this;r.forEach(function(t){var e=t.target,t=t.rect;o._animate(e,t,o.options.animation)})},_animate:function(t,e){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:150,n=w(t),r=e.left-n.left,e=e.top-n.top;f(t,"none"),d(t,"translate3d(".concat(r,"px, ").concat(e,"px, 0)")),t.offsetWidth,f(t,"".concat(o,"ms")),d(t,"translate3d(0px, 0px, 0px)"),clearTimeout(t.animated),t.animated=setTimeout(function(){f(t,""),d(t,""),t.animated=null},o)}}}function S(t){if(x){var e=t=t.touches?t.touches[0]:t,o=e.clientX,e=e.clientY,n=U(o,e);if(n){var r,i={};for(r in t)i[r]=t[r];i.target=document.elementFromPoint(o,e),i.rootEl=n,i.preventDefault=void 0,i.stopPropagation=void 0,n[E]._triggerEvent(i)}}}function U(r,i){var a;return Q.some(function(t){var e,o,n=t[E].options.emptyInsertThreshold;if(n)return o=w(t,!0),e=r>=o.left-n&&r<=o.right+n,o=i>=o.top-n&&i<=o.bottom+n,e&&o?a=t:void 0}),a}function Z(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}var T,x,O,P,A,C,$=r(function t(){o(this,t),this.sortableDown=void 0,this.sortableMove=void 0,this.animationEnd=void 0}),J=function(){function t(){o(this,t),this.from={sortable:null,group:null,node:null,rect:{},offset:{}},this.to={sortable:null,group:null,node:null,rect:{},offset:{}}}return r(t,[{key:"destroy",value:function(){this.from={sortable:null,group:null,node:null,rect:{},offset:{}},this.to={sortable:null,group:null,node:null,rect:{},offset:{}}}}]),t}(),K="undefined"!=typeof document&&!W&&!R&&"draggable"in document.createElement("div"),Q=[],M=new $,j=new J,k={x:0,y:0},N={x:0,y:0};function L(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));(t[E]=this).el=t,this.scrollEl=function(t,e){if(!t||!t.getBoundingClientRect)return b();var o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var r=_(o);if(o.clientWidth<o.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!o.getBoundingClientRect||o===document.body)return b();if(n||e)return o;n=!0}}}while(o=o.parentNode);return b()}(t,!0),this.options=e=Object.assign({},e),this.ownerDocument=t.ownerDocument;var o,n,r={group:"",animation:150,draggable:void 0,onDrag:void 0,onMove:void 0,onDrop:void 0,onChange:void 0,autoScroll:!0,scrollStep:5,scrollThreshold:15,delay:0,delayOnTouchOnly:!1,disabled:!1,ghostClass:"",ghostStyle:{},chosenClass:"",fallbackOnBody:!1,forceFallback:!1,stopPropagation:!1,supportPointer:"PointerEvent"in window&&!u,supportTouch:"ontouchstart"in window,emptyInsertThreshold:5};for(o in r)o in this.options||(this.options[o]=r[o]);for(n in this.nativeDraggable=!this.options.forceFallback&&K,this.dragStartTimer=null,this.autoScrollTimer=null,a={},(i=(e=e).group)&&"object"==s(i)||(i={name:i,pull:!0,put:!0}),a.name=i.name,a.pull=i.pull,a.put=i.put,e.group=a,this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));var i=this.options,e=i.supportPointer,a=i.supportTouch;m(t,e?"pointerdown":a?"touchstart":"mousedown",this._onDrag),Q.push(t),Object.assign(this,G(),(window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),{_autoScroll:V(function(t,e){var o,n,r,i,a,s,l,c,u,h,f,d,p,m,g;t.scrollEl&&e.sortableDown&&e.sortableMove&&(o=(n=e.sortableMove).clientX,n=n.clientY,void 0!==o&&void 0!==n&&t.scrollEl!==t.ownerDocument&&(r=(m=t.scrollEl).scrollTop,i=m.scrollLeft,a=m.scrollHeight,m=m.scrollWidth,s=(p=w(t.scrollEl)).top,f=p.right,l=p.bottom,d=p.left,c=p.height,p=p.width,u=(h=t.options).scrollStep,h=h.scrollThreshold,d=0<i&&d<=o&&o<=d+h,p=i+p<m&&o<=f&&f-h<=o,m=r+c<a&&n<=l&&l-h<=n,g={x:i,y:r},(f=0<r&&s<=n&&n<=s+h)?(g.x=d?i-u:p?i+u:i,g.y=r-u):m?(g.x=d?i-u:p?i+u:i,g.y=r+u):d?(g.x=i-u,g.y=r):p&&(g.x=i+u,g.y=r),(f||d||p||m)&&requestAnimationFrame(function(){t.scrollEl.scrollTo(g.x,g.y),t._autoScroll(t,e)})))},10)}))}return(L.prototype={constructor:L,destroy:function(){this.el[E]=null,g(this.el,"pointerdown",this._onDrag),g(this.el,"touchstart",this._onDrag),g(this.el,"mousedown",this._onDrag),this._clearState(),Array.prototype.forEach.call(this.el.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")})},_onDrag:function(t){var e=this;if(!x&&!this.options.disabled&&!1!==this.options.group.pull){if(/mousedown|pointerdown/.test(t.type)&&0!==t.button)return!0;var t=p(t),o=t.touch,n=t.e,t=t.target;if(!this.nativeDraggable&&u&&t&&"SELECT"===t.tagName.toUpperCase())return!0;if(t===this.el)return!0;var r=this.options.draggable;if("function"==typeof r){var i=r(n);if(!i)return!0;!function(e){var t=document.createElement("div");try{return t.appendChild(e.cloneNode(!0)),1==e.nodeType}catch(t){return e==window||e==document}}(i)||(x=i)}else if("string"==typeof r){if(!q(t,r))return!0}else if(r)throw new Error('draggable expected "function" or "string" but received "'.concat(s(r),'"'));if(!(x=x||y(this.el,t,!0))||x.animated)return!0;o&&(x.style["touch-action"]="none"),A=this.el;i=y(this.el,x),r=i.rect,t=i.offset,i=(j.from={sortable:this,group:this.el,node:x,rect:r,offset:t},k={x:n.clientX-r.left,y:n.clientY-r.top},M.sortableDown=n,m(this.ownerDocument,"dragover",S),this.options.supportPointer?m(this.ownerDocument,"pointermove",S):m(this.ownerDocument,o?"touchmove":"mousemove",S),m(this.ownerDocument,"pointerup",this._onDrop),m(this.ownerDocument,"touchend",this._onDrop),m(this.ownerDocument,"mouseup",this._onDrop),this.options),t=i.delay,r=i.delayOnTouchOnly;!t||r&&!o||this.nativeDraggable&&(I||l)?this._onStart(n,o):(clearTimeout(this.dragStartTimer),this.dragStartTimer=setTimeout(function(){return e._onStart(n,o)},t))}},_onStart:function(t,e){T=this.el,C=this.options.group,!this.nativeDraggable||e?(this.options.supportPointer?m(this.ownerDocument,"pointermove",this._onMove):m(this.ownerDocument,e?"touchmove":"mousemove",this._onMove),m(this.ownerDocument,"pointercancel",this._onDrop),m(this.ownerDocument,"touchcancel",this._onDrop)):(x.draggable=!0,m(this.el,"dragstart",this._onDragStart));try{document.selection?setTimeout(function(){document.selection.empty()},0):window.getSelection().removeAllRanges()}catch(t){}},_onDragStart:function(t){t=t.dataTransfer;t&&(t.setData("text",""),t.setDragImage(P,k.x,k.y),t.effectAllowed="move")},_triggerEvent:function(t){T=t.rootEl,this.nativeDraggable?(m(this.el,"dragover",Z),m(this.el,"dragend",this._onDrop),this._onDragOver(t)):this._onMove(t)},_onMove:function(t){var e,o,n=this;M.sortableDown&&x&&(this._preventEvent(t),e=(o=p(t)).e,o=o.target,this._onStarted(e,t),t.rootEl&&(this._dispatchEvent("onMove",c(c({},j),{},{ghostEl:P,event:e,originalEvent:t})),this._allowPut()&&this._onChange(o,e,t),clearTimeout(this.autoScrollTimer),this.options.autoScroll&&(this.autoScrollTimer=setTimeout(function(){return n._autoScroll(n,M)},0))))},_onDragOver:function(t){var e,o,n,r,i;M.sortableDown&&x&&(this._preventEvent(t),e=this._allowPut(),t.dataTransfer&&(t.dataTransfer.dropEffect=e?"move":"none"),this._onStarted(t,t),!t.rootEl||(n=(o=t).clientX,o=o.clientY,r=n-N.x,i=o-N.y,N.x=n,N.y=o,void 0!==n&&Math.abs(r)<=0&&void 0!==o&&Math.abs(i)<=0)||(this._dispatchEvent("onMove",c(c({},j),{},{ghostEl:P,event:t,originalEvent:t})),e&&this._onChange(t.target,t,t)))},_allowPut:function(){var t;return A===this.el||!!this.options.group.put&&(t=this.options.group.name,C.name&&t&&C.name===t)},_onStarted:function(t,e){var o;M.sortableMove||(this._dispatchEvent("onDrag",c(c({},j),{},{event:t,originalEvent:e})),this._appendGhost(),D(x,this.options.chosenClass,!0),x.style["will-change"]="transform",this.nativeDraggable&&this._unbindDropEvents(),u&&_(document.body,"user-select","none")),M.sortableMove=t,this.nativeDraggable||(o=(e=M.sortableDown).clientX,e=e.clientY,f(P,"none"),d(P,"translate3d(".concat(t.clientX-o,"px, ").concat(t.clientY-e,"px, 0)")))},_appendGhost:function(){if(!P){var t,e=this.options,o=e.fallbackOnBody,n=e.ghostClass,e=e.ghostStyle,r=void 0===e?{}:e,e=o?document.body:this.el,o=j.from.rect;for(t in D(P=x.cloneNode(!0),n,!0),_(P,"box-sizing","border-box"),_(P,"margin",0),_(P,"top",o.top),_(P,"left",o.left),_(P,"width",o.width),_(P,"height",o.height),_(P,"opacity","0.8"),_(P,"position","fixed"),_(P,"zIndex","100000"),_(P,"pointerEvents","none"),r)_(P,t,r[t]);this.nativeDraggable&&_(P,"top","-999px"),f(P,"none"),d(P,"translate3d(0px, 0px, 0px)"),e.appendChild(P);n=k.x/parseInt(P.style.width)*100,o=k.y/parseInt(P.style.height)*100;_(P,"transform-origin","".concat(n,"% ").concat(o,"%")),_(P,"transform","translateZ(0)"),L.ghost=P}},_onChange:z(function(t,e,o){var n,r,i,a,s,l;x&&(!function(t,e){for(var o=t.lastElementChild;o&&(o===L.ghost||"none"===_(o,"display")||e&&!q(o,e));)o=o.previousElementSibling;return o}(T)||t===T&&j.from.group!==T?(j.from.sortable._captureAnimationState(x,x),j.to={sortable:this,group:T,node:x,rect:w(x),offset:v(x)},j.from.sortable._dispatchEvent("onRemove",c(c({},j),{},{event:e,originalEvent:o})),this._dispatchEvent("onAdd",c(c({},j),{},{event:e,originalEvent:o})),T.appendChild(x),j.from.sortable._rangeAnimate(),j.from.sortable=this,j.from.group=T):(n=(t=y(T,t)).el,s=t.rect,t=t.offset,n&&!n.animated&&n!==x&&(O=n,j.to={sortable:this,group:T,node:O,rect:s,offset:t},n=e.clientX,r=e.clientY,l=s.left,i=s.right,a=s.top,s=s.bottom,l<n&&n<i&&a<r&&r<s&&(this._captureAnimationState(x,O),j.from.group!==j.to.group?(j.from.sortable._captureAnimationState(x,O),j.from.sortable._dispatchEvent("onRemove",c(c({},j),{},{event:e,originalEvent:o})),this._dispatchEvent("onAdd",c(c({},j),{},{event:e,originalEvent:o})),T.insertBefore(x,O),j.from.sortable._rangeAnimate()):(this._dispatchEvent("onChange",c(c({},j),{},{event:e,originalEvent:o})),(l=v(x)).top<t.top||l.left<t.left?T.insertBefore(x,O.nextSibling):T.insertBefore(x,O)),j.from.sortable=this,j.from.group=T,this._rangeAnimate()))))},3),_onDrop:function(t){var e,o;this._unbindDragEvents(),this._unbindMoveEvents(),this._unbindDropEvents(),this._preventEvent(t),this.dragStartTimer&&clearTimeout(this.dragStartTimer),x&&(e=p(t).touch,D(x,this.options.chosenClass,!1),this.nativeDraggable&&(x.draggable=!1),e&&(x.style["touch-action"]=""),x.style["will-change"]="",M.sortableDown&&M.sortableMove&&(j.to.offset=v(x),j.to.rect=w(x),e=j.from.offset,o=j.to.offset,e=e.top!==o.top||e.left!==o.left,this._dispatchEvent("onDrop",c(c({},j),{},{changed:e,event:t,originalEvent:t})))),u&&_(document.body,"user-select",""),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(){P&&P.parentNode&&P.parentNode.removeChild(P),x=O=P=A=C=L.ghostEl=null,k=N={x:0,y:0},M=new $,j.destroy()},_unbindDragEvents:function(){this.nativeDraggable&&(g(this.el,"dragstart",this._onDragStart),g(this.el,"dragover",Z),g(this.el,"dragend",this._onDrop))},_unbindMoveEvents:function(){g(this.ownerDocument,"pointermove",this._onMove),g(this.ownerDocument,"touchmove",this._onMove),g(this.ownerDocument,"mousemove",this._onMove),g(this.ownerDocument,"pointermove",S),g(this.ownerDocument,"touchmove",S),g(this.ownerDocument,"mousemove",S),g(this.ownerDocument,"dragover",S)},_unbindDropEvents:function(){g(this.ownerDocument,"pointerup",this._onDrop),g(this.ownerDocument,"pointercancel",this._onDrop),g(this.ownerDocument,"touchend",this._onDrop),g(this.ownerDocument,"touchcancel",this._onDrop),g(this.ownerDocument,"mouseup",this._onDrop)}}).utils={getRect:w,getOffset:v,debounce:z,throttle:V},L});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Sortable=e()}(this,function(){"use strict";function e(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 r=null!=arguments[t]?arguments[t]:{};t%2?e(Object(r),!0).forEach(function(t){var e,o;e=n,o=r[t=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(r)):e(Object(r)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(r,t))})}return n}function s(t){return(s="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 o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function I(t,e,o){e&&B(t.prototype,e),o&&B(t,o),Object.defineProperty(t,"prototype",{writable:!1})}function R(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(o="Object"===o&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(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 n(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}function t(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r,a=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),W=t(/Edge/i),l=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i),X=t(/iP(ad|od|hone)/i),Y=t(/chrome/i)&&t(/android/i),H={capture:!1,passive:!1},F=/\s+/g,i=["-webkit-transition","-moz-transition","-ms-transition","-o-transition","transition"],q=["-webkit-transform","-moz-transform","-ms-transform","-o-transform","transform"],z=(r=!1,document.addEventListener("checkIfSupportPassive",null,{get passive(){return r=!0}}),r);function u(e,o){o?"none"===o?i.forEach(function(t){return y(e,t,"none")}):i.forEach(function(t){return y(e,t,"".concat(t.split("transition")[0],"transform ").concat(o))}):i.forEach(function(t){return y(e,t,"")})}function h(e,o){o?q.forEach(function(t){return y(e,t,"".concat(t.split("transform")[0]).concat(o))}):q.forEach(function(t){return y(e,t,"")})}function f(t){var e=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,t=e||t;return{touch:e,e:t,target:e?document.elementFromPoint(t.clientX,t.clientY):t.target}}function d(t,e,o){window.addEventListener?t.addEventListener(e,o,!(!z&&a)&&H):window.attachEvent&&t.attachEvent("on"+e,o)}function p(t,e,o){window.removeEventListener?t.removeEventListener(e,o,!(!z&&a)&&H):window.detachEvent&&t.detachEvent("on"+e,o)}function m(t){for(var e={top:0,left:0,height:0,width:0},o=(e.height=t.offsetHeight,e.width=t.offsetWidth,e.top=t.offsetTop,e.left=t.offsetLeft,t.offsetParent);null!==o;)e.top+=o.offsetTop,e.left+=o.offsetLeft,o=o.offsetParent;return e}function g(){var t=document.scrollingElement;return!t||t.contains(document.body)?document:t}function v(t,e){if(t.getBoundingClientRect||t===window){var o,n={top:0,left:0,bottom:0,right:0,height:0,width:0};if(t!==window&&t.parentNode&&t!==g()){if(o=t.getBoundingClientRect(),n.top=o.top,n.left=o.left,n.bottom=o.bottom,n.right=o.right,n.height=o.height,n.width=o.width,e&&t.parentNode!==t.ownerDocument.body)for(var r,i=t.parentNode;i&&i.getBoundingClientRect&&i!==t.ownerDocument.body;){if((r=i.getBoundingClientRect()).height<n.height)return n.top=r.top,n.left=r.left,n.bottom=r.bottom,n.right=r.right,n.height=r.height,n.width=r.width,n;i=i.parentNode}}else n.top=0,n.left=0,n.bottom=window.innerHeight,n.right=window.innerWidth,n.height=window.innerHeight,n.width=window.innerWidth;return n}}function b(t,e,o){var n=R(Array.from(t.children)),t=n.indexOf(e);if(-1<t)return o?n[t]:{index:t,el:n[t],rect:v(n[t]),offset:m(n[t])};for(var r=0;r<n.length;r++)if(function(t,e){var o;if(t&&e)for(o=t.parentNode;o;){if(e===o)return 1;o=o.parentNode}return}(e,n[r]))return o?n[r]:{index:r,el:n[r],rect:v(n[r]),offset:m(n[r])};return o?null:{index:-1,el:null,rect:{},offset:{}}}function w(t,e,o){var n;t&&e&&(t.classList?t.classList[o?"add":"remove"](e):(n=(" "+t.className+" ").replace(F," ").replace(" "+e+" "," "),t.className=(n+(o?" "+e:"")).replace(F," ")))}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 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")}}function G(o,n,r){var i=null;return function(){var t=this,e=arguments;i&&clearTimeout(i),r&&!i&&o.apply(t,e),i=setTimeout(function(){o.apply(t,e)},n)}}function U(o,n){var r=null;return function(){var t=this,e=arguments;r=r||setTimeout(function(){r=null,o.apply(t,e)},n)}}var D="Sortable"+Date.now();function Z(){var r=[];return{_captureAnimationState:function(t,e){var o=R(Array.from(this.el.children)),e=(t=t,e=e,t=(n=o).indexOf(t),n=n.indexOf(e),t<n?{start:t,end:n}:{start:n,end:t}),n=e.start,t=e.end;n<(r.length=0)&&(n=t,t=Math.min(o.length-1,100)),o.slice(n,t+1).forEach(function(t){r.push({target:t,rect:v(t)})})},_rangeAnimate:function(){var o=this;r.forEach(function(t){var e=t.target,t=t.rect;o._animate(e,t,o.options.animation)})},_animate:function(t,e){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:150,n=v(t),r=e.left-n.left,e=e.top-n.top;u(t,"none"),h(t,"translate3d(".concat(r,"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)}}}function _(t){if(T){var e=t=t.touches?t.touches[0]:t,o=e.clientX,e=e.clientY,n=$(o,e);if(n){var r,i={};for(r in t)i[r]=t[r];i.target=document.elementFromPoint(o,e),i.rootEl=n,i.preventDefault=void 0,i.stopPropagation=void 0,n[D]._triggerEvent(i)}}}function $(r,i){var a;return et.some(function(t){var e,o,n=t[D].options.emptyInsertThreshold;if(n)return o=v(t,!0),e=r>=o.left-n&&r<=o.right+n,o=i>=o.top-n&&i<=o.bottom+n,e&&o?a=t:void 0}),a}function J(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function E(){return{from:c({},j.from),to:c({},j.to)}}var S,T,x,O,P,A,M,K=function(){function t(){o(this,t),this.sortableDown=void 0,this.sortableMove=void 0,this.animationEnd=void 0}return I(t,[{key:"destroy",value:function(){this.sortableDown=void 0,this.sortableMove=void 0,this.animationEnd=void 0}}]),t}(),Q=function(){function t(){o(this,t),this.from={sortable:null,group:null,node:null,rect:{},offset:{}},this.to={sortable:null,group:null,node:null,rect:{},offset:{}}}return I(t,[{key:"destroy",value:function(){this.from={sortable:null,group:null,node:null,rect:{},offset:{}},this.to={sortable:null,group:null,node:null,rect:{},offset:{}}}}]),t}(),tt="undefined"!=typeof document&&!Y&&!X&&"draggable"in document.createElement("div"),et=[],C=new K,j=new Q,k={x:0,y:0},N={x:0,y:0};function L(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));(t[D]=this).el=t,this.scrollEl=function(t,e){if(!t||!t.getBoundingClientRect)return g();var o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var r=y(o);if(o.clientWidth<o.scrollWidth&&("auto"==r.overflowX||"scroll"==r.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==r.overflowY||"scroll"==r.overflowY)){if(!o.getBoundingClientRect||o===document.body)return g();if(n||e)return o;n=!0}}}while(o=o.parentNode);return g()}(t,!0),this.options=e=Object.assign({},e),this.ownerDocument=t.ownerDocument;var o,n,r={group:"",animation:150,draggable:void 0,onDrag:void 0,onMove:void 0,onDrop:void 0,onChange:void 0,autoScroll:!0,scrollStep:5,scrollThreshold:15,delay:0,delayOnTouchOnly:!1,disabled:!1,ghostClass:"",ghostStyle:{},chosenClass:"",fallbackOnBody:!1,forceFallback:!1,stopPropagation:!1,supportPointer:"PointerEvent"in window&&!l,supportTouch:"ontouchstart"in window,emptyInsertThreshold:5};for(o in r)o in this.options||(this.options[o]=r[o]);for(n in this.nativeDraggable=!this.options.forceFallback&&tt,this.dragStartTimer=null,this.autoScrollTimer=null,a={},(i=(e=e).group)&&"object"==s(i)||(i={name:i,pull:!0,put:!0}),a.name=i.name,a.pull=i.pull,a.put=i.put,e.group=a,this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));var i=this.options,e=i.supportPointer,a=i.supportTouch;d(t,e?"pointerdown":a?"touchstart":"mousedown",this._onDrag),et.push(t),Object.assign(this,Z(),(window.requestAnimationFrame||(window.requestAnimationFrame=function(t){return setTimeout(t,17)}),{_autoScroll:U(function(t,e){var o,n,r,i,a,s,l,c,u,h,f,d,p,m,g;t.scrollEl&&e.sortableDown&&e.sortableMove&&(o=(n=e.sortableMove).clientX,n=n.clientY,void 0!==o&&void 0!==n&&t.scrollEl!==t.ownerDocument&&(r=(m=t.scrollEl).scrollTop,i=m.scrollLeft,a=m.scrollHeight,m=m.scrollWidth,s=(p=v(t.scrollEl)).top,f=p.right,l=p.bottom,d=p.left,c=p.height,p=p.width,u=(h=t.options).scrollStep,h=h.scrollThreshold,d=0<i&&d<=o&&o<=d+h,p=i+p<m&&o<=f&&f-h<=o,m=r+c<a&&n<=l&&l-h<=n,g={x:i,y:r},(f=0<r&&s<=n&&n<=s+h)?(g.x=d?i-u:p?i+u:i,g.y=r-u):m?(g.x=d?i-u:p?i+u:i,g.y=r+u):d?(g.x=i-u,g.y=r):p&&(g.x=i+u,g.y=r),(f||d||p||m)&&requestAnimationFrame(function(){t.scrollEl.scrollTo(g.x,g.y),t._autoScroll(t,e)})))},10)}))}return(L.prototype={constructor:L,destroy:function(){this.el[D]=null,p(this.el,"pointerdown",this._onDrag),p(this.el,"touchstart",this._onDrag),p(this.el,"mousedown",this._onDrag),this._clearState(),Array.prototype.forEach.call(this.el.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")})},_onDrag:function(t){var e=this;if(!T&&!this.options.disabled&&!1!==this.options.group.pull){if(/mousedown|pointerdown/.test(t.type)&&0!==t.button)return!0;var t=f(t),o=t.touch,n=t.e,t=t.target;if(!this.nativeDraggable&&l&&t&&"SELECT"===t.tagName.toUpperCase())return!0;if(t===this.el)return!0;var r=this.options.draggable;if("function"==typeof r){var i=r(n);if(!i)return!0;!function(e){var t=document.createElement("div");try{return t.appendChild(e.cloneNode(!0)),1==e.nodeType}catch(t){return e==window||e==document}}(i)||(T=i)}else if("string"==typeof r){if(!V(t,r))return!0}else if(r)throw new Error('draggable expected "function" or "string" but received "'.concat(s(r),'"'));if(!(T=T||b(this.el,t,!0))||T.animated)return!0;o&&(T.style["touch-action"]="none"),P=this.el;i=b((A=this).el,T),r=i.rect,t=i.offset,i=(j.from={sortable:this,group:this.el,node:T,rect:r,offset:t},k={x:n.clientX-r.left,y:n.clientY-r.top},C.sortableDown=n,d(this.ownerDocument,"dragover",_),this.options.supportPointer?d(this.ownerDocument,"pointermove",_):d(this.ownerDocument,o?"touchmove":"mousemove",_),d(this.ownerDocument,"pointerup",this._onDrop),d(this.ownerDocument,"touchend",this._onDrop),d(this.ownerDocument,"mouseup",this._onDrop),this.options),t=i.delay,r=i.delayOnTouchOnly;!t||r&&!o||this.nativeDraggable&&(W||a)?this._onStart(n,o):(clearTimeout(this.dragStartTimer),this.dragStartTimer=setTimeout(function(){return e._onStart(n,o)},t))}},_onStart:function(t,e){S=this.el,M=this.options.group,!this.nativeDraggable||e?(this.options.supportPointer?d(this.ownerDocument,"pointermove",this._onMove):d(this.ownerDocument,e?"touchmove":"mousemove",this._onMove),d(this.ownerDocument,"pointercancel",this._onDrop),d(this.ownerDocument,"touchcancel",this._onDrop)):(T.draggable=!0,d(this.el,"dragstart",this._onDragStart));try{document.selection?setTimeout(function(){document.selection.empty()},0):window.getSelection().removeAllRanges()}catch(t){}},_onDragStart:function(t){t=t.dataTransfer;t&&(t.setData("text",""),t.setDragImage(O,k.x,k.y),t.effectAllowed="move")},_triggerEvent:function(t){S=t.rootEl,this.nativeDraggable?(d(this.el,"dragover",J),d(this.el,"dragend",this._onDrop),this._onDragOver(t)):this._onMove(t)},_onMove:function(t){var e,o,n=this;C.sortableDown&&T&&(this._preventEvent(t),e=(o=f(t)).e,o=o.target,this._onStarted(e,t),t.rootEl&&(this._dispatchEvent("onMove",c(c({},E()),{},{ghostEl:O,event:e,originalEvent:t})),this._allowPut()&&this._onChange(o,e,t),clearTimeout(this.autoScrollTimer),this.options.autoScroll&&(this.autoScrollTimer=setTimeout(function(){return n._autoScroll(n,C)},0))))},_onDragOver:function(t){var e,o,n,r,i;C.sortableDown&&T&&(this._preventEvent(t),e=this._allowPut(),t.dataTransfer&&(t.dataTransfer.dropEffect=e?"move":"none"),this._onStarted(t,t),!t.rootEl||(n=(o=t).clientX,o=o.clientY,r=n-N.x,i=o-N.y,N.x=n,N.y=o,void 0!==n&&Math.abs(r)<=0&&void 0!==o&&Math.abs(i)<=0)||(this._dispatchEvent("onMove",c(c({},E()),{},{ghostEl:O,event:t,originalEvent:t})),e&&this._onChange(t.target,t,t)))},_allowPut:function(){var t;return P===this.el||!!this.options.group.put&&(t=this.options.group.name,M.name&&t&&M.name===t)},_onStarted:function(t,e){var o;C.sortableMove||(this._dispatchEvent("onDrag",c(c({},E()),{},{event:t,originalEvent:e})),this._appendGhost(),w(T,this.options.chosenClass,!0),T.style["will-change"]="transform",this.nativeDraggable&&this._unbindDropEvents(),l&&y(document.body,"user-select","none")),C.sortableMove=t,this.nativeDraggable||(o=(e=C.sortableDown).clientX,e=e.clientY,u(O,"none"),h(O,"translate3d(".concat(t.clientX-o,"px, ").concat(t.clientY-e,"px, 0)")))},_appendGhost:function(){if(!O){var t,e=this.options,o=e.fallbackOnBody,n=e.ghostClass,e=e.ghostStyle,r=void 0===e?{}:e,e=o?document.body:this.el,o=j.from.rect;for(t in w(O=T.cloneNode(!0),n,!0),y(O,"box-sizing","border-box"),y(O,"margin",0),y(O,"top",o.top),y(O,"left",o.left),y(O,"width",o.width),y(O,"height",o.height),y(O,"opacity","0.8"),y(O,"position","fixed"),y(O,"zIndex","100000"),y(O,"pointerEvents","none"),r)y(O,t,r[t]);this.nativeDraggable&&y(O,"top","-999px"),u(O,"none"),h(O,"translate3d(0px, 0px, 0px)"),e.appendChild(O);n=k.x/parseInt(O.style.width)*100,o=k.y/parseInt(O.style.height)*100;y(O,"transform-origin","".concat(n,"% ").concat(o,"%")),y(O,"transform","translateZ(0)"),L.ghost=O}},_onChange:G(function(t,e,o){if(T){if(!function(t,e){for(var o=t.lastElementChild;o&&(o===L.ghost||"none"===y(o,"display")||e&&!V(o,e));)o=o.previousElementSibling;return o}(S)||t===S&&j.from.group!==S)j.from.sortable._captureAnimationState(T,T),j.to={sortable:this,group:S,node:T,rect:v(T),offset:m(T)},j.from.sortable._dispatchEvent("onRemove",c(c({},E()),{},{event:e,originalEvent:o})),this._dispatchEvent("onAdd",c(c({},E()),{},{event:e,originalEvent:o})),S.appendChild(T),j.from.sortable._rangeAnimate();else{var t=b(S,t),n=t.el,r=t.rect,t=t.offset;if(!n||n.animated||n===T)return;x=n,j.to={sortable:this,group:S,node:x,rect:r,offset:t};var n=e.clientX,i=e.clientY,a=r.left,s=r.right,l=r.top,r=r.bottom;a<n&&n<s&&l<i&&i<r&&(this._captureAnimationState(T,x),j.from.group!==j.to.group?(j.from.sortable._captureAnimationState(T,x),j.from.sortable._dispatchEvent("onRemove",c(c({},E()),{},{event:e,originalEvent:o})),this._dispatchEvent("onAdd",c(c({},E()),{},{event:e,originalEvent:o})),S.insertBefore(T,x),j.from.sortable._rangeAnimate()):(this._dispatchEvent("onChange",c(c({},E()),{},{event:e,originalEvent:o})),(a=m(T)).top<t.top||a.left<t.left?S.insertBefore(T,x.nextSibling):S.insertBefore(T,x)),this._rangeAnimate())}j.from.sortable=this,j.from.group=S}},3),_onDrop:function(t){var e,o;this._unbindDragEvents(),this._unbindMoveEvents(),this._unbindDropEvents(),this._preventEvent(t),this.dragStartTimer&&clearTimeout(this.dragStartTimer),T&&(e=f(t).touch,w(T,this.options.chosenClass,!1),this.nativeDraggable&&(T.draggable=!1),e&&(T.style["touch-action"]=""),T.style["will-change"]="",C.sortableDown&&C.sortableMove&&(j.to.rect=v(T),j.to.offset=m(T),j.from.group=P,j.from.sortable=A,e=j.from.offset,o=j.to.offset,e=e.top!==o.top||e.left!==o.left,this._dispatchEvent("onDrop",c(c({},E()),{},{changed:e,event:t,originalEvent:t})))),l&&y(document.body,"user-select",""),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(){O&&O.parentNode&&O.parentNode.removeChild(O),T=x=O=P=A=M=L.ghostEl=null,k=N={x:0,y:0},C.destroy(),j.destroy()},_unbindDragEvents:function(){this.nativeDraggable&&(p(this.el,"dragstart",this._onDragStart),p(this.el,"dragover",J),p(this.el,"dragend",this._onDrop))},_unbindMoveEvents:function(){p(this.ownerDocument,"pointermove",this._onMove),p(this.ownerDocument,"touchmove",this._onMove),p(this.ownerDocument,"mousemove",this._onMove),p(this.ownerDocument,"pointermove",_),p(this.ownerDocument,"touchmove",_),p(this.ownerDocument,"mousemove",_),p(this.ownerDocument,"dragover",_)},_unbindDropEvents:function(){p(this.ownerDocument,"pointerup",this._onDrop),p(this.ownerDocument,"pointercancel",this._onDrop),p(this.ownerDocument,"touchend",this._onDrop),p(this.ownerDocument,"touchcancel",this._onDrop),p(this.ownerDocument,"mouseup",this._onDrop)}}).utils={getRect:v,getOffset:m,debounce:G,throttle:U},L});
{
"name": "sortable-dnd",
"version": "0.3.5",
"version": "0.3.6",
"description": "JS library for drag-and-drop lists, supports sortable and draggable",
"main": "dist/sortable.js",
"files": [
"src",
"dist"

@@ -9,0 +8,0 @@ ],

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