@@ -173,26 +173,6 @@ export class GridStack {
173173 return grid ;
174174 }
175175
176- /** create the default grid item divs, and content possibly lazy loaded calling GridStack.renderCB */
177- static createWidgetDivs ( itemClass : string , n : GridStackNode ) : HTMLElement {
178- const el = Utils . createDiv ( [ 'grid-stack-item' , itemClass ] ) ;
179- const cont = Utils . createDiv ( [ 'grid-stack-item-content' ] , el ) ;
180-
181- if ( Utils . lazyLoad ( n ) ) {
182- if ( ! n . visibleObservable ) {
183- n . visibleObservable = new IntersectionObserver ( ( [ entry ] ) => { if ( entry . isIntersecting ) {
184- n . visibleObservable ?. disconnect ( ) ;
185- delete n . visibleObservable ;
186- GridStack . renderCB ( cont , n ) ;
187- n . grid ?. prepareDragDrop ( n . el ) ;
188- } } ) ;
189- window . setTimeout ( ( ) => n . visibleObservable ?. observe ( el ) ) ; // wait until callee sets position attributes
190- }
191- } else GridStack . renderCB ( cont , n ) ;
192-
193- return el ;
194- }
195-
196176 /** call this method to register your engine instead of the default one.
197177 * See instead `GridStackOptions.engineClass` if you only need to
198178 * replace just one instance.
@@ -487,7 +467,7 @@ export class GridStack {
487467 } else if ( GridStack . addRemoveCB ) {
488468 el = GridStack . addRemoveCB ( this . el , w , true , false ) ;
489469 } else {
490- el = GridStack . createWidgetDivs ( this . opts . itemClass , node ) ;
470+ el = this . createWidgetDivs ( node ) ;
491471 }
492472
493473 if ( ! el ) return ;
@@ -511,6 +491,26 @@ export class GridStack {
511491 return el ;
512492 }
513493
494+ /** create the default grid item divs, and content (possibly lazy loaded) by using GridStack.renderCB() */
495+ public createWidgetDivs ( n : GridStackNode ) : HTMLElement {
496+ const el = Utils . createDiv ( [ 'grid-stack-item' , this . opts . itemClass ] ) ;
497+ const cont = Utils . createDiv ( [ 'grid-stack-item-content' ] , el ) ;
498+
499+ if ( Utils . lazyLoad ( n ) ) {
500+ if ( ! n . visibleObservable ) {
501+ n . visibleObservable = new IntersectionObserver ( ( [ entry ] ) => { if ( entry . isIntersecting ) {
502+ n . visibleObservable ?. disconnect ( ) ;
503+ delete n . visibleObservable ;
504+ GridStack . renderCB ( cont , n ) ;
505+ n . grid ?. prepareDragDrop ( n . el ) ;
506+ } } ) ;
507+ window . setTimeout ( ( ) => n . visibleObservable ?. observe ( el ) ) ; // wait until callee sets position attributes
508+ }
509+ } else GridStack . renderCB ( cont , n ) ;
510+
511+ return el ;
512+ }
513+
514514 /**
515515 * Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
516516 * from the parent's subGrid options.
0 commit comments