gridstack 9.1.0 → 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.
Files changed (110) hide show
  1. package/angular/projects/lib/package.json +1 -1
  2. package/angular/projects/lib/src/lib/base-widget.ts +1 -1
  3. package/angular/projects/lib/src/lib/gridstack-item.component.ts +1 -1
  4. package/angular/projects/lib/src/lib/gridstack.component.ts +1 -1
  5. package/angular/projects/lib/src/lib/gridstack.module.ts +1 -1
  6. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  7. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  8. package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
  9. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  10. package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
  11. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  12. package/dist/angular/fesm2020/gridstack-angular.mjs +4 -4
  13. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  14. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  15. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  16. package/dist/angular/package.json +1 -1
  17. package/dist/angular/src/base-widget.ts +1 -1
  18. package/dist/angular/src/gridstack-item.component.ts +1 -1
  19. package/dist/angular/src/gridstack.component.ts +1 -1
  20. package/dist/angular/src/gridstack.module.ts +1 -1
  21. package/dist/dd-base-impl.d.ts +1 -1
  22. package/dist/dd-base-impl.js +1 -1
  23. package/dist/dd-base-impl.js.map +1 -1
  24. package/dist/dd-draggable.d.ts +1 -1
  25. package/dist/dd-draggable.js +2 -2
  26. package/dist/dd-draggable.js.map +1 -1
  27. package/dist/dd-droppable.d.ts +1 -1
  28. package/dist/dd-droppable.js +1 -1
  29. package/dist/dd-droppable.js.map +1 -1
  30. package/dist/dd-element.d.ts +1 -1
  31. package/dist/dd-element.js +1 -1
  32. package/dist/dd-element.js.map +1 -1
  33. package/dist/dd-gridstack.d.ts +1 -1
  34. package/dist/dd-gridstack.js +1 -1
  35. package/dist/dd-gridstack.js.map +1 -1
  36. package/dist/dd-manager.d.ts +1 -1
  37. package/dist/dd-manager.js +1 -1
  38. package/dist/dd-manager.js.map +1 -1
  39. package/dist/dd-resizable-handle.d.ts +1 -1
  40. package/dist/dd-resizable-handle.js +1 -1
  41. package/dist/dd-resizable-handle.js.map +1 -1
  42. package/dist/dd-resizable.d.ts +1 -1
  43. package/dist/dd-resizable.js +2 -2
  44. package/dist/dd-resizable.js.map +1 -1
  45. package/dist/dd-touch.d.ts +1 -1
  46. package/dist/dd-touch.js +1 -1
  47. package/dist/dd-touch.js.map +1 -1
  48. package/dist/es5/dd-base-impl.d.ts +1 -1
  49. package/dist/es5/dd-base-impl.js +1 -1
  50. package/dist/es5/dd-base-impl.js.map +1 -1
  51. package/dist/es5/dd-draggable.d.ts +1 -1
  52. package/dist/es5/dd-draggable.js +2 -2
  53. package/dist/es5/dd-draggable.js.map +1 -1
  54. package/dist/es5/dd-droppable.d.ts +1 -1
  55. package/dist/es5/dd-droppable.js +1 -1
  56. package/dist/es5/dd-droppable.js.map +1 -1
  57. package/dist/es5/dd-element.d.ts +1 -1
  58. package/dist/es5/dd-element.js +1 -1
  59. package/dist/es5/dd-element.js.map +1 -1
  60. package/dist/es5/dd-gridstack.d.ts +1 -1
  61. package/dist/es5/dd-gridstack.js +1 -1
  62. package/dist/es5/dd-gridstack.js.map +1 -1
  63. package/dist/es5/dd-manager.d.ts +1 -1
  64. package/dist/es5/dd-manager.js +1 -1
  65. package/dist/es5/dd-manager.js.map +1 -1
  66. package/dist/es5/dd-resizable-handle.d.ts +1 -1
  67. package/dist/es5/dd-resizable-handle.js +1 -1
  68. package/dist/es5/dd-resizable-handle.js.map +1 -1
  69. package/dist/es5/dd-resizable.d.ts +1 -1
  70. package/dist/es5/dd-resizable.js +2 -2
  71. package/dist/es5/dd-resizable.js.map +1 -1
  72. package/dist/es5/dd-touch.d.ts +1 -1
  73. package/dist/es5/dd-touch.js +1 -1
  74. package/dist/es5/dd-touch.js.map +1 -1
  75. package/dist/es5/gridstack-all.js +1 -1
  76. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  77. package/dist/es5/gridstack-all.js.map +1 -1
  78. package/dist/es5/gridstack-engine.d.ts +1 -1
  79. package/dist/es5/gridstack-engine.js +3 -2
  80. package/dist/es5/gridstack-engine.js.map +1 -1
  81. package/dist/es5/gridstack-poly.js +1 -1
  82. package/dist/es5/gridstack.d.ts +8 -5
  83. package/dist/es5/gridstack.js +70 -70
  84. package/dist/es5/gridstack.js.map +1 -1
  85. package/dist/es5/types.d.ts +4 -4
  86. package/dist/es5/types.js +1 -1
  87. package/dist/es5/types.js.map +1 -1
  88. package/dist/es5/utils.d.ts +1 -1
  89. package/dist/es5/utils.js +2 -2
  90. package/dist/es5/utils.js.map +1 -1
  91. package/dist/gridstack-all.js +1 -1
  92. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  93. package/dist/gridstack-all.js.map +1 -1
  94. package/dist/gridstack-engine.d.ts +1 -1
  95. package/dist/gridstack-engine.js +3 -2
  96. package/dist/gridstack-engine.js.map +1 -1
  97. package/dist/gridstack.css +2 -2
  98. package/dist/gridstack.d.ts +8 -5
  99. package/dist/gridstack.js +67 -69
  100. package/dist/gridstack.js.map +1 -1
  101. package/dist/gridstack.min.css +1 -1
  102. package/dist/src/gridstack.scss +2 -2
  103. package/dist/types.d.ts +4 -4
  104. package/dist/types.js +1 -1
  105. package/dist/types.js.map +1 -1
  106. package/dist/utils.d.ts +1 -1
  107. package/dist/utils.js +2 -2
  108. package/dist/utils.js.map +1 -1
  109. package/doc/CHANGES.md +5 -0
  110. package/package.json +1 -1
@@ -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.1.0
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,72 +1189,71 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1189
1189
  this._triggerChangeEvent();
1190
1190
  this.engine.endUpdate();
1191
1191
  };
1192
- /** Updates widget height to match the content height to avoid v-scrollbar or dead space.
1193
- Note: this assumes only 1 child under '.grid-stack-item-content' (sized to gridItem minus padding) that is at the entire content size wanted */
1194
- GridStack.prototype.resizeToContent = function (els) {
1195
- var _this = this;
1196
- GridStack.getElements(els).forEach(function (el) {
1197
- if (!el.clientHeight)
1198
- return; // 0 when hidden, skip
1199
- var n = el === null || el === void 0 ? void 0 : el.gridstackNode;
1200
- if (!n)
1201
- return;
1202
- var grid = n.grid;
1203
- if (grid !== _this)
1204
- return grid === null || grid === void 0 ? void 0 : grid.resizeToContent(el);
1205
- if (el.parentElement !== _this.el)
1206
- return; // skip if we are not inside a grid
1207
- var cell = _this.getCellHeight();
1208
- if (!cell)
1209
- return;
1210
- var height = n.h ? n.h * cell : el.clientHeight; // getBoundingClientRect().height seem to flicker back and forth
1211
- var item;
1212
- if (n.resizeToContentParent)
1213
- item = el.querySelector(n.resizeToContentParent);
1214
- if (!item)
1215
- item = el.querySelector(GridStack.resizeToContentParent);
1216
- if (!item)
1217
- return;
1218
- var child = item.firstElementChild;
1219
- // NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
1220
- if (!child) {
1221
- console.log("Error: resizeToContent() '".concat(GridStack.resizeToContentParent, "'.firstElementChild is null, make sure to have a div like container. Skipping sizing."));
1222
- return;
1223
- }
1224
- var padding = el.clientHeight - item.clientHeight; // full - available height to our child (minus border, padding...)
1225
- var itemH = 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)
1226
- var wantedH = child.getBoundingClientRect().height || itemH;
1227
- if (itemH === wantedH)
1228
- return;
1229
- height += wantedH - itemH;
1230
- var h = Math.ceil(height / cell);
1231
- // check for min/max and special sizing
1232
- var softMax = Number.isInteger(n.sizeToContent) ? n.sizeToContent : 0;
1233
- if (softMax) {
1234
- if (h > softMax) {
1235
- h = softMax;
1236
- el.classList.remove('size-to-content'); // get v-scroll back
1237
- }
1238
- else
1239
- el.classList.add('size-to-content');
1240
- }
1241
- if (n.minH && h < n.minH)
1242
- h = n.minH;
1243
- else if (n.maxH && h > n.maxH)
1244
- h = n.maxH;
1245
- if (h !== n.h) {
1246
- _this._ignoreLayoutsNodeChange = true;
1247
- _this.moveNode(n, { h: h });
1248
- delete _this._ignoreLayoutsNodeChange;
1249
- }
1250
- });
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
+ }
1251
1249
  };
1252
1250
  /** call the user resize (so we can do extra work) else our build in version */
1253
- GridStack.prototype.resizeToContentCheck = function (el) {
1251
+ GridStack.prototype.resizeToContentCheck = function (el, useAttr) {
1252
+ if (useAttr === void 0) { useAttr = false; }
1254
1253
  if (GridStack.resizeToContentCB)
1255
1254
  GridStack.resizeToContentCB(el);
1256
1255
  else
1257
- this.resizeToContent(el);
1256
+ this.resizeToContent(el, useAttr);
1258
1257
  };
1259
1258
  /**
1260
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).
@@ -1590,27 +1589,28 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1590
1589
  if (n.subGrid)
1591
1590
  n.subGrid.onResize();
1592
1591
  });
1593
- this.doContentResize(columnChanged);
1592
+ this.doContentResize(columnChanged); // wait for anim of column changed (DOM reflow before we can size correctly)
1594
1593
  this.batchUpdate(false);
1595
1594
  return this;
1596
1595
  };
1597
- GridStack.prototype.doContentResize = function (delay, n) {
1596
+ GridStack.prototype.doContentResize = function (delay, useAttr, n) {
1598
1597
  var _this = this;
1599
1598
  if (delay === void 0) { delay = true; }
1599
+ if (useAttr === void 0) { useAttr = false; }
1600
1600
  if (n === void 0) { n = undefined; }
1601
1601
  // update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
1602
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 ?
1603
1603
  setTimeout(function () {
1604
1604
  if (n) {
1605
1605
  if (utils_1.Utils.shouldSizeToContent(n))
1606
- _this.resizeToContentCheck(n.el);
1606
+ _this.resizeToContentCheck(n.el, useAttr);
1607
1607
  }
1608
1608
  else {
1609
1609
  var nodes = __spreadArray([], _this.engine.nodes, true); // in case order changes while resizing one
1610
1610
  _this.batchUpdate();
1611
1611
  nodes.forEach(function (n) {
1612
1612
  if (utils_1.Utils.shouldSizeToContent(n))
1613
- _this.resizeToContentCheck(n.el);
1613
+ _this.resizeToContentCheck(n.el, useAttr);
1614
1614
  });
1615
1615
  _this.batchUpdate(false);
1616
1616
  }
@@ -2196,7 +2196,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2196
2196
  if (event.type === 'resizestop') {
2197
2197
  if (Number.isInteger(node.sizeToContent))
2198
2198
  node.sizeToContent = node.h; // new soft limit
2199
- _this.doContentResize(false, node);
2199
+ _this.doContentResize(false, true, node); // no amin wait as will use the actual sized coordinate attr
2200
2200
  }
2201
2201
  };
2202
2202
  dd.draggable(el, {
@@ -2372,7 +2372,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2372
2372
  GridStack.Utils = utils_1.Utils;
2373
2373
  /** scoping so users can call new GridStack.Engine(12) for example */
2374
2374
  GridStack.Engine = gridstack_engine_1.GridStackEngine;
2375
- GridStack.GDRev = '9.1.0';
2375
+ GridStack.GDRev = '9.1.1';
2376
2376
  return GridStack;
2377
2377
  }());
2378
2378
  //# sourceMappingURL=gridstack.js.map