@@ -110,18 +110,24 @@ export class Utils {
110110 return els ;
111111 }
112112
113+ /** true if widget (or grid) makes this item lazyLoad */
114+ static lazyLoad ( n : GridStackNode ) : boolean {
115+ return n . lazyLoad || n . grid ?. opts ?. lazyLoad && n . lazyLoad !== false ;
116+ }
117+
113118 /** create the default grid item divs, and content possibly lazy loaded calling GridStack.renderCB */
114119 static createWidgetDivs ( itemClass : string , n : GridStackNode ) : HTMLElement {
115120 const el = Utils . createDiv ( [ 'grid-stack-item' , itemClass ] ) ;
116121 const cont = Utils . createDiv ( [ 'grid-stack-item-content' ] , el ) ;
117122
118- const lazyLoad = n . lazyLoad || n . grid ?. opts ?. lazyLoad && n . lazyLoad !== false ;
119- if ( lazyLoad ) {
123+ if ( Utils . lazyLoad ( n ) ) {
120124 if ( ! n . visibleObservable ) {
121125 n . visibleObservable = new IntersectionObserver ( ( [ entry ] ) => { if ( entry . isIntersecting ) {
122126 n . visibleObservable ?. disconnect ( ) ;
123127 delete n . visibleObservable ;
124- GridStack . renderCB ( cont , n )
128+ GridStack . renderCB ( cont , n ) ;
129+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
130+ ( n . grid as any ) ?. _prepareDragDropByNode ( n ) ; // access protected method. TODO: do we expose that for React to call too (after dom is ready)
125131 } } ) ;
126132 window . setTimeout ( ( ) => n . visibleObservable ?. observe ( el ) ) ; // wait until callee sets position attributes
127133 }
@@ -582,7 +588,7 @@ export class Utils {
582588 button : 0 ,
583589 relatedTarget : e . target
584590 } ) ;
585-
591+
586592 ( target || e . target ) . dispatchEvent ( simulatedEvent ) ;
587593 }
588594
0 commit comments