gridstack 12.3.2 → 12.3.3
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/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 +2 -2
- 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 +4 -4
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +5 -5
- 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/package.json +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 +1 -1
- package/dist/angular/src/gridstack.module.ts +1 -1
- package/dist/angular/src/types.ts +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.css +1 -1
- package/dist/spec/gridstack-engine-spec.d.ts +1 -0
- package/dist/spec/gridstack-engine-spec.js +358 -0
- package/dist/spec/gridstack-engine-spec.js.map +1 -0
- package/dist/spec/gridstack-spec.d.ts +1 -0
- package/dist/spec/gridstack-spec.js +1780 -0
- package/dist/spec/gridstack-spec.js.map +1 -0
- package/dist/spec/integration/gridstack-integration.spec.d.ts +1 -0
- package/dist/spec/integration/gridstack-integration.spec.js +171 -0
- package/dist/spec/integration/gridstack-integration.spec.js.map +1 -0
- package/dist/spec/regression-spec.d.ts +1 -0
- package/dist/spec/regression-spec.js +100 -0
- package/dist/spec/regression-spec.js.map +1 -0
- package/dist/spec/utils-spec.d.ts +1 -0
- package/dist/spec/utils-spec.js +243 -0
- package/dist/spec/utils-spec.js.map +1 -0
- package/dist/src/dd-base-impl.d.ts +69 -0
- package/dist/src/dd-base-impl.js +70 -0
- package/dist/src/dd-base-impl.js.map +1 -0
- package/dist/src/dd-draggable.d.ts +20 -0
- package/dist/src/dd-draggable.js +364 -0
- package/dist/src/dd-draggable.js.map +1 -0
- package/dist/src/dd-droppable.d.ts +26 -0
- package/dist/src/dd-droppable.js +149 -0
- package/dist/src/dd-droppable.js.map +1 -0
- package/dist/src/dd-element.d.ts +27 -0
- package/dist/src/dd-element.js +91 -0
- package/dist/src/dd-element.js.map +1 -0
- package/dist/src/dd-gridstack.d.ts +82 -0
- package/dist/src/dd-gridstack.js +165 -0
- package/dist/src/dd-gridstack.js.map +1 -0
- package/dist/src/dd-manager.d.ts +43 -0
- package/dist/src/dd-manager.js +14 -0
- package/dist/src/dd-manager.js.map +1 -0
- package/dist/src/dd-resizable-handle.d.ts +18 -0
- package/dist/src/dd-resizable-handle.js +113 -0
- package/dist/src/dd-resizable-handle.js.map +1 -0
- package/dist/src/dd-resizable.d.ts +30 -0
- package/dist/src/dd-resizable.js +304 -0
- package/dist/src/dd-resizable.js.map +1 -0
- package/dist/src/dd-touch.d.ts +33 -0
- package/dist/src/dd-touch.js +145 -0
- package/dist/src/dd-touch.js.map +1 -0
- package/dist/src/gridstack-engine.d.ts +321 -0
- package/dist/src/gridstack-engine.js +1272 -0
- package/dist/src/gridstack-engine.js.map +1 -0
- package/dist/src/gridstack.d.ts +802 -0
- package/dist/src/gridstack.js +2872 -0
- package/dist/src/gridstack.js.map +1 -0
- package/dist/src/gridstack.scss +1 -1
- package/dist/src/types.d.ts +427 -0
- package/dist/src/types.js +38 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +283 -0
- package/dist/src/utils.js +790 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +74 -0
- package/dist/vitest.config.js.map +1 -0
- package/dist/vitest.setup.d.ts +1 -0
- package/dist/vitest.setup.js +90 -0
- package/dist/vitest.setup.js.map +1 -0
- package/doc/API.md +22 -22
- package/package.json +21 -9
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts 12.3.3
|
|
3
|
+
* Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
|
|
4
|
+
*/
|
|
5
|
+
import { GridStack } from './gridstack';
|
|
6
|
+
import { GridStackEngine } from './gridstack-engine';
|
|
7
|
+
/**
|
|
8
|
+
* Default values for grid options - used during initialization and when saving out grid configuration.
|
|
9
|
+
* These values are applied when options are not explicitly provided.
|
|
10
|
+
*/
|
|
11
|
+
export declare const gridDefaults: GridStackOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Different layout options when changing the number of columns.
|
|
14
|
+
*
|
|
15
|
+
* These options control how widgets are repositioned when the grid column count changes.
|
|
16
|
+
* Note: The new list may be partially filled if there's a cached layout for that size.
|
|
17
|
+
*
|
|
18
|
+
* Options:
|
|
19
|
+
* - `'list'`: Treat items as a sorted list, keeping them sequentially without resizing (unless too big)
|
|
20
|
+
* - `'compact'`: Similar to list, but uses compact() method to fill empty slots by reordering
|
|
21
|
+
* - `'moveScale'`: Scale and move items by the ratio of newColumnCount / oldColumnCount
|
|
22
|
+
* - `'move'`: Only move items, keep their sizes
|
|
23
|
+
* - `'scale'`: Only scale items, keep their positions
|
|
24
|
+
* - `'none'`: Leave items unchanged unless they don't fit in the new column count
|
|
25
|
+
* - Custom function: Provide your own layout logic
|
|
26
|
+
*/
|
|
27
|
+
export type ColumnOptions = 'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' | ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);
|
|
28
|
+
/**
|
|
29
|
+
* Options for the compact() method to reclaim empty space.
|
|
30
|
+
* - `'list'`: Keep items in order, move them up sequentially
|
|
31
|
+
* - `'compact'`: Find truly empty spaces, may reorder items for optimal fit
|
|
32
|
+
*/
|
|
33
|
+
export type CompactOptions = 'list' | 'compact';
|
|
34
|
+
/**
|
|
35
|
+
* Type representing values that can be either numbers or strings (e.g., dimensions with units).
|
|
36
|
+
* Used for properties like width, height, margins that accept both numeric and string values.
|
|
37
|
+
*/
|
|
38
|
+
export type numberOrString = number | string;
|
|
39
|
+
/**
|
|
40
|
+
* Extended HTMLElement interface for grid items.
|
|
41
|
+
* All grid item DOM elements implement this interface to provide access to their grid data.
|
|
42
|
+
*/
|
|
43
|
+
export interface GridItemHTMLElement extends HTMLElement {
|
|
44
|
+
/** Pointer to the associated grid node instance containing position, size, and other widget data */
|
|
45
|
+
gridstackNode?: GridStackNode;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Type representing various ways to specify grid elements.
|
|
49
|
+
* Can be a CSS selector string, HTMLElement, or GridItemHTMLElement.
|
|
50
|
+
*/
|
|
51
|
+
export type GridStackElement = string | HTMLElement | GridItemHTMLElement;
|
|
52
|
+
/**
|
|
53
|
+
* Event handler function types for the .on() method.
|
|
54
|
+
* Different handlers receive different parameters based on the event type.
|
|
55
|
+
*/
|
|
56
|
+
/** General event handler that receives only the event */
|
|
57
|
+
export type GridStackEventHandler = (event: Event) => void;
|
|
58
|
+
/** Element-specific event handler that receives event and affected element */
|
|
59
|
+
export type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;
|
|
60
|
+
/** Node-based event handler that receives event and array of affected nodes */
|
|
61
|
+
export type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;
|
|
62
|
+
/** Drop event handler that receives previous and new node states */
|
|
63
|
+
export type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;
|
|
64
|
+
/** Union type of all possible event handler types */
|
|
65
|
+
export type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;
|
|
66
|
+
/**
|
|
67
|
+
* Optional callback function called during load() operations.
|
|
68
|
+
* Allows custom handling of widget addition/removal for framework integration.
|
|
69
|
+
*
|
|
70
|
+
* @param parent - The parent HTML element
|
|
71
|
+
* @param w - The widget definition
|
|
72
|
+
* @param add - True if adding, false if removing
|
|
73
|
+
* @param grid - True if this is a grid operation
|
|
74
|
+
* @returns The created/modified HTML element, or undefined
|
|
75
|
+
*/
|
|
76
|
+
export type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Optional callback function called during save() operations.
|
|
79
|
+
* Allows adding custom data to the saved widget structure.
|
|
80
|
+
*
|
|
81
|
+
* @param node - The internal grid node
|
|
82
|
+
* @param w - The widget structure being saved (can be modified)
|
|
83
|
+
*/
|
|
84
|
+
export type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Optional callback function for custom widget content rendering.
|
|
87
|
+
* Called during load()/addWidget() to create custom content beyond plain text.
|
|
88
|
+
*
|
|
89
|
+
* @param el - The widget's content container element
|
|
90
|
+
* @param w - The widget definition with content and other properties
|
|
91
|
+
*/
|
|
92
|
+
export type RenderFcn = (el: HTMLElement, w: GridStackWidget) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Optional callback function for custom resize-to-content behavior.
|
|
95
|
+
* Called when a widget needs to resize to fit its content.
|
|
96
|
+
*
|
|
97
|
+
* @param el - The grid item element to resize
|
|
98
|
+
*/
|
|
99
|
+
export type ResizeToContentFcn = (el: GridItemHTMLElement) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for responsive grid behavior.
|
|
102
|
+
*
|
|
103
|
+
* Defines how the grid responds to different screen sizes by changing column counts.
|
|
104
|
+
* NOTE: Make sure to include the appropriate CSS (gridstack-extra.css) to support responsive behavior.
|
|
105
|
+
*/
|
|
106
|
+
export interface Responsive {
|
|
107
|
+
/** wanted width to maintain (+-50%) to dynamically pick a column count. NOTE: make sure to have correct extra CSS to support this. */
|
|
108
|
+
columnWidth?: number;
|
|
109
|
+
/** maximum number of columns allowed (default: 12). NOTE: make sure to have correct extra CSS to support this. */
|
|
110
|
+
columnMax?: number;
|
|
111
|
+
/** explicit width:column breakpoints instead of automatic 'columnWidth'. NOTE: make sure to have correct extra CSS to support this. */
|
|
112
|
+
breakpoints?: Breakpoint[];
|
|
113
|
+
/** specify if breakpoints are for window size or grid size (default:false = grid) */
|
|
114
|
+
breakpointForWindow?: boolean;
|
|
115
|
+
/** global re-layout mode when changing columns */
|
|
116
|
+
layout?: ColumnOptions;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Defines a responsive breakpoint for automatic column count changes.
|
|
120
|
+
* Used with the responsive.breakpoints option.
|
|
121
|
+
*/
|
|
122
|
+
export interface Breakpoint {
|
|
123
|
+
/** Maximum width (in pixels) for this breakpoint to be active */
|
|
124
|
+
w?: number;
|
|
125
|
+
/** Number of columns to use when this breakpoint is active */
|
|
126
|
+
c: number;
|
|
127
|
+
/** Layout mode for this specific breakpoint (overrides global responsive.layout) */
|
|
128
|
+
layout?: ColumnOptions;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Defines the options for a Grid
|
|
132
|
+
*/
|
|
133
|
+
export interface GridStackOptions {
|
|
134
|
+
/**
|
|
135
|
+
* Accept widgets dragged from other grids or from outside (default: `false`). Can be:
|
|
136
|
+
* - `true`: will accept HTML elements having 'grid-stack-item' as class attribute
|
|
137
|
+
* - `false`: will not accept any external widgets
|
|
138
|
+
* - string: explicit class name to accept instead of default
|
|
139
|
+
* - function: callback called before an item will be accepted when entering a grid
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* // Accept all grid items
|
|
143
|
+
* acceptWidgets: true
|
|
144
|
+
*
|
|
145
|
+
* // Accept only items with specific class
|
|
146
|
+
* acceptWidgets: 'my-draggable-item'
|
|
147
|
+
*
|
|
148
|
+
* // Custom validation function
|
|
149
|
+
* acceptWidgets: (el) => {
|
|
150
|
+
* return el.getAttribute('data-accept') === 'true';
|
|
151
|
+
* }
|
|
152
|
+
*
|
|
153
|
+
* @see {@link http://gridstack.github.io/gridstack.js/demo/two.html} for complete example
|
|
154
|
+
*/
|
|
155
|
+
acceptWidgets?: boolean | string | ((element: Element) => boolean);
|
|
156
|
+
/** possible values (default: `mobile`) - does not apply to non-resizable widgets
|
|
157
|
+
* `false` the resizing handles are only shown while hovering over a widget
|
|
158
|
+
* `true` the resizing handles are always shown
|
|
159
|
+
* 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.
|
|
160
|
+
See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */
|
|
161
|
+
alwaysShowResizeHandle?: true | false | 'mobile';
|
|
162
|
+
/** turns animation on (default?: true) */
|
|
163
|
+
animate?: boolean;
|
|
164
|
+
/** if false gridstack will not initialize existing items (default?: true) */
|
|
165
|
+
auto?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* One cell height (default: 'auto'). Can be:
|
|
168
|
+
* - an integer (px): fixed pixel height
|
|
169
|
+
* - a string (ex: '100px', '10em', '10rem'): CSS length value
|
|
170
|
+
* - 0: library will not generate styles for rows (define your own CSS)
|
|
171
|
+
* - 'auto': height calculated for square cells (width / column) and updated live on window resize
|
|
172
|
+
* - 'initial': similar to 'auto' but stays fixed size during window resizing
|
|
173
|
+
*
|
|
174
|
+
* Note: % values don't work correctly - see demo/cell-height.html
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* // Fixed 100px height
|
|
178
|
+
* cellHeight: 100
|
|
179
|
+
*
|
|
180
|
+
* // CSS units
|
|
181
|
+
* cellHeight: '5rem'
|
|
182
|
+
* cellHeight: '100px'
|
|
183
|
+
*
|
|
184
|
+
* // Auto-sizing for square cells
|
|
185
|
+
* cellHeight: 'auto'
|
|
186
|
+
*
|
|
187
|
+
* // No CSS generation (custom styles)
|
|
188
|
+
* cellHeight: 0
|
|
189
|
+
*/
|
|
190
|
+
cellHeight?: numberOrString;
|
|
191
|
+
/** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).
|
|
192
|
+
* A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!
|
|
193
|
+
* */
|
|
194
|
+
cellHeightThrottle?: number;
|
|
195
|
+
/** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */
|
|
196
|
+
cellHeightUnit?: string;
|
|
197
|
+
/** list of children item to create when calling load() or addGrid() */
|
|
198
|
+
children?: GridStackWidget[];
|
|
199
|
+
/** number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns.
|
|
200
|
+
* Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside
|
|
201
|
+
* items always the same. flag is NOT supported for regular non-nested grids.
|
|
202
|
+
*/
|
|
203
|
+
column?: number | 'auto';
|
|
204
|
+
/** responsive column layout for width:column behavior */
|
|
205
|
+
columnOpts?: Responsive;
|
|
206
|
+
/** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.
|
|
207
|
+
Note: only used by addGrid(), else your element should have the needed class */
|
|
208
|
+
class?: string;
|
|
209
|
+
/** disallows dragging of widgets (default?: false) */
|
|
210
|
+
disableDrag?: boolean;
|
|
211
|
+
/** disallows resizing of widgets (default?: false). */
|
|
212
|
+
disableResize?: boolean;
|
|
213
|
+
/** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */
|
|
214
|
+
draggable?: DDDragOpt;
|
|
215
|
+
/** let user drag nested grid items out of a parent or not (default true - not supported yet) */
|
|
216
|
+
/** the type of engine to create (so you can subclass) default to GridStackEngine */
|
|
217
|
+
engineClass?: typeof GridStackEngine;
|
|
218
|
+
/** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */
|
|
219
|
+
float?: boolean;
|
|
220
|
+
/** draggable handle selector (default?: '.grid-stack-item-content') */
|
|
221
|
+
handle?: string;
|
|
222
|
+
/** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */
|
|
223
|
+
handleClass?: string;
|
|
224
|
+
/** additional widget class (default?: 'grid-stack-item') */
|
|
225
|
+
itemClass?: string;
|
|
226
|
+
/** re-layout mode when we're a subgrid and we are being resized. default to 'list' */
|
|
227
|
+
layout?: ColumnOptions;
|
|
228
|
+
/** true when widgets are only created when they scroll into view (visible) */
|
|
229
|
+
lazyLoad?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below
|
|
232
|
+
* an integer (px)
|
|
233
|
+
* a string with possible units (ex: '2em', '20px', '2rem')
|
|
234
|
+
* string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS).
|
|
235
|
+
* Note: all sides must have same units (last one wins, default px)
|
|
236
|
+
*/
|
|
237
|
+
margin?: numberOrString;
|
|
238
|
+
/** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */
|
|
239
|
+
marginTop?: numberOrString;
|
|
240
|
+
marginRight?: numberOrString;
|
|
241
|
+
marginBottom?: numberOrString;
|
|
242
|
+
marginLeft?: numberOrString;
|
|
243
|
+
/** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */
|
|
244
|
+
marginUnit?: string;
|
|
245
|
+
/** maximum rows amount. Default? is 0 which means no maximum rows */
|
|
246
|
+
maxRow?: number;
|
|
247
|
+
/** minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`.
|
|
248
|
+
* When no set the `min-height` CSS attribute on the grid div (in pixels) can be used, which will round to the closest row.
|
|
249
|
+
*/
|
|
250
|
+
minRow?: number;
|
|
251
|
+
/** If you are using a nonce-based Content Security Policy, pass your nonce here and
|
|
252
|
+
* GridStack will add it to the <style> elements it creates. */
|
|
253
|
+
nonce?: string;
|
|
254
|
+
/** class for placeholder (default?: 'grid-stack-placeholder') */
|
|
255
|
+
placeholderClass?: string;
|
|
256
|
+
/** placeholder default content (default?: '') */
|
|
257
|
+
placeholderText?: string;
|
|
258
|
+
/** allows to override UI resizable options. (default?: { handles: 'se' }) */
|
|
259
|
+
resizable?: DDResizeOpt;
|
|
260
|
+
/**
|
|
261
|
+
* if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: ".trash"),
|
|
262
|
+
* in this case widgets will be removed by dropping them there (default?: false)
|
|
263
|
+
* See example (http://gridstack.github.io/gridstack.js/demo/two.html)
|
|
264
|
+
*/
|
|
265
|
+
removable?: boolean | string;
|
|
266
|
+
/** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */
|
|
267
|
+
removableOptions?: DDRemoveOpt;
|
|
268
|
+
/** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */
|
|
269
|
+
row?: number;
|
|
270
|
+
/**
|
|
271
|
+
* if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')
|
|
272
|
+
* See [example](http://gridstack.github.io/gridstack.js/demo/right-to-left(rtl).html)
|
|
273
|
+
*/
|
|
274
|
+
rtl?: boolean | 'auto';
|
|
275
|
+
/** set to true if all grid items (by default, but item can also override) height should be based on content size instead of WidgetItem.h to avoid v-scrollbars.
|
|
276
|
+
* Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight())
|
|
277
|
+
*/
|
|
278
|
+
sizeToContent?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* makes grid static (default?: false). If `true` widgets are not movable/resizable.
|
|
281
|
+
* You don't even need draggable/resizable. A CSS class
|
|
282
|
+
* 'grid-stack-static' is also added to the element.
|
|
283
|
+
*/
|
|
284
|
+
staticGrid?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* @deprecated Not used anymore, styles are now implemented with local CSS variables
|
|
287
|
+
*/
|
|
288
|
+
styleInHead?: boolean;
|
|
289
|
+
/** list of differences in options for automatically created sub-grids under us (inside our grid-items) */
|
|
290
|
+
subGridOpts?: GridStackOptions;
|
|
291
|
+
/** enable/disable the creation of sub-grids on the fly by dragging items completely
|
|
292
|
+
* over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */
|
|
293
|
+
subGridDynamic?: boolean;
|
|
294
|
+
}
|
|
295
|
+
/** options used during GridStackEngine.moveNode() */
|
|
296
|
+
export interface GridStackMoveOpts extends GridStackPosition {
|
|
297
|
+
/** node to skip collision */
|
|
298
|
+
skip?: GridStackNode;
|
|
299
|
+
/** do we pack (default true) */
|
|
300
|
+
pack?: boolean;
|
|
301
|
+
/** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/
|
|
302
|
+
nested?: boolean;
|
|
303
|
+
/** vars to calculate other cells coordinates */
|
|
304
|
+
cellWidth?: number;
|
|
305
|
+
cellHeight?: number;
|
|
306
|
+
marginTop?: number;
|
|
307
|
+
marginBottom?: number;
|
|
308
|
+
marginLeft?: number;
|
|
309
|
+
marginRight?: number;
|
|
310
|
+
/** position in pixels of the currently dragged items (for overlap check) */
|
|
311
|
+
rect?: GridStackPosition;
|
|
312
|
+
/** true if we're live resizing */
|
|
313
|
+
resizing?: boolean;
|
|
314
|
+
/** best node (most coverage) we collied with */
|
|
315
|
+
collide?: GridStackNode;
|
|
316
|
+
/** for collision check even if we don't move */
|
|
317
|
+
forceCollide?: boolean;
|
|
318
|
+
}
|
|
319
|
+
export interface GridStackPosition {
|
|
320
|
+
/** widget position x (default?: 0) */
|
|
321
|
+
x?: number;
|
|
322
|
+
/** widget position y (default?: 0) */
|
|
323
|
+
y?: number;
|
|
324
|
+
/** widget dimension width (default?: 1) */
|
|
325
|
+
w?: number;
|
|
326
|
+
/** widget dimension height (default?: 1) */
|
|
327
|
+
h?: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* GridStack Widget creation options
|
|
331
|
+
*/
|
|
332
|
+
export interface GridStackWidget extends GridStackPosition {
|
|
333
|
+
/** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */
|
|
334
|
+
autoPosition?: boolean;
|
|
335
|
+
/** minimum width allowed during resize/creation (default?: undefined = un-constrained) */
|
|
336
|
+
minW?: number;
|
|
337
|
+
/** maximum width allowed during resize/creation (default?: undefined = un-constrained) */
|
|
338
|
+
maxW?: number;
|
|
339
|
+
/** minimum height allowed during resize/creation (default?: undefined = un-constrained) */
|
|
340
|
+
minH?: number;
|
|
341
|
+
/** maximum height allowed during resize/creation (default?: undefined = un-constrained) */
|
|
342
|
+
maxH?: number;
|
|
343
|
+
/** prevent direct resizing by the user (default?: undefined = un-constrained) */
|
|
344
|
+
noResize?: boolean;
|
|
345
|
+
/** prevents direct moving by the user (default?: undefined = un-constrained) */
|
|
346
|
+
noMove?: boolean;
|
|
347
|
+
/** prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) */
|
|
348
|
+
locked?: boolean;
|
|
349
|
+
/** value for `gs-id` stored on the widget (default?: undefined) */
|
|
350
|
+
id?: string;
|
|
351
|
+
/** html to append inside as content */
|
|
352
|
+
content?: string;
|
|
353
|
+
/** true when widgets are only created when they scroll into view (visible) */
|
|
354
|
+
lazyLoad?: boolean;
|
|
355
|
+
/** local (vs grid) override - see GridStackOptions.
|
|
356
|
+
* Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) */
|
|
357
|
+
sizeToContent?: boolean | number;
|
|
358
|
+
/** local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height */
|
|
359
|
+
resizeToContentParent?: string;
|
|
360
|
+
/** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */
|
|
361
|
+
subGridOpts?: GridStackOptions;
|
|
362
|
+
}
|
|
363
|
+
/** Drag&Drop resize options */
|
|
364
|
+
export interface DDResizeOpt {
|
|
365
|
+
/** do resize handle hide by default until mouse over ? - default: true on desktop, false on mobile*/
|
|
366
|
+
autoHide?: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)
|
|
369
|
+
* Note: it is not recommended to resize from the top sides as weird side effect may occur.
|
|
370
|
+
*/
|
|
371
|
+
handles?: string;
|
|
372
|
+
}
|
|
373
|
+
/** Drag&Drop remove options */
|
|
374
|
+
export interface DDRemoveOpt {
|
|
375
|
+
/** class that can be removed (default?: opts.itemClass) */
|
|
376
|
+
accept?: string;
|
|
377
|
+
/** class that cannot be removed (default: 'grid-stack-non-removable') */
|
|
378
|
+
decline?: string;
|
|
379
|
+
}
|
|
380
|
+
/** Drag&Drop dragging options */
|
|
381
|
+
export interface DDDragOpt {
|
|
382
|
+
/** class selector of items that can be dragged. default to '.grid-stack-item-content' */
|
|
383
|
+
handle?: string;
|
|
384
|
+
/** default to 'body' */
|
|
385
|
+
appendTo?: string;
|
|
386
|
+
/** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */
|
|
387
|
+
pause?: boolean | number;
|
|
388
|
+
/** default to `true` */
|
|
389
|
+
scroll?: boolean;
|
|
390
|
+
/** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */
|
|
391
|
+
cancel?: string;
|
|
392
|
+
/** helper function when dropping: 'clone' or your own method */
|
|
393
|
+
helper?: 'clone' | ((el: HTMLElement) => HTMLElement);
|
|
394
|
+
/** callbacks */
|
|
395
|
+
start?: (event: Event, ui: DDUIData) => void;
|
|
396
|
+
stop?: (event: Event) => void;
|
|
397
|
+
drag?: (event: Event, ui: DDUIData) => void;
|
|
398
|
+
}
|
|
399
|
+
export interface Size {
|
|
400
|
+
width: number;
|
|
401
|
+
height: number;
|
|
402
|
+
}
|
|
403
|
+
export interface Position {
|
|
404
|
+
top: number;
|
|
405
|
+
left: number;
|
|
406
|
+
}
|
|
407
|
+
export interface Rect extends Size, Position {
|
|
408
|
+
}
|
|
409
|
+
/** data that is passed during drag and resizing callbacks */
|
|
410
|
+
export interface DDUIData {
|
|
411
|
+
position?: Position;
|
|
412
|
+
size?: Size;
|
|
413
|
+
draggable?: HTMLElement;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* internal runtime descriptions describing the widgets in the grid
|
|
417
|
+
*/
|
|
418
|
+
export interface GridStackNode extends GridStackWidget {
|
|
419
|
+
/** pointer back to HTML element */
|
|
420
|
+
el?: GridItemHTMLElement;
|
|
421
|
+
/** pointer back to parent Grid instance */
|
|
422
|
+
grid?: GridStack;
|
|
423
|
+
/** actual sub-grid instance */
|
|
424
|
+
subGrid?: GridStack;
|
|
425
|
+
/** allow delay creation when visible */
|
|
426
|
+
visibleObservable?: IntersectionObserver;
|
|
427
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts 12.3.3
|
|
3
|
+
* Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Default values for grid options - used during initialization and when saving out grid configuration.
|
|
7
|
+
* These values are applied when options are not explicitly provided.
|
|
8
|
+
*/
|
|
9
|
+
export const gridDefaults = {
|
|
10
|
+
alwaysShowResizeHandle: 'mobile',
|
|
11
|
+
animate: true,
|
|
12
|
+
auto: true,
|
|
13
|
+
cellHeight: 'auto',
|
|
14
|
+
cellHeightThrottle: 100,
|
|
15
|
+
cellHeightUnit: 'px',
|
|
16
|
+
column: 12,
|
|
17
|
+
draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },
|
|
18
|
+
handle: '.grid-stack-item-content',
|
|
19
|
+
itemClass: 'grid-stack-item',
|
|
20
|
+
margin: 10,
|
|
21
|
+
marginUnit: 'px',
|
|
22
|
+
maxRow: 0,
|
|
23
|
+
minRow: 0,
|
|
24
|
+
placeholderClass: 'grid-stack-placeholder',
|
|
25
|
+
placeholderText: '',
|
|
26
|
+
removableOptions: { accept: 'grid-stack-item', decline: 'grid-stack-non-removable' },
|
|
27
|
+
resizable: { handles: 'se' },
|
|
28
|
+
rtl: 'auto',
|
|
29
|
+
// **** same as not being set ****
|
|
30
|
+
// disableDrag: false,
|
|
31
|
+
// disableResize: false,
|
|
32
|
+
// float: false,
|
|
33
|
+
// handleClass: null,
|
|
34
|
+
// removable: false,
|
|
35
|
+
// staticGrid: false,
|
|
36
|
+
//removable
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,sBAAsB,EAAE,QAAQ;IAChC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,MAAM;IAClB,kBAAkB,EAAE,GAAG;IACvB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;IACjF,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,gBAAgB,EAAE,wBAAwB;IAC1C,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,0BAA0B,EAAC;IACnF,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,MAAM;IAEX,kCAAkC;IAClC,sBAAsB;IACtB,wBAAwB;IACxB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,WAAW;CACZ,CAAC","sourcesContent":["/**\r\n * types.ts 12.3.3\r\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStack } from './gridstack';\r\nimport { GridStackEngine } from './gridstack-engine';\r\n\r\n/**\r\n * Default values for grid options - used during initialization and when saving out grid configuration.\r\n * These values are applied when options are not explicitly provided.\r\n */\r\nexport const gridDefaults: GridStackOptions = {\r\n alwaysShowResizeHandle: 'mobile',\r\n animate: true,\r\n auto: true,\r\n cellHeight: 'auto',\r\n cellHeightThrottle: 100,\r\n cellHeightUnit: 'px',\r\n column: 12,\r\n draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },\r\n handle: '.grid-stack-item-content',\r\n itemClass: 'grid-stack-item',\r\n margin: 10,\r\n marginUnit: 'px',\r\n maxRow: 0,\r\n minRow: 0,\r\n placeholderClass: 'grid-stack-placeholder',\r\n placeholderText: '',\r\n removableOptions: { accept: 'grid-stack-item', decline: 'grid-stack-non-removable'},\r\n resizable: { handles: 'se' },\r\n rtl: 'auto',\r\n\r\n // **** same as not being set ****\r\n // disableDrag: false,\r\n // disableResize: false,\r\n // float: false,\r\n // handleClass: null,\r\n // removable: false,\r\n // staticGrid: false,\r\n //removable\r\n};\r\n\r\n/**\r\n * Different layout options when changing the number of columns.\r\n *\r\n * These options control how widgets are repositioned when the grid column count changes.\r\n * Note: The new list may be partially filled if there's a cached layout for that size.\r\n *\r\n * Options:\r\n * - `'list'`: Treat items as a sorted list, keeping them sequentially without resizing (unless too big)\r\n * - `'compact'`: Similar to list, but uses compact() method to fill empty slots by reordering\r\n * - `'moveScale'`: Scale and move items by the ratio of newColumnCount / oldColumnCount\r\n * - `'move'`: Only move items, keep their sizes\r\n * - `'scale'`: Only scale items, keep their positions\r\n * - `'none'`: Leave items unchanged unless they don't fit in the new column count\r\n * - Custom function: Provide your own layout logic\r\n */\r\nexport type ColumnOptions = 'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' |\r\n ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);\r\n/**\r\n * Options for the compact() method to reclaim empty space.\r\n * - `'list'`: Keep items in order, move them up sequentially\r\n * - `'compact'`: Find truly empty spaces, may reorder items for optimal fit\r\n */\r\nexport type CompactOptions = 'list' | 'compact';\r\n/**\r\n * Type representing values that can be either numbers or strings (e.g., dimensions with units).\r\n * Used for properties like width, height, margins that accept both numeric and string values.\r\n */\r\nexport type numberOrString = number | string;\r\n/**\r\n * Extended HTMLElement interface for grid items.\r\n * All grid item DOM elements implement this interface to provide access to their grid data.\r\n */\r\nexport interface GridItemHTMLElement extends HTMLElement {\r\n /** Pointer to the associated grid node instance containing position, size, and other widget data */\r\n gridstackNode?: GridStackNode;\r\n /** @internal Original node data (used for restoring during drag operations) */\r\n _gridstackNodeOrig?: GridStackNode;\r\n}\r\n\r\n/**\r\n * Type representing various ways to specify grid elements.\r\n * Can be a CSS selector string, HTMLElement, or GridItemHTMLElement.\r\n */\r\nexport type GridStackElement = string | HTMLElement | GridItemHTMLElement;\r\n\r\n/**\r\n * Event handler function types for the .on() method.\r\n * Different handlers receive different parameters based on the event type.\r\n */\r\n\r\n/** General event handler that receives only the event */\r\nexport type GridStackEventHandler = (event: Event) => void;\r\n\r\n/** Element-specific event handler that receives event and affected element */\r\nexport type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;\r\n\r\n/** Node-based event handler that receives event and array of affected nodes */\r\nexport type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;\r\n\r\n/** Drop event handler that receives previous and new node states */\r\nexport type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;\r\n\r\n/** Union type of all possible event handler types */\r\nexport type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;\r\n\r\n/**\r\n * Optional callback function called during load() operations.\r\n * Allows custom handling of widget addition/removal for framework integration.\r\n *\r\n * @param parent - The parent HTML element\r\n * @param w - The widget definition\r\n * @param add - True if adding, false if removing\r\n * @param grid - True if this is a grid operation\r\n * @returns The created/modified HTML element, or undefined\r\n */\r\nexport type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;\r\n\r\n/**\r\n * Optional callback function called during save() operations.\r\n * Allows adding custom data to the saved widget structure.\r\n *\r\n * @param node - The internal grid node\r\n * @param w - The widget structure being saved (can be modified)\r\n */\r\nexport type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;\r\n\r\n/**\r\n * Optional callback function for custom widget content rendering.\r\n * Called during load()/addWidget() to create custom content beyond plain text.\r\n *\r\n * @param el - The widget's content container element\r\n * @param w - The widget definition with content and other properties\r\n */\r\nexport type RenderFcn = (el: HTMLElement, w: GridStackWidget) => void;\r\n\r\n/**\r\n * Optional callback function for custom resize-to-content behavior.\r\n * Called when a widget needs to resize to fit its content.\r\n *\r\n * @param el - The grid item element to resize\r\n */\r\nexport type ResizeToContentFcn = (el: GridItemHTMLElement) => void;\r\n\r\n/**\r\n * Configuration for responsive grid behavior.\r\n *\r\n * Defines how the grid responds to different screen sizes by changing column counts.\r\n * NOTE: Make sure to include the appropriate CSS (gridstack-extra.css) to support responsive behavior.\r\n */\r\nexport interface Responsive {\r\n /** wanted width to maintain (+-50%) to dynamically pick a column count. NOTE: make sure to have correct extra CSS to support this. */\r\n columnWidth?: number;\r\n /** maximum number of columns allowed (default: 12). NOTE: make sure to have correct extra CSS to support this. */\r\n columnMax?: number;\r\n /** explicit width:column breakpoints instead of automatic 'columnWidth'. NOTE: make sure to have correct extra CSS to support this. */\r\n breakpoints?: Breakpoint[];\r\n /** specify if breakpoints are for window size or grid size (default:false = grid) */\r\n breakpointForWindow?: boolean;\r\n /** global re-layout mode when changing columns */\r\n layout?: ColumnOptions;\r\n}\r\n\r\n/**\r\n * Defines a responsive breakpoint for automatic column count changes.\r\n * Used with the responsive.breakpoints option.\r\n */\r\nexport interface Breakpoint {\r\n /** Maximum width (in pixels) for this breakpoint to be active */\r\n w?: number;\r\n /** Number of columns to use when this breakpoint is active */\r\n c: number;\r\n /** Layout mode for this specific breakpoint (overrides global responsive.layout) */\r\n layout?: ColumnOptions;\r\n /** TODO: Future feature - specific children layout for this breakpoint */\r\n // children?: GridStackWidget[];\r\n}\r\n\r\n/**\r\n * Defines the options for a Grid\r\n */\r\nexport interface GridStackOptions {\r\n /**\r\n * Accept widgets dragged from other grids or from outside (default: `false`). Can be:\r\n * - `true`: will accept HTML elements having 'grid-stack-item' as class attribute\r\n * - `false`: will not accept any external widgets\r\n * - string: explicit class name to accept instead of default\r\n * - function: callback called before an item will be accepted when entering a grid\r\n *\r\n * @example\r\n * // Accept all grid items\r\n * acceptWidgets: true\r\n *\r\n * // Accept only items with specific class\r\n * acceptWidgets: 'my-draggable-item'\r\n *\r\n * // Custom validation function\r\n * acceptWidgets: (el) => {\r\n * return el.getAttribute('data-accept') === 'true';\r\n * }\r\n *\r\n * @see {@link http://gridstack.github.io/gridstack.js/demo/two.html} for complete example\r\n */\r\n acceptWidgets?: boolean | string | ((element: Element) => boolean);\r\n\r\n /** possible values (default: `mobile`) - does not apply to non-resizable widgets\r\n * `false` the resizing handles are only shown while hovering over a widget\r\n * `true` the resizing handles are always shown\r\n * 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.\r\n See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */\r\n alwaysShowResizeHandle?: true | false | 'mobile';\r\n\r\n /** turns animation on (default?: true) */\r\n animate?: boolean;\r\n\r\n /** if false gridstack will not initialize existing items (default?: true) */\r\n auto?: boolean;\r\n\r\n /**\r\n * One cell height (default: 'auto'). Can be:\r\n * - an integer (px): fixed pixel height\r\n * - a string (ex: '100px', '10em', '10rem'): CSS length value\r\n * - 0: library will not generate styles for rows (define your own CSS)\r\n * - 'auto': height calculated for square cells (width / column) and updated live on window resize\r\n * - 'initial': similar to 'auto' but stays fixed size during window resizing\r\n *\r\n * Note: % values don't work correctly - see demo/cell-height.html\r\n *\r\n * @example\r\n * // Fixed 100px height\r\n * cellHeight: 100\r\n *\r\n * // CSS units\r\n * cellHeight: '5rem'\r\n * cellHeight: '100px'\r\n *\r\n * // Auto-sizing for square cells\r\n * cellHeight: 'auto'\r\n *\r\n * // No CSS generation (custom styles)\r\n * cellHeight: 0\r\n */\r\n cellHeight?: numberOrString;\r\n\r\n /** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).\r\n * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!\r\n * */\r\n cellHeightThrottle?: number;\r\n\r\n /** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */\r\n cellHeightUnit?: string;\r\n\r\n /** list of children item to create when calling load() or addGrid() */\r\n children?: GridStackWidget[];\r\n\r\n /** number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns.\r\n * Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside\r\n * items always the same. flag is NOT supported for regular non-nested grids.\r\n */\r\n column?: number | 'auto';\r\n\r\n /** responsive column layout for width:column behavior */\r\n columnOpts?: Responsive;\r\n\r\n /** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.\r\n Note: only used by addGrid(), else your element should have the needed class */\r\n class?: string;\r\n\r\n /** disallows dragging of widgets (default?: false) */\r\n disableDrag?: boolean;\r\n\r\n /** disallows resizing of widgets (default?: false). */\r\n disableResize?: boolean;\r\n\r\n /** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */\r\n draggable?: DDDragOpt;\r\n\r\n /** let user drag nested grid items out of a parent or not (default true - not supported yet) */\r\n //dragOut?: boolean;\r\n\r\n /** the type of engine to create (so you can subclass) default to GridStackEngine */\r\n engineClass?: typeof GridStackEngine;\r\n\r\n /** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */\r\n float?: boolean;\r\n\r\n /** draggable handle selector (default?: '.grid-stack-item-content') */\r\n handle?: string;\r\n\r\n /** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */\r\n handleClass?: string;\r\n\r\n /** additional widget class (default?: 'grid-stack-item') */\r\n itemClass?: string;\r\n\r\n /** re-layout mode when we're a subgrid and we are being resized. default to 'list' */\r\n layout?: ColumnOptions;\r\n\r\n /** true when widgets are only created when they scroll into view (visible) */\r\n lazyLoad?: boolean;\r\n\r\n /**\r\n * gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below\r\n * an integer (px)\r\n * a string with possible units (ex: '2em', '20px', '2rem')\r\n * string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS).\r\n * Note: all sides must have same units (last one wins, default px)\r\n */\r\n margin?: numberOrString;\r\n\r\n /** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */\r\n marginTop?: numberOrString;\r\n marginRight?: numberOrString;\r\n marginBottom?: numberOrString;\r\n marginLeft?: numberOrString;\r\n\r\n /** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */\r\n marginUnit?: string;\r\n\r\n /** maximum rows amount. Default? is 0 which means no maximum rows */\r\n maxRow?: number;\r\n\r\n /** minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`.\r\n * When no set the `min-height` CSS attribute on the grid div (in pixels) can be used, which will round to the closest row.\r\n */\r\n minRow?: number;\r\n\r\n /** If you are using a nonce-based Content Security Policy, pass your nonce here and\r\n * GridStack will add it to the <style> elements it creates. */\r\n nonce?: string;\r\n\r\n /** class for placeholder (default?: 'grid-stack-placeholder') */\r\n placeholderClass?: string;\r\n\r\n /** placeholder default content (default?: '') */\r\n placeholderText?: string;\r\n\r\n /** allows to override UI resizable options. (default?: { handles: 'se' }) */\r\n resizable?: DDResizeOpt;\r\n\r\n /**\r\n * if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: \".trash\"),\r\n * in this case widgets will be removed by dropping them there (default?: false)\r\n * See example (http://gridstack.github.io/gridstack.js/demo/two.html)\r\n */\r\n removable?: boolean | string;\r\n\r\n /** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */\r\n removableOptions?: DDRemoveOpt;\r\n\r\n /** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */\r\n row?: number;\r\n\r\n /**\r\n * if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')\r\n * See [example](http://gridstack.github.io/gridstack.js/demo/right-to-left(rtl).html)\r\n */\r\n rtl?: boolean | 'auto';\r\n\r\n /** set to true if all grid items (by default, but item can also override) height should be based on content size instead of WidgetItem.h to avoid v-scrollbars.\r\n * Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight())\r\n */\r\n sizeToContent?: boolean;\r\n\r\n /**\r\n * makes grid static (default?: false). If `true` widgets are not movable/resizable.\r\n * You don't even need draggable/resizable. A CSS class\r\n * 'grid-stack-static' is also added to the element.\r\n */\r\n staticGrid?: boolean;\r\n\r\n /**\r\n * @deprecated Not used anymore, styles are now implemented with local CSS variables\r\n */\r\n styleInHead?: boolean;\r\n\r\n /** list of differences in options for automatically created sub-grids under us (inside our grid-items) */\r\n subGridOpts?: GridStackOptions;\r\n\r\n /** enable/disable the creation of sub-grids on the fly by dragging items completely\r\n * over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */\r\n subGridDynamic?: boolean;\r\n}\r\n\r\n/** options used during GridStackEngine.moveNode() */\r\nexport interface GridStackMoveOpts extends GridStackPosition {\r\n /** node to skip collision */\r\n skip?: GridStackNode;\r\n /** do we pack (default true) */\r\n pack?: boolean;\r\n /** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/\r\n nested?: boolean;\r\n /** vars to calculate other cells coordinates */\r\n cellWidth?: number;\r\n cellHeight?: number;\r\n marginTop?: number;\r\n marginBottom?: number;\r\n marginLeft?: number;\r\n marginRight?: number;\r\n /** position in pixels of the currently dragged items (for overlap check) */\r\n rect?: GridStackPosition;\r\n /** true if we're live resizing */\r\n resizing?: boolean;\r\n /** best node (most coverage) we collied with */\r\n collide?: GridStackNode;\r\n /** for collision check even if we don't move */\r\n forceCollide?: boolean;\r\n}\r\n\r\nexport interface GridStackPosition {\r\n /** widget position x (default?: 0) */\r\n x?: number;\r\n /** widget position y (default?: 0) */\r\n y?: number;\r\n /** widget dimension width (default?: 1) */\r\n w?: number;\r\n /** widget dimension height (default?: 1) */\r\n h?: number;\r\n}\r\n\r\n/**\r\n * GridStack Widget creation options\r\n */\r\nexport interface GridStackWidget extends GridStackPosition {\r\n /** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */\r\n autoPosition?: boolean;\r\n /** minimum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n minW?: number;\r\n /** maximum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxW?: number;\r\n /** minimum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n minH?: number;\r\n /** maximum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxH?: number;\r\n /** prevent direct resizing by the user (default?: undefined = un-constrained) */\r\n noResize?: boolean;\r\n /** prevents direct moving by the user (default?: undefined = un-constrained) */\r\n noMove?: boolean;\r\n /** prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) */\r\n locked?: boolean;\r\n /** value for `gs-id` stored on the widget (default?: undefined) */\r\n id?: string;\r\n /** html to append inside as content */\r\n content?: string;\r\n /** true when widgets are only created when they scroll into view (visible) */\r\n lazyLoad?: boolean;\r\n /** local (vs grid) override - see GridStackOptions.\r\n * Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) */\r\n sizeToContent?: boolean | number;\r\n /** local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height */\r\n resizeToContentParent?: string;\r\n /** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */\r\n subGridOpts?: GridStackOptions;\r\n}\r\n\r\n/** Drag&Drop resize options */\r\nexport interface DDResizeOpt {\r\n /** do resize handle hide by default until mouse over ? - default: true on desktop, false on mobile*/\r\n autoHide?: boolean;\r\n /**\r\n * sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)\r\n * Note: it is not recommended to resize from the top sides as weird side effect may occur.\r\n */\r\n handles?: string;\r\n}\r\n\r\n/** Drag&Drop remove options */\r\nexport interface DDRemoveOpt {\r\n /** class that can be removed (default?: opts.itemClass) */\r\n accept?: string;\r\n /** class that cannot be removed (default: 'grid-stack-non-removable') */\r\n decline?: string;\r\n}\r\n\r\n/** Drag&Drop dragging options */\r\nexport interface DDDragOpt {\r\n /** class selector of items that can be dragged. default to '.grid-stack-item-content' */\r\n handle?: string;\r\n /** default to 'body' */\r\n appendTo?: string;\r\n /** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */\r\n pause?: boolean | number;\r\n /** default to `true` */\r\n scroll?: boolean;\r\n /** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */\r\n cancel?: string;\r\n /** helper function when dropping: 'clone' or your own method */\r\n helper?: 'clone' | ((el: HTMLElement) => HTMLElement);\r\n /** callbacks */\r\n start?: (event: Event, ui: DDUIData) => void;\r\n stop?: (event: Event) => void;\r\n drag?: (event: Event, ui: DDUIData) => void;\r\n}\r\nexport interface Size {\r\n width: number;\r\n height: number;\r\n}\r\nexport interface Position {\r\n top: number;\r\n left: number;\r\n}\r\nexport interface Rect extends Size, Position {}\r\n\r\n/** data that is passed during drag and resizing callbacks */\r\nexport interface DDUIData {\r\n position?: Position;\r\n size?: Size;\r\n draggable?: HTMLElement;\r\n /* fields not used by GridStack but sent by jq ? leave in case we go back to them...\r\n originalPosition? : Position;\r\n offset?: Position;\r\n originalSize?: Size;\r\n element?: HTMLElement[];\r\n helper?: HTMLElement[];\r\n originalElement?: HTMLElement[];\r\n */\r\n}\r\n\r\n/**\r\n * internal runtime descriptions describing the widgets in the grid\r\n */\r\nexport interface GridStackNode extends GridStackWidget {\r\n /** pointer back to HTML element */\r\n el?: GridItemHTMLElement;\r\n /** pointer back to parent Grid instance */\r\n grid?: GridStack;\r\n /** actual sub-grid instance */\r\n subGrid?: GridStack;\r\n /** allow delay creation when visible */\r\n visibleObservable?: IntersectionObserver;\r\n /** @internal internal id used to match when cloning engines or saving column layouts */\r\n _id?: number;\r\n /** @internal does the node attr ned to be updated due to changed x,y,w,h values */\r\n _dirty?: boolean;\r\n /** @internal */\r\n _updating?: boolean;\r\n /** @internal true when over trash/another grid so we don't bother removing drag CSS style that would animate back to old position */\r\n _isAboutToRemove?: boolean;\r\n /** @internal true if item came from outside of the grid -> actual item need to be moved over */\r\n _isExternal?: boolean;\r\n /** @internal Mouse event that's causing moving|resizing */\r\n _event?: MouseEvent;\r\n /** @internal moving vs resizing */\r\n _moving?: boolean;\r\n /** @internal is resizing? */\r\n _resizing?: boolean;\r\n /** @internal true if we jumped down past item below (one time jump so we don't have to totally pass it) */\r\n _skipDown?: boolean;\r\n /** @internal original values before a drag/size */\r\n _orig?: GridStackPosition;\r\n /** @internal position in pixels used during collision check */\r\n _rect?: GridStackPosition;\r\n /** @internal top/left pixel location before a drag so we can detect direction of move from last position*/\r\n _lastUiPosition?: Position;\r\n /** @internal set on the item being dragged/resized remember the last positions we've tried (but failed) so we don't try again during drag/resize */\r\n _lastTried?: GridStackPosition;\r\n /** @internal position willItFit() will use to position the item */\r\n _willFitPos?: GridStackPosition;\r\n /** @internal last drag Y pixel position used to incrementally update V scroll bar */\r\n _prevYPix?: number;\r\n /** @internal true if we've remove the item from ourself (dragging out) but might revert it back (release on nothing -> goes back) */\r\n _temporaryRemoved?: boolean;\r\n /** @internal true if we should remove DOM element on _notify() rather than clearing _id (old way) */\r\n _removeDOM?: boolean;\r\n /** @internal original position/size of item if dragged from sidebar */\r\n _sidebarOrig?: GridStackPosition;\r\n /** @internal had drag&drop been initialized */\r\n _initDD?: boolean;\r\n}\r\n"]}
|