gridstack 10.1.2 → 10.2.1
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/angular/angular.json +3 -0
- package/angular/package.json +1 -1
- package/dist/angular/esm2020/gridstack-angular.mjs +4 -4
- package/dist/angular/esm2020/lib/base-widget.mjs +30 -30
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +52 -52
- package/dist/angular/esm2020/lib/gridstack.component.mjs +266 -264
- package/dist/angular/esm2020/lib/gridstack.module.mjs +39 -39
- package/dist/angular/esm2020/public-api.mjs +7 -7
- package/dist/angular/fesm2015/gridstack-angular.mjs +368 -366
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +363 -361
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
- package/dist/angular/index.d.ts +5 -5
- package/dist/angular/lib/base-widget.d.ts +16 -16
- package/dist/angular/lib/gridstack-item.component.d.ts +37 -37
- package/dist/angular/lib/gridstack.component.d.ts +129 -129
- package/dist/angular/lib/gridstack.module.d.ts +10 -10
- package/dist/angular/public-api.d.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 +4 -4
- package/dist/dd-draggable.js +63 -19
- 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 +2 -2
- 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 +4 -3
- package/dist/dd-resizable-handle.js +12 -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 +4 -4
- package/dist/es5/dd-draggable.js +78 -21
- 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 +2 -2
- 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 +4 -3
- package/dist/es5/dd-resizable-handle.js +13 -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 +1 -1
- package/dist/es5/gridstack-engine.js +1 -1
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +9 -3
- package/dist/es5/gridstack.js +61 -28
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +8 -8
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +6 -1
- package/dist/es5/utils.js +26 -10
- 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 +1 -1
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +9 -3
- package/dist/gridstack.js +56 -26
- package/dist/gridstack.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +25 -10
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +15 -0
- package/doc/README.md +7 -1
- package/package.json +3 -2
- package/angular/.vscode/extensions.json +0 -4
- package/angular/.vscode/launch.json +0 -20
- package/angular/.vscode/tasks.json +0 -42
- package/angular/projects/demo/.browserslistrc +0 -16
- package/angular/projects/demo/src/app/app.component.css +0 -11
- package/angular/projects/demo/src/app/app.component.html +0 -110
- package/angular/projects/demo/src/app/app.component.spec.ts +0 -25
- package/angular/projects/demo/src/app/app.component.ts +0 -223
- package/angular/projects/demo/src/app/app.module.ts +0 -39
- package/angular/projects/demo/src/app/dummy.component.ts +0 -34
- package/angular/projects/demo/src/app/ngFor.ts +0 -131
- package/angular/projects/demo/src/app/ngFor_cmd.ts +0 -106
- package/angular/projects/demo/src/app/simple.ts +0 -46
- package/angular/projects/demo/src/assets/.gitkeep +0 -0
- package/angular/projects/demo/src/environments/environment.ts +0 -16
- package/angular/projects/demo/src/favicon.ico +0 -0
- package/angular/projects/demo/src/index.html +0 -13
- package/angular/projects/demo/src/main.ts +0 -12
- package/angular/projects/demo/src/polyfills.ts +0 -53
- package/angular/projects/demo/src/styles.css +0 -41
- package/angular/projects/demo/src/test.ts +0 -26
- package/angular/projects/demo/tsconfig.app.json +0 -15
- package/angular/projects/demo/tsconfig.spec.json +0 -18
- package/angular/projects/lib/src/lib/base-widget.ts +0 -28
- package/angular/projects/lib/src/lib/gridstack-item.component.ts +0 -78
- package/angular/projects/lib/src/lib/gridstack.component.ts +0 -287
- package/angular/projects/lib/src/lib/gridstack.module.ts +0 -32
- package/angular/projects/lib/src/public-api.ts +0 -8
- package/angular/projects/lib/src/test.ts +0 -27
- package/dist/angular/src/base-widget.ts +0 -28
- package/dist/angular/src/gridstack-item.component.ts +0 -78
- package/dist/angular/src/gridstack.component.ts +0 -287
- package/dist/angular/src/gridstack.module.ts +0 -32
- package/dist/src/gridstack-extra.scss +0 -25
- package/dist/src/gridstack.scss +0 -157
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 10.1
|
|
39
|
+
* GridStack 10.2.1
|
|
40
40
|
* https://gridstackjs.com/
|
|
41
41
|
*
|
|
42
42
|
* Copyright (c) 2021-2022 Alain Dumesny
|
|
@@ -231,7 +231,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
231
231
|
this.load(children); // don't load empty
|
|
232
232
|
}
|
|
233
233
|
// if (this.engine.nodes.length) this._updateStyles(); // update based on # of children. done in engine onChange CB
|
|
234
|
-
this.setAnimation(
|
|
234
|
+
this.setAnimation();
|
|
235
235
|
// dynamic grids require pausing during drag to detect over to nest vs push
|
|
236
236
|
if (opts.subGridDynamic && !dd_manager_1.DDManager.pauseDrag)
|
|
237
237
|
dd_manager_1.DDManager.pauseDrag = true;
|
|
@@ -638,6 +638,8 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
638
638
|
if (addRemove === void 0) { addRemove = GridStack.addRemoveCB || true; }
|
|
639
639
|
items = utils_1.Utils.cloneDeep(items); // so we can mod
|
|
640
640
|
var column = this.getColumn();
|
|
641
|
+
// make sure size 1x1 (default) is present as it may need to override current sizes
|
|
642
|
+
items.forEach(function (n) { n.w = n.w || 1; n.h = n.h || 1; });
|
|
641
643
|
// if we have a mix of new items without coordinates and existing items, separate them out so they can be added after #2639
|
|
642
644
|
var addAfter = items.filter(function (n) { return (n.x === undefined || n.y === undefined) && !utils_1.Utils.find(_this.engine.nodes, n.id); });
|
|
643
645
|
if (addAfter.length && addAfter.length !== items.length) {
|
|
@@ -733,10 +735,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
733
735
|
delete this._ignoreLayoutsNodeChange;
|
|
734
736
|
delete this._insertNotAppend;
|
|
735
737
|
prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB;
|
|
736
|
-
// delay adding animation back
|
|
738
|
+
// delay adding animation back
|
|
737
739
|
if (noAnim && ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.animate))
|
|
738
|
-
|
|
739
|
-
_this.setAnimation(_this.opts.animate); });
|
|
740
|
+
this.setAnimation(this.opts.animate, true);
|
|
740
741
|
return this;
|
|
741
742
|
};
|
|
742
743
|
/**
|
|
@@ -1169,9 +1170,17 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1169
1170
|
/**
|
|
1170
1171
|
* Toggle the grid animation state. Toggles the `grid-stack-animate` class.
|
|
1171
1172
|
* @param doAnimate if true the grid will animate.
|
|
1173
|
+
* @param delay if true setting will be set on next event loop.
|
|
1172
1174
|
*/
|
|
1173
|
-
GridStack.prototype.setAnimation = function (doAnimate) {
|
|
1174
|
-
|
|
1175
|
+
GridStack.prototype.setAnimation = function (doAnimate, delay) {
|
|
1176
|
+
var _this = this;
|
|
1177
|
+
if (doAnimate === void 0) { doAnimate = this.opts.animate; }
|
|
1178
|
+
if (delay) {
|
|
1179
|
+
// delay, but check to make sure grid (opt) is still around
|
|
1180
|
+
setTimeout(function () { if (_this.opts)
|
|
1181
|
+
_this.setAnimation(doAnimate); });
|
|
1182
|
+
}
|
|
1183
|
+
else if (doAnimate) {
|
|
1175
1184
|
this.el.classList.add('grid-stack-animate');
|
|
1176
1185
|
}
|
|
1177
1186
|
else {
|
|
@@ -1275,6 +1284,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1275
1284
|
var widthChanged = (m.w !== undefined && m.w !== n.w);
|
|
1276
1285
|
_this.moveNode(n, m);
|
|
1277
1286
|
_this.resizeToContentCheck(widthChanged, n); // wait for animation if we changed width
|
|
1287
|
+
delete n._orig; // clear out original position now that we moved #2669
|
|
1278
1288
|
}
|
|
1279
1289
|
if (m || changed) {
|
|
1280
1290
|
_this._writeAttr(el, n);
|
|
@@ -1286,12 +1296,15 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1286
1296
|
return this;
|
|
1287
1297
|
};
|
|
1288
1298
|
GridStack.prototype.moveNode = function (n, m) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
.
|
|
1299
|
+
var wasUpdating = n._updating;
|
|
1300
|
+
if (!wasUpdating)
|
|
1301
|
+
this.engine.cleanNodes().beginUpdate(n);
|
|
1302
|
+
this.engine.moveNode(n, m);
|
|
1292
1303
|
this._updateContainerHeight();
|
|
1293
|
-
|
|
1294
|
-
|
|
1304
|
+
if (!wasUpdating) {
|
|
1305
|
+
this._triggerChangeEvent();
|
|
1306
|
+
this.engine.endUpdate();
|
|
1307
|
+
}
|
|
1295
1308
|
};
|
|
1296
1309
|
/**
|
|
1297
1310
|
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
|
|
@@ -1365,6 +1378,28 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
1365
1378
|
else
|
|
1366
1379
|
this.resizeToContent(el);
|
|
1367
1380
|
};
|
|
1381
|
+
/** rotate (by swapping w & h) the passed in node - called when user press 'r' during dragging
|
|
1382
|
+
* @param els widget or selector of objects to modify
|
|
1383
|
+
* @param relative optional pixel coord relative to upper/left corner to rotate around (will keep that cell under cursor)
|
|
1384
|
+
*/
|
|
1385
|
+
GridStack.prototype.rotate = function (els, relative) {
|
|
1386
|
+
var _this = this;
|
|
1387
|
+
GridStack.getElements(els).forEach(function (el) {
|
|
1388
|
+
var n = el.gridstackNode;
|
|
1389
|
+
if (!utils_1.Utils.canBeRotated(n))
|
|
1390
|
+
return;
|
|
1391
|
+
var rot = { w: n.h, h: n.w, minH: n.minW, minW: n.minH, maxH: n.maxW, maxW: n.maxH };
|
|
1392
|
+
// if given an offset, adjust x/y by column/row bounds when user presses 'r' during dragging
|
|
1393
|
+
if (relative) {
|
|
1394
|
+
var pivotX = relative.left > 0 ? Math.floor(relative.left / _this.cellWidth()) : 0;
|
|
1395
|
+
var pivotY = relative.top > 0 ? Math.floor(relative.top / _this.opts.cellHeight) : 0;
|
|
1396
|
+
rot.x = n.x + pivotX - (n.h - (pivotY + 1));
|
|
1397
|
+
rot.y = (n.y + pivotY) - pivotX;
|
|
1398
|
+
}
|
|
1399
|
+
_this.update(el, rot);
|
|
1400
|
+
});
|
|
1401
|
+
return this;
|
|
1402
|
+
};
|
|
1368
1403
|
/**
|
|
1369
1404
|
* Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options (CSS string format of 1,2,4 values or single number).
|
|
1370
1405
|
* @param value margin value
|
|
@@ -2153,7 +2188,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2153
2188
|
* end - releasing the mouse
|
|
2154
2189
|
*/
|
|
2155
2190
|
.on(this.el, 'drop', function (event, el, helper) {
|
|
2156
|
-
var _a, _b;
|
|
2191
|
+
var _a, _b, _c;
|
|
2157
2192
|
var node = el.gridstackNode;
|
|
2158
2193
|
// ignore drop on ourself from ourself that didn't come from the outside - dragend will handle the simple move instead
|
|
2159
2194
|
if ((node === null || node === void 0 ? void 0 : node.grid) === _this && !node._isExternal)
|
|
@@ -2185,7 +2220,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2185
2220
|
_this.engine.cleanupNode(node); // removes all internal _xyz values
|
|
2186
2221
|
node.grid = _this;
|
|
2187
2222
|
}
|
|
2188
|
-
|
|
2223
|
+
(_a = node.grid) === null || _a === void 0 ? true : delete _a._isTemp;
|
|
2189
2224
|
dd.off(el, 'drag');
|
|
2190
2225
|
// if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)
|
|
2191
2226
|
// as the helper will be nuked by jquery-ui otherwise. TODO: update old code path
|
|
@@ -2204,7 +2239,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2204
2239
|
return false;
|
|
2205
2240
|
el.gridstackNode = node;
|
|
2206
2241
|
node.el = el;
|
|
2207
|
-
var subGrid = (
|
|
2242
|
+
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
|
|
2208
2243
|
// @ts-ignore
|
|
2209
2244
|
utils_1.Utils.copyPos(node, _this._readAttr(_this.placeholder)); // placeholder values as moving VERY fast can throw things off #1578
|
|
2210
2245
|
utils_1.Utils.removePositioningStyles(el); // @ts-ignore
|
|
@@ -2223,10 +2258,9 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2223
2258
|
if (_this._gsEventHandler['dropped']) {
|
|
2224
2259
|
_this._gsEventHandler['dropped'](__assign(__assign({}, event), { type: 'dropped' }), origNode && origNode.grid ? origNode : undefined, node);
|
|
2225
2260
|
}
|
|
2226
|
-
// delay adding animation back
|
|
2261
|
+
// delay adding animation back
|
|
2227
2262
|
if (noAnim)
|
|
2228
|
-
|
|
2229
|
-
_this.setAnimation(_this.opts.animate); });
|
|
2263
|
+
_this.setAnimation(_this.opts.animate, true);
|
|
2230
2264
|
return false; // prevent parent from receiving msg (which may be grid as well)
|
|
2231
2265
|
});
|
|
2232
2266
|
return this;
|
|
@@ -2360,6 +2394,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2360
2394
|
// @ts-ignore
|
|
2361
2395
|
this._writePosAttr(this.placeholder, node);
|
|
2362
2396
|
this.el.appendChild(this.placeholder);
|
|
2397
|
+
this.placeholder.gridstackNode = node;
|
|
2363
2398
|
// console.log('_onStartMoving placeholder') // TEST
|
|
2364
2399
|
// if the element is inside a grid, it has already been scaled
|
|
2365
2400
|
// we can use that as a scale reference
|
|
@@ -2391,17 +2426,15 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2391
2426
|
this.engine.addNode(node); // will add, fix collisions, update attr and clear _temporaryRemoved
|
|
2392
2427
|
node._moving = true; // AFTER, mark as moving object (wanted fix location before)
|
|
2393
2428
|
}
|
|
2394
|
-
// set the min/max resize info
|
|
2429
|
+
// set the min/max resize info taking into account the column count and position (so we don't resize outside the grid)
|
|
2395
2430
|
this.engine.cacheRects(cellWidth, cellHeight, this.opts.marginTop, this.opts.marginRight, this.opts.marginBottom, this.opts.marginLeft);
|
|
2396
2431
|
if (event.type === 'resizestart') {
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
dd.resizable(el, 'option', 'maxHeight', cellHeight * node.maxH);
|
|
2404
|
-
}
|
|
2432
|
+
var colLeft = this.getColumn() - node.x;
|
|
2433
|
+
var rowLeft = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - node.y;
|
|
2434
|
+
dd.resizable(el, 'option', 'minWidth', cellWidth * Math.min(node.minW || 1, colLeft))
|
|
2435
|
+
.resizable(el, 'option', 'minHeight', cellHeight * Math.min(node.minH || 1, rowLeft))
|
|
2436
|
+
.resizable(el, 'option', 'maxWidth', cellWidth * Math.min(node.maxW || Number.MAX_SAFE_INTEGER, colLeft))
|
|
2437
|
+
.resizable(el, 'option', 'maxHeight', cellHeight * Math.min(node.maxH || Number.MAX_SAFE_INTEGER, rowLeft));
|
|
2405
2438
|
}
|
|
2406
2439
|
};
|
|
2407
2440
|
/** @internal handles actual drag/resize */
|
|
@@ -2533,7 +2566,7 @@ var GridStack = exports.GridStack = /** @class */ (function () {
|
|
|
2533
2566
|
GridStack.Utils = utils_1.Utils;
|
|
2534
2567
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
2535
2568
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
2536
|
-
GridStack.GDRev = '10.1
|
|
2569
|
+
GridStack.GDRev = '10.2.1';
|
|
2537
2570
|
return GridStack;
|
|
2538
2571
|
}());
|
|
2539
2572
|
//# sourceMappingURL=gridstack.js.map
|