gridstack 5.0.0 → 6.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 +78 -53
- package/dist/{h5/dd-base-impl.d.ts → dd-base-impl.d.ts} +2 -2
- package/dist/{h5/dd-base-impl.js → dd-base-impl.js} +2 -4
- package/dist/dd-base-impl.js.map +1 -0
- package/dist/{es5/h5/dd-draggable.d.ts → dd-draggable.d.ts} +7 -8
- package/dist/dd-draggable.js +313 -0
- package/dist/dd-draggable.js.map +1 -0
- package/dist/{es5/h5/dd-droppable.d.ts → dd-droppable.d.ts} +4 -3
- package/dist/dd-droppable.js +149 -0
- package/dist/dd-droppable.js.map +1 -0
- package/dist/{es5/h5/dd-element.d.ts → dd-element.d.ts} +2 -2
- package/dist/{h5/dd-element.js → dd-element.js} +1 -1
- package/dist/dd-element.js.map +1 -0
- package/dist/dd-gridstack.d.ts +36 -0
- package/dist/{gridstack-dd.js → dd-gridstack.js} +154 -52
- package/dist/dd-gridstack.js.map +1 -0
- package/dist/dd-manager.d.ts +17 -0
- package/dist/{h5/dd-manager.js → dd-manager.js} +4 -1
- package/dist/dd-manager.js.map +1 -0
- package/dist/{es5/h5/dd-resizable-handle.d.ts → dd-resizable-handle.d.ts} +2 -2
- package/dist/{h5/dd-resizable-handle.js → dd-resizable-handle.js} +33 -9
- package/dist/dd-resizable-handle.js.map +1 -0
- package/dist/{h5/dd-resizable.d.ts → dd-resizable.d.ts} +3 -3
- package/dist/{h5/dd-resizable.js → dd-resizable.js} +29 -28
- package/dist/dd-resizable.js.map +1 -0
- package/dist/dd-touch.d.ts +33 -0
- package/dist/dd-touch.js +179 -0
- package/dist/dd-touch.js.map +1 -0
- package/dist/es5/{h5/dd-base-impl.d.ts → dd-base-impl.d.ts} +2 -2
- package/dist/es5/{h5/dd-base-impl.js → dd-base-impl.js} +2 -4
- package/dist/es5/dd-base-impl.js.map +1 -0
- package/dist/{h5 → es5}/dd-draggable.d.ts +7 -8
- package/dist/es5/dd-draggable.js +335 -0
- package/dist/es5/dd-draggable.js.map +1 -0
- package/dist/{h5 → es5}/dd-droppable.d.ts +4 -3
- package/dist/es5/dd-droppable.js +180 -0
- package/dist/es5/dd-droppable.js.map +1 -0
- package/dist/{h5 → es5}/dd-element.d.ts +2 -2
- package/dist/es5/{h5/dd-element.js → dd-element.js} +1 -1
- package/dist/es5/dd-element.js.map +1 -0
- package/dist/es5/dd-gridstack.d.ts +36 -0
- package/dist/es5/{gridstack-dd.js → dd-gridstack.js} +164 -71
- package/dist/es5/dd-gridstack.js.map +1 -0
- package/dist/es5/dd-manager.d.ts +17 -0
- package/dist/es5/{h5/dd-manager.js → dd-manager.js} +4 -1
- package/dist/es5/dd-manager.js.map +1 -0
- package/dist/{h5 → es5}/dd-resizable-handle.d.ts +2 -2
- package/dist/es5/{h5/dd-resizable-handle.js → dd-resizable-handle.js} +33 -9
- package/dist/es5/dd-resizable-handle.js.map +1 -0
- package/dist/es5/{h5/dd-resizable.d.ts → dd-resizable.d.ts} +3 -3
- package/dist/es5/{h5/dd-resizable.js → dd-resizable.js} +29 -28
- package/dist/es5/dd-resizable.js.map +1 -0
- package/dist/es5/dd-touch.d.ts +33 -0
- package/dist/es5/dd-touch.js +182 -0
- package/dist/es5/dd-touch.js.map +1 -0
- package/dist/es5/gridstack-all.js +3 -0
- package/dist/{gridstack-static.js.LICENSE.txt → es5/gridstack-all.js.LICENSE.txt} +2 -2
- package/dist/es5/gridstack-all.js.map +1 -0
- package/dist/es5/gridstack-engine.d.ts +12 -9
- package/dist/es5/gridstack-engine.js +45 -55
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +17 -12
- package/dist/es5/gridstack.js +70 -43
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +19 -20
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +12 -2
- package/dist/es5/utils.js +79 -18
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-all.js +3 -0
- package/dist/{es5/gridstack-h5.js.LICENSE.txt → gridstack-all.js.LICENSE.txt} +2 -2
- package/dist/gridstack-all.js.map +1 -0
- package/dist/gridstack-engine.d.ts +12 -9
- package/dist/gridstack-engine.js +44 -54
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +21 -9
- package/dist/gridstack.d.ts +17 -12
- package/dist/gridstack.js +68 -43
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/src/gridstack.scss +19 -12
- package/dist/types.d.ts +19 -20
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +12 -2
- package/dist/utils.js +75 -17
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +21 -2
- package/doc/README.md +29 -24
- package/package.json +5 -5
- package/dist/es5/gridstack-dd.d.ts +0 -35
- package/dist/es5/gridstack-dd.js.map +0 -1
- package/dist/es5/gridstack-ddi.d.ts +0 -17
- package/dist/es5/gridstack-ddi.js +0 -31
- package/dist/es5/gridstack-ddi.js.map +0 -1
- package/dist/es5/gridstack-h5.d.ts +0 -10
- package/dist/es5/gridstack-h5.js +0 -3
- package/dist/es5/gridstack-h5.js.map +0 -1
- package/dist/es5/gridstack-jq.d.ts +0 -10
- package/dist/es5/gridstack-jq.js +0 -3
- package/dist/es5/gridstack-jq.js.LICENSE.txt +0 -99
- package/dist/es5/gridstack-jq.js.map +0 -1
- package/dist/es5/gridstack-static.d.ts +0 -9
- package/dist/es5/gridstack-static.js +0 -3
- package/dist/es5/gridstack-static.js.LICENSE.txt +0 -7
- package/dist/es5/gridstack-static.js.map +0 -1
- package/dist/es5/h5/dd-base-impl.js.map +0 -1
- package/dist/es5/h5/dd-draggable.js +0 -329
- package/dist/es5/h5/dd-draggable.js.map +0 -1
- package/dist/es5/h5/dd-droppable.js +0 -199
- package/dist/es5/h5/dd-droppable.js.map +0 -1
- package/dist/es5/h5/dd-element.js.map +0 -1
- package/dist/es5/h5/dd-manager.d.ts +0 -8
- package/dist/es5/h5/dd-manager.js.map +0 -1
- package/dist/es5/h5/dd-resizable-handle.js.map +0 -1
- package/dist/es5/h5/dd-resizable.js.map +0 -1
- package/dist/es5/h5/dd-utils.d.ts +0 -19
- package/dist/es5/h5/dd-utils.js +0 -111
- package/dist/es5/h5/dd-utils.js.map +0 -1
- package/dist/es5/h5/gridstack-dd-native.d.ts +0 -26
- package/dist/es5/h5/gridstack-dd-native.js +0 -175
- package/dist/es5/h5/gridstack-dd-native.js.map +0 -1
- package/dist/es5/jq/gridstack-dd-jqueryui.d.ts +0 -22
- package/dist/es5/jq/gridstack-dd-jqueryui.js +0 -162
- package/dist/es5/jq/gridstack-dd-jqueryui.js.map +0 -1
- package/dist/gridstack-dd.d.ts +0 -35
- package/dist/gridstack-dd.js.map +0 -1
- package/dist/gridstack-ddi.d.ts +0 -17
- package/dist/gridstack-ddi.js +0 -28
- package/dist/gridstack-ddi.js.map +0 -1
- package/dist/gridstack-h5.d.ts +0 -10
- package/dist/gridstack-h5.js +0 -3
- package/dist/gridstack-h5.js.LICENSE.txt +0 -7
- package/dist/gridstack-h5.js.map +0 -1
- package/dist/gridstack-jq.d.ts +0 -10
- package/dist/gridstack-jq.js +0 -3
- package/dist/gridstack-jq.js.LICENSE.txt +0 -99
- package/dist/gridstack-jq.js.map +0 -1
- package/dist/gridstack-static.d.ts +0 -9
- package/dist/gridstack-static.js +0 -3
- package/dist/gridstack-static.js.map +0 -1
- package/dist/h5/dd-base-impl.js.map +0 -1
- package/dist/h5/dd-draggable.js +0 -305
- package/dist/h5/dd-draggable.js.map +0 -1
- package/dist/h5/dd-droppable.js +0 -168
- package/dist/h5/dd-droppable.js.map +0 -1
- package/dist/h5/dd-element.js.map +0 -1
- package/dist/h5/dd-manager.d.ts +0 -8
- package/dist/h5/dd-manager.js.map +0 -1
- package/dist/h5/dd-resizable-handle.js.map +0 -1
- package/dist/h5/dd-resizable.js.map +0 -1
- package/dist/h5/dd-utils.d.ts +0 -19
- package/dist/h5/dd-utils.js +0 -94
- package/dist/h5/dd-utils.js.map +0 -1
- package/dist/h5/gridstack-dd-native.d.ts +0 -26
- package/dist/h5/gridstack-dd-native.js +0 -140
- package/dist/h5/gridstack-dd-native.js.map +0 -1
- package/dist/jq/gridstack-dd-jqueryui.d.ts +0 -22
- package/dist/jq/gridstack-dd-jqueryui.js +0 -133
- package/dist/jq/gridstack-dd-jqueryui.js.map +0 -1
- package/dist/jq/jquery-ui.js +0 -2
- package/dist/jq/jquery-ui.js.map +0 -1
- package/dist/jq/jquery.js +0 -2
- package/dist/jq/jquery.js.map +0 -1
- package/dist/jq/jquery.ui.touch-punch.js +0 -2
- package/dist/jq/jquery.ui.touch-punch.js.map +0 -1
package/dist/es5/gridstack.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GridStack
|
|
2
|
+
* GridStack 6.0.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';
|
|
@@ -11,7 +11,6 @@ import { ColumnOptions, GridItemHTMLElement, GridStackElement, GridStackEventHan
|
|
|
11
11
|
export * from './types';
|
|
12
12
|
export * from './utils';
|
|
13
13
|
export * from './gridstack-engine';
|
|
14
|
-
export * from './gridstack-ddi';
|
|
15
14
|
export interface GridHTMLElement extends HTMLElement {
|
|
16
15
|
gridstack?: GridStack;
|
|
17
16
|
}
|
|
@@ -70,6 +69,11 @@ export declare class GridStack {
|
|
|
70
69
|
* @param opt grids options used to initialize the grid, and list of children
|
|
71
70
|
*/
|
|
72
71
|
static addGrid(parent: HTMLElement, opt?: GridStackOptions): GridStack;
|
|
72
|
+
/** call this method to register your engine instead of the default one.
|
|
73
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
74
|
+
* replace just one instance.
|
|
75
|
+
*/
|
|
76
|
+
static registerEngine(engineClass: typeof GridStackEngine): void;
|
|
73
77
|
/** scoping so users can call GridStack.Utils.sort() for example */
|
|
74
78
|
static Utils: typeof Utils;
|
|
75
79
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
@@ -80,6 +84,7 @@ export declare class GridStack {
|
|
|
80
84
|
engine: GridStackEngine;
|
|
81
85
|
/** grid options - public for classes to access, but use methods to modify! */
|
|
82
86
|
opts: GridStackOptions;
|
|
87
|
+
protected static engineClass: typeof GridStackEngine;
|
|
83
88
|
/**
|
|
84
89
|
* Construct a grid item from the given element and options
|
|
85
90
|
* @param el
|
|
@@ -124,9 +129,10 @@ export declare class GridStack {
|
|
|
124
129
|
**/
|
|
125
130
|
load(layout: GridStackWidget[], addAndRemove?: boolean | ((g: GridStack, w: GridStackWidget, add: boolean) => GridItemHTMLElement)): GridStack;
|
|
126
131
|
/**
|
|
127
|
-
*
|
|
132
|
+
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
133
|
+
* and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
|
|
128
134
|
*/
|
|
129
|
-
batchUpdate(): GridStack;
|
|
135
|
+
batchUpdate(flag?: boolean): GridStack;
|
|
130
136
|
/**
|
|
131
137
|
* Gets current cell height.
|
|
132
138
|
*/
|
|
@@ -149,11 +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
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
|
|
155
|
-
*/
|
|
156
|
-
commit(): GridStack;
|
|
158
|
+
protected _widthOrContainer(): number;
|
|
157
159
|
/** re-layout grid items to reclaim any empty space */
|
|
158
160
|
compact(): GridStack;
|
|
159
161
|
/**
|
|
@@ -294,13 +296,14 @@ export declare class GridStack {
|
|
|
294
296
|
*/
|
|
295
297
|
onParentResize(): GridStack;
|
|
296
298
|
/** add or remove the window size event handler */
|
|
297
|
-
|
|
299
|
+
protected _updateWindowResizeEvent(forceRemove?: boolean): GridStack;
|
|
300
|
+
static GDRev: string;
|
|
298
301
|
/**
|
|
299
302
|
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
300
303
|
* Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar
|
|
301
304
|
* is dynamically create and needs to change later.
|
|
302
305
|
* @param dragIn string selector (ex: '.sidebar .grid-stack-item')
|
|
303
|
-
* @param dragInOptions options - see DDDragInOpt. (default: {
|
|
306
|
+
* @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
304
307
|
**/
|
|
305
308
|
static setupDragIn(dragIn?: string, dragInOptions?: DDDragInOpt): void;
|
|
306
309
|
/**
|
|
@@ -343,4 +346,6 @@ export declare class GridStack {
|
|
|
343
346
|
* Enables/disables widget resizing. No-op for static grids.
|
|
344
347
|
*/
|
|
345
348
|
enableResize(doEnable: boolean): GridStack;
|
|
349
|
+
commit(): GridStack;
|
|
346
350
|
}
|
|
351
|
+
export * from './dd-gridstack';
|
package/dist/es5/gridstack.js
CHANGED
|
@@ -30,20 +30,18 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.GridStack = void 0;
|
|
32
32
|
/*!
|
|
33
|
-
* GridStack
|
|
33
|
+
* GridStack 6.0.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");
|
|
40
40
|
var utils_1 = require("./utils");
|
|
41
|
-
var gridstack_ddi_1 = require("./gridstack-ddi");
|
|
42
41
|
// export all dependent file as well to make it easier for users to just import the main file
|
|
43
42
|
__exportStar(require("./types"), exports);
|
|
44
43
|
__exportStar(require("./utils"), exports);
|
|
45
44
|
__exportStar(require("./gridstack-engine"), exports);
|
|
46
|
-
__exportStar(require("./gridstack-ddi"), exports);
|
|
47
45
|
// default values for grid options - used during init and when saving out
|
|
48
46
|
var GridDefaults = {
|
|
49
47
|
column: 12,
|
|
@@ -59,18 +57,16 @@ var GridDefaults = {
|
|
|
59
57
|
cellHeightThrottle: 100,
|
|
60
58
|
margin: 10,
|
|
61
59
|
auto: true,
|
|
62
|
-
|
|
60
|
+
oneColumnSize: 768,
|
|
63
61
|
float: false,
|
|
64
62
|
staticGrid: false,
|
|
65
63
|
animate: true,
|
|
66
|
-
alwaysShowResizeHandle:
|
|
64
|
+
alwaysShowResizeHandle: 'mobile',
|
|
67
65
|
resizable: {
|
|
68
|
-
autoHide: true,
|
|
69
66
|
handles: 'se'
|
|
70
67
|
},
|
|
71
68
|
draggable: {
|
|
72
69
|
handle: '.grid-stack-item-content',
|
|
73
|
-
scroll: false,
|
|
74
70
|
appendTo: 'body'
|
|
75
71
|
},
|
|
76
72
|
disableDrag: false,
|
|
@@ -83,7 +79,7 @@ var GridDefaults = {
|
|
|
83
79
|
marginUnit: 'px',
|
|
84
80
|
cellHeightUnit: 'px',
|
|
85
81
|
disableOneColumnMode: false,
|
|
86
|
-
oneColumnModeDomSort: false
|
|
82
|
+
oneColumnModeDomSort: false,
|
|
87
83
|
};
|
|
88
84
|
/**
|
|
89
85
|
* Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.
|
|
@@ -120,25 +116,31 @@ var GridStack = /** @class */ (function () {
|
|
|
120
116
|
if (opts.column === 'auto') {
|
|
121
117
|
delete opts.column;
|
|
122
118
|
}
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
// 'minWidth' legacy support in 5.1
|
|
120
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
121
|
+
var anyOpts = opts;
|
|
122
|
+
if (anyOpts.minWidth !== undefined) {
|
|
123
|
+
opts.oneColumnSize = opts.oneColumnSize || anyOpts.minWidth;
|
|
124
|
+
delete anyOpts.minWidth;
|
|
125
|
+
}
|
|
126
|
+
// save original setting so we can restore on save
|
|
127
|
+
if (opts.alwaysShowResizeHandle !== undefined) {
|
|
128
|
+
opts._alwaysShowResizeHandle = opts.alwaysShowResizeHandle;
|
|
129
|
+
}
|
|
130
|
+
// elements DOM attributes override any passed options (like CSS style) - merge the two together
|
|
131
|
+
var defaults = __assign(__assign({}, utils_1.Utils.cloneDeep(GridDefaults)), { column: utils_1.Utils.toNumber(el.getAttribute('gs-column')) || GridDefaults.column, minRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-min-row')) || GridDefaults.minRow, maxRow: rowAttr ? rowAttr : utils_1.Utils.toNumber(el.getAttribute('gs-max-row')) || GridDefaults.maxRow, staticGrid: utils_1.Utils.toBool(el.getAttribute('gs-static')) || GridDefaults.staticGrid, _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0), draggable: {
|
|
132
|
+
handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || GridDefaults.draggable.handle,
|
|
131
133
|
}, removableOptions: {
|
|
132
|
-
accept: '.' +
|
|
134
|
+
accept: opts.itemClass ? '.' + opts.itemClass : GridDefaults.removableOptions.accept,
|
|
133
135
|
} });
|
|
134
136
|
if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead
|
|
135
137
|
defaults.animate = utils_1.Utils.toBool(el.getAttribute('gs-animate'));
|
|
136
138
|
}
|
|
137
139
|
this.opts = utils_1.Utils.defaults(opts, defaults);
|
|
138
140
|
opts = null; // make sure we use this.opts instead
|
|
139
|
-
this.
|
|
141
|
+
this._initMargin(); // part of settings defaults...
|
|
140
142
|
// 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.
|
|
143
|
+
if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.oneColumnSize) {
|
|
142
144
|
this._prevColumn = this.getColumn();
|
|
143
145
|
this.opts.column = 1;
|
|
144
146
|
}
|
|
@@ -169,9 +171,14 @@ var GridStack = /** @class */ (function () {
|
|
|
169
171
|
}
|
|
170
172
|
this.cellHeight(this.opts.cellHeight, false);
|
|
171
173
|
}
|
|
174
|
+
// see if we need to adjust auto-hide
|
|
175
|
+
if (this.opts.alwaysShowResizeHandle === 'mobile') {
|
|
176
|
+
this.opts.alwaysShowResizeHandle = dd_touch_1.isTouch;
|
|
177
|
+
}
|
|
172
178
|
this.el.classList.add(this.opts._styleSheetClass);
|
|
173
179
|
this._setStaticClass();
|
|
174
|
-
this.
|
|
180
|
+
var engineClass = this.opts.engineClass || GridStack.engineClass || gridstack_engine_1.GridStackEngine;
|
|
181
|
+
this.engine = new engineClass({
|
|
175
182
|
column: this.getColumn(),
|
|
176
183
|
float: this.opts.float,
|
|
177
184
|
maxRow: this.opts.maxRow,
|
|
@@ -207,7 +214,7 @@ var GridStack = /** @class */ (function () {
|
|
|
207
214
|
});
|
|
208
215
|
});
|
|
209
216
|
elements_1.sort(function (a, b) { return a.i - b.i; }).forEach(function (e) { return _this._prepareElement(e.el); });
|
|
210
|
-
this.
|
|
217
|
+
this.batchUpdate(false);
|
|
211
218
|
}
|
|
212
219
|
this.setAnimation(this.opts.animate);
|
|
213
220
|
this._updateStyles();
|
|
@@ -310,6 +317,13 @@ var GridStack = /** @class */ (function () {
|
|
|
310
317
|
}
|
|
311
318
|
return grid;
|
|
312
319
|
};
|
|
320
|
+
/** call this method to register your engine instead of the default one.
|
|
321
|
+
* See instead `GridStackOptions.engineClass` if you only need to
|
|
322
|
+
* replace just one instance.
|
|
323
|
+
*/
|
|
324
|
+
GridStack.registerEngine = function (engineClass) {
|
|
325
|
+
GridStack.engineClass = engineClass;
|
|
326
|
+
};
|
|
313
327
|
Object.defineProperty(GridStack.prototype, "placeholder", {
|
|
314
328
|
/** @internal create placeholder DIV as needed */
|
|
315
329
|
get: function () {
|
|
@@ -462,6 +476,14 @@ var GridStack = /** @class */ (function () {
|
|
|
462
476
|
o.column = 'auto';
|
|
463
477
|
delete o.disableOneColumnMode;
|
|
464
478
|
}
|
|
479
|
+
var origShow = o._alwaysShowResizeHandle;
|
|
480
|
+
delete o._alwaysShowResizeHandle;
|
|
481
|
+
if (origShow !== undefined) {
|
|
482
|
+
o.alwaysShowResizeHandle = origShow;
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
delete o.alwaysShowResizeHandle;
|
|
486
|
+
}
|
|
465
487
|
utils_1.Utils.removeInternalAndSame(o, GridDefaults);
|
|
466
488
|
o.children = list;
|
|
467
489
|
return o;
|
|
@@ -530,17 +552,24 @@ var GridStack = /** @class */ (function () {
|
|
|
530
552
|
}
|
|
531
553
|
});
|
|
532
554
|
this.engine.removedNodes = removed;
|
|
533
|
-
this.
|
|
555
|
+
this.batchUpdate(false);
|
|
534
556
|
// after commit, clear that flag
|
|
535
557
|
delete this._ignoreLayoutsNodeChange;
|
|
536
558
|
delete this._insertNotAppend;
|
|
537
559
|
return this;
|
|
538
560
|
};
|
|
539
561
|
/**
|
|
540
|
-
*
|
|
562
|
+
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
563
|
+
* and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
|
|
541
564
|
*/
|
|
542
|
-
GridStack.prototype.batchUpdate = function () {
|
|
543
|
-
|
|
565
|
+
GridStack.prototype.batchUpdate = function (flag) {
|
|
566
|
+
if (flag === void 0) { flag = true; }
|
|
567
|
+
this.engine.batchUpdate(flag);
|
|
568
|
+
if (!flag) {
|
|
569
|
+
this._triggerRemoveEvent();
|
|
570
|
+
this._triggerAddEvent();
|
|
571
|
+
this._triggerChangeEvent();
|
|
572
|
+
}
|
|
544
573
|
return this;
|
|
545
574
|
};
|
|
546
575
|
/**
|
|
@@ -615,16 +644,6 @@ var GridStack = /** @class */ (function () {
|
|
|
615
644
|
// https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively
|
|
616
645
|
return (this.el.clientWidth || this.el.parentElement.clientWidth || window.innerWidth);
|
|
617
646
|
};
|
|
618
|
-
/**
|
|
619
|
-
* Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.
|
|
620
|
-
*/
|
|
621
|
-
GridStack.prototype.commit = function () {
|
|
622
|
-
this.engine.commit();
|
|
623
|
-
this._triggerRemoveEvent();
|
|
624
|
-
this._triggerAddEvent();
|
|
625
|
-
this._triggerChangeEvent();
|
|
626
|
-
return this;
|
|
627
|
-
};
|
|
628
647
|
/** re-layout grid items to reclaim any empty space */
|
|
629
648
|
GridStack.prototype.compact = function () {
|
|
630
649
|
this.engine.compact();
|
|
@@ -881,7 +900,7 @@ var GridStack = /** @class */ (function () {
|
|
|
881
900
|
return;
|
|
882
901
|
// remove our DOM data (circular link) and drag&drop permanently
|
|
883
902
|
delete el.gridstackNode;
|
|
884
|
-
|
|
903
|
+
_this._removeDD(el);
|
|
885
904
|
_this.engine.removeNode(node, removeDOM, triggerEvent);
|
|
886
905
|
if (removeDOM && el.parentElement) {
|
|
887
906
|
el.remove(); // in batch mode engine.removeNode doesn't call back to remove DOM
|
|
@@ -898,11 +917,12 @@ var GridStack = /** @class */ (function () {
|
|
|
898
917
|
* @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).
|
|
899
918
|
*/
|
|
900
919
|
GridStack.prototype.removeAll = function (removeDOM) {
|
|
920
|
+
var _this = this;
|
|
901
921
|
if (removeDOM === void 0) { removeDOM = true; }
|
|
902
922
|
// always remove our DOM data (circular link) before list gets emptied and drag&drop permanently
|
|
903
923
|
this.engine.nodes.forEach(function (n) {
|
|
904
924
|
delete n.el.gridstackNode;
|
|
905
|
-
|
|
925
|
+
_this._removeDD(n.el);
|
|
906
926
|
});
|
|
907
927
|
this.engine.removeAll(removeDOM);
|
|
908
928
|
this._triggerRemoveEvent();
|
|
@@ -1026,7 +1046,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1026
1046
|
// re-use existing margin handling
|
|
1027
1047
|
this.opts.margin = value;
|
|
1028
1048
|
this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;
|
|
1029
|
-
this.
|
|
1049
|
+
this._initMargin();
|
|
1030
1050
|
this._updateStyles(true); // true = force re-create
|
|
1031
1051
|
return this;
|
|
1032
1052
|
};
|
|
@@ -1314,7 +1334,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1314
1334
|
}
|
|
1315
1335
|
else {
|
|
1316
1336
|
// else check for 1 column in/out behavior
|
|
1317
|
-
var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.
|
|
1337
|
+
var oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.oneColumnSize;
|
|
1318
1338
|
if ((this.opts.column === 1) !== oneColumn) {
|
|
1319
1339
|
changedColumn = true;
|
|
1320
1340
|
if (this.opts.animate) {
|
|
@@ -1377,7 +1397,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1377
1397
|
/** @internal */
|
|
1378
1398
|
GridStack.getGridElements = function (els) { return utils_1.Utils.getElements(els); };
|
|
1379
1399
|
/** @internal initialize margin top/bottom/left/right and units */
|
|
1380
|
-
GridStack.prototype.
|
|
1400
|
+
GridStack.prototype._initMargin = function () {
|
|
1381
1401
|
var data;
|
|
1382
1402
|
var margin = 0;
|
|
1383
1403
|
// support passing multiple values like CSS (ex: '5px 10px 0 20px')
|
|
@@ -1440,7 +1460,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1440
1460
|
return this;
|
|
1441
1461
|
};
|
|
1442
1462
|
/*
|
|
1443
|
-
* drag&drop empty stubs that will be implemented in gridstack
|
|
1463
|
+
* drag&drop empty stubs that will be implemented in dd-gridstack.ts for non static grid
|
|
1444
1464
|
* so we don't incur the load unless needed.
|
|
1445
1465
|
* NOTE: had to make those methods public in order to define them else as
|
|
1446
1466
|
* GridStack.prototype._setupAcceptWidget = function()
|
|
@@ -1452,7 +1472,7 @@ var GridStack = /** @class */ (function () {
|
|
|
1452
1472
|
* Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar
|
|
1453
1473
|
* is dynamically create and needs to change later.
|
|
1454
1474
|
* @param dragIn string selector (ex: '.sidebar .grid-stack-item')
|
|
1455
|
-
* @param dragInOptions options - see DDDragInOpt. (default: {
|
|
1475
|
+
* @param dragInOptions options - see DDDragInOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
1456
1476
|
**/
|
|
1457
1477
|
GridStack.setupDragIn = function (dragIn, dragInOptions) { };
|
|
1458
1478
|
/**
|
|
@@ -1495,6 +1515,8 @@ var GridStack = /** @class */ (function () {
|
|
|
1495
1515
|
* Enables/disables widget resizing. No-op for static grids.
|
|
1496
1516
|
*/
|
|
1497
1517
|
GridStack.prototype.enableResize = function (doEnable) { return this; };
|
|
1518
|
+
/** @internal removes any drag&drop present (called during destroy) */
|
|
1519
|
+
GridStack.prototype._removeDD = function (el) { return this; };
|
|
1498
1520
|
/** @internal called to add drag over support to support widgets */
|
|
1499
1521
|
GridStack.prototype._setupAcceptWidget = function () { return this; };
|
|
1500
1522
|
/** @internal called to setup a trash drop zone if the user specifies it */
|
|
@@ -1507,11 +1529,16 @@ var GridStack = /** @class */ (function () {
|
|
|
1507
1529
|
GridStack.prototype._dragOrResize = function (el, event, ui, node, cellWidth, cellHeight) { return; };
|
|
1508
1530
|
/** @internal called when a node leaves our area (mouse out or shape outside) **/
|
|
1509
1531
|
GridStack.prototype._leave = function (el, helper) { return; };
|
|
1532
|
+
// legacy method removed
|
|
1533
|
+
GridStack.prototype.commit = function () { utils_1.obsolete(this, this.batchUpdate(false), 'commit', 'batchUpdate', '5.2'); return this; };
|
|
1510
1534
|
/** scoping so users can call GridStack.Utils.sort() for example */
|
|
1511
1535
|
GridStack.Utils = utils_1.Utils;
|
|
1512
1536
|
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
1513
1537
|
GridStack.Engine = gridstack_engine_1.GridStackEngine;
|
|
1538
|
+
GridStack.GDRev = '6.0.0';
|
|
1514
1539
|
return GridStack;
|
|
1515
1540
|
}());
|
|
1516
1541
|
exports.GridStack = GridStack;
|
|
1542
|
+
var dd_touch_1 = require("./dd-touch");
|
|
1543
|
+
__exportStar(require("./dd-gridstack"), exports);
|
|
1517
1544
|
//# sourceMappingURL=gridstack.js.map
|