gridstack 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +1 -1
  2. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  3. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  4. package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
  5. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  6. package/dist/angular/esm2020/lib/types.mjs +2 -2
  7. package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
  8. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  9. package/dist/angular/fesm2020/gridstack-angular.mjs +5 -5
  10. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  11. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  12. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  13. package/dist/angular/lib/types.d.ts +1 -1
  14. package/dist/angular/src/base-widget.ts +1 -1
  15. package/dist/angular/src/gridstack-item.component.ts +1 -1
  16. package/dist/angular/src/gridstack.component.ts +1 -1
  17. package/dist/angular/src/gridstack.module.ts +1 -1
  18. package/dist/dd-base-impl.d.ts +1 -1
  19. package/dist/dd-base-impl.js +1 -1
  20. package/dist/dd-base-impl.js.map +1 -1
  21. package/dist/dd-draggable.d.ts +1 -1
  22. package/dist/dd-draggable.js +1 -1
  23. package/dist/dd-draggable.js.map +1 -1
  24. package/dist/dd-droppable.d.ts +1 -1
  25. package/dist/dd-droppable.js +1 -1
  26. package/dist/dd-droppable.js.map +1 -1
  27. package/dist/dd-element.d.ts +1 -1
  28. package/dist/dd-element.js +1 -1
  29. package/dist/dd-element.js.map +1 -1
  30. package/dist/dd-gridstack.d.ts +1 -1
  31. package/dist/dd-gridstack.js +1 -1
  32. package/dist/dd-gridstack.js.map +1 -1
  33. package/dist/dd-manager.d.ts +1 -1
  34. package/dist/dd-manager.js +1 -1
  35. package/dist/dd-manager.js.map +1 -1
  36. package/dist/dd-resizable-handle.d.ts +1 -1
  37. package/dist/dd-resizable-handle.js +1 -1
  38. package/dist/dd-resizable-handle.js.map +1 -1
  39. package/dist/dd-resizable.d.ts +1 -1
  40. package/dist/dd-resizable.js +1 -1
  41. package/dist/dd-resizable.js.map +1 -1
  42. package/dist/dd-touch.d.ts +1 -1
  43. package/dist/dd-touch.js +1 -1
  44. package/dist/dd-touch.js.map +1 -1
  45. package/dist/gridstack-all.js +1 -1
  46. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  47. package/dist/gridstack-all.js.map +1 -1
  48. package/dist/gridstack-engine.d.ts +1 -1
  49. package/dist/gridstack-engine.js +1 -1
  50. package/dist/gridstack-engine.js.map +1 -1
  51. package/dist/gridstack.css +1 -1
  52. package/dist/gridstack.d.ts +3 -1
  53. package/dist/gridstack.js +57 -55
  54. package/dist/gridstack.js.map +1 -1
  55. package/dist/src/gridstack.scss +1 -1
  56. package/dist/types.d.ts +1 -1
  57. package/dist/types.js +1 -1
  58. package/dist/types.js.map +1 -1
  59. package/dist/utils.d.ts +1 -1
  60. package/dist/utils.js +1 -1
  61. package/dist/utils.js.map +1 -1
  62. package/doc/CHANGES.md +10 -0
  63. package/package.json +2 -4
  64. package/dist/es5/dd-base-impl.d.ts +0 -20
  65. package/dist/es5/dd-base-impl.js +0 -41
  66. package/dist/es5/dd-base-impl.js.map +0 -1
  67. package/dist/es5/dd-draggable.d.ts +0 -20
  68. package/dist/es5/dd-draggable.js +0 -408
  69. package/dist/es5/dd-draggable.js.map +0 -1
  70. package/dist/es5/dd-droppable.d.ts +0 -26
  71. package/dist/es5/dd-droppable.js +0 -185
  72. package/dist/es5/dd-droppable.js.map +0 -1
  73. package/dist/es5/dd-element.d.ts +0 -27
  74. package/dist/es5/dd-element.js +0 -96
  75. package/dist/es5/dd-element.js.map +0 -1
  76. package/dist/es5/dd-gridstack.d.ts +0 -34
  77. package/dist/es5/dd-gridstack.js +0 -154
  78. package/dist/es5/dd-gridstack.js.map +0 -1
  79. package/dist/es5/dd-manager.d.ts +0 -22
  80. package/dist/es5/dd-manager.js +0 -17
  81. package/dist/es5/dd-manager.js.map +0 -1
  82. package/dist/es5/dd-resizable-handle.d.ts +0 -18
  83. package/dist/es5/dd-resizable-handle.js +0 -117
  84. package/dist/es5/dd-resizable-handle.js.map +0 -1
  85. package/dist/es5/dd-resizable.d.ts +0 -30
  86. package/dist/es5/dd-resizable.js +0 -331
  87. package/dist/es5/dd-resizable.js.map +0 -1
  88. package/dist/es5/dd-touch.d.ts +0 -33
  89. package/dist/es5/dd-touch.js +0 -157
  90. package/dist/es5/dd-touch.js.map +0 -1
  91. package/dist/es5/gridstack-all.js +0 -3
  92. package/dist/es5/gridstack-all.js.LICENSE.txt +0 -7
  93. package/dist/es5/gridstack-all.js.map +0 -1
  94. package/dist/es5/gridstack-engine.d.ts +0 -107
  95. package/dist/es5/gridstack-engine.js +0 -1070
  96. package/dist/es5/gridstack-engine.js.map +0 -1
  97. package/dist/es5/gridstack-poly.js +0 -356
  98. package/dist/es5/gridstack.d.ts +0 -452
  99. package/dist/es5/gridstack.js +0 -2644
  100. package/dist/es5/gridstack.js.map +0 -1
  101. package/dist/es5/types.d.ts +0 -326
  102. package/dist/es5/types.js +0 -38
  103. package/dist/es5/types.js.map +0 -1
  104. package/dist/es5/utils.d.ts +0 -104
  105. package/dist/es5/utils.js +0 -633
  106. package/dist/es5/utils.js.map +0 -1
@@ -1,326 +0,0 @@
1
- /**
2
- * types.ts 12.0.0
3
- * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
4
- */
5
- import { GridStack } from './gridstack';
6
- import { GridStackEngine } from './gridstack-engine';
7
- export declare const gridDefaults: GridStackOptions;
8
- /**
9
- * different layout options when changing # of columns, including a custom function that takes new/old column count, and array of new/old positions
10
- * Note: new list may be partially already filled if we have a cache of the layout at that size and new items were added later.
11
- * Options are:
12
- * 'list' - treat items as sorted list, keeping items (un-sized unless too big for column count) sequentially reflowing them
13
- * 'compact' - similar to list, but using compact() method which will possibly re-order items if an empty slots are available due to a larger item needing to be pushed to next row
14
- * 'moveScale' - will scale and move items by the ratio new newColumnCount / oldColumnCount
15
- * 'move' | 'scale' - will only size or move items
16
- * 'none' will leave items unchanged, unless they don't fit in column count
17
- */
18
- export type ColumnOptions = 'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' | ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);
19
- export type CompactOptions = 'list' | 'compact';
20
- export type numberOrString = number | string;
21
- export interface GridItemHTMLElement extends HTMLElement {
22
- /** pointer to grid node instance */
23
- gridstackNode?: GridStackNode;
24
- }
25
- export type GridStackElement = string | HTMLElement | GridItemHTMLElement;
26
- /** specific and general event handlers for the .on() method */
27
- export type GridStackEventHandler = (event: Event) => void;
28
- export type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;
29
- export type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;
30
- export type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;
31
- export type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;
32
- /** optional function called during load() to callback the user on new added/remove grid items | grids */
33
- export type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;
34
- /** optional function called during save() to let the caller add additional custom data to the GridStackWidget structure that will get returned */
35
- export type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;
36
- /** optional function called during load()/addWidget() to let the caller create custom content other than plan text */
37
- export type RenderFcn = (el: HTMLElement, w: GridStackWidget) => void;
38
- export type ResizeToContentFcn = (el: GridItemHTMLElement) => void;
39
- /** describes the responsive nature of the grid. NOTE: make sure to have correct extra CSS to support this. */
40
- export interface Responsive {
41
- /** wanted width to maintain (+-50%) to dynamically pick a column count. NOTE: make sure to have correct extra CSS to support this. */
42
- columnWidth?: number;
43
- /** maximum number of columns allowed (default: 12). NOTE: make sure to have correct extra CSS to support this. */
44
- columnMax?: number;
45
- /** explicit width:column breakpoints instead of automatic 'columnWidth'. NOTE: make sure to have correct extra CSS to support this. */
46
- breakpoints?: Breakpoint[];
47
- /** specify if breakpoints are for window size or grid size (default:false = grid) */
48
- breakpointForWindow?: boolean;
49
- /** global re-layout mode when changing columns */
50
- layout?: ColumnOptions;
51
- }
52
- export interface Breakpoint {
53
- /** <= width for the breakpoint to trigger */
54
- w?: number;
55
- /** column count */
56
- c: number;
57
- /** re-layout mode if different from global one */
58
- layout?: ColumnOptions;
59
- }
60
- /**
61
- * Defines the options for a Grid
62
- */
63
- export interface GridStackOptions {
64
- /**
65
- * accept widgets dragged from other grids or from outside (default: `false`). Can be:
66
- * `true` (uses `'.grid-stack-item'` class filter) or `false`,
67
- * string for explicit class name,
68
- * function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)
69
- */
70
- acceptWidgets?: boolean | string | ((element: Element) => boolean);
71
- /** possible values (default: `mobile`) - does not apply to non-resizable widgets
72
- * `false` the resizing handles are only shown while hovering over a widget
73
- * `true` the resizing handles are always shown
74
- * 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.
75
- See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */
76
- alwaysShowResizeHandle?: true | false | 'mobile';
77
- /** turns animation on (default?: true) */
78
- animate?: boolean;
79
- /** if false gridstack will not initialize existing items (default?: true) */
80
- auto?: boolean;
81
- /**
82
- * one cell height (default?: 'auto'). Can be:
83
- * an integer (px)
84
- * a string (ex: '100px', '10em', '10rem'). Note: % doesn't work right - see demo/cell-height.html
85
- * 0, in which case the library will not generate styles for rows. Everything must be defined in your own CSS files.
86
- * 'auto' - height will be calculated for square cells (width / column) and updated live as you resize the window - also see `cellHeightThrottle`
87
- * 'initial' - similar to 'auto' (start at square cells) but stay that size during window resizing.
88
- */
89
- cellHeight?: numberOrString;
90
- /** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).
91
- * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!
92
- * */
93
- cellHeightThrottle?: number;
94
- /** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */
95
- cellHeightUnit?: string;
96
- /** list of children item to create when calling load() or addGrid() */
97
- children?: GridStackWidget[];
98
- /** 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.
99
- * 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
100
- * items always the same. flag is NOT supported for regular non-nested grids.
101
- */
102
- column?: number | 'auto';
103
- /** responsive column layout for width:column behavior */
104
- columnOpts?: Responsive;
105
- /** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.
106
- Note: only used by addGrid(), else your element should have the needed class */
107
- class?: string;
108
- /** disallows dragging of widgets (default?: false) */
109
- disableDrag?: boolean;
110
- /** disallows resizing of widgets (default?: false). */
111
- disableResize?: boolean;
112
- /** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */
113
- draggable?: DDDragOpt;
114
- /** let user drag nested grid items out of a parent or not (default true - not supported yet) */
115
- /** the type of engine to create (so you can subclass) default to GridStackEngine */
116
- engineClass?: typeof GridStackEngine;
117
- /** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */
118
- float?: boolean;
119
- /** draggable handle selector (default?: '.grid-stack-item-content') */
120
- handle?: string;
121
- /** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */
122
- handleClass?: string;
123
- /** additional widget class (default?: 'grid-stack-item') */
124
- itemClass?: string;
125
- /** re-layout mode when we're a subgrid and we are being resized. default to 'list' */
126
- layout?: ColumnOptions;
127
- /** true when widgets are only created when they scroll into view (visible) */
128
- lazyLoad?: boolean;
129
- /**
130
- * gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below
131
- * an integer (px)
132
- * a string with possible units (ex: '2em', '20px', '2rem')
133
- * 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).
134
- * Note: all sides must have same units (last one wins, default px)
135
- */
136
- margin?: numberOrString;
137
- /** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */
138
- marginTop?: numberOrString;
139
- marginRight?: numberOrString;
140
- marginBottom?: numberOrString;
141
- marginLeft?: numberOrString;
142
- /** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */
143
- marginUnit?: string;
144
- /** maximum rows amount. Default? is 0 which means no maximum rows */
145
- maxRow?: number;
146
- /** minimum rows amount. Default is `0`. You can also do this with `min-height` CSS attribute
147
- * on the grid div in pixels, which will round to the closest row.
148
- */
149
- minRow?: number;
150
- /** If you are using a nonce-based Content Security Policy, pass your nonce here and
151
- * GridStack will add it to the <style> elements it creates. */
152
- nonce?: string;
153
- /** class for placeholder (default?: 'grid-stack-placeholder') */
154
- placeholderClass?: string;
155
- /** placeholder default content (default?: '') */
156
- placeholderText?: string;
157
- /** allows to override UI resizable options. (default?: { handles: 'se' }) */
158
- resizable?: DDResizeOpt;
159
- /**
160
- * if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: ".trash"),
161
- * in this case widgets will be removed by dropping them there (default?: false)
162
- * See example (http://gridstack.github.io/gridstack.js/demo/two.html)
163
- */
164
- removable?: boolean | string;
165
- /** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */
166
- removableOptions?: DDRemoveOpt;
167
- /** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */
168
- row?: number;
169
- /**
170
- * if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')
171
- * See [example](http://gridstack.github.io/gridstack.js/demo/right-to-left(rtl).html)
172
- */
173
- rtl?: boolean | 'auto';
174
- /** 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.
175
- * Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight())
176
- */
177
- sizeToContent?: boolean;
178
- /**
179
- * makes grid static (default?: false). If `true` widgets are not movable/resizable.
180
- * You don't even need draggable/resizable. A CSS class
181
- * 'grid-stack-static' is also added to the element.
182
- */
183
- staticGrid?: boolean;
184
- /**
185
- * @deprecated Not used anymore, styles are now implemented with local CSS variables
186
- */
187
- styleInHead?: boolean;
188
- /** list of differences in options for automatically created sub-grids under us (inside our grid-items) */
189
- subGridOpts?: GridStackOptions;
190
- /** enable/disable the creation of sub-grids on the fly by dragging items completely
191
- * over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */
192
- subGridDynamic?: boolean;
193
- }
194
- /** options used during GridStackEngine.moveNode() */
195
- export interface GridStackMoveOpts extends GridStackPosition {
196
- /** node to skip collision */
197
- skip?: GridStackNode;
198
- /** do we pack (default true) */
199
- pack?: boolean;
200
- /** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/
201
- nested?: boolean;
202
- /** vars to calculate other cells coordinates */
203
- cellWidth?: number;
204
- cellHeight?: number;
205
- marginTop?: number;
206
- marginBottom?: number;
207
- marginLeft?: number;
208
- marginRight?: number;
209
- /** position in pixels of the currently dragged items (for overlap check) */
210
- rect?: GridStackPosition;
211
- /** true if we're live resizing */
212
- resizing?: boolean;
213
- /** best node (most coverage) we collied with */
214
- collide?: GridStackNode;
215
- /** for collision check even if we don't move */
216
- forceCollide?: boolean;
217
- }
218
- export interface GridStackPosition {
219
- /** widget position x (default?: 0) */
220
- x?: number;
221
- /** widget position y (default?: 0) */
222
- y?: number;
223
- /** widget dimension width (default?: 1) */
224
- w?: number;
225
- /** widget dimension height (default?: 1) */
226
- h?: number;
227
- }
228
- /**
229
- * GridStack Widget creation options
230
- */
231
- export interface GridStackWidget extends GridStackPosition {
232
- /** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */
233
- autoPosition?: boolean;
234
- /** minimum width allowed during resize/creation (default?: undefined = un-constrained) */
235
- minW?: number;
236
- /** maximum width allowed during resize/creation (default?: undefined = un-constrained) */
237
- maxW?: number;
238
- /** minimum height allowed during resize/creation (default?: undefined = un-constrained) */
239
- minH?: number;
240
- /** maximum height allowed during resize/creation (default?: undefined = un-constrained) */
241
- maxH?: number;
242
- /** prevent direct resizing by the user (default?: undefined = un-constrained) */
243
- noResize?: boolean;
244
- /** prevents direct moving by the user (default?: undefined = un-constrained) */
245
- noMove?: boolean;
246
- /** prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) */
247
- locked?: boolean;
248
- /** value for `gs-id` stored on the widget (default?: undefined) */
249
- id?: string;
250
- /** html to append inside as content */
251
- content?: string;
252
- /** true when widgets are only created when they scroll into view (visible) */
253
- lazyLoad?: boolean;
254
- /** local (vs grid) override - see GridStackOptions.
255
- * 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) */
256
- sizeToContent?: boolean | number;
257
- /** local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height */
258
- resizeToContentParent?: string;
259
- /** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */
260
- subGridOpts?: GridStackOptions;
261
- }
262
- /** Drag&Drop resize options */
263
- export interface DDResizeOpt {
264
- /** do resize handle hide by default until mouse over ? - default: true on desktop, false on mobile*/
265
- autoHide?: boolean;
266
- /**
267
- * sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)
268
- * Note: it is not recommended to resize from the top sides as weird side effect may occur.
269
- */
270
- handles?: string;
271
- }
272
- /** Drag&Drop remove options */
273
- export interface DDRemoveOpt {
274
- /** class that can be removed (default?: opts.itemClass) */
275
- accept?: string;
276
- /** class that cannot be removed (default: 'grid-stack-non-removable') */
277
- decline?: string;
278
- }
279
- /** Drag&Drop dragging options */
280
- export interface DDDragOpt {
281
- /** class selector of items that can be dragged. default to '.grid-stack-item-content' */
282
- handle?: string;
283
- /** default to 'body' */
284
- appendTo?: string;
285
- /** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */
286
- pause?: boolean | number;
287
- /** default to `true` */
288
- scroll?: boolean;
289
- /** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */
290
- cancel?: string;
291
- /** helper function when dropping: 'clone' or your own method */
292
- helper?: 'clone' | ((el: HTMLElement) => HTMLElement);
293
- /** callbacks */
294
- start?: (event: Event, ui: DDUIData) => void;
295
- stop?: (event: Event) => void;
296
- drag?: (event: Event, ui: DDUIData) => void;
297
- }
298
- export interface Size {
299
- width: number;
300
- height: number;
301
- }
302
- export interface Position {
303
- top: number;
304
- left: number;
305
- }
306
- export interface Rect extends Size, Position {
307
- }
308
- /** data that is passed during drag and resizing callbacks */
309
- export interface DDUIData {
310
- position?: Position;
311
- size?: Size;
312
- draggable?: HTMLElement;
313
- }
314
- /**
315
- * internal runtime descriptions describing the widgets in the grid
316
- */
317
- export interface GridStackNode extends GridStackWidget {
318
- /** pointer back to HTML element */
319
- el?: GridItemHTMLElement;
320
- /** pointer back to parent Grid instance */
321
- grid?: GridStack;
322
- /** actual sub-grid instance */
323
- subGrid?: GridStack;
324
- /** allow delay creation when visible */
325
- visibleObservable?: IntersectionObserver;
326
- }
package/dist/es5/types.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- /**
3
- * types.ts 12.0.0
4
- * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.gridDefaults = void 0;
8
- // default values for grid options - used during init and when saving out
9
- exports.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
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,yEAAyE;AAC5D,QAAA,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.0.0\r\n * Copyright (c) 2021-2024 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// default values for grid options - used during init and when saving out\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 # of columns, including a custom function that takes new/old column count, and array of new/old positions\r\n * Note: new list may be partially already filled if we have a cache of the layout at that size and new items were added later.\r\n * Options are:\r\n * 'list' - treat items as sorted list, keeping items (un-sized unless too big for column count) sequentially reflowing them\r\n * 'compact' - similar to list, but using compact() method which will possibly re-order items if an empty slots are available due to a larger item needing to be pushed to next row\r\n * 'moveScale' - will scale and move items by the ratio new newColumnCount / oldColumnCount\r\n * 'move' | 'scale' - will only size or move items\r\n * 'none' will leave items unchanged, unless they don't fit in column count\r\n */\r\nexport type ColumnOptions = 'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' |\r\n ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);\r\nexport type CompactOptions = 'list' | 'compact';\r\nexport type numberOrString = number | string;\r\nexport interface GridItemHTMLElement extends HTMLElement {\r\n /** pointer to grid node instance */\r\n gridstackNode?: GridStackNode;\r\n /** @internal */\r\n _gridstackNodeOrig?: GridStackNode;\r\n}\r\n\r\nexport type GridStackElement = string | HTMLElement | GridItemHTMLElement;\r\n\r\n/** specific and general event handlers for the .on() method */\r\nexport type GridStackEventHandler = (event: Event) => void;\r\nexport type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;\r\nexport type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;\r\nexport type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;\r\nexport type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;\r\n\r\n/** optional function called during load() to callback the user on new added/remove grid items | grids */\r\nexport type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;\r\n\r\n/** optional function called during save() to let the caller add additional custom data to the GridStackWidget structure that will get returned */\r\nexport type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;\r\n\r\n/** optional function called during load()/addWidget() to let the caller create custom content other than plan text */\r\nexport type RenderFcn = (el: HTMLElement, w: GridStackWidget) => void;\r\n\r\nexport type ResizeToContentFcn = (el: GridItemHTMLElement) => void;\r\n\r\n/** describes the responsive nature of the grid. NOTE: make sure to have correct extra CSS to support this. */\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\nexport interface Breakpoint {\r\n /** <= width for the breakpoint to trigger */\r\n w?: number;\r\n /** column count */\r\n c: number;\r\n /** re-layout mode if different from global one */\r\n layout?: ColumnOptions;\r\n /** TODO: children layout, which spells out exact locations and could omit/add some children */\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` (uses `'.grid-stack-item'` class filter) or `false`,\r\n * string for explicit class name,\r\n * function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)\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)\r\n * a string (ex: '100px', '10em', '10rem'). Note: % doesn't work right - see demo/cell-height.html\r\n * 0, in which case the library will not generate styles for rows. Everything must be defined in your own CSS files.\r\n * 'auto' - height will be calculated for square cells (width / column) and updated live as you resize the window - also see `cellHeightThrottle`\r\n * 'initial' - similar to 'auto' (start at square cells) but stay that size during window resizing.\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. Default is `0`. You can also do this with `min-height` CSS attribute\r\n * on the grid div in pixels, 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"]}
@@ -1,104 +0,0 @@
1
- /**
2
- * utils.ts 12.0.0
3
- * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
4
- */
5
- import { GridStackElement, GridStackNode, GridStackOptions, numberOrString, GridStackPosition, GridStackWidget } from './types';
6
- export interface HeightData {
7
- h: number;
8
- unit: string;
9
- }
10
- export interface DragTransform {
11
- xScale: number;
12
- yScale: number;
13
- xOffset: number;
14
- yOffset: number;
15
- }
16
- /** checks for obsolete method names */
17
- export declare function obsolete(self: any, f: any, oldName: string, newName: string, rev: string): (...args: any[]) => any;
18
- /** checks for obsolete grid options (can be used for any fields, but msg is about options) */
19
- export declare function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void;
20
- /** checks for obsolete grid options which are gone */
21
- export declare function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void;
22
- /** checks for obsolete Jquery element attributes */
23
- export declare function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void;
24
- /**
25
- * Utility methods
26
- */
27
- export declare class Utils {
28
- /** convert a potential selector into actual list of html elements. optional root which defaults to document (for shadow dom) */
29
- static getElements(els: GridStackElement, root?: HTMLElement | Document): HTMLElement[];
30
- /** convert a potential selector into actual single element. optional root which defaults to document (for shadow dom) */
31
- static getElement(els: GridStackElement, root?: HTMLElement | Document): HTMLElement;
32
- /** true if widget (or grid) makes this item lazyLoad */
33
- static lazyLoad(n: GridStackNode): boolean;
34
- /** create a div with the given classes */
35
- static createDiv(classes: string[], parent?: HTMLElement): HTMLElement;
36
- /** true if we should resize to content. strict=true when only 'sizeToContent:true' and not a number which lets user adjust */
37
- static shouldSizeToContent(n: GridStackNode | undefined, strict?: boolean): boolean;
38
- /** returns true if a and b overlap */
39
- static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean;
40
- /** returns true if a and b touch edges or corners */
41
- static isTouching(a: GridStackPosition, b: GridStackPosition): boolean;
42
- /** returns the area a and b overlap */
43
- static areaIntercept(a: GridStackPosition, b: GridStackPosition): number;
44
- /** returns the area */
45
- static area(a: GridStackPosition): number;
46
- /**
47
- * Sorts array of nodes
48
- * @param nodes array to sort
49
- * @param dir 1 for ascending, -1 for descending (optional)
50
- **/
51
- static sort(nodes: GridStackNode[], dir?: 1 | -1): GridStackNode[];
52
- /** find an item by id */
53
- static find(nodes: GridStackNode[], id: string): GridStackNode | undefined;
54
- static toBool(v: unknown): boolean;
55
- static toNumber(value: null | string): number;
56
- static parseHeight(val: numberOrString): HeightData;
57
- /** copies unset fields in target to use the given default sources values */
58
- static defaults(target: any, ...sources: any[]): {};
59
- /** given 2 objects return true if they have the same values. Checks for Object {} having same fields and values (just 1 level down) */
60
- static same(a: unknown, b: unknown): boolean;
61
- /** copies over b size & position (GridStackPosition), and optionally min/max as well */
62
- static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax?: boolean): GridStackWidget;
63
- /** true if a and b has same size & position */
64
- static samePos(a: GridStackPosition, b: GridStackPosition): boolean;
65
- /** given a node, makes sure it's min/max are valid */
66
- static sanitizeMinMax(node: GridStackNode): void;
67
- /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */
68
- static removeInternalAndSame(a: unknown, b: unknown): void;
69
- /** removes internal fields '_' and default values for saving */
70
- static removeInternalForSave(n: GridStackNode, removeEl?: boolean): void;
71
- /** return the closest parent (or itself) matching the given class */
72
- /** delay calling the given function for given delay, preventing new calls from happening while waiting */
73
- static throttle(func: () => void, delay: number): () => void;
74
- static removePositioningStyles(el: HTMLElement): void;
75
- /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
76
- static clone<T>(obj: T): T;
77
- /**
78
- * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.
79
- * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.
80
- */
81
- static cloneDeep<T>(obj: T): T;
82
- /** deep clone the given HTML node, removing teh unique id field */
83
- static cloneNode(el: HTMLElement): HTMLElement;
84
- static appendTo(el: HTMLElement, parent: string | HTMLElement): void;
85
- static addElStyles(el: HTMLElement, styles: {
86
- [prop: string]: string | string[];
87
- }): void;
88
- static initEvent<T>(e: DragEvent | MouseEvent, info: {
89
- type: string;
90
- target?: EventTarget;
91
- }): T;
92
- /** copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target */
93
- static simulateMouseEvent(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget): void;
94
- /**
95
- * defines an element that is used to get the offset and scale from grid transforms
96
- * returns the scale and offsets from said element
97
- */
98
- static getValuesFromTransformedElement(parent: HTMLElement): DragTransform;
99
- /** swap the given object 2 field values */
100
- static swap(o: unknown, a: string, b: string): void;
101
- /** returns true if event is inside the given element rectangle */
102
- /** true if the item can be rotated (checking for prop, not space available) */
103
- static canBeRotated(n: GridStackNode): boolean;
104
- }