gridstack 8.1.0 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -38
- package/angular/.editorconfig +16 -0
- package/angular/.vscode/extensions.json +4 -0
- package/angular/.vscode/launch.json +20 -0
- package/angular/.vscode/tasks.json +42 -0
- package/{dist/ng → angular}/README.md +170 -154
- package/angular/README_build.md +27 -0
- package/angular/angular.json +132 -0
- package/angular/package.json +40 -0
- package/angular/projects/demo/.browserslistrc +16 -0
- package/angular/projects/demo/src/app/app.component.css +11 -0
- package/angular/projects/demo/src/app/app.component.html +78 -0
- package/angular/projects/demo/src/app/app.component.spec.ts +25 -0
- package/angular/projects/demo/src/app/app.component.ts +208 -0
- package/angular/projects/demo/src/app/app.module.ts +38 -0
- package/angular/projects/demo/src/app/dummy.component.ts +29 -0
- package/angular/projects/demo/src/app/ngFor.ts +131 -0
- package/angular/projects/demo/src/app/ngFor_cmd.ts +106 -0
- package/angular/projects/demo/src/app/simple.ts +46 -0
- package/angular/projects/demo/src/assets/.gitkeep +0 -0
- package/angular/projects/demo/src/environments/environment.prod.ts +3 -0
- package/angular/projects/demo/src/environments/environment.ts +16 -0
- package/angular/projects/demo/src/favicon.ico +0 -0
- package/angular/projects/demo/src/index.html +13 -0
- package/angular/projects/demo/src/main.ts +12 -0
- package/angular/projects/demo/src/polyfills.ts +53 -0
- package/angular/projects/demo/src/styles.css +4 -0
- package/angular/projects/demo/src/test.ts +26 -0
- package/angular/projects/demo/tsconfig.app.json +15 -0
- package/angular/projects/demo/tsconfig.spec.json +18 -0
- package/angular/projects/lib/README.md +24 -0
- package/angular/projects/lib/ng-package.json +7 -0
- package/angular/projects/lib/package.json +11 -0
- package/angular/projects/lib/src/lib/gridstack-item.component.ts +70 -0
- package/angular/projects/lib/src/lib/gridstack.component.ts +240 -0
- package/angular/projects/lib/src/lib/gridstack.module.ts +32 -0
- package/angular/projects/lib/src/public-api.ts +7 -0
- package/angular/projects/lib/src/test.ts +27 -0
- package/angular/projects/lib/tsconfig.lib.json +15 -0
- package/angular/projects/lib/tsconfig.lib.prod.json +10 -0
- package/angular/projects/lib/tsconfig.spec.json +17 -0
- package/dist/angular/README.md +170 -0
- package/dist/angular/esm2020/gridstack-angular.mjs +5 -0
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +67 -0
- package/dist/angular/esm2020/lib/gridstack.component.mjs +233 -0
- package/dist/angular/esm2020/lib/gridstack.module.mjs +39 -0
- package/dist/angular/esm2020/public-api.mjs +7 -0
- package/dist/angular/fesm2015/gridstack-angular.mjs +346 -0
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -0
- package/dist/angular/fesm2020/gridstack-angular.mjs +342 -0
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -0
- package/dist/angular/index.d.ts +5 -0
- package/dist/{ng → angular/lib}/gridstack-item.component.d.ts +32 -29
- package/dist/{ng → angular/lib}/gridstack.component.d.ts +121 -118
- package/dist/angular/lib/gridstack.module.d.ts +10 -0
- package/dist/angular/package.json +31 -0
- package/dist/angular/public-api.d.ts +3 -0
- package/dist/angular/src/gridstack-item.component.ts +70 -0
- package/dist/angular/src/gridstack.component.ts +240 -0
- package/dist/angular/src/gridstack.module.ts +32 -0
- package/dist/dd-base-impl.d.ts +1 -1
- package/dist/dd-base-impl.js +1 -1
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +1 -1
- package/dist/dd-draggable.js +1 -1
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +1 -1
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +1 -1
- package/dist/dd-element.js +1 -1
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +1 -1
- package/dist/dd-gridstack.js +1 -1
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +1 -1
- package/dist/dd-manager.js +1 -1
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +1 -1
- package/dist/dd-resizable-handle.js +1 -1
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +1 -1
- package/dist/dd-resizable.js +1 -1
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +1 -1
- package/dist/dd-touch.js +1 -1
- package/dist/dd-touch.js.map +1 -1
- package/dist/es5/dd-base-impl.d.ts +1 -1
- package/dist/es5/dd-base-impl.js +1 -1
- package/dist/es5/dd-base-impl.js.map +1 -1
- package/dist/es5/dd-draggable.d.ts +1 -1
- package/dist/es5/dd-draggable.js +1 -1
- package/dist/es5/dd-draggable.js.map +1 -1
- package/dist/es5/dd-droppable.d.ts +1 -1
- package/dist/es5/dd-droppable.js +1 -1
- package/dist/es5/dd-droppable.js.map +1 -1
- package/dist/es5/dd-element.d.ts +1 -1
- package/dist/es5/dd-element.js +1 -1
- package/dist/es5/dd-element.js.map +1 -1
- package/dist/es5/dd-gridstack.d.ts +1 -1
- package/dist/es5/dd-gridstack.js +1 -1
- package/dist/es5/dd-gridstack.js.map +1 -1
- package/dist/es5/dd-manager.d.ts +1 -1
- package/dist/es5/dd-manager.js +1 -1
- package/dist/es5/dd-manager.js.map +1 -1
- package/dist/es5/dd-resizable-handle.d.ts +1 -1
- package/dist/es5/dd-resizable-handle.js +1 -1
- package/dist/es5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/dd-resizable.d.ts +1 -1
- package/dist/es5/dd-resizable.js +1 -1
- package/dist/es5/dd-resizable.js.map +1 -1
- package/dist/es5/dd-touch.d.ts +1 -1
- package/dist/es5/dd-touch.js +1 -1
- package/dist/es5/dd-touch.js.map +1 -1
- package/dist/es5/gridstack-all.js +1 -1
- package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/es5/gridstack-all.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +1 -1
- package/dist/es5/gridstack-engine.js +1 -1
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +1 -1
- package/dist/es5/gridstack.js +9 -10
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +1 -1
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +1 -1
- package/dist/es5/utils.js +1 -1
- package/dist/es5/utils.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-extra.css +130 -130
- package/dist/gridstack-extra.min.css +1 -1
- package/dist/gridstack.css +29 -31
- package/dist/gridstack.d.ts +1 -1
- package/dist/gridstack.js +9 -10
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/src/gridstack-extra.scss +5 -5
- package/dist/src/gridstack.scss +7 -10
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +10 -2
- package/package.json +3 -3
- package/dist/ng/gridstack-item.component.js +0 -65
- package/dist/ng/gridstack-item.component.js.map +0 -1
- package/dist/ng/gridstack.component.js +0 -245
- package/dist/ng/gridstack.component.js.map +0 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ViewContainerRef, Component, ViewChild, Input, EventEmitter, reflectComponentType, ContentChildren, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { takeUntil } from 'rxjs/operators';
|
|
5
|
+
import { GridStack } from 'gridstack';
|
|
6
|
+
import * as i1 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* gridstack-item.component.ts 8.1.2
|
|
11
|
+
* Copyright (c) 2022 Alain Dumesny - see GridStack root license
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* HTML Component Wrapper for gridstack items, in combination with GridstackComponent for parent grid
|
|
15
|
+
*/
|
|
16
|
+
class GridstackItemComponent {
|
|
17
|
+
constructor(elementRef) {
|
|
18
|
+
this.elementRef = elementRef;
|
|
19
|
+
this.el._gridItemComp = this;
|
|
20
|
+
}
|
|
21
|
+
/** list of options for creating/updating this item */
|
|
22
|
+
set options(val) {
|
|
23
|
+
if (this.el.gridstackNode?.grid) {
|
|
24
|
+
// already built, do an update...
|
|
25
|
+
this.el.gridstackNode.grid.update(this.el, val);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// store our custom element in options so we can update it and not re-create a generic div!
|
|
29
|
+
this._options = { ...val, el: this.el };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** return the latest grid options (from GS once built, otherwise initial values) */
|
|
33
|
+
get options() {
|
|
34
|
+
return this.el.gridstackNode || this._options || { el: this.el };
|
|
35
|
+
}
|
|
36
|
+
/** return the native element that contains grid specific fields as well */
|
|
37
|
+
get el() { return this.elementRef.nativeElement; }
|
|
38
|
+
/** clears the initial options now that we've built */
|
|
39
|
+
clearOptions() {
|
|
40
|
+
delete this._options;
|
|
41
|
+
}
|
|
42
|
+
ngOnDestroy() {
|
|
43
|
+
delete this.el._gridItemComp;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
GridstackItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
47
|
+
GridstackItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: GridstackItemComponent, selector: "gridstack-item", inputs: { options: "options" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
|
|
48
|
+
<div class="grid-stack-item-content">
|
|
49
|
+
<!-- where dynamic items go based on component types, or sub-grids, etc...) -->
|
|
50
|
+
<ng-template #container></ng-template>
|
|
51
|
+
<!-- any static (defined in dom) content goes here -->
|
|
52
|
+
<ng-content></ng-content>
|
|
53
|
+
<!-- fallback HTML content from GridStackWidget content field if used instead -->
|
|
54
|
+
{{options.content}}
|
|
55
|
+
</div>`, isInline: true, styles: [":host{display:block}\n"] });
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, decorators: [{
|
|
57
|
+
type: Component,
|
|
58
|
+
args: [{ selector: 'gridstack-item', template: `
|
|
59
|
+
<div class="grid-stack-item-content">
|
|
60
|
+
<!-- where dynamic items go based on component types, or sub-grids, etc...) -->
|
|
61
|
+
<ng-template #container></ng-template>
|
|
62
|
+
<!-- any static (defined in dom) content goes here -->
|
|
63
|
+
<ng-content></ng-content>
|
|
64
|
+
<!-- fallback HTML content from GridStackWidget content field if used instead -->
|
|
65
|
+
{{options.content}}
|
|
66
|
+
</div>`, styles: [":host{display:block}\n"] }]
|
|
67
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { container: [{
|
|
68
|
+
type: ViewChild,
|
|
69
|
+
args: ['container', { read: ViewContainerRef, static: true }]
|
|
70
|
+
}], options: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}] } });
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* gridstack.component.ts 8.1.2
|
|
76
|
+
* Copyright (c) 2022 Alain Dumesny - see GridStack root license
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* HTML Component Wrapper for gridstack, in combination with GridstackItemComponent for the items
|
|
80
|
+
*/
|
|
81
|
+
class GridstackComponent {
|
|
82
|
+
constructor(
|
|
83
|
+
// private readonly zone: NgZone,
|
|
84
|
+
// private readonly cd: ChangeDetectorRef,
|
|
85
|
+
elementRef) {
|
|
86
|
+
this.elementRef = elementRef;
|
|
87
|
+
/** individual list of GridStackEvent callbacks handlers as output
|
|
88
|
+
* otherwise use this.grid.on('name1 name2 name3', callback) to handle multiple at once
|
|
89
|
+
* see https://github.com/gridstack/gridstack.js/blob/master/demo/events.js#L4
|
|
90
|
+
*
|
|
91
|
+
* Note: camel casing and 'CB' added at the end to prevent @angular-eslint/no-output-native
|
|
92
|
+
* eg: 'change' would trigger the raw CustomEvent so use different name.
|
|
93
|
+
*/
|
|
94
|
+
this.addedCB = new EventEmitter();
|
|
95
|
+
this.changeCB = new EventEmitter();
|
|
96
|
+
this.disableCB = new EventEmitter();
|
|
97
|
+
this.dragCB = new EventEmitter();
|
|
98
|
+
this.dragStartCB = new EventEmitter();
|
|
99
|
+
this.dragStopCB = new EventEmitter();
|
|
100
|
+
this.droppedCB = new EventEmitter();
|
|
101
|
+
this.enableCB = new EventEmitter();
|
|
102
|
+
this.removedCB = new EventEmitter();
|
|
103
|
+
this.resizeCB = new EventEmitter();
|
|
104
|
+
this.resizeStartCB = new EventEmitter();
|
|
105
|
+
this.resizeStopCB = new EventEmitter();
|
|
106
|
+
this.ngUnsubscribe = new Subject();
|
|
107
|
+
this.el._gridComp = this;
|
|
108
|
+
}
|
|
109
|
+
/** initial options for creation of the grid */
|
|
110
|
+
set options(val) { this._options = val; }
|
|
111
|
+
/** return the current running options */
|
|
112
|
+
get options() { return this._grid?.opts || this._options || {}; }
|
|
113
|
+
/** return the native element that contains grid specific fields as well */
|
|
114
|
+
get el() { return this.elementRef.nativeElement; }
|
|
115
|
+
/** return the GridStack class */
|
|
116
|
+
get grid() { return this._grid; }
|
|
117
|
+
/** add a list of ng Component to be mapped to selector */
|
|
118
|
+
static addComponentToSelectorType(typeList) {
|
|
119
|
+
typeList.forEach(type => GridstackComponent.selectorToType[GridstackComponent.getSelector(type)] = type);
|
|
120
|
+
}
|
|
121
|
+
/** return the ng Component selector */
|
|
122
|
+
static getSelector(type) {
|
|
123
|
+
const mirror = reflectComponentType(type);
|
|
124
|
+
return mirror.selector;
|
|
125
|
+
}
|
|
126
|
+
ngOnInit() {
|
|
127
|
+
// init ourself before any template children are created since we track them below anyway - no need to double create+update widgets
|
|
128
|
+
this.loaded = !!this.options?.children?.length;
|
|
129
|
+
this._grid = GridStack.init(this._options, this.el);
|
|
130
|
+
delete this._options; // GS has it now
|
|
131
|
+
this.checkEmpty();
|
|
132
|
+
}
|
|
133
|
+
/** wait until after all DOM is ready to init gridstack children (after angular ngFor and sub-components run first) */
|
|
134
|
+
ngAfterContentInit() {
|
|
135
|
+
// track whenever the children list changes and update the layout...
|
|
136
|
+
this.gridstackItems?.changes
|
|
137
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
138
|
+
.subscribe(() => this.updateAll());
|
|
139
|
+
// ...and do this once at least unless we loaded children already
|
|
140
|
+
if (!this.loaded)
|
|
141
|
+
this.updateAll();
|
|
142
|
+
this.hookEvents(this.grid);
|
|
143
|
+
}
|
|
144
|
+
ngOnDestroy() {
|
|
145
|
+
this.ngUnsubscribe.next();
|
|
146
|
+
this.ngUnsubscribe.complete();
|
|
147
|
+
this.grid?.destroy();
|
|
148
|
+
delete this._grid;
|
|
149
|
+
delete this.el._gridComp;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* called when the TEMPLATE list of items changes - get a list of nodes and
|
|
153
|
+
* update the layout accordingly (which will take care of adding/removing items changed by Angular)
|
|
154
|
+
*/
|
|
155
|
+
updateAll() {
|
|
156
|
+
if (!this.grid)
|
|
157
|
+
return;
|
|
158
|
+
const layout = [];
|
|
159
|
+
this.gridstackItems?.forEach(item => {
|
|
160
|
+
layout.push(item.options);
|
|
161
|
+
item.clearOptions();
|
|
162
|
+
});
|
|
163
|
+
this.grid.load(layout); // efficient that does diffs only
|
|
164
|
+
}
|
|
165
|
+
/** check if the grid is empty, if so show alternative content */
|
|
166
|
+
checkEmpty() {
|
|
167
|
+
if (!this.grid)
|
|
168
|
+
return;
|
|
169
|
+
const isEmpty = !this.grid.engine.nodes.length;
|
|
170
|
+
if (isEmpty === this.isEmpty)
|
|
171
|
+
return;
|
|
172
|
+
this.isEmpty = isEmpty;
|
|
173
|
+
// this.cd.detectChanges();
|
|
174
|
+
}
|
|
175
|
+
/** get all known events as easy to use Outputs for convenience */
|
|
176
|
+
hookEvents(grid) {
|
|
177
|
+
if (!grid)
|
|
178
|
+
return;
|
|
179
|
+
grid
|
|
180
|
+
.on('added', (event, nodes) => { this.checkEmpty(); this.addedCB.emit({ event, nodes }); })
|
|
181
|
+
.on('change', (event, nodes) => this.changeCB.emit({ event, nodes }))
|
|
182
|
+
.on('disable', (event) => this.disableCB.emit({ event }))
|
|
183
|
+
.on('drag', (event, el) => this.dragCB.emit({ event, el }))
|
|
184
|
+
.on('dragstart', (event, el) => this.dragStartCB.emit({ event, el }))
|
|
185
|
+
.on('dragstop', (event, el) => this.dragStopCB.emit({ event, el }))
|
|
186
|
+
.on('dropped', (event, previousNode, newNode) => this.droppedCB.emit({ event, previousNode, newNode }))
|
|
187
|
+
.on('enable', (event) => this.enableCB.emit({ event }))
|
|
188
|
+
.on('removed', (event, nodes) => { this.checkEmpty(); this.removedCB.emit({ event, nodes }); })
|
|
189
|
+
.on('resize', (event, el) => this.resizeCB.emit({ event, el }))
|
|
190
|
+
.on('resizestart', (event, el) => this.resizeStartCB.emit({ event, el }))
|
|
191
|
+
.on('resizestop', (event, el) => this.resizeStopCB.emit({ event, el }));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* stores the selector -> Type mapping, so we can create items dynamically from a string.
|
|
196
|
+
* Unfortunately Ng doesn't provide public access to that mapping.
|
|
197
|
+
*/
|
|
198
|
+
GridstackComponent.selectorToType = {};
|
|
199
|
+
GridstackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
200
|
+
GridstackComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: GridstackComponent, selector: "gridstack", inputs: { options: "options", isEmpty: "isEmpty" }, outputs: { addedCB: "addedCB", changeCB: "changeCB", disableCB: "disableCB", dragCB: "dragCB", dragStartCB: "dragStartCB", dragStopCB: "dragStopCB", droppedCB: "droppedCB", enableCB: "enableCB", removedCB: "removedCB", resizeCB: "resizeCB", resizeStartCB: "resizeStartCB", resizeStopCB: "resizeStopCB" }, queries: [{ propertyName: "gridstackItems", predicate: GridstackItemComponent }], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
|
|
201
|
+
<!-- content to show when when grid is empty, like instructions on how to add widgets -->
|
|
202
|
+
<ng-content select="[empty-content]" *ngIf="isEmpty"></ng-content>
|
|
203
|
+
<!-- where dynamic items go -->
|
|
204
|
+
<ng-template #container></ng-template>
|
|
205
|
+
<!-- where template items go -->
|
|
206
|
+
<ng-content></ng-content>
|
|
207
|
+
`, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, decorators: [{
|
|
209
|
+
type: Component,
|
|
210
|
+
args: [{ selector: 'gridstack', template: `
|
|
211
|
+
<!-- content to show when when grid is empty, like instructions on how to add widgets -->
|
|
212
|
+
<ng-content select="[empty-content]" *ngIf="isEmpty"></ng-content>
|
|
213
|
+
<!-- where dynamic items go -->
|
|
214
|
+
<ng-template #container></ng-template>
|
|
215
|
+
<!-- where template items go -->
|
|
216
|
+
<ng-content></ng-content>
|
|
217
|
+
`, styles: [":host{display:block}\n"] }]
|
|
218
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { gridstackItems: [{
|
|
219
|
+
type: ContentChildren,
|
|
220
|
+
args: [GridstackItemComponent]
|
|
221
|
+
}], container: [{
|
|
222
|
+
type: ViewChild,
|
|
223
|
+
args: ['container', { read: ViewContainerRef, static: true }]
|
|
224
|
+
}], options: [{
|
|
225
|
+
type: Input
|
|
226
|
+
}], isEmpty: [{
|
|
227
|
+
type: Input
|
|
228
|
+
}], addedCB: [{
|
|
229
|
+
type: Output
|
|
230
|
+
}], changeCB: [{
|
|
231
|
+
type: Output
|
|
232
|
+
}], disableCB: [{
|
|
233
|
+
type: Output
|
|
234
|
+
}], dragCB: [{
|
|
235
|
+
type: Output
|
|
236
|
+
}], dragStartCB: [{
|
|
237
|
+
type: Output
|
|
238
|
+
}], dragStopCB: [{
|
|
239
|
+
type: Output
|
|
240
|
+
}], droppedCB: [{
|
|
241
|
+
type: Output
|
|
242
|
+
}], enableCB: [{
|
|
243
|
+
type: Output
|
|
244
|
+
}], removedCB: [{
|
|
245
|
+
type: Output
|
|
246
|
+
}], resizeCB: [{
|
|
247
|
+
type: Output
|
|
248
|
+
}], resizeStartCB: [{
|
|
249
|
+
type: Output
|
|
250
|
+
}], resizeStopCB: [{
|
|
251
|
+
type: Output
|
|
252
|
+
}] } });
|
|
253
|
+
/**
|
|
254
|
+
* can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)
|
|
255
|
+
**/
|
|
256
|
+
function gsCreateNgComponents(host, w, add, isGrid) {
|
|
257
|
+
// only care about creating ng components here...
|
|
258
|
+
if (!add || !host)
|
|
259
|
+
return;
|
|
260
|
+
// create the component dynamically - see https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html
|
|
261
|
+
if (isGrid) {
|
|
262
|
+
let grid;
|
|
263
|
+
const gridItemComp = host.parentElement?._gridItemComp;
|
|
264
|
+
if (gridItemComp) {
|
|
265
|
+
grid = gridItemComp.container?.createComponent(GridstackComponent)?.instance;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
// TODO: figure out how to create ng component inside regular Div. need to access app injectors...
|
|
269
|
+
// const hostElement: Element = host;
|
|
270
|
+
// const environmentInjector: EnvironmentInjector;
|
|
271
|
+
// grid = createComponent(GridstackComponent, {environmentInjector, hostElement})?.instance;
|
|
272
|
+
}
|
|
273
|
+
if (grid)
|
|
274
|
+
grid.options = w;
|
|
275
|
+
return grid?.el;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
const gridComp = host._gridComp;
|
|
279
|
+
const gridItem = gridComp?.container?.createComponent(GridstackItemComponent)?.instance;
|
|
280
|
+
// IFF we're not a subGrid, define what type of component to create as child, OR you can do it GridstackItemComponent template, but this is more generic
|
|
281
|
+
const selector = w.type;
|
|
282
|
+
const type = selector ? GridstackComponent.selectorToType[selector] : undefined;
|
|
283
|
+
if (!w.subGridOpts && type) {
|
|
284
|
+
gridItem?.container?.createComponent(type);
|
|
285
|
+
}
|
|
286
|
+
return gridItem?.el;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* can be used when saving the grid - make sure we save the content from the field (not HTML as we get ng markups)
|
|
291
|
+
* and can put the extra info of type, otherwise content
|
|
292
|
+
*/
|
|
293
|
+
function gsSaveAdditionalNgInfo(n, w) {
|
|
294
|
+
if (n.type)
|
|
295
|
+
w.type = n.type;
|
|
296
|
+
else if (n.content)
|
|
297
|
+
w.content = n.content;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* gridstack.component.ts 8.1.2
|
|
302
|
+
* Copyright (c) 2022 Alain Dumesny - see GridStack root license
|
|
303
|
+
*/
|
|
304
|
+
class GridstackModule {
|
|
305
|
+
constructor() {
|
|
306
|
+
// set globally our method to create the right widget type
|
|
307
|
+
GridStack.addRemoveCB = gsCreateNgComponents;
|
|
308
|
+
GridStack.saveCB = gsSaveAdditionalNgInfo;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
GridstackModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
312
|
+
GridstackModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, declarations: [GridstackComponent,
|
|
313
|
+
GridstackItemComponent], imports: [CommonModule], exports: [GridstackComponent,
|
|
314
|
+
GridstackItemComponent] });
|
|
315
|
+
GridstackModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, imports: [CommonModule] });
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, decorators: [{
|
|
317
|
+
type: NgModule,
|
|
318
|
+
args: [{
|
|
319
|
+
imports: [
|
|
320
|
+
CommonModule,
|
|
321
|
+
],
|
|
322
|
+
declarations: [
|
|
323
|
+
GridstackComponent,
|
|
324
|
+
GridstackItemComponent,
|
|
325
|
+
],
|
|
326
|
+
exports: [
|
|
327
|
+
GridstackComponent,
|
|
328
|
+
GridstackItemComponent,
|
|
329
|
+
],
|
|
330
|
+
}]
|
|
331
|
+
}], ctorParameters: function () { return []; } });
|
|
332
|
+
|
|
333
|
+
/*
|
|
334
|
+
* Public API Surface of gridstack-angular
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Generated bundle index. Do not edit.
|
|
339
|
+
*/
|
|
340
|
+
|
|
341
|
+
export { GridstackComponent, GridstackItemComponent, GridstackModule, gsCreateNgComponents, gsSaveAdditionalNgInfo };
|
|
342
|
+
//# sourceMappingURL=gridstack-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridstack-angular.mjs","sources":["../../../angular/projects/lib/src/lib/gridstack-item.component.ts","../../../angular/projects/lib/src/lib/gridstack.component.ts","../../../angular/projects/lib/src/lib/gridstack.module.ts","../../../angular/projects/lib/src/public-api.ts","../../../angular/projects/lib/src/gridstack-angular.ts"],"sourcesContent":["/**\n * gridstack-item.component.ts 8.1.2\n * Copyright (c) 2022 Alain Dumesny - see GridStack root license\n */\n\nimport { Component, ElementRef, Input, ViewChild, ViewContainerRef, OnDestroy } from '@angular/core';\nimport { GridItemHTMLElement, GridStackNode } from 'gridstack';\n\n/** store element to Ng Class pointer back */\nexport interface GridItemCompHTMLElement extends GridItemHTMLElement {\n _gridItemComp?: GridstackItemComponent;\n}\n\n/**\n * HTML Component Wrapper for gridstack items, in combination with GridstackComponent for parent grid\n */\n@Component({\n selector: 'gridstack-item',\n template: `\n <div class=\"grid-stack-item-content\">\n <!-- where dynamic items go based on component types, or sub-grids, etc...) -->\n <ng-template #container></ng-template>\n <!-- any static (defined in dom) content goes here -->\n <ng-content></ng-content>\n <!-- fallback HTML content from GridStackWidget content field if used instead -->\n {{options.content}}\n </div>`,\n styles: [`\n :host { display: block; }\n `],\n // changeDetection: ChangeDetectionStrategy.OnPush, // IFF you want to optimize and control when ChangeDetection needs to happen...\n})\nexport class GridstackItemComponent implements OnDestroy {\n\n /** container to append items dynamically */\n @ViewChild('container', { read: ViewContainerRef, static: true}) public container?: ViewContainerRef;\n\n /** list of options for creating/updating this item */\n @Input() public set options(val: GridStackNode) {\n if (this.el.gridstackNode?.grid) {\n // already built, do an update...\n this.el.gridstackNode.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 private _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(private readonly elementRef: ElementRef<GridItemHTMLElement>) {\n this.el._gridItemComp = this;\n }\n\n public ngOnDestroy(): void {\n delete this.el._gridItemComp;\n }\n}\n","/**\n * gridstack.component.ts 8.1.2\n * Copyright (c) 2022 Alain Dumesny - see GridStack root license\n */\n\nimport { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, Input,\n OnDestroy, OnInit, Output, QueryList, Type, ViewChild, ViewContainerRef, reflectComponentType } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { GridHTMLElement, GridItemHTMLElement, GridStack, GridStackNode, GridStackOptions, GridStackWidget } from 'gridstack';\n\nimport { GridItemCompHTMLElement, GridstackItemComponent } from './gridstack-item.component';\n\n/** events handlers emitters signature for different events */\nexport type eventCB = {event: Event};\nexport type elementCB = {event: Event, el: GridItemHTMLElement};\nexport type nodesCB = {event: Event, nodes: GridStackNode[]};\nexport type droppedCB = {event: Event, previousNode: GridStackNode, newNode: GridStackNode};\n\n/** extends to store Ng Component selector, instead/inAddition to content */\nexport interface NgGridStackWidget extends GridStackWidget {\n type?: string; // component type to create as content\n}\nexport interface NgGridStackNode extends GridStackNode {\n type?: string; // component type to create as content\n}\nexport interface NgGridStackOptions extends GridStackOptions {\n children?: NgGridStackWidget[];\n subGridOpts?: NgGridStackOptions;\n}\n\n/** store element to Ng Class pointer back */\nexport interface GridCompHTMLElement extends GridHTMLElement {\n _gridComp?: GridstackComponent;\n}\n\n/** selector string to runtime Type mapping */\nexport type SelectorToType = {[key: string]: Type<Object>};\n\n/**\n * HTML Component Wrapper for gridstack, in combination with GridstackItemComponent for the items\n */\n@Component({\n selector: 'gridstack',\n template: `\n <!-- content to show when when grid is empty, like instructions on how to add widgets -->\n <ng-content select=\"[empty-content]\" *ngIf=\"isEmpty\"></ng-content>\n <!-- where dynamic items go -->\n <ng-template #container></ng-template>\n <!-- where template items go -->\n <ng-content></ng-content>\n `,\n styles: [`\n :host { display: block; }\n `],\n // changeDetection: ChangeDetectionStrategy.OnPush, // IFF you want to optimize and control when ChangeDetection needs to happen...\n})\nexport class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {\n\n /** track list of TEMPLATE grid items so we can sync between DOM and GS internals */\n @ContentChildren(GridstackItemComponent) public gridstackItems?: QueryList<GridstackItemComponent>;\n /** container to append items dynamically */\n @ViewChild('container', { read: ViewContainerRef, static: true}) public container?: ViewContainerRef;\n\n /** initial options for creation of the grid */\n @Input() public set options(val: GridStackOptions) { this._options = val; }\n /** return the current running options */\n public get options(): GridStackOptions { return this._grid?.opts || this._options || {}; }\n\n /** true while ng-content with 'no-item-content' should be shown when last item is removed from a grid */\n @Input() public isEmpty?: boolean;\n\n /** individual list of GridStackEvent callbacks handlers as output\n * otherwise use this.grid.on('name1 name2 name3', callback) to handle multiple at once\n * see https://github.com/gridstack/gridstack.js/blob/master/demo/events.js#L4\n *\n * Note: camel casing and 'CB' added at the end to prevent @angular-eslint/no-output-native\n * eg: 'change' would trigger the raw CustomEvent so use different name.\n */\n @Output() public addedCB = new EventEmitter<nodesCB>();\n @Output() public changeCB = new EventEmitter<nodesCB>();\n @Output() public disableCB = new EventEmitter<eventCB>();\n @Output() public dragCB = new EventEmitter<elementCB>();\n @Output() public dragStartCB = new EventEmitter<elementCB>();\n @Output() public dragStopCB = new EventEmitter<elementCB>();\n @Output() public droppedCB = new EventEmitter<droppedCB>();\n @Output() public enableCB = new EventEmitter<eventCB>();\n @Output() public removedCB = new EventEmitter<nodesCB>();\n @Output() public resizeCB = new EventEmitter<elementCB>();\n @Output() public resizeStartCB = new EventEmitter<elementCB>();\n @Output() public resizeStopCB = new EventEmitter<elementCB>();\n\n /** return the native element that contains grid specific fields as well */\n public get el(): GridCompHTMLElement { return this.elementRef.nativeElement; }\n\n /** return the GridStack class */\n public get grid(): GridStack | undefined { return this._grid; }\n\n /**\n * stores the selector -> Type mapping, so we can create items dynamically from a string.\n * Unfortunately Ng doesn't provide public access to that mapping.\n */\n public static selectorToType: SelectorToType = {};\n /** add a list of ng Component to be mapped to selector */\n public static addComponentToSelectorType(typeList: Array<Type<Object>>) {\n typeList.forEach(type => GridstackComponent.selectorToType[ GridstackComponent.getSelector(type) ] = type);\n }\n /** return the ng Component selector */\n public static getSelector(type: Type<Object>): string {\n const mirror = reflectComponentType(type)!;\n return mirror.selector;\n }\n\n private _options?: GridStackOptions;\n private _grid?: GridStack;\n private loaded?: boolean;\n private ngUnsubscribe: Subject<void> = new Subject();\n\n constructor(\n // private readonly zone: NgZone,\n // private readonly cd: ChangeDetectorRef,\n private readonly elementRef: ElementRef<GridCompHTMLElement>,\n ) {\n this.el._gridComp = this;\n }\n\n public ngOnInit(): void {\n // init ourself before any template children are created since we track them below anyway - no need to double create+update widgets\n this.loaded = !!this.options?.children?.length;\n this._grid = GridStack.init(this._options, this.el);\n delete this._options; // GS has it now\n\n this.checkEmpty();\n }\n\n /** wait until after all DOM is ready to init gridstack children (after angular ngFor and sub-components run first) */\n public ngAfterContentInit(): void {\n // track whenever the children list changes and update the layout...\n this.gridstackItems?.changes\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => this.updateAll());\n // ...and do this once at least unless we loaded children already\n if (!this.loaded) this.updateAll();\n this.hookEvents(this.grid);\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n this.grid?.destroy();\n delete this._grid;\n delete this.el._gridComp;\n }\n\n /**\n * called when the TEMPLATE list of items changes - get a list of nodes and\n * update the layout accordingly (which will take care of adding/removing items changed by Angular)\n */\n public updateAll() {\n if (!this.grid) return;\n const layout: GridStackWidget[] = [];\n this.gridstackItems?.forEach(item => {\n layout.push(item.options);\n item.clearOptions();\n });\n this.grid.load(layout); // efficient that does diffs only\n }\n\n /** check if the grid is empty, if so show alternative content */\n public checkEmpty() {\n if (!this.grid) return;\n const isEmpty = !this.grid.engine.nodes.length;\n if (isEmpty === this.isEmpty) return;\n this.isEmpty = isEmpty;\n // this.cd.detectChanges();\n }\n\n /** get all known events as easy to use Outputs for convenience */\n private hookEvents(grid?: GridStack) {\n if (!grid) return;\n grid\n .on('added', (event: Event, nodes: GridStackNode[]) => { this.checkEmpty(); this.addedCB.emit({event, nodes}); })\n .on('change', (event: Event, nodes: GridStackNode[]) => this.changeCB.emit({event, nodes}))\n .on('disable', (event: Event) => this.disableCB.emit({event}))\n .on('drag', (event: Event, el: GridItemHTMLElement) => this.dragCB.emit({event, el}))\n .on('dragstart', (event: Event, el: GridItemHTMLElement) => this.dragStartCB.emit({event, el}))\n .on('dragstop', (event: Event, el: GridItemHTMLElement) => this.dragStopCB.emit({event, el}))\n .on('dropped', (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => this.droppedCB.emit({event, previousNode, newNode}))\n .on('enable', (event: Event) => this.enableCB.emit({event}))\n .on('removed', (event: Event, nodes: GridStackNode[]) => { this.checkEmpty(); this.removedCB.emit({event, nodes}); })\n .on('resize', (event: Event, el: GridItemHTMLElement) => this.resizeCB.emit({event, el}))\n .on('resizestart', (event: Event, el: GridItemHTMLElement) => this.resizeStartCB.emit({event, el}))\n .on('resizestop', (event: Event, el: GridItemHTMLElement) => this.resizeStopCB.emit({event, el}))\n }\n}\n\n/**\n * can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)\n **/\nexport function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, w: NgGridStackWidget | GridStackOptions, add: boolean, isGrid: boolean): HTMLElement | undefined {\n // only care about creating ng components here...\n if (!add || !host) return;\n\n // create the component dynamically - see https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html\n if (isGrid) {\n let grid: GridstackComponent | undefined;\n const gridItemComp = (host.parentElement as GridItemCompHTMLElement)?._gridItemComp;\n if (gridItemComp) {\n grid = gridItemComp.container?.createComponent(GridstackComponent)?.instance;\n } else {\n // TODO: figure out how to create ng component inside regular Div. need to access app injectors...\n // const hostElement: Element = host;\n // const environmentInjector: EnvironmentInjector;\n // grid = createComponent(GridstackComponent, {environmentInjector, hostElement})?.instance;\n }\n if (grid) grid.options = w as GridStackOptions;\n return grid?.el;\n } else {\n const gridComp = (host as GridCompHTMLElement)._gridComp;\n const gridItem = gridComp?.container?.createComponent(GridstackItemComponent)?.instance;\n\n // IFF we're not a subGrid, define what type of component to create as child, OR you can do it GridstackItemComponent template, but this is more generic\n const selector = (w as NgGridStackWidget).type;\n const type = selector ? GridstackComponent.selectorToType[selector] : undefined;\n if (!w.subGridOpts && type) {\n gridItem?.container?.createComponent(type);\n }\n\n return gridItem?.el;\n }\n}\n\n/**\n * can be used when saving the grid - make sure we save the content from the field (not HTML as we get ng markups)\n * and can put the extra info of type, otherwise content\n */\nexport function gsSaveAdditionalNgInfo(n: NgGridStackNode, w: NgGridStackWidget) {\n if (n.type) w.type = n.type;\n else if (n.content) w.content = n.content;\n}\n","/**\r\n * gridstack.component.ts 8.1.2\r\n * Copyright (c) 2022 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from '@angular/common';\r\n\r\nimport { GridStack } from \"gridstack\";\r\nimport { GridstackComponent, gsCreateNgComponents, gsSaveAdditionalNgInfo } from \"./gridstack.component\";\r\nimport { GridstackItemComponent } from \"./gridstack-item.component\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n ],\r\n declarations: [\r\n GridstackComponent,\r\n GridstackItemComponent,\r\n ],\r\n exports: [\r\n GridstackComponent,\r\n GridstackItemComponent,\r\n ],\r\n})\r\nexport class GridstackModule {\r\n constructor() {\r\n // set globally our method to create the right widget type\r\n GridStack.addRemoveCB = gsCreateNgComponents;\r\n GridStack.saveCB = gsSaveAdditionalNgInfo;\r\n }\r\n}\r\n","/*\n * Public API Surface of gridstack-angular\n */\n\nexport * from './lib/gridstack-item.component';\nexport * from './lib/gridstack.component';\nexport * from './lib/gridstack.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAG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EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,iBARxB,kBAAkB;QAClB,sBAAsB,CAAA,EAAA,OAAA,EAAA,CAJtB,YAAY,CAAA,EAAA,OAAA,EAAA,CAOZ,kBAAkB;QAClB,sBAAsB,CAAA,EAAA,CAAA,CAAA;AAGb,eAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAXxB,YAAY,CAAA,EAAA,CAAA,CAAA;2FAWH,eAAe,EAAA,UAAA,EAAA,CAAA;kBAb3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACD,oBAAA,YAAY,EAAE;wBACZ,kBAAkB;wBAClB,sBAAsB;AACvB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,kBAAkB;wBAClB,sBAAsB;AACvB,qBAAA;AACF,iBAAA,CAAA;;;ACxBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* gridstack-item.component.ts 8.1.
|
|
3
|
-
* Copyright (c) 2022 Alain Dumesny - see GridStack root license
|
|
4
|
-
*/
|
|
5
|
-
import { ElementRef, ViewContainerRef, OnDestroy } from '@angular/core';
|
|
6
|
-
import { GridItemHTMLElement, GridStackNode } from 'gridstack';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
container
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
/**
|
|
2
|
+
* gridstack-item.component.ts 8.1.2
|
|
3
|
+
* Copyright (c) 2022 Alain Dumesny - see GridStack root license
|
|
4
|
+
*/
|
|
5
|
+
import { ElementRef, ViewContainerRef, OnDestroy } from '@angular/core';
|
|
6
|
+
import { GridItemHTMLElement, GridStackNode } from 'gridstack';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/** store element to Ng Class pointer back */
|
|
9
|
+
export interface GridItemCompHTMLElement extends GridItemHTMLElement {
|
|
10
|
+
_gridItemComp?: GridstackItemComponent;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* HTML Component Wrapper for gridstack items, in combination with GridstackComponent for parent grid
|
|
14
|
+
*/
|
|
15
|
+
export declare class GridstackItemComponent implements OnDestroy {
|
|
16
|
+
private readonly elementRef;
|
|
17
|
+
/** container to append items dynamically */
|
|
18
|
+
container?: ViewContainerRef;
|
|
19
|
+
/** list of options for creating/updating this item */
|
|
20
|
+
set options(val: GridStackNode);
|
|
21
|
+
/** return the latest grid options (from GS once built, otherwise initial values) */
|
|
22
|
+
get options(): GridStackNode;
|
|
23
|
+
private _options?;
|
|
24
|
+
/** return the native element that contains grid specific fields as well */
|
|
25
|
+
get el(): GridItemCompHTMLElement;
|
|
26
|
+
/** clears the initial options now that we've built */
|
|
27
|
+
clearOptions(): void;
|
|
28
|
+
constructor(elementRef: ElementRef<GridItemHTMLElement>);
|
|
29
|
+
ngOnDestroy(): void;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GridstackItemComponent, never>;
|
|
31
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GridstackItemComponent, "gridstack-item", never, { "options": "options"; }, {}, never, ["*"], false>;
|
|
32
|
+
}
|