gridstack 12.4.2 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/dd-base-impl.d.ts +1 -1
- package/dist/dd-base-impl.js +1 -1
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +3 -1
- package/dist/dd-draggable.js +70 -1
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +7 -3
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +1 -1
- package/dist/dd-element.js +1 -1
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +1 -1
- package/dist/dd-gridstack.js +1 -1
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +1 -1
- package/dist/dd-manager.js +1 -1
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +1 -1
- package/dist/dd-resizable-handle.js +1 -1
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +1 -1
- package/dist/dd-resizable.js +2 -1
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +1 -1
- package/dist/dd-touch.js +1 -1
- package/dist/dd-touch.js.map +1 -1
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack-engine.d.ts +1 -1
- package/dist/gridstack-engine.js +1 -1
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/gridstack.d.ts +1 -1
- package/dist/gridstack.js +22 -13
- package/dist/gridstack.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +4 -36
- package/dist/utils.js.map +1 -1
- package/doc/API.md +367 -347
- package/package.json +1 -1
package/doc/API.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# gridstack v12.
|
|
1
|
+
# gridstack v12.5.0
|
|
2
2
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
- [GridHTMLElement](#gridhtmlelement)
|
|
32
32
|
- [GridItemHTMLElement](#griditemhtmlelement)
|
|
33
33
|
- [GridStackEngineOptions](#gridstackengineoptions)
|
|
34
|
+
- [GridStackMouseEvent](#gridstackmouseevent)
|
|
34
35
|
- [GridStackMoveOpts](#gridstackmoveopts)
|
|
35
36
|
- [GridStackNode](#gridstacknode-2)
|
|
36
37
|
- [GridStackPosition](#gridstackposition)
|
|
@@ -67,18 +68,18 @@
|
|
|
67
68
|
<a id="gridstack"></a>
|
|
68
69
|
### GridStack
|
|
69
70
|
|
|
70
|
-
Defined in: [gridstack.ts:
|
|
71
|
+
Defined in: [gridstack.ts:77](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L77)
|
|
71
72
|
|
|
72
|
-
Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.
|
|
73
|
+
Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.
|
|
73
74
|
Note: your grid elements MUST have the following classes for the CSS layout to work:
|
|
74
75
|
|
|
75
76
|
#### Example
|
|
76
77
|
|
|
77
78
|
```ts
|
|
78
|
-
<div class="grid-stack">
|
|
79
|
-
<div class="grid-stack-item">
|
|
80
|
-
<div class="grid-stack-item-content">Item 1</div>
|
|
81
|
-
</div>
|
|
79
|
+
<div class="grid-stack">
|
|
80
|
+
<div class="grid-stack-item">
|
|
81
|
+
<div class="grid-stack-item-content">Item 1</div>
|
|
82
|
+
</div>
|
|
82
83
|
</div>
|
|
83
84
|
```
|
|
84
85
|
|
|
@@ -113,7 +114,7 @@ Construct a grid item from the given element and options
|
|
|
113
114
|
protected _updateResizeEvent(forceRemove): GridStack;
|
|
114
115
|
```
|
|
115
116
|
|
|
116
|
-
Defined in: [gridstack.ts:
|
|
117
|
+
Defined in: [gridstack.ts:2087](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2087)
|
|
117
118
|
|
|
118
119
|
add or remove the grid element size event handler
|
|
119
120
|
|
|
@@ -153,10 +154,10 @@ return our expected width (or parent) , and optionally of window for dynamic col
|
|
|
153
154
|
static addGrid(parent, opt): GridStack;
|
|
154
155
|
```
|
|
155
156
|
|
|
156
|
-
Defined in: [gridstack.ts:
|
|
157
|
+
Defined in: [gridstack.ts:142](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L142)
|
|
157
158
|
|
|
158
|
-
call to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then
|
|
159
|
-
grid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from
|
|
159
|
+
call to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then
|
|
160
|
+
grid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from
|
|
160
161
|
JSON serialized data, including options.
|
|
161
162
|
|
|
162
163
|
###### Parameters
|
|
@@ -180,8 +181,8 @@ Defined in: [gridstack.ts:432](https://github.com/adumesny/gridstack.js/blob/mas
|
|
|
180
181
|
|
|
181
182
|
add a new widget and returns it.
|
|
182
183
|
|
|
183
|
-
Widget will be always placed even if result height is more than actual grid height.
|
|
184
|
-
You need to use `willItFit()` before calling addWidget for additional check.
|
|
184
|
+
Widget will be always placed even if result height is more than actual grid height.
|
|
185
|
+
You need to use `willItFit()` before calling addWidget for additional check.
|
|
185
186
|
See also `makeWidget(el)` for DOM element.
|
|
186
187
|
|
|
187
188
|
###### Parameters
|
|
@@ -197,7 +198,7 @@ See also `makeWidget(el)` for DOM element.
|
|
|
197
198
|
###### Example
|
|
198
199
|
|
|
199
200
|
```ts
|
|
200
|
-
const grid = GridStack.init();
|
|
201
|
+
const grid = GridStack.init();
|
|
201
202
|
grid.addWidget({w: 3, content: 'hello'});
|
|
202
203
|
```
|
|
203
204
|
|
|
@@ -209,7 +210,7 @@ batchUpdate(flag): GridStack;
|
|
|
209
210
|
|
|
210
211
|
Defined in: [gridstack.ts:833](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L833)
|
|
211
212
|
|
|
212
|
-
use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
213
|
+
use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)
|
|
213
214
|
and get a single event callback. You will see no changes until `batchUpdate(false)` is called.
|
|
214
215
|
|
|
215
216
|
###### Parameters
|
|
@@ -247,10 +248,10 @@ the grid instance for chaining
|
|
|
247
248
|
###### Example
|
|
248
249
|
|
|
249
250
|
```ts
|
|
250
|
-
grid.cellHeight(100); // 100px height
|
|
251
|
-
grid.cellHeight('70px'); // explicit pixel height
|
|
252
|
-
grid.cellHeight('5rem'); // relative to root font size
|
|
253
|
-
grid.cellHeight(grid.cellWidth() * 1.2); // aspect ratio
|
|
251
|
+
grid.cellHeight(100); // 100px height
|
|
252
|
+
grid.cellHeight('70px'); // explicit pixel height
|
|
253
|
+
grid.cellHeight('5rem'); // relative to root font size
|
|
254
|
+
grid.cellHeight(grid.cellWidth() * 1.2); // aspect ratio
|
|
254
255
|
grid.cellHeight('auto'); // auto-size based on content
|
|
255
256
|
```
|
|
256
257
|
|
|
@@ -273,10 +274,10 @@ the cell width in pixels
|
|
|
273
274
|
###### Example
|
|
274
275
|
|
|
275
276
|
```ts
|
|
276
|
-
const width = grid.cellWidth();
|
|
277
|
+
const width = grid.cellWidth();
|
|
277
278
|
console.log('Cell width:', width, 'px');
|
|
278
279
|
|
|
279
|
-
// Use cell width to calculate widget dimensions
|
|
280
|
+
// Use cell width to calculate widget dimensions
|
|
280
281
|
const widgetWidth = width * 3; // For a 3-column wide widget
|
|
281
282
|
```
|
|
282
283
|
|
|
@@ -302,11 +303,11 @@ column(column, layout): GridStack;
|
|
|
302
303
|
|
|
303
304
|
Defined in: [gridstack.ts:1041](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1041)
|
|
304
305
|
|
|
305
|
-
Set the number of columns in the grid. Will update existing widgets to conform to new number of columns,
|
|
306
|
+
Set the number of columns in the grid. Will update existing widgets to conform to new number of columns,
|
|
306
307
|
as well as cache the original layout so you can revert back to previous positions without loss.
|
|
307
308
|
|
|
308
|
-
Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11] columns,
|
|
309
|
-
else you will need to generate correct CSS.
|
|
309
|
+
Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11] columns,
|
|
310
|
+
else you will need to generate correct CSS.
|
|
310
311
|
See: https://github.com/gridstack/gridstack.js#change-grid-columns
|
|
311
312
|
|
|
312
313
|
###### Parameters
|
|
@@ -325,13 +326,13 @@ the grid instance for chaining
|
|
|
325
326
|
###### Example
|
|
326
327
|
|
|
327
328
|
```ts
|
|
328
|
-
// Change to 6 columns with default scaling
|
|
329
|
+
// Change to 6 columns with default scaling
|
|
329
330
|
grid.column(6);
|
|
330
331
|
|
|
331
|
-
// Change to 4 columns, only move positions
|
|
332
|
+
// Change to 4 columns, only move positions
|
|
332
333
|
grid.column(4, 'move');
|
|
333
334
|
|
|
334
|
-
// Single column layout (vertical stack)
|
|
335
|
+
// Single column layout (vertical stack)
|
|
335
336
|
grid.column(1);
|
|
336
337
|
```
|
|
337
338
|
|
|
@@ -343,7 +344,7 @@ compact(layout, doSort): GridStack;
|
|
|
343
344
|
|
|
344
345
|
Defined in: [gridstack.ts:1007](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1007)
|
|
345
346
|
|
|
346
|
-
Re-layout grid items to reclaim any empty space. This is useful after removing widgets
|
|
347
|
+
Re-layout grid items to reclaim any empty space. This is useful after removing widgets
|
|
347
348
|
or when you want to optimize the layout.
|
|
348
349
|
|
|
349
350
|
###### Parameters
|
|
@@ -362,14 +363,14 @@ the grid instance for chaining
|
|
|
362
363
|
###### Example
|
|
363
364
|
|
|
364
365
|
```ts
|
|
365
|
-
// Compact layout after removing widgets
|
|
366
|
-
grid.removeWidget('.widget-to-remove');
|
|
366
|
+
// Compact layout after removing widgets
|
|
367
|
+
grid.removeWidget('.widget-to-remove');
|
|
367
368
|
grid.compact();
|
|
368
369
|
|
|
369
|
-
// Use list layout (preserve order)
|
|
370
|
+
// Use list layout (preserve order)
|
|
370
371
|
grid.compact('list');
|
|
371
372
|
|
|
372
|
-
// Compact without sorting first
|
|
373
|
+
// Compact without sorting first
|
|
373
374
|
grid.compact('compact', false);
|
|
374
375
|
```
|
|
375
376
|
|
|
@@ -427,17 +428,17 @@ Destroys a grid instance. DO NOT CALL any methods or access any vars after this
|
|
|
427
428
|
disable(recurse): GridStack;
|
|
428
429
|
```
|
|
429
430
|
|
|
430
|
-
Defined in: [gridstack.ts:
|
|
431
|
+
Defined in: [gridstack.ts:2288](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2288)
|
|
431
432
|
|
|
432
|
-
Temporarily disables widgets moving/resizing.
|
|
433
|
+
Temporarily disables widgets moving/resizing.
|
|
433
434
|
If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.
|
|
434
435
|
|
|
435
436
|
Note: This is a no-op for static grids.
|
|
436
437
|
|
|
437
|
-
This is a shortcut for:
|
|
438
|
-
```typescript
|
|
439
|
-
grid.enableMove(false);
|
|
440
|
-
grid.enableResize(false);
|
|
438
|
+
This is a shortcut for:
|
|
439
|
+
```typescript
|
|
440
|
+
grid.enableMove(false);
|
|
441
|
+
grid.enableResize(false);
|
|
441
442
|
```
|
|
442
443
|
|
|
443
444
|
###### Parameters
|
|
@@ -455,10 +456,10 @@ the grid instance for chaining
|
|
|
455
456
|
###### Example
|
|
456
457
|
|
|
457
458
|
```ts
|
|
458
|
-
// Disable all interactions
|
|
459
|
+
// Disable all interactions
|
|
459
460
|
grid.disable();
|
|
460
461
|
|
|
461
|
-
// Disable only this grid, not sub-grids
|
|
462
|
+
// Disable only this grid, not sub-grids
|
|
462
463
|
grid.disable(false);
|
|
463
464
|
```
|
|
464
465
|
|
|
@@ -468,15 +469,15 @@ grid.disable(false);
|
|
|
468
469
|
enable(recurse): GridStack;
|
|
469
470
|
```
|
|
470
471
|
|
|
471
|
-
Defined in: [gridstack.ts:
|
|
472
|
+
Defined in: [gridstack.ts:2315](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2315)
|
|
472
473
|
|
|
473
|
-
Re-enables widgets moving/resizing - see disable().
|
|
474
|
+
Re-enables widgets moving/resizing - see disable().
|
|
474
475
|
Note: This is a no-op for static grids.
|
|
475
476
|
|
|
476
|
-
This is a shortcut for:
|
|
477
|
-
```typescript
|
|
478
|
-
grid.enableMove(true);
|
|
479
|
-
grid.enableResize(true);
|
|
477
|
+
This is a shortcut for:
|
|
478
|
+
```typescript
|
|
479
|
+
grid.enableMove(true);
|
|
480
|
+
grid.enableResize(true);
|
|
480
481
|
```
|
|
481
482
|
|
|
482
483
|
###### Parameters
|
|
@@ -494,10 +495,10 @@ the grid instance for chaining
|
|
|
494
495
|
###### Example
|
|
495
496
|
|
|
496
497
|
```ts
|
|
497
|
-
// Re-enable all interactions
|
|
498
|
+
// Re-enable all interactions
|
|
498
499
|
grid.enable();
|
|
499
500
|
|
|
500
|
-
// Enable only this grid, not sub-grids
|
|
501
|
+
// Enable only this grid, not sub-grids
|
|
501
502
|
grid.enable(false);
|
|
502
503
|
```
|
|
503
504
|
|
|
@@ -507,9 +508,9 @@ grid.enable(false);
|
|
|
507
508
|
enableMove(doEnable, recurse): GridStack;
|
|
508
509
|
```
|
|
509
510
|
|
|
510
|
-
Defined in: [gridstack.ts:
|
|
511
|
+
Defined in: [gridstack.ts:2341](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2341)
|
|
511
512
|
|
|
512
|
-
Enables/disables widget moving for all widgets. No-op for static grids.
|
|
513
|
+
Enables/disables widget moving for all widgets. No-op for static grids.
|
|
513
514
|
Note: locally defined items (with noMove property) still override this setting.
|
|
514
515
|
|
|
515
516
|
###### Parameters
|
|
@@ -528,13 +529,13 @@ the grid instance for chaining
|
|
|
528
529
|
###### Example
|
|
529
530
|
|
|
530
531
|
```ts
|
|
531
|
-
// Enable moving for all widgets
|
|
532
|
+
// Enable moving for all widgets
|
|
532
533
|
grid.enableMove(true);
|
|
533
534
|
|
|
534
|
-
// Disable moving for all widgets
|
|
535
|
+
// Disable moving for all widgets
|
|
535
536
|
grid.enableMove(false);
|
|
536
537
|
|
|
537
|
-
// Enable only this grid, not sub-grids
|
|
538
|
+
// Enable only this grid, not sub-grids
|
|
538
539
|
grid.enableMove(true, false);
|
|
539
540
|
```
|
|
540
541
|
|
|
@@ -544,9 +545,9 @@ grid.enableMove(true, false);
|
|
|
544
545
|
enableResize(doEnable, recurse): GridStack;
|
|
545
546
|
```
|
|
546
547
|
|
|
547
|
-
Defined in: [gridstack.ts:
|
|
548
|
+
Defined in: [gridstack.ts:2369](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2369)
|
|
548
549
|
|
|
549
|
-
Enables/disables widget resizing for all widgets. No-op for static grids.
|
|
550
|
+
Enables/disables widget resizing for all widgets. No-op for static grids.
|
|
550
551
|
Note: locally defined items (with noResize property) still override this setting.
|
|
551
552
|
|
|
552
553
|
###### Parameters
|
|
@@ -565,13 +566,13 @@ the grid instance for chaining
|
|
|
565
566
|
###### Example
|
|
566
567
|
|
|
567
568
|
```ts
|
|
568
|
-
// Enable resizing for all widgets
|
|
569
|
+
// Enable resizing for all widgets
|
|
569
570
|
grid.enableResize(true);
|
|
570
571
|
|
|
571
|
-
// Disable resizing for all widgets
|
|
572
|
+
// Disable resizing for all widgets
|
|
572
573
|
grid.enableResize(false);
|
|
573
574
|
|
|
574
|
-
// Enable only this grid, not sub-grids
|
|
575
|
+
// Enable only this grid, not sub-grids
|
|
575
576
|
grid.enableResize(true, false);
|
|
576
577
|
```
|
|
577
578
|
|
|
@@ -583,7 +584,7 @@ float(val): GridStack;
|
|
|
583
584
|
|
|
584
585
|
Defined in: [gridstack.ts:1149](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1149)
|
|
585
586
|
|
|
586
|
-
Enable/disable floating widgets (default: `false`). When enabled, widgets can float up to fill empty spaces.
|
|
587
|
+
Enable/disable floating widgets (default: `false`). When enabled, widgets can float up to fill empty spaces.
|
|
587
588
|
See [example](http://gridstackjs.com/demo/float.html)
|
|
588
589
|
|
|
589
590
|
###### Parameters
|
|
@@ -601,7 +602,7 @@ the grid instance for chaining
|
|
|
601
602
|
###### Example
|
|
602
603
|
|
|
603
604
|
```ts
|
|
604
|
-
grid.float(true); // Enable floating
|
|
605
|
+
grid.float(true); // Enable floating
|
|
605
606
|
grid.float(false); // Disable floating (default)
|
|
606
607
|
```
|
|
607
608
|
|
|
@@ -651,10 +652,10 @@ the cell height in pixels
|
|
|
651
652
|
###### Example
|
|
652
653
|
|
|
653
654
|
```ts
|
|
654
|
-
const height = grid.getCellHeight();
|
|
655
|
+
const height = grid.getCellHeight();
|
|
655
656
|
console.log('Cell height:', height, 'px');
|
|
656
657
|
|
|
657
|
-
// Force pixel conversion
|
|
658
|
+
// Force pixel conversion
|
|
658
659
|
const pixelHeight = grid.getCellHeight(true);
|
|
659
660
|
```
|
|
660
661
|
|
|
@@ -686,9 +687,9 @@ const columnCount = grid.getColumn(); // returns 12 by default
|
|
|
686
687
|
static getDD(): DDGridStack;
|
|
687
688
|
```
|
|
688
689
|
|
|
689
|
-
Defined in: [gridstack.ts:
|
|
690
|
+
Defined in: [gridstack.ts:2185](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2185)
|
|
690
691
|
|
|
691
|
-
Get the global drag & drop implementation instance.
|
|
692
|
+
Get the global drag & drop implementation instance.
|
|
692
693
|
This provides access to the underlying drag & drop functionality.
|
|
693
694
|
|
|
694
695
|
###### Returns
|
|
@@ -700,7 +701,7 @@ the DDGridStack instance used for drag & drop operations
|
|
|
700
701
|
###### Example
|
|
701
702
|
|
|
702
703
|
```ts
|
|
703
|
-
const dd = GridStack.getDD();
|
|
704
|
+
const dd = GridStack.getDD();
|
|
704
705
|
// Access drag & drop functionality
|
|
705
706
|
```
|
|
706
707
|
|
|
@@ -723,7 +724,7 @@ true if floating is enabled, false otherwise
|
|
|
723
724
|
###### Example
|
|
724
725
|
|
|
725
726
|
```ts
|
|
726
|
-
const isFloating = grid.getFloat();
|
|
727
|
+
const isFloating = grid.getFloat();
|
|
727
728
|
console.log('Floating enabled:', isFloating);
|
|
728
729
|
```
|
|
729
730
|
|
|
@@ -735,7 +736,7 @@ getGridItems(): GridItemHTMLElement[];
|
|
|
735
736
|
|
|
736
737
|
Defined in: [gridstack.ts:1092](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1092)
|
|
737
738
|
|
|
738
|
-
Returns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order.
|
|
739
|
+
Returns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order.
|
|
739
740
|
This method excludes placeholder elements and returns only actual grid items.
|
|
740
741
|
|
|
741
742
|
###### Returns
|
|
@@ -747,9 +748,9 @@ array of GridItemHTMLElement instances representing all grid items
|
|
|
747
748
|
###### Example
|
|
748
749
|
|
|
749
750
|
```ts
|
|
750
|
-
const items = grid.getGridItems();
|
|
751
|
-
items.forEach(item => {
|
|
752
|
-
console.log('Item ID:', item.gridstackNode.id);
|
|
751
|
+
const items = grid.getGridItems();
|
|
752
|
+
items.forEach(item => {
|
|
753
|
+
console.log('Item ID:', item.gridstackNode.id);
|
|
753
754
|
});
|
|
754
755
|
```
|
|
755
756
|
|
|
@@ -759,9 +760,9 @@ items.forEach(item => {
|
|
|
759
760
|
getMargin(): number;
|
|
760
761
|
```
|
|
761
762
|
|
|
762
|
-
Defined in: [gridstack.ts:
|
|
763
|
+
Defined in: [gridstack.ts:1793](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1793)
|
|
763
764
|
|
|
764
|
-
Returns the current margin value as a number (undefined if the 4 sides don't match).
|
|
765
|
+
Returns the current margin value as a number (undefined if the 4 sides don't match).
|
|
765
766
|
This only returns a number if all sides have the same margin value.
|
|
766
767
|
|
|
767
768
|
###### Returns
|
|
@@ -773,11 +774,11 @@ the margin value in pixels, or undefined if sides have different values
|
|
|
773
774
|
###### Example
|
|
774
775
|
|
|
775
776
|
```ts
|
|
776
|
-
const margin = grid.getMargin();
|
|
777
|
-
if (margin !== undefined) {
|
|
778
|
-
console.log('Uniform margin:', margin, 'px');
|
|
779
|
-
} else {
|
|
780
|
-
console.log('Margins are different on different sides');
|
|
777
|
+
const margin = grid.getMargin();
|
|
778
|
+
if (margin !== undefined) {
|
|
779
|
+
console.log('Uniform margin:', margin, 'px');
|
|
780
|
+
} else {
|
|
781
|
+
console.log('Margins are different on different sides');
|
|
781
782
|
}
|
|
782
783
|
```
|
|
783
784
|
|
|
@@ -789,7 +790,7 @@ getRow(): number;
|
|
|
789
790
|
|
|
790
791
|
Defined in: [gridstack.ts:1209](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1209)
|
|
791
792
|
|
|
792
|
-
Returns the current number of rows, which will be at least `minRow` if set.
|
|
793
|
+
Returns the current number of rows, which will be at least `minRow` if set.
|
|
793
794
|
The row count is based on the highest positioned widget in the grid.
|
|
794
795
|
|
|
795
796
|
###### Returns
|
|
@@ -801,7 +802,7 @@ the current number of rows in the grid
|
|
|
801
802
|
###### Example
|
|
802
803
|
|
|
803
804
|
```ts
|
|
804
|
-
const rowCount = grid.getRow();
|
|
805
|
+
const rowCount = grid.getRow();
|
|
805
806
|
console.log('Grid has', rowCount, 'rows');
|
|
806
807
|
```
|
|
807
808
|
|
|
@@ -811,10 +812,10 @@ console.log('Grid has', rowCount, 'rows');
|
|
|
811
812
|
static init(options, elOrString): GridStack;
|
|
812
813
|
```
|
|
813
814
|
|
|
814
|
-
Defined in: [gridstack.ts:
|
|
815
|
+
Defined in: [gridstack.ts:92](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L92)
|
|
815
816
|
|
|
816
|
-
initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
817
|
-
simply return the existing instance (ignore any passed options). There is also an initAll() version that support
|
|
817
|
+
initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will
|
|
818
|
+
simply return the existing instance (ignore any passed options). There is also an initAll() version that support
|
|
818
819
|
multiple grids initialization at once. Or you can use addGrid() to create the entire grid from JSON.
|
|
819
820
|
|
|
820
821
|
###### Parameters
|
|
@@ -833,7 +834,7 @@ multiple grids initialization at once. Or you can use addGrid() to create the en
|
|
|
833
834
|
```ts
|
|
834
835
|
const grid = GridStack.init();
|
|
835
836
|
|
|
836
|
-
Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later
|
|
837
|
+
Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later
|
|
837
838
|
const grid = document.querySelector('.grid-stack').gridstack;
|
|
838
839
|
```
|
|
839
840
|
|
|
@@ -843,7 +844,7 @@ const grid = document.querySelector('.grid-stack').gridstack;
|
|
|
843
844
|
static initAll(options, selector): GridStack[];
|
|
844
845
|
```
|
|
845
846
|
|
|
846
|
-
Defined in: [gridstack.ts:
|
|
847
|
+
Defined in: [gridstack.ts:119](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L119)
|
|
847
848
|
|
|
848
849
|
Will initialize a list of elements (given a selector) and return an array of grids.
|
|
849
850
|
|
|
@@ -861,7 +862,7 @@ Will initialize a list of elements (given a selector) and return an array of gri
|
|
|
861
862
|
###### Example
|
|
862
863
|
|
|
863
864
|
```ts
|
|
864
|
-
const grids = GridStack.initAll();
|
|
865
|
+
const grids = GridStack.initAll();
|
|
865
866
|
grids.forEach(...)
|
|
866
867
|
```
|
|
867
868
|
|
|
@@ -897,9 +898,9 @@ true if the area is completely empty, false if any widget overlaps
|
|
|
897
898
|
###### Example
|
|
898
899
|
|
|
899
900
|
```ts
|
|
900
|
-
// Check if a 2x2 area at position (1,1) is empty
|
|
901
|
-
if (grid.isAreaEmpty(1, 1, 2, 2)) {
|
|
902
|
-
console.log('Area is available for placement');
|
|
901
|
+
// Check if a 2x2 area at position (1,1) is empty
|
|
902
|
+
if (grid.isAreaEmpty(1, 1, 2, 2)) {
|
|
903
|
+
console.log('Area is available for placement');
|
|
903
904
|
}
|
|
904
905
|
```
|
|
905
906
|
|
|
@@ -911,7 +912,7 @@ isIgnoreChangeCB(): boolean;
|
|
|
911
912
|
|
|
912
913
|
Defined in: [gridstack.ts:1109](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1109)
|
|
913
914
|
|
|
914
|
-
Returns true if change callbacks should be ignored due to column change, sizeToContent, loading, etc.
|
|
915
|
+
Returns true if change callbacks should be ignored due to column change, sizeToContent, loading, etc.
|
|
915
916
|
This is useful for callers who want to implement dirty flag functionality.
|
|
916
917
|
|
|
917
918
|
###### Returns
|
|
@@ -923,9 +924,9 @@ true if change callbacks are currently being ignored
|
|
|
923
924
|
###### Example
|
|
924
925
|
|
|
925
926
|
```ts
|
|
926
|
-
if (!grid.isIgnoreChangeCB()) {
|
|
927
|
-
// Process the change event
|
|
928
|
-
console.log('Grid layout changed');
|
|
927
|
+
if (!grid.isIgnoreChangeCB()) {
|
|
928
|
+
// Process the change event
|
|
929
|
+
console.log('Grid layout changed');
|
|
929
930
|
}
|
|
930
931
|
```
|
|
931
932
|
|
|
@@ -937,7 +938,7 @@ load(items, addRemove): GridStack;
|
|
|
937
938
|
|
|
938
939
|
Defined in: [gridstack.ts:722](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L722)
|
|
939
940
|
|
|
940
|
-
Load widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.
|
|
941
|
+
Load widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.
|
|
941
942
|
Used to restore a grid layout for a saved layout list (see `save()`).
|
|
942
943
|
|
|
943
944
|
###### Parameters
|
|
@@ -956,27 +957,27 @@ the grid instance for chaining
|
|
|
956
957
|
###### Example
|
|
957
958
|
|
|
958
959
|
```ts
|
|
959
|
-
// Basic usage with saved layout
|
|
960
|
-
const savedLayout = grid.save(); // Save current layout
|
|
961
|
-
// ... later restore it
|
|
960
|
+
// Basic usage with saved layout
|
|
961
|
+
const savedLayout = grid.save(); // Save current layout
|
|
962
|
+
// ... later restore it
|
|
962
963
|
grid.load(savedLayout);
|
|
963
964
|
|
|
964
|
-
// Load with custom add/remove callback
|
|
965
|
-
grid.load(layout, (items, grid, add) => {
|
|
966
|
-
if (add) {
|
|
967
|
-
// Custom logic for adding new widgets
|
|
968
|
-
items.forEach(item => {
|
|
969
|
-
const el = document.createElement('div');
|
|
970
|
-
el.innerHTML = item.content || '';
|
|
971
|
-
grid.addWidget(el, item);
|
|
972
|
-
});
|
|
973
|
-
} else {
|
|
974
|
-
// Custom logic for removing widgets
|
|
975
|
-
items.forEach(item => grid.removeWidget(item.el));
|
|
976
|
-
}
|
|
965
|
+
// Load with custom add/remove callback
|
|
966
|
+
grid.load(layout, (items, grid, add) => {
|
|
967
|
+
if (add) {
|
|
968
|
+
// Custom logic for adding new widgets
|
|
969
|
+
items.forEach(item => {
|
|
970
|
+
const el = document.createElement('div');
|
|
971
|
+
el.innerHTML = item.content || '';
|
|
972
|
+
grid.addWidget(el, item);
|
|
973
|
+
});
|
|
974
|
+
} else {
|
|
975
|
+
// Custom logic for removing widgets
|
|
976
|
+
items.forEach(item => grid.removeWidget(item.el));
|
|
977
|
+
}
|
|
977
978
|
});
|
|
978
979
|
|
|
979
|
-
// Load without adding/removing missing widgets
|
|
980
|
+
// Load without adding/removing missing widgets
|
|
980
981
|
grid.load(layout, false);
|
|
981
982
|
```
|
|
982
983
|
|
|
@@ -996,7 +997,7 @@ makeSubGrid(
|
|
|
996
997
|
|
|
997
998
|
Defined in: [gridstack.ts:506](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L506)
|
|
998
999
|
|
|
999
|
-
Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
|
|
1000
|
+
Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
|
|
1000
1001
|
from the parent's subGrid options.
|
|
1001
1002
|
|
|
1002
1003
|
###### Parameters
|
|
@@ -1022,8 +1023,8 @@ makeWidget(els, options?): GridItemHTMLElement;
|
|
|
1022
1023
|
|
|
1023
1024
|
Defined in: [gridstack.ts:1256](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1256)
|
|
1024
1025
|
|
|
1025
|
-
If you add elements to your grid by hand (or have some framework creating DOM), you have to tell gridstack afterwards to make them widgets.
|
|
1026
|
-
If you want gridstack to add the elements for you, use `addWidget()` instead.
|
|
1026
|
+
If you add elements to your grid by hand (or have some framework creating DOM), you have to tell gridstack afterwards to make them widgets.
|
|
1027
|
+
If you want gridstack to add the elements for you, use `addWidget()` instead.
|
|
1027
1028
|
Makes the given element a widget and returns it.
|
|
1028
1029
|
|
|
1029
1030
|
###### Parameters
|
|
@@ -1044,16 +1045,16 @@ the converted GridItemHTMLElement
|
|
|
1044
1045
|
```ts
|
|
1045
1046
|
const grid = GridStack.init();
|
|
1046
1047
|
|
|
1047
|
-
// Create HTML content manually, possibly looking like:
|
|
1048
|
-
// <div id="item-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2"></div>
|
|
1048
|
+
// Create HTML content manually, possibly looking like:
|
|
1049
|
+
// <div id="item-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2"></div>
|
|
1049
1050
|
grid.el.innerHTML = '<div id="item-1" gs-w="3"></div><div id="item-2"></div>';
|
|
1050
1051
|
|
|
1051
|
-
// Convert existing elements to widgets
|
|
1052
|
-
grid.makeWidget('#item-1'); // Uses gs-* attributes from DOM
|
|
1052
|
+
// Convert existing elements to widgets
|
|
1053
|
+
grid.makeWidget('#item-1'); // Uses gs-* attributes from DOM
|
|
1053
1054
|
grid.makeWidget('#item-2', {w: 2, h: 1, content: 'Hello World'});
|
|
1054
1055
|
|
|
1055
|
-
// Or pass DOM element directly
|
|
1056
|
-
const element = document.getElementById('item-3');
|
|
1056
|
+
// Or pass DOM element directly
|
|
1057
|
+
const element = document.getElementById('item-3');
|
|
1057
1058
|
grid.makeWidget(element, {x: 0, y: 1, w: 4, h: 2});
|
|
1058
1059
|
```
|
|
1059
1060
|
|
|
@@ -1063,9 +1064,9 @@ grid.makeWidget(element, {x: 0, y: 1, w: 4, h: 2});
|
|
|
1063
1064
|
margin(value): GridStack;
|
|
1064
1065
|
```
|
|
1065
1066
|
|
|
1066
|
-
Defined in: [gridstack.ts:
|
|
1067
|
+
Defined in: [gridstack.ts:1764](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1764)
|
|
1067
1068
|
|
|
1068
|
-
Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options.
|
|
1069
|
+
Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options.
|
|
1069
1070
|
Supports CSS string format of 1, 2, or 4 values or a single number.
|
|
1070
1071
|
|
|
1071
1072
|
###### Parameters
|
|
@@ -1083,8 +1084,8 @@ the grid instance for chaining
|
|
|
1083
1084
|
###### Example
|
|
1084
1085
|
|
|
1085
1086
|
```ts
|
|
1086
|
-
grid.margin(10); // 10px all sides
|
|
1087
|
-
grid.margin('10px 20px'); // 10px top/bottom, 20px left/right
|
|
1087
|
+
grid.margin(10); // 10px all sides
|
|
1088
|
+
grid.margin('10px 20px'); // 10px top/bottom, 20px left/right
|
|
1088
1089
|
grid.margin('5px 10px 15px 20px'); // Different for each side
|
|
1089
1090
|
```
|
|
1090
1091
|
|
|
@@ -1094,12 +1095,12 @@ grid.margin('5px 10px 15px 20px'); // Different for each side
|
|
|
1094
1095
|
movable(els, val): GridStack;
|
|
1095
1096
|
```
|
|
1096
1097
|
|
|
1097
|
-
Defined in: [gridstack.ts:
|
|
1098
|
+
Defined in: [gridstack.ts:2229](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2229)
|
|
1098
1099
|
|
|
1099
|
-
Enables/Disables dragging by the user for specific grid elements.
|
|
1100
|
+
Enables/Disables dragging by the user for specific grid elements.
|
|
1100
1101
|
For all items and future items, use enableMove() instead. No-op for static grids.
|
|
1101
1102
|
|
|
1102
|
-
Note: If you want to prevent an item from moving due to being pushed around by another
|
|
1103
|
+
Note: If you want to prevent an item from moving due to being pushed around by another
|
|
1103
1104
|
during collision, use the 'locked' property instead.
|
|
1104
1105
|
|
|
1105
1106
|
###### Parameters
|
|
@@ -1118,10 +1119,10 @@ the grid instance for chaining
|
|
|
1118
1119
|
###### Example
|
|
1119
1120
|
|
|
1120
1121
|
```ts
|
|
1121
|
-
// Make specific widgets draggable
|
|
1122
|
+
// Make specific widgets draggable
|
|
1122
1123
|
grid.movable('.my-widget', true);
|
|
1123
1124
|
|
|
1124
|
-
// Disable dragging for specific widgets
|
|
1125
|
+
// Disable dragging for specific widgets
|
|
1125
1126
|
grid.movable('#fixed-widget', false);
|
|
1126
1127
|
```
|
|
1127
1128
|
|
|
@@ -1179,18 +1180,18 @@ Defined in: [gridstack.ts:1315](https://github.com/adumesny/gridstack.js/blob/ma
|
|
|
1179
1180
|
|
|
1180
1181
|
Register event handler for grid events. You can call this on a single event name, or space separated list.
|
|
1181
1182
|
|
|
1182
|
-
Supported events:
|
|
1183
|
-
- `added`: Called when widgets are being added to a grid
|
|
1184
|
-
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1185
|
-
- `disable`: Called when grid becomes disabled
|
|
1186
|
-
- `dragstart`: Called when grid item starts being dragged
|
|
1187
|
-
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1188
|
-
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1189
|
-
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1190
|
-
- `enable`: Called when grid becomes enabled
|
|
1191
|
-
- `removed`: Called when items are being removed from the grid
|
|
1192
|
-
- `resizestart`: Called before user starts resizing an item
|
|
1193
|
-
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1183
|
+
Supported events:
|
|
1184
|
+
- `added`: Called when widgets are being added to a grid
|
|
1185
|
+
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1186
|
+
- `disable`: Called when grid becomes disabled
|
|
1187
|
+
- `dragstart`: Called when grid item starts being dragged
|
|
1188
|
+
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1189
|
+
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1190
|
+
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1191
|
+
- `enable`: Called when grid becomes enabled
|
|
1192
|
+
- `removed`: Called when items are being removed from the grid
|
|
1193
|
+
- `resizestart`: Called before user starts resizing an item
|
|
1194
|
+
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1194
1195
|
- `resizestop`: Called after user is done resizing the item, with updated DOM attributes
|
|
1195
1196
|
|
|
1196
1197
|
###### Parameters
|
|
@@ -1209,14 +1210,14 @@ the grid instance for chaining
|
|
|
1209
1210
|
###### Example
|
|
1210
1211
|
|
|
1211
1212
|
```ts
|
|
1212
|
-
// Listen to multiple events at once
|
|
1213
|
-
grid.on('added removed change', (event, items) => {
|
|
1214
|
-
items.forEach(item => console.log('Item changed:', item));
|
|
1213
|
+
// Listen to multiple events at once
|
|
1214
|
+
grid.on('added removed change', (event, items) => {
|
|
1215
|
+
items.forEach(item => console.log('Item changed:', item));
|
|
1215
1216
|
});
|
|
1216
1217
|
|
|
1217
|
-
// Listen to individual events
|
|
1218
|
-
grid.on('added', (event, items) => {
|
|
1219
|
-
items.forEach(item => console.log('Added item:', item));
|
|
1218
|
+
// Listen to individual events
|
|
1219
|
+
grid.on('added', (event, items) => {
|
|
1220
|
+
items.forEach(item => console.log('Added item:', item));
|
|
1220
1221
|
});
|
|
1221
1222
|
```
|
|
1222
1223
|
|
|
@@ -1230,18 +1231,18 @@ Defined in: [gridstack.ts:1316](https://github.com/adumesny/gridstack.js/blob/ma
|
|
|
1230
1231
|
|
|
1231
1232
|
Register event handler for grid events. You can call this on a single event name, or space separated list.
|
|
1232
1233
|
|
|
1233
|
-
Supported events:
|
|
1234
|
-
- `added`: Called when widgets are being added to a grid
|
|
1235
|
-
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1236
|
-
- `disable`: Called when grid becomes disabled
|
|
1237
|
-
- `dragstart`: Called when grid item starts being dragged
|
|
1238
|
-
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1239
|
-
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1240
|
-
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1241
|
-
- `enable`: Called when grid becomes enabled
|
|
1242
|
-
- `removed`: Called when items are being removed from the grid
|
|
1243
|
-
- `resizestart`: Called before user starts resizing an item
|
|
1244
|
-
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1234
|
+
Supported events:
|
|
1235
|
+
- `added`: Called when widgets are being added to a grid
|
|
1236
|
+
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1237
|
+
- `disable`: Called when grid becomes disabled
|
|
1238
|
+
- `dragstart`: Called when grid item starts being dragged
|
|
1239
|
+
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1240
|
+
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1241
|
+
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1242
|
+
- `enable`: Called when grid becomes enabled
|
|
1243
|
+
- `removed`: Called when items are being removed from the grid
|
|
1244
|
+
- `resizestart`: Called before user starts resizing an item
|
|
1245
|
+
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1245
1246
|
- `resizestop`: Called after user is done resizing the item, with updated DOM attributes
|
|
1246
1247
|
|
|
1247
1248
|
###### Parameters
|
|
@@ -1260,14 +1261,14 @@ the grid instance for chaining
|
|
|
1260
1261
|
###### Example
|
|
1261
1262
|
|
|
1262
1263
|
```ts
|
|
1263
|
-
// Listen to multiple events at once
|
|
1264
|
-
grid.on('added removed change', (event, items) => {
|
|
1265
|
-
items.forEach(item => console.log('Item changed:', item));
|
|
1264
|
+
// Listen to multiple events at once
|
|
1265
|
+
grid.on('added removed change', (event, items) => {
|
|
1266
|
+
items.forEach(item => console.log('Item changed:', item));
|
|
1266
1267
|
});
|
|
1267
1268
|
|
|
1268
|
-
// Listen to individual events
|
|
1269
|
-
grid.on('added', (event, items) => {
|
|
1270
|
-
items.forEach(item => console.log('Added item:', item));
|
|
1269
|
+
// Listen to individual events
|
|
1270
|
+
grid.on('added', (event, items) => {
|
|
1271
|
+
items.forEach(item => console.log('Added item:', item));
|
|
1271
1272
|
});
|
|
1272
1273
|
```
|
|
1273
1274
|
|
|
@@ -1281,18 +1282,18 @@ Defined in: [gridstack.ts:1317](https://github.com/adumesny/gridstack.js/blob/ma
|
|
|
1281
1282
|
|
|
1282
1283
|
Register event handler for grid events. You can call this on a single event name, or space separated list.
|
|
1283
1284
|
|
|
1284
|
-
Supported events:
|
|
1285
|
-
- `added`: Called when widgets are being added to a grid
|
|
1286
|
-
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1287
|
-
- `disable`: Called when grid becomes disabled
|
|
1288
|
-
- `dragstart`: Called when grid item starts being dragged
|
|
1289
|
-
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1290
|
-
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1291
|
-
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1292
|
-
- `enable`: Called when grid becomes enabled
|
|
1293
|
-
- `removed`: Called when items are being removed from the grid
|
|
1294
|
-
- `resizestart`: Called before user starts resizing an item
|
|
1295
|
-
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1285
|
+
Supported events:
|
|
1286
|
+
- `added`: Called when widgets are being added to a grid
|
|
1287
|
+
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1288
|
+
- `disable`: Called when grid becomes disabled
|
|
1289
|
+
- `dragstart`: Called when grid item starts being dragged
|
|
1290
|
+
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1291
|
+
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1292
|
+
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1293
|
+
- `enable`: Called when grid becomes enabled
|
|
1294
|
+
- `removed`: Called when items are being removed from the grid
|
|
1295
|
+
- `resizestart`: Called before user starts resizing an item
|
|
1296
|
+
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1296
1297
|
- `resizestop`: Called after user is done resizing the item, with updated DOM attributes
|
|
1297
1298
|
|
|
1298
1299
|
###### Parameters
|
|
@@ -1311,14 +1312,14 @@ the grid instance for chaining
|
|
|
1311
1312
|
###### Example
|
|
1312
1313
|
|
|
1313
1314
|
```ts
|
|
1314
|
-
// Listen to multiple events at once
|
|
1315
|
-
grid.on('added removed change', (event, items) => {
|
|
1316
|
-
items.forEach(item => console.log('Item changed:', item));
|
|
1315
|
+
// Listen to multiple events at once
|
|
1316
|
+
grid.on('added removed change', (event, items) => {
|
|
1317
|
+
items.forEach(item => console.log('Item changed:', item));
|
|
1317
1318
|
});
|
|
1318
1319
|
|
|
1319
|
-
// Listen to individual events
|
|
1320
|
-
grid.on('added', (event, items) => {
|
|
1321
|
-
items.forEach(item => console.log('Added item:', item));
|
|
1320
|
+
// Listen to individual events
|
|
1321
|
+
grid.on('added', (event, items) => {
|
|
1322
|
+
items.forEach(item => console.log('Added item:', item));
|
|
1322
1323
|
});
|
|
1323
1324
|
```
|
|
1324
1325
|
|
|
@@ -1332,18 +1333,18 @@ Defined in: [gridstack.ts:1318](https://github.com/adumesny/gridstack.js/blob/ma
|
|
|
1332
1333
|
|
|
1333
1334
|
Register event handler for grid events. You can call this on a single event name, or space separated list.
|
|
1334
1335
|
|
|
1335
|
-
Supported events:
|
|
1336
|
-
- `added`: Called when widgets are being added to a grid
|
|
1337
|
-
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1338
|
-
- `disable`: Called when grid becomes disabled
|
|
1339
|
-
- `dragstart`: Called when grid item starts being dragged
|
|
1340
|
-
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1341
|
-
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1342
|
-
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1343
|
-
- `enable`: Called when grid becomes enabled
|
|
1344
|
-
- `removed`: Called when items are being removed from the grid
|
|
1345
|
-
- `resizestart`: Called before user starts resizing an item
|
|
1346
|
-
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1336
|
+
Supported events:
|
|
1337
|
+
- `added`: Called when widgets are being added to a grid
|
|
1338
|
+
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1339
|
+
- `disable`: Called when grid becomes disabled
|
|
1340
|
+
- `dragstart`: Called when grid item starts being dragged
|
|
1341
|
+
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1342
|
+
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1343
|
+
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1344
|
+
- `enable`: Called when grid becomes enabled
|
|
1345
|
+
- `removed`: Called when items are being removed from the grid
|
|
1346
|
+
- `resizestart`: Called before user starts resizing an item
|
|
1347
|
+
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1347
1348
|
- `resizestop`: Called after user is done resizing the item, with updated DOM attributes
|
|
1348
1349
|
|
|
1349
1350
|
###### Parameters
|
|
@@ -1362,14 +1363,14 @@ the grid instance for chaining
|
|
|
1362
1363
|
###### Example
|
|
1363
1364
|
|
|
1364
1365
|
```ts
|
|
1365
|
-
// Listen to multiple events at once
|
|
1366
|
-
grid.on('added removed change', (event, items) => {
|
|
1367
|
-
items.forEach(item => console.log('Item changed:', item));
|
|
1366
|
+
// Listen to multiple events at once
|
|
1367
|
+
grid.on('added removed change', (event, items) => {
|
|
1368
|
+
items.forEach(item => console.log('Item changed:', item));
|
|
1368
1369
|
});
|
|
1369
1370
|
|
|
1370
|
-
// Listen to individual events
|
|
1371
|
-
grid.on('added', (event, items) => {
|
|
1372
|
-
items.forEach(item => console.log('Added item:', item));
|
|
1371
|
+
// Listen to individual events
|
|
1372
|
+
grid.on('added', (event, items) => {
|
|
1373
|
+
items.forEach(item => console.log('Added item:', item));
|
|
1373
1374
|
});
|
|
1374
1375
|
```
|
|
1375
1376
|
|
|
@@ -1383,18 +1384,18 @@ Defined in: [gridstack.ts:1319](https://github.com/adumesny/gridstack.js/blob/ma
|
|
|
1383
1384
|
|
|
1384
1385
|
Register event handler for grid events. You can call this on a single event name, or space separated list.
|
|
1385
1386
|
|
|
1386
|
-
Supported events:
|
|
1387
|
-
- `added`: Called when widgets are being added to a grid
|
|
1388
|
-
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1389
|
-
- `disable`: Called when grid becomes disabled
|
|
1390
|
-
- `dragstart`: Called when grid item starts being dragged
|
|
1391
|
-
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1392
|
-
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1393
|
-
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1394
|
-
- `enable`: Called when grid becomes enabled
|
|
1395
|
-
- `removed`: Called when items are being removed from the grid
|
|
1396
|
-
- `resizestart`: Called before user starts resizing an item
|
|
1397
|
-
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1387
|
+
Supported events:
|
|
1388
|
+
- `added`: Called when widgets are being added to a grid
|
|
1389
|
+
- `change`: Occurs when widgets change their position/size due to constraints or direct changes
|
|
1390
|
+
- `disable`: Called when grid becomes disabled
|
|
1391
|
+
- `dragstart`: Called when grid item starts being dragged
|
|
1392
|
+
- `drag`: Called while grid item is being dragged (for each new row/column value)
|
|
1393
|
+
- `dragstop`: Called after user is done moving the item, with updated DOM attributes
|
|
1394
|
+
- `dropped`: Called when an item has been dropped and accepted over a grid
|
|
1395
|
+
- `enable`: Called when grid becomes enabled
|
|
1396
|
+
- `removed`: Called when items are being removed from the grid
|
|
1397
|
+
- `resizestart`: Called before user starts resizing an item
|
|
1398
|
+
- `resize`: Called while grid item is being resized (for each new row/column value)
|
|
1398
1399
|
- `resizestop`: Called after user is done resizing the item, with updated DOM attributes
|
|
1399
1400
|
|
|
1400
1401
|
###### Parameters
|
|
@@ -1413,14 +1414,14 @@ the grid instance for chaining
|
|
|
1413
1414
|
###### Example
|
|
1414
1415
|
|
|
1415
1416
|
```ts
|
|
1416
|
-
// Listen to multiple events at once
|
|
1417
|
-
grid.on('added removed change', (event, items) => {
|
|
1418
|
-
items.forEach(item => console.log('Item changed:', item));
|
|
1417
|
+
// Listen to multiple events at once
|
|
1418
|
+
grid.on('added removed change', (event, items) => {
|
|
1419
|
+
items.forEach(item => console.log('Item changed:', item));
|
|
1419
1420
|
});
|
|
1420
1421
|
|
|
1421
|
-
// Listen to individual events
|
|
1422
|
-
grid.on('added', (event, items) => {
|
|
1423
|
-
items.forEach(item => console.log('Added item:', item));
|
|
1422
|
+
// Listen to individual events
|
|
1423
|
+
grid.on('added', (event, items) => {
|
|
1424
|
+
items.forEach(item => console.log('Added item:', item));
|
|
1424
1425
|
});
|
|
1425
1426
|
```
|
|
1426
1427
|
|
|
@@ -1430,10 +1431,10 @@ grid.on('added', (event, items) => {
|
|
|
1430
1431
|
onResize(clientWidth): GridStack;
|
|
1431
1432
|
```
|
|
1432
1433
|
|
|
1433
|
-
Defined in: [gridstack.ts:
|
|
1434
|
+
Defined in: [gridstack.ts:2026](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2026)
|
|
1434
1435
|
|
|
1435
|
-
called when we are being resized - check if the one Column Mode needs to be turned on/off
|
|
1436
|
-
and remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)
|
|
1436
|
+
called when we are being resized - check if the one Column Mode needs to be turned on/off
|
|
1437
|
+
and remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)
|
|
1437
1438
|
or `sizeToContent` gridItem options.
|
|
1438
1439
|
|
|
1439
1440
|
###### Parameters
|
|
@@ -1452,7 +1453,7 @@ or `sizeToContent` gridItem options.
|
|
|
1452
1453
|
prepareDragDrop(el, force?): GridStack;
|
|
1453
1454
|
```
|
|
1454
1455
|
|
|
1455
|
-
Defined in: [gridstack.ts:
|
|
1456
|
+
Defined in: [gridstack.ts:2712](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2712)
|
|
1456
1457
|
|
|
1457
1458
|
prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading
|
|
1458
1459
|
|
|
@@ -1473,10 +1474,10 @@ prepares the element for drag&drop - this is normally called by makeWidget() unl
|
|
|
1473
1474
|
static registerEngine(engineClass): void;
|
|
1474
1475
|
```
|
|
1475
1476
|
|
|
1476
|
-
Defined in: [gridstack.ts:
|
|
1477
|
+
Defined in: [gridstack.ts:173](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L173)
|
|
1477
1478
|
|
|
1478
|
-
call this method to register your engine instead of the default one.
|
|
1479
|
-
See instead `GridStackOptions.engineClass` if you only need to
|
|
1479
|
+
call this method to register your engine instead of the default one.
|
|
1480
|
+
See instead `GridStackOptions.engineClass` if you only need to
|
|
1480
1481
|
replace just one instance.
|
|
1481
1482
|
|
|
1482
1483
|
###### Parameters
|
|
@@ -1518,7 +1519,7 @@ removeAsSubGrid(nodeThatRemoved?): void;
|
|
|
1518
1519
|
|
|
1519
1520
|
Defined in: [gridstack.ts:599](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L599)
|
|
1520
1521
|
|
|
1521
|
-
called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
1522
|
+
called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back
|
|
1522
1523
|
to the original grid-item. Also called to remove empty sub-grids when last item is dragged out (since re-creating is simple)
|
|
1523
1524
|
|
|
1524
1525
|
###### Parameters
|
|
@@ -1562,9 +1563,9 @@ Removes widget from the grid.
|
|
|
1562
1563
|
resizable(els, val): GridStack;
|
|
1563
1564
|
```
|
|
1564
1565
|
|
|
1565
|
-
Defined in: [gridstack.ts:
|
|
1566
|
+
Defined in: [gridstack.ts:2255](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2255)
|
|
1566
1567
|
|
|
1567
|
-
Enables/Disables user resizing for specific grid elements.
|
|
1568
|
+
Enables/Disables user resizing for specific grid elements.
|
|
1568
1569
|
For all items and future items, use enableResize() instead. No-op for static grids.
|
|
1569
1570
|
|
|
1570
1571
|
###### Parameters
|
|
@@ -1583,10 +1584,10 @@ the grid instance for chaining
|
|
|
1583
1584
|
###### Example
|
|
1584
1585
|
|
|
1585
1586
|
```ts
|
|
1586
|
-
// Make specific widgets resizable
|
|
1587
|
+
// Make specific widgets resizable
|
|
1587
1588
|
grid.resizable('.my-widget', true);
|
|
1588
1589
|
|
|
1589
|
-
// Disable resizing for specific widgets
|
|
1590
|
+
// Disable resizing for specific widgets
|
|
1590
1591
|
grid.resizable('#fixed-size-widget', false);
|
|
1591
1592
|
```
|
|
1592
1593
|
|
|
@@ -1596,12 +1597,12 @@ grid.resizable('#fixed-size-widget', false);
|
|
|
1596
1597
|
resizeToContent(el): void;
|
|
1597
1598
|
```
|
|
1598
1599
|
|
|
1599
|
-
Defined in: [gridstack.ts:
|
|
1600
|
+
Defined in: [gridstack.ts:1654](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1654)
|
|
1600
1601
|
|
|
1601
|
-
Updates widget height to match the content height to avoid vertical scrollbars or dead space.
|
|
1602
|
+
Updates widget height to match the content height to avoid vertical scrollbars or dead space.
|
|
1602
1603
|
This automatically adjusts the widget height based on its content size.
|
|
1603
1604
|
|
|
1604
|
-
Note: This assumes only 1 child under resizeToContentParent='.grid-stack-item-content'
|
|
1605
|
+
Note: This assumes only 1 child under resizeToContentParent='.grid-stack-item-content'
|
|
1605
1606
|
(sized to gridItem minus padding) that represents the entire content size.
|
|
1606
1607
|
|
|
1607
1608
|
###### Parameters
|
|
@@ -1617,12 +1618,12 @@ Note: This assumes only 1 child under resizeToContentParent='.grid-stack-item-co
|
|
|
1617
1618
|
###### Example
|
|
1618
1619
|
|
|
1619
1620
|
```ts
|
|
1620
|
-
// Resize a widget to fit its content
|
|
1621
|
-
const widget = document.querySelector('.grid-stack-item');
|
|
1621
|
+
// Resize a widget to fit its content
|
|
1622
|
+
const widget = document.querySelector('.grid-stack-item');
|
|
1622
1623
|
grid.resizeToContent(widget);
|
|
1623
1624
|
|
|
1624
|
-
// This is commonly used with dynamic content:
|
|
1625
|
-
widget.querySelector('.content').innerHTML = 'New longer content...';
|
|
1625
|
+
// This is commonly used with dynamic content:
|
|
1626
|
+
widget.querySelector('.content').innerHTML = 'New longer content...';
|
|
1626
1627
|
grid.resizeToContent(widget);
|
|
1627
1628
|
```
|
|
1628
1629
|
|
|
@@ -1632,9 +1633,9 @@ grid.resizeToContent(widget);
|
|
|
1632
1633
|
rotate(els, relative?): GridStack;
|
|
1633
1634
|
```
|
|
1634
1635
|
|
|
1635
|
-
Defined in: [gridstack.ts:
|
|
1636
|
+
Defined in: [gridstack.ts:1729](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1729)
|
|
1636
1637
|
|
|
1637
|
-
Rotate widgets by swapping their width and height. This is typically called when the user presses 'r' during dragging.
|
|
1638
|
+
Rotate widgets by swapping their width and height. This is typically called when the user presses 'r' during dragging.
|
|
1638
1639
|
The rotation swaps the w/h dimensions and adjusts min/max constraints accordingly.
|
|
1639
1640
|
|
|
1640
1641
|
###### Parameters
|
|
@@ -1653,10 +1654,10 @@ the grid instance for chaining
|
|
|
1653
1654
|
###### Example
|
|
1654
1655
|
|
|
1655
1656
|
```ts
|
|
1656
|
-
// Rotate a specific widget
|
|
1657
|
+
// Rotate a specific widget
|
|
1657
1658
|
grid.rotate('.my-widget');
|
|
1658
1659
|
|
|
1659
|
-
// Rotate with relative positioning during drag
|
|
1660
|
+
// Rotate with relative positioning during drag
|
|
1660
1661
|
grid.rotate(widget, { left: 50, top: 30 });
|
|
1661
1662
|
```
|
|
1662
1663
|
|
|
@@ -1724,7 +1725,7 @@ setStatic(
|
|
|
1724
1725
|
|
|
1725
1726
|
Defined in: [gridstack.ts:1470](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1470)
|
|
1726
1727
|
|
|
1727
|
-
Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.
|
|
1728
|
+
Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.
|
|
1728
1729
|
Also toggle the grid-stack-static class.
|
|
1729
1730
|
|
|
1730
1731
|
###### Parameters
|
|
@@ -1749,10 +1750,10 @@ static setupDragIn(
|
|
|
1749
1750
|
root?): void;
|
|
1750
1751
|
```
|
|
1751
1752
|
|
|
1752
|
-
Defined in: [gridstack.ts:
|
|
1753
|
+
Defined in: [gridstack.ts:2198](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2198)
|
|
1753
1754
|
|
|
1754
|
-
call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
1755
|
-
Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar
|
|
1755
|
+
call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.
|
|
1756
|
+
Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar
|
|
1756
1757
|
is dynamically create and needs to be set later.
|
|
1757
1758
|
|
|
1758
1759
|
###### Parameters
|
|
@@ -1774,7 +1775,7 @@ is dynamically create and needs to be set later.
|
|
|
1774
1775
|
protected triggerEvent(event, target): void;
|
|
1775
1776
|
```
|
|
1776
1777
|
|
|
1777
|
-
Defined in: [gridstack.ts:
|
|
1778
|
+
Defined in: [gridstack.ts:2970](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2970)
|
|
1778
1779
|
|
|
1779
1780
|
call given event callback on our main top-most grid (if we're nested)
|
|
1780
1781
|
|
|
@@ -1795,12 +1796,12 @@ call given event callback on our main top-most grid (if we're nested)
|
|
|
1795
1796
|
update(els, opt): GridStack;
|
|
1796
1797
|
```
|
|
1797
1798
|
|
|
1798
|
-
Defined in: [gridstack.ts:
|
|
1799
|
+
Defined in: [gridstack.ts:1550](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1550)
|
|
1799
1800
|
|
|
1800
|
-
Updates widget position/size and other info. This is used to change widget properties after creation.
|
|
1801
|
+
Updates widget position/size and other info. This is used to change widget properties after creation.
|
|
1801
1802
|
Can update position, size, content, and other widget properties.
|
|
1802
1803
|
|
|
1803
|
-
Note: If you need to call this on all nodes, use load() instead which will update what changed.
|
|
1804
|
+
Note: If you need to call this on all nodes, use load() instead which will update what changed.
|
|
1804
1805
|
Setting the same x,y for multiple items will be indeterministic and likely unwanted.
|
|
1805
1806
|
|
|
1806
1807
|
###### Parameters
|
|
@@ -1819,18 +1820,18 @@ the grid instance for chaining
|
|
|
1819
1820
|
###### Example
|
|
1820
1821
|
|
|
1821
1822
|
```ts
|
|
1822
|
-
// Update widget size and position
|
|
1823
|
+
// Update widget size and position
|
|
1823
1824
|
grid.update('.my-widget', { x: 2, y: 1, w: 3, h: 2 });
|
|
1824
1825
|
|
|
1825
|
-
// Update widget content
|
|
1826
|
+
// Update widget content
|
|
1826
1827
|
grid.update(widget, { content: '<p>New content</p>' });
|
|
1827
1828
|
|
|
1828
|
-
// Update multiple properties
|
|
1829
|
-
grid.update('#my-widget', {
|
|
1830
|
-
w: 4,
|
|
1831
|
-
h: 3,
|
|
1832
|
-
noResize: true,
|
|
1833
|
-
locked: true
|
|
1829
|
+
// Update multiple properties
|
|
1830
|
+
grid.update('#my-widget', {
|
|
1831
|
+
w: 4,
|
|
1832
|
+
h: 3,
|
|
1833
|
+
noResize: true,
|
|
1834
|
+
locked: true
|
|
1834
1835
|
});
|
|
1835
1836
|
```
|
|
1836
1837
|
|
|
@@ -1860,9 +1861,9 @@ Updates the passed in options on the grid (similar to update(widget) for for the
|
|
|
1860
1861
|
willItFit(node): boolean;
|
|
1861
1862
|
```
|
|
1862
1863
|
|
|
1863
|
-
Defined in: [gridstack.ts:
|
|
1864
|
+
Defined in: [gridstack.ts:1807](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1807)
|
|
1864
1865
|
|
|
1865
|
-
Returns true if the height of the grid will be less than the vertical
|
|
1866
|
+
Returns true if the height of the grid will be less than the vertical
|
|
1866
1867
|
constraint. Always returns true if grid doesn't have height constraint.
|
|
1867
1868
|
|
|
1868
1869
|
###### Parameters
|
|
@@ -1878,10 +1879,10 @@ constraint. Always returns true if grid doesn't have height constraint.
|
|
|
1878
1879
|
###### Example
|
|
1879
1880
|
|
|
1880
1881
|
```ts
|
|
1881
|
-
if (grid.willItFit(newWidget)) {
|
|
1882
|
-
grid.addWidget(newWidget);
|
|
1883
|
-
} else {
|
|
1884
|
-
alert('Not enough free space to place the widget');
|
|
1882
|
+
if (grid.willItFit(newWidget)) {
|
|
1883
|
+
grid.addWidget(newWidget);
|
|
1884
|
+
} else {
|
|
1885
|
+
alert('Not enough free space to place the widget');
|
|
1885
1886
|
}
|
|
1886
1887
|
```
|
|
1887
1888
|
|
|
@@ -1889,22 +1890,22 @@ if (grid.willItFit(newWidget)) {
|
|
|
1889
1890
|
|
|
1890
1891
|
| Property | Modifier | Type | Default value | Description | Defined in |
|
|
1891
1892
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
1892
|
-
| <a id="addremovecb"></a> `addRemoveCB?` | `static` | [`AddRemoveFcn`](#addremovefcn) | `undefined` | callback method use when new items|grids needs to be created or deleted, instead of the default item: <div class="grid-stack-item"><div class="grid-stack-item-content">w.content</div></div> grid: <div class="grid-stack">grid content...</div> add = true: the returned DOM element will then be converted to a GridItemHTMLElement using makeWidget()|GridStack:init(). add = false: the item will be removed from DOM (if not already done) grid = true|false for grid vs grid-items | [gridstack.ts:
|
|
1893
|
-
| <a id="animationdelay"></a> `animationDelay` | `public` | `number` | `undefined` | time to wait for animation (if enabled) to be done so content sizing can happen | [gridstack.ts:
|
|
1893
|
+
| <a id="addremovecb"></a> `addRemoveCB?` | `static` | [`AddRemoveFcn`](#addremovefcn) | `undefined` | callback method use when new items|grids needs to be created or deleted, instead of the default item: <div class="grid-stack-item"><div class="grid-stack-item-content">w.content</div></div> grid: <div class="grid-stack">grid content...</div> add = true: the returned DOM element will then be converted to a GridItemHTMLElement using makeWidget()|GridStack:init(). add = false: the item will be removed from DOM (if not already done) grid = true|false for grid vs grid-items | [gridstack.ts:185](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L185) |
|
|
1894
|
+
| <a id="animationdelay"></a> `animationDelay` | `public` | `number` | `undefined` | time to wait for animation (if enabled) to be done so content sizing can happen | [gridstack.ts:219](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L219) |
|
|
1894
1895
|
| <a id="el-4"></a> `el` | `public` | [`GridHTMLElement`](#gridhtmlelement) | `undefined` | the HTML element tied to this grid after it's been initialized | [gridstack.ts:266](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L266) |
|
|
1895
|
-
| <a id="engine"></a> `engine` | `public` | [`GridStackEngine`](#gridstackengine-2) | `undefined` | engine used to implement non DOM grid functionality | [gridstack.ts:
|
|
1896
|
-
| <a id="engine-1"></a> `Engine` | `static` | *typeof* [`GridStackEngine`](#gridstackengine-2) | `GridStackEngine` | scoping so users can call new GridStack.Engine(12) for example | [gridstack.ts:
|
|
1897
|
-
| <a id="engineclass"></a> `engineClass` | `static` | *typeof* [`GridStackEngine`](#gridstackengine-2) | `undefined` | - | [gridstack.ts:
|
|
1896
|
+
| <a id="engine"></a> `engine` | `public` | [`GridStackEngine`](#gridstackengine-2) | `undefined` | engine used to implement non DOM grid functionality | [gridstack.ts:213](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L213) |
|
|
1897
|
+
| <a id="engine-1"></a> `Engine` | `static` | *typeof* [`GridStackEngine`](#gridstackengine-2) | `GridStackEngine` | scoping so users can call new GridStack.Engine(12) for example | [gridstack.ts:210](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L210) |
|
|
1898
|
+
| <a id="engineclass"></a> `engineClass` | `static` | *typeof* [`GridStackEngine`](#gridstackengine-2) | `undefined` | - | [gridstack.ts:221](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L221) |
|
|
1898
1899
|
| <a id="opts"></a> `opts` | `public` | [`GridStackOptions`](#gridstackoptions) | `{}` | grid options - public for classes to access, but use methods to modify! | [gridstack.ts:266](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L266) |
|
|
1899
|
-
| <a id="parentgridnode"></a> `parentGridNode?` | `public` | [`GridStackNode`](#gridstacknode-2) | `undefined` | point to a parent grid item if we're nested (inside a grid-item in between 2 Grids) | [gridstack.ts:
|
|
1900
|
-
| <a id="rendercb"></a> `renderCB?` | `static` | [`RenderFcn`](#renderfcn) | `undefined` | callback to create the content of widgets so the app can control how to store and restore it By default this lib will do 'el.textContent = w.content' forcing text only support for avoiding potential XSS issues. | [gridstack.ts:
|
|
1901
|
-
| <a id="resizeobserver"></a> `resizeObserver` | `protected` | `ResizeObserver` | `undefined` | - | [gridstack.ts:
|
|
1902
|
-
| <a id="resizetocontentcb"></a> `resizeToContentCB?` | `static` | [`ResizeToContentFcn`](#resizetocontentfcn) | `undefined` | callback to use for resizeToContent instead of the built in one | [gridstack.ts:
|
|
1903
|
-
| <a id="resizetocontentparent"></a> `resizeToContentParent` | `static` | `string` | `'.grid-stack-item-content'` | parent class for sizing content. defaults to '.grid-stack-item-content' | [gridstack.ts:
|
|
1904
|
-
| <a id="responselayout"></a> `responseLayout` | `protected` | [`ColumnOptions`](#columnoptions) | `undefined` | - | [gridstack.ts:
|
|
1905
|
-
| <a id="savecb"></a> `saveCB?` | `static` | [`SaveFcn`](#savefcn) | `undefined` | callback during saving to application can inject extra data for each widget, on top of the grid layout properties | [gridstack.ts:
|
|
1906
|
-
| <a id="updatecb"></a> `updateCB?` | `static` | (`w`) => `void` | `undefined` | called after a widget has been updated (eg: load() into an existing list of children) so application can do extra work | [gridstack.ts:
|
|
1907
|
-
| <a id="utils"></a> `Utils` | `static` | *typeof* [`Utils`](#utils-1) | `Utils` | scoping so users can call GridStack.Utils.sort() for example | [gridstack.ts:
|
|
1900
|
+
| <a id="parentgridnode"></a> `parentGridNode?` | `public` | [`GridStackNode`](#gridstacknode-2) | `undefined` | point to a parent grid item if we're nested (inside a grid-item in between 2 Grids) | [gridstack.ts:216](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L216) |
|
|
1901
|
+
| <a id="rendercb"></a> `renderCB?` | `static` | [`RenderFcn`](#renderfcn) | `undefined` | callback to create the content of widgets so the app can control how to store and restore it By default this lib will do 'el.textContent = w.content' forcing text only support for avoiding potential XSS issues. | [gridstack.ts:196](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L196) |
|
|
1902
|
+
| <a id="resizeobserver"></a> `resizeObserver` | `protected` | `ResizeObserver` | `undefined` | - | [gridstack.ts:222](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L222) |
|
|
1903
|
+
| <a id="resizetocontentcb"></a> `resizeToContentCB?` | `static` | [`ResizeToContentFcn`](#resizetocontentfcn) | `undefined` | callback to use for resizeToContent instead of the built in one | [gridstack.ts:202](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L202) |
|
|
1904
|
+
| <a id="resizetocontentparent"></a> `resizeToContentParent` | `static` | `string` | `'.grid-stack-item-content'` | parent class for sizing content. defaults to '.grid-stack-item-content' | [gridstack.ts:204](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L204) |
|
|
1905
|
+
| <a id="responselayout"></a> `responseLayout` | `protected` | [`ColumnOptions`](#columnoptions) | `undefined` | - | [gridstack.ts:259](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L259) |
|
|
1906
|
+
| <a id="savecb"></a> `saveCB?` | `static` | [`SaveFcn`](#savefcn) | `undefined` | callback during saving to application can inject extra data for each widget, on top of the grid layout properties | [gridstack.ts:190](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L190) |
|
|
1907
|
+
| <a id="updatecb"></a> `updateCB?` | `static` | (`w`) => `void` | `undefined` | called after a widget has been updated (eg: load() into an existing list of children) so application can do extra work | [gridstack.ts:199](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L199) |
|
|
1908
|
+
| <a id="utils"></a> `Utils` | `static` | *typeof* [`Utils`](#utils-1) | `Utils` | scoping so users can call GridStack.Utils.sort() for example | [gridstack.ts:207](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L207) |
|
|
1908
1909
|
|
|
1909
1910
|
***
|
|
1910
1911
|
|
|
@@ -2809,8 +2810,8 @@ return true if can fit in grid height constrain only (always true if no maxRow)
|
|
|
2809
2810
|
|
|
2810
2811
|
Defined in: [utils.ts:97](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L97)
|
|
2811
2812
|
|
|
2812
|
-
Collection of utility methods used throughout GridStack.
|
|
2813
|
-
These are general-purpose helper functions for DOM manipulation,
|
|
2813
|
+
Collection of utility methods used throughout GridStack.
|
|
2814
|
+
These are general-purpose helper functions for DOM manipulation,
|
|
2814
2815
|
positioning calculations, object operations, and more.
|
|
2815
2816
|
|
|
2816
2817
|
#### Constructors
|
|
@@ -2833,7 +2834,7 @@ new Utils(): Utils;
|
|
|
2833
2834
|
static addElStyles(el, styles): void;
|
|
2834
2835
|
```
|
|
2835
2836
|
|
|
2836
|
-
Defined in: [utils.ts:
|
|
2837
|
+
Defined in: [utils.ts:667](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L667)
|
|
2837
2838
|
|
|
2838
2839
|
###### Parameters
|
|
2839
2840
|
|
|
@@ -2852,7 +2853,7 @@ Defined in: [utils.ts:701](https://github.com/adumesny/gridstack.js/blob/master/
|
|
|
2852
2853
|
static appendTo(el, parent): void;
|
|
2853
2854
|
```
|
|
2854
2855
|
|
|
2855
|
-
Defined in: [utils.ts:
|
|
2856
|
+
Defined in: [utils.ts:649](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L649)
|
|
2856
2857
|
|
|
2857
2858
|
###### Parameters
|
|
2858
2859
|
|
|
@@ -2919,9 +2920,9 @@ the area of overlap (0 if no overlap)
|
|
|
2919
2920
|
###### Example
|
|
2920
2921
|
|
|
2921
2922
|
```ts
|
|
2922
|
-
const overlap = Utils.areaIntercept(
|
|
2923
|
-
{x: 0, y: 0, w: 3, h: 2},
|
|
2924
|
-
{x: 1, y: 0, w: 3, h: 2}
|
|
2923
|
+
const overlap = Utils.areaIntercept(
|
|
2924
|
+
{x: 0, y: 0, w: 3, h: 2},
|
|
2925
|
+
{x: 1, y: 0, w: 3, h: 2}
|
|
2925
2926
|
); // returns 4 (2x2 overlap)
|
|
2926
2927
|
```
|
|
2927
2928
|
|
|
@@ -2931,7 +2932,7 @@ const overlap = Utils.areaIntercept(
|
|
|
2931
2932
|
static canBeRotated(n): boolean;
|
|
2932
2933
|
```
|
|
2933
2934
|
|
|
2934
|
-
Defined in: [utils.ts:
|
|
2935
|
+
Defined in: [utils.ts:770](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L770)
|
|
2935
2936
|
|
|
2936
2937
|
true if the item can be rotated (checking for prop, not space available)
|
|
2937
2938
|
|
|
@@ -2951,7 +2952,7 @@ true if the item can be rotated (checking for prop, not space available)
|
|
|
2951
2952
|
static clone<T>(obj): T;
|
|
2952
2953
|
```
|
|
2953
2954
|
|
|
2954
|
-
Defined in: [utils.ts:
|
|
2955
|
+
Defined in: [utils.ts:612](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L612)
|
|
2955
2956
|
|
|
2956
2957
|
single level clone, returning a new object with same top fields. This will share sub objects and arrays
|
|
2957
2958
|
|
|
@@ -2977,9 +2978,9 @@ single level clone, returning a new object with same top fields. This will share
|
|
|
2977
2978
|
static cloneDeep<T>(obj): T;
|
|
2978
2979
|
```
|
|
2979
2980
|
|
|
2980
|
-
Defined in: [utils.ts:
|
|
2981
|
+
Defined in: [utils.ts:628](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L628)
|
|
2981
2982
|
|
|
2982
|
-
Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.
|
|
2983
|
+
Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.
|
|
2983
2984
|
Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.
|
|
2984
2985
|
|
|
2985
2986
|
###### Type Parameters
|
|
@@ -3004,7 +3005,7 @@ Note: this will use as-is any key starting with double __ (and not copy inside)
|
|
|
3004
3005
|
static cloneNode(el): HTMLElement;
|
|
3005
3006
|
```
|
|
3006
3007
|
|
|
3007
|
-
Defined in: [utils.ts:
|
|
3008
|
+
Defined in: [utils.ts:643](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L643)
|
|
3008
3009
|
|
|
3009
3010
|
deep clone the given HTML node, removing teh unique id field
|
|
3010
3011
|
|
|
@@ -3029,7 +3030,7 @@ static copyPos(
|
|
|
3029
3030
|
|
|
3030
3031
|
Defined in: [utils.ts:474](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L474)
|
|
3031
3032
|
|
|
3032
|
-
Copy position and size properties from one widget to another.
|
|
3033
|
+
Copy position and size properties from one widget to another.
|
|
3033
3034
|
Copies x, y, w, h and optionally min/max constraints.
|
|
3034
3035
|
|
|
3035
3036
|
###### Parameters
|
|
@@ -3049,7 +3050,7 @@ the target widget (a)
|
|
|
3049
3050
|
###### Example
|
|
3050
3051
|
|
|
3051
3052
|
```ts
|
|
3052
|
-
Utils.copyPos(widget1, widget2); // Copy position/size
|
|
3053
|
+
Utils.copyPos(widget1, widget2); // Copy position/size
|
|
3053
3054
|
Utils.copyPos(widget1, widget2, true); // Also copy constraints
|
|
3054
3055
|
```
|
|
3055
3056
|
|
|
@@ -3079,7 +3080,7 @@ the created div element
|
|
|
3079
3080
|
###### Example
|
|
3080
3081
|
|
|
3081
3082
|
```ts
|
|
3082
|
-
const div = Utils.createDiv(['grid-item', 'draggable']);
|
|
3083
|
+
const div = Utils.createDiv(['grid-item', 'draggable']);
|
|
3083
3084
|
const nested = Utils.createDiv(['content'], parentDiv);
|
|
3084
3085
|
```
|
|
3085
3086
|
|
|
@@ -3091,7 +3092,7 @@ static defaults(target, ...sources): object;
|
|
|
3091
3092
|
|
|
3092
3093
|
Defined in: [utils.ts:421](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L421)
|
|
3093
3094
|
|
|
3094
|
-
Copy unset fields from source objects to target object (shallow merge with defaults).
|
|
3095
|
+
Copy unset fields from source objects to target object (shallow merge with defaults).
|
|
3095
3096
|
Similar to Object.assign but only sets undefined/null fields.
|
|
3096
3097
|
|
|
3097
3098
|
###### Parameters
|
|
@@ -3110,8 +3111,8 @@ the modified target object
|
|
|
3110
3111
|
###### Example
|
|
3111
3112
|
|
|
3112
3113
|
```ts
|
|
3113
|
-
const config = { width: 100 };
|
|
3114
|
-
Utils.defaults(config, { width: 200, height: 50 });
|
|
3114
|
+
const config = { width: 100 };
|
|
3115
|
+
Utils.defaults(config, { width: 200, height: 50 });
|
|
3115
3116
|
// config is now { width: 100, height: 50 }
|
|
3116
3117
|
```
|
|
3117
3118
|
|
|
@@ -3141,7 +3142,7 @@ the node with matching ID, or undefined if not found
|
|
|
3141
3142
|
###### Example
|
|
3142
3143
|
|
|
3143
3144
|
```ts
|
|
3144
|
-
const node = Utils.find(nodes, 'widget-1');
|
|
3145
|
+
const node = Utils.find(nodes, 'widget-1');
|
|
3145
3146
|
if (node) console.log('Found node at:', node.x, node.y);
|
|
3146
3147
|
```
|
|
3147
3148
|
|
|
@@ -3153,7 +3154,7 @@ static getElement(els, root): HTMLElement;
|
|
|
3153
3154
|
|
|
3154
3155
|
Defined in: [utils.ts:155](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L155)
|
|
3155
3156
|
|
|
3156
|
-
Convert a potential selector into a single HTML element.
|
|
3157
|
+
Convert a potential selector into a single HTML element.
|
|
3157
3158
|
Similar to getElements() but returns only the first match.
|
|
3158
3159
|
|
|
3159
3160
|
###### Parameters
|
|
@@ -3172,7 +3173,7 @@ the first HTML element matching the selector, or null if not found
|
|
|
3172
3173
|
###### Example
|
|
3173
3174
|
|
|
3174
3175
|
```ts
|
|
3175
|
-
const element = Utils.getElement('#myWidget');
|
|
3176
|
+
const element = Utils.getElement('#myWidget');
|
|
3176
3177
|
const first = Utils.getElement('.grid-item');
|
|
3177
3178
|
```
|
|
3178
3179
|
|
|
@@ -3184,7 +3185,7 @@ static getElements(els, root): HTMLElement[];
|
|
|
3184
3185
|
|
|
3185
3186
|
Defined in: [utils.ts:112](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L112)
|
|
3186
3187
|
|
|
3187
|
-
Convert a potential selector into an actual list of HTML elements.
|
|
3188
|
+
Convert a potential selector into an actual list of HTML elements.
|
|
3188
3189
|
Supports CSS selectors, element references, and special ID handling.
|
|
3189
3190
|
|
|
3190
3191
|
###### Parameters
|
|
@@ -3203,8 +3204,8 @@ array of HTML elements matching the selector
|
|
|
3203
3204
|
###### Example
|
|
3204
3205
|
|
|
3205
3206
|
```ts
|
|
3206
|
-
const elements = Utils.getElements('.grid-item');
|
|
3207
|
-
const byId = Utils.getElements('#myWidget');
|
|
3207
|
+
const elements = Utils.getElements('.grid-item');
|
|
3208
|
+
const byId = Utils.getElements('#myWidget');
|
|
3208
3209
|
const fromShadow = Utils.getElements('.item', shadowRoot);
|
|
3209
3210
|
```
|
|
3210
3211
|
|
|
@@ -3214,9 +3215,9 @@ const fromShadow = Utils.getElements('.item', shadowRoot);
|
|
|
3214
3215
|
static getValuesFromTransformedElement(parent): DragTransform;
|
|
3215
3216
|
```
|
|
3216
3217
|
|
|
3217
|
-
Defined in: [utils.ts:
|
|
3218
|
+
Defined in: [utils.ts:727](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L727)
|
|
3218
3219
|
|
|
3219
|
-
defines an element that is used to get the offset and scale from grid transforms
|
|
3220
|
+
defines an element that is used to get the offset and scale from grid transforms
|
|
3220
3221
|
returns the scale and offsets from said element
|
|
3221
3222
|
|
|
3222
3223
|
###### Parameters
|
|
@@ -3235,7 +3236,7 @@ returns the scale and offsets from said element
|
|
|
3235
3236
|
static initEvent<T>(e, info): T;
|
|
3236
3237
|
```
|
|
3237
3238
|
|
|
3238
|
-
Defined in: [utils.ts:
|
|
3239
|
+
Defined in: [utils.ts:684](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L684)
|
|
3239
3240
|
|
|
3240
3241
|
###### Type Parameters
|
|
3241
3242
|
|
|
@@ -3282,9 +3283,9 @@ true if the positions overlap
|
|
|
3282
3283
|
###### Example
|
|
3283
3284
|
|
|
3284
3285
|
```ts
|
|
3285
|
-
const overlaps = Utils.isIntercepted(
|
|
3286
|
-
{x: 0, y: 0, w: 2, h: 1},
|
|
3287
|
-
{x: 1, y: 0, w: 2, h: 1}
|
|
3286
|
+
const overlaps = Utils.isIntercepted(
|
|
3287
|
+
{x: 0, y: 0, w: 2, h: 1},
|
|
3288
|
+
{x: 1, y: 0, w: 2, h: 1}
|
|
3288
3289
|
); // true - they overlap
|
|
3289
3290
|
```
|
|
3290
3291
|
|
|
@@ -3314,9 +3315,9 @@ true if the positions are touching
|
|
|
3314
3315
|
###### Example
|
|
3315
3316
|
|
|
3316
3317
|
```ts
|
|
3317
|
-
const touching = Utils.isTouching(
|
|
3318
|
-
{x: 0, y: 0, w: 2, h: 1},
|
|
3319
|
-
{x: 2, y: 0, w: 1, h: 1}
|
|
3318
|
+
const touching = Utils.isTouching(
|
|
3319
|
+
{x: 0, y: 0, w: 2, h: 1},
|
|
3320
|
+
{x: 2, y: 0, w: 1, h: 1}
|
|
3320
3321
|
); // true - they share an edge
|
|
3321
3322
|
```
|
|
3322
3323
|
|
|
@@ -3345,8 +3346,8 @@ true if the item should be lazy loaded
|
|
|
3345
3346
|
###### Example
|
|
3346
3347
|
|
|
3347
3348
|
```ts
|
|
3348
|
-
if (Utils.lazyLoad(node)) {
|
|
3349
|
-
// Set up intersection observer for lazy loading
|
|
3349
|
+
if (Utils.lazyLoad(node)) {
|
|
3350
|
+
// Set up intersection observer for lazy loading
|
|
3350
3351
|
}
|
|
3351
3352
|
```
|
|
3352
3353
|
|
|
@@ -3358,7 +3359,7 @@ static parseHeight(val): HeightData;
|
|
|
3358
3359
|
|
|
3359
3360
|
Defined in: [utils.ts:388](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L388)
|
|
3360
3361
|
|
|
3361
|
-
Parse a height value with units into numeric value and unit string.
|
|
3362
|
+
Parse a height value with units into numeric value and unit string.
|
|
3362
3363
|
Supports px, em, rem, vh, vw, %, cm, mm units.
|
|
3363
3364
|
|
|
3364
3365
|
###### Parameters
|
|
@@ -3376,8 +3377,8 @@ object with h (height) and unit properties
|
|
|
3376
3377
|
###### Example
|
|
3377
3378
|
|
|
3378
3379
|
```ts
|
|
3379
|
-
Utils.parseHeight('100px'); // {h: 100, unit: 'px'}
|
|
3380
|
-
Utils.parseHeight('2rem'); // {h: 2, unit: 'rem'}
|
|
3380
|
+
Utils.parseHeight('100px'); // {h: 100, unit: 'px'}
|
|
3381
|
+
Utils.parseHeight('2rem'); // {h: 2, unit: 'rem'}
|
|
3381
3382
|
Utils.parseHeight(50); // {h: 50, unit: 'px'}
|
|
3382
3383
|
```
|
|
3383
3384
|
|
|
@@ -3449,7 +3450,7 @@ static same(a, b): boolean;
|
|
|
3449
3450
|
|
|
3450
3451
|
Defined in: [utils.ts:450](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L450)
|
|
3451
3452
|
|
|
3452
|
-
Compare two objects for equality (shallow comparison).
|
|
3453
|
+
Compare two objects for equality (shallow comparison).
|
|
3453
3454
|
Checks if objects have the same fields and values at one level deep.
|
|
3454
3455
|
|
|
3455
3456
|
###### Parameters
|
|
@@ -3468,7 +3469,7 @@ true if objects have the same values
|
|
|
3468
3469
|
###### Example
|
|
3469
3470
|
|
|
3470
3471
|
```ts
|
|
3471
|
-
Utils.same({x: 1, y: 2}, {x: 1, y: 2}); // true
|
|
3472
|
+
Utils.same({x: 1, y: 2}, {x: 1, y: 2}); // true
|
|
3472
3473
|
Utils.same({x: 1}, {x: 1, y: 2}); // false
|
|
3473
3474
|
```
|
|
3474
3475
|
|
|
@@ -3539,8 +3540,8 @@ true if the widget should resize to content
|
|
|
3539
3540
|
###### Example
|
|
3540
3541
|
|
|
3541
3542
|
```ts
|
|
3542
|
-
if (Utils.shouldSizeToContent(node)) {
|
|
3543
|
-
// Trigger content-based resizing
|
|
3543
|
+
if (Utils.shouldSizeToContent(node)) {
|
|
3544
|
+
// Trigger content-based resizing
|
|
3544
3545
|
}
|
|
3545
3546
|
```
|
|
3546
3547
|
|
|
@@ -3553,7 +3554,7 @@ static simulateMouseEvent(
|
|
|
3553
3554
|
target?): void;
|
|
3554
3555
|
```
|
|
3555
3556
|
|
|
3556
|
-
Defined in: [utils.ts:
|
|
3557
|
+
Defined in: [utils.ts:700](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L700)
|
|
3557
3558
|
|
|
3558
3559
|
copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target
|
|
3559
3560
|
|
|
@@ -3595,7 +3596,7 @@ the sorted array (modifies original)
|
|
|
3595
3596
|
###### Example
|
|
3596
3597
|
|
|
3597
3598
|
```ts
|
|
3598
|
-
const sorted = Utils.sort(nodes); // Sort top-left to bottom-right
|
|
3599
|
+
const sorted = Utils.sort(nodes); // Sort top-left to bottom-right
|
|
3599
3600
|
const reverse = Utils.sort(nodes, -1); // Sort bottom-right to top-left
|
|
3600
3601
|
```
|
|
3601
3602
|
|
|
@@ -3608,7 +3609,7 @@ static swap(
|
|
|
3608
3609
|
b): void;
|
|
3609
3610
|
```
|
|
3610
3611
|
|
|
3611
|
-
Defined in: [utils.ts:
|
|
3612
|
+
Defined in: [utils.ts:751](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L751)
|
|
3612
3613
|
|
|
3613
3614
|
swap the given object 2 field values
|
|
3614
3615
|
|
|
@@ -3659,7 +3660,7 @@ static toBool(v): boolean;
|
|
|
3659
3660
|
|
|
3660
3661
|
Defined in: [utils.ts:350](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L350)
|
|
3661
3662
|
|
|
3662
|
-
Convert various value types to boolean.
|
|
3663
|
+
Convert various value types to boolean.
|
|
3663
3664
|
Handles strings like 'false', 'no', '0' as false.
|
|
3664
3665
|
|
|
3665
3666
|
###### Parameters
|
|
@@ -3677,9 +3678,9 @@ boolean representation
|
|
|
3677
3678
|
###### Example
|
|
3678
3679
|
|
|
3679
3680
|
```ts
|
|
3680
|
-
Utils.toBool('true'); // true
|
|
3681
|
-
Utils.toBool('false'); // false
|
|
3682
|
-
Utils.toBool('no'); // false
|
|
3681
|
+
Utils.toBool('true'); // true
|
|
3682
|
+
Utils.toBool('false'); // false
|
|
3683
|
+
Utils.toBool('no'); // false
|
|
3683
3684
|
Utils.toBool('1'); // true
|
|
3684
3685
|
```
|
|
3685
3686
|
|
|
@@ -3708,8 +3709,8 @@ number value, or undefined for null/empty strings
|
|
|
3708
3709
|
###### Example
|
|
3709
3710
|
|
|
3710
3711
|
```ts
|
|
3711
|
-
Utils.toNumber('42'); // 42
|
|
3712
|
-
Utils.toNumber(''); // undefined
|
|
3712
|
+
Utils.toNumber('42'); // 42
|
|
3713
|
+
Utils.toNumber(''); // undefined
|
|
3713
3714
|
Utils.toNumber(null); // undefined
|
|
3714
3715
|
```
|
|
3715
3716
|
|
|
@@ -3977,7 +3978,7 @@ Note: Use enable()/disable() methods to change state as other operations need to
|
|
|
3977
3978
|
new DDDraggable(el, option): DDDraggable;
|
|
3978
3979
|
```
|
|
3979
3980
|
|
|
3980
|
-
Defined in: [dd-draggable.ts:
|
|
3981
|
+
Defined in: [dd-draggable.ts:69](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L69)
|
|
3981
3982
|
|
|
3982
3983
|
###### Parameters
|
|
3983
3984
|
|
|
@@ -4002,7 +4003,7 @@ Defined in: [dd-draggable.ts:65](https://github.com/adumesny/gridstack.js/blob/m
|
|
|
4002
4003
|
destroy(): void;
|
|
4003
4004
|
```
|
|
4004
4005
|
|
|
4005
|
-
Defined in: [dd-draggable.ts:
|
|
4006
|
+
Defined in: [dd-draggable.ts:122](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L122)
|
|
4006
4007
|
|
|
4007
4008
|
Destroy this drag & drop implementation and clean up resources.
|
|
4008
4009
|
Removes all event handlers and clears internal state.
|
|
@@ -4021,7 +4022,7 @@ Removes all event handlers and clears internal state.
|
|
|
4021
4022
|
disable(forDestroy): void;
|
|
4022
4023
|
```
|
|
4023
4024
|
|
|
4024
|
-
Defined in: [dd-draggable.ts:
|
|
4025
|
+
Defined in: [dd-draggable.ts:109](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L109)
|
|
4025
4026
|
|
|
4026
4027
|
Disable this drag & drop implementation.
|
|
4027
4028
|
Subclasses should override to perform additional cleanup.
|
|
@@ -4046,7 +4047,7 @@ Subclasses should override to perform additional cleanup.
|
|
|
4046
4047
|
enable(): void;
|
|
4047
4048
|
```
|
|
4048
4049
|
|
|
4049
|
-
Defined in: [dd-draggable.ts:
|
|
4050
|
+
Defined in: [dd-draggable.ts:95](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L95)
|
|
4050
4051
|
|
|
4051
4052
|
Enable this drag & drop implementation.
|
|
4052
4053
|
Subclasses should override to perform additional setup.
|
|
@@ -4065,7 +4066,7 @@ Subclasses should override to perform additional setup.
|
|
|
4065
4066
|
off(event): void;
|
|
4066
4067
|
```
|
|
4067
4068
|
|
|
4068
|
-
Defined in: [dd-draggable.ts:
|
|
4069
|
+
Defined in: [dd-draggable.ts:91](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L91)
|
|
4069
4070
|
|
|
4070
4071
|
Unregister an event callback for the specified event.
|
|
4071
4072
|
|
|
@@ -4089,7 +4090,7 @@ Unregister an event callback for the specified event.
|
|
|
4089
4090
|
on(event, callback): void;
|
|
4090
4091
|
```
|
|
4091
4092
|
|
|
4092
|
-
Defined in: [dd-draggable.ts:
|
|
4093
|
+
Defined in: [dd-draggable.ts:87](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L87)
|
|
4093
4094
|
|
|
4094
4095
|
Register an event callback for the specified event.
|
|
4095
4096
|
|
|
@@ -4141,7 +4142,7 @@ Result from the callback function, if any
|
|
|
4141
4142
|
updateOption(opts): DDDraggable;
|
|
4142
4143
|
```
|
|
4143
4144
|
|
|
4144
|
-
Defined in: [dd-draggable.ts:
|
|
4145
|
+
Defined in: [dd-draggable.ts:133](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L133)
|
|
4145
4146
|
|
|
4146
4147
|
Method to update the options and return the DD implementation
|
|
4147
4148
|
|
|
@@ -4163,9 +4164,11 @@ Method to update the options and return the DD implementation
|
|
|
4163
4164
|
|
|
4164
4165
|
| Property | Modifier | Type | Default value | Description | Defined in |
|
|
4165
4166
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
4166
|
-
| <a id="
|
|
4167
|
+
| <a id="_autoscrollcontainer"></a> `_autoScrollContainer?` | `protected` | `HTMLElement` | `undefined` | - | [dd-draggable.ts:66](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L66) |
|
|
4168
|
+
| <a id="_autoscrollmaxspeed"></a> `_autoScrollMaxSpeed?` | `protected` | `number` | `undefined` | - | [dd-draggable.ts:67](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L67) |
|
|
4169
|
+
| <a id="el"></a> `el` | `public` | [`GridItemHTMLElement`](#griditemhtmlelement) | `undefined` | The HTML element being extended | [dd-draggable.ts:69](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L69) |
|
|
4167
4170
|
| <a id="helper"></a> `helper` | `public` | `HTMLElement` | `undefined` | - | [dd-draggable.ts:35](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L35) |
|
|
4168
|
-
| <a id="option"></a> `option` | `public` | [`DDDragOpt`](#dddragopt) | `{}` | The drag & drop options/configuration | [dd-draggable.ts:
|
|
4171
|
+
| <a id="option"></a> `option` | `public` | [`DDDragOpt`](#dddragopt) | `{}` | The drag & drop options/configuration | [dd-draggable.ts:69](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L69) |
|
|
4169
4172
|
|
|
4170
4173
|
***
|
|
4171
4174
|
|
|
@@ -4285,7 +4288,7 @@ Subclasses should override to perform additional cleanup.
|
|
|
4285
4288
|
drop(e): void;
|
|
4286
4289
|
```
|
|
4287
4290
|
|
|
4288
|
-
Defined in: [dd-droppable.ts:
|
|
4291
|
+
Defined in: [dd-droppable.ts:146](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L146)
|
|
4289
4292
|
|
|
4290
4293
|
item is being dropped on us - called by the drag mouseup handler - this calls the client drop event
|
|
4291
4294
|
|
|
@@ -5200,7 +5203,7 @@ Used with the responsive.breakpoints option.
|
|
|
5200
5203
|
<a id="cellposition"></a>
|
|
5201
5204
|
### CellPosition
|
|
5202
5205
|
|
|
5203
|
-
Defined in: [gridstack.ts:
|
|
5206
|
+
Defined in: [gridstack.ts:57](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L57)
|
|
5204
5207
|
|
|
5205
5208
|
Defines the position of a cell inside the grid
|
|
5206
5209
|
|
|
@@ -5208,8 +5211,8 @@ Defines the position of a cell inside the grid
|
|
|
5208
5211
|
|
|
5209
5212
|
| Property | Type | Defined in |
|
|
5210
5213
|
| ------ | ------ | ------ |
|
|
5211
|
-
| <a id="x"></a> `x` | `number` | [gridstack.ts:
|
|
5212
|
-
| <a id="y"></a> `y` | `number` | [gridstack.ts:
|
|
5214
|
+
| <a id="x"></a> `x` | `number` | [gridstack.ts:58](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L58) |
|
|
5215
|
+
| <a id="y"></a> `y` | `number` | [gridstack.ts:59](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L59) |
|
|
5213
5216
|
|
|
5214
5217
|
***
|
|
5215
5218
|
|
|
@@ -5392,7 +5395,7 @@ Defined in: [utils.ts:13](https://github.com/adumesny/gridstack.js/blob/master/s
|
|
|
5392
5395
|
<a id="gridhtmlelement"></a>
|
|
5393
5396
|
### GridHTMLElement
|
|
5394
5397
|
|
|
5395
|
-
Defined in: [gridstack.ts:
|
|
5398
|
+
Defined in: [gridstack.ts:43](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L43)
|
|
5396
5399
|
|
|
5397
5400
|
#### Extends
|
|
5398
5401
|
|
|
@@ -5402,7 +5405,7 @@ Defined in: [gridstack.ts:42](https://github.com/adumesny/gridstack.js/blob/mast
|
|
|
5402
5405
|
|
|
5403
5406
|
| Property | Type | Defined in |
|
|
5404
5407
|
| ------ | ------ | ------ |
|
|
5405
|
-
| <a id="gridstack"></a> `gridstack?` | [`GridStack`](#gridstack-1) | [gridstack.ts:
|
|
5408
|
+
| <a id="gridstack"></a> `gridstack?` | [`GridStack`](#gridstack-1) | [gridstack.ts:44](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L44) |
|
|
5406
5409
|
|
|
5407
5410
|
***
|
|
5408
5411
|
|
|
@@ -5449,6 +5452,23 @@ options used during creation - similar to GridStackOptions
|
|
|
5449
5452
|
|
|
5450
5453
|
***
|
|
5451
5454
|
|
|
5455
|
+
<a id="gridstackmouseevent"></a>
|
|
5456
|
+
### GridStackMouseEvent
|
|
5457
|
+
|
|
5458
|
+
Defined in: [types.ts:579](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L579)
|
|
5459
|
+
|
|
5460
|
+
#### Extends
|
|
5461
|
+
|
|
5462
|
+
- `MouseEvent`
|
|
5463
|
+
|
|
5464
|
+
#### Properties
|
|
5465
|
+
|
|
5466
|
+
| Property | Type | Defined in |
|
|
5467
|
+
| ------ | ------ | ------ |
|
|
5468
|
+
| <a id="resizedir"></a> `resizeDir?` | `string` | [types.ts:580](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L580) |
|
|
5469
|
+
|
|
5470
|
+
***
|
|
5471
|
+
|
|
5452
5472
|
<a id="gridstackmoveopts"></a>
|
|
5453
5473
|
### GridStackMoveOpts
|
|
5454
5474
|
|
|
@@ -5647,7 +5667,7 @@ Method to update the options and return the DD implementation
|
|
|
5647
5667
|
<a id="mouseposition"></a>
|
|
5648
5668
|
### MousePosition
|
|
5649
5669
|
|
|
5650
|
-
Defined in: [gridstack.ts:
|
|
5670
|
+
Defined in: [gridstack.ts:51](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L51)
|
|
5651
5671
|
|
|
5652
5672
|
Defines the coordinates of an object
|
|
5653
5673
|
|
|
@@ -5655,8 +5675,8 @@ Defines the coordinates of an object
|
|
|
5655
5675
|
|
|
5656
5676
|
| Property | Type | Defined in |
|
|
5657
5677
|
| ------ | ------ | ------ |
|
|
5658
|
-
| <a id="left"></a> `left` | `number` | [gridstack.ts:
|
|
5659
|
-
| <a id="top"></a> `top` | `number` | [gridstack.ts:
|
|
5678
|
+
| <a id="left"></a> `left` | `number` | [gridstack.ts:53](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L53) |
|
|
5679
|
+
| <a id="top"></a> `top` | `number` | [gridstack.ts:52](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L52) |
|
|
5660
5680
|
|
|
5661
5681
|
***
|
|
5662
5682
|
|
|
@@ -6042,7 +6062,7 @@ type GridStackEvent =
|
|
|
6042
6062
|
| "resizecontent";
|
|
6043
6063
|
```
|
|
6044
6064
|
|
|
6045
|
-
Defined in: [gridstack.ts:
|
|
6065
|
+
Defined in: [gridstack.ts:47](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L47)
|
|
6046
6066
|
|
|
6047
6067
|
list of possible events, or space separated list of them
|
|
6048
6068
|
|