-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathangular-widget-grid.min.js
9 lines (8 loc) · 20.4 KB
/
angular-widget-grid.min.js
1
2
3
4
5
6
7
8
9
/**
* @license angular-widget-grid v0.2.5
* (c) 2016 Patrick Buergin
* License: MIT
* https://github.com/patbuergin/angular-widget-grid
*/
!function(){angular.module("widgetGrid",[])}(),function(){angular.module("widgetGrid").directive("wgGridOverlay",function(){return{scope:{rendering:"=",highlight:"=?",options:"=?"},restrict:"AE",replace:!0,template:'<div class="wg-grid-overlay"></div>',link:function(a,b){function c(b){angular.isDefined(b)&&f(b,a.options)}function d(b){f(a.rendering,b)}function e(b){if(h(),null!==b)if(angular.isArray(b))for(var c=0;c<b.length;c++)j(b[c],a.rendering);else j(b,a.rendering)}function f(a,b){i(),b&&b.showGrid&&g(a)}function g(a){var c,d,e,f,g=a.grid.cellSize.height,h=a.grid.cellSize.width,i=g+"%",j=h+"%";for(c=1;c<a.grid.rows;c+=2)e=c*g+"%",f='<div class="wg-preview-item wg-preview-row" style="top: '+e+"; height: calc("+i+' - 1px);"></div>',f=angular.element(f),b.append(f),l.push(f);for(c=1;c<a.grid.columns;c+=2)d=c*h+"%",f='<div class="wg-preview-item wg-preview-column" style="left: '+d+"; width: calc("+j+' - 1px);"></div>',f=angular.element(f),b.append(f),l.push(f)}function h(){angular.forEach(k,function(a){a.remove()}),k=[]}function i(){angular.forEach(l,function(a){a.remove()}),l=[]}function j(a,c){var d=c.grid.cellSize.height,e=c.grid.cellSize.width,f=angular.element("<div>");f.addClass("wg-preview-item"),f.addClass("wg-preview-highlight"),f.css("top",(a.top-1)*d+"%"),f.css("left",(a.left-1)*e+"%"),f.css("height",a.height*d+"%"),f.css("width",a.width*e+"%"),b.append(f),k.push(f)}var k=[],l=[];a.options=a.options||{showGrid:!1},a.$watch("highlight",e),a.$watch("options",d,!0),a.$watch("rendering",c)}}})}(),function(){var a={showGrid:!1,highlightNextPosition:!1,clickThrough:!1};angular.module("widgetGrid").controller("wgGridController",["$element","$scope","$timeout","Grid","gridRenderer",function(b,c,d,e,f){function g(a){y.grid.add(a),k()}function h(a){y.grid.remove(a),k()}function i(){var a=parseInt(c.columns),b=parseInt(c.rows);y.grid.columns===a&&y.grid.rows===b||(y.grid.resize(b,a),k())}function j(){y.options=angular.extend({},a,c.options),y.overlayOptions.showGrid=y.options.showGrid,y.options.highlightNextPosition?o():x()}function k(){y.rendering=f.render(y.grid,l),o(),m(),c.$broadcast("wg-update-rendering")}function l(a){c.$emit("wg-update-position",{index:r(a),newPosition:a.getPosition()})}function m(){var a=y.rendering.hasSpaceLeft();a&&z?(c.$emit("wg-grid-space-available"),z=!1):a||z||(c.$emit("wg-grid-full"),z=!0)}function n(a){var b=a.getPosition();y.rendering.setWidgetPosition(a.id,b),l(a),m()}function o(){if(y.options.highlightNextPosition){var a=y.rendering.getNextPosition();y.highlight=a}}function p(a){return y.rendering.getWidgetPosition(a.id)}function q(a){return y.rendering.getStyle(a.id)}function r(a){for(var b=y.grid.widgets.length-1;b>=0;b--)if(y.grid.widgets[b].id===a.id)return b;return-1}function s(){var a=b[0],c=a.getBoundingClientRect();if(c.width||c.height||a.getClientRects().length){var d=a.ownerDocument,e=d.documentElement;return{top:c.top+window.pageYOffset-e.clientTop,left:c.left+window.pageXOffset-e.clientLeft,height:c.height,width:c.width}}return{top:0,left:0,height:0,width:0}}function t(a,b){return y.rendering?y.rendering.isObstructed(a,b):!0}function u(a,b){return y.rendering?y.rendering.isAreaObstructed(a,b):!0}function v(a,c){return y.rendering.rasterizeCoords(a,c,b[0].clientWidth,b[0].clientHeight)}function w(a){a.top&&a.left&&a.height&&a.width&&d(function(){y.highlight=a})}function x(){d(function(){y.highlight=null})}var y=this;y.grid=new e(c.rows,c.columns),y.rendering=null,y.highlight=null,y.options=a,y.overlayOptions={},y.addWidget=g,y.removeWidget=h,y.updateGridSize=i,y.updateRendering=k,y.getPositions=s,y.rasterizeCoords=v,y.updateWidget=n,y.getWidgetRenderPosition=p,y.getWidgetStyle=q,y.isPointObstructed=t,y.isAreaObstructed=u,y.highlightArea=w,y.resetHighlights=x,c.$watch("columns",i),c.$watch("rows",i),c.$watch("options",j,!0),k();var z=!1}]),angular.module("widgetGrid").directive("wgGrid",function(){return{scope:{columns:"@",rows:"@",options:"=?"},restrict:"AE",controller:"wgGridController",controllerAs:"gridCtrl",transclude:!0,replace:!0,templateUrl:"wg-grid"}})}(),function(){angular.module("widgetGrid").directive("wgMovable",["gridUtil",function(a){return{restrict:"A",require:"wgWidget",link:{pre:function(b,c,d,e){var f=a.getTemplate("wg-movable");if(f){var g=angular.element(f);c.append(g),e.innerCompile(g)}}}}}]),angular.module("widgetGrid").directive("wgMover",["$document","gridUtil","PathIterator",function(a,b,c){return{restrict:"A",require:"^wgGrid",link:function(b,d,e,f){function g(c){function e(a){a.preventDefault(),angular.isObject(a.originalEvent)&&(a=a.originalEvent),a.touches&&(a.clientX=a.touches[0].clientX,a.clientY=a.touches[0].clientY);var b=Math.round(a.clientX)-r.left,c=Math.round(a.clientY)-r.top;p.top=Math.min(Math.max(c-q.top,0),r.height-o.height-1),p.left=Math.min(Math.max(b-q.left,0),r.width-o.width-1);var d=h(n,p,o,s,t);f.highlightArea(d),m.css({top:p.top+"px",left:p.left+"px"})}function g(c){if(c.preventDefault(),a.off(j,e),a.off(k,g),f.options.clickThrough&&c.clientX===i.x&&c.clientY===i.y){d.hide();var l=document.elementFromPoint(i.x,i.y);d.show(),angular.element(l).trigger("click")}var q=h(n,p,o,s,t);f.resetHighlights(),m.removeClass("wg-moving"),b.setWidgetPosition(q)}c.preventDefault(),angular.isObject(c.originalEvent)&&(c=c.originalEvent);var i={x:c.clientX,y:c.clientY},l=d[0].parentElement,m=angular.element(l);m.addClass("wg-moving");var n={};n=f.getWidgetRenderPosition(b.widget),n.bottom=n.top+n.height-1,n.right=n.left+n.width-1;var o={};o.top=l.offsetTop,o.left=l.offsetLeft,o.height=l.clientHeight,o.width=l.clientWidth,c.offsetX=c.offsetX||c.layerX,c.offsetY=c.offsetY||c.layerY;var p={top:o.top,left:o.left},q={top:c.offsetY+d[0].offsetTop||0,left:c.offsetX+d[0].offsetLeft||0},r=f.getPositions(),s=f.grid.cellSize.height/100*r.height,t=f.grid.cellSize.width/100*r.width;a.on(j,e),a.on(k,g)}function h(a,b,d,e,g){if(d.top===b.top&&d.left===b.left)return a;var h,i;h=b.top%e>e/2?b.top+Math.floor(e):b.top,i=b.left%g>g/2?b.left+Math.floor(g):b.left;for(var j=h>=d.top,k=i>=d.left,l=f.rasterizeCoords(i,h),m=new c(l,a);m.hasNext();){var n=m.next(),o={top:n.top,left:n.left,height:a.height,width:a.width},p={excludedArea:a,fromBottom:j,fromRight:k};if(!f.isAreaObstructed(o,p)){if(l.top<o.top)for(;l.top<=o.top-1&&!f.isAreaObstructed({top:o.top-1,left:o.left,height:o.height,width:o.width},p);)o.top--;else if(l.top>o.top)for(;l.top>=o.top+1&&!f.isAreaObstructed({top:o.top+1,left:o.left,height:o.height,width:o.width},p);)o.top++;if(l.left<o.left)for(;l.left<=o.left-1&&!f.isAreaObstructed({top:o.top,left:o.left-1,height:o.height,width:o.width},p);)o.left--;else if(l.left>o.left)for(;l.left>=o.left+1&&!f.isAreaObstructed({top:o.top,left:o.left+1,height:o.height,width:o.width},p);)o.left++;return o}}}var i,j,k;window.navigator.pointerEnabled?(i="pointerdown",j="pointermove",k="pointerup"):(i="mousedown touchstart",j="mousemove touchmove",k="mouseup touchend touchcancel"),d.on(i,g)}}}])}(),function(){angular.module("widgetGrid").directive("wgResizable",["gridUtil",function(a){return{restrict:"A",require:"wgWidget",link:{pre:function(b,c,d,e){var f=a.getTemplate("wg-resizable");if(f){var g=angular.element(f);c.append(g),e.innerCompile(g)}}},controller:["$attrs","$parse","$scope",function(a,b,c){var d=this,e=["NW","N","NE","E","SE","S","SW","W"];d.getResizeDirections=function(){var d=b(a.wgResizable)(c);return d&&d.directions?d.directions:e}}],controllerAs:"resizableCtrl"}}]),angular.module("widgetGrid").directive("wgResizer",["$document",function(a){var b=42,c=42;return{restrict:"A",require:["^wgGrid","^wgResizable"],link:function(d,e,f,g){function h(e,f){function g(g){function h(a){a.preventDefault(),angular.isObject(a.originalEvent)&&(a=a.originalEvent),a.touches&&(a.clientX=a.touches[0].clientX,a.clientY=a.touches[0].clientY);var d=Math.round(a.clientX)-u.left,g=Math.round(a.clientY)-u.top;e.up?(s.top=Math.min(Math.max(g-t.top,0),u.height)-r.top,s.top=Math.min(s.top,r.height-b)):e.down&&(s.bottom=r.bottom-Math.min(Math.max(g-t.bottom,0),u.height),s.bottom=Math.min(s.bottom,r.height-b)),e.left?(s.left=Math.min(Math.max(d-t.left,0),u.width)-r.left,s.left=Math.min(s.left,r.width-c)):e.right&&(s.right=r.right-Math.min(Math.max(d-t.right,0),u.width),s.right=Math.min(s.right,r.width-c));var h=m();l.highlightArea(h),f.css({top:s.top+"px",left:s.left+"px",bottom:s.bottom+"px",right:s.right+"px"})}function i(b){b.preventDefault(),a.off(j,h),a.off(k,i);var c=m();d.setWidgetPosition(c),l.resetHighlights(),p.removeClass("wg-resizing"),e.element.removeClass("dragging"),f.removeAttr("style")}function m(){var a,b,c,d={},f=l.rasterizeCoords(r.left+s.left+1,r.top+s.top+1),g=l.rasterizeCoords(r.right-s.right-1,r.bottom-s.bottom-1),h={top:f.top,right:g.left,bottom:g.top,left:f.left};if(e.up&&h.top<q.top)for(d.top=q.top;d.top>h.top;){for(a=!1,c=Math.max(q.left,h.left);c<=Math.min(q.right,h.right);c++)if(l.isPointObstructed(d.top-1,c)){a=!0;break}if(a)break;d.top--}else if(e.down&&h.bottom>q.bottom)for(d.bottom=q.bottom;d.bottom<h.bottom;){for(a=!1,c=Math.max(q.left,h.left);c<=Math.min(q.right,h.right);c++)if(l.isPointObstructed(d.bottom+1,c)){a=!0;break}if(a)break;d.bottom++}if(d.top=d.top||h.top,d.bottom=d.bottom||h.bottom,e.left&&h.left<q.left)for(d.left=q.left;d.left>h.left;){for(a=!1,b=d.top;b<=d.bottom;b++)if(l.isPointObstructed(b,d.left-1)){a=!0;break}if(a)break;d.left--}else if(e.right&&h.right>q.right)for(d.right=q.right;d.right<h.right;){for(a=!1,b=d.top;b<=d.bottom;b++)if(l.isPointObstructed(b,d.right+1)){a=!0;break}if(a)break;d.right++}return d.right=d.right||h.right,d.left=d.left||h.left,d.height=d.bottom-d.top+1,d.width=d.right-d.left+1,d}g.preventDefault(),angular.isObject(g.originalEvent)&&(g=g.originalEvent),e.element.addClass("dragging");var n=f[0],o=n.parentElement,p=angular.element(o);p.addClass("wg-resizing");var q={};q.top=d.widget.top,q.left=d.widget.left,q.bottom=q.top+d.widget.height-1,q.right=q.left+d.widget.width-1;var r={};r.top=Math.ceil(o.offsetTop),r.left=Math.ceil(o.offsetLeft),r.height=Math.floor(n.offsetHeight),r.width=Math.floor(n.offsetWidth),r.bottom=r.top+r.height,r.right=r.left+r.width,g.offsetX=g.offsetX||g.layerX,g.offsetY=g.offsetY||g.layerY;var s={top:0,right:0,bottom:0,left:0},t={top:g.offsetY,left:g.offsetX,bottom:g.offsetY-e.element[0].offsetHeight,right:g.offsetX-e.element[0].offsetWidth},u=l.getPositions();a.on(j,h),a.on(k,i)}e.element.on(i,g)}var i,j,k,l=g[0],m=g[1];window.navigator.pointerEnabled?(i="pointerdown",j="pointermove",k="pointerup"):(i="mousedown touchstart",j="mousemove touchmove",k="mouseup touchend touchcancel");for(var n={N:{up:!0,right:!1,down:!1,left:!1,element:angular.element('<div class="wg-resize wg-resize-axis wg-resize-n"></div>')},E:{up:!1,right:!0,down:!1,left:!1,element:angular.element('<div class="wg-resize wg-resize-axis wg-resize-e"></div>')},S:{up:!1,right:!1,down:!0,left:!1,element:angular.element('<div class="wg-resize wg-resize-axis wg-resize-s"></div>')},W:{up:!1,right:!1,down:!1,left:!0,element:angular.element('<div class="wg-resize wg-resize-axis wg-resize-w"></div>')},NW:{up:!0,right:!1,down:!1,left:!0,element:angular.element('<div class="wg-resize wg-resize-diag wg-resize-nw"></div>')},NE:{up:!0,right:!0,down:!1,left:!1,element:angular.element('<div class="wg-resize wg-resize-diag wg-resize-ne"></div>')},SE:{up:!1,right:!0,down:!0,left:!1,element:angular.element('<div class="wg-resize wg-resize-diag wg-resize-se"></div>')},SW:{up:!1,right:!1,down:!0,left:!0,element:angular.element('<div class="wg-resize wg-resize-diag wg-resize-sw"></div>')}},o=m.getResizeDirections(),p=0;p<o.length;p++){var q=n[angular.uppercase(o[p])];angular.isDefined(q)&&(h(q,e),e.append(q.element))}}}}])}(),function(){angular.module("widgetGrid").controller("wgWidgetController",["$scope","$compile",function(a,b){this.innerCompile=function(c){b(c)(a)}}]),angular.module("widgetGrid").directive("wgWidget",["Widget",function(a){return{scope:{position:"=",editable:"@?"},restrict:"AE",controller:"wgWidgetController",require:"^wgGrid",transclude:!0,templateUrl:"wg-widget",replace:!0,link:function(b,c,d,e){function f(a){var b=h.getPosition();h.setPosition(a);var c=h.getPosition();angular.equals(b,c)||e.updateWidget(h),g()}function g(){c.css(e.getWidgetStyle(h)),b.position=b.position||{},angular.extend(b.position,h.getPosition())}var h=new a(b.position);b.editable="false",b.widget=h,b.setWidgetPosition=f,b.$watch("position",function(a,b){a.top===b.top&&a.left===b.left&&a.width===b.width&&a.height===b.height||f(a)},!0),b.$on("wg-update-rendering",g),b.$on("$destroy",function(){e.removeWidget(h)}),e.addWidget(h)}}}])}(),function(){angular.module("widgetGrid").factory("CellSize",function(){var a=function(a,b){this.height=parseFloat(a)||0,this.width=parseFloat(b)||0};return a.create=function(b,c){var d=b>=1?100/b:0,e=c>=1?100/c:0;return new a(d,e)},a})}(),function(){var a=4,b=4;angular.module("widgetGrid").factory("Grid",["CellSize",function(c){var d=function(d,e){this.widgets=[],this.rows=parseInt(d)||b,this.columns=parseInt(e)||a,this.cellSize=c.create(this.rows,this.columns)};return d.prototype.add=function(a){this.widgets.push(a)},d.prototype.remove=function(a){var b=this.widgets.indexOf(a);b>=0&&this.widgets.splice(b,1)},d.prototype.resize=function(a,b){b=parseInt(b)||0,a=parseInt(a)||0,(b>0&&a>0&&b!==this.columns||a!==this.rows)&&(this.columns=b,this.rows=a,this.cellSize=c.create(this.rows,this.columns))},d}])}(),function(){angular.module("widgetGrid").factory("GridArea",function(){var a=function(a,b,c,d){this.top=parseInt(a)||0,this.left=parseInt(b)||0,this.height=parseInt(c)||0,this.width=parseInt(d)||0};return a.create=function(b,c){var d=c.left-b.left+1,e=c.top-b.top+1;return new a(b.top,b.left,d,e)},a.empty=new a,a.prototype.getBottom=function(){return this.top+this.height-1},a.prototype.getRight=function(){return this.left+this.width-1},a.prototype.getSurfaceArea=function(){return this.height*this.width},a})}(),function(){angular.module("widgetGrid").factory("GridPoint",function(){var a=function(a,b){this.top=parseInt(a)||1,this.left=parseInt(b)||1};return a})}(),function(){angular.module("widgetGrid").factory("GridRendering",["GridArea","GridPoint",function(a,b){function c(b,c){if(!(angular.isDefined(c)&&angular.isDefined(c.grid)&&angular.isNumber(c.grid.columns)&&angular.isNumber(c.grid.rows)))return null;for(var d=null,e=0,f=c.grid.columns,g=b.top;g<=c.grid.rows;g++)for(var h=b.left;f>=h;h++)if(c._isObstructed(g,h))f=h-1;else{var i=g-b.top+1,j=h-b.left+1,k=i*j;k>e&&(e=k,d=new a(b.top,b.left,i,j))}return d}var d=function(a){this.grid=a||{rows:0,columns:0},this.positions={},this.cachedNextPosition=void 0,this.obstructions=[];for(var b=0;b<this.grid.rows*this.grid.columns;b++)this.obstructions[b]=0};return d.prototype.rasterizeCoords=function(a,c,d,e){a=Math.min(Math.max(a,0),d-1),c=Math.min(Math.max(c,0),e-1);var f=Math.floor(c/e*this.grid.rows)+1,g=Math.floor(a/d*this.grid.columns)+1;return new b(f,g)},d.prototype.getWidgetIdAt=function(a,b){for(var c in this.positions){var d=this.positions[c];if(d.top<=a&&a<=d.top+d.height-1&&d.left<=b&&b<=d.left+d.width-1)return c}return null},d.prototype.getWidgetPosition=function(a){return this.positions[a]},d.prototype.setWidgetPosition=function(a,b){var c=this.positions[a];c&&this.setObstructionValues(c,0),b={top:angular.isNumber(b.top)?b.top:c.top,left:angular.isNumber(b.left)?b.left:c.left,height:angular.isNumber(b.height)?b.height:c.height,width:angular.isNumber(b.width)?b.width:c.width},this.positions[a]=b,this.setObstructionValues(this.positions[a],1),this.cachedNextPosition=void 0},d.prototype.hasSpaceLeft=function(){for(var a=0;a<this.obstructions.length;a++)if(!this.obstructions[a])return!0;return!1},d.prototype.getNextPosition=function(){if(angular.isDefined(this.cachedNextPosition))return this.cachedNextPosition;if(!this.hasSpaceLeft())return null;var a=this.findLargestEmptyArea();return this.cachedNextPosition=a,a},d.prototype.isObstructed=function(a,b,c){return 1>a||1>b||b>this.grid.columns||a>this.grid.rows?!0:c&&c.top<=a&&a<=c.bottom&&c.left<=b&&b<=c.right?!1:this._isObstructed(a,b)},d.prototype._isObstructed=function(a,b){return 1===this.obstructions[(a-1)*this.grid.columns+(b-1)]},d.prototype.isAreaObstructed=function(a,b){if(!a)return!1;b=angular.isObject(b)?b:{};var c=a.top,d=a.left,e=a.bottom||a.top+a.height-1,f=a.right||a.left+a.width-1;if(!(angular.isNumber(c)&&angular.isNumber(d)&&angular.isNumber(e)&&angular.isNumber(f)))return!1;for(var g=b.fromBottom?e:c,h=b.fromBottom?-1:1,i=(b.fromBottom?c:e)+h,j=b.fromRight?f:d,k=b.fromRight?-1:1,l=(b.fromRight?d:f)+k,m=g;m!==i;m+=h)for(var n=j;n!==l;n+=k)if(this.isObstructed(m,n,b.excludedArea))return!0;return!1},d.prototype.getStyle=function(a){a=a.id||a;var b=this.positions[a];return b?{top:((b.top-1)*this.grid.cellSize.height).toString()+"%",height:(b.height*this.grid.cellSize.height).toString()+"%",left:((b.left-1)*this.grid.cellSize.width).toString()+"%",width:(b.width*this.grid.cellSize.width).toString()+"%"}:{display:"none"}},d.prototype.setObstructionValues=function(a,b){for(var c=a.top-1;c<a.top+a.height-1;c++)for(var d=a.left-1;d<a.left+a.width-1;d++)this.obstructions[c*this.grid.columns+d]=b},d.prototype.printObstructions=function(){for(var a="obstructions:",b=0;b<this.grid.columns*this.grid.rows;b++)b%this.grid.columns===0&&(console.log(a),a=""),a+=this.obstructions[b]+" ";console.log(a)},d.prototype.findLargestEmptyArea=function(){for(var a=null,d=null,e=0,f=0,g=1;g<=this.grid.rows;g++)for(var h=1;h<=this.grid.columns;h++)if(!this._isObstructed(g,h)){var i=(this.grid.rows-g+1)*(this.grid.columns-h+1);if(e>i)break;d=c(new b(g,h),this),f=d.getSurfaceArea(),f>e&&(e=f,a=d)}return a},d}])}(),function(){angular.module("widgetGrid").factory("PathIterator",["GridPoint",function(a){var b=function(b,c){this.start=b,this.topDelta=c.top-b.top,this.leftDelta=c.left-b.left,this.steps=Math.max(Math.abs(this.topDelta),Math.abs(this.leftDelta)),this.currStep=0,this.currPos=null,this.nextPos=new a(b.top,b.left)};return b.prototype.next=function(){if(this.currPos=this.nextPos,this.currStep<this.steps){this.currStep++;var b=Math.round(this.currStep/this.steps*this.topDelta),c=Math.round(this.currStep/this.steps*this.leftDelta);this.nextPos=new a(this.start.top+b,this.start.left+c)}else this.nextPos=null;return this.currPos},b.prototype.hasNext=function(){return null!==this.nextPos},b}])}(),function(){angular.module("widgetGrid").factory("Widget",["GridArea",function(a){function b(){return(d++).toString()}var c=function(c){this.id=b(),c=c||a.empty,this.top=parseInt(c.top)||0,this.left=parseInt(c.left)||0,this.width=parseInt(c.width)||0,this.height=parseInt(c.height)||0};c.prototype.getPosition=function(){return new a(this.top,this.left,this.height,this.width)},c.prototype.setPosition=function(a){this.top=angular.isNumber(a.top)?a.top:this.top,this.left=angular.isNumber(a.left)?a.left:this.left,this.width=angular.isNumber(a.width)?a.width:this.width,this.height=angular.isNumber(a.height)?a.height:this.height};var d=1;return c}])}(),function(){angular.module("widgetGrid").service("gridRenderer",["GridArea","GridRendering",function(a,b){function c(c,d){var e=c&&c.widgets?c.widgets:[],f=[],g=new b(c);return angular.forEach(e,function(a){var b=a.getPosition();b.width*b.height===0||g.isAreaObstructed(b)?f.push(a):g.setWidgetPosition(a.id,a)}),angular.forEach(f,function(b){var c=g.getNextPosition();null!==c?(b.setPosition(c),g.setWidgetPosition(b.id,c)):(b.setPosition(a.empty),g.setWidgetPosition(b.id,a.empty)),void 0!==d&&d(b)}),g}var d={render:c};return d}])}(),function(){angular.module("widgetGrid").service("gridUtil",["$templateCache",function(a){function b(b){var c=a.get(b);return c?c:null}function c(a){var b=[];if(!a.length||a.length<2)return a;for(var c,d,e,f=0;f<a.length;f++){c=a[f],e=!1;for(var g=0;g<b.length;g++)if(d=b[g],c.top<d.top||c.top===d.top&&c.left<d.left){b.splice(g,0,c),e=!0;break}e||b.push(c)}return b}var d={getTemplate:b,sortWidgets:c};return d}])}(),angular.module("widgetGrid").run(["$templateCache",function(a){"use strict";a.put("wg-grid",'<div class=wg-grid><div class=wg-grid-widgets ng-transclude></div><div wg-grid-overlay options=gridCtrl.overlayOptions rendering=gridCtrl.rendering highlight="gridCtrl.highlight"></div>'),a.put("wg-movable",'<div wg-mover ng-show="editable === \'true\'" class="wg-widget-edit wg-widget-edit-move"></div>'),a.put("wg-resizable",'<div wg-resizer ng-show="editable === \'true\'" class="wg-widget-edit wg-widget-edit-resize"></div>'),a.put("wg-widget","<div class=wg-widget ng-class=\"{ editable: editable === 'true' }\"><div class=wg-widget-content ng-transclude></div></div>")}]);
//# sourceMappingURL=angular-widget-grid.min.js.map