gridstack 10.3.1 → 11.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.
- package/README.md +37 -3
- package/dist/angular/README.md +47 -25
- package/dist/angular/{esm2020 → esm2022}/gridstack-angular.mjs +5 -5
- package/dist/angular/esm2022/index.mjs +8 -0
- package/dist/angular/esm2022/lib/base-widget.mjs +34 -0
- package/dist/angular/esm2022/lib/gridstack-item.component.mjs +72 -0
- package/dist/angular/esm2022/lib/gridstack.component.mjs +300 -0
- package/dist/angular/esm2022/lib/gridstack.module.mjs +39 -0
- package/dist/angular/{fesm2020 → fesm2022}/gridstack-angular.mjs +400 -369
- package/dist/angular/fesm2022/gridstack-angular.mjs.map +1 -0
- package/dist/angular/index.d.ts +4 -5
- package/dist/angular/lib/base-widget.d.ts +18 -16
- package/dist/angular/lib/gridstack-item.component.d.ts +37 -37
- package/dist/angular/lib/gridstack.component.d.ts +135 -129
- package/dist/angular/lib/gridstack.module.d.ts +10 -10
- package/dist/angular/src/base-widget.ts +10 -2
- package/dist/angular/src/gridstack-item.component.ts +11 -7
- package/dist/angular/src/gridstack.component.ts +67 -44
- package/dist/angular/src/gridstack.module.ts +2 -2
- package/dist/dd-base-impl.d.ts +2 -2
- package/dist/dd-base-impl.js +2 -2
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +7 -16
- package/dist/dd-draggable.js +22 -34
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +2 -2
- package/dist/dd-droppable.js +2 -2
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +5 -5
- package/dist/dd-element.js +2 -2
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +4 -4
- package/dist/dd-gridstack.js +8 -8
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +2 -2
- package/dist/dd-manager.js +2 -2
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +2 -2
- package/dist/dd-resizable-handle.js +3 -3
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +2 -2
- package/dist/dd-resizable.js +4 -4
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +2 -2
- package/dist/dd-touch.js +2 -2
- package/dist/dd-touch.js.map +1 -1
- package/dist/es5/dd-base-impl.d.ts +2 -2
- package/dist/es5/dd-base-impl.js +2 -2
- package/dist/es5/dd-base-impl.js.map +1 -1
- package/dist/es5/dd-draggable.d.ts +7 -16
- package/dist/es5/dd-draggable.js +19 -29
- package/dist/es5/dd-draggable.js.map +1 -1
- package/dist/es5/dd-droppable.d.ts +2 -2
- package/dist/es5/dd-droppable.js +2 -2
- package/dist/es5/dd-droppable.js.map +1 -1
- package/dist/es5/dd-element.d.ts +5 -5
- package/dist/es5/dd-element.js +2 -2
- package/dist/es5/dd-element.js.map +1 -1
- package/dist/es5/dd-gridstack.d.ts +4 -4
- package/dist/es5/dd-gridstack.js +9 -6
- package/dist/es5/dd-gridstack.js.map +1 -1
- package/dist/es5/dd-manager.d.ts +2 -2
- package/dist/es5/dd-manager.js +2 -2
- package/dist/es5/dd-manager.js.map +1 -1
- package/dist/es5/dd-resizable-handle.d.ts +2 -2
- package/dist/es5/dd-resizable-handle.js +2 -2
- package/dist/es5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/dd-resizable.d.ts +2 -2
- package/dist/es5/dd-resizable.js +2 -2
- package/dist/es5/dd-resizable.js.map +1 -1
- package/dist/es5/dd-touch.d.ts +2 -2
- package/dist/es5/dd-touch.js +2 -2
- 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 +2 -2
- package/dist/es5/gridstack-all.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +2 -2
- package/dist/es5/gridstack-engine.js +5 -5
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +2 -2
- package/dist/es5/gridstack.d.ts +22 -17
- package/dist/es5/gridstack.js +158 -141
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +16 -8
- package/dist/es5/types.js +3 -10
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +6 -2
- package/dist/es5/utils.js +36 -3
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +2 -2
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack-engine.d.ts +2 -2
- package/dist/gridstack-engine.js +61 -61
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack-extra.css +1 -1
- package/dist/gridstack.css +2 -2
- package/dist/gridstack.d.ts +22 -17
- package/dist/gridstack.js +244 -226
- package/dist/gridstack.js.map +1 -1
- package/dist/src/gridstack-extra.scss +1 -1
- package/dist/src/gridstack.scss +2 -2
- package/dist/types.d.ts +16 -8
- package/dist/types.js +2 -9
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +6 -2
- package/dist/utils.js +50 -20
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +8 -0
- package/doc/README.md +18 -23
- package/package.json +1 -1
- package/dist/angular/esm2020/lib/base-widget.mjs +0 -30
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +0 -68
- package/dist/angular/esm2020/lib/gridstack.component.mjs +0 -280
- package/dist/angular/esm2020/lib/gridstack.module.mjs +0 -39
- package/dist/angular/esm2020/public-api.mjs +0 -8
- package/dist/angular/fesm2015/gridstack-angular.mjs +0 -420
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +0 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +0 -1
- package/dist/angular/package.json +0 -31
- package/dist/angular/public-api.d.ts +0 -4
package/dist/es5/gridstack.js
CHANGED
|
@@ -36,10 +36,10 @@ 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
|
|
39
|
+
* GridStack 11.0.0
|
|
40
40
|
* https://gridstackjs.com/
|
|
41
41
|
*
|
|
42
|
-
* Copyright (c) 2021-
|
|
42
|
+
* Copyright (c) 2021-2024 Alain Dumesny
|
|
43
43
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
44
44
|
*/
|
|
45
45
|
var gridstack_engine_1 = require("./gridstack-engine");
|
|
@@ -79,7 +79,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
79
79
|
function GridStack(el, opts) {
|
|
80
80
|
if (opts === void 0) { opts = {}; }
|
|
81
81
|
var _this = this;
|
|
82
|
-
var _a, _b, _c
|
|
82
|
+
var _a, _b, _c;
|
|
83
83
|
this.el = el;
|
|
84
84
|
this.opts = opts;
|
|
85
85
|
/** @internal */
|
|
@@ -164,13 +164,13 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
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)
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
this.
|
|
167
|
+
var parentGridItem = this.el.closest('.' + types_1.gridDefaults.itemClass);
|
|
168
|
+
var parentNode = parentGridItem === null || parentGridItem === void 0 ? void 0 : parentGridItem.gridstackNode;
|
|
169
|
+
if (parentNode) {
|
|
170
|
+
parentNode.subGrid = this;
|
|
171
|
+
this.parentGridNode = parentNode;
|
|
172
172
|
this.el.classList.add('grid-stack-nested');
|
|
173
|
-
|
|
173
|
+
parentNode.el.classList.add('grid-stack-sub-grid');
|
|
174
174
|
}
|
|
175
175
|
this._isAutoCellHeight = (opts.cellHeight === 'auto');
|
|
176
176
|
if (this._isAutoCellHeight || opts.cellHeight === 'initial') {
|
|
@@ -237,7 +237,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
237
237
|
// dynamic grids require pausing during drag to detect over to nest vs push
|
|
238
238
|
if (opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
|
|
239
239
|
dd_manager_1.DDManager.pauseDrag = true;
|
|
240
|
-
if (((
|
|
240
|
+
if (((_c = opts.draggable) === null || _c === void 0 ? void 0 : _c.pause) !== undefined)
|
|
241
241
|
dd_manager_1.DDManager.pauseDrag = opts.draggable.pause;
|
|
242
242
|
this._setupRemoveDrop();
|
|
243
243
|
this._setupAcceptWidget();
|
|
@@ -251,10 +251,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
251
251
|
* @param elOrString element or CSS selector (first one used) to convert to a grid (default to '.grid-stack' class selector)
|
|
252
252
|
*
|
|
253
253
|
* @example
|
|
254
|
-
*
|
|
254
|
+
* const grid = GridStack.init();
|
|
255
255
|
*
|
|
256
256
|
* Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later
|
|
257
|
-
*
|
|
257
|
+
* const grid = document.querySelector('.grid-stack').gridstack;
|
|
258
258
|
*/
|
|
259
259
|
GridStack.init = function (options, elOrString) {
|
|
260
260
|
if (options === void 0) { options = {}; }
|
|
@@ -283,7 +283,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
283
283
|
* @param selector elements selector to convert to grids (default to '.grid-stack' class selector)
|
|
284
284
|
*
|
|
285
285
|
* @example
|
|
286
|
-
*
|
|
286
|
+
* const grids = GridStack.initAll();
|
|
287
287
|
* grids.forEach(...)
|
|
288
288
|
*/
|
|
289
289
|
GridStack.initAll = function (options, selector) {
|
|
@@ -332,10 +332,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
332
332
|
el = GridStack.addRemoveCB(parent, opt, true, true);
|
|
333
333
|
}
|
|
334
334
|
else {
|
|
335
|
-
|
|
336
|
-
doc.body.innerHTML = "<div class=\"grid-stack ".concat(opt.class || '', "\"></div>");
|
|
337
|
-
el = doc.body.children[0];
|
|
338
|
-
parent.appendChild(el);
|
|
335
|
+
el = utils_1.Utils.createDiv(['grid-stack', opt.class], parent);
|
|
339
336
|
}
|
|
340
337
|
}
|
|
341
338
|
// create grid class and load any children
|
|
@@ -356,7 +353,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
356
353
|
var placeholderChild = document.createElement('div'); // child so padding match item-content
|
|
357
354
|
placeholderChild.className = 'placeholder-content';
|
|
358
355
|
if (this.opts.placeholderText) {
|
|
359
|
-
placeholderChild.
|
|
356
|
+
placeholderChild.textContent = this.opts.placeholderText;
|
|
360
357
|
}
|
|
361
358
|
this._placeholder = document.createElement('div');
|
|
362
359
|
this._placeholder.classList.add(this.opts.placeholderClass, types_1.gridDefaults.itemClass, this.opts.itemClass);
|
|
@@ -372,44 +369,35 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
372
369
|
*
|
|
373
370
|
* Widget will be always placed even if result height is more than actual grid height.
|
|
374
371
|
* You need to use `willItFit()` before calling addWidget for additional check.
|
|
375
|
-
* See also `makeWidget()
|
|
372
|
+
* See also `makeWidget(el)` for DOM element.
|
|
376
373
|
*
|
|
377
374
|
* @example
|
|
378
|
-
*
|
|
375
|
+
* const grid = GridStack.init();
|
|
379
376
|
* grid.addWidget({w: 3, content: 'hello'});
|
|
380
|
-
* grid.addWidget('<div class="grid-stack-item"><div class="grid-stack-item-content">hello</div></div>', {w: 3});
|
|
381
377
|
*
|
|
382
|
-
* @param
|
|
378
|
+
* @param w GridStackWidget definition. used MakeWidget(el) if you have dom element instead.
|
|
383
379
|
* @param options widget position/size options (optional, and ignore if first param is already option) - see GridStackWidget
|
|
384
380
|
*/
|
|
385
|
-
GridStack.prototype.addWidget = function (
|
|
386
|
-
|
|
387
|
-
|
|
381
|
+
GridStack.prototype.addWidget = function (w) {
|
|
382
|
+
if (typeof w === 'string') {
|
|
383
|
+
console.error('V11: GridStack.addWidget() does not support string anymore. see #2736');
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (w.ELEMENT_NODE) {
|
|
387
|
+
console.error('V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()');
|
|
388
|
+
return this.makeWidget(w);
|
|
388
389
|
}
|
|
389
390
|
var el;
|
|
390
|
-
var node;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
el = doc.body.children[0];
|
|
391
|
+
var node = w;
|
|
392
|
+
node.grid = this;
|
|
393
|
+
if (node === null || node === void 0 ? void 0 : node.el) {
|
|
394
|
+
el = node.el; // re-use element stored in the node
|
|
395
395
|
}
|
|
396
|
-
else if (
|
|
397
|
-
|
|
398
|
-
if (node === null || node === void 0 ? void 0 : node.el) {
|
|
399
|
-
el = node.el; // re-use element stored in the node
|
|
400
|
-
}
|
|
401
|
-
else if (GridStack.addRemoveCB) {
|
|
402
|
-
el = GridStack.addRemoveCB(this.el, options, true, false);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
var content = (options === null || options === void 0 ? void 0 : options.content) || '';
|
|
406
|
-
var doc = document.implementation.createHTMLDocument(''); // IE needs a param
|
|
407
|
-
doc.body.innerHTML = "<div class=\"grid-stack-item ".concat(this.opts.itemClass || '', "\"><div class=\"grid-stack-item-content\">").concat(content, "</div></div>");
|
|
408
|
-
el = doc.body.children[0];
|
|
409
|
-
}
|
|
396
|
+
else if (GridStack.addRemoveCB) {
|
|
397
|
+
el = GridStack.addRemoveCB(this.el, w, true, false);
|
|
410
398
|
}
|
|
411
399
|
else {
|
|
412
|
-
el =
|
|
400
|
+
el = utils_1.Utils.createWidgetDivs(this.opts.itemClass, node);
|
|
413
401
|
}
|
|
414
402
|
if (!el)
|
|
415
403
|
return;
|
|
@@ -421,12 +409,11 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
421
409
|
// as the actual value are filled in when _prepareElement() calls el.getAttribute('gs-xyz') before adding the node.
|
|
422
410
|
// So make sure we load any DOM attributes that are not specified in passed in options (which override)
|
|
423
411
|
var domAttr = this._readAttr(el);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
this._writeAttr(el, options);
|
|
412
|
+
utils_1.Utils.defaults(w, domAttr);
|
|
413
|
+
this.engine.prepareNode(w);
|
|
414
|
+
this._writeAttr(el, w);
|
|
428
415
|
this.el.appendChild(el);
|
|
429
|
-
this.makeWidget(el,
|
|
416
|
+
this.makeWidget(el, w);
|
|
430
417
|
return el;
|
|
431
418
|
};
|
|
432
419
|
/**
|
|
@@ -452,7 +439,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
452
439
|
var grid = this;
|
|
453
440
|
while (grid && !subGridTemplate) {
|
|
454
441
|
subGridTemplate = (_b = grid.opts) === null || _b === void 0 ? void 0 : _b.subGridOpts;
|
|
455
|
-
grid = (_c = grid.
|
|
442
|
+
grid = (_c = grid.parentGridNode) === null || _c === void 0 ? void 0 : _c.grid;
|
|
456
443
|
}
|
|
457
444
|
//... and set the create options
|
|
458
445
|
ops = utils_1.Utils.cloneDeep(__assign(__assign(__assign({}, (subGridTemplate || {})), { children: undefined }), (ops || node.subGridOpts || {})));
|
|
@@ -481,13 +468,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
481
468
|
newItem = GridStack.addRemoveCB(this.el, newItemOpt, true, false);
|
|
482
469
|
}
|
|
483
470
|
else {
|
|
484
|
-
|
|
485
|
-
doc.body.innerHTML = "<div class=\"grid-stack-item\"></div>";
|
|
486
|
-
newItem = doc.body.children[0];
|
|
471
|
+
newItem = utils_1.Utils.createDiv(['grid-stack-item']);
|
|
487
472
|
newItem.appendChild(content);
|
|
488
|
-
|
|
489
|
-
content = doc.body.children[0];
|
|
490
|
-
node.el.appendChild(content);
|
|
473
|
+
content = utils_1.Utils.createDiv(['grid-stack-item-content'], node.el);
|
|
491
474
|
}
|
|
492
475
|
this._prepareDragDropByNode(node); // ... and restore original D&D
|
|
493
476
|
}
|
|
@@ -507,7 +490,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
507
490
|
subGrid._autoColumn = true;
|
|
508
491
|
// add the original content back as a child of hte newly created grid
|
|
509
492
|
if (saveContent) {
|
|
510
|
-
subGrid.
|
|
493
|
+
subGrid.makeWidget(newItem, newItemOpt);
|
|
511
494
|
}
|
|
512
495
|
// now add any additional node
|
|
513
496
|
if (nodeToAdd) {
|
|
@@ -516,7 +499,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
516
499
|
window.setTimeout(function () { return utils_1.Utils.simulateMouseEvent(nodeToAdd._event, 'mouseenter', subGrid.el); }, 0);
|
|
517
500
|
}
|
|
518
501
|
else {
|
|
519
|
-
subGrid.
|
|
502
|
+
subGrid.makeWidget(node.el, node);
|
|
520
503
|
}
|
|
521
504
|
}
|
|
522
505
|
return subGrid;
|
|
@@ -528,21 +511,21 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
528
511
|
GridStack.prototype.removeAsSubGrid = function (nodeThatRemoved) {
|
|
529
512
|
var _this = this;
|
|
530
513
|
var _a;
|
|
531
|
-
var pGrid = (_a = this.
|
|
514
|
+
var pGrid = (_a = this.parentGridNode) === null || _a === void 0 ? void 0 : _a.grid;
|
|
532
515
|
if (!pGrid)
|
|
533
516
|
return;
|
|
534
517
|
pGrid.batchUpdate();
|
|
535
|
-
pGrid.removeWidget(this.
|
|
518
|
+
pGrid.removeWidget(this.parentGridNode.el, true, true);
|
|
536
519
|
this.engine.nodes.forEach(function (n) {
|
|
537
520
|
// migrate any children over and offsetting by our location
|
|
538
|
-
n.x += _this.
|
|
539
|
-
n.y += _this.
|
|
540
|
-
pGrid.
|
|
521
|
+
n.x += _this.parentGridNode.x;
|
|
522
|
+
n.y += _this.parentGridNode.y;
|
|
523
|
+
pGrid.makeWidget(n.el, n);
|
|
541
524
|
});
|
|
542
525
|
pGrid.batchUpdate(false);
|
|
543
|
-
if (this.
|
|
544
|
-
delete this.
|
|
545
|
-
delete this.
|
|
526
|
+
if (this.parentGridNode)
|
|
527
|
+
delete this.parentGridNode.subGrid;
|
|
528
|
+
delete this.parentGridNode;
|
|
546
529
|
// create an artificial event for the original grid now that this one is gone (got a leave, but won't get enter)
|
|
547
530
|
if (nodeThatRemoved) {
|
|
548
531
|
window.setTimeout(function () { return utils_1.Utils.simulateMouseEvent(nodeThatRemoved._event, 'mouseenter', pGrid.el); }, 0);
|
|
@@ -567,8 +550,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
567
550
|
list.forEach(function (n) {
|
|
568
551
|
var _a;
|
|
569
552
|
if (saveContent && n.el && !n.subGrid && !saveCB) { // sub-grid are saved differently, not plain content
|
|
570
|
-
var
|
|
571
|
-
n.content =
|
|
553
|
+
var itemContent = n.el.querySelector('.grid-stack-item-content');
|
|
554
|
+
n.content = itemContent === null || itemContent === void 0 ? void 0 : itemContent.innerHTML;
|
|
572
555
|
if (!n.content)
|
|
573
556
|
delete n.content;
|
|
574
557
|
}
|
|
@@ -934,9 +917,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
934
917
|
this.el.parentNode.removeChild(this.el);
|
|
935
918
|
}
|
|
936
919
|
this._removeStylesheet();
|
|
937
|
-
if (this.
|
|
938
|
-
delete this.
|
|
939
|
-
delete this.
|
|
920
|
+
if (this.parentGridNode)
|
|
921
|
+
delete this.parentGridNode.subGrid;
|
|
922
|
+
delete this.parentGridNode;
|
|
940
923
|
delete this.opts;
|
|
941
924
|
delete this._placeholder;
|
|
942
925
|
delete this.engine;
|
|
@@ -1010,7 +993,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1010
993
|
* @param options widget definition to use instead of reading attributes or using default sizing values
|
|
1011
994
|
*
|
|
1012
995
|
* @example
|
|
1013
|
-
*
|
|
996
|
+
* const grid = GridStack.init();
|
|
1014
997
|
* grid.el.appendChild('<div id="1" gs-w="3"></div>');
|
|
1015
998
|
* grid.el.appendChild('<div id="2"></div>');
|
|
1016
999
|
* grid.makeWidget('1');
|
|
@@ -1018,6 +1001,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1018
1001
|
*/
|
|
1019
1002
|
GridStack.prototype.makeWidget = function (els, options) {
|
|
1020
1003
|
var el = GridStack.getElement(els);
|
|
1004
|
+
if (!el)
|
|
1005
|
+
return;
|
|
1006
|
+
if (!el.parentElement)
|
|
1007
|
+
this.el.appendChild(el);
|
|
1021
1008
|
this._prepareElement(el, true, options);
|
|
1022
1009
|
var node = el.gridstackNode;
|
|
1023
1010
|
this._updateContainerHeight();
|
|
@@ -1050,7 +1037,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1050
1037
|
this._gsEventHandler[name] = function (event) { return callback(event); };
|
|
1051
1038
|
}
|
|
1052
1039
|
else {
|
|
1053
|
-
this._gsEventHandler[name] = function (event) {
|
|
1040
|
+
this._gsEventHandler[name] = function (event) { if (event.detail)
|
|
1041
|
+
callback(event, event.detail); };
|
|
1054
1042
|
}
|
|
1055
1043
|
this.el.addEventListener(name, this._gsEventHandler[name]);
|
|
1056
1044
|
}
|
|
@@ -1102,6 +1090,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1102
1090
|
var _this = this;
|
|
1103
1091
|
if (removeDOM === void 0) { removeDOM = true; }
|
|
1104
1092
|
if (triggerEvent === void 0) { triggerEvent = true; }
|
|
1093
|
+
if (!els) {
|
|
1094
|
+
console.error('Error: GridStack.removeWidget(undefined) called');
|
|
1095
|
+
return this;
|
|
1096
|
+
}
|
|
1105
1097
|
GridStack.getElements(els).forEach(function (el) {
|
|
1106
1098
|
if (el.parentElement && el.parentElement !== _this.el)
|
|
1107
1099
|
return; // not our child!
|
|
@@ -1212,7 +1204,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1212
1204
|
if (arguments.length > 2) {
|
|
1213
1205
|
console.warn('gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon');
|
|
1214
1206
|
// eslint-disable-next-line prefer-rest-params
|
|
1215
|
-
var a = arguments
|
|
1207
|
+
var a = arguments;
|
|
1208
|
+
var i = 1;
|
|
1216
1209
|
opt = { x: a[i++], y: a[i++], w: a[i++], h: a[i++] };
|
|
1217
1210
|
return this.update(els, opt);
|
|
1218
1211
|
}
|
|
@@ -1242,8 +1235,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1242
1235
|
// check for content changing
|
|
1243
1236
|
if (w.content !== undefined) {
|
|
1244
1237
|
var itemContent = el.querySelector('.grid-stack-item-content');
|
|
1245
|
-
if (itemContent && itemContent.
|
|
1246
|
-
itemContent
|
|
1238
|
+
if (itemContent && itemContent.textContent !== w.content) {
|
|
1239
|
+
GridStack.renderCB(itemContent, w);
|
|
1247
1240
|
// restore any sub-grid back
|
|
1248
1241
|
if ((_a = n.subGrid) === null || _a === void 0 ? void 0 : _a.el) {
|
|
1249
1242
|
itemContent.appendChild(n.subGrid.el);
|
|
@@ -1432,7 +1425,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1432
1425
|
if (arguments.length > 1) {
|
|
1433
1426
|
console.warn('gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon');
|
|
1434
1427
|
// eslint-disable-next-line prefer-rest-params
|
|
1435
|
-
var a = arguments
|
|
1428
|
+
var a = arguments;
|
|
1429
|
+
var i = 0, w = { x: a[i++], y: a[i++], w: a[i++], h: a[i++], autoPosition: a[i++] };
|
|
1436
1430
|
return this.willItFit(w);
|
|
1437
1431
|
}
|
|
1438
1432
|
return this.engine.willItFit(node);
|
|
@@ -1559,7 +1553,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1559
1553
|
GridStack.prototype._updateContainerHeight = function () {
|
|
1560
1554
|
if (!this.engine || this.engine.batchMode)
|
|
1561
1555
|
return this;
|
|
1562
|
-
var parent = this.
|
|
1556
|
+
var parent = this.parentGridNode;
|
|
1563
1557
|
var row = this.getRow() + this._extraDragRow; // this checks for minRow already
|
|
1564
1558
|
var cellHeight = this.opts.cellHeight;
|
|
1565
1559
|
var unit = this.opts.cellHeightUnit;
|
|
@@ -1624,7 +1618,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1624
1618
|
return this;
|
|
1625
1619
|
this._writePosAttr(el, node);
|
|
1626
1620
|
var attrs /*: GridStackWidget but strings */ = {
|
|
1627
|
-
autoPosition: 'gs-auto-position',
|
|
1621
|
+
// autoPosition: 'gs-auto-position', // no need to write out as already in node and doesn't affect CSS
|
|
1628
1622
|
noResize: 'gs-no-resize',
|
|
1629
1623
|
noMove: 'gs-no-move',
|
|
1630
1624
|
locked: 'gs-locked',
|
|
@@ -1713,9 +1707,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1713
1707
|
this.batchUpdate();
|
|
1714
1708
|
// see if we're nested and take our column count from our parent....
|
|
1715
1709
|
var columnChanged = false;
|
|
1716
|
-
if (this._autoColumn && this.
|
|
1717
|
-
if (this.opts.column !== this.
|
|
1718
|
-
this.column(this.
|
|
1710
|
+
if (this._autoColumn && this.parentGridNode) {
|
|
1711
|
+
if (this.opts.column !== this.parentGridNode.w) {
|
|
1712
|
+
this.column(this.parentGridNode.w, 'none');
|
|
1719
1713
|
columnChanged = true;
|
|
1720
1714
|
}
|
|
1721
1715
|
}
|
|
@@ -1771,7 +1765,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1771
1765
|
if (forceRemove === void 0) { forceRemove = false; }
|
|
1772
1766
|
// only add event if we're not nested (parent will call us) and we're auto sizing cells or supporting dynamic column (i.e. doing work)
|
|
1773
1767
|
// or supporting new sizeToContent option.
|
|
1774
|
-
var trackSize = !this.
|
|
1768
|
+
var trackSize = !this.parentGridNode && (this._isAutoCellHeight || this.opts.sizeToContent || this.opts.columnOpts
|
|
1775
1769
|
|| this.engine.nodes.find(function (n) { return n.sizeToContent; }));
|
|
1776
1770
|
if (!forceRemove && trackSize && !this.resizeObserver) {
|
|
1777
1771
|
this._sizeThrottle = utils_1.Utils.throttle(function () { return _this.onResize(); }, this.opts.cellHeightThrottle);
|
|
@@ -1876,22 +1870,24 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1876
1870
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
1877
1871
|
* Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar
|
|
1878
1872
|
* is dynamically create and needs to be set later.
|
|
1879
|
-
* @param dragIn string selector (ex: '.sidebar
|
|
1880
|
-
* @param dragInOptions options - see
|
|
1881
|
-
* @param
|
|
1873
|
+
* @param dragIn string selector (ex: '.sidebar-item') or list of dom elements
|
|
1874
|
+
* @param dragInOptions options - see DDDragOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
1875
|
+
* @param widgets GridStackWidget def to assign to each element which defines what to create on drop
|
|
1876
|
+
* @param root optional root which defaults to document (for shadow dom pass the parent HTMLDocument)
|
|
1882
1877
|
*/
|
|
1883
|
-
GridStack.setupDragIn = function (dragIn, dragInOptions, root) {
|
|
1878
|
+
GridStack.setupDragIn = function (dragIn, dragInOptions, widgets, root) {
|
|
1884
1879
|
if (root === void 0) { root = document; }
|
|
1885
1880
|
if ((dragInOptions === null || dragInOptions === void 0 ? void 0 : dragInOptions.pause) !== undefined) {
|
|
1886
1881
|
dd_manager_1.DDManager.pauseDrag = dragInOptions.pause;
|
|
1887
1882
|
}
|
|
1888
|
-
dragInOptions = __assign(
|
|
1883
|
+
dragInOptions = __assign({ appendTo: 'body', helper: 'clone' }, (dragInOptions || {})); // default to handle:undefined = drag by the whole item
|
|
1889
1884
|
var els = (typeof dragIn === 'string') ? utils_1.Utils.getElements(dragIn, root) : dragIn;
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1885
|
+
els.forEach(function (el, i) {
|
|
1886
|
+
if (!dd.isDraggable(el))
|
|
1887
|
+
dd.dragIn(el, dragInOptions);
|
|
1888
|
+
if (widgets === null || widgets === void 0 ? void 0 : widgets[i])
|
|
1889
|
+
el.gridstackNode = widgets[i];
|
|
1890
|
+
});
|
|
1895
1891
|
};
|
|
1896
1892
|
/**
|
|
1897
1893
|
* Enables/Disables dragging by the user of specific grid element. If you want all items, and have it affect future items, use enableMove() instead. No-op for static grids.
|
|
@@ -2022,14 +2018,13 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2022
2018
|
var cellHeight, cellWidth;
|
|
2023
2019
|
var onDrag = function (event, el, helper) {
|
|
2024
2020
|
var _a;
|
|
2025
|
-
|
|
2026
|
-
var node =
|
|
2021
|
+
helper = helper || el;
|
|
2022
|
+
var node = helper.gridstackNode;
|
|
2027
2023
|
if (!node)
|
|
2028
2024
|
return;
|
|
2029
|
-
helper = helper || el;
|
|
2030
2025
|
// if the element is being dragged from outside, scale it down to match the grid's scale
|
|
2031
2026
|
// and slightly adjust its position relative to the mouse
|
|
2032
|
-
if (!((
|
|
2027
|
+
if (!((_a = node.grid) === null || _a === void 0 ? void 0 : _a.el)) {
|
|
2033
2028
|
// this scales the helper down
|
|
2034
2029
|
helper.style.transform = "scale(".concat(1 / _this.dragTransform.xScale, ",").concat(1 / _this.dragTransform.yScale, ")");
|
|
2035
2030
|
// this makes it so that the helper is well positioned relative to the mouse after scaling
|
|
@@ -2038,10 +2033,10 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2038
2033
|
helper.style.top = helperRect.y + (_this.dragTransform.yScale - 1) * (event.clientY - helperRect.y) / _this.dragTransform.yScale + 'px';
|
|
2039
2034
|
helper.style.transformOrigin = "0px 0px";
|
|
2040
2035
|
}
|
|
2041
|
-
var
|
|
2042
|
-
var
|
|
2043
|
-
left -=
|
|
2044
|
-
top -=
|
|
2036
|
+
var _b = helper.getBoundingClientRect(), top = _b.top, left = _b.left;
|
|
2037
|
+
var rect = _this.el.getBoundingClientRect();
|
|
2038
|
+
left -= rect.left;
|
|
2039
|
+
top -= rect.top;
|
|
2045
2040
|
var ui = {
|
|
2046
2041
|
position: {
|
|
2047
2042
|
top: top * _this.dragTransform.xScale,
|
|
@@ -2104,7 +2099,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2104
2099
|
*/
|
|
2105
2100
|
.on(this.el, 'dropover', function (event, el, helper) {
|
|
2106
2101
|
// console.log(`over ${this.el.gridstack.opts.id} ${count++}`); // TEST
|
|
2107
|
-
var node = el.gridstackNode;
|
|
2102
|
+
var node = (helper === null || helper === void 0 ? void 0 : helper.gridstackNode) || el.gridstackNode;
|
|
2108
2103
|
// ignore drop enter on ourself (unless we temporarily removed) which happens on a simple drag of our item
|
|
2109
2104
|
if ((node === null || node === void 0 ? void 0 : node.grid) === _this && !node._temporaryRemoved) {
|
|
2110
2105
|
// delete node._added; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear)
|
|
@@ -2116,19 +2111,31 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2116
2111
|
var otherGrid = node.grid;
|
|
2117
2112
|
otherGrid._leave(el, helper);
|
|
2118
2113
|
}
|
|
2114
|
+
helper = helper || el;
|
|
2119
2115
|
// cache cell dimensions (which don't change), position can animate if we removed an item in otherGrid that affects us...
|
|
2120
2116
|
cellWidth = _this.cellWidth();
|
|
2121
2117
|
cellHeight = _this.getCellHeight(true);
|
|
2122
|
-
// load any element attributes if we don't have a node
|
|
2118
|
+
// sidebar items: load any element attributes if we don't have a node
|
|
2123
2119
|
if (!node) {
|
|
2124
|
-
|
|
2120
|
+
if (helper.hasAttribute('gridstacknode')) {
|
|
2121
|
+
try {
|
|
2122
|
+
node = JSON.parse(helper.getAttribute('gridstacknode'));
|
|
2123
|
+
}
|
|
2124
|
+
catch (error) {
|
|
2125
|
+
console.error("Gridstack dropover: Bad JSON format: ", helper.getAttribute('gridstacknode'));
|
|
2126
|
+
}
|
|
2127
|
+
helper.removeAttribute('gridstacknode');
|
|
2128
|
+
}
|
|
2129
|
+
if (!node)
|
|
2130
|
+
node = _this._readAttr(helper); // used to pass false for #2354, but now we clone top level node
|
|
2125
2131
|
}
|
|
2126
|
-
if (!node.grid) {
|
|
2132
|
+
if (!node.grid) { // sidebar item
|
|
2133
|
+
if (!node.el)
|
|
2134
|
+
node = __assign({}, node); // clone first time we're coming from sidebar (since 'clone' doesn't copy vars)
|
|
2127
2135
|
node._isExternal = true;
|
|
2128
|
-
|
|
2136
|
+
helper.gridstackNode = node;
|
|
2129
2137
|
}
|
|
2130
2138
|
// calculate the grid size based on element outer size
|
|
2131
|
-
helper = helper || el;
|
|
2132
2139
|
var w = node.w || Math.round(helper.offsetWidth / cellWidth) || 1;
|
|
2133
2140
|
var h = node.h || Math.round(helper.offsetHeight / cellHeight) || 1;
|
|
2134
2141
|
// if the item came from another grid, make a copy and save the original info in case we go back there
|
|
@@ -2164,7 +2171,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2164
2171
|
*/
|
|
2165
2172
|
.on(this.el, 'dropout', function (event, el, helper) {
|
|
2166
2173
|
// console.log(`out ${this.el.gridstack.opts.id} ${count++}`); // TEST
|
|
2167
|
-
var node = el.gridstackNode;
|
|
2174
|
+
var node = (helper === null || helper === void 0 ? void 0 : helper.gridstackNode) || el.gridstackNode;
|
|
2168
2175
|
if (!node)
|
|
2169
2176
|
return false;
|
|
2170
2177
|
// fix #1578 when dragging fast, we might get leave after other grid gets enter (which calls us to clean)
|
|
@@ -2183,11 +2190,12 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2183
2190
|
*/
|
|
2184
2191
|
.on(this.el, 'drop', function (event, el, helper) {
|
|
2185
2192
|
var _a, _b, _c;
|
|
2186
|
-
var node = el.gridstackNode;
|
|
2193
|
+
var node = (helper === null || helper === void 0 ? void 0 : helper.gridstackNode) || el.gridstackNode;
|
|
2187
2194
|
// ignore drop on ourself from ourself that didn't come from the outside - dragend will handle the simple move instead
|
|
2188
2195
|
if ((node === null || node === void 0 ? void 0 : node.grid) === _this && !node._isExternal)
|
|
2189
2196
|
return false;
|
|
2190
2197
|
var wasAdded = !!_this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419
|
|
2198
|
+
var wasSidebar = el !== helper;
|
|
2191
2199
|
_this.placeholder.remove();
|
|
2192
2200
|
// disable animation when replacing a placeholder (already positioned) with actual content
|
|
2193
2201
|
var noAnim = wasAdded && _this.opts.animate;
|
|
@@ -2203,7 +2211,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2203
2211
|
oGrid.engine.removedNodes.push(origNode);
|
|
2204
2212
|
oGrid._triggerRemoveEvent()._triggerChangeEvent();
|
|
2205
2213
|
// if it's an empty sub-grid that got auto-created, nuke it
|
|
2206
|
-
if (oGrid.
|
|
2214
|
+
if (oGrid.parentGridNode && !oGrid.engine.nodes.length && oGrid.opts.subGridDynamic) {
|
|
2207
2215
|
oGrid.removeAsSubGrid();
|
|
2208
2216
|
}
|
|
2209
2217
|
}
|
|
@@ -2216,37 +2224,39 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2216
2224
|
}
|
|
2217
2225
|
(_a = node.grid) === null || _a === void 0 ? true : delete _a._isTemp;
|
|
2218
2226
|
dd.off(el, 'drag');
|
|
2219
|
-
// if we made a copy
|
|
2220
|
-
// as the helper will be nuked by jquery-ui otherwise. TODO: update old code path
|
|
2227
|
+
// if we made a copy insert that instead of the original (sidebar item)
|
|
2221
2228
|
if (helper !== el) {
|
|
2222
2229
|
helper.remove();
|
|
2223
|
-
el
|
|
2224
|
-
if (wasAdded) {
|
|
2225
|
-
el = el.cloneNode(true);
|
|
2226
|
-
}
|
|
2230
|
+
el = helper;
|
|
2227
2231
|
}
|
|
2228
2232
|
else {
|
|
2229
2233
|
el.remove(); // reduce flicker as we change depth here, and size further down
|
|
2230
|
-
_this._removeDD(el);
|
|
2231
2234
|
}
|
|
2235
|
+
_this._removeDD(el);
|
|
2232
2236
|
if (!wasAdded)
|
|
2233
2237
|
return false;
|
|
2234
|
-
el.gridstackNode = node;
|
|
2235
|
-
node.el = el;
|
|
2236
2238
|
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
|
|
2237
|
-
// @ts-ignore
|
|
2238
2239
|
utils_1.Utils.copyPos(node, _this._readAttr(_this.placeholder)); // placeholder values as moving VERY fast can throw things off #1578
|
|
2239
|
-
utils_1.Utils.removePositioningStyles(el);
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2240
|
+
utils_1.Utils.removePositioningStyles(el);
|
|
2241
|
+
// give the user a chance to alter the widget that will get inserted if new sidebar item
|
|
2242
|
+
if (wasSidebar && (node.content || node.subGridOpts || GridStack.addRemoveCB)) {
|
|
2243
|
+
delete node.el;
|
|
2244
|
+
el = _this.addWidget(node);
|
|
2245
|
+
}
|
|
2246
|
+
else {
|
|
2247
|
+
_this._prepareElement(el, true, node);
|
|
2248
|
+
_this.el.appendChild(el);
|
|
2249
|
+
// resizeToContent is skipped in _prepareElement() until node is visible (clientHeight=0) so call it now
|
|
2250
|
+
_this.resizeToContentCheck(false, node);
|
|
2251
|
+
if (subGrid) {
|
|
2252
|
+
subGrid.parentGridNode = node;
|
|
2253
|
+
if (!subGrid.opts.styleInHead)
|
|
2254
|
+
subGrid._updateStyles(true); // re-create sub-grid styles now that we've moved
|
|
2255
|
+
}
|
|
2256
|
+
_this._updateContainerHeight();
|
|
2257
|
+
}
|
|
2258
|
+
_this.engine.addedNodes.push(node);
|
|
2259
|
+
_this._triggerAddEvent();
|
|
2250
2260
|
_this._triggerChangeEvent();
|
|
2251
2261
|
_this.engine.endUpdate();
|
|
2252
2262
|
if (_this._gsEventHandler['dropped']) {
|
|
@@ -2261,6 +2271,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2261
2271
|
};
|
|
2262
2272
|
/** @internal mark item for removal */
|
|
2263
2273
|
GridStack._itemRemoving = function (el, remove) {
|
|
2274
|
+
if (!el)
|
|
2275
|
+
return;
|
|
2264
2276
|
var node = el ? el.gridstackNode : undefined;
|
|
2265
2277
|
if (!(node === null || node === void 0 ? void 0 : node.grid) || el.classList.contains(node.grid.opts.removableOptions.decline))
|
|
2266
2278
|
return;
|
|
@@ -2523,12 +2535,12 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2523
2535
|
* our item to start with else restore prev node values from prev grid it came from.
|
|
2524
2536
|
*/
|
|
2525
2537
|
GridStack.prototype._leave = function (el, helper) {
|
|
2526
|
-
|
|
2538
|
+
helper = helper || el;
|
|
2539
|
+
var node = helper.gridstackNode;
|
|
2527
2540
|
if (!node)
|
|
2528
2541
|
return;
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
helper.style.transform = 'scale(1)';
|
|
2542
|
+
// remove the scale of the helper on leave
|
|
2543
|
+
helper.style.transform = helper.style.transformOrigin = null;
|
|
2532
2544
|
dd.off(el, 'drag'); // no need to track while being outside
|
|
2533
2545
|
// this gets called when cursor leaves and shape is outside, so only do this once
|
|
2534
2546
|
if (node._temporaryRemoved)
|
|
@@ -2536,6 +2548,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2536
2548
|
node._temporaryRemoved = true;
|
|
2537
2549
|
this.engine.removeNode(node); // remove placeholder as well, otherwise it's a sign node is not in our list, which is a bigger issue
|
|
2538
2550
|
node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged
|
|
2551
|
+
if (node._isExternal)
|
|
2552
|
+
this.engine.cleanupNode(node);
|
|
2539
2553
|
if (this.opts.removable === true) { // boolean vs a class string
|
|
2540
2554
|
// item leaving us and we are supposed to remove on leave (no need to drag onto trash) mark it so
|
|
2541
2555
|
GridStack._itemRemoving(el, true);
|
|
@@ -2547,22 +2561,25 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2547
2561
|
delete el._gridstackNodeOrig;
|
|
2548
2562
|
}
|
|
2549
2563
|
else if (node._isExternal) {
|
|
2550
|
-
// item came from outside
|
|
2551
|
-
delete node.el;
|
|
2552
|
-
delete el.gridstackNode;
|
|
2553
|
-
// and restore all nodes back to original
|
|
2564
|
+
// item came from outside restore all nodes back to original
|
|
2554
2565
|
this.engine.restoreInitial();
|
|
2555
2566
|
}
|
|
2556
2567
|
};
|
|
2557
2568
|
// legacy method removed
|
|
2558
2569
|
GridStack.prototype.commit = function () { (0, utils_1.obsolete)(this, this.batchUpdate(false), 'commit', 'batchUpdate', '5.2'); return this; };
|
|
2570
|
+
/**
|
|
2571
|
+
* callback to create the content of widgets so the app can control how to store and restore it
|
|
2572
|
+
* By default this lib will do 'el.textContent = w.content' forcing text only support for avoiding potential XSS issues.
|
|
2573
|
+
*/
|
|
2574
|
+
GridStack.renderCB = function (el, w) { if (el && (w === null || w === void 0 ? void 0 : w.content))
|
|
2575
|
+
el.textContent = w.content; };
|
|
2559
2576
|
/** parent class for sizing content. defaults to '.grid-stack-item-content' */
|
|
2560
2577
|
GridStack.resizeToContentParent = '.grid-stack-item-content';
|
|
2561
2578
|
/** scoping so users can call GridStack.Utils.sort() for example */
|
|
2562
2579
|
GridStack.Utils = utils_1.Utils;
|
|
2563
2580
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2564
2581
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
2565
|
-
GridStack.GDRev = '
|
|
2582
|
+
GridStack.GDRev = '11.0.0';
|
|
2566
2583
|
return GridStack;
|
|
2567
2584
|
}());
|
|
2568
2585
|
//# sourceMappingURL=gridstack.js.map
|