gridstack 11.1.2 → 11.3.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.
- package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
- package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +4 -4
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
- package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
- package/dist/angular/lib/gridstack.component.d.ts +1 -1
- package/dist/angular/src/base-widget.ts +1 -1
- package/dist/angular/src/gridstack-item.component.ts +1 -1
- package/dist/angular/src/gridstack.component.ts +1 -1
- package/dist/angular/src/gridstack.module.ts +1 -1
- package/dist/dd-base-impl.d.ts +1 -1
- package/dist/dd-base-impl.js +1 -1
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +1 -1
- package/dist/dd-draggable.js +5 -7
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +1 -1
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +1 -1
- package/dist/dd-element.js +1 -1
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +1 -1
- package/dist/dd-gridstack.js +1 -1
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +1 -1
- package/dist/dd-manager.js +1 -1
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +1 -1
- package/dist/dd-resizable-handle.js +1 -1
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +1 -1
- package/dist/dd-resizable.js +1 -1
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +1 -1
- package/dist/dd-touch.js +1 -1
- package/dist/dd-touch.js.map +1 -1
- package/dist/es5/dd-base-impl.d.ts +1 -1
- package/dist/es5/dd-base-impl.js +1 -1
- package/dist/es5/dd-base-impl.js.map +1 -1
- package/dist/es5/dd-draggable.d.ts +1 -1
- package/dist/es5/dd-draggable.js +6 -7
- package/dist/es5/dd-draggable.js.map +1 -1
- package/dist/es5/dd-droppable.d.ts +1 -1
- package/dist/es5/dd-droppable.js +1 -1
- package/dist/es5/dd-droppable.js.map +1 -1
- package/dist/es5/dd-element.d.ts +1 -1
- package/dist/es5/dd-element.js +1 -1
- package/dist/es5/dd-element.js.map +1 -1
- package/dist/es5/dd-gridstack.d.ts +1 -1
- package/dist/es5/dd-gridstack.js +1 -1
- package/dist/es5/dd-gridstack.js.map +1 -1
- package/dist/es5/dd-manager.d.ts +1 -1
- package/dist/es5/dd-manager.js +1 -1
- package/dist/es5/dd-manager.js.map +1 -1
- package/dist/es5/dd-resizable-handle.d.ts +1 -1
- package/dist/es5/dd-resizable-handle.js +1 -1
- package/dist/es5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/dd-resizable.d.ts +1 -1
- package/dist/es5/dd-resizable.js +1 -1
- package/dist/es5/dd-resizable.js.map +1 -1
- package/dist/es5/dd-touch.d.ts +1 -1
- package/dist/es5/dd-touch.js +1 -1
- package/dist/es5/dd-touch.js.map +1 -1
- package/dist/es5/gridstack-all.js +1 -1
- package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/es5/gridstack-all.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +3 -1
- package/dist/es5/gridstack-engine.js +4 -7
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +3 -2
- package/dist/es5/gridstack.js +41 -19
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +1 -1
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +3 -3
- package/dist/es5/utils.js +5 -8
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack-engine.d.ts +3 -1
- package/dist/gridstack-engine.js +4 -7
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +3 -2
- package/dist/gridstack.js +39 -19
- package/dist/gridstack.js.map +1 -1
- package/dist/src/gridstack.scss +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +5 -8
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +14 -2
- package/doc/README.md +1 -0
- package/package.json +1 -1
package/dist/es5/gridstack.js
CHANGED
|
@@ -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 11.
|
|
39
|
+
* GridStack 11.3.0
|
|
40
40
|
* https://gridstackjs.com/
|
|
41
41
|
*
|
|
42
42
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
@@ -352,14 +352,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
352
352
|
/** @internal create placeholder DIV as needed */
|
|
353
353
|
get: function () {
|
|
354
354
|
if (!this._placeholder) {
|
|
355
|
-
|
|
356
|
-
placeholderChild
|
|
355
|
+
this._placeholder = utils_1.Utils.createDiv([this.opts.placeholderClass, types_1.gridDefaults.itemClass, this.opts.itemClass]);
|
|
356
|
+
var placeholderChild = utils_1.Utils.createDiv(['placeholder-content'], this._placeholder);
|
|
357
357
|
if (this.opts.placeholderText) {
|
|
358
358
|
placeholderChild.textContent = this.opts.placeholderText;
|
|
359
359
|
}
|
|
360
|
-
this._placeholder = document.createElement('div');
|
|
361
|
-
this._placeholder.classList.add(this.opts.placeholderClass, types_1.gridDefaults.itemClass, this.opts.itemClass);
|
|
362
|
-
this.placeholder.appendChild(placeholderChild);
|
|
363
360
|
}
|
|
364
361
|
return this._placeholder;
|
|
365
362
|
},
|
|
@@ -378,7 +375,6 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
378
375
|
* grid.addWidget({w: 3, content: 'hello'});
|
|
379
376
|
*
|
|
380
377
|
* @param w GridStackWidget definition. used MakeWidget(el) if you have dom element instead.
|
|
381
|
-
* @param options widget position/size options (optional, and ignore if first param is already option) - see GridStackWidget
|
|
382
378
|
*/
|
|
383
379
|
GridStack.prototype.addWidget = function (w) {
|
|
384
380
|
if (typeof w === 'string') {
|
|
@@ -626,16 +622,15 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
626
622
|
items.forEach(function (n) { n.w = n.w || 1; n.h = n.h || 1; });
|
|
627
623
|
// sort items. those without coord will be appended last
|
|
628
624
|
items = utils_1.Utils.sort(items);
|
|
625
|
+
this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = true; // skip layout update
|
|
629
626
|
// if we're loading a layout into for example 1 column and items don't fit, make sure to save
|
|
630
627
|
// the original wanted layout so we can scale back up correctly #1471
|
|
631
628
|
var maxColumn = 0;
|
|
632
629
|
items.forEach(function (n) { maxColumn = Math.max(maxColumn, (n.x || 0) + n.w); });
|
|
633
630
|
if (maxColumn > this.engine.defaultColumn)
|
|
634
631
|
this.engine.defaultColumn = maxColumn;
|
|
635
|
-
if (maxColumn > column)
|
|
636
|
-
this._ignoreLayoutsNodeChange = true; // skip layout update
|
|
632
|
+
if (maxColumn > column)
|
|
637
633
|
this.engine.cacheLayout(items, maxColumn, true);
|
|
638
|
-
}
|
|
639
634
|
// if given a different callback, temporally set it as global option so creating will use it
|
|
640
635
|
var prevCB = GridStack.addRemoveCB;
|
|
641
636
|
if (typeof (addRemove) === 'function')
|
|
@@ -709,6 +704,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
709
704
|
this.batchUpdate(false);
|
|
710
705
|
// after commit, clear that flag
|
|
711
706
|
delete this._ignoreLayoutsNodeChange;
|
|
707
|
+
delete this.engine.skipCacheUpdate;
|
|
712
708
|
prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB;
|
|
713
709
|
// delay adding animation back
|
|
714
710
|
if (blank && ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.animate))
|
|
@@ -903,11 +899,14 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
903
899
|
return Array.from(this.el.children)
|
|
904
900
|
.filter(function (el) { return el.matches('.' + _this.opts.itemClass) && !el.matches('.' + _this.opts.placeholderClass); });
|
|
905
901
|
};
|
|
902
|
+
/** true if changeCB should be ignored due to column change, sizeToContent, loading, etc... which caller can ignore for dirty flag case */
|
|
903
|
+
GridStack.prototype.isIgnoreChangeCB = function () { return this._ignoreLayoutsNodeChange; };
|
|
906
904
|
/**
|
|
907
905
|
* Destroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members.
|
|
908
906
|
* @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).
|
|
909
907
|
*/
|
|
910
908
|
GridStack.prototype.destroy = function (removeDOM) {
|
|
909
|
+
var _a, _b;
|
|
911
910
|
if (removeDOM === void 0) { removeDOM = true; }
|
|
912
911
|
if (!this.el)
|
|
913
912
|
return; // prevent multiple calls
|
|
@@ -924,10 +923,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
924
923
|
this.el.parentNode.removeChild(this.el);
|
|
925
924
|
}
|
|
926
925
|
this._removeStylesheet();
|
|
927
|
-
|
|
928
|
-
delete this.parentGridNode.subGrid;
|
|
926
|
+
(_a = this.parentGridNode) === null || _a === void 0 ? true : delete _a.subGrid;
|
|
929
927
|
delete this.parentGridNode;
|
|
930
928
|
delete this.opts;
|
|
929
|
+
(_b = this._placeholder) === null || _b === void 0 ? true : delete _b.gridstackNode;
|
|
931
930
|
delete this._placeholder;
|
|
932
931
|
delete this.engine;
|
|
933
932
|
delete this.el.gridstack; // remove circular dependency that would prevent a freeing
|
|
@@ -1020,12 +1019,14 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1020
1019
|
}
|
|
1021
1020
|
// if we're adding an item into 1 column make sure
|
|
1022
1021
|
// we don't override the larger 12 column layout that was already saved. #1985
|
|
1023
|
-
|
|
1024
|
-
|
|
1022
|
+
var resetIgnoreLayoutsNodeChange;
|
|
1023
|
+
if (this.opts.column === 1 && !this._ignoreLayoutsNodeChange) {
|
|
1024
|
+
resetIgnoreLayoutsNodeChange = this._ignoreLayoutsNodeChange = true;
|
|
1025
1025
|
}
|
|
1026
1026
|
this._triggerAddEvent();
|
|
1027
1027
|
this._triggerChangeEvent();
|
|
1028
|
-
|
|
1028
|
+
if (resetIgnoreLayoutsNodeChange)
|
|
1029
|
+
delete this._ignoreLayoutsNodeChange;
|
|
1029
1030
|
return el;
|
|
1030
1031
|
};
|
|
1031
1032
|
GridStack.prototype.on = function (name, callback) {
|
|
@@ -2015,6 +2016,23 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2015
2016
|
});
|
|
2016
2017
|
return this;
|
|
2017
2018
|
};
|
|
2019
|
+
/** @internal call when drag (and drop) needs to be cancelled (Esc key) */
|
|
2020
|
+
GridStack.prototype.cancelDrag = function () {
|
|
2021
|
+
var _a;
|
|
2022
|
+
var n = (_a = this._placeholder) === null || _a === void 0 ? void 0 : _a.gridstackNode;
|
|
2023
|
+
if (!n)
|
|
2024
|
+
return;
|
|
2025
|
+
if (n._isExternal) {
|
|
2026
|
+
// remove any newly inserted nodes (from outside)
|
|
2027
|
+
n._isAboutToRemove = true;
|
|
2028
|
+
this.engine.removeNode(n);
|
|
2029
|
+
}
|
|
2030
|
+
else if (n._isAboutToRemove) {
|
|
2031
|
+
// restore any temp removed (dragged over trash)
|
|
2032
|
+
GridStack._itemRemoving(n.el, false);
|
|
2033
|
+
}
|
|
2034
|
+
this.engine.restoreInitial();
|
|
2035
|
+
};
|
|
2018
2036
|
/** @internal removes any drag&drop present (called during destroy) */
|
|
2019
2037
|
GridStack.prototype._removeDD = function (el) {
|
|
2020
2038
|
dd.draggable(el, 'destroy').resizable(el, 'destroy');
|
|
@@ -2135,13 +2153,15 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2135
2153
|
cellHeight = _this.getCellHeight(true);
|
|
2136
2154
|
// sidebar items: load any element attributes if we don't have a node
|
|
2137
2155
|
if (!node) {
|
|
2138
|
-
|
|
2156
|
+
var attr = helper.getAttribute('data-gs-widget') || helper.getAttribute('gridstacknode'); // TBD: temp support for old V11.0.0 attribute
|
|
2157
|
+
if (attr) {
|
|
2139
2158
|
try {
|
|
2140
|
-
node = JSON.parse(
|
|
2159
|
+
node = JSON.parse(attr);
|
|
2141
2160
|
}
|
|
2142
2161
|
catch (error) {
|
|
2143
|
-
console.error("Gridstack dropover: Bad JSON format: ",
|
|
2162
|
+
console.error("Gridstack dropover: Bad JSON format: ", attr);
|
|
2144
2163
|
}
|
|
2164
|
+
helper.removeAttribute('data-gs-widget');
|
|
2145
2165
|
helper.removeAttribute('gridstacknode');
|
|
2146
2166
|
}
|
|
2147
2167
|
if (!node)
|
|
@@ -2215,6 +2235,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2215
2235
|
var wasAdded = !!_this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419
|
|
2216
2236
|
var wasSidebar = el !== helper;
|
|
2217
2237
|
_this.placeholder.remove();
|
|
2238
|
+
delete _this.placeholder.gridstackNode;
|
|
2218
2239
|
// disable animation when replacing a placeholder (already positioned) with actual content
|
|
2219
2240
|
var noAnim = wasAdded && _this.opts.animate;
|
|
2220
2241
|
if (noAnim)
|
|
@@ -2350,6 +2371,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2350
2371
|
/** called when the item stops moving/resizing */
|
|
2351
2372
|
var onEndMoving = function (event) {
|
|
2352
2373
|
_this.placeholder.remove();
|
|
2374
|
+
delete _this.placeholder.gridstackNode;
|
|
2353
2375
|
delete node._moving;
|
|
2354
2376
|
delete node._event;
|
|
2355
2377
|
delete node._lastTried;
|
|
@@ -2597,7 +2619,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2597
2619
|
GridStack.Utils = utils_1.Utils;
|
|
2598
2620
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2599
2621
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
2600
|
-
GridStack.GDRev = '11.
|
|
2622
|
+
GridStack.GDRev = '11.3.0';
|
|
2601
2623
|
return GridStack;
|
|
2602
2624
|
}());
|
|
2603
2625
|
//# sourceMappingURL=gridstack.js.map
|