gridstack 4.4.1 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -16
- package/dist/es5/gridstack-dd.d.ts +1 -1
- package/dist/es5/gridstack-dd.js +13 -10
- package/dist/es5/gridstack-dd.js.map +1 -1
- package/dist/es5/gridstack-ddi.d.ts +1 -1
- package/dist/es5/gridstack-ddi.js +1 -1
- package/dist/es5/gridstack-ddi.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +11 -7
- package/dist/es5/gridstack-engine.js +30 -40
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-h5.d.ts +1 -1
- package/dist/es5/gridstack-h5.js +1 -1
- package/dist/es5/gridstack-h5.js.LICENSE.txt +2 -2
- package/dist/es5/gridstack-h5.js.map +1 -1
- package/dist/es5/gridstack-jq.d.ts +1 -1
- package/dist/es5/gridstack-jq.js +1 -1
- package/dist/es5/gridstack-jq.js.LICENSE.txt +8 -8
- package/dist/es5/gridstack-jq.js.map +1 -1
- package/dist/es5/gridstack-poly.js +3 -3
- package/dist/es5/gridstack-static.d.ts +1 -1
- package/dist/es5/gridstack-static.js +1 -1
- package/dist/es5/gridstack-static.js.LICENSE.txt +2 -2
- package/dist/es5/gridstack-static.js.map +1 -1
- package/dist/es5/gridstack.d.ts +11 -5
- package/dist/es5/gridstack.js +91 -41
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/h5/dd-base-impl.d.ts +2 -2
- package/dist/es5/h5/dd-base-impl.js +2 -2
- package/dist/es5/h5/dd-base-impl.js.map +1 -1
- package/dist/es5/h5/dd-draggable.d.ts +2 -3
- package/dist/es5/h5/dd-draggable.js +29 -22
- package/dist/es5/h5/dd-draggable.js.map +1 -1
- package/dist/es5/h5/dd-droppable.d.ts +3 -2
- package/dist/es5/h5/dd-droppable.js +43 -26
- package/dist/es5/h5/dd-droppable.js.map +1 -1
- package/dist/es5/h5/dd-element.d.ts +1 -1
- package/dist/es5/h5/dd-element.js +1 -1
- package/dist/es5/h5/dd-element.js.map +1 -1
- package/dist/es5/h5/dd-manager.d.ts +1 -1
- package/dist/es5/h5/dd-manager.js +1 -1
- package/dist/es5/h5/dd-manager.js.map +1 -1
- package/dist/es5/h5/dd-resizable-handle.d.ts +2 -2
- package/dist/es5/h5/dd-resizable-handle.js +2 -2
- package/dist/es5/h5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/h5/dd-resizable.d.ts +2 -3
- package/dist/es5/h5/dd-resizable.js +3 -4
- package/dist/es5/h5/dd-resizable.js.map +1 -1
- package/dist/es5/h5/dd-utils.d.ts +3 -1
- package/dist/es5/h5/dd-utils.js +13 -1
- package/dist/es5/h5/dd-utils.js.map +1 -1
- package/dist/es5/h5/gridstack-dd-native.d.ts +2 -2
- package/dist/es5/h5/gridstack-dd-native.js +2 -2
- package/dist/es5/h5/gridstack-dd-native.js.map +1 -1
- package/dist/es5/jq/gridstack-dd-jqueryui.js.map +1 -1
- package/dist/es5/types.d.ts +14 -6
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +3 -3
- package/dist/es5/utils.js +16 -15
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-dd.d.ts +1 -1
- package/dist/gridstack-dd.js +13 -10
- package/dist/gridstack-dd.js.map +1 -1
- package/dist/gridstack-ddi.d.ts +1 -1
- package/dist/gridstack-ddi.js +1 -1
- package/dist/gridstack-ddi.js.map +1 -1
- package/dist/gridstack-engine.d.ts +11 -7
- package/dist/gridstack-engine.js +30 -39
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack-h5.d.ts +1 -1
- package/dist/gridstack-h5.js +1 -1
- package/dist/gridstack-h5.js.LICENSE.txt +2 -2
- package/dist/gridstack-h5.js.map +1 -1
- package/dist/gridstack-jq.d.ts +1 -1
- package/dist/gridstack-jq.js +1 -1
- package/dist/gridstack-jq.js.LICENSE.txt +8 -8
- package/dist/gridstack-jq.js.map +1 -1
- package/dist/gridstack-static.d.ts +1 -1
- package/dist/gridstack-static.js +1 -1
- package/dist/gridstack-static.js.LICENSE.txt +2 -2
- package/dist/gridstack-static.js.map +1 -1
- package/dist/gridstack.css +1 -4
- package/dist/gridstack.d.ts +11 -5
- package/dist/gridstack.js +91 -41
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/h5/dd-base-impl.d.ts +2 -2
- package/dist/h5/dd-base-impl.js +2 -2
- package/dist/h5/dd-base-impl.js.map +1 -1
- package/dist/h5/dd-draggable.d.ts +2 -3
- package/dist/h5/dd-draggable.js +29 -22
- package/dist/h5/dd-draggable.js.map +1 -1
- package/dist/h5/dd-droppable.d.ts +3 -2
- package/dist/h5/dd-droppable.js +43 -26
- package/dist/h5/dd-droppable.js.map +1 -1
- package/dist/h5/dd-element.d.ts +1 -1
- package/dist/h5/dd-element.js +1 -1
- package/dist/h5/dd-element.js.map +1 -1
- package/dist/h5/dd-manager.d.ts +1 -1
- package/dist/h5/dd-manager.js +1 -1
- package/dist/h5/dd-manager.js.map +1 -1
- package/dist/h5/dd-resizable-handle.d.ts +2 -2
- package/dist/h5/dd-resizable-handle.js +2 -2
- package/dist/h5/dd-resizable-handle.js.map +1 -1
- package/dist/h5/dd-resizable.d.ts +2 -3
- package/dist/h5/dd-resizable.js +3 -4
- package/dist/h5/dd-resizable.js.map +1 -1
- package/dist/h5/dd-utils.d.ts +3 -1
- package/dist/h5/dd-utils.js +13 -1
- package/dist/h5/dd-utils.js.map +1 -1
- package/dist/h5/gridstack-dd-native.d.ts +2 -2
- package/dist/h5/gridstack-dd-native.js +2 -2
- package/dist/h5/gridstack-dd-native.js.map +1 -1
- package/dist/jq/gridstack-dd-jqueryui.js.map +1 -1
- package/dist/jq/jquery-ui.js +1 -1
- package/dist/jq/jquery-ui.js.map +1 -1
- package/dist/src/gridstack.scss +5 -4
- package/dist/types.d.ts +14 -6
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +15 -14
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +20 -0
- package/doc/README.md +17 -6
- package/package.json +4 -4
package/dist/es5/gridstack.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GridStack
|
|
2
|
+
* GridStack 5.1.1
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2021 Alain Dumesny
|
|
5
|
+
* Copyright (c) 2021-2022 Alain Dumesny
|
|
6
6
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
7
7
|
*/
|
|
8
8
|
import { GridStackEngine } from './gridstack-engine';
|
|
@@ -70,6 +70,11 @@ export declare class GridStack {
|
|
|
70
70
|
* @param opt grids options used to initialize the grid, and list of children
|
|
71
71
|
*/
|
|
72
72
|
static addGrid(parent: HTMLElement, opt?: GridStackOptions): GridStack;
|
|
73
|
+
/** call this method to register your engine instead of the default one.
|
|
74
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
75
|
+
* replace just one instance.
|
|
76
|
+
*/
|
|
77
|
+
static registerEngine(engineClass: typeof GridStackEngine): void;
|
|
73
78
|
/** scoping so users can call GridStack.Utils.sort() for example */
|
|
74
79
|
static Utils: typeof Utils;
|
|
75
80
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
@@ -80,6 +85,7 @@ export declare class GridStack {
|
|
|
80
85
|
engine: GridStackEngine;
|
|
81
86
|
/** grid options - public for classes to access, but use methods to modify! */
|
|
82
87
|
opts: GridStackOptions;
|
|
88
|
+
protected static engineClass: typeof GridStackEngine;
|
|
83
89
|
/**
|
|
84
90
|
* Construct a grid item from the given element and options
|
|
85
91
|
* @param el
|
|
@@ -149,7 +155,7 @@ export declare class GridStack {
|
|
|
149
155
|
/** Gets current cell width. */
|
|
150
156
|
cellWidth(): number;
|
|
151
157
|
/** return our expected width (or parent) for 1 column check */
|
|
152
|
-
|
|
158
|
+
protected _widthOrContainer(): number;
|
|
153
159
|
/**
|
|
154
160
|
* Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
|
|
155
161
|
*/
|
|
@@ -290,11 +296,11 @@ export declare class GridStack {
|
|
|
290
296
|
willItFit(node: GridStackWidget): boolean;
|
|
291
297
|
/**
|
|
292
298
|
* called when we are being resized by the window - check if the one Column Mode needs to be turned on/off
|
|
293
|
-
* and remember the prev columns we used, as well as check for auto cell height (square)
|
|
299
|
+
* and remember the prev columns we used, or get our count from parent, as well as check for auto cell height (square)
|
|
294
300
|
*/
|
|
295
301
|
onParentResize(): GridStack;
|
|
296
302
|
/** add or remove the window size event handler */
|
|
297
|
-
|
|
303
|
+
protected _updateWindowResizeEvent(forceRemove?: boolean): GridStack;
|
|
298
304
|
/**
|
|
299
305
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
300
306
|
* Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar
|
package/dist/es5/gridstack.js
CHANGED
|
@@ -30,10 +30,10 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.GridStack = void 0;
|
|
32
32
|
/*!
|
|
33
|
-
* GridStack
|
|
33
|
+
* GridStack 5.1.1
|
|
34
34
|
* https://gridstackjs.com/
|
|
35
35
|
*
|
|
36
|
-
* Copyright (c) 2021 Alain Dumesny
|
|
36
|
+
* Copyright (c) 2021-2022 Alain Dumesny
|
|
37
37
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
38
38
|
*/
|
|
39
39
|
var gridstack_engine_1 = require("./gridstack-engine");
|
|
@@ -59,7 +59,7 @@ var GridDefaults = {
|
|
|
59
59
|
cellHeightThrottle: 100,
|
|
60
60
|
margin: 10,
|
|
61
61
|
auto: true,
|
|
62
|
-
|
|
62
|
+
oneColumnSize: 768,
|
|
63
63
|
float: false,
|
|
64
64
|
staticGrid: false,
|
|
65
65
|
animate: true,
|
|
@@ -116,6 +116,17 @@ var GridStack = /** @class */ (function () {
|
|
|
116
116
|
delete opts.row;
|
|
117
117
|
}
|
|
118
118
|
var rowAttr = utils_1.Utils.toNumber(el.getAttribute('gs-row'));
|
|
119
|
+
// flag only valid in sub-grids (handled by parent, not here)
|
|
120
|
+
if (opts.column === 'auto') {
|
|
121
|
+
delete opts.column;
|
|
122
|
+
}
|
|
123
|
+
// 'minWidth' legacy support in 5.1
|
|
124
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
125
|
+
var anyOpts = opts;
|
|
126
|
+
if (anyOpts.minWidth !== undefined) {
|
|
127
|
+
opts.oneColumnSize = opts.oneColumnSize || anyOpts.minWidth;
|
|
128
|
+
delete anyOpts.minWidth;
|
|
129
|
+
}
|
|
119
130
|
// elements attributes override any passed options (like CSS style) - merge the two together
|
|
120
131
|
var defaults = __assign(__assign({}, utils_1.Utils.cloneDeep(GridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || 12, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || 0, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || 0, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || false, _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, resizable: {
|
|
121
132
|
autoHide: !(opts.alwaysShowResizeHandle || false),
|
|
@@ -132,10 +143,10 @@ var GridStack = /** @class */ (function () {
|
|
|
132
143
|
}
|
|
133
144
|
this.opts = utils_1.Utils.defaults(opts, defaults);
|
|
134
145
|
opts = null; // make sure we use this.opts instead
|
|
135
|
-
this.
|
|
146
|
+
this._initMargin(); // part of settings defaults...
|
|
136
147
|
// Now check if we're loading into 1 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)
|
|
137
|
-
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.
|
|
138
|
-
this._prevColumn = this.
|
|
148
|
+
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.oneColumnSize) {
|
|
149
|
+
this._prevColumn = this.getColumn();
|
|
139
150
|
this.opts.column = 1;
|
|
140
151
|
}
|
|
141
152
|
if (this.opts.rtl === 'auto') {
|
|
@@ -149,6 +160,7 @@ var GridStack = /** @class */ (function () {
|
|
|
149
160
|
if (parentGridItemEl && parentGridItemEl.gridstackNode) {
|
|
150
161
|
this.opts._isNested = parentGridItemEl.gridstackNode;
|
|
151
162
|
this.opts._isNested.subGrid = this;
|
|
163
|
+
parentGridItemEl.classList.add('grid-stack-nested');
|
|
152
164
|
this.el.classList.add('grid-stack-nested');
|
|
153
165
|
}
|
|
154
166
|
this._isAutoCellHeight = (this.opts.cellHeight === 'auto');
|
|
@@ -166,8 +178,9 @@ var GridStack = /** @class */ (function () {
|
|
|
166
178
|
}
|
|
167
179
|
this.el.classList.add(this.opts._styleSheetClass);
|
|
168
180
|
this._setStaticClass();
|
|
169
|
-
this.
|
|
170
|
-
|
|
181
|
+
var engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
|
|
182
|
+
this.engine = new engineClass({
|
|
183
|
+
column: this.getColumn(),
|
|
171
184
|
float: this.opts.float,
|
|
172
185
|
maxRow: this.opts.maxRow,
|
|
173
186
|
onChange: function (cbNodes) {
|
|
@@ -198,7 +211,7 @@ var GridStack = /** @class */ (function () {
|
|
|
198
211
|
elements_1.push({
|
|
199
212
|
el: el,
|
|
200
213
|
// if x,y are missing (autoPosition) add them to end of list - but keep their respective DOM order
|
|
201
|
-
i: (Number.isNaN(x) ? 1000 : x) + (Number.isNaN(y) ? 1000 : y) * _this.
|
|
214
|
+
i: (Number.isNaN(x) ? 1000 : x) + (Number.isNaN(y) ? 1000 : y) * _this.getColumn()
|
|
202
215
|
});
|
|
203
216
|
});
|
|
204
217
|
elements_1.sort(function (a, b) { return a.i - b.i; }).forEach(function (e) { return _this._prepareElement(e.el); });
|
|
@@ -305,6 +318,13 @@ var GridStack = /** @class */ (function () {
|
|
|
305
318
|
}
|
|
306
319
|
return grid;
|
|
307
320
|
};
|
|
321
|
+
/** call this method to register your engine instead of the default one.
|
|
322
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
323
|
+
* replace just one instance.
|
|
324
|
+
*/
|
|
325
|
+
GridStack.registerEngine = function (engineClass) {
|
|
326
|
+
GridStack.engineClass = engineClass;
|
|
327
|
+
};
|
|
308
328
|
Object.defineProperty(GridStack.prototype, "placeholder", {
|
|
309
329
|
/** @internal create placeholder DIV as needed */
|
|
310
330
|
get: function () {
|
|
@@ -385,8 +405,19 @@ var GridStack = /** @class */ (function () {
|
|
|
385
405
|
this._updateContainerHeight();
|
|
386
406
|
// check if nested grid definition is present
|
|
387
407
|
if (node.subGrid && !node.subGrid.el) { // see if there is a sub-grid to create too
|
|
408
|
+
// if column special case it set, remember that flag and set default
|
|
409
|
+
var autoColumn = void 0;
|
|
410
|
+
var ops = node.subGrid;
|
|
411
|
+
if (ops.column === 'auto') {
|
|
412
|
+
ops.column = node.w;
|
|
413
|
+
ops.disableOneColumnMode = true; // driven by parent
|
|
414
|
+
autoColumn = true;
|
|
415
|
+
}
|
|
388
416
|
var content = node.el.querySelector('.grid-stack-item-content');
|
|
389
417
|
node.subGrid = GridStack.addGrid(content, node.subGrid);
|
|
418
|
+
if (autoColumn) {
|
|
419
|
+
node.subGrid._autoColumn = true;
|
|
420
|
+
}
|
|
390
421
|
}
|
|
391
422
|
this._triggerAddEvent();
|
|
392
423
|
this._triggerChangeEvent();
|
|
@@ -442,6 +473,10 @@ var GridStack = /** @class */ (function () {
|
|
|
442
473
|
if (this._isAutoCellHeight) {
|
|
443
474
|
o.cellHeight = 'auto';
|
|
444
475
|
}
|
|
476
|
+
if (this._autoColumn) {
|
|
477
|
+
o.column = 'auto';
|
|
478
|
+
delete o.disableOneColumnMode;
|
|
479
|
+
}
|
|
445
480
|
utils_1.Utils.removeInternalAndSame(o, GridDefaults);
|
|
446
481
|
o.children = list;
|
|
447
482
|
return o;
|
|
@@ -461,7 +496,7 @@ var GridStack = /** @class */ (function () {
|
|
|
461
496
|
GridStack.prototype.load = function (layout, addAndRemove) {
|
|
462
497
|
var _this = this;
|
|
463
498
|
if (addAndRemove === void 0) { addAndRemove = true; }
|
|
464
|
-
var items = GridStack.Utils.sort(__spreadArrays(layout), -1, this._prevColumn || this.
|
|
499
|
+
var items = GridStack.Utils.sort(__spreadArrays(layout), -1, this._prevColumn || this.getColumn()); // make copy before we mod/sort
|
|
465
500
|
this._insertNotAppend = true; // since create in reverse order...
|
|
466
501
|
// if we're loading a layout into 1 column (_prevColumn is set only when going to 1) and items don't fit, make sure to save
|
|
467
502
|
// the original wanted layout so we can scale back up correctly #1471
|
|
@@ -532,12 +567,15 @@ var GridStack = /** @class */ (function () {
|
|
|
532
567
|
(!forcePixel || !this.opts.cellHeightUnit || this.opts.cellHeightUnit === 'px')) {
|
|
533
568
|
return this.opts.cellHeight;
|
|
534
569
|
}
|
|
535
|
-
// else
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
570
|
+
// else get first cell height
|
|
571
|
+
var el = this.el.querySelector('.' + this.opts.itemClass);
|
|
572
|
+
if (el) {
|
|
573
|
+
var height = utils_1.Utils.toNumber(el.getAttribute('gs-h'));
|
|
574
|
+
return Math.round(el.offsetHeight / height);
|
|
575
|
+
}
|
|
576
|
+
// else do entire grid and # of rows (but doesn't work if min-height is the actual constrain)
|
|
577
|
+
var rows = parseInt(this.el.getAttribute('gs-current-row'));
|
|
578
|
+
return rows ? Math.round(this.el.getBoundingClientRect().height / rows) : this.opts.cellHeight;
|
|
541
579
|
};
|
|
542
580
|
/**
|
|
543
581
|
* Update current cell height - see `GridStackOptions.cellHeight` for format.
|
|
@@ -584,7 +622,7 @@ var GridStack = /** @class */ (function () {
|
|
|
584
622
|
};
|
|
585
623
|
/** Gets current cell width. */
|
|
586
624
|
GridStack.prototype.cellWidth = function () {
|
|
587
|
-
return this._widthOrContainer() / this.
|
|
625
|
+
return this._widthOrContainer() / this.getColumn();
|
|
588
626
|
};
|
|
589
627
|
/** return our expected width (or parent) for 1 column check */
|
|
590
628
|
GridStack.prototype._widthOrContainer = function () {
|
|
@@ -621,7 +659,7 @@ var GridStack = /** @class */ (function () {
|
|
|
621
659
|
if (layout === void 0) { layout = 'moveScale'; }
|
|
622
660
|
if (column < 1 || this.opts.column === column)
|
|
623
661
|
return this;
|
|
624
|
-
var oldColumn = this.
|
|
662
|
+
var oldColumn = this.getColumn();
|
|
625
663
|
// if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)
|
|
626
664
|
// then remember the original columns so we can restore.
|
|
627
665
|
if (column === 1) {
|
|
@@ -733,7 +771,7 @@ var GridStack = /** @class */ (function () {
|
|
|
733
771
|
}
|
|
734
772
|
var relativeLeft = position.left - containerPos.left;
|
|
735
773
|
var relativeTop = position.top - containerPos.top;
|
|
736
|
-
var columnWidth = (box.width / this.
|
|
774
|
+
var columnWidth = (box.width / this.getColumn());
|
|
737
775
|
var rowHeight = (box.height / parseInt(this.el.getAttribute('gs-current-row')));
|
|
738
776
|
return { x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight) };
|
|
739
777
|
};
|
|
@@ -1003,7 +1041,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1003
1041
|
// re-use existing margin handling
|
|
1004
1042
|
this.opts.margin = value;
|
|
1005
1043
|
this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;
|
|
1006
|
-
this.
|
|
1044
|
+
this._initMargin();
|
|
1007
1045
|
this._updateStyles(true); // true = force re-create
|
|
1008
1046
|
return this;
|
|
1009
1047
|
};
|
|
@@ -1149,13 +1187,15 @@ var GridStack = /** @class */ (function () {
|
|
|
1149
1187
|
return this;
|
|
1150
1188
|
var row = this.getRow() + this._extraDragRow; // checks for minRow already
|
|
1151
1189
|
// check for css min height
|
|
1152
|
-
|
|
1153
|
-
if
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1190
|
+
// Note: we don't handle %,rem correctly so comment out, beside we don't need need to create un-necessary
|
|
1191
|
+
// rows as the CSS will make us bigger than our set height if needed... not sure why we had this.
|
|
1192
|
+
// let cssMinHeight = parseInt(getComputedStyle(this.el)['min-height']);
|
|
1193
|
+
// if (cssMinHeight > 0) {
|
|
1194
|
+
// let minRow = Math.round(cssMinHeight / this.getCellHeight(true));
|
|
1195
|
+
// if (row < minRow) {
|
|
1196
|
+
// row = minRow;
|
|
1197
|
+
// }
|
|
1198
|
+
// }
|
|
1159
1199
|
this.el.setAttribute('gs-current-row', String(row));
|
|
1160
1200
|
if (row === 0) {
|
|
1161
1201
|
this.el.style.removeProperty('height');
|
|
@@ -1273,34 +1313,44 @@ var GridStack = /** @class */ (function () {
|
|
|
1273
1313
|
};
|
|
1274
1314
|
/**
|
|
1275
1315
|
* called when we are being resized by the window - check if the one Column Mode needs to be turned on/off
|
|
1276
|
-
* and remember the prev columns we used, as well as check for auto cell height (square)
|
|
1316
|
+
* and remember the prev columns we used, or get our count from parent, as well as check for auto cell height (square)
|
|
1277
1317
|
*/
|
|
1278
1318
|
GridStack.prototype.onParentResize = function () {
|
|
1279
1319
|
var _this = this;
|
|
1280
1320
|
if (!this.el || !this.el.clientWidth)
|
|
1281
1321
|
return; // return if we're gone or no size yet (will get called again)
|
|
1282
|
-
var
|
|
1283
|
-
|
|
1284
|
-
if (
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
this.
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1322
|
+
var changedColumn = false;
|
|
1323
|
+
// see if we're nested and take our column count from our parent....
|
|
1324
|
+
if (this._autoColumn && this.opts._isNested) {
|
|
1325
|
+
if (this.opts.column !== this.opts._isNested.w) {
|
|
1326
|
+
changedColumn = true;
|
|
1327
|
+
this.column(this.opts._isNested.w, 'none');
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
else {
|
|
1331
|
+
// else check for 1 column in/out behavior
|
|
1332
|
+
var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize;
|
|
1333
|
+
if ((this.opts.column === 1) !== oneColumn) {
|
|
1334
|
+
changedColumn = true;
|
|
1335
|
+
if (this.opts.animate) {
|
|
1336
|
+
this.setAnimation(false);
|
|
1337
|
+
} // 1 <-> 12 is too radical, turn off animation
|
|
1338
|
+
this.column(oneColumn ? 1 : this._prevColumn);
|
|
1339
|
+
if (this.opts.animate) {
|
|
1340
|
+
this.setAnimation(true);
|
|
1341
|
+
}
|
|
1292
1342
|
}
|
|
1293
1343
|
}
|
|
1294
1344
|
// make the cells content square again
|
|
1295
1345
|
if (this._isAutoCellHeight) {
|
|
1296
|
-
if (!
|
|
1346
|
+
if (!changedColumn && this.opts.cellHeightThrottle) {
|
|
1297
1347
|
if (!this._cellHeightThrottle) {
|
|
1298
1348
|
this._cellHeightThrottle = utils_1.Utils.throttle(function () { return _this.cellHeight(); }, this.opts.cellHeightThrottle);
|
|
1299
1349
|
}
|
|
1300
1350
|
this._cellHeightThrottle();
|
|
1301
1351
|
}
|
|
1302
1352
|
else {
|
|
1303
|
-
// immediate update if we've changed
|
|
1353
|
+
// immediate update if we've changed column count or have no threshold
|
|
1304
1354
|
this.cellHeight();
|
|
1305
1355
|
}
|
|
1306
1356
|
}
|
|
@@ -1342,7 +1392,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1342
1392
|
/** @internal */
|
|
1343
1393
|
GridStack.getGridElements = function (els) { return utils_1.Utils.getElements(els); };
|
|
1344
1394
|
/** @internal initialize margin top/bottom/left/right and units */
|
|
1345
|
-
GridStack.prototype.
|
|
1395
|
+
GridStack.prototype._initMargin = function () {
|
|
1346
1396
|
var data;
|
|
1347
1397
|
var margin = 0;
|
|
1348
1398
|
// support passing multiple values like CSS (ex: '5px 10px 0 20px')
|