gridstack 9.0.2 → 9.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 +1 -1
- package/angular/projects/lib/package.json +1 -1
- package/angular/projects/lib/src/lib/base-widget.ts +1 -1
- package/angular/projects/lib/src/lib/gridstack-item.component.ts +1 -1
- package/angular/projects/lib/src/lib/gridstack.component.ts +1 -1
- package/angular/projects/lib/src/lib/gridstack.module.ts +1 -1
- package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
- package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +4 -4
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
- package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
- package/dist/angular/lib/gridstack.component.d.ts +1 -1
- package/dist/angular/package.json +1 -1
- package/dist/angular/src/base-widget.ts +1 -1
- package/dist/angular/src/gridstack-item.component.ts +1 -1
- package/dist/angular/src/gridstack.component.ts +1 -1
- package/dist/angular/src/gridstack.module.ts +1 -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 +2 -2
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +1 -1
- 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 +1 -1
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +1 -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 +2 -2
- 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 +2 -2
- package/dist/es5/dd-draggable.js.map +1 -1
- package/dist/es5/dd-droppable.d.ts +1 -1
- package/dist/es5/dd-droppable.js +1 -1
- 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 +1 -1
- package/dist/es5/dd-gridstack.js.map +1 -1
- package/dist/es5/dd-manager.d.ts +1 -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 +2 -2
- 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 +1 -1
- package/dist/es5/gridstack-engine.js +3 -2
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +9 -6
- package/dist/es5/gridstack.js +83 -66
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +10 -7
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +2 -2
- package/dist/es5/utils.js +4 -4
- 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 +1 -1
- package/dist/gridstack-engine.js +3 -2
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +2 -2
- package/dist/gridstack.d.ts +9 -6
- package/dist/gridstack.js +80 -65
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/src/gridstack.scss +2 -2
- package/dist/types.d.ts +10 -7
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +4 -4
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +14 -3
- package/doc/README.md +3 -2
- package/package.json +1 -1
package/dist/es5/gridstack.js
CHANGED
|
@@ -36,7 +36,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.GridStack = void 0;
|
|
38
38
|
/*!
|
|
39
|
-
* GridStack 9.
|
|
39
|
+
* GridStack 9.1.1
|
|
40
40
|
* https://gridstackjs.com/
|
|
41
41
|
*
|
|
42
42
|
* Copyright (c) 2021-2022 Alain Dumesny
|
|
@@ -730,7 +730,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
730
730
|
}
|
|
731
731
|
this.opts.cellHeightUnit = data.unit;
|
|
732
732
|
this.opts.cellHeight = data.h;
|
|
733
|
-
this.doContentResize(false);
|
|
733
|
+
this.doContentResize(false, true); // no anim wait, but use attributes since we only change row height
|
|
734
734
|
if (update) {
|
|
735
735
|
this._updateStyles(true); // true = force re-create for current # of rows
|
|
736
736
|
}
|
|
@@ -928,7 +928,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
928
928
|
this._prepareElement(el, true, options);
|
|
929
929
|
var node = el.gridstackNode;
|
|
930
930
|
this._updateContainerHeight();
|
|
931
|
-
this.doContentResize(false, node);
|
|
931
|
+
this.doContentResize(false, false, node);
|
|
932
932
|
// see if there is a sub-grid to create
|
|
933
933
|
if (node.subGridOpts) {
|
|
934
934
|
this.makeSubGrid(el, node.subGridOpts, undefined, false); // node.subGrid will be used as option in method, no need to pass
|
|
@@ -1189,58 +1189,71 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1189
1189
|
this._triggerChangeEvent();
|
|
1190
1190
|
this.engine.endUpdate();
|
|
1191
1191
|
};
|
|
1192
|
-
/**
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
if
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1192
|
+
/**
|
|
1193
|
+
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
|
|
1194
|
+
* Note: this assumes only 1 child under resizeToContentParent='.grid-stack-item-content' (sized to gridItem minus padding) that is at the entire content size wanted.
|
|
1195
|
+
* useAttrSize set to true if GridStackNode.h should be used instead of actual container height when we don't need to wait for animation to finish to get actual DOM heights
|
|
1196
|
+
**/
|
|
1197
|
+
GridStack.prototype.resizeToContent = function (el, useAttrSize) {
|
|
1198
|
+
if (useAttrSize === void 0) { useAttrSize = false; }
|
|
1199
|
+
el === null || el === void 0 ? void 0 : el.classList.remove('size-to-content-max');
|
|
1200
|
+
if (!(el === null || el === void 0 ? void 0 : el.clientHeight))
|
|
1201
|
+
return; // 0 when hidden, skip
|
|
1202
|
+
var n = el.gridstackNode;
|
|
1203
|
+
if (!n)
|
|
1204
|
+
return;
|
|
1205
|
+
var grid = n.grid;
|
|
1206
|
+
if (!grid)
|
|
1207
|
+
return;
|
|
1208
|
+
if (el.parentElement !== grid.el)
|
|
1209
|
+
return; // skip if we are not inside a grid
|
|
1210
|
+
var cell = grid.getCellHeight();
|
|
1211
|
+
if (!cell)
|
|
1212
|
+
return;
|
|
1213
|
+
var height = useAttrSize && n.h ? n.h * cell : el.clientHeight; // getBoundingClientRect().height seem to flicker back and forth
|
|
1214
|
+
var item;
|
|
1215
|
+
if (n.resizeToContentParent)
|
|
1216
|
+
item = el.querySelector(n.resizeToContentParent);
|
|
1217
|
+
if (!item)
|
|
1218
|
+
item = el.querySelector(GridStack.resizeToContentParent);
|
|
1219
|
+
if (!item)
|
|
1220
|
+
return;
|
|
1221
|
+
var child = item.firstElementChild;
|
|
1222
|
+
// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
|
|
1223
|
+
if (!child) {
|
|
1224
|
+
console.log("Error: resizeToContent() '".concat(GridStack.resizeToContentParent, "'.firstElementChild is null, make sure to have a div like container. Skipping sizing."));
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
var padding = el.clientHeight - item.clientHeight; // full - available height to our child (minus border, padding...)
|
|
1228
|
+
var itemH = useAttrSize && n.h ? n.h * cell - padding : item.clientHeight; // calculated to what cellHeight is or will become (rather than actual to prevent waiting for animation to finish)
|
|
1229
|
+
var wantedH = child.getBoundingClientRect().height || itemH;
|
|
1230
|
+
if (itemH === wantedH)
|
|
1231
|
+
return;
|
|
1232
|
+
height += wantedH - itemH;
|
|
1233
|
+
var h = Math.ceil(height / cell);
|
|
1234
|
+
// check for min/max and special sizing
|
|
1235
|
+
var softMax = Number.isInteger(n.sizeToContent) ? n.sizeToContent : 0;
|
|
1236
|
+
if (softMax && h > softMax) {
|
|
1237
|
+
h = softMax;
|
|
1238
|
+
el.classList.add('size-to-content-max'); // get v-scroll back
|
|
1239
|
+
}
|
|
1240
|
+
if (n.minH && h < n.minH)
|
|
1241
|
+
h = n.minH;
|
|
1242
|
+
else if (n.maxH && h > n.maxH)
|
|
1243
|
+
h = n.maxH;
|
|
1244
|
+
if (h !== n.h) {
|
|
1245
|
+
grid._ignoreLayoutsNodeChange = true;
|
|
1246
|
+
grid.moveNode(n, { h: h });
|
|
1247
|
+
delete grid._ignoreLayoutsNodeChange;
|
|
1248
|
+
}
|
|
1237
1249
|
};
|
|
1238
1250
|
/** call the user resize (so we can do extra work) else our build in version */
|
|
1239
|
-
GridStack.prototype.resizeToContentCheck = function (el) {
|
|
1251
|
+
GridStack.prototype.resizeToContentCheck = function (el, useAttr) {
|
|
1252
|
+
if (useAttr === void 0) { useAttr = false; }
|
|
1240
1253
|
if (GridStack.resizeToContentCB)
|
|
1241
1254
|
GridStack.resizeToContentCB(el);
|
|
1242
1255
|
else
|
|
1243
|
-
this.resizeToContent(el);
|
|
1256
|
+
this.resizeToContent(el, useAttr);
|
|
1244
1257
|
};
|
|
1245
1258
|
/**
|
|
1246
1259
|
* Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options (CSS string format of 1,2,4 values or single number).
|
|
@@ -1439,8 +1452,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1439
1452
|
if (!utils_1.Utils.same(node, copy)) {
|
|
1440
1453
|
this._writeAttr(el, node);
|
|
1441
1454
|
}
|
|
1442
|
-
if (utils_1.Utils.
|
|
1443
|
-
el.classList.add('
|
|
1455
|
+
if (utils_1.Utils.shouldSizeToContent(node))
|
|
1456
|
+
el.classList.add('size-to-content');
|
|
1444
1457
|
this._prepareDragDropByNode(node);
|
|
1445
1458
|
return this;
|
|
1446
1459
|
};
|
|
@@ -1538,7 +1551,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1538
1551
|
/**
|
|
1539
1552
|
* called when we are being resized - check if the one Column Mode needs to be turned on/off
|
|
1540
1553
|
* and remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)
|
|
1541
|
-
* or `
|
|
1554
|
+
* or `sizeToContent` gridItem options.
|
|
1542
1555
|
*/
|
|
1543
1556
|
GridStack.prototype.onResize = function () {
|
|
1544
1557
|
var _a;
|
|
@@ -1562,7 +1575,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1562
1575
|
var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize ||
|
|
1563
1576
|
(this.opts.column === 1 && !this._prevColumn);
|
|
1564
1577
|
if ((this.opts.column === 1) !== oneColumn) {
|
|
1565
|
-
// if (this.opts.animate) this.setAnimation(false); // 1 <-> 12 is too radical, turn off animation and we need it for
|
|
1578
|
+
// if (this.opts.animate) this.setAnimation(false); // 1 <-> 12 is too radical, turn off animation and we need it for sizeToContent
|
|
1566
1579
|
this.column(oneColumn ? 1 : this._prevColumn);
|
|
1567
1580
|
// if (this.opts.animate) setTimeout(() => this.setAnimation(true));
|
|
1568
1581
|
columnChanged = true;
|
|
@@ -1576,27 +1589,28 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1576
1589
|
if (n.subGrid)
|
|
1577
1590
|
n.subGrid.onResize();
|
|
1578
1591
|
});
|
|
1579
|
-
this.doContentResize(columnChanged);
|
|
1592
|
+
this.doContentResize(columnChanged); // wait for anim of column changed (DOM reflow before we can size correctly)
|
|
1580
1593
|
this.batchUpdate(false);
|
|
1581
1594
|
return this;
|
|
1582
1595
|
};
|
|
1583
|
-
GridStack.prototype.doContentResize = function (delay, n) {
|
|
1596
|
+
GridStack.prototype.doContentResize = function (delay, useAttr, n) {
|
|
1584
1597
|
var _this = this;
|
|
1585
1598
|
if (delay === void 0) { delay = true; }
|
|
1599
|
+
if (useAttr === void 0) { useAttr = false; }
|
|
1586
1600
|
if (n === void 0) { n = undefined; }
|
|
1587
|
-
// update any gridItem height with
|
|
1601
|
+
// update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
|
|
1588
1602
|
// TODO: is there a way to know what the final (post animation) size of the content will be so we can animate the column width and height together rather than sequentially ?
|
|
1589
1603
|
setTimeout(function () {
|
|
1590
1604
|
if (n) {
|
|
1591
|
-
if (utils_1.Utils.
|
|
1592
|
-
_this.resizeToContentCheck(n.el);
|
|
1605
|
+
if (utils_1.Utils.shouldSizeToContent(n))
|
|
1606
|
+
_this.resizeToContentCheck(n.el, useAttr);
|
|
1593
1607
|
}
|
|
1594
1608
|
else {
|
|
1595
1609
|
var nodes = __spreadArray([], _this.engine.nodes, true); // in case order changes while resizing one
|
|
1596
1610
|
_this.batchUpdate();
|
|
1597
1611
|
nodes.forEach(function (n) {
|
|
1598
|
-
if (utils_1.Utils.
|
|
1599
|
-
_this.resizeToContentCheck(n.el);
|
|
1612
|
+
if (utils_1.Utils.shouldSizeToContent(n))
|
|
1613
|
+
_this.resizeToContentCheck(n.el, useAttr);
|
|
1600
1614
|
});
|
|
1601
1615
|
_this.batchUpdate(false);
|
|
1602
1616
|
}
|
|
@@ -1609,8 +1623,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1609
1623
|
var _this = this;
|
|
1610
1624
|
if (forceRemove === void 0) { forceRemove = false; }
|
|
1611
1625
|
// 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)
|
|
1612
|
-
// or supporting new
|
|
1613
|
-
var trackSize = !this.parentGridItem && (this._isAutoCellHeight || this.opts.
|
|
1626
|
+
// or supporting new sizeToContent option.
|
|
1627
|
+
var trackSize = !this.parentGridItem && (this._isAutoCellHeight || this.opts.sizeToContent || !this.opts.disableOneColumnMode || this.engine.nodes.find(function (n) { return n.sizeToContent; }));
|
|
1614
1628
|
if (!forceRemove && trackSize && !this.resizeObserver) {
|
|
1615
1629
|
this._sizeThrottle = utils_1.Utils.throttle(function () { return _this.onResize(); }, this.opts.cellHeightThrottle);
|
|
1616
1630
|
this.resizeObserver = new ResizeObserver(function (entries) { return _this._sizeThrottle(); });
|
|
@@ -2179,8 +2193,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2179
2193
|
_this._updateContainerHeight(); // @ts-ignore
|
|
2180
2194
|
_this._triggerChangeEvent();
|
|
2181
2195
|
_this.engine.endUpdate();
|
|
2182
|
-
if (event.type === 'resizestop')
|
|
2183
|
-
|
|
2196
|
+
if (event.type === 'resizestop') {
|
|
2197
|
+
if (Number.isInteger(node.sizeToContent))
|
|
2198
|
+
node.sizeToContent = node.h; // new soft limit
|
|
2199
|
+
_this.doContentResize(false, true, node); // no amin wait as will use the actual sized coordinate attr
|
|
2200
|
+
}
|
|
2184
2201
|
};
|
|
2185
2202
|
dd.draggable(el, {
|
|
2186
2203
|
start: onStartMoving,
|
|
@@ -2355,7 +2372,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2355
2372
|
GridStack.Utils = utils_1.Utils;
|
|
2356
2373
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2357
2374
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
2358
|
-
GridStack.GDRev = '9.
|
|
2375
|
+
GridStack.GDRev = '9.1.1';
|
|
2359
2376
|
return GridStack;
|
|
2360
2377
|
}());
|
|
2361
2378
|
//# sourceMappingURL=gridstack.js.map
|