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