gridstack 10.2.1 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/angular/.vscode/extensions.json +4 -0
  2. package/angular/.vscode/launch.json +20 -0
  3. package/angular/.vscode/tasks.json +42 -0
  4. package/angular/package.json +1 -1
  5. package/dist/angular/esm2020/gridstack-angular.mjs +4 -4
  6. package/dist/angular/esm2020/lib/base-widget.mjs +30 -30
  7. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +52 -52
  8. package/dist/angular/esm2020/lib/gridstack.component.mjs +266 -266
  9. package/dist/angular/esm2020/lib/gridstack.module.mjs +39 -39
  10. package/dist/angular/esm2020/public-api.mjs +7 -7
  11. package/dist/angular/fesm2015/gridstack-angular.mjs +368 -368
  12. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  13. package/dist/angular/fesm2020/gridstack-angular.mjs +363 -363
  14. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  15. package/dist/angular/index.d.ts +5 -5
  16. package/dist/angular/lib/base-widget.d.ts +16 -16
  17. package/dist/angular/lib/gridstack-item.component.d.ts +37 -37
  18. package/dist/angular/lib/gridstack.component.d.ts +129 -129
  19. package/dist/angular/lib/gridstack.module.d.ts +10 -10
  20. package/dist/angular/public-api.d.ts +4 -4
  21. package/dist/dd-base-impl.d.ts +1 -1
  22. package/dist/dd-base-impl.js +1 -1
  23. package/dist/dd-base-impl.js.map +1 -1
  24. package/dist/dd-draggable.d.ts +1 -1
  25. package/dist/dd-draggable.js +1 -1
  26. package/dist/dd-draggable.js.map +1 -1
  27. package/dist/dd-droppable.d.ts +1 -1
  28. package/dist/dd-droppable.js +1 -1
  29. package/dist/dd-droppable.js.map +1 -1
  30. package/dist/dd-element.d.ts +1 -1
  31. package/dist/dd-element.js +1 -1
  32. package/dist/dd-element.js.map +1 -1
  33. package/dist/dd-gridstack.d.ts +1 -1
  34. package/dist/dd-gridstack.js +1 -1
  35. package/dist/dd-gridstack.js.map +1 -1
  36. package/dist/dd-manager.d.ts +1 -1
  37. package/dist/dd-manager.js +1 -1
  38. package/dist/dd-manager.js.map +1 -1
  39. package/dist/dd-resizable-handle.d.ts +1 -1
  40. package/dist/dd-resizable-handle.js +1 -1
  41. package/dist/dd-resizable-handle.js.map +1 -1
  42. package/dist/dd-resizable.d.ts +1 -1
  43. package/dist/dd-resizable.js +1 -1
  44. package/dist/dd-resizable.js.map +1 -1
  45. package/dist/dd-touch.d.ts +1 -1
  46. package/dist/dd-touch.js +1 -1
  47. package/dist/dd-touch.js.map +1 -1
  48. package/dist/es5/dd-base-impl.d.ts +1 -1
  49. package/dist/es5/dd-base-impl.js +1 -1
  50. package/dist/es5/dd-base-impl.js.map +1 -1
  51. package/dist/es5/dd-draggable.d.ts +1 -1
  52. package/dist/es5/dd-draggable.js +1 -1
  53. package/dist/es5/dd-draggable.js.map +1 -1
  54. package/dist/es5/dd-droppable.d.ts +1 -1
  55. package/dist/es5/dd-droppable.js +1 -1
  56. package/dist/es5/dd-droppable.js.map +1 -1
  57. package/dist/es5/dd-element.d.ts +1 -1
  58. package/dist/es5/dd-element.js +1 -1
  59. package/dist/es5/dd-element.js.map +1 -1
  60. package/dist/es5/dd-gridstack.d.ts +1 -1
  61. package/dist/es5/dd-gridstack.js +1 -1
  62. package/dist/es5/dd-gridstack.js.map +1 -1
  63. package/dist/es5/dd-manager.d.ts +1 -1
  64. package/dist/es5/dd-manager.js +1 -1
  65. package/dist/es5/dd-manager.js.map +1 -1
  66. package/dist/es5/dd-resizable-handle.d.ts +1 -1
  67. package/dist/es5/dd-resizable-handle.js +1 -1
  68. package/dist/es5/dd-resizable-handle.js.map +1 -1
  69. package/dist/es5/dd-resizable.d.ts +1 -1
  70. package/dist/es5/dd-resizable.js +1 -1
  71. package/dist/es5/dd-resizable.js.map +1 -1
  72. package/dist/es5/dd-touch.d.ts +1 -1
  73. package/dist/es5/dd-touch.js +1 -1
  74. package/dist/es5/dd-touch.js.map +1 -1
  75. package/dist/es5/gridstack-all.js +1 -1
  76. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  77. package/dist/es5/gridstack-all.js.map +1 -1
  78. package/dist/es5/gridstack-engine.d.ts +1 -1
  79. package/dist/es5/gridstack-engine.js +5 -5
  80. package/dist/es5/gridstack-engine.js.map +1 -1
  81. package/dist/es5/gridstack-poly.js +1 -1
  82. package/dist/es5/gridstack.d.ts +1 -1
  83. package/dist/es5/gridstack.js +18 -33
  84. package/dist/es5/gridstack.js.map +1 -1
  85. package/dist/es5/types.d.ts +1 -1
  86. package/dist/es5/types.js +1 -1
  87. package/dist/es5/types.js.map +1 -1
  88. package/dist/es5/utils.d.ts +1 -1
  89. package/dist/es5/utils.js +1 -1
  90. package/dist/es5/utils.js.map +1 -1
  91. package/dist/gridstack-all.js +1 -1
  92. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  93. package/dist/gridstack-all.js.map +1 -1
  94. package/dist/gridstack-engine.d.ts +1 -1
  95. package/dist/gridstack-engine.js +5 -5
  96. package/dist/gridstack-engine.js.map +1 -1
  97. package/dist/gridstack.css +1 -1
  98. package/dist/gridstack.d.ts +1 -1
  99. package/dist/gridstack.js +19 -34
  100. package/dist/gridstack.js.map +1 -1
  101. package/dist/types.d.ts +1 -1
  102. package/dist/types.js +1 -1
  103. package/dist/types.js.map +1 -1
  104. package/dist/utils.d.ts +1 -1
  105. package/dist/utils.js +1 -1
  106. package/dist/utils.js.map +1 -1
  107. package/doc/CHANGES.md +4 -0
  108. package/package.json +1 -1
@@ -6,45 +6,45 @@ import { GridStack } from 'gridstack';
6
6
  import * as i1 from '@angular/common';
7
7
  import { CommonModule } from '@angular/common';
8
8
 
9
- /**
10
- * gridstack-item.component.ts 10.2.1
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.ref;
44
- delete this.el._gridItemComp;
45
- }
46
- }
47
- GridstackItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
9
+ /**
10
+ * gridstack-item.component.ts 10.3.0
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.ref;
44
+ delete this.el._gridItemComp;
45
+ }
46
+ }
47
+ GridstackItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
48
48
  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: `
49
49
  <div class="grid-stack-item-content">
50
50
  <!-- where dynamic items go based on component types, or sub-grids, etc...) -->
@@ -53,9 +53,9 @@ GridstackItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0",
53
53
  <ng-content></ng-content>
54
54
  <!-- fallback HTML content from GridStackWidget content field if used instead -->
55
55
  {{options.content}}
56
- </div>`, isInline: true, styles: [":host{display:block}\n"] });
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, decorators: [{
58
- type: Component,
56
+ </div>`, isInline: true, styles: [":host{display:block}\n"] });
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, decorators: [{
58
+ type: Component,
59
59
  args: [{ selector: 'gridstack-item', template: `
60
60
  <div class="grid-stack-item-content">
61
61
  <!-- where dynamic items go based on component types, or sub-grids, etc...) -->
@@ -64,140 +64,140 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
64
64
  <ng-content></ng-content>
65
65
  <!-- fallback HTML content from GridStackWidget content field if used instead -->
66
66
  {{options.content}}
67
- </div>`, styles: [":host{display:block}\n"] }]
68
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { container: [{
69
- type: ViewChild,
70
- args: ['container', { read: ViewContainerRef, static: true }]
71
- }], options: [{
72
- type: Input
67
+ </div>`, styles: [":host{display:block}\n"] }]
68
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { container: [{
69
+ type: ViewChild,
70
+ args: ['container', { read: ViewContainerRef, static: true }]
71
+ }], options: [{
72
+ type: Input
73
73
  }] } });
74
74
 
75
- /**
76
- * gridstack.component.ts 10.2.1
77
- * Copyright (c) 2022 Alain Dumesny - see GridStack root license
78
- */
79
- /**
80
- * HTML Component Wrapper for gridstack, in combination with GridstackItemComponent for the items
81
- */
82
- class GridstackComponent {
83
- constructor(
84
- // private readonly zone: NgZone,
85
- // private readonly cd: ChangeDetectorRef,
86
- elementRef) {
87
- this.elementRef = elementRef;
88
- /** individual list of GridStackEvent callbacks handlers as output
89
- * otherwise use this.grid.on('name1 name2 name3', callback) to handle multiple at once
90
- * see https://github.com/gridstack/gridstack.js/blob/master/demo/events.js#L4
91
- *
92
- * Note: camel casing and 'CB' added at the end to prevent @angular-eslint/no-output-native
93
- * eg: 'change' would trigger the raw CustomEvent so use different name.
94
- */
95
- this.addedCB = new EventEmitter();
96
- this.changeCB = new EventEmitter();
97
- this.disableCB = new EventEmitter();
98
- this.dragCB = new EventEmitter();
99
- this.dragStartCB = new EventEmitter();
100
- this.dragStopCB = new EventEmitter();
101
- this.droppedCB = new EventEmitter();
102
- this.enableCB = new EventEmitter();
103
- this.removedCB = new EventEmitter();
104
- this.resizeCB = new EventEmitter();
105
- this.resizeStartCB = new EventEmitter();
106
- this.resizeStopCB = new EventEmitter();
107
- this.ngUnsubscribe = new Subject();
108
- this.el._gridComp = this;
109
- }
110
- /** initial options for creation of the grid */
111
- set options(val) { this._options = val; }
112
- /** return the current running options */
113
- get options() { return this._grid?.opts || this._options || {}; }
114
- /** return the native element that contains grid specific fields as well */
115
- get el() { return this.elementRef.nativeElement; }
116
- /** return the GridStack class */
117
- get grid() { return this._grid; }
118
- /** add a list of ng Component to be mapped to selector */
119
- static addComponentToSelectorType(typeList) {
120
- typeList.forEach(type => GridstackComponent.selectorToType[GridstackComponent.getSelector(type)] = type);
121
- }
122
- /** return the ng Component selector */
123
- static getSelector(type) {
124
- return reflectComponentType(type).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
- delete this.ref;
146
- this.ngUnsubscribe.next();
147
- this.ngUnsubscribe.complete();
148
- this.grid?.destroy();
149
- delete this._grid;
150
- delete this.el._gridComp;
151
- }
152
- /**
153
- * called when the TEMPLATE list of items changes - get a list of nodes and
154
- * update the layout accordingly (which will take care of adding/removing items changed by Angular)
155
- */
156
- updateAll() {
157
- if (!this.grid)
158
- return;
159
- const layout = [];
160
- this.gridstackItems?.forEach(item => {
161
- layout.push(item.options);
162
- item.clearOptions();
163
- });
164
- this.grid.load(layout); // efficient that does diffs only
165
- }
166
- /** check if the grid is empty, if so show alternative content */
167
- checkEmpty() {
168
- if (!this.grid)
169
- return;
170
- const isEmpty = !this.grid.engine.nodes.length;
171
- if (isEmpty === this.isEmpty)
172
- return;
173
- this.isEmpty = isEmpty;
174
- // this.cd.detectChanges();
175
- }
176
- /** get all known events as easy to use Outputs for convenience */
177
- hookEvents(grid) {
178
- if (!grid)
179
- return;
180
- grid
181
- .on('added', (event, nodes) => { this.checkEmpty(); this.addedCB.emit({ event, nodes }); })
182
- .on('change', (event, nodes) => this.changeCB.emit({ event, nodes }))
183
- .on('disable', (event) => this.disableCB.emit({ event }))
184
- .on('drag', (event, el) => this.dragCB.emit({ event, el }))
185
- .on('dragstart', (event, el) => this.dragStartCB.emit({ event, el }))
186
- .on('dragstop', (event, el) => this.dragStopCB.emit({ event, el }))
187
- .on('dropped', (event, previousNode, newNode) => this.droppedCB.emit({ event, previousNode, newNode }))
188
- .on('enable', (event) => this.enableCB.emit({ event }))
189
- .on('removed', (event, nodes) => { this.checkEmpty(); this.removedCB.emit({ event, nodes }); })
190
- .on('resize', (event, el) => this.resizeCB.emit({ event, el }))
191
- .on('resizestart', (event, el) => this.resizeStartCB.emit({ event, el }))
192
- .on('resizestop', (event, el) => this.resizeStopCB.emit({ event, el }));
193
- }
194
- }
195
- /**
196
- * stores the selector -> Type mapping, so we can create items dynamically from a string.
197
- * Unfortunately Ng doesn't provide public access to that mapping.
198
- */
199
- GridstackComponent.selectorToType = {};
200
- GridstackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
75
+ /**
76
+ * gridstack.component.ts 10.3.0
77
+ * Copyright (c) 2022 Alain Dumesny - see GridStack root license
78
+ */
79
+ /**
80
+ * HTML Component Wrapper for gridstack, in combination with GridstackItemComponent for the items
81
+ */
82
+ class GridstackComponent {
83
+ constructor(
84
+ // private readonly zone: NgZone,
85
+ // private readonly cd: ChangeDetectorRef,
86
+ elementRef) {
87
+ this.elementRef = elementRef;
88
+ /** individual list of GridStackEvent callbacks handlers as output
89
+ * otherwise use this.grid.on('name1 name2 name3', callback) to handle multiple at once
90
+ * see https://github.com/gridstack/gridstack.js/blob/master/demo/events.js#L4
91
+ *
92
+ * Note: camel casing and 'CB' added at the end to prevent @angular-eslint/no-output-native
93
+ * eg: 'change' would trigger the raw CustomEvent so use different name.
94
+ */
95
+ this.addedCB = new EventEmitter();
96
+ this.changeCB = new EventEmitter();
97
+ this.disableCB = new EventEmitter();
98
+ this.dragCB = new EventEmitter();
99
+ this.dragStartCB = new EventEmitter();
100
+ this.dragStopCB = new EventEmitter();
101
+ this.droppedCB = new EventEmitter();
102
+ this.enableCB = new EventEmitter();
103
+ this.removedCB = new EventEmitter();
104
+ this.resizeCB = new EventEmitter();
105
+ this.resizeStartCB = new EventEmitter();
106
+ this.resizeStopCB = new EventEmitter();
107
+ this.ngUnsubscribe = new Subject();
108
+ this.el._gridComp = this;
109
+ }
110
+ /** initial options for creation of the grid */
111
+ set options(val) { this._options = val; }
112
+ /** return the current running options */
113
+ get options() { return this._grid?.opts || this._options || {}; }
114
+ /** return the native element that contains grid specific fields as well */
115
+ get el() { return this.elementRef.nativeElement; }
116
+ /** return the GridStack class */
117
+ get grid() { return this._grid; }
118
+ /** add a list of ng Component to be mapped to selector */
119
+ static addComponentToSelectorType(typeList) {
120
+ typeList.forEach(type => GridstackComponent.selectorToType[GridstackComponent.getSelector(type)] = type);
121
+ }
122
+ /** return the ng Component selector */
123
+ static getSelector(type) {
124
+ return reflectComponentType(type).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
+ delete this.ref;
146
+ this.ngUnsubscribe.next();
147
+ this.ngUnsubscribe.complete();
148
+ this.grid?.destroy();
149
+ delete this._grid;
150
+ delete this.el._gridComp;
151
+ }
152
+ /**
153
+ * called when the TEMPLATE list of items changes - get a list of nodes and
154
+ * update the layout accordingly (which will take care of adding/removing items changed by Angular)
155
+ */
156
+ updateAll() {
157
+ if (!this.grid)
158
+ return;
159
+ const layout = [];
160
+ this.gridstackItems?.forEach(item => {
161
+ layout.push(item.options);
162
+ item.clearOptions();
163
+ });
164
+ this.grid.load(layout); // efficient that does diffs only
165
+ }
166
+ /** check if the grid is empty, if so show alternative content */
167
+ checkEmpty() {
168
+ if (!this.grid)
169
+ return;
170
+ const isEmpty = !this.grid.engine.nodes.length;
171
+ if (isEmpty === this.isEmpty)
172
+ return;
173
+ this.isEmpty = isEmpty;
174
+ // this.cd.detectChanges();
175
+ }
176
+ /** get all known events as easy to use Outputs for convenience */
177
+ hookEvents(grid) {
178
+ if (!grid)
179
+ return;
180
+ grid
181
+ .on('added', (event, nodes) => { this.checkEmpty(); this.addedCB.emit({ event, nodes }); })
182
+ .on('change', (event, nodes) => this.changeCB.emit({ event, nodes }))
183
+ .on('disable', (event) => this.disableCB.emit({ event }))
184
+ .on('drag', (event, el) => this.dragCB.emit({ event, el }))
185
+ .on('dragstart', (event, el) => this.dragStartCB.emit({ event, el }))
186
+ .on('dragstop', (event, el) => this.dragStopCB.emit({ event, el }))
187
+ .on('dropped', (event, previousNode, newNode) => this.droppedCB.emit({ event, previousNode, newNode }))
188
+ .on('enable', (event) => this.enableCB.emit({ event }))
189
+ .on('removed', (event, nodes) => { this.checkEmpty(); this.removedCB.emit({ event, nodes }); })
190
+ .on('resize', (event, el) => this.resizeCB.emit({ event, el }))
191
+ .on('resizestart', (event, el) => this.resizeStartCB.emit({ event, el }))
192
+ .on('resizestop', (event, el) => this.resizeStopCB.emit({ event, el }));
193
+ }
194
+ }
195
+ /**
196
+ * stores the selector -> Type mapping, so we can create items dynamically from a string.
197
+ * Unfortunately Ng doesn't provide public access to that mapping.
198
+ */
199
+ GridstackComponent.selectorToType = {};
200
+ GridstackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
201
201
  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: `
202
202
  <!-- content to show when when grid is empty, like instructions on how to add widgets -->
203
203
  <ng-content select="[empty-content]" *ngIf="isEmpty"></ng-content>
@@ -205,9 +205,9 @@ GridstackComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ver
205
205
  <ng-template #container></ng-template>
206
206
  <!-- where template items go -->
207
207
  <ng-content></ng-content>
208
- `, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, decorators: [{
210
- type: Component,
208
+ `, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, decorators: [{
210
+ type: Component,
211
211
  args: [{ selector: 'gridstack', template: `
212
212
  <!-- content to show when when grid is empty, like instructions on how to add widgets -->
213
213
  <ng-content select="[empty-content]" *ngIf="isEmpty"></ng-content>
@@ -215,200 +215,200 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
215
215
  <ng-template #container></ng-template>
216
216
  <!-- where template items go -->
217
217
  <ng-content></ng-content>
218
- `, styles: [":host{display:block}\n"] }]
219
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { gridstackItems: [{
220
- type: ContentChildren,
221
- args: [GridstackItemComponent]
222
- }], container: [{
223
- type: ViewChild,
224
- args: ['container', { read: ViewContainerRef, static: true }]
225
- }], options: [{
226
- type: Input
227
- }], isEmpty: [{
228
- type: Input
229
- }], addedCB: [{
230
- type: Output
231
- }], changeCB: [{
232
- type: Output
233
- }], disableCB: [{
234
- type: Output
235
- }], dragCB: [{
236
- type: Output
237
- }], dragStartCB: [{
238
- type: Output
239
- }], dragStopCB: [{
240
- type: Output
241
- }], droppedCB: [{
242
- type: Output
243
- }], enableCB: [{
244
- type: Output
245
- }], removedCB: [{
246
- type: Output
247
- }], resizeCB: [{
248
- type: Output
249
- }], resizeStartCB: [{
250
- type: Output
251
- }], resizeStopCB: [{
252
- type: Output
253
- }] } });
254
- /**
255
- * can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)
256
- **/
257
- function gsCreateNgComponents(host, w, add, isGrid) {
258
- if (add) {
259
- //
260
- // create the component dynamically - see https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html
261
- //
262
- if (!host)
263
- return;
264
- if (isGrid) {
265
- const container = host.parentElement?._gridItemComp?.container;
266
- // TODO: figure out how to create ng component inside regular Div. need to access app injectors...
267
- // if (!container) {
268
- // const hostElement: Element = host;
269
- // const environmentInjector: EnvironmentInjector;
270
- // grid = createComponent(GridstackComponent, {environmentInjector, hostElement})?.instance;
271
- // }
272
- const gridRef = container?.createComponent(GridstackComponent);
273
- const grid = gridRef?.instance;
274
- if (!grid)
275
- return;
276
- grid.ref = gridRef;
277
- grid.options = w;
278
- return grid.el;
279
- }
280
- else {
281
- const gridComp = host._gridComp;
282
- const gridItemRef = gridComp?.container?.createComponent(GridstackItemComponent);
283
- const gridItem = gridItemRef?.instance;
284
- if (!gridItem)
285
- return;
286
- gridItem.ref = gridItemRef;
287
- // 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
288
- if (!w.subGridOpts) {
289
- const selector = w.selector;
290
- const type = selector ? GridstackComponent.selectorToType[selector] : undefined;
291
- if (type) {
292
- const childWidget = gridItem.container?.createComponent(type)?.instance;
293
- // if proper BaseWidget subclass, save it and load additional data
294
- if (childWidget && typeof childWidget.serialize === 'function' && typeof childWidget.deserialize === 'function') {
295
- gridItem.childWidget = childWidget;
296
- childWidget.deserialize(w);
297
- }
298
- }
299
- }
300
- return gridItem.el;
301
- }
302
- }
303
- else {
304
- //
305
- // REMOVE - have to call ComponentRef:destroy() for dynamic objects to correctly remove themselves
306
- // Note: this will destroy all children dynamic components as well: gridItem -> childWidget
307
- //
308
- const n = w;
309
- if (isGrid) {
310
- const grid = n.el?._gridComp;
311
- if (grid?.ref)
312
- grid.ref.destroy();
313
- else
314
- grid?.ngOnDestroy();
315
- }
316
- else {
317
- const gridItem = n.el?._gridItemComp;
318
- if (gridItem?.ref)
319
- gridItem.ref.destroy();
320
- else
321
- gridItem?.ngOnDestroy();
322
- }
323
- }
324
- return;
325
- }
326
- /**
327
- * called for each item in the grid - check if additional information needs to be saved.
328
- * Note: since this is options minus gridstack private members using Utils.removeInternalForSave(),
329
- * this typically doesn't need to do anything. However your custom Component @Input() are now supported
330
- * using BaseWidget.serialize()
331
- */
332
- function gsSaveAdditionalNgInfo(n, w) {
333
- const gridItem = n.el?._gridItemComp;
334
- if (gridItem) {
335
- const input = gridItem.childWidget?.serialize();
336
- if (input) {
337
- w.input = input;
338
- }
339
- return;
340
- }
341
- // else check if Grid
342
- const grid = n.el?._gridComp;
343
- if (grid) {
344
- //.... save any custom data
345
- }
218
+ `, styles: [":host{display:block}\n"] }]
219
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { gridstackItems: [{
220
+ type: ContentChildren,
221
+ args: [GridstackItemComponent]
222
+ }], container: [{
223
+ type: ViewChild,
224
+ args: ['container', { read: ViewContainerRef, static: true }]
225
+ }], options: [{
226
+ type: Input
227
+ }], isEmpty: [{
228
+ type: Input
229
+ }], addedCB: [{
230
+ type: Output
231
+ }], changeCB: [{
232
+ type: Output
233
+ }], disableCB: [{
234
+ type: Output
235
+ }], dragCB: [{
236
+ type: Output
237
+ }], dragStartCB: [{
238
+ type: Output
239
+ }], dragStopCB: [{
240
+ type: Output
241
+ }], droppedCB: [{
242
+ type: Output
243
+ }], enableCB: [{
244
+ type: Output
245
+ }], removedCB: [{
246
+ type: Output
247
+ }], resizeCB: [{
248
+ type: Output
249
+ }], resizeStartCB: [{
250
+ type: Output
251
+ }], resizeStopCB: [{
252
+ type: Output
253
+ }] } });
254
+ /**
255
+ * can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)
256
+ **/
257
+ function gsCreateNgComponents(host, w, add, isGrid) {
258
+ if (add) {
259
+ //
260
+ // create the component dynamically - see https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html
261
+ //
262
+ if (!host)
263
+ return;
264
+ if (isGrid) {
265
+ const container = host.parentElement?._gridItemComp?.container;
266
+ // TODO: figure out how to create ng component inside regular Div. need to access app injectors...
267
+ // if (!container) {
268
+ // const hostElement: Element = host;
269
+ // const environmentInjector: EnvironmentInjector;
270
+ // grid = createComponent(GridstackComponent, {environmentInjector, hostElement})?.instance;
271
+ // }
272
+ const gridRef = container?.createComponent(GridstackComponent);
273
+ const grid = gridRef?.instance;
274
+ if (!grid)
275
+ return;
276
+ grid.ref = gridRef;
277
+ grid.options = w;
278
+ return grid.el;
279
+ }
280
+ else {
281
+ const gridComp = host._gridComp;
282
+ const gridItemRef = gridComp?.container?.createComponent(GridstackItemComponent);
283
+ const gridItem = gridItemRef?.instance;
284
+ if (!gridItem)
285
+ return;
286
+ gridItem.ref = gridItemRef;
287
+ // 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
288
+ if (!w.subGridOpts) {
289
+ const selector = w.selector;
290
+ const type = selector ? GridstackComponent.selectorToType[selector] : undefined;
291
+ if (type) {
292
+ const childWidget = gridItem.container?.createComponent(type)?.instance;
293
+ // if proper BaseWidget subclass, save it and load additional data
294
+ if (childWidget && typeof childWidget.serialize === 'function' && typeof childWidget.deserialize === 'function') {
295
+ gridItem.childWidget = childWidget;
296
+ childWidget.deserialize(w);
297
+ }
298
+ }
299
+ }
300
+ return gridItem.el;
301
+ }
302
+ }
303
+ else {
304
+ //
305
+ // REMOVE - have to call ComponentRef:destroy() for dynamic objects to correctly remove themselves
306
+ // Note: this will destroy all children dynamic components as well: gridItem -> childWidget
307
+ //
308
+ const n = w;
309
+ if (isGrid) {
310
+ const grid = n.el?._gridComp;
311
+ if (grid?.ref)
312
+ grid.ref.destroy();
313
+ else
314
+ grid?.ngOnDestroy();
315
+ }
316
+ else {
317
+ const gridItem = n.el?._gridItemComp;
318
+ if (gridItem?.ref)
319
+ gridItem.ref.destroy();
320
+ else
321
+ gridItem?.ngOnDestroy();
322
+ }
323
+ }
324
+ return;
325
+ }
326
+ /**
327
+ * called for each item in the grid - check if additional information needs to be saved.
328
+ * Note: since this is options minus gridstack private members using Utils.removeInternalForSave(),
329
+ * this typically doesn't need to do anything. However your custom Component @Input() are now supported
330
+ * using BaseWidget.serialize()
331
+ */
332
+ function gsSaveAdditionalNgInfo(n, w) {
333
+ const gridItem = n.el?._gridItemComp;
334
+ if (gridItem) {
335
+ const input = gridItem.childWidget?.serialize();
336
+ if (input) {
337
+ w.input = input;
338
+ }
339
+ return;
340
+ }
341
+ // else check if Grid
342
+ const grid = n.el?._gridComp;
343
+ if (grid) {
344
+ //.... save any custom data
345
+ }
346
346
  }
347
347
 
348
- /**
349
- * gridstack-item.component.ts 10.2.1
350
- * Copyright (c) 2022 Alain Dumesny - see GridStack root license
351
- */
352
- class BaseWidget {
353
- /**
354
- * REDEFINE to return an object representing the data needed to re-create yourself, other than `selector` already handled.
355
- * This should map directly to the @Input() fields of this objects on create, so a simple apply can be used on read
356
- */
357
- serialize() { return; }
358
- /**
359
- * REDEFINE this if your widget needs to read from saved data and transform it to create itself - you do this for
360
- * things that are not mapped directly into @Input() fields for example.
361
- */
362
- deserialize(w) {
363
- if (w.input)
364
- Object.assign(this, w.input);
365
- }
366
- }
367
- BaseWidget.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
368
- BaseWidget.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget });
369
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget, decorators: [{
370
- type: Injectable
348
+ /**
349
+ * gridstack-item.component.ts 10.3.0
350
+ * Copyright (c) 2022 Alain Dumesny - see GridStack root license
351
+ */
352
+ class BaseWidget {
353
+ /**
354
+ * REDEFINE to return an object representing the data needed to re-create yourself, other than `selector` already handled.
355
+ * This should map directly to the @Input() fields of this objects on create, so a simple apply can be used on read
356
+ */
357
+ serialize() { return; }
358
+ /**
359
+ * REDEFINE this if your widget needs to read from saved data and transform it to create itself - you do this for
360
+ * things that are not mapped directly into @Input() fields for example.
361
+ */
362
+ deserialize(w) {
363
+ if (w.input)
364
+ Object.assign(this, w.input);
365
+ }
366
+ }
367
+ BaseWidget.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
368
+ BaseWidget.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget });
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget, decorators: [{
370
+ type: Injectable
371
371
  }] });
372
372
 
373
- /**
374
- * gridstack.component.ts 10.2.1
375
- * Copyright (c) 2022 Alain Dumesny - see GridStack root license
376
- */
377
- class GridstackModule {
378
- constructor() {
379
- // set globally our method to create the right widget type
380
- GridStack.addRemoveCB = gsCreateNgComponents;
381
- GridStack.saveCB = gsSaveAdditionalNgInfo;
382
- }
383
- }
384
- GridstackModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
385
- GridstackModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, declarations: [GridstackComponent,
386
- GridstackItemComponent], imports: [CommonModule], exports: [GridstackComponent,
387
- GridstackItemComponent] });
388
- GridstackModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, imports: [CommonModule] });
389
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, decorators: [{
390
- type: NgModule,
391
- args: [{
392
- imports: [
393
- CommonModule,
394
- ],
395
- declarations: [
396
- GridstackComponent,
397
- GridstackItemComponent,
398
- ],
399
- exports: [
400
- GridstackComponent,
401
- GridstackItemComponent,
402
- ],
403
- }]
373
+ /**
374
+ * gridstack.component.ts 10.3.0
375
+ * Copyright (c) 2022 Alain Dumesny - see GridStack root license
376
+ */
377
+ class GridstackModule {
378
+ constructor() {
379
+ // set globally our method to create the right widget type
380
+ GridStack.addRemoveCB = gsCreateNgComponents;
381
+ GridStack.saveCB = gsSaveAdditionalNgInfo;
382
+ }
383
+ }
384
+ GridstackModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
385
+ GridstackModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, declarations: [GridstackComponent,
386
+ GridstackItemComponent], imports: [CommonModule], exports: [GridstackComponent,
387
+ GridstackItemComponent] });
388
+ GridstackModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, imports: [CommonModule] });
389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, decorators: [{
390
+ type: NgModule,
391
+ args: [{
392
+ imports: [
393
+ CommonModule,
394
+ ],
395
+ declarations: [
396
+ GridstackComponent,
397
+ GridstackItemComponent,
398
+ ],
399
+ exports: [
400
+ GridstackComponent,
401
+ GridstackItemComponent,
402
+ ],
403
+ }]
404
404
  }], ctorParameters: function () { return []; } });
405
405
 
406
- /*
407
- * Public API Surface of gridstack-angular
406
+ /*
407
+ * Public API Surface of gridstack-angular
408
408
  */
409
409
 
410
- /**
411
- * Generated bundle index. Do not edit.
410
+ /**
411
+ * Generated bundle index. Do not edit.
412
412
  */
413
413
 
414
414
  export { BaseWidget, GridstackComponent, GridstackItemComponent, GridstackModule, gsCreateNgComponents, gsSaveAdditionalNgInfo };