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/es5/gridstack.js
CHANGED
|
@@ -30,7 +30,7 @@ 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 7.0.0
|
|
34
34
|
* https://gridstackjs.com/
|
|
35
35
|
*
|
|
36
36
|
* Copyright (c) 2021-2022 Alain Dumesny
|
|
@@ -62,6 +62,7 @@ var GridStack = /** @class */ (function () {
|
|
|
62
62
|
function GridStack(el, opts) {
|
|
63
63
|
var _this = this;
|
|
64
64
|
if (opts === void 0) { opts = {}; }
|
|
65
|
+
var _a, _b;
|
|
65
66
|
/** @internal */
|
|
66
67
|
this._gsEventHandler = {};
|
|
67
68
|
/** @internal extra row added when dragging at the bottom of the grid */
|
|
@@ -90,10 +91,10 @@ var GridStack = /** @class */ (function () {
|
|
|
90
91
|
opts._alwaysShowResizeHandle = opts.alwaysShowResizeHandle;
|
|
91
92
|
}
|
|
92
93
|
// elements DOM attributes override any passed options (like CSS style) - merge the two together
|
|
93
|
-
var defaults = __assign(__assign({}, utils_1.Utils.cloneDeep(types_1.
|
|
94
|
-
handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || types_1.
|
|
94
|
+
var defaults = __assign(__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: {
|
|
95
|
+
handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || types_1.gridDefaults.draggable.handle,
|
|
95
96
|
}, removableOptions: {
|
|
96
|
-
accept: opts.itemClass ? '.' + opts.itemClass : types_1.
|
|
97
|
+
accept: opts.itemClass ? '.' + opts.itemClass : types_1.gridDefaults.removableOptions.accept,
|
|
97
98
|
} });
|
|
98
99
|
if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead
|
|
99
100
|
defaults.animate = utils_1.Utils.toBool(el.getAttribute('gs-animate'));
|
|
@@ -113,12 +114,12 @@ var GridStack = /** @class */ (function () {
|
|
|
113
114
|
this.el.classList.add('grid-stack-rtl');
|
|
114
115
|
}
|
|
115
116
|
// check if we're been nested, and if so update our style and keep pointer around (used during save)
|
|
116
|
-
var
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
this.
|
|
120
|
-
parentGridItemEl.classList.add('grid-stack-nested');
|
|
117
|
+
var parentGridItem = (_a = utils_1.Utils.closestUpByClass(this.el, types_1.gridDefaults.itemClass)) === null || _a === void 0 ? void 0 : _a.gridstackNode;
|
|
118
|
+
if (parentGridItem) {
|
|
119
|
+
parentGridItem.subGrid = this;
|
|
120
|
+
this.parentGridItem = parentGridItem;
|
|
121
121
|
this.el.classList.add('grid-stack-nested');
|
|
122
|
+
parentGridItem.el.classList.add('grid-stack-sub-grid');
|
|
122
123
|
}
|
|
123
124
|
this._isAutoCellHeight = (this.opts.cellHeight === 'auto');
|
|
124
125
|
if (this._isAutoCellHeight || this.opts.cellHeight === 'initial') {
|
|
@@ -127,7 +128,7 @@ var GridStack = /** @class */ (function () {
|
|
|
127
128
|
}
|
|
128
129
|
else {
|
|
129
130
|
// append unit if any are set
|
|
130
|
-
if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== types_1.
|
|
131
|
+
if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== types_1.gridDefaults.cellHeightUnit) {
|
|
131
132
|
this.opts.cellHeight = this.opts.cellHeight + this.opts.cellHeightUnit;
|
|
132
133
|
delete this.opts.cellHeightUnit;
|
|
133
134
|
}
|
|
@@ -137,7 +138,7 @@ var GridStack = /** @class */ (function () {
|
|
|
137
138
|
if (this.opts.alwaysShowResizeHandle === 'mobile') {
|
|
138
139
|
this.opts.alwaysShowResizeHandle = dd_touch_1.isTouch;
|
|
139
140
|
}
|
|
140
|
-
this._styleSheetClass = 'grid-stack-instance-' +
|
|
141
|
+
this._styleSheetClass = 'grid-stack-instance-' + gridstack_engine_1.GridStackEngine._idSeq++;
|
|
141
142
|
this.el.classList.add(this._styleSheetClass);
|
|
142
143
|
this._setStaticClass();
|
|
143
144
|
var engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
|
|
@@ -189,6 +190,11 @@ var GridStack = /** @class */ (function () {
|
|
|
189
190
|
GridStack.setupDragIn(this.opts.dragIn, this.opts.dragInOptions);
|
|
190
191
|
delete this.opts.dragIn;
|
|
191
192
|
delete this.opts.dragInOptions;
|
|
193
|
+
// dynamic grids require pausing during drag to detect over to nest vs push
|
|
194
|
+
if (this.opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
|
|
195
|
+
dd_manager_1.DDManager.pauseDrag = true;
|
|
196
|
+
if (((_b = this.opts.draggable) === null || _b === void 0 ? void 0 : _b.pause) !== undefined)
|
|
197
|
+
dd_manager_1.DDManager.pauseDrag = this.opts.draggable.pause;
|
|
192
198
|
this._setupRemoveDrop();
|
|
193
199
|
this._setupAcceptWidget();
|
|
194
200
|
this._updateWindowResizeEvent();
|
|
@@ -297,7 +303,7 @@ var GridStack = /** @class */ (function () {
|
|
|
297
303
|
placeholderChild.innerHTML = this.opts.placeholderText;
|
|
298
304
|
}
|
|
299
305
|
this._placeholder = document.createElement('div');
|
|
300
|
-
this._placeholder.classList.add(this.opts.placeholderClass, types_1.
|
|
306
|
+
this._placeholder.classList.add(this.opts.placeholderClass, types_1.gridDefaults.itemClass, this.opts.itemClass);
|
|
301
307
|
this.placeholder.appendChild(placeholderChild);
|
|
302
308
|
}
|
|
303
309
|
return this._placeholder;
|
|
@@ -365,26 +371,118 @@ var GridStack = /** @class */ (function () {
|
|
|
365
371
|
// similar to makeWidget() that doesn't read attr again and worse re-create a new node and loose any _id
|
|
366
372
|
this._prepareElement(el, true, options);
|
|
367
373
|
this._updateContainerHeight();
|
|
368
|
-
//
|
|
369
|
-
if (node.subGrid
|
|
370
|
-
|
|
371
|
-
var autoColumn = void 0;
|
|
372
|
-
var ops = node.subGrid;
|
|
373
|
-
if (ops.column === 'auto') {
|
|
374
|
-
ops.column = node.w;
|
|
375
|
-
ops.disableOneColumnMode = true; // driven by parent
|
|
376
|
-
autoColumn = true;
|
|
377
|
-
}
|
|
378
|
-
var content = node.el.querySelector('.grid-stack-item-content');
|
|
379
|
-
node.subGrid = GridStack.addGrid(content, node.subGrid);
|
|
380
|
-
if (autoColumn) {
|
|
381
|
-
node.subGrid._autoColumn = true;
|
|
382
|
-
}
|
|
374
|
+
// see if there is a sub-grid to create too
|
|
375
|
+
if (node.subGrid) {
|
|
376
|
+
this.makeSubGrid(node.el, undefined, undefined, false);
|
|
383
377
|
}
|
|
384
378
|
this._triggerAddEvent();
|
|
385
379
|
this._triggerChangeEvent();
|
|
386
380
|
return el;
|
|
387
381
|
};
|
|
382
|
+
/**
|
|
383
|
+
* Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
|
|
384
|
+
* from the parent subGrid options.
|
|
385
|
+
* @param el gridItem element to convert
|
|
386
|
+
* @param ops (optional) sub-grid options, else default to node, then parent settings, else defaults
|
|
387
|
+
* @param nodeToAdd (optional) node to add to the newly created sub grid (used when dragging over existing regular item)
|
|
388
|
+
* @returns newly created grid
|
|
389
|
+
*/
|
|
390
|
+
GridStack.prototype.makeSubGrid = function (el, ops, nodeToAdd, saveContent) {
|
|
391
|
+
var _a;
|
|
392
|
+
if (saveContent === void 0) { saveContent = true; }
|
|
393
|
+
var node = el.gridstackNode;
|
|
394
|
+
if (!node) {
|
|
395
|
+
node = this.makeWidget(el).gridstackNode;
|
|
396
|
+
}
|
|
397
|
+
if ((_a = node.subGrid) === null || _a === void 0 ? void 0 : _a.el)
|
|
398
|
+
return node.subGrid; // already done
|
|
399
|
+
ops = utils_1.Utils.cloneDeep(ops || node.subGrid || __assign(__assign({}, this.opts.subGrid), { children: undefined }));
|
|
400
|
+
ops.subGrid = utils_1.Utils.cloneDeep(ops); // carry nesting settings to next one down
|
|
401
|
+
node.subGrid = ops;
|
|
402
|
+
// if column special case it set, remember that flag and set default
|
|
403
|
+
var autoColumn;
|
|
404
|
+
if (ops.column === 'auto') {
|
|
405
|
+
autoColumn = true;
|
|
406
|
+
ops.column = Math.max(node.w || 1, (nodeToAdd === null || nodeToAdd === void 0 ? void 0 : nodeToAdd.w) || 1);
|
|
407
|
+
ops.disableOneColumnMode = true; // driven by parent
|
|
408
|
+
}
|
|
409
|
+
// if we're converting an existing full item, move over the content to be the first sub item in the new grid
|
|
410
|
+
var content = node.el.querySelector('.grid-stack-item-content');
|
|
411
|
+
var newItem;
|
|
412
|
+
var newItemOpt;
|
|
413
|
+
if (saveContent) {
|
|
414
|
+
this._removeDD(node.el); // remove D&D since it's set on content div
|
|
415
|
+
var doc = document.implementation.createHTMLDocument(''); // IE needs a param
|
|
416
|
+
doc.body.innerHTML = "<div class=\"grid-stack-item\"></div>";
|
|
417
|
+
newItem = doc.body.children[0];
|
|
418
|
+
newItem.appendChild(content);
|
|
419
|
+
newItemOpt = __assign(__assign({}, node), { x: 0, y: 0 });
|
|
420
|
+
utils_1.Utils.removeInternalForSave(newItemOpt);
|
|
421
|
+
delete newItemOpt.subGrid;
|
|
422
|
+
if (node.content) {
|
|
423
|
+
newItemOpt.content = node.content;
|
|
424
|
+
delete node.content;
|
|
425
|
+
}
|
|
426
|
+
doc.body.innerHTML = "<div class=\"grid-stack-item-content\"></div>";
|
|
427
|
+
content = doc.body.children[0];
|
|
428
|
+
node.el.appendChild(content);
|
|
429
|
+
this._prepareDragDropByNode(node); // ... and restore original D&D
|
|
430
|
+
}
|
|
431
|
+
// if we're adding an additional item, make the container large enough to have them both
|
|
432
|
+
if (nodeToAdd) {
|
|
433
|
+
var w = autoColumn ? ops.column : node.w;
|
|
434
|
+
var h = node.h + nodeToAdd.h;
|
|
435
|
+
var style_1 = node.el.style;
|
|
436
|
+
style_1.transition = 'none'; // show up instantly so we don't see scrollbar with nodeToAdd
|
|
437
|
+
this.update(node.el, { w: w, h: h });
|
|
438
|
+
setTimeout(function () { return style_1.transition = null; }); // recover animation
|
|
439
|
+
}
|
|
440
|
+
var subGrid = node.subGrid = GridStack.addGrid(content, ops);
|
|
441
|
+
if (nodeToAdd === null || nodeToAdd === void 0 ? void 0 : nodeToAdd._moving)
|
|
442
|
+
subGrid._isTemp = true; // prevent re-nesting as we add over
|
|
443
|
+
if (autoColumn)
|
|
444
|
+
subGrid._autoColumn = true;
|
|
445
|
+
// add the original content back as a child of hte newly created grid
|
|
446
|
+
if (saveContent) {
|
|
447
|
+
subGrid.addWidget(newItem, newItemOpt);
|
|
448
|
+
}
|
|
449
|
+
// now add any additional node
|
|
450
|
+
if (nodeToAdd) {
|
|
451
|
+
if (nodeToAdd._moving) {
|
|
452
|
+
// create an artificial event even for the just created grid to receive this item
|
|
453
|
+
window.setTimeout(function () { return utils_1.Utils.simulateMouseEvent(nodeToAdd._event, 'mouseenter', subGrid.el); }, 0);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
subGrid.addWidget(node.el, node);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return subGrid;
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
463
|
+
* to the original grid-item. Also called to remove empty sub-grids when last item is dragged out (since re-creating is simple)
|
|
464
|
+
*/
|
|
465
|
+
GridStack.prototype.removeAsSubGrid = function (nodeThatRemoved) {
|
|
466
|
+
var _this = this;
|
|
467
|
+
var _a;
|
|
468
|
+
var pGrid = (_a = this.parentGridItem) === null || _a === void 0 ? void 0 : _a.grid;
|
|
469
|
+
if (!pGrid)
|
|
470
|
+
return;
|
|
471
|
+
pGrid.batchUpdate();
|
|
472
|
+
pGrid.removeWidget(this.parentGridItem.el, true, true);
|
|
473
|
+
this.engine.nodes.forEach(function (n) {
|
|
474
|
+
// migrate any children over and offsetting by our location
|
|
475
|
+
n.x += _this.parentGridItem.x;
|
|
476
|
+
n.y += _this.parentGridItem.y;
|
|
477
|
+
pGrid.addWidget(n.el, n);
|
|
478
|
+
});
|
|
479
|
+
pGrid.batchUpdate(false);
|
|
480
|
+
delete this.parentGridItem;
|
|
481
|
+
// create an artificial event for the original grid now that this one is gone (got a leave, but won't get enter)
|
|
482
|
+
if (nodeThatRemoved) {
|
|
483
|
+
window.setTimeout(function () { return utils_1.Utils.simulateMouseEvent(nodeThatRemoved._event, 'mouseenter', pGrid.el); }, 0);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
388
486
|
/**
|
|
389
487
|
/**
|
|
390
488
|
* saves the current layout returning a list of widgets for serialization which might include any nested grids.
|
|
@@ -447,7 +545,7 @@ var GridStack = /** @class */ (function () {
|
|
|
447
545
|
else {
|
|
448
546
|
delete o.alwaysShowResizeHandle;
|
|
449
547
|
}
|
|
450
|
-
utils_1.Utils.removeInternalAndSame(o, types_1.
|
|
548
|
+
utils_1.Utils.removeInternalAndSame(o, types_1.gridDefaults);
|
|
451
549
|
o.children = list;
|
|
452
550
|
return o;
|
|
453
551
|
}
|
|
@@ -593,7 +691,7 @@ var GridStack = /** @class */ (function () {
|
|
|
593
691
|
this.opts.cellHeightUnit = data.unit;
|
|
594
692
|
this.opts.cellHeight = data.h;
|
|
595
693
|
if (update) {
|
|
596
|
-
this._updateStyles(true
|
|
694
|
+
this._updateStyles(true); // true = force re-create for current # of rows
|
|
597
695
|
}
|
|
598
696
|
return this;
|
|
599
697
|
};
|
|
@@ -692,7 +790,7 @@ var GridStack = /** @class */ (function () {
|
|
|
692
790
|
}
|
|
693
791
|
this._removeStylesheet();
|
|
694
792
|
this.el.removeAttribute('gs-current-row');
|
|
695
|
-
delete this.
|
|
793
|
+
delete this.parentGridItem;
|
|
696
794
|
delete this.opts;
|
|
697
795
|
delete this._placeholder;
|
|
698
796
|
delete this.engine;
|
|
@@ -1079,15 +1177,15 @@ var GridStack = /** @class */ (function () {
|
|
|
1079
1177
|
return this;
|
|
1080
1178
|
};
|
|
1081
1179
|
/** @internal */
|
|
1082
|
-
GridStack.prototype._triggerEvent = function (
|
|
1083
|
-
var event = data ? new CustomEvent(
|
|
1180
|
+
GridStack.prototype._triggerEvent = function (type, data) {
|
|
1181
|
+
var event = data ? new CustomEvent(type, { bubbles: false, detail: data }) : new Event(type);
|
|
1084
1182
|
this.el.dispatchEvent(event);
|
|
1085
1183
|
return this;
|
|
1086
1184
|
};
|
|
1087
1185
|
/** @internal called to delete the current dynamic style sheet used for our layout */
|
|
1088
1186
|
GridStack.prototype._removeStylesheet = function () {
|
|
1089
1187
|
if (this._styles) {
|
|
1090
|
-
utils_1.Utils.removeStylesheet(this.
|
|
1188
|
+
utils_1.Utils.removeStylesheet(this._styleSheetClass);
|
|
1091
1189
|
delete this._styles;
|
|
1092
1190
|
}
|
|
1093
1191
|
return this;
|
|
@@ -1099,6 +1197,8 @@ var GridStack = /** @class */ (function () {
|
|
|
1099
1197
|
if (forceUpdate) {
|
|
1100
1198
|
this._removeStylesheet();
|
|
1101
1199
|
}
|
|
1200
|
+
if (!maxH)
|
|
1201
|
+
maxH = this.getRow();
|
|
1102
1202
|
this._updateContainerHeight();
|
|
1103
1203
|
// if user is telling us they will handle the CSS themselves by setting heights to 0. Do we need this opts really ??
|
|
1104
1204
|
if (this.opts.cellHeight === 0) {
|
|
@@ -1109,13 +1209,11 @@ var GridStack = /** @class */ (function () {
|
|
|
1109
1209
|
var prefix = "." + this._styleSheetClass + " > ." + this.opts.itemClass;
|
|
1110
1210
|
// create one as needed
|
|
1111
1211
|
if (!this._styles) {
|
|
1112
|
-
var id = 'gridstack-style-' + (Math.random() * 100000).toFixed();
|
|
1113
1212
|
// insert style to parent (instead of 'head' by default) to support WebComponent
|
|
1114
1213
|
var styleLocation = this.opts.styleInHead ? undefined : this.el.parentNode;
|
|
1115
|
-
this._styles = utils_1.Utils.createStylesheet(
|
|
1214
|
+
this._styles = utils_1.Utils.createStylesheet(this._styleSheetClass, styleLocation);
|
|
1116
1215
|
if (!this._styles)
|
|
1117
1216
|
return this;
|
|
1118
|
-
this._styles._id = id;
|
|
1119
1217
|
this._styles._max = 0;
|
|
1120
1218
|
// these are done once only
|
|
1121
1219
|
utils_1.Utils.addCSSRule(this._styles, prefix, "min-height: " + cellHeight + cellHeightUnit);
|
|
@@ -1168,14 +1266,14 @@ var GridStack = /** @class */ (function () {
|
|
|
1168
1266
|
// }
|
|
1169
1267
|
this.el.setAttribute('gs-current-row', String(row));
|
|
1170
1268
|
if (row === 0) {
|
|
1171
|
-
this.el.style.removeProperty('height');
|
|
1269
|
+
this.el.style.removeProperty('min-height');
|
|
1172
1270
|
return this;
|
|
1173
1271
|
}
|
|
1174
1272
|
var cellHeight = this.opts.cellHeight;
|
|
1175
1273
|
var unit = this.opts.cellHeightUnit;
|
|
1176
1274
|
if (!cellHeight)
|
|
1177
1275
|
return this;
|
|
1178
|
-
this.el.style.
|
|
1276
|
+
this.el.style.minHeight = row * cellHeight + unit;
|
|
1179
1277
|
return this;
|
|
1180
1278
|
};
|
|
1181
1279
|
/** @internal */
|
|
@@ -1291,10 +1389,10 @@ var GridStack = /** @class */ (function () {
|
|
|
1291
1389
|
return; // return if we're gone or no size yet (will get called again)
|
|
1292
1390
|
var changedColumn = false;
|
|
1293
1391
|
// see if we're nested and take our column count from our parent....
|
|
1294
|
-
if (this._autoColumn && this.
|
|
1295
|
-
if (this.opts.column !== this.
|
|
1392
|
+
if (this._autoColumn && this.parentGridItem) {
|
|
1393
|
+
if (this.opts.column !== this.parentGridItem.w) {
|
|
1296
1394
|
changedColumn = true;
|
|
1297
|
-
this.column(this.
|
|
1395
|
+
this.column(this.parentGridItem.w, 'none');
|
|
1298
1396
|
}
|
|
1299
1397
|
}
|
|
1300
1398
|
else {
|
|
@@ -1336,7 +1434,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1336
1434
|
GridStack.prototype._updateWindowResizeEvent = function (forceRemove) {
|
|
1337
1435
|
if (forceRemove === void 0) { forceRemove = false; }
|
|
1338
1436
|
// 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)
|
|
1339
|
-
var workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.
|
|
1437
|
+
var workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.parentGridItem;
|
|
1340
1438
|
if (!forceRemove && workTodo && !this._windowResizeBind) {
|
|
1341
1439
|
this._windowResizeBind = this.onParentResize.bind(this); // so we can properly remove later
|
|
1342
1440
|
window.addEventListener('resize', this._windowResizeBind);
|
|
@@ -1434,8 +1532,8 @@ var GridStack = /** @class */ (function () {
|
|
|
1434
1532
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1435
1533
|
/**
|
|
1436
1534
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
1437
|
-
* Called during GridStack.init() as options, but can also be called directly (last param are
|
|
1438
|
-
* is dynamically create and needs to
|
|
1535
|
+
* Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar
|
|
1536
|
+
* is dynamically create and needs to be set later.
|
|
1439
1537
|
* @param dragIn string selector (ex: '.sidebar .grid-stack-item')
|
|
1440
1538
|
* @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
1441
1539
|
**/
|
|
@@ -1500,10 +1598,11 @@ var GridStack = /** @class */ (function () {
|
|
|
1500
1598
|
GridStack.Utils = utils_1.Utils;
|
|
1501
1599
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
1502
1600
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
1503
|
-
GridStack.GDRev = '
|
|
1601
|
+
GridStack.GDRev = '7.0.0';
|
|
1504
1602
|
return GridStack;
|
|
1505
1603
|
}());
|
|
1506
1604
|
exports.GridStack = GridStack;
|
|
1507
1605
|
var dd_touch_1 = require("./dd-touch");
|
|
1606
|
+
var dd_manager_1 = require("./dd-manager");
|
|
1508
1607
|
__exportStar(require("./dd-gridstack"), exports);
|
|
1509
1608
|
//# sourceMappingURL=gridstack.js.map
|