gridstack 11.3.0 → 11.5.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/README.md +4 -4
- package/dist/angular/README.md +4 -4
- package/dist/angular/esm2020/index.mjs +3 -2
- package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +8 -8
- package/dist/angular/esm2020/lib/gridstack.component.mjs +13 -13
- package/dist/angular/esm2020/lib/gridstack.module.mjs +10 -10
- package/dist/angular/esm2020/lib/types.mjs +6 -0
- package/dist/angular/fesm2015/gridstack-angular.mjs +57 -57
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +62 -57
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
- package/dist/angular/index.d.ts +2 -1
- package/dist/angular/lib/base-widget.d.ts +1 -1
- package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
- package/dist/angular/lib/gridstack.component.d.ts +7 -25
- package/dist/angular/lib/gridstack.module.d.ts +3 -3
- package/dist/angular/lib/types.d.ts +24 -0
- package/dist/angular/src/base-widget.ts +2 -2
- package/dist/angular/src/gridstack-item.component.ts +4 -4
- package/dist/angular/src/gridstack.component.ts +15 -34
- package/dist/angular/src/gridstack.module.ts +4 -4
- 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 +2 -2
- 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 +10 -13
- 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 +4 -39
- 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 +2 -2
- 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 +10 -14
- 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 +4 -39
- 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 +1 -1
- package/dist/es5/gridstack-engine.js +9 -9
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +17 -3
- package/dist/es5/gridstack.js +126 -34
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +2 -2
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +5 -5
- package/dist/es5/utils.js +24 -42
- 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 +1 -1
- package/dist/gridstack-engine.js +9 -9
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +17 -3
- package/dist/gridstack.js +122 -34
- package/dist/gridstack.js.map +1 -1
- package/dist/src/gridstack.scss +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +23 -40
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +19 -0
- package/doc/README.md +10 -4
- 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.5.0
|
|
40
40
|
* https://gridstackjs.com/
|
|
41
41
|
*
|
|
42
42
|
* Copyright (c) 2021-2024 Alain Dumesny
|
|
@@ -395,7 +395,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
395
395
|
el = GridStack.addRemoveCB(this.el, w, true, false);
|
|
396
396
|
}
|
|
397
397
|
else {
|
|
398
|
-
el =
|
|
398
|
+
el = this.createWidgetDivs(node);
|
|
399
399
|
}
|
|
400
400
|
if (!el)
|
|
401
401
|
return;
|
|
@@ -414,6 +414,29 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
414
414
|
this.makeWidget(el, w);
|
|
415
415
|
return el;
|
|
416
416
|
};
|
|
417
|
+
/** create the default grid item divs, and content (possibly lazy loaded) by using GridStack.renderCB() */
|
|
418
|
+
GridStack.prototype.createWidgetDivs = function (n) {
|
|
419
|
+
var el = utils_1.Utils.createDiv(['grid-stack-item', this.opts.itemClass]);
|
|
420
|
+
var cont = utils_1.Utils.createDiv(['grid-stack-item-content'], el);
|
|
421
|
+
if (utils_1.Utils.lazyLoad(n)) {
|
|
422
|
+
if (!n.visibleObservable) {
|
|
423
|
+
n.visibleObservable = new IntersectionObserver(function (_a) {
|
|
424
|
+
var _b, _c;
|
|
425
|
+
var entry = _a[0];
|
|
426
|
+
if (entry.isIntersecting) {
|
|
427
|
+
(_b = n.visibleObservable) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
428
|
+
delete n.visibleObservable;
|
|
429
|
+
GridStack.renderCB(cont, n);
|
|
430
|
+
(_c = n.grid) === null || _c === void 0 ? void 0 : _c.prepareDragDrop(n.el);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
window.setTimeout(function () { var _a; return (_a = n.visibleObservable) === null || _a === void 0 ? void 0 : _a.observe(el); }); // wait until callee sets position attributes
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
else
|
|
437
|
+
GridStack.renderCB(cont, n);
|
|
438
|
+
return el;
|
|
439
|
+
};
|
|
417
440
|
/**
|
|
418
441
|
* Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
|
|
419
442
|
* from the parent's subGrid options.
|
|
@@ -470,7 +493,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
470
493
|
newItem.appendChild(content);
|
|
471
494
|
content = utils_1.Utils.createDiv(['grid-stack-item-content'], node.el);
|
|
472
495
|
}
|
|
473
|
-
this.
|
|
496
|
+
this.prepareDragDrop(node.el); // ... and restore original D&D
|
|
474
497
|
}
|
|
475
498
|
// if we're adding an additional item, make the container large enough to have them both
|
|
476
499
|
if (nodeToAdd) {
|
|
@@ -605,8 +628,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
605
628
|
/**
|
|
606
629
|
* load the widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.
|
|
607
630
|
*
|
|
608
|
-
* @param
|
|
609
|
-
* @param
|
|
631
|
+
* @param items list of widgets definition to update/create
|
|
632
|
+
* @param addRemove boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving
|
|
610
633
|
* the user control of insertion.
|
|
611
634
|
*
|
|
612
635
|
* @example
|
|
@@ -1191,7 +1214,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1191
1214
|
this._setupRemoveDrop();
|
|
1192
1215
|
this._setupAcceptWidget();
|
|
1193
1216
|
this.engine.nodes.forEach(function (n) {
|
|
1194
|
-
_this.
|
|
1217
|
+
_this.prepareDragDrop(n.el); // either delete or init Drag&drop
|
|
1195
1218
|
if (n.subGrid && recurse)
|
|
1196
1219
|
n.subGrid.setStatic(val, updateClass, recurse);
|
|
1197
1220
|
});
|
|
@@ -1200,6 +1223,54 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1200
1223
|
}
|
|
1201
1224
|
return this;
|
|
1202
1225
|
};
|
|
1226
|
+
/**
|
|
1227
|
+
* Updates the passed in options on the grid (similar to update(widget) for for the grid options).
|
|
1228
|
+
* @param options PARTIAL grid options to update - only items specified will be updated.
|
|
1229
|
+
* NOTE: not all options updating are currently supported (lot of code, unlikely to change)
|
|
1230
|
+
*/
|
|
1231
|
+
GridStack.prototype.updateOptions = function (o) {
|
|
1232
|
+
var _a;
|
|
1233
|
+
var opts = this.opts;
|
|
1234
|
+
if (o.acceptWidgets !== undefined)
|
|
1235
|
+
this._setupAcceptWidget();
|
|
1236
|
+
if (o.animate !== undefined)
|
|
1237
|
+
this.setAnimation();
|
|
1238
|
+
if (o.cellHeight) {
|
|
1239
|
+
this.cellHeight(o.cellHeight, true);
|
|
1240
|
+
delete o.cellHeight;
|
|
1241
|
+
}
|
|
1242
|
+
if (o.class && o.class !== opts.class) {
|
|
1243
|
+
if (opts.class)
|
|
1244
|
+
this.el.classList.remove(opts.class);
|
|
1245
|
+
this.el.classList.add(o.class);
|
|
1246
|
+
}
|
|
1247
|
+
if (typeof (o.column) === 'number' && !o.columnOpts) {
|
|
1248
|
+
this.column(o.column);
|
|
1249
|
+
delete o.column;
|
|
1250
|
+
} // responsive column take over actual count
|
|
1251
|
+
if (o.margin !== undefined)
|
|
1252
|
+
this.margin(o.margin);
|
|
1253
|
+
if (o.staticGrid !== undefined)
|
|
1254
|
+
this.setStatic(o.staticGrid);
|
|
1255
|
+
if (o.disableDrag !== undefined && !o.staticGrid)
|
|
1256
|
+
this.enableMove(!o.disableDrag);
|
|
1257
|
+
if (o.disableResize !== undefined && !o.staticGrid)
|
|
1258
|
+
this.enableResize(!o.disableResize);
|
|
1259
|
+
if (o.float !== undefined)
|
|
1260
|
+
this.float(o.float);
|
|
1261
|
+
if (o.row !== undefined) {
|
|
1262
|
+
opts.minRow = opts.maxRow = o.row;
|
|
1263
|
+
}
|
|
1264
|
+
if ((_a = o.children) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1265
|
+
this.load(o.children);
|
|
1266
|
+
delete o.children;
|
|
1267
|
+
}
|
|
1268
|
+
// TBD if we have a real need for these (more complex code)
|
|
1269
|
+
// alwaysShowResizeHandle, draggable, handle, handleClass, itemClass, layout, placeholderClass, placeholderText, resizable, removable, row,...
|
|
1270
|
+
// rest are just copied over...
|
|
1271
|
+
this.opts = __assign(__assign({}, this.opts), o);
|
|
1272
|
+
return this;
|
|
1273
|
+
};
|
|
1203
1274
|
/**
|
|
1204
1275
|
* Updates widget position/size and other info. Note: if you need to call this on all nodes, use load() instead which will update what changed.
|
|
1205
1276
|
* @param els widget or selector of objects to modify (note: setting the same x,y for multiple items will be indeterministic and likely unwanted)
|
|
@@ -1207,21 +1278,12 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1207
1278
|
*/
|
|
1208
1279
|
GridStack.prototype.update = function (els, opt) {
|
|
1209
1280
|
var _this = this;
|
|
1210
|
-
// support legacy call for now ?
|
|
1211
|
-
if (arguments.length > 2) {
|
|
1212
|
-
console.warn('gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon');
|
|
1213
|
-
// eslint-disable-next-line prefer-rest-params
|
|
1214
|
-
var a = arguments;
|
|
1215
|
-
var i = 1;
|
|
1216
|
-
opt = { x: a[i++], y: a[i++], w: a[i++], h: a[i++] };
|
|
1217
|
-
return this.update(els, opt);
|
|
1218
|
-
}
|
|
1219
1281
|
GridStack.getElements(els).forEach(function (el) {
|
|
1220
1282
|
var _a;
|
|
1221
1283
|
var n = el === null || el === void 0 ? void 0 : el.gridstackNode;
|
|
1222
1284
|
if (!n)
|
|
1223
1285
|
return;
|
|
1224
|
-
var w = utils_1.Utils.cloneDeep(opt); // make a copy we can modify in case they re-use it or multiple items
|
|
1286
|
+
var w = __assign(__assign({}, utils_1.Utils.copyPos({}, n)), utils_1.Utils.cloneDeep(opt)); // make a copy we can modify in case they re-use it or multiple items
|
|
1225
1287
|
_this.engine.nodeBoundFix(w);
|
|
1226
1288
|
delete w.autoPosition;
|
|
1227
1289
|
// move/resize widget if anything changed
|
|
@@ -1281,7 +1343,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1281
1343
|
_this._writeAttr(el, n);
|
|
1282
1344
|
}
|
|
1283
1345
|
if (ddChanged) {
|
|
1284
|
-
_this.
|
|
1346
|
+
_this.prepareDragDrop(n.el);
|
|
1285
1347
|
}
|
|
1286
1348
|
});
|
|
1287
1349
|
return this;
|
|
@@ -1613,7 +1675,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1613
1675
|
sizeToContent ? el.classList.add('size-to-content') : el.classList.remove('size-to-content');
|
|
1614
1676
|
if (sizeToContent)
|
|
1615
1677
|
this.resizeToContentCheck(false, node);
|
|
1616
|
-
|
|
1678
|
+
if (!utils_1.Utils.lazyLoad(node))
|
|
1679
|
+
this.prepareDragDrop(node.el);
|
|
1617
1680
|
return this;
|
|
1618
1681
|
};
|
|
1619
1682
|
/** @internal call to write position x,y,w,h attributes back to element */
|
|
@@ -1663,7 +1726,13 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1663
1726
|
n.noResize = utils_1.Utils.toBool(el.getAttribute('gs-no-resize'));
|
|
1664
1727
|
n.noMove = utils_1.Utils.toBool(el.getAttribute('gs-no-move'));
|
|
1665
1728
|
n.locked = utils_1.Utils.toBool(el.getAttribute('gs-locked'));
|
|
1666
|
-
|
|
1729
|
+
var attr = el.getAttribute('gs-size-to-content');
|
|
1730
|
+
if (attr) {
|
|
1731
|
+
if (attr === 'true' || attr === 'false')
|
|
1732
|
+
n.sizeToContent = utils_1.Utils.toBool(attr);
|
|
1733
|
+
else
|
|
1734
|
+
n.sizeToContent = parseInt(attr, 10);
|
|
1735
|
+
}
|
|
1667
1736
|
n.id = el.getAttribute('gs-id');
|
|
1668
1737
|
// read but never written out
|
|
1669
1738
|
n.maxW = utils_1.Utils.toNumber(el.getAttribute('gs-max-w'));
|
|
@@ -1685,11 +1754,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1685
1754
|
if (n.minH)
|
|
1686
1755
|
el.removeAttribute('gs-min-h');
|
|
1687
1756
|
}
|
|
1688
|
-
// remove any key not found (null or false which is default)
|
|
1757
|
+
// remove any key not found (null or false which is default, unless sizeToContent=false override)
|
|
1689
1758
|
for (var key in n) {
|
|
1690
1759
|
if (!n.hasOwnProperty(key))
|
|
1691
1760
|
return;
|
|
1692
|
-
if (!n[key] && n[key] !== 0) { // 0 can be valid value (x,y only really)
|
|
1761
|
+
if (!n[key] && n[key] !== 0 && key !== 'gs-size-to-content') { // 0 can be valid value (x,y only really)
|
|
1693
1762
|
delete n[key];
|
|
1694
1763
|
}
|
|
1695
1764
|
}
|
|
@@ -1923,7 +1992,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1923
1992
|
if (!n)
|
|
1924
1993
|
return;
|
|
1925
1994
|
val ? delete n.noMove : n.noMove = true;
|
|
1926
|
-
_this.
|
|
1995
|
+
_this.prepareDragDrop(n.el); // init DD if need be, and adjust
|
|
1927
1996
|
});
|
|
1928
1997
|
return this;
|
|
1929
1998
|
};
|
|
@@ -1941,7 +2010,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1941
2010
|
if (!n)
|
|
1942
2011
|
return;
|
|
1943
2012
|
val ? delete n.noResize : n.noResize = true;
|
|
1944
|
-
_this.
|
|
2013
|
+
_this.prepareDragDrop(n.el); // init DD if need be, and adjust
|
|
1945
2014
|
});
|
|
1946
2015
|
return this;
|
|
1947
2016
|
};
|
|
@@ -1993,7 +2062,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1993
2062
|
return this; // can't move a static grid!
|
|
1994
2063
|
doEnable ? delete this.opts.disableDrag : this.opts.disableDrag = true; // FIRST before we update children as grid overrides #1658
|
|
1995
2064
|
this.engine.nodes.forEach(function (n) {
|
|
1996
|
-
_this.
|
|
2065
|
+
_this.prepareDragDrop(n.el);
|
|
1997
2066
|
if (n.subGrid && recurse)
|
|
1998
2067
|
n.subGrid.enableMove(doEnable, recurse);
|
|
1999
2068
|
});
|
|
@@ -2010,7 +2079,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2010
2079
|
return this; // can't size a static grid!
|
|
2011
2080
|
doEnable ? delete this.opts.disableResize : this.opts.disableResize = true; // FIRST before we update children as grid overrides #1658
|
|
2012
2081
|
this.engine.nodes.forEach(function (n) {
|
|
2013
|
-
_this.
|
|
2082
|
+
_this.prepareDragDrop(n.el);
|
|
2014
2083
|
if (n.subGrid && recurse)
|
|
2015
2084
|
n.subGrid.enableResize(doEnable, recurse);
|
|
2016
2085
|
});
|
|
@@ -2141,6 +2210,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2141
2210
|
// delete node._added; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear)
|
|
2142
2211
|
return false; // prevent parent from receiving msg (which may be a grid as well)
|
|
2143
2212
|
}
|
|
2213
|
+
// If sidebar item, restore the sidebar node size to ensure consistent behavior when dragging between grids
|
|
2214
|
+
if (node === null || node === void 0 ? void 0 : node._sidebarOrig) {
|
|
2215
|
+
node.w = node._sidebarOrig.w;
|
|
2216
|
+
node.h = node._sidebarOrig.h;
|
|
2217
|
+
}
|
|
2144
2218
|
// fix #1578 when dragging fast, we may not get a leave on the previous grid so force one now
|
|
2145
2219
|
if ((node === null || node === void 0 ? void 0 : node.grid) && node.grid !== _this && !node._temporaryRemoved) {
|
|
2146
2220
|
// console.log('dropover without leave'); // TEST
|
|
@@ -2151,7 +2225,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2151
2225
|
// cache cell dimensions (which don't change), position can animate if we removed an item in otherGrid that affects us...
|
|
2152
2226
|
cellWidth = _this.cellWidth();
|
|
2153
2227
|
cellHeight = _this.getCellHeight(true);
|
|
2154
|
-
// sidebar items: load any element attributes if we don't have a node
|
|
2228
|
+
// sidebar items: load any element attributes if we don't have a node on first enter from the sidebar
|
|
2155
2229
|
if (!node) {
|
|
2156
2230
|
var attr = helper.getAttribute('data-gs-widget') || helper.getAttribute('gridstacknode'); // TBD: temp support for old V11.0.0 attribute
|
|
2157
2231
|
if (attr) {
|
|
@@ -2166,6 +2240,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2166
2240
|
}
|
|
2167
2241
|
if (!node)
|
|
2168
2242
|
node = _this._readAttr(helper); // used to pass false for #2354, but now we clone top level node
|
|
2243
|
+
// On first grid enter from sidebar, set the initial sidebar item size properties for the node
|
|
2244
|
+
node._sidebarOrig = { w: node.w, h: node.h };
|
|
2169
2245
|
}
|
|
2170
2246
|
if (!node.grid) { // sidebar item
|
|
2171
2247
|
if (!node.el)
|
|
@@ -2335,20 +2411,30 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2335
2411
|
}
|
|
2336
2412
|
return this;
|
|
2337
2413
|
};
|
|
2338
|
-
/**
|
|
2339
|
-
|
|
2414
|
+
/**
|
|
2415
|
+
* prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
2416
|
+
* @param el GridItemHTMLElement of the widget
|
|
2417
|
+
* @param [force=false]
|
|
2418
|
+
* */
|
|
2419
|
+
GridStack.prototype.prepareDragDrop = function (el, force) {
|
|
2340
2420
|
var _this = this;
|
|
2341
|
-
|
|
2421
|
+
if (force === void 0) { force = false; }
|
|
2422
|
+
var node = el === null || el === void 0 ? void 0 : el.gridstackNode;
|
|
2423
|
+
if (!node)
|
|
2424
|
+
return;
|
|
2342
2425
|
var noMove = node.noMove || this.opts.disableDrag;
|
|
2343
2426
|
var noResize = node.noResize || this.opts.disableResize;
|
|
2344
2427
|
// check for disabled grid first
|
|
2345
|
-
|
|
2428
|
+
var disable = node.locked || this.opts.staticGrid || (noMove && noResize);
|
|
2429
|
+
if (force || disable) {
|
|
2346
2430
|
if (node._initDD) {
|
|
2347
2431
|
this._removeDD(el); // nukes everything instead of just disable, will add some styles back next
|
|
2348
2432
|
delete node._initDD;
|
|
2349
2433
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2434
|
+
if (disable) {
|
|
2435
|
+
el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435
|
|
2436
|
+
return this;
|
|
2437
|
+
}
|
|
2352
2438
|
}
|
|
2353
2439
|
if (!node._initDD) {
|
|
2354
2440
|
// variables used/cashed between the 3 start/move/end methods, in addition to node passed above
|
|
@@ -2564,7 +2650,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2564
2650
|
this._extraDragRow = 0; // @ts-ignore
|
|
2565
2651
|
this._updateContainerHeight();
|
|
2566
2652
|
var target = event.target; // @ts-ignore
|
|
2567
|
-
|
|
2653
|
+
// Do not write sidebar item attributes back to the original sidebar el
|
|
2654
|
+
if (!node._sidebarOrig) {
|
|
2655
|
+
this._writePosAttr(target, node);
|
|
2656
|
+
}
|
|
2568
2657
|
if (this._gsEventHandler[event.type]) {
|
|
2569
2658
|
this._gsEventHandler[event.type](event, target);
|
|
2570
2659
|
}
|
|
@@ -2588,8 +2677,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2588
2677
|
node._temporaryRemoved = true;
|
|
2589
2678
|
this.engine.removeNode(node); // remove placeholder as well, otherwise it's a sign node is not in our list, which is a bigger issue
|
|
2590
2679
|
node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged
|
|
2680
|
+
var sidebarOrig = node._sidebarOrig;
|
|
2591
2681
|
if (node._isExternal)
|
|
2592
2682
|
this.engine.cleanupNode(node);
|
|
2683
|
+
// Restore sidebar item initial size info to stay consistent when dragging between multiple grids
|
|
2684
|
+
node._sidebarOrig = sidebarOrig;
|
|
2593
2685
|
if (this.opts.removable === true) { // boolean vs a class string
|
|
2594
2686
|
// item leaving us and we are supposed to remove on leave (no need to drag onto trash) mark it so
|
|
2595
2687
|
GridStack._itemRemoving(el, true);
|
|
@@ -2619,7 +2711,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2619
2711
|
GridStack.Utils = utils_1.Utils;
|
|
2620
2712
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2621
2713
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
2622
|
-
GridStack.GDRev = '11.
|
|
2714
|
+
GridStack.GDRev = '11.5.0';
|
|
2623
2715
|
return GridStack;
|
|
2624
2716
|
}());
|
|
2625
2717
|
//# sourceMappingURL=gridstack.js.map
|