gridstack 12.0.0 → 12.1.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/README.md +5 -3
- package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.component.mjs +18 -4
- package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
- package/dist/angular/esm2020/lib/types.mjs +2 -2
- package/dist/angular/fesm2015/gridstack-angular.mjs +22 -6
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +21 -7
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
- package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
- package/dist/angular/lib/gridstack.component.d.ts +1 -1
- package/dist/angular/lib/types.d.ts +1 -1
- package/dist/angular/src/base-widget.ts +1 -1
- package/dist/angular/src/gridstack-item.component.ts +1 -1
- package/dist/angular/src/gridstack.component.ts +15 -3
- package/dist/angular/src/gridstack.module.ts +1 -1
- 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 +1 -1
- package/dist/dd-draggable.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/dd-resizable-handle.js +1 -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/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 +3 -1
- package/dist/gridstack.js +58 -56
- package/dist/gridstack.js.map +1 -1
- package/dist/src/gridstack.scss +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +14 -0
- package/package.json +2 -4
- package/dist/es5/dd-base-impl.d.ts +0 -20
- package/dist/es5/dd-base-impl.js +0 -41
- package/dist/es5/dd-base-impl.js.map +0 -1
- package/dist/es5/dd-draggable.d.ts +0 -20
- package/dist/es5/dd-draggable.js +0 -408
- package/dist/es5/dd-draggable.js.map +0 -1
- package/dist/es5/dd-droppable.d.ts +0 -26
- package/dist/es5/dd-droppable.js +0 -185
- package/dist/es5/dd-droppable.js.map +0 -1
- package/dist/es5/dd-element.d.ts +0 -27
- package/dist/es5/dd-element.js +0 -96
- package/dist/es5/dd-element.js.map +0 -1
- package/dist/es5/dd-gridstack.d.ts +0 -34
- package/dist/es5/dd-gridstack.js +0 -154
- package/dist/es5/dd-gridstack.js.map +0 -1
- package/dist/es5/dd-manager.d.ts +0 -22
- package/dist/es5/dd-manager.js +0 -17
- package/dist/es5/dd-manager.js.map +0 -1
- package/dist/es5/dd-resizable-handle.d.ts +0 -18
- package/dist/es5/dd-resizable-handle.js +0 -117
- package/dist/es5/dd-resizable-handle.js.map +0 -1
- package/dist/es5/dd-resizable.d.ts +0 -30
- package/dist/es5/dd-resizable.js +0 -331
- package/dist/es5/dd-resizable.js.map +0 -1
- package/dist/es5/dd-touch.d.ts +0 -33
- package/dist/es5/dd-touch.js +0 -157
- package/dist/es5/dd-touch.js.map +0 -1
- package/dist/es5/gridstack-all.js +0 -3
- package/dist/es5/gridstack-all.js.LICENSE.txt +0 -7
- package/dist/es5/gridstack-all.js.map +0 -1
- package/dist/es5/gridstack-engine.d.ts +0 -107
- package/dist/es5/gridstack-engine.js +0 -1070
- package/dist/es5/gridstack-engine.js.map +0 -1
- package/dist/es5/gridstack-poly.js +0 -356
- package/dist/es5/gridstack.d.ts +0 -452
- package/dist/es5/gridstack.js +0 -2644
- package/dist/es5/gridstack.js.map +0 -1
- package/dist/es5/types.d.ts +0 -326
- package/dist/es5/types.js +0 -38
- package/dist/es5/types.js.map +0 -1
- package/dist/es5/utils.d.ts +0 -104
- package/dist/es5/utils.js +0 -633
- package/dist/es5/utils.js.map +0 -1
package/dist/es5/gridstack.d.ts
DELETED
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* GridStack 12.0.0
|
|
3
|
-
* https://gridstackjs.com/
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2021-2024 Alain Dumesny
|
|
6
|
-
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
7
|
-
*/
|
|
8
|
-
import { GridStackEngine } from './gridstack-engine';
|
|
9
|
-
import { Utils } from './utils';
|
|
10
|
-
import { ColumnOptions, GridItemHTMLElement, GridStackElement, GridStackEventHandlerCallback, GridStackNode, GridStackWidget, numberOrString, DDDragOpt, GridStackOptions, GridStackEventHandler, GridStackNodesHandler, AddRemoveFcn, SaveFcn, CompactOptions, ResizeToContentFcn, GridStackDroppedHandler, GridStackElementHandler, Position, RenderFcn } from './types';
|
|
11
|
-
import { DDGridStack } from './dd-gridstack';
|
|
12
|
-
export * from './types';
|
|
13
|
-
export * from './utils';
|
|
14
|
-
export * from './gridstack-engine';
|
|
15
|
-
export * from './dd-gridstack';
|
|
16
|
-
export interface GridHTMLElement extends HTMLElement {
|
|
17
|
-
gridstack?: GridStack;
|
|
18
|
-
}
|
|
19
|
-
/** list of possible events, or space separated list of them */
|
|
20
|
-
export type GridStackEvent = 'added' | 'change' | 'disable' | 'drag' | 'dragstart' | 'dragstop' | 'dropped' | 'enable' | 'removed' | 'resize' | 'resizestart' | 'resizestop' | 'resizecontent';
|
|
21
|
-
/** Defines the coordinates of an object */
|
|
22
|
-
export interface MousePosition {
|
|
23
|
-
top: number;
|
|
24
|
-
left: number;
|
|
25
|
-
}
|
|
26
|
-
/** Defines the position of a cell inside the grid*/
|
|
27
|
-
export interface CellPosition {
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.
|
|
33
|
-
* Note: your grid elements MUST have the following classes for the CSS layout to work:
|
|
34
|
-
* @example
|
|
35
|
-
* <div class="grid-stack">
|
|
36
|
-
* <div class="grid-stack-item">
|
|
37
|
-
* <div class="grid-stack-item-content">Item 1</div>
|
|
38
|
-
* </div>
|
|
39
|
-
* </div>
|
|
40
|
-
*/
|
|
41
|
-
export declare class GridStack {
|
|
42
|
-
el: GridHTMLElement;
|
|
43
|
-
opts: GridStackOptions;
|
|
44
|
-
/**
|
|
45
|
-
* initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
46
|
-
* simply return the existing instance (ignore any passed options). There is also an initAll() version that support
|
|
47
|
-
* multiple grids initialization at once. Or you can use addGrid() to create the entire grid from JSON.
|
|
48
|
-
* @param options grid options (optional)
|
|
49
|
-
* @param elOrString element or CSS selector (first one used) to convert to a grid (default to '.grid-stack' class selector)
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const grid = GridStack.init();
|
|
53
|
-
*
|
|
54
|
-
* Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later
|
|
55
|
-
* const grid = document.querySelector('.grid-stack').gridstack;
|
|
56
|
-
*/
|
|
57
|
-
static init(options?: GridStackOptions, elOrString?: GridStackElement): GridStack;
|
|
58
|
-
/**
|
|
59
|
-
* Will initialize a list of elements (given a selector) and return an array of grids.
|
|
60
|
-
* @param options grid options (optional)
|
|
61
|
-
* @param selector elements selector to convert to grids (default to '.grid-stack' class selector)
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* const grids = GridStack.initAll();
|
|
65
|
-
* grids.forEach(...)
|
|
66
|
-
*/
|
|
67
|
-
static initAll(options?: GridStackOptions, selector?: string): GridStack[];
|
|
68
|
-
/**
|
|
69
|
-
* call to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then
|
|
70
|
-
* grid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from
|
|
71
|
-
* JSON serialized data, including options.
|
|
72
|
-
* @param parent HTML element parent to the grid
|
|
73
|
-
* @param opt grids options used to initialize the grid, and list of children
|
|
74
|
-
*/
|
|
75
|
-
static addGrid(parent: HTMLElement, opt?: GridStackOptions): GridStack;
|
|
76
|
-
/** call this method to register your engine instead of the default one.
|
|
77
|
-
* See instead `GridStackOptions.engineClass` if you only need to
|
|
78
|
-
* replace just one instance.
|
|
79
|
-
*/
|
|
80
|
-
static registerEngine(engineClass: typeof GridStackEngine): void;
|
|
81
|
-
/**
|
|
82
|
-
* callback method use when new items|grids needs to be created or deleted, instead of the default
|
|
83
|
-
* item: <div class="grid-stack-item"><div class="grid-stack-item-content">w.content</div></div>
|
|
84
|
-
* grid: <div class="grid-stack">grid content...</div>
|
|
85
|
-
* add = true: the returned DOM element will then be converted to a GridItemHTMLElement using makeWidget()|GridStack:init().
|
|
86
|
-
* add = false: the item will be removed from DOM (if not already done)
|
|
87
|
-
* grid = true|false for grid vs grid-items
|
|
88
|
-
*/
|
|
89
|
-
static addRemoveCB?: AddRemoveFcn;
|
|
90
|
-
/**
|
|
91
|
-
* callback during saving to application can inject extra data for each widget, on top of the grid layout properties
|
|
92
|
-
*/
|
|
93
|
-
static saveCB?: SaveFcn;
|
|
94
|
-
/**
|
|
95
|
-
* callback to create the content of widgets so the app can control how to store and restore it
|
|
96
|
-
* By default this lib will do 'el.textContent = w.content' forcing text only support for avoiding potential XSS issues.
|
|
97
|
-
*/
|
|
98
|
-
static renderCB?: RenderFcn;
|
|
99
|
-
/** callback to use for resizeToContent instead of the built in one */
|
|
100
|
-
static resizeToContentCB?: ResizeToContentFcn;
|
|
101
|
-
/** parent class for sizing content. defaults to '.grid-stack-item-content' */
|
|
102
|
-
static resizeToContentParent: string;
|
|
103
|
-
/** scoping so users can call GridStack.Utils.sort() for example */
|
|
104
|
-
static Utils: typeof Utils;
|
|
105
|
-
/** scoping so users can call new GridStack.Engine(12) for example */
|
|
106
|
-
static Engine: typeof GridStackEngine;
|
|
107
|
-
/** engine used to implement non DOM grid functionality */
|
|
108
|
-
engine: GridStackEngine;
|
|
109
|
-
/** point to a parent grid item if we're nested (inside a grid-item in between 2 Grids) */
|
|
110
|
-
parentGridNode?: GridStackNode;
|
|
111
|
-
/** time to wait for animation (if enabled) to be done so content sizing can happen */
|
|
112
|
-
animationDelay: number;
|
|
113
|
-
protected static engineClass: typeof GridStackEngine;
|
|
114
|
-
protected resizeObserver: ResizeObserver;
|
|
115
|
-
protected responseLayout: ColumnOptions;
|
|
116
|
-
private _skipInitialResize;
|
|
117
|
-
/**
|
|
118
|
-
* Construct a grid item from the given element and options
|
|
119
|
-
* @param el the HTML element tied to this grid after it's been initialized
|
|
120
|
-
* @param opts grid options - public for classes to access, but use methods to modify!
|
|
121
|
-
*/
|
|
122
|
-
constructor(el: GridHTMLElement, opts?: GridStackOptions);
|
|
123
|
-
private _updateColumnVar;
|
|
124
|
-
/**
|
|
125
|
-
* add a new widget and returns it.
|
|
126
|
-
*
|
|
127
|
-
* Widget will be always placed even if result height is more than actual grid height.
|
|
128
|
-
* You need to use `willItFit()` before calling addWidget for additional check.
|
|
129
|
-
* See also `makeWidget(el)` for DOM element.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* const grid = GridStack.init();
|
|
133
|
-
* grid.addWidget({w: 3, content: 'hello'});
|
|
134
|
-
*
|
|
135
|
-
* @param w GridStackWidget definition. used MakeWidget(el) if you have dom element instead.
|
|
136
|
-
*/
|
|
137
|
-
addWidget(w: GridStackWidget): GridItemHTMLElement;
|
|
138
|
-
/** create the default grid item divs, and content (possibly lazy loaded) by using GridStack.renderCB() */
|
|
139
|
-
createWidgetDivs(n: GridStackNode): HTMLElement;
|
|
140
|
-
/**
|
|
141
|
-
* Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
|
|
142
|
-
* from the parent's subGrid options.
|
|
143
|
-
* @param el gridItem element to convert
|
|
144
|
-
* @param ops (optional) sub-grid options, else default to node, then parent settings, else defaults
|
|
145
|
-
* @param nodeToAdd (optional) node to add to the newly created sub grid (used when dragging over existing regular item)
|
|
146
|
-
* @param saveContent if true (default) the html inside .grid-stack-content will be saved to child widget
|
|
147
|
-
* @returns newly created grid
|
|
148
|
-
*/
|
|
149
|
-
makeSubGrid(el: GridItemHTMLElement, ops?: GridStackOptions, nodeToAdd?: GridStackNode, saveContent?: boolean): GridStack;
|
|
150
|
-
/**
|
|
151
|
-
* called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
152
|
-
* to the original grid-item. Also called to remove empty sub-grids when last item is dragged out (since re-creating is simple)
|
|
153
|
-
*/
|
|
154
|
-
removeAsSubGrid(nodeThatRemoved?: GridStackNode): void;
|
|
155
|
-
/**
|
|
156
|
-
* saves the current layout returning a list of widgets for serialization which might include any nested grids.
|
|
157
|
-
* @param saveContent if true (default) the latest html inside .grid-stack-content will be saved to GridStackWidget.content field, else it will
|
|
158
|
-
* be removed.
|
|
159
|
-
* @param saveGridOpt if true (default false), save the grid options itself, so you can call the new GridStack.addGrid()
|
|
160
|
-
* to recreate everything from scratch. GridStackOptions.children would then contain the widget list instead.
|
|
161
|
-
* @param saveCB callback for each node -> widget, so application can insert additional data to be saved into the widget data structure.
|
|
162
|
-
* @returns list of widgets or full grid option, including .children list of widgets
|
|
163
|
-
*/
|
|
164
|
-
save(saveContent?: boolean, saveGridOpt?: boolean, saveCB?: SaveFcn): GridStackWidget[] | GridStackOptions;
|
|
165
|
-
/**
|
|
166
|
-
* load the widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.
|
|
167
|
-
*
|
|
168
|
-
* @param items list of widgets definition to update/create
|
|
169
|
-
* @param addRemove boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving
|
|
170
|
-
* the user control of insertion.
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* see http://gridstackjs.com/demo/serialization.html
|
|
174
|
-
*/
|
|
175
|
-
load(items: GridStackWidget[], addRemove?: boolean | AddRemoveFcn): GridStack;
|
|
176
|
-
/**
|
|
177
|
-
* use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
178
|
-
* and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
|
|
179
|
-
*/
|
|
180
|
-
batchUpdate(flag?: boolean): GridStack;
|
|
181
|
-
/**
|
|
182
|
-
* Gets current cell height.
|
|
183
|
-
*/
|
|
184
|
-
getCellHeight(forcePixel?: boolean): number;
|
|
185
|
-
/**
|
|
186
|
-
* Update current cell height - see `GridStackOptions.cellHeight` for format.
|
|
187
|
-
* This method rebuilds an internal CSS style sheet.
|
|
188
|
-
* Note: You can expect performance issues if call this method too often.
|
|
189
|
-
*
|
|
190
|
-
* @param val the cell height. If not passed (undefined), cells content will be made square (match width minus margin),
|
|
191
|
-
* if pass 0 the CSS will be generated by the application instead.
|
|
192
|
-
*
|
|
193
|
-
* @example
|
|
194
|
-
* grid.cellHeight(100); // same as 100px
|
|
195
|
-
* grid.cellHeight('70px');
|
|
196
|
-
* grid.cellHeight(grid.cellWidth() * 1.2);
|
|
197
|
-
*/
|
|
198
|
-
cellHeight(val?: numberOrString): GridStack;
|
|
199
|
-
/** Gets current cell width. */
|
|
200
|
-
cellWidth(): number;
|
|
201
|
-
/** return our expected width (or parent) , and optionally of window for dynamic column check */
|
|
202
|
-
protected _widthOrContainer(forBreakpoint?: boolean): number;
|
|
203
|
-
/** checks for dynamic column count for our current size, returning true if changed */
|
|
204
|
-
protected checkDynamicColumn(): boolean;
|
|
205
|
-
/**
|
|
206
|
-
* re-layout grid items to reclaim any empty space. Options are:
|
|
207
|
-
* 'list' keep the widget left->right order the same, even if that means leaving an empty slot if things don't fit
|
|
208
|
-
* 'compact' might re-order items to fill any empty space
|
|
209
|
-
*
|
|
210
|
-
* doSort - 'false' to let you do your own sorting ahead in case you need to control a different order. (default to sort)
|
|
211
|
-
*/
|
|
212
|
-
compact(layout?: CompactOptions, doSort?: boolean): GridStack;
|
|
213
|
-
/**
|
|
214
|
-
* set the number of columns in the grid. Will update existing widgets to conform to new number of columns,
|
|
215
|
-
* as well as cache the original layout so you can revert back to previous positions without loss.
|
|
216
|
-
* @param column - Integer > 0 (default 12).
|
|
217
|
-
* @param layout specify the type of re-layout that will happen (position, size, etc...).
|
|
218
|
-
* Note: items will never be outside of the current column boundaries. default ('moveScale'). Ignored for 1 column
|
|
219
|
-
*/
|
|
220
|
-
column(column: number, layout?: ColumnOptions): GridStack;
|
|
221
|
-
/**
|
|
222
|
-
* get the number of columns in the grid (default 12)
|
|
223
|
-
*/
|
|
224
|
-
getColumn(): number;
|
|
225
|
-
/** returns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order */
|
|
226
|
-
getGridItems(): GridItemHTMLElement[];
|
|
227
|
-
/** true if changeCB should be ignored due to column change, sizeToContent, loading, etc... which caller can ignore for dirty flag case */
|
|
228
|
-
isIgnoreChangeCB(): boolean;
|
|
229
|
-
/**
|
|
230
|
-
* Destroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members.
|
|
231
|
-
* @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).
|
|
232
|
-
*/
|
|
233
|
-
destroy(removeDOM?: boolean): GridStack;
|
|
234
|
-
/**
|
|
235
|
-
* enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html)
|
|
236
|
-
*/
|
|
237
|
-
float(val: boolean): GridStack;
|
|
238
|
-
/**
|
|
239
|
-
* get the current float mode
|
|
240
|
-
*/
|
|
241
|
-
getFloat(): boolean;
|
|
242
|
-
/**
|
|
243
|
-
* Get the position of the cell under a pixel on screen.
|
|
244
|
-
* @param position the position of the pixel to resolve in
|
|
245
|
-
* absolute coordinates, as an object with top and left properties
|
|
246
|
-
* @param useDocRelative if true, value will be based on document position vs parent position (Optional. Default false).
|
|
247
|
-
* Useful when grid is within `position: relative` element
|
|
248
|
-
*
|
|
249
|
-
* Returns an object with properties `x` and `y` i.e. the column and row in the grid.
|
|
250
|
-
*/
|
|
251
|
-
getCellFromPixel(position: MousePosition, useDocRelative?: boolean): CellPosition;
|
|
252
|
-
/** returns the current number of rows, which will be at least `minRow` if set */
|
|
253
|
-
getRow(): number;
|
|
254
|
-
/**
|
|
255
|
-
* Checks if specified area is empty.
|
|
256
|
-
* @param x the position x.
|
|
257
|
-
* @param y the position y.
|
|
258
|
-
* @param w the width of to check
|
|
259
|
-
* @param h the height of to check
|
|
260
|
-
*/
|
|
261
|
-
isAreaEmpty(x: number, y: number, w: number, h: number): boolean;
|
|
262
|
-
/**
|
|
263
|
-
* If you add elements to your grid by hand (or have some framework creating DOM), you have to tell gridstack afterwards to make them widgets.
|
|
264
|
-
* If you want gridstack to add the elements for you, use `addWidget()` instead.
|
|
265
|
-
* Makes the given element a widget and returns it.
|
|
266
|
-
* @param els widget or single selector to convert.
|
|
267
|
-
* @param options widget definition to use instead of reading attributes or using default sizing values
|
|
268
|
-
*
|
|
269
|
-
* @example
|
|
270
|
-
* const grid = GridStack.init();
|
|
271
|
-
* grid.el.innerHtml = '<div id="1" gs-w="3"></div><div id="2"></div>';
|
|
272
|
-
* grid.makeWidget('1');
|
|
273
|
-
* grid.makeWidget('2', {w:2, content: 'hello'});
|
|
274
|
-
*/
|
|
275
|
-
makeWidget(els: GridStackElement, options?: GridStackWidget): GridItemHTMLElement;
|
|
276
|
-
/**
|
|
277
|
-
* Event handler that extracts our CustomEvent data out automatically for receiving custom
|
|
278
|
-
* notifications (see doc for supported events)
|
|
279
|
-
* @param name of the event (see possible values) or list of names space separated
|
|
280
|
-
* @param callback function called with event and optional second/third param
|
|
281
|
-
* (see README documentation for each signature).
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* grid.on('added', function(e, items) { log('added ', items)} );
|
|
285
|
-
* or
|
|
286
|
-
* grid.on('added removed change', function(e, items) { log(e.type, items)} );
|
|
287
|
-
*
|
|
288
|
-
* Note: in some cases it is the same as calling native handler and parsing the event.
|
|
289
|
-
* grid.el.addEventListener('added', function(event) { log('added ', event.detail)} );
|
|
290
|
-
*
|
|
291
|
-
*/
|
|
292
|
-
on(name: 'dropped', callback: GridStackDroppedHandler): GridStack;
|
|
293
|
-
on(name: 'enable' | 'disable', callback: GridStackEventHandler): GridStack;
|
|
294
|
-
on(name: 'change' | 'added' | 'removed' | 'resizecontent', callback: GridStackNodesHandler): GridStack;
|
|
295
|
-
on(name: 'resizestart' | 'resize' | 'resizestop' | 'dragstart' | 'drag' | 'dragstop', callback: GridStackElementHandler): GridStack;
|
|
296
|
-
on(name: string, callback: GridStackEventHandlerCallback): GridStack;
|
|
297
|
-
/**
|
|
298
|
-
* unsubscribe from the 'on' event GridStackEvent
|
|
299
|
-
* @param name of the event (see possible values) or list of names space separated
|
|
300
|
-
*/
|
|
301
|
-
off(name: GridStackEvent | string): GridStack;
|
|
302
|
-
/** remove all event handlers */
|
|
303
|
-
offAll(): GridStack;
|
|
304
|
-
/**
|
|
305
|
-
* Removes widget from the grid.
|
|
306
|
-
* @param el widget or selector to modify
|
|
307
|
-
* @param removeDOM if `false` DOM element won't be removed from the tree (Default? true).
|
|
308
|
-
* @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).
|
|
309
|
-
*/
|
|
310
|
-
removeWidget(els: GridStackElement, removeDOM?: boolean, triggerEvent?: boolean): GridStack;
|
|
311
|
-
/**
|
|
312
|
-
* Removes all widgets from the grid.
|
|
313
|
-
* @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).
|
|
314
|
-
* @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).
|
|
315
|
-
*/
|
|
316
|
-
removeAll(removeDOM?: boolean, triggerEvent?: boolean): GridStack;
|
|
317
|
-
/**
|
|
318
|
-
* Toggle the grid animation state. Toggles the `grid-stack-animate` class.
|
|
319
|
-
* @param doAnimate if true the grid will animate.
|
|
320
|
-
* @param delay if true setting will be set on next event loop.
|
|
321
|
-
*/
|
|
322
|
-
setAnimation(doAnimate?: boolean, delay?: boolean): GridStack;
|
|
323
|
-
/**
|
|
324
|
-
* Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.
|
|
325
|
-
* Also toggle the grid-stack-static class.
|
|
326
|
-
* @param val if true the grid become static.
|
|
327
|
-
* @param updateClass true (default) if css class gets updated
|
|
328
|
-
* @param recurse true (default) if sub-grids also get updated
|
|
329
|
-
*/
|
|
330
|
-
setStatic(val: boolean, updateClass?: boolean, recurse?: boolean): GridStack;
|
|
331
|
-
/**
|
|
332
|
-
* Updates the passed in options on the grid (similar to update(widget) for for the grid options).
|
|
333
|
-
* @param options PARTIAL grid options to update - only items specified will be updated.
|
|
334
|
-
* NOTE: not all options updating are currently supported (lot of code, unlikely to change)
|
|
335
|
-
*/
|
|
336
|
-
updateOptions(o: GridStackOptions): GridStack;
|
|
337
|
-
/**
|
|
338
|
-
* Updates widget position/size and other info. Note: if you need to call this on all nodes, use load() instead which will update what changed.
|
|
339
|
-
* @param els widget or selector of objects to modify (note: setting the same x,y for multiple items will be indeterministic and likely unwanted)
|
|
340
|
-
* @param opt new widget options (x,y,w,h, etc..). Only those set will be updated.
|
|
341
|
-
*/
|
|
342
|
-
update(els: GridStackElement, opt: GridStackWidget): GridStack;
|
|
343
|
-
private moveNode;
|
|
344
|
-
/**
|
|
345
|
-
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
|
|
346
|
-
* Note: this assumes only 1 child under resizeToContentParent='.grid-stack-item-content' (sized to gridItem minus padding) that is at the entire content size wanted.
|
|
347
|
-
* @param el grid item element
|
|
348
|
-
* @param useNodeH set to true if GridStackNode.h should be used instead of actual container height when we don't need to wait for animation to finish to get actual DOM heights
|
|
349
|
-
*/
|
|
350
|
-
resizeToContent(el: GridItemHTMLElement): void;
|
|
351
|
-
/** call the user resize (so they can do extra work) else our build in version */
|
|
352
|
-
private resizeToContentCBCheck;
|
|
353
|
-
/** rotate (by swapping w & h) the passed in node - called when user press 'r' during dragging
|
|
354
|
-
* @param els widget or selector of objects to modify
|
|
355
|
-
* @param relative optional pixel coord relative to upper/left corner to rotate around (will keep that cell under cursor)
|
|
356
|
-
*/
|
|
357
|
-
rotate(els: GridStackElement, relative?: Position): GridStack;
|
|
358
|
-
/**
|
|
359
|
-
* 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).
|
|
360
|
-
* @param value margin value
|
|
361
|
-
*/
|
|
362
|
-
margin(value: numberOrString): GridStack;
|
|
363
|
-
/** returns current margin number value (undefined if 4 sides don't match) */
|
|
364
|
-
getMargin(): number;
|
|
365
|
-
/**
|
|
366
|
-
* Returns true if the height of the grid will be less than the vertical
|
|
367
|
-
* constraint. Always returns true if grid doesn't have height constraint.
|
|
368
|
-
* @param node contains x,y,w,h,auto-position options
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
* if (grid.willItFit(newWidget)) {
|
|
372
|
-
* grid.addWidget(newWidget);
|
|
373
|
-
* } else {
|
|
374
|
-
* alert('Not enough free space to place the widget');
|
|
375
|
-
* }
|
|
376
|
-
*/
|
|
377
|
-
willItFit(node: GridStackWidget): boolean;
|
|
378
|
-
/**
|
|
379
|
-
* called when we are being resized - check if the one Column Mode needs to be turned on/off
|
|
380
|
-
* and remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)
|
|
381
|
-
* or `sizeToContent` gridItem options.
|
|
382
|
-
*/
|
|
383
|
-
onResize(clientWidth?: number): GridStack;
|
|
384
|
-
/** resizes content for given node (or all) if shouldSizeToContent() is true */
|
|
385
|
-
private resizeToContentCheck;
|
|
386
|
-
/** add or remove the grid element size event handler */
|
|
387
|
-
protected _updateResizeEvent(forceRemove?: boolean): GridStack;
|
|
388
|
-
static GDRev: string;
|
|
389
|
-
/** get the global (but static to this code) DD implementation */
|
|
390
|
-
static getDD(): DDGridStack;
|
|
391
|
-
/**
|
|
392
|
-
* call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
393
|
-
* Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar
|
|
394
|
-
* is dynamically create and needs to be set later.
|
|
395
|
-
* @param dragIn string selector (ex: '.sidebar-item') or list of dom elements
|
|
396
|
-
* @param dragInOptions options - see DDDragOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}
|
|
397
|
-
* @param widgets GridStackWidget def to assign to each element which defines what to create on drop
|
|
398
|
-
* @param root optional root which defaults to document (for shadow dom pass the parent HTMLDocument)
|
|
399
|
-
*/
|
|
400
|
-
static setupDragIn(dragIn?: string | HTMLElement[], dragInOptions?: DDDragOpt, widgets?: GridStackWidget[], root?: HTMLElement | Document): void;
|
|
401
|
-
/**
|
|
402
|
-
* 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.
|
|
403
|
-
* IF you are looking to prevent an item from moving (due to being pushed around by another during collision) use locked property instead.
|
|
404
|
-
* @param els widget or selector to modify.
|
|
405
|
-
* @param val if true widget will be draggable, assuming the parent grid isn't noMove or static.
|
|
406
|
-
*/
|
|
407
|
-
movable(els: GridStackElement, val: boolean): GridStack;
|
|
408
|
-
/**
|
|
409
|
-
* Enables/Disables user resizing of specific grid element. If you want all items, and have it affect future items, use enableResize() instead. No-op for static grids.
|
|
410
|
-
* @param els widget or selector to modify
|
|
411
|
-
* @param val if true widget will be resizable, assuming the parent grid isn't noResize or static.
|
|
412
|
-
*/
|
|
413
|
-
resizable(els: GridStackElement, val: boolean): GridStack;
|
|
414
|
-
/**
|
|
415
|
-
* Temporarily disables widgets moving/resizing.
|
|
416
|
-
* If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.
|
|
417
|
-
* Note: no-op for static grid
|
|
418
|
-
* This is a shortcut for:
|
|
419
|
-
* @example
|
|
420
|
-
* grid.enableMove(false);
|
|
421
|
-
* grid.enableResize(false);
|
|
422
|
-
* @param recurse true (default) if sub-grids also get updated
|
|
423
|
-
*/
|
|
424
|
-
disable(recurse?: boolean): GridStack;
|
|
425
|
-
/**
|
|
426
|
-
* Re-enables widgets moving/resizing - see disable().
|
|
427
|
-
* Note: no-op for static grid.
|
|
428
|
-
* This is a shortcut for:
|
|
429
|
-
* @example
|
|
430
|
-
* grid.enableMove(true);
|
|
431
|
-
* grid.enableResize(true);
|
|
432
|
-
* @param recurse true (default) if sub-grids also get updated
|
|
433
|
-
*/
|
|
434
|
-
enable(recurse?: boolean): GridStack;
|
|
435
|
-
/**
|
|
436
|
-
* Enables/disables widget moving. No-op for static grids, and locally defined items still overrule
|
|
437
|
-
* @param recurse true (default) if sub-grids also get updated
|
|
438
|
-
*/
|
|
439
|
-
enableMove(doEnable: boolean, recurse?: boolean): GridStack;
|
|
440
|
-
/**
|
|
441
|
-
* Enables/disables widget resizing. No-op for static grids.
|
|
442
|
-
* @param recurse true (default) if sub-grids also get updated
|
|
443
|
-
*/
|
|
444
|
-
enableResize(doEnable: boolean, recurse?: boolean): GridStack;
|
|
445
|
-
/**
|
|
446
|
-
* prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
447
|
-
* @param el GridItemHTMLElement of the widget
|
|
448
|
-
* @param [force=false]
|
|
449
|
-
* */
|
|
450
|
-
prepareDragDrop(el: GridItemHTMLElement, force?: boolean): GridStack;
|
|
451
|
-
commit(): GridStack;
|
|
452
|
-
}
|