gridstack 9.1.1 → 9.2.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/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 +1 -1
- 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 +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 +1 -1
- 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 +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 +1 -1
- package/dist/es5/gridstack-engine.js +4 -3
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +7 -6
- package/dist/es5/gridstack.js +61 -41
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +5 -5
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +1 -1
- package/dist/es5/utils.js +1 -1
- 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 +4 -3
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +7 -6
- package/dist/gridstack.js +63 -43
- package/dist/gridstack.js.map +1 -1
- package/dist/src/gridstack.scss +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +9 -0
- package/doc/README.md +7 -0
- package/package.json +1 -1
package/dist/gridstack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GridStack 9.
|
|
2
|
+
* GridStack 9.2.1
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2022 Alain Dumesny
|
|
@@ -540,7 +540,7 @@ class GridStack {
|
|
|
540
540
|
*
|
|
541
541
|
* @example
|
|
542
542
|
* see http://gridstackjs.com/demo/serialization.html
|
|
543
|
-
|
|
543
|
+
*/
|
|
544
544
|
load(layout, addRemove = GridStack.addRemoveCB || true) {
|
|
545
545
|
// if passed list has coordinates, use them (insert from end to beginning for conflict resolution) else force widget same order
|
|
546
546
|
const haveCoord = layout.some(w => w.x !== undefined || w.y !== undefined);
|
|
@@ -696,7 +696,7 @@ class GridStack {
|
|
|
696
696
|
* 'compact' might re-order items to fill any empty space
|
|
697
697
|
*
|
|
698
698
|
* doSort - 'false' to let you do your own sorting ahead in case you need to control a different order. (default to sort)
|
|
699
|
-
|
|
699
|
+
*/
|
|
700
700
|
compact(layout = 'compact', doSort = true) {
|
|
701
701
|
this.engine.compact(layout, doSort);
|
|
702
702
|
this._triggerChangeEvent();
|
|
@@ -1118,10 +1118,12 @@ class GridStack {
|
|
|
1118
1118
|
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
|
|
1119
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
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
|
-
|
|
1121
|
+
*/
|
|
1122
1122
|
resizeToContent(el, useAttrSize = false) {
|
|
1123
|
-
el
|
|
1124
|
-
|
|
1123
|
+
if (!el)
|
|
1124
|
+
return;
|
|
1125
|
+
el.classList.remove('size-to-content-max');
|
|
1126
|
+
if (!el.clientHeight)
|
|
1125
1127
|
return; // 0 when hidden, skip
|
|
1126
1128
|
let n = el.gridstackNode;
|
|
1127
1129
|
if (!n)
|
|
@@ -1142,15 +1144,22 @@ class GridStack {
|
|
|
1142
1144
|
item = el.querySelector(GridStack.resizeToContentParent);
|
|
1143
1145
|
if (!item)
|
|
1144
1146
|
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
1147
|
const padding = el.clientHeight - item.clientHeight; // full - available height to our child (minus border, padding...)
|
|
1152
1148
|
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
|
-
|
|
1149
|
+
let wantedH;
|
|
1150
|
+
if (n.subGrid) {
|
|
1151
|
+
// sub-grid - use their actual row count * their cell height
|
|
1152
|
+
wantedH = n.subGrid.getRow() * n.subGrid.getCellHeight();
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
|
|
1156
|
+
const child = item.firstElementChild;
|
|
1157
|
+
if (!child) {
|
|
1158
|
+
console.log(`Error: resizeToContent() '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
wantedH = child.getBoundingClientRect().height || itemH;
|
|
1162
|
+
}
|
|
1154
1163
|
if (itemH === wantedH)
|
|
1155
1164
|
return;
|
|
1156
1165
|
height += wantedH - itemH;
|
|
@@ -1171,10 +1180,10 @@ class GridStack {
|
|
|
1171
1180
|
delete grid._ignoreLayoutsNodeChange;
|
|
1172
1181
|
}
|
|
1173
1182
|
}
|
|
1174
|
-
/** call the user resize (so
|
|
1183
|
+
/** call the user resize (so they can do extra work) else our build in version */
|
|
1175
1184
|
resizeToContentCheck(el, useAttr = false) {
|
|
1176
1185
|
if (GridStack.resizeToContentCB)
|
|
1177
|
-
GridStack.resizeToContentCB(el);
|
|
1186
|
+
GridStack.resizeToContentCB(el, useAttr);
|
|
1178
1187
|
else
|
|
1179
1188
|
this.resizeToContent(el, useAttr);
|
|
1180
1189
|
}
|
|
@@ -1335,27 +1344,33 @@ class GridStack {
|
|
|
1335
1344
|
_updateContainerHeight() {
|
|
1336
1345
|
if (!this.engine || this.engine.batchMode)
|
|
1337
1346
|
return this;
|
|
1338
|
-
|
|
1339
|
-
//
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
// let cssMinHeight = parseInt(getComputedStyle(this.el)['min-height']);
|
|
1343
|
-
// if (cssMinHeight > 0) {
|
|
1344
|
-
// let minRow = Math.round(cssMinHeight / this.getCellHeight(true));
|
|
1345
|
-
// if (row < minRow) {
|
|
1346
|
-
// row = minRow;
|
|
1347
|
-
// }
|
|
1348
|
-
// }
|
|
1349
|
-
this.el.setAttribute('gs-current-row', String(row));
|
|
1350
|
-
if (row === 0) {
|
|
1351
|
-
this.el.style.removeProperty('min-height');
|
|
1352
|
-
return this;
|
|
1353
|
-
}
|
|
1354
|
-
let cellHeight = this.opts.cellHeight;
|
|
1355
|
-
let unit = this.opts.cellHeightUnit;
|
|
1347
|
+
const parent = this.parentGridItem;
|
|
1348
|
+
let row = this.getRow() + this._extraDragRow; // this checks for minRow already
|
|
1349
|
+
const cellHeight = this.opts.cellHeight;
|
|
1350
|
+
const unit = this.opts.cellHeightUnit;
|
|
1356
1351
|
if (!cellHeight)
|
|
1357
1352
|
return this;
|
|
1358
|
-
|
|
1353
|
+
// check for css min height (non nested grid). TODO: support mismatch, say: min % while unit is px.
|
|
1354
|
+
if (!parent) {
|
|
1355
|
+
const cssMinHeight = Utils.parseHeight(getComputedStyle(this.el)['minHeight']);
|
|
1356
|
+
if (cssMinHeight.h > 0 && cssMinHeight.unit === unit) {
|
|
1357
|
+
const minRow = Math.floor(cssMinHeight.h / cellHeight);
|
|
1358
|
+
if (row < minRow) {
|
|
1359
|
+
row = minRow;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
this.el.setAttribute('gs-current-row', String(row));
|
|
1364
|
+
this.el.style.removeProperty('min-height');
|
|
1365
|
+
this.el.style.removeProperty('height');
|
|
1366
|
+
if (row) {
|
|
1367
|
+
// nested grids have 'insert:0' to fill the space of parent by default, but we may be taller so use min-height for possible scrollbars
|
|
1368
|
+
this.el.style[parent ? 'minHeight' : 'height'] = row * cellHeight + unit;
|
|
1369
|
+
}
|
|
1370
|
+
// if we're a nested grid inside an sizeToContent item, tell it to resize itself too
|
|
1371
|
+
if (parent && !parent.grid.engine.batchMode && Utils.shouldSizeToContent(parent)) {
|
|
1372
|
+
parent.grid.resizeToContentCheck(parent.el);
|
|
1373
|
+
}
|
|
1359
1374
|
return this;
|
|
1360
1375
|
}
|
|
1361
1376
|
/** @internal */
|
|
@@ -1505,7 +1520,9 @@ class GridStack {
|
|
|
1505
1520
|
if (n.subGrid)
|
|
1506
1521
|
n.subGrid.onResize();
|
|
1507
1522
|
});
|
|
1508
|
-
this.
|
|
1523
|
+
if (!this._skipInitialResize)
|
|
1524
|
+
this.doContentResize(columnChanged); // wait for anim of column changed (DOM reflow before we can size correctly)
|
|
1525
|
+
delete this._skipInitialResize;
|
|
1509
1526
|
this.batchUpdate(false);
|
|
1510
1527
|
return this;
|
|
1511
1528
|
}
|
|
@@ -1517,7 +1534,7 @@ class GridStack {
|
|
|
1517
1534
|
if (Utils.shouldSizeToContent(n))
|
|
1518
1535
|
this.resizeToContentCheck(n.el, useAttr);
|
|
1519
1536
|
}
|
|
1520
|
-
else {
|
|
1537
|
+
else if (this.engine.nodes.some(n => Utils.shouldSizeToContent(n))) {
|
|
1521
1538
|
const nodes = [...this.engine.nodes]; // in case order changes while resizing one
|
|
1522
1539
|
this.batchUpdate();
|
|
1523
1540
|
nodes.forEach(n => {
|
|
@@ -1526,6 +1543,7 @@ class GridStack {
|
|
|
1526
1543
|
});
|
|
1527
1544
|
this.batchUpdate(false);
|
|
1528
1545
|
}
|
|
1546
|
+
// call this regardless of shouldSizeToContent because widget might need to stretch to take available space after a resize
|
|
1529
1547
|
if (this._gsEventHandler['resizecontent'])
|
|
1530
1548
|
this._gsEventHandler['resizecontent'](null, n ? [n] : this.engine.nodes);
|
|
1531
1549
|
}, delay ? 300 + 10 : 0);
|
|
@@ -1534,11 +1552,13 @@ class GridStack {
|
|
|
1534
1552
|
_updateResizeEvent(forceRemove = false) {
|
|
1535
1553
|
// 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)
|
|
1536
1554
|
// or supporting new sizeToContent option.
|
|
1537
|
-
const trackSize = !this.parentGridItem && (this._isAutoCellHeight || this.opts.sizeToContent || !this.opts.disableOneColumnMode
|
|
1555
|
+
const trackSize = !this.parentGridItem && (this._isAutoCellHeight || this.opts.sizeToContent || !this.opts.disableOneColumnMode
|
|
1556
|
+
|| this.engine.nodes.find(n => n.sizeToContent));
|
|
1538
1557
|
if (!forceRemove && trackSize && !this.resizeObserver) {
|
|
1539
1558
|
this._sizeThrottle = Utils.throttle(() => this.onResize(), this.opts.cellHeightThrottle);
|
|
1540
1559
|
this.resizeObserver = new ResizeObserver(entries => this._sizeThrottle());
|
|
1541
1560
|
this.resizeObserver.observe(this.el);
|
|
1561
|
+
this._skipInitialResize = true; // makeWidget will originally have called on startup
|
|
1542
1562
|
}
|
|
1543
1563
|
else if ((forceRemove || !trackSize) && this.resizeObserver) {
|
|
1544
1564
|
this.resizeObserver.disconnect();
|
|
@@ -1634,7 +1654,7 @@ class GridStack {
|
|
|
1634
1654
|
* @param dragIn string selector (ex: '.sidebar .grid-stack-item') or list of dom elements
|
|
1635
1655
|
* @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
1636
1656
|
* @param root optional root which defaults to document (for shadow dom pas the parent HTMLDocument)
|
|
1637
|
-
|
|
1657
|
+
*/
|
|
1638
1658
|
static setupDragIn(dragIn, dragInOptions, root = document) {
|
|
1639
1659
|
if (dragInOptions?.pause !== undefined) {
|
|
1640
1660
|
DDManager.pauseDrag = dragInOptions.pause;
|
|
@@ -2011,7 +2031,7 @@ class GridStack {
|
|
|
2011
2031
|
}
|
|
2012
2032
|
return this;
|
|
2013
2033
|
}
|
|
2014
|
-
/** @internal prepares the element for drag&drop
|
|
2034
|
+
/** @internal prepares the element for drag&drop */
|
|
2015
2035
|
_prepareDragDropByNode(node) {
|
|
2016
2036
|
let el = node.el;
|
|
2017
2037
|
const noMove = node.noMove || this.opts.disableDrag;
|
|
@@ -2105,7 +2125,7 @@ class GridStack {
|
|
|
2105
2125
|
.resizable(el, noResize ? 'disable' : 'enable');
|
|
2106
2126
|
return this;
|
|
2107
2127
|
}
|
|
2108
|
-
/** @internal handles actual drag/resize start
|
|
2128
|
+
/** @internal handles actual drag/resize start */
|
|
2109
2129
|
_onStartMoving(el, event, ui, node, cellWidth, cellHeight) {
|
|
2110
2130
|
this.engine.cleanNodes()
|
|
2111
2131
|
.beginUpdate(node);
|
|
@@ -2136,7 +2156,7 @@ class GridStack {
|
|
|
2136
2156
|
}
|
|
2137
2157
|
}
|
|
2138
2158
|
}
|
|
2139
|
-
/** @internal handles actual drag/resize
|
|
2159
|
+
/** @internal handles actual drag/resize */
|
|
2140
2160
|
_dragOrResize(el, event, ui, node, cellWidth, cellHeight) {
|
|
2141
2161
|
let p = { ...node._orig }; // could be undefined (_isExternal) which is ok (drag only set x,y and w,h will default to node value)
|
|
2142
2162
|
let resizing;
|
|
@@ -2224,7 +2244,7 @@ class GridStack {
|
|
|
2224
2244
|
/** @internal called when item leaving our area by either cursor dropout event
|
|
2225
2245
|
* or shape is outside our boundaries. remove it from us, and mark temporary if this was
|
|
2226
2246
|
* our item to start with else restore prev node values from prev grid it came from.
|
|
2227
|
-
|
|
2247
|
+
*/
|
|
2228
2248
|
_leave(el, helper) {
|
|
2229
2249
|
let node = el.gridstackNode;
|
|
2230
2250
|
if (!node)
|
|
@@ -2263,6 +2283,6 @@ GridStack.resizeToContentParent = '.grid-stack-item-content';
|
|
|
2263
2283
|
GridStack.Utils = Utils;
|
|
2264
2284
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2265
2285
|
GridStack.Engine = GridStackEngine;
|
|
2266
|
-
GridStack.GDRev = '9.
|
|
2286
|
+
GridStack.GDRev = '9.2.1';
|
|
2267
2287
|
export { GridStack };
|
|
2268
2288
|
//# sourceMappingURL=gridstack.js.map
|