gridstack 4.3.0 → 5.0.0
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 +22 -5
- package/dist/es5/gridstack-dd.d.ts +35 -0
- package/dist/es5/gridstack-dd.js +686 -0
- package/dist/es5/gridstack-dd.js.map +1 -0
- package/dist/es5/gridstack-ddi.d.ts +17 -0
- package/dist/es5/gridstack-ddi.js +31 -0
- package/dist/es5/gridstack-ddi.js.map +1 -0
- package/dist/es5/gridstack-engine.d.ts +93 -0
- package/dist/es5/gridstack-engine.js +955 -0
- package/dist/es5/gridstack-engine.js.map +1 -0
- package/dist/es5/gridstack-h5.d.ts +10 -0
- package/dist/es5/gridstack-h5.js +3 -0
- package/dist/es5/gridstack-h5.js.LICENSE.txt +7 -0
- package/dist/es5/gridstack-h5.js.map +1 -0
- package/dist/es5/gridstack-jq.d.ts +10 -0
- package/dist/es5/gridstack-jq.js +3 -0
- package/dist/es5/gridstack-jq.js.LICENSE.txt +99 -0
- package/dist/es5/gridstack-jq.js.map +1 -0
- package/dist/{gridstack-poly.js → es5/gridstack-poly.js} +154 -3
- package/dist/es5/gridstack-static.d.ts +9 -0
- package/dist/es5/gridstack-static.js +3 -0
- package/dist/es5/gridstack-static.js.LICENSE.txt +7 -0
- package/dist/es5/gridstack-static.js.map +1 -0
- package/dist/es5/gridstack.d.ts +346 -0
- package/dist/es5/gridstack.js +1517 -0
- package/dist/es5/gridstack.js.map +1 -0
- package/dist/es5/h5/dd-base-impl.d.ts +20 -0
- package/dist/es5/h5/dd-base-impl.js +43 -0
- package/dist/es5/h5/dd-base-impl.js.map +1 -0
- package/dist/es5/h5/dd-draggable.d.ts +29 -0
- package/dist/es5/h5/dd-draggable.js +329 -0
- package/dist/es5/h5/dd-draggable.js.map +1 -0
- package/dist/es5/h5/dd-droppable.d.ts +24 -0
- package/dist/es5/h5/dd-droppable.js +199 -0
- package/dist/es5/h5/dd-droppable.js.map +1 -0
- package/dist/es5/h5/dd-element.d.ts +27 -0
- package/dist/es5/h5/dd-element.js +96 -0
- package/dist/es5/h5/dd-element.js.map +1 -0
- package/dist/es5/h5/dd-manager.d.ts +8 -0
- package/dist/es5/h5/dd-manager.js +14 -0
- package/dist/es5/h5/dd-manager.js.map +1 -0
- package/dist/es5/h5/dd-resizable-handle.d.ts +14 -0
- package/dist/es5/h5/dd-resizable-handle.js +83 -0
- package/dist/es5/h5/dd-resizable-handle.js.map +1 -0
- package/dist/es5/h5/dd-resizable.d.ts +28 -0
- package/dist/es5/h5/dd-resizable.js +301 -0
- package/dist/es5/h5/dd-resizable.js.map +1 -0
- package/dist/es5/h5/dd-utils.d.ts +19 -0
- package/dist/es5/h5/dd-utils.js +111 -0
- package/dist/es5/h5/dd-utils.js.map +1 -0
- package/dist/es5/h5/gridstack-dd-native.d.ts +26 -0
- package/dist/es5/h5/gridstack-dd-native.js +175 -0
- package/dist/es5/h5/gridstack-dd-native.js.map +1 -0
- package/dist/es5/jq/gridstack-dd-jqueryui.d.ts +22 -0
- package/dist/es5/jq/gridstack-dd-jqueryui.js +162 -0
- package/dist/es5/jq/gridstack-dd-jqueryui.js.map +1 -0
- package/dist/es5/types.d.ts +263 -0
- package/dist/es5/types.js +7 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/es5/utils.d.ts +73 -0
- package/dist/es5/utils.js +445 -0
- package/dist/es5/utils.js.map +1 -0
- package/dist/gridstack-dd.d.ts +1 -1
- package/dist/gridstack-dd.js +27 -16
- 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 +3 -2
- package/dist/gridstack-engine.js +83 -53
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/gridstack-static.js.map +1 -1
- package/dist/gridstack.css +1 -5
- package/dist/gridstack.d.ts +2 -2
- package/dist/gridstack.js +81 -44
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/h5/dd-base-impl.d.ts +1 -1
- package/dist/h5/dd-base-impl.js +1 -1
- package/dist/h5/dd-base-impl.js.map +1 -1
- package/dist/h5/dd-draggable.d.ts +1 -2
- package/dist/h5/dd-draggable.js +26 -16
- package/dist/h5/dd-draggable.js.map +1 -1
- package/dist/h5/dd-droppable.d.ts +2 -1
- package/dist/h5/dd-droppable.js +42 -25
- 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 +1 -1
- package/dist/h5/dd-resizable-handle.js +1 -1
- package/dist/h5/dd-resizable-handle.js.map +1 -1
- package/dist/h5/dd-resizable.d.ts +1 -2
- package/dist/h5/dd-resizable.js +3 -3
- 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 +1 -1
- package/dist/h5/gridstack-dd-native.js +1 -1
- package/dist/h5/gridstack-dd-native.js.map +1 -1
- package/dist/jq/gridstack-dd-jqueryui.js.map +1 -1
- package/dist/src/gridstack.scss +6 -5
- package/dist/types.d.ts +12 -4
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +4 -2
- package/dist/utils.js +7 -6
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +24 -0
- package/doc/README.md +10 -5
- package/package.json +5 -3
package/dist/gridstack.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gridstack SASS styles
|
|
2
|
+
* gridstack SASS styles 5.0
|
|
3
3
|
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
5
|
:root .grid-stack-item > .ui-resizable-handle {
|
|
@@ -111,7 +111,6 @@
|
|
|
111
111
|
cursor: sw-resize;
|
|
112
112
|
width: 20px;
|
|
113
113
|
height: 20px;
|
|
114
|
-
bottom: 0;
|
|
115
114
|
}
|
|
116
115
|
.grid-stack > .grid-stack-item > .ui-resizable-w {
|
|
117
116
|
cursor: w-resize;
|
|
@@ -306,7 +305,4 @@
|
|
|
306
305
|
-ms-transition: left 0s, top 0s, height 0s, width 0s;
|
|
307
306
|
-o-transition: left 0s, top 0s, height 0s, width 0s;
|
|
308
307
|
transition: left 0s, top 0s, height 0s, width 0s;
|
|
309
|
-
}
|
|
310
|
-
.grid-stack.ui-droppable.ui-droppable-over > *:not(.ui-droppable) {
|
|
311
|
-
pointer-events: none;
|
|
312
308
|
}
|
package/dist/gridstack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GridStack
|
|
2
|
+
* GridStack 5.0
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021 Alain Dumesny
|
|
@@ -290,7 +290,7 @@ export declare class GridStack {
|
|
|
290
290
|
willItFit(node: GridStackWidget): boolean;
|
|
291
291
|
/**
|
|
292
292
|
* 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)
|
|
293
|
+
* and remember the prev columns we used, or get our count from parent, as well as check for auto cell height (square)
|
|
294
294
|
*/
|
|
295
295
|
onParentResize(): GridStack;
|
|
296
296
|
/** add or remove the window size event handler */
|
package/dist/gridstack.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* GridStack 4.3.0
|
|
4
|
-
* https://gridstackjs.com/
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021 Alain Dumesny
|
|
7
|
-
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
8
|
-
*/
|
|
9
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
3
|
if (k2 === undefined) k2 = k;
|
|
11
4
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -18,6 +11,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
11
|
};
|
|
19
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
13
|
exports.GridStack = void 0;
|
|
14
|
+
/*!
|
|
15
|
+
* GridStack 5.0
|
|
16
|
+
* https://gridstackjs.com/
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) 2021 Alain Dumesny
|
|
19
|
+
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
20
|
+
*/
|
|
21
21
|
const gridstack_engine_1 = require("./gridstack-engine");
|
|
22
22
|
const utils_1 = require("./utils");
|
|
23
23
|
const gridstack_ddi_1 = require("./gridstack-ddi");
|
|
@@ -96,6 +96,10 @@ class GridStack {
|
|
|
96
96
|
delete opts.row;
|
|
97
97
|
}
|
|
98
98
|
let rowAttr = utils_1.Utils.toNumber(el.getAttribute('gs-row'));
|
|
99
|
+
// flag only valid in sub-grids (handled by parent, not here)
|
|
100
|
+
if (opts.column === 'auto') {
|
|
101
|
+
delete opts.column;
|
|
102
|
+
}
|
|
99
103
|
// elements attributes override any passed options (like CSS style) - merge the two together
|
|
100
104
|
let defaults = Object.assign(Object.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: {
|
|
101
105
|
autoHide: !(opts.alwaysShowResizeHandle || false),
|
|
@@ -115,7 +119,7 @@ class GridStack {
|
|
|
115
119
|
this.initMargin(); // part of settings defaults...
|
|
116
120
|
// 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)
|
|
117
121
|
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.minWidth) {
|
|
118
|
-
this._prevColumn = this.
|
|
122
|
+
this._prevColumn = this.getColumn();
|
|
119
123
|
this.opts.column = 1;
|
|
120
124
|
}
|
|
121
125
|
if (this.opts.rtl === 'auto') {
|
|
@@ -129,6 +133,7 @@ class GridStack {
|
|
|
129
133
|
if (parentGridItemEl && parentGridItemEl.gridstackNode) {
|
|
130
134
|
this.opts._isNested = parentGridItemEl.gridstackNode;
|
|
131
135
|
this.opts._isNested.subGrid = this;
|
|
136
|
+
parentGridItemEl.classList.add('grid-stack-nested');
|
|
132
137
|
this.el.classList.add('grid-stack-nested');
|
|
133
138
|
}
|
|
134
139
|
this._isAutoCellHeight = (this.opts.cellHeight === 'auto');
|
|
@@ -147,7 +152,7 @@ class GridStack {
|
|
|
147
152
|
this.el.classList.add(this.opts._styleSheetClass);
|
|
148
153
|
this._setStaticClass();
|
|
149
154
|
this.engine = new gridstack_engine_1.GridStackEngine({
|
|
150
|
-
column: this.
|
|
155
|
+
column: this.getColumn(),
|
|
151
156
|
float: this.opts.float,
|
|
152
157
|
maxRow: this.opts.maxRow,
|
|
153
158
|
onChange: (cbNodes) => {
|
|
@@ -155,6 +160,8 @@ class GridStack {
|
|
|
155
160
|
this.engine.nodes.forEach(n => { maxH = Math.max(maxH, n.y + n.h); });
|
|
156
161
|
cbNodes.forEach(n => {
|
|
157
162
|
let el = n.el;
|
|
163
|
+
if (!el)
|
|
164
|
+
return;
|
|
158
165
|
if (n._removeDOM) {
|
|
159
166
|
if (el)
|
|
160
167
|
el.remove();
|
|
@@ -176,7 +183,7 @@ class GridStack {
|
|
|
176
183
|
elements.push({
|
|
177
184
|
el,
|
|
178
185
|
// if x,y are missing (autoPosition) add them to end of list - but keep their respective DOM order
|
|
179
|
-
i: (Number.isNaN(x) ? 1000 : x) + (Number.isNaN(y) ? 1000 : y) * this.
|
|
186
|
+
i: (Number.isNaN(x) ? 1000 : x) + (Number.isNaN(y) ? 1000 : y) * this.getColumn()
|
|
180
187
|
});
|
|
181
188
|
});
|
|
182
189
|
elements.sort((a, b) => a.i - b.i).forEach(e => this._prepareElement(e.el));
|
|
@@ -264,7 +271,7 @@ class GridStack {
|
|
|
264
271
|
// create the grid element, but check if the passed 'parent' already has grid styling and should be used instead
|
|
265
272
|
let el = parent;
|
|
266
273
|
if (!parent.classList.contains('grid-stack')) {
|
|
267
|
-
let doc = document.implementation.createHTMLDocument();
|
|
274
|
+
let doc = document.implementation.createHTMLDocument(''); // IE needs a param
|
|
268
275
|
doc.body.innerHTML = `<div class="grid-stack ${opt.class || ''}"></div>`;
|
|
269
276
|
el = doc.body.children[0];
|
|
270
277
|
parent.appendChild(el);
|
|
@@ -321,14 +328,14 @@ class GridStack {
|
|
|
321
328
|
}
|
|
322
329
|
let el;
|
|
323
330
|
if (typeof els === 'string') {
|
|
324
|
-
let doc = document.implementation.createHTMLDocument();
|
|
331
|
+
let doc = document.implementation.createHTMLDocument(''); // IE needs a param
|
|
325
332
|
doc.body.innerHTML = els;
|
|
326
333
|
el = doc.body.children[0];
|
|
327
334
|
}
|
|
328
335
|
else if (arguments.length === 0 || arguments.length === 1 && isGridStackWidget(els)) {
|
|
329
336
|
let content = els ? els.content || '' : '';
|
|
330
337
|
options = els;
|
|
331
|
-
let doc = document.implementation.createHTMLDocument();
|
|
338
|
+
let doc = document.implementation.createHTMLDocument(''); // IE needs a param
|
|
332
339
|
doc.body.innerHTML = `<div class="grid-stack-item ${this.opts.itemClass || ''}"><div class="grid-stack-item-content">${content}</div></div>`;
|
|
333
340
|
el = doc.body.children[0];
|
|
334
341
|
}
|
|
@@ -354,8 +361,19 @@ class GridStack {
|
|
|
354
361
|
this._updateContainerHeight();
|
|
355
362
|
// check if nested grid definition is present
|
|
356
363
|
if (node.subGrid && !node.subGrid.el) { // see if there is a sub-grid to create too
|
|
364
|
+
// if column special case it set, remember that flag and set default
|
|
365
|
+
let autoColumn;
|
|
366
|
+
let ops = node.subGrid;
|
|
367
|
+
if (ops.column === 'auto') {
|
|
368
|
+
ops.column = node.w;
|
|
369
|
+
ops.disableOneColumnMode = true; // driven by parent
|
|
370
|
+
autoColumn = true;
|
|
371
|
+
}
|
|
357
372
|
let content = node.el.querySelector('.grid-stack-item-content');
|
|
358
373
|
node.subGrid = GridStack.addGrid(content, node.subGrid);
|
|
374
|
+
if (autoColumn) {
|
|
375
|
+
node.subGrid._autoColumn = true;
|
|
376
|
+
}
|
|
359
377
|
}
|
|
360
378
|
this._triggerAddEvent();
|
|
361
379
|
this._triggerChangeEvent();
|
|
@@ -409,6 +427,10 @@ class GridStack {
|
|
|
409
427
|
if (this._isAutoCellHeight) {
|
|
410
428
|
o.cellHeight = 'auto';
|
|
411
429
|
}
|
|
430
|
+
if (this._autoColumn) {
|
|
431
|
+
o.column = 'auto';
|
|
432
|
+
delete o.disableOneColumnMode;
|
|
433
|
+
}
|
|
412
434
|
utils_1.Utils.removeInternalAndSame(o, GridDefaults);
|
|
413
435
|
o.children = list;
|
|
414
436
|
return o;
|
|
@@ -426,7 +448,7 @@ class GridStack {
|
|
|
426
448
|
* see http://gridstackjs.com/demo/serialization.html
|
|
427
449
|
**/
|
|
428
450
|
load(layout, addAndRemove = true) {
|
|
429
|
-
let items = GridStack.Utils.sort([...layout], -1, this._prevColumn || this.
|
|
451
|
+
let items = GridStack.Utils.sort([...layout], -1, this._prevColumn || this.getColumn()); // make copy before we mod/sort
|
|
430
452
|
this._insertNotAppend = true; // since create in reverse order...
|
|
431
453
|
// 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
|
|
432
454
|
// the original wanted layout so we can scale back up correctly #1471
|
|
@@ -496,12 +518,15 @@ class GridStack {
|
|
|
496
518
|
(!forcePixel || !this.opts.cellHeightUnit || this.opts.cellHeightUnit === 'px')) {
|
|
497
519
|
return this.opts.cellHeight;
|
|
498
520
|
}
|
|
499
|
-
// else
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
521
|
+
// else get first cell height
|
|
522
|
+
let el = this.el.querySelector('.' + this.opts.itemClass);
|
|
523
|
+
if (el) {
|
|
524
|
+
let height = utils_1.Utils.toNumber(el.getAttribute('gs-h'));
|
|
525
|
+
return Math.round(el.offsetHeight / height);
|
|
526
|
+
}
|
|
527
|
+
// else do entire grid and # of rows (but doesn't work if min-height is the actual constrain)
|
|
528
|
+
let rows = parseInt(this.el.getAttribute('gs-current-row'));
|
|
529
|
+
return rows ? Math.round(this.el.getBoundingClientRect().height / rows) : this.opts.cellHeight;
|
|
505
530
|
}
|
|
506
531
|
/**
|
|
507
532
|
* Update current cell height - see `GridStackOptions.cellHeight` for format.
|
|
@@ -547,7 +572,7 @@ class GridStack {
|
|
|
547
572
|
}
|
|
548
573
|
/** Gets current cell width. */
|
|
549
574
|
cellWidth() {
|
|
550
|
-
return this._widthOrContainer() / this.
|
|
575
|
+
return this._widthOrContainer() / this.getColumn();
|
|
551
576
|
}
|
|
552
577
|
/** return our expected width (or parent) for 1 column check */
|
|
553
578
|
_widthOrContainer() {
|
|
@@ -581,9 +606,9 @@ class GridStack {
|
|
|
581
606
|
* Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column
|
|
582
607
|
*/
|
|
583
608
|
column(column, layout = 'moveScale') {
|
|
584
|
-
if (this.opts.column === column)
|
|
609
|
+
if (column < 1 || this.opts.column === column)
|
|
585
610
|
return this;
|
|
586
|
-
let oldColumn = this.
|
|
611
|
+
let oldColumn = this.getColumn();
|
|
587
612
|
// if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)
|
|
588
613
|
// then remember the original columns so we can restore.
|
|
589
614
|
if (column === 1) {
|
|
@@ -692,7 +717,7 @@ class GridStack {
|
|
|
692
717
|
}
|
|
693
718
|
let relativeLeft = position.left - containerPos.left;
|
|
694
719
|
let relativeTop = position.top - containerPos.top;
|
|
695
|
-
let columnWidth = (box.width / this.
|
|
720
|
+
let columnWidth = (box.width / this.getColumn());
|
|
696
721
|
let rowHeight = (box.height / parseInt(this.el.getAttribute('gs-current-row')));
|
|
697
722
|
return { x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight) };
|
|
698
723
|
}
|
|
@@ -1098,13 +1123,15 @@ class GridStack {
|
|
|
1098
1123
|
return this;
|
|
1099
1124
|
let row = this.getRow() + this._extraDragRow; // checks for minRow already
|
|
1100
1125
|
// check for css min height
|
|
1101
|
-
|
|
1102
|
-
if
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1126
|
+
// Note: we don't handle %,rem correctly so comment out, beside we don't need need to create un-necessary
|
|
1127
|
+
// rows as the CSS will make us bigger than our set height if needed... not sure why we had this.
|
|
1128
|
+
// let cssMinHeight = parseInt(getComputedStyle(this.el)['min-height']);
|
|
1129
|
+
// if (cssMinHeight > 0) {
|
|
1130
|
+
// let minRow = Math.round(cssMinHeight / this.getCellHeight(true));
|
|
1131
|
+
// if (row < minRow) {
|
|
1132
|
+
// row = minRow;
|
|
1133
|
+
// }
|
|
1134
|
+
// }
|
|
1108
1135
|
this.el.setAttribute('gs-current-row', String(row));
|
|
1109
1136
|
if (row === 0) {
|
|
1110
1137
|
this.el.style.removeProperty('height');
|
|
@@ -1220,33 +1247,43 @@ class GridStack {
|
|
|
1220
1247
|
}
|
|
1221
1248
|
/**
|
|
1222
1249
|
* called when we are being resized by the window - check if the one Column Mode needs to be turned on/off
|
|
1223
|
-
* and remember the prev columns we used, as well as check for auto cell height (square)
|
|
1250
|
+
* and remember the prev columns we used, or get our count from parent, as well as check for auto cell height (square)
|
|
1224
1251
|
*/
|
|
1225
1252
|
onParentResize() {
|
|
1226
1253
|
if (!this.el || !this.el.clientWidth)
|
|
1227
1254
|
return; // return if we're gone or no size yet (will get called again)
|
|
1228
|
-
let
|
|
1229
|
-
|
|
1230
|
-
if (
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
this.
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1255
|
+
let changedColumn = false;
|
|
1256
|
+
// see if we're nested and take our column count from our parent....
|
|
1257
|
+
if (this._autoColumn && this.opts._isNested) {
|
|
1258
|
+
if (this.opts.column !== this.opts._isNested.w) {
|
|
1259
|
+
changedColumn = true;
|
|
1260
|
+
this.column(this.opts._isNested.w, 'none');
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
else {
|
|
1264
|
+
// else check for 1 column in/out behavior
|
|
1265
|
+
let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.minWidth;
|
|
1266
|
+
if ((this.opts.column === 1) !== oneColumn) {
|
|
1267
|
+
changedColumn = true;
|
|
1268
|
+
if (this.opts.animate) {
|
|
1269
|
+
this.setAnimation(false);
|
|
1270
|
+
} // 1 <-> 12 is too radical, turn off animation
|
|
1271
|
+
this.column(oneColumn ? 1 : this._prevColumn);
|
|
1272
|
+
if (this.opts.animate) {
|
|
1273
|
+
this.setAnimation(true);
|
|
1274
|
+
}
|
|
1238
1275
|
}
|
|
1239
1276
|
}
|
|
1240
1277
|
// make the cells content square again
|
|
1241
1278
|
if (this._isAutoCellHeight) {
|
|
1242
|
-
if (!
|
|
1279
|
+
if (!changedColumn && this.opts.cellHeightThrottle) {
|
|
1243
1280
|
if (!this._cellHeightThrottle) {
|
|
1244
1281
|
this._cellHeightThrottle = utils_1.Utils.throttle(() => this.cellHeight(), this.opts.cellHeightThrottle);
|
|
1245
1282
|
}
|
|
1246
1283
|
this._cellHeightThrottle();
|
|
1247
1284
|
}
|
|
1248
1285
|
else {
|
|
1249
|
-
// immediate update if we've changed
|
|
1286
|
+
// immediate update if we've changed column count or have no threshold
|
|
1250
1287
|
this.cellHeight();
|
|
1251
1288
|
}
|
|
1252
1289
|
}
|