From 30b096d5f9666dbdc97bcd96643f52fdc8ee0d17 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Wed, 17 Aug 2016 23:29:59 -0700 Subject: [PATCH 01/15] dd plugin draft --- dist/gridstack.js | 86 ++++++++++++++++++++++++++++++++++-------- dist/gridstack.min.js | 26 ++++++++----- dist/gridstack.min.map | 2 +- src/gridstack.js | 86 ++++++++++++++++++++++++++++++++++-------- 4 files changed, 160 insertions(+), 40 deletions(-) diff --git a/dist/gridstack.js b/dist/gridstack.js index 3fce575..5f73e5a 100644 --- a/dist/gridstack.js +++ b/dist/gridstack.js @@ -124,6 +124,60 @@ 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.prototype.resizable = function(el, opts) { + return this; + }; + + GridStackDragDropPlugin.prototype.draggable = function(el, opts) { + return this; + }; + + /** + * @class JQueryUIGridStackDragDropPlugin + * jQuery UI implementation of drag'n'drop gridstack plugin. + */ + function JQueryUIGridStackDragDropPlugin(grid) { + GridStackDragDropPlugin.call(this, grid); + }; + + JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype); + JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; + + JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) { + if (opts === 'disable' || opts === 'enable') { + el.resizable(opts); + } else { + el.resizable(_.extend({}, this.grid.opts.resizable, { + start: opts.start || function() {}, + stop: opts.stop || function() {}, + resize: opts.resize || function() {} + })); + } + return this; + }; + + JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) { + 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; + }; + var idSeq = 0; var GridStackEngine = function(width, onchange, floatMode, height, items) { @@ -548,9 +602,12 @@ removeTimeout: 2000, verticalMarginUnit: 'px', cellHeightUnit: 'px', - oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode' + oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode', + ddPlugin: JQueryUIGridStackDragDropPlugin }); + this.dd = new opts.ddPlugin(this); + if (this.opts.rtl === 'auto') { this.opts.rtl = this.container.css('direction') === 'rtl'; } @@ -647,10 +704,10 @@ return; } if (node.noMove || self.opts.disableDrag) { - node.el.draggable('disable'); + self.dd.draggable(node.el, 'disable'); } if (node.noResize || self.opts.disableResize) { - node.el.resizable('disable'); + self.dd.resizable(node.el, 'disable'); } node.el.trigger('resize'); @@ -669,10 +726,10 @@ _.each(self.grid.nodes, function(node) { if (!node.noMove && !self.opts.disableDrag) { - node.el.draggable('enable'); + self.dd.draggable(node.el, 'enable'); } if (!node.noResize && !self.opts.disableResize) { - node.el.resizable('enable'); + self.dd.resizable(node.el, 'enable'); } node.el.trigger('resize'); @@ -1116,25 +1173,24 @@ } }; - el - .draggable(_.extend({}, this.opts.draggable, { - containment: this.opts.isNested ? this.container.parent() : null, + this.dd + .draggable(el, { start: onStartMoving, stop: onEndMoving, drag: dragOrResize - })) - .resizable(_.extend({}, this.opts.resizable, { + }) + .resizable(el, { start: onStartMoving, stop: onEndMoving, resize: dragOrResize - })); + }); if (node.noMove || this._isOneColumnMode() || this.opts.disableDrag) { - el.draggable('disable'); + this.dd.draggable(el, 'disable'); } if (node.noResize || this._isOneColumnMode() || this.opts.disableResize) { - el.resizable('disable'); + this.dd.resizable(el, 'disable'); } el.attr('data-gs-locked', node.locked ? 'yes' : null); @@ -1288,10 +1344,10 @@ node.noMove = !(val || false); if (node.noMove || self._isOneColumnMode()) { - el.draggable('disable'); + self.dd.draggable(el, 'disable'); el.removeClass('ui-draggable-handle'); } else { - el.draggable('enable'); + self.dd.draggable(el, 'enable'); el.addClass('ui-draggable-handle'); } }); diff --git a/dist/gridstack.min.js b/dist/gridstack.min.js index f75d215..7968ab0 100644 --- a/dist/gridstack.min.js +++ b/dist/gridstack.min.js @@ -5,20 +5,28 @@ * gridstack.js may be freely distributed under the MIT license. * @preserve */ -!function(a){if("function"==typeof define&&define.amd)define(["jquery","lodash","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"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(b){}try{_=require("lodash")}catch(b){}a(jQuery,_)}else a(jQuery,_)}(function(a,b){var c=window,d=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},e=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.")},f={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=c!=-1?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(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&f.isIntercepted(a,this.nn)},_didCollide:function(a){return f.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return f.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}}}; -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -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"); +!function(a){if("function"==typeof define&&define.amd)define(["jquery","lodash","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"],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){ // jscs:enable requireCamelCaseOrUpperCaseIdentifiers -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())}, +/** + * @class GridStackDragDropPlugin + * Base class for drag'n'drop plugin. + */ +function c(a){this.grid=a}/** + * @class JQueryUIGridStackDragDropPlugin + * jQuery UI implementation of drag'n'drop gridstack plugin. + */ +function d(a){c.call(this,a)}var e=window,f=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},g=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.")},h={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=c!=-1?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(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&h.isIntercepted(a,this.nn)},_didCollide:function(a){return h.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return h.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}}}; +// jscs:disable requireCamelCaseOrUpperCaseIdentifiers +h.is_intercepted=f(h.isIntercepted,"is_intercepted","isIntercepted"),h.create_stylesheet=f(h.createStylesheet,"create_stylesheet","createStylesheet"),h.remove_stylesheet=f(h.removeStylesheet,"remove_stylesheet","removeStylesheet"),h.insert_css_rule=f(h.insertCSSRule,"insert_css_rule","insertCSSRule"),c.prototype.resizable=function(a,b){return this},c.prototype.draggable=function(a,b){return this},d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.resizable=function(a,c){return"disable"===c||"enable"===c?a.resizable(c):a.resizable(b.extend({},this.grid.opts.resizable,{start:c.start||function(){},stop:c.stop||function(){},resize:c.resize||function(){}})),this},d.prototype.draggable=function(a,c){return"disable"===c||"enable"===c?a.draggable(c):a.draggable(b.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:c.start||function(){},stop:c.stop||function(){},drag:c.drag||function(){}})),this};var i=0,j=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=[]};j.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},j.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())}, // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -h.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},h.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(f._collisionNodeCheck,{node:a,nn:c}));if("undefined"==typeof e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},h.prototype.isAreaEmpty=function(a,c,d,e){var g={x:a||0,y:c||0,width:d||1,height:e||1},h=b.find(this.nodes,b.bind(function(a){return f.isIntercepted(a,g)},this));return null===h||"undefined"==typeof h},h.prototype._sortNodes=function(a){this.nodes=f.sort(this.nodes,a,this.width)},h.prototype._packNodes=function(){this._sortNodes(),this["float"]?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(f._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 g=b.chain(this.nodes).take(c).find(b.bind(f._didCollide,{n:a,newY:d})).value();e="undefined"==typeof g}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},h.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},h.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},h.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},h.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},h.prototype.addNode=function(a,c){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++g,a._dirty=!0,a.autoPosition){this._sortNodes();for(var d=0;;++d){var e=d%this.width,h=Math.floor(d/this.width);if(!(e+a.width>this.width||b.find(this.nodes,b.bind(f._isAddNodeIntercepted,{x:e,y:h,node:a})))){a.x=e,a.y=h;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},h.prototype.removeNode=function(a,c){c="undefined"==typeof c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},h.prototype.canMoveNode=function(c,d,e,f,g){var i=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!i)return!0;var j,k=new h(this.width,null,this["float"],0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if("undefined"==typeof j)return!0;k.moveNode(j,d,e,f,g);var l=!0;return i&&(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},h.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new h(this.width,null,this["float"],0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},h.prototype.moveNode=function(a,b,c,d,e,f){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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof 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=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},h.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},h.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},h.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 i=function(c,d){var f,g,i=this;d=d||{},this.container=a(c), +j.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},j.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(h._collisionNodeCheck,{node:a,nn:c}));if("undefined"==typeof e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},j.prototype.isAreaEmpty=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},g=b.find(this.nodes,b.bind(function(a){return h.isIntercepted(a,f)},this));return null===g||"undefined"==typeof g},j.prototype._sortNodes=function(a){this.nodes=h.sort(this.nodes,a,this.width)},j.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(h._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(h._didCollide,{n:a,newY:d})).value();e="undefined"==typeof f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},j.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},j.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},j.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},j.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},j.prototype.addNode=function(a,c){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++i,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(h._isAddNodeIntercepted,{x:e,y:f,node:a})))){a.x=e,a.y=f;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},j.prototype.removeNode=function(a,c){c="undefined"==typeof c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},j.prototype.canMoveNode=function(c,d,e,f,g){var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;var i,k=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?i=a.extend({},b):a.extend({},b)}));if("undefined"==typeof i)return!0;k.moveNode(i,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=i&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},j.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},j.prototype.moveNode=function(a,b,c,d,e,f){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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof 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=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},j.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},j.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},j.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 k=function(c,e){var f,h,i=this;e=e||{},this.container=a(c), // jscs:disable requireCamelCaseOrUpperCaseIdentifiers -"undefined"!=typeof d.handle_class&&(d.handleClass=d.handle_class,e("handle_class","handleClass")),"undefined"!=typeof d.item_class&&(d.itemClass=d.item_class,e("item_class","itemClass")),"undefined"!=typeof d.placeholder_class&&(d.placeholderClass=d.placeholder_class,e("placeholder_class","placeholderClass")),"undefined"!=typeof d.placeholder_text&&(d.placeholderText=d.placeholder_text,e("placeholder_text","placeholderText")),"undefined"!=typeof d.cell_height&&(d.cellHeight=d.cell_height,e("cell_height","cellHeight")),"undefined"!=typeof d.vertical_margin&&(d.verticalMargin=d.vertical_margin,e("vertical_margin","verticalMargin")),"undefined"!=typeof d.min_width&&(d.minWidth=d.min_width,e("min_width","minWidth")),"undefined"!=typeof d.static_grid&&(d.staticGrid=d.static_grid,e("static_grid","staticGrid")),"undefined"!=typeof d.is_nested&&(d.isNested=d.is_nested,e("is_nested","isNested")),"undefined"!=typeof d.always_show_resize_handle&&(d.alwaysShowResizeHandle=d.always_show_resize_handle,e("always_show_resize_handle","alwaysShowResizeHandle")), +"undefined"!=typeof e.handle_class&&(e.handleClass=e.handle_class,g("handle_class","handleClass")),"undefined"!=typeof e.item_class&&(e.itemClass=e.item_class,g("item_class","itemClass")),"undefined"!=typeof e.placeholder_class&&(e.placeholderClass=e.placeholder_class,g("placeholder_class","placeholderClass")),"undefined"!=typeof e.placeholder_text&&(e.placeholderText=e.placeholder_text,g("placeholder_text","placeholderText")),"undefined"!=typeof e.cell_height&&(e.cellHeight=e.cell_height,g("cell_height","cellHeight")),"undefined"!=typeof e.vertical_margin&&(e.verticalMargin=e.vertical_margin,g("vertical_margin","verticalMargin")),"undefined"!=typeof e.min_width&&(e.minWidth=e.min_width,g("min_width","minWidth")),"undefined"!=typeof e.static_grid&&(e.staticGrid=e.static_grid,g("static_grid","staticGrid")),"undefined"!=typeof e.is_nested&&(e.isNested=e.is_nested,g("is_nested","isNested")),"undefined"!=typeof e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,g("always_show_resize_handle","alwaysShowResizeHandle")), // jscs:enable requireCamelCaseOrUpperCaseIdentifiers -d.itemClass=d.itemClass||"grid-stack-item";var j=this.container.closest("."+d.itemClass).length>0;if(this.opts=b.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:b.defaults(d.resizable||{},{autoHide:!d.alwaysShowResizeHandle,handles:"se"}),draggable:b.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",oneColumnModeClass:d.oneColumnModeClass||"grid-stack-one-column-mode"}),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=j,g="auto"===this.opts.cellHeight,g?i.cellHeight(i.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),j&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new h(this.opts.width,function(a,c){c="undefined"==typeof 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))}),i._updateStyles(d+10)},this.opts["float"],this.opts.height),this.opts.auto){var k=[],l=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),k.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*l.opts.width})}),b.chain(k).sortBy(function(a){return a.i}).each(function(a){i._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(g&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;i.container.addClass(i.opts.oneColumnModeClass),f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&a.el.draggable("disable"),(a.noResize||i.opts.disableResize)&&a.el.resizable("disable"),a.el.trigger("resize"))})}else{if(!f)return;if(i.container.removeClass(i.opts.oneColumnModeClass),f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||a.el.draggable("enable"),a.noResize||i.opts.disableResize||a.el.resizable("enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.opts.removable){var m=a(i.opts.removable);m.data("droppable")||m.droppable({accept:"."+i.opts.itemClass}),m.on("dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on("dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var n=null,o=function(a,b){var c=n,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.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=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};a(i.container).droppable({accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==i)&&b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)},over:function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);n=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",o)},out:function(b,c){var d=a(c.draggable);d.unbind("drag",o);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))},drop:function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.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(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",o),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()}})}}; +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",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:d}),this.dd=new e.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?i.cellHeight(i.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 j(this.opts.width,function(a,c){c="undefined"==typeof 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))}),i._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){i._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;i.container.addClass(i.opts.oneColumnModeClass),f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&i.dd.draggable(a.el,"disable"),(a.noResize||i.opts.disableResize)&&i.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!f)return;if(i.container.removeClass(i.opts.oneColumnModeClass),f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||i.dd.draggable(a.el,"enable"),a.noResize||i.opts.disableResize||i.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.opts.removable){var n=a(i.opts.removable);n.data("droppable")||n.droppable({accept:"."+i.opts.itemClass}),n.on("dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on("dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.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=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};a(i.container).droppable({accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==i)&&b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)},over:function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)},out:function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))},drop:function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.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(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()}})}}; // jscs:disable requireCamelCaseOrUpperCaseIdentifiers // jscs:enable requireCamelCaseOrUpperCaseIdentifiers -return i.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},i.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=[])},i.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=[])},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&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof 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=g.grid.width||k<0?(g.opts.removable===!0&&g._setupRemovingTimeout(c),j=d._beforeDragX,k=d._beforeDragY,g.placeholder.detach(),g.placeholder.hide(),g.grid.removeNode(d),g._updateContainerHeight(),d._temporaryRemoved=!0):(g._clearRemovingTimeout(c),d._temporaryRemoved&&(g.grid.addNode(d),g.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),g.container.append(g.placeholder),d.el=g.placeholder,d._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return;g.grid.canMoveNode(d,j,k,h,i)&&(g.grid.moveNode(d,j,k,h,i),g._updateContainerHeight())},i=function(b,h){g.container.append(g.placeholder);var i=a(this);g.grid.cleanNodes(),g.grid.beginUpdate(d),e=g.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));f=g.container.height()/parseInt(g.container.attr("data-gs-current-height")),g.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(),d.el=g.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,c.resizable("option","minWidth",e*(d.minWidth||1)),c.resizable("option","minHeight",j*(d.minHeight||1)),"resizestart"==b.type&&i.find(".grid-stack-item").trigger("resizestart")},j=function(b,e){var f=a(this);if(f.data("_gridstack_node")){var h=!1;g.placeholder.detach(),d.el=f,g.placeholder.hide(),d._isAboutToRemove?(h=!0,c.removeData("_gridstack_node"),c.remove()):(g._clearRemovingTimeout(c),d._temporaryRemoved?(f.attr("data-gs-x",d._beforeDragX).attr("data-gs-y",d._beforeDragY).attr("data-gs-width",d.width).attr("data-gs-height",d.height).removeAttr("style"),d.x=d._beforeDragX,d.y=d._beforeDragY,g.grid.addNode(d)):f.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).removeAttr("style")),g._updateContainerHeight(),g._triggerChangeEvent(h),g.grid.endUpdate();var i=f.find(".grid-stack");i.length&&"resizestop"==b.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),f.find(".grid-stack-item").trigger("resizestop"))}};c.draggable(b.extend({},this.opts.draggable,{containment:this.opts.isNested?this.container.parent():null,start:i,stop:j,drag:h})).resizable(b.extend({},this.opts.resizable,{start:i,stop:j,resize:h})),(d.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&c.draggable("disable"),(d.noResize||this._isOneColumnMode()||this.opts.disableResize)&&c.resizable("disable"),c.attr("data-gs-locked",d.locked?"yes":null)}},i.prototype._prepareElement=function(b,c){c="undefined"!=typeof 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")),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),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof 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="undefined"==typeof c||c,b=a(b);var d=b.data("_gridstack_node"); +return k.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},k.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=[])},k.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=[])},k.prototype._initStyles=function(){this._stylesId&&h.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=h.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},k.prototype._updateStyles=function(a){if(null!==this._styles&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof 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&&h.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.opts.removable===!0&&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;f.grid.canMoveNode(c,j,k,h,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,b.resizable("option","minWidth",d*(c.minWidth||1)),b.resizable("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;f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove?(h=!0,b.removeData("_gridstack_node"),b.remove()):(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"))}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)}},k.prototype._prepareElement=function(b,c){c="undefined"!=typeof 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:h.toBool(b.attr("data-gs-auto-position")),noResize:h.toBool(b.attr("data-gs-no-resize")),noMove:h.toBool(b.attr("data-gs-no-move")),locked:h.toBool(b.attr("data-gs-locked")),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},k.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},k.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},k.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},k.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)},k.prototype.removeWidget=function(b,c){c="undefined"==typeof c||c,b=a(b);var d=b.data("_gridstack_node"); // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -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){b.each(this.grid.nodes,b.bind(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(),"undefined"==typeof 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");"undefined"!=typeof f&&null!==f&&"undefined"!=typeof a.ui&&(f.noResize=!c,f.noResize||d._isOneColumnMode()?e.resizable("disable"):e.resizable("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");"undefined"!=typeof f&&null!==f&&"undefined"!=typeof a.ui&&(f.noMove=!c,f.noMove||d._isOneColumnMode()?(e.draggable("disable"),e.removeClass("ui-draggable-handle")):(e.draggable("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");"undefined"!=typeof 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");"undefined"!=typeof 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");"undefined"!=typeof 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");"undefined"!=typeof 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");"undefined"!=typeof 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("undefined"!=typeof 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&&"undefined"!=typeof b?b:d.width,c=null!==c&&"undefined"!=typeof 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&&"undefined"!=typeof b?b:d.x,c=null!==c&&"undefined"!=typeof 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&&"undefined"!=typeof b?b:f.x,c=null!==c&&"undefined"!=typeof c?c:f.y,d=null!==d&&"undefined"!=typeof d?d:f.width,e=null!==e&&"undefined"!=typeof e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},i.prototype.verticalMargin=function(a,b){if("undefined"==typeof 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("undefined"==typeof 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="undefined"!=typeof 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=a===!0,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},i.prototype._setStaticClass=function(){var a="grid-stack-static";this.opts.staticGrid===!0?this.container.addClass(a):this.container.removeClass(a)},i.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;d Date: Wed, 17 Aug 2016 23:36:05 -0700 Subject: [PATCH 02/15] fix lint errors --- dist/gridstack.js | 4 ++-- src/gridstack.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/gridstack.js b/dist/gridstack.js index 5f73e5a..2e05cf1 100644 --- a/dist/gridstack.js +++ b/dist/gridstack.js @@ -130,7 +130,7 @@ */ function GridStackDragDropPlugin(grid) { this.grid = grid; - }; + } GridStackDragDropPlugin.prototype.resizable = function(el, opts) { return this; @@ -146,7 +146,7 @@ */ function JQueryUIGridStackDragDropPlugin(grid) { GridStackDragDropPlugin.call(this, grid); - }; + } JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype); JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; diff --git a/src/gridstack.js b/src/gridstack.js index 5f73e5a..2e05cf1 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -130,7 +130,7 @@ */ function GridStackDragDropPlugin(grid) { this.grid = grid; - }; + } GridStackDragDropPlugin.prototype.resizable = function(el, opts) { return this; @@ -146,7 +146,7 @@ */ function JQueryUIGridStackDragDropPlugin(grid) { GridStackDragDropPlugin.call(this, grid); - }; + } JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype); JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; From eeff06dbe84a269ba7f579b5d592a6bc4202fadf Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Thu, 18 Aug 2016 20:51:41 -0700 Subject: [PATCH 03/15] incapsulate drag/drop into plugin --- dist/gridstack.js | 77 +++++++++++++++++++++++++++++++----------- dist/gridstack.min.js | 4 +-- dist/gridstack.min.map | 2 +- src/gridstack.js | 77 +++++++++++++++++++++++++++++++----------- 4 files changed, 117 insertions(+), 43 deletions(-) diff --git a/dist/gridstack.js b/dist/gridstack.js index 0afd35f..5d50499 100644 --- a/dist/gridstack.js +++ b/dist/gridstack.js @@ -140,6 +140,18 @@ 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; + }; + /** * @class JQueryUIGridStackDragDropPlugin * jQuery UI implementation of drag'n'drop gridstack plugin. @@ -152,6 +164,7 @@ JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) { + el = $(el); if (opts === 'disable' || opts === 'enable') { el.resizable(opts); } else { @@ -165,6 +178,7 @@ }; JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) { + el = $(el); if (opts === 'disable' || opts === 'enable') { el.draggable(opts); } else { @@ -178,6 +192,28 @@ return this; }; + JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) { + el = $(el); + if (opts === 'disable' || opts === 'enable') { + el.droppable(opts); + } else { + el.droppable({ + accept: opts.accept + }); + } + 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; + }; + var idSeq = 0; var GridStackEngine = function(width, onchange, floatMode, height, items) { @@ -765,13 +801,13 @@ if (!self.opts.staticGrid && typeof self.opts.removable === 'string') { var trashZone = $(self.opts.removable); - if (!trashZone.data('droppable')) { - trashZone.droppable({ + if (!this.dd.isDroppable(trashZone)) { + this.dd.droppable(trashZone, { accept: '.' + self.opts.itemClass }); } - trashZone - .on('dropover', function(event, ui) { + this.dd + .on(trashZone, 'dropover', function(event, ui) { var el = $(ui.draggable); var node = el.data('_gridstack_node'); if (node._grid !== self) { @@ -779,7 +815,7 @@ } self._setupRemovingTimeout(el); }) - .on('dropout', function(event, ui) { + .on(trashZone, 'dropout', function(event, ui) { var el = $(ui.draggable); var node = el.data('_gridstack_node'); if (node._grid !== self) { @@ -829,16 +865,18 @@ } }; - $(self.container).droppable({ - accept: function(el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (node && node._grid === self) { - return false; + 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); } - return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets); - }, - over: function(event, ui) { + }) + .on(self.container, 'dropover', function(event, ui) { var offset = self.container.offset(); var el = $(ui.draggable); var cellWidth = self.cellWidth(); @@ -855,8 +893,8 @@ el.data('_gridstack_node_orig', origNode); el.on('drag', onDrag); - }, - out: function(event, ui) { + }) + .on(self.container, 'dropout', function(event, ui) { var el = $(ui.draggable); el.unbind('drag', onDrag); var node = el.data('_gridstack_node'); @@ -865,8 +903,8 @@ self.placeholder.detach(); self._updateContainerHeight(); el.data('_gridstack_node', el.data('_gridstack_node_orig')); - }, - drop: function(event, ui) { + }) + .on(self.container, 'drop', function(event, ui) { self.placeholder.detach(); var node = $(ui.draggable).data('_gridstack_node'); @@ -893,8 +931,7 @@ self._triggerChangeEvent(); self.grid.endUpdate(); - } - }); + }); } }; diff --git a/dist/gridstack.min.js b/dist/gridstack.min.js index 62256fe..30bb760 100644 --- a/dist/gridstack.min.js +++ b/dist/gridstack.min.js @@ -17,13 +17,13 @@ function c(a){this.grid=a}/** */ function d(a){c.call(this,a)}var e=window,f=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},g=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.")},h={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=c!=-1?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(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&h.isIntercepted(a,this.nn)},_didCollide:function(a){return h.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return h.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}}}; // jscs:disable requireCamelCaseOrUpperCaseIdentifiers -h.is_intercepted=f(h.isIntercepted,"is_intercepted","isIntercepted"),h.create_stylesheet=f(h.createStylesheet,"create_stylesheet","createStylesheet"),h.remove_stylesheet=f(h.removeStylesheet,"remove_stylesheet","removeStylesheet"),h.insert_css_rule=f(h.insertCSSRule,"insert_css_rule","insertCSSRule"),c.prototype.resizable=function(a,b){return this},c.prototype.draggable=function(a,b){return this},d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.resizable=function(a,c){return"disable"===c||"enable"===c?a.resizable(c):a.resizable(b.extend({},this.grid.opts.resizable,{start:c.start||function(){},stop:c.stop||function(){},resize:c.resize||function(){}})),this},d.prototype.draggable=function(a,c){return"disable"===c||"enable"===c?a.draggable(c):a.draggable(b.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:c.start||function(){},stop:c.stop||function(){},drag:c.drag||function(){}})),this};var i=0,j=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=[]};j.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},j.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())}, +h.is_intercepted=f(h.isIntercepted,"is_intercepted","isIntercepted"),h.create_stylesheet=f(h.createStylesheet,"create_stylesheet","createStylesheet"),h.remove_stylesheet=f(h.removeStylesheet,"remove_stylesheet","removeStylesheet"),h.insert_css_rule=f(h.insertCSSRule,"insert_css_rule","insertCSSRule"),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},d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.resizable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.resizable(d):c.resizable(b.extend({},this.grid.opts.resizable,{start:d.start||function(){},stop:d.stop||function(){},resize:d.resize||function(){}})),this},d.prototype.draggable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.draggable(d):c.draggable(b.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:d.start||function(){},stop:d.stop||function(){},drag:d.drag||function(){}})),this},d.prototype.droppable=function(b,c){return b=a(b),"disable"===c||"enable"===c?b.droppable(c):b.droppable({accept:c.accept}),this},d.prototype.isDroppable=function(b,c){return b=a(b),Boolean(b.data("droppable"))},d.prototype.on=function(b,c,d){return a(b).on(c,d),this};var i=0,j=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=[]};j.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},j.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())}, // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 j.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},j.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(h._collisionNodeCheck,{node:a,nn:c}));if("undefined"==typeof e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},j.prototype.isAreaEmpty=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},g=b.find(this.nodes,b.bind(function(a){return h.isIntercepted(a,f)},this));return null===g||"undefined"==typeof g},j.prototype._sortNodes=function(a){this.nodes=h.sort(this.nodes,a,this.width)},j.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(h._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(h._didCollide,{n:a,newY:d})).value();e="undefined"==typeof f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},j.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},j.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},j.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},j.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},j.prototype.addNode=function(a,c){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++i,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(h._isAddNodeIntercepted,{x:e,y:f,node:a})))){a.x=e,a.y=f;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},j.prototype.removeNode=function(a,c){c="undefined"==typeof c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},j.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 i,k=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?i=a.extend({},b):a.extend({},b)}));if("undefined"==typeof i)return!0;k.moveNode(i,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=i&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},j.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},j.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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},j.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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof 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=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},j.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},j.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},j.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 k=function(c,e){var f,h,i=this;e=e||{},this.container=a(c), // jscs:disable requireCamelCaseOrUpperCaseIdentifiers "undefined"!=typeof e.handle_class&&(e.handleClass=e.handle_class,g("handle_class","handleClass")),"undefined"!=typeof e.item_class&&(e.itemClass=e.item_class,g("item_class","itemClass")),"undefined"!=typeof e.placeholder_class&&(e.placeholderClass=e.placeholder_class,g("placeholder_class","placeholderClass")),"undefined"!=typeof e.placeholder_text&&(e.placeholderText=e.placeholder_text,g("placeholder_text","placeholderText")),"undefined"!=typeof e.cell_height&&(e.cellHeight=e.cell_height,g("cell_height","cellHeight")),"undefined"!=typeof e.vertical_margin&&(e.verticalMargin=e.vertical_margin,g("vertical_margin","verticalMargin")),"undefined"!=typeof e.min_width&&(e.minWidth=e.min_width,g("min_width","minWidth")),"undefined"!=typeof e.static_grid&&(e.staticGrid=e.static_grid,g("static_grid","staticGrid")),"undefined"!=typeof e.is_nested&&(e.isNested=e.is_nested,g("is_nested","isNested")),"undefined"!=typeof e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,g("always_show_resize_handle","alwaysShowResizeHandle")), // jscs:enable requireCamelCaseOrUpperCaseIdentifiers -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",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:d}),this.dd=new e.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?i.cellHeight(i.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 j(this.opts.width,function(a,c){c="undefined"==typeof 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))}),i._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){i._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;i.container.addClass(i.opts.oneColumnModeClass),f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&i.dd.draggable(a.el,"disable"),(a.noResize||i.opts.disableResize)&&i.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!f)return;if(i.container.removeClass(i.opts.oneColumnModeClass),f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||i.dd.draggable(a.el,"enable"),a.noResize||i.opts.disableResize||i.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.opts.removable){var n=a(i.opts.removable);n.data("droppable")||n.droppable({accept:"."+i.opts.itemClass}),n.on("dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on("dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.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=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};a(i.container).droppable({accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==i)&&b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)},over:function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)},out:function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))},drop:function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.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(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()}})}}; +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",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:d}),this.dd=new e.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?i.cellHeight(i.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 j(this.opts.width,function(a,c){c="undefined"==typeof 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))}),i._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){i._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;i.container.addClass(i.opts.oneColumnModeClass),f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&i.dd.draggable(a.el,"disable"),(a.noResize||i.opts.disableResize)&&i.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!f)return;if(i.container.removeClass(i.opts.oneColumnModeClass),f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||i.dd.draggable(a.el,"enable"),a.noResize||i.opts.disableResize||i.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.opts.removable){var n=a(i.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+i.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.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=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};this.dd.droppable(i.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==i)&&b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)}}).on(i.container,"dropover",function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(i.container,"dropout",function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}).on(i.container,"drop",function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.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(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()})}}; // jscs:disable requireCamelCaseOrUpperCaseIdentifiers // jscs:enable requireCamelCaseOrUpperCaseIdentifiers return k.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},k.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=[])},k.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=[])},k.prototype._initStyles=function(){this._stylesId&&h.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=h.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},k.prototype._updateStyles=function(a){if(null!==this._styles&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof 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&&h.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.opts.removable===!0&&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;f.grid.canMoveNode(c,j,k,h,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,b.resizable("option","minWidth",d*(c.minWidth||1)),b.resizable("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;f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove?(h=!0,b.removeData("_gridstack_node"),b.remove()):(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"))}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)}},k.prototype._prepareElement=function(b,c){c="undefined"!=typeof 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:h.toBool(b.attr("data-gs-auto-position")),noResize:h.toBool(b.attr("data-gs-no-resize")),noMove:h.toBool(b.attr("data-gs-no-move")),locked:h.toBool(b.attr("data-gs-locked")),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},k.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},k.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},k.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},k.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)},k.prototype.removeWidget=function(b,c){c="undefined"==typeof c||c,b=a(b);var d=b.data("_gridstack_node"); diff --git a/dist/gridstack.min.map b/dist/gridstack.min.map index ff4388b..96c945b 100644 --- a/dist/gridstack.min.map +++ b/dist/gridstack.min.map @@ -1 +1 @@ -{"version":3,"sources":["../src/gridstack.js"],"names":["factory","define","amd","exports","jQuery","require","e","_","$","GridStackDragDropPlugin","grid","this","JQueryUIGridStackDragDropPlugin","call","scope","window","obsolete","f","oldName","newName","wrapper","console","warn","apply","arguments","prototype","obsoleteOpts","Utils","isIntercepted","a","b","x","width","y","height","sort","nodes","dir","chain","map","node","max","value","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","isString","match","Error","parseFloat","unit","is_intercepted","create_stylesheet","remove_stylesheet","insert_css_rule","resizable","el","opts","draggable","Object","create","constructor","extend","start","stop","resize","containment","isNested","container","parent","drag","idSeq","GridStackEngine","onchange","floatMode","items","float","_updateCounter","_float","_addedNodes","_removedNodes","batchUpdate","commit","_packNodes","_notify","getNodeDataByDOMEl","find","get","_fixCollisions","_sortNodes","hasLocked","locked","collisionNode","bind","moveNode","isAreaEmpty","each","i","_updating","_origY","_dirty","canBeMoved","take","_prepareNode","resizing","defaults","parseInt","autoPosition","noResize","noMove","args","Array","slice","deletedNodes","concat","getDirtyNodes","cleanNodes","filter","addNode","triggerAddEvent","maxWidth","Math","min","maxHeight","minWidth","minHeight","_id","floor","push","clone","removeNode","detachNode","without","canMoveNode","isNodeChangedPosition","clonedNode","res","getGridHeight","canBePlacedWithRespectToHeight","noPack","reduce","memo","beginUpdate","endUpdate","GridStack","oneColumnMode","isAutoCellHeight","self","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","always_show_resize_handle","alwaysShowResizeHandle","closest","length","attr","handle","auto","_class","random","toFixed","animate","autoHide","handles","scroll","appendTo","disableDrag","disableResize","rtl","removable","removeTimeout","verticalMarginUnit","cellHeightUnit","oneColumnModeClass","ddPlugin","dd","css","addClass","cellWidth","_setStaticClass","_initStyles","_updateStyles","elements","_this","children","_prepareElement","setAnimation","placeholder","hide","_updateContainerHeight","_updateHeightsOnResize","throttle","onResizeHandler","_isOneColumnMode","append","trigger","removeClass","trashZone","data","droppable","accept","on","event","ui","_grid","_setupRemovingTimeout","_clearRemovingTimeout","acceptWidgets","draggingElement","onDrag","pos","getCellFromPixel","offset","_added","show","_beforeDragX","_beforeDragY","is","over","origNode","ceil","outerWidth","outerHeight","_temporary","out","unbind","detach","drop","removeAttr","enableSelection","removeData","_prepareElementsByNode","_triggerChangeEvent","forceTrigger","hasChanges","eventParams","_triggerAddEvent","_triggerRemoveEvent","_stylesId","_styles","_max","getHeight","prefix","nbRows","nbMargins","innerWidth","documentElement","clientWidth","body","_removeTimeout","setTimeout","_isAboutToRemove","clearTimeout","dragOrResize","round","position","left","top","type","size","_temporaryRemoved","onStartMoving","o","strictCellHeight","onEndMoving","forceNotify","nestedGrids","enable","addWidget","makeWidget","willItFit","removeWidget","removeAll","destroy","detachGrid","off","disable","movable","enableMove","doEnable","includeNewWidgets","enableResize","isNaN","_updateElement","callback","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"],"mappings":";;;;;;;CAOA,SAAUA,GACN,GAAsB,kBAAXC,SAAyBA,OAAOC,IACvCD,QAAQ,SAAU,SAAU,iBAAkB,8BAA+B,sBACzE,iBAAkB,eAAgB,oBAAqB,mBAAoB,uBAC3E,mBAAoB,gCAAiC,sBAAuB,0BAC5E,qBAAsB,sBAAuB,oBAAqB,mBAClE,0BAA2B,8BAA+B,8BAC1D,+BAAgCD,OACjC,IAAuB,mBAAZG,SAAyB,CACvC,IAAMC,OAASC,QAAQ,UAAa,MAAOC,IAC3C,IAAMC,EAAIF,QAAQ,UAAa,MAAOC,IACtCN,EAAQI,OAAQG,OAEhBP,GAAQI,OAAQG,IAErB,SAASC,EAAGD;;;;;;AA4GX,QAASE,GAAwBC,GAC7BC,KAAKD,KAAOA;;;;AAehB,QAAS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,UAAUqW,oBAAsB9W,EAASgK,EAAUvJ,UAAUuO,iBACnE,sBAAuB,oBAC3BhF,EAAUvJ,UAAUsU,aAAe/U,EAASgK,EAAUvJ,UAAUwF,YAC5D,eAAgB,eACpB+D,EAAUvJ,UAAUwU,cAAgBjV,EAASgK,EAAUvJ,UAAUsG,YAC7D,gBAAiB,eACrBiD,EAAUvJ,UAAUsW,WAAa/W,EAASgK,EAAUvJ,UAAU4T,UAC1D,aAAc,aAClBrK,EAAUvJ,UAAUuW,kBAAoBhX,EAASgK,EAAUvJ,UAAUuM,gBACjE,oBAAqB,mBAGzBlN,EAAMmX,YAAcjN,EAEpBlK,EAAMmX,YAAYtW,MAAQA,EAC1Bb,EAAMmX,YAAYC,OAAS1R,EAE3BhG,EAAE2X,GAAGC,UAAY,SAAS3S,GACtB,MAAO9E,MAAKqH,KAAK,WACb,GAAImL,GAAI3S,EAAEG,KACLwS,GAAEhE,KAAK,cACRgE,EACKhE,KAAK,YAAa,GAAInE,GAAUrK,KAAM8E,OAKhD3E,EAAMmX","file":"gridstack.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/gridstack.js"],"names":["factory","define","amd","exports","jQuery","require","e","_","$","GridStackDragDropPlugin","grid","this","JQueryUIGridStackDragDropPlugin","call","scope","window","obsolete","f","oldName","newName","wrapper","console","warn","apply","arguments","prototype","obsoleteOpts","Utils","isIntercepted","a","b","x","width","y","height","sort","nodes","dir","chain","map","node","max","value","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","isString","match","Error","parseFloat","unit","is_intercepted","create_stylesheet","remove_stylesheet","insert_css_rule","resizable","el","opts","draggable","droppable","isDroppable","on","eventName","callback","Object","create","constructor","extend","start","stop","resize","containment","isNested","container","parent","drag","accept","data","idSeq","GridStackEngine","onchange","floatMode","items","float","_updateCounter","_float","_addedNodes","_removedNodes","batchUpdate","commit","_packNodes","_notify","getNodeDataByDOMEl","find","get","_fixCollisions","_sortNodes","hasLocked","locked","collisionNode","bind","moveNode","isAreaEmpty","each","i","_updating","_origY","_dirty","canBeMoved","take","_prepareNode","resizing","defaults","parseInt","autoPosition","noResize","noMove","args","Array","slice","deletedNodes","concat","getDirtyNodes","cleanNodes","filter","addNode","triggerAddEvent","maxWidth","Math","min","maxHeight","minWidth","minHeight","_id","floor","push","clone","removeNode","detachNode","without","canMoveNode","isNodeChangedPosition","clonedNode","res","getGridHeight","canBePlacedWithRespectToHeight","noPack","reduce","memo","beginUpdate","endUpdate","GridStack","oneColumnMode","isAutoCellHeight","self","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","always_show_resize_handle","alwaysShowResizeHandle","closest","length","attr","handle","auto","_class","random","toFixed","animate","autoHide","handles","scroll","appendTo","disableDrag","disableResize","rtl","removable","removeTimeout","verticalMarginUnit","cellHeightUnit","oneColumnModeClass","ddPlugin","dd","css","addClass","cellWidth","_setStaticClass","_initStyles","_updateStyles","elements","_this","children","_prepareElement","setAnimation","placeholder","hide","_updateContainerHeight","_updateHeightsOnResize","throttle","onResizeHandler","_isOneColumnMode","append","trigger","removeClass","trashZone","event","ui","_grid","_setupRemovingTimeout","_clearRemovingTimeout","acceptWidgets","draggingElement","onDrag","pos","getCellFromPixel","offset","_added","show","_beforeDragX","_beforeDragY","is","origNode","ceil","outerWidth","outerHeight","_temporary","unbind","detach","removeAttr","enableSelection","removeData","_prepareElementsByNode","_triggerChangeEvent","forceTrigger","hasChanges","eventParams","_triggerAddEvent","_triggerRemoveEvent","_stylesId","_styles","_max","getHeight","prefix","nbRows","nbMargins","innerWidth","documentElement","clientWidth","body","_removeTimeout","setTimeout","_isAboutToRemove","clearTimeout","dragOrResize","round","position","left","top","type","size","_temporaryRemoved","onStartMoving","o","strictCellHeight","onEndMoving","forceNotify","nestedGrids","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"],"mappings":";;;;;;;CAOA,SAAUA,GACN,GAAsB,kBAAXC,SAAyBA,OAAOC,IACvCD,QAAQ,SAAU,SAAU,iBAAkB,8BAA+B,sBACzE,iBAAkB,eAAgB,oBAAqB,mBAAoB,uBAC3E,mBAAoB,gCAAiC,sBAAuB,0BAC5E,qBAAsB,sBAAuB,oBAAqB,mBAClE,0BAA2B,8BAA+B,8BAC1D,+BAAgCD,OACjC,IAAuB,mBAAZG,SAAyB,CACvC,IAAMC,OAASC,QAAQ,UAAa,MAAOC,IAC3C,IAAMC,EAAIF,QAAQ,UAAa,MAAOC,IACtCN,EAAQI,OAAQG,OAEhBP,GAAQI,OAAQG,IAErB,SAASC,EAAGD;;;;;;AA4GX,QAASE,GAAwBC,GAC7BC,KAAKD,KAAOA;;;;AA2BhB,QAASE,GAAgCF,GACrCD,EAAwBI,KAAKF,KAAMD,GAvIvC,GAAII,GAAQC,OAERC,EAAW,SAASC,EAAGC,EAASC,GAChC,GAAIC,GAAU,WAG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ack.min.js"} \ No newline at end of file diff --git a/src/gridstack.js b/src/gridstack.js index 0afd35f..5d50499 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -140,6 +140,18 @@ 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; + }; + /** * @class JQueryUIGridStackDragDropPlugin * jQuery UI implementation of drag'n'drop gridstack plugin. @@ -152,6 +164,7 @@ JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) { + el = $(el); if (opts === 'disable' || opts === 'enable') { el.resizable(opts); } else { @@ -165,6 +178,7 @@ }; JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) { + el = $(el); if (opts === 'disable' || opts === 'enable') { el.draggable(opts); } else { @@ -178,6 +192,28 @@ return this; }; + JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) { + el = $(el); + if (opts === 'disable' || opts === 'enable') { + el.droppable(opts); + } else { + el.droppable({ + accept: opts.accept + }); + } + 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; + }; + var idSeq = 0; var GridStackEngine = function(width, onchange, floatMode, height, items) { @@ -765,13 +801,13 @@ if (!self.opts.staticGrid && typeof self.opts.removable === 'string') { var trashZone = $(self.opts.removable); - if (!trashZone.data('droppable')) { - trashZone.droppable({ + if (!this.dd.isDroppable(trashZone)) { + this.dd.droppable(trashZone, { accept: '.' + self.opts.itemClass }); } - trashZone - .on('dropover', function(event, ui) { + this.dd + .on(trashZone, 'dropover', function(event, ui) { var el = $(ui.draggable); var node = el.data('_gridstack_node'); if (node._grid !== self) { @@ -779,7 +815,7 @@ } self._setupRemovingTimeout(el); }) - .on('dropout', function(event, ui) { + .on(trashZone, 'dropout', function(event, ui) { var el = $(ui.draggable); var node = el.data('_gridstack_node'); if (node._grid !== self) { @@ -829,16 +865,18 @@ } }; - $(self.container).droppable({ - accept: function(el) { - el = $(el); - var node = el.data('_gridstack_node'); - if (node && node._grid === self) { - return false; + 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); } - return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets); - }, - over: function(event, ui) { + }) + .on(self.container, 'dropover', function(event, ui) { var offset = self.container.offset(); var el = $(ui.draggable); var cellWidth = self.cellWidth(); @@ -855,8 +893,8 @@ el.data('_gridstack_node_orig', origNode); el.on('drag', onDrag); - }, - out: function(event, ui) { + }) + .on(self.container, 'dropout', function(event, ui) { var el = $(ui.draggable); el.unbind('drag', onDrag); var node = el.data('_gridstack_node'); @@ -865,8 +903,8 @@ self.placeholder.detach(); self._updateContainerHeight(); el.data('_gridstack_node', el.data('_gridstack_node_orig')); - }, - drop: function(event, ui) { + }) + .on(self.container, 'drop', function(event, ui) { self.placeholder.detach(); var node = $(ui.draggable).data('_gridstack_node'); @@ -893,8 +931,7 @@ self._triggerChangeEvent(); self.grid.endUpdate(); - } - }); + }); } }; From 6d8ce2299cfdf894188c248738970c1f07ee9533 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Thu, 18 Aug 2016 21:01:23 -0700 Subject: [PATCH 04/15] dd plugin registration --- dist/gridstack.js | 19 +++++++++++++++++-- dist/gridstack.min.js | 8 ++++---- dist/gridstack.min.map | 2 +- src/gridstack.js | 19 +++++++++++++++++-- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/dist/gridstack.js b/dist/gridstack.js index 5d50499..b4e97a2 100644 --- a/dist/gridstack.js +++ b/dist/gridstack.js @@ -132,6 +132,12 @@ this.grid = grid; } + GridStackDragDropPlugin.registeredPlugins = []; + + GridStackDragDropPlugin.registerPlugin = function(pluginClass) { + GridStackDragDropPlugin.registeredPlugins.push(pluginClass); + }; + GridStackDragDropPlugin.prototype.resizable = function(el, opts) { return this; }; @@ -160,6 +166,8 @@ GridStackDragDropPlugin.call(this, grid); } + GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin); + JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype); JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; @@ -662,10 +670,16 @@ verticalMarginUnit: 'px', cellHeightUnit: 'px', oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode', - ddPlugin: JQueryUIGridStackDragDropPlugin + ddPlugin: null }); - this.dd = new opts.ddPlugin(this); + if (this.opts.ddPlugin === false) { + this.opts.ddPlugin = GridStackDragDropPlugin; + } else if (this.opts.ddPlugin === null) { + this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins); + } + + this.dd = new this.opts.ddPlugin(this); if (this.opts.rtl === 'auto') { this.opts.rtl = this.container.css('direction') === 'rtl'; @@ -1763,6 +1777,7 @@ scope.GridStackUI.Utils = Utils; scope.GridStackUI.Engine = GridStackEngine; + scope.GridStackUI.GridStackDragDropPlugin = GridStackDragDropPlugin; $.fn.gridstack = function(opts) { return this.each(function() { diff --git a/dist/gridstack.min.js b/dist/gridstack.min.js index 30bb760..250699a 100644 --- a/dist/gridstack.min.js +++ b/dist/gridstack.min.js @@ -17,16 +17,16 @@ function c(a){this.grid=a}/** */ function d(a){c.call(this,a)}var e=window,f=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},g=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.")},h={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=c!=-1?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(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&h.isIntercepted(a,this.nn)},_didCollide:function(a){return h.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return h.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}}}; // jscs:disable requireCamelCaseOrUpperCaseIdentifiers -h.is_intercepted=f(h.isIntercepted,"is_intercepted","isIntercepted"),h.create_stylesheet=f(h.createStylesheet,"create_stylesheet","createStylesheet"),h.remove_stylesheet=f(h.removeStylesheet,"remove_stylesheet","removeStylesheet"),h.insert_css_rule=f(h.insertCSSRule,"insert_css_rule","insertCSSRule"),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},d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.resizable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.resizable(d):c.resizable(b.extend({},this.grid.opts.resizable,{start:d.start||function(){},stop:d.stop||function(){},resize:d.resize||function(){}})),this},d.prototype.draggable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.draggable(d):c.draggable(b.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:d.start||function(){},stop:d.stop||function(){},drag:d.drag||function(){}})),this},d.prototype.droppable=function(b,c){return b=a(b),"disable"===c||"enable"===c?b.droppable(c):b.droppable({accept:c.accept}),this},d.prototype.isDroppable=function(b,c){return b=a(b),Boolean(b.data("droppable"))},d.prototype.on=function(b,c,d){return a(b).on(c,d),this};var i=0,j=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=[]};j.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},j.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())}, +h.is_intercepted=f(h.isIntercepted,"is_intercepted","isIntercepted"),h.create_stylesheet=f(h.createStylesheet,"create_stylesheet","createStylesheet"),h.remove_stylesheet=f(h.removeStylesheet,"remove_stylesheet","removeStylesheet"),h.insert_css_rule=f(h.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},c.registerPlugin(d),d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.resizable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.resizable(d):c.resizable(b.extend({},this.grid.opts.resizable,{start:d.start||function(){},stop:d.stop||function(){},resize:d.resize||function(){}})),this},d.prototype.draggable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.draggable(d):c.draggable(b.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:d.start||function(){},stop:d.stop||function(){},drag:d.drag||function(){}})),this},d.prototype.droppable=function(b,c){return b=a(b),"disable"===c||"enable"===c?b.droppable(c):b.droppable({accept:c.accept}),this},d.prototype.isDroppable=function(b,c){return b=a(b),Boolean(b.data("droppable"))},d.prototype.on=function(b,c,d){return a(b).on(c,d),this};var i=0,j=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=[]};j.prototype.batchUpdate=function(){this._updateCounter=1,this.float=!0},j.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this.float=this._float,this._packNodes(),this._notify())}, // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -j.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},j.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(h._collisionNodeCheck,{node:a,nn:c}));if("undefined"==typeof e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},j.prototype.isAreaEmpty=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},g=b.find(this.nodes,b.bind(function(a){return h.isIntercepted(a,f)},this));return null===g||"undefined"==typeof g},j.prototype._sortNodes=function(a){this.nodes=h.sort(this.nodes,a,this.width)},j.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(h._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(h._didCollide,{n:a,newY:d})).value();e="undefined"==typeof f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},j.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},j.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},j.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},j.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},j.prototype.addNode=function(a,c){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++i,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(h._isAddNodeIntercepted,{x:e,y:f,node:a})))){a.x=e,a.y=f;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},j.prototype.removeNode=function(a,c){c="undefined"==typeof c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},j.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 i,k=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?i=a.extend({},b):a.extend({},b)}));if("undefined"==typeof i)return!0;k.moveNode(i,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=i&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},j.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},j.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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},j.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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof 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=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},j.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},j.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},j.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 k=function(c,e){var f,h,i=this;e=e||{},this.container=a(c), +j.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},j.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(h._collisionNodeCheck,{node:a,nn:c}));if("undefined"==typeof e)return;this.moveNode(e,e.x,a.y+a.height,e.width,e.height,!0)}},j.prototype.isAreaEmpty=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},g=b.find(this.nodes,b.bind(function(a){return h.isIntercepted(a,f)},this));return null===g||"undefined"==typeof g},j.prototype._sortNodes=function(a){this.nodes=h.sort(this.nodes,a,this.width)},j.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(h._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(h._didCollide,{n:a,newY:d})).value();e="undefined"==typeof f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},j.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},j.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},j.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},j.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},j.prototype.addNode=function(a,c){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++i,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(h._isAddNodeIntercepted,{x:e,y:f,node:a})))){a.x=e,a.y=f;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},j.prototype.removeNode=function(a,c){c="undefined"==typeof c||c,this._removedNodes.push(b.clone(a)),a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c)},j.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 i,k=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?i=a.extend({},b):a.extend({},b)}));if("undefined"==typeof i)return!0;k.moveNode(i,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=i&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height),l},j.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new j(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},j.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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},j.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),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof 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=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},j.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},j.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},j.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 k=function(d,e){var f,h,i=this;e=e||{},this.container=a(d), // jscs:disable requireCamelCaseOrUpperCaseIdentifiers "undefined"!=typeof e.handle_class&&(e.handleClass=e.handle_class,g("handle_class","handleClass")),"undefined"!=typeof e.item_class&&(e.itemClass=e.item_class,g("item_class","itemClass")),"undefined"!=typeof e.placeholder_class&&(e.placeholderClass=e.placeholder_class,g("placeholder_class","placeholderClass")),"undefined"!=typeof e.placeholder_text&&(e.placeholderText=e.placeholder_text,g("placeholder_text","placeholderText")),"undefined"!=typeof e.cell_height&&(e.cellHeight=e.cell_height,g("cell_height","cellHeight")),"undefined"!=typeof e.vertical_margin&&(e.verticalMargin=e.vertical_margin,g("vertical_margin","verticalMargin")),"undefined"!=typeof e.min_width&&(e.minWidth=e.min_width,g("min_width","minWidth")),"undefined"!=typeof e.static_grid&&(e.staticGrid=e.static_grid,g("static_grid","staticGrid")),"undefined"!=typeof e.is_nested&&(e.isNested=e.is_nested,g("is_nested","isNested")),"undefined"!=typeof e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,g("always_show_resize_handle","alwaysShowResizeHandle")), // jscs:enable requireCamelCaseOrUpperCaseIdentifiers -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",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:d}),this.dd=new e.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?i.cellHeight(i.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 j(this.opts.width,function(a,c){c="undefined"==typeof 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))}),i._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){i._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;i.container.addClass(i.opts.oneColumnModeClass),f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&i.dd.draggable(a.el,"disable"),(a.noResize||i.opts.disableResize)&&i.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!f)return;if(i.container.removeClass(i.opts.oneColumnModeClass),f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||i.dd.draggable(a.el,"enable"),a.noResize||i.opts.disableResize||i.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.opts.removable){var n=a(i.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+i.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.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=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};this.dd.droppable(i.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==i)&&b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)}}).on(i.container,"dropover",function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(i.container,"dropout",function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}).on(i.container,"drop",function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.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(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()})}}; +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",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),this.opts.ddPlugin===!1?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)),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?i.cellHeight(i.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 j(this.opts.width,function(a,c){c="undefined"==typeof 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))}),i._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){i._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateHeightsOnResize=b.throttle(function(){i.cellHeight(i.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&i._updateHeightsOnResize(),i._isOneColumnMode()){if(f)return;i.container.addClass(i.opts.oneColumnModeClass),f=!0,i.grid._sortNodes(),b.each(i.grid.nodes,function(a){i.container.append(a.el),i.opts.staticGrid||((a.noMove||i.opts.disableDrag)&&i.dd.draggable(a.el,"disable"),(a.noResize||i.opts.disableResize)&&i.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!f)return;if(i.container.removeClass(i.opts.oneColumnModeClass),f=!1,i.opts.staticGrid)return;b.each(i.grid.nodes,function(a){a.noMove||i.opts.disableDrag||i.dd.draggable(a.el,"enable"),a.noResize||i.opts.disableResize||i.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!i.opts.staticGrid&&"string"==typeof i.opts.removable){var n=a(i.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+i.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===i&&i._clearRemovingTimeout(d)})}if(!i.opts.staticGrid&&i.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=i.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!i.grid.canMoveNode(d,f,g))return;i.grid.moveNode(d,f,g),i._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,i.grid.cleanNodes(),i.grid.beginUpdate(d),i.grid.addNode(d),i.container.append(i.placeholder),i.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=i.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,i._updateContainerHeight()};this.dd.droppable(i.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==i)&&b.is(i.opts.acceptWidgets===!0?".grid-stack-item":i.opts.acceptWidgets)}}).on(i.container,"dropover",function(b,c){var d=(i.container.offset(),a(c.draggable)),e=i.cellWidth(),f=i.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),j=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=i.grid._prepareNode({width:h,height:j,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(i.container,"dropout",function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,i.grid.removeNode(e),i.placeholder.detach(),i._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}).on(i.container,"drop",function(b,c){i.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=i;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,i.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(i.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),i.container.append(e),i._prepareElementsByNode(e,d),i._updateContainerHeight(),i._triggerChangeEvent(),i.grid.endUpdate()})}}; // jscs:disable requireCamelCaseOrUpperCaseIdentifiers // jscs:enable requireCamelCaseOrUpperCaseIdentifiers return k.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},k.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=[])},k.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=[])},k.prototype._initStyles=function(){this._stylesId&&h.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=h.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},k.prototype._updateStyles=function(a){if(null!==this._styles&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof 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&&h.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.opts.removable===!0&&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;f.grid.canMoveNode(c,j,k,h,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,b.resizable("option","minWidth",d*(c.minWidth||1)),b.resizable("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;f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove?(h=!0,b.removeData("_gridstack_node"),b.remove()):(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"))}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)}},k.prototype._prepareElement=function(b,c){c="undefined"!=typeof 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:h.toBool(b.attr("data-gs-auto-position")),noResize:h.toBool(b.attr("data-gs-no-resize")),noMove:h.toBool(b.attr("data-gs-no-move")),locked:h.toBool(b.attr("data-gs-locked")),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},k.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},k.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof l&&b.attr("data-gs-id",l),this.container.append(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},k.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},k.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)},k.prototype.removeWidget=function(b,c){c="undefined"==typeof c||c,b=a(b);var d=b.data("_gridstack_node"); // For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -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()},k.prototype.removeAll=function(a){b.each(this.grid.nodes,b.bind(function(b){this.removeWidget(b.el,a)},this)),this.grid.nodes=[],this._updateContainerHeight()},k.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),"undefined"==typeof b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),h.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},k.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");"undefined"!=typeof f&&null!==f&&"undefined"!=typeof a.ui&&(f.noResize=!c,f.noResize||d._isOneColumnMode()?e.resizable("disable"):e.resizable("enable"))}),this},k.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");"undefined"!=typeof f&&null!==f&&"undefined"!=typeof a.ui&&(f.noMove=!c,f.noMove||d._isOneColumnMode()?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},k.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},k.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},k.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")},k.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")},k.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},k.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},k.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},k.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},k.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},k.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if("undefined"!=typeof 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()}},k.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.width,c=null!==c&&"undefined"!=typeof c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},k.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.x,c=null!==c&&"undefined"!=typeof c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},k.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&"undefined"!=typeof b?b:f.x,c=null!==c&&"undefined"!=typeof c?c:f.y,d=null!==d&&"undefined"!=typeof d?d:f.width,e=null!==e&&"undefined"!=typeof e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},k.prototype.verticalMargin=function(a,b){if("undefined"==typeof a)return this.opts.verticalMargin;var c=h.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())},k.prototype.cellHeight=function(a,b){if("undefined"==typeof 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=h.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())},k.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},k.prototype.getCellFromPixel=function(a,b){var c="undefined"!=typeof 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)}},k.prototype.batchUpdate=function(){this.grid.batchUpdate()},k.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},k.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},k.prototype.setStatic=function(a){this.opts.staticGrid=a===!0,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},k.prototype._setStaticClass=function(){var a="grid-stack-static";this.opts.staticGrid===!0?this.container.addClass(a):this.container.removeClass(a)},k.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;d Date: Thu, 18 Aug 2016 21:42:59 -0700 Subject: [PATCH 05/15] fix direct resizable calling --- src/gridstack.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gridstack.js b/src/gridstack.js index b4e97a2..ce6e032 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -1189,8 +1189,8 @@ node._beforeDragX = node.x; node._beforeDragY = node.y; - el.resizable('option', 'minWidth', cellWidth * (node.minWidth || 1)); - el.resizable('option', 'minHeight', strictCellHeight * (node.minHeight || 1)); + 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'); @@ -1398,9 +1398,9 @@ node.noResize = !(val || false); if (node.noResize || self._isOneColumnMode()) { - el.resizable('disable'); + self.dd.resizable(el, 'disable'); } else { - el.resizable('enable'); + self.dd.resizable(el, 'enable'); } }); return this; From 3f193dbb3a6c5989e05885cc71664cd63019b041 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Thu, 18 Aug 2016 21:43:28 -0700 Subject: [PATCH 06/15] move jQueryUI plugin to separate file --- src/gridstack.jQueryUI.js | 97 +++++++++++++++++++++++++++++++++++++++ src/gridstack.js | 65 +------------------------- 2 files changed, 98 insertions(+), 64 deletions(-) create mode 100644 src/gridstack.jQueryUI.js diff --git a/src/gridstack.jQueryUI.js b/src/gridstack.jQueryUI.js new file mode 100644 index 0000000..1ae8575 --- /dev/null +++ b/src/gridstack.jQueryUI.js @@ -0,0 +1,97 @@ +/** + * gridstack.js 0.2.7-dev + * http://troolee.github.io/gridstack.js/ + * (c) 2014-2016 Pavel Reznikov + * gridstack.js may be freely distributed under the MIT license. + * @preserve +*/ +(function(factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', 'lodash', '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 { _ = require('lodash'); } catch (e) {} + try { GridStackUI = require('gridstack'); } catch (e) {} + factory(jQuery, _, GridStackUI); + } else { + factory(jQuery, _, GridStackUI); + } +})(function($, _, GridStackUI) { + + var scope = window; + + /** + * @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 { + el.resizable(_.extend({}, this.grid.opts.resizable, { + 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); + if (opts === 'disable' || opts === 'enable') { + el.droppable(opts); + } else { + el.droppable({ + accept: opts.accept + }); + } + 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; + }; + + return JQueryUIGridStackDragDropPlugin; +}); diff --git a/src/gridstack.js b/src/gridstack.js index ce6e032..03c4d90 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -158,69 +158,6 @@ return this; }; - /** - * @class JQueryUIGridStackDragDropPlugin - * jQuery UI implementation of drag'n'drop gridstack plugin. - */ - function JQueryUIGridStackDragDropPlugin(grid) { - GridStackDragDropPlugin.call(this, grid); - } - - GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin); - - JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype); - JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; - - JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) { - el = $(el); - if (opts === 'disable' || opts === 'enable') { - el.resizable(opts); - } else { - el.resizable(_.extend({}, this.grid.opts.resizable, { - 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); - if (opts === 'disable' || opts === 'enable') { - el.droppable(opts); - } else { - el.droppable({ - accept: opts.accept - }); - } - 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; - }; var idSeq = 0; @@ -676,7 +613,7 @@ if (this.opts.ddPlugin === false) { this.opts.ddPlugin = GridStackDragDropPlugin; } else if (this.opts.ddPlugin === null) { - this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins); + this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins) || GridStackDragDropPlugin; } this.dd = new this.opts.ddPlugin(this); From a9a332cd8f510818083160f0f367bbd92a7c46cb Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Thu, 18 Aug 2016 21:43:48 -0700 Subject: [PATCH 07/15] update gruntfile/karma --- Gruntfile.js | 7 +++++-- karma.conf.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index d4c7714..124b69f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -37,7 +37,8 @@ module.exports = function(grunt) { copy: { dist: { files: { - 'dist/gridstack.js': ['src/gridstack.js'] + 'dist/gridstack.js': ['src/gridstack.js'], + 'dist/gridstack.jQueryUI.js': ['src/gridstack.jQueryUI.js'], } } }, @@ -50,7 +51,9 @@ module.exports = function(grunt) { }, dist: { files: { - 'dist/gridstack.min.js': ['src/gridstack.js'] + 'dist/gridstack.min.js': ['src/gridstack.js'], + 'dist/gridstack.jQueryUI.js': ['src/gridstack.jQueryUI.js'], + 'dist/gridstack.all.js': ['src/gridstack.js', 'src/gridstack.jQueryUI.js'] } } }, diff --git a/karma.conf.js b/karma.conf.js index a2472da..4230ca8 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -19,6 +19,7 @@ module.exports = function(config) { 'bower_components/jquery-ui/jquery-ui.min.js', 'bower_components/lodash/dist/lodash.min.js', 'src/gridstack.js', + 'src/gridstack.jQueryUI.js', 'spec/*-spec.js' ], @@ -31,7 +32,8 @@ module.exports = function(config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - 'src/gridstack.js': ['coverage'] + 'src/gridstack.js': ['coverage'], + 'src/gridstack.jQueryUI.js': ['coverage'], }, From 625a8378b4b4fb4a65633fea146eb49e5379cb91 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Thu, 18 Aug 2016 21:43:55 -0700 Subject: [PATCH 08/15] update tests --- spec/e2e/html/gridstack-with-height.html | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/e2e/html/gridstack-with-height.html b/spec/e2e/html/gridstack-with-height.html index 4845ef6..2f543eb 100644 --- a/spec/e2e/html/gridstack-with-height.html +++ b/spec/e2e/html/gridstack-with-height.html @@ -18,6 +18,7 @@ +