@@ -21,9 +21,12 @@ export type NgCompInputs = {[key: string]: any};
2121
2222/** extends to store Ng Component selector, instead/inAddition to content */
2323export 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 ;
2730}
2831export interface NgGridStackNode extends GridStackNode {
2932 selector ?: string ; // component type to create as content
@@ -117,15 +120,15 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
117120 return reflectComponentType ( type ) ! . selector ;
118121 }
119122
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 ;
124127
125128 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 > ,
129132 ) {
130133 this . el . _gridComp = this ;
131134 }
@@ -182,7 +185,7 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
182185 }
183186
184187 /** get all known events as easy to use Outputs for convenience */
185- private hookEvents ( grid ?: GridStack ) {
188+ protected hookEvents ( grid ?: GridStack ) {
186189 if ( ! grid ) return ;
187190 grid
188191 . on ( 'added' , ( event : Event , nodes : GridStackNode [ ] ) => { this . checkEmpty ( ) ; this . addedCB . emit ( { event, nodes} ) ; } )
@@ -199,7 +202,7 @@ export class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {
199202 . on ( 'resizestop' , ( event : Event , el : GridItemHTMLElement ) => this . resizeStopCB . emit ( { event, el} ) )
200203 }
201204
202- private unhookEvents ( grid ?: GridStack ) {
205+ protected unhookEvents ( grid ?: GridStack ) {
203206 if ( ! grid ) return ;
204207 grid . off ( 'added change disable drag dragstart dragstop dropped enable removed resize resizestart resizestop' ) ;
205208 }
@@ -247,7 +250,6 @@ export function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, w:
247250 // if proper BaseWidget subclass, save it and load additional data
248251 if ( childWidget && typeof childWidget . serialize === 'function' && typeof childWidget . deserialize === 'function' ) {
249252 gridItem . childWidget = childWidget ;
250- childWidget . widgetItem = w ;
251253 childWidget . deserialize ( w ) ;
252254 }
253255 }
@@ -275,7 +277,7 @@ export function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, w:
275277
276278/**
277279 * 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(),
279281 * this typically doesn't need to do anything. However your custom Component @Input() are now supported
280282 * using BaseWidget.serialize()
281283 */
0 commit comments