From 49ad47dde21d08d9cdd8e19da9c3749040289c66 Mon Sep 17 00:00:00 2001 From: Sergii Stotskyi Date: Thu, 6 Jul 2017 11:11:29 +0300 Subject: [PATCH 01/10] refactor(project): replaces lodash with native Array methods For older browsers added Array.prototype.find shim --- README.md | 6 +- bower.json | 1 - demo/anijs.html | 4 +- demo/float.html | 2 +- demo/knockout.html | 4 +- demo/knockout2.html | 4 +- demo/nested.html | 2 +- demo/responsive.html | 4 +- demo/rtl.html | 7 +- demo/serialization.html | 8 +- demo/two.html | 10 +- dist/gridstack.all.js | 6 +- dist/gridstack.jQueryUI.js | 13 +- dist/gridstack.jQueryUI.min.js | 2 +- dist/gridstack.js | 163 +++++++++++++++-------- dist/gridstack.min.js | 4 +- dist/gridstack.min.map | 2 +- karma.conf.js | 4 +- package.json | 8 +- spec/e2e/html/gridstack-with-height.html | 2 +- spec/gridstack-engine-spec.js | 2 +- src/gridstack.jQueryUI.js | 13 +- src/gridstack.js | 163 +++++++++++++++-------- 23 files changed, 271 insertions(+), 163 deletions(-) diff --git a/README.md b/README.md index 1bf790473..b44b20269 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,8 @@ Usage ## Requirements -* [lodash.js](https://lodash.com) (>= 3.5.0, full build) * [jQuery](http://jquery.com) (>= 3.1.0) - -Note: You can still use [underscore.js](http://underscorejs.org) (>= 1.7.0) instead of lodash.js +* `Array.prototype.find` for IE and older browsers ([core.js](https://github.com/zloirock/core-js#ecmascript-6-array) allows to include specific polyfills) #### Using gridstack.js with jQuery UI @@ -155,7 +153,7 @@ Please use [jQuery UI Touch Punch](https://github.com/furf/jquery-ui-touch-punch working on touch-based devices. ```html - + diff --git a/bower.json b/bower.json index 34824238a..98a1855ef 100644 --- a/bower.json +++ b/bower.json @@ -14,7 +14,6 @@ "amd" ], "dependencies": { - "lodash": ">= 4.14.2", "jquery": ">= 3.1.0", "jquery-ui": ">= 1.12.0" }, diff --git a/demo/anijs.html b/demo/anijs.html index 6d66b428c..d8898493c 100644 --- a/demo/anijs.html +++ b/demo/anijs.html @@ -18,7 +18,7 @@ - + @@ -86,4 +86,4 @@

Widget added

}); - \ No newline at end of file + diff --git a/demo/float.html b/demo/float.html index e1a968db8..9c3d9f430 100644 --- a/demo/float.html +++ b/demo/float.html @@ -16,7 +16,7 @@ - + diff --git a/demo/knockout.html b/demo/knockout.html index 0c20e1955..a7677333e 100644 --- a/demo/knockout.html +++ b/demo/knockout.html @@ -16,7 +16,7 @@ - + @@ -63,7 +63,7 @@

knockout.js Demo

}).data('gridstack'); } - var item = _.find(items, function (i) { return i.nodeType == 1 }); + var item = items.find(function (i) { return i.nodeType == 1 }); grid.addWidget(item); ko.utils.domNodeDisposal.addDisposeCallback(item, function () { grid.removeWidget(item); diff --git a/demo/knockout2.html b/demo/knockout2.html index 0b3ebee1c..f7beb9287 100644 --- a/demo/knockout2.html +++ b/demo/knockout2.html @@ -16,7 +16,7 @@ - + @@ -63,7 +63,7 @@

knockout.js Demo

}).data('gridstack'); } - var item = _.find(items, function (i) { return i.nodeType == 1 }); + var item = items.find(function (i) { return i.nodeType == 1 }); grid.addWidget(item); ko.utils.domNodeDisposal.addDisposeCallback(item, function () { grid.removeWidget(item); diff --git a/demo/nested.html b/demo/nested.html index 4b451e22e..607d1093d 100644 --- a/demo/nested.html +++ b/demo/nested.html @@ -16,7 +16,7 @@ - + diff --git a/demo/responsive.html b/demo/responsive.html index d07dfc832..98f05d56d 100644 --- a/demo/responsive.html +++ b/demo/responsive.html @@ -17,7 +17,7 @@ - + @@ -106,7 +106,7 @@

Responsive grid demo

this.loadGrid = function () { this.grid.removeAll(); var items = GridStackUI.Utils.sort(this.serializedData); - _.each(items, function (node, i) { + items.forEach(function (node, i) { this.grid.addWidget($('
' + i + '
'), node.x, node.y, node.width, node.height); }, this); diff --git a/demo/rtl.html b/demo/rtl.html index 0f27dafd0..564cfbab0 100644 --- a/demo/rtl.html +++ b/demo/rtl.html @@ -16,7 +16,7 @@ - + @@ -62,7 +62,7 @@

RTL Demo

}).data('gridstack'); } - var item = _.find(items, function (i) { return i.nodeType == 1 }); + var item = items.find(function (i) { return i.nodeType == 1 }); grid.addWidget(item); ko.utils.domNodeDisposal.addDisposeCallback(item, function () { grid.removeWidget(item); @@ -95,7 +95,8 @@

RTL Demo

y: 0, width: Math.floor(1 + 3 * Math.random()), height: Math.floor(1 + 3 * Math.random()), - auto_position: true + auto_position: true, + index: 'auto' }); return false; }; diff --git a/demo/serialization.html b/demo/serialization.html index a58e847c1..3f5bea8c2 100644 --- a/demo/serialization.html +++ b/demo/serialization.html @@ -16,7 +16,7 @@ - + @@ -76,7 +76,7 @@

Serialization demo

this.loadGrid = function () { this.grid.removeAll(); var items = GridStackUI.Utils.sort(this.serializedData); - _.each(items, function (node) { + items.forEach(function (node) { this.grid.addWidget($('
'), node.x, node.y, node.width, node.height); }, this); @@ -84,7 +84,7 @@

Serialization demo

}.bind(this); this.saveGrid = function () { - this.serializedData = _.map($('.grid-stack > .grid-stack-item:visible'), function (el) { + this.serializedData = $('.grid-stack > .grid-stack-item:visible').map(function (i, el) { el = $(el); var node = el.data('_gridstack_node'); return { @@ -93,7 +93,7 @@

Serialization demo

width: node.width, height: node.height }; - }, this); + }).toArray(); $('#saved-data').val(JSON.stringify(this.serializedData, null, ' ')); return false; }.bind(this); diff --git a/demo/two.html b/demo/two.html index 852eab1d8..c1f8d9a9d 100644 --- a/demo/two.html +++ b/demo/two.html @@ -17,7 +17,7 @@ - + @@ -113,9 +113,9 @@

Two grids demo

acceptWidgets: '.grid-stack-item' }; $('#grid1').gridstack(options); - $('#grid2').gridstack(_.defaults({ + $('#grid2').gridstack($.extend({}, options, { float: true - }, options)); + })); var items = [ {x: 0, y: 0, width: 2, height: 2}, @@ -128,10 +128,10 @@

Two grids demo

$('.grid-stack').each(function () { var grid = $(this).data('gridstack'); - _.each(items, function (node) { + items.forEach(function (node) { grid.addWidget($('
'), node.x, node.y, node.width, node.height); - }, this); + }); }); $('.sidebar .grid-stack-item').draggable({ diff --git a/dist/gridstack.all.js b/dist/gridstack.all.js index c4e0d0305..2c9db0688 100644 --- a/dist/gridstack.all.js +++ b/dist/gridstack.all.js @@ -5,13 +5,13 @@ * gridstack.js may be freely distributed under the MIT license. * @preserve */ -!function(a){if("function"==typeof define&&define.amd)define(["jquery","lodash"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(a){}try{_=require("lodash")}catch(a){}a(jQuery,_)}else a(jQuery,_)}(function(a,b){function c(a){this.grid=a}var d=window,e=function(a,b,c){var d=function(){return console.warn("gridstack.js: Function `"+b+"` is deprecated as of v0.2.5 and has been replaced with `"+c+"`. It will be **completely** removed in v1.0."),a.apply(this,arguments)};return d.prototype=a.prototype,d},f=function(a,b){console.warn("gridstack.js: Option `"+a+"` is deprecated as of v0.2.5 and has been replaced with `"+b+"`. It will be **completely** removed in v1.0.")},g={isIntercepted:function(a,b){return!(a.x+a.width<=b.x||b.x+b.width<=a.x||a.y+a.height<=b.y||b.y+b.height<=a.y)},sort:function(a,c,d){return d=d||b.chain(a).map(function(a){return a.x+a.width}).max().value(),c=-1!=c?1:-1,b.sortBy(a,function(a){return c*(a.x+a.y*d)})},createStylesheet:function(a){var b=document.createElement("style");return b.setAttribute("type","text/css"),b.setAttribute("data-gs-style-id",a),b.styleSheet?b.styleSheet.cssText="":b.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(b),b.sheet},removeStylesheet:function(b){a("STYLE[data-gs-style-id="+b+"]").remove()},insertCSSRule:function(a,b,c,d){"function"==typeof a.insertRule?a.insertRule(b+"{"+c+"}",d):"function"==typeof a.addRule&&a.addRule(b,c,d)},toBool:function(a){return"boolean"==typeof a?a:"string"==typeof a?!(""===(a=a.toLowerCase())||"no"==a||"false"==a||"0"==a):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&g.isIntercepted(a,this.nn)},_didCollide:function(a){return g.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return g.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.height},a)},parseHeight:function(a){var c=a,d="px";if(c&&b.isString(c)){var e=c.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!e)throw new Error("Invalid height");d=e[2]||"px",c=parseFloat(e[1])}return{height:c,unit:d}}};g.is_intercepted=e(g.isIntercepted,"is_intercepted","isIntercepted"),g.create_stylesheet=e(g.createStylesheet,"create_stylesheet","createStylesheet"),g.remove_stylesheet=e(g.removeStylesheet,"remove_stylesheet","removeStylesheet"),g.insert_css_rule=e(g.insertCSSRule,"insert_css_rule","insertCSSRule"),c.registeredPlugins=[],c.registerPlugin=function(a){c.registeredPlugins.push(a)},c.prototype.resizable=function(a,b){return this},c.prototype.draggable=function(a,b){return this},c.prototype.droppable=function(a,b){return this},c.prototype.isDroppable=function(a){return!1},c.prototype.on=function(a,b,c){return this};var h=0,i=function(a,b,c,d,e){this.width=a,this.float=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this.float,this._addedNodes=[],this._removedNodes=[]};i.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},i.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())},i.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},i.prototype._fixCollisions=function(a){this._sortNodes(-1);var c=a,d=Boolean(b.find(this.nodes,function(a){return a.locked}));for(this.float||d||(c={x:0,y:a.y,width:this.width,height:a.height});;){var e=b.find(this.nodes,b.bind(g._collisionNodeCheck,{node:a,nn:c}));if(void 0===e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},i.prototype.isAreaEmpty=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},h=b.find(this.nodes,b.bind(function(a){return g.isIntercepted(a,f)},this));return null===h||void 0===h},i.prototype._sortNodes=function(a){this.nodes=g.sort(this.nodes,a,this.width)},i.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&void 0!==a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(g._didCollide,{n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var f=b.chain(this.nodes).take(c).find(b.bind(g._didCollide,{n:a,newY:d})).value();e=void 0===f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},i.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},i.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]=void 0===a[0]?[]:[a[0]],a[1]=void 0===a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},i.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},i.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},i.prototype.addNode=function(a,c){if(a=this._prepareNode(a),void 0!==a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),void 0!==a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),void 0!==a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),void 0!==a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++h,a._dirty=!0,a.autoPosition){this._sortNodes();for(var d=0;;++d){var e=d%this.width,f=Math.floor(d/this.width);if(!(e+a.width>this.width)&&!b.find(this.nodes,b.bind(g._isAddNodeIntercepted,{x:e,y:f,node:a}))){a.x=e,a.y=f;break}}}return this.nodes.push(a),void 0!==c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},i.prototype.removeNode=function(a,c){c=void 0===c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},i.prototype.canMoveNode=function(c,d,e,f,g){if(!this.isNodeChangedPosition(c,d,e,f,g))return!1;var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;var j,k=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if(void 0===j)return!0;k.moveNode(j,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},i.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},i.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},i.prototype.moveNode=function(a,b,c,d,e,f){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},i.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},i.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},i.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var j=function(d,e){var g,h,j=this;e=e||{},this.container=a(d),void 0!==e.handle_class&&(e.handleClass=e.handle_class,f("handle_class","handleClass")),void 0!==e.item_class&&(e.itemClass=e.item_class,f("item_class","itemClass")),void 0!==e.placeholder_class&&(e.placeholderClass=e.placeholder_class,f("placeholder_class","placeholderClass")),void 0!==e.placeholder_text&&(e.placeholderText=e.placeholder_text,f("placeholder_text","placeholderText")),void 0!==e.cell_height&&(e.cellHeight=e.cell_height,f("cell_height","cellHeight")),void 0!==e.vertical_margin&&(e.verticalMargin=e.vertical_margin,f("vertical_margin","verticalMargin")),void 0!==e.min_width&&(e.minWidth=e.min_width,f("min_width","minWidth")),void 0!==e.static_grid&&(e.staticGrid=e.static_grid,f("static_grid","staticGrid")),void 0!==e.is_nested&&(e.isNested=e.is_nested,f("is_nested","isNested")),void 0!==e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,f("always_show_resize_handle","alwaysShowResizeHandle")),e.itemClass=e.itemClass||"grid-stack-item";var k=this.container.closest("."+e.itemClass).length>0;if(this.opts=b.defaults(e||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,float:!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:e.alwaysShowResizeHandle||!1,resizable:b.defaults(e.resizable||{},{autoHide:!e.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(e.draggable||{},{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:e.disableDrag||!1,disableResize:e.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:e.disableOneColumnMode||!1,oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),!1===this.opts.ddPlugin?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)||c),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,h="auto"===this.opts.cellHeight,h?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new i(this.opts.width,function(a,c){c=void 0===c||c;var d=0;b.each(a,function(a){c&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),d=Math.max(d,a.y+a.height))}),j._updateStyles(d+10)},this.opts.float,this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),b.chain(l).sortBy(function(a){return a.i}).each(function(a){j._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&j._updateHeightsOnResize(),j._isOneColumnMode()&&!j.opts.disableOneColumnMode){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),b.each(j.grid.nodes,function(a){j.container.append(a.el),j.opts.staticGrid||(j.dd.draggable(a.el,"disable"),j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;b.each(j.grid.nodes,function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(!0===j.opts.acceptWidgets?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);if(d.data("_gridstack_node")){d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d);var f=a(c.draggable).data("_gridstack_node_orig");void 0!==f&&void 0!==f._grid&&f._grid._triggerRemoveEvent(),a(c.helper).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j.grid._addedNodes.push(d),j._triggerAddEvent(),j._triggerChangeEvent(),j.grid.endUpdate(),a(c.draggable).unbind("drag",p),a(c.draggable).removeData("_gridstack_node"),a(c.draggable).removeData("_gridstack_node_orig")})}};return j.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||!0===a)&&this.container.trigger("change",d)},j.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},j.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},j.prototype._initStyles=function(){this._stylesId&&g.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=g.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},j.prototype._updateStyles=function(a){if(null!==this._styles&&void 0!==this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if(void 0===a&&(a=this._styles._max),this._initStyles(),this._updateContainerHeight(),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&g.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e=f.grid.width||k<0||!f.grid.float&&k>f.grid.getGridHeight()?c._temporaryRemoved||(!0===f.opts.removable&&f._setupRemovingTimeout(b),j=c._beforeDragX,k=c._beforeDragY,f.placeholder.detach(),f.placeholder.hide(),f.grid.removeNode(c),f._updateContainerHeight(),c._temporaryRemoved=!0):(f._clearRemovingTimeout(b),c._temporaryRemoved&&(f.grid.addNode(c),f.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),f.container.append(f.placeholder),c.el=f.placeholder,c._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return;var l=void 0!==h?h:c.lastTriedWidth,m=void 0!==i?i:c.lastTriedHeight;!f.grid.canMoveNode(c,j,k,h,i)||c.lastTriedX===j&&c.lastTriedY===k&&c.lastTriedWidth===l&&c.lastTriedHeight===m||(c.lastTriedX=j,c.lastTriedY=k,c.lastTriedWidth=h,c.lastTriedHeight=i,f.grid.moveNode(c,j,k,h,i),f._updateContainerHeight())},h=function(g,h){f.container.append(f.placeholder);var i=a(this);f.grid.cleanNodes(),f.grid.beginUpdate(c),d=f.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));e=f.container.height()/parseInt(f.container.attr("data-gs-current-height")),f.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),c.el=f.placeholder,c._beforeDragX=c.x,c._beforeDragY=c.y,f.dd.resizable(b,"option","minWidth",d*(c.minWidth||1)),f.dd.resizable(b,"option","minHeight",j*(c.minHeight||1)),"resizestart"==g.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(d,e){var g=a(this);if(g.data("_gridstack_node")){var h=!1;if(f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove){h=!0;b.data("_gridstack_node")._grid._triggerRemoveEvent(),b.removeData("_gridstack_node"),b.remove()}else f._clearRemovingTimeout(b),c._temporaryRemoved?(g.attr("data-gs-x",c._beforeDragX).attr("data-gs-y",c._beforeDragY).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style"),c.x=c._beforeDragX,c.y=c._beforeDragY,f.grid.addNode(c)):g.attr("data-gs-x",c.x).attr("data-gs-y",c.y).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style");f._updateContainerHeight(),f._triggerChangeEvent(h),f.grid.endUpdate();var i=g.find(".grid-stack");i.length&&"resizestop"==d.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),g.find(".grid-stack-item").trigger("resizestop"),g.find(".grid-stack-item").trigger("gsresizestop")),"resizestop"==d.type&&f.container.trigger("gsresizestop",g)}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)},j.prototype._prepareElement=function(b,c){c=void 0!==c&&c;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:g.toBool(b.attr("data-gs-auto-position")),noResize:g.toBool(b.attr("data-gs-no-resize")),noMove:g.toBool(b.attr("data-gs-no-move")),locked:g.toBool(b.attr("data-gs-locked")),resizeHandles:b.attr("data-gs-resize-handles"),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},j.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},j.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),void 0!==c&&b.attr("data-gs-x",c),void 0!==d&&b.attr("data-gs-y",d),void 0!==e&&b.attr("data-gs-width",e),void 0!==f&&b.attr("data-gs-height",f),void 0!==g&&b.attr("data-gs-auto-position",g?"yes":null),void 0!==h&&b.attr("data-gs-min-width",h),void 0!==i&&b.attr("data-gs-max-width",i),void 0!==j&&b.attr("data-gs-min-height",j),void 0!==k&&b.attr("data-gs-max-height",k),void 0!==l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},j.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},j.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},j.prototype.removeWidget=function(b,c){c=void 0===c||c,b=a(b);var d=b.data("_gridstack_node");d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},j.prototype.removeAll=function(a){b.each(this.grid.nodes,b.bind(function(b){this.removeWidget(b.el,a)},this)),this.grid.nodes=[],this._updateContainerHeight()},j.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),void 0===b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),g.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},j.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noResize=!c,f.noResize||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?d.dd.resizable(e,"disable"):d.dd.resizable(e,"enable"))}),this},j.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noMove=!c,f.noMove||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},j.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},j.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},j.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},j.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},j.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},j.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},j.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},j.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},j.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},j.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if(void 0!==d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},j.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.width,c=null!==c&&void 0!==c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},j.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.x,c=null!==c&&void 0!==c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},j.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&void 0!==b?b:f.x,c=null!==c&&void 0!==c?c:f.y,d=null!==d&&void 0!==d?d:f.width,e=null!==e&&void 0!==e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},j.prototype.verticalMargin=function(a,b){if(void 0===a)return this.opts.verticalMargin;var c=g.parseHeight(a);this.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},j.prototype.cellHeight=function(a,b){if(void 0===a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=g.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},j.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},j.prototype.getCellFromPixel=function(a,b){var c=void 0!==b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},j.prototype.batchUpdate=function(){this.grid.batchUpdate()},j.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},j.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},j.prototype.setStatic=function(a){this.opts.staticGrid=!0===a,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},j.prototype._setStaticClass=function(){!0===this.opts.staticGrid?this.container.addClass("grid-stack-static"):this.container.removeClass("grid-stack-static")},j.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;de?1:-1})},defaults:function(a){return Array.prototype.slice.call(arguments,1).forEach(function(b){for(var c in b)b.hasOwnProperty(c)&&!a.hasOwnProperty(c)&&(a[c]=b[c])}),a},clone:function(b){return a.extend({},b)},throttle:function(a,b){var c=!1;return function(){c||(a.apply(this,arguments),c=!0,setTimeout(function(){c=!1},b))}}};f.is_intercepted=d(f.isIntercepted,"is_intercepted","isIntercepted"),f.create_stylesheet=d(f.createStylesheet,"create_stylesheet","createStylesheet"),f.remove_stylesheet=d(f.removeStylesheet,"remove_stylesheet","removeStylesheet"),f.insert_css_rule=d(f.insertCSSRule,"insert_css_rule","insertCSSRule"),b.registeredPlugins=[],b.registerPlugin=function(a){b.registeredPlugins.push(a)},b.prototype.resizable=function(a,b){return this},b.prototype.draggable=function(a,b){return this},b.prototype.droppable=function(a,b){return this},b.prototype.isDroppable=function(a){return!1},b.prototype.on=function(a,b,c){return this};var g=0,h=function(a,b,c,d,e){this.width=a,this.float=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this.float,this._addedNodes=[],this._removedNodes=[]};h.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},h.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())},h.prototype.getNodeDataByDOMEl=function(a){return this.nodes.find(function(b){return a.get(0)===b.el.get(0)})},h.prototype._fixCollisions=function(a){this._sortNodes(-1);var b=a,c=Boolean(this.nodes.find(function(a){return a.locked}));for(this.float||c||(b={x:0,y:a.y,width:this.width,height:a.height});;){var d=this.nodes.find(f._collisionNodeCheck,{node:a,nn:b});if(void 0===d)return;this.moveNode(d,d.x,a.y+a.height,d.width,d.height,!0)}},h.prototype.isAreaEmpty=function(a,b,c,d){var e={x:a||0,y:b||0,width:c||1,height:d||1},g=this.nodes.find(function(a){return f.isIntercepted(a,e)});return null===g||void 0===g},h.prototype._sortNodes=function(a){this.nodes=f.sort(this.nodes,a,this.width)},h.prototype._packNodes=function(){this._sortNodes(),this.float?this.nodes.forEach(function(a,b){if(!a._updating&&void 0!==a._origY&&a.y!=a._origY)for(var c=a.y;c>=a._origY;){var d=this.nodes.find(f._didCollide,{n:a,newY:c});d||(a._dirty=!0,a.y=c),--c}},this):this.nodes.forEach(function(a,b){if(!a.locked)for(;a.y>0;){var c=a.y-1,d=0===b;if(b>0){var e=this.nodes.slice(0,b).find(f._didCollide,{n:a,newY:c});d=void 0===e}if(!d)break;a._dirty=a.y!=c,a.y=c}},this)},h.prototype._prepareNode=function(a,b){return a=f.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(b?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},h.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]=void 0===a[0]?[]:[a[0]],a[1]=void 0===a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},h.prototype.cleanNodes=function(){this._updateCounter||this.nodes.forEach(function(a){a._dirty=!1})},h.prototype.getDirtyNodes=function(){return this.nodes.filter(function(a){return a._dirty})},h.prototype.addNode=function(a,b){if(a=this._prepareNode(a),void 0!==a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),void 0!==a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),void 0!==a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),void 0!==a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++g,a._dirty=!0,a.autoPosition){this._sortNodes();for(var c=0;;++c){var d=c%this.width,e=Math.floor(c/this.width);if(!(d+a.width>this.width)&&!this.nodes.find(f._isAddNodeIntercepted,{x:d,y:e,node:a})){a.x=d,a.y=e;break}}}return this.nodes.push(a),void 0!==b&&b&&this._addedNodes.push(f.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},h.prototype.removeNode=function(a,b){b=void 0===b||b,this._removedNodes.push(f.clone(a)),a._id=null,this.nodes=f.without(this.nodes,a),this._packNodes(),this._notify(a,b)},h.prototype.canMoveNode=function(b,c,d,e,f){if(!this.isNodeChangedPosition(b,c,d,e,f))return!1;var g=Boolean(this.nodes.find(function(a){return a.locked}));if(!this.height&&!g)return!0;var i,j=new h(this.width,null,this.float,0,this.nodes.map(function(c){return c==b?i=a.extend({},c):a.extend({},c)}));if(void 0===i)return!0;j.moveNode(i,c,d,e,f);var k=!0;return g&&(k&=!Boolean(j.nodes.find(function(a){return a!=i&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(k&=j.getGridHeight()<=this.height),k},h.prototype.canBePlacedWithRespectToHeight=function(b){if(!this.height)return!0;var c=new h(this.width,null,this.float,0,this.nodes.map(function(b){return a.extend({},b)}));return c.addNode(b),c.getGridHeight()<=this.height},h.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},h.prototype.moveNode=function(a,b,c,d,e,f){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},h.prototype.getGridHeight=function(){return this.nodes.reduce(function(a,b){return Math.max(a,b.y+b.height)},0)},h.prototype.beginUpdate=function(a){this.nodes.forEach(function(a){a._origY=a.y}),a._updating=!0},h.prototype.endUpdate=function(){this.nodes.forEach(function(a){a._origY=a.y});var a=this.nodes.find(function(a){return a._updating});a&&(a._updating=!1)};var i=function(c,d){var g,i,j=this;d=d||{},this.container=a(c),void 0!==d.handle_class&&(d.handleClass=d.handle_class,e("handle_class","handleClass")),void 0!==d.item_class&&(d.itemClass=d.item_class,e("item_class","itemClass")),void 0!==d.placeholder_class&&(d.placeholderClass=d.placeholder_class,e("placeholder_class","placeholderClass")),void 0!==d.placeholder_text&&(d.placeholderText=d.placeholder_text,e("placeholder_text","placeholderText")),void 0!==d.cell_height&&(d.cellHeight=d.cell_height,e("cell_height","cellHeight")),void 0!==d.vertical_margin&&(d.verticalMargin=d.vertical_margin,e("vertical_margin","verticalMargin")),void 0!==d.min_width&&(d.minWidth=d.min_width,e("min_width","minWidth")),void 0!==d.static_grid&&(d.staticGrid=d.static_grid,e("static_grid","staticGrid")),void 0!==d.is_nested&&(d.isNested=d.is_nested,e("is_nested","isNested")),void 0!==d.always_show_resize_handle&&(d.alwaysShowResizeHandle=d.always_show_resize_handle,e("always_show_resize_handle","alwaysShowResizeHandle")),d.itemClass=d.itemClass||"grid-stack-item";var k=this.container.closest("."+d.itemClass).length>0;if(this.opts=f.defaults(d||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,float:!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:d.alwaysShowResizeHandle||!1,resizable:f.defaults(d.resizable||{},{autoHide:!d.alwaysShowResizeHandle,handles:"se"}),draggable:f.defaults(d.draggable||{},{handle:(d.handleClass?"."+d.handleClass:d.handle?d.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:d.disableDrag||!1,disableResize:d.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:d.disableOneColumnMode||!1,oneColumnModeClass:d.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),!1===this.opts.ddPlugin?this.opts.ddPlugin=b:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.registeredPlugins[0]||b),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,i="auto"===this.opts.cellHeight,i?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new h(this.opts.width,function(a,b){b=void 0===b||b;var c=0;a.forEach(function(a){b&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),c=Math.max(c,a.y+a.height))}),j._updateStyles(c+10)},this.opts.float,this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),f.sortBy(l,function(a){return a.i}).forEach(function(a){this._prepareElement(a.el)},this)}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=f.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(i&&j._updateHeightsOnResize(),j._isOneColumnMode()&&!j.opts.disableOneColumnMode){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),j.grid.nodes.forEach(function(a){j.container.append(a.el),j.opts.staticGrid||(j.dd.draggable(a.el,"disable"),j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;j.grid.nodes.forEach(function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(!0===j.opts.acceptWidgets?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);if(d.data("_gridstack_node")){d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d);var f=a(c.draggable).data("_gridstack_node_orig");void 0!==f&&void 0!==f._grid&&f._grid._triggerRemoveEvent(),a(c.helper).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j.grid._addedNodes.push(d),j._triggerAddEvent(),j._triggerChangeEvent(),j.grid.endUpdate(),a(c.draggable).unbind("drag",p),a(c.draggable).removeData("_gridstack_node"),a(c.draggable).removeData("_gridstack_node_orig")})}};return i.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||!0===a)&&this.container.trigger("change",d)},i.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[this.grid._addedNodes.map(f.clone)]),this.grid._addedNodes=[])},i.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[this.grid._removedNodes.map(f.clone)]),this.grid._removedNodes=[])},i.prototype._initStyles=function(){this._stylesId&&f.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=f.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},i.prototype._updateStyles=function(a){if(null!==this._styles&&void 0!==this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if(void 0===a&&(a=this._styles._max),this._initStyles(),this._updateContainerHeight(),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&f.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e=f.grid.width||k<0||!f.grid.float&&k>f.grid.getGridHeight()?c._temporaryRemoved||(!0===f.opts.removable&&f._setupRemovingTimeout(b),j=c._beforeDragX,k=c._beforeDragY,f.placeholder.detach(),f.placeholder.hide(),f.grid.removeNode(c),f._updateContainerHeight(),c._temporaryRemoved=!0):(f._clearRemovingTimeout(b),c._temporaryRemoved&&(f.grid.addNode(c),f.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),f.container.append(f.placeholder),c.el=f.placeholder,c._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return;var l=void 0!==h?h:c.lastTriedWidth,m=void 0!==i?i:c.lastTriedHeight;!f.grid.canMoveNode(c,j,k,h,i)||c.lastTriedX===j&&c.lastTriedY===k&&c.lastTriedWidth===l&&c.lastTriedHeight===m||(c.lastTriedX=j,c.lastTriedY=k,c.lastTriedWidth=h,c.lastTriedHeight=i,f.grid.moveNode(c,j,k,h,i),f._updateContainerHeight())},h=function(g,h){f.container.append(f.placeholder);var i=a(this);f.grid.cleanNodes(),f.grid.beginUpdate(c),d=f.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));e=f.container.height()/parseInt(f.container.attr("data-gs-current-height")),f.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),c.el=f.placeholder,c._beforeDragX=c.x,c._beforeDragY=c.y,f.dd.resizable(b,"option","minWidth",d*(c.minWidth||1)),f.dd.resizable(b,"option","minHeight",j*(c.minHeight||1)),"resizestart"==g.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(d,e){var g=a(this);if(g.data("_gridstack_node")){var h=!1;if(f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove){h=!0;b.data("_gridstack_node")._grid._triggerRemoveEvent(),b.removeData("_gridstack_node"),b.remove()}else f._clearRemovingTimeout(b),c._temporaryRemoved?(g.attr("data-gs-x",c._beforeDragX).attr("data-gs-y",c._beforeDragY).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style"),c.x=c._beforeDragX,c.y=c._beforeDragY,f.grid.addNode(c)):g.attr("data-gs-x",c.x).attr("data-gs-y",c.y).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style");f._updateContainerHeight(),f._triggerChangeEvent(h),f.grid.endUpdate();var i=g.find(".grid-stack");i.length&&"resizestop"==d.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),g.find(".grid-stack-item").trigger("resizestop"),g.find(".grid-stack-item").trigger("gsresizestop")),"resizestop"==d.type&&f.container.trigger("gsresizestop",g)}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)},i.prototype._prepareElement=function(b,c){c=void 0!==c&&c;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:f.toBool(b.attr("data-gs-auto-position")),noResize:f.toBool(b.attr("data-gs-no-resize")),noMove:f.toBool(b.attr("data-gs-no-move")),locked:f.toBool(b.attr("data-gs-locked")),resizeHandles:b.attr("data-gs-resize-handles"),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},i.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},i.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),void 0!==c&&b.attr("data-gs-x",c),void 0!==d&&b.attr("data-gs-y",d),void 0!==e&&b.attr("data-gs-width",e),void 0!==f&&b.attr("data-gs-height",f),void 0!==g&&b.attr("data-gs-auto-position",g?"yes":null),void 0!==h&&b.attr("data-gs-min-width",h),void 0!==i&&b.attr("data-gs-max-width",i),void 0!==j&&b.attr("data-gs-min-height",j),void 0!==k&&b.attr("data-gs-max-height",k),void 0!==l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},i.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},i.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},i.prototype.removeWidget=function(b,c){c=void 0===c||c,b=a(b);var d=b.data("_gridstack_node");d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},i.prototype.removeAll=function(a){this.grid.nodes.forEach(function(b){this.removeWidget(b.el,a)},this),this.grid.nodes=[],this._updateContainerHeight()},i.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),void 0===b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),f.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},i.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noResize=!c,f.noResize||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?d.dd.resizable(e,"disable"):d.dd.resizable(e,"enable"))}),this},i.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noMove=!c,f.noMove||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},i.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},i.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},i.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},i.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},i.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},i.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},i.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},i.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},i.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},i.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if(void 0!==d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},i.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.width,c=null!==c&&void 0!==c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},i.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.x,c=null!==c&&void 0!==c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},i.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&void 0!==b?b:f.x,c=null!==c&&void 0!==c?c:f.y,d=null!==d&&void 0!==d?d:f.width,e=null!==e&&void 0!==e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},i.prototype.verticalMargin=function(a,b){if(void 0===a)return this.opts.verticalMargin;var c=f.parseHeight(a);this.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},i.prototype.cellHeight=function(a,b){if(void 0===a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=f.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},i.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},i.prototype.getCellFromPixel=function(a,b){var c=void 0!==b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},i.prototype.batchUpdate=function(){this.grid.batchUpdate()},i.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},i.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},i.prototype.setStatic=function(a){this.opts.staticGrid=!0===a,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},i.prototype._setStaticClass=function(){!0===this.opts.staticGrid?this.container.addClass("grid-stack-static"):this.container.removeClass("grid-stack-static")},i.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;d valueRight ? 1 : -1; + }); + }, + + defaults: function(target) { + var sources = Array.prototype.slice.call(arguments, 1); + + sources.forEach(function(source) { + for (var prop in source) { + if (source.hasOwnProperty(prop) && !target.hasOwnProperty(prop)) { + target[prop] = source[prop]; + } + } + }); + + return target; + }, + + clone: function(target) { + return $.extend({}, target); + }, + + throttle: function(callback, delay) { + var isWaiting = false; + + return function() { + if (!isWaiting) { + callback.apply(this, arguments); + isWaiting = true; + setTimeout(function() { isWaiting = false; }, delay); + } + }; } }; @@ -187,7 +245,7 @@ // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 GridStackEngine.prototype.getNodeDataByDOMEl = function(el) { - return _.find(this.nodes, function(n) { return el.get(0) === n.el.get(0); }); + return this.nodes.find(function(n) { return el.get(0) === n.el.get(0); }); }; GridStackEngine.prototype._fixCollisions = function(node) { @@ -195,12 +253,12 @@ this._sortNodes(-1); var nn = node; - var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; })); + var hasLocked = Boolean(this.nodes.find(function(n) { return n.locked; })); if (!this.float && !hasLocked) { nn = {x: 0, y: node.y, width: this.width, height: node.height}; } while (true) { - var collisionNode = _.find(this.nodes, _.bind(Utils._collisionNodeCheck, {node: node, nn: nn})); + var collisionNode = this.nodes.find(Utils._collisionNodeCheck, {node: node, nn: nn}); if (typeof collisionNode == 'undefined') { return; } @@ -211,9 +269,9 @@ GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height) { var nn = {x: x || 0, y: y || 0, width: width || 1, height: height || 1}; - var collisionNode = _.find(this.nodes, _.bind(function(n) { + var collisionNode = this.nodes.find(function(n) { return Utils.isIntercepted(n, nn); - }, this)); + }); return collisionNode === null || typeof collisionNode === 'undefined'; }; @@ -225,16 +283,14 @@ this._sortNodes(); if (this.float) { - _.each(this.nodes, _.bind(function(n, i) { + this.nodes.forEach(function(n, i) { if (n._updating || typeof n._origY == 'undefined' || n.y == n._origY) { return; } var newY = n.y; while (newY >= n._origY) { - var collisionNode = _.chain(this.nodes) - .find(_.bind(Utils._didCollide, {n: n, newY: newY})) - .value(); + var collisionNode = this.nodes.find(Utils._didCollide, {n: n, newY: newY}); if (!collisionNode) { n._dirty = true; @@ -242,9 +298,9 @@ } --newY; } - }, this)); + }, this); } else { - _.each(this.nodes, _.bind(function(n, i) { + this.nodes.forEach(function(n, i) { if (n.locked) { return; } @@ -253,10 +309,9 @@ var canBeMoved = i === 0; if (i > 0) { - var collisionNode = _.chain(this.nodes) - .take(i) - .find(_.bind(Utils._didCollide, {n: n, newY: newY})) - .value(); + var collisionNode = this.nodes + .slice(0, i) + .find(Utils._didCollide, {n: n, newY: newY}); canBeMoved = typeof collisionNode == 'undefined'; } @@ -266,12 +321,12 @@ n._dirty = n.y != newY; n.y = newY; } - }, this)); + }, this); } }; GridStackEngine.prototype._prepareNode = function(node, resizing) { - node = _.defaults(node || {}, {width: 1, height: 1, x: 0, y: 0}); + node = Utils.defaults(node || {}, {width: 1, height: 1, x: 0, y: 0}); node.x = parseInt('' + node.x); node.y = parseInt('' + node.y); @@ -325,11 +380,11 @@ if (this._updateCounter) { return; } - _.each(this.nodes, function(n) {n._dirty = false; }); + this.nodes.forEach(function(n) { n._dirty = false; }); }; GridStackEngine.prototype.getDirtyNodes = function() { - return _.filter(this.nodes, function(n) { return n._dirty; }); + return this.nodes.filter(function(n) { return n._dirty; }); }; GridStackEngine.prototype.addNode = function(node, triggerAddEvent) { @@ -352,7 +407,7 @@ if (x + node.width > this.width) { continue; } - if (!_.find(this.nodes, _.bind(Utils._isAddNodeIntercepted, {x: x, y: y, node: node}))) { + if (!this.nodes.find(Utils._isAddNodeIntercepted, {x: x, y: y, node: node})) { node.x = x; node.y = y; break; @@ -362,7 +417,7 @@ this.nodes.push(node); if (typeof triggerAddEvent != 'undefined' && triggerAddEvent) { - this._addedNodes.push(_.clone(node)); + this._addedNodes.push(Utils.clone(node)); } this._fixCollisions(node); @@ -373,9 +428,9 @@ GridStackEngine.prototype.removeNode = function(node, detachNode) { detachNode = typeof detachNode === 'undefined' ? true : detachNode; - this._removedNodes.push(_.clone(node)); + this._removedNodes.push(Utils.clone(node)); node._id = null; - this.nodes = _.without(this.nodes, node); + this.nodes = Utils.without(this.nodes, node); this._packNodes(); this._notify(node, detachNode); }; @@ -384,7 +439,7 @@ if (!this.isNodeChangedPosition(node, x, y, width, height)) { return false; } - var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; })); + var hasLocked = Boolean(this.nodes.find(function(n) { return n.locked; })); if (!this.height && !hasLocked) { return true; @@ -396,7 +451,7 @@ null, this.float, 0, - _.map(this.nodes, function(n) { + this.nodes.map(function(n) { if (n == node) { clonedNode = $.extend({}, n); return clonedNode; @@ -413,7 +468,7 @@ var res = true; if (hasLocked) { - res &= !Boolean(_.find(clone.nodes, function(n) { + res &= !Boolean(clone.nodes.find(function(n) { return n != clonedNode && Boolean(n.locked) && Boolean(n._dirty); })); } @@ -434,7 +489,7 @@ null, this.float, 0, - _.map(this.nodes, function(n) { return $.extend({}, n); })); + this.nodes.map(function(n) { return $.extend({}, n); })); clone.addNode(node); return clone.getGridHeight() <= this.height; }; @@ -498,21 +553,21 @@ }; GridStackEngine.prototype.getGridHeight = function() { - return _.reduce(this.nodes, function(memo, n) { return Math.max(memo, n.y + n.height); }, 0); + return this.nodes.reduce(function(memo, n) { return Math.max(memo, n.y + n.height); }, 0); }; GridStackEngine.prototype.beginUpdate = function(node) { - _.each(this.nodes, function(n) { + this.nodes.forEach(function(n) { n._origY = n.y; }); node._updating = true; }; GridStackEngine.prototype.endUpdate = function() { - _.each(this.nodes, function(n) { + this.nodes.forEach(function(n) { n._origY = n.y; }); - var n = _.find(this.nodes, function(n) { return n._updating; }); + var n = this.nodes.find(function(n) { return n._updating; }); if (n) { n._updating = false; } @@ -572,7 +627,7 @@ opts.itemClass = opts.itemClass || 'grid-stack-item'; var isNested = this.container.closest('.' + opts.itemClass).length > 0; - this.opts = _.defaults(opts || {}, { + this.opts = Utils.defaults(opts || {}, { width: parseInt(this.container.attr('data-gs-width')) || 12, height: parseInt(this.container.attr('data-gs-height')) || 0, itemClass: 'grid-stack-item', @@ -589,11 +644,11 @@ _class: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), animate: Boolean(this.container.attr('data-gs-animate')) || false, alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, - resizable: _.defaults(opts.resizable || {}, { + resizable: Utils.defaults(opts.resizable || {}, { autoHide: !(opts.alwaysShowResizeHandle || false), handles: 'se' }), - draggable: _.defaults(opts.draggable || {}, { + draggable: Utils.defaults(opts.draggable || {}, { handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || '.grid-stack-item-content', scroll: false, @@ -614,7 +669,7 @@ if (this.opts.ddPlugin === false) { this.opts.ddPlugin = GridStackDragDropPlugin; } else if (this.opts.ddPlugin === null) { - this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins) || GridStackDragDropPlugin; + this.opts.ddPlugin = GridStackDragDropPlugin.registeredPlugins[0] || GridStackDragDropPlugin; } this.dd = new this.opts.ddPlugin(this); @@ -650,7 +705,7 @@ this.grid = new GridStackEngine(this.opts.width, function(nodes, detachNode) { detachNode = typeof detachNode === 'undefined' ? true : detachNode; var maxHeight = 0; - _.each(nodes, function(n) { + nodes.forEach(function(n) { if (detachNode && n._id === null) { if (n.el) { n.el.remove(); @@ -678,9 +733,9 @@ i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * _this.opts.width }); }); - _.chain(elements).sortBy(function(x) { return x.i; }).each(function(i) { - self._prepareElement(i.el); - }).value(); + Utils.sortBy(elements, function(x) { return x.i; }).forEach(function(i) { + this._prepareElement(i.el); + }, this); } this.setAnimation(this.opts.animate); @@ -691,7 +746,7 @@ this._updateContainerHeight(); - this._updateHeightsOnResize = _.throttle(function() { + this._updateHeightsOnResize = Utils.throttle(function() { self.cellHeight(self.cellWidth(), false); }, 100); @@ -708,7 +763,7 @@ oneColumnMode = true; self.grid._sortNodes(); - _.each(self.grid.nodes, function(node) { + self.grid.nodes.forEach(function(node) { self.container.append(node.el); if (self.opts.staticGrid) { @@ -731,7 +786,7 @@ return; } - _.each(self.grid.nodes, function(node) { + self.grid.nodes.forEach(function(node) { if (!node.noMove && !self.opts.disableDrag) { self.dd.draggable(node.el, 'enable'); } @@ -912,14 +967,14 @@ GridStack.prototype._triggerAddEvent = function() { if (this.grid._addedNodes && this.grid._addedNodes.length > 0) { - this.container.trigger('added', [_.map(this.grid._addedNodes, _.clone)]); + this.container.trigger('added', [this.grid._addedNodes.map(Utils.clone)]); this.grid._addedNodes = []; } }; GridStack.prototype._triggerRemoveEvent = function() { if (this.grid._removedNodes && this.grid._removedNodes.length > 0) { - this.container.trigger('removed', [_.map(this.grid._removedNodes, _.clone)]); + this.container.trigger('removed', [this.grid._removedNodes.map(Utils.clone)]); this.grid._removedNodes = []; } }; @@ -1324,9 +1379,9 @@ }; GridStack.prototype.removeAll = function(detachNode) { - _.each(this.grid.nodes, _.bind(function(node) { + this.grid.nodes.forEach(function(node) { this.removeWidget(node.el, detachNode); - }, this)); + }, this); this.grid.nodes = []; this._updateContainerHeight(); }; diff --git a/dist/gridstack.min.js b/dist/gridstack.min.js index a38f653df..d97d1b723 100644 --- a/dist/gridstack.min.js +++ b/dist/gridstack.min.js @@ -5,6 +5,6 @@ * gridstack.js may be freely distributed under the MIT license. * @preserve */ -!function(a){if("function"==typeof define&&define.amd)define(["jquery","lodash"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(a){}try{_=require("lodash")}catch(a){}a(jQuery,_)}else a(jQuery,_)}(function(a,b){function c(a){this.grid=a}var d=window,e=function(a,b,c){var d=function(){return console.warn("gridstack.js: Function `"+b+"` is deprecated as of v0.2.5 and has been replaced with `"+c+"`. It will be **completely** removed in v1.0."),a.apply(this,arguments)};return d.prototype=a.prototype,d},f=function(a,b){console.warn("gridstack.js: Option `"+a+"` is deprecated as of v0.2.5 and has been replaced with `"+b+"`. It will be **completely** removed in v1.0.")},g={isIntercepted:function(a,b){return!(a.x+a.width<=b.x||b.x+b.width<=a.x||a.y+a.height<=b.y||b.y+b.height<=a.y)},sort:function(a,c,d){return d=d||b.chain(a).map(function(a){return a.x+a.width}).max().value(),c=-1!=c?1:-1,b.sortBy(a,function(a){return c*(a.x+a.y*d)})},createStylesheet:function(a){var b=document.createElement("style");return b.setAttribute("type","text/css"),b.setAttribute("data-gs-style-id",a),b.styleSheet?b.styleSheet.cssText="":b.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(b),b.sheet},removeStylesheet:function(b){a("STYLE[data-gs-style-id="+b+"]").remove()},insertCSSRule:function(a,b,c,d){"function"==typeof a.insertRule?a.insertRule(b+"{"+c+"}",d):"function"==typeof a.addRule&&a.addRule(b,c,d)},toBool:function(a){return"boolean"==typeof a?a:"string"==typeof a?!(""===(a=a.toLowerCase())||"no"==a||"false"==a||"0"==a):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&g.isIntercepted(a,this.nn)},_didCollide:function(a){return g.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return g.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.height},a)},parseHeight:function(a){var c=a,d="px";if(c&&b.isString(c)){var e=c.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!e)throw new Error("Invalid height");d=e[2]||"px",c=parseFloat(e[1])}return{height:c,unit:d}}};g.is_intercepted=e(g.isIntercepted,"is_intercepted","isIntercepted"),g.create_stylesheet=e(g.createStylesheet,"create_stylesheet","createStylesheet"),g.remove_stylesheet=e(g.removeStylesheet,"remove_stylesheet","removeStylesheet"),g.insert_css_rule=e(g.insertCSSRule,"insert_css_rule","insertCSSRule"),c.registeredPlugins=[],c.registerPlugin=function(a){c.registeredPlugins.push(a)},c.prototype.resizable=function(a,b){return this},c.prototype.draggable=function(a,b){return this},c.prototype.droppable=function(a,b){return this},c.prototype.isDroppable=function(a){return!1},c.prototype.on=function(a,b,c){return this};var h=0,i=function(a,b,c,d,e){this.width=a,this.float=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this.float,this._addedNodes=[],this._removedNodes=[]};i.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},i.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())},i.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},i.prototype._fixCollisions=function(a){this._sortNodes(-1);var c=a,d=Boolean(b.find(this.nodes,function(a){return a.locked}));for(this.float||d||(c={x:0,y:a.y,width:this.width,height:a.height});;){var e=b.find(this.nodes,b.bind(g._collisionNodeCheck,{node:a,nn:c}));if(void 0===e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},i.prototype.isAreaEmpty=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},h=b.find(this.nodes,b.bind(function(a){return g.isIntercepted(a,f)},this));return null===h||void 0===h},i.prototype._sortNodes=function(a){this.nodes=g.sort(this.nodes,a,this.width)},i.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&void 0!==a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(g._didCollide,{n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var f=b.chain(this.nodes).take(c).find(b.bind(g._didCollide,{n:a,newY:d})).value();e=void 0===f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},i.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},i.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]=void 0===a[0]?[]:[a[0]],a[1]=void 0===a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},i.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},i.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},i.prototype.addNode=function(a,c){if(a=this._prepareNode(a),void 0!==a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),void 0!==a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),void 0!==a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),void 0!==a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++h,a._dirty=!0,a.autoPosition){this._sortNodes();for(var d=0;;++d){var e=d%this.width,f=Math.floor(d/this.width);if(!(e+a.width>this.width)&&!b.find(this.nodes,b.bind(g._isAddNodeIntercepted,{x:e,y:f,node:a}))){a.x=e,a.y=f;break}}}return this.nodes.push(a),void 0!==c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},i.prototype.removeNode=function(a,c){c=void 0===c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},i.prototype.canMoveNode=function(c,d,e,f,g){if(!this.isNodeChangedPosition(c,d,e,f,g))return!1;var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;var j,k=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if(void 0===j)return!0;k.moveNode(j,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},i.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},i.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},i.prototype.moveNode=function(a,b,c,d,e,f){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},i.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},i.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},i.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var j=function(d,e){var g,h,j=this;e=e||{},this.container=a(d),void 0!==e.handle_class&&(e.handleClass=e.handle_class,f("handle_class","handleClass")),void 0!==e.item_class&&(e.itemClass=e.item_class,f("item_class","itemClass")),void 0!==e.placeholder_class&&(e.placeholderClass=e.placeholder_class,f("placeholder_class","placeholderClass")),void 0!==e.placeholder_text&&(e.placeholderText=e.placeholder_text,f("placeholder_text","placeholderText")),void 0!==e.cell_height&&(e.cellHeight=e.cell_height,f("cell_height","cellHeight")),void 0!==e.vertical_margin&&(e.verticalMargin=e.vertical_margin,f("vertical_margin","verticalMargin")),void 0!==e.min_width&&(e.minWidth=e.min_width,f("min_width","minWidth")),void 0!==e.static_grid&&(e.staticGrid=e.static_grid,f("static_grid","staticGrid")),void 0!==e.is_nested&&(e.isNested=e.is_nested,f("is_nested","isNested")),void 0!==e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,f("always_show_resize_handle","alwaysShowResizeHandle")),e.itemClass=e.itemClass||"grid-stack-item";var k=this.container.closest("."+e.itemClass).length>0;if(this.opts=b.defaults(e||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,float:!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:e.alwaysShowResizeHandle||!1,resizable:b.defaults(e.resizable||{},{autoHide:!e.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(e.draggable||{},{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:e.disableDrag||!1,disableResize:e.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:e.disableOneColumnMode||!1,oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),!1===this.opts.ddPlugin?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)||c),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,h="auto"===this.opts.cellHeight,h?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new i(this.opts.width,function(a,c){c=void 0===c||c;var d=0;b.each(a,function(a){c&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),d=Math.max(d,a.y+a.height))}),j._updateStyles(d+10)},this.opts.float,this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),b.chain(l).sortBy(function(a){return a.i}).each(function(a){j._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&j._updateHeightsOnResize(),j._isOneColumnMode()&&!j.opts.disableOneColumnMode){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),b.each(j.grid.nodes,function(a){j.container.append(a.el),j.opts.staticGrid||(j.dd.draggable(a.el,"disable"),j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;b.each(j.grid.nodes,function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(!0===j.opts.acceptWidgets?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);if(d.data("_gridstack_node")){d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d);var f=a(c.draggable).data("_gridstack_node_orig");void 0!==f&&void 0!==f._grid&&f._grid._triggerRemoveEvent(),a(c.helper).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j.grid._addedNodes.push(d),j._triggerAddEvent(),j._triggerChangeEvent(),j.grid.endUpdate(),a(c.draggable).unbind("drag",p),a(c.draggable).removeData("_gridstack_node"),a(c.draggable).removeData("_gridstack_node_orig")})}};return j.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||!0===a)&&this.container.trigger("change",d)},j.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},j.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},j.prototype._initStyles=function(){this._stylesId&&g.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=g.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},j.prototype._updateStyles=function(a){if(null!==this._styles&&void 0!==this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if(void 0===a&&(a=this._styles._max),this._initStyles(),this._updateContainerHeight(),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&g.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e=f.grid.width||k<0||!f.grid.float&&k>f.grid.getGridHeight()?c._temporaryRemoved||(!0===f.opts.removable&&f._setupRemovingTimeout(b),j=c._beforeDragX,k=c._beforeDragY,f.placeholder.detach(),f.placeholder.hide(),f.grid.removeNode(c),f._updateContainerHeight(),c._temporaryRemoved=!0):(f._clearRemovingTimeout(b),c._temporaryRemoved&&(f.grid.addNode(c),f.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),f.container.append(f.placeholder),c.el=f.placeholder,c._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return;var l=void 0!==h?h:c.lastTriedWidth,m=void 0!==i?i:c.lastTriedHeight;!f.grid.canMoveNode(c,j,k,h,i)||c.lastTriedX===j&&c.lastTriedY===k&&c.lastTriedWidth===l&&c.lastTriedHeight===m||(c.lastTriedX=j,c.lastTriedY=k,c.lastTriedWidth=h,c.lastTriedHeight=i,f.grid.moveNode(c,j,k,h,i),f._updateContainerHeight())},h=function(g,h){f.container.append(f.placeholder);var i=a(this);f.grid.cleanNodes(),f.grid.beginUpdate(c),d=f.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));e=f.container.height()/parseInt(f.container.attr("data-gs-current-height")),f.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),c.el=f.placeholder,c._beforeDragX=c.x,c._beforeDragY=c.y,f.dd.resizable(b,"option","minWidth",d*(c.minWidth||1)),f.dd.resizable(b,"option","minHeight",j*(c.minHeight||1)),"resizestart"==g.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(d,e){var g=a(this);if(g.data("_gridstack_node")){var h=!1;if(f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove){h=!0;b.data("_gridstack_node")._grid._triggerRemoveEvent(),b.removeData("_gridstack_node"),b.remove()}else f._clearRemovingTimeout(b),c._temporaryRemoved?(g.attr("data-gs-x",c._beforeDragX).attr("data-gs-y",c._beforeDragY).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style"),c.x=c._beforeDragX,c.y=c._beforeDragY,f.grid.addNode(c)):g.attr("data-gs-x",c.x).attr("data-gs-y",c.y).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style");f._updateContainerHeight(),f._triggerChangeEvent(h),f.grid.endUpdate();var i=g.find(".grid-stack");i.length&&"resizestop"==d.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),g.find(".grid-stack-item").trigger("resizestop"),g.find(".grid-stack-item").trigger("gsresizestop")),"resizestop"==d.type&&f.container.trigger("gsresizestop",g)}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)},j.prototype._prepareElement=function(b,c){c=void 0!==c&&c;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:g.toBool(b.attr("data-gs-auto-position")),noResize:g.toBool(b.attr("data-gs-no-resize")),noMove:g.toBool(b.attr("data-gs-no-move")),locked:g.toBool(b.attr("data-gs-locked")),resizeHandles:b.attr("data-gs-resize-handles"),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},j.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},j.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),void 0!==c&&b.attr("data-gs-x",c),void 0!==d&&b.attr("data-gs-y",d),void 0!==e&&b.attr("data-gs-width",e),void 0!==f&&b.attr("data-gs-height",f),void 0!==g&&b.attr("data-gs-auto-position",g?"yes":null),void 0!==h&&b.attr("data-gs-min-width",h),void 0!==i&&b.attr("data-gs-max-width",i),void 0!==j&&b.attr("data-gs-min-height",j),void 0!==k&&b.attr("data-gs-max-height",k),void 0!==l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},j.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},j.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},j.prototype.removeWidget=function(b,c){c=void 0===c||c,b=a(b);var d=b.data("_gridstack_node");d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},j.prototype.removeAll=function(a){b.each(this.grid.nodes,b.bind(function(b){this.removeWidget(b.el,a)},this)),this.grid.nodes=[],this._updateContainerHeight()},j.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),void 0===b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),g.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},j.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noResize=!c,f.noResize||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?d.dd.resizable(e,"disable"):d.dd.resizable(e,"enable"))}),this},j.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noMove=!c,f.noMove||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},j.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},j.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},j.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},j.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},j.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},j.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},j.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},j.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},j.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},j.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if(void 0!==d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},j.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.width,c=null!==c&&void 0!==c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},j.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.x,c=null!==c&&void 0!==c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},j.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&void 0!==b?b:f.x,c=null!==c&&void 0!==c?c:f.y,d=null!==d&&void 0!==d?d:f.width,e=null!==e&&void 0!==e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},j.prototype.verticalMargin=function(a,b){if(void 0===a)return this.opts.verticalMargin;var c=g.parseHeight(a);this.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},j.prototype.cellHeight=function(a,b){if(void 0===a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=g.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},j.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},j.prototype.getCellFromPixel=function(a,b){var c=void 0!==b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},j.prototype.batchUpdate=function(){this.grid.batchUpdate()},j.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},j.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},j.prototype.setStatic=function(a){this.opts.staticGrid=!0===a,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},j.prototype._setStaticClass=function(){!0===this.opts.staticGrid?this.container.addClass("grid-stack-static"):this.container.removeClass("grid-stack-static")},j.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;de?1:-1})},defaults:function(a){return Array.prototype.slice.call(arguments,1).forEach(function(b){for(var c in b)b.hasOwnProperty(c)&&!a.hasOwnProperty(c)&&(a[c]=b[c])}),a},clone:function(b){return a.extend({},b)},throttle:function(a,b){var c=!1;return function(){c||(a.apply(this,arguments),c=!0,setTimeout(function(){c=!1},b))}}};f.is_intercepted=d(f.isIntercepted,"is_intercepted","isIntercepted"),f.create_stylesheet=d(f.createStylesheet,"create_stylesheet","createStylesheet"),f.remove_stylesheet=d(f.removeStylesheet,"remove_stylesheet","removeStylesheet"),f.insert_css_rule=d(f.insertCSSRule,"insert_css_rule","insertCSSRule"),b.registeredPlugins=[],b.registerPlugin=function(a){b.registeredPlugins.push(a)},b.prototype.resizable=function(a,b){return this},b.prototype.draggable=function(a,b){return this},b.prototype.droppable=function(a,b){return this},b.prototype.isDroppable=function(a){return!1},b.prototype.on=function(a,b,c){return this};var g=0,h=function(a,b,c,d,e){this.width=a,this.float=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this.float,this._addedNodes=[],this._removedNodes=[]};h.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},h.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())},h.prototype.getNodeDataByDOMEl=function(a){return this.nodes.find(function(b){return a.get(0)===b.el.get(0)})},h.prototype._fixCollisions=function(a){this._sortNodes(-1);var b=a,c=Boolean(this.nodes.find(function(a){return a.locked}));for(this.float||c||(b={x:0,y:a.y,width:this.width,height:a.height});;){var d=this.nodes.find(f._collisionNodeCheck,{node:a,nn:b});if(void 0===d)return;this.moveNode(d,d.x,a.y+a.height,d.width,d.height,!0)}},h.prototype.isAreaEmpty=function(a,b,c,d){var e={x:a||0,y:b||0,width:c||1,height:d||1},g=this.nodes.find(function(a){return f.isIntercepted(a,e)});return null===g||void 0===g},h.prototype._sortNodes=function(a){this.nodes=f.sort(this.nodes,a,this.width)},h.prototype._packNodes=function(){this._sortNodes(),this.float?this.nodes.forEach(function(a,b){if(!a._updating&&void 0!==a._origY&&a.y!=a._origY)for(var c=a.y;c>=a._origY;){var d=this.nodes.find(f._didCollide,{n:a,newY:c});d||(a._dirty=!0,a.y=c),--c}},this):this.nodes.forEach(function(a,b){if(!a.locked)for(;a.y>0;){var c=a.y-1,d=0===b;if(b>0){var e=this.nodes.slice(0,b).find(f._didCollide,{n:a,newY:c});d=void 0===e}if(!d)break;a._dirty=a.y!=c,a.y=c}},this)},h.prototype._prepareNode=function(a,b){return a=f.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(b?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},h.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]=void 0===a[0]?[]:[a[0]],a[1]=void 0===a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},h.prototype.cleanNodes=function(){this._updateCounter||this.nodes.forEach(function(a){a._dirty=!1})},h.prototype.getDirtyNodes=function(){return this.nodes.filter(function(a){return a._dirty})},h.prototype.addNode=function(a,b){if(a=this._prepareNode(a),void 0!==a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),void 0!==a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),void 0!==a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),void 0!==a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++g,a._dirty=!0,a.autoPosition){this._sortNodes();for(var c=0;;++c){var d=c%this.width,e=Math.floor(c/this.width);if(!(d+a.width>this.width)&&!this.nodes.find(f._isAddNodeIntercepted,{x:d,y:e,node:a})){a.x=d,a.y=e;break}}}return this.nodes.push(a),void 0!==b&&b&&this._addedNodes.push(f.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},h.prototype.removeNode=function(a,b){b=void 0===b||b,this._removedNodes.push(f.clone(a)),a._id=null,this.nodes=f.without(this.nodes,a),this._packNodes(),this._notify(a,b)},h.prototype.canMoveNode=function(b,c,d,e,f){if(!this.isNodeChangedPosition(b,c,d,e,f))return!1;var g=Boolean(this.nodes.find(function(a){return a.locked}));if(!this.height&&!g)return!0;var i,j=new h(this.width,null,this.float,0,this.nodes.map(function(c){return c==b?i=a.extend({},c):a.extend({},c)}));if(void 0===i)return!0;j.moveNode(i,c,d,e,f);var k=!0;return g&&(k&=!Boolean(j.nodes.find(function(a){return a!=i&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(k&=j.getGridHeight()<=this.height),k},h.prototype.canBePlacedWithRespectToHeight=function(b){if(!this.height)return!0;var c=new h(this.width,null,this.float,0,this.nodes.map(function(b){return a.extend({},b)}));return c.addNode(b),c.getGridHeight()<=this.height},h.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},h.prototype.moveNode=function(a,b,c,d,e,f){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},h.prototype.getGridHeight=function(){return this.nodes.reduce(function(a,b){return Math.max(a,b.y+b.height)},0)},h.prototype.beginUpdate=function(a){this.nodes.forEach(function(a){a._origY=a.y}),a._updating=!0},h.prototype.endUpdate=function(){this.nodes.forEach(function(a){a._origY=a.y});var a=this.nodes.find(function(a){return a._updating});a&&(a._updating=!1)};var i=function(c,d){var g,i,j=this;d=d||{},this.container=a(c),void 0!==d.handle_class&&(d.handleClass=d.handle_class,e("handle_class","handleClass")),void 0!==d.item_class&&(d.itemClass=d.item_class,e("item_class","itemClass")),void 0!==d.placeholder_class&&(d.placeholderClass=d.placeholder_class,e("placeholder_class","placeholderClass")),void 0!==d.placeholder_text&&(d.placeholderText=d.placeholder_text,e("placeholder_text","placeholderText")),void 0!==d.cell_height&&(d.cellHeight=d.cell_height,e("cell_height","cellHeight")),void 0!==d.vertical_margin&&(d.verticalMargin=d.vertical_margin,e("vertical_margin","verticalMargin")),void 0!==d.min_width&&(d.minWidth=d.min_width,e("min_width","minWidth")),void 0!==d.static_grid&&(d.staticGrid=d.static_grid,e("static_grid","staticGrid")),void 0!==d.is_nested&&(d.isNested=d.is_nested,e("is_nested","isNested")),void 0!==d.always_show_resize_handle&&(d.alwaysShowResizeHandle=d.always_show_resize_handle,e("always_show_resize_handle","alwaysShowResizeHandle")),d.itemClass=d.itemClass||"grid-stack-item";var k=this.container.closest("."+d.itemClass).length>0;if(this.opts=f.defaults(d||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,float:!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:d.alwaysShowResizeHandle||!1,resizable:f.defaults(d.resizable||{},{autoHide:!d.alwaysShowResizeHandle,handles:"se"}),draggable:f.defaults(d.draggable||{},{handle:(d.handleClass?"."+d.handleClass:d.handle?d.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:d.disableDrag||!1,disableResize:d.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:d.disableOneColumnMode||!1,oneColumnModeClass:d.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),!1===this.opts.ddPlugin?this.opts.ddPlugin=b:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.registeredPlugins[0]||b),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,i="auto"===this.opts.cellHeight,i?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new h(this.opts.width,function(a,b){b=void 0===b||b;var c=0;a.forEach(function(a){b&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),c=Math.max(c,a.y+a.height))}),j._updateStyles(c+10)},this.opts.float,this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),f.sortBy(l,function(a){return a.i}).forEach(function(a){this._prepareElement(a.el)},this)}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=f.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(i&&j._updateHeightsOnResize(),j._isOneColumnMode()&&!j.opts.disableOneColumnMode){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),j.grid.nodes.forEach(function(a){j.container.append(a.el),j.opts.staticGrid||(j.dd.draggable(a.el,"disable"),j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;j.grid.nodes.forEach(function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(!0===j.opts.acceptWidgets?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);if(d.data("_gridstack_node")){d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d);var f=a(c.draggable).data("_gridstack_node_orig");void 0!==f&&void 0!==f._grid&&f._grid._triggerRemoveEvent(),a(c.helper).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j.grid._addedNodes.push(d),j._triggerAddEvent(),j._triggerChangeEvent(),j.grid.endUpdate(),a(c.draggable).unbind("drag",p),a(c.draggable).removeData("_gridstack_node"),a(c.draggable).removeData("_gridstack_node_orig")})}};return i.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||!0===a)&&this.container.trigger("change",d)},i.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[this.grid._addedNodes.map(f.clone)]),this.grid._addedNodes=[])},i.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[this.grid._removedNodes.map(f.clone)]),this.grid._removedNodes=[])},i.prototype._initStyles=function(){this._stylesId&&f.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=f.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},i.prototype._updateStyles=function(a){if(null!==this._styles&&void 0!==this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if(void 0===a&&(a=this._styles._max),this._initStyles(),this._updateContainerHeight(),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&f.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e=f.grid.width||k<0||!f.grid.float&&k>f.grid.getGridHeight()?c._temporaryRemoved||(!0===f.opts.removable&&f._setupRemovingTimeout(b),j=c._beforeDragX,k=c._beforeDragY,f.placeholder.detach(),f.placeholder.hide(),f.grid.removeNode(c),f._updateContainerHeight(),c._temporaryRemoved=!0):(f._clearRemovingTimeout(b),c._temporaryRemoved&&(f.grid.addNode(c),f.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),f.container.append(f.placeholder),c.el=f.placeholder,c._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return;var l=void 0!==h?h:c.lastTriedWidth,m=void 0!==i?i:c.lastTriedHeight;!f.grid.canMoveNode(c,j,k,h,i)||c.lastTriedX===j&&c.lastTriedY===k&&c.lastTriedWidth===l&&c.lastTriedHeight===m||(c.lastTriedX=j,c.lastTriedY=k,c.lastTriedWidth=h,c.lastTriedHeight=i,f.grid.moveNode(c,j,k,h,i),f._updateContainerHeight())},h=function(g,h){f.container.append(f.placeholder);var i=a(this);f.grid.cleanNodes(),f.grid.beginUpdate(c),d=f.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));e=f.container.height()/parseInt(f.container.attr("data-gs-current-height")),f.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),c.el=f.placeholder,c._beforeDragX=c.x,c._beforeDragY=c.y,f.dd.resizable(b,"option","minWidth",d*(c.minWidth||1)),f.dd.resizable(b,"option","minHeight",j*(c.minHeight||1)),"resizestart"==g.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(d,e){var g=a(this);if(g.data("_gridstack_node")){var h=!1;if(f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove){h=!0;b.data("_gridstack_node")._grid._triggerRemoveEvent(),b.removeData("_gridstack_node"),b.remove()}else f._clearRemovingTimeout(b),c._temporaryRemoved?(g.attr("data-gs-x",c._beforeDragX).attr("data-gs-y",c._beforeDragY).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style"),c.x=c._beforeDragX,c.y=c._beforeDragY,f.grid.addNode(c)):g.attr("data-gs-x",c.x).attr("data-gs-y",c.y).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style");f._updateContainerHeight(),f._triggerChangeEvent(h),f.grid.endUpdate();var i=g.find(".grid-stack");i.length&&"resizestop"==d.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),g.find(".grid-stack-item").trigger("resizestop"),g.find(".grid-stack-item").trigger("gsresizestop")),"resizestop"==d.type&&f.container.trigger("gsresizestop",g)}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()&&!f.opts.disableOneColumnMode||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)},i.prototype._prepareElement=function(b,c){c=void 0!==c&&c;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:f.toBool(b.attr("data-gs-auto-position")),noResize:f.toBool(b.attr("data-gs-no-resize")),noMove:f.toBool(b.attr("data-gs-no-move")),locked:f.toBool(b.attr("data-gs-locked")),resizeHandles:b.attr("data-gs-resize-handles"),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},i.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},i.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),void 0!==c&&b.attr("data-gs-x",c),void 0!==d&&b.attr("data-gs-y",d),void 0!==e&&b.attr("data-gs-width",e),void 0!==f&&b.attr("data-gs-height",f),void 0!==g&&b.attr("data-gs-auto-position",g?"yes":null),void 0!==h&&b.attr("data-gs-min-width",h),void 0!==i&&b.attr("data-gs-max-width",i),void 0!==j&&b.attr("data-gs-min-height",j),void 0!==k&&b.attr("data-gs-max-height",k),void 0!==l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},i.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},i.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},i.prototype.removeWidget=function(b,c){c=void 0===c||c,b=a(b);var d=b.data("_gridstack_node");d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},i.prototype.removeAll=function(a){this.grid.nodes.forEach(function(b){this.removeWidget(b.el,a)},this),this.grid.nodes=[],this._updateContainerHeight()},i.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),void 0===b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),f.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},i.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noResize=!c,f.noResize||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?d.dd.resizable(e,"disable"):d.dd.resizable(e,"enable"))}),this},i.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");void 0!==f&&null!==f&&(f.noMove=!c,f.noMove||d._isOneColumnMode()&&!d.opts.disableOneColumnMode?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},i.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},i.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},i.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},i.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},i.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},i.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},i.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},i.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},i.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");void 0!==e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},i.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if(void 0!==d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},i.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.width,c=null!==c&&void 0!==c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},i.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&void 0!==b?b:d.x,c=null!==c&&void 0!==c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},i.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&void 0!==b?b:f.x,c=null!==c&&void 0!==c?c:f.y,d=null!==d&&void 0!==d?d:f.width,e=null!==e&&void 0!==e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},i.prototype.verticalMargin=function(a,b){if(void 0===a)return this.opts.verticalMargin;var c=f.parseHeight(a);this.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},i.prototype.cellHeight=function(a,b){if(void 0===a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=f.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},i.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},i.prototype.getCellFromPixel=function(a,b){var c=void 0!==b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},i.prototype.batchUpdate=function(){this.grid.batchUpdate()},i.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},i.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},i.prototype.setStatic=function(a){this.opts.staticGrid=!0===a,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},i.prototype._setStaticClass=function(){!0===this.opts.staticGrid?this.container.addClass("grid-stack-static"):this.container.removeClass("grid-stack-static")},i.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;d", - "contributors": ["Dylan Weiss (https://dylandreams.com)"], + "contributors": [ + "Dylan Weiss (https://dylandreams.com)" + ], "license": "MIT", "bugs": { "url": "https://github.com/troolee/gridstack.js/issues" @@ -27,11 +29,11 @@ "homepage": "http://troolee.github.io/gridstack.js/", "dependencies": { "jquery": "^3.1.0", - "jquery-ui": "^1.12.0", - "lodash": "^4.14.2" + "jquery-ui": "^1.12.0" }, "devDependencies": { "connect": "^3.4.1", + "core-js": "^2.4.1", "coveralls": "^2.11.8", "doctoc": "^1.3.0", "grunt": "^1.0.1", diff --git a/spec/e2e/html/gridstack-with-height.html b/spec/e2e/html/gridstack-with-height.html index 2f543eba0..d50a5b3ec 100644 --- a/spec/e2e/html/gridstack-with-height.html +++ b/spec/e2e/html/gridstack-with-height.html @@ -16,7 +16,7 @@ - + diff --git a/spec/gridstack-engine-spec.js b/spec/gridstack-engine-spec.js index ef18255a0..67e4785a4 100644 --- a/spec/gridstack-engine-spec.js +++ b/spec/gridstack-engine-spec.js @@ -209,7 +209,7 @@ describe('gridstack engine', function() { var engine; var findNode = function(engine, id) { - return _.find(engine.nodes, function(i) { return i._id === id; }); + return engine.nodes.find(function(i) { return i._id === id; }); }; beforeEach(function() { diff --git a/src/gridstack.jQueryUI.js b/src/gridstack.jQueryUI.js index 79b843319..6aa7564f3 100644 --- a/src/gridstack.jQueryUI.js +++ b/src/gridstack.jQueryUI.js @@ -7,7 +7,7 @@ */ (function(factory) { if (typeof define === 'function' && define.amd) { - define(['jquery', 'lodash', 'gridstack', 'jquery-ui/data', 'jquery-ui/disable-selection', 'jquery-ui/focusable', + define(['jquery', 'gridstack', 'jquery-ui/data', 'jquery-ui/disable-selection', 'jquery-ui/focusable', 'jquery-ui/form', 'jquery-ui/ie', 'jquery-ui/keycode', 'jquery-ui/labels', 'jquery-ui/jquery-1-7', 'jquery-ui/plugin', 'jquery-ui/safe-active-element', 'jquery-ui/safe-blur', 'jquery-ui/scroll-parent', 'jquery-ui/tabbable', 'jquery-ui/unique-id', 'jquery-ui/version', 'jquery-ui/widget', @@ -15,13 +15,12 @@ 'jquery-ui/widgets/resizable'], factory); } else if (typeof exports !== 'undefined') { try { jQuery = require('jquery'); } catch (e) {} - try { _ = require('lodash'); } catch (e) {} try { GridStackUI = require('gridstack'); } catch (e) {} - factory(jQuery, _, GridStackUI); + factory(jQuery, GridStackUI); } else { - factory(jQuery, _, GridStackUI); + factory(jQuery, GridStackUI); } -})(function($, _, GridStackUI) { +})(function($, GridStackUI) { var scope = window; @@ -49,7 +48,7 @@ } else { var handles = el.data('gs-resize-handles') ? el.data('gs-resize-handles') : this.grid.opts.resizable.handles; - el.resizable(_.extend({}, this.grid.opts.resizable, { + el.resizable($.extend({}, this.grid.opts.resizable, { handles: handles }, { start: opts.start || function() {}, @@ -65,7 +64,7 @@ if (opts === 'disable' || opts === 'enable') { el.draggable(opts); } else { - el.draggable(_.extend({}, this.grid.opts.draggable, { + el.draggable($.extend({}, this.grid.opts.draggable, { containment: this.grid.opts.isNested ? this.grid.container.parent() : null, start: opts.start || function() {}, stop: opts.stop || function() {}, diff --git a/src/gridstack.js b/src/gridstack.js index 3f4bf80f3..967c346f3 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -7,15 +7,14 @@ */ (function(factory) { if (typeof define === 'function' && define.amd) { - define(['jquery', 'lodash'], factory); + define(['jquery'], factory); } else if (typeof exports !== 'undefined') { try { jQuery = require('jquery'); } catch (e) {} - try { _ = require('lodash'); } catch (e) {} - factory(jQuery, _); + factory(jQuery); } else { - factory(jQuery, _); + factory(jQuery); } -})(function($, _) { +})(function($) { var scope = window; @@ -36,14 +35,19 @@ }; var Utils = { + isIntercepted: function(a, b) { return !(a.x + a.width <= b.x || b.x + b.width <= a.x || a.y + a.height <= b.y || b.y + b.height <= a.y); }, sort: function(nodes, dir, width) { - width = width || _.chain(nodes).map(function(node) { return node.x + node.width; }).max().value(); + if (!width) { + var widths = nodes.map(function(node) { return node.x + node.width; }); + width = Math.max.apply(Math, widths); + } + dir = dir != -1 ? 1 : -1; - return _.sortBy(nodes, function(n) { return dir * (n.x + n.y * width); }); + return Utils.sortBy(nodes, function(n) { return dir * (n.x + n.y * width); }); }, createStylesheet: function(id) { @@ -97,7 +101,7 @@ parseHeight: function(val) { var height = val; var heightUnit = 'px'; - if (height && _.isString(height)) { + if (height && typeof height === 'string') { var match = height.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/); if (!match) { throw new Error('Invalid height'); @@ -106,6 +110,60 @@ height = parseFloat(match[1]); } return {height: height, unit: heightUnit}; + }, + + without: function(array, item) { + var index = array.indexOf(item); + + if (index !== -1) { + array = array.slice(0); + array.splice(index, 1); + } + + return array; + }, + + sortBy: function(array, getter) { + return array.slice(0).sort(function(left, right) { + var valueLeft = getter(left); + var valueRight = getter(right); + + if (valueRight === valueLeft) { + return 0; + } + + return valueLeft > valueRight ? 1 : -1; + }); + }, + + defaults: function(target) { + var sources = Array.prototype.slice.call(arguments, 1); + + sources.forEach(function(source) { + for (var prop in source) { + if (source.hasOwnProperty(prop) && !target.hasOwnProperty(prop)) { + target[prop] = source[prop]; + } + } + }); + + return target; + }, + + clone: function(target) { + return $.extend({}, target); + }, + + throttle: function(callback, delay) { + var isWaiting = false; + + return function() { + if (!isWaiting) { + callback.apply(this, arguments); + isWaiting = true; + setTimeout(function() { isWaiting = false; }, delay); + } + }; } }; @@ -187,7 +245,7 @@ // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 GridStackEngine.prototype.getNodeDataByDOMEl = function(el) { - return _.find(this.nodes, function(n) { return el.get(0) === n.el.get(0); }); + return this.nodes.find(function(n) { return el.get(0) === n.el.get(0); }); }; GridStackEngine.prototype._fixCollisions = function(node) { @@ -195,12 +253,12 @@ this._sortNodes(-1); var nn = node; - var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; })); + var hasLocked = Boolean(this.nodes.find(function(n) { return n.locked; })); if (!this.float && !hasLocked) { nn = {x: 0, y: node.y, width: this.width, height: node.height}; } while (true) { - var collisionNode = _.find(this.nodes, _.bind(Utils._collisionNodeCheck, {node: node, nn: nn})); + var collisionNode = this.nodes.find(Utils._collisionNodeCheck, {node: node, nn: nn}); if (typeof collisionNode == 'undefined') { return; } @@ -211,9 +269,9 @@ GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height) { var nn = {x: x || 0, y: y || 0, width: width || 1, height: height || 1}; - var collisionNode = _.find(this.nodes, _.bind(function(n) { + var collisionNode = this.nodes.find(function(n) { return Utils.isIntercepted(n, nn); - }, this)); + }); return collisionNode === null || typeof collisionNode === 'undefined'; }; @@ -225,16 +283,14 @@ this._sortNodes(); if (this.float) { - _.each(this.nodes, _.bind(function(n, i) { + this.nodes.forEach(function(n, i) { if (n._updating || typeof n._origY == 'undefined' || n.y == n._origY) { return; } var newY = n.y; while (newY >= n._origY) { - var collisionNode = _.chain(this.nodes) - .find(_.bind(Utils._didCollide, {n: n, newY: newY})) - .value(); + var collisionNode = this.nodes.find(Utils._didCollide, {n: n, newY: newY}); if (!collisionNode) { n._dirty = true; @@ -242,9 +298,9 @@ } --newY; } - }, this)); + }, this); } else { - _.each(this.nodes, _.bind(function(n, i) { + this.nodes.forEach(function(n, i) { if (n.locked) { return; } @@ -253,10 +309,9 @@ var canBeMoved = i === 0; if (i > 0) { - var collisionNode = _.chain(this.nodes) - .take(i) - .find(_.bind(Utils._didCollide, {n: n, newY: newY})) - .value(); + var collisionNode = this.nodes + .slice(0, i) + .find(Utils._didCollide, {n: n, newY: newY}); canBeMoved = typeof collisionNode == 'undefined'; } @@ -266,12 +321,12 @@ n._dirty = n.y != newY; n.y = newY; } - }, this)); + }, this); } }; GridStackEngine.prototype._prepareNode = function(node, resizing) { - node = _.defaults(node || {}, {width: 1, height: 1, x: 0, y: 0}); + node = Utils.defaults(node || {}, {width: 1, height: 1, x: 0, y: 0}); node.x = parseInt('' + node.x); node.y = parseInt('' + node.y); @@ -325,11 +380,11 @@ if (this._updateCounter) { return; } - _.each(this.nodes, function(n) {n._dirty = false; }); + this.nodes.forEach(function(n) { n._dirty = false; }); }; GridStackEngine.prototype.getDirtyNodes = function() { - return _.filter(this.nodes, function(n) { return n._dirty; }); + return this.nodes.filter(function(n) { return n._dirty; }); }; GridStackEngine.prototype.addNode = function(node, triggerAddEvent) { @@ -352,7 +407,7 @@ if (x + node.width > this.width) { continue; } - if (!_.find(this.nodes, _.bind(Utils._isAddNodeIntercepted, {x: x, y: y, node: node}))) { + if (!this.nodes.find(Utils._isAddNodeIntercepted, {x: x, y: y, node: node})) { node.x = x; node.y = y; break; @@ -362,7 +417,7 @@ this.nodes.push(node); if (typeof triggerAddEvent != 'undefined' && triggerAddEvent) { - this._addedNodes.push(_.clone(node)); + this._addedNodes.push(Utils.clone(node)); } this._fixCollisions(node); @@ -373,9 +428,9 @@ GridStackEngine.prototype.removeNode = function(node, detachNode) { detachNode = typeof detachNode === 'undefined' ? true : detachNode; - this._removedNodes.push(_.clone(node)); + this._removedNodes.push(Utils.clone(node)); node._id = null; - this.nodes = _.without(this.nodes, node); + this.nodes = Utils.without(this.nodes, node); this._packNodes(); this._notify(node, detachNode); }; @@ -384,7 +439,7 @@ if (!this.isNodeChangedPosition(node, x, y, width, height)) { return false; } - var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; })); + var hasLocked = Boolean(this.nodes.find(function(n) { return n.locked; })); if (!this.height && !hasLocked) { return true; @@ -396,7 +451,7 @@ null, this.float, 0, - _.map(this.nodes, function(n) { + this.nodes.map(function(n) { if (n == node) { clonedNode = $.extend({}, n); return clonedNode; @@ -413,7 +468,7 @@ var res = true; if (hasLocked) { - res &= !Boolean(_.find(clone.nodes, function(n) { + res &= !Boolean(clone.nodes.find(function(n) { return n != clonedNode && Boolean(n.locked) && Boolean(n._dirty); })); } @@ -434,7 +489,7 @@ null, this.float, 0, - _.map(this.nodes, function(n) { return $.extend({}, n); })); + this.nodes.map(function(n) { return $.extend({}, n); })); clone.addNode(node); return clone.getGridHeight() <= this.height; }; @@ -498,21 +553,21 @@ }; GridStackEngine.prototype.getGridHeight = function() { - return _.reduce(this.nodes, function(memo, n) { return Math.max(memo, n.y + n.height); }, 0); + return this.nodes.reduce(function(memo, n) { return Math.max(memo, n.y + n.height); }, 0); }; GridStackEngine.prototype.beginUpdate = function(node) { - _.each(this.nodes, function(n) { + this.nodes.forEach(function(n) { n._origY = n.y; }); node._updating = true; }; GridStackEngine.prototype.endUpdate = function() { - _.each(this.nodes, function(n) { + this.nodes.forEach(function(n) { n._origY = n.y; }); - var n = _.find(this.nodes, function(n) { return n._updating; }); + var n = this.nodes.find(function(n) { return n._updating; }); if (n) { n._updating = false; } @@ -572,7 +627,7 @@ opts.itemClass = opts.itemClass || 'grid-stack-item'; var isNested = this.container.closest('.' + opts.itemClass).length > 0; - this.opts = _.defaults(opts || {}, { + this.opts = Utils.defaults(opts || {}, { width: parseInt(this.container.attr('data-gs-width')) || 12, height: parseInt(this.container.attr('data-gs-height')) || 0, itemClass: 'grid-stack-item', @@ -589,11 +644,11 @@ _class: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), animate: Boolean(this.container.attr('data-gs-animate')) || false, alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, - resizable: _.defaults(opts.resizable || {}, { + resizable: Utils.defaults(opts.resizable || {}, { autoHide: !(opts.alwaysShowResizeHandle || false), handles: 'se' }), - draggable: _.defaults(opts.draggable || {}, { + draggable: Utils.defaults(opts.draggable || {}, { handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || '.grid-stack-item-content', scroll: false, @@ -614,7 +669,7 @@ if (this.opts.ddPlugin === false) { this.opts.ddPlugin = GridStackDragDropPlugin; } else if (this.opts.ddPlugin === null) { - this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins) || GridStackDragDropPlugin; + this.opts.ddPlugin = GridStackDragDropPlugin.registeredPlugins[0] || GridStackDragDropPlugin; } this.dd = new this.opts.ddPlugin(this); @@ -650,7 +705,7 @@ this.grid = new GridStackEngine(this.opts.width, function(nodes, detachNode) { detachNode = typeof detachNode === 'undefined' ? true : detachNode; var maxHeight = 0; - _.each(nodes, function(n) { + nodes.forEach(function(n) { if (detachNode && n._id === null) { if (n.el) { n.el.remove(); @@ -678,9 +733,9 @@ i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * _this.opts.width }); }); - _.chain(elements).sortBy(function(x) { return x.i; }).each(function(i) { - self._prepareElement(i.el); - }).value(); + Utils.sortBy(elements, function(x) { return x.i; }).forEach(function(i) { + this._prepareElement(i.el); + }, this); } this.setAnimation(this.opts.animate); @@ -691,7 +746,7 @@ this._updateContainerHeight(); - this._updateHeightsOnResize = _.throttle(function() { + this._updateHeightsOnResize = Utils.throttle(function() { self.cellHeight(self.cellWidth(), false); }, 100); @@ -708,7 +763,7 @@ oneColumnMode = true; self.grid._sortNodes(); - _.each(self.grid.nodes, function(node) { + self.grid.nodes.forEach(function(node) { self.container.append(node.el); if (self.opts.staticGrid) { @@ -731,7 +786,7 @@ return; } - _.each(self.grid.nodes, function(node) { + self.grid.nodes.forEach(function(node) { if (!node.noMove && !self.opts.disableDrag) { self.dd.draggable(node.el, 'enable'); } @@ -912,14 +967,14 @@ GridStack.prototype._triggerAddEvent = function() { if (this.grid._addedNodes && this.grid._addedNodes.length > 0) { - this.container.trigger('added', [_.map(this.grid._addedNodes, _.clone)]); + this.container.trigger('added', [this.grid._addedNodes.map(Utils.clone)]); this.grid._addedNodes = []; } }; GridStack.prototype._triggerRemoveEvent = function() { if (this.grid._removedNodes && this.grid._removedNodes.length > 0) { - this.container.trigger('removed', [_.map(this.grid._removedNodes, _.clone)]); + this.container.trigger('removed', [this.grid._removedNodes.map(Utils.clone)]); this.grid._removedNodes = []; } }; @@ -1324,9 +1379,9 @@ }; GridStack.prototype.removeAll = function(detachNode) { - _.each(this.grid.nodes, _.bind(function(node) { + this.grid.nodes.forEach(function(node) { this.removeWidget(node.el, detachNode); - }, this)); + }, this); this.grid.nodes = []; this._updateContainerHeight(); }; From 8eb803641b6b269bd932f07a1cf9e4a464b892f5 Mon Sep 17 00:00:00 2001 From: Ctibor Laky Date: Tue, 22 Aug 2017 15:18:47 +0200 Subject: [PATCH 02/10] links to docs --- doc/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/README.md b/doc/README.md index 6e4d231ec..363c3daed 100644 --- a/doc/README.md +++ b/doc/README.md @@ -90,12 +90,12 @@ gridstack.js API - `verticalMargin` - vertical gap size (default: `20`). Can be: - an integer (px) - a string (ex: '2em', '20px', '2rem') -- `width` - amount of columns (default: `12`) +- `width` - amount of columns (default: `12`). Setting non-default value must be supported by equivalent change in CSS, [see docs here](https://github.com/troolee/gridstack.js#change-grid-width). ## Grid attributes - `data-gs-animate` - turns animation on -- `data-gs-width` - amount of columns +- `data-gs-width` - amount of columns. Setting non-default value must be supported by equivalent change in CSS, [see docs here](https://github.com/troolee/gridstack.js#change-grid-width). - `data-gs-height` - maximum rows amount. Default is `0` which means no maximum rows. - `data-gs-current-height` - current rows amount. Set by the library only. Can be used by the CSS rules. From e5f2a42877c7579901db5fc368495d69a84618ed Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 26 Mar 2019 08:40:31 -0700 Subject: [PATCH 03/10] Update karma.conf.js --- karma.conf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index d8fcd440b..253cc9f55 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -15,8 +15,8 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ - 'bower_components/jquery/dist/jquery.min.js', - 'bower_components/jquery-ui/jquery-ui.min.js', + 'node_modules/jquery/dist/jquery.min.js', + 'node_modules/components-jqueryui/jquery-ui.min.js', 'node_modules/core-js/client/shim.min.js', 'src/gridstack.js', 'src/gridstack.jQueryUI.js', From 1eac26347b08ea3d17ed2bf9ac2fdf6c244c2a7f Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 26 Mar 2019 08:42:31 -0700 Subject: [PATCH 04/10] Delete gridstack.all.js --- dist/gridstack.all.js | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 dist/gridstack.all.js diff --git a/dist/gridstack.all.js b/dist/gridstack.all.js deleted file mode 100644 index c18626c72..000000000 --- a/dist/gridstack.all.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(t){if("function"==typeof define&&define.amd)define(["jquery","exports"],t);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(t){}t(jQuery,exports)}else t(jQuery,window)}(function(u,t){var e=function(t,e,i){var o=function(){return console.warn("gridstack.js: Function `"+e+"` is deprecated as of v0.2.5 and has been replaced with `"+i+"`. It will be **completely** removed in v1.0."),t.apply(this,arguments)};return o.prototype=t.prototype,o},d=function(t,e){console.warn("gridstack.js: Option `"+t+"` is deprecated as of v0.2.5 and has been replaced with `"+e+"`. It will be **completely** removed in v1.0.")},_={isIntercepted:function(t,e){return!(t.x+t.width<=e.x||e.x+e.width<=t.x||t.y+t.height<=e.y||e.y+e.height<=t.y)},sort:function(t,e,i){if(!i){var o=t.map(function(t){return t.x+t.width});i=Math.max.apply(Math,o)}return e=-1!=e?1:-1,_.sortBy(t,function(t){return e*(t.x+t.y*i)})},createStylesheet:function(t){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.setAttribute("data-gs-style-id",t),e.styleSheet?e.styleSheet.cssText="":e.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(e),e.sheet},removeStylesheet:function(t){u("STYLE[data-gs-style-id="+t+"]").remove()},insertCSSRule:function(t,e,i,o){"function"==typeof t.insertRule?t.insertRule(e+"{"+i+"}",o):"function"==typeof t.addRule&&t.addRule(e,i,o)},toBool:function(t){return"boolean"==typeof t?t:"string"==typeof t?!(""===(t=t.toLowerCase())||"no"==t||"false"==t||"0"==t):Boolean(t)},_collisionNodeCheck:function(t){return t!=this.node&&_.isIntercepted(t,this.nn)},_didCollide:function(t){return _.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},t)},_isAddNodeIntercepted:function(t){return _.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.height},t)},parseHeight:function(t){var e=t,i="px";if(e&&"string"==typeof e){var o=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!o)throw new Error("Invalid height");i=o[2]||"px",e=parseFloat(o[1])}return{height:e,unit:i}},without:function(t,e){var i=t.indexOf(e);return-1!==i&&(t=t.slice(0)).splice(i,1),t},sortBy:function(t,a){return t.slice(0).sort(function(t,e){var i=a(t),o=a(e);return o===i?0:ot.clientHeight?t:_.getScrollParent(t.parentNode)},updateScrollPosition:function(t,e,i){var o=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>a){var r=o.bottom-a,s=o.top,n=_.getScrollParent(t);if(null!=n){var d=n.scrollTop;o.top<0&&i<0?t.offsetHeight>a?n.scrollTop+=i:n.scrollTop+=Math.abs(s)>Math.abs(i)?i:s:0a?n.scrollTop+=i:n.scrollTop+=i=t._origY;){this.nodes.slice(0,e).find(_._didCollide,{n:t,newY:i})||(t._dirty=!0,t.y=i),--i}},this):this.nodes.forEach(function(t,e){if(!t.locked)for(;0this.width?t.width=this.width:t.width<1&&(t.width=1),t.height<1&&(t.height=1),t.x<0&&(t.x=0),t.x+t.width>this.width&&(e?t.width=this.width-t.x:t.x=this.width-t.width),t.y<0&&(t.y=0),t},c.prototype._notify=function(){var t=Array.prototype.slice.call(arguments,0);if(t[0]=void 0===t[0]?[]:[t[0]],t[1]=void 0===t[1]||t[1],!this._updateCounter){var e=t[0].concat(this.getDirtyNodes());this.onchange(e,t[1])}},c.prototype.cleanNodes=function(){this._updateCounter||this.nodes.forEach(function(t){t._dirty=!1})},c.prototype.getDirtyNodes=function(){return this.nodes.filter(function(t){return t._dirty})},c.prototype.addNode=function(t,e){if(void 0!==(t=this._prepareNode(t)).maxWidth&&(t.width=Math.min(t.width,t.maxWidth)),void 0!==t.maxHeight&&(t.height=Math.min(t.height,t.maxHeight)),void 0!==t.minWidth&&(t.width=Math.max(t.width,t.minWidth)),void 0!==t.minHeight&&(t.height=Math.max(t.height,t.minHeight)),t._id=++r,t._dirty=!0,t.autoPosition){this._sortNodes();for(var i=0;;++i){var o=i%this.width,a=Math.floor(i/this.width);if(!(o+t.width>this.width)&&!this.nodes.find(_._isAddNodeIntercepted,{x:o,y:a,node:t})){t.x=o,t.y=a;break}}}return this.nodes.push(t),void 0!==e&&e&&this._addedNodes.push(_.clone(t)),this._fixCollisions(t),this._packNodes(),this._notify(),t},c.prototype.removeNode=function(t,e){e=void 0===e||e,this._removedNodes.push(_.clone(t)),t._id=null,this.nodes=_.without(this.nodes,t),this._packNodes(),this._notify(t,e)},c.prototype.canMoveNode=function(e,t,i,o,a){if(!this.isNodeChangedPosition(e,t,i,o,a))return!1;var r,s=Boolean(this.nodes.find(function(t){return t.locked}));if(!this.height&&!s)return!0;var n=new c(this.width,null,this.float,0,this.nodes.map(function(t){return t==e?r=u.extend({},t):u.extend({},t)}));if(void 0===r)return!0;n.moveNode(r,t,i,o,a);var d=!0;return s&&(d&=!Boolean(n.nodes.find(function(t){return t!=r&&Boolean(t.locked)&&Boolean(t._dirty)}))),this.height&&(d&=n.getGridHeight()<=this.height),d},c.prototype.canBePlacedWithRespectToHeight=function(t){if(!this.height)return!0;var e=new c(this.width,null,this.float,0,this.nodes.map(function(t){return u.extend({},t)}));return e.addNode(t),e.getGridHeight()<=this.height},c.prototype.isNodeChangedPosition=function(t,e,i,o,a){return"number"!=typeof e&&(e=t.x),"number"!=typeof i&&(i=t.y),"number"!=typeof o&&(o=t.width),"number"!=typeof a&&(a=t.height),void 0!==t.maxWidth&&(o=Math.min(o,t.maxWidth)),void 0!==t.maxHeight&&(a=Math.min(a,t.maxHeight)),void 0!==t.minWidth&&(o=Math.max(o,t.minWidth)),void 0!==t.minHeight&&(a=Math.max(a,t.minHeight)),t.x!=e||t.y!=i||t.width!=o||t.height!=a},c.prototype.moveNode=function(t,e,i,o,a,r){if(!this.isNodeChangedPosition(t,e,i,o,a))return t;if("number"!=typeof e&&(e=t.x),"number"!=typeof i&&(i=t.y),"number"!=typeof o&&(o=t.width),"number"!=typeof a&&(a=t.height),void 0!==t.maxWidth&&(o=Math.min(o,t.maxWidth)),void 0!==t.maxHeight&&(a=Math.min(a,t.maxHeight)),void 0!==t.minWidth&&(o=Math.max(o,t.minWidth)),void 0!==t.minHeight&&(a=Math.max(a,t.minHeight)),t.x==e&&t.y==i&&t.width==o&&t.height==a)return t;var s=t.width!=o;return t._dirty=!0,t.x=e,t.y=i,t.width=o,t.height=a,t.lastTriedX=e,t.lastTriedY=i,t.lastTriedWidth=o,t.lastTriedHeight=a,t=this._prepareNode(t,s),this._fixCollisions(t),r||(this._packNodes(),this._notify()),t},c.prototype.getGridHeight=function(){return this.nodes.reduce(function(t,e){return Math.max(t,e.y+e.height)},0)},c.prototype.beginUpdate=function(t){this.nodes.forEach(function(t){t._origY=t.y}),t._updating=!0},c.prototype.endUpdate=function(){this.nodes.forEach(function(t){t._origY=t.y});var t=this.nodes.find(function(t){return t._updating});t&&(t._updating=!1)};var i=function(t,e){var i,o,h=this;e=e||{},this.container=u(t),void 0!==e.handle_class&&(e.handleClass=e.handle_class,d("handle_class","handleClass")),void 0!==e.item_class&&(e.itemClass=e.item_class,d("item_class","itemClass")),void 0!==e.placeholder_class&&(e.placeholderClass=e.placeholder_class,d("placeholder_class","placeholderClass")),void 0!==e.placeholder_text&&(e.placeholderText=e.placeholder_text,d("placeholder_text","placeholderText")),void 0!==e.cell_height&&(e.cellHeight=e.cell_height,d("cell_height","cellHeight")),void 0!==e.vertical_margin&&(e.verticalMargin=e.vertical_margin,d("vertical_margin","verticalMargin")),void 0!==e.min_width&&(e.minWidth=e.min_width,d("min_width","minWidth")),void 0!==e.static_grid&&(e.staticGrid=e.static_grid,d("static_grid","staticGrid")),void 0!==e.is_nested&&(e.isNested=e.is_nested,d("is_nested","isNested")),void 0!==e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,d("always_show_resize_handle","alwaysShowResizeHandle")),e.itemClass=e.itemClass||"grid-stack-item";var a=0
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=_.throttle(function(){h.cellHeight(h.cellWidth(),!1)},100),this.onResizeHandler=function(){if(o&&h._updateHeightsOnResize(),h._isOneColumnMode()&&!h.opts.disableOneColumnMode){if(i)return;h.container.addClass(h.opts.oneColumnModeClass),i=!0,h.grid._sortNodes(),h.grid.nodes.forEach(function(t){h.container.append(t.el),h.opts.staticGrid||(h.dd.draggable(t.el,"disable"),h.dd.resizable(t.el,"disable"),t.el.trigger("resize"))})}else{if(!i)return;if(h.container.removeClass(h.opts.oneColumnModeClass),i=!1,h.opts.staticGrid)return;h.grid.nodes.forEach(function(t){t.noMove||h.opts.disableDrag||h.dd.draggable(t.el,"enable"),t.noResize||h.opts.disableResize||h.dd.resizable(t.el,"enable"),t.el.trigger("resize")})}},u(window).resize(this.onResizeHandler),this.onResizeHandler(),!h.opts.staticGrid&&"string"==typeof h.opts.removable){var n=u(h.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,h.opts.removableOptions),this.dd.on(n,"dropover",function(t,e){var i=u(e.draggable);i.data("_gridstack_node")._grid===h&&(i.data("inTrashZone",!0),h._setupRemovingTimeout(i))}).on(n,"dropout",function(t,e){var i=u(e.draggable);i.data("_gridstack_node")._grid===h&&(i.data("inTrashZone",!1),h._clearRemovingTimeout(i))})}if(!h.opts.staticGrid&&h.opts.acceptWidgets){var l=null,p=function(t,e){var i=l,o=i.data("_gridstack_node"),a=h.getCellFromPixel({left:t.pageX,top:t.pageY},!0),r=Math.max(0,a.x),s=Math.max(0,a.y);o._added||(o._added=!0,o.el=i,o.autoPosition=!0,o.x=r,o.y=s,h.grid.cleanNodes(),h.grid.beginUpdate(o),h.grid.addNode(o),h.container.append(h.placeholder),h.placeholder.attr("data-gs-x",o.x).attr("data-gs-y",o.y).attr("data-gs-width",o.width).attr("data-gs-height",o.height).show(),o.el=h.placeholder,o._beforeDragX=o.x,o._beforeDragY=o.y,h._updateContainerHeight()),h.grid.canMoveNode(o,r,s)&&(h.grid.moveNode(o,r,s),h._updateContainerHeight())};this.dd.droppable(h.container,{accept:function(t){var e=(t=u(t)).data("_gridstack_node");return(!e||e._grid!==h)&&t.is(!0===h.opts.acceptWidgets?".grid-stack-item":h.opts.acceptWidgets)}}).on(h.container,"dropover",function(t,e){h.container.offset();var i=u(e.draggable),o=h.cellWidth(),a=h.cellHeight(),r=i.data("_gridstack_node"),s=r?r.width:Math.ceil(i.outerWidth()/o),n=r?r.height:Math.ceil(i.outerHeight()/a);l=i;var d=h.grid._prepareNode({width:s,height:n,_added:!1,_temporary:!0});i.data("_gridstack_node",d),i.data("_gridstack_node_orig",r),i.on("drag",p)}).on(h.container,"dropout",function(t,e){var i=u(e.draggable);if(i.data("_gridstack_node")){i.unbind("drag",p);var o=i.data("_gridstack_node");o.el=null,h.grid.removeNode(o),h.placeholder.detach(),h._updateContainerHeight(),i.data("_gridstack_node",i.data("_gridstack_node_orig"))}}).on(h.container,"drop",function(t,e){h.placeholder.detach();var i=u(e.draggable).data("_gridstack_node");i._grid=h;var o=u(e.draggable).clone(!1);o.data("_gridstack_node",i);var a=u(e.draggable).data("_gridstack_node_orig");void 0!==a&&void 0!==a._grid&&a._grid._triggerRemoveEvent(),u(e.helper).remove(),i.el=o,h.placeholder.hide(),_.removePositioningStyles(o),o.find("div.ui-resizable-handle").remove(),o.attr("data-gs-x",i.x).attr("data-gs-y",i.y).attr("data-gs-width",i.width).attr("data-gs-height",i.height).addClass(h.opts.itemClass).enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),h.container.append(o),h._prepareElementsByNode(o,i),h._updateContainerHeight(),h.grid._addedNodes.push(i),h._triggerAddEvent(),h._triggerChangeEvent(),h.grid.endUpdate(),u(e.draggable).unbind("drag",p),u(e.draggable).removeData("_gridstack_node"),u(e.draggable).removeData("_gridstack_node_orig"),h.container.trigger("dropped",[a,i])})}};return i.prototype._triggerChangeEvent=function(t){var e=this.grid.getDirtyNodes(),i=!1,o=[];e&&e.length&&(o.push(e),i=!0),(i||!0===t)&&this.container.trigger("change",o)},i.prototype._triggerAddEvent=function(){this.grid._addedNodes&&0this._styles._max)){for(var a=this._styles._max;a=c.grid.width||r<0||!c.grid.float&&r>c.grid.getGridHeight()){if(l._temporaryRemoved)return;!0===c.opts.removable&&c._setupRemovingTimeout(h),a=l._beforeDragX,r=l._beforeDragY,c.placeholder.detach(),c.placeholder.hide(),c.grid.removeNode(l),c._updateContainerHeight(),l._temporaryRemoved=!0}else c._clearRemovingTimeout(h),l._temporaryRemoved&&(c.grid.addNode(l),c.placeholder.attr("data-gs-x",a).attr("data-gs-y",r).attr("data-gs-width",i).attr("data-gs-height",o).show(),c.container.append(c.placeholder),l.el=c.placeholder,l._temporaryRemoved=!1)}else if("resize"==t.type&&a<0)return;var n=void 0!==i?i:l.lastTriedWidth,d=void 0!==o?o:l.lastTriedHeight;!c.grid.canMoveNode(l,a,r,i,o)||l.lastTriedX===a&&l.lastTriedY===r&&l.lastTriedWidth===n&&l.lastTriedHeight===d||(l.lastTriedX=a,l.lastTriedY=r,l.lastTriedWidth=i,l.lastTriedHeight=o,c.grid.moveNode(l,a,r,i,o),c._updateContainerHeight(),"resize"==t.type&&u(t.target).trigger("gsresize",l))},e=function(t,e){c.container.append(c.placeholder);var i=u(this);c.grid.cleanNodes(),c.grid.beginUpdate(l),p=c.cellWidth();var o=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));g=c.container.height()/parseInt(c.container.attr("data-gs-current-height")),c.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),l.el=c.placeholder,l._beforeDragX=l.x,l._beforeDragY=l.y,l._prevYPix=e.position.top,c.dd.resizable(h,"option","minWidth",p*(l.minWidth||1)),c.dd.resizable(h,"option","minHeight",o*(l.minHeight||1)),"resizestart"==t.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(t,e){var i=u(this);if(i.data("_gridstack_node")){var o=!1;if(c.placeholder.detach(),l.el=i,c.placeholder.hide(),l._isAboutToRemove)o=!0,h.data("_gridstack_node")._grid._triggerRemoveEvent(),h.removeData("_gridstack_node"),h.remove();else c._clearRemovingTimeout(h),l._temporaryRemoved?(_.removePositioningStyles(i),i.attr("data-gs-x",l._beforeDragX).attr("data-gs-y",l._beforeDragY).attr("data-gs-width",l.width).attr("data-gs-height",l.height),l.x=l._beforeDragX,l.y=l._beforeDragY,l._temporaryRemoved=!1,c.grid.addNode(l)):(_.removePositioningStyles(i),i.attr("data-gs-x",l.x).attr("data-gs-y",l.y).attr("data-gs-width",l.width).attr("data-gs-height",l.height));c._updateContainerHeight(),c._triggerChangeEvent(o),c.grid.endUpdate();var a=i.find(".grid-stack");a.length&&"resizestop"==t.type&&(a.each(function(t,e){u(e).data("gridstack").onResizeHandler()}),i.find(".grid-stack-item").trigger("resizestop"),i.find(".grid-stack-item").trigger("gsresizestop")),"resizestop"==t.type&&c.container.trigger("gsresizestop",i)}};this.dd.draggable(h,{start:e,stop:i,drag:t}).resizable(h,{start:e,stop:i,resize:t}),(l.noMove||this._isOneColumnMode()&&!c.opts.disableOneColumnMode||this.opts.disableDrag||this.opts.staticGrid)&&this.dd.draggable(h,"disable"),(l.noResize||this._isOneColumnMode()&&!c.opts.disableOneColumnMode||this.opts.disableResize||this.opts.staticGrid)&&this.dd.resizable(h,"disable"),h.attr("data-gs-locked",l.locked?"yes":null)},i.prototype._prepareElement=function(t,e){e=void 0!==e&&e;(t=u(t)).addClass(this.opts.itemClass);var i=this.grid.addNode({x:parseInt(t.attr("data-gs-x"),10),y:parseInt(t.attr("data-gs-y"),10),width:t.attr("data-gs-width"),height:t.attr("data-gs-height"),maxWidth:t.attr("data-gs-max-width"),minWidth:t.attr("data-gs-min-width"),maxHeight:t.attr("data-gs-max-height"),minHeight:t.attr("data-gs-min-height"),autoPosition:_.toBool(t.attr("data-gs-auto-position")),noResize:_.toBool(t.attr("data-gs-no-resize")),noMove:_.toBool(t.attr("data-gs-no-move")),locked:_.toBool(t.attr("data-gs-locked")),resizeHandles:t.attr("data-gs-resize-handles"),el:t,id:t.attr("data-gs-id"),_grid:this},e);t.data("_gridstack_node",i),this._prepareElementsByNode(t,i)},i.prototype.setAnimation=function(t){t?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},i.prototype.addWidget=function(t,e,i,o,a,r,s,n,d,h,l){return t=u(t),void 0!==e&&t.attr("data-gs-x",e),void 0!==i&&t.attr("data-gs-y",i),void 0!==o&&t.attr("data-gs-width",o),void 0!==a&&t.attr("data-gs-height",a),void 0!==r&&t.attr("data-gs-auto-position",r?"yes":null),void 0!==s&&t.attr("data-gs-min-width",s),void 0!==n&&t.attr("data-gs-max-width",n),void 0!==d&&t.attr("data-gs-min-height",d),void 0!==h&&t.attr("data-gs-max-height",h),void 0!==l&&t.attr("data-gs-id",l),this.container.append(t),this._prepareElement(t,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),t},i.prototype.makeWidget=function(t){return t=u(t),this._prepareElement(t,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),t},i.prototype.willItFit=function(t,e,i,o,a){var r={x:t,y:e,width:i,height:o,autoPosition:a};return this.grid.canBePlacedWithRespectToHeight(r)},i.prototype.removeWidget=function(t,e){e=void 0===e||e;var i=(t=u(t)).data("_gridstack_node");i||(i=this.grid.getNodeDataByDOMEl(t)),this.grid.removeNode(i,e),t.removeData("_gridstack_node"),this._updateContainerHeight(),e&&t.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},i.prototype.removeAll=function(e){this.grid.nodes.forEach(function(t){this.removeWidget(t.el,e)},this),this.grid.nodes=[],this._updateContainerHeight()},i.prototype.destroy=function(t){u(window).off("resize",this.onResizeHandler),this.disable(),void 0===t||t?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),_.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},i.prototype.resizable=function(t,o){var a=this;return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(i.noResize=!o,i.noResize||a._isOneColumnMode()&&!a.opts.disableOneColumnMode?a.dd.resizable(e,"disable"):a.dd.resizable(e,"enable"))}),this},i.prototype.movable=function(t,o){var a=this;return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(i.noMove=!o,i.noMove||a._isOneColumnMode()&&!a.opts.disableOneColumnMode?(a.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(a.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},i.prototype.enableMove=function(t,e){this.movable(this.container.children("."+this.opts.itemClass),t),e&&(this.opts.disableDrag=!t)},i.prototype.enableResize=function(t,e){this.resizable(this.container.children("."+this.opts.itemClass),t),e&&(this.opts.disableResize=!t)},i.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},i.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},i.prototype.locked=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(i.locked=o||!1,e.attr("data-gs-locked",i.locked?"yes":null))}),this},i.prototype.maxHeight=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.maxHeight=o||!1,e.attr("data-gs-max-height",o)))}),this},i.prototype.minHeight=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.minHeight=o||!1,e.attr("data-gs-min-height",o)))}),this},i.prototype.maxWidth=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.maxWidth=o||!1,e.attr("data-gs-max-width",o)))}),this},i.prototype.minWidth=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.minWidth=o||!1,e.attr("data-gs-min-width",o)))}),this},i.prototype._updateElement=function(t,e){var i=(t=u(t).first()).data("_gridstack_node");if(null!=i){var o=this;o.grid.cleanNodes(),o.grid.beginUpdate(i),e.call(this,t,i),o._updateContainerHeight(),o._triggerChangeEvent(),o.grid.endUpdate()}},i.prototype.resize=function(t,i,o){this._updateElement(t,function(t,e){i=null!=i?i:e.width,o=null!=o?o:e.height,this.grid.moveNode(e,e.x,e.y,i,o)})},i.prototype.move=function(t,i,o){this._updateElement(t,function(t,e){i=null!=i?i:e.x,o=null!=o?o:e.y,this.grid.moveNode(e,i,o,e.width,e.height)})},i.prototype.update=function(t,i,o,a,r){this._updateElement(t,function(t,e){i=null!=i?i:e.x,o=null!=o?o:e.y,a=null!=a?a:e.width,r=null!=r?r:e.height,this.grid.moveNode(e,i,o,a,r)})},i.prototype.verticalMargin=function(t,e){if(void 0===t)return this.opts.verticalMargin;var i=_.parseHeight(t);this.opts.verticalMarginUnit===i.unit&&this.opts.height===i.height||(this.opts.verticalMarginUnit=i.unit,this.opts.verticalMargin=i.height,e||this._updateStyles())},i.prototype.cellHeight=function(t,e){if(void 0===t){if(this.opts.cellHeight)return this.opts.cellHeight;var i=this.container.children("."+this.opts.itemClass).first();return Math.ceil(i.outerHeight()/i.attr("data-gs-height"))}var o=_.parseHeight(t);this.opts.cellHeightUnit===o.unit&&this.opts.cellHeight===o.height||(this.opts.cellHeightUnit=o.unit,this.opts.cellHeight=o.height,e||this._updateStyles())},i.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},i.prototype.getCellFromPixel=function(t,e){var i=void 0!==e&&e?this.container.offset():this.container.position(),o=t.left-i.left,a=t.top-i.top,r=Math.floor(this.container.width()/this.opts.width),s=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(o/r),y:Math.floor(a/s)}},i.prototype.batchUpdate=function(){this.grid.batchUpdate()},i.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},i.prototype.isAreaEmpty=function(t,e,i,o){return this.grid.isAreaEmpty(t,e,i,o)},i.prototype.setStatic=function(t){this.opts.staticGrid=!0===t,this.enableMove(!t),this.enableResize(!t),this._setStaticClass()},i.prototype._setStaticClass=function(){var t="grid-stack-static";!0===this.opts.staticGrid?this.container.addClass(t):this.container.removeClass(t)},i.prototype._updateNodeWidths=function(t,e){this.grid._sortNodes(),this.grid.batchUpdate();for(var i={},o=0;o Date: Tue, 26 Mar 2019 08:42:42 -0700 Subject: [PATCH 05/10] Delete gridstack.jQueryUI.js --- dist/gridstack.jQueryUI.js | 93 -------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 dist/gridstack.jQueryUI.js diff --git a/dist/gridstack.jQueryUI.js b/dist/gridstack.jQueryUI.js deleted file mode 100644 index 1cc01ccbc..000000000 --- a/dist/gridstack.jQueryUI.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * gridstack.js 1.0.0-dev - * http://troolee.github.io/gridstack.js/ - * (c) 2014-2017 Pavel Reznikov, Dylan Weiss - * gridstack.js may be freely distributed under the MIT license. - * @preserve -*/ -(function(factory) { - if (typeof define === 'function' && define.amd) { - define(['jquery', 'gridstack', 'exports', 'jquery-ui/data', 'jquery-ui/disable-selection', - 'jquery-ui/focusable', 'jquery-ui/form', 'jquery-ui/ie', 'jquery-ui/keycode', 'jquery-ui/labels', - 'jquery-ui/jquery-1-7', 'jquery-ui/plugin', 'jquery-ui/safe-active-element', 'jquery-ui/safe-blur', - 'jquery-ui/scroll-parent', 'jquery-ui/tabbable', 'jquery-ui/unique-id', 'jquery-ui/version', - 'jquery-ui/widget', 'jquery-ui/widgets/mouse', 'jquery-ui/widgets/draggable', - 'jquery-ui/widgets/droppable', 'jquery-ui/widgets/resizable'], factory); - } else if (typeof exports !== 'undefined') { - try { jQuery = require('jquery'); } catch (e) {} - try { gridstack = require('gridstack'); } catch (e) {} - factory(jQuery, gridstack.GridStackUI, exports); - } else { - factory(jQuery, GridStackUI, window); - } -})(function($, GridStackUI, scope) { - /** - * @class JQueryUIGridStackDragDropPlugin - * jQuery UI implementation of drag'n'drop gridstack plugin. - */ - function JQueryUIGridStackDragDropPlugin(grid) { - GridStackUI.GridStackDragDropPlugin.call(this, grid); - } - - GridStackUI.GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin); - - JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackUI.GridStackDragDropPlugin.prototype); - JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; - - JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) { - el = $(el); - if (opts === 'disable' || opts === 'enable') { - el.resizable(opts); - } else if (opts === 'option') { - var key = arguments[2]; - var value = arguments[3]; - el.resizable(opts, key, value); - } else { - var handles = el.data('gs-resize-handles') ? el.data('gs-resize-handles') : - this.grid.opts.resizable.handles; - el.resizable($.extend({}, this.grid.opts.resizable, { - handles: handles - }, { - start: opts.start || function() {}, - stop: opts.stop || function() {}, - resize: opts.resize || function() {} - })); - } - return this; - }; - - JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) { - el = $(el); - if (opts === 'disable' || opts === 'enable') { - el.draggable(opts); - } else { - el.draggable($.extend({}, this.grid.opts.draggable, { - containment: this.grid.opts.isNested ? this.grid.container.parent() : null, - start: opts.start || function() {}, - stop: opts.stop || function() {}, - drag: opts.drag || function() {} - })); - } - return this; - }; - - JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) { - el = $(el); - el.droppable(opts); - return this; - }; - - JQueryUIGridStackDragDropPlugin.prototype.isDroppable = function(el, opts) { - el = $(el); - return Boolean(el.data('droppable')); - }; - - JQueryUIGridStackDragDropPlugin.prototype.on = function(el, eventName, callback) { - $(el).on(eventName, callback); - return this; - }; - - scope.JQueryUIGridStackDragDropPlugin = JQueryUIGridStackDragDropPlugin; - - return JQueryUIGridStackDragDropPlugin; -}); From f05ff04145a606973c03bed5437ff9f46268a80a Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 26 Mar 2019 08:43:56 -0700 Subject: [PATCH 06/10] Delete gridstack.jQueryUI.min.js --- dist/gridstack.jQueryUI.min.js | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 dist/gridstack.jQueryUI.min.js diff --git a/dist/gridstack.jQueryUI.min.js b/dist/gridstack.jQueryUI.min.js deleted file mode 100644 index 55dbc7d59..000000000 --- a/dist/gridstack.jQueryUI.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e){if("function"==typeof define&&define.amd)define(["jquery","gridstack","exports","jquery-ui/data","jquery-ui/disable-selection","jquery-ui/focusable","jquery-ui/form","jquery-ui/ie","jquery-ui/keycode","jquery-ui/labels","jquery-ui/jquery-1-7","jquery-ui/plugin","jquery-ui/safe-active-element","jquery-ui/safe-blur","jquery-ui/scroll-parent","jquery-ui/tabbable","jquery-ui/unique-id","jquery-ui/version","jquery-ui/widget","jquery-ui/widgets/mouse","jquery-ui/widgets/draggable","jquery-ui/widgets/droppable","jquery-ui/widgets/resizable"],e);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(e){}try{gridstack=require("gridstack")}catch(e){}e(jQuery,gridstack.GridStackUI,exports)}else e(jQuery,GridStackUI,window)}(function(a,r,e){function i(e){r.GridStackDragDropPlugin.call(this,e)}return r.GridStackDragDropPlugin.registerPlugin(i),((i.prototype=Object.create(r.GridStackDragDropPlugin.prototype)).constructor=i).prototype.resizable=function(e,r){if(e=a(e),"disable"===r||"enable"===r)e.resizable(r);else if("option"===r){var i=arguments[2],t=arguments[3];e.resizable(r,i,t)}else{var u=e.data("gs-resize-handles")?e.data("gs-resize-handles"):this.grid.opts.resizable.handles;e.resizable(a.extend({},this.grid.opts.resizable,{handles:u},{start:r.start||function(){},stop:r.stop||function(){},resize:r.resize||function(){}}))}return this},i.prototype.draggable=function(e,r){return e=a(e),"disable"===r||"enable"===r?e.draggable(r):e.draggable(a.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:r.start||function(){},stop:r.stop||function(){},drag:r.drag||function(){}})),this},i.prototype.droppable=function(e,r){return(e=a(e)).droppable(r),this},i.prototype.isDroppable=function(e,r){return e=a(e),Boolean(e.data("droppable"))},i.prototype.on=function(e,r,i){return a(e).on(r,i),this},e.JQueryUIGridStackDragDropPlugin=i}); -//# sourceMappingURL=gridstack.min.map \ No newline at end of file From fa8edabc250d6d621577940e27a0c2f1e313f1a1 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 26 Mar 2019 08:44:05 -0700 Subject: [PATCH 07/10] Delete gridstack.js --- dist/gridstack.js | 1902 --------------------------------------------- 1 file changed, 1902 deletions(-) delete mode 100644 dist/gridstack.js diff --git a/dist/gridstack.js b/dist/gridstack.js deleted file mode 100644 index 195c4a19f..000000000 --- a/dist/gridstack.js +++ /dev/null @@ -1,1902 +0,0 @@ -/** - * gridstack.js 1.0.0-dev - * http://troolee.github.io/gridstack.js/ - * (c) 2014-2018 Pavel Reznikov, Dylan Weiss - * gridstack.js may be freely distributed under the MIT license. - * @preserve -*/ -(function(factory) { - if (typeof define === 'function' && define.amd) { - define(['jquery', 'exports'], factory); - } else if (typeof exports !== 'undefined') { - try { jQuery = require('jquery'); } catch (e) {} - factory(jQuery, exports); - } else { - factory(jQuery, window); - } -})(function($, scope) { - var obsolete = function(f, oldName, newName) { - var wrapper = function() { - console.warn('gridstack.js: Function `' + oldName + '` is deprecated as of v0.2.5 and has been replaced ' + - 'with `' + newName + '`. It will be **completely** removed in v1.0.'); - return f.apply(this, arguments); - }; - wrapper.prototype = f.prototype; - - return wrapper; - }; - - var obsoleteOpts = function(oldName, newName) { - console.warn('gridstack.js: Option `' + oldName + '` is deprecated as of v0.2.5 and has been replaced with `' + - newName + '`. It will be **completely** removed in v1.0.'); - }; - - var Utils = { - - isIntercepted: function(a, b) { - return !(a.x + a.width <= b.x || b.x + b.width <= a.x || a.y + a.height <= b.y || b.y + b.height <= a.y); - }, - - sort: function(nodes, dir, width) { - if (!width) { - var widths = nodes.map(function(node) { return node.x + node.width; }); - width = Math.max.apply(Math, widths); - } - - dir = dir != -1 ? 1 : -1; - return Utils.sortBy(nodes, function(n) { return dir * (n.x + n.y * width); }); - }, - - createStylesheet: function(id) { - var style = document.createElement('style'); - style.setAttribute('type', 'text/css'); - style.setAttribute('data-gs-style-id', id); - if (style.styleSheet) { - style.styleSheet.cssText = ''; - } else { - style.appendChild(document.createTextNode('')); - } - document.getElementsByTagName('head')[0].appendChild(style); - return style.sheet; - }, - - removeStylesheet: function(id) { - $('STYLE[data-gs-style-id=' + id + ']').remove(); - }, - - insertCSSRule: function(sheet, selector, rules, index) { - if (typeof sheet.insertRule === 'function') { - sheet.insertRule(selector + '{' + rules + '}', index); - } else if (typeof sheet.addRule === 'function') { - sheet.addRule(selector, rules, index); - } - }, - - toBool: function(v) { - if (typeof v == 'boolean') { - return v; - } - if (typeof v == 'string') { - v = v.toLowerCase(); - return !(v === '' || v == 'no' || v == 'false' || v == '0'); - } - return Boolean(v); - }, - - _collisionNodeCheck: function(n) { - return n != this.node && Utils.isIntercepted(n, this.nn); - }, - - _didCollide: function(bn) { - return Utils.isIntercepted({x: this.n.x, y: this.newY, width: this.n.width, height: this.n.height}, bn); - }, - - _isAddNodeIntercepted: function(n) { - return Utils.isIntercepted({x: this.x, y: this.y, width: this.node.width, height: this.node.height}, n); - }, - - parseHeight: function(val) { - var height = val; - var heightUnit = 'px'; - if (height && typeof height === 'string') { - var match = height.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/); - if (!match) { - throw new Error('Invalid height'); - } - heightUnit = match[2] || 'px'; - height = parseFloat(match[1]); - } - return {height: height, unit: heightUnit}; - }, - - without: function(array, item) { - var index = array.indexOf(item); - - if (index !== -1) { - array = array.slice(0); - array.splice(index, 1); - } - - return array; - }, - - sortBy: function(array, getter) { - return array.slice(0).sort(function(left, right) { - var valueLeft = getter(left); - var valueRight = getter(right); - - if (valueRight === valueLeft) { - return 0; - } - - return valueLeft > valueRight ? 1 : -1; - }); - }, - - defaults: function(target) { - var sources = Array.prototype.slice.call(arguments, 1); - - sources.forEach(function(source) { - for (var prop in source) { - if (source.hasOwnProperty(prop) && !target.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - }); - - return target; - }, - - clone: function(target) { - return $.extend({}, target); - }, - - throttle: function(callback, delay) { - var isWaiting = false; - - return function() { - if (!isWaiting) { - callback.apply(this, arguments); - isWaiting = true; - setTimeout(function() { isWaiting = false; }, delay); - } - }; - }, - - removePositioningStyles: function(el) { - var style = el[0].style; - if (style.position) { - style.removeProperty('position'); - } - if (style.left) { - style.removeProperty('left'); - } - if (style.top) { - style.removeProperty('top'); - } - if (style.width) { - style.removeProperty('width'); - } - if (style.height) { - style.removeProperty('height'); - } - }, - getScrollParent: function(el) { - var returnEl; - if (el == null) { - returnEl = null; - } else if (el.scrollHeight > el.clientHeight) { - returnEl = el; - } else { - returnEl = Utils.getScrollParent(el.parentNode); - } - return returnEl; - }, - updateScrollPosition: function(el, ui, distance) { - // is widget in view? - var rect = el.getBoundingClientRect(); - var innerHeightOrClientHeight = (window.innerHeight || document.documentElement.clientHeight); - if (rect.top < 0 || - rect.bottom > innerHeightOrClientHeight - ) { - // set scrollTop of first parent that scrolls - // if parent is larger than el, set as low as possible - // to get entire widget on screen - var offsetDiffDown = rect.bottom - innerHeightOrClientHeight; - var offsetDiffUp = rect.top; - var scrollEl = Utils.getScrollParent(el); - if (scrollEl != null) { - var prevScroll = scrollEl.scrollTop; - if (rect.top < 0 && distance < 0) { - // moving up - if (el.offsetHeight > innerHeightOrClientHeight) { - scrollEl.scrollTop += distance; - } else { - scrollEl.scrollTop += Math.abs(offsetDiffUp) > Math.abs(distance) ? distance : offsetDiffUp; - } - } else if (distance > 0) { - // moving down - if (el.offsetHeight > innerHeightOrClientHeight) { - scrollEl.scrollTop += distance; - } else { - scrollEl.scrollTop += offsetDiffDown > distance ? distance : offsetDiffDown; - } - } - // move widget y by amount scrolled - ui.position.top += scrollEl.scrollTop - prevScroll; - } - } - } - }; - - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers - Utils.is_intercepted = obsolete(Utils.isIntercepted, 'is_intercepted', 'isIntercepted'); - - Utils.create_stylesheet = obsolete(Utils.createStylesheet, 'create_stylesheet', 'createStylesheet'); - - Utils.remove_stylesheet = obsolete(Utils.removeStylesheet, 'remove_stylesheet', 'removeStylesheet'); - - Utils.insert_css_rule = obsolete(Utils.insertCSSRule, 'insert_css_rule', 'insertCSSRule'); - // jscs:enable requireCamelCaseOrUpperCaseIdentifiers - - /** - * @class GridStackDragDropPlugin - * Base class for drag'n'drop plugin. - */ - function GridStackDragDropPlugin(grid) { - this.grid = grid; - } - - GridStackDragDropPlugin.registeredPlugins = []; - - GridStackDragDropPlugin.registerPlugin = function(pluginClass) { - GridStackDragDropPlugin.registeredPlugins.push(pluginClass); - }; - - GridStackDragDropPlugin.prototype.resizable = function(el, opts) { - return this; - }; - - GridStackDragDropPlugin.prototype.draggable = function(el, opts) { - return this; - }; - - GridStackDragDropPlugin.prototype.droppable = function(el, opts) { - return this; - }; - - GridStackDragDropPlugin.prototype.isDroppable = function(el) { - return false; - }; - - GridStackDragDropPlugin.prototype.on = function(el, eventName, callback) { - return this; - }; - - - var idSeq = 0; - - var GridStackEngine = function(width, onchange, floatMode, height, items) { - this.width = width; - this.float = floatMode || false; - this.height = height || 0; - - this.nodes = items || []; - this.onchange = onchange || function() {}; - - this._updateCounter = 0; - this._float = this.float; - - this._addedNodes = []; - this._removedNodes = []; - }; - - GridStackEngine.prototype.batchUpdate = function() { - this._updateCounter = 1; - this.float = true; - }; - - GridStackEngine.prototype.commit = function() { - if (this._updateCounter !== 0) { - this._updateCounter = 0; - this.float = this._float; - this._packNodes(); - this._notify(); - } - }; - - // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 - GridStackEngine.prototype.getNodeDataByDOMEl = function(el) { - return this.nodes.find(function(n) { return el.get(0) === n.el.get(0); }); - }; - - GridStackEngine.prototype._fixCollisions = function(node) { - var self = this; - this._sortNodes(-1); - - var nn = node; - var hasLocked = Boolean(this.nodes.find(function(n) { return n.locked; })); - if (!this.float && !hasLocked) { - nn = {x: 0, y: node.y, width: this.width, height: node.height}; - } - while (true) { - var collisionNode = this.nodes.find(Utils._collisionNodeCheck, {node: node, nn: nn}); - if (typeof collisionNode == 'undefined') { - return; - } - this.moveNode(collisionNode, collisionNode.x, node.y + node.height, - collisionNode.width, collisionNode.height, true); - } - }; - - GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height) { - var nn = {x: x || 0, y: y || 0, width: width || 1, height: height || 1}; - var collisionNode = this.nodes.find(function(n) { - return Utils.isIntercepted(n, nn); - }); - return collisionNode === null || typeof collisionNode === 'undefined'; - }; - - GridStackEngine.prototype._sortNodes = function(dir) { - this.nodes = Utils.sort(this.nodes, dir, this.width); - }; - - GridStackEngine.prototype._packNodes = function() { - this._sortNodes(); - - if (this.float) { - this.nodes.forEach(function(n, i) { - if (n._updating || typeof n._origY == 'undefined' || n.y == n._origY) { - return; - } - - var newY = n.y; - while (newY >= n._origY) { - var collisionNode = this.nodes - .slice(0, i) - .find(Utils._didCollide, {n: n, newY: newY}); - - if (!collisionNode) { - n._dirty = true; - n.y = newY; - } - --newY; - } - }, this); - } else { - this.nodes.forEach(function(n, i) { - if (n.locked) { - return; - } - while (n.y > 0) { - var newY = n.y - 1; - var canBeMoved = i === 0; - - if (i > 0) { - var collisionNode = this.nodes - .slice(0, i) - .find(Utils._didCollide, {n: n, newY: newY}); - canBeMoved = typeof collisionNode == 'undefined'; - } - - if (!canBeMoved) { - break; - } - n._dirty = n.y != newY; - n.y = newY; - } - }, this); - } - }; - - GridStackEngine.prototype._prepareNode = function(node, resizing) { - node = Utils.defaults(node || {}, {width: 1, height: 1, x: 0, y: 0}); - - node.x = parseInt('' + node.x); - node.y = parseInt('' + node.y); - node.width = parseInt('' + node.width); - node.height = parseInt('' + node.height); - node.autoPosition = node.autoPosition || false; - node.noResize = node.noResize || false; - node.noMove = node.noMove || false; - - if (node.width > this.width) { - node.width = this.width; - } else if (node.width < 1) { - node.width = 1; - } - - if (node.height < 1) { - node.height = 1; - } - - if (node.x < 0) { - node.x = 0; - } - - if (node.x + node.width > this.width) { - if (resizing) { - node.width = this.width - node.x; - } else { - node.x = this.width - node.width; - } - } - - if (node.y < 0) { - node.y = 0; - } - - return node; - }; - - GridStackEngine.prototype._notify = function() { - var args = Array.prototype.slice.call(arguments, 0); - args[0] = typeof args[0] === 'undefined' ? [] : [args[0]]; - args[1] = typeof args[1] === 'undefined' ? true : args[1]; - if (this._updateCounter) { - return; - } - var deletedNodes = args[0].concat(this.getDirtyNodes()); - this.onchange(deletedNodes, args[1]); - }; - - GridStackEngine.prototype.cleanNodes = function() { - if (this._updateCounter) { - return; - } - this.nodes.forEach(function(n) { n._dirty = false; }); - }; - - GridStackEngine.prototype.getDirtyNodes = function() { - return this.nodes.filter(function(n) { return n._dirty; }); - }; - - GridStackEngine.prototype.addNode = function(node, triggerAddEvent) { - node = this._prepareNode(node); - - if (typeof node.maxWidth != 'undefined') { node.width = Math.min(node.width, node.maxWidth); } - if (typeof node.maxHeight != 'undefined') { node.height = Math.min(node.height, node.maxHeight); } - if (typeof node.minWidth != 'undefined') { node.width = Math.max(node.width, node.minWidth); } - if (typeof node.minHeight != 'undefined') { node.height = Math.max(node.height, node.minHeight); } - - node._id = ++idSeq; - node._dirty = true; - - if (node.autoPosition) { - this._sortNodes(); - - for (var i = 0;; ++i) { - var x = i % this.width; - var y = Math.floor(i / this.width); - if (x + node.width > this.width) { - continue; - } - if (!this.nodes.find(Utils._isAddNodeIntercepted, {x: x, y: y, node: node})) { - node.x = x; - node.y = y; - break; - } - } - } - - this.nodes.push(node); - if (typeof triggerAddEvent != 'undefined' && triggerAddEvent) { - this._addedNodes.push(Utils.clone(node)); - } - - this._fixCollisions(node); - this._packNodes(); - this._notify(); - return node; - }; - - GridStackEngine.prototype.removeNode = function(node, detachNode) { - detachNode = typeof detachNode === 'undefined' ? true : detachNode; - this._removedNodes.push(Utils.clone(node)); - node._id = null; - this.nodes = Utils.without(this.nodes, node); - this._packNodes(); - this._notify(node, detachNode); - }; - - GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) { - if (!this.isNodeChangedPosition(node, x, y, width, height)) { - return false; - } - var hasLocked = Boolean(this.nodes.find(function(n) { return n.locked; })); - - if (!this.height && !hasLocked) { - return true; - } - - var clonedNode; - var clone = new GridStackEngine( - this.width, - null, - this.float, - 0, - this.nodes.map(function(n) { - if (n == node) { - clonedNode = $.extend({}, n); - return clonedNode; - } - return $.extend({}, n); - })); - - if (typeof clonedNode === 'undefined') { - return true; - } - - clone.moveNode(clonedNode, x, y, width, height); - - var res = true; - - if (hasLocked) { - res &= !Boolean(clone.nodes.find(function(n) { - return n != clonedNode && Boolean(n.locked) && Boolean(n._dirty); - })); - } - if (this.height) { - res &= clone.getGridHeight() <= this.height; - } - - return res; - }; - - GridStackEngine.prototype.canBePlacedWithRespectToHeight = function(node) { - if (!this.height) { - return true; - } - - var clone = new GridStackEngine( - this.width, - null, - this.float, - 0, - this.nodes.map(function(n) { return $.extend({}, n); })); - clone.addNode(node); - return clone.getGridHeight() <= this.height; - }; - - GridStackEngine.prototype.isNodeChangedPosition = function(node, x, y, width, height) { - if (typeof x != 'number') { x = node.x; } - if (typeof y != 'number') { y = node.y; } - if (typeof width != 'number') { width = node.width; } - if (typeof height != 'number') { height = node.height; } - - if (typeof node.maxWidth != 'undefined') { width = Math.min(width, node.maxWidth); } - if (typeof node.maxHeight != 'undefined') { height = Math.min(height, node.maxHeight); } - if (typeof node.minWidth != 'undefined') { width = Math.max(width, node.minWidth); } - if (typeof node.minHeight != 'undefined') { height = Math.max(height, node.minHeight); } - - if (node.x == x && node.y == y && node.width == width && node.height == height) { - return false; - } - return true; - }; - - GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack) { - if (!this.isNodeChangedPosition(node, x, y, width, height)) { - return node; - } - if (typeof x != 'number') { x = node.x; } - if (typeof y != 'number') { y = node.y; } - if (typeof width != 'number') { width = node.width; } - if (typeof height != 'number') { height = node.height; } - - if (typeof node.maxWidth != 'undefined') { width = Math.min(width, node.maxWidth); } - if (typeof node.maxHeight != 'undefined') { height = Math.min(height, node.maxHeight); } - if (typeof node.minWidth != 'undefined') { width = Math.max(width, node.minWidth); } - if (typeof node.minHeight != 'undefined') { height = Math.max(height, node.minHeight); } - - if (node.x == x && node.y == y && node.width == width && node.height == height) { - return node; - } - - var resizing = node.width != width; - node._dirty = true; - - node.x = x; - node.y = y; - node.width = width; - node.height = height; - - node.lastTriedX = x; - node.lastTriedY = y; - node.lastTriedWidth = width; - node.lastTriedHeight = height; - - node = this._prepareNode(node, resizing); - - this._fixCollisions(node); - if (!noPack) { - this._packNodes(); - this._notify(); - } - return node; - }; - - GridStackEngine.prototype.getGridHeight = function() { - return this.nodes.reduce(function(memo, n) { return Math.max(memo, n.y + n.height); }, 0); - }; - - GridStackEngine.prototype.beginUpdate = function(node) { - this.nodes.forEach(function(n) { - n._origY = n.y; - }); - node._updating = true; - }; - - GridStackEngine.prototype.endUpdate = function() { - this.nodes.forEach(function(n) { - n._origY = n.y; - }); - var n = this.nodes.find(function(n) { return n._updating; }); - if (n) { - n._updating = false; - } - }; - - var GridStack = function(el, opts) { - var self = this; - var oneColumnMode, isAutoCellHeight; - - opts = opts || {}; - - this.container = $(el); - - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers - if (typeof opts.handle_class !== 'undefined') { - opts.handleClass = opts.handle_class; - obsoleteOpts('handle_class', 'handleClass'); - } - if (typeof opts.item_class !== 'undefined') { - opts.itemClass = opts.item_class; - obsoleteOpts('item_class', 'itemClass'); - } - if (typeof opts.placeholder_class !== 'undefined') { - opts.placeholderClass = opts.placeholder_class; - obsoleteOpts('placeholder_class', 'placeholderClass'); - } - if (typeof opts.placeholder_text !== 'undefined') { - opts.placeholderText = opts.placeholder_text; - obsoleteOpts('placeholder_text', 'placeholderText'); - } - if (typeof opts.cell_height !== 'undefined') { - opts.cellHeight = opts.cell_height; - obsoleteOpts('cell_height', 'cellHeight'); - } - if (typeof opts.vertical_margin !== 'undefined') { - opts.verticalMargin = opts.vertical_margin; - obsoleteOpts('vertical_margin', 'verticalMargin'); - } - if (typeof opts.min_width !== 'undefined') { - opts.minWidth = opts.min_width; - obsoleteOpts('min_width', 'minWidth'); - } - if (typeof opts.static_grid !== 'undefined') { - opts.staticGrid = opts.static_grid; - obsoleteOpts('static_grid', 'staticGrid'); - } - if (typeof opts.is_nested !== 'undefined') { - opts.isNested = opts.is_nested; - obsoleteOpts('is_nested', 'isNested'); - } - if (typeof opts.always_show_resize_handle !== 'undefined') { - opts.alwaysShowResizeHandle = opts.always_show_resize_handle; - obsoleteOpts('always_show_resize_handle', 'alwaysShowResizeHandle'); - } - // jscs:enable requireCamelCaseOrUpperCaseIdentifiers - - opts.itemClass = opts.itemClass || 'grid-stack-item'; - var isNested = this.container.closest('.' + opts.itemClass).length > 0; - - this.opts = Utils.defaults(opts || {}, { - width: parseInt(this.container.attr('data-gs-width')) || 12, - height: parseInt(this.container.attr('data-gs-height')) || 0, - itemClass: 'grid-stack-item', - placeholderClass: 'grid-stack-placeholder', - placeholderText: '', - handle: '.grid-stack-item-content', - handleClass: null, - cellHeight: 60, - verticalMargin: 20, - auto: true, - minWidth: 768, - float: false, - staticGrid: false, - _class: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), - animate: Boolean(this.container.attr('data-gs-animate')) || false, - alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, - resizable: Utils.defaults(opts.resizable || {}, { - autoHide: !(opts.alwaysShowResizeHandle || false), - handles: 'se' - }), - draggable: Utils.defaults(opts.draggable || {}, { - handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || - '.grid-stack-item-content', - scroll: false, - appendTo: 'body' - }), - disableDrag: opts.disableDrag || false, - disableResize: opts.disableResize || false, - rtl: 'auto', - removable: false, - removableOptions: Utils.defaults(opts.removableOptions || {}, { - accept: '.' + opts.itemClass - }), - removeTimeout: 2000, - verticalMarginUnit: 'px', - cellHeightUnit: 'px', - disableOneColumnMode: opts.disableOneColumnMode || false, - oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode', - ddPlugin: null - }); - - if (this.opts.ddPlugin === false) { - this.opts.ddPlugin = GridStackDragDropPlugin; - } else if (this.opts.ddPlugin === null) { - this.opts.ddPlugin = GridStackDragDropPlugin.registeredPlugins[0] || GridStackDragDropPlugin; - } - - this.dd = new this.opts.ddPlugin(this); - - if (this.opts.rtl === 'auto') { - this.opts.rtl = this.container.css('direction') === 'rtl'; - } - - if (this.opts.rtl) { - this.container.addClass('grid-stack-rtl'); - } - - this.opts.isNested = isNested; - - isAutoCellHeight = this.opts.cellHeight === 'auto'; - if (isAutoCellHeight) { - self.cellHeight(self.cellWidth(), true); - } else { - this.cellHeight(this.opts.cellHeight, true); - } - this.verticalMargin(this.opts.verticalMargin, true); - - this.container.addClass(this.opts._class); - - this._setStaticClass(); - - if (isNested) { - this.container.addClass('grid-stack-nested'); - } - - this._initStyles(); - - this.grid = new GridStackEngine(this.opts.width, function(nodes, detachNode) { - detachNode = typeof detachNode === 'undefined' ? true : detachNode; - var maxHeight = 0; - this.nodes.forEach(function(n) { - maxHeight = Math.max(maxHeight, n.y + n.height); - }); - nodes.forEach(function(n) { - if (detachNode && n._id === null) { - if (n.el) { - n.el.remove(); - } - } else { - n.el - .attr('data-gs-x', n.x) - .attr('data-gs-y', n.y) - .attr('data-gs-width', n.width) - .attr('data-gs-height', n.height); - } - }); - self._updateStyles(maxHeight + 10); - }, this.opts.float, this.opts.height); - - if (this.opts.auto) { - var elements = []; - var _this = this; - this.container.children('.' + this.opts.itemClass + ':not(.' + this.opts.placeholderClass + ')') - .each(function(index, el) { - el = $(el); - elements.push({ - el: el, - i: parseInt(el.attr('data-gs-x')) + parseInt(el.attr('data-gs-y')) * _this.opts.width - }); - }); - Utils.sortBy(elements, function(x) { return x.i; }).forEach(function(i) { - this._prepareElement(i.el); - }, this); - } - - this.setAnimation(this.opts.animate); - - this.placeholder = $( - '
' + - '
' + this.opts.placeholderText + '
').hide(); - - this._updateContainerHeight(); - - this._updateHeightsOnResize = Utils.throttle(function() { - self.cellHeight(self.cellWidth(), false); - }, 100); - - this.onResizeHandler = function() { - if (isAutoCellHeight) { - self._updateHeightsOnResize(); - } - - if (self._isOneColumnMode() && !self.opts.disableOneColumnMode) { - if (oneColumnMode) { - return; - } - self.container.addClass(self.opts.oneColumnModeClass); - oneColumnMode = true; - - self.grid._sortNodes(); - self.grid.nodes.forEach(function(node) { - self.container.append(node.el); - - if (self.opts.staticGrid) { - return; - } - self.dd.draggable(node.el, 'disable'); - self.dd.resizable(node.el, 'disable'); - - node.el.trigger('resize'); - }); - } else { - if (!oneColumnMode) { - return; - } - - self.container.removeClass(self.opts.oneColumnModeClass); - oneColumnMode = false; - - if (self.opts.staticGrid) { - return; - } - - self.grid.nodes.forEach(function(node) { - if (!node.noMove && !self.opts.disableDrag) { - self.dd.draggable(node.el, 'enable'); - } - if (!node.noResize && !self.opts.disableResize) { - self.dd.resizable(node.el, 'enable'); - } - - node.el.trigger('resize'); - }); - } - }; - - $(window).resize(this.onResizeHandler); - this.onResizeHandler(); - - if (!self.opts.staticGrid && typeof self.opts.removable === 'string') { - var trashZone = $(self.opts.removable); - if (!this.dd.isDroppable(trashZone)) { - this.dd.droppable(trashZone, self.opts.removableOptions); - } - this.dd - .on(trashZone, 'dropover', function(event, ui) { - var el = $(ui.draggable); - var node = el.data('_gridstack_node'); - if (node._grid !== self) { - return; - } - el.data('inTrashZone', true); - self._setupRemovingTimeout(el); - }) - .on(trashZone, 'dropout', function(event, ui) { - var el = $(ui.draggable); - var node = el.data('_gridstack_node'); - if (node._grid !== self) { - return; - } - el.data('inTrashZone', false); - self._clearRemovingTimeout(el); - }); - } - - if (!self.opts.staticGrid && self.opts.acceptWidgets) { - var draggingElement = null; - - var onDrag = function(event, ui) { - var el = draggingElement; - var node = el.data('_gridstack_node'); - var pos = self.getCellFromPixel({left: event.pageX, top: event.pageY}, true); - var x = Math.max(0, pos.x); - var y = Math.max(0, pos.y); - if (!node._added) { - node._added = true; - - node.el = el; - node.autoPosition = true; - node.x = x; - node.y = y; - self.grid.cleanNodes(); - self.grid.beginUpdate(node); - self.grid.addNode(node); - - self.container.append(self.placeholder); - self.placeholder - .attr('data-gs-x', node.x) - .attr('data-gs-y', node.y) - .attr('data-gs-width', node.width) - .attr('data-gs-height', node.height) - .show(); - node.el = self.placeholder; - node._beforeDragX = node.x; - node._beforeDragY = node.y; - - self._updateContainerHeight(); - } - if (!self.grid.canMoveNode(node, x, y)) { - return; - } - self.grid.moveNode(node, x, y); - self._updateContainerHeight(); - }; - - this.dd - .droppable(self.container, { - accept: function(el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (node && node._grid === self) { - return false; - } - return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets); - } - }) - .on(self.container, 'dropover', function(event, ui) { - var offset = self.container.offset(); - var el = $(ui.draggable); - var cellWidth = self.cellWidth(); - var cellHeight = self.cellHeight(); - var origNode = el.data('_gridstack_node'); - - var width = origNode ? origNode.width : (Math.ceil(el.outerWidth() / cellWidth)); - var height = origNode ? origNode.height : (Math.ceil(el.outerHeight() / cellHeight)); - - draggingElement = el; - - var node = self.grid._prepareNode({width: width, height: height, _added: false, _temporary: true}); - el.data('_gridstack_node', node); - el.data('_gridstack_node_orig', origNode); - - el.on('drag', onDrag); - }) - .on(self.container, 'dropout', function(event, ui) { - var el = $(ui.draggable); - if (!el.data('_gridstack_node')) { - return; - } - el.unbind('drag', onDrag); - var node = el.data('_gridstack_node'); - node.el = null; - self.grid.removeNode(node); - self.placeholder.detach(); - self._updateContainerHeight(); - el.data('_gridstack_node', el.data('_gridstack_node_orig')); - }) - .on(self.container, 'drop', function(event, ui) { - self.placeholder.detach(); - - var node = $(ui.draggable).data('_gridstack_node'); - node._grid = self; - var el = $(ui.draggable).clone(false); - el.data('_gridstack_node', node); - var originalNode = $(ui.draggable).data('_gridstack_node_orig'); - if (typeof originalNode !== 'undefined' && typeof originalNode._grid !== 'undefined') { - originalNode._grid._triggerRemoveEvent(); - } - $(ui.helper).remove(); - node.el = el; - self.placeholder.hide(); - Utils.removePositioningStyles(el); - el.find('div.ui-resizable-handle').remove(); - - el - .attr('data-gs-x', node.x) - .attr('data-gs-y', node.y) - .attr('data-gs-width', node.width) - .attr('data-gs-height', node.height) - .addClass(self.opts.itemClass) - .enableSelection() - .removeData('draggable') - .removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled') - .unbind('drag', onDrag); - self.container.append(el); - self._prepareElementsByNode(el, node); - self._updateContainerHeight(); - self.grid._addedNodes.push(node); - self._triggerAddEvent(); - self._triggerChangeEvent(); - - self.grid.endUpdate(); - $(ui.draggable).unbind('drag', onDrag); - $(ui.draggable).removeData('_gridstack_node'); - $(ui.draggable).removeData('_gridstack_node_orig'); - self.container.trigger('dropped', [originalNode, node]); - }); - } - }; - - GridStack.prototype._triggerChangeEvent = function(forceTrigger) { - var elements = this.grid.getDirtyNodes(); - var hasChanges = false; - - var eventParams = []; - if (elements && elements.length) { - eventParams.push(elements); - hasChanges = true; - } - - if (hasChanges || forceTrigger === true) { - this.container.trigger('change', eventParams); - } - }; - - GridStack.prototype._triggerAddEvent = function() { - if (this.grid._addedNodes && this.grid._addedNodes.length > 0) { - this.container.trigger('added', [this.grid._addedNodes.map(Utils.clone)]); - this.grid._addedNodes = []; - } - }; - - GridStack.prototype._triggerRemoveEvent = function() { - if (this.grid._removedNodes && this.grid._removedNodes.length > 0) { - this.container.trigger('removed', [this.grid._removedNodes.map(Utils.clone)]); - this.grid._removedNodes = []; - } - }; - - GridStack.prototype._initStyles = function() { - if (this._stylesId) { - Utils.removeStylesheet(this._stylesId); - } - this._stylesId = 'gridstack-style-' + (Math.random() * 100000).toFixed(); - this._styles = Utils.createStylesheet(this._stylesId); - if (this._styles !== null) { - this._styles._max = 0; - } - }; - - GridStack.prototype._updateStyles = function(maxHeight) { - if (this._styles === null || typeof this._styles === 'undefined') { - return; - } - - var prefix = '.' + this.opts._class + ' .' + this.opts.itemClass; - var self = this; - var getHeight; - - if (typeof maxHeight == 'undefined') { - maxHeight = this._styles._max; - } - this._initStyles(); - this._updateContainerHeight(); - if (!this.opts.cellHeight) { // The rest will be handled by CSS - return ; - } - if (this._styles._max !== 0 && maxHeight <= this._styles._max) { // Keep this._styles._max increasing - return ; - } - - if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) { - getHeight = function(nbRows, nbMargins) { - return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) + - self.opts.cellHeightUnit; - }; - } else { - getHeight = function(nbRows, nbMargins) { - if (!nbRows || !nbMargins) { - return (self.opts.cellHeight * nbRows + self.opts.verticalMargin * nbMargins) + - self.opts.cellHeightUnit; - } - return 'calc(' + ((self.opts.cellHeight * nbRows) + self.opts.cellHeightUnit) + ' + ' + - ((self.opts.verticalMargin * nbMargins) + self.opts.verticalMarginUnit) + ')'; - }; - } - - if (this._styles._max === 0) { - Utils.insertCSSRule(this._styles, prefix, 'min-height: ' + getHeight(1, 0) + ';', 0); - } - - if (maxHeight > this._styles._max) { - for (var i = this._styles._max; i < maxHeight; ++i) { - Utils.insertCSSRule(this._styles, - prefix + '[data-gs-height="' + (i + 1) + '"]', - 'height: ' + getHeight(i + 1, i) + ';', - i - ); - Utils.insertCSSRule(this._styles, - prefix + '[data-gs-min-height="' + (i + 1) + '"]', - 'min-height: ' + getHeight(i + 1, i) + ';', - i - ); - Utils.insertCSSRule(this._styles, - prefix + '[data-gs-max-height="' + (i + 1) + '"]', - 'max-height: ' + getHeight(i + 1, i) + ';', - i - ); - Utils.insertCSSRule(this._styles, - prefix + '[data-gs-y="' + i + '"]', - 'top: ' + getHeight(i, i) + ';', - i - ); - } - this._styles._max = maxHeight; - } - }; - - GridStack.prototype._updateContainerHeight = function() { - if (this.grid._updateCounter) { - return; - } - var height = this.grid.getGridHeight(); - // check for css min height. Each row is cellHeight + verticalMargin, until last one which has no margin below - var cssMinHeight = parseInt(this.container.css('min-height')); - if (cssMinHeight > 0) { - var minHeight = (cssMinHeight + this.opts.verticalMargin) / (this.cellHeight() + this.opts.verticalMargin); - if (height < minHeight) { - height = minHeight; - } - } - this.container.attr('data-gs-current-height', height); - if (!this.opts.cellHeight) { - return ; - } - if (!this.opts.verticalMargin) { - this.container.css('height', (height * (this.opts.cellHeight)) + this.opts.cellHeightUnit); - } else if (this.opts.cellHeightUnit === this.opts.verticalMarginUnit) { - this.container.css('height', (height * (this.opts.cellHeight + this.opts.verticalMargin) - - this.opts.verticalMargin) + this.opts.cellHeightUnit); - } else { - this.container.css('height', 'calc(' + ((height * (this.opts.cellHeight)) + this.opts.cellHeightUnit) + - ' + ' + ((height * (this.opts.verticalMargin - 1)) + this.opts.verticalMarginUnit) + ')'); - } - }; - - GridStack.prototype._isOneColumnMode = function() { - return (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= - this.opts.minWidth; - }; - - GridStack.prototype._setupRemovingTimeout = function(el) { - var self = this; - var node = $(el).data('_gridstack_node'); - - if (node._removeTimeout || !self.opts.removable) { - return; - } - node._removeTimeout = setTimeout(function() { - el.addClass('grid-stack-item-removing'); - node._isAboutToRemove = true; - }, self.opts.removeTimeout); - }; - - GridStack.prototype._clearRemovingTimeout = function(el) { - var node = $(el).data('_gridstack_node'); - - if (!node._removeTimeout) { - return; - } - clearTimeout(node._removeTimeout); - node._removeTimeout = null; - el.removeClass('grid-stack-item-removing'); - node._isAboutToRemove = false; - }; - - GridStack.prototype._prepareElementsByNode = function(el, node) { - var self = this; - - var cellWidth; - var cellHeight; - - var dragOrResize = function(event, ui) { - var x = Math.round(ui.position.left / cellWidth); - var y = Math.floor((ui.position.top + cellHeight / 2) / cellHeight); - var width; - var height; - - if (event.type != 'drag') { - width = Math.round(ui.size.width / cellWidth); - height = Math.round(ui.size.height / cellHeight); - } - - if (event.type == 'drag') { - var distance = ui.position.top - node._prevYPix; - node._prevYPix = ui.position.top; - Utils.updateScrollPosition(el[0], ui, distance); - if (el.data('inTrashZone') || x < 0 || x >= self.grid.width || y < 0 || - (!self.grid.float && y > self.grid.getGridHeight())) { - if (!node._temporaryRemoved) { - if (self.opts.removable === true) { - self._setupRemovingTimeout(el); - } - - x = node._beforeDragX; - y = node._beforeDragY; - - self.placeholder.detach(); - self.placeholder.hide(); - self.grid.removeNode(node); - self._updateContainerHeight(); - - node._temporaryRemoved = true; - } else { - return; - } - } else { - self._clearRemovingTimeout(el); - - if (node._temporaryRemoved) { - self.grid.addNode(node); - self.placeholder - .attr('data-gs-x', x) - .attr('data-gs-y', y) - .attr('data-gs-width', width) - .attr('data-gs-height', height) - .show(); - self.container.append(self.placeholder); - node.el = self.placeholder; - node._temporaryRemoved = false; - } - } - } else if (event.type == 'resize') { - if (x < 0) { - return; - } - } - // width and height are undefined if not resizing - var lastTriedWidth = typeof width !== 'undefined' ? width : node.lastTriedWidth; - var lastTriedHeight = typeof height !== 'undefined' ? height : node.lastTriedHeight; - if (!self.grid.canMoveNode(node, x, y, width, height) || - (node.lastTriedX === x && node.lastTriedY === y && - node.lastTriedWidth === lastTriedWidth && node.lastTriedHeight === lastTriedHeight)) { - return; - } - node.lastTriedX = x; - node.lastTriedY = y; - node.lastTriedWidth = width; - node.lastTriedHeight = height; - self.grid.moveNode(node, x, y, width, height); - self._updateContainerHeight(); - - if (event.type == 'resize') { - $(event.target).trigger('gsresize', node); - } - }; - - var onStartMoving = function(event, ui) { - self.container.append(self.placeholder); - var o = $(this); - self.grid.cleanNodes(); - self.grid.beginUpdate(node); - cellWidth = self.cellWidth(); - var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height')); - cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height')); - self.placeholder - .attr('data-gs-x', o.attr('data-gs-x')) - .attr('data-gs-y', o.attr('data-gs-y')) - .attr('data-gs-width', o.attr('data-gs-width')) - .attr('data-gs-height', o.attr('data-gs-height')) - .show(); - node.el = self.placeholder; - node._beforeDragX = node.x; - node._beforeDragY = node.y; - node._prevYPix = ui.position.top; - - self.dd.resizable(el, 'option', 'minWidth', cellWidth * (node.minWidth || 1)); - self.dd.resizable(el, 'option', 'minHeight', strictCellHeight * (node.minHeight || 1)); - - if (event.type == 'resizestart') { - o.find('.grid-stack-item').trigger('resizestart'); - } - }; - - var onEndMoving = function(event, ui) { - var o = $(this); - if (!o.data('_gridstack_node')) { - return; - } - - var forceNotify = false; - self.placeholder.detach(); - node.el = o; - self.placeholder.hide(); - - if (node._isAboutToRemove) { - forceNotify = true; - var gridToNotify = el.data('_gridstack_node')._grid; - gridToNotify._triggerRemoveEvent(); - el.removeData('_gridstack_node'); - el.remove(); - } else { - self._clearRemovingTimeout(el); - if (!node._temporaryRemoved) { - Utils.removePositioningStyles(o); - o - .attr('data-gs-x', node.x) - .attr('data-gs-y', node.y) - .attr('data-gs-width', node.width) - .attr('data-gs-height', node.height); - } else { - Utils.removePositioningStyles(o); - o - .attr('data-gs-x', node._beforeDragX) - .attr('data-gs-y', node._beforeDragY) - .attr('data-gs-width', node.width) - .attr('data-gs-height', node.height); - node.x = node._beforeDragX; - node.y = node._beforeDragY; - node._temporaryRemoved = false; - self.grid.addNode(node); - } - } - self._updateContainerHeight(); - self._triggerChangeEvent(forceNotify); - - self.grid.endUpdate(); - - var nestedGrids = o.find('.grid-stack'); - if (nestedGrids.length && event.type == 'resizestop') { - nestedGrids.each(function(index, el) { - $(el).data('gridstack').onResizeHandler(); - }); - o.find('.grid-stack-item').trigger('resizestop'); - o.find('.grid-stack-item').trigger('gsresizestop'); - } - if (event.type == 'resizestop') { - self.container.trigger('gsresizestop', o); - } - }; - - this.dd - .draggable(el, { - start: onStartMoving, - stop: onEndMoving, - drag: dragOrResize - }) - .resizable(el, { - start: onStartMoving, - stop: onEndMoving, - resize: dragOrResize - }); - - if (node.noMove || (this._isOneColumnMode() && !self.opts.disableOneColumnMode) || this.opts.disableDrag || - this.opts.staticGrid) { - this.dd.draggable(el, 'disable'); - } - - if (node.noResize || (this._isOneColumnMode() && !self.opts.disableOneColumnMode) || this.opts.disableResize || - this.opts.staticGrid) { - this.dd.resizable(el, 'disable'); - } - - el.attr('data-gs-locked', node.locked ? 'yes' : null); - }; - - GridStack.prototype._prepareElement = function(el, triggerAddEvent) { - triggerAddEvent = typeof triggerAddEvent != 'undefined' ? triggerAddEvent : false; - var self = this; - el = $(el); - - el.addClass(this.opts.itemClass); - var node = self.grid.addNode({ - x: parseInt(el.attr('data-gs-x'), 10), - y: parseInt(el.attr('data-gs-y'), 10), - width: el.attr('data-gs-width'), - height: el.attr('data-gs-height'), - maxWidth: el.attr('data-gs-max-width'), - minWidth: el.attr('data-gs-min-width'), - maxHeight: el.attr('data-gs-max-height'), - minHeight: el.attr('data-gs-min-height'), - autoPosition: Utils.toBool(el.attr('data-gs-auto-position')), - noResize: Utils.toBool(el.attr('data-gs-no-resize')), - noMove: Utils.toBool(el.attr('data-gs-no-move')), - locked: Utils.toBool(el.attr('data-gs-locked')), - resizeHandles: el.attr('data-gs-resize-handles'), - el: el, - id: el.attr('data-gs-id'), - _grid: self - }, triggerAddEvent); - el.data('_gridstack_node', node); - - this._prepareElementsByNode(el, node); - }; - - GridStack.prototype.setAnimation = function(enable) { - if (enable) { - this.container.addClass('grid-stack-animate'); - } else { - this.container.removeClass('grid-stack-animate'); - } - }; - - GridStack.prototype.addWidget = function(el, x, y, width, height, autoPosition, minWidth, maxWidth, - minHeight, maxHeight, id) { - el = $(el); - if (typeof x != 'undefined') { el.attr('data-gs-x', x); } - if (typeof y != 'undefined') { el.attr('data-gs-y', y); } - if (typeof width != 'undefined') { el.attr('data-gs-width', width); } - if (typeof height != 'undefined') { el.attr('data-gs-height', height); } - if (typeof autoPosition != 'undefined') { el.attr('data-gs-auto-position', autoPosition ? 'yes' : null); } - if (typeof minWidth != 'undefined') { el.attr('data-gs-min-width', minWidth); } - if (typeof maxWidth != 'undefined') { el.attr('data-gs-max-width', maxWidth); } - if (typeof minHeight != 'undefined') { el.attr('data-gs-min-height', minHeight); } - if (typeof maxHeight != 'undefined') { el.attr('data-gs-max-height', maxHeight); } - if (typeof id != 'undefined') { el.attr('data-gs-id', id); } - this.container.append(el); - this._prepareElement(el, true); - this._triggerAddEvent(); - this._updateContainerHeight(); - this._triggerChangeEvent(true); - - return el; - }; - - GridStack.prototype.makeWidget = function(el) { - el = $(el); - this._prepareElement(el, true); - this._triggerAddEvent(); - this._updateContainerHeight(); - this._triggerChangeEvent(true); - - return el; - }; - - GridStack.prototype.willItFit = function(x, y, width, height, autoPosition) { - var node = {x: x, y: y, width: width, height: height, autoPosition: autoPosition}; - return this.grid.canBePlacedWithRespectToHeight(node); - }; - - GridStack.prototype.removeWidget = function(el, detachNode) { - detachNode = typeof detachNode === 'undefined' ? true : detachNode; - el = $(el); - var node = el.data('_gridstack_node'); - - // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 - if (!node) { - node = this.grid.getNodeDataByDOMEl(el); - } - - this.grid.removeNode(node, detachNode); - el.removeData('_gridstack_node'); - this._updateContainerHeight(); - if (detachNode) { - el.remove(); - } - this._triggerChangeEvent(true); - this._triggerRemoveEvent(); - }; - - GridStack.prototype.removeAll = function(detachNode) { - this.grid.nodes.forEach(function(node) { - this.removeWidget(node.el, detachNode); - }, this); - this.grid.nodes = []; - this._updateContainerHeight(); - }; - - GridStack.prototype.destroy = function(detachGrid) { - $(window).off('resize', this.onResizeHandler); - this.disable(); - if (typeof detachGrid != 'undefined' && !detachGrid) { - this.removeAll(false); - this.container.removeData('gridstack'); - } else { - this.container.remove(); - } - Utils.removeStylesheet(this._stylesId); - if (this.grid) { - this.grid = null; - } - }; - - GridStack.prototype.resizable = function(el, val) { - var self = this; - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node == 'undefined' || node === null) { - return; - } - - node.noResize = !(val || false); - if (node.noResize || (self._isOneColumnMode() && !self.opts.disableOneColumnMode)) { - self.dd.resizable(el, 'disable'); - } else { - self.dd.resizable(el, 'enable'); - } - }); - return this; - }; - - GridStack.prototype.movable = function(el, val) { - var self = this; - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node == 'undefined' || node === null) { - return; - } - - node.noMove = !(val || false); - if (node.noMove || (self._isOneColumnMode() && !self.opts.disableOneColumnMode)) { - self.dd.draggable(el, 'disable'); - el.removeClass('ui-draggable-handle'); - } else { - self.dd.draggable(el, 'enable'); - el.addClass('ui-draggable-handle'); - } - }); - return this; - }; - - GridStack.prototype.enableMove = function(doEnable, includeNewWidgets) { - this.movable(this.container.children('.' + this.opts.itemClass), doEnable); - if (includeNewWidgets) { - this.opts.disableDrag = !doEnable; - } - }; - - GridStack.prototype.enableResize = function(doEnable, includeNewWidgets) { - this.resizable(this.container.children('.' + this.opts.itemClass), doEnable); - if (includeNewWidgets) { - this.opts.disableResize = !doEnable; - } - }; - - GridStack.prototype.disable = function() { - this.movable(this.container.children('.' + this.opts.itemClass), false); - this.resizable(this.container.children('.' + this.opts.itemClass), false); - this.container.trigger('disable'); - }; - - GridStack.prototype.enable = function() { - this.movable(this.container.children('.' + this.opts.itemClass), true); - this.resizable(this.container.children('.' + this.opts.itemClass), true); - this.container.trigger('enable'); - }; - - GridStack.prototype.locked = function(el, val) { - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node == 'undefined' || node === null) { - return; - } - - node.locked = (val || false); - el.attr('data-gs-locked', node.locked ? 'yes' : null); - }); - return this; - }; - - GridStack.prototype.maxHeight = function(el, val) { - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node === 'undefined' || node === null) { - return; - } - - if (!isNaN(val)) { - node.maxHeight = (val || false); - el.attr('data-gs-max-height', val); - } - }); - return this; - }; - - GridStack.prototype.minHeight = function(el, val) { - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node === 'undefined' || node === null) { - return; - } - - if (!isNaN(val)) { - node.minHeight = (val || false); - el.attr('data-gs-min-height', val); - } - }); - return this; - }; - - GridStack.prototype.maxWidth = function(el, val) { - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node === 'undefined' || node === null) { - return; - } - - if (!isNaN(val)) { - node.maxWidth = (val || false); - el.attr('data-gs-max-width', val); - } - }); - return this; - }; - - GridStack.prototype.minWidth = function(el, val) { - el = $(el); - el.each(function(index, el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (typeof node === 'undefined' || node === null) { - return; - } - - if (!isNaN(val)) { - node.minWidth = (val || false); - el.attr('data-gs-min-width', val); - } - }); - return this; - }; - - GridStack.prototype._updateElement = function(el, callback) { - el = $(el).first(); - var node = el.data('_gridstack_node'); - if (typeof node == 'undefined' || node === null) { - return; - } - - var self = this; - - self.grid.cleanNodes(); - self.grid.beginUpdate(node); - - callback.call(this, el, node); - - self._updateContainerHeight(); - self._triggerChangeEvent(); - - self.grid.endUpdate(); - }; - - GridStack.prototype.resize = function(el, width, height) { - this._updateElement(el, function(el, node) { - width = (width !== null && typeof width != 'undefined') ? width : node.width; - height = (height !== null && typeof height != 'undefined') ? height : node.height; - - this.grid.moveNode(node, node.x, node.y, width, height); - }); - }; - - GridStack.prototype.move = function(el, x, y) { - this._updateElement(el, function(el, node) { - x = (x !== null && typeof x != 'undefined') ? x : node.x; - y = (y !== null && typeof y != 'undefined') ? y : node.y; - - this.grid.moveNode(node, x, y, node.width, node.height); - }); - }; - - GridStack.prototype.update = function(el, x, y, width, height) { - this._updateElement(el, function(el, node) { - x = (x !== null && typeof x != 'undefined') ? x : node.x; - y = (y !== null && typeof y != 'undefined') ? y : node.y; - width = (width !== null && typeof width != 'undefined') ? width : node.width; - height = (height !== null && typeof height != 'undefined') ? height : node.height; - - this.grid.moveNode(node, x, y, width, height); - }); - }; - - GridStack.prototype.verticalMargin = function(val, noUpdate) { - if (typeof val == 'undefined') { - return this.opts.verticalMargin; - } - - var heightData = Utils.parseHeight(val); - - if (this.opts.verticalMarginUnit === heightData.unit && this.opts.height === heightData.height) { - return ; - } - this.opts.verticalMarginUnit = heightData.unit; - this.opts.verticalMargin = heightData.height; - - if (!noUpdate) { - this._updateStyles(); - } - }; - - GridStack.prototype.cellHeight = function(val, noUpdate) { - if (typeof val == 'undefined') { - if (this.opts.cellHeight) { - return this.opts.cellHeight; - } - var o = this.container.children('.' + this.opts.itemClass).first(); - return Math.ceil(o.outerHeight() / o.attr('data-gs-height')); - } - var heightData = Utils.parseHeight(val); - - if (this.opts.cellHeightUnit === heightData.unit && this.opts.cellHeight === heightData.height) { - return ; - } - this.opts.cellHeightUnit = heightData.unit; - this.opts.cellHeight = heightData.height; - - if (!noUpdate) { - this._updateStyles(); - } - - }; - - GridStack.prototype.cellWidth = function() { - return Math.round(this.container.outerWidth() / this.opts.width); - }; - - GridStack.prototype.getCellFromPixel = function(position, useOffset) { - var containerPos = (typeof useOffset != 'undefined' && useOffset) ? - this.container.offset() : this.container.position(); - var relativeLeft = position.left - containerPos.left; - var relativeTop = position.top - containerPos.top; - - var columnWidth = Math.floor(this.container.width() / this.opts.width); - var rowHeight = Math.floor(this.container.height() / parseInt(this.container.attr('data-gs-current-height'))); - - return {x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight)}; - }; - - GridStack.prototype.batchUpdate = function() { - this.grid.batchUpdate(); - }; - - GridStack.prototype.commit = function() { - this.grid.commit(); - this._updateContainerHeight(); - }; - - GridStack.prototype.isAreaEmpty = function(x, y, width, height) { - return this.grid.isAreaEmpty(x, y, width, height); - }; - - GridStack.prototype.setStatic = function(staticValue) { - this.opts.staticGrid = (staticValue === true); - this.enableMove(!staticValue); - this.enableResize(!staticValue); - this._setStaticClass(); - }; - - GridStack.prototype._setStaticClass = function() { - var staticClassName = 'grid-stack-static'; - - if (this.opts.staticGrid === true) { - this.container.addClass(staticClassName); - } else { - this.container.removeClass(staticClassName); - } - }; - - GridStack.prototype._updateNodeWidths = function(oldWidth, newWidth) { - this.grid._sortNodes(); - this.grid.batchUpdate(); - var node = {}; - for (var i = 0; i < this.grid.nodes.length; i++) { - node = this.grid.nodes[i]; - this.update(node.el, Math.round(node.x * newWidth / oldWidth), undefined, - Math.round(node.width * newWidth / oldWidth), undefined); - } - this.grid.commit(); - }; - - GridStack.prototype.setGridWidth = function(gridWidth,doNotPropagate) { - this.container.removeClass('grid-stack-' + this.opts.width); - if (doNotPropagate !== true) { - this._updateNodeWidths(this.opts.width, gridWidth); - } - this.opts.width = gridWidth; - this.grid.width = gridWidth; - this.container.addClass('grid-stack-' + gridWidth); - }; - - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers - GridStackEngine.prototype.batch_update = obsolete(GridStackEngine.prototype.batchUpdate); - GridStackEngine.prototype._fix_collisions = obsolete(GridStackEngine.prototype._fixCollisions, - '_fix_collisions', '_fixCollisions'); - GridStackEngine.prototype.is_area_empty = obsolete(GridStackEngine.prototype.isAreaEmpty, - 'is_area_empty', 'isAreaEmpty'); - GridStackEngine.prototype._sort_nodes = obsolete(GridStackEngine.prototype._sortNodes, - '_sort_nodes', '_sortNodes'); - GridStackEngine.prototype._pack_nodes = obsolete(GridStackEngine.prototype._packNodes, - '_pack_nodes', '_packNodes'); - GridStackEngine.prototype._prepare_node = obsolete(GridStackEngine.prototype._prepareNode, - '_prepare_node', '_prepareNode'); - GridStackEngine.prototype.clean_nodes = obsolete(GridStackEngine.prototype.cleanNodes, - 'clean_nodes', 'cleanNodes'); - GridStackEngine.prototype.get_dirty_nodes = obsolete(GridStackEngine.prototype.getDirtyNodes, - 'get_dirty_nodes', 'getDirtyNodes'); - GridStackEngine.prototype.add_node = obsolete(GridStackEngine.prototype.addNode, - 'add_node', 'addNode, '); - GridStackEngine.prototype.remove_node = obsolete(GridStackEngine.prototype.removeNode, - 'remove_node', 'removeNode'); - GridStackEngine.prototype.can_move_node = obsolete(GridStackEngine.prototype.canMoveNode, - 'can_move_node', 'canMoveNode'); - GridStackEngine.prototype.move_node = obsolete(GridStackEngine.prototype.moveNode, - 'move_node', 'moveNode'); - GridStackEngine.prototype.get_grid_height = obsolete(GridStackEngine.prototype.getGridHeight, - 'get_grid_height', 'getGridHeight'); - GridStackEngine.prototype.begin_update = obsolete(GridStackEngine.prototype.beginUpdate, - 'begin_update', 'beginUpdate'); - GridStackEngine.prototype.end_update = obsolete(GridStackEngine.prototype.endUpdate, - 'end_update', 'endUpdate'); - GridStackEngine.prototype.can_be_placed_with_respect_to_height = - obsolete(GridStackEngine.prototype.canBePlacedWithRespectToHeight, - 'can_be_placed_with_respect_to_height', 'canBePlacedWithRespectToHeight'); - GridStack.prototype._trigger_change_event = obsolete(GridStack.prototype._triggerChangeEvent, - '_trigger_change_event', '_triggerChangeEvent'); - GridStack.prototype._init_styles = obsolete(GridStack.prototype._initStyles, - '_init_styles', '_initStyles'); - GridStack.prototype._update_styles = obsolete(GridStack.prototype._updateStyles, - '_update_styles', '_updateStyles'); - GridStack.prototype._update_container_height = obsolete(GridStack.prototype._updateContainerHeight, - '_update_container_height', '_updateContainerHeight'); - GridStack.prototype._is_one_column_mode = obsolete(GridStack.prototype._isOneColumnMode, - '_is_one_column_mode','_isOneColumnMode'); - GridStack.prototype._prepare_element = obsolete(GridStack.prototype._prepareElement, - '_prepare_element', '_prepareElement'); - GridStack.prototype.set_animation = obsolete(GridStack.prototype.setAnimation, - 'set_animation', 'setAnimation'); - GridStack.prototype.add_widget = obsolete(GridStack.prototype.addWidget, - 'add_widget', 'addWidget'); - GridStack.prototype.make_widget = obsolete(GridStack.prototype.makeWidget, - 'make_widget', 'makeWidget'); - GridStack.prototype.will_it_fit = obsolete(GridStack.prototype.willItFit, - 'will_it_fit', 'willItFit'); - GridStack.prototype.remove_widget = obsolete(GridStack.prototype.removeWidget, - 'remove_widget', 'removeWidget'); - GridStack.prototype.remove_all = obsolete(GridStack.prototype.removeAll, - 'remove_all', 'removeAll'); - GridStack.prototype.min_height = obsolete(GridStack.prototype.minHeight, - 'min_height', 'minHeight'); - GridStack.prototype.min_width = obsolete(GridStack.prototype.minWidth, - 'min_width', 'minWidth'); - GridStack.prototype._update_element = obsolete(GridStack.prototype._updateElement, - '_update_element', '_updateElement'); - GridStack.prototype.cell_height = obsolete(GridStack.prototype.cellHeight, - 'cell_height', 'cellHeight'); - GridStack.prototype.cell_width = obsolete(GridStack.prototype.cellWidth, - 'cell_width', 'cellWidth'); - GridStack.prototype.get_cell_from_pixel = obsolete(GridStack.prototype.getCellFromPixel, - 'get_cell_from_pixel', 'getCellFromPixel'); - GridStack.prototype.batch_update = obsolete(GridStack.prototype.batchUpdate, - 'batch_update', 'batchUpdate'); - GridStack.prototype.is_area_empty = obsolete(GridStack.prototype.isAreaEmpty, - 'is_area_empty', 'isAreaEmpty'); - GridStack.prototype.set_static = obsolete(GridStack.prototype.setStatic, - 'set_static', 'setStatic'); - GridStack.prototype._set_static_class = obsolete(GridStack.prototype._setStaticClass, - '_set_static_class', '_setStaticClass'); - // jscs:enable requireCamelCaseOrUpperCaseIdentifiers - - scope.GridStackUI = GridStack; - - scope.GridStackUI.Utils = Utils; - scope.GridStackUI.Engine = GridStackEngine; - scope.GridStackUI.GridStackDragDropPlugin = GridStackDragDropPlugin; - - $.fn.gridstack = function(opts) { - return this.each(function() { - var o = $(this); - if (!o.data('gridstack')) { - o - .data('gridstack', new GridStack(this, opts)); - } - }); - }; - - return scope.GridStackUI; -}); From e53ef030af4be1bff2695a77628e7f7909ad0507 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 26 Mar 2019 08:44:21 -0700 Subject: [PATCH 08/10] Delete gridstack.min.js --- dist/gridstack.min.js | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 dist/gridstack.min.js diff --git a/dist/gridstack.min.js b/dist/gridstack.min.js deleted file mode 100644 index f4bbff4ad..000000000 --- a/dist/gridstack.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(t){if("function"==typeof define&&define.amd)define(["jquery","exports"],t);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(t){}t(jQuery,exports)}else t(jQuery,window)}(function(u,t){var e=function(t,e,i){var o=function(){return console.warn("gridstack.js: Function `"+e+"` is deprecated as of v0.2.5 and has been replaced with `"+i+"`. It will be **completely** removed in v1.0."),t.apply(this,arguments)};return o.prototype=t.prototype,o},d=function(t,e){console.warn("gridstack.js: Option `"+t+"` is deprecated as of v0.2.5 and has been replaced with `"+e+"`. It will be **completely** removed in v1.0.")},_={isIntercepted:function(t,e){return!(t.x+t.width<=e.x||e.x+e.width<=t.x||t.y+t.height<=e.y||e.y+e.height<=t.y)},sort:function(t,e,i){if(!i){var o=t.map(function(t){return t.x+t.width});i=Math.max.apply(Math,o)}return e=-1!=e?1:-1,_.sortBy(t,function(t){return e*(t.x+t.y*i)})},createStylesheet:function(t){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.setAttribute("data-gs-style-id",t),e.styleSheet?e.styleSheet.cssText="":e.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(e),e.sheet},removeStylesheet:function(t){u("STYLE[data-gs-style-id="+t+"]").remove()},insertCSSRule:function(t,e,i,o){"function"==typeof t.insertRule?t.insertRule(e+"{"+i+"}",o):"function"==typeof t.addRule&&t.addRule(e,i,o)},toBool:function(t){return"boolean"==typeof t?t:"string"==typeof t?!(""===(t=t.toLowerCase())||"no"==t||"false"==t||"0"==t):Boolean(t)},_collisionNodeCheck:function(t){return t!=this.node&&_.isIntercepted(t,this.nn)},_didCollide:function(t){return _.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},t)},_isAddNodeIntercepted:function(t){return _.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.height},t)},parseHeight:function(t){var e=t,i="px";if(e&&"string"==typeof e){var o=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!o)throw new Error("Invalid height");i=o[2]||"px",e=parseFloat(o[1])}return{height:e,unit:i}},without:function(t,e){var i=t.indexOf(e);return-1!==i&&(t=t.slice(0)).splice(i,1),t},sortBy:function(t,a){return t.slice(0).sort(function(t,e){var i=a(t),o=a(e);return o===i?0:ot.clientHeight?t:_.getScrollParent(t.parentNode)},updateScrollPosition:function(t,e,i){var o=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>a){var r=o.bottom-a,s=o.top,n=_.getScrollParent(t);if(null!=n){var d=n.scrollTop;o.top<0&&i<0?t.offsetHeight>a?n.scrollTop+=i:n.scrollTop+=Math.abs(s)>Math.abs(i)?i:s:0a?n.scrollTop+=i:n.scrollTop+=i=t._origY;){this.nodes.slice(0,e).find(_._didCollide,{n:t,newY:i})||(t._dirty=!0,t.y=i),--i}},this):this.nodes.forEach(function(t,e){if(!t.locked)for(;0this.width?t.width=this.width:t.width<1&&(t.width=1),t.height<1&&(t.height=1),t.x<0&&(t.x=0),t.x+t.width>this.width&&(e?t.width=this.width-t.x:t.x=this.width-t.width),t.y<0&&(t.y=0),t},c.prototype._notify=function(){var t=Array.prototype.slice.call(arguments,0);if(t[0]=void 0===t[0]?[]:[t[0]],t[1]=void 0===t[1]||t[1],!this._updateCounter){var e=t[0].concat(this.getDirtyNodes());this.onchange(e,t[1])}},c.prototype.cleanNodes=function(){this._updateCounter||this.nodes.forEach(function(t){t._dirty=!1})},c.prototype.getDirtyNodes=function(){return this.nodes.filter(function(t){return t._dirty})},c.prototype.addNode=function(t,e){if(void 0!==(t=this._prepareNode(t)).maxWidth&&(t.width=Math.min(t.width,t.maxWidth)),void 0!==t.maxHeight&&(t.height=Math.min(t.height,t.maxHeight)),void 0!==t.minWidth&&(t.width=Math.max(t.width,t.minWidth)),void 0!==t.minHeight&&(t.height=Math.max(t.height,t.minHeight)),t._id=++r,t._dirty=!0,t.autoPosition){this._sortNodes();for(var i=0;;++i){var o=i%this.width,a=Math.floor(i/this.width);if(!(o+t.width>this.width)&&!this.nodes.find(_._isAddNodeIntercepted,{x:o,y:a,node:t})){t.x=o,t.y=a;break}}}return this.nodes.push(t),void 0!==e&&e&&this._addedNodes.push(_.clone(t)),this._fixCollisions(t),this._packNodes(),this._notify(),t},c.prototype.removeNode=function(t,e){e=void 0===e||e,this._removedNodes.push(_.clone(t)),t._id=null,this.nodes=_.without(this.nodes,t),this._packNodes(),this._notify(t,e)},c.prototype.canMoveNode=function(e,t,i,o,a){if(!this.isNodeChangedPosition(e,t,i,o,a))return!1;var r,s=Boolean(this.nodes.find(function(t){return t.locked}));if(!this.height&&!s)return!0;var n=new c(this.width,null,this.float,0,this.nodes.map(function(t){return t==e?r=u.extend({},t):u.extend({},t)}));if(void 0===r)return!0;n.moveNode(r,t,i,o,a);var d=!0;return s&&(d&=!Boolean(n.nodes.find(function(t){return t!=r&&Boolean(t.locked)&&Boolean(t._dirty)}))),this.height&&(d&=n.getGridHeight()<=this.height),d},c.prototype.canBePlacedWithRespectToHeight=function(t){if(!this.height)return!0;var e=new c(this.width,null,this.float,0,this.nodes.map(function(t){return u.extend({},t)}));return e.addNode(t),e.getGridHeight()<=this.height},c.prototype.isNodeChangedPosition=function(t,e,i,o,a){return"number"!=typeof e&&(e=t.x),"number"!=typeof i&&(i=t.y),"number"!=typeof o&&(o=t.width),"number"!=typeof a&&(a=t.height),void 0!==t.maxWidth&&(o=Math.min(o,t.maxWidth)),void 0!==t.maxHeight&&(a=Math.min(a,t.maxHeight)),void 0!==t.minWidth&&(o=Math.max(o,t.minWidth)),void 0!==t.minHeight&&(a=Math.max(a,t.minHeight)),t.x!=e||t.y!=i||t.width!=o||t.height!=a},c.prototype.moveNode=function(t,e,i,o,a,r){if(!this.isNodeChangedPosition(t,e,i,o,a))return t;if("number"!=typeof e&&(e=t.x),"number"!=typeof i&&(i=t.y),"number"!=typeof o&&(o=t.width),"number"!=typeof a&&(a=t.height),void 0!==t.maxWidth&&(o=Math.min(o,t.maxWidth)),void 0!==t.maxHeight&&(a=Math.min(a,t.maxHeight)),void 0!==t.minWidth&&(o=Math.max(o,t.minWidth)),void 0!==t.minHeight&&(a=Math.max(a,t.minHeight)),t.x==e&&t.y==i&&t.width==o&&t.height==a)return t;var s=t.width!=o;return t._dirty=!0,t.x=e,t.y=i,t.width=o,t.height=a,t.lastTriedX=e,t.lastTriedY=i,t.lastTriedWidth=o,t.lastTriedHeight=a,t=this._prepareNode(t,s),this._fixCollisions(t),r||(this._packNodes(),this._notify()),t},c.prototype.getGridHeight=function(){return this.nodes.reduce(function(t,e){return Math.max(t,e.y+e.height)},0)},c.prototype.beginUpdate=function(t){this.nodes.forEach(function(t){t._origY=t.y}),t._updating=!0},c.prototype.endUpdate=function(){this.nodes.forEach(function(t){t._origY=t.y});var t=this.nodes.find(function(t){return t._updating});t&&(t._updating=!1)};var i=function(t,e){var i,o,h=this;e=e||{},this.container=u(t),void 0!==e.handle_class&&(e.handleClass=e.handle_class,d("handle_class","handleClass")),void 0!==e.item_class&&(e.itemClass=e.item_class,d("item_class","itemClass")),void 0!==e.placeholder_class&&(e.placeholderClass=e.placeholder_class,d("placeholder_class","placeholderClass")),void 0!==e.placeholder_text&&(e.placeholderText=e.placeholder_text,d("placeholder_text","placeholderText")),void 0!==e.cell_height&&(e.cellHeight=e.cell_height,d("cell_height","cellHeight")),void 0!==e.vertical_margin&&(e.verticalMargin=e.vertical_margin,d("vertical_margin","verticalMargin")),void 0!==e.min_width&&(e.minWidth=e.min_width,d("min_width","minWidth")),void 0!==e.static_grid&&(e.staticGrid=e.static_grid,d("static_grid","staticGrid")),void 0!==e.is_nested&&(e.isNested=e.is_nested,d("is_nested","isNested")),void 0!==e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,d("always_show_resize_handle","alwaysShowResizeHandle")),e.itemClass=e.itemClass||"grid-stack-item";var a=0
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=_.throttle(function(){h.cellHeight(h.cellWidth(),!1)},100),this.onResizeHandler=function(){if(o&&h._updateHeightsOnResize(),h._isOneColumnMode()&&!h.opts.disableOneColumnMode){if(i)return;h.container.addClass(h.opts.oneColumnModeClass),i=!0,h.grid._sortNodes(),h.grid.nodes.forEach(function(t){h.container.append(t.el),h.opts.staticGrid||(h.dd.draggable(t.el,"disable"),h.dd.resizable(t.el,"disable"),t.el.trigger("resize"))})}else{if(!i)return;if(h.container.removeClass(h.opts.oneColumnModeClass),i=!1,h.opts.staticGrid)return;h.grid.nodes.forEach(function(t){t.noMove||h.opts.disableDrag||h.dd.draggable(t.el,"enable"),t.noResize||h.opts.disableResize||h.dd.resizable(t.el,"enable"),t.el.trigger("resize")})}},u(window).resize(this.onResizeHandler),this.onResizeHandler(),!h.opts.staticGrid&&"string"==typeof h.opts.removable){var n=u(h.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,h.opts.removableOptions),this.dd.on(n,"dropover",function(t,e){var i=u(e.draggable);i.data("_gridstack_node")._grid===h&&(i.data("inTrashZone",!0),h._setupRemovingTimeout(i))}).on(n,"dropout",function(t,e){var i=u(e.draggable);i.data("_gridstack_node")._grid===h&&(i.data("inTrashZone",!1),h._clearRemovingTimeout(i))})}if(!h.opts.staticGrid&&h.opts.acceptWidgets){var l=null,p=function(t,e){var i=l,o=i.data("_gridstack_node"),a=h.getCellFromPixel({left:t.pageX,top:t.pageY},!0),r=Math.max(0,a.x),s=Math.max(0,a.y);o._added||(o._added=!0,o.el=i,o.autoPosition=!0,o.x=r,o.y=s,h.grid.cleanNodes(),h.grid.beginUpdate(o),h.grid.addNode(o),h.container.append(h.placeholder),h.placeholder.attr("data-gs-x",o.x).attr("data-gs-y",o.y).attr("data-gs-width",o.width).attr("data-gs-height",o.height).show(),o.el=h.placeholder,o._beforeDragX=o.x,o._beforeDragY=o.y,h._updateContainerHeight()),h.grid.canMoveNode(o,r,s)&&(h.grid.moveNode(o,r,s),h._updateContainerHeight())};this.dd.droppable(h.container,{accept:function(t){var e=(t=u(t)).data("_gridstack_node");return(!e||e._grid!==h)&&t.is(!0===h.opts.acceptWidgets?".grid-stack-item":h.opts.acceptWidgets)}}).on(h.container,"dropover",function(t,e){h.container.offset();var i=u(e.draggable),o=h.cellWidth(),a=h.cellHeight(),r=i.data("_gridstack_node"),s=r?r.width:Math.ceil(i.outerWidth()/o),n=r?r.height:Math.ceil(i.outerHeight()/a);l=i;var d=h.grid._prepareNode({width:s,height:n,_added:!1,_temporary:!0});i.data("_gridstack_node",d),i.data("_gridstack_node_orig",r),i.on("drag",p)}).on(h.container,"dropout",function(t,e){var i=u(e.draggable);if(i.data("_gridstack_node")){i.unbind("drag",p);var o=i.data("_gridstack_node");o.el=null,h.grid.removeNode(o),h.placeholder.detach(),h._updateContainerHeight(),i.data("_gridstack_node",i.data("_gridstack_node_orig"))}}).on(h.container,"drop",function(t,e){h.placeholder.detach();var i=u(e.draggable).data("_gridstack_node");i._grid=h;var o=u(e.draggable).clone(!1);o.data("_gridstack_node",i);var a=u(e.draggable).data("_gridstack_node_orig");void 0!==a&&void 0!==a._grid&&a._grid._triggerRemoveEvent(),u(e.helper).remove(),i.el=o,h.placeholder.hide(),_.removePositioningStyles(o),o.find("div.ui-resizable-handle").remove(),o.attr("data-gs-x",i.x).attr("data-gs-y",i.y).attr("data-gs-width",i.width).attr("data-gs-height",i.height).addClass(h.opts.itemClass).enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),h.container.append(o),h._prepareElementsByNode(o,i),h._updateContainerHeight(),h.grid._addedNodes.push(i),h._triggerAddEvent(),h._triggerChangeEvent(),h.grid.endUpdate(),u(e.draggable).unbind("drag",p),u(e.draggable).removeData("_gridstack_node"),u(e.draggable).removeData("_gridstack_node_orig"),h.container.trigger("dropped",[a,i])})}};return i.prototype._triggerChangeEvent=function(t){var e=this.grid.getDirtyNodes(),i=!1,o=[];e&&e.length&&(o.push(e),i=!0),(i||!0===t)&&this.container.trigger("change",o)},i.prototype._triggerAddEvent=function(){this.grid._addedNodes&&0this._styles._max)){for(var a=this._styles._max;a=c.grid.width||r<0||!c.grid.float&&r>c.grid.getGridHeight()){if(l._temporaryRemoved)return;!0===c.opts.removable&&c._setupRemovingTimeout(h),a=l._beforeDragX,r=l._beforeDragY,c.placeholder.detach(),c.placeholder.hide(),c.grid.removeNode(l),c._updateContainerHeight(),l._temporaryRemoved=!0}else c._clearRemovingTimeout(h),l._temporaryRemoved&&(c.grid.addNode(l),c.placeholder.attr("data-gs-x",a).attr("data-gs-y",r).attr("data-gs-width",i).attr("data-gs-height",o).show(),c.container.append(c.placeholder),l.el=c.placeholder,l._temporaryRemoved=!1)}else if("resize"==t.type&&a<0)return;var n=void 0!==i?i:l.lastTriedWidth,d=void 0!==o?o:l.lastTriedHeight;!c.grid.canMoveNode(l,a,r,i,o)||l.lastTriedX===a&&l.lastTriedY===r&&l.lastTriedWidth===n&&l.lastTriedHeight===d||(l.lastTriedX=a,l.lastTriedY=r,l.lastTriedWidth=i,l.lastTriedHeight=o,c.grid.moveNode(l,a,r,i,o),c._updateContainerHeight(),"resize"==t.type&&u(t.target).trigger("gsresize",l))},e=function(t,e){c.container.append(c.placeholder);var i=u(this);c.grid.cleanNodes(),c.grid.beginUpdate(l),p=c.cellWidth();var o=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));g=c.container.height()/parseInt(c.container.attr("data-gs-current-height")),c.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),l.el=c.placeholder,l._beforeDragX=l.x,l._beforeDragY=l.y,l._prevYPix=e.position.top,c.dd.resizable(h,"option","minWidth",p*(l.minWidth||1)),c.dd.resizable(h,"option","minHeight",o*(l.minHeight||1)),"resizestart"==t.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(t,e){var i=u(this);if(i.data("_gridstack_node")){var o=!1;if(c.placeholder.detach(),l.el=i,c.placeholder.hide(),l._isAboutToRemove)o=!0,h.data("_gridstack_node")._grid._triggerRemoveEvent(),h.removeData("_gridstack_node"),h.remove();else c._clearRemovingTimeout(h),l._temporaryRemoved?(_.removePositioningStyles(i),i.attr("data-gs-x",l._beforeDragX).attr("data-gs-y",l._beforeDragY).attr("data-gs-width",l.width).attr("data-gs-height",l.height),l.x=l._beforeDragX,l.y=l._beforeDragY,l._temporaryRemoved=!1,c.grid.addNode(l)):(_.removePositioningStyles(i),i.attr("data-gs-x",l.x).attr("data-gs-y",l.y).attr("data-gs-width",l.width).attr("data-gs-height",l.height));c._updateContainerHeight(),c._triggerChangeEvent(o),c.grid.endUpdate();var a=i.find(".grid-stack");a.length&&"resizestop"==t.type&&(a.each(function(t,e){u(e).data("gridstack").onResizeHandler()}),i.find(".grid-stack-item").trigger("resizestop"),i.find(".grid-stack-item").trigger("gsresizestop")),"resizestop"==t.type&&c.container.trigger("gsresizestop",i)}};this.dd.draggable(h,{start:e,stop:i,drag:t}).resizable(h,{start:e,stop:i,resize:t}),(l.noMove||this._isOneColumnMode()&&!c.opts.disableOneColumnMode||this.opts.disableDrag||this.opts.staticGrid)&&this.dd.draggable(h,"disable"),(l.noResize||this._isOneColumnMode()&&!c.opts.disableOneColumnMode||this.opts.disableResize||this.opts.staticGrid)&&this.dd.resizable(h,"disable"),h.attr("data-gs-locked",l.locked?"yes":null)},i.prototype._prepareElement=function(t,e){e=void 0!==e&&e;(t=u(t)).addClass(this.opts.itemClass);var i=this.grid.addNode({x:parseInt(t.attr("data-gs-x"),10),y:parseInt(t.attr("data-gs-y"),10),width:t.attr("data-gs-width"),height:t.attr("data-gs-height"),maxWidth:t.attr("data-gs-max-width"),minWidth:t.attr("data-gs-min-width"),maxHeight:t.attr("data-gs-max-height"),minHeight:t.attr("data-gs-min-height"),autoPosition:_.toBool(t.attr("data-gs-auto-position")),noResize:_.toBool(t.attr("data-gs-no-resize")),noMove:_.toBool(t.attr("data-gs-no-move")),locked:_.toBool(t.attr("data-gs-locked")),resizeHandles:t.attr("data-gs-resize-handles"),el:t,id:t.attr("data-gs-id"),_grid:this},e);t.data("_gridstack_node",i),this._prepareElementsByNode(t,i)},i.prototype.setAnimation=function(t){t?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},i.prototype.addWidget=function(t,e,i,o,a,r,s,n,d,h,l){return t=u(t),void 0!==e&&t.attr("data-gs-x",e),void 0!==i&&t.attr("data-gs-y",i),void 0!==o&&t.attr("data-gs-width",o),void 0!==a&&t.attr("data-gs-height",a),void 0!==r&&t.attr("data-gs-auto-position",r?"yes":null),void 0!==s&&t.attr("data-gs-min-width",s),void 0!==n&&t.attr("data-gs-max-width",n),void 0!==d&&t.attr("data-gs-min-height",d),void 0!==h&&t.attr("data-gs-max-height",h),void 0!==l&&t.attr("data-gs-id",l),this.container.append(t),this._prepareElement(t,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),t},i.prototype.makeWidget=function(t){return t=u(t),this._prepareElement(t,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),t},i.prototype.willItFit=function(t,e,i,o,a){var r={x:t,y:e,width:i,height:o,autoPosition:a};return this.grid.canBePlacedWithRespectToHeight(r)},i.prototype.removeWidget=function(t,e){e=void 0===e||e;var i=(t=u(t)).data("_gridstack_node");i||(i=this.grid.getNodeDataByDOMEl(t)),this.grid.removeNode(i,e),t.removeData("_gridstack_node"),this._updateContainerHeight(),e&&t.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},i.prototype.removeAll=function(e){this.grid.nodes.forEach(function(t){this.removeWidget(t.el,e)},this),this.grid.nodes=[],this._updateContainerHeight()},i.prototype.destroy=function(t){u(window).off("resize",this.onResizeHandler),this.disable(),void 0===t||t?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),_.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},i.prototype.resizable=function(t,o){var a=this;return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(i.noResize=!o,i.noResize||a._isOneColumnMode()&&!a.opts.disableOneColumnMode?a.dd.resizable(e,"disable"):a.dd.resizable(e,"enable"))}),this},i.prototype.movable=function(t,o){var a=this;return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(i.noMove=!o,i.noMove||a._isOneColumnMode()&&!a.opts.disableOneColumnMode?(a.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(a.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},i.prototype.enableMove=function(t,e){this.movable(this.container.children("."+this.opts.itemClass),t),e&&(this.opts.disableDrag=!t)},i.prototype.enableResize=function(t,e){this.resizable(this.container.children("."+this.opts.itemClass),t),e&&(this.opts.disableResize=!t)},i.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},i.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},i.prototype.locked=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(i.locked=o||!1,e.attr("data-gs-locked",i.locked?"yes":null))}),this},i.prototype.maxHeight=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.maxHeight=o||!1,e.attr("data-gs-max-height",o)))}),this},i.prototype.minHeight=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.minHeight=o||!1,e.attr("data-gs-min-height",o)))}),this},i.prototype.maxWidth=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.maxWidth=o||!1,e.attr("data-gs-max-width",o)))}),this},i.prototype.minWidth=function(t,o){return(t=u(t)).each(function(t,e){var i=(e=u(e)).data("_gridstack_node");null!=i&&(isNaN(o)||(i.minWidth=o||!1,e.attr("data-gs-min-width",o)))}),this},i.prototype._updateElement=function(t,e){var i=(t=u(t).first()).data("_gridstack_node");if(null!=i){var o=this;o.grid.cleanNodes(),o.grid.beginUpdate(i),e.call(this,t,i),o._updateContainerHeight(),o._triggerChangeEvent(),o.grid.endUpdate()}},i.prototype.resize=function(t,i,o){this._updateElement(t,function(t,e){i=null!=i?i:e.width,o=null!=o?o:e.height,this.grid.moveNode(e,e.x,e.y,i,o)})},i.prototype.move=function(t,i,o){this._updateElement(t,function(t,e){i=null!=i?i:e.x,o=null!=o?o:e.y,this.grid.moveNode(e,i,o,e.width,e.height)})},i.prototype.update=function(t,i,o,a,r){this._updateElement(t,function(t,e){i=null!=i?i:e.x,o=null!=o?o:e.y,a=null!=a?a:e.width,r=null!=r?r:e.height,this.grid.moveNode(e,i,o,a,r)})},i.prototype.verticalMargin=function(t,e){if(void 0===t)return this.opts.verticalMargin;var i=_.parseHeight(t);this.opts.verticalMarginUnit===i.unit&&this.opts.height===i.height||(this.opts.verticalMarginUnit=i.unit,this.opts.verticalMargin=i.height,e||this._updateStyles())},i.prototype.cellHeight=function(t,e){if(void 0===t){if(this.opts.cellHeight)return this.opts.cellHeight;var i=this.container.children("."+this.opts.itemClass).first();return Math.ceil(i.outerHeight()/i.attr("data-gs-height"))}var o=_.parseHeight(t);this.opts.cellHeightUnit===o.unit&&this.opts.cellHeight===o.height||(this.opts.cellHeightUnit=o.unit,this.opts.cellHeight=o.height,e||this._updateStyles())},i.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},i.prototype.getCellFromPixel=function(t,e){var i=void 0!==e&&e?this.container.offset():this.container.position(),o=t.left-i.left,a=t.top-i.top,r=Math.floor(this.container.width()/this.opts.width),s=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(o/r),y:Math.floor(a/s)}},i.prototype.batchUpdate=function(){this.grid.batchUpdate()},i.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},i.prototype.isAreaEmpty=function(t,e,i,o){return this.grid.isAreaEmpty(t,e,i,o)},i.prototype.setStatic=function(t){this.opts.staticGrid=!0===t,this.enableMove(!t),this.enableResize(!t),this._setStaticClass()},i.prototype._setStaticClass=function(){var t="grid-stack-static";!0===this.opts.staticGrid?this.container.addClass(t):this.container.removeClass(t)},i.prototype._updateNodeWidths=function(t,e){this.grid._sortNodes(),this.grid.batchUpdate();for(var i={},o=0;o Date: Tue, 26 Mar 2019 08:44:45 -0700 Subject: [PATCH 09/10] Delete gridstack.min.map --- dist/gridstack.min.map | 1 - 1 file changed, 1 deletion(-) delete mode 100644 dist/gridstack.min.map diff --git a/dist/gridstack.min.map b/dist/gridstack.min.map deleted file mode 100644 index dec7dd1e3..000000000 --- a/dist/gridstack.min.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../src/gridstack.js","../src/gridstack.jQueryUI.js"],"names":["factory","define","amd","exports","jQuery","require","e","window","$","scope","obsolete","f","oldName","newName","wrapper","console","warn","apply","this","arguments","prototype","obsoleteOpts","Utils","isIntercepted","a","b","x","width","y","height","sort","nodes","dir","widths","map","node","Math","max","sortBy","n","createStylesheet","id","style","document","createElement","setAttribute","styleSheet","cssText","appendChild","createTextNode","getElementsByTagName","sheet","removeStylesheet","remove","insertCSSRule","selector","rules","index","insertRule","addRule","toBool","v","toLowerCase","Boolean","_collisionNodeCheck","nn","_didCollide","bn","newY","_isAddNodeIntercepted","parseHeight","val","heightUnit","match","Error","parseFloat","unit","without","array","item","indexOf","slice","splice","getter","left","right","valueLeft","valueRight","defaults","target","Array","call","forEach","source","prop","hasOwnProperty","clone","extend","throttle","callback","delay","isWaiting","setTimeout","removePositioningStyles","el","position","removeProperty","top","getScrollParent","scrollHeight","clientHeight","parentNode","updateScrollPosition","ui","distance","rect","getBoundingClientRect","innerHeightOrClientHeight","innerHeight","documentElement","bottom","offsetDiffDown","offsetDiffUp","scrollEl","prevScroll","scrollTop","offsetHeight","abs","GridStackDragDropPlugin","grid","is_intercepted","create_stylesheet","remove_stylesheet","insert_css_rule","registeredPlugins","registerPlugin","pluginClass","push","resizable","opts","draggable","droppable","isDroppable","on","eventName","idSeq","GridStackEngine","onchange","floatMode","items","float","_updateCounter","_float","_addedNodes","_removedNodes","batchUpdate","commit","_packNodes","_notify","getNodeDataByDOMEl","find","get","_fixCollisions","_sortNodes","hasLocked","locked","collisionNode","moveNode","isAreaEmpty","i","_updating","_origY","_dirty","canBeMoved","_prepareNode","resizing","parseInt","autoPosition","noResize","noMove","args","deletedNodes","concat","getDirtyNodes","cleanNodes","filter","addNode","triggerAddEvent","maxWidth","min","maxHeight","minWidth","minHeight","_id","floor","removeNode","detachNode","canMoveNode","isNodeChangedPosition","clonedNode","res","getGridHeight","canBePlacedWithRespectToHeight","noPack","lastTriedX","lastTriedY","lastTriedWidth","lastTriedHeight","reduce","memo","beginUpdate","endUpdate","GridStack","oneColumnMode","isAutoCellHeight","self","container","handle_class","handleClass","item_class","itemClass","placeholder_class","placeholderClass","placeholder_text","placeholderText","cell_height","cellHeight","vertical_margin","verticalMargin","min_width","static_grid","staticGrid","is_nested","isNested","always_show_resize_handle","alwaysShowResizeHandle","closest","length","attr","handle","auto","_class","random","toFixed","animate","autoHide","handles","scroll","appendTo","disableDrag","disableResize","rtl","removable","removableOptions","accept","removeTimeout","verticalMarginUnit","cellHeightUnit","disableOneColumnMode","oneColumnModeClass","ddPlugin","dd","css","addClass","cellWidth","_setStaticClass","_initStyles","_updateStyles","elements","_this","children","each","_prepareElement","setAnimation","placeholder","hide","_updateContainerHeight","_updateHeightsOnResize","onResizeHandler","_isOneColumnMode","append","trigger","removeClass","resize","trashZone","event","data","_grid","_setupRemovingTimeout","_clearRemovingTimeout","acceptWidgets","draggingElement","onDrag","pos","getCellFromPixel","pageX","pageY","_added","show","_beforeDragX","_beforeDragY","is","offset","origNode","ceil","outerWidth","outerHeight","_temporary","unbind","detach","originalNode","_triggerRemoveEvent","helper","enableSelection","removeData","_prepareElementsByNode","_triggerAddEvent","_triggerChangeEvent","forceTrigger","hasChanges","eventParams","_stylesId","_styles","_max","getHeight","prefix","nbRows","nbMargins","cssMinHeight","innerWidth","clientWidth","body","_removeTimeout","_isAboutToRemove","clearTimeout","dragOrResize","round","type","size","_prevYPix","_temporaryRemoved","onStartMoving","o","strictCellHeight","onEndMoving","forceNotify","nestedGrids","start","stop","drag","resizeHandles","enable","addWidget","makeWidget","willItFit","removeWidget","removeAll","destroy","detachGrid","off","disable","movable","enableMove","doEnable","includeNewWidgets","enableResize","isNaN","_updateElement","first","move","update","noUpdate","heightData","useOffset","containerPos","relativeLeft","relativeTop","columnWidth","rowHeight","setStatic","staticValue","staticClassName","_updateNodeWidths","oldWidth","newWidth","undefined","setGridWidth","gridWidth","doNotPropagate","batch_update","_fix_collisions","is_area_empty","_sort_nodes","_pack_nodes","_prepare_node","clean_nodes","get_dirty_nodes","add_node","remove_node","can_move_node","move_node","get_grid_height","begin_update","end_update","can_be_placed_with_respect_to_height","_trigger_change_event","_init_styles","_update_styles","_update_container_height","_is_one_column_mode","_prepare_element","set_animation","add_widget","make_widget","will_it_fit","remove_widget","remove_all","min_height","_update_element","cell_width","get_cell_from_pixel","set_static","_set_static_class","GridStackUI","Engine","fn","gridstack","JQueryUIGridStackDragDropPlugin","Object","create","constructor","key","value","containment","parent"],"mappings":"CAOA,SAAUA,GACN,GAAsB,mBAAXC,QAAyBA,OAAOC,IACvCD,OAAO,CAAC,SAAU,WAAYD,QAC3B,GAAuB,oBAAZG,QAAyB,CACvC,IAAMC,OAASC,QAAQ,UAAa,MAAOC,IAC3CN,EA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,EAAKiN,MAAQ,aACnBjE,OAAQhJ,EAAKgJ,QAAU,gBAG/B,OAAOzQ,MAGXyZ,EAAgCvZ,UAAUwH,UAAY,SAASpC,EAAImC,GAY/D,OAXAnC,EAAKhG,EAAEgG,GACM,YAATmC,GAA+B,WAATA,EACtBnC,EAAGoC,UAAUD,GAEbnC,EAAGoC,UAAUpI,EAAEyF,OAAO,GAAI/E,KAAK+G,KAAKU,KAAKC,UAAW,CAChDqS,YAAa/Z,KAAK+G,KAAKU,KAAK8F,SAAWvN,KAAK+G,KAAKuF,UAAU0N,SAAW,KACtEvF,MAAOhN,EAAKgN,OAAS,aACrBC,KAAMjN,EAAKiN,MAAQ,aACnBC,KAAMlN,EAAKkN,MAAQ,gBAGpB3U,MAGXyZ,EAAgCvZ,UAAUyH,UAAY,SAASrC,EAAImC,GAG/D,OAFAnC,EAAKhG,EAAEgG,IACJqC,UAAUF,GACNzH,MAGXyZ,EAAgCvZ,UAAU0H,YAAc,SAAStC,EAAImC,GAEjE,OADAnC,EAAKhG,EAAEgG,GACAzC,QAAQyC,EAAGsL,KAAK,eAG3B6I,EAAgCvZ,UAAU2H,GAAK,SAASvC,EAAIwC,EAAW7C,GAEnE,OADA3F,EAAEgG,GAAIuC,GAAGC,EAAW7C,GACbjF,MAGXT,EAAMka,gCAAkCA","file":"gridstack.all.js"} \ No newline at end of file From 1036221b02bc935c5411711f1800dd39187dff56 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 26 Mar 2019 08:46:28 -0700 Subject: [PATCH 10/10] Update README.md --- doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index d0bd95755..bf660d504 100644 --- a/doc/README.md +++ b/doc/README.md @@ -96,7 +96,7 @@ gridstack.js API ## Grid attributes - `data-gs-animate` - turns animation on -- `data-gs-width` - amount of columns. Setting non-default value must be supported by equivalent change in CSS, [see docs here](https://github.com/troolee/gridstack.js#change-grid-width). +- `data-gs-width` - amount of columns. Setting non-default value must be supported by equivalent change in CSS, [see docs here](https://github.com/gridstack/gridstack.js#change-grid-width). - `data-gs-height` - maximum rows amount. Default is `0` which means no maximum rows. - `data-gs-current-height` - current rows amount. Set by the library only. Can be used by the CSS rules.