|
250 | 250 |
|
251 | 251 | /*eslint-disable camelcase */ |
252 | 252 | Utils.is_intercepted = obsolete(Utils.isIntercepted, 'is_intercepted', 'isIntercepted'); |
253 | | - |
254 | 253 | Utils.create_stylesheet = obsolete(Utils.createStylesheet, 'create_stylesheet', 'createStylesheet'); |
255 | | - |
256 | 254 | Utils.remove_stylesheet = obsolete(Utils.removeStylesheet, 'remove_stylesheet', 'removeStylesheet'); |
257 | | - |
258 | 255 | Utils.insert_css_rule = obsolete(Utils.insertCSSRule, 'insert_css_rule', 'insertCSSRule'); |
259 | 256 | /*eslint-enable camelcase */ |
260 | 257 |
|
|
697 | 694 | opts.itemClass = opts.itemClass || 'grid-stack-item'; |
698 | 695 | var isNested = this.container.closest('.' + opts.itemClass).length > 0; |
699 | 696 |
|
700 | | - this.opts = Utils.defaults(opts || {}, { |
| 697 | + this.opts = Utils.defaults(opts, { |
701 | 698 | column: parseInt(this.container.attr('data-gs-column')) || 12, |
702 | 699 | maxRow: parseInt(this.container.attr('data-gs-max-row')) || 0, |
703 | 700 | itemClass: 'grid-stack-item', |
|
1229 | 1226 | var distance = ui.position.top - node._prevYPix; |
1230 | 1227 | node._prevYPix = ui.position.top; |
1231 | 1228 | Utils.updateScrollPosition(el[0], ui, distance); |
1232 | | - if (el.data('inTrashZone') || x < 0 || x >= self.grid.width || y < 0 || |
| 1229 | + if (el.data('inTrashZone') || x < 0 || x >= self.grid.column || y < 0 || |
1233 | 1230 | (!self.grid.float && y > self.grid.getGridHeight())) { |
1234 | 1231 | if (!node._temporaryRemoved) { |
1235 | 1232 | if (self.opts.removable === true) { |
|
1807 | 1804 | this.grid.commit(); |
1808 | 1805 | }; |
1809 | 1806 |
|
1810 | | - GridStack.prototype.setGridWidth = function(gridWidth,doNotPropagate) { |
| 1807 | + GridStack.prototype.setColumn = function(column, doNotPropagate) { |
| 1808 | + if (this.opts.column === column) { return; } |
1811 | 1809 | this.container.removeClass('grid-stack-' + this.opts.column); |
1812 | 1810 | if (doNotPropagate !== true) { |
1813 | | - this._updateNodeWidths(this.opts.column, gridWidth); |
| 1811 | + this._updateNodeWidths(this.opts.column, column); |
1814 | 1812 | } |
1815 | | - this.opts.column = gridWidth; |
1816 | | - this.grid.width = gridWidth; |
1817 | | - this.container.addClass('grid-stack-' + gridWidth); |
| 1813 | + this.opts.column = this.grid.column = column; |
| 1814 | + this.container.addClass('grid-stack-' + column); |
1818 | 1815 | }; |
| 1816 | + // legacy call from <= 0.5.2 - use new method instead. |
| 1817 | + GridStack.prototype.setGridWidth = function(column, doNotPropagate) { |
| 1818 | + console.warn('gridstack.js: setGridWidth() is deprecated as of v0.5.3 and has been replaced ' + |
| 1819 | + 'with setColumn(). It will be **completely** removed in v1.0.'); |
| 1820 | + this.setColumn(column, doNotPropagate); |
| 1821 | + } |
1819 | 1822 |
|
1820 | 1823 | /*eslint-disable camelcase */ |
1821 | 1824 | GridStackEngine.prototype.batch_update = obsolete(GridStackEngine.prototype.batchUpdate); |
|
0 commit comments