gridstack 10.1.0 → 10.1.2

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 (112) hide show
  1. package/README.md +1 -1
  2. package/angular/package.json +1 -1
  3. package/angular/projects/demo/src/app/app.component.ts +4 -2
  4. package/angular/projects/demo/src/app/dummy.component.ts +3 -4
  5. package/angular/projects/lib/src/lib/base-widget.ts +1 -1
  6. package/angular/projects/lib/src/lib/gridstack-item.component.ts +1 -1
  7. package/angular/projects/lib/src/lib/gridstack.component.ts +1 -1
  8. package/angular/projects/lib/src/lib/gridstack.module.ts +1 -1
  9. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  10. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  11. package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
  12. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  13. package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
  14. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  15. package/dist/angular/fesm2020/gridstack-angular.mjs +4 -4
  16. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  17. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  18. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  19. package/dist/angular/src/base-widget.ts +1 -1
  20. package/dist/angular/src/gridstack-item.component.ts +1 -1
  21. package/dist/angular/src/gridstack.component.ts +1 -1
  22. package/dist/angular/src/gridstack.module.ts +1 -1
  23. package/dist/dd-base-impl.d.ts +1 -1
  24. package/dist/dd-base-impl.js +1 -1
  25. package/dist/dd-base-impl.js.map +1 -1
  26. package/dist/dd-draggable.d.ts +1 -1
  27. package/dist/dd-draggable.js +3 -3
  28. package/dist/dd-draggable.js.map +1 -1
  29. package/dist/dd-droppable.d.ts +3 -3
  30. package/dist/dd-droppable.js +3 -3
  31. package/dist/dd-droppable.js.map +1 -1
  32. package/dist/dd-element.d.ts +2 -2
  33. package/dist/dd-element.js +1 -1
  34. package/dist/dd-element.js.map +1 -1
  35. package/dist/dd-gridstack.d.ts +1 -1
  36. package/dist/dd-gridstack.js +2 -2
  37. package/dist/dd-gridstack.js.map +1 -1
  38. package/dist/dd-manager.d.ts +1 -1
  39. package/dist/dd-manager.js +1 -1
  40. package/dist/dd-manager.js.map +1 -1
  41. package/dist/dd-resizable-handle.d.ts +5 -2
  42. package/dist/dd-resizable-handle.js +6 -7
  43. package/dist/dd-resizable-handle.js.map +1 -1
  44. package/dist/dd-resizable.d.ts +2 -2
  45. package/dist/dd-resizable.js +6 -5
  46. package/dist/dd-resizable.js.map +1 -1
  47. package/dist/dd-touch.d.ts +1 -1
  48. package/dist/dd-touch.js +1 -1
  49. package/dist/dd-touch.js.map +1 -1
  50. package/dist/es5/dd-base-impl.d.ts +1 -1
  51. package/dist/es5/dd-base-impl.js +1 -1
  52. package/dist/es5/dd-base-impl.js.map +1 -1
  53. package/dist/es5/dd-draggable.d.ts +1 -1
  54. package/dist/es5/dd-draggable.js +3 -3
  55. package/dist/es5/dd-draggable.js.map +1 -1
  56. package/dist/es5/dd-droppable.d.ts +3 -3
  57. package/dist/es5/dd-droppable.js +4 -4
  58. package/dist/es5/dd-droppable.js.map +1 -1
  59. package/dist/es5/dd-element.d.ts +2 -2
  60. package/dist/es5/dd-element.js +1 -1
  61. package/dist/es5/dd-element.js.map +1 -1
  62. package/dist/es5/dd-gridstack.d.ts +1 -1
  63. package/dist/es5/dd-gridstack.js +2 -2
  64. package/dist/es5/dd-gridstack.js.map +1 -1
  65. package/dist/es5/dd-manager.d.ts +1 -1
  66. package/dist/es5/dd-manager.js +1 -1
  67. package/dist/es5/dd-manager.js.map +1 -1
  68. package/dist/es5/dd-resizable-handle.d.ts +5 -2
  69. package/dist/es5/dd-resizable-handle.js +6 -7
  70. package/dist/es5/dd-resizable-handle.js.map +1 -1
  71. package/dist/es5/dd-resizable.d.ts +2 -2
  72. package/dist/es5/dd-resizable.js +7 -6
  73. package/dist/es5/dd-resizable.js.map +1 -1
  74. package/dist/es5/dd-touch.d.ts +1 -1
  75. package/dist/es5/dd-touch.js +1 -1
  76. package/dist/es5/dd-touch.js.map +1 -1
  77. package/dist/es5/gridstack-all.js +1 -1
  78. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  79. package/dist/es5/gridstack-all.js.map +1 -1
  80. package/dist/es5/gridstack-engine.d.ts +3 -3
  81. package/dist/es5/gridstack-engine.js +17 -14
  82. package/dist/es5/gridstack-engine.js.map +1 -1
  83. package/dist/es5/gridstack-poly.js +1 -1
  84. package/dist/es5/gridstack.d.ts +7 -8
  85. package/dist/es5/gridstack.js +84 -62
  86. package/dist/es5/gridstack.js.map +1 -1
  87. package/dist/es5/types.d.ts +1 -1
  88. package/dist/es5/types.js +1 -1
  89. package/dist/es5/types.js.map +1 -1
  90. package/dist/es5/utils.d.ts +5 -6
  91. package/dist/es5/utils.js +17 -12
  92. package/dist/es5/utils.js.map +1 -1
  93. package/dist/gridstack-all.js +1 -1
  94. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  95. package/dist/gridstack-all.js.map +1 -1
  96. package/dist/gridstack-engine.d.ts +3 -3
  97. package/dist/gridstack-engine.js +15 -13
  98. package/dist/gridstack-engine.js.map +1 -1
  99. package/dist/gridstack.css +1 -1
  100. package/dist/gridstack.d.ts +7 -8
  101. package/dist/gridstack.js +85 -63
  102. package/dist/gridstack.js.map +1 -1
  103. package/dist/src/gridstack.scss +1 -1
  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 +5 -6
  108. package/dist/utils.js +15 -12
  109. package/dist/utils.js.map +1 -1
  110. package/doc/CHANGES.md +13 -0
  111. package/doc/README.md +3 -4
  112. 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 10.1.0
39
+ * GridStack 10.1.2
40
40
  * https://gridstackjs.com/
41
41
  *
42
42
  * Copyright (c) 2021-2022 Alain Dumesny
@@ -73,13 +73,15 @@ __exportStar(require("./dd-gridstack"), exports);
73
73
  var GridStack = exports.GridStack = /** @class */ (function () {
74
74
  /**
75
75
  * Construct a grid item from the given element and options
76
- * @param el
77
- * @param opts
76
+ * @param el the HTML element tied to this grid after it's been initialized
77
+ * @param opts grid options - public for classes to access, but use methods to modify!
78
78
  */
79
79
  function GridStack(el, opts) {
80
80
  if (opts === void 0) { opts = {}; }
81
81
  var _this = this;
82
82
  var _a, _b, _c, _d;
83
+ this.el = el;
84
+ this.opts = opts;
83
85
  /** @internal */
84
86
  this._gsEventHandler = {};
85
87
  /** @internal extra row added when dragging at the bottom of the grid */
@@ -87,7 +89,6 @@ var GridStack = exports.GridStack = /** @class */ (function () {
87
89
  /** @internal meant to store the scale of the active grid */
88
90
  this.dragTransform = { xScale: 1, yScale: 1, xOffset: 0, yOffset: 0 };
89
91
  el.gridstack = this;
90
- this.el = el; // exposed HTML element to the user
91
92
  opts = opts || {}; // handles null/undefined/0
92
93
  if (!el.classList.contains('grid-stack')) {
93
94
  this.el.classList.add('grid-stack');
@@ -151,16 +152,15 @@ var GridStack = exports.GridStack = /** @class */ (function () {
151
152
  if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead
152
153
  defaults.animate = utils_1.Utils.toBool(el.getAttribute('gs-animate'));
153
154
  }
154
- this.opts = utils_1.Utils.defaults(opts, defaults);
155
- opts = null; // make sure we use this.opts instead
155
+ opts = utils_1.Utils.defaults(opts, defaults);
156
156
  this._initMargin(); // part of settings defaults...
157
157
  // Now check if we're loading into 1 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)
158
158
  this.checkDynamicColumn();
159
- this.el.classList.add('gs-' + this.opts.column);
160
- if (this.opts.rtl === 'auto') {
161
- this.opts.rtl = (el.style.direction === 'rtl');
159
+ this.el.classList.add('gs-' + opts.column);
160
+ if (opts.rtl === 'auto') {
161
+ opts.rtl = (el.style.direction === 'rtl');
162
162
  }
163
- if (this.opts.rtl) {
163
+ if (opts.rtl) {
164
164
  this.el.classList.add('grid-stack-rtl');
165
165
  }
166
166
  // check if we're been nested, and if so update our style and keep pointer around (used during save)
@@ -172,31 +172,31 @@ var GridStack = exports.GridStack = /** @class */ (function () {
172
172
  this.el.classList.add('grid-stack-nested');
173
173
  parentGridItem.el.classList.add('grid-stack-sub-grid');
174
174
  }
175
- this._isAutoCellHeight = (this.opts.cellHeight === 'auto');
176
- if (this._isAutoCellHeight || this.opts.cellHeight === 'initial') {
175
+ this._isAutoCellHeight = (opts.cellHeight === 'auto');
176
+ if (this._isAutoCellHeight || opts.cellHeight === 'initial') {
177
177
  // make the cell content square initially (will use resize/column event to keep it square)
178
178
  this.cellHeight(undefined, false);
179
179
  }
180
180
  else {
181
181
  // append unit if any are set
182
- if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== types_1.gridDefaults.cellHeightUnit) {
183
- this.opts.cellHeight = this.opts.cellHeight + this.opts.cellHeightUnit;
184
- delete this.opts.cellHeightUnit;
182
+ if (typeof opts.cellHeight == 'number' && opts.cellHeightUnit && opts.cellHeightUnit !== types_1.gridDefaults.cellHeightUnit) {
183
+ opts.cellHeight = opts.cellHeight + opts.cellHeightUnit;
184
+ delete opts.cellHeightUnit;
185
185
  }
186
- this.cellHeight(this.opts.cellHeight, false);
186
+ this.cellHeight(opts.cellHeight, false);
187
187
  }
188
188
  // see if we need to adjust auto-hide
189
- if (this.opts.alwaysShowResizeHandle === 'mobile') {
190
- this.opts.alwaysShowResizeHandle = dd_touch_1.isTouch;
189
+ if (opts.alwaysShowResizeHandle === 'mobile') {
190
+ opts.alwaysShowResizeHandle = dd_touch_1.isTouch;
191
191
  }
192
192
  this._styleSheetClass = 'gs-id-' + gridstack_engine_1.GridStackEngine._idSeq++;
193
193
  this.el.classList.add(this._styleSheetClass);
194
194
  this._setStaticClass();
195
- var engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
195
+ var engineClass = opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
196
196
  this.engine = new engineClass({
197
197
  column: this.getColumn(),
198
- float: this.opts.float,
199
- maxRow: this.opts.maxRow,
198
+ float: opts.float,
199
+ maxRow: opts.maxRow,
200
200
  onChange: function (cbNodes) {
201
201
  var maxH = 0;
202
202
  _this.engine.nodes.forEach(function (n) { maxH = Math.max(maxH, n.y + n.h); });
@@ -218,25 +218,25 @@ var GridStack = exports.GridStack = /** @class */ (function () {
218
218
  });
219
219
  // create initial global styles BEFORE loading children so resizeToContent margin can be calculated correctly
220
220
  this._updateStyles(false, 0);
221
- if (this.opts.auto) {
221
+ if (opts.auto) {
222
222
  this.batchUpdate(); // prevent in between re-layout #1535 TODO: this only set float=true, need to prevent collision check...
223
223
  this.getGridItems().forEach(function (el) { return _this._prepareElement(el); });
224
224
  this.batchUpdate(false);
225
225
  }
226
226
  // load any passed in children as well, which overrides any DOM layout done above
227
- if (this.opts.children) {
228
- var children = this.opts.children;
229
- delete this.opts.children;
227
+ if (opts.children) {
228
+ var children = opts.children;
229
+ delete opts.children;
230
230
  if (children.length)
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(this.opts.animate);
234
+ this.setAnimation(opts.animate);
235
235
  // dynamic grids require pausing during drag to detect over to nest vs push
236
- if (this.opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
236
+ if (opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
237
237
  dd_manager_1.DDManager.pauseDrag = true;
238
- if (((_d = this.opts.draggable) === null || _d === void 0 ? void 0 : _d.pause) !== undefined)
239
- dd_manager_1.DDManager.pauseDrag = this.opts.draggable.pause;
238
+ if (((_d = opts.draggable) === null || _d === void 0 ? void 0 : _d.pause) !== undefined)
239
+ dd_manager_1.DDManager.pauseDrag = opts.draggable.pause;
240
240
  this._setupRemoveDrop();
241
241
  this._setupAcceptWidget();
242
242
  this._updateResizeEvent();
@@ -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,15 +723,20 @@ 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
721
733
  delete this._ignoreLayoutsNodeChange;
722
734
  delete this._insertNotAppend;
723
735
  prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB;
724
- // delay adding animation back
725
- if (noAnim && this.opts.animate)
726
- setTimeout(function () { return _this.setAnimation(_this.opts.animate); });
736
+ // delay adding animation back, but check to make sure grid (opt) is still around
737
+ if (noAnim && ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.animate))
738
+ setTimeout(function () { if (_this.opts)
739
+ _this.setAnimation(_this.opts.animate); });
727
740
  return this;
728
741
  };
729
742
  /**
@@ -1113,7 +1126,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1113
1126
  }
1114
1127
  if (!node)
1115
1128
  return;
1116
- if (GridStack.addRemoveCB) {
1129
+ if (removeDOM && GridStack.addRemoveCB) {
1117
1130
  GridStack.addRemoveCB(_this.el, node, false, false);
1118
1131
  }
1119
1132
  // remove our DOM data (circular link) and drag&drop permanently
@@ -1133,17 +1146,24 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1133
1146
  /**
1134
1147
  * Removes all widgets from the grid.
1135
1148
  * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).
1149
+ * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).
1136
1150
  */
1137
- GridStack.prototype.removeAll = function (removeDOM) {
1151
+ GridStack.prototype.removeAll = function (removeDOM, triggerEvent) {
1138
1152
  var _this = this;
1139
1153
  if (removeDOM === void 0) { removeDOM = true; }
1154
+ if (triggerEvent === void 0) { triggerEvent = true; }
1140
1155
  // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently
1141
1156
  this.engine.nodes.forEach(function (n) {
1157
+ if (removeDOM && GridStack.addRemoveCB) {
1158
+ GridStack.addRemoveCB(_this.el, n, false, false);
1159
+ }
1142
1160
  delete n.el.gridstackNode;
1143
- _this._removeDD(n.el);
1161
+ if (!_this.opts.staticGrid)
1162
+ _this._removeDD(n.el);
1144
1163
  });
1145
- this.engine.removeAll(removeDOM);
1146
- this._triggerRemoveEvent();
1164
+ this.engine.removeAll(removeDOM, triggerEvent);
1165
+ if (triggerEvent)
1166
+ this._triggerRemoveEvent();
1147
1167
  return this;
1148
1168
  };
1149
1169
  /**
@@ -1413,8 +1433,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1413
1433
  }
1414
1434
  // prevent added nodes from also triggering 'change' event (which is called next)
1415
1435
  this.engine.addedNodes.forEach(function (n) { delete n._dirty; });
1416
- this._triggerEvent('added', this.engine.addedNodes);
1436
+ var addedNodes = __spreadArray([], this.engine.addedNodes, true);
1417
1437
  this.engine.addedNodes = [];
1438
+ this._triggerEvent('added', addedNodes);
1418
1439
  }
1419
1440
  return this;
1420
1441
  };
@@ -1424,8 +1445,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
1424
1445
  if (this.engine.batchMode)
1425
1446
  return this;
1426
1447
  if ((_a = this.engine.removedNodes) === null || _a === void 0 ? void 0 : _a.length) {
1427
- this._triggerEvent('removed', this.engine.removedNodes);
1448
+ var removedNodes = __spreadArray([], this.engine.removedNodes, true);
1428
1449
  this.engine.removedNodes = [];
1450
+ this._triggerEvent('removed', removedNodes);
1429
1451
  }
1430
1452
  return this;
1431
1453
  };
@@ -2025,7 +2047,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2025
2047
  };
2026
2048
  dd.droppable(this.el, {
2027
2049
  accept: function (el) {
2028
- var node = el.gridstackNode;
2050
+ var node = el.gridstackNode || _this._readAttr(el, false);
2029
2051
  // 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
2052
  if ((node === null || node === void 0 ? void 0 : node.grid) === _this)
2031
2053
  return true;
@@ -2040,7 +2062,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2040
2062
  var selector = (_this.opts.acceptWidgets === true ? '.grid-stack-item' : _this.opts.acceptWidgets);
2041
2063
  canAccept = el.matches(selector);
2042
2064
  }
2043
- // finally check to make sure we actually have space left #1571
2065
+ // finally check to make sure we actually have space left #1571 #2633
2044
2066
  if (canAccept && node && _this.opts.maxRow) {
2045
2067
  var n = { w: node.w, h: node.h, minW: node.minW, minH: node.minH }; // only width/height matters and autoPosition
2046
2068
  canAccept = _this.engine.willItFit(n);
@@ -2102,7 +2124,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2102
2124
  node._temporaryRemoved = true; // so we can insert it
2103
2125
  }
2104
2126
  // 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);
2127
+ GridStack._itemRemoving(node.el, false);
2106
2128
  dd.on(el, 'drag', onDrag);
2107
2129
  // make sure this is called at least once when going fast #1578
2108
2130
  onDrag(event, el, helper);
@@ -2201,36 +2223,36 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2201
2223
  if (_this._gsEventHandler['dropped']) {
2202
2224
  _this._gsEventHandler['dropped'](__assign(__assign({}, event), { type: 'dropped' }), origNode && origNode.grid ? origNode : undefined, node);
2203
2225
  }
2204
- // delay adding animation back
2226
+ // delay adding animation back, but check to make sure grid (opt) is still around
2205
2227
  if (noAnim)
2206
- setTimeout(function () { return _this.setAnimation(_this.opts.animate); });
2228
+ setTimeout(function () { if (_this.opts)
2229
+ _this.setAnimation(_this.opts.animate); });
2207
2230
  return false; // prevent parent from receiving msg (which may be grid as well)
2208
2231
  });
2209
2232
  return this;
2210
2233
  };
2211
2234
  /** @internal mark item for removal */
2212
- GridStack.prototype._itemRemoving = function (el, remove) {
2235
+ GridStack._itemRemoving = function (el, remove) {
2213
2236
  var node = el ? el.gridstackNode : undefined;
2214
- if (!node || !node.grid || el.classList.contains(this.opts.removableOptions.decline))
2237
+ if (!(node === null || node === void 0 ? void 0 : node.grid) || el.classList.contains(node.grid.opts.removableOptions.decline))
2215
2238
  return;
2216
2239
  remove ? node._isAboutToRemove = true : delete node._isAboutToRemove;
2217
2240
  remove ? el.classList.add('grid-stack-item-removing') : el.classList.remove('grid-stack-item-removing');
2218
2241
  };
2219
2242
  /** @internal called to setup a trash drop zone if the user specifies it */
2220
2243
  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
- }
2244
+ if (typeof this.opts.removable !== 'string')
2245
+ return this;
2246
+ var trashEl = document.querySelector(this.opts.removable);
2247
+ if (!trashEl)
2248
+ return this;
2249
+ // only register ONE static drop-over/dropout callback for the 'trash', and it will
2250
+ // update the passed in item and parent grid because the '.trash' is a shared resource anyway,
2251
+ // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly)
2252
+ if (!this.opts.staticGrid && !dd.isDroppable(trashEl)) {
2253
+ dd.droppable(trashEl, this.opts.removableOptions)
2254
+ .on(trashEl, 'dropover', function (event, el) { return GridStack._itemRemoving(el, true); })
2255
+ .on(trashEl, 'dropout', function (event, el) { return GridStack._itemRemoving(el, false); });
2234
2256
  }
2235
2257
  return this;
2236
2258
  };
@@ -2487,7 +2509,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2487
2509
  node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged
2488
2510
  if (this.opts.removable === true) { // boolean vs a class string
2489
2511
  // 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);
2512
+ GridStack._itemRemoving(el, true);
2491
2513
  }
2492
2514
  // finally if item originally came from another grid, but left us, restore things back to prev info
2493
2515
  if (el._gridstackNodeOrig) {
@@ -2511,7 +2533,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
2511
2533
  GridStack.Utils = utils_1.Utils;
2512
2534
  /** scoping so users can call new GridStack.Engine(12) for example */
2513
2535
  GridStack.Engine = gridstack_engine_1.GridStackEngine;
2514
- GridStack.GDRev = '10.1.0';
2536
+ GridStack.GDRev = '10.1.2';
2515
2537
  return GridStack;
2516
2538
  }());
2517
2539
  //# sourceMappingURL=gridstack.js.map