angular-dragula
Advanced tools
Comparing version 1.1.3 to 1.1.5
{ | ||
"name": "angular-dragula", | ||
"version": "1.1.3", | ||
"version": "1.1.5", | ||
"description": "Drag and drop so simple it hurts", | ||
@@ -5,0 +5,0 @@ "main": [ |
@@ -1,1 +0,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.angularDragula=e()}}(function(){return function e(n,t,r){function o(a,u){if(!t[a]){if(!n[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=t[a]={exports:{}};n[a][0].call(f.exports,function(e){var t=n[a][1][e];return o(t?t:e)},f,f.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,n,t){"use strict";function r(e){var n=e.module("dragula",["ng"]);return n.factory("dragulaService",o(e)),n.directive("dragula",i(e)),"dragula"}var o=e("./service"),i=e("./directive");n.exports=r},{"./directive":2,"./service":13}],2:[function(e,n,t){"use strict";function r(e){return["dragulaService",function(e){function n(n,t,r){var i=n.dragulaScope||n.$parent,a=t[0],u=n.$eval(r.dragula),c=n.dragulaModel,l=e.find(i,u);if(l)return l.drake.containers.push(a),void(c&&(l.drake.models?l.drake.models.push(c):l.drake.models=[c]));var f=o({containers:[a]});c&&(f.models=[c]),e.add(i,u,f)}return{restrict:"A",scope:{dragulaScope:"=",dragulaModel:"="},link:n}}]}var o=e("dragula");n.exports=r},{dragula:5}],3:[function(e,n,t){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],4:[function(e,n,t){"use strict";function r(e){var n=a[e];return n?n.lastIndex=0:a[e]=n=new RegExp(u+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 a={},u="(?:^|\\s)",c="(?:\\s|$)";n.exports={add:o,rm:i}},{}],5:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==ue.containers.indexOf(e)||ae.isContainer(e)}function r(e){var n=e?"remove":"add";o(oe,n,"mousedown",w),o(oe,n,"mouseup",B)}function u(e){var n=e?"remove":"add";o(oe,n,"mousemove",x)}function p(e){var n=e?"remove":"add";o(oe,n,"selectstart",E),o(oe,n,"click",E)}function y(){r(!0),B({})}function E(e){te&&e.preventDefault()}function w(e){J=e.clientX,Q=e.clientY;var n=1!==i(e)||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=S(t);r&&(te=r,u(),"mousedown"===e.type&&(v(t)?t.focus():e.preventDefault()))}}function x(e){if(te){if(0===i(e))return void B({});if(e.clientX!==J||e.clientY!==Q){if(ae.ignoreInputTextSelection){var n=g("clientX",e),t=g("clientY",e),r=document.elementFromPoint(n,t);if(v(r))return}var o=te;u(!0),p(),N(),O(o);var c=a(H);V=g("pageX",e)-c.left,G=g("pageY",e)-c.top,b.add(ee||H,"gu-transit"),R(),I(e)}}}function S(e){if(!(ue.dragging&&K||t(e))){for(var n=e;e.parentElement&&t(e.parentElement)===!1;){if(ae.invalid(e,n))return;if(e=e.parentElement,!e)return}var r=e.parentElement;if(r&&!ae.invalid(e,n)){var o=ae.moves(e,r,n,m(e));if(o)return{item:e,source:r}}}}function C(e){var n=S(e);n&&O(n)}function O(e){_(e.item,e.source)&&(ee=e.item.cloneNode(!0),ue.emit("cloned",ee,e.item,"copy")),z=e.source,H=e.item,W=Z=m(e.item),ue.dragging=!0,ue.emit("drag",H,z)}function T(){return!1}function N(){if(ue.dragging){var e=ee||H;X(e,e.parentElement)}}function k(){te=!1,u(!0),p(!0)}function B(e){if(k(),ue.dragging){var n=ee||H,t=g("clientX",e),r=g("clientY",e),o=c(K,t,r),i=$(o,t,r);i&&(ee&&ae.copySortSource||!ee||i!==z)?X(n,i):ae.removeOnSpill?A():D()}}function X(e,n){var t=e.parentElement;ee&&ae.copySortSource&&n===z&&t.removeChild(H),Y(n)?ue.emit("cancel",e,z,z):ue.emit("drop",e,n,z,Z),P()}function A(){if(ue.dragging){var e=ee||H,n=e.parentElement;n&&n.removeChild(e),ue.emit(ee?"cancel":"remove",e,n,z),P()}}function D(e){if(ue.dragging){var n=arguments.length>0?e:ae.revertOnSpill,t=ee||H,r=t.parentElement;r===z&&ee&&r.removeChild(ee);var o=Y(r);o===!1&&!ee&&n&&z.insertBefore(t,W),o||n?ue.emit("cancel",t,z,z):ue.emit("drop",t,r,z,Z),P()}}function P(){var e=ee||H;k(),j(),e&&b.rm(e,"gu-transit"),ne&&clearTimeout(ne),ue.dragging=!1,ie&&ue.emit("out",e,ie,z),ue.emit("dragend",e),z=H=ee=W=Z=ne=ie=null}function Y(e,n){var t;return t=void 0!==n?n:K?Z:m(ee||H),e===z&&t===W}function $(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var a=q(i,e),u=U(i,a,n,r),c=Y(i,u);return c?!0:ae.accepts(H,i,z,u)}for(var i=e;i&&!o();)i=i.parentElement;return i}function I(e){function n(e){ue.emit(e,l,ie,z)}function t(){s&&n("over")}function r(){ie&&n("out")}if(K){e.preventDefault();var o=g("clientX",e),i=g("clientY",e),a=o-V,u=i-G;K.style.left=a+"px",K.style.top=u+"px";var l=ee||H,f=c(K,o,i),d=$(f,o,i),s=null!==d&&d!==ie;if((s||null===d)&&(r(),ie=d,t()),d===z&&ee&&!ae.copySortSource)return void(l.parentElement&&l.parentElement.removeChild(l));var v,p=q(d,f);if(null!==p)v=U(d,p,o,i);else{if(ae.revertOnSpill!==!0||ee)return void(ee&&l.parentElement&&l.parentElement.removeChild(l));v=W,d=z}(null===v||v!==l&&v!==m(l)&&v!==Z)&&(Z=v,d.insertBefore(l,v),ue.emit("shadow",l,d,z))}}function M(e){b.rm(e,"gu-hide")}function L(e){ue.dragging&&b.add(e,"gu-hide")}function R(){if(!K){var e=H.getBoundingClientRect();K=H.cloneNode(!0),K.style.width=d(e)+"px",K.style.height=s(e)+"px",b.rm(K,"gu-transit"),b.add(K,"gu-mirror"),ae.mirrorContainer.appendChild(K),o(oe,"add","mousemove",I),b.add(ae.mirrorContainer,"gu-unselectable"),ue.emit("cloned",K,H,"mirror")}}function j(){K&&(b.rm(ae.mirrorContainer,"gu-unselectable"),o(oe,"remove","mousemove",I),K.parentElement.removeChild(K),K=null)}function q(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===oe?null:t}function U(e,n,t,r){function o(){var n,o,i,a=e.children.length;for(n=0;a>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),u&&i.left>t)return o;if(!u&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return a(u?t>e.left+d(e)/2:r>e.top+s(e)/2)}function a(e){return e?m(n):n}var u="horizontal"===ae.direction,c=n!==e?i():o();return c}function _(e,n){return"boolean"==typeof ae.copy?ae.copy:ae.copy(e,n)}var F=arguments.length;1===F&&Array.isArray(e)===!1&&(n=e,e=[]);var K,z,H,V,G,J,Q,W,Z,ee,ne,te,re=document.body,oe=document.documentElement,ie=null,ae=n||{};void 0===ae.moves&&(ae.moves=f),void 0===ae.accepts&&(ae.accepts=f),void 0===ae.invalid&&(ae.invalid=T),void 0===ae.containers&&(ae.containers=e||[]),void 0===ae.isContainer&&(ae.isContainer=l),void 0===ae.copy&&(ae.copy=!1),void 0===ae.copySortSource&&(ae.copySortSource=!1),void 0===ae.revertOnSpill&&(ae.revertOnSpill=!1),void 0===ae.removeOnSpill&&(ae.removeOnSpill=!1),void 0===ae.direction&&(ae.direction="vertical"),void 0===ae.ignoreInputTextSelection&&(ae.ignoreInputTextSelection=!0),void 0===ae.mirrorContainer&&(ae.mirrorContainer=re);var ue=h({containers:ae.containers,start:C,end:N,cancel:D,remove:A,destroy:y,dragging:!1});return ae.removeOnSpill===!0&&ue.on("over",M).on("out",L),r(),ue}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&y[n](e,a[r],o),y[n](e,i[r],o),y[n](e,r,o)}function i(e){if(void 0!==e.buttons)return e.buttons;if(void 0!==e.which)return e.which;var n=e.button;return void 0!==n?1&n?1:2&n?3:4&n?2:0:void 0}function a(e){var n=e.getBoundingClientRect();return{left:n.left+u("scrollLeft","pageXOffset"),top:n.top+u("scrollTop","pageYOffset")}}function u(e,n){if("undefined"!=typeof t[n])return t[n];var r=document.documentElement;if(r.clientHeight)return r[e];var o=document.body;return o[e]}function c(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function l(){return!1}function f(){return!0}function d(e){return e.width||e.right-e.left}function s(e){return e.height||e.bottom-e.top}function v(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName}function m(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function p(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function g(e,n){var t=p(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}var h=e("contra/emitter"),y=e("crossvent"),b=e("./classes");n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":4,"contra/emitter":7,crossvent:10}],6:[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:8}],7:[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 a=(i[n]||[]).slice(0);return function(){var i=r(arguments),u=this||e;if("error"===n&&t["throws"]!==!1&&!a.length)throw 1===i.length?i[0]:i;return a.forEach(function(r){t.async?o(r,i,u):r.apply(u,i),r._once&&e.off(n,r)}),e}},e}},{"./debounce":6,atoa:3}],8:[function(e,n,t){var r,o="function"==typeof setImmediate;r=o?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=r},{}],9:[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:{})},{}],10:[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 a(e,n,t){var r=f(e,n,t);return r?e.detachEvent("on"+n,r):void 0}function u(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 s(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=d(e,n,t);if(r){var o=h[r].wrapper;return h.splice(r,1),o}}function d(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 s=e("custom-event"),v=e("./eventmap"),m=t.document,p=r,g=i,h=[];t.addEventListener||(p=o,g=a),n.exports={add:p,remove:g,fabricate:u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./eventmap":11,"custom-event":9}],11:[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:{})},{}],12:[function(e,n,t){"use strict";function r(e,n,t){function r(e){function r(){var r=o(arguments).map(a);r.unshift(n.name+"."+e),t.$emit.apply(t,r)}n.drake.on(e,r)}function a(n){return e.isElement(n)?e.element(n):n}i.forEach(r)}var o=e("atoa"),i=["cancel","cloned","drag","dragend","drop","out","over","remove","shadow","drop-model","remove-model"];n.exports=r},{atoa:3}],13:[function(e,n,t){"use strict";function r(e){return[function(){function n(n,t){var o,i,a,u;t.on("remove",function(e,r){u=t.models[t.containers.indexOf(r)],n.$applyAsync(function(){u.splice(i,1),t.emit("remove-model",e,r)})}),t.on("drag",function(e,n){o=e,i=r(e,n)}),t.on("drop",function(c,l,f){a=r(c,l),n.$applyAsync(function(){if(u=t.models[t.containers.indexOf(f)],l===f)u.splice(a,0,u.splice(i,1)[0]);else{var n=o===c,r=t.models[t.containers.indexOf(l)],d=n?u[i]:e.copy(u[i]);n&&u.splice(i,1),r.splice(a,0,d),l.removeChild(c)}t.emit("drop-model",c,l,f)})})}function t(e){var n=e[i];return n||(n=e[i]={bags:[]}),n}function r(n,t){return Array.prototype.indexOf.call(e.element(t).children(),n)}function u(r,o,i){var u=c(r,o);if(u)throw new Error('Bag named: "'+o+'" already exists in same angular scope.');var l=t(r);return u={name:o,drake:i},l.bags.push(u),a(e,u,r),i.models&&n(r,i),u}function c(e,n){for(var r=t(e).bags,o=0;o<r.length;o++)if(r[o].name===n)return r[o]}function l(e,n){var r=t(e).bags,o=c(e,n),i=r.indexOf(o);r.splice(i,1),o.drake.destroy()}function f(e,t,r){var i=u(e,t,o(r));i.drake.models&&n(e,i.drake)}return{add:u,find:c,options:f,destroy:l}}]}var o=e("dragula"),i="$$dragula",a=e("./replicate-events");n.exports=r},{"./replicate-events":12,dragula:5}]},{},[1])(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.angularDragula=e()}}(function(){return function e(n,t,r){function o(a,u){if(!t[a]){if(!n[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=t[a]={exports:{}};n[a][0].call(f.exports,function(e){var t=n[a][1][e];return o(t?t:e)},f,f.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,n,t){"use strict";function r(e){var n=e.module("dragula",["ng"]);return n.factory("dragulaService",o(e)),n.directive("dragula",i(e)),"dragula"}var o=e("./service"),i=e("./directive");n.exports=r},{"./directive":2,"./service":13}],2:[function(e,n,t){"use strict";function r(e){return["dragulaService",function(e){function n(n,t,r){var i=n.dragulaScope||n.$parent,a=t[0],u=n.$eval(r.dragula),c=n.dragulaModel,l=e.find(i,u);if(l)return l.drake.containers.push(a),void(c&&(l.drake.models?l.drake.models.push(c):l.drake.models=[c]));var f=o({containers:[a]});c&&(f.models=[c]),e.add(i,u,f)}return{restrict:"A",scope:{dragulaScope:"=",dragulaModel:"="},link:n}}]}var o=e("dragula");n.exports=r},{dragula:5}],3:[function(e,n,t){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],4:[function(e,n,t){"use strict";function r(e){var n=a[e];return n?n.lastIndex=0:a[e]=n=new RegExp(u+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 a={},u="(?:^|\\s)",c="(?:\\s|$)";n.exports={add:o,rm:i}},{}],5:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==ue.containers.indexOf(e)||ae.isContainer(e)}function r(e){var n=e?"remove":"add";o(oe,n,"mousedown",w),o(oe,n,"mouseup",X)}function u(e){var n=e?"remove":"add";o(oe,n,"mousemove",x)}function p(e){var n=e?"remove":"add";o(oe,n,"selectstart",E),o(oe,n,"click",E)}function y(){r(!0),X({})}function E(e){te&&e.preventDefault()}function w(e){J=e.clientX,Q=e.clientY;var n=1!==i(e)||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=S(t);r&&(te=r,u(),"mousedown"===e.type&&(v(t)?t.focus():e.preventDefault()))}}function x(e){if(te){if(0===i(e))return void X({});if(void 0===e.clientX||e.clientX!==J||void 0===e.clientY||e.clientY!==Q){if(ae.ignoreInputTextSelection){var n=g("clientX",e),t=g("clientY",e),r=document.elementFromPoint(n,t);if(v(r))return}var o=te;u(!0),p(),N(),O(o);var c=a(H);V=g("pageX",e)-c.left,G=g("pageY",e)-c.top,b.add(ee||H,"gu-transit"),R(),I(e)}}}function S(e){if(!(ue.dragging&&K||t(e))){for(var n=e;e.parentElement&&t(e.parentElement)===!1;){if(ae.invalid(e,n))return;if(e=e.parentElement,!e)return}var r=e.parentElement;if(r&&!ae.invalid(e,n)){var o=ae.moves(e,r,n,m(e));if(o)return{item:e,source:r}}}}function C(e){var n=S(e);n&&O(n)}function O(e){_(e.item,e.source)&&(ee=e.item.cloneNode(!0),ue.emit("cloned",ee,e.item,"copy")),z=e.source,H=e.item,W=Z=m(e.item),ue.dragging=!0,ue.emit("drag",H,z)}function T(){return!1}function N(){if(ue.dragging){var e=ee||H;B(e,e.parentElement)}}function k(){te=!1,u(!0),p(!0)}function X(e){if(k(),ue.dragging){var n=ee||H,t=g("clientX",e),r=g("clientY",e),o=c(K,t,r),i=$(o,t,r);i&&(ee&&ae.copySortSource||!ee||i!==z)?B(n,i):ae.removeOnSpill?Y():A()}}function B(e,n){var t=e.parentElement;ee&&ae.copySortSource&&n===z&&t.removeChild(H),P(n)?ue.emit("cancel",e,z,z):ue.emit("drop",e,n,z,Z),D()}function Y(){if(ue.dragging){var e=ee||H,n=e.parentElement;n&&n.removeChild(e),ue.emit(ee?"cancel":"remove",e,n,z),D()}}function A(e){if(ue.dragging){var n=arguments.length>0?e:ae.revertOnSpill,t=ee||H,r=t.parentElement;r===z&&ee&&r.removeChild(ee);var o=P(r);o===!1&&!ee&&n&&z.insertBefore(t,W),o||n?ue.emit("cancel",t,z,z):ue.emit("drop",t,r,z,Z),D()}}function D(){var e=ee||H;k(),j(),e&&b.rm(e,"gu-transit"),ne&&clearTimeout(ne),ue.dragging=!1,ie&&ue.emit("out",e,ie,z),ue.emit("dragend",e),z=H=ee=W=Z=ne=ie=null}function P(e,n){var t;return t=void 0!==n?n:K?Z:m(ee||H),e===z&&t===W}function $(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var a=q(i,e),u=U(i,a,n,r),c=P(i,u);return c?!0:ae.accepts(H,i,z,u)}for(var i=e;i&&!o();)i=i.parentElement;return i}function I(e){function n(e){ue.emit(e,l,ie,z)}function t(){s&&n("over")}function r(){ie&&n("out")}if(K){e.preventDefault();var o=g("clientX",e),i=g("clientY",e),a=o-V,u=i-G;K.style.left=a+"px",K.style.top=u+"px";var l=ee||H,f=c(K,o,i),d=$(f,o,i),s=null!==d&&d!==ie;if((s||null===d)&&(r(),ie=d,t()),d===z&&ee&&!ae.copySortSource)return void(l.parentElement&&l.parentElement.removeChild(l));var v,p=q(d,f);if(null!==p)v=U(d,p,o,i);else{if(ae.revertOnSpill!==!0||ee)return void(ee&&l.parentElement&&l.parentElement.removeChild(l));v=W,d=z}(null===v||v!==l&&v!==m(l)&&v!==Z)&&(Z=v,d.insertBefore(l,v),ue.emit("shadow",l,d,z))}}function M(e){b.rm(e,"gu-hide")}function L(e){ue.dragging&&b.add(e,"gu-hide")}function R(){if(!K){var e=H.getBoundingClientRect();K=H.cloneNode(!0),K.style.width=d(e)+"px",K.style.height=s(e)+"px",b.rm(K,"gu-transit"),b.add(K,"gu-mirror"),ae.mirrorContainer.appendChild(K),o(oe,"add","mousemove",I),b.add(ae.mirrorContainer,"gu-unselectable"),ue.emit("cloned",K,H,"mirror")}}function j(){K&&(b.rm(ae.mirrorContainer,"gu-unselectable"),o(oe,"remove","mousemove",I),K.parentElement.removeChild(K),K=null)}function q(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===oe?null:t}function U(e,n,t,r){function o(){var n,o,i,a=e.children.length;for(n=0;a>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),u&&i.left>t)return o;if(!u&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return a(u?t>e.left+d(e)/2:r>e.top+s(e)/2)}function a(e){return e?m(n):n}var u="horizontal"===ae.direction,c=n!==e?i():o();return c}function _(e,n){return"boolean"==typeof ae.copy?ae.copy:ae.copy(e,n)}var F=arguments.length;1===F&&Array.isArray(e)===!1&&(n=e,e=[]);var K,z,H,V,G,J,Q,W,Z,ee,ne,te,re=document.body,oe=document.documentElement,ie=null,ae=n||{};void 0===ae.moves&&(ae.moves=f),void 0===ae.accepts&&(ae.accepts=f),void 0===ae.invalid&&(ae.invalid=T),void 0===ae.containers&&(ae.containers=e||[]),void 0===ae.isContainer&&(ae.isContainer=l),void 0===ae.copy&&(ae.copy=!1),void 0===ae.copySortSource&&(ae.copySortSource=!1),void 0===ae.revertOnSpill&&(ae.revertOnSpill=!1),void 0===ae.removeOnSpill&&(ae.removeOnSpill=!1),void 0===ae.direction&&(ae.direction="vertical"),void 0===ae.ignoreInputTextSelection&&(ae.ignoreInputTextSelection=!0),void 0===ae.mirrorContainer&&(ae.mirrorContainer=re);var ue=h({containers:ae.containers,start:C,end:N,cancel:A,remove:Y,destroy:y,dragging:!1});return ae.removeOnSpill===!0&&ue.on("over",M).on("out",L),r(),ue}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&y[n](e,a[r],o),y[n](e,i[r],o),y[n](e,r,o)}function i(e){if(void 0!==e.touches)return e.touches.length;if(void 0!==e.buttons)return e.buttons;if(void 0!==e.which)return e.which;var n=e.button;return void 0!==n?1&n?1:2&n?3:4&n?2:0:void 0}function a(e){var n=e.getBoundingClientRect();return{left:n.left+u("scrollLeft","pageXOffset"),top:n.top+u("scrollTop","pageYOffset")}}function u(e,n){if("undefined"!=typeof t[n])return t[n];var r=document.documentElement;if(r.clientHeight)return r[e];var o=document.body;return o[e]}function c(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function l(){return!1}function f(){return!0}function d(e){return e.width||e.right-e.left}function s(e){return e.height||e.bottom-e.top}function v(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName}function m(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function p(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function g(e,n){var t=p(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}var h=e("contra/emitter"),y=e("crossvent"),b=e("./classes");n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":4,"contra/emitter":7,crossvent:10}],6:[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:8}],7:[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 a=(i[n]||[]).slice(0);return function(){var i=r(arguments),u=this||e;if("error"===n&&t["throws"]!==!1&&!a.length)throw 1===i.length?i[0]:i;return a.forEach(function(r){t.async?o(r,i,u):r.apply(u,i),r._once&&e.off(n,r)}),e}},e}},{"./debounce":6,atoa:3}],8:[function(e,n,t){var r,o="function"==typeof setImmediate;r=o?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=r},{}],9:[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:{})},{}],10:[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 a(e,n,t){var r=f(e,n,t);return r?e.detachEvent("on"+n,r):void 0}function u(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 s(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=d(e,n,t);if(r){var o=h[r].wrapper;return h.splice(r,1),o}}function d(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 s=e("custom-event"),v=e("./eventmap"),m=t.document,p=r,g=i,h=[];t.addEventListener||(p=o,g=a),n.exports={add:p,remove:g,fabricate:u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./eventmap":11,"custom-event":9}],11:[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:{})},{}],12:[function(e,n,t){"use strict";function r(e,n,t){function r(e){function r(){var r=o(arguments).map(a);r.unshift(n.name+"."+e),t.$emit.apply(t,r)}n.drake.on(e,r)}function a(n){return e.isElement(n)?e.element(n):n}i.forEach(r)}var o=e("atoa"),i=["cancel","cloned","drag","dragend","drop","out","over","remove","shadow","drop-model","remove-model"];n.exports=r},{atoa:3}],13:[function(e,n,t){"use strict";function r(e){return[function(){function n(n,t){var o,i,a,u;t.on("remove",function(e,r){t.models&&(u=t.models[t.containers.indexOf(r)],n.$applyAsync(function(){u.splice(i,1),t.emit("remove-model",e,r)}))}),t.on("drag",function(e,n){o=e,i=r(e,n)}),t.on("drop",function(c,l,f){t.models&&(a=r(c,l),n.$applyAsync(function(){if(u=t.models[t.containers.indexOf(f)],l===f)u.splice(a,0,u.splice(i,1)[0]);else{var n=o===c,r=t.models[t.containers.indexOf(l)],d=n?u[i]:e.copy(u[i]);n&&u.splice(i,1),r.splice(a,0,d),l.removeChild(c)}t.emit("drop-model",c,l,f)}))})}function t(e){var n=e[i];return n||(n=e[i]={bags:[]}),n}function r(n,t){return Array.prototype.indexOf.call(e.element(t).children(),n)}function u(r,o,i){var u=c(r,o);if(u)throw new Error('Bag named: "'+o+'" already exists in same angular scope.');var l=t(r);return u={name:o,drake:i},l.bags.push(u),a(e,u,r),i.models&&n(r,i),u}function c(e,n){for(var r=t(e).bags,o=0;o<r.length;o++)if(r[o].name===n)return r[o]}function l(e,n){var r=t(e).bags,o=c(e,n),i=r.indexOf(o);r.splice(i,1),o.drake.destroy()}function f(e,t,r){var i=u(e,t,o(r));n(e,i.drake)}return{add:u,find:c,options:f,destroy:l}}]}var o=e("dragula"),i="$$dragula",a=e("./replicate-events");n.exports=r},{"./replicate-events":12,dragula:5}]},{},[1])(1)}); |
{ | ||
"name": "angular-dragula", | ||
"version": "1.1.3", | ||
"version": "1.1.5", | ||
"description": "Drag and drop so simple it hurts", | ||
@@ -29,3 +29,3 @@ "main": "angular-dragula.js", | ||
"atoa": "1.0.0", | ||
"dragula": "3.5.2" | ||
"dragula": "3.5.3" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -21,2 +21,5 @@ 'use strict'; | ||
drake.on('remove',function removeModel (el, source) { | ||
if (!drake.models) { | ||
return; | ||
} | ||
sourceModel = drake.models[drake.containers.indexOf(source)]; | ||
@@ -33,2 +36,5 @@ scope.$applyAsync(function applyRemove() { | ||
drake.on('drop',function dropModel (dropElm, target, source) { | ||
if (!drake.models) { | ||
return; | ||
} | ||
dropIndex = domIndexOf(dropElm, target); | ||
@@ -100,5 +106,3 @@ scope.$applyAsync(function applyDrop() { | ||
var bag = add(scope, name, dragula(options)); | ||
if(bag.drake.models){ | ||
handleModels(scope, bag.drake); | ||
} | ||
handleModels(scope, bag.drake); | ||
} | ||
@@ -105,0 +109,0 @@ }]; |
Sorry, the diff of this file is too big to display
1800731
27505
+ Addeddragula@3.5.3(transitive)
- Removeddragula@3.5.2(transitive)
Updateddragula@3.5.3