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
package/dist/gridstack.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * GridStack 9.4.0
2
+ * GridStack 9.5.1
3
3
  * https://gridstackjs.com/
4
4
  *
5
5
  * Copyright (c) 2021-2022 Alain Dumesny
@@ -551,7 +551,8 @@ class GridStack {
551
551
  this._insertNotAppend = haveCoord; // if we create in reverse order...
552
552
  // 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
553
553
  // the original wanted layout so we can scale back up correctly #1471
554
- if (this._prevColumn && this._prevColumn !== this.opts.column && items.some(n => ((n.x || 0) + n.w) > this.opts.column)) {
554
+ const column = this.opts.column;
555
+ if (this._prevColumn && this._prevColumn !== column && items.some(n => ((n.x || 0) + n.w) > column)) {
555
556
  this._ignoreLayoutsNodeChange = true; // skip layout update
556
557
  this.engine.cacheLayout(items, this._prevColumn, true);
557
558
  }
@@ -594,6 +595,7 @@ class GridStack {
594
595
  if (Utils.shouldSizeToContent(item))
595
596
  w.h = item.h;
596
597
  // check if missing coord, in which case find next empty slot with new (or old if missing) sizes
598
+ this.engine.nodeBoundFix(w); // before widthChanged is checked below...
597
599
  if (w.autoPosition || w.x === undefined || w.y === undefined) {
598
600
  w.w = w.w || item.w;
599
601
  w.h = w.h || item.h;
@@ -604,7 +606,6 @@ class GridStack {
604
606
  this.engine.nodes.push(item);
605
607
  if (Utils.samePos(item, w)) {
606
608
  this.moveNode(item, { ...w, forceCollide: true });
607
- Utils.copyPos(w, item, true);
608
609
  }
609
610
  this.update(item.el, w);
610
611
  if (w.subGridOpts?.children) { // update any sub grid as well
@@ -738,9 +739,9 @@ class GridStack {
738
739
  if (!column || column < 1 || this.opts.column === column)
739
740
  return this;
740
741
  let oldColumn = this.getColumn();
741
- // if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)
742
+ // if we go into 1 column mode due to size change (disableOneColumnMode is off and we hit min width)
742
743
  // then remember the original columns so we can restore.
743
- if (column === 1) {
744
+ if (column === 1 && !this.opts.disableOneColumnMode) {
744
745
  this._prevColumn = oldColumn;
745
746
  }
746
747
  else {
@@ -1077,6 +1078,7 @@ class GridStack {
1077
1078
  if (!n)
1078
1079
  return;
1079
1080
  let w = Utils.cloneDeep(opt); // make a copy we can modify in case they re-use it or multiple items
1081
+ this.engine.nodeBoundFix(w);
1080
1082
  delete w.autoPosition;
1081
1083
  delete w.id;
1082
1084
  // move/resize widget if anything changed
@@ -1118,10 +1120,10 @@ class GridStack {
1118
1120
  }
1119
1121
  }
1120
1122
  Utils.sanitizeMinMax(n);
1121
- // finally move the widget
1122
- if (m !== undefined)
1123
+ // finally move the widget and update attr
1124
+ if (m)
1123
1125
  this.moveNode(n, m);
1124
- if (changed) { // move will only update x,y,w,h so update the rest too
1126
+ if (m || changed) {
1125
1127
  this._writeAttr(el, n);
1126
1128
  }
1127
1129
  if (ddChanged) {
@@ -1554,6 +1556,8 @@ class GridStack {
1554
1556
  // update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
1555
1557
  // 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 ?
1556
1558
  setTimeout(() => {
1559
+ if (!this.engine)
1560
+ return; // we've been deleted in between!
1557
1561
  if (n) {
1558
1562
  if (Utils.shouldSizeToContent(n))
1559
1563
  this.resizeToContentCheck(n.el, useAttr);
@@ -1980,6 +1984,7 @@ class GridStack {
1980
1984
  this.engine.cleanupNode(node); // removes all internal _xyz values
1981
1985
  node.grid = this;
1982
1986
  }
1987
+ delete node.grid._isTemp;
1983
1988
  dd.off(el, 'drag');
1984
1989
  // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)
1985
1990
  // as the helper will be nuked by jquery-ui otherwise. TODO: update old code path
@@ -2010,6 +2015,7 @@ class GridStack {
2010
2015
  if (!subGrid.opts.styleInHead)
2011
2016
  subGrid._updateStyles(true); // re-create sub-grid styles now that we've moved
2012
2017
  }
2018
+ this._prepareDragDropByNode(node);
2013
2019
  this._updateContainerHeight();
2014
2020
  this.engine.addedNodes.push(node); // @ts-ignore
2015
2021
  this._triggerAddEvent(); // @ts-ignore
@@ -2018,17 +2024,6 @@ class GridStack {
2018
2024
  if (this._gsEventHandler['dropped']) {
2019
2025
  this._gsEventHandler['dropped']({ ...event, type: 'dropped' }, origNode && origNode.grid ? origNode : undefined, node);
2020
2026
  }
2021
- // wait till we return out of the drag callback to set the new drag&resize handler or they may get messed up
2022
- window.setTimeout(() => {
2023
- // IFF we are still there (some application will use as placeholder and insert their real widget instead and better call makeWidget())
2024
- if (node.el && node.el.parentElement) {
2025
- this._prepareDragDropByNode(node);
2026
- }
2027
- else {
2028
- this.engine.removeNode(node);
2029
- }
2030
- delete node.grid._isTemp;
2031
- });
2032
2027
  return false; // prevent parent from receiving msg (which may be grid as well)
2033
2028
  });
2034
2029
  return this;
@@ -2310,6 +2305,6 @@ GridStack.resizeToContentParent = '.grid-stack-item-content';
2310
2305
  GridStack.Utils = Utils;
2311
2306
  /** scoping so users can call new GridStack.Engine(12) for example */
2312
2307
  GridStack.Engine = GridStackEngine;
2313
- GridStack.GDRev = '9.4.0';
2308
+ GridStack.GDRev = '9.5.1';
2314
2309
  export { GridStack };
2315
2310
  //# sourceMappingURL=gridstack.js.map