gridstack 6.0.2 → 7.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 +6 -1
- package/dist/dd-base-impl.d.ts +1 -1
- package/dist/dd-base-impl.js +1 -1
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +1 -1
- package/dist/dd-draggable.js +35 -13
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +4 -4
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +1 -1
- package/dist/dd-element.js +1 -1
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +1 -1
- package/dist/dd-gridstack.js +35 -24
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +3 -1
- package/dist/dd-manager.js +1 -1
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +1 -1
- package/dist/dd-resizable-handle.js +1 -1
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +1 -1
- package/dist/dd-resizable.js +1 -1
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +1 -1
- package/dist/dd-touch.js +1 -1
- package/dist/dd-touch.js.map +1 -1
- package/dist/es5/dd-base-impl.d.ts +1 -1
- package/dist/es5/dd-base-impl.js +1 -1
- package/dist/es5/dd-base-impl.js.map +1 -1
- package/dist/es5/dd-draggable.d.ts +1 -1
- package/dist/es5/dd-draggable.js +36 -13
- package/dist/es5/dd-draggable.js.map +1 -1
- package/dist/es5/dd-droppable.d.ts +1 -1
- package/dist/es5/dd-droppable.js +4 -4
- package/dist/es5/dd-droppable.js.map +1 -1
- package/dist/es5/dd-element.d.ts +1 -1
- package/dist/es5/dd-element.js +1 -1
- package/dist/es5/dd-element.js.map +1 -1
- package/dist/es5/dd-gridstack.d.ts +1 -1
- package/dist/es5/dd-gridstack.js +35 -24
- package/dist/es5/dd-gridstack.js.map +1 -1
- package/dist/es5/dd-manager.d.ts +3 -1
- package/dist/es5/dd-manager.js +1 -1
- package/dist/es5/dd-manager.js.map +1 -1
- package/dist/es5/dd-resizable-handle.d.ts +1 -1
- package/dist/es5/dd-resizable-handle.js +1 -1
- package/dist/es5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/dd-resizable.d.ts +1 -1
- package/dist/es5/dd-resizable.js +1 -1
- package/dist/es5/dd-resizable.js.map +1 -1
- package/dist/es5/dd-touch.d.ts +1 -1
- package/dist/es5/dd-touch.js +1 -1
- package/dist/es5/dd-touch.js.map +1 -1
- package/dist/es5/gridstack-all.js +1 -1
- package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/es5/gridstack-all.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +4 -3
- package/dist/es5/gridstack-engine.js +45 -28
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +20 -4
- package/dist/es5/gridstack.js +144 -45
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +11 -10
- package/dist/es5/types.js +8 -3
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +10 -2
- package/dist/es5/utils.js +64 -3
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack-engine.d.ts +4 -3
- package/dist/gridstack-engine.js +45 -28
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +20 -4
- package/dist/gridstack.js +142 -45
- package/dist/gridstack.js.map +1 -1
- package/dist/src/gridstack.scss +2 -2
- package/dist/types.d.ts +11 -10
- package/dist/types.js +8 -3
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +10 -2
- package/dist/utils.js +63 -3
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +14 -0
- package/doc/README.md +3 -2
- package/package.json +1 -1
package/dist/gridstack.js
CHANGED
|
@@ -12,7 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.GridStack = void 0;
|
|
14
14
|
/*!
|
|
15
|
-
* GridStack
|
|
15
|
+
* GridStack 7.0.0
|
|
16
16
|
* https://gridstackjs.com/
|
|
17
17
|
*
|
|
18
18
|
* Copyright (c) 2021-2022 Alain Dumesny
|
|
@@ -42,6 +42,7 @@ class GridStack {
|
|
|
42
42
|
* @param opts
|
|
43
43
|
*/
|
|
44
44
|
constructor(el, opts = {}) {
|
|
45
|
+
var _a, _b;
|
|
45
46
|
/** @internal */
|
|
46
47
|
this._gsEventHandler = {};
|
|
47
48
|
/** @internal extra row added when dragging at the bottom of the grid */
|
|
@@ -70,10 +71,10 @@ class GridStack {
|
|
|
70
71
|
opts._alwaysShowResizeHandle = opts.alwaysShowResizeHandle;
|
|
71
72
|
}
|
|
72
73
|
// elements DOM attributes override any passed options (like CSS style) - merge the two together
|
|
73
|
-
let defaults = Object.assign(Object.assign({}, utils_1.Utils.cloneDeep(types_1.
|
|
74
|
-
handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || types_1.
|
|
74
|
+
let defaults = Object.assign(Object.assign({}, utils_1.Utils.cloneDeep(types_1.gridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || types_1.gridDefaults.column, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || types_1.gridDefaults.minRow, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || types_1.gridDefaults.maxRow, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || types_1.gridDefaults.staticGrid, draggable: {
|
|
75
|
+
handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || types_1.gridDefaults.draggable.handle,
|
|
75
76
|
}, removableOptions: {
|
|
76
|
-
accept: opts.itemClass ? '.' + opts.itemClass : types_1.
|
|
77
|
+
accept: opts.itemClass ? '.' + opts.itemClass : types_1.gridDefaults.removableOptions.accept,
|
|
77
78
|
} });
|
|
78
79
|
if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead
|
|
79
80
|
defaults.animate = utils_1.Utils.toBool(el.getAttribute('gs-animate'));
|
|
@@ -93,12 +94,12 @@ class GridStack {
|
|
|
93
94
|
this.el.classList.add('grid-stack-rtl');
|
|
94
95
|
}
|
|
95
96
|
// check if we're been nested, and if so update our style and keep pointer around (used during save)
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
-
parentGridItemEl.classList.add('grid-stack-nested');
|
|
97
|
+
let parentGridItem = (_a = utils_1.Utils.closestUpByClass(this.el, types_1.gridDefaults.itemClass)) === null || _a === void 0 ? void 0 : _a.gridstackNode;
|
|
98
|
+
if (parentGridItem) {
|
|
99
|
+
parentGridItem.subGrid = this;
|
|
100
|
+
this.parentGridItem = parentGridItem;
|
|
101
101
|
this.el.classList.add('grid-stack-nested');
|
|
102
|
+
parentGridItem.el.classList.add('grid-stack-sub-grid');
|
|
102
103
|
}
|
|
103
104
|
this._isAutoCellHeight = (this.opts.cellHeight === 'auto');
|
|
104
105
|
if (this._isAutoCellHeight || this.opts.cellHeight === 'initial') {
|
|
@@ -107,7 +108,7 @@ class GridStack {
|
|
|
107
108
|
}
|
|
108
109
|
else {
|
|
109
110
|
// append unit if any are set
|
|
110
|
-
if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== types_1.
|
|
111
|
+
if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== types_1.gridDefaults.cellHeightUnit) {
|
|
111
112
|
this.opts.cellHeight = this.opts.cellHeight + this.opts.cellHeightUnit;
|
|
112
113
|
delete this.opts.cellHeightUnit;
|
|
113
114
|
}
|
|
@@ -117,7 +118,7 @@ class GridStack {
|
|
|
117
118
|
if (this.opts.alwaysShowResizeHandle === 'mobile') {
|
|
118
119
|
this.opts.alwaysShowResizeHandle = dd_touch_1.isTouch;
|
|
119
120
|
}
|
|
120
|
-
this._styleSheetClass = 'grid-stack-instance-' +
|
|
121
|
+
this._styleSheetClass = 'grid-stack-instance-' + gridstack_engine_1.GridStackEngine._idSeq++;
|
|
121
122
|
this.el.classList.add(this._styleSheetClass);
|
|
122
123
|
this._setStaticClass();
|
|
123
124
|
let engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
|
|
@@ -169,6 +170,11 @@ class GridStack {
|
|
|
169
170
|
GridStack.setupDragIn(this.opts.dragIn, this.opts.dragInOptions);
|
|
170
171
|
delete this.opts.dragIn;
|
|
171
172
|
delete this.opts.dragInOptions;
|
|
173
|
+
// dynamic grids require pausing during drag to detect over to nest vs push
|
|
174
|
+
if (this.opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
|
|
175
|
+
dd_manager_1.DDManager.pauseDrag = true;
|
|
176
|
+
if (((_b = this.opts.draggable) === null || _b === void 0 ? void 0 : _b.pause) !== undefined)
|
|
177
|
+
dd_manager_1.DDManager.pauseDrag = this.opts.draggable.pause;
|
|
172
178
|
this._setupRemoveDrop();
|
|
173
179
|
this._setupAcceptWidget();
|
|
174
180
|
this._updateWindowResizeEvent();
|
|
@@ -271,7 +277,7 @@ class GridStack {
|
|
|
271
277
|
placeholderChild.innerHTML = this.opts.placeholderText;
|
|
272
278
|
}
|
|
273
279
|
this._placeholder = document.createElement('div');
|
|
274
|
-
this._placeholder.classList.add(this.opts.placeholderClass, types_1.
|
|
280
|
+
this._placeholder.classList.add(this.opts.placeholderClass, types_1.gridDefaults.itemClass, this.opts.itemClass);
|
|
275
281
|
this.placeholder.appendChild(placeholderChild);
|
|
276
282
|
}
|
|
277
283
|
return this._placeholder;
|
|
@@ -336,26 +342,116 @@ class GridStack {
|
|
|
336
342
|
// similar to makeWidget() that doesn't read attr again and worse re-create a new node and loose any _id
|
|
337
343
|
this._prepareElement(el, true, options);
|
|
338
344
|
this._updateContainerHeight();
|
|
339
|
-
//
|
|
340
|
-
if (node.subGrid
|
|
341
|
-
|
|
342
|
-
let autoColumn;
|
|
343
|
-
let ops = node.subGrid;
|
|
344
|
-
if (ops.column === 'auto') {
|
|
345
|
-
ops.column = node.w;
|
|
346
|
-
ops.disableOneColumnMode = true; // driven by parent
|
|
347
|
-
autoColumn = true;
|
|
348
|
-
}
|
|
349
|
-
let content = node.el.querySelector('.grid-stack-item-content');
|
|
350
|
-
node.subGrid = GridStack.addGrid(content, node.subGrid);
|
|
351
|
-
if (autoColumn) {
|
|
352
|
-
node.subGrid._autoColumn = true;
|
|
353
|
-
}
|
|
345
|
+
// see if there is a sub-grid to create too
|
|
346
|
+
if (node.subGrid) {
|
|
347
|
+
this.makeSubGrid(node.el, undefined, undefined, false);
|
|
354
348
|
}
|
|
355
349
|
this._triggerAddEvent();
|
|
356
350
|
this._triggerChangeEvent();
|
|
357
351
|
return el;
|
|
358
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
|
|
355
|
+
* from the parent subGrid options.
|
|
356
|
+
* @param el gridItem element to convert
|
|
357
|
+
* @param ops (optional) sub-grid options, else default to node, then parent settings, else defaults
|
|
358
|
+
* @param nodeToAdd (optional) node to add to the newly created sub grid (used when dragging over existing regular item)
|
|
359
|
+
* @returns newly created grid
|
|
360
|
+
*/
|
|
361
|
+
makeSubGrid(el, ops, nodeToAdd, saveContent = true) {
|
|
362
|
+
var _a;
|
|
363
|
+
let node = el.gridstackNode;
|
|
364
|
+
if (!node) {
|
|
365
|
+
node = this.makeWidget(el).gridstackNode;
|
|
366
|
+
}
|
|
367
|
+
if ((_a = node.subGrid) === null || _a === void 0 ? void 0 : _a.el)
|
|
368
|
+
return node.subGrid; // already done
|
|
369
|
+
ops = utils_1.Utils.cloneDeep(ops || node.subGrid || Object.assign(Object.assign({}, this.opts.subGrid), { children: undefined }));
|
|
370
|
+
ops.subGrid = utils_1.Utils.cloneDeep(ops); // carry nesting settings to next one down
|
|
371
|
+
node.subGrid = ops;
|
|
372
|
+
// if column special case it set, remember that flag and set default
|
|
373
|
+
let autoColumn;
|
|
374
|
+
if (ops.column === 'auto') {
|
|
375
|
+
autoColumn = true;
|
|
376
|
+
ops.column = Math.max(node.w || 1, (nodeToAdd === null || nodeToAdd === void 0 ? void 0 : nodeToAdd.w) || 1);
|
|
377
|
+
ops.disableOneColumnMode = true; // driven by parent
|
|
378
|
+
}
|
|
379
|
+
// if we're converting an existing full item, move over the content to be the first sub item in the new grid
|
|
380
|
+
let content = node.el.querySelector('.grid-stack-item-content');
|
|
381
|
+
let newItem;
|
|
382
|
+
let newItemOpt;
|
|
383
|
+
if (saveContent) {
|
|
384
|
+
this._removeDD(node.el); // remove D&D since it's set on content div
|
|
385
|
+
let doc = document.implementation.createHTMLDocument(''); // IE needs a param
|
|
386
|
+
doc.body.innerHTML = `<div class="grid-stack-item"></div>`;
|
|
387
|
+
newItem = doc.body.children[0];
|
|
388
|
+
newItem.appendChild(content);
|
|
389
|
+
newItemOpt = Object.assign(Object.assign({}, node), { x: 0, y: 0 });
|
|
390
|
+
utils_1.Utils.removeInternalForSave(newItemOpt);
|
|
391
|
+
delete newItemOpt.subGrid;
|
|
392
|
+
if (node.content) {
|
|
393
|
+
newItemOpt.content = node.content;
|
|
394
|
+
delete node.content;
|
|
395
|
+
}
|
|
396
|
+
doc.body.innerHTML = `<div class="grid-stack-item-content"></div>`;
|
|
397
|
+
content = doc.body.children[0];
|
|
398
|
+
node.el.appendChild(content);
|
|
399
|
+
this._prepareDragDropByNode(node); // ... and restore original D&D
|
|
400
|
+
}
|
|
401
|
+
// if we're adding an additional item, make the container large enough to have them both
|
|
402
|
+
if (nodeToAdd) {
|
|
403
|
+
let w = autoColumn ? ops.column : node.w;
|
|
404
|
+
let h = node.h + nodeToAdd.h;
|
|
405
|
+
let style = node.el.style;
|
|
406
|
+
style.transition = 'none'; // show up instantly so we don't see scrollbar with nodeToAdd
|
|
407
|
+
this.update(node.el, { w, h });
|
|
408
|
+
setTimeout(() => style.transition = null); // recover animation
|
|
409
|
+
}
|
|
410
|
+
let subGrid = node.subGrid = GridStack.addGrid(content, ops);
|
|
411
|
+
if (nodeToAdd === null || nodeToAdd === void 0 ? void 0 : nodeToAdd._moving)
|
|
412
|
+
subGrid._isTemp = true; // prevent re-nesting as we add over
|
|
413
|
+
if (autoColumn)
|
|
414
|
+
subGrid._autoColumn = true;
|
|
415
|
+
// add the original content back as a child of hte newly created grid
|
|
416
|
+
if (saveContent) {
|
|
417
|
+
subGrid.addWidget(newItem, newItemOpt);
|
|
418
|
+
}
|
|
419
|
+
// now add any additional node
|
|
420
|
+
if (nodeToAdd) {
|
|
421
|
+
if (nodeToAdd._moving) {
|
|
422
|
+
// create an artificial event even for the just created grid to receive this item
|
|
423
|
+
window.setTimeout(() => utils_1.Utils.simulateMouseEvent(nodeToAdd._event, 'mouseenter', subGrid.el), 0);
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
subGrid.addWidget(node.el, node);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return subGrid;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
433
|
+
* to the original grid-item. Also called to remove empty sub-grids when last item is dragged out (since re-creating is simple)
|
|
434
|
+
*/
|
|
435
|
+
removeAsSubGrid(nodeThatRemoved) {
|
|
436
|
+
var _a;
|
|
437
|
+
let pGrid = (_a = this.parentGridItem) === null || _a === void 0 ? void 0 : _a.grid;
|
|
438
|
+
if (!pGrid)
|
|
439
|
+
return;
|
|
440
|
+
pGrid.batchUpdate();
|
|
441
|
+
pGrid.removeWidget(this.parentGridItem.el, true, true);
|
|
442
|
+
this.engine.nodes.forEach(n => {
|
|
443
|
+
// migrate any children over and offsetting by our location
|
|
444
|
+
n.x += this.parentGridItem.x;
|
|
445
|
+
n.y += this.parentGridItem.y;
|
|
446
|
+
pGrid.addWidget(n.el, n);
|
|
447
|
+
});
|
|
448
|
+
pGrid.batchUpdate(false);
|
|
449
|
+
delete this.parentGridItem;
|
|
450
|
+
// create an artificial event for the original grid now that this one is gone (got a leave, but won't get enter)
|
|
451
|
+
if (nodeThatRemoved) {
|
|
452
|
+
window.setTimeout(() => utils_1.Utils.simulateMouseEvent(nodeThatRemoved._event, 'mouseenter', pGrid.el), 0);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
359
455
|
/**
|
|
360
456
|
/**
|
|
361
457
|
* saves the current layout returning a list of widgets for serialization which might include any nested grids.
|
|
@@ -416,7 +512,7 @@ class GridStack {
|
|
|
416
512
|
else {
|
|
417
513
|
delete o.alwaysShowResizeHandle;
|
|
418
514
|
}
|
|
419
|
-
utils_1.Utils.removeInternalAndSame(o, types_1.
|
|
515
|
+
utils_1.Utils.removeInternalAndSame(o, types_1.gridDefaults);
|
|
420
516
|
o.children = list;
|
|
421
517
|
return o;
|
|
422
518
|
}
|
|
@@ -557,7 +653,7 @@ class GridStack {
|
|
|
557
653
|
this.opts.cellHeightUnit = data.unit;
|
|
558
654
|
this.opts.cellHeight = data.h;
|
|
559
655
|
if (update) {
|
|
560
|
-
this._updateStyles(true
|
|
656
|
+
this._updateStyles(true); // true = force re-create for current # of rows
|
|
561
657
|
}
|
|
562
658
|
return this;
|
|
563
659
|
}
|
|
@@ -653,7 +749,7 @@ class GridStack {
|
|
|
653
749
|
}
|
|
654
750
|
this._removeStylesheet();
|
|
655
751
|
this.el.removeAttribute('gs-current-row');
|
|
656
|
-
delete this.
|
|
752
|
+
delete this.parentGridItem;
|
|
657
753
|
delete this.opts;
|
|
658
754
|
delete this._placeholder;
|
|
659
755
|
delete this.engine;
|
|
@@ -1029,15 +1125,15 @@ class GridStack {
|
|
|
1029
1125
|
return this;
|
|
1030
1126
|
}
|
|
1031
1127
|
/** @internal */
|
|
1032
|
-
_triggerEvent(
|
|
1033
|
-
let event = data ? new CustomEvent(
|
|
1128
|
+
_triggerEvent(type, data) {
|
|
1129
|
+
let event = data ? new CustomEvent(type, { bubbles: false, detail: data }) : new Event(type);
|
|
1034
1130
|
this.el.dispatchEvent(event);
|
|
1035
1131
|
return this;
|
|
1036
1132
|
}
|
|
1037
1133
|
/** @internal called to delete the current dynamic style sheet used for our layout */
|
|
1038
1134
|
_removeStylesheet() {
|
|
1039
1135
|
if (this._styles) {
|
|
1040
|
-
utils_1.Utils.removeStylesheet(this.
|
|
1136
|
+
utils_1.Utils.removeStylesheet(this._styleSheetClass);
|
|
1041
1137
|
delete this._styles;
|
|
1042
1138
|
}
|
|
1043
1139
|
return this;
|
|
@@ -1048,6 +1144,8 @@ class GridStack {
|
|
|
1048
1144
|
if (forceUpdate) {
|
|
1049
1145
|
this._removeStylesheet();
|
|
1050
1146
|
}
|
|
1147
|
+
if (!maxH)
|
|
1148
|
+
maxH = this.getRow();
|
|
1051
1149
|
this._updateContainerHeight();
|
|
1052
1150
|
// if user is telling us they will handle the CSS themselves by setting heights to 0. Do we need this opts really ??
|
|
1053
1151
|
if (this.opts.cellHeight === 0) {
|
|
@@ -1058,13 +1156,11 @@ class GridStack {
|
|
|
1058
1156
|
let prefix = `.${this._styleSheetClass} > .${this.opts.itemClass}`;
|
|
1059
1157
|
// create one as needed
|
|
1060
1158
|
if (!this._styles) {
|
|
1061
|
-
let id = 'gridstack-style-' + (Math.random() * 100000).toFixed();
|
|
1062
1159
|
// insert style to parent (instead of 'head' by default) to support WebComponent
|
|
1063
1160
|
let styleLocation = this.opts.styleInHead ? undefined : this.el.parentNode;
|
|
1064
|
-
this._styles = utils_1.Utils.createStylesheet(
|
|
1161
|
+
this._styles = utils_1.Utils.createStylesheet(this._styleSheetClass, styleLocation);
|
|
1065
1162
|
if (!this._styles)
|
|
1066
1163
|
return this;
|
|
1067
|
-
this._styles._id = id;
|
|
1068
1164
|
this._styles._max = 0;
|
|
1069
1165
|
// these are done once only
|
|
1070
1166
|
utils_1.Utils.addCSSRule(this._styles, prefix, `min-height: ${cellHeight}${cellHeightUnit}`);
|
|
@@ -1117,14 +1213,14 @@ class GridStack {
|
|
|
1117
1213
|
// }
|
|
1118
1214
|
this.el.setAttribute('gs-current-row', String(row));
|
|
1119
1215
|
if (row === 0) {
|
|
1120
|
-
this.el.style.removeProperty('height');
|
|
1216
|
+
this.el.style.removeProperty('min-height');
|
|
1121
1217
|
return this;
|
|
1122
1218
|
}
|
|
1123
1219
|
let cellHeight = this.opts.cellHeight;
|
|
1124
1220
|
let unit = this.opts.cellHeightUnit;
|
|
1125
1221
|
if (!cellHeight)
|
|
1126
1222
|
return this;
|
|
1127
|
-
this.el.style.
|
|
1223
|
+
this.el.style.minHeight = row * cellHeight + unit;
|
|
1128
1224
|
return this;
|
|
1129
1225
|
}
|
|
1130
1226
|
/** @internal */
|
|
@@ -1237,10 +1333,10 @@ class GridStack {
|
|
|
1237
1333
|
return; // return if we're gone or no size yet (will get called again)
|
|
1238
1334
|
let changedColumn = false;
|
|
1239
1335
|
// see if we're nested and take our column count from our parent....
|
|
1240
|
-
if (this._autoColumn && this.
|
|
1241
|
-
if (this.opts.column !== this.
|
|
1336
|
+
if (this._autoColumn && this.parentGridItem) {
|
|
1337
|
+
if (this.opts.column !== this.parentGridItem.w) {
|
|
1242
1338
|
changedColumn = true;
|
|
1243
|
-
this.column(this.
|
|
1339
|
+
this.column(this.parentGridItem.w, 'none');
|
|
1244
1340
|
}
|
|
1245
1341
|
}
|
|
1246
1342
|
else {
|
|
@@ -1281,7 +1377,7 @@ class GridStack {
|
|
|
1281
1377
|
/** add or remove the window size event handler */
|
|
1282
1378
|
_updateWindowResizeEvent(forceRemove = false) {
|
|
1283
1379
|
// only add event if we're not nested (parent will call us) and we're auto sizing cells or supporting oneColumn (i.e. doing work)
|
|
1284
|
-
const workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.
|
|
1380
|
+
const workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.parentGridItem;
|
|
1285
1381
|
if (!forceRemove && workTodo && !this._windowResizeBind) {
|
|
1286
1382
|
this._windowResizeBind = this.onParentResize.bind(this); // so we can properly remove later
|
|
1287
1383
|
window.addEventListener('resize', this._windowResizeBind);
|
|
@@ -1373,8 +1469,8 @@ class GridStack {
|
|
|
1373
1469
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1374
1470
|
/**
|
|
1375
1471
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
1376
|
-
* Called during GridStack.init() as options, but can also be called directly (last param are
|
|
1377
|
-
* is dynamically create and needs to
|
|
1472
|
+
* Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar
|
|
1473
|
+
* is dynamically create and needs to be set later.
|
|
1378
1474
|
* @param dragIn string selector (ex: '.sidebar .grid-stack-item')
|
|
1379
1475
|
* @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
1380
1476
|
**/
|
|
@@ -1441,7 +1537,8 @@ exports.GridStack = GridStack;
|
|
|
1441
1537
|
GridStack.Utils = utils_1.Utils;
|
|
1442
1538
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
1443
1539
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
1444
|
-
GridStack.GDRev = '
|
|
1540
|
+
GridStack.GDRev = '7.0.0';
|
|
1445
1541
|
const dd_touch_1 = require("./dd-touch");
|
|
1542
|
+
const dd_manager_1 = require("./dd-manager");
|
|
1446
1543
|
__exportStar(require("./dd-gridstack"), exports);
|
|
1447
1544
|
//# sourceMappingURL=gridstack.js.map
|