| 1 |
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.dragula=e()}}(function(){return function e(n,t,r){function o(u,a){if(!t[u]){if(!n[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var f=t[u]={exports:{}};n[u][0].call(f.exports,function(e){var t=n[u][1][e];return o(t?t:e)},f,f.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,n,t){"use strict";function r(e){var n=u[e];return n?n.lastIndex=0:u[e]=n=new RegExp(a+e+c,"g"),n}function o(e,n){var t=e.className;t.length?r(n).test(t)||(e.className+=" "+n):e.className=n}function i(e,n){e.className=e.className.replace(r(n)," ").trim()}var u={},a="(?:^|\\s)",c="(?:\\s|$)";n.exports={add:o,rm:i}},{}],2:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==se.containers.indexOf(e)||fe.isContainer(e)}function r(e){var n=e?"remove":"add";o(S,n,"mousedown",T),o(S,n,"mouseup",j)}function a(e){var n=e?"remove":"add";o(S,n,"mousemove",N)}function p(e){var n=e?"remove":"add";E[n](S,"selectstart",O),E[n](S,"click",O)}function y(){r(!0),j({})}function O(e){ce&&e.preventDefault()}function T(e){te=e.clientX,re=e.clientY;var n=1!==i(e)||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=B(t);r&&(ce=r,a(),"mousedown"===e.type&&(m(t)?t.focus():e.preventDefault()))}}function N(e){if(ce){if(0===i(e))return void j({});if(void 0===e.clientX||e.clientX!==te||void 0===e.clientY||e.clientY!==re){if(fe.ignoreInputTextSelection){var n=b("clientX",e),t=b("clientY",e),r=x.elementFromPoint(n,t);if(m(r))return}var o=ce;a(!0),p(),D(),R(o);var c=u(Z);ee=b("pageX",e)-c.left,ne=b("pageY",e)-c.top,C.add(ue||Z,"gu-transit"),K(),_(e)}}}function B(e){if(!(se.dragging&&J||t(e))){for(var n=e;v(e)&&t(v(e))===!1;){if(fe.invalid(e,n))return;if(e=v(e),!e)return}var r=v(e);if(r&&!(fe.staticClass&&e.classList.contains(fe.staticClass)||fe.invalid(e,n))){var o=fe.moves(e,r,n,g(e));if(o)return{item:e,source:r}}}}function X(e){return!!B(e)}function P(e){var n=B(e);n&&R(n)}function R(e){$(e.item,e.source)&&(ue=e.item.cloneNode(!0),se.emit("cloned",ue,e.item,"copy")),Q=e.source,Z=e.item,oe=ie=g(e.item),se.dragging=!0,se.emit("drag",Z,Q)}function Y(){return!1}function D(){if(se.dragging){var e=ue||Z;I(e,v(e))}}function L(){ce=!1,a(!0),p(!0)}function j(e){if(L(),se.dragging){var n=ue||Z,t=b("clientX",e),r=b("clientY",e),o=c(J,t,r),i=U(o,t,r);i&&(ue&&fe.copySortSource||!ue||i!==Q)?I(n,i):fe.removeOnSpill?M():A()}}function I(e,n){var t=v(e);ue&&fe.copySortSource&&n===Q&&t.removeChild(Z),q(n)?se.emit("cancel",e,Q,Q):se.emit("drop",e,n,Q,ie),k()}function M(){if(se.dragging){var e=ue||Z,n=v(e);n&&n.removeChild(e),se.emit(ue?"cancel":"remove",e,n,Q),k()}}function A(e){if(se.dragging){var n=arguments.length>0?e:fe.revertOnSpill,t=ue||Z,r=v(t),o=q(r);o===!1&&n&&(ue?r&&r.removeChild(ue):Q.insertBefore(t,oe)),o||n?se.emit("cancel",t,Q,Q):se.emit("drop",t,r,Q,ie),k()}}function k(){var e=ue||Z;L(),H(),e&&C.rm(e,"gu-transit"),ae&&clearTimeout(ae),se.dragging=!1,le&&se.emit("out",e,le,Q),se.emit("dragend",e),Q=Z=ue=oe=ie=ae=le=null}function q(e,n){var t;return t=void 0!==n?n:J?ie:g(ue||Z),e===Q&&t===oe}function U(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var u=V(i,e),a=W(i,u,n,r),c=q(i,a);return c?!0:fe.accepts(Z,i,Q,a)}for(var i=e;i&&!o();)i=v(i);return i}function _(e){function n(e){se.emit(e,l,le,Q)}function t(){d&&n("over")}function r(){le&&n("out")}if(J){e.preventDefault();var o=b("clientX",e),i=b("clientY",e),u=o-ee,a=i-ne;J.style.left=u+"px",J.style.top=a+"px";var l=ue||Z,f=c(J,o,i),s=U(f,o,i),d=null!==s&&s!==le;(d||null===s)&&(r(),le=s,t());var m=v(l);if(s===Q&&ue&&!fe.copySortSource)return void(m&&m.removeChild(l));var p,y=V(s,f);if(null!==y)p=W(s,y,o,i);else{if(fe.revertOnSpill!==!0||ue)return void(ue&&m&&m.removeChild(l));p=oe,s=Q}if(null===p&&d||p!==l&&p!==g(l)){ie=p;var w,E=l.getBoundingClientRect(),C=p?p.getBoundingClientRect():null,x=fe.direction;w=C?"horizontal"===x?E.x<C.x:E.y<C.y:!0;var S;if(S=w?p?p.previousElementSibling?p.previousElementSibling:p:s.lastElementChild:p,!S)return;if(fe.staticClass&&S.classList.contains(fe.staticClass))return;var O=S&&S.getBoundingClientRect();s.insertBefore(l,p),S&&O&&(h(O,S),h(E,l)),se.emit("shadow",l,s,Q)}}}function F(e){C.rm(e,"gu-hide")}function z(e){se.dragging&&C.add(e,"gu-hide")}function K(){if(!J){var e=Z.getBoundingClientRect();J=Z.cloneNode(!0),J.style.width=s(e)+"px",J.style.height=d(e)+"px",C.rm(J,"gu-transit"),C.add(J,"gu-mirror"),fe.mirrorContainer.appendChild(J),o(S,"add","mousemove",_),C.add(fe.mirrorContainer,"gu-unselectable"),se.emit("cloned",J,Z,"mirror")}}function H(){J&&(C.rm(fe.mirrorContainer,"gu-unselectable"),o(S,"remove","mousemove",_),v(J).removeChild(J),J=null)}function V(e,n){for(var t=n;t!==e&&v(t)!==e;)t=v(t);return t===S?null:t}function W(e,n,t,r){function o(){var n,o,i,u=e.children.length;for(n=0;u>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),a&&i.left+i.width/2>t)return o;if(!a&&i.top+i.height/2>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(a?t>e.left+s(e)/2:r>e.top+d(e)/2)}function u(e){return e?g(n):n}var a="horizontal"===fe.direction,c=n!==e?i():o();return c}function $(e,n){return"boolean"==typeof fe.copy?fe.copy:fe.copy(e,n)}var G=arguments.length;1===G&&Array.isArray(e)===!1&&(n=e,e=[]);var J,Q,Z,ee,ne,te,re,oe,ie,ue,ae,ce,le=null,fe=n||{};void 0===fe.moves&&(fe.moves=f),void 0===fe.accepts&&(fe.accepts=f),void 0===fe.invalid&&(fe.invalid=Y),void 0===fe.containers&&(fe.containers=e||[]),void 0===fe.isContainer&&(fe.isContainer=l),void 0===fe.copy&&(fe.copy=!1),void 0===fe.copySortSource&&(fe.copySortSource=!1),void 0===fe.revertOnSpill&&(fe.revertOnSpill=!1),void 0===fe.removeOnSpill&&(fe.removeOnSpill=!1),void 0===fe.direction&&(fe.direction="vertical"),void 0===fe.ignoreInputTextSelection&&(fe.ignoreInputTextSelection=!0),void 0===fe.mirrorContainer&&(fe.mirrorContainer=x.body),void 0===fe.staticClass&&(fe.staticClass="");var se=w({containers:fe.containers,start:P,end:D,cancel:A,remove:M,destroy:y,canMove:X,dragging:!1});return fe.removeOnSpill===!0&&se.on("over",F).on("out",z),r(),se}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},u={mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.pointerEnabled?E[n](e,u[r],o):t.navigator.msPointerEnabled?E[n](e,a[r],o):(E[n](e,i[r],o),E[n](e,r,o))}function i(e){if(void 0!==e.touches)return e.touches.length;if(void 0!==e.which&&0!==e.which)return e.which;if(void 0!==e.buttons)return e.buttons;var n=e.button;return void 0!==n?1&n?1:2&n?3:4&n?2:0:void 0}function u(e){var n=e.getBoundingClientRect();return{left:n.left+a("scrollLeft","pageXOffset"),top:n.top+a("scrollTop","pageYOffset")}}function a(e,n){return"undefined"!=typeof t[n]?t[n]:S.clientHeight?S[e]:x.body[e]}function c(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=x.elementFromPoint(n,t),o.className=i,r}function l(){return!1}function f(){return!0}function s(e){return e.width||e.right-e.left}function d(e){return e.height||e.bottom-e.top}function v(e){return e.parentNode===x?null:e.parentNode}function m(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||p(e)}function p(e){return e?"false"===e.contentEditable?!1:"true"===e.contentEditable?!0:p(v(e)):!1}function g(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function h(e,n){if(e&&n){var t=n.getBoundingClientRect(),r={transition:n.style.transition,transform:n.style.transform};Object.assign(n.style,{transition:"none",transform:"translate("+(e.left-t.left)+"px,"+(e.top-t.top)+"px)"}),n.offsetWidth,Object.assign(n.style,{transition:"all "+O+"ms",transform:"translate(0,0)"}),clearTimeout(n.animated),n.animated=setTimeout(function(){Object.assign(n.style,{originProps:r}),n.animated=!1},O)}}function y(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function b(e,n){var t=y(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}var w=e("contra/emitter"),E=e("crossvent"),C=e("./classes"),x=document,S=x.documentElement,O=300;n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":1,"contra/emitter":5,crossvent:6}],3:[function(e,n,t){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],4:[function(e,n,t){"use strict";var r=e("ticky");n.exports=function(e,n,t){e&&r(function(){e.apply(t||null,n||[])})}},{ticky:9}],5:[function(e,n,t){"use strict";var r=e("atoa"),o=e("./debounce");n.exports=function(e,n){var t=n||{},i={};return void 0===e&&(e={}),e.on=function(n,t){return i[n]?i[n].push(t):i[n]=[t],e},e.once=function(n,t){return t._once=!0,e.on(n,t),e},e.off=function(n,t){var r=arguments.length;if(1===r)delete i[n];else if(0===r)i={};else{var o=i[n];if(!o)return e;o.splice(o.indexOf(t),1)}return e},e.emit=function(){var n=r(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var u=(i[n]||[]).slice(0);return function(){var i=r(arguments),a=this||e;if("error"===n&&t["throws"]!==!1&&!u.length)throw 1===i.length?i[0]:i;return u.forEach(function(r){t.async?o(r,i,a):r.apply(a,i),r._once&&e.off(n,r)}),e}},e}},{"./debounce":4,atoa:3}],6:[function(e,n,t){(function(t){"use strict";function r(e,n,t,r){return e.addEventListener(n,t,r)}function o(e,n,t){return e.attachEvent("on"+n,l(e,n,t))}function i(e,n,t,r){return e.removeEventListener(n,t,r)}function u(e,n,t){var r=f(e,n,t);return r?e.detachEvent("on"+n,r):void 0}function a(e,n,t){function r(){var e;return m.createEvent?(e=m.createEvent("Event"),e.initEvent(n,!0,!0)):m.createEventObject&&(e=m.createEventObject()),e}function o(){return new d(n,{detail:t})}var i=-1===v.indexOf(n)?o():r();e.dispatchEvent?e.dispatchEvent(i):e.fireEvent("on"+n,i)}function c(e,n,r){return function(n){var o=n||t.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}function l(e,n,t){var r=f(e,n,t)||c(e,n,t);return h.push({wrapper:r,element:e,type:n,fn:t}),r}function f(e,n,t){var r=s(e,n,t);if(r){var o=h[r].wrapper;return h.splice(r,1),o}}function s(e,n,t){var r,o;for(r=0;r<h.length;r++)if(o=h[r],o.element===e&&o.type===n&&o.fn===t)return r}var d=e("custom-event"),v=e("./eventmap"),m=t.document,p=r,g=i,h=[];t.addEventListener||(p=o,g=u),n.exports={add:p,remove:g,fabricate:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./eventmap":7,"custom-event":8}],7:[function(e,n,t){(function(e){"use strict";var t=[],r="",o=/^on/;for(r in e)o.test(r)&&t.push(r.slice(2));n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,n,t){(function(e){function t(){try{var e=new r("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(n){}return!1}var r=e.CustomEvent;n.exports=t()?r:"function"==typeof document.createEvent?function(e,n){var t=document.createEvent("CustomEvent");return n?t.initCustomEvent(e,n.bubbles,n.cancelable,n.detail):t.initCustomEvent(e,!1,!1,void 0),t}:function(e,n){var t=document.createEventObject();return t.type=e,n?(t.bubbles=Boolean(n.bubbles),t.cancelable=Boolean(n.cancelable),t.detail=n.detail):(t.bubbles=!1,t.cancelable=!1,t.detail=void 0),t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,n,t){var r,o="function"==typeof setImmediate;r=o?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=r},{}]},{},[2])(2)});
|