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/gridstack.css
CHANGED
package/dist/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/gridstack.js
CHANGED
|
@@ -12,10 +12,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.GridStack = void 0;
|
|
14
14
|
/*!
|
|
15
|
-
* GridStack 5.0
|
|
15
|
+
* GridStack 5.1.0
|
|
16
16
|
* https://gridstackjs.com/
|
|
17
17
|
*
|
|
18
|
-
* Copyright (c) 2021 Alain Dumesny
|
|
18
|
+
* Copyright (c) 2021-2022 Alain Dumesny
|
|
19
19
|
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
20
20
|
*/
|
|
21
21
|
const gridstack_engine_1 = require("./gridstack-engine");
|
|
@@ -41,7 +41,7 @@ const GridDefaults = {
|
|
|
41
41
|
cellHeightThrottle: 100,
|
|
42
42
|
margin: 10,
|
|
43
43
|
auto: true,
|
|
44
|
-
|
|
44
|
+
oneColumnSize: 768,
|
|
45
45
|
float: false,
|
|
46
46
|
staticGrid: false,
|
|
47
47
|
animate: true,
|
|
@@ -100,6 +100,13 @@ class GridStack {
|
|
|
100
100
|
if (opts.column === 'auto') {
|
|
101
101
|
delete opts.column;
|
|
102
102
|
}
|
|
103
|
+
// 'minWidth' legacy support in 5.1
|
|
104
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
105
|
+
let anyOpts = opts;
|
|
106
|
+
if (anyOpts.minWidth !== undefined) {
|
|
107
|
+
opts.oneColumnSize = opts.oneColumnSize || anyOpts.minWidth;
|
|
108
|
+
delete anyOpts.minWidth;
|
|
109
|
+
}
|
|
103
110
|
// elements attributes override any passed options (like CSS style) - merge the two together
|
|
104
111
|
let defaults = Object.assign(Object.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: {
|
|
105
112
|
autoHide: !(opts.alwaysShowResizeHandle || false),
|
|
@@ -116,9 +123,9 @@ class GridStack {
|
|
|
116
123
|
}
|
|
117
124
|
this.opts = utils_1.Utils.defaults(opts, defaults);
|
|
118
125
|
opts = null; // make sure we use this.opts instead
|
|
119
|
-
this.
|
|
126
|
+
this._initMargin(); // part of settings defaults...
|
|
120
127
|
// 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)
|
|
121
|
-
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.
|
|
128
|
+
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.oneColumnSize) {
|
|
122
129
|
this._prevColumn = this.getColumn();
|
|
123
130
|
this.opts.column = 1;
|
|
124
131
|
}
|
|
@@ -151,7 +158,8 @@ class GridStack {
|
|
|
151
158
|
}
|
|
152
159
|
this.el.classList.add(this.opts._styleSheetClass);
|
|
153
160
|
this._setStaticClass();
|
|
154
|
-
this.
|
|
161
|
+
let engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
|
|
162
|
+
this.engine = new engineClass({
|
|
155
163
|
column: this.getColumn(),
|
|
156
164
|
float: this.opts.float,
|
|
157
165
|
maxRow: this.opts.maxRow,
|
|
@@ -285,6 +293,13 @@ class GridStack {
|
|
|
285
293
|
}
|
|
286
294
|
return grid;
|
|
287
295
|
}
|
|
296
|
+
/** call this method to register your engine instead of the default one.
|
|
297
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
298
|
+
* replace just one instance.
|
|
299
|
+
*/
|
|
300
|
+
static registerEngine(engineClass) {
|
|
301
|
+
GridStack.engineClass = engineClass;
|
|
302
|
+
}
|
|
288
303
|
/** @internal create placeholder DIV as needed */
|
|
289
304
|
get placeholder() {
|
|
290
305
|
if (!this._placeholder) {
|
|
@@ -978,7 +993,7 @@ class GridStack {
|
|
|
978
993
|
// re-use existing margin handling
|
|
979
994
|
this.opts.margin = value;
|
|
980
995
|
this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;
|
|
981
|
-
this.
|
|
996
|
+
this._initMargin();
|
|
982
997
|
this._updateStyles(true); // true = force re-create
|
|
983
998
|
return this;
|
|
984
999
|
}
|
|
@@ -1262,7 +1277,7 @@ class GridStack {
|
|
|
1262
1277
|
}
|
|
1263
1278
|
else {
|
|
1264
1279
|
// else check for 1 column in/out behavior
|
|
1265
|
-
let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.
|
|
1280
|
+
let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize;
|
|
1266
1281
|
if ((this.opts.column === 1) !== oneColumn) {
|
|
1267
1282
|
changedColumn = true;
|
|
1268
1283
|
if (this.opts.animate) {
|
|
@@ -1318,7 +1333,7 @@ class GridStack {
|
|
|
1318
1333
|
/** @internal */
|
|
1319
1334
|
static getGridElements(els) { return utils_1.Utils.getElements(els); }
|
|
1320
1335
|
/** @internal initialize margin top/bottom/left/right and units */
|
|
1321
|
-
|
|
1336
|
+
_initMargin() {
|
|
1322
1337
|
let data;
|
|
1323
1338
|
let margin = 0;
|
|
1324
1339
|
// support passing multiple values like CSS (ex: '5px 10px 0 20px')
|