angular-dragula
Advanced tools
Comparing version 1.1.9 to 1.2.0
{ | ||
"name": "angular-dragula", | ||
"version": "1.1.9", | ||
"version": "1.2.0", | ||
"description": "Drag and drop so simple it hurts", | ||
@@ -5,0 +5,0 @@ "main": [ |
@@ -34,11 +34,19 @@ 'use strict'; | ||
scope.$watch('dragulaModel', function(newValue, oldValue) { | ||
if(newValue){ | ||
if(drake.models){ | ||
var modelIndex = drake.models.indexOf(oldValue); | ||
scope.$watch('dragulaModel', function (newValue, oldValue) { | ||
if (!newValue) { | ||
return; | ||
} | ||
if (drake.models) { | ||
var modelIndex = oldValue ? drake.models.indexOf(oldValue) : -1; | ||
if (modelIndex >= 0) { | ||
drake.models.splice(modelIndex, 1, newValue); | ||
}else{ | ||
drake.models = [newValue]; | ||
} else { | ||
drake.models.push(newValue); | ||
} | ||
} else { | ||
drake.models = [newValue]; | ||
} | ||
dragulaService.handleModels(dragulaScope, drake); | ||
}); | ||
@@ -45,0 +53,0 @@ } |
@@ -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(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=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,u=n.dragulaScope||n.$parent,a=t[0],c=n.$eval(r.dragula),l=e.find(u,c);l?(i=l.drake,i.containers.push(a)):(i=o({containers:[a]}),e.add(u,c,i)),n.$watch("dragulaModel",function(e,n){if(e)if(i.models){var t=i.models.indexOf(n);i.models.splice(t,1,e)}else i.models=[e]})}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=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}},{}],5:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==fe.containers.indexOf(e)||le.isContainer(e)}function r(e){var n=e?"remove":"add";o(S,n,"mousedown",N),o(S,n,"mouseup",P)}function a(e){var n=e?"remove":"add";o(S,n,"mousemove",T)}function m(e){var n=e?"remove":"add";w[n](S,"selectstart",O),w[n](S,"click",O)}function h(){r(!0),P({})}function O(e){ae&&e.preventDefault()}function N(e){ne=e.clientX,te=e.clientY;var n=1!==i(e)||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=X(t);r&&(ae=r,a(),"mousedown"===e.type&&(p(t)?t.focus():e.preventDefault()))}}function T(e){if(ae){if(0===i(e))return void P({});if(void 0===e.clientX||e.clientX!==ne||void 0===e.clientY||e.clientY!==te){if(le.ignoreInputTextSelection){var n=y("clientX",e),t=y("clientY",e),r=E.elementFromPoint(n,t);if(p(r))return}var o=ae;a(!0),m(),A(),B(o);var c=u(W);Z=y("pageX",e)-c.left,ee=y("pageY",e)-c.top,x.add(ie||W,"gu-transit"),F(),q(e)}}}function X(e){if(!(fe.dragging&&J||t(e))){for(var n=e;v(e)&&t(v(e))===!1;){if(le.invalid(e,n))return;if(e=v(e),!e)return}var r=v(e);if(r&&!le.invalid(e,n)){var o=le.moves(e,r,n,g(e));if(o)return{item:e,source:r}}}}function k(e){var n=X(e);n&&B(n)}function B(e){V(e.item,e.source)&&(ie=e.item.cloneNode(!0),fe.emit("cloned",ie,e.item,"copy")),Q=e.source,W=e.item,re=oe=g(e.item),fe.dragging=!0,fe.emit("drag",W,Q)}function Y(){return!1}function A(){if(fe.dragging){var e=ie||W;$(e,v(e))}}function D(){ae=!1,a(!0),m(!0)}function P(e){if(D(),fe.dragging){var n=ie||W,t=y("clientX",e),r=y("clientY",e),o=c(J,t,r),i=j(o,t,r);i&&(ie&&le.copySortSource||!ie||i!==Q)?$(n,i):le.removeOnSpill?I():M()}}function $(e,n){var t=v(e);ie&&le.copySortSource&&n===Q&&t.removeChild(W),R(n)?fe.emit("cancel",e,Q,Q):fe.emit("drop",e,n,Q,oe),L()}function I(){if(fe.dragging){var e=ie||W,n=v(e);n&&n.removeChild(e),fe.emit(ie?"cancel":"remove",e,n,Q),L()}}function M(e){if(fe.dragging){var n=arguments.length>0?e:le.revertOnSpill,t=ie||W,r=v(t);r===Q&&ie&&r.removeChild(ie);var o=R(r);o===!1&&!ie&&n&&Q.insertBefore(t,re),o||n?fe.emit("cancel",t,Q,Q):fe.emit("drop",t,r,Q,oe),L()}}function L(){var e=ie||W;D(),K(),e&&x.rm(e,"gu-transit"),ue&&clearTimeout(ue),fe.dragging=!1,ce&&fe.emit("out",e,ce,Q),fe.emit("dragend",e),Q=W=ie=re=oe=ue=ce=null}function R(e,n){var t;return t=void 0!==n?n:J?oe:g(ie||W),e===Q&&t===re}function j(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var u=z(i,e),a=H(i,u,n,r),c=R(i,a);return c?!0:le.accepts(W,i,Q,a)}for(var i=e;i&&!o();)i=v(i);return i}function q(e){function n(e){fe.emit(e,l,ce,Q)}function t(){s&&n("over")}function r(){ce&&n("out")}if(J){e.preventDefault();var o=y("clientX",e),i=y("clientY",e),u=o-Z,a=i-ee;J.style.left=u+"px",J.style.top=a+"px";var l=ie||W,f=c(J,o,i),d=j(f,o,i),s=null!==d&&d!==ce;(s||null===d)&&(r(),ce=d,t());var p=v(l);if(d===Q&&ie&&!le.copySortSource)return void(p&&p.removeChild(l));var m,h=z(d,f);if(null!==h)m=H(d,h,o,i);else{if(le.revertOnSpill!==!0||ie)return void(ie&&p&&p.removeChild(l));m=re,d=Q}(null===m||m!==l&&m!==g(l)&&m!==oe)&&(oe=m,d.insertBefore(l,m),fe.emit("shadow",l,d,Q))}}function U(e){x.rm(e,"gu-hide")}function _(e){fe.dragging&&x.add(e,"gu-hide")}function F(){if(!J){var e=W.getBoundingClientRect();J=W.cloneNode(!0),J.style.width=d(e)+"px",J.style.height=s(e)+"px",x.rm(J,"gu-transit"),x.add(J,"gu-mirror"),le.mirrorContainer.appendChild(J),o(S,"add","mousemove",q),x.add(le.mirrorContainer,"gu-unselectable"),fe.emit("cloned",J,W,"mirror")}}function K(){J&&(x.rm(le.mirrorContainer,"gu-unselectable"),o(S,"remove","mousemove",q),v(J).removeChild(J),J=null)}function z(e,n){for(var t=n;t!==e&&v(t)!==e;)t=v(t);return t===S?null:t}function H(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>t)return o;if(!a&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(a?t>e.left+d(e)/2:r>e.top+s(e)/2)}function u(e){return e?g(n):n}var a="horizontal"===le.direction,c=n!==e?i():o();return c}function V(e,n){return"boolean"==typeof le.copy?le.copy:le.copy(e,n)}var G=arguments.length;1===G&&Array.isArray(e)===!1&&(n=e,e=[]);var J,Q,W,Z,ee,ne,te,re,oe,ie,ue,ae,ce=null,le=n||{};void 0===le.moves&&(le.moves=f),void 0===le.accepts&&(le.accepts=f),void 0===le.invalid&&(le.invalid=Y),void 0===le.containers&&(le.containers=e||[]),void 0===le.isContainer&&(le.isContainer=l),void 0===le.copy&&(le.copy=!1),void 0===le.copySortSource&&(le.copySortSource=!1),void 0===le.revertOnSpill&&(le.revertOnSpill=!1),void 0===le.removeOnSpill&&(le.removeOnSpill=!1),void 0===le.direction&&(le.direction="vertical"),void 0===le.ignoreInputTextSelection&&(le.ignoreInputTextSelection=!0),void 0===le.mirrorContainer&&(le.mirrorContainer=C);var fe=b({containers:le.containers,start:k,end:A,cancel:M,remove:I,destroy:h,dragging:!1});return le.removeOnSpill===!0&&fe.on("over",U).on("out",_),r(),fe}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?w[n](e,u[r],o):t.navigator.msPointerEnabled?w[n](e,a[r],o):(w[n](e,i[r],o),w[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 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]:C[e]}function c(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=E.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 e.parentNode===E?null:e.parentNode}function p(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||m(e)}function m(e){return e?"false"===e.contentEditable?!1:"true"===e.contentEditable?!0:m(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){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function y(e,n){var t=h(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}var b=e("contra/emitter"),w=e("crossvent"),x=e("./classes"),E=document,S=E.documentElement,C=E.body;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 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":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 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 p.createEvent?(e=p.createEvent("Event"),e.initEvent(n,!0,!0)):p.createEventObject&&(e=p.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"),p=t.document,m=r,g=i,h=[];t.addEventListener||(m=o,g=u),n.exports={add:m,remove:g,fabricate:a}}).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(u);r.unshift(n.name+"."+e),t.$emit.apply(t,r)}n.drake.on(e,r)}function u(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,u,a;t.on("remove",function(e,r){t.models&&(a=t.models[t.containers.indexOf(r)],n.$applyAsync(function(){a.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&&(u=r(c,l),n.$applyAsync(function(){if(a=t.models[t.containers.indexOf(f)],l===f)a.splice(u,0,a.splice(i,1)[0]);else{var n=o===c,r=t.models[t.containers.indexOf(l)],d=n?a[i]:e.copy(a[i]);n&&a.splice(i,1),r.splice(u,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 a(r,o,i){var a=c(r,o);if(a)throw new Error('Bag named: "'+o+'" already exists in same angular scope.');var l=t(r);return a={name:o,drake:i},l.bags.push(a),u(e,a,r),i.models&&n(r,i),a}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=a(e,t,o(r));n(e,i.drake)}return{add:a,find:c,options:f,destroy:l}}]}var o=e("dragula"),i="$$dragula",u=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(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=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,u=n.dragulaScope||n.$parent,a=t[0],c=n.$eval(r.dragula),l=e.find(u,c);l?(i=l.drake,i.containers.push(a)):(i=o({containers:[a]}),e.add(u,c,i)),n.$watch("dragulaModel",function(n,t){if(n){if(i.models){var r=t?i.models.indexOf(t):-1;r>=0?i.models.splice(r,1,n):i.models.push(n)}else i.models=[n];e.handleModels(u,i)}})}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=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}},{}],5:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==fe.containers.indexOf(e)||le.isContainer(e)}function r(e){var n=e?"remove":"add";o(S,n,"mousedown",N),o(S,n,"mouseup",M)}function a(e){var n=e?"remove":"add";o(S,n,"mousemove",T)}function m(e){var n=e?"remove":"add";w[n](S,"selectstart",O),w[n](S,"click",O)}function h(){r(!0),M({})}function O(e){ae&&e.preventDefault()}function N(e){ne=e.clientX,te=e.clientY;var n=1!==i(e)||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=X(t);r&&(ae=r,a(),"mousedown"===e.type&&(p(t)?t.focus():e.preventDefault()))}}function T(e){if(ae){if(0===i(e))return void M({});if(void 0===e.clientX||e.clientX!==ne||void 0===e.clientY||e.clientY!==te){if(le.ignoreInputTextSelection){var n=y("clientX",e),t=y("clientY",e),r=E.elementFromPoint(n,t);if(p(r))return}var o=ae;a(!0),m(),A(),B(o);var c=u(W);Z=y("pageX",e)-c.left,ee=y("pageY",e)-c.top,x.add(ie||W,"gu-transit"),F(),q(e)}}}function X(e){if(!(fe.dragging&&J||t(e))){for(var n=e;v(e)&&t(v(e))===!1;){if(le.invalid(e,n))return;if(e=v(e),!e)return}var r=v(e);if(r&&!le.invalid(e,n)){var o=le.moves(e,r,n,g(e));if(o)return{item:e,source:r}}}}function k(e){var n=X(e);n&&B(n)}function B(e){V(e.item,e.source)&&(ie=e.item.cloneNode(!0),fe.emit("cloned",ie,e.item,"copy")),Q=e.source,W=e.item,re=oe=g(e.item),fe.dragging=!0,fe.emit("drag",W,Q)}function Y(){return!1}function A(){if(fe.dragging){var e=ie||W;P(e,v(e))}}function D(){ae=!1,a(!0),m(!0)}function M(e){if(D(),fe.dragging){var n=ie||W,t=y("clientX",e),r=y("clientY",e),o=c(J,t,r),i=j(o,t,r);i&&(ie&&le.copySortSource||!ie||i!==Q)?P(n,i):le.removeOnSpill?$():I()}}function P(e,n){var t=v(e);ie&&le.copySortSource&&n===Q&&t.removeChild(W),R(n)?fe.emit("cancel",e,Q,Q):fe.emit("drop",e,n,Q,oe),L()}function $(){if(fe.dragging){var e=ie||W,n=v(e);n&&n.removeChild(e),fe.emit(ie?"cancel":"remove",e,n,Q),L()}}function I(e){if(fe.dragging){var n=arguments.length>0?e:le.revertOnSpill,t=ie||W,r=v(t);r===Q&&ie&&r.removeChild(ie);var o=R(r);o===!1&&!ie&&n&&Q.insertBefore(t,re),o||n?fe.emit("cancel",t,Q,Q):fe.emit("drop",t,r,Q,oe),L()}}function L(){var e=ie||W;D(),K(),e&&x.rm(e,"gu-transit"),ue&&clearTimeout(ue),fe.dragging=!1,ce&&fe.emit("out",e,ce,Q),fe.emit("dragend",e),Q=W=ie=re=oe=ue=ce=null}function R(e,n){var t;return t=void 0!==n?n:J?oe:g(ie||W),e===Q&&t===re}function j(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var u=z(i,e),a=H(i,u,n,r),c=R(i,a);return c?!0:le.accepts(W,i,Q,a)}for(var i=e;i&&!o();)i=v(i);return i}function q(e){function n(e){fe.emit(e,l,ce,Q)}function t(){s&&n("over")}function r(){ce&&n("out")}if(J){e.preventDefault();var o=y("clientX",e),i=y("clientY",e),u=o-Z,a=i-ee;J.style.left=u+"px",J.style.top=a+"px";var l=ie||W,f=c(J,o,i),d=j(f,o,i),s=null!==d&&d!==ce;(s||null===d)&&(r(),ce=d,t());var p=v(l);if(d===Q&&ie&&!le.copySortSource)return void(p&&p.removeChild(l));var m,h=z(d,f);if(null!==h)m=H(d,h,o,i);else{if(le.revertOnSpill!==!0||ie)return void(ie&&p&&p.removeChild(l));m=re,d=Q}(null===m||m!==l&&m!==g(l)&&m!==oe)&&(oe=m,d.insertBefore(l,m),fe.emit("shadow",l,d,Q))}}function U(e){x.rm(e,"gu-hide")}function _(e){fe.dragging&&x.add(e,"gu-hide")}function F(){if(!J){var e=W.getBoundingClientRect();J=W.cloneNode(!0),J.style.width=d(e)+"px",J.style.height=s(e)+"px",x.rm(J,"gu-transit"),x.add(J,"gu-mirror"),le.mirrorContainer.appendChild(J),o(S,"add","mousemove",q),x.add(le.mirrorContainer,"gu-unselectable"),fe.emit("cloned",J,W,"mirror")}}function K(){J&&(x.rm(le.mirrorContainer,"gu-unselectable"),o(S,"remove","mousemove",q),v(J).removeChild(J),J=null)}function z(e,n){for(var t=n;t!==e&&v(t)!==e;)t=v(t);return t===S?null:t}function H(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>t)return o;if(!a&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(a?t>e.left+d(e)/2:r>e.top+s(e)/2)}function u(e){return e?g(n):n}var a="horizontal"===le.direction,c=n!==e?i():o();return c}function V(e,n){return"boolean"==typeof le.copy?le.copy:le.copy(e,n)}var G=arguments.length;1===G&&Array.isArray(e)===!1&&(n=e,e=[]);var J,Q,W,Z,ee,ne,te,re,oe,ie,ue,ae,ce=null,le=n||{};void 0===le.moves&&(le.moves=f),void 0===le.accepts&&(le.accepts=f),void 0===le.invalid&&(le.invalid=Y),void 0===le.containers&&(le.containers=e||[]),void 0===le.isContainer&&(le.isContainer=l),void 0===le.copy&&(le.copy=!1),void 0===le.copySortSource&&(le.copySortSource=!1),void 0===le.revertOnSpill&&(le.revertOnSpill=!1),void 0===le.removeOnSpill&&(le.removeOnSpill=!1),void 0===le.direction&&(le.direction="vertical"),void 0===le.ignoreInputTextSelection&&(le.ignoreInputTextSelection=!0),void 0===le.mirrorContainer&&(le.mirrorContainer=C);var fe=b({containers:le.containers,start:k,end:A,cancel:I,remove:$,destroy:h,dragging:!1});return le.removeOnSpill===!0&&fe.on("over",U).on("out",_),r(),fe}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?w[n](e,u[r],o):t.navigator.msPointerEnabled?w[n](e,a[r],o):(w[n](e,i[r],o),w[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 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]:C[e]}function c(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=E.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 e.parentNode===E?null:e.parentNode}function p(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||m(e)}function m(e){return e?"false"===e.contentEditable?!1:"true"===e.contentEditable?!0:m(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){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function y(e,n){var t=h(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}var b=e("contra/emitter"),w=e("crossvent"),x=e("./classes"),E=document,S=E.documentElement,C=E.body;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 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":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 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 p.createEvent?(e=p.createEvent("Event"),e.initEvent(n,!0,!0)):p.createEventObject&&(e=p.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"),p=t.document,m=r,g=i,h=[];t.addEventListener||(m=o,g=u),n.exports={add:m,remove:g,fabricate:a}}).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(u);r.unshift(n.name+"."+e),t.$emit.apply(t,r)}n.drake.on(e,r)}function u(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,u,a;t.on("remove",function(e,r){t.models&&(a=t.models[t.containers.indexOf(r)],n.$applyAsync(function(){a.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&&(u=r(c,l),n.$applyAsync(function(){if(a=t.models[t.containers.indexOf(f)],l===f)a.splice(u,0,a.splice(i,1)[0]);else{var n=o===c,r=t.models[t.containers.indexOf(l)],d=n?a[i]:e.copy(a[i]);n&&a.splice(i,1),r.splice(u,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 a(r,o,i){var a=c(r,o);if(a)throw new Error('Bag named: "'+o+'" already exists in same angular scope.');var l=t(r);return a={name:o,drake:i},l.bags.push(a),u(e,a,r),i.models&&n(r,i),a}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=a(e,t,o(r));n(e,i.drake)}return{add:a,find:c,options:f,destroy:l,handleModels:n}}]}var o=e("dragula"),i="$$dragula",u=e("./replicate-events");n.exports=r},{"./replicate-events":12,dragula:5}]},{},[1])(1)}); |
{ | ||
"name": "angular-dragula", | ||
"version": "1.1.9", | ||
"version": "1.2.0", | ||
"description": "Drag and drop so simple it hurts", | ||
@@ -10,3 +10,3 @@ "main": "angular-dragula.js", | ||
"deploy": "npm run build && npm run deployment && npm run sync", | ||
"deployment": "git add dist && npm version ${BUMP:-\"patch\"} --no-git-tag-version && git add package.json && git commit -am \"Autogenerated pre-deployment commit\" && bower version ${BUMP:-\"patch\"} && git reset HEAD~2 && git add . && git commit -am \"Release $(cat package.json | jq -r .version)\" && git push --tags && npm publish && git push", | ||
"deployment": "git add dist && npm version ${BUMP:-\"minor\"} --no-git-tag-version && git add package.json && git commit -am \"Autogenerated pre-deployment commit\" && bower version ${BUMP:-\"minor\"} && git reset HEAD~2 && git add . && git commit -am \"Release $(cat package.json | jq -r .version)\" && git push --tags && npm publish && git push", | ||
"scripts": "jshint . && browserify -s angularDragula -do dist/angular-dragula.js angular-dragula.js && uglifyjs -m -c -o dist/angular-dragula.min.js dist/angular-dragula.js", | ||
@@ -13,0 +13,0 @@ "start": "watchify -vs angularDragula -do dist/angular-dragula.js angular-dragula.js", |
@@ -13,3 +13,4 @@ 'use strict'; | ||
options: setOptions, | ||
destroy: destroy | ||
destroy: destroy, | ||
handleModels: handleModels | ||
}; | ||
@@ -16,0 +17,0 @@ function handleModels(scope, drake){ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1803509
27461
4