gridstack 12.3.3 → 12.4.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 +4 -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 +6 -4
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +7 -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 +4 -4
- package/dist/angular/lib/types.d.ts +1 -1
- package/dist/angular/package.json +1 -1
- package/dist/angular/projects/lib/src/index.d.ts +5 -0
- package/dist/angular/projects/lib/src/index.js +9 -0
- package/dist/angular/projects/lib/src/index.js.map +1 -0
- package/dist/angular/projects/lib/src/lib/base-widget.d.ts +56 -0
- package/dist/angular/projects/lib/src/lib/base-widget.js +94 -0
- package/dist/angular/projects/lib/src/lib/base-widget.js.map +1 -0
- package/dist/angular/projects/lib/src/lib/gridstack-item.component.d.ts +76 -0
- package/dist/angular/projects/lib/src/lib/gridstack-item.component.js +112 -0
- package/dist/angular/projects/lib/src/lib/gridstack-item.component.js.map +1 -0
- package/dist/angular/projects/lib/src/lib/gridstack.component.d.ts +233 -0
- package/dist/angular/projects/lib/src/lib/gridstack.component.js +457 -0
- package/dist/angular/projects/lib/src/lib/gridstack.component.js.map +1 -0
- package/dist/angular/projects/lib/src/lib/gridstack.module.d.ts +29 -0
- package/dist/angular/projects/lib/src/lib/gridstack.module.js +52 -0
- package/dist/angular/projects/lib/src/lib/gridstack.module.js.map +1 -0
- package/dist/angular/projects/lib/src/lib/types.d.ts +51 -0
- package/dist/angular/projects/lib/src/lib/types.js +6 -0
- package/dist/angular/projects/lib/src/lib/types.js.map +1 -0
- package/dist/angular/src/base-widget.ts +13 -13
- package/dist/angular/src/gridstack-item.component.ts +5 -5
- package/dist/angular/src/gridstack.component.ts +34 -32
- package/dist/angular/src/gridstack.module.ts +4 -4
- package/dist/angular/src/types.ts +3 -2
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack.css +1 -1
- package/dist/src/dd-base-impl.d.ts +1 -1
- package/dist/src/dd-base-impl.js +1 -1
- package/dist/src/dd-base-impl.js.map +1 -1
- package/dist/src/dd-draggable.d.ts +1 -1
- package/dist/src/dd-draggable.js +1 -1
- package/dist/src/dd-draggable.js.map +1 -1
- package/dist/src/dd-droppable.d.ts +1 -1
- package/dist/src/dd-droppable.js +7 -1
- package/dist/src/dd-droppable.js.map +1 -1
- package/dist/src/dd-element.d.ts +1 -1
- package/dist/src/dd-element.js +1 -1
- package/dist/src/dd-element.js.map +1 -1
- package/dist/src/dd-gridstack.d.ts +1 -1
- package/dist/src/dd-gridstack.js +1 -1
- package/dist/src/dd-gridstack.js.map +1 -1
- package/dist/src/dd-manager.d.ts +1 -1
- package/dist/src/dd-manager.js +1 -1
- package/dist/src/dd-manager.js.map +1 -1
- package/dist/src/dd-resizable-handle.d.ts +5 -4
- package/dist/src/dd-resizable-handle.js +23 -8
- package/dist/src/dd-resizable-handle.js.map +1 -1
- package/dist/src/dd-resizable.d.ts +3 -5
- package/dist/src/dd-resizable.js +5 -10
- package/dist/src/dd-resizable.js.map +1 -1
- package/dist/src/dd-touch.d.ts +1 -1
- package/dist/src/dd-touch.js +1 -1
- package/dist/src/dd-touch.js.map +1 -1
- package/dist/src/gridstack-engine.d.ts +1 -1
- package/dist/src/gridstack-engine.js +7 -1
- package/dist/src/gridstack-engine.js.map +1 -1
- package/dist/src/gridstack.d.ts +1 -2
- package/dist/src/gridstack.js +9 -18
- package/dist/src/gridstack.js.map +1 -1
- package/dist/src/gridstack.scss +1 -1
- package/dist/src/types.d.ts +11 -6
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils.d.ts +1 -270
- package/dist/src/utils.js +37 -31
- package/dist/src/utils.js.map +1 -1
- package/doc/API.md +166 -165
- package/package.json +5 -5
- package/dist/dd-base-impl.d.ts +0 -69
- package/dist/dd-base-impl.js +0 -70
- package/dist/dd-base-impl.js.map +0 -1
- package/dist/dd-draggable.d.ts +0 -20
- package/dist/dd-draggable.js +0 -364
- package/dist/dd-draggable.js.map +0 -1
- package/dist/dd-droppable.d.ts +0 -26
- package/dist/dd-droppable.js +0 -149
- package/dist/dd-droppable.js.map +0 -1
- package/dist/dd-element.d.ts +0 -27
- package/dist/dd-element.js +0 -91
- package/dist/dd-element.js.map +0 -1
- package/dist/dd-gridstack.d.ts +0 -82
- package/dist/dd-gridstack.js +0 -165
- package/dist/dd-gridstack.js.map +0 -1
- package/dist/dd-manager.d.ts +0 -43
- package/dist/dd-manager.js +0 -14
- package/dist/dd-manager.js.map +0 -1
- package/dist/dd-resizable-handle.d.ts +0 -18
- package/dist/dd-resizable-handle.js +0 -113
- package/dist/dd-resizable-handle.js.map +0 -1
- package/dist/dd-resizable.d.ts +0 -30
- package/dist/dd-resizable.js +0 -304
- package/dist/dd-resizable.js.map +0 -1
- package/dist/dd-touch.d.ts +0 -33
- package/dist/dd-touch.js +0 -145
- package/dist/dd-touch.js.map +0 -1
- package/dist/gridstack-engine.d.ts +0 -321
- package/dist/gridstack-engine.js +0 -1272
- package/dist/gridstack-engine.js.map +0 -1
- package/dist/gridstack.d.ts +0 -802
- package/dist/gridstack.js +0 -2872
- package/dist/gridstack.js.map +0 -1
- package/dist/spec/gridstack-engine-spec.d.ts +0 -1
- package/dist/spec/gridstack-engine-spec.js +0 -358
- package/dist/spec/gridstack-engine-spec.js.map +0 -1
- package/dist/spec/gridstack-spec.d.ts +0 -1
- package/dist/spec/gridstack-spec.js +0 -1780
- package/dist/spec/gridstack-spec.js.map +0 -1
- package/dist/spec/integration/gridstack-integration.spec.d.ts +0 -1
- package/dist/spec/integration/gridstack-integration.spec.js +0 -171
- package/dist/spec/integration/gridstack-integration.spec.js.map +0 -1
- package/dist/spec/regression-spec.d.ts +0 -1
- package/dist/spec/regression-spec.js +0 -100
- package/dist/spec/regression-spec.js.map +0 -1
- package/dist/spec/utils-spec.d.ts +0 -1
- package/dist/spec/utils-spec.js +0 -243
- package/dist/spec/utils-spec.js.map +0 -1
- package/dist/types.d.ts +0 -427
- package/dist/types.js +0 -38
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -283
- package/dist/utils.js +0 -787
- package/dist/utils.js.map +0 -1
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -74
- package/dist/vitest.config.js.map +0 -1
- package/dist/vitest.setup.d.ts +0 -1
- package/dist/vitest.setup.js +0 -90
- package/dist/vitest.setup.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gridstack-item.component.ts 12.4.0
|
|
3
|
+
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
|
|
4
|
+
*/
|
|
5
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13
|
+
};
|
|
14
|
+
import { Component, ElementRef, Input, ViewChild, ViewContainerRef } from '@angular/core';
|
|
15
|
+
/**
|
|
16
|
+
* Angular component wrapper for individual GridStack items.
|
|
17
|
+
*
|
|
18
|
+
* This component represents a single grid item and handles:
|
|
19
|
+
* - Dynamic content creation and management
|
|
20
|
+
* - Integration with parent GridStack component
|
|
21
|
+
* - Component lifecycle and cleanup
|
|
22
|
+
* - Widget options and configuration
|
|
23
|
+
*
|
|
24
|
+
* Use in combination with GridstackComponent for the parent grid.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```html
|
|
28
|
+
* <gridstack>
|
|
29
|
+
* <gridstack-item [options]="{x: 0, y: 0, w: 2, h: 1}">
|
|
30
|
+
* <my-widget-component></my-widget-component>
|
|
31
|
+
* </gridstack-item>
|
|
32
|
+
* </gridstack>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
let GridstackItemComponent = class GridstackItemComponent {
|
|
36
|
+
/**
|
|
37
|
+
* Grid item configuration options.
|
|
38
|
+
* Defines position, size, and behavior of this grid item.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* itemOptions: GridStackNode = {
|
|
43
|
+
* x: 0, y: 0, w: 2, h: 1,
|
|
44
|
+
* noResize: true,
|
|
45
|
+
* content: 'Item content'
|
|
46
|
+
* };
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
set options(val) {
|
|
50
|
+
const grid = this.el.gridstackNode?.grid;
|
|
51
|
+
if (grid) {
|
|
52
|
+
// already built, do an update...
|
|
53
|
+
grid.update(this.el, val);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// store our custom element in options so we can update it and not re-create a generic div!
|
|
57
|
+
this._options = { ...val, el: this.el };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** return the latest grid options (from GS once built, otherwise initial values) */
|
|
61
|
+
get options() {
|
|
62
|
+
return this.el.gridstackNode || this._options || { el: this.el };
|
|
63
|
+
}
|
|
64
|
+
/** return the native element that contains grid specific fields as well */
|
|
65
|
+
get el() { return this.elementRef.nativeElement; }
|
|
66
|
+
/** clears the initial options now that we've built */
|
|
67
|
+
clearOptions() {
|
|
68
|
+
delete this._options;
|
|
69
|
+
}
|
|
70
|
+
constructor(elementRef) {
|
|
71
|
+
this.elementRef = elementRef;
|
|
72
|
+
this.el._gridItemComp = this;
|
|
73
|
+
}
|
|
74
|
+
ngOnDestroy() {
|
|
75
|
+
this.clearOptions();
|
|
76
|
+
delete this.childWidget;
|
|
77
|
+
delete this.el._gridItemComp;
|
|
78
|
+
delete this.container;
|
|
79
|
+
delete this.ref;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
__decorate([
|
|
83
|
+
ViewChild('container', { read: ViewContainerRef, static: true }),
|
|
84
|
+
__metadata("design:type", ViewContainerRef)
|
|
85
|
+
], GridstackItemComponent.prototype, "container", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Input(),
|
|
88
|
+
__metadata("design:type", Object),
|
|
89
|
+
__metadata("design:paramtypes", [Object])
|
|
90
|
+
], GridstackItemComponent.prototype, "options", null);
|
|
91
|
+
GridstackItemComponent = __decorate([
|
|
92
|
+
Component({
|
|
93
|
+
selector: 'gridstack-item',
|
|
94
|
+
template: `
|
|
95
|
+
<div class="grid-stack-item-content">
|
|
96
|
+
<!-- where dynamic items go based on component selector (recommended way), or sub-grids, etc...) -->
|
|
97
|
+
<ng-template #container></ng-template>
|
|
98
|
+
<!-- any static (defined in DOM - not recommended) content goes here -->
|
|
99
|
+
<ng-content></ng-content>
|
|
100
|
+
<!-- fallback HTML content from GridStackWidget.content if used instead (not recommended) -->
|
|
101
|
+
{{options.content}}
|
|
102
|
+
</div>`,
|
|
103
|
+
styles: [`
|
|
104
|
+
:host { display: block; }
|
|
105
|
+
`],
|
|
106
|
+
standalone: true,
|
|
107
|
+
// changeDetection: ChangeDetectionStrategy.OnPush, // IFF you want to optimize and control when ChangeDetection needs to happen...
|
|
108
|
+
}),
|
|
109
|
+
__metadata("design:paramtypes", [ElementRef])
|
|
110
|
+
], GridstackItemComponent);
|
|
111
|
+
export { GridstackItemComponent };
|
|
112
|
+
//# sourceMappingURL=gridstack-item.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridstack-item.component.js","sourceRoot":"","sources":["../../../../../../angular/projects/lib/src/lib/gridstack-item.component.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAA2B,MAAM,eAAe,CAAC;AAanH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,IAiBa,sBAAsB,GAjBnC,MAiBa,sBAAsB;IAoBjC;;;;;;;;;;;;OAYG;IACH,IAAoB,OAAO,CAAC,GAAkB;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC;QACzC,IAAI,IAAI,EAAE;YACR,iCAAiC;YACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;SAC3B;aAAM;YACL,2FAA2F;YAC3F,IAAI,CAAC,QAAQ,GAAG,EAAC,GAAG,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAC,CAAC;SACvC;IACH,CAAC;IACD,oFAAoF;IACpF,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,EAAE,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAC,CAAC;IACjE,CAAC;IAID,2EAA2E;IAC3E,IAAW,EAAE,KAA8B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;IAElF,sDAAsD;IAC/C,YAAY;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,YAA+B,UAA+C;QAA/C,eAAU,GAAV,UAAU,CAAqC;QAC5E,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;IAC/B,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,WAAW,CAAA;QACvB,OAAO,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF,CAAA;AA/DyE;IAAvE,SAAS,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;8BAAoB,gBAAgB;yDAAC;AA2BrG;IAAC,KAAK,EAAE;;;qDASP;AA1CU,sBAAsB;IAjBlC,SAAS,CAAC;QACT,QAAQ,EAAE,gBAAgB;QAC1B,QAAQ,EAAE;;;;;;;;WAQD;QACT,MAAM,EAAE,CAAC;;GAER,CAAC;QACF,UAAU,EAAE,IAAI;QAChB,mIAAmI;KACpI,CAAC;qCA2D2C,UAAU;GA1D1C,sBAAsB,CAqElC;SArEY,sBAAsB","sourcesContent":["/**\n * gridstack-item.component.ts 12.4.0\n * Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license\n */\n\nimport { Component, ElementRef, Input, ViewChild, ViewContainerRef, OnDestroy, ComponentRef } from '@angular/core';\nimport { GridItemHTMLElement, GridStackNode } from 'gridstack';\nimport { BaseWidget } from './base-widget';\n\n/**\n * Extended HTMLElement interface for grid items.\n * Stores a back-reference to the Angular component for integration.\n */\nexport interface GridItemCompHTMLElement extends GridItemHTMLElement {\n /** Back-reference to the Angular GridStackItem component */\n _gridItemComp?: GridstackItemComponent;\n}\n\n/**\n * Angular component wrapper for individual GridStack items.\n *\n * This component represents a single grid item and handles:\n * - Dynamic content creation and management\n * - Integration with parent GridStack component\n * - Component lifecycle and cleanup\n * - Widget options and configuration\n *\n * Use in combination with GridstackComponent for the parent grid.\n *\n * @example\n * ```html\n * <gridstack>\n * <gridstack-item [options]=\"{x: 0, y: 0, w: 2, h: 1}\">\n * <my-widget-component></my-widget-component>\n * </gridstack-item>\n * </gridstack>\n * ```\n */\n@Component({\n selector: 'gridstack-item',\n template: `\n <div class=\"grid-stack-item-content\">\n <!-- where dynamic items go based on component selector (recommended way), or sub-grids, etc...) -->\n <ng-template #container></ng-template>\n <!-- any static (defined in DOM - not recommended) content goes here -->\n <ng-content></ng-content>\n <!-- fallback HTML content from GridStackWidget.content if used instead (not recommended) -->\n {{options.content}}\n </div>`,\n styles: [`\n :host { display: block; }\n `],\n standalone: true,\n // changeDetection: ChangeDetectionStrategy.OnPush, // IFF you want to optimize and control when ChangeDetection needs to happen...\n})\nexport class GridstackItemComponent implements OnDestroy {\n\n /**\n * Container for dynamic component creation within this grid item.\n * Used to append child components programmatically.\n */\n @ViewChild('container', { read: ViewContainerRef, static: true}) public container?: ViewContainerRef;\n\n /**\n * Component reference for dynamic component removal.\n * Used internally when this component is created dynamically.\n */\n public ref: ComponentRef<GridstackItemComponent> | undefined;\n\n /**\n * Reference to child widget component for serialization.\n * Used to save/restore additional data along with grid position.\n */\n public childWidget: BaseWidget | undefined;\n\n /**\n * Grid item configuration options.\n * Defines position, size, and behavior of this grid item.\n *\n * @example\n * ```typescript\n * itemOptions: GridStackNode = {\n * x: 0, y: 0, w: 2, h: 1,\n * noResize: true,\n * content: 'Item content'\n * };\n * ```\n */\n @Input() public set options(val: GridStackNode) {\n const grid = this.el.gridstackNode?.grid;\n if (grid) {\n // already built, do an update...\n grid.update(this.el, val);\n } else {\n // store our custom element in options so we can update it and not re-create a generic div!\n this._options = {...val, el: this.el};\n }\n }\n /** return the latest grid options (from GS once built, otherwise initial values) */\n public get options(): GridStackNode {\n return this.el.gridstackNode || this._options || {el: this.el};\n }\n\n protected _options?: GridStackNode;\n\n /** return the native element that contains grid specific fields as well */\n public get el(): GridItemCompHTMLElement { return this.elementRef.nativeElement; }\n\n /** clears the initial options now that we've built */\n public clearOptions() {\n delete this._options;\n }\n\n constructor(protected readonly elementRef: ElementRef<GridItemCompHTMLElement>) {\n this.el._gridItemComp = this;\n }\n\n public ngOnDestroy(): void {\n this.clearOptions();\n delete this.childWidget\n delete this.el._gridItemComp;\n delete this.container;\n delete this.ref;\n }\n}\n"]}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gridstack.component.ts 12.4.0
|
|
3
|
+
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
|
|
4
|
+
*/
|
|
5
|
+
import { AfterContentInit, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList, Type, ViewContainerRef, ComponentRef } from '@angular/core';
|
|
6
|
+
import { Subscription } from 'rxjs';
|
|
7
|
+
import { GridHTMLElement, GridItemHTMLElement, GridStack, GridStackNode, GridStackOptions } from 'gridstack';
|
|
8
|
+
import { NgGridStackNode, NgGridStackWidget } from './types';
|
|
9
|
+
import { GridstackItemComponent } from './gridstack-item.component';
|
|
10
|
+
/**
|
|
11
|
+
* Event handler callback signatures for different GridStack events.
|
|
12
|
+
* These types define the structure of data passed to Angular event emitters.
|
|
13
|
+
*/
|
|
14
|
+
/** Callback for general events (enable, disable, etc.) */
|
|
15
|
+
export type eventCB = {
|
|
16
|
+
event: Event;
|
|
17
|
+
};
|
|
18
|
+
/** Callback for element-specific events (resize, drag, etc.) */
|
|
19
|
+
export type elementCB = {
|
|
20
|
+
event: Event;
|
|
21
|
+
el: GridItemHTMLElement;
|
|
22
|
+
};
|
|
23
|
+
/** Callback for events affecting multiple nodes (change, etc.) */
|
|
24
|
+
export type nodesCB = {
|
|
25
|
+
event: Event;
|
|
26
|
+
nodes: GridStackNode[];
|
|
27
|
+
};
|
|
28
|
+
/** Callback for drop events with before/after node state */
|
|
29
|
+
export type droppedCB = {
|
|
30
|
+
event: Event;
|
|
31
|
+
previousNode: GridStackNode;
|
|
32
|
+
newNode: GridStackNode;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Extended HTMLElement interface for the grid container.
|
|
36
|
+
* Stores a back-reference to the Angular component for integration purposes.
|
|
37
|
+
*/
|
|
38
|
+
export interface GridCompHTMLElement extends GridHTMLElement {
|
|
39
|
+
/** Back-reference to the Angular GridStack component */
|
|
40
|
+
_gridComp?: GridstackComponent;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Mapping of selector strings to Angular component types.
|
|
44
|
+
* Used for dynamic component creation based on widget selectors.
|
|
45
|
+
*/
|
|
46
|
+
export type SelectorToType = {
|
|
47
|
+
[key: string]: Type<object>;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Angular component wrapper for GridStack.
|
|
51
|
+
*
|
|
52
|
+
* This component provides Angular integration for GridStack grids, handling:
|
|
53
|
+
* - Grid initialization and lifecycle
|
|
54
|
+
* - Dynamic component creation and management
|
|
55
|
+
* - Event binding and emission
|
|
56
|
+
* - Integration with Angular change detection
|
|
57
|
+
*
|
|
58
|
+
* Use in combination with GridstackItemComponent for individual grid items.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```html
|
|
62
|
+
* <gridstack [options]="gridOptions" (change)="onGridChange($event)">
|
|
63
|
+
* <div empty-content>Drag widgets here</div>
|
|
64
|
+
* </gridstack>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
|
|
68
|
+
protected readonly elementRef: ElementRef<GridCompHTMLElement>;
|
|
69
|
+
/**
|
|
70
|
+
* List of template-based grid items (not recommended approach).
|
|
71
|
+
* Used to sync between DOM and GridStack internals when items are defined in templates.
|
|
72
|
+
* Prefer dynamic component creation instead.
|
|
73
|
+
*/
|
|
74
|
+
gridstackItems?: QueryList<GridstackItemComponent>;
|
|
75
|
+
/**
|
|
76
|
+
* Container for dynamic component creation (recommended approach).
|
|
77
|
+
* Used to append grid items programmatically at runtime.
|
|
78
|
+
*/
|
|
79
|
+
container?: ViewContainerRef;
|
|
80
|
+
/**
|
|
81
|
+
* Grid configuration options.
|
|
82
|
+
* Can be set before grid initialization or updated after grid is created.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* gridOptions: GridStackOptions = {
|
|
87
|
+
* column: 12,
|
|
88
|
+
* cellHeight: 'auto',
|
|
89
|
+
* animate: true
|
|
90
|
+
* };
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
set options(o: GridStackOptions);
|
|
94
|
+
/** Get the current running grid options */
|
|
95
|
+
get options(): GridStackOptions;
|
|
96
|
+
/**
|
|
97
|
+
* Controls whether empty content should be displayed.
|
|
98
|
+
* Set to true to show ng-content with 'empty-content' selector when grid has no items.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```html
|
|
102
|
+
* <gridstack [isEmpty]="gridItems.length === 0">
|
|
103
|
+
* <div empty-content>Drag widgets here to get started</div>
|
|
104
|
+
* </gridstack>
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
isEmpty?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* GridStack event emitters for Angular integration.
|
|
110
|
+
*
|
|
111
|
+
* These provide Angular-style event handling for GridStack events.
|
|
112
|
+
* Alternatively, use `this.grid.on('event1 event2', callback)` for multiple events.
|
|
113
|
+
*
|
|
114
|
+
* Note: 'CB' suffix prevents conflicts with native DOM events.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```html
|
|
118
|
+
* <gridstack (changeCB)="onGridChange($event)" (droppedCB)="onItemDropped($event)">
|
|
119
|
+
* </gridstack>
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
/** Emitted when widgets are added to the grid */
|
|
123
|
+
addedCB: EventEmitter<nodesCB>;
|
|
124
|
+
/** Emitted when grid layout changes */
|
|
125
|
+
changeCB: EventEmitter<nodesCB>;
|
|
126
|
+
/** Emitted when grid is disabled */
|
|
127
|
+
disableCB: EventEmitter<eventCB>;
|
|
128
|
+
/** Emitted during widget drag operations */
|
|
129
|
+
dragCB: EventEmitter<elementCB>;
|
|
130
|
+
/** Emitted when widget drag starts */
|
|
131
|
+
dragStartCB: EventEmitter<elementCB>;
|
|
132
|
+
/** Emitted when widget drag stops */
|
|
133
|
+
dragStopCB: EventEmitter<elementCB>;
|
|
134
|
+
/** Emitted when widget is dropped */
|
|
135
|
+
droppedCB: EventEmitter<droppedCB>;
|
|
136
|
+
/** Emitted when grid is enabled */
|
|
137
|
+
enableCB: EventEmitter<eventCB>;
|
|
138
|
+
/** Emitted when widgets are removed from the grid */
|
|
139
|
+
removedCB: EventEmitter<nodesCB>;
|
|
140
|
+
/** Emitted during widget resize operations */
|
|
141
|
+
resizeCB: EventEmitter<elementCB>;
|
|
142
|
+
/** Emitted when widget resize starts */
|
|
143
|
+
resizeStartCB: EventEmitter<elementCB>;
|
|
144
|
+
/** Emitted when widget resize stops */
|
|
145
|
+
resizeStopCB: EventEmitter<elementCB>;
|
|
146
|
+
/**
|
|
147
|
+
* Get the native DOM element that contains grid-specific fields.
|
|
148
|
+
* This element has GridStack properties attached to it.
|
|
149
|
+
*/
|
|
150
|
+
get el(): GridCompHTMLElement;
|
|
151
|
+
/**
|
|
152
|
+
* Get the underlying GridStack instance.
|
|
153
|
+
* Use this to access GridStack API methods directly.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* this.gridComponent.grid.addWidget({x: 0, y: 0, w: 2, h: 1});
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
get grid(): GridStack | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Component reference for dynamic component removal.
|
|
163
|
+
* Used internally when this component is created dynamically.
|
|
164
|
+
*/
|
|
165
|
+
ref: ComponentRef<GridstackComponent> | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Mapping of component selectors to their types for dynamic creation.
|
|
168
|
+
*
|
|
169
|
+
* This enables dynamic component instantiation from string selectors.
|
|
170
|
+
* Angular doesn't provide public access to this mapping, so we maintain our own.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* GridstackComponent.addComponentToSelectorType([MyWidgetComponent]);
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
static selectorToType: SelectorToType;
|
|
178
|
+
/**
|
|
179
|
+
* Register a list of Angular components for dynamic creation.
|
|
180
|
+
*
|
|
181
|
+
* @param typeList Array of component types to register
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* GridstackComponent.addComponentToSelectorType([
|
|
186
|
+
* MyWidgetComponent,
|
|
187
|
+
* AnotherWidgetComponent
|
|
188
|
+
* ]);
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
static addComponentToSelectorType(typeList: Array<Type<object>>): void;
|
|
192
|
+
/**
|
|
193
|
+
* Extract the selector string from an Angular component type.
|
|
194
|
+
*
|
|
195
|
+
* @param type The component type to get selector from
|
|
196
|
+
* @returns The component's selector string
|
|
197
|
+
*/
|
|
198
|
+
static getSelector(type: Type<object>): string;
|
|
199
|
+
protected _options?: GridStackOptions;
|
|
200
|
+
protected _grid?: GridStack;
|
|
201
|
+
protected _sub: Subscription | undefined;
|
|
202
|
+
protected loaded?: boolean;
|
|
203
|
+
constructor(elementRef: ElementRef<GridCompHTMLElement>);
|
|
204
|
+
ngOnInit(): void;
|
|
205
|
+
/** wait until after all DOM is ready to init gridstack children (after angular ngFor and sub-components run first) */
|
|
206
|
+
ngAfterContentInit(): void;
|
|
207
|
+
ngOnDestroy(): void;
|
|
208
|
+
/**
|
|
209
|
+
* called when the TEMPLATE (not recommended) list of items changes - get a list of nodes and
|
|
210
|
+
* update the layout accordingly (which will take care of adding/removing items changed by Angular)
|
|
211
|
+
*/
|
|
212
|
+
updateAll(): void;
|
|
213
|
+
/** check if the grid is empty, if so show alternative content */
|
|
214
|
+
checkEmpty(): void;
|
|
215
|
+
/** get all known events as easy to use Outputs for convenience */
|
|
216
|
+
protected hookEvents(grid?: GridStack): void;
|
|
217
|
+
protected unhookEvents(grid?: GridStack): void;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)
|
|
221
|
+
**/
|
|
222
|
+
export declare function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, n: NgGridStackNode, add: boolean, isGrid: boolean): HTMLElement | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* called for each item in the grid - check if additional information needs to be saved.
|
|
225
|
+
* Note: since this is options minus gridstack protected members using Utils.removeInternalForSave(),
|
|
226
|
+
* this typically doesn't need to do anything. However your custom Component @Input() are now supported
|
|
227
|
+
* using BaseWidget.serialize()
|
|
228
|
+
*/
|
|
229
|
+
export declare function gsSaveAdditionalNgInfo(n: NgGridStackNode, w: NgGridStackWidget): void;
|
|
230
|
+
/**
|
|
231
|
+
* track when widgeta re updated (rather than created) to make sure we de-serialize them as well
|
|
232
|
+
*/
|
|
233
|
+
export declare function gsUpdateNgComponents(n: NgGridStackNode): void;
|