gridstack 5.0.0 → 5.1.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 +29 -15
- package/dist/es5/gridstack-dd.d.ts +1 -1
- package/dist/es5/gridstack-dd.js +1 -1
- package/dist/es5/gridstack-dd.js.map +1 -1
- package/dist/es5/gridstack-ddi.d.ts +1 -1
- package/dist/es5/gridstack-ddi.js +1 -1
- package/dist/es5/gridstack-ddi.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +11 -7
- package/dist/es5/gridstack-engine.js +30 -40
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-h5.d.ts +1 -1
- package/dist/es5/gridstack-h5.js +1 -1
- package/dist/es5/gridstack-h5.js.LICENSE.txt +2 -2
- package/dist/es5/gridstack-h5.js.map +1 -1
- package/dist/es5/gridstack-jq.d.ts +1 -1
- package/dist/es5/gridstack-jq.js +1 -1
- package/dist/es5/gridstack-jq.js.LICENSE.txt +8 -8
- package/dist/es5/gridstack-jq.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack-static.d.ts +1 -1
- package/dist/es5/gridstack-static.js +1 -1
- package/dist/es5/gridstack-static.js.LICENSE.txt +2 -2
- package/dist/es5/gridstack-static.js.map +1 -1
- package/dist/es5/gridstack.d.ts +10 -4
- package/dist/es5/gridstack.js +24 -9
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/h5/dd-base-impl.d.ts +2 -2
- package/dist/es5/h5/dd-base-impl.js +2 -2
- package/dist/es5/h5/dd-base-impl.js.map +1 -1
- package/dist/es5/h5/dd-draggable.d.ts +2 -2
- package/dist/es5/h5/dd-draggable.js +10 -13
- package/dist/es5/h5/dd-draggable.js.map +1 -1
- package/dist/es5/h5/dd-droppable.d.ts +3 -3
- package/dist/es5/h5/dd-droppable.js +2 -2
- package/dist/es5/h5/dd-droppable.js.map +1 -1
- package/dist/es5/h5/dd-element.d.ts +1 -1
- package/dist/es5/h5/dd-element.js +1 -1
- package/dist/es5/h5/dd-element.js.map +1 -1
- package/dist/es5/h5/dd-manager.d.ts +1 -1
- package/dist/es5/h5/dd-manager.js +1 -1
- package/dist/es5/h5/dd-manager.js.map +1 -1
- package/dist/es5/h5/dd-resizable-handle.d.ts +2 -2
- package/dist/es5/h5/dd-resizable-handle.js +2 -2
- package/dist/es5/h5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/h5/dd-resizable.d.ts +2 -2
- package/dist/es5/h5/dd-resizable.js +2 -2
- package/dist/es5/h5/dd-resizable.js.map +1 -1
- package/dist/es5/h5/dd-utils.d.ts +1 -1
- package/dist/es5/h5/dd-utils.js +1 -1
- package/dist/es5/h5/dd-utils.js.map +1 -1
- package/dist/es5/h5/gridstack-dd-native.d.ts +2 -2
- package/dist/es5/h5/gridstack-dd-native.js +2 -2
- package/dist/es5/h5/gridstack-dd-native.js.map +1 -1
- package/dist/es5/jq/gridstack-dd-jqueryui.js.map +1 -1
- package/dist/es5/types.d.ts +8 -5
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +2 -2
- package/dist/es5/utils.js +13 -13
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-dd.d.ts +1 -1
- package/dist/gridstack-dd.js +1 -1
- package/dist/gridstack-dd.js.map +1 -1
- package/dist/gridstack-ddi.d.ts +1 -1
- package/dist/gridstack-ddi.js +1 -1
- package/dist/gridstack-ddi.js.map +1 -1
- package/dist/gridstack-engine.d.ts +11 -7
- package/dist/gridstack-engine.js +30 -39
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack-h5.d.ts +1 -1
- package/dist/gridstack-h5.js +1 -1
- package/dist/gridstack-h5.js.LICENSE.txt +2 -2
- package/dist/gridstack-h5.js.map +1 -1
- package/dist/gridstack-jq.d.ts +1 -1
- package/dist/gridstack-jq.js +1 -1
- package/dist/gridstack-jq.js.LICENSE.txt +8 -8
- package/dist/gridstack-jq.js.map +1 -1
- package/dist/gridstack-static.d.ts +1 -1
- package/dist/gridstack-static.js +1 -1
- package/dist/gridstack-static.js.LICENSE.txt +2 -2
- package/dist/gridstack-static.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +10 -4
- package/dist/gridstack.js +24 -9
- package/dist/gridstack.js.map +1 -1
- package/dist/h5/dd-base-impl.d.ts +2 -2
- package/dist/h5/dd-base-impl.js +2 -2
- package/dist/h5/dd-base-impl.js.map +1 -1
- package/dist/h5/dd-draggable.d.ts +2 -2
- package/dist/h5/dd-draggable.js +10 -13
- package/dist/h5/dd-draggable.js.map +1 -1
- package/dist/h5/dd-droppable.d.ts +3 -3
- package/dist/h5/dd-droppable.js +2 -2
- package/dist/h5/dd-droppable.js.map +1 -1
- package/dist/h5/dd-element.d.ts +1 -1
- package/dist/h5/dd-element.js +1 -1
- package/dist/h5/dd-element.js.map +1 -1
- package/dist/h5/dd-manager.d.ts +1 -1
- package/dist/h5/dd-manager.js +1 -1
- package/dist/h5/dd-manager.js.map +1 -1
- package/dist/h5/dd-resizable-handle.d.ts +2 -2
- package/dist/h5/dd-resizable-handle.js +2 -2
- package/dist/h5/dd-resizable-handle.js.map +1 -1
- package/dist/h5/dd-resizable.d.ts +2 -2
- package/dist/h5/dd-resizable.js +2 -2
- package/dist/h5/dd-resizable.js.map +1 -1
- package/dist/h5/dd-utils.d.ts +1 -1
- package/dist/h5/dd-utils.js +1 -1
- package/dist/h5/dd-utils.js.map +1 -1
- package/dist/h5/gridstack-dd-native.d.ts +2 -2
- package/dist/h5/gridstack-dd-native.js +2 -2
- package/dist/h5/gridstack-dd-native.js.map +1 -1
- package/dist/jq/gridstack-dd-jqueryui.js.map +1 -1
- package/dist/jq/jquery-ui.js +1 -1
- package/dist/jq/jquery-ui.js.map +1 -1
- package/dist/src/gridstack.scss +1 -1
- package/dist/types.d.ts +8 -5
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +12 -12
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +11 -2
- package/doc/README.md +10 -4
- package/package.json +4 -4
package/dist/es5/gridstack.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GridStack 5.0
|
|
2
|
+
* GridStack 5.1.0
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c) 2021 Alain Dumesny
|
|
5
|
+
* Copyright (c) 2021-2022 Alain Dumesny
|
|
6
6
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
7
7
|
*/
|
|
8
8
|
import { GridStackEngine } from './gridstack-engine';
|
|
@@ -70,6 +70,11 @@ export declare class GridStack {
|
|
|
70
70
|
* @param opt grids options used to initialize the grid, and list of children
|
|
71
71
|
*/
|
|
72
72
|
static addGrid(parent: HTMLElement, opt?: GridStackOptions): GridStack;
|
|
73
|
+
/** call this method to register your engine instead of the default one.
|
|
74
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
75
|
+
* replace just one instance.
|
|
76
|
+
*/
|
|
77
|
+
static registerEngine(engineClass: typeof GridStackEngine): void;
|
|
73
78
|
/** scoping so users can call GridStack.Utils.sort() for example */
|
|
74
79
|
static Utils: typeof Utils;
|
|
75
80
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
@@ -80,6 +85,7 @@ export declare class GridStack {
|
|
|
80
85
|
engine: GridStackEngine;
|
|
81
86
|
/** grid options - public for classes to access, but use methods to modify! */
|
|
82
87
|
opts: GridStackOptions;
|
|
88
|
+
protected static engineClass: typeof GridStackEngine;
|
|
83
89
|
/**
|
|
84
90
|
* Construct a grid item from the given element and options
|
|
85
91
|
* @param el
|
|
@@ -149,7 +155,7 @@ export declare class GridStack {
|
|
|
149
155
|
/** Gets current cell width. */
|
|
150
156
|
cellWidth(): number;
|
|
151
157
|
/** return our expected width (or parent) for 1 column check */
|
|
152
|
-
|
|
158
|
+
protected _widthOrContainer(): number;
|
|
153
159
|
/**
|
|
154
160
|
* Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
|
|
155
161
|
*/
|
|
@@ -294,7 +300,7 @@ export declare class GridStack {
|
|
|
294
300
|
*/
|
|
295
301
|
onParentResize(): GridStack;
|
|
296
302
|
/** add or remove the window size event handler */
|
|
297
|
-
|
|
303
|
+
protected _updateWindowResizeEvent(forceRemove?: boolean): GridStack;
|
|
298
304
|
/**
|
|
299
305
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
300
306
|
* Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar
|
package/dist/es5/gridstack.js
CHANGED
|
@@ -30,10 +30,10 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.GridStack = void 0;
|
|
32
32
|
/*!
|
|
33
|
-
* GridStack 5.0
|
|
33
|
+
* GridStack 5.1.0
|
|
34
34
|
* https://gridstackjs.com/
|
|
35
35
|
*
|
|
36
|
-
* Copyright (c) 2021 Alain Dumesny
|
|
36
|
+
* Copyright (c) 2021-2022 Alain Dumesny
|
|
37
37
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
38
38
|
*/
|
|
39
39
|
var gridstack_engine_1 = require("./gridstack-engine");
|
|
@@ -59,7 +59,7 @@ var GridDefaults = {
|
|
|
59
59
|
cellHeightThrottle: 100,
|
|
60
60
|
margin: 10,
|
|
61
61
|
auto: true,
|
|
62
|
-
|
|
62
|
+
oneColumnSize: 768,
|
|
63
63
|
float: false,
|
|
64
64
|
staticGrid: false,
|
|
65
65
|
animate: true,
|
|
@@ -120,6 +120,13 @@ var GridStack = /** @class */ (function () {
|
|
|
120
120
|
if (opts.column === 'auto') {
|
|
121
121
|
delete opts.column;
|
|
122
122
|
}
|
|
123
|
+
// 'minWidth' legacy support in 5.1
|
|
124
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
125
|
+
var anyOpts = opts;
|
|
126
|
+
if (anyOpts.minWidth !== undefined) {
|
|
127
|
+
opts.oneColumnSize = opts.oneColumnSize || anyOpts.minWidth;
|
|
128
|
+
delete anyOpts.minWidth;
|
|
129
|
+
}
|
|
123
130
|
// elements attributes override any passed options (like CSS style) - merge the two together
|
|
124
131
|
var defaults = __assign(__assign({}, utils_1.Utils.cloneDeep(GridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || 12, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || 0, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || 0, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || false, _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false, resizable: {
|
|
125
132
|
autoHide: !(opts.alwaysShowResizeHandle || false),
|
|
@@ -136,9 +143,9 @@ var GridStack = /** @class */ (function () {
|
|
|
136
143
|
}
|
|
137
144
|
this.opts = utils_1.Utils.defaults(opts, defaults);
|
|
138
145
|
opts = null; // make sure we use this.opts instead
|
|
139
|
-
this.
|
|
146
|
+
this._initMargin(); // part of settings defaults...
|
|
140
147
|
// Now check if we're loading into 1 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)
|
|
141
|
-
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.
|
|
148
|
+
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.oneColumnSize) {
|
|
142
149
|
this._prevColumn = this.getColumn();
|
|
143
150
|
this.opts.column = 1;
|
|
144
151
|
}
|
|
@@ -171,7 +178,8 @@ var GridStack = /** @class */ (function () {
|
|
|
171
178
|
}
|
|
172
179
|
this.el.classList.add(this.opts._styleSheetClass);
|
|
173
180
|
this._setStaticClass();
|
|
174
|
-
this.
|
|
181
|
+
var engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
|
|
182
|
+
this.engine = new engineClass({
|
|
175
183
|
column: this.getColumn(),
|
|
176
184
|
float: this.opts.float,
|
|
177
185
|
maxRow: this.opts.maxRow,
|
|
@@ -310,6 +318,13 @@ var GridStack = /** @class */ (function () {
|
|
|
310
318
|
}
|
|
311
319
|
return grid;
|
|
312
320
|
};
|
|
321
|
+
/** call this method to register your engine instead of the default one.
|
|
322
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
323
|
+
* replace just one instance.
|
|
324
|
+
*/
|
|
325
|
+
GridStack.registerEngine = function (engineClass) {
|
|
326
|
+
GridStack.engineClass = engineClass;
|
|
327
|
+
};
|
|
313
328
|
Object.defineProperty(GridStack.prototype, "placeholder", {
|
|
314
329
|
/** @internal create placeholder DIV as needed */
|
|
315
330
|
get: function () {
|
|
@@ -1026,7 +1041,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1026
1041
|
// re-use existing margin handling
|
|
1027
1042
|
this.opts.margin = value;
|
|
1028
1043
|
this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;
|
|
1029
|
-
this.
|
|
1044
|
+
this._initMargin();
|
|
1030
1045
|
this._updateStyles(true); // true = force re-create
|
|
1031
1046
|
return this;
|
|
1032
1047
|
};
|
|
@@ -1314,7 +1329,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1314
1329
|
}
|
|
1315
1330
|
else {
|
|
1316
1331
|
// else check for 1 column in/out behavior
|
|
1317
|
-
var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.
|
|
1332
|
+
var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize;
|
|
1318
1333
|
if ((this.opts.column === 1) !== oneColumn) {
|
|
1319
1334
|
changedColumn = true;
|
|
1320
1335
|
if (this.opts.animate) {
|
|
@@ -1377,7 +1392,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1377
1392
|
/** @internal */
|
|
1378
1393
|
GridStack.getGridElements = function (els) { return utils_1.Utils.getElements(els); };
|
|
1379
1394
|
/** @internal initialize margin top/bottom/left/right and units */
|
|
1380
|
-
GridStack.prototype.
|
|
1395
|
+
GridStack.prototype._initMargin = function () {
|
|
1381
1396
|
var data;
|
|
1382
1397
|
var margin = 0;
|
|
1383
1398
|
// support passing multiple values like CSS (ex: '5px 10px 0 20px')
|