@@ -173,26 +173,6 @@ export class GridStack {
173
173
return grid ;
174
174
}
175
175
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
-
196
176
/** call this method to register your engine instead of the default one.
197
177
* See instead `GridStackOptions.engineClass` if you only need to
198
178
* replace just one instance.
@@ -487,7 +467,7 @@ export class GridStack {
487
467
} else if ( GridStack . addRemoveCB ) {
488
468
el = GridStack . addRemoveCB ( this . el , w , true , false ) ;
489
469
} else {
490
- el = GridStack . createWidgetDivs ( this . opts . itemClass , node ) ;
470
+ el = this . createWidgetDivs ( node ) ;
491
471
}
492
472
493
473
if ( ! el ) return ;
@@ -511,6 +491,26 @@ export class GridStack {
511
491
return el ;
512
492
}
513
493
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
+
514
514
/**
515
515
* Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them
516
516
* from the parent's subGrid options.
0 commit comments