From ba1aea6830a7507dda326c1b96a4dbe32e586de3 Mon Sep 17 00:00:00 2001 From: Lukas Oppermann Date: Sat, 26 May 2018 15:12:10 +0200 Subject: [PATCH] 0.9.3 --- dist/html5sortable.amd.js | 5 +++-- dist/html5sortable.cjs.js | 5 +++-- dist/html5sortable.es.js | 5 +++-- dist/html5sortable.js | 5 +++-- dist/html5sortable.min.js | 2 +- dist/html5sortable.min.js.map | 2 +- docs/html5sortable.js | 5 +++-- package-lock.json | 2 +- package.json | 2 +- 9 files changed, 19 insertions(+), 14 deletions(-) diff --git a/dist/html5sortable.amd.js b/dist/html5sortable.amd.js index 0cda31d2..63fd1692 100644 --- a/dist/html5sortable.amd.js +++ b/dist/html5sortable.amd.js @@ -1019,12 +1019,13 @@ define(function () { 'use strict'; // To avoid flicker, determine where to position the placeholder // based on where the mouse pointer is relative to the elements // vertical center. + var placeAfter = false; try { var elementMiddle = offset(element).top + element.offsetHeight / 2; - var placeAfter = pageY >= elementMiddle; + placeAfter = pageY >= elementMiddle; } catch (e) { - var placeAfter = placeholderIndex < thisIndex; + placeAfter = placeholderIndex < thisIndex; } if (placeAfter) { insertAfter(element, store(sortableElement).placeholder); diff --git a/dist/html5sortable.cjs.js b/dist/html5sortable.cjs.js index a6a8d41b..143ea4a1 100644 --- a/dist/html5sortable.cjs.js +++ b/dist/html5sortable.cjs.js @@ -1019,12 +1019,13 @@ function sortable(sortableElements, options) { // To avoid flicker, determine where to position the placeholder // based on where the mouse pointer is relative to the elements // vertical center. + var placeAfter = false; try { var elementMiddle = offset(element).top + element.offsetHeight / 2; - var placeAfter = pageY >= elementMiddle; + placeAfter = pageY >= elementMiddle; } catch (e) { - var placeAfter = placeholderIndex < thisIndex; + placeAfter = placeholderIndex < thisIndex; } if (placeAfter) { insertAfter(element, store(sortableElement).placeholder); diff --git a/dist/html5sortable.es.js b/dist/html5sortable.es.js index 301491ba..2904bee8 100644 --- a/dist/html5sortable.es.js +++ b/dist/html5sortable.es.js @@ -1017,12 +1017,13 @@ function sortable(sortableElements, options) { // To avoid flicker, determine where to position the placeholder // based on where the mouse pointer is relative to the elements // vertical center. + var placeAfter = false; try { var elementMiddle = offset(element).top + element.offsetHeight / 2; - var placeAfter = pageY >= elementMiddle; + placeAfter = pageY >= elementMiddle; } catch (e) { - var placeAfter = placeholderIndex < thisIndex; + placeAfter = placeholderIndex < thisIndex; } if (placeAfter) { insertAfter(element, store(sortableElement).placeholder); diff --git a/dist/html5sortable.js b/dist/html5sortable.js index d60878c1..0a165f09 100644 --- a/dist/html5sortable.js +++ b/dist/html5sortable.js @@ -1020,12 +1020,13 @@ var sortable = (function () { // To avoid flicker, determine where to position the placeholder // based on where the mouse pointer is relative to the elements // vertical center. + var placeAfter = false; try { var elementMiddle = offset(element).top + element.offsetHeight / 2; - var placeAfter = pageY >= elementMiddle; + placeAfter = pageY >= elementMiddle; } catch (e) { - var placeAfter = placeholderIndex < thisIndex; + placeAfter = placeholderIndex < thisIndex; } if (placeAfter) { insertAfter(element, store(sortableElement).placeholder); diff --git a/dist/html5sortable.min.js b/dist/html5sortable.min.js index ec9aa1a2..4fe1e20c 100644 --- a/dist/html5sortable.min.js +++ b/dist/html5sortable.min.js @@ -1,2 +1,2 @@ -var sortable=function(){"use strict";function e(e,t,n){if(void 0===n)return e&&e.h5s&&e.h5s.data&&e.h5s.data[t];e.h5s=e.h5s||{},e.h5s.data=e.h5s.data||{},e.h5s.data[t]=n}function t(e,t){if(!(e instanceof NodeList||e instanceof HTMLCollection||e instanceof Array))throw new Error("You must provide a nodeList/HTMLCollection/Array of elements to be filtered.");return"string"!=typeof t?Array.from(e):Array.from(e).filter(function(e){return 1===e.nodeType&&e.matches(t)})}var n=new Map,r=function(){function e(){this._config=new Map,this._placeholder=void 0,this._data=new Map}return Object.defineProperty(e.prototype,"config",{get:function(){var e={};return this._config.forEach(function(t,n){e[n]=t}),e},set:function(e){if("object"!=typeof e)throw new Error("You must provide a valid configuration object to the config setter.");var t=Object.assign({},e);this._config=new Map(Object.entries(t))},enumerable:!0,configurable:!0}),e.prototype.setConfig=function(e,t){if(!this._config.has(e))throw new Error("Trying to set invalid configuration item: "+e);this._config.set(e,t)},e.prototype.getConfig=function(e){if(!this._config.has(e))throw new Error("Invalid configuration item requested: "+e);return this._config.get(e)},Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(!(e instanceof HTMLElement)&&null!==e)throw new Error("A placeholder must be an html element or null.");this._placeholder=e},enumerable:!0,configurable:!0}),e.prototype.setData=function(e,t){if("string"!=typeof e)throw new Error("The key must be a string.");this._data.set(e,t)},e.prototype.getData=function(e){if("string"!=typeof e)throw new Error("The key must be a string.");return this._data.get(e)},e.prototype.deleteData=function(e){if("string"!=typeof e)throw new Error("The key must be a string.");return this._data.delete(e)},e}();function o(e){if(!(e instanceof HTMLElement))throw new Error("Please provide a sortable to the store function.");return n.has(e)||n.set(e,new r),n.get(e)}function i(e,t,n){if(e instanceof Array)for(var r=0;r0&&t.matches(e)}).length>0;if(e===t)return!0;if(void 0!==o(e).getConfig("connectWith")&&null!==o(e).getConfig("connectWith"))return o(e).getConfig("connectWith")===o(t).getConfig("connectWith")}return!1}var E,b,w,T,C,L,M,x={items:null,connectWith:null,disableIEFix:null,acceptFrom:null,copy:!1,placeholder:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,debounce:0,throttleTime:100,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null};function D(e,n){if("string"==typeof o(e).getConfig("hoverClass")){var r=o(e).getConfig("hoverClass").split(" ");!0===n?(i(e,"mousemove",function(e,t){var n=this;if(void 0===t&&(t=250),"function"!=typeof e)throw new Error("You must provide a function as the first argument for throttle.");if("number"!=typeof t)throw new Error("You must provide a number as the second argument for throttle.");var r=null;return function(){for(var o=[],i=0;i=t)&&(r=a,e.apply(n,o))}}(function(n){0===n.buttons&&t(e.children,o(e).getConfig("items")).forEach(function(e){var t,o;e!==n.target?(t=e.classList).remove.apply(t,r):(o=e.classList).add.apply(o,r)})},o(e).getConfig("throttleTime"))),i(e,"mouseleave",function(){t(e.children,o(e).getConfig("items")).forEach(function(e){var t;(t=e.classList).remove.apply(t,r)})})):(a(e,"mousemove"),a(e,"mouseleave"))}}var A=function(e){a(e,"dragstart"),a(e,"dragend"),a(e,"dragover"),a(e,"dragenter"),a(e,"drop"),a(e,"mouseenter"),a(e,"mouseleave")},H=function(e,t){var n=e;return!0===o(t).getConfig("copy")&&(l(n=e.cloneNode(!0),"aria-copied","true"),e.parentElement.appendChild(n),n.style.display="none",n.oldDisplay=e.style.display),n};function I(e){for(;!0!==e.isSortable;)e=e.parentElement;return e}function S(n,r){var o=e(n,"opts"),i=t(n.children,o.items).filter(function(e){return e.contains(r)});return i.length>0?i[0]:r}var Y=function(n){var r,o,i=e(n,"opts")||{},l=t(n.children,i.items),c=h(l,i.handle);a(n,"dragover"),a(n,"dragenter"),a(n,"drop"),(o=r=n).h5s&&delete o.h5s.data,s(r,"aria-dropeffect"),a(c,"mousedown"),A(l),function(e){s(e,"aria-grabbed"),s(e,"aria-copied"),s(e,"draggable"),s(e,"role")}(l)},_=function(n){var r=e(n,"opts"),o=t(n.children,r.items),a=h(o,r.handle);(l(n,"aria-dropeffect","move"),e(n,"_disabled","false"),l(a,"draggable","true"),!1===r.disableIEFix)&&("function"==typeof(document||window.document).createElement("span").dragDrop&&i(a,"mousedown",function(){if(-1!==o.indexOf(this))this.dragDrop();else{for(var e=this.parentElement;-1===o.indexOf(e);)e=e.parentElement;e.dragDrop()}}))},O=function(n){var r=e(n,"opts"),o=t(n.children,r.items),i=h(o,r.handle);e(n,"_disabled","false"),A(o),a(i,"mousedown"),a(n,"dragover"),a(n,"dragenter"),a(n,"drop")};function F(r,a){var s=String(a);return a=Object.assign({connectWith:null,acceptFrom:null,copy:!1,placeholder:null,disableIEFix:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,debounce:0,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null,items:null},"object"==typeof a?a:{}),"string"==typeof r&&(r=document.querySelectorAll(r)),r instanceof HTMLElement&&(r=[r]),r=Array.prototype.slice.call(r),/serialize/.test(s)?r.map(function(n){var r=e(n,"opts");return function(n,r,o){if(void 0===r&&(r=function(e,t){return e}),void 0===o&&(o=function(e){return e}),!(n instanceof HTMLElement)||1==!n.isSortable)throw new Error("You need to provide a sortableContainer to be serialized.");if("function"!=typeof r||"function"!=typeof o)throw new Error("You need to provide a valid serializer for items and the container.");var i=e(n,"opts").items,a=t(n.children,i),l=a.map(function(e){return{parent:n,node:e,html:e.outerHTML,index:f(e,a)}});return{container:o({node:n,itemCount:l.length}),items:l.map(function(e){return r(e,n)})}}(n,r.itemSerializer,r.containerSerializer)}):(r.forEach(function(r){if(/enable|disable|destroy/.test(s))return F[s](r);["connectWith","disableIEFix"].forEach(function(e){a.hasOwnProperty(e)&&null!==a[e]&&console.warn('HTML5Sortable: You are using the deprecated configuration "'+e+'". This will be removed in an upcoming version, make sure to migrate to the new options when updating.')}),a=Object.assign({},x,a),o(r).config=a,a=e(r,"opts")||a,e(r,"opts",a),r.isSortable=!0,O(r);var u,h=t(r.children,a.items);if(null!==a.placeholder&&void 0!==a.placeholder){var A=document.createElement(r.tagName);A.innerHTML=a.placeholder,u=A.children[0]}o(r).placeholder=function(e,t,n){if(void 0===n&&(n="sortable-placeholder"),!(e instanceof HTMLElement))throw new Error("You must provide a valid element as a sortable.");if(!(t instanceof HTMLElement)&&void 0!==t)throw new Error("You must provide a valid element as a placeholder or set ot to undefined.");return void 0===t&&(["UL","OL"].includes(e.tagName)?t=document.createElement("li"):["TABLE","TBODY"].includes(e.tagName)?(t=document.createElement("tr")).innerHTML='':t=document.createElement("div")),"string"==typeof n&&(r=t.classList).add.apply(r,n.split(" ")),t;var r}(r,u,a.placeholderClass),e(r,"items",a.items),a.acceptFrom?e(r,"acceptFrom",a.acceptFrom):a.connectWith&&e(r,"connectWith",a.connectWith),_(r),l(h,"role","option"),l(h,"aria-grabbed","false"),D(r,!0),i(r,"dragstart",function(e){if(!0!==e.target.isSortable&&(e.stopImmediatePropagation(),(!a.handle||e.target.matches(a.handle))&&"false"!==e.target.getAttribute("draggable"))){var n=I(e.target),r=S(n,e.target);L=t(n.children,a.items),T=L.indexOf(r),C=f(r,n.children),w=n,function(e,t,n){if(!(e instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(t instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(n||(n=v),e.dataTransfer&&e.dataTransfer.setDragImage){var r=n(t,c(t),e);if(!(r.element instanceof HTMLElement)||"number"!=typeof r.posX||"number"!=typeof r.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData("text/plain","arbitrary"),e.dataTransfer.setDragImage(r.element,r.posX,r.posY)}}(e,r,a.customDragImage),b=g(r),r.classList.add(a.draggingClass),l(E=H(r,n),"aria-grabbed","true"),n.dispatchEvent(new CustomEvent("sortstart",{detail:{origin:{elementIndex:C,index:T,container:w},item:E}}))}}),i(r,"dragenter",function(n){if(!0!==n.target.isSortable){var i=I(n.target);M=t(i.children,e(i,"items")).filter(function(e){return e!==o(r).placeholder})}}),i(r,"dragend",function(t){if(E){E.classList.remove(a.draggingClass),l(E,"aria-grabbed","false"),"true"===E.getAttribute("aria-copied")&&"true"!==e(E,"dropped")&&E.remove(),E.style.display=E.oldDisplay,delete E.oldDisplay;var o=Array.from(n.values()).map(function(e){return e.placeholder}).filter(function(e){return e instanceof HTMLElement}).filter(d)[0];o&&o.remove(),r.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:C,index:T,container:w},item:E}})),E=null,b=null}}),i(r,"drop",function(i){if(y(r,E.parentElement)){i.preventDefault(),i.stopPropagation(),e(E,"dropped","true");var l=Array.from(n.values()).map(function(e){return e.placeholder}).filter(function(e){return e instanceof HTMLElement}).filter(d)[0];m(l,E),l.remove(),r.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:C,index:T,container:w},item:E}}));var s=o(r).placeholder,c=t(w.children,a.items).filter(function(e){return e!==s}),u=!0===this.isSortable?this:this.parentElement,p=t(u.children,e(u,"items")).filter(function(e){return e!==s}),g=f(E,Array.from(E.parentElement.children).filter(function(e){return e!==s})),h=f(E,p);C===g&&w===u||r.dispatchEvent(new CustomEvent("sortupdate",{detail:{origin:{elementIndex:C,index:T,container:w,itemsBeforeUpdate:L,items:c},destination:{index:h,elementIndex:g,container:u,itemsBeforeUpdate:M,items:p},item:E}}))}});var Y,W,j,z=(Y=function(e,r,i){if(E)if(a.forcePlaceholderSize&&(o(e).placeholder.style.height=b+"px"),Array.from(e.children).indexOf(r)>-1){var l=g(r),s=f(o(e).placeholder,r.parentElement.children),d=f(r,r.parentElement.children);if(l>b){var u=l-b,h=c(r).top;if(sd&&i>h+l-u)return}void 0===E.oldDisplay&&(E.oldDisplay=E.style.display),"none"!==E.style.display&&(E.style.display="none");try{var v=i>=c(r).top+r.offsetHeight/2}catch(e){v=s=parseInt(a.maxItems)&&E.parentElement!==i||(n.preventDefault(),n.stopPropagation(),n.dataTransfer.dropEffect=!0===o(i).getConfig("copy")?"copy":"move",z(i,r,n.pageY))}};i(h.concat(r),"dragover",N),i(h.concat(r),"dragenter",N)}),r)}return F.destroy=function(e){Y(e)},F.enable=function(e){_(e)},F.disable=function(n){!function(n){var r=e(n,"opts"),o=h(t(n.children,r.items),r.handle);l(n,"aria-dropeffect","none"),e(n,"_disabled","true"),l(o,"draggable","false"),a(o,"mousedown")}(n)},F}(); +var sortable=function(){"use strict";function e(e,t,n){if(void 0===n)return e&&e.h5s&&e.h5s.data&&e.h5s.data[t];e.h5s=e.h5s||{},e.h5s.data=e.h5s.data||{},e.h5s.data[t]=n}function t(e,t){if(!(e instanceof NodeList||e instanceof HTMLCollection||e instanceof Array))throw new Error("You must provide a nodeList/HTMLCollection/Array of elements to be filtered.");return"string"!=typeof t?Array.from(e):Array.from(e).filter(function(e){return 1===e.nodeType&&e.matches(t)})}var n=new Map,r=function(){function e(){this._config=new Map,this._placeholder=void 0,this._data=new Map}return Object.defineProperty(e.prototype,"config",{get:function(){var e={};return this._config.forEach(function(t,n){e[n]=t}),e},set:function(e){if("object"!=typeof e)throw new Error("You must provide a valid configuration object to the config setter.");var t=Object.assign({},e);this._config=new Map(Object.entries(t))},enumerable:!0,configurable:!0}),e.prototype.setConfig=function(e,t){if(!this._config.has(e))throw new Error("Trying to set invalid configuration item: "+e);this._config.set(e,t)},e.prototype.getConfig=function(e){if(!this._config.has(e))throw new Error("Invalid configuration item requested: "+e);return this._config.get(e)},Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(!(e instanceof HTMLElement)&&null!==e)throw new Error("A placeholder must be an html element or null.");this._placeholder=e},enumerable:!0,configurable:!0}),e.prototype.setData=function(e,t){if("string"!=typeof e)throw new Error("The key must be a string.");this._data.set(e,t)},e.prototype.getData=function(e){if("string"!=typeof e)throw new Error("The key must be a string.");return this._data.get(e)},e.prototype.deleteData=function(e){if("string"!=typeof e)throw new Error("The key must be a string.");return this._data.delete(e)},e}();function o(e){if(!(e instanceof HTMLElement))throw new Error("Please provide a sortable to the store function.");return n.has(e)||n.set(e,new r),n.get(e)}function i(e,t,n){if(e instanceof Array)for(var r=0;r0&&t.matches(e)}).length>0;if(e===t)return!0;if(void 0!==o(e).getConfig("connectWith")&&null!==o(e).getConfig("connectWith"))return o(e).getConfig("connectWith")===o(t).getConfig("connectWith")}return!1}var E,b,w,T,C,L,M,x={items:null,connectWith:null,disableIEFix:null,acceptFrom:null,copy:!1,placeholder:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,debounce:0,throttleTime:100,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null};function D(e,n){if("string"==typeof o(e).getConfig("hoverClass")){var r=o(e).getConfig("hoverClass").split(" ");!0===n?(i(e,"mousemove",function(e,t){var n=this;if(void 0===t&&(t=250),"function"!=typeof e)throw new Error("You must provide a function as the first argument for throttle.");if("number"!=typeof t)throw new Error("You must provide a number as the second argument for throttle.");var r=null;return function(){for(var o=[],i=0;i=t)&&(r=a,e.apply(n,o))}}(function(n){0===n.buttons&&t(e.children,o(e).getConfig("items")).forEach(function(e){var t,o;e!==n.target?(t=e.classList).remove.apply(t,r):(o=e.classList).add.apply(o,r)})},o(e).getConfig("throttleTime"))),i(e,"mouseleave",function(){t(e.children,o(e).getConfig("items")).forEach(function(e){var t;(t=e.classList).remove.apply(t,r)})})):(a(e,"mousemove"),a(e,"mouseleave"))}}var A=function(e){a(e,"dragstart"),a(e,"dragend"),a(e,"dragover"),a(e,"dragenter"),a(e,"drop"),a(e,"mouseenter"),a(e,"mouseleave")},H=function(e,t){var n=e;return!0===o(t).getConfig("copy")&&(l(n=e.cloneNode(!0),"aria-copied","true"),e.parentElement.appendChild(n),n.style.display="none",n.oldDisplay=e.style.display),n};function I(e){for(;!0!==e.isSortable;)e=e.parentElement;return e}function S(n,r){var o=e(n,"opts"),i=t(n.children,o.items).filter(function(e){return e.contains(r)});return i.length>0?i[0]:r}var Y=function(n){var r,o,i=e(n,"opts")||{},l=t(n.children,i.items),c=h(l,i.handle);a(n,"dragover"),a(n,"dragenter"),a(n,"drop"),(o=r=n).h5s&&delete o.h5s.data,s(r,"aria-dropeffect"),a(c,"mousedown"),A(l),function(e){s(e,"aria-grabbed"),s(e,"aria-copied"),s(e,"draggable"),s(e,"role")}(l)},_=function(n){var r=e(n,"opts"),o=t(n.children,r.items),a=h(o,r.handle);(l(n,"aria-dropeffect","move"),e(n,"_disabled","false"),l(a,"draggable","true"),!1===r.disableIEFix)&&("function"==typeof(document||window.document).createElement("span").dragDrop&&i(a,"mousedown",function(){if(-1!==o.indexOf(this))this.dragDrop();else{for(var e=this.parentElement;-1===o.indexOf(e);)e=e.parentElement;e.dragDrop()}}))},O=function(n){var r=e(n,"opts"),o=t(n.children,r.items),i=h(o,r.handle);e(n,"_disabled","false"),A(o),a(i,"mousedown"),a(n,"dragover"),a(n,"dragenter"),a(n,"drop")};function F(r,a){var s=String(a);return a=Object.assign({connectWith:null,acceptFrom:null,copy:!1,placeholder:null,disableIEFix:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,debounce:0,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null,items:null},"object"==typeof a?a:{}),"string"==typeof r&&(r=document.querySelectorAll(r)),r instanceof HTMLElement&&(r=[r]),r=Array.prototype.slice.call(r),/serialize/.test(s)?r.map(function(n){var r=e(n,"opts");return function(n,r,o){if(void 0===r&&(r=function(e,t){return e}),void 0===o&&(o=function(e){return e}),!(n instanceof HTMLElement)||1==!n.isSortable)throw new Error("You need to provide a sortableContainer to be serialized.");if("function"!=typeof r||"function"!=typeof o)throw new Error("You need to provide a valid serializer for items and the container.");var i=e(n,"opts").items,a=t(n.children,i),l=a.map(function(e){return{parent:n,node:e,html:e.outerHTML,index:f(e,a)}});return{container:o({node:n,itemCount:l.length}),items:l.map(function(e){return r(e,n)})}}(n,r.itemSerializer,r.containerSerializer)}):(r.forEach(function(r){if(/enable|disable|destroy/.test(s))return F[s](r);["connectWith","disableIEFix"].forEach(function(e){a.hasOwnProperty(e)&&null!==a[e]&&console.warn('HTML5Sortable: You are using the deprecated configuration "'+e+'". This will be removed in an upcoming version, make sure to migrate to the new options when updating.')}),a=Object.assign({},x,a),o(r).config=a,a=e(r,"opts")||a,e(r,"opts",a),r.isSortable=!0,O(r);var u,h=t(r.children,a.items);if(null!==a.placeholder&&void 0!==a.placeholder){var A=document.createElement(r.tagName);A.innerHTML=a.placeholder,u=A.children[0]}o(r).placeholder=function(e,t,n){if(void 0===n&&(n="sortable-placeholder"),!(e instanceof HTMLElement))throw new Error("You must provide a valid element as a sortable.");if(!(t instanceof HTMLElement)&&void 0!==t)throw new Error("You must provide a valid element as a placeholder or set ot to undefined.");return void 0===t&&(["UL","OL"].includes(e.tagName)?t=document.createElement("li"):["TABLE","TBODY"].includes(e.tagName)?(t=document.createElement("tr")).innerHTML='':t=document.createElement("div")),"string"==typeof n&&(r=t.classList).add.apply(r,n.split(" ")),t;var r}(r,u,a.placeholderClass),e(r,"items",a.items),a.acceptFrom?e(r,"acceptFrom",a.acceptFrom):a.connectWith&&e(r,"connectWith",a.connectWith),_(r),l(h,"role","option"),l(h,"aria-grabbed","false"),D(r,!0),i(r,"dragstart",function(e){if(!0!==e.target.isSortable&&(e.stopImmediatePropagation(),(!a.handle||e.target.matches(a.handle))&&"false"!==e.target.getAttribute("draggable"))){var n=I(e.target),r=S(n,e.target);L=t(n.children,a.items),T=L.indexOf(r),C=f(r,n.children),w=n,function(e,t,n){if(!(e instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(t instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(n||(n=v),e.dataTransfer&&e.dataTransfer.setDragImage){var r=n(t,c(t),e);if(!(r.element instanceof HTMLElement)||"number"!=typeof r.posX||"number"!=typeof r.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData("text/plain","arbitrary"),e.dataTransfer.setDragImage(r.element,r.posX,r.posY)}}(e,r,a.customDragImage),b=g(r),r.classList.add(a.draggingClass),l(E=H(r,n),"aria-grabbed","true"),n.dispatchEvent(new CustomEvent("sortstart",{detail:{origin:{elementIndex:C,index:T,container:w},item:E}}))}}),i(r,"dragenter",function(n){if(!0!==n.target.isSortable){var i=I(n.target);M=t(i.children,e(i,"items")).filter(function(e){return e!==o(r).placeholder})}}),i(r,"dragend",function(t){if(E){E.classList.remove(a.draggingClass),l(E,"aria-grabbed","false"),"true"===E.getAttribute("aria-copied")&&"true"!==e(E,"dropped")&&E.remove(),E.style.display=E.oldDisplay,delete E.oldDisplay;var o=Array.from(n.values()).map(function(e){return e.placeholder}).filter(function(e){return e instanceof HTMLElement}).filter(d)[0];o&&o.remove(),r.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:C,index:T,container:w},item:E}})),E=null,b=null}}),i(r,"drop",function(i){if(y(r,E.parentElement)){i.preventDefault(),i.stopPropagation(),e(E,"dropped","true");var l=Array.from(n.values()).map(function(e){return e.placeholder}).filter(function(e){return e instanceof HTMLElement}).filter(d)[0];m(l,E),l.remove(),r.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:C,index:T,container:w},item:E}}));var s=o(r).placeholder,c=t(w.children,a.items).filter(function(e){return e!==s}),u=!0===this.isSortable?this:this.parentElement,p=t(u.children,e(u,"items")).filter(function(e){return e!==s}),g=f(E,Array.from(E.parentElement.children).filter(function(e){return e!==s})),h=f(E,p);C===g&&w===u||r.dispatchEvent(new CustomEvent("sortupdate",{detail:{origin:{elementIndex:C,index:T,container:w,itemsBeforeUpdate:L,items:c},destination:{index:h,elementIndex:g,container:u,itemsBeforeUpdate:M,items:p},item:E}}))}});var Y,W,j,z=(Y=function(e,r,i){if(E)if(a.forcePlaceholderSize&&(o(e).placeholder.style.height=b+"px"),Array.from(e.children).indexOf(r)>-1){var l=g(r),s=f(o(e).placeholder,r.parentElement.children),d=f(r,r.parentElement.children);if(l>b){var u=l-b,h=c(r).top;if(sd&&i>h+l-u)return}void 0===E.oldDisplay&&(E.oldDisplay=E.style.display),"none"!==E.style.display&&(E.style.display="none");var v=!1;try{v=i>=c(r).top+r.offsetHeight/2}catch(e){v=s=parseInt(a.maxItems)&&E.parentElement!==i||(n.preventDefault(),n.stopPropagation(),n.dataTransfer.dropEffect=!0===o(i).getConfig("copy")?"copy":"move",z(i,r,n.pageY))}};i(h.concat(r),"dragover",N),i(h.concat(r),"dragenter",N)}),r)}return F.destroy=function(e){Y(e)},F.enable=function(e){_(e)},F.disable=function(n){!function(n){var r=e(n,"opts"),o=h(t(n.children,r.items),r.handle);l(n,"aria-dropeffect","none"),e(n,"_disabled","true"),l(o,"draggable","false"),a(o,"mousedown")}(n)},F}(); //# sourceMappingURL=html5sortable.min.js.map diff --git a/dist/html5sortable.min.js.map b/dist/html5sortable.min.js.map index 68202e90..f6a8b85b 100644 --- a/dist/html5sortable.min.js.map +++ b/dist/html5sortable.min.js.map @@ -1 +1 @@ -{"version":3,"file":"html5sortable.min.js","sources":["../src/data.ts","../src/filter.ts","../src/store.ts","../src/eventListener.ts","../src/attribute.ts","../src/offset.ts","../src/index.ts","../src/isInDom.ts","../src/insertHtmlElements.ts","../src/elementHeight.ts","../src/getHandles.ts","../src/setDragImage.ts","../src/isConnected.ts","../src/html5sortable.ts","../src/defaultConfiguration.ts","../src/hoverClass.ts","../src/throttle.ts","../src/serialize.ts","../src/makePlaceholder.ts","../src/debounce.ts"],"sourcesContent":["/**\n * Get or set data on element\n * @param {HTMLElement} element\n * @param {string} key\n * @param {any} value\n * @return {*}\n */\n\nfunction addData (element: HTMLElement, key: string, value?: any): HTMLElement|configuration|string|void {\n if (value === undefined) {\n return element && element.h5s && element.h5s.data && element.h5s.data[key]\n } else {\n element.h5s = element.h5s || {}\n element.h5s.data = element.h5s.data || {}\n element.h5s.data[key] = value\n }\n}\n/**\n * Remove data from element\n * @param {HTMLElement} element\n */\nfunction removeData (element: HTMLElement) {\n if (element.h5s) {\n delete element.h5s.data\n }\n}\n\nexport { addData, removeData }\n","/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {NodeList|HTMLCollection|Array} nodes\n * @param {String} selector\n * @returns {Array}\n */\nexport default (nodes: NodeList|HTMLCollection|Array, selector: string): Array => {\n if (!(nodes instanceof NodeList || nodes instanceof HTMLCollection || nodes instanceof Array)) {\n throw new Error('You must provide a nodeList/HTMLCollection/Array of elements to be filtered.')\n }\n if (typeof selector !== 'string') {\n return Array.from(nodes)\n }\n\n return Array.from(nodes).filter((item) => item.nodeType === 1 && item.matches(selector))\n}\n","/* eslint-env browser */\nexport let stores: Map = new Map()\n/**\n * Stores data & configurations per Sortable\n * @param {Object} config\n */\nexport class Store implements Store {\n private _config: Map = new Map() // eslint-disable-line no-undef\n private _placeholder?: HTMLElement = undefined // eslint-disable-line no-undef\n private _data: Map = new Map() // eslint-disable-line no-undef\n /**\n * set the configuration of a class instance\n * @method config\n * @param {object} config object of configurations\n */\n set config (config: configuration) {\n if (typeof config !== 'object') {\n throw new Error('You must provide a valid configuration object to the config setter.')\n }\n // combine config with default\n let mergedConfig = Object.assign({}, config)\n // add config to map\n this._config = new Map(Object.entries(mergedConfig))\n }\n /**\n * get the configuration map of a class instance\n * @method config\n * @return {object}\n */\n get config (): configuration {\n // transform Map to object\n let config = {}\n this._config.forEach((value, key) => {\n config[key] = value\n })\n // return object\n return config\n }\n /**\n * set individual configuration of a class instance\n * @method setConfig\n * @param key valid configuration key\n * @param value any value\n * @return void\n */\n setConfig (key: string, value: any): void {\n if (!this._config.has(key)) {\n throw new Error(`Trying to set invalid configuration item: ${key}`)\n }\n // set config\n this._config.set(key, value)\n }\n /**\n * get an individual configuration of a class instance\n * @method getConfig\n * @param key valid configuration key\n * @return any configuration value\n */\n getConfig (key: string): any {\n if (!this._config.has(key)) {\n throw new Error(`Invalid configuration item requested: ${key}`)\n }\n return this._config.get(key)\n }\n /**\n * get the placeholder for a class instance\n * @method placeholder\n * @return {HTMLElement|null}\n */\n get placeholder (): HTMLElement {\n return this._placeholder\n }\n /**\n * set the placeholder for a class instance\n * @method placeholder\n * @param {HTMLElement} placeholder\n * @return {void}\n */\n set placeholder (placeholder: HTMLElement): void {\n if (!(placeholder instanceof HTMLElement) && placeholder !== null) {\n throw new Error('A placeholder must be an html element or null.')\n }\n this._placeholder = placeholder\n }\n /**\n * set an data entry\n * @method setData\n * @param {string} key\n * @param {any} value\n * @return {void}\n */\n setData (key: string, value: Function): void {\n if (typeof key !== 'string') {\n throw new Error(`The key must be a string.`)\n }\n this._data.set(key, value)\n }\n /**\n * get an data entry\n * @method getData\n * @param {string} key an existing key\n * @return {any}\n */\n getData (key: string): any {\n if (typeof key !== 'string') {\n throw new Error(`The key must be a string.`)\n }\n return this._data.get(key)\n }\n /**\n * delete an data entry\n * @method deleteData\n * @param {string} key an existing key\n * @return {boolean}\n */\n deleteData (key: string): boolean {\n if (typeof key !== 'string') {\n throw new Error(`The key must be a string.`)\n }\n return this._data.delete(key)\n }\n}\n/**\n * @param {HTMLElement} sortableElement\n * @returns {Class: Store}\n */\nexport default (sortableElement: HTMLElement): Store => {\n // if sortableElement is wrong type\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('Please provide a sortable to the store function.')\n }\n // create new instance if not avilable\n if (!stores.has(sortableElement)) {\n stores.set(sortableElement, new Store())\n }\n // return instance\n return stores.get(sortableElement)\n}\n","import store from './store'\n/**\n * @param {Array|HTMLElement} element\n * @param {Function} callback\n * @param {string} event\n */\nfunction addEventListener (element: Array|HTMLElement, eventName:string, callback: () => void) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addEventListener(element[i], eventName, callback)\n }\n return\n }\n element.addEventListener(eventName, callback)\n store(element).setData(`event${eventName}`, callback)\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} eventName\n */\nfunction removeEventListener (element: Array|HTMLElement, eventName: string) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeEventListener(element[i], eventName)\n }\n return\n }\n element.removeEventListener(eventName, store(element).getData(`event${eventName}`))\n store(element).deleteData(`event${eventName}`)\n}\n\nexport { addEventListener, removeEventListener }\n","/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction addAttribute (element: Array|HTMLElement, attribute:string, value:string) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addAttribute(element[i], attribute, value)\n }\n return\n }\n element.setAttribute(attribute, value)\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n */\nfunction removeAttribute (element: Array|HTMLElement, attribute:string) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeAttribute(element[i], attribute)\n }\n return\n }\n element.removeAttribute(attribute)\n}\n\nexport { addAttribute, removeAttribute }\n","/**\n * @param {HTMLElement} element\n * @returns {Object}\n */\nexport default (element: HTMLElement): offsetObject => {\n if (!element.parentElement || element.getClientRects().length === 0) {\n throw new Error('target element must be part of the dom')\n }\n\n let rect = element.getClientRects()[0]\n return {\n left: rect.left + window.scrollX,\n right: rect.right + window.scrollX,\n top: rect.top + window.scrollY,\n bottom: rect.bottom + window.scrollY\n }\n}\n","/* eslint-env browser */\n/**\n * Get position of the element relatively to its sibling elements\n * @param {HTMLElement} element\n * @returns {number}\n */\nexport default (element: HTMLElement, elementList: HTMLCollection | NodeList | Array): number => {\n if (!(element instanceof HTMLElement) || !(elementList instanceof NodeList || elementList instanceof HTMLCollection || elementList instanceof Array)) {\n throw new Error('You must provide an element and a list of elements.')\n }\n\n return Array.from(elementList).indexOf(element)\n}\n","/* eslint-env browser */\n/**\n * Test whether element is in DOM\n * @param {HTMLElement} element\n * @returns {boolean}\n */\nexport default (element: HTMLElement): boolean => {\n if (!(element instanceof HTMLElement)) {\n throw new Error('Element is not a node element.')\n }\n\n return element.parentNode !== null\n}\n","/* eslint-env browser */\n/**\n * Insert node before or after target\n * @param {HTMLElement} referenceNode - reference element\n * @param {HTMLElement} newElement - element to be inserted\n * @param {String} position - insert before or after reference element\n */\nlet insertNode = (referenceNode: HTMLElement, newElement: HTMLElement, position: String) => {\n if (!(referenceNode instanceof HTMLElement) || !(referenceNode.parentElement instanceof HTMLElement)) {\n throw new Error('target and element must be a node')\n }\n referenceNode.parentElement.insertBefore(\n newElement,\n (position === 'before' ? referenceNode : referenceNode.nextElementSibling)\n )\n}\n/**\n * Insert before target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nlet insertBefore = (target: HTMLElement, element: HTMLElement) => insertNode(target, element, 'before')\n/**\n * Insert after target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nlet insertAfter = (target: HTMLElement, element: HTMLElement) => insertNode(target, element, 'after')\n\nexport { insertBefore, insertAfter }\n","/* eslint-env browser */\n/**\n * Get height of an element including padding\n * @param {HTMLElement} element an dom element\n */\nexport default (element: HTMLElement) => {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element')\n }\n // get calculated style of element\n let style = window.getComputedStyle(element)\n // pick applicable properties, convert to int and reduce by adding\n return ['height', 'padding-top', 'padding-bottom']\n .map((key) => {\n let int = parseInt(style.getPropertyValue(key), 10)\n return isNaN(int) ? 0 : int\n })\n .reduce((sum, value) => sum + value)\n}\n","/* eslint-env browser */\n/**\n * get handle or return item\n * @param {Array} items\n * @param {string} selector\n */\nexport default (items: Array, selector: string): Array => {\n if (!(items instanceof Array)) {\n throw new Error('You must provide a Array of HTMLElements to be filtered.')\n }\n\n if (typeof selector !== 'string') {\n return items\n }\n\n return items\n // remove items without handle from array\n .filter((item: HTMLElement) => {\n return item.querySelector(selector) instanceof HTMLElement\n })\n // replace item with handle in array\n .map((item: HTMLElement) => {\n return item.querySelector(selector)\n })\n}\n","/* eslint-env browser */\nimport {default as offset} from './offset'\n/**\n * defaultDragImage returns the current item as dragged image\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {object} elementOffset - an object with the offsets top, left, right & bottom\n * @param {Event} event - the original drag event object\n * @return {object} with element, posX and posY properties\n */\nlet defaultDragImage = (draggedElement: HTMLElement, elementOffset: offsetObject, event: DragEvent): object => {\n return {\n element: draggedElement,\n posX: event.pageX - elementOffset.left,\n posY: event.pageY - elementOffset.top\n }\n}\n/**\n * attaches an element as the drag image to an event\n * @param {Event} event - the original drag event object\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {Function} customDragImage - function to create a custom dragImage\n * @return void\n */\nexport default (event: DragEvent, draggedElement: HTMLElement, customDragImage: Function): void => {\n // check if event is provided\n if (!(event instanceof Event)) {\n throw new Error('setDragImage requires a DragEvent as the first argument.')\n }\n // check if draggedElement is provided\n if (!(draggedElement instanceof HTMLElement)) {\n throw new Error('setDragImage requires the dragged element as the second argument.')\n }\n // set default function of none provided\n if (!customDragImage) {\n customDragImage = defaultDragImage\n }\n // check if setDragImage method is available\n if (event.dataTransfer && event.dataTransfer.setDragImage) {\n // get the elements offset\n let elementOffset = offset(draggedElement)\n // get the dragImage\n let dragImage = customDragImage(draggedElement, elementOffset, event)\n // check if custom function returns correct values\n if (!(dragImage.element instanceof HTMLElement) || typeof dragImage.posX !== 'number' || typeof dragImage.posY !== 'number') {\n throw new Error('The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].')\n }\n // needs to be set for HTML5 drag & drop to work\n event.dataTransfer.effectAllowed = 'copyMove'\n // Firefox requires arbitrary content in setData for the drag & drop functionality to work\n event.dataTransfer.setData('text/plain', 'arbitrary')\n // set the drag image on the event\n event.dataTransfer.setDragImage(dragImage.element, dragImage.posX, dragImage.posY)\n }\n}\n","import store from './store'\n/**\n * Check if curList accepts items from destList\n * @param {sortable} destination the container an item is move to\n * @param {sortable} origin the container an item comes from\n */\nexport default (destination: sortable, origin: sortable) => {\n // check if valid sortable\n if (destination.isSortable === true) {\n const acceptFrom = store(destination).getConfig('acceptFrom')\n // check if acceptFrom is valid\n if (acceptFrom !== null && acceptFrom !== false && typeof acceptFrom !== 'string') {\n throw new Error('HTML5Sortable: Wrong argument, \"acceptFrom\" must be \"null\", \"false\", or a valid selector string.')\n }\n\n if (acceptFrom !== null) {\n return acceptFrom !== false && acceptFrom.split(',').filter(function (sel) {\n return sel.length > 0 && origin.matches(sel)\n }).length > 0\n }\n // drop in same list\n if (destination === origin) {\n return true\n }\n // check if lists are connected with connectWith\n if (store(destination).getConfig('connectWith') !== undefined && store(destination).getConfig('connectWith') !== null) {\n return store(destination).getConfig('connectWith') === store(origin).getConfig('connectWith')\n }\n }\n return false\n}\n","/* eslint-env browser */\n'use strict'\n\nimport { addData as _data, removeData as _removeData } from './data'\nimport _filter from './filter'\nimport { addEventListener as _on, removeEventListener as _off } from './eventListener'\nimport { addAttribute as _attr, removeAttribute as _removeAttr } from './attribute'\nimport _offset from './offset'\nimport _debounce from './debounce'\nimport _index from './index'\nimport isInDom from './isInDom'\nimport { insertBefore as _before, insertAfter as _after } from './insertHtmlElements'\nimport _serialize from './serialize'\nimport _makePlaceholder from './makePlaceholder'\nimport _getElementHeight from './elementHeight'\nimport _getHandles from './getHandles'\nimport setDragImage from './setDragImage'\nimport {default as store, stores} from './store'\nimport _listsConnected from './isConnected'\nimport defaultConfiguration from './defaultConfiguration'\nimport enableHoverClass from './hoverClass'\n/*\n * variables global to the plugin\n */\nlet dragging\nlet draggingHeight\n\n/*\n * Keeps track of the initialy selected list, where 'dragstart' event was triggered\n * It allows us to move the data in between individual Sortable List instances\n */\n\n// Origin List - data from before any item was changed\nlet originContainer\nlet originIndex\nlet originElementIndex\nlet originItemsBeforeUpdate\n\n// Destination List - data from before any item was changed\nlet destinationItemsBeforeUpdate\n\n/**\n * remove event handlers from items\n * @param {Array|NodeList} items\n */\nconst _removeItemEvents = function (items) {\n _off(items, 'dragstart')\n _off(items, 'dragend')\n _off(items, 'dragover')\n _off(items, 'dragenter')\n _off(items, 'drop')\n _off(items, 'mouseenter')\n _off(items, 'mouseleave')\n}\n/**\n * _getDragging returns the current element to drag or\n * a copy of the element.\n * Is Copy Active for sortable\n * @param {HTMLElement} draggedItem - the item that the user drags\n * @param {HTMLElement} sortable a single sortable\n */\nconst _getDragging = function (draggedItem, sortable) {\n let ditem = draggedItem\n if (store(sortable).getConfig('copy') === true) {\n ditem = draggedItem.cloneNode(true)\n _attr(ditem, 'aria-copied', 'true')\n draggedItem.parentElement.appendChild(ditem)\n ditem.style.display = 'none'\n ditem.oldDisplay = draggedItem.style.display\n }\n return ditem\n}\n/**\n * Remove data from sortable\n * @param {HTMLElement} sortable a single sortable\n */\nconst _removeSortableData = function (sortable) {\n _removeData(sortable)\n _removeAttr(sortable, 'aria-dropeffect')\n}\n/**\n * Remove data from items\n * @param {Array|HTMLElement} items\n */\nconst _removeItemData = function (items) {\n _removeAttr(items, 'aria-grabbed')\n _removeAttr(items, 'aria-copied')\n _removeAttr(items, 'draggable')\n _removeAttr(items, 'role')\n}\n/**\n * find sortable from element. travels up parent element until found or null.\n * @param {HTMLElement} element a single sortable\n */\nfunction findSortable (element) {\n while (element.isSortable !== true) {\n element = element.parentElement\n }\n return element\n}\n/**\n * Dragging event is on the sortable element. finds the top child that\n * contains the element.\n * @param {HTMLElement} sortableElement a single sortable\n * @param {HTMLElement} element is that being dragged\n */\nfunction findDragElement (sortableElement, element) {\n const options = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, options.items)\n const itemlist = items.filter(function (ele) {\n return ele.contains(element)\n })\n\n return itemlist.length > 0 ? itemlist[0] : element\n}\n/**\n * Destroy the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nconst _destroySortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts') || {}\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n // remove event handlers & data from sortable\n _off(sortableElement, 'dragover')\n _off(sortableElement, 'dragenter')\n _off(sortableElement, 'drop')\n // remove event data from sortable\n _removeSortableData(sortableElement)\n // remove event handlers & data from items\n _off(handles, 'mousedown')\n _removeItemEvents(items)\n _removeItemData(items)\n}\n/**\n * Enable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nconst _enableSortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n _attr(sortableElement, 'aria-dropeffect', 'move')\n _data(sortableElement, '_disabled', 'false')\n _attr(handles, 'draggable', 'true')\n // @todo: remove this fix\n // IE FIX for ghost\n // can be disabled as it has the side effect that other events\n // (e.g. click) will be ignored\n if (opts.disableIEFix === false) {\n const spanEl = (document || window.document).createElement('span')\n if (typeof spanEl.dragDrop === 'function') {\n _on(handles, 'mousedown', function () {\n if (items.indexOf(this) !== -1) {\n this.dragDrop()\n } else {\n let parent = this.parentElement\n while (items.indexOf(parent) === -1) {\n parent = parent.parentElement\n }\n parent.dragDrop()\n }\n })\n }\n }\n}\n/**\n * Disable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nconst _disableSortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n _attr(sortableElement, 'aria-dropeffect', 'none')\n _data(sortableElement, '_disabled', 'true')\n _attr(handles, 'draggable', 'false')\n _off(handles, 'mousedown')\n}\n/**\n * Reload the sortable\n * @param {HTMLElement} sortableElement a single sortable\n * @description events need to be removed to not be double bound\n */\nconst _reloadSortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n _data(sortableElement, '_disabled', 'false')\n // remove event handlers from items\n _removeItemEvents(items)\n _off(handles, 'mousedown')\n // remove event handlers from sortable\n _off(sortableElement, 'dragover')\n _off(sortableElement, 'dragenter')\n _off(sortableElement, 'drop')\n}\n\n/**\n * Public sortable object\n * @param {Array|NodeList} sortableElements\n * @param {object|string} options|method\n */\nexport default function sortable (sortableElements, options: object|string|undefined): sortable {\n // get method string to see if a method is called\n const method = String(options)\n // merge user options with defaultss\n options = Object.assign({\n connectWith: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n disableIEFix: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n debounce: 0,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null,\n items: null\n // if options is an object, merge it, otherwise use empty object\n }, (typeof options === 'object') ? options : {})\n // check if the user provided a selector instead of an element\n if (typeof sortableElements === 'string') {\n sortableElements = document.querySelectorAll(sortableElements)\n }\n // if the user provided an element, return it in an array to keep the return value consistant\n if (sortableElements instanceof HTMLElement) {\n sortableElements = [sortableElements]\n }\n\n sortableElements = Array.prototype.slice.call(sortableElements)\n\n if (/serialize/.test(method)) {\n return sortableElements.map((sortableContainer) => {\n let opts = _data(sortableContainer, 'opts')\n return _serialize(sortableContainer, opts.itemSerializer, opts.containerSerializer)\n })\n }\n\n sortableElements.forEach(function (sortableElement) {\n if (/enable|disable|destroy/.test(method)) {\n return sortable[method](sortableElement)\n }\n // log deprecation\n ['connectWith', 'disableIEFix'].forEach((configKey) => {\n if (options.hasOwnProperty(configKey) && options[configKey] !== null) {\n console.warn(`HTML5Sortable: You are using the deprecated configuration \"${configKey}\". This will be removed in an upcoming version, make sure to migrate to the new options when updating.`)\n }\n })\n // merge options with default options\n options = Object.assign({}, defaultConfiguration, options)\n // init data store for sortable\n store(sortableElement).config = options\n // get options & set options on sortable\n options = _data(sortableElement, 'opts') || options\n _data(sortableElement, 'opts', options)\n // property to define as sortable\n sortableElement.isSortable = true\n // reset sortable\n _reloadSortable(sortableElement)\n // initialize\n const listItems = _filter(sortableElement.children, options.items)\n // create element if user defined a placeholder element as a string\n let customPlaceholder\n if (options.placeholder !== null && options.placeholder !== undefined) {\n let tempContainer = document.createElement(sortableElement.tagName)\n tempContainer.innerHTML = options.placeholder\n customPlaceholder = tempContainer.children[0]\n }\n // add placeholder\n store(sortableElement).placeholder = _makePlaceholder(sortableElement, customPlaceholder, options.placeholderClass)\n\n _data(sortableElement, 'items', options.items)\n\n if (options.acceptFrom) {\n _data(sortableElement, 'acceptFrom', options.acceptFrom)\n } else if (options.connectWith) {\n _data(sortableElement, 'connectWith', options.connectWith)\n }\n\n _enableSortable(sortableElement)\n _attr(listItems, 'role', 'option')\n _attr(listItems, 'aria-grabbed', 'false')\n // enable hover class\n enableHoverClass(sortableElement, true)\n /*\n Handle drag events on draggable items\n Handle is set at the sortableElement level as it will bubble up\n from the item\n */\n _on(sortableElement, 'dragstart', function (e) {\n // ignore dragstart events\n if (e.target.isSortable === true) {\n return\n }\n e.stopImmediatePropagation()\n\n if ((options.handle && !e.target.matches(options.handle)) || e.target.getAttribute('draggable') === 'false') {\n return\n }\n\n const sortableContainer = findSortable(e.target)\n const dragItem = findDragElement(sortableContainer, e.target)\n\n // grab values\n originItemsBeforeUpdate = _filter(sortableContainer.children, options.items)\n originIndex = originItemsBeforeUpdate.indexOf(dragItem)\n originElementIndex = _index(dragItem, sortableContainer.children)\n originContainer = sortableContainer\n\n // add transparent clone or other ghost to cursor\n setDragImage(e, dragItem, options.customDragImage)\n // cache selsection & add attr for dragging\n draggingHeight = _getElementHeight(dragItem)\n dragItem.classList.add(options.draggingClass)\n dragging = _getDragging(dragItem, sortableContainer)\n _attr(dragging, 'aria-grabbed', 'true')\n\n // dispatch sortstart event on each element in group\n sortableContainer.dispatchEvent(new CustomEvent('sortstart', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }))\n })\n\n /*\n We are capturing targetSortable before modifications with 'dragenter' event\n */\n _on(sortableElement, 'dragenter', (e) => {\n if (e.target.isSortable === true) {\n return\n }\n const sortableContainer = findSortable(e.target)\n destinationItemsBeforeUpdate = _filter(sortableContainer.children, _data(sortableContainer, 'items'))\n .filter(item => item !== store(sortableElement).placeholder)\n })\n /*\n * Dragend Event - https://developer.mozilla.org/en-US/docs/Web/Events/dragend\n * Fires each time dragEvent end, or ESC pressed\n * We are using it to clean up any draggable elements and placeholders\n */\n _on(sortableElement, 'dragend', function (e) {\n if (!dragging) {\n return\n }\n\n dragging.classList.remove(options.draggingClass)\n _attr(dragging, 'aria-grabbed', 'false')\n\n if (dragging.getAttribute('aria-copied') === 'true' && _data(dragging, 'dropped') !== 'true') {\n dragging.remove()\n }\n\n dragging.style.display = dragging.oldDisplay\n delete dragging.oldDisplay\n\n const visiblePlaceholder = Array.from(stores.values()).map(data => data.placeholder)\n .filter(placeholder => placeholder instanceof HTMLElement)\n .filter(isInDom)[0]\n\n if (visiblePlaceholder) {\n visiblePlaceholder.remove()\n }\n\n // dispatch sortstart event on each element in group\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }))\n\n dragging = null\n draggingHeight = null\n })\n\n /*\n * Drop Event - https://developer.mozilla.org/en-US/docs/Web/Events/drop\n * Fires when valid drop target area is hit\n */\n _on(sortableElement, 'drop', function (e) {\n if (!_listsConnected(sortableElement, dragging.parentElement)) {\n return\n }\n e.preventDefault()\n e.stopPropagation()\n\n _data(dragging, 'dropped', 'true')\n // get the one placeholder that is currently visible\n const visiblePlaceholder = Array.from(stores.values()).map((data) => {\n return data.placeholder\n })\n // filter only HTMLElements\n .filter(placeholder => placeholder instanceof HTMLElement)\n // filter only elements in DOM\n .filter(isInDom)[0]\n // attach element after placeholder\n _after(visiblePlaceholder, dragging)\n // remove placeholder from dom\n visiblePlaceholder.remove()\n\n /*\n * Fires Custom Event - 'sortstop'\n */\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }))\n\n const placeholder = store(sortableElement).placeholder\n const originItems = _filter(originContainer.children, options.items)\n .filter(item => item !== placeholder)\n const destinationContainer = this.isSortable === true ? this : this.parentElement\n const destinationItems = _filter(destinationContainer.children, _data(destinationContainer, 'items'))\n .filter(item => item !== placeholder)\n const destinationElementIndex = _index(dragging, Array.from(dragging.parentElement.children)\n .filter(item => item !== placeholder))\n const destinationIndex = _index(dragging, destinationItems)\n\n /*\n * When a list item changed container lists or index within a list\n * Fires Custom Event - 'sortupdate'\n */\n if (originElementIndex !== destinationElementIndex || originContainer !== destinationContainer) {\n sortableElement.dispatchEvent(new CustomEvent('sortupdate', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer,\n itemsBeforeUpdate: originItemsBeforeUpdate,\n items: originItems\n },\n destination: {\n index: destinationIndex,\n elementIndex: destinationElementIndex,\n container: destinationContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate,\n items: destinationItems\n },\n item: dragging\n }\n }))\n }\n })\n\n const debouncedDragOverEnter = _debounce((sortableElement, element, pageY) => {\n if (!dragging) {\n return\n }\n\n // set placeholder height if forcePlaceholderSize option is set\n if (options.forcePlaceholderSize) {\n store(sortableElement).placeholder.style.height = draggingHeight + 'px'\n }\n // if element the draggedItem is dragged onto is within the array of all elements in list\n // (not only items, but also disabled, etc.)\n if (Array.from(sortableElement.children).indexOf(element) > -1) {\n const thisHeight = _getElementHeight(element)\n const placeholderIndex = _index(store(sortableElement).placeholder, element.parentElement.children)\n const thisIndex = _index(element, element.parentElement.children)\n // Check if `element` is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering\n if (thisHeight > draggingHeight) {\n // Dead zone?\n const deadZone = thisHeight - draggingHeight\n const offsetTop = _offset(element).top\n if (placeholderIndex < thisIndex && pageY < offsetTop) {\n return\n }\n if (placeholderIndex > thisIndex &&\n pageY > offsetTop + thisHeight - deadZone) {\n return\n }\n }\n\n if (dragging.oldDisplay === undefined) {\n dragging.oldDisplay = dragging.style.display\n }\n\n if (dragging.style.display !== 'none') {\n dragging.style.display = 'none'\n }\n // To avoid flicker, determine where to position the placeholder\n // based on where the mouse pointer is relative to the elements\n // vertical center.\n try{\n let elementMiddle = _offset(element).top + element.offsetHeight / 2\n let placeAfter = pageY >= elementMiddle\n } catch(e) {\n let placeAfter = placeholderIndex < thisIndex\n }\n\n if (placeAfter) {\n _after(element, store(sortableElement).placeholder)\n } else {\n _before(element, store(sortableElement).placeholder)\n }\n // get placeholders from all stores & remove all but current one\n Array.from(stores.values())\n // remove empty values\n .filter(data => data.placeholder !== undefined)\n // foreach placeholder in array if outside of current sorableContainer -> remove from DOM\n .forEach((data) => {\n if (data.placeholder !== store(sortableElement).placeholder) {\n data.placeholder.remove()\n }\n })\n } else {\n // get all placeholders from store\n let placeholders = Array.from(stores.values())\n .filter((data) => data.placeholder !== undefined)\n .map((data) => {\n return data.placeholder\n })\n // check if element is not in placeholders\n if (placeholders.indexOf(element) === -1 && sortableElement === element && !_filter(element.children, options.items).length) {\n placeholders.forEach((element) => element.remove())\n element.appendChild(store(sortableElement).placeholder)\n }\n }\n }, options.debounce)\n // Handle dragover and dragenter events on draggable items\n const onDragOverEnter = function (e) {\n let element = e.target\n const sortableElement = element.isSortable === true ? element : findSortable(element)\n element = findDragElement(sortableElement, element)\n if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || _data(sortableElement, '_disabled') === 'true') {\n return\n }\n const options = _data(sortableElement, 'opts')\n if (parseInt(options.maxItems) && _filter(sortableElement.children, _data(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {\n return\n }\n e.preventDefault()\n e.stopPropagation()\n e.dataTransfer.dropEffect = store(sortableElement).getConfig('copy') === true ? 'copy' : 'move'\n debouncedDragOverEnter(sortableElement, element, e.pageY)\n }\n\n _on(listItems.concat(sortableElement), 'dragover', onDragOverEnter)\n _on(listItems.concat(sortableElement), 'dragenter', onDragOverEnter)\n })\n\n return sortableElements\n}\n\nsortable.destroy = function (sortableElement) {\n _destroySortable(sortableElement)\n}\n\nsortable.enable = function (sortableElement) {\n _enableSortable(sortableElement)\n}\n\nsortable.disable = function (sortableElement) {\n _disableSortable(sortableElement)\n}\n\n/* START.TESTS_ONLY */\nsortable.__testing = {\n // add internal methods here for testing purposes\n _data: _data,\n _removeItemEvents: _removeItemEvents,\n _removeItemData: _removeItemData,\n _removeSortableData: _removeSortableData\n}\n/* END.TESTS_ONLY */\n","/**\n * default configurations\n */\nexport default {\n items: null,\n // deprecated\n connectWith: null,\n // deprecated\n disableIEFix: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n debounce: 0,\n throttleTime: 100,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null\n}\n","/* eslint-env browser */\nimport store from './store'\nimport _filter from './filter'\nimport _throttle from './throttle'\nimport { addEventListener as _on, removeEventListener as _off } from './eventListener'\n/**\n * enable or disable hoverClass on mouseenter/leave if container Items\n * @param {sortable} sortableContainer a valid sortableContainer\n * @param {boolean} enable enable or disable event\n */\n// export default (sortableContainer: sortable, enable: boolean) => {\nexport default (sortableContainer: sortable, enable: boolean) => {\n if (typeof store(sortableContainer).getConfig('hoverClass') === 'string') {\n let hoverClasses = store(sortableContainer).getConfig('hoverClass').split(' ')\n // add class on hover\n if (enable === true) {\n _on(sortableContainer, 'mousemove', _throttle((event) => {\n // check of no mouse button was pressed when mousemove started == no drag\n if (event.buttons === 0) {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(item => {\n if (item !== event.target) {\n item.classList.remove(...hoverClasses)\n } else {\n item.classList.add(...hoverClasses)\n }\n })\n }\n }, store(sortableContainer).getConfig('throttleTime')))\n // remove class on leave\n _on(sortableContainer, 'mouseleave', () => {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(item => {\n item.classList.remove(...hoverClasses)\n })\n })\n // remove events\n } else {\n _off(sortableContainer, 'mousemove')\n _off(sortableContainer, 'mouseleave')\n }\n }\n}\n","/**\n * make sure a function is only called once within the given amount of time\n * @param {Function} fn the function to throttle\n * @param {number} threshold time limit for throttling\n */\n// must use function to keep this context\nexport default function (fn: Function, threshold: number = 250) {\n // check function\n if (typeof fn !== 'function') {\n throw new Error('You must provide a function as the first argument for throttle.')\n }\n // check threshold\n if (typeof threshold !== 'number') {\n throw new Error('You must provide a number as the second argument for throttle.')\n }\n\n let lastEventTimestamp = null\n\n return (...args) => {\n let now = Date.now()\n if (lastEventTimestamp === null || now - lastEventTimestamp >= threshold) {\n lastEventTimestamp = now\n fn.apply(this, args)\n }\n }\n}\n","/* eslint-env browser */\nimport {addData as _data} from './data' // yuk, data really needs to be refactored\nimport filter from './filter'\nimport index from './index'\n/**\n * Filter only wanted nodes\n * @param {HTMLElement} sortableContainer\n * @param {Function} customSerializer\n * @returns {Array}\n */\nexport default (sortableContainer: HTMLElement, customItemSerializer: Function = (serializedItem: serializedItem, sortableContainer: HTMLElement) => serializedItem, customContainerSerializer: Function = (serializedContainer: object) => serializedContainer): object => {\n // check for valid sortableContainer\n if (!(sortableContainer instanceof HTMLElement) || !sortableContainer.isSortable === true) {\n throw new Error('You need to provide a sortableContainer to be serialized.')\n }\n // check for valid serializers\n if (typeof customItemSerializer !== 'function' || typeof customContainerSerializer !== 'function') {\n throw new Error('You need to provide a valid serializer for items and the container.')\n }\n // get options\n let options = _data(sortableContainer, 'opts')\n\n let item: string|undefined = options.items\n\n // serialize container\n let items = filter(sortableContainer.children, item)\n let serializedItems: serializedItem[] = items.map((item) => {\n return {\n parent: sortableContainer,\n node: item,\n html: item.outerHTML,\n index: index(item, items)\n }\n })\n // serialize container\n let container = {\n node: sortableContainer,\n itemCount: serializedItems.length\n }\n\n return {\n container: customContainerSerializer(container),\n items: serializedItems.map((item: object) => customItemSerializer(item, sortableContainer))\n }\n}\n","/* eslint-env browser */\n/**\n * create a placeholder element\n * @param {HTMLElement} sortableElement a single sortable\n * @param {string|undefined} placeholder a string representing an html element\n * @param {string} placeholderClasses a string representing the classes that should be added to the placeholder\n */\nexport default (sortableElement: HTMLElement, placeholder?: HTMLElement, placeholderClass: string = 'sortable-placeholder') => {\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('You must provide a valid element as a sortable.')\n }\n // if placeholder is not an element\n if (!(placeholder instanceof HTMLElement) && placeholder !== undefined) {\n throw new Error('You must provide a valid element as a placeholder or set ot to undefined.')\n }\n // if no placeholder element is given\n if (placeholder === undefined) {\n if (['UL', 'OL'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('li')\n } else if (['TABLE', 'TBODY'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('tr')\n // set colspan to always all rows, otherwise the item can only be dropped in first column\n placeholder.innerHTML = ''\n } else {\n placeholder = document.createElement('div')\n }\n }\n // add classes to placeholder\n if (typeof placeholderClass === 'string') {\n placeholder.classList.add(...placeholderClass.split(' '))\n }\n\n return placeholder\n}\n","/**\n * Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed\n * @param {Function} func to debounce\n * @param {number} time to wait before calling function with latest arguments, 0 - no debounce\n * @returns {function} - debounced function\n */\nexport default (func: Function, wait: number = 0): Function => {\n let timeout\n return (...args) => {\n clearTimeout(timeout)\n timeout = setTimeout(() => {\n func(...args)\n }, wait)\n }\n}\n"],"names":["element","key","value","undefined","h5s","data","nodes","selector","NodeList","HTMLCollection","Array","Error","from","filter","item","nodeType","matches","stores","Map","this","Object","Store","config","_config","forEach","mergedConfig","assign","entries","has","set","get","_placeholder","placeholder","HTMLElement","_data","delete","sortableElement","eventName","callback","i","length","addEventListener","store","setData","removeEventListener","getData","deleteData","attribute","addAttribute","setAttribute","removeAttribute","parentElement","getClientRects","rect","left","window","scrollX","right","top","scrollY","bottom","elementList","indexOf","parentNode","insertNode","referenceNode","newElement","position","insertBefore","nextElementSibling","target","insertAfter","style","getComputedStyle","map","int","parseInt","getPropertyValue","isNaN","reduce","sum","items","querySelector","defaultDragImage","draggedElement","elementOffset","event","posX","pageX","posY","pageY","destination","origin","isSortable","acceptFrom","getConfig","split","sel","dragging","draggingHeight","originContainer","originIndex","originElementIndex","originItemsBeforeUpdate","destinationItemsBeforeUpdate","connectWith","disableIEFix","copy","placeholderClass","draggingClass","hoverClass","debounce","throttleTime","maxItems","itemSerializer","containerSerializer","customDragImage","sortableContainer","enable","hoverClasses_1","_on","fn","threshold","lastEventTimestamp","_i","args","now","Date","apply","_this","_throttle","buttons","_filter","children","classList","remove","add","_off","_removeItemEvents","_getDragging","draggedItem","sortable","ditem","_attr","cloneNode","appendChild","display","oldDisplay","options","itemlist","ele","contains","_destroySortable","opts","handles","_getHandles","handle","_removeAttr","_removeItemData","_enableSortable","document","createElement","dragDrop","parent","_reloadSortable","sortableElements","method","String","querySelectorAll","prototype","slice","call","test","customItemSerializer","customContainerSerializer","serializedItem","serializedContainer","serializedItems","node","html","outerHTML","index","container","itemCount","_serialize","configKey","hasOwnProperty","console","warn","defaultConfiguration","customPlaceholder","listItems","tempContainer","tagName","innerHTML","includes","_makePlaceholder","enableHoverClass","e","stopImmediatePropagation","getAttribute","findSortable","dragItem","findDragElement","_index","Event","dataTransfer","setDragImage","dragImage","offset","effectAllowed","_getElementHeight","dispatchEvent","CustomEvent","detail","elementIndex","visiblePlaceholder","values","isInDom","_listsConnected","preventDefault","stopPropagation","_after","originItems","destinationContainer","destinationItems","destinationElementIndex","destinationIndex","itemsBeforeUpdate","func","wait","timeout","debouncedDragOverEnter","forcePlaceholderSize","height","thisHeight","placeholderIndex","thisIndex","deadZone","offsetTop","_offset","placeAfter","offsetHeight","_before","placeholders","clearTimeout","setTimeout","onDragOverEnter","dropEffect","concat","destroy","disable","_disableSortable"],"mappings":"qCAQA,WAAkBA,EAAsBC,EAAaC,GACnD,QAAcC,IAAVD,EACF,OAAOF,GAAWA,EAAQI,KAAOJ,EAAQI,IAAIC,MAAQL,EAAQI,IAAIC,KAAKJ,GAEtED,EAAQI,IAAMJ,EAAQI,QACtBJ,EAAQI,IAAIC,KAAOL,EAAQI,IAAIC,SAC/BL,EAAQI,IAAIC,KAAKJ,GAAOC,ECPb,WAACI,EAAmDC,GACjE,KAAMD,aAAiBE,UAAYF,aAAiBG,gBAAkBH,aAAiBI,OACrF,MAAM,IAAIC,MAAM,gFAElB,MAAwB,iBAAbJ,EACFG,MAAME,KAAKN,GAGbI,MAAME,KAAKN,GAAOO,OAAO,SAACC,GAAS,OAAkB,IAAlBA,EAAKC,UAAkBD,EAAKE,QAAQT,KCdzE,IAAIU,EAAkC,IAAIC,iBAK1C,aACGC,aAA4B,IAAID,IAChCC,uBAA6BhB,EAC7BgB,WAA0B,IAAID,IAgHxC,OA1GEE,sBAAIC,0BAcJ,WAEE,IAAIC,KAKJ,OAJAH,KAAKI,QAAQC,QAAQ,SAACtB,EAAOD,GAC3BqB,EAAOrB,GAAOC,IAGToB,OArBT,SAAYA,GACV,GAAsB,iBAAXA,EACT,MAAM,IAAIX,MAAM,uEAGlB,IAAIc,EAAeL,OAAOM,UAAWJ,GAErCH,KAAKI,Q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,GAAayH,EAAgBvL,EAAiB8D,EAAS/C,gBAA0D,SAAxCjB,EAAME,EAAiB,aAArG,CAGA,IAAMgH,EAAUlH,EAAME,EAAiB,QACnCwC,SAASwE,EAAQnC,WAAamB,EAAQhG,EAAgBiG,SAAUnG,EAAME,EAAiB,UAAUI,QAAUoC,SAASwE,EAAQnC,WAAaf,EAAS/C,gBAAkBf,IAGxKkK,EAAEsB,iBACFtB,EAAEuB,kBACFvB,EAAEQ,aAAa0C,YAA0D,IAA7C9M,EAAMN,GAAiB2D,UAAU,QAAmB,OAAS,OACzFyI,EAAuBpM,EAAiBpC,EAASsM,EAAE5G,UAGrD8B,EAAIuE,EAAU0D,OAAOrN,GAAkB,WAAYmN,GACnD/H,EAAIuE,EAAU0D,OAAOrN,GAAkB,YAAamN,KAG/ClF,UAGTxB,EAAS6G,QAAU,SAAUtN,GAC3BoH,EAAiBpH,IAGnByG,EAASvB,OAAS,SAAUlF,GAC1B2H,EAAgB3H,IAGlByG,EAAS8G,QAAU,SAAUvN,IAnZJ,SAAUA,GACjC,IAAMqH,EAAOvH,EAAME,EAAiB,QAE9BsH,EAAUC,EADFvB,EAAQhG,EAAgBiG,SAAUoB,EAAKxE,OAClBwE,EAAKG,QACxCb,EAAM3G,EAAiB,kBAAmB,QAC1CF,EAAME,EAAiB,YAAa,QACpC2G,EAAMW,EAAS,YAAa,SAC5BjB,EAAKiB,EAAS,aA6YdkG,CAAiBxN"} \ No newline at end of file +{"version":3,"file":"html5sortable.min.js","sources":["../src/data.ts","../src/filter.ts","../src/store.ts","../src/eventListener.ts","../src/attribute.ts","../src/offset.ts","../src/index.ts","../src/isInDom.ts","../src/insertHtmlElements.ts","../src/elementHeight.ts","../src/getHandles.ts","../src/setDragImage.ts","../src/isConnected.ts","../src/html5sortable.ts","../src/defaultConfiguration.ts","../src/hoverClass.ts","../src/throttle.ts","../src/serialize.ts","../src/makePlaceholder.ts","../src/debounce.ts"],"sourcesContent":["/**\n * Get or set data on element\n * @param {HTMLElement} element\n * @param {string} key\n * @param {any} value\n * @return {*}\n */\n\nfunction addData (element: HTMLElement, key: string, value?: any): HTMLElement|configuration|string|void {\n if (value === undefined) {\n return element && element.h5s && element.h5s.data && element.h5s.data[key]\n } else {\n element.h5s = element.h5s || {}\n element.h5s.data = element.h5s.data || {}\n element.h5s.data[key] = value\n }\n}\n/**\n * Remove data from element\n * @param {HTMLElement} element\n */\nfunction removeData (element: HTMLElement) {\n if (element.h5s) {\n delete element.h5s.data\n }\n}\n\nexport { addData, removeData }\n","/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {NodeList|HTMLCollection|Array} nodes\n * @param {String} selector\n * @returns {Array}\n */\nexport default (nodes: NodeList|HTMLCollection|Array, selector: string): Array => {\n if (!(nodes instanceof NodeList || nodes instanceof HTMLCollection || nodes instanceof Array)) {\n throw new Error('You must provide a nodeList/HTMLCollection/Array of elements to be filtered.')\n }\n if (typeof selector !== 'string') {\n return Array.from(nodes)\n }\n\n return Array.from(nodes).filter((item) => item.nodeType === 1 && item.matches(selector))\n}\n","/* eslint-env browser */\nexport let stores: Map = new Map()\n/**\n * Stores data & configurations per Sortable\n * @param {Object} config\n */\nexport class Store implements Store {\n private _config: Map = new Map() // eslint-disable-line no-undef\n private _placeholder?: HTMLElement = undefined // eslint-disable-line no-undef\n private _data: Map = new Map() // eslint-disable-line no-undef\n /**\n * set the configuration of a class instance\n * @method config\n * @param {object} config object of configurations\n */\n set config (config: configuration) {\n if (typeof config !== 'object') {\n throw new Error('You must provide a valid configuration object to the config setter.')\n }\n // combine config with default\n let mergedConfig = Object.assign({}, config)\n // add config to map\n this._config = new Map(Object.entries(mergedConfig))\n }\n /**\n * get the configuration map of a class instance\n * @method config\n * @return {object}\n */\n get config (): configuration {\n // transform Map to object\n let config = {}\n this._config.forEach((value, key) => {\n config[key] = value\n })\n // return object\n return config\n }\n /**\n * set individual configuration of a class instance\n * @method setConfig\n * @param key valid configuration key\n * @param value any value\n * @return void\n */\n setConfig (key: string, value: any): void {\n if (!this._config.has(key)) {\n throw new Error(`Trying to set invalid configuration item: ${key}`)\n }\n // set config\n this._config.set(key, value)\n }\n /**\n * get an individual configuration of a class instance\n * @method getConfig\n * @param key valid configuration key\n * @return any configuration value\n */\n getConfig (key: string): any {\n if (!this._config.has(key)) {\n throw new Error(`Invalid configuration item requested: ${key}`)\n }\n return this._config.get(key)\n }\n /**\n * get the placeholder for a class instance\n * @method placeholder\n * @return {HTMLElement|null}\n */\n get placeholder (): HTMLElement {\n return this._placeholder\n }\n /**\n * set the placeholder for a class instance\n * @method placeholder\n * @param {HTMLElement} placeholder\n * @return {void}\n */\n set placeholder (placeholder: HTMLElement): void {\n if (!(placeholder instanceof HTMLElement) && placeholder !== null) {\n throw new Error('A placeholder must be an html element or null.')\n }\n this._placeholder = placeholder\n }\n /**\n * set an data entry\n * @method setData\n * @param {string} key\n * @param {any} value\n * @return {void}\n */\n setData (key: string, value: Function): void {\n if (typeof key !== 'string') {\n throw new Error(`The key must be a string.`)\n }\n this._data.set(key, value)\n }\n /**\n * get an data entry\n * @method getData\n * @param {string} key an existing key\n * @return {any}\n */\n getData (key: string): any {\n if (typeof key !== 'string') {\n throw new Error(`The key must be a string.`)\n }\n return this._data.get(key)\n }\n /**\n * delete an data entry\n * @method deleteData\n * @param {string} key an existing key\n * @return {boolean}\n */\n deleteData (key: string): boolean {\n if (typeof key !== 'string') {\n throw new Error(`The key must be a string.`)\n }\n return this._data.delete(key)\n }\n}\n/**\n * @param {HTMLElement} sortableElement\n * @returns {Class: Store}\n */\nexport default (sortableElement: HTMLElement): Store => {\n // if sortableElement is wrong type\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('Please provide a sortable to the store function.')\n }\n // create new instance if not avilable\n if (!stores.has(sortableElement)) {\n stores.set(sortableElement, new Store())\n }\n // return instance\n return stores.get(sortableElement)\n}\n","import store from './store'\n/**\n * @param {Array|HTMLElement} element\n * @param {Function} callback\n * @param {string} event\n */\nfunction addEventListener (element: Array|HTMLElement, eventName:string, callback: () => void) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addEventListener(element[i], eventName, callback)\n }\n return\n }\n element.addEventListener(eventName, callback)\n store(element).setData(`event${eventName}`, callback)\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} eventName\n */\nfunction removeEventListener (element: Array|HTMLElement, eventName: string) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeEventListener(element[i], eventName)\n }\n return\n }\n element.removeEventListener(eventName, store(element).getData(`event${eventName}`))\n store(element).deleteData(`event${eventName}`)\n}\n\nexport { addEventListener, removeEventListener }\n","/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction addAttribute (element: Array|HTMLElement, attribute:string, value:string) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addAttribute(element[i], attribute, value)\n }\n return\n }\n element.setAttribute(attribute, value)\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n */\nfunction removeAttribute (element: Array|HTMLElement, attribute:string) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeAttribute(element[i], attribute)\n }\n return\n }\n element.removeAttribute(attribute)\n}\n\nexport { addAttribute, removeAttribute }\n","/**\n * @param {HTMLElement} element\n * @returns {Object}\n */\nexport default (element: HTMLElement): offsetObject => {\n if (!element.parentElement || element.getClientRects().length === 0) {\n throw new Error('target element must be part of the dom')\n }\n\n let rect = element.getClientRects()[0]\n return {\n left: rect.left + window.scrollX,\n right: rect.right + window.scrollX,\n top: rect.top + window.scrollY,\n bottom: rect.bottom + window.scrollY\n }\n}\n","/* eslint-env browser */\n/**\n * Get position of the element relatively to its sibling elements\n * @param {HTMLElement} element\n * @returns {number}\n */\nexport default (element: HTMLElement, elementList: HTMLCollection | NodeList | Array): number => {\n if (!(element instanceof HTMLElement) || !(elementList instanceof NodeList || elementList instanceof HTMLCollection || elementList instanceof Array)) {\n throw new Error('You must provide an element and a list of elements.')\n }\n\n return Array.from(elementList).indexOf(element)\n}\n","/* eslint-env browser */\n/**\n * Test whether element is in DOM\n * @param {HTMLElement} element\n * @returns {boolean}\n */\nexport default (element: HTMLElement): boolean => {\n if (!(element instanceof HTMLElement)) {\n throw new Error('Element is not a node element.')\n }\n\n return element.parentNode !== null\n}\n","/* eslint-env browser */\n/**\n * Insert node before or after target\n * @param {HTMLElement} referenceNode - reference element\n * @param {HTMLElement} newElement - element to be inserted\n * @param {String} position - insert before or after reference element\n */\nlet insertNode = (referenceNode: HTMLElement, newElement: HTMLElement, position: String) => {\n if (!(referenceNode instanceof HTMLElement) || !(referenceNode.parentElement instanceof HTMLElement)) {\n throw new Error('target and element must be a node')\n }\n referenceNode.parentElement.insertBefore(\n newElement,\n (position === 'before' ? referenceNode : referenceNode.nextElementSibling)\n )\n}\n/**\n * Insert before target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nlet insertBefore = (target: HTMLElement, element: HTMLElement) => insertNode(target, element, 'before')\n/**\n * Insert after target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nlet insertAfter = (target: HTMLElement, element: HTMLElement) => insertNode(target, element, 'after')\n\nexport { insertBefore, insertAfter }\n","/* eslint-env browser */\n/**\n * Get height of an element including padding\n * @param {HTMLElement} element an dom element\n */\nexport default (element: HTMLElement) => {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element')\n }\n // get calculated style of element\n let style = window.getComputedStyle(element)\n // pick applicable properties, convert to int and reduce by adding\n return ['height', 'padding-top', 'padding-bottom']\n .map((key) => {\n let int = parseInt(style.getPropertyValue(key), 10)\n return isNaN(int) ? 0 : int\n })\n .reduce((sum, value) => sum + value)\n}\n","/* eslint-env browser */\n/**\n * get handle or return item\n * @param {Array} items\n * @param {string} selector\n */\nexport default (items: Array, selector: string): Array => {\n if (!(items instanceof Array)) {\n throw new Error('You must provide a Array of HTMLElements to be filtered.')\n }\n\n if (typeof selector !== 'string') {\n return items\n }\n\n return items\n // remove items without handle from array\n .filter((item: HTMLElement) => {\n return item.querySelector(selector) instanceof HTMLElement\n })\n // replace item with handle in array\n .map((item: HTMLElement) => {\n return item.querySelector(selector)\n })\n}\n","/* eslint-env browser */\nimport {default as offset} from './offset'\n/**\n * defaultDragImage returns the current item as dragged image\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {object} elementOffset - an object with the offsets top, left, right & bottom\n * @param {Event} event - the original drag event object\n * @return {object} with element, posX and posY properties\n */\nlet defaultDragImage = (draggedElement: HTMLElement, elementOffset: offsetObject, event: DragEvent): object => {\n return {\n element: draggedElement,\n posX: event.pageX - elementOffset.left,\n posY: event.pageY - elementOffset.top\n }\n}\n/**\n * attaches an element as the drag image to an event\n * @param {Event} event - the original drag event object\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {Function} customDragImage - function to create a custom dragImage\n * @return void\n */\nexport default (event: DragEvent, draggedElement: HTMLElement, customDragImage: Function): void => {\n // check if event is provided\n if (!(event instanceof Event)) {\n throw new Error('setDragImage requires a DragEvent as the first argument.')\n }\n // check if draggedElement is provided\n if (!(draggedElement instanceof HTMLElement)) {\n throw new Error('setDragImage requires the dragged element as the second argument.')\n }\n // set default function of none provided\n if (!customDragImage) {\n customDragImage = defaultDragImage\n }\n // check if setDragImage method is available\n if (event.dataTransfer && event.dataTransfer.setDragImage) {\n // get the elements offset\n let elementOffset = offset(draggedElement)\n // get the dragImage\n let dragImage = customDragImage(draggedElement, elementOffset, event)\n // check if custom function returns correct values\n if (!(dragImage.element instanceof HTMLElement) || typeof dragImage.posX !== 'number' || typeof dragImage.posY !== 'number') {\n throw new Error('The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].')\n }\n // needs to be set for HTML5 drag & drop to work\n event.dataTransfer.effectAllowed = 'copyMove'\n // Firefox requires arbitrary content in setData for the drag & drop functionality to work\n event.dataTransfer.setData('text/plain', 'arbitrary')\n // set the drag image on the event\n event.dataTransfer.setDragImage(dragImage.element, dragImage.posX, dragImage.posY)\n }\n}\n","import store from './store'\n/**\n * Check if curList accepts items from destList\n * @param {sortable} destination the container an item is move to\n * @param {sortable} origin the container an item comes from\n */\nexport default (destination: sortable, origin: sortable) => {\n // check if valid sortable\n if (destination.isSortable === true) {\n const acceptFrom = store(destination).getConfig('acceptFrom')\n // check if acceptFrom is valid\n if (acceptFrom !== null && acceptFrom !== false && typeof acceptFrom !== 'string') {\n throw new Error('HTML5Sortable: Wrong argument, \"acceptFrom\" must be \"null\", \"false\", or a valid selector string.')\n }\n\n if (acceptFrom !== null) {\n return acceptFrom !== false && acceptFrom.split(',').filter(function (sel) {\n return sel.length > 0 && origin.matches(sel)\n }).length > 0\n }\n // drop in same list\n if (destination === origin) {\n return true\n }\n // check if lists are connected with connectWith\n if (store(destination).getConfig('connectWith') !== undefined && store(destination).getConfig('connectWith') !== null) {\n return store(destination).getConfig('connectWith') === store(origin).getConfig('connectWith')\n }\n }\n return false\n}\n","/* eslint-env browser */\n'use strict'\n\nimport { addData as _data, removeData as _removeData } from './data'\nimport _filter from './filter'\nimport { addEventListener as _on, removeEventListener as _off } from './eventListener'\nimport { addAttribute as _attr, removeAttribute as _removeAttr } from './attribute'\nimport _offset from './offset'\nimport _debounce from './debounce'\nimport _index from './index'\nimport isInDom from './isInDom'\nimport { insertBefore as _before, insertAfter as _after } from './insertHtmlElements'\nimport _serialize from './serialize'\nimport _makePlaceholder from './makePlaceholder'\nimport _getElementHeight from './elementHeight'\nimport _getHandles from './getHandles'\nimport setDragImage from './setDragImage'\nimport {default as store, stores} from './store'\nimport _listsConnected from './isConnected'\nimport defaultConfiguration from './defaultConfiguration'\nimport enableHoverClass from './hoverClass'\n/*\n * variables global to the plugin\n */\nlet dragging\nlet draggingHeight\n\n/*\n * Keeps track of the initialy selected list, where 'dragstart' event was triggered\n * It allows us to move the data in between individual Sortable List instances\n */\n\n// Origin List - data from before any item was changed\nlet originContainer\nlet originIndex\nlet originElementIndex\nlet originItemsBeforeUpdate\n\n// Destination List - data from before any item was changed\nlet destinationItemsBeforeUpdate\n\n/**\n * remove event handlers from items\n * @param {Array|NodeList} items\n */\nconst _removeItemEvents = function (items) {\n _off(items, 'dragstart')\n _off(items, 'dragend')\n _off(items, 'dragover')\n _off(items, 'dragenter')\n _off(items, 'drop')\n _off(items, 'mouseenter')\n _off(items, 'mouseleave')\n}\n/**\n * _getDragging returns the current element to drag or\n * a copy of the element.\n * Is Copy Active for sortable\n * @param {HTMLElement} draggedItem - the item that the user drags\n * @param {HTMLElement} sortable a single sortable\n */\nconst _getDragging = function (draggedItem, sortable) {\n let ditem = draggedItem\n if (store(sortable).getConfig('copy') === true) {\n ditem = draggedItem.cloneNode(true)\n _attr(ditem, 'aria-copied', 'true')\n draggedItem.parentElement.appendChild(ditem)\n ditem.style.display = 'none'\n ditem.oldDisplay = draggedItem.style.display\n }\n return ditem\n}\n/**\n * Remove data from sortable\n * @param {HTMLElement} sortable a single sortable\n */\nconst _removeSortableData = function (sortable) {\n _removeData(sortable)\n _removeAttr(sortable, 'aria-dropeffect')\n}\n/**\n * Remove data from items\n * @param {Array|HTMLElement} items\n */\nconst _removeItemData = function (items) {\n _removeAttr(items, 'aria-grabbed')\n _removeAttr(items, 'aria-copied')\n _removeAttr(items, 'draggable')\n _removeAttr(items, 'role')\n}\n/**\n * find sortable from element. travels up parent element until found or null.\n * @param {HTMLElement} element a single sortable\n */\nfunction findSortable (element) {\n while (element.isSortable !== true) {\n element = element.parentElement\n }\n return element\n}\n/**\n * Dragging event is on the sortable element. finds the top child that\n * contains the element.\n * @param {HTMLElement} sortableElement a single sortable\n * @param {HTMLElement} element is that being dragged\n */\nfunction findDragElement (sortableElement, element) {\n const options = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, options.items)\n const itemlist = items.filter(function (ele) {\n return ele.contains(element)\n })\n\n return itemlist.length > 0 ? itemlist[0] : element\n}\n/**\n * Destroy the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nconst _destroySortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts') || {}\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n // remove event handlers & data from sortable\n _off(sortableElement, 'dragover')\n _off(sortableElement, 'dragenter')\n _off(sortableElement, 'drop')\n // remove event data from sortable\n _removeSortableData(sortableElement)\n // remove event handlers & data from items\n _off(handles, 'mousedown')\n _removeItemEvents(items)\n _removeItemData(items)\n}\n/**\n * Enable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nconst _enableSortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n _attr(sortableElement, 'aria-dropeffect', 'move')\n _data(sortableElement, '_disabled', 'false')\n _attr(handles, 'draggable', 'true')\n // @todo: remove this fix\n // IE FIX for ghost\n // can be disabled as it has the side effect that other events\n // (e.g. click) will be ignored\n if (opts.disableIEFix === false) {\n const spanEl = (document || window.document).createElement('span')\n if (typeof spanEl.dragDrop === 'function') {\n _on(handles, 'mousedown', function () {\n if (items.indexOf(this) !== -1) {\n this.dragDrop()\n } else {\n let parent = this.parentElement\n while (items.indexOf(parent) === -1) {\n parent = parent.parentElement\n }\n parent.dragDrop()\n }\n })\n }\n }\n}\n/**\n * Disable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nconst _disableSortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n _attr(sortableElement, 'aria-dropeffect', 'none')\n _data(sortableElement, '_disabled', 'true')\n _attr(handles, 'draggable', 'false')\n _off(handles, 'mousedown')\n}\n/**\n * Reload the sortable\n * @param {HTMLElement} sortableElement a single sortable\n * @description events need to be removed to not be double bound\n */\nconst _reloadSortable = function (sortableElement) {\n const opts = _data(sortableElement, 'opts')\n const items = _filter(sortableElement.children, opts.items)\n const handles = _getHandles(items, opts.handle)\n _data(sortableElement, '_disabled', 'false')\n // remove event handlers from items\n _removeItemEvents(items)\n _off(handles, 'mousedown')\n // remove event handlers from sortable\n _off(sortableElement, 'dragover')\n _off(sortableElement, 'dragenter')\n _off(sortableElement, 'drop')\n}\n\n/**\n * Public sortable object\n * @param {Array|NodeList} sortableElements\n * @param {object|string} options|method\n */\nexport default function sortable (sortableElements, options: object|string|undefined): sortable {\n // get method string to see if a method is called\n const method = String(options)\n // merge user options with defaultss\n options = Object.assign({\n connectWith: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n disableIEFix: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n debounce: 0,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null,\n items: null\n // if options is an object, merge it, otherwise use empty object\n }, (typeof options === 'object') ? options : {})\n // check if the user provided a selector instead of an element\n if (typeof sortableElements === 'string') {\n sortableElements = document.querySelectorAll(sortableElements)\n }\n // if the user provided an element, return it in an array to keep the return value consistant\n if (sortableElements instanceof HTMLElement) {\n sortableElements = [sortableElements]\n }\n\n sortableElements = Array.prototype.slice.call(sortableElements)\n\n if (/serialize/.test(method)) {\n return sortableElements.map((sortableContainer) => {\n let opts = _data(sortableContainer, 'opts')\n return _serialize(sortableContainer, opts.itemSerializer, opts.containerSerializer)\n })\n }\n\n sortableElements.forEach(function (sortableElement) {\n if (/enable|disable|destroy/.test(method)) {\n return sortable[method](sortableElement)\n }\n // log deprecation\n ['connectWith', 'disableIEFix'].forEach((configKey) => {\n if (options.hasOwnProperty(configKey) && options[configKey] !== null) {\n console.warn(`HTML5Sortable: You are using the deprecated configuration \"${configKey}\". This will be removed in an upcoming version, make sure to migrate to the new options when updating.`)\n }\n })\n // merge options with default options\n options = Object.assign({}, defaultConfiguration, options)\n // init data store for sortable\n store(sortableElement).config = options\n // get options & set options on sortable\n options = _data(sortableElement, 'opts') || options\n _data(sortableElement, 'opts', options)\n // property to define as sortable\n sortableElement.isSortable = true\n // reset sortable\n _reloadSortable(sortableElement)\n // initialize\n const listItems = _filter(sortableElement.children, options.items)\n // create element if user defined a placeholder element as a string\n let customPlaceholder\n if (options.placeholder !== null && options.placeholder !== undefined) {\n let tempContainer = document.createElement(sortableElement.tagName)\n tempContainer.innerHTML = options.placeholder\n customPlaceholder = tempContainer.children[0]\n }\n // add placeholder\n store(sortableElement).placeholder = _makePlaceholder(sortableElement, customPlaceholder, options.placeholderClass)\n\n _data(sortableElement, 'items', options.items)\n\n if (options.acceptFrom) {\n _data(sortableElement, 'acceptFrom', options.acceptFrom)\n } else if (options.connectWith) {\n _data(sortableElement, 'connectWith', options.connectWith)\n }\n\n _enableSortable(sortableElement)\n _attr(listItems, 'role', 'option')\n _attr(listItems, 'aria-grabbed', 'false')\n // enable hover class\n enableHoverClass(sortableElement, true)\n /*\n Handle drag events on draggable items\n Handle is set at the sortableElement level as it will bubble up\n from the item\n */\n _on(sortableElement, 'dragstart', function (e) {\n // ignore dragstart events\n if (e.target.isSortable === true) {\n return\n }\n e.stopImmediatePropagation()\n\n if ((options.handle && !e.target.matches(options.handle)) || e.target.getAttribute('draggable') === 'false') {\n return\n }\n\n const sortableContainer = findSortable(e.target)\n const dragItem = findDragElement(sortableContainer, e.target)\n\n // grab values\n originItemsBeforeUpdate = _filter(sortableContainer.children, options.items)\n originIndex = originItemsBeforeUpdate.indexOf(dragItem)\n originElementIndex = _index(dragItem, sortableContainer.children)\n originContainer = sortableContainer\n\n // add transparent clone or other ghost to cursor\n setDragImage(e, dragItem, options.customDragImage)\n // cache selsection & add attr for dragging\n draggingHeight = _getElementHeight(dragItem)\n dragItem.classList.add(options.draggingClass)\n dragging = _getDragging(dragItem, sortableContainer)\n _attr(dragging, 'aria-grabbed', 'true')\n\n // dispatch sortstart event on each element in group\n sortableContainer.dispatchEvent(new CustomEvent('sortstart', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }))\n })\n\n /*\n We are capturing targetSortable before modifications with 'dragenter' event\n */\n _on(sortableElement, 'dragenter', (e) => {\n if (e.target.isSortable === true) {\n return\n }\n const sortableContainer = findSortable(e.target)\n destinationItemsBeforeUpdate = _filter(sortableContainer.children, _data(sortableContainer, 'items'))\n .filter(item => item !== store(sortableElement).placeholder)\n })\n /*\n * Dragend Event - https://developer.mozilla.org/en-US/docs/Web/Events/dragend\n * Fires each time dragEvent end, or ESC pressed\n * We are using it to clean up any draggable elements and placeholders\n */\n _on(sortableElement, 'dragend', function (e) {\n if (!dragging) {\n return\n }\n\n dragging.classList.remove(options.draggingClass)\n _attr(dragging, 'aria-grabbed', 'false')\n\n if (dragging.getAttribute('aria-copied') === 'true' && _data(dragging, 'dropped') !== 'true') {\n dragging.remove()\n }\n\n dragging.style.display = dragging.oldDisplay\n delete dragging.oldDisplay\n\n const visiblePlaceholder = Array.from(stores.values()).map(data => data.placeholder)\n .filter(placeholder => placeholder instanceof HTMLElement)\n .filter(isInDom)[0]\n\n if (visiblePlaceholder) {\n visiblePlaceholder.remove()\n }\n\n // dispatch sortstart event on each element in group\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }))\n\n dragging = null\n draggingHeight = null\n })\n\n /*\n * Drop Event - https://developer.mozilla.org/en-US/docs/Web/Events/drop\n * Fires when valid drop target area is hit\n */\n _on(sortableElement, 'drop', function (e) {\n if (!_listsConnected(sortableElement, dragging.parentElement)) {\n return\n }\n e.preventDefault()\n e.stopPropagation()\n\n _data(dragging, 'dropped', 'true')\n // get the one placeholder that is currently visible\n const visiblePlaceholder = Array.from(stores.values()).map((data) => {\n return data.placeholder\n })\n // filter only HTMLElements\n .filter(placeholder => placeholder instanceof HTMLElement)\n // filter only elements in DOM\n .filter(isInDom)[0]\n // attach element after placeholder\n _after(visiblePlaceholder, dragging)\n // remove placeholder from dom\n visiblePlaceholder.remove()\n\n /*\n * Fires Custom Event - 'sortstop'\n */\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }))\n\n const placeholder = store(sortableElement).placeholder\n const originItems = _filter(originContainer.children, options.items)\n .filter(item => item !== placeholder)\n const destinationContainer = this.isSortable === true ? this : this.parentElement\n const destinationItems = _filter(destinationContainer.children, _data(destinationContainer, 'items'))\n .filter(item => item !== placeholder)\n const destinationElementIndex = _index(dragging, Array.from(dragging.parentElement.children)\n .filter(item => item !== placeholder))\n const destinationIndex = _index(dragging, destinationItems)\n\n /*\n * When a list item changed container lists or index within a list\n * Fires Custom Event - 'sortupdate'\n */\n if (originElementIndex !== destinationElementIndex || originContainer !== destinationContainer) {\n sortableElement.dispatchEvent(new CustomEvent('sortupdate', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer,\n itemsBeforeUpdate: originItemsBeforeUpdate,\n items: originItems\n },\n destination: {\n index: destinationIndex,\n elementIndex: destinationElementIndex,\n container: destinationContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate,\n items: destinationItems\n },\n item: dragging\n }\n }))\n }\n })\n\n const debouncedDragOverEnter = _debounce((sortableElement, element, pageY) => {\n if (!dragging) {\n return\n }\n\n // set placeholder height if forcePlaceholderSize option is set\n if (options.forcePlaceholderSize) {\n store(sortableElement).placeholder.style.height = draggingHeight + 'px'\n }\n // if element the draggedItem is dragged onto is within the array of all elements in list\n // (not only items, but also disabled, etc.)\n if (Array.from(sortableElement.children).indexOf(element) > -1) {\n const thisHeight = _getElementHeight(element)\n const placeholderIndex = _index(store(sortableElement).placeholder, element.parentElement.children)\n const thisIndex = _index(element, element.parentElement.children)\n // Check if `element` is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering\n if (thisHeight > draggingHeight) {\n // Dead zone?\n const deadZone = thisHeight - draggingHeight\n const offsetTop = _offset(element).top\n if (placeholderIndex < thisIndex && pageY < offsetTop) {\n return\n }\n if (placeholderIndex > thisIndex &&\n pageY > offsetTop + thisHeight - deadZone) {\n return\n }\n }\n\n if (dragging.oldDisplay === undefined) {\n dragging.oldDisplay = dragging.style.display\n }\n\n if (dragging.style.display !== 'none') {\n dragging.style.display = 'none'\n }\n // To avoid flicker, determine where to position the placeholder\n // based on where the mouse pointer is relative to the elements\n // vertical center.\n let placeAfter = false\n try {\n let elementMiddle = _offset(element).top + element.offsetHeight / 2\n placeAfter = pageY >= elementMiddle\n } catch (e) {\n placeAfter = placeholderIndex < thisIndex\n }\n\n if (placeAfter) {\n _after(element, store(sortableElement).placeholder)\n } else {\n _before(element, store(sortableElement).placeholder)\n }\n // get placeholders from all stores & remove all but current one\n Array.from(stores.values())\n // remove empty values\n .filter(data => data.placeholder !== undefined)\n // foreach placeholder in array if outside of current sorableContainer -> remove from DOM\n .forEach((data) => {\n if (data.placeholder !== store(sortableElement).placeholder) {\n data.placeholder.remove()\n }\n })\n } else {\n // get all placeholders from store\n let placeholders = Array.from(stores.values())\n .filter((data) => data.placeholder !== undefined)\n .map((data) => {\n return data.placeholder\n })\n // check if element is not in placeholders\n if (placeholders.indexOf(element) === -1 && sortableElement === element && !_filter(element.children, options.items).length) {\n placeholders.forEach((element) => element.remove())\n element.appendChild(store(sortableElement).placeholder)\n }\n }\n }, options.debounce)\n // Handle dragover and dragenter events on draggable items\n const onDragOverEnter = function (e) {\n let element = e.target\n const sortableElement = element.isSortable === true ? element : findSortable(element)\n element = findDragElement(sortableElement, element)\n if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || _data(sortableElement, '_disabled') === 'true') {\n return\n }\n const options = _data(sortableElement, 'opts')\n if (parseInt(options.maxItems) && _filter(sortableElement.children, _data(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {\n return\n }\n e.preventDefault()\n e.stopPropagation()\n e.dataTransfer.dropEffect = store(sortableElement).getConfig('copy') === true ? 'copy' : 'move'\n debouncedDragOverEnter(sortableElement, element, e.pageY)\n }\n\n _on(listItems.concat(sortableElement), 'dragover', onDragOverEnter)\n _on(listItems.concat(sortableElement), 'dragenter', onDragOverEnter)\n })\n\n return sortableElements\n}\n\nsortable.destroy = function (sortableElement) {\n _destroySortable(sortableElement)\n}\n\nsortable.enable = function (sortableElement) {\n _enableSortable(sortableElement)\n}\n\nsortable.disable = function (sortableElement) {\n _disableSortable(sortableElement)\n}\n\n/* START.TESTS_ONLY */\nsortable.__testing = {\n // add internal methods here for testing purposes\n _data: _data,\n _removeItemEvents: _removeItemEvents,\n _removeItemData: _removeItemData,\n _removeSortableData: _removeSortableData\n}\n/* END.TESTS_ONLY */\n","/**\n * default configurations\n */\nexport default {\n items: null,\n // deprecated\n connectWith: null,\n // deprecated\n disableIEFix: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n debounce: 0,\n throttleTime: 100,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null\n}\n","/* eslint-env browser */\nimport store from './store'\nimport _filter from './filter'\nimport _throttle from './throttle'\nimport { addEventListener as _on, removeEventListener as _off } from './eventListener'\n/**\n * enable or disable hoverClass on mouseenter/leave if container Items\n * @param {sortable} sortableContainer a valid sortableContainer\n * @param {boolean} enable enable or disable event\n */\n// export default (sortableContainer: sortable, enable: boolean) => {\nexport default (sortableContainer: sortable, enable: boolean) => {\n if (typeof store(sortableContainer).getConfig('hoverClass') === 'string') {\n let hoverClasses = store(sortableContainer).getConfig('hoverClass').split(' ')\n // add class on hover\n if (enable === true) {\n _on(sortableContainer, 'mousemove', _throttle((event) => {\n // check of no mouse button was pressed when mousemove started == no drag\n if (event.buttons === 0) {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(item => {\n if (item !== event.target) {\n item.classList.remove(...hoverClasses)\n } else {\n item.classList.add(...hoverClasses)\n }\n })\n }\n }, store(sortableContainer).getConfig('throttleTime')))\n // remove class on leave\n _on(sortableContainer, 'mouseleave', () => {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(item => {\n item.classList.remove(...hoverClasses)\n })\n })\n // remove events\n } else {\n _off(sortableContainer, 'mousemove')\n _off(sortableContainer, 'mouseleave')\n }\n }\n}\n","/**\n * make sure a function is only called once within the given amount of time\n * @param {Function} fn the function to throttle\n * @param {number} threshold time limit for throttling\n */\n// must use function to keep this context\nexport default function (fn: Function, threshold: number = 250) {\n // check function\n if (typeof fn !== 'function') {\n throw new Error('You must provide a function as the first argument for throttle.')\n }\n // check threshold\n if (typeof threshold !== 'number') {\n throw new Error('You must provide a number as the second argument for throttle.')\n }\n\n let lastEventTimestamp = null\n\n return (...args) => {\n let now = Date.now()\n if (lastEventTimestamp === null || now - lastEventTimestamp >= threshold) {\n lastEventTimestamp = now\n fn.apply(this, args)\n }\n }\n}\n","/* eslint-env browser */\nimport {addData as _data} from './data' // yuk, data really needs to be refactored\nimport filter from './filter'\nimport index from './index'\n/**\n * Filter only wanted nodes\n * @param {HTMLElement} sortableContainer\n * @param {Function} customSerializer\n * @returns {Array}\n */\nexport default (sortableContainer: HTMLElement, customItemSerializer: Function = (serializedItem: serializedItem, sortableContainer: HTMLElement) => serializedItem, customContainerSerializer: Function = (serializedContainer: object) => serializedContainer): object => {\n // check for valid sortableContainer\n if (!(sortableContainer instanceof HTMLElement) || !sortableContainer.isSortable === true) {\n throw new Error('You need to provide a sortableContainer to be serialized.')\n }\n // check for valid serializers\n if (typeof customItemSerializer !== 'function' || typeof customContainerSerializer !== 'function') {\n throw new Error('You need to provide a valid serializer for items and the container.')\n }\n // get options\n let options = _data(sortableContainer, 'opts')\n\n let item: string|undefined = options.items\n\n // serialize container\n let items = filter(sortableContainer.children, item)\n let serializedItems: serializedItem[] = items.map((item) => {\n return {\n parent: sortableContainer,\n node: item,\n html: item.outerHTML,\n index: index(item, items)\n }\n })\n // serialize container\n let container = {\n node: sortableContainer,\n itemCount: serializedItems.length\n }\n\n return {\n container: customContainerSerializer(container),\n items: serializedItems.map((item: object) => customItemSerializer(item, sortableContainer))\n }\n}\n","/* eslint-env browser */\n/**\n * create a placeholder element\n * @param {HTMLElement} sortableElement a single sortable\n * @param {string|undefined} placeholder a string representing an html element\n * @param {string} placeholderClasses a string representing the classes that should be added to the placeholder\n */\nexport default (sortableElement: HTMLElement, placeholder?: HTMLElement, placeholderClass: string = 'sortable-placeholder') => {\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('You must provide a valid element as a sortable.')\n }\n // if placeholder is not an element\n if (!(placeholder instanceof HTMLElement) && placeholder !== undefined) {\n throw new Error('You must provide a valid element as a placeholder or set ot to undefined.')\n }\n // if no placeholder element is given\n if (placeholder === undefined) {\n if (['UL', 'OL'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('li')\n } else if (['TABLE', 'TBODY'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('tr')\n // set colspan to always all rows, otherwise the item can only be dropped in first column\n placeholder.innerHTML = ''\n } else {\n placeholder = document.createElement('div')\n }\n }\n // add classes to placeholder\n if (typeof placeholderClass === 'string') {\n placeholder.classList.add(...placeholderClass.split(' '))\n }\n\n return placeholder\n}\n","/**\n * Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed\n * @param {Function} func to debounce\n * @param {number} time to wait before calling function with latest arguments, 0 - no debounce\n * @returns {function} - debounced function\n */\nexport default (func: Function, wait: number = 0): Function => {\n let timeout\n return (...args) => {\n clearTimeout(timeout)\n timeout = setTimeout(() => {\n func(...args)\n }, wait)\n }\n}\n"],"names":["element","key","value","undefined","h5s","data","nodes","selector","NodeList","HTMLCollection","Array","Error","from","filter","item","nodeType","matches","stores","Map","this","Object","Store","config","_config","forEach","mergedConfig","assign","entries","has","set","get","_placeholder","placeholder","HTMLElement","_data","delete","sortableElement","eventName","callback","i","length","addEventListener","store","setData","removeEventListener","getData","deleteData","attribute","addAttribute","setAttribute","removeAttribute","parentElement","getClientRects","rect","left","window","scrollX","right","top","scrollY","bottom","elementList","indexOf","parentNode","insertNode","referenceNode","newElement","position","insertBefore","nextElementSibling","target","insertAfter","style","getComputedStyle","map","int","parseInt","getPropertyValue","isNaN","reduce","sum","items","querySelector","defaultDragImage","draggedElement","elementOffset","event","posX","pageX","posY","pageY","destination","origin","isSortable","acceptFrom","getConfig","split","sel","dragging","draggingHeight","originContainer","originIndex","originElementIndex","originItemsBeforeUpdate","destinationItemsBeforeUpdate","connectWith","disableIEFix","copy","placeholderClass","draggingClass","hoverClass","debounce","throttleTime","maxItems","itemSerializer","containerSerializer","customDragImage","sortableContainer","enable","hoverClasses_1","_on","fn","threshold","lastEventTimestamp","_i","args","now","Date","apply","_this","_throttle","buttons","_filter","children","classList","remove","add","_off","_removeItemEvents","_getDragging","draggedItem","sortable","ditem","_attr","cloneNode","appendChild","display","oldDisplay","options","itemlist","ele","contains","_destroySortable","opts","handles","_getHandles","handle","_removeAttr","_removeItemData","_enableSortable","document","createElement","dragDrop","parent","_reloadSortable","sortableElements","method","String","querySelectorAll","prototype","slice","call","test","customItemSerializer","customContainerSerializer","serializedItem","serializedContainer","serializedItems","node","html","outerHTML","index","container","itemCount","_serialize","configKey","hasOwnProperty","console","warn","defaultConfiguration","customPlaceholder","listItems","tempContainer","tagName","innerHTML","includes","_makePlaceholder","enableHoverClass","e","stopImmediatePropagation","getAttribute","findSortable","dragItem","findDragElement","_index","Event","dataTransfer","setDragImage","dragImage","offset","effectAllowed","_getElementHeight","dispatchEvent","CustomEvent","detail","elementIndex","visiblePlaceholder","values","isInDom","_listsConnected","preventDefault","stopPropagation","_after","originItems","destinationContainer","destinationItems","destinationElementIndex","destinationIndex","itemsBeforeUpdate","func","wait","timeout","debouncedDragOverEnter","forcePlaceholderSize","height","thisHeight","placeholderIndex","thisIndex","deadZone","offsetTop","_offset","placeAfter","offsetHeight","_before","placeholders","clearTimeout","setTimeout","onDragOverEnter","dropEffect","concat","destroy","disable","_disableSortable"],"mappings":"qCAQA,WAAkBA,EAAsBC,EAAaC,GACnD,QAAcC,IAAVD,EACF,OAAO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,EAAU0D,OAAOrN,GAAkB,YAAamN,KAG/ClF,UAGTxB,EAAS6G,QAAU,SAAUtN,GAC3BoH,EAAiBpH,IAGnByG,EAASvB,OAAS,SAAUlF,GAC1B2H,EAAgB3H,IAGlByG,EAAS8G,QAAU,SAAUvN,IApZJ,SAAUA,GACjC,IAAMqH,EAAOvH,EAAME,EAAiB,QAE9BsH,EAAUC,EADFvB,EAAQhG,EAAgBiG,SAAUoB,EAAKxE,OAClBwE,EAAKG,QACxCb,EAAM3G,EAAiB,kBAAmB,QAC1CF,EAAME,EAAiB,YAAa,QACpC2G,EAAMW,EAAS,YAAa,SAC5BjB,EAAKiB,EAAS,aA8YdkG,CAAiBxN"} \ No newline at end of file diff --git a/docs/html5sortable.js b/docs/html5sortable.js index d60878c1..0a165f09 100644 --- a/docs/html5sortable.js +++ b/docs/html5sortable.js @@ -1020,12 +1020,13 @@ var sortable = (function () { // To avoid flicker, determine where to position the placeholder // based on where the mouse pointer is relative to the elements // vertical center. + var placeAfter = false; try { var elementMiddle = offset(element).top + element.offsetHeight / 2; - var placeAfter = pageY >= elementMiddle; + placeAfter = pageY >= elementMiddle; } catch (e) { - var placeAfter = placeholderIndex < thisIndex; + placeAfter = placeholderIndex < thisIndex; } if (placeAfter) { insertAfter(element, store(sortableElement).placeholder); diff --git a/package-lock.json b/package-lock.json index 94bca12e..125c3e38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "html5sortable", - "version": "0.9.2", + "version": "0.9.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 49767912..0c820413 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "main": "dist/html5sortable.js", "file": "src/html5sortable.ts", "dest": "dist", - "version": "0.9.2", + "version": "0.9.3", "license": "MIT", "description": "VanillaJS sortable lists and grids using native HTML5 drag and drop API.", "author": {