gridstack 9.4.0 → 9.5.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 (111) hide show
  1. package/angular/package.json +1 -1
  2. package/angular/projects/lib/package.json +1 -1
  3. package/angular/projects/lib/src/lib/base-widget.ts +1 -1
  4. package/angular/projects/lib/src/lib/gridstack-item.component.ts +1 -1
  5. package/angular/projects/lib/src/lib/gridstack.component.ts +1 -1
  6. package/angular/projects/lib/src/lib/gridstack.module.ts +1 -1
  7. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  8. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  9. package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
  10. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  11. package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
  12. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  13. package/dist/angular/fesm2020/gridstack-angular.mjs +4 -4
  14. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  15. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  16. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  17. package/dist/angular/package.json +1 -1
  18. package/dist/angular/src/base-widget.ts +1 -1
  19. package/dist/angular/src/gridstack-item.component.ts +1 -1
  20. package/dist/angular/src/gridstack.component.ts +1 -1
  21. package/dist/angular/src/gridstack.module.ts +1 -1
  22. package/dist/dd-base-impl.d.ts +1 -1
  23. package/dist/dd-base-impl.js +1 -1
  24. package/dist/dd-base-impl.js.map +1 -1
  25. package/dist/dd-draggable.d.ts +1 -1
  26. package/dist/dd-draggable.js +14 -9
  27. package/dist/dd-draggable.js.map +1 -1
  28. package/dist/dd-droppable.d.ts +1 -1
  29. package/dist/dd-droppable.js +1 -1
  30. package/dist/dd-droppable.js.map +1 -1
  31. package/dist/dd-element.d.ts +1 -1
  32. package/dist/dd-element.js +1 -1
  33. package/dist/dd-element.js.map +1 -1
  34. package/dist/dd-gridstack.d.ts +1 -1
  35. package/dist/dd-gridstack.js +1 -1
  36. package/dist/dd-gridstack.js.map +1 -1
  37. package/dist/dd-manager.d.ts +1 -1
  38. package/dist/dd-manager.js +1 -1
  39. package/dist/dd-manager.js.map +1 -1
  40. package/dist/dd-resizable-handle.d.ts +1 -1
  41. package/dist/dd-resizable-handle.js +1 -1
  42. package/dist/dd-resizable-handle.js.map +1 -1
  43. package/dist/dd-resizable.d.ts +1 -1
  44. package/dist/dd-resizable.js +29 -8
  45. package/dist/dd-resizable.js.map +1 -1
  46. package/dist/dd-touch.d.ts +1 -1
  47. package/dist/dd-touch.js +1 -1
  48. package/dist/dd-touch.js.map +1 -1
  49. package/dist/es5/dd-base-impl.d.ts +1 -1
  50. package/dist/es5/dd-base-impl.js +1 -1
  51. package/dist/es5/dd-base-impl.js.map +1 -1
  52. package/dist/es5/dd-draggable.d.ts +1 -1
  53. package/dist/es5/dd-draggable.js +14 -9
  54. package/dist/es5/dd-draggable.js.map +1 -1
  55. package/dist/es5/dd-droppable.d.ts +1 -1
  56. package/dist/es5/dd-droppable.js +1 -1
  57. package/dist/es5/dd-droppable.js.map +1 -1
  58. package/dist/es5/dd-element.d.ts +1 -1
  59. package/dist/es5/dd-element.js +1 -1
  60. package/dist/es5/dd-element.js.map +1 -1
  61. package/dist/es5/dd-gridstack.d.ts +1 -1
  62. package/dist/es5/dd-gridstack.js +1 -1
  63. package/dist/es5/dd-gridstack.js.map +1 -1
  64. package/dist/es5/dd-manager.d.ts +1 -1
  65. package/dist/es5/dd-manager.js +1 -1
  66. package/dist/es5/dd-manager.js.map +1 -1
  67. package/dist/es5/dd-resizable-handle.d.ts +1 -1
  68. package/dist/es5/dd-resizable-handle.js +1 -1
  69. package/dist/es5/dd-resizable-handle.js.map +1 -1
  70. package/dist/es5/dd-resizable.d.ts +1 -1
  71. package/dist/es5/dd-resizable.js +29 -8
  72. package/dist/es5/dd-resizable.js.map +1 -1
  73. package/dist/es5/dd-touch.d.ts +1 -1
  74. package/dist/es5/dd-touch.js +1 -1
  75. package/dist/es5/dd-touch.js.map +1 -1
  76. package/dist/es5/gridstack-all.js +1 -1
  77. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  78. package/dist/es5/gridstack-all.js.map +1 -1
  79. package/dist/es5/gridstack-engine.d.ts +6 -6
  80. package/dist/es5/gridstack-engine.js +12 -7
  81. package/dist/es5/gridstack-engine.js.map +1 -1
  82. package/dist/es5/gridstack-poly.js +1 -1
  83. package/dist/es5/gridstack.d.ts +1 -1
  84. package/dist/es5/gridstack.js +15 -20
  85. package/dist/es5/gridstack.js.map +1 -1
  86. package/dist/es5/types.d.ts +1 -1
  87. package/dist/es5/types.js +1 -1
  88. package/dist/es5/types.js.map +1 -1
  89. package/dist/es5/utils.d.ts +1 -1
  90. package/dist/es5/utils.js +3 -3
  91. package/dist/es5/utils.js.map +1 -1
  92. package/dist/gridstack-all.js +1 -1
  93. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  94. package/dist/gridstack-all.js.map +1 -1
  95. package/dist/gridstack-engine.d.ts +6 -6
  96. package/dist/gridstack-engine.js +11 -7
  97. package/dist/gridstack-engine.js.map +1 -1
  98. package/dist/gridstack.css +9 -3
  99. package/dist/gridstack.d.ts +1 -1
  100. package/dist/gridstack.js +15 -20
  101. package/dist/gridstack.js.map +1 -1
  102. package/dist/gridstack.min.css +1 -1
  103. package/dist/src/gridstack.scss +9 -3
  104. package/dist/types.d.ts +1 -1
  105. package/dist/types.js +1 -1
  106. package/dist/types.js.map +1 -1
  107. package/dist/utils.d.ts +1 -1
  108. package/dist/utils.js +3 -3
  109. package/dist/utils.js.map +1 -1
  110. package/doc/CHANGES.md +15 -1
  111. 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.4.0
39
+ * GridStack 9.5.1
40
40
  * https://gridstackjs.com/
41
41
  *
42
42
  * Copyright (c) 2021-2022 Alain Dumesny
@@ -603,7 +603,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
603
603
  this._insertNotAppend = haveCoord; // if we create in reverse order...
604
604
  // if we're loading a layout into for example 1 column (_prevColumn is set only when going to 1) and items don't fit, make sure to save
605
605
  // the original wanted layout so we can scale back up correctly #1471
606
- if (this._prevColumn && this._prevColumn !== this.opts.column && items.some(function (n) { return ((n.x || 0) + n.w) > _this.opts.column; })) {
606
+ var column = this.opts.column;
607
+ if (this._prevColumn && this._prevColumn !== column && items.some(function (n) { return ((n.x || 0) + n.w) > column; })) {
607
608
  this._ignoreLayoutsNodeChange = true; // skip layout update
608
609
  this.engine.cacheLayout(items, this._prevColumn, true);
609
610
  }
@@ -647,6 +648,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
647
648
  if (utils_1.Utils.shouldSizeToContent(item))
648
649
  w.h = item.h;
649
650
  // check if missing coord, in which case find next empty slot with new (or old if missing) sizes
651
+ _this.engine.nodeBoundFix(w); // before widthChanged is checked below...
650
652
  if (w.autoPosition || w.x === undefined || w.y === undefined) {
651
653
  w.w = w.w || item.w;
652
654
  w.h = w.h || item.h;
@@ -657,7 +659,6 @@ var GridStack = exports.GridStack = /** @class */ (function () {
657
659
  _this.engine.nodes.push(item);
658
660
  if (utils_1.Utils.samePos(item, w)) {
659
661
  _this.moveNode(item, __assign(__assign({}, w), { forceCollide: true }));
660
- utils_1.Utils.copyPos(w, item, true);
661
662
  }
662
663
  _this.update(item.el, w);
663
664
  if ((_a = w.subGridOpts) === null || _a === void 0 ? void 0 : _a.children) { // update any sub grid as well
@@ -797,9 +798,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
797
798
  if (!column || column < 1 || this.opts.column === column)
798
799
  return this;
799
800
  var oldColumn = this.getColumn();
800
- // if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)
801
+ // if we go into 1 column mode due to size change (disableOneColumnMode is off and we hit min width)
801
802
  // then remember the original columns so we can restore.
802
- if (column === 1) {
803
+ if (column === 1 && !this.opts.disableOneColumnMode) {
803
804
  this._prevColumn = oldColumn;
804
805
  }
805
806
  else {
@@ -1152,6 +1153,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1152
1153
  if (!n)
1153
1154
  return;
1154
1155
  var w = utils_1.Utils.cloneDeep(opt); // make a copy we can modify in case they re-use it or multiple items
1156
+ _this.engine.nodeBoundFix(w);
1155
1157
  delete w.autoPosition;
1156
1158
  delete w.id;
1157
1159
  // move/resize widget if anything changed
@@ -1193,10 +1195,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1193
1195
  }
1194
1196
  }
1195
1197
  utils_1.Utils.sanitizeMinMax(n);
1196
- // finally move the widget
1197
- if (m !== undefined)
1198
+ // finally move the widget and update attr
1199
+ if (m)
1198
1200
  _this.moveNode(n, m);
1199
- if (changed) { // move will only update x,y,w,h so update the rest too
1201
+ if (m || changed) {
1200
1202
  _this._writeAttr(el, n);
1201
1203
  }
1202
1204
  if (ddChanged) {
@@ -1642,6 +1644,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1642
1644
  // update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
1643
1645
  // 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 ?
1644
1646
  setTimeout(function () {
1647
+ if (!_this.engine)
1648
+ return; // we've been deleted in between!
1645
1649
  if (n) {
1646
1650
  if (utils_1.Utils.shouldSizeToContent(n))
1647
1651
  _this.resizeToContentCheck(n.el, useAttr);
@@ -2088,6 +2092,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2088
2092
  _this.engine.cleanupNode(node); // removes all internal _xyz values
2089
2093
  node.grid = _this;
2090
2094
  }
2095
+ delete node.grid._isTemp;
2091
2096
  dd.off(el, 'drag');
2092
2097
  // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)
2093
2098
  // as the helper will be nuked by jquery-ui otherwise. TODO: update old code path
@@ -2118,6 +2123,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2118
2123
  if (!subGrid.opts.styleInHead)
2119
2124
  subGrid._updateStyles(true); // re-create sub-grid styles now that we've moved
2120
2125
  }
2126
+ _this._prepareDragDropByNode(node);
2121
2127
  _this._updateContainerHeight();
2122
2128
  _this.engine.addedNodes.push(node); // @ts-ignore
2123
2129
  _this._triggerAddEvent(); // @ts-ignore
@@ -2126,17 +2132,6 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2126
2132
  if (_this._gsEventHandler['dropped']) {
2127
2133
  _this._gsEventHandler['dropped'](__assign(__assign({}, event), { type: 'dropped' }), origNode && origNode.grid ? origNode : undefined, node);
2128
2134
  }
2129
- // wait till we return out of the drag callback to set the new drag&resize handler or they may get messed up
2130
- window.setTimeout(function () {
2131
- // IFF we are still there (some application will use as placeholder and insert their real widget instead and better call makeWidget())
2132
- if (node.el && node.el.parentElement) {
2133
- _this._prepareDragDropByNode(node);
2134
- }
2135
- else {
2136
- _this.engine.removeNode(node);
2137
- }
2138
- delete node.grid._isTemp;
2139
- });
2140
2135
  return false; // prevent parent from receiving msg (which may be grid as well)
2141
2136
  });
2142
2137
  return this;
@@ -2419,7 +2414,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2419
2414
  GridStack.Utils = utils_1.Utils;
2420
2415
  /** scoping so users can call new GridStack.Engine(12) for example */
2421
2416
  GridStack.Engine = gridstack_engine_1.GridStackEngine;
2422
- GridStack.GDRev = '9.4.0';
2417
+ GridStack.GDRev = '9.5.1';
2423
2418
  return GridStack;
2424
2419
  }());
2425
2420
  //# sourceMappingURL=gridstack.js.map