1 |
- (function(m,r,j){var t={full:"0.0.1-f770de9",major:"0",minor:"0",dot:"1",codeName:"badger"},i,g={"false":false,"true":true,"":true},d=function(x){if(typeof x==="string"){var w;if(g.hasOwnProperty(x)){return g[x]}else{w=parseInt(x,10);if(w===w){x=w}}}return x};function k(){}function c(){}var o=function(y,w,x){if(Object.defineProperty){Object.defineProperty(y,w,{get:x,set:function(){},configurable:false,enumerable:true})}else{if(y.__defineGetter__){y.__defineGetter__(w,x)}else{y[w]=x()}}},h,b=/^(\s*(\.-?([a-z\u00A0-\u10FFFF]|(\\\d+))([0-9a-z\u00A0-\u10FFFF_-]|(\\\d+))*)\s*)+$/i,n=function(){var z=["matches","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector"];if(typeof m.Element==="function"&&typeof m.Element.prototype==="object"){for(var x=0,y=z.length;x<y;++x){var w=z[x];if(typeof m.Element.prototype[w]==="function"){var A=m.Element.prototype[w];return function(C,B){return A.call(C[0],B)}}}}if(typeof $==="function"&&typeof $.prototype.is==="function"){return function(C,B){return C.is(B)}}else{if(typeof Sizzle==="function"&&typeof Sizzle.matchesSelector==="function"){return function(C,B){return Sizzle.matchesSelector(C[0],B)}}else{return function(C,B){if(B&&b.test(B)){B=B.replace(/\s+/g,"").replace("."," ").replace(/^\s+/,"").replace(/\s+$/,"");return C.hasClass(B)}else{throw new Error("Only class-based selectors are supported in this browser.")}}}}},a=function(y,w){var x;if(typeof h!=="function"){h=n()}return h(y,w)},v={nodeEq:function(x,w){return(typeof(x.nodeName==="string"?x.nodeName.toLowerCase():x[0].nodeName).toLowerCase()===w)},offset:function(x){x=x.length?x[0]:x;var z,w={top:0,left:0},y=x&&x.ownerDocument;if(!y){return}y=y.documentElement;if(!v.contains(y,x)){return w}if(angular.isFunction(x.getBoundingClientRect)){w=x.getBoundingClientRect()}z=v.window(y);return{top:w.top+z.pageYOffset-y.clientTop,left:w.left+z.pageXOffset-y.clientLeft}},contains:function(x,w){var z=x.nodeType===9?x.documentElement:x,y=w&&w.parentNode;return x===y||!!(y&&y.nodeType===1&&v.contains(z,y))},window:function(w){w=typeof w.nodeName==="undefined"&&typeof w.length==="number"?w[0]:w;return v.isWindow(w)?w:(w.nodeType===9&&w.defaultView)||(w.ownerDocument&&(w.ownerDocument.defaultView||w.ownerDocument.parentWindow))},isWindow:function(w){return w&&w.document&&w.location&&w.alert&&w.setInterval},swapCss:function(A,z,C,y){var x,B,w={};for(B in z){w[B]=A.style[B];A.style[B]=z[B]}x=C.apply(A,y||[]);for(B in z){A.style[B]=w[B]}return x},swapDisplay:/^(none|table(?!-c[ea]).+)/,cssShow:{position:"absolute",visibility:"hidden",display:"block"},size:function(x){var y=angular.element(x);x=x.nodeName?x:x[0];if(x.offsetWidth===0&&v.swapDisplay.test(y.css("display"))){return v.swapCss(x,v.cssShow,w,[x])}return w(x);function w(z){return{width:z.offsetWidth,height:z.offsetHeight}}},keepSize:function(x){var w=v.size(x);w.width=w.width+"px";w.height=w.height+"px";return w},closest:function(w,x){w=angular.element(w);if($.fn&&angular.isFunction($.fn.closest)){return w.closest(x)}w=w[0];x=x.toLowerCase();do{if(w.nodeName.toLowerCase()===x){return angular.element(w)}}while(w=w.parentNode)}};var u={dragKeepSize:"keepSize",dragWithin:"dragWithin"};var e=["$drag","$document","$interpolate","$timeout",function(w,z,y,x){return{restrict:"A",link:function(D,C,B){var A={};angular.forEach(u,function(F,E){if(typeof B[E]!=="undefined"){A[F]=d(y(B[E],false)(D))}});w.draggable(C,A)}}}];var p=function(){this.$get=["$document","$drop",function(D,C){var B={isDraggable:function(E){return !!B.draggable(E,false)},draggable:function(F,E){F=angular.element(F);var G=F.data("$draggable");if(G){return G}if(E===false){return j}E=angular.extend({delay:500,distance:1},E||{});G=new k();G.element=F;G.options=E;F.on("mousedown",G.dragStart);F.data("$draggable",G);return G}};k.prototype={constructor:k,dragStart:function(F){F=z(F);F.preventDefault();var E=y(this)?this:B.draggable(this);if(i){i.dragEnd(F)}i=E;E.cssDisplay=E.element.css("display");E.dimensions=v.size(E.element);if(!E.hanging){E.cssPosition=E.element.css("position");if(E.options.keepSize){E.keepSize={width:E.element[0].style.width,height:E.element[0].style.height};E.element.css(v.keepSize(E.element))}}if(typeof E.options.dragWithin==="string"){E.constraints=A(E.options.dragWithin,E.element)}E.offset=E.positionAbs=v.offset(E.element);E.offset.scroll=false;angular.extend(E.offset,{click:{top:F.pageY-E.offset.top,left:F.pageX-E.offset.left},});E.lastMouseY=F.pageY;E.lastMouseX=F.pageX;E.startEvent=F;E.element.css({position:"absolute",left:E.offset.left,top:E.offset.top});D.on("mousemove",E.drag);D.on("mouseup",E.dragEnd)},dragEnd:function(E){E.preventDefault();D.off("mousemove",self.drag);D.off("mouseup",self.dragEnd);C.drop(E)},drag:function(J){J=z(J);J.preventDefault();var H=i;if(!H){return}var I=H.element.prop("style");var G={top:J.pageY,left:J.pageX},F=I.left||0,L=I.top||0,E,K;K=parseInt(L,10)+(G.top-H.lastMouseY);E=parseInt(F,10)+(G.left-H.lastMouseX);if(!H.constraints||x(H.constraints,E,K,H.dimensions.width,H.dimensions.height)){I.left=E+"px";I.top=K+"px"}H.lastMouseY=G.top;H.lastMouseX=G.left},finish:function(){this.element.css({position:this.cssPosition});this.dimensions=j;i=j}};o(B,"current",function(){return i});o(B,"version",function(){return t});return B}];o(this,"version",function(){return t});function z(B){if(angular.isUndefined(B)){B=m.event||{pageX:0,pageY:0,preventDefault:function(){}}}if(!angular.isFunction(B.preventDefault)){B.preventDefault=function(){}}return B}function y(B){return angular.isObject(B)&&B.constructor===k}function A(C,B){if(C.length===""){return}if(/^(\.|#)/.test(C)&&$.fn&&angular.isFunction($.fn.closest)){return w(B.parent().closest(C))}if(/^(\^|parent)$/.test(C)){return w(B.parent())}return w(v.closest(B.parent(),C))}function w(B){if(typeof B==="undefined"||B.length===0){return}var D=v.offset(B),C=v.size(B);D.right=D.left+C.width;D.bottom=D.top+C.height;return D}function x(F,B,E,C,D){return B>=F.left&&(B+C)<=F.right&&E>=F.top&&(E+D)<=F.bottom}};var q=["$drop","$parse",function(x,w){return{restrict:"A",compile:function(z,y){return function(C,B,A){var E=w(A.dropAllowed||"undefined")(C);var D=x.droppable(B);if(E){D.allowedSelectors(E)}}}}}];var s=function(){this.$get=["$document","$rootScope",function(y,w){var x={isDroppable:function(z){return !!$drag.droppable(z,false)},droppable:function(A,z){A=angular.element(A);var B=A.data("$droppable");if(B){return B}if(z===false){return j}z=angular.extend({constraints:null,delay:500,distance:1},z||{});B=new c();B.element=A;B.options=z;A.data("$droppable",B);return B},drop:function(z,E){if(!i){return}if(typeof z==="undefined"){z=m.event}if(angular.isObject(z)){if(typeof z.clientX==="number"&&typeof z.clientY==="number"){E=z.clientY;z=z.clientX}else{if(typeof z.left==="number"&&typeof z.top==="number"){E=z.top;z=z.left}}}if(typeof z!=="number"||typeof E!=="number"){return}var C=i,A,B;C.element.css({display:"none"});A=r.elementFromPoint(z,E);if(!A){return D()}if(A.nodeType===3){A=A.parentNode}A=angular.element(A);B=A.inheritedData("$droppable");if(!B||!this.dropAllowed(B,C.element)){return D()}B.drop(C);return true;function D(){C.hanging=true;C.element.css({display:C.cssDisplay});i=j;w.$emit("$badDrop",C)}},dropAllowed:function(B,z){var D=B.allowedSelectors();if(!D||!angular.isArray(D)){return true}for(var A=0;A<D.length;++A){var C=D[A];if(typeof C==="string"){if(a(z,C)){return true}}}return false}};c.prototype={constructor:c,drop:function(z,A){z=z||i;if(typeof z.length==="number"||z.nodeName){z=angular.element(z).data("$draggable")}if(!z||z.constructor!==k){return}A=angular.extend(A||{},{display:z.cssDisplay});this.element.append(z.element);if(z.options.keepSize){z.element.css(z.keepSize);z.keepSize=j}z.element.css({display:A.display});z.hanging=false;if(!w.$$phase){w.$apply()}z.finish()},allowedSelectors:function(z){if(arguments.length>0){if(typeof z==="string"){z=z.split(",")}if(angular.isArray(z)){this.allowed=z}return this}return this.allowed}};o(x,"version",function(){return t});return x}];o(this,"version",function(){return t})};var l=function(){this.$get=[function(){var w={};o(w,"current",function(){return i});o(w,"version",function(){return t});return w}];o(this,"version",function(){return t})};function f(){angular.module("ui.drop",[],["$provide",function(w){w.provider({$dnd:l,$drag:p,$drop:s})}]).directive({draggable:e,droppable:q})}f()})(window,document);
|