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/gridstack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GridStack 9.
|
|
2
|
+
* GridStack 9.1.1
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2022 Alain Dumesny
|
|
@@ -674,7 +674,7 @@ class GridStack {
|
|
|
674
674
|
}
|
|
675
675
|
this.opts.cellHeightUnit = data.unit;
|
|
676
676
|
this.opts.cellHeight = data.h;
|
|
677
|
-
this.doContentResize(false);
|
|
677
|
+
this.doContentResize(false, true); // no anim wait, but use attributes since we only change row height
|
|
678
678
|
if (update) {
|
|
679
679
|
this._updateStyles(true); // true = force re-create for current # of rows
|
|
680
680
|
}
|
|
@@ -866,7 +866,7 @@ class GridStack {
|
|
|
866
866
|
this._prepareElement(el, true, options);
|
|
867
867
|
const node = el.gridstackNode;
|
|
868
868
|
this._updateContainerHeight();
|
|
869
|
-
this.doContentResize(false, node);
|
|
869
|
+
this.doContentResize(false, false, node);
|
|
870
870
|
// see if there is a sub-grid to create
|
|
871
871
|
if (node.subGridOpts) {
|
|
872
872
|
this.makeSubGrid(el, node.subGridOpts, undefined, false); // node.subGrid will be used as option in method, no need to pass
|
|
@@ -1114,57 +1114,69 @@ class GridStack {
|
|
|
1114
1114
|
this._triggerChangeEvent();
|
|
1115
1115
|
this.engine.endUpdate();
|
|
1116
1116
|
}
|
|
1117
|
-
/**
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
if
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1117
|
+
/**
|
|
1118
|
+
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
|
|
1119
|
+
* 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.
|
|
1120
|
+
* 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
|
|
1121
|
+
**/
|
|
1122
|
+
resizeToContent(el, useAttrSize = false) {
|
|
1123
|
+
el?.classList.remove('size-to-content-max');
|
|
1124
|
+
if (!el?.clientHeight)
|
|
1125
|
+
return; // 0 when hidden, skip
|
|
1126
|
+
let n = el.gridstackNode;
|
|
1127
|
+
if (!n)
|
|
1128
|
+
return;
|
|
1129
|
+
const grid = n.grid;
|
|
1130
|
+
if (!grid)
|
|
1131
|
+
return;
|
|
1132
|
+
if (el.parentElement !== grid.el)
|
|
1133
|
+
return; // skip if we are not inside a grid
|
|
1134
|
+
const cell = grid.getCellHeight();
|
|
1135
|
+
if (!cell)
|
|
1136
|
+
return;
|
|
1137
|
+
let height = useAttrSize && n.h ? n.h * cell : el.clientHeight; // getBoundingClientRect().height seem to flicker back and forth
|
|
1138
|
+
let item;
|
|
1139
|
+
if (n.resizeToContentParent)
|
|
1140
|
+
item = el.querySelector(n.resizeToContentParent);
|
|
1141
|
+
if (!item)
|
|
1142
|
+
item = el.querySelector(GridStack.resizeToContentParent);
|
|
1143
|
+
if (!item)
|
|
1144
|
+
return;
|
|
1145
|
+
const child = item.firstElementChild;
|
|
1146
|
+
// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
|
|
1147
|
+
if (!child) {
|
|
1148
|
+
console.log(`Error: resizeToContent() '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
const padding = el.clientHeight - item.clientHeight; // full - available height to our child (minus border, padding...)
|
|
1152
|
+
const 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)
|
|
1153
|
+
const wantedH = child.getBoundingClientRect().height || itemH;
|
|
1154
|
+
if (itemH === wantedH)
|
|
1155
|
+
return;
|
|
1156
|
+
height += wantedH - itemH;
|
|
1157
|
+
let h = Math.ceil(height / cell);
|
|
1158
|
+
// check for min/max and special sizing
|
|
1159
|
+
const softMax = Number.isInteger(n.sizeToContent) ? n.sizeToContent : 0;
|
|
1160
|
+
if (softMax && h > softMax) {
|
|
1161
|
+
h = softMax;
|
|
1162
|
+
el.classList.add('size-to-content-max'); // get v-scroll back
|
|
1163
|
+
}
|
|
1164
|
+
if (n.minH && h < n.minH)
|
|
1165
|
+
h = n.minH;
|
|
1166
|
+
else if (n.maxH && h > n.maxH)
|
|
1167
|
+
h = n.maxH;
|
|
1168
|
+
if (h !== n.h) {
|
|
1169
|
+
grid._ignoreLayoutsNodeChange = true;
|
|
1170
|
+
grid.moveNode(n, { h });
|
|
1171
|
+
delete grid._ignoreLayoutsNodeChange;
|
|
1172
|
+
}
|
|
1161
1173
|
}
|
|
1162
1174
|
/** call the user resize (so we can do extra work) else our build in version */
|
|
1163
|
-
resizeToContentCheck(el) {
|
|
1175
|
+
resizeToContentCheck(el, useAttr = false) {
|
|
1164
1176
|
if (GridStack.resizeToContentCB)
|
|
1165
1177
|
GridStack.resizeToContentCB(el);
|
|
1166
1178
|
else
|
|
1167
|
-
this.resizeToContent(el);
|
|
1179
|
+
this.resizeToContent(el, useAttr);
|
|
1168
1180
|
}
|
|
1169
1181
|
/**
|
|
1170
1182
|
* 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).
|
|
@@ -1359,8 +1371,8 @@ class GridStack {
|
|
|
1359
1371
|
if (!Utils.same(node, copy)) {
|
|
1360
1372
|
this._writeAttr(el, node);
|
|
1361
1373
|
}
|
|
1362
|
-
if (Utils.
|
|
1363
|
-
el.classList.add('
|
|
1374
|
+
if (Utils.shouldSizeToContent(node))
|
|
1375
|
+
el.classList.add('size-to-content');
|
|
1364
1376
|
this._prepareDragDropByNode(node);
|
|
1365
1377
|
return this;
|
|
1366
1378
|
}
|
|
@@ -1456,7 +1468,7 @@ class GridStack {
|
|
|
1456
1468
|
/**
|
|
1457
1469
|
* called when we are being resized - check if the one Column Mode needs to be turned on/off
|
|
1458
1470
|
* and remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)
|
|
1459
|
-
* or `
|
|
1471
|
+
* or `sizeToContent` gridItem options.
|
|
1460
1472
|
*/
|
|
1461
1473
|
onResize() {
|
|
1462
1474
|
if (!this.el?.clientWidth)
|
|
@@ -1479,7 +1491,7 @@ class GridStack {
|
|
|
1479
1491
|
let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize ||
|
|
1480
1492
|
(this.opts.column === 1 && !this._prevColumn);
|
|
1481
1493
|
if ((this.opts.column === 1) !== oneColumn) {
|
|
1482
|
-
// if (this.opts.animate) this.setAnimation(false); // 1 <-> 12 is too radical, turn off animation and we need it for
|
|
1494
|
+
// if (this.opts.animate) this.setAnimation(false); // 1 <-> 12 is too radical, turn off animation and we need it for sizeToContent
|
|
1483
1495
|
this.column(oneColumn ? 1 : this._prevColumn);
|
|
1484
1496
|
// if (this.opts.animate) setTimeout(() => this.setAnimation(true));
|
|
1485
1497
|
columnChanged = true;
|
|
@@ -1493,24 +1505,24 @@ class GridStack {
|
|
|
1493
1505
|
if (n.subGrid)
|
|
1494
1506
|
n.subGrid.onResize();
|
|
1495
1507
|
});
|
|
1496
|
-
this.doContentResize(columnChanged);
|
|
1508
|
+
this.doContentResize(columnChanged); // wait for anim of column changed (DOM reflow before we can size correctly)
|
|
1497
1509
|
this.batchUpdate(false);
|
|
1498
1510
|
return this;
|
|
1499
1511
|
}
|
|
1500
|
-
doContentResize(delay = true, n = undefined) {
|
|
1501
|
-
// update any gridItem height with
|
|
1512
|
+
doContentResize(delay = true, useAttr = false, n = undefined) {
|
|
1513
|
+
// update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
|
|
1502
1514
|
// 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 ?
|
|
1503
1515
|
setTimeout(() => {
|
|
1504
1516
|
if (n) {
|
|
1505
|
-
if (Utils.
|
|
1506
|
-
this.resizeToContentCheck(n.el);
|
|
1517
|
+
if (Utils.shouldSizeToContent(n))
|
|
1518
|
+
this.resizeToContentCheck(n.el, useAttr);
|
|
1507
1519
|
}
|
|
1508
1520
|
else {
|
|
1509
1521
|
const nodes = [...this.engine.nodes]; // in case order changes while resizing one
|
|
1510
1522
|
this.batchUpdate();
|
|
1511
1523
|
nodes.forEach(n => {
|
|
1512
|
-
if (Utils.
|
|
1513
|
-
this.resizeToContentCheck(n.el);
|
|
1524
|
+
if (Utils.shouldSizeToContent(n))
|
|
1525
|
+
this.resizeToContentCheck(n.el, useAttr);
|
|
1514
1526
|
});
|
|
1515
1527
|
this.batchUpdate(false);
|
|
1516
1528
|
}
|
|
@@ -1521,8 +1533,8 @@ class GridStack {
|
|
|
1521
1533
|
/** add or remove the grid element size event handler */
|
|
1522
1534
|
_updateResizeEvent(forceRemove = false) {
|
|
1523
1535
|
// 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)
|
|
1524
|
-
// or supporting new
|
|
1525
|
-
const trackSize = !this.parentGridItem && (this._isAutoCellHeight || this.opts.
|
|
1536
|
+
// or supporting new sizeToContent option.
|
|
1537
|
+
const trackSize = !this.parentGridItem && (this._isAutoCellHeight || this.opts.sizeToContent || !this.opts.disableOneColumnMode || this.engine.nodes.find(n => n.sizeToContent));
|
|
1526
1538
|
if (!forceRemove && trackSize && !this.resizeObserver) {
|
|
1527
1539
|
this._sizeThrottle = Utils.throttle(() => this.onResize(), this.opts.cellHeightThrottle);
|
|
1528
1540
|
this.resizeObserver = new ResizeObserver(entries => this._sizeThrottle());
|
|
@@ -2071,8 +2083,11 @@ class GridStack {
|
|
|
2071
2083
|
this._updateContainerHeight(); // @ts-ignore
|
|
2072
2084
|
this._triggerChangeEvent();
|
|
2073
2085
|
this.engine.endUpdate();
|
|
2074
|
-
if (event.type === 'resizestop')
|
|
2075
|
-
|
|
2086
|
+
if (event.type === 'resizestop') {
|
|
2087
|
+
if (Number.isInteger(node.sizeToContent))
|
|
2088
|
+
node.sizeToContent = node.h; // new soft limit
|
|
2089
|
+
this.doContentResize(false, true, node); // no amin wait as will use the actual sized coordinate attr
|
|
2090
|
+
}
|
|
2076
2091
|
};
|
|
2077
2092
|
dd.draggable(el, {
|
|
2078
2093
|
start: onStartMoving,
|
|
@@ -2248,6 +2263,6 @@ GridStack.resizeToContentParent = '.grid-stack-item-content';
|
|
|
2248
2263
|
GridStack.Utils = Utils;
|
|
2249
2264
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2250
2265
|
GridStack.Engine = GridStackEngine;
|
|
2251
|
-
GridStack.GDRev = '9.
|
|
2266
|
+
GridStack.GDRev = '9.1.1';
|
|
2252
2267
|
export { GridStack };
|
|
2253
2268
|
//# sourceMappingURL=gridstack.js.map
|