@@ -2,6 +2,7 @@ import "./../../components/toast-notification/toast-notification.js";
22import { FormModule } from "./../../src/modules/form.js" ;
33import "./../../components/dynamic-columns/dynamic-columns.js" ;
44import "./../../components/virtual-list/virtual-list.js" ;
5+ import { ComponentModule } from "../../src/modules/component.js" ;
56
67export default class FormView extends HTMLElement {
78 static tag = "form-view" ;
@@ -24,7 +25,14 @@ export default class FormView extends HTMLElement {
2425 const data = loadData ( ) ;
2526
2627 const virtualList = this . shadowRoot . querySelector ( "virtual-list" ) ;
27- virtualList . load ( data , template , this . #inflate. bind ( this ) ) ;
28+
29+ ComponentModule . on_ready ( {
30+ element : virtualList ,
31+ callback : ( ) => {
32+ virtualList . load ( data , template , 32 , this . #inflate. bind ( this ) ) ;
33+ }
34+ } )
35+
2836 }
2937
3038 async disconnectedCallback ( ) {
@@ -36,9 +44,6 @@ export default class FormView extends HTMLElement {
3644
3745 }
3846
39- load ( data ) {
40- }
41-
4247 async #click( event ) {
4348 const target = event . target ;
4449
@@ -96,4 +101,18 @@ function loadData() {
96101 return data ;
97102}
98103
104+ // Ensure the template is properly styled before measuring
105+ function measureListItem ( template ) {
106+ const div = document . createElement ( "div" ) ;
107+ div . style . position = "absolute" ;
108+ div . style . visibility = "hidden" ;
109+ div . style . height = "auto" ;
110+ div . style . width = "auto" ;
111+ div . appendChild ( template . cloneNode ( true ) ) ;
112+ document . body . appendChild ( div ) ;
113+ const height = div . clientHeight ;
114+ document . body . removeChild ( div ) ;
115+ return height ;
116+ }
117+
99118customElements . define ( FormView . tag , FormView ) ;
0 commit comments