New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-dragula

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-dragula - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

4

bower.json
{
"name": "angular-dragula.js",
"version": "1.0.6",
"name": "angular-dragula",
"version": "1.0.7",
"description": "Drag and drop so simple it hurts",

@@ -5,0 +5,0 @@ "main": [

@@ -11,3 +11,4 @@ 'use strict';

scope: {
dragulaScope: '='
dragulaScope: '=',
dragulaModel: '=',
},

@@ -21,5 +22,14 @@ link: link

var name = scope.$eval(attrs.dragula);
var model = scope.dragulaModel;
var bag = dragulaService.find(dragulaScope, name);
if (bag) {
bag.drake.containers.push(container); return;
bag.drake.containers.push(container);
if(model){
if(bag.drake.models){
bag.drake.models.push(model);
}else{
bag.drake.models = [model];
}
}
return;
}

@@ -29,2 +39,5 @@ var drake = dragula({

});
if(model){
drake.models = [model];
}
dragulaService.add(dragulaScope, name, drake);

@@ -31,0 +44,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(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=e.find(i,u);if(c)return void c.drake.containers.push(a);var l=o({containers:[a]});e.add(i,u,l)}return{restrict:"A",scope:{dragulaScope:"="},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!==te.containers.indexOf(e)||ne.isContainer(e)}function r(e){var n=e?"remove":"add";o(Z,n,"mousedown",b),o(Z,n,"mouseup",T)}function a(e){var n=e?"remove":"add";o(Z,n,"mousemove",E)}function d(e){var n=e?"remove":"add";o(Z,n,"selectstart",y),o(Z,n,"click",y)}function g(){r(!0),T({})}function y(e){Q&&e.preventDefault()}function b(e){var n=0!==e.which&&1!==e.which||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=w(t);r&&(Q=r,a(),"mousedown"===e.type&&e.preventDefault())}}function E(e){a(!0),d(),S(),C(Q);var n=i(F);K=s("pageX",e)-n.left,z=s("pageY",e)-n.top,h.add(G||F,"gu-transit"),R(),$(e)}function w(e){if(!(te.dragging&&I||t(e))){for(var n=e;e.parentElement&&t(e.parentElement)===!1;){if(ne.invalid(e,n))return;if(e=e.parentElement,!e)return}var r=e.parentElement;if(r&&!ne.invalid(e,n)){var o=ne.moves(e,r,n);if(o)return{item:e,source:r}}}}function x(e){var n=w(e);n&&C(n)}function C(e){ne.copy&&(G=e.item.cloneNode(!0),te.emit("cloned",G,e.item,"copy")),U=e.source,F=e.item,H=V=f(e.item),te.dragging=!0,te.emit("drag",F,U)}function O(){return!1}function S(){if(te.dragging){var e=G||F;B(e,e.parentElement)}}function N(){Q=!1,a(!0),d(!0)}function T(e){if(N(),te.dragging){var n=G||F,t=s("clientX",e),r=s("clientY",e),o=u(I,t,r),i=Y(o,t,r);!i||ne.copy!==!1&&i===U?ne.removeOnSpill?k():D():B(n,i)}}function B(e,n){X(n)?te.emit("cancel",e,U):te.emit("drop",e,n,U),P()}function k(){if(te.dragging){var e=G||F,n=e.parentElement;n&&n.removeChild(e),te.emit(ne.copy?"cancel":"remove",e,n),P()}}function D(e){if(te.dragging){var n=arguments.length>0?e:ne.revertOnSpill,t=G||F,r=t.parentElement;r===U&&ne.copy&&r.removeChild(G);var o=X(r);o===!1&&ne.copy===!1&&n&&U.insertBefore(t,H),o||n?te.emit("cancel",t,U):te.emit("drop",t,r,U),P()}}function P(){var e=G||F;N(),j(),e&&h.rm(e,"gu-transit"),J&&clearTimeout(J),te.dragging=!1,te.emit("out",e,ee,U),te.emit("dragend",e),U=F=G=H=V=J=ee=null}function X(e,n){var t;return t=void 0!==n?n:I?V:f(F||G),e===U&&t===H}function Y(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var a=q(i,e),u=A(i,a,n,r),c=X(i,u);return c?!0:ne.accepts(F,i,U,u)}for(var i=e;i&&!o();)i=i.parentElement;return i}function $(e){function n(e){te.emit(e,l,ee,U)}function t(){p&&n("over")}function r(){ee&&n("out")}if(I){e.preventDefault();var o=s("clientX",e),i=s("clientY",e),a=o-K,c=i-z;I.style.left=a+"px",I.style.top=c+"px";var l=G||F,d=u(I,o,i),v=Y(d,o,i),p=null!==v&&v!==ee;if((p||null===v)&&(r(),ee=v,t()),v===U&&ne.copy)return void(l.parentElement&&l.parentElement.removeChild(l));var m,g=q(v,d);if(null!==g)m=A(v,g,o,i);else{if(ne.revertOnSpill!==!0||ne.copy)return void(ne.copy&&l.parentElement&&l.parentElement.removeChild(l));m=H,v=U}(null===m||m!==l&&m!==f(l)&&m!==V)&&(V=m,v.insertBefore(l,m),te.emit("shadow",l,v))}}function L(e){h.rm(e,"gu-hide")}function M(e){te.dragging&&h.add(e,"gu-hide")}function R(){if(!I){var e=F.getBoundingClientRect();I=F.cloneNode(!0),I.style.width=v(e)+"px",I.style.height=p(e)+"px",h.rm(I,"gu-transit"),h.add(I,"gu-mirror"),ne.mirrorContainer.appendChild(I),o(Z,"add","mousemove",$),h.add(ne.mirrorContainer,"gu-unselectable"),te.emit("cloned",I,F,"mirror")}}function j(){I&&(h.rm(ne.mirrorContainer,"gu-unselectable"),o(Z,"remove","mousemove",$),I.parentElement.removeChild(I),I=null)}function q(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===Z?null:t}function A(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+v(e)/2:r>e.top+p(e)/2)}function a(e){return e?f(n):n}var u="horizontal"===ne.direction,c=n!==e?i():o();return c}var _=arguments.length;1===_&&Array.isArray(e)===!1&&(n=e,e=[]);var I,U,F,K,z,H,V,G,J,Q,W=document.body,Z=document.documentElement,ee=null,ne=n||{};void 0===ne.moves&&(ne.moves=l),void 0===ne.accepts&&(ne.accepts=l),void 0===ne.invalid&&(ne.invalid=O),void 0===ne.containers&&(ne.containers=e||[]),void 0===ne.isContainer&&(ne.isContainer=c),void 0===ne.copy&&(ne.copy=!1),void 0===ne.revertOnSpill&&(ne.revertOnSpill=!1),void 0===ne.removeOnSpill&&(ne.removeOnSpill=!1),void 0===ne.direction&&(ne.direction="vertical"),void 0===ne.mirrorContainer&&(ne.mirrorContainer=W);var te=m({containers:ne.containers,start:x,end:S,cancel:D,remove:k,destroy:g,dragging:!1});return ne.removeOnSpill===!0&&te.on("over",L).on("out",M),r(),te}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&g[n](e,a[r],o),g[n](e,i[r],o),g[n](e,r,o)}function i(e){var n=e.getBoundingClientRect();return{left:n.left+a("scrollLeft","pageXOffset"),top:n.top+a("scrollTop","pageYOffset")}}function a(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 u(e,n,t){if(!n&&!t)return null;var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function c(){return!1}function l(){return!0}function f(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function d(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function s(e,n){var t=d(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}function v(e){return e.width||e.right-e.left}function p(e){return e.height||e.bottom-e.top}var m=e("contra/emitter"),g=e("crossvent"),h=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){return e.detachEvent("on"+n,f(e,n,t))}function u(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=document,m=r,g=i,h=[];t.addEventListener||(m=o,g=a),n.exports={add:m,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"];n.exports=r},{atoa:3}],13:[function(e,n,t){"use strict";function r(e){return[function(){function n(e){var n=e[i];return n||(n=e[i]={bags:[]}),n}function t(t,o,i){var u=r(t,o);if(u)throw new Error('Bag named: "'+o+'" already exists in same angular scope.');var c=n(t);return u={name:o,drake:i},c.bags.push(u),a(e,u,t),u}function r(e,t){for(var r=n(e).bags,o=0;o<r.length;o++)if(r[o].name===t)return r[o]}function u(e,t){var o=n(e).bags,i=r(e,t),a=o.indexOf(i);o.splice(a,1),i.drake.destroy()}function c(e,n,r){t(e,n,o(r))}return{add:t,find:r,options:c,destroy:u}}]}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!==te.containers.indexOf(e)||ne.isContainer(e)}function r(e){var n=e?"remove":"add";o(Z,n,"mousedown",b),o(Z,n,"mouseup",N)}function a(e){var n=e?"remove":"add";o(Z,n,"mousemove",E)}function d(e){var n=e?"remove":"add";o(Z,n,"selectstart",y),o(Z,n,"click",y)}function g(){r(!0),N({})}function y(e){Q&&e.preventDefault()}function b(e){var n=0!==e.which&&1!==e.which||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=w(t);r&&(Q=r,a(),"mousedown"===e.type&&e.preventDefault())}}function E(e){a(!0),d(),S(),C(Q);var n=i(F);K=s("pageX",e)-n.left,z=s("pageY",e)-n.top,h.add(G||F,"gu-transit"),L(),P(e)}function w(e){if(!(te.dragging&&I||t(e))){for(var n=e;e.parentElement&&t(e.parentElement)===!1;){if(ne.invalid(e,n))return;if(e=e.parentElement,!e)return}var r=e.parentElement;if(r&&!ne.invalid(e,n)){var o=ne.moves(e,r,n);if(o)return{item:e,source:r}}}}function x(e){var n=w(e);n&&C(n)}function C(e){ne.copy&&(G=e.item.cloneNode(!0),te.emit("cloned",G,e.item,"copy")),U=e.source,F=e.item,H=V=f(e.item),te.dragging=!0,te.emit("drag",F,U)}function O(){return!1}function S(){if(te.dragging){var e=G||F;T(e,e.parentElement)}}function k(){Q=!1,a(!0),d(!0)}function N(e){if(k(),te.dragging){var n=G||F,t=s("clientX",e),r=s("clientY",e),o=u(I,t,r),i=M(o,t,r);!i||ne.copy!==!1&&i===U?ne.removeOnSpill?B():D():T(n,i)}}function T(e,n){A(n)?te.emit("cancel",e,U):te.emit("drop",e,n,U),$()}function B(){if(te.dragging){var e=G||F,n=e.parentElement;n&&n.removeChild(e),te.emit(ne.copy?"cancel":"remove",e,n),$()}}function D(e){if(te.dragging){var n=arguments.length>0?e:ne.revertOnSpill,t=G||F,r=t.parentElement;r===U&&ne.copy&&r.removeChild(G);var o=A(r);o===!1&&ne.copy===!1&&n&&U.insertBefore(t,H),o||n?te.emit("cancel",t,U):te.emit("drop",t,r,U),$()}}function $(){var e=G||F;k(),R(),e&&h.rm(e,"gu-transit"),J&&clearTimeout(J),te.dragging=!1,te.emit("out",e,ee,U),te.emit("dragend",e),U=F=G=H=V=J=ee=null}function A(e,n){var t;return t=void 0!==n?n:I?V:f(F||G),e===U&&t===H}function M(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var a=j(i,e),u=q(i,a,n,r),c=A(i,u);return c?!0:ne.accepts(F,i,U,u)}for(var i=e;i&&!o();)i=i.parentElement;return i}function P(e){function n(e){te.emit(e,l,ee,U)}function t(){p&&n("over")}function r(){ee&&n("out")}if(I){e.preventDefault();var o=s("clientX",e),i=s("clientY",e),a=o-K,c=i-z;I.style.left=a+"px",I.style.top=c+"px";var l=G||F,d=u(I,o,i),v=M(d,o,i),p=null!==v&&v!==ee;if((p||null===v)&&(r(),ee=v,t()),v===U&&ne.copy)return void(l.parentElement&&l.parentElement.removeChild(l));var m,g=j(v,d);if(null!==g)m=q(v,g,o,i);else{if(ne.revertOnSpill!==!0||ne.copy)return void(ne.copy&&l.parentElement&&l.parentElement.removeChild(l));m=H,v=U}(null===m||m!==l&&m!==f(l)&&m!==V)&&(V=m,v.insertBefore(l,m),te.emit("shadow",l,v))}}function X(e){h.rm(e,"gu-hide")}function Y(e){te.dragging&&h.add(e,"gu-hide")}function L(){if(!I){var e=F.getBoundingClientRect();I=F.cloneNode(!0),I.style.width=v(e)+"px",I.style.height=p(e)+"px",h.rm(I,"gu-transit"),h.add(I,"gu-mirror"),ne.mirrorContainer.appendChild(I),o(Z,"add","mousemove",P),h.add(ne.mirrorContainer,"gu-unselectable"),te.emit("cloned",I,F,"mirror")}}function R(){I&&(h.rm(ne.mirrorContainer,"gu-unselectable"),o(Z,"remove","mousemove",P),I.parentElement.removeChild(I),I=null)}function j(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===Z?null:t}function q(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+v(e)/2:r>e.top+p(e)/2)}function a(e){return e?f(n):n}var u="horizontal"===ne.direction,c=n!==e?i():o();return c}var _=arguments.length;1===_&&Array.isArray(e)===!1&&(n=e,e=[]);var I,U,F,K,z,H,V,G,J,Q,W=document.body,Z=document.documentElement,ee=null,ne=n||{};void 0===ne.moves&&(ne.moves=l),void 0===ne.accepts&&(ne.accepts=l),void 0===ne.invalid&&(ne.invalid=O),void 0===ne.containers&&(ne.containers=e||[]),void 0===ne.isContainer&&(ne.isContainer=c),void 0===ne.copy&&(ne.copy=!1),void 0===ne.revertOnSpill&&(ne.revertOnSpill=!1),void 0===ne.removeOnSpill&&(ne.removeOnSpill=!1),void 0===ne.direction&&(ne.direction="vertical"),void 0===ne.mirrorContainer&&(ne.mirrorContainer=W);var te=m({containers:ne.containers,start:x,end:S,cancel:D,remove:B,destroy:g,dragging:!1});return ne.removeOnSpill===!0&&te.on("over",X).on("out",Y),r(),te}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&g[n](e,a[r],o),g[n](e,i[r],o),g[n](e,r,o)}function i(e){var n=e.getBoundingClientRect();return{left:n.left+a("scrollLeft","pageXOffset"),top:n.top+a("scrollTop","pageYOffset")}}function a(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 u(e,n,t){if(!n&&!t)return null;var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function c(){return!1}function l(){return!0}function f(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function d(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function s(e,n){var t=d(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}function v(e){return e.width||e.right-e.left}function p(e){return e.height||e.bottom-e.top}var m=e("contra/emitter"),g=e("crossvent"),h=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){return e.detachEvent("on"+n,f(e,n,t))}function u(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=document,m=r,g=i,h=[];t.addEventListener||(m=o,g=a),n.exports={add:m,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"];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.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)}})})}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)});

@@ -73,2 +73,3 @@ 'use strict';

$scope.many = ['The', 'possibilities', 'are', 'endless!'];
$scope.many2 = ['Explore', 'them'];
}

@@ -75,0 +76,0 @@ ]);

{
"name": "angular-dragula",
"version": "1.0.6",
"version": "1.0.7",
"description": "Drag and drop so simple it hurts",

@@ -5,0 +5,0 @@ "main": "angular-dragula.js",

@@ -15,2 +15,37 @@ 'use strict';

};
function handleModels(scope, drake){
var dragElm;
var dragIndex;
var dropIndex;
var sourceModel;
drake.on('remove',function removeModel (el, source) {
sourceModel = drake.models[drake.containers.indexOf(source)];
scope.$applyAsync(function applyRemove() {
sourceModel.splice(dragIndex, 1);
});
});
drake.on('drag',function dragModel (el, source) {
dragElm = el;
dragIndex = domIndexOf(el, source);
});
drake.on('drop',function dropModel (dropElm, target, source) {
dropIndex = domIndexOf(dropElm, target);
scope.$applyAsync(function applyDrop() {
sourceModel = drake.models[drake.containers.indexOf(source)];
if (target === source) {
sourceModel.splice(dropIndex, 0, sourceModel.splice(dragIndex, 1)[0]);
} else {
var notCopy = dragElm === dropElm;
var targetModel = drake.models[drake.containers.indexOf(target)];
var dropElmModel = notCopy ? sourceModel[dragIndex] : angular.copy(sourceModel[dragIndex]);
if (notCopy) {
sourceModel.splice(dragIndex, 1);
}
targetModel.splice(dropIndex, 0, dropElmModel);
target.removeChild(dropElm); // element must be removed for ngRepeat to apply correctly
}
});
});
}
function getOrCreateCtx (scope) {

@@ -25,2 +60,5 @@ var ctx = scope[dragulaKey];

}
function domIndexOf(child, parent) {
return Array.prototype.indexOf.call(angular.element(parent).children(), child);
}
function add (scope, name, drake) {

@@ -38,2 +76,5 @@ var bag = find(scope, name);

replicateEvents(angular, bag, scope);
if(drake.models){ // models to sync with (must have same structure as containers)
handleModels(scope, drake);
}
return bag;

@@ -57,3 +98,4 @@ }

function setOptions (scope, name, options) {
add(scope, name, dragula(options));
var bag = add(scope, name, dragula(options));
handleModels(scope, bag.drake);
}

@@ -60,0 +102,0 @@ }];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc