gridstack 5.0.0 → 6.0.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 (168) hide show
  1. package/README.md +78 -53
  2. package/dist/{h5/dd-base-impl.d.ts → dd-base-impl.d.ts} +2 -2
  3. package/dist/{h5/dd-base-impl.js → dd-base-impl.js} +2 -4
  4. package/dist/dd-base-impl.js.map +1 -0
  5. package/dist/{es5/h5/dd-draggable.d.ts → dd-draggable.d.ts} +7 -8
  6. package/dist/dd-draggable.js +313 -0
  7. package/dist/dd-draggable.js.map +1 -0
  8. package/dist/{es5/h5/dd-droppable.d.ts → dd-droppable.d.ts} +4 -3
  9. package/dist/dd-droppable.js +149 -0
  10. package/dist/dd-droppable.js.map +1 -0
  11. package/dist/{es5/h5/dd-element.d.ts → dd-element.d.ts} +2 -2
  12. package/dist/{h5/dd-element.js → dd-element.js} +1 -1
  13. package/dist/dd-element.js.map +1 -0
  14. package/dist/dd-gridstack.d.ts +36 -0
  15. package/dist/{gridstack-dd.js → dd-gridstack.js} +154 -52
  16. package/dist/dd-gridstack.js.map +1 -0
  17. package/dist/dd-manager.d.ts +17 -0
  18. package/dist/{h5/dd-manager.js → dd-manager.js} +4 -1
  19. package/dist/dd-manager.js.map +1 -0
  20. package/dist/{es5/h5/dd-resizable-handle.d.ts → dd-resizable-handle.d.ts} +2 -2
  21. package/dist/{h5/dd-resizable-handle.js → dd-resizable-handle.js} +33 -9
  22. package/dist/dd-resizable-handle.js.map +1 -0
  23. package/dist/{h5/dd-resizable.d.ts → dd-resizable.d.ts} +3 -3
  24. package/dist/{h5/dd-resizable.js → dd-resizable.js} +29 -28
  25. package/dist/dd-resizable.js.map +1 -0
  26. package/dist/dd-touch.d.ts +33 -0
  27. package/dist/dd-touch.js +179 -0
  28. package/dist/dd-touch.js.map +1 -0
  29. package/dist/es5/{h5/dd-base-impl.d.ts → dd-base-impl.d.ts} +2 -2
  30. package/dist/es5/{h5/dd-base-impl.js → dd-base-impl.js} +2 -4
  31. package/dist/es5/dd-base-impl.js.map +1 -0
  32. package/dist/{h5 → es5}/dd-draggable.d.ts +7 -8
  33. package/dist/es5/dd-draggable.js +335 -0
  34. package/dist/es5/dd-draggable.js.map +1 -0
  35. package/dist/{h5 → es5}/dd-droppable.d.ts +4 -3
  36. package/dist/es5/dd-droppable.js +180 -0
  37. package/dist/es5/dd-droppable.js.map +1 -0
  38. package/dist/{h5 → es5}/dd-element.d.ts +2 -2
  39. package/dist/es5/{h5/dd-element.js → dd-element.js} +1 -1
  40. package/dist/es5/dd-element.js.map +1 -0
  41. package/dist/es5/dd-gridstack.d.ts +36 -0
  42. package/dist/es5/{gridstack-dd.js → dd-gridstack.js} +164 -71
  43. package/dist/es5/dd-gridstack.js.map +1 -0
  44. package/dist/es5/dd-manager.d.ts +17 -0
  45. package/dist/es5/{h5/dd-manager.js → dd-manager.js} +4 -1
  46. package/dist/es5/dd-manager.js.map +1 -0
  47. package/dist/{h5 → es5}/dd-resizable-handle.d.ts +2 -2
  48. package/dist/es5/{h5/dd-resizable-handle.js → dd-resizable-handle.js} +33 -9
  49. package/dist/es5/dd-resizable-handle.js.map +1 -0
  50. package/dist/es5/{h5/dd-resizable.d.ts → dd-resizable.d.ts} +3 -3
  51. package/dist/es5/{h5/dd-resizable.js → dd-resizable.js} +29 -28
  52. package/dist/es5/dd-resizable.js.map +1 -0
  53. package/dist/es5/dd-touch.d.ts +33 -0
  54. package/dist/es5/dd-touch.js +182 -0
  55. package/dist/es5/dd-touch.js.map +1 -0
  56. package/dist/es5/gridstack-all.js +3 -0
  57. package/dist/{gridstack-static.js.LICENSE.txt → es5/gridstack-all.js.LICENSE.txt} +2 -2
  58. package/dist/es5/gridstack-all.js.map +1 -0
  59. package/dist/es5/gridstack-engine.d.ts +12 -9
  60. package/dist/es5/gridstack-engine.js +45 -55
  61. package/dist/es5/gridstack-engine.js.map +1 -1
  62. package/dist/es5/gridstack-poly.js +1 -1
  63. package/dist/es5/gridstack.d.ts +17 -12
  64. package/dist/es5/gridstack.js +70 -43
  65. package/dist/es5/gridstack.js.map +1 -1
  66. package/dist/es5/types.d.ts +19 -20
  67. package/dist/es5/types.js +1 -1
  68. package/dist/es5/types.js.map +1 -1
  69. package/dist/es5/utils.d.ts +12 -2
  70. package/dist/es5/utils.js +79 -18
  71. package/dist/es5/utils.js.map +1 -1
  72. package/dist/gridstack-all.js +3 -0
  73. package/dist/{es5/gridstack-h5.js.LICENSE.txt → gridstack-all.js.LICENSE.txt} +2 -2
  74. package/dist/gridstack-all.js.map +1 -0
  75. package/dist/gridstack-engine.d.ts +12 -9
  76. package/dist/gridstack-engine.js +44 -54
  77. package/dist/gridstack-engine.js.map +1 -1
  78. package/dist/gridstack.css +21 -9
  79. package/dist/gridstack.d.ts +17 -12
  80. package/dist/gridstack.js +68 -43
  81. package/dist/gridstack.js.map +1 -1
  82. package/dist/gridstack.min.css +1 -1
  83. package/dist/src/gridstack.scss +19 -12
  84. package/dist/types.d.ts +19 -20
  85. package/dist/types.js +1 -1
  86. package/dist/types.js.map +1 -1
  87. package/dist/utils.d.ts +12 -2
  88. package/dist/utils.js +75 -17
  89. package/dist/utils.js.map +1 -1
  90. package/doc/CHANGES.md +21 -2
  91. package/doc/README.md +29 -24
  92. package/package.json +5 -5
  93. package/dist/es5/gridstack-dd.d.ts +0 -35
  94. package/dist/es5/gridstack-dd.js.map +0 -1
  95. package/dist/es5/gridstack-ddi.d.ts +0 -17
  96. package/dist/es5/gridstack-ddi.js +0 -31
  97. package/dist/es5/gridstack-ddi.js.map +0 -1
  98. package/dist/es5/gridstack-h5.d.ts +0 -10
  99. package/dist/es5/gridstack-h5.js +0 -3
  100. package/dist/es5/gridstack-h5.js.map +0 -1
  101. package/dist/es5/gridstack-jq.d.ts +0 -10
  102. package/dist/es5/gridstack-jq.js +0 -3
  103. package/dist/es5/gridstack-jq.js.LICENSE.txt +0 -99
  104. package/dist/es5/gridstack-jq.js.map +0 -1
  105. package/dist/es5/gridstack-static.d.ts +0 -9
  106. package/dist/es5/gridstack-static.js +0 -3
  107. package/dist/es5/gridstack-static.js.LICENSE.txt +0 -7
  108. package/dist/es5/gridstack-static.js.map +0 -1
  109. package/dist/es5/h5/dd-base-impl.js.map +0 -1
  110. package/dist/es5/h5/dd-draggable.js +0 -329
  111. package/dist/es5/h5/dd-draggable.js.map +0 -1
  112. package/dist/es5/h5/dd-droppable.js +0 -199
  113. package/dist/es5/h5/dd-droppable.js.map +0 -1
  114. package/dist/es5/h5/dd-element.js.map +0 -1
  115. package/dist/es5/h5/dd-manager.d.ts +0 -8
  116. package/dist/es5/h5/dd-manager.js.map +0 -1
  117. package/dist/es5/h5/dd-resizable-handle.js.map +0 -1
  118. package/dist/es5/h5/dd-resizable.js.map +0 -1
  119. package/dist/es5/h5/dd-utils.d.ts +0 -19
  120. package/dist/es5/h5/dd-utils.js +0 -111
  121. package/dist/es5/h5/dd-utils.js.map +0 -1
  122. package/dist/es5/h5/gridstack-dd-native.d.ts +0 -26
  123. package/dist/es5/h5/gridstack-dd-native.js +0 -175
  124. package/dist/es5/h5/gridstack-dd-native.js.map +0 -1
  125. package/dist/es5/jq/gridstack-dd-jqueryui.d.ts +0 -22
  126. package/dist/es5/jq/gridstack-dd-jqueryui.js +0 -162
  127. package/dist/es5/jq/gridstack-dd-jqueryui.js.map +0 -1
  128. package/dist/gridstack-dd.d.ts +0 -35
  129. package/dist/gridstack-dd.js.map +0 -1
  130. package/dist/gridstack-ddi.d.ts +0 -17
  131. package/dist/gridstack-ddi.js +0 -28
  132. package/dist/gridstack-ddi.js.map +0 -1
  133. package/dist/gridstack-h5.d.ts +0 -10
  134. package/dist/gridstack-h5.js +0 -3
  135. package/dist/gridstack-h5.js.LICENSE.txt +0 -7
  136. package/dist/gridstack-h5.js.map +0 -1
  137. package/dist/gridstack-jq.d.ts +0 -10
  138. package/dist/gridstack-jq.js +0 -3
  139. package/dist/gridstack-jq.js.LICENSE.txt +0 -99
  140. package/dist/gridstack-jq.js.map +0 -1
  141. package/dist/gridstack-static.d.ts +0 -9
  142. package/dist/gridstack-static.js +0 -3
  143. package/dist/gridstack-static.js.map +0 -1
  144. package/dist/h5/dd-base-impl.js.map +0 -1
  145. package/dist/h5/dd-draggable.js +0 -305
  146. package/dist/h5/dd-draggable.js.map +0 -1
  147. package/dist/h5/dd-droppable.js +0 -168
  148. package/dist/h5/dd-droppable.js.map +0 -1
  149. package/dist/h5/dd-element.js.map +0 -1
  150. package/dist/h5/dd-manager.d.ts +0 -8
  151. package/dist/h5/dd-manager.js.map +0 -1
  152. package/dist/h5/dd-resizable-handle.js.map +0 -1
  153. package/dist/h5/dd-resizable.js.map +0 -1
  154. package/dist/h5/dd-utils.d.ts +0 -19
  155. package/dist/h5/dd-utils.js +0 -94
  156. package/dist/h5/dd-utils.js.map +0 -1
  157. package/dist/h5/gridstack-dd-native.d.ts +0 -26
  158. package/dist/h5/gridstack-dd-native.js +0 -140
  159. package/dist/h5/gridstack-dd-native.js.map +0 -1
  160. package/dist/jq/gridstack-dd-jqueryui.d.ts +0 -22
  161. package/dist/jq/gridstack-dd-jqueryui.js +0 -133
  162. package/dist/jq/gridstack-dd-jqueryui.js.map +0 -1
  163. package/dist/jq/jquery-ui.js +0 -2
  164. package/dist/jq/jquery-ui.js.map +0 -1
  165. package/dist/jq/jquery.js +0 -2
  166. package/dist/jq/jquery.js.map +0 -1
  167. package/dist/jq/jquery.ui.touch-punch.js +0 -2
  168. package/dist/jq/jquery.ui.touch-punch.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * GridStack 5.0
2
+ * GridStack 6.0.0
3
3
  * https://gridstackjs.com/
4
4
  *
5
- * Copyright (c) 2021 Alain Dumesny
5
+ * Copyright (c) 2021-2022 Alain Dumesny
6
6
  * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
7
7
  */
8
8
  import { GridStackEngine } from './gridstack-engine';
@@ -11,7 +11,6 @@ import { ColumnOptions, GridItemHTMLElement, GridStackElement, GridStackEventHan
11
11
  export * from './types';
12
12
  export * from './utils';
13
13
  export * from './gridstack-engine';
14
- export * from './gridstack-ddi';
15
14
  export interface GridHTMLElement extends HTMLElement {
16
15
  gridstack?: GridStack;
17
16
  }
@@ -70,6 +69,11 @@ export declare class GridStack {
70
69
  * @param opt grids options used to initialize the grid, and list of children
71
70
  */
72
71
  static addGrid(parent: HTMLElement, opt?: GridStackOptions): GridStack;
72
+ /** call this method to register your engine instead of the default one.
73
+ * See instead `GridStackOptions.engineClass` if you only need to
74
+ * replace just one instance.
75
+ */
76
+ static registerEngine(engineClass: typeof GridStackEngine): void;
73
77
  /** scoping so users can call GridStack.Utils.sort() for example */
74
78
  static Utils: typeof Utils;
75
79
  /** scoping so users can call new GridStack.Engine(12) for example */
@@ -80,6 +84,7 @@ export declare class GridStack {
80
84
  engine: GridStackEngine;
81
85
  /** grid options - public for classes to access, but use methods to modify! */
82
86
  opts: GridStackOptions;
87
+ protected static engineClass: typeof GridStackEngine;
83
88
  /**
84
89
  * Construct a grid item from the given element and options
85
90
  * @param el
@@ -124,9 +129,10 @@ export declare class GridStack {
124
129
  **/
125
130
  load(layout: GridStackWidget[], addAndRemove?: boolean | ((g: GridStack, w: GridStackWidget, add: boolean) => GridItemHTMLElement)): GridStack;
126
131
  /**
127
- * Initializes batch updates. You will see no changes until `commit()` method is called.
132
+ * use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
133
+ * and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
128
134
  */
129
- batchUpdate(): GridStack;
135
+ batchUpdate(flag?: boolean): GridStack;
130
136
  /**
131
137
  * Gets current cell height.
132
138
  */
@@ -149,11 +155,7 @@ export declare class GridStack {
149
155
  /** Gets current cell width. */
150
156
  cellWidth(): number;
151
157
  /** return our expected width (or parent) for 1 column check */
152
- private _widthOrContainer;
153
- /**
154
- * Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
155
- */
156
- commit(): GridStack;
158
+ protected _widthOrContainer(): number;
157
159
  /** re-layout grid items to reclaim any empty space */
158
160
  compact(): GridStack;
159
161
  /**
@@ -294,13 +296,14 @@ export declare class GridStack {
294
296
  */
295
297
  onParentResize(): GridStack;
296
298
  /** add or remove the window size event handler */
297
- private _updateWindowResizeEvent;
299
+ protected _updateWindowResizeEvent(forceRemove?: boolean): GridStack;
300
+ static GDRev: string;
298
301
  /**
299
302
  * call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
300
303
  * Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar
301
304
  * is dynamically create and needs to change later.
302
305
  * @param dragIn string selector (ex: '.sidebar .grid-stack-item')
303
- * @param dragInOptions options - see DDDragInOpt. (default: {revert: 'invalid', handle: '.grid-stack-item-content', scroll: false, appendTo: 'body'}
306
+ * @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
304
307
  **/
305
308
  static setupDragIn(dragIn?: string, dragInOptions?: DDDragInOpt): void;
306
309
  /**
@@ -343,4 +346,6 @@ export declare class GridStack {
343
346
  * Enables/disables widget resizing. No-op for static grids.
344
347
  */
345
348
  enableResize(doEnable: boolean): GridStack;
349
+ commit(): GridStack;
346
350
  }
351
+ export * from './dd-gridstack';
@@ -30,20 +30,18 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.GridStack = void 0;
32
32
  /*!
33
- * GridStack 5.0
33
+ * GridStack 6.0.0
34
34
  * https://gridstackjs.com/
35
35
  *
36
- * Copyright (c) 2021 Alain Dumesny
36
+ * Copyright (c) 2021-2022 Alain Dumesny
37
37
  * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
38
38
  */
39
39
  var gridstack_engine_1 = require("./gridstack-engine");
40
40
  var utils_1 = require("./utils");
41
- var gridstack_ddi_1 = require("./gridstack-ddi");
42
41
  // export all dependent file as well to make it easier for users to just import the main file
43
42
  __exportStar(require("./types"), exports);
44
43
  __exportStar(require("./utils"), exports);
45
44
  __exportStar(require("./gridstack-engine"), exports);
46
- __exportStar(require("./gridstack-ddi"), exports);
47
45
  // default values for grid options - used during init and when saving out
48
46
  var GridDefaults = {
49
47
  column: 12,
@@ -59,18 +57,16 @@ var GridDefaults = {
59
57
  cellHeightThrottle: 100,
60
58
  margin: 10,
61
59
  auto: true,
62
- minWidth: 768,
60
+ oneColumnSize: 768,
63
61
  float: false,
64
62
  staticGrid: false,
65
63
  animate: true,
66
- alwaysShowResizeHandle: false,
64
+ alwaysShowResizeHandle: 'mobile',
67
65
  resizable: {
68
- autoHide: true,
69
66
  handles: 'se'
70
67
  },
71
68
  draggable: {
72
69
  handle: '.grid-stack-item-content',
73
- scroll: false,
74
70
  appendTo: 'body'
75
71
  },
76
72
  disableDrag: false,
@@ -83,7 +79,7 @@ var GridDefaults = {
83
79
  marginUnit: 'px',
84
80
  cellHeightUnit: 'px',
85
81
  disableOneColumnMode: false,
86
- oneColumnModeDomSort: false
82
+ oneColumnModeDomSort: false,
87
83
  };
88
84
  /**
89
85
  * Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.
@@ -120,25 +116,31 @@ var GridStack = /** @class */ (function () {
120
116
  if (opts.column === 'auto') {
121
117
  delete opts.column;
122
118
  }
123
- // elements attributes override any passed options (like CSS style) - merge the two together
124
- var defaults = __assign(__assign({}, utils_1.Utils.cloneDeep(GridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || 12, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || 0, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || 0, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || false, _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, resizable: {
125
- autoHide: !(opts.alwaysShowResizeHandle || false),
126
- handles: 'se'
127
- }, draggable: {
128
- handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || '.grid-stack-item-content',
129
- scroll: false,
130
- appendTo: 'body'
119
+ // 'minWidth' legacy support in 5.1
120
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
121
+ var anyOpts = opts;
122
+ if (anyOpts.minWidth !== undefined) {
123
+ opts.oneColumnSize = opts.oneColumnSize || anyOpts.minWidth;
124
+ delete anyOpts.minWidth;
125
+ }
126
+ // save original setting so we can restore on save
127
+ if (opts.alwaysShowResizeHandle !== undefined) {
128
+ opts._alwaysShowResizeHandle = opts.alwaysShowResizeHandle;
129
+ }
130
+ // elements DOM attributes override any passed options (like CSS style) - merge the two together
131
+ var defaults = __assign(__assign({}, utils_1.Utils.cloneDeep(GridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || GridDefaults.column, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || GridDefaults.minRow, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || GridDefaults.maxRow, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || GridDefaults.staticGrid, _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), draggable: {
132
+ handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || GridDefaults.draggable.handle,
131
133
  }, removableOptions: {
132
- accept: '.' + (opts.itemClass || 'grid-stack-item')
134
+ accept: opts.itemClass ? '.' + opts.itemClass : GridDefaults.removableOptions.accept,
133
135
  } });
134
136
  if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead
135
137
  defaults.animate = utils_1.Utils.toBool(el.getAttribute('gs-animate'));
136
138
  }
137
139
  this.opts = utils_1.Utils.defaults(opts, defaults);
138
140
  opts = null; // make sure we use this.opts instead
139
- this.initMargin(); // part of settings defaults...
141
+ this._initMargin(); // part of settings defaults...
140
142
  // 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)
141
- if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.minWidth) {
143
+ if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.oneColumnSize) {
142
144
  this._prevColumn = this.getColumn();
143
145
  this.opts.column = 1;
144
146
  }
@@ -169,9 +171,14 @@ var GridStack = /** @class */ (function () {
169
171
  }
170
172
  this.cellHeight(this.opts.cellHeight, false);
171
173
  }
174
+ // see if we need to adjust auto-hide
175
+ if (this.opts.alwaysShowResizeHandle === 'mobile') {
176
+ this.opts.alwaysShowResizeHandle = dd_touch_1.isTouch;
177
+ }
172
178
  this.el.classList.add(this.opts._styleSheetClass);
173
179
  this._setStaticClass();
174
- this.engine = new gridstack_engine_1.GridStackEngine({
180
+ var engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
181
+ this.engine = new engineClass({
175
182
  column: this.getColumn(),
176
183
  float: this.opts.float,
177
184
  maxRow: this.opts.maxRow,
@@ -207,7 +214,7 @@ var GridStack = /** @class */ (function () {
207
214
  });
208
215
  });
209
216
  elements_1.sort(function (a, b) { return a.i - b.i; }).forEach(function (e) { return _this._prepareElement(e.el); });
210
- this.commit();
217
+ this.batchUpdate(false);
211
218
  }
212
219
  this.setAnimation(this.opts.animate);
213
220
  this._updateStyles();
@@ -310,6 +317,13 @@ var GridStack = /** @class */ (function () {
310
317
  }
311
318
  return grid;
312
319
  };
320
+ /** call this method to register your engine instead of the default one.
321
+ * See instead `GridStackOptions.engineClass` if you only need to
322
+ * replace just one instance.
323
+ */
324
+ GridStack.registerEngine = function (engineClass) {
325
+ GridStack.engineClass = engineClass;
326
+ };
313
327
  Object.defineProperty(GridStack.prototype, "placeholder", {
314
328
  /** @internal create placeholder DIV as needed */
315
329
  get: function () {
@@ -462,6 +476,14 @@ var GridStack = /** @class */ (function () {
462
476
  o.column = 'auto';
463
477
  delete o.disableOneColumnMode;
464
478
  }
479
+ var origShow = o._alwaysShowResizeHandle;
480
+ delete o._alwaysShowResizeHandle;
481
+ if (origShow !== undefined) {
482
+ o.alwaysShowResizeHandle = origShow;
483
+ }
484
+ else {
485
+ delete o.alwaysShowResizeHandle;
486
+ }
465
487
  utils_1.Utils.removeInternalAndSame(o, GridDefaults);
466
488
  o.children = list;
467
489
  return o;
@@ -530,17 +552,24 @@ var GridStack = /** @class */ (function () {
530
552
  }
531
553
  });
532
554
  this.engine.removedNodes = removed;
533
- this.commit();
555
+ this.batchUpdate(false);
534
556
  // after commit, clear that flag
535
557
  delete this._ignoreLayoutsNodeChange;
536
558
  delete this._insertNotAppend;
537
559
  return this;
538
560
  };
539
561
  /**
540
- * Initializes batch updates. You will see no changes until `commit()` method is called.
562
+ * use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
563
+ * and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
541
564
  */
542
- GridStack.prototype.batchUpdate = function () {
543
- this.engine.batchUpdate();
565
+ GridStack.prototype.batchUpdate = function (flag) {
566
+ if (flag === void 0) { flag = true; }
567
+ this.engine.batchUpdate(flag);
568
+ if (!flag) {
569
+ this._triggerRemoveEvent();
570
+ this._triggerAddEvent();
571
+ this._triggerChangeEvent();
572
+ }
544
573
  return this;
545
574
  };
546
575
  /**
@@ -615,16 +644,6 @@ var GridStack = /** @class */ (function () {
615
644
  // https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively
616
645
  return (this.el.clientWidth || this.el.parentElement.clientWidth || window.innerWidth);
617
646
  };
618
- /**
619
- * Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
620
- */
621
- GridStack.prototype.commit = function () {
622
- this.engine.commit();
623
- this._triggerRemoveEvent();
624
- this._triggerAddEvent();
625
- this._triggerChangeEvent();
626
- return this;
627
- };
628
647
  /** re-layout grid items to reclaim any empty space */
629
648
  GridStack.prototype.compact = function () {
630
649
  this.engine.compact();
@@ -881,7 +900,7 @@ var GridStack = /** @class */ (function () {
881
900
  return;
882
901
  // remove our DOM data (circular link) and drag&drop permanently
883
902
  delete el.gridstackNode;
884
- gridstack_ddi_1.GridStackDDI.get().remove(el);
903
+ _this._removeDD(el);
885
904
  _this.engine.removeNode(node, removeDOM, triggerEvent);
886
905
  if (removeDOM && el.parentElement) {
887
906
  el.remove(); // in batch mode engine.removeNode doesn't call back to remove DOM
@@ -898,11 +917,12 @@ var GridStack = /** @class */ (function () {
898
917
  * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).
899
918
  */
900
919
  GridStack.prototype.removeAll = function (removeDOM) {
920
+ var _this = this;
901
921
  if (removeDOM === void 0) { removeDOM = true; }
902
922
  // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently
903
923
  this.engine.nodes.forEach(function (n) {
904
924
  delete n.el.gridstackNode;
905
- gridstack_ddi_1.GridStackDDI.get().remove(n.el);
925
+ _this._removeDD(n.el);
906
926
  });
907
927
  this.engine.removeAll(removeDOM);
908
928
  this._triggerRemoveEvent();
@@ -1026,7 +1046,7 @@ var GridStack = /** @class */ (function () {
1026
1046
  // re-use existing margin handling
1027
1047
  this.opts.margin = value;
1028
1048
  this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;
1029
- this.initMargin();
1049
+ this._initMargin();
1030
1050
  this._updateStyles(true); // true = force re-create
1031
1051
  return this;
1032
1052
  };
@@ -1314,7 +1334,7 @@ var GridStack = /** @class */ (function () {
1314
1334
  }
1315
1335
  else {
1316
1336
  // else check for 1 column in/out behavior
1317
- var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.minWidth;
1337
+ var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize;
1318
1338
  if ((this.opts.column === 1) !== oneColumn) {
1319
1339
  changedColumn = true;
1320
1340
  if (this.opts.animate) {
@@ -1377,7 +1397,7 @@ var GridStack = /** @class */ (function () {
1377
1397
  /** @internal */
1378
1398
  GridStack.getGridElements = function (els) { return utils_1.Utils.getElements(els); };
1379
1399
  /** @internal initialize margin top/bottom/left/right and units */
1380
- GridStack.prototype.initMargin = function () {
1400
+ GridStack.prototype._initMargin = function () {
1381
1401
  var data;
1382
1402
  var margin = 0;
1383
1403
  // support passing multiple values like CSS (ex: '5px 10px 0 20px')
@@ -1440,7 +1460,7 @@ var GridStack = /** @class */ (function () {
1440
1460
  return this;
1441
1461
  };
1442
1462
  /*
1443
- * drag&drop empty stubs that will be implemented in gridstack-dd.ts for non static grid
1463
+ * drag&drop empty stubs that will be implemented in dd-gridstack.ts for non static grid
1444
1464
  * so we don't incur the load unless needed.
1445
1465
  * NOTE: had to make those methods public in order to define them else as
1446
1466
  * GridStack.prototype._setupAcceptWidget = function()
@@ -1452,7 +1472,7 @@ var GridStack = /** @class */ (function () {
1452
1472
  * Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar
1453
1473
  * is dynamically create and needs to change later.
1454
1474
  * @param dragIn string selector (ex: '.sidebar .grid-stack-item')
1455
- * @param dragInOptions options - see DDDragInOpt. (default: {revert: 'invalid', handle: '.grid-stack-item-content', scroll: false, appendTo: 'body'}
1475
+ * @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
1456
1476
  **/
1457
1477
  GridStack.setupDragIn = function (dragIn, dragInOptions) { };
1458
1478
  /**
@@ -1495,6 +1515,8 @@ var GridStack = /** @class */ (function () {
1495
1515
  * Enables/disables widget resizing. No-op for static grids.
1496
1516
  */
1497
1517
  GridStack.prototype.enableResize = function (doEnable) { return this; };
1518
+ /** @internal removes any drag&drop present (called during destroy) */
1519
+ GridStack.prototype._removeDD = function (el) { return this; };
1498
1520
  /** @internal called to add drag over support to support widgets */
1499
1521
  GridStack.prototype._setupAcceptWidget = function () { return this; };
1500
1522
  /** @internal called to setup a trash drop zone if the user specifies it */
@@ -1507,11 +1529,16 @@ var GridStack = /** @class */ (function () {
1507
1529
  GridStack.prototype._dragOrResize = function (el, event, ui, node, cellWidth, cellHeight) { return; };
1508
1530
  /** @internal called when a node leaves our area (mouse out or shape outside) **/
1509
1531
  GridStack.prototype._leave = function (el, helper) { return; };
1532
+ // legacy method removed
1533
+ GridStack.prototype.commit = function () { utils_1.obsolete(this, this.batchUpdate(false), 'commit', 'batchUpdate', '5.2'); return this; };
1510
1534
  /** scoping so users can call GridStack.Utils.sort() for example */
1511
1535
  GridStack.Utils = utils_1.Utils;
1512
1536
  /** scoping so users can call new GridStack.Engine(12) for example */
1513
1537
  GridStack.Engine = gridstack_engine_1.GridStackEngine;
1538
+ GridStack.GDRev = '6.0.0';
1514
1539
  return GridStack;
1515
1540
  }());
1516
1541
  exports.GridStack = GridStack;
1542
+ var dd_touch_1 = require("./dd-touch");
1543
+ __exportStar(require("./dd-gridstack"), exports);
1517
1544
  //# sourceMappingURL=gridstack.js.map