@@ -21,9 +21,12 @@ export type NgCompInputs = {[key: string]: any};
21
21
22
22
/** extends to store Ng Component selector, instead/inAddition to content */
23
23
export interface NgGridStackWidget extends GridStackWidget {
24
- selector ?: string ; // component type to create as content
25
- input ?: NgCompInputs ; // serialized data for the component input fields
26
- subGridOpts ?: NgGridStackOptions ; // nested grid options
24
+ /** Angular tag selector for this component to create at runtime */
25
+ selector ?: string ;
26
+ /** serialized data for the component input fields */
27
+ input ?: NgCompInputs ;
28
+ /** nested grid options */
29
+ subGridOpts ?: NgGridStackOptions ;
27
30
}
28
31
export interface NgGridStackNode extends GridStackNode {
29
32
selector ?: string ; // component type to create as content
@@ -117,15 +120,15 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
117
120
return reflectComponentType ( type ) ! . selector ;
118
121
}
119
122
120
- private _options ?: GridStackOptions ;
121
- private _grid ?: GridStack ;
122
- private _sub : Subscription | undefined ;
123
- private loaded ?: boolean ;
123
+ protected _options ?: GridStackOptions ;
124
+ protected _grid ?: GridStack ;
125
+ protected _sub : Subscription | undefined ;
126
+ protected loaded ?: boolean ;
124
127
125
128
constructor (
126
- // private readonly zone: NgZone,
127
- // private readonly cd: ChangeDetectorRef,
128
- private readonly elementRef : ElementRef < GridCompHTMLElement > ,
129
+ // protected readonly zone: NgZone,
130
+ // protected readonly cd: ChangeDetectorRef,
131
+ protected readonly elementRef : ElementRef < GridCompHTMLElement > ,
129
132
) {
130
133
this . el . _gridComp = this ;
131
134
}
@@ -182,7 +185,7 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
182
185
}
183
186
184
187
/** get all known events as easy to use Outputs for convenience */
185
- private hookEvents ( grid ?: GridStack ) {
188
+ protected hookEvents ( grid ?: GridStack ) {
186
189
if ( ! grid ) return ;
187
190
grid
188
191
. on ( 'added' , ( event : Event , nodes : GridStackNode [ ] ) => { this . checkEmpty ( ) ; this . addedCB . emit ( { event, nodes} ) ; } )
@@ -199,7 +202,7 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
199
202
. on ( 'resizestop' , ( event : Event , el : GridItemHTMLElement ) => this . resizeStopCB . emit ( { event, el} ) )
200
203
}
201
204
202
- private unhookEvents ( grid ?: GridStack ) {
205
+ protected unhookEvents ( grid ?: GridStack ) {
203
206
if ( ! grid ) return ;
204
207
grid . off ( 'added change disable drag dragstart dragstop dropped enable removed resize resizestart resizestop' ) ;
205
208
}
@@ -247,7 +250,6 @@ export function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, w:
247
250
// if proper BaseWidget subclass, save it and load additional data
248
251
if ( childWidget && typeof childWidget . serialize === 'function' && typeof childWidget . deserialize === 'function' ) {
249
252
gridItem . childWidget = childWidget ;
250
- childWidget . widgetItem = w ;
251
253
childWidget . deserialize ( w ) ;
252
254
}
253
255
}
@@ -275,7 +277,7 @@ export function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, w:
275
277
276
278
/**
277
279
* called for each item in the grid - check if additional information needs to be saved.
278
- * Note: since this is options minus gridstack private members using Utils.removeInternalForSave(),
280
+ * Note: since this is options minus gridstack protected members using Utils.removeInternalForSave(),
279
281
* this typically doesn't need to do anything. However your custom Component @Input() are now supported
280
282
* using BaseWidget.serialize()
281
283
*/
0 commit comments