gridstack 10.1.1 → 10.2.0

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 (133) hide show
  1. package/README.md +1 -1
  2. package/angular/package.json +1 -1
  3. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  4. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  5. package/dist/angular/esm2020/lib/gridstack.component.mjs +12 -10
  6. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  7. package/dist/angular/fesm2015/gridstack-angular.mjs +14 -12
  8. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  9. package/dist/angular/fesm2020/gridstack-angular.mjs +14 -12
  10. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  11. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  12. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  13. package/dist/dd-base-impl.d.ts +1 -1
  14. package/dist/dd-base-impl.js +1 -1
  15. package/dist/dd-base-impl.js.map +1 -1
  16. package/dist/dd-draggable.d.ts +4 -4
  17. package/dist/dd-draggable.js +40 -3
  18. package/dist/dd-draggable.js.map +1 -1
  19. package/dist/dd-droppable.d.ts +1 -1
  20. package/dist/dd-droppable.js +1 -1
  21. package/dist/dd-droppable.js.map +1 -1
  22. package/dist/dd-element.d.ts +1 -1
  23. package/dist/dd-element.js +1 -1
  24. package/dist/dd-element.js.map +1 -1
  25. package/dist/dd-gridstack.d.ts +1 -1
  26. package/dist/dd-gridstack.js +1 -1
  27. package/dist/dd-gridstack.js.map +1 -1
  28. package/dist/dd-manager.d.ts +1 -1
  29. package/dist/dd-manager.js +1 -1
  30. package/dist/dd-manager.js.map +1 -1
  31. package/dist/dd-resizable-handle.d.ts +4 -3
  32. package/dist/dd-resizable-handle.js +12 -1
  33. package/dist/dd-resizable-handle.js.map +1 -1
  34. package/dist/dd-resizable.d.ts +1 -1
  35. package/dist/dd-resizable.js +1 -1
  36. package/dist/dd-resizable.js.map +1 -1
  37. package/dist/dd-touch.d.ts +1 -1
  38. package/dist/dd-touch.js +1 -1
  39. package/dist/dd-touch.js.map +1 -1
  40. package/dist/es5/dd-base-impl.d.ts +1 -1
  41. package/dist/es5/dd-base-impl.js +1 -1
  42. package/dist/es5/dd-base-impl.js.map +1 -1
  43. package/dist/es5/dd-draggable.d.ts +4 -4
  44. package/dist/es5/dd-draggable.js +53 -5
  45. package/dist/es5/dd-draggable.js.map +1 -1
  46. package/dist/es5/dd-droppable.d.ts +1 -1
  47. package/dist/es5/dd-droppable.js +1 -1
  48. package/dist/es5/dd-droppable.js.map +1 -1
  49. package/dist/es5/dd-element.d.ts +1 -1
  50. package/dist/es5/dd-element.js +1 -1
  51. package/dist/es5/dd-element.js.map +1 -1
  52. package/dist/es5/dd-gridstack.d.ts +1 -1
  53. package/dist/es5/dd-gridstack.js +1 -1
  54. package/dist/es5/dd-gridstack.js.map +1 -1
  55. package/dist/es5/dd-manager.d.ts +1 -1
  56. package/dist/es5/dd-manager.js +1 -1
  57. package/dist/es5/dd-manager.js.map +1 -1
  58. package/dist/es5/dd-resizable-handle.d.ts +4 -3
  59. package/dist/es5/dd-resizable-handle.js +13 -1
  60. package/dist/es5/dd-resizable-handle.js.map +1 -1
  61. package/dist/es5/dd-resizable.d.ts +1 -1
  62. package/dist/es5/dd-resizable.js +1 -1
  63. package/dist/es5/dd-resizable.js.map +1 -1
  64. package/dist/es5/dd-touch.d.ts +1 -1
  65. package/dist/es5/dd-touch.js +1 -1
  66. package/dist/es5/dd-touch.js.map +1 -1
  67. package/dist/es5/gridstack-all.js +1 -1
  68. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  69. package/dist/es5/gridstack-all.js.map +1 -1
  70. package/dist/es5/gridstack-engine.d.ts +3 -3
  71. package/dist/es5/gridstack-engine.js +17 -14
  72. package/dist/es5/gridstack-engine.js.map +1 -1
  73. package/dist/es5/gridstack-poly.js +1 -1
  74. package/dist/es5/gridstack.d.ts +11 -4
  75. package/dist/es5/gridstack.js +100 -46
  76. package/dist/es5/gridstack.js.map +1 -1
  77. package/dist/es5/types.d.ts +8 -8
  78. package/dist/es5/types.js +1 -1
  79. package/dist/es5/types.js.map +1 -1
  80. package/dist/es5/utils.d.ts +5 -4
  81. package/dist/es5/utils.js +19 -18
  82. package/dist/es5/utils.js.map +1 -1
  83. package/dist/gridstack-all.js +1 -1
  84. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  85. package/dist/gridstack-all.js.map +1 -1
  86. package/dist/gridstack-engine.d.ts +3 -3
  87. package/dist/gridstack-engine.js +15 -13
  88. package/dist/gridstack-engine.js.map +1 -1
  89. package/dist/gridstack.css +1 -1
  90. package/dist/gridstack.d.ts +11 -4
  91. package/dist/gridstack.js +96 -45
  92. package/dist/gridstack.js.map +1 -1
  93. package/dist/types.d.ts +8 -8
  94. package/dist/types.js +1 -1
  95. package/dist/types.js.map +1 -1
  96. package/dist/utils.d.ts +5 -4
  97. package/dist/utils.js +18 -18
  98. package/dist/utils.js.map +1 -1
  99. package/doc/CHANGES.md +17 -0
  100. package/doc/README.md +10 -4
  101. package/package.json +1 -1
  102. package/angular/projects/demo/.browserslistrc +0 -16
  103. package/angular/projects/demo/src/app/app.component.css +0 -11
  104. package/angular/projects/demo/src/app/app.component.html +0 -110
  105. package/angular/projects/demo/src/app/app.component.spec.ts +0 -25
  106. package/angular/projects/demo/src/app/app.component.ts +0 -221
  107. package/angular/projects/demo/src/app/app.module.ts +0 -39
  108. package/angular/projects/demo/src/app/dummy.component.ts +0 -35
  109. package/angular/projects/demo/src/app/ngFor.ts +0 -131
  110. package/angular/projects/demo/src/app/ngFor_cmd.ts +0 -106
  111. package/angular/projects/demo/src/app/simple.ts +0 -46
  112. package/angular/projects/demo/src/assets/.gitkeep +0 -0
  113. package/angular/projects/demo/src/environments/environment.ts +0 -16
  114. package/angular/projects/demo/src/favicon.ico +0 -0
  115. package/angular/projects/demo/src/index.html +0 -13
  116. package/angular/projects/demo/src/main.ts +0 -12
  117. package/angular/projects/demo/src/polyfills.ts +0 -53
  118. package/angular/projects/demo/src/styles.css +0 -41
  119. package/angular/projects/demo/src/test.ts +0 -26
  120. package/angular/projects/demo/tsconfig.app.json +0 -15
  121. package/angular/projects/demo/tsconfig.spec.json +0 -18
  122. package/angular/projects/lib/src/lib/base-widget.ts +0 -28
  123. package/angular/projects/lib/src/lib/gridstack-item.component.ts +0 -78
  124. package/angular/projects/lib/src/lib/gridstack.component.ts +0 -287
  125. package/angular/projects/lib/src/lib/gridstack.module.ts +0 -32
  126. package/angular/projects/lib/src/public-api.ts +0 -8
  127. package/angular/projects/lib/src/test.ts +0 -27
  128. package/dist/angular/src/base-widget.ts +0 -28
  129. package/dist/angular/src/gridstack-item.component.ts +0 -78
  130. package/dist/angular/src/gridstack.component.ts +0 -287
  131. package/dist/angular/src/gridstack.module.ts +0 -32
  132. package/dist/src/gridstack-extra.scss +0 -25
  133. package/dist/src/gridstack.scss +0 -157
@@ -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 10.1.1
39
+ * GridStack 10.2.0
40
40
  * https://gridstackjs.com/
41
41
  *
42
42
  * Copyright (c) 2021-2022 Alain Dumesny
@@ -231,7 +231,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
231
231
  this.load(children); // don't load empty
232
232
  }
233
233
  // if (this.engine.nodes.length) this._updateStyles(); // update based on # of children. done in engine onChange CB
234
- this.setAnimation(opts.animate);
234
+ this.setAnimation();
235
235
  // dynamic grids require pausing during drag to detect over to nest vs push
236
236
  if (opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
237
237
  dd_manager_1.DDManager.pauseDrag = true;
@@ -634,13 +634,21 @@ var GridStack = exports.GridStack = /** @class */ (function () {
634
634
  */
635
635
  GridStack.prototype.load = function (items, addRemove) {
636
636
  var _this = this;
637
+ var _a;
637
638
  if (addRemove === void 0) { addRemove = GridStack.addRemoveCB || true; }
638
639
  items = utils_1.Utils.cloneDeep(items); // so we can mod
639
640
  var column = this.getColumn();
641
+ // if we have a mix of new items without coordinates and existing items, separate them out so they can be added after #2639
642
+ var addAfter = items.filter(function (n) { return (n.x === undefined || n.y === undefined) && !utils_1.Utils.find(_this.engine.nodes, n.id); });
643
+ if (addAfter.length && addAfter.length !== items.length) {
644
+ items = items.filter(function (n) { return !utils_1.Utils.find(addAfter, n.id); });
645
+ }
646
+ else
647
+ addAfter = [];
640
648
  // if passed list has coordinates, use them (insert from end to beginning for conflict resolution) else keep widget order
641
649
  var haveCoord = items.some(function (w) { return w.x !== undefined || w.y !== undefined; });
642
650
  if (haveCoord)
643
- items = utils_1.Utils.sort(items, -1, column);
651
+ items = utils_1.Utils.sort(items, -1);
644
652
  this._insertNotAppend = haveCoord; // if we create in reverse order...
645
653
  // if we're loading a layout into for example 1 column and items don't fit, make sure to save
646
654
  // the original wanted layout so we can scale back up correctly #1471
@@ -715,6 +723,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
715
723
  _this.addWidget(w);
716
724
  }
717
725
  });
726
+ // finally append any separate ones that didn't have explicit coordinates last so they can find next empty spot
727
+ if (addRemove) {
728
+ addAfter.forEach(function (w) { return _this.addWidget(w); });
729
+ }
718
730
  this.engine.removedNodes = removed;
719
731
  this.batchUpdate(false);
720
732
  // after commit, clear that flag
@@ -722,8 +734,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
722
734
  delete this._insertNotAppend;
723
735
  prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB;
724
736
  // delay adding animation back
725
- if (noAnim && this.opts.animate)
726
- setTimeout(function () { return _this.setAnimation(_this.opts.animate); });
737
+ if (noAnim && ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.animate))
738
+ this.setAnimation(this.opts.animate, true);
727
739
  return this;
728
740
  };
729
741
  /**
@@ -1113,7 +1125,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1113
1125
  }
1114
1126
  if (!node)
1115
1127
  return;
1116
- if (GridStack.addRemoveCB) {
1128
+ if (removeDOM && GridStack.addRemoveCB) {
1117
1129
  GridStack.addRemoveCB(_this.el, node, false, false);
1118
1130
  }
1119
1131
  // remove our DOM data (circular link) and drag&drop permanently
@@ -1133,25 +1145,40 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1133
1145
  /**
1134
1146
  * Removes all widgets from the grid.
1135
1147
  * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).
1148
+ * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).
1136
1149
  */
1137
- GridStack.prototype.removeAll = function (removeDOM) {
1150
+ GridStack.prototype.removeAll = function (removeDOM, triggerEvent) {
1138
1151
  var _this = this;
1139
1152
  if (removeDOM === void 0) { removeDOM = true; }
1153
+ if (triggerEvent === void 0) { triggerEvent = true; }
1140
1154
  // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently
1141
1155
  this.engine.nodes.forEach(function (n) {
1156
+ if (removeDOM && GridStack.addRemoveCB) {
1157
+ GridStack.addRemoveCB(_this.el, n, false, false);
1158
+ }
1142
1159
  delete n.el.gridstackNode;
1143
- _this._removeDD(n.el);
1160
+ if (!_this.opts.staticGrid)
1161
+ _this._removeDD(n.el);
1144
1162
  });
1145
- this.engine.removeAll(removeDOM);
1146
- this._triggerRemoveEvent();
1163
+ this.engine.removeAll(removeDOM, triggerEvent);
1164
+ if (triggerEvent)
1165
+ this._triggerRemoveEvent();
1147
1166
  return this;
1148
1167
  };
1149
1168
  /**
1150
1169
  * Toggle the grid animation state. Toggles the `grid-stack-animate` class.
1151
1170
  * @param doAnimate if true the grid will animate.
1171
+ * @param delay if true setting will be set on next event loop.
1152
1172
  */
1153
- GridStack.prototype.setAnimation = function (doAnimate) {
1154
- if (doAnimate) {
1173
+ GridStack.prototype.setAnimation = function (doAnimate, delay) {
1174
+ var _this = this;
1175
+ if (doAnimate === void 0) { doAnimate = this.opts.animate; }
1176
+ if (delay) {
1177
+ // delay, but check to make sure grid (opt) is still around
1178
+ setTimeout(function () { if (_this.opts)
1179
+ _this.setAnimation(doAnimate); });
1180
+ }
1181
+ else if (doAnimate) {
1155
1182
  this.el.classList.add('grid-stack-animate');
1156
1183
  }
1157
1184
  else {
@@ -1266,12 +1293,15 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1266
1293
  return this;
1267
1294
  };
1268
1295
  GridStack.prototype.moveNode = function (n, m) {
1269
- this.engine.cleanNodes()
1270
- .beginUpdate(n)
1271
- .moveNode(n, m);
1296
+ var wasUpdating = n._updating;
1297
+ if (!wasUpdating)
1298
+ this.engine.cleanNodes().beginUpdate(n);
1299
+ this.engine.moveNode(n, m);
1272
1300
  this._updateContainerHeight();
1273
- this._triggerChangeEvent();
1274
- this.engine.endUpdate();
1301
+ if (!wasUpdating) {
1302
+ this._triggerChangeEvent();
1303
+ this.engine.endUpdate();
1304
+ }
1275
1305
  };
1276
1306
  /**
1277
1307
  * Updates widget height to match the content height to avoid v-scrollbar or dead space.
@@ -1345,6 +1375,28 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1345
1375
  else
1346
1376
  this.resizeToContent(el);
1347
1377
  };
1378
+ /** rotate (by swapping w & h) the passed in node - called when user press 'r' during dragging
1379
+ * @param els widget or selector of objects to modify
1380
+ * @param relative optional pixel coord relative to upper/left corner to rotate around (will keep that cell under cursor)
1381
+ */
1382
+ GridStack.prototype.rotate = function (els, relative) {
1383
+ var _this = this;
1384
+ GridStack.getElements(els).forEach(function (el) {
1385
+ var n = el.gridstackNode;
1386
+ if (!n || n.w === n.h)
1387
+ return;
1388
+ var rot = { w: n.h, h: n.w, minH: n.minW, minW: n.minH, maxH: n.maxW, maxW: n.maxH };
1389
+ // if given an offset, adjust x/y by column/row bounds when user presses 'r' during dragging
1390
+ if (relative) {
1391
+ var pivotX = relative.left > 0 ? Math.floor(relative.left / _this.cellWidth()) : 0;
1392
+ var pivotY = relative.top > 0 ? Math.floor(relative.top / _this.opts.cellHeight) : 0;
1393
+ rot.x = n.x + pivotX - (n.h - (pivotY + 1));
1394
+ rot.y = (n.y + pivotY) - pivotX;
1395
+ }
1396
+ _this.update(el, rot);
1397
+ });
1398
+ return this;
1399
+ };
1348
1400
  /**
1349
1401
  * 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).
1350
1402
  * @param value margin value
@@ -1413,8 +1465,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1413
1465
  }
1414
1466
  // prevent added nodes from also triggering 'change' event (which is called next)
1415
1467
  this.engine.addedNodes.forEach(function (n) { delete n._dirty; });
1416
- this._triggerEvent('added', this.engine.addedNodes);
1468
+ var addedNodes = __spreadArray([], this.engine.addedNodes, true);
1417
1469
  this.engine.addedNodes = [];
1470
+ this._triggerEvent('added', addedNodes);
1418
1471
  }
1419
1472
  return this;
1420
1473
  };
@@ -1424,8 +1477,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1424
1477
  if (this.engine.batchMode)
1425
1478
  return this;
1426
1479
  if ((_a = this.engine.removedNodes) === null || _a === void 0 ? void 0 : _a.length) {
1427
- this._triggerEvent('removed', this.engine.removedNodes);
1480
+ var removedNodes = __spreadArray([], this.engine.removedNodes, true);
1428
1481
  this.engine.removedNodes = [];
1482
+ this._triggerEvent('removed', removedNodes);
1429
1483
  }
1430
1484
  return this;
1431
1485
  };
@@ -2025,7 +2079,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2025
2079
  };
2026
2080
  dd.droppable(this.el, {
2027
2081
  accept: function (el) {
2028
- var node = el.gridstackNode;
2082
+ var node = el.gridstackNode || _this._readAttr(el, false);
2029
2083
  // set accept drop to true on ourself (which we ignore) so we don't get "can't drop" icon in HTML5 mode while moving
2030
2084
  if ((node === null || node === void 0 ? void 0 : node.grid) === _this)
2031
2085
  return true;
@@ -2040,7 +2094,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2040
2094
  var selector = (_this.opts.acceptWidgets === true ? '.grid-stack-item' : _this.opts.acceptWidgets);
2041
2095
  canAccept = el.matches(selector);
2042
2096
  }
2043
- // finally check to make sure we actually have space left #1571
2097
+ // finally check to make sure we actually have space left #1571 #2633
2044
2098
  if (canAccept && node && _this.opts.maxRow) {
2045
2099
  var n = { w: node.w, h: node.h, minW: node.minW, minH: node.minH }; // only width/height matters and autoPosition
2046
2100
  canAccept = _this.engine.willItFit(n);
@@ -2102,7 +2156,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2102
2156
  node._temporaryRemoved = true; // so we can insert it
2103
2157
  }
2104
2158
  // clear any marked for complete removal (Note: don't check _isAboutToRemove as that is cleared above - just do it)
2105
- _this._itemRemoving(node.el, false);
2159
+ GridStack._itemRemoving(node.el, false);
2106
2160
  dd.on(el, 'drag', onDrag);
2107
2161
  // make sure this is called at least once when going fast #1578
2108
2162
  onDrag(event, el, helper);
@@ -2131,7 +2185,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2131
2185
  * end - releasing the mouse
2132
2186
  */
2133
2187
  .on(this.el, 'drop', function (event, el, helper) {
2134
- var _a, _b;
2188
+ var _a, _b, _c;
2135
2189
  var node = el.gridstackNode;
2136
2190
  // ignore drop on ourself from ourself that didn't come from the outside - dragend will handle the simple move instead
2137
2191
  if ((node === null || node === void 0 ? void 0 : node.grid) === _this && !node._isExternal)
@@ -2163,7 +2217,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2163
2217
  _this.engine.cleanupNode(node); // removes all internal _xyz values
2164
2218
  node.grid = _this;
2165
2219
  }
2166
- delete node.grid._isTemp;
2220
+ (_a = node.grid) === null || _a === void 0 ? true : delete _a._isTemp;
2167
2221
  dd.off(el, 'drag');
2168
2222
  // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)
2169
2223
  // as the helper will be nuked by jquery-ui otherwise. TODO: update old code path
@@ -2182,7 +2236,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2182
2236
  return false;
2183
2237
  el.gridstackNode = node;
2184
2238
  node.el = el;
2185
- var subGrid = (_b = (_a = node.subGrid) === null || _a === void 0 ? void 0 : _a.el) === null || _b === void 0 ? void 0 : _b.gridstack; // set when actual sub-grid present
2239
+ var subGrid = (_c = (_b = node.subGrid) === null || _b === void 0 ? void 0 : _b.el) === null || _c === void 0 ? void 0 : _c.gridstack; // set when actual sub-grid present
2186
2240
  // @ts-ignore
2187
2241
  utils_1.Utils.copyPos(node, _this._readAttr(_this.placeholder)); // placeholder values as moving VERY fast can throw things off #1578
2188
2242
  utils_1.Utils.removePositioningStyles(el); // @ts-ignore
@@ -2203,34 +2257,33 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2203
2257
  }
2204
2258
  // delay adding animation back
2205
2259
  if (noAnim)
2206
- setTimeout(function () { return _this.setAnimation(_this.opts.animate); });
2260
+ _this.setAnimation(_this.opts.animate, true);
2207
2261
  return false; // prevent parent from receiving msg (which may be grid as well)
2208
2262
  });
2209
2263
  return this;
2210
2264
  };
2211
2265
  /** @internal mark item for removal */
2212
- GridStack.prototype._itemRemoving = function (el, remove) {
2266
+ GridStack._itemRemoving = function (el, remove) {
2213
2267
  var node = el ? el.gridstackNode : undefined;
2214
- if (!node || !node.grid || el.classList.contains(this.opts.removableOptions.decline))
2268
+ if (!(node === null || node === void 0 ? void 0 : node.grid) || el.classList.contains(node.grid.opts.removableOptions.decline))
2215
2269
  return;
2216
2270
  remove ? node._isAboutToRemove = true : delete node._isAboutToRemove;
2217
2271
  remove ? el.classList.add('grid-stack-item-removing') : el.classList.remove('grid-stack-item-removing');
2218
2272
  };
2219
2273
  /** @internal called to setup a trash drop zone if the user specifies it */
2220
2274
  GridStack.prototype._setupRemoveDrop = function () {
2221
- var _this = this;
2222
- if (!this.opts.staticGrid && typeof this.opts.removable === 'string') {
2223
- var trashEl = document.querySelector(this.opts.removable);
2224
- if (!trashEl)
2225
- return this;
2226
- // only register ONE drop-over/dropout callback for the 'trash', and it will
2227
- // update the passed in item and parent grid because the 'trash' is a shared resource anyway,
2228
- // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly)
2229
- if (!dd.isDroppable(trashEl)) {
2230
- dd.droppable(trashEl, this.opts.removableOptions)
2231
- .on(trashEl, 'dropover', function (event, el) { return _this._itemRemoving(el, true); })
2232
- .on(trashEl, 'dropout', function (event, el) { return _this._itemRemoving(el, false); });
2233
- }
2275
+ if (typeof this.opts.removable !== 'string')
2276
+ return this;
2277
+ var trashEl = document.querySelector(this.opts.removable);
2278
+ if (!trashEl)
2279
+ return this;
2280
+ // only register ONE static drop-over/dropout callback for the 'trash', and it will
2281
+ // update the passed in item and parent grid because the '.trash' is a shared resource anyway,
2282
+ // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly)
2283
+ if (!this.opts.staticGrid && !dd.isDroppable(trashEl)) {
2284
+ dd.droppable(trashEl, this.opts.removableOptions)
2285
+ .on(trashEl, 'dropover', function (event, el) { return GridStack._itemRemoving(el, true); })
2286
+ .on(trashEl, 'dropout', function (event, el) { return GridStack._itemRemoving(el, false); });
2234
2287
  }
2235
2288
  return this;
2236
2289
  };
@@ -2338,6 +2391,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2338
2391
  // @ts-ignore
2339
2392
  this._writePosAttr(this.placeholder, node);
2340
2393
  this.el.appendChild(this.placeholder);
2394
+ this.placeholder.gridstackNode = node;
2341
2395
  // console.log('_onStartMoving placeholder') // TEST
2342
2396
  // if the element is inside a grid, it has already been scaled
2343
2397
  // we can use that as a scale reference
@@ -2369,11 +2423,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2369
2423
  this.engine.addNode(node); // will add, fix collisions, update attr and clear _temporaryRemoved
2370
2424
  node._moving = true; // AFTER, mark as moving object (wanted fix location before)
2371
2425
  }
2372
- // set the min/max resize info
2426
+ // set the min/max resize info taking into account the column count and position (so we don't resize outside the grid)
2373
2427
  this.engine.cacheRects(cellWidth, cellHeight, this.opts.marginTop, this.opts.marginRight, this.opts.marginBottom, this.opts.marginLeft);
2374
2428
  if (event.type === 'resizestart') {
2375
- dd.resizable(el, 'option', 'minWidth', cellWidth * (node.minW || 1))
2376
- .resizable(el, 'option', 'minHeight', cellHeight * (node.minH || 1));
2429
+ dd.resizable(el, 'option', 'minWidth', cellWidth * Math.min(node.minW || 1, this.getColumn() - node.x))
2430
+ .resizable(el, 'option', 'minHeight', cellHeight * Math.min(node.minH || 1, (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - node.y));
2377
2431
  if (node.maxW) {
2378
2432
  dd.resizable(el, 'option', 'maxWidth', cellWidth * node.maxW);
2379
2433
  }
@@ -2487,7 +2541,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2487
2541
  node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged
2488
2542
  if (this.opts.removable === true) { // boolean vs a class string
2489
2543
  // item leaving us and we are supposed to remove on leave (no need to drag onto trash) mark it so
2490
- this._itemRemoving(el, true);
2544
+ GridStack._itemRemoving(el, true);
2491
2545
  }
2492
2546
  // finally if item originally came from another grid, but left us, restore things back to prev info
2493
2547
  if (el._gridstackNodeOrig) {
@@ -2511,7 +2565,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2511
2565
  GridStack.Utils = utils_1.Utils;
2512
2566
  /** scoping so users can call new GridStack.Engine(12) for example */
2513
2567
  GridStack.Engine = gridstack_engine_1.GridStackEngine;
2514
- GridStack.GDRev = '10.1.1';
2568
+ GridStack.GDRev = '10.2.0';
2515
2569
  return GridStack;
2516
2570
  }());
2517
2571
  //# sourceMappingURL=gridstack.js.map