@ninebone/table 0.0.528 → 0.0.529

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,7 +123,7 @@
123
123
  <button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
124
124
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
125
125
  <button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
126
- `;const e=h(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,T,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,Bt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,lt=new WeakMap,tt=new WeakMap,T=new WeakMap,xt=new WeakMap,vt=new WeakMap,Bt=new WeakMap,h(Ae,"NineTableVScrollBar");let mt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,R);d(this,D,new Map);d(this,I,null);d(this,U,null);d(this,et,0);d(this,wt,40);d(this,Re,!1);d(this,ct,!1);d(this,zt,3);q(this,"refresh",h(()=>{v.log("rowManager.refresh");const i=t(this,R).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop))},"refresh"));q(this,"initialize",h(()=>{v.log("rowManager.initialize"),y(this,I,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const o=t(this,R).querySelector(a);if(!o)return;const c=o.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,D).set(a,u)});const i=t(this,R).querySelector(".ng-container-body .ng-part-body"),e=t(this,R).querySelector(".ng-container-left .ng-part-body"),s=t(this,R).querySelector(".ng-container-right .ng-part-body"),n=t(this,R).querySelector(".ng-container-body .ng-part-header"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let a=!1;const o=h((c,l,f)=>{var u;a||(a=!0,i&&i.scrollTop!==c&&(i.scrollTop=c),e&&e.scrollTop!==c&&(e.scrollTop=c),s&&s.scrollTop!==c&&(s.scrollTop=c),n&&n.scrollLeft!==l&&(n.scrollLeft=l),r&&r.scrollLeft!==l&&(r.scrollLeft=l),t(this,ht).call(this,c),(u=t(this,R).querySelector("nine-table-vscrollbar"))==null||u.refresh(),a=!1)},"syncScroll");[i,e,s].forEach(c=>{c&&c.addEventListener("scroll",()=>{t(this,ct)||(y(this,ct,!0),requestAnimationFrame(()=>{o(c.scrollTop,c.scrollLeft),y(this,ct,!1)}))})})}},"initialize"));d(this,Dt,h((i,e)=>{v.log("rowManager.#renderRows");const s=t(this,D).get(e);if(!s||s.length===0)return;const n=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;n.querySelectorAll("tr:not(.nodata)").forEach(o=>o.remove());const r=n.querySelector("tr.nodata"),a=document.createDocumentFragment();for(let o=0;o<t(this,wt);o++)s.forEach(c=>{a.appendChild(c.cloneNode(!0))});r?r.before(a):n.appendChild(a)},"#renderRows"));d(this,Pt,h(i=>{if(v.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);v.log("#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)return 24;const s=i.querySelector("tbody.bindable-tbody");if(!s)return 24;s.querySelectorAll("tr:not(.nodata)").forEach(g=>g.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(g=>{r.appendChild(g.cloneNode(!0))}),n?n.before(r):s.appendChild(r);const a=t(this,R),o=a.style.display,c=a.style.visibility,l=a.style.position;(o==="none"||window.getComputedStyle(a).display==="none")&&(a.style.display="block",a.style.visibility="hidden",a.style.position="absolute");let f=0;const u=s.querySelectorAll("tr:not(.nodata)");return u.forEach(g=>{f+=g.offsetHeight||g.getBoundingClientRect().height}),u.forEach(g=>g.remove()),a.style.display=o,a.style.visibility=c,a.style.position=l,y(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,St,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const a=t(this,R).querySelector(r);if(!a)return;const o=a.querySelector(".ng-part-body .ng-virtual-spacer");o&&(o.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{if(t(this,et)>0&&t(this,I)>0){const i=Math.ceil(t(this,et)/t(this,I));y(this,wt,i+t(this,zt))}},"#updateRowCount"));d(this,jt,h(()=>{var o,c,l,f,u,g;const i=t(this,R).querySelector(".ng-container-left .ng-part-body table"),e=t(this,R).querySelector(".ng-container-body .ng-part-body table"),s=t(this,R).querySelector(".ng-container-right .ng-part-body table");if(e){const b=i?Array.from(i.querySelectorAll("tbody tr")):[],x=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],k=Math.max(b.length,x.length,w.length);for(let m=0;m<k;m++){const O=[((o=b[m])==null?void 0:o.getBoundingClientRect().height)||0,((c=x[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[m])==null?void 0:l.getBoundingClientRect().height)||0],M=Math.max(...O);M>0&&(b[m]&&(b[m].style.height=`${M}px`),x[m]&&(x[m].style.height=`${M}px`),w[m]&&(w[m].style.height=`${M}px`))}}const n=t(this,R).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer table"),a=t(this,R).querySelector(".ng-container-right .ng-part-footer table");if(r){const b=n?Array.from(n.querySelectorAll("tfoot tr")):[],x=Array.from(r.querySelectorAll("tfoot tr")),w=a?Array.from(a.querySelectorAll("tfoot tr")):[],k=Math.max(b.length,x.length,w.length);for(let m=0;m<k;m++){const O=[((f=b[m])==null?void 0:f.getBoundingClientRect().height)||0,((u=x[m])==null?void 0:u.getBoundingClientRect().height)||0,((g=w[m])==null?void 0:g.getBoundingClientRect().height)||0],M=Math.max(...O);M>0&&(b[m]&&(b[m].style.height=`${M}px`),x[m]&&(x[m].style.height=`${M}px`),w[m]&&(w[m].style.height=`${M}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(y(this,U,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const n=e.contentRect.height;if(n>0){let r=0;const a=s.querySelector(".ng-part-header"),o=s.querySelector(".ng-part-footer");a&&(r+=a.offsetHeight),o&&(r+=o.offsetHeight);const c=Math.max(n-r,100);t(this,et)!==c&&(y(this,et,c),t(this,Et).call(this),t(this,I)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,R)))},"#initResizeObserver"));d(this,At,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,R).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Dt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,qe,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,R).querySelector(e);if(!s)return;const n=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr:not(.nodata)")),a=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const g=i+Math.floor(u/a);if(g>=c){f.style.display="none";return}const b=t(this,j).data.get(g);f.style.display="",t(this,Rt).call(this,f,b,g)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var f;const e=t(this,I);if(!e||e<=0)return;const s=t(this,j).data.length,n=Math.max(0,Math.floor(i/e)),r=n*e,a=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,o=t(this,R).querySelector(".ng-container-body"),c=o==null?void 0:o.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"),l=c&&c.dataset.row!==void 0?parseInt(c.dataset.row,10):-1;[".ng-container-body .ng-part-body table",".ng-container-left .ng-part-body table",".ng-container-right .ng-part-body table"].forEach(u=>{u.style.transform=`translateY(${r}px)`}),v.log("#handleScroll",l,n),l!==n&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const g=t(this,R).querySelector(u);if(!g)return;const b=g.querySelector(".ng-part-body tbody.bindable-tbody");if(!b)return;Array.from(b.querySelectorAll("tr:not(.nodata)")).forEach((w,k)=>{const m=n+Math.floor(k/a);if(m>=s){w.style.display="none";return}const O=t(this,j).data.get(m);w.style.display="",t(this,Rt).call(this,w,O,m)})})},"#handleScroll"));d(this,Rt,h((i,e,s)=>{i.dataset.row=s,i.data=e,v.log(e,s),Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const a=Array.from(n.children).find(o=>o.tagName.toLowerCase().startsWith("cell-")||typeof o.refresh=="function");a&&typeof a.refresh=="function"&&a.refresh()})},"#bindRowData"));d(this,Vt,h(()=>{var c,l,f;v.log("rowManager.#syncHeaderHeights");const i=t(this,R).querySelector(".ng-container-left .ng-part-header table"),e=t(this,R).querySelector(".ng-container-body .ng-part-header table"),s=t(this,R).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const n=i?Array.from(i.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),a=s?Array.from(s.querySelectorAll("tr")):[],o=Math.max(n.length,r.length,a.length);for(let u=0;u<o;u++){const g=[((c=n[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=a[u])==null?void 0:f.getBoundingClientRect().height)||0],b=Math.max(...g);b>0&&(n[u]&&(n[u].style.height=`${b}px`),r[u]&&(r[u].style.height=`${b}px`),a[u]&&(a[u].style.height=`${b}px`))}},"#syncHeaderHeights"));q(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,R,i),t(this,Ft).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,R=new WeakMap,D=new WeakMap,I=new WeakMap,U=new WeakMap,et=new WeakMap,wt=new WeakMap,Re=new WeakMap,ct=new WeakMap,zt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,qe=new WeakMap,ht=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,h(ke,"RowManager");let ce=ke;const Yt=class Yt{static compileAll(i){return Array.isArray(i)?i.map(e=>Yt.compile(e)):[]}static compile(i){if(!i)return null;const e=h(o=>{o.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const g=l.getAttribute("data-bind"),b=l.getAttribute("data-expr"),x=l.getAttribute("maxbyte"),w=l.getAttribute("type");let k=[];g&&k.push(`data-bind="${g}"`),b&&k.push(`data-expr="${b}"`),x&&k.push(`maxbyte="${x}"`),w&&k.push(`type="${w}"`),l.innerHTML=`<${u} ${k.join(" ")}></${u}>`})},"processCellTypes"),s=h(o=>{if(!o.querySelector("colgroup")){const c=o.querySelector("tbody tr")||o.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(o.clientWidth/l),100);for(let g=0;g<l;g++){const b=document.createElement("col");b.setAttribute("width",u),f.appendChild(b)}o.prepend(f)}if(!o.querySelector("thead")){const c=document.createElement("thead"),l=o.querySelector("colgroup");l?l.after(c):o.prepend(c)}o.classList.add("nine-table-element"),o.style.display="table"},"ensureTableStructure"),n=h((o,c)=>{const l=Array.from(o.querySelectorAll(c+" tr")),f=Array.from(o.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let g=0;f.forEach(x=>{g+=x.colSpan||1});const b=Array.from(Array(u),()=>Array(g).fill(null));l.forEach(x=>{const w=x.sectionRowIndex;let k=0;Array.from(x.querySelectorAll("th,td")).forEach(m=>{for(let P=0;P<b[w].length;P++)if(b[w][P]===null){k=P;break}const O=m.rowSpan||1,M=m.colSpan||1;for(let P=0;P<O;P++)for(let _t=0;_t<M;_t++)w+P<u&&k+_t<g&&(b[w+P][k+_t]=P===0&&_t===0?"1":"0")})}),l.forEach(x=>{const w=x.sectionRowIndex;Array.from(x.querySelectorAll("th,td")).forEach(k=>{for(let m=0;m<b[w].length;m++)if(b[w][m]==="1"){k.dataset.col=m,b[w][m]="0";break}})})},"resetColIndex"),r=i.cloneNode(!0);return s(r),e(r),n(r,"thead"),n(r,"tbody"),n(r,"tfoot"),Array.from(r.querySelectorAll("colgroup col")).forEach((o,c)=>{const l=o.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};h(Yt,"TableCompiler");let he=Yt;const qt=class qt extends HTMLElement{constructor(){super();d(this,Ut);d(this,st,null);d(this,it);q(this,"invalidate",h(()=>{t(this,it).refresh()},"invalidate"));d(this,Xt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:n})=>{const r=this.querySelector(s);if(!r)return;r.innerHTML="";const a=document.createElement("div");a.className="ng-part-header",a.appendChild(t(this,dt).call(this,t(this,st),n,"header"));const o=document.createElement("div");o.className="ng-part-body";const c=document.createElement("div");c.className="ng-scroll-content",c.style.position="relative",c.style.width="100%",c.appendChild(t(this,dt).call(this,t(this,st),n,"body"));const l=document.createElement("div");l.className="ng-virtual-spacer",l.style.width="100%",l.style.pointerEvents="none",c.appendChild(l),o.appendChild(c);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,dt).call(this,t(this,st),n,"footer")),r.appendChild(a),r.appendChild(o),r.appendChild(f)})},"#renderSplitContainers"));d(this,Kt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),n=s==null?void 0:s.querySelectorAll("table");if(!s||!n||n.length===0)return;let r=0;n[0].querySelectorAll("col").forEach(a=>{const o=parseInt(a.getAttribute("width"),10);isNaN(r)||(r+=o)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${r}px`,s.style.width=`${r}px`)})},"#updateContainerWidths"));q(this,"generate",h(e=>{e&&(y(this,st,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this),t(this,it).initialize(),setTimeout(()=>{var s;(s=this.querySelector("nine-table-hscrollbar"))==null||s.refresh()},0))},"generate"));d(this,dt,h((e,s,n)=>{const r=e.cloneNode(!0),a=r.querySelector("thead"),o=r.querySelector("tbody"),c=r.querySelector("tfoot");if(n==="header"){if(o&&o.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(a&&a.remove(),c&&c.remove(),o&&(o.className="bindable-tbody")):n==="footer"&&(a&&a.remove(),o&&o.remove());return s==="left"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):r.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),r},"#createSplitTable"));q(this,"getRowHeight",h(()=>t(this,it).getRowHeight(),"getRowHeight"));q(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));q(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,h(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,h(()=>{const e=qt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=h(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,T,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,Bt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,lt=new WeakMap,tt=new WeakMap,T=new WeakMap,xt=new WeakMap,vt=new WeakMap,Bt=new WeakMap,h(Ae,"NineTableVScrollBar");let mt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,R);d(this,D,new Map);d(this,I,null);d(this,U,null);d(this,et,0);d(this,wt,40);d(this,Re,!1);d(this,ct,!1);d(this,zt,3);q(this,"refresh",h(()=>{v.log("rowManager.refresh");const i=t(this,R).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop))},"refresh"));q(this,"initialize",h(()=>{v.log("rowManager.initialize"),y(this,I,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const o=t(this,R).querySelector(a);if(!o)return;const c=o.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,D).set(a,u)});const i=t(this,R).querySelector(".ng-container-body .ng-part-body"),e=t(this,R).querySelector(".ng-container-left .ng-part-body"),s=t(this,R).querySelector(".ng-container-right .ng-part-body"),n=t(this,R).querySelector(".ng-container-body .ng-part-header"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let a=!1;const o=h((c,l,f)=>{var u;a||(a=!0,i&&i.scrollTop!==c&&(i.scrollTop=c),e&&e.scrollTop!==c&&(e.scrollTop=c),s&&s.scrollTop!==c&&(s.scrollTop=c),n&&n.scrollLeft!==l&&(n.scrollLeft=l),r&&r.scrollLeft!==l&&(r.scrollLeft=l),t(this,ht).call(this,c),(u=t(this,R).querySelector("nine-table-vscrollbar"))==null||u.refresh(),a=!1)},"syncScroll");[i,e,s].forEach(c=>{c&&c.addEventListener("scroll",()=>{t(this,ct)||(y(this,ct,!0),requestAnimationFrame(()=>{o(c.scrollTop,c.scrollLeft),y(this,ct,!1)}))})})}},"initialize"));d(this,Dt,h((i,e)=>{v.log("rowManager.#renderRows");const s=t(this,D).get(e);if(!s||s.length===0)return;const n=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;n.querySelectorAll("tr:not(.nodata)").forEach(o=>o.remove());const r=n.querySelector("tr.nodata"),a=document.createDocumentFragment();for(let o=0;o<t(this,wt);o++)s.forEach(c=>{a.appendChild(c.cloneNode(!0))});r?r.before(a):n.appendChild(a)},"#renderRows"));d(this,Pt,h(i=>{if(v.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);v.log("#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)return 24;const s=i.querySelector("tbody.bindable-tbody");if(!s)return 24;s.querySelectorAll("tr:not(.nodata)").forEach(g=>g.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(g=>{r.appendChild(g.cloneNode(!0))}),n?n.before(r):s.appendChild(r);const a=t(this,R),o=a.style.display,c=a.style.visibility,l=a.style.position;(o==="none"||window.getComputedStyle(a).display==="none")&&(a.style.display="block",a.style.visibility="hidden",a.style.position="absolute");let f=0;const u=s.querySelectorAll("tr:not(.nodata)");return u.forEach(g=>{f+=g.offsetHeight||g.getBoundingClientRect().height}),u.forEach(g=>g.remove()),a.style.display=o,a.style.visibility=c,a.style.position=l,y(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,St,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const a=t(this,R).querySelector(r);if(!a)return;const o=a.querySelector(".ng-part-body .ng-virtual-spacer");o&&(o.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{if(t(this,et)>0&&t(this,I)>0){const i=Math.ceil(t(this,et)/t(this,I));y(this,wt,i+t(this,zt))}},"#updateRowCount"));d(this,jt,h(()=>{var o,c,l,f,u,g;const i=t(this,R).querySelector(".ng-container-left .ng-part-body table"),e=t(this,R).querySelector(".ng-container-body .ng-part-body table"),s=t(this,R).querySelector(".ng-container-right .ng-part-body table");if(e){const b=i?Array.from(i.querySelectorAll("tbody tr")):[],x=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],k=Math.max(b.length,x.length,w.length);for(let m=0;m<k;m++){const O=[((o=b[m])==null?void 0:o.getBoundingClientRect().height)||0,((c=x[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[m])==null?void 0:l.getBoundingClientRect().height)||0],M=Math.max(...O);M>0&&(b[m]&&(b[m].style.height=`${M}px`),x[m]&&(x[m].style.height=`${M}px`),w[m]&&(w[m].style.height=`${M}px`))}}const n=t(this,R).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer table"),a=t(this,R).querySelector(".ng-container-right .ng-part-footer table");if(r){const b=n?Array.from(n.querySelectorAll("tfoot tr")):[],x=Array.from(r.querySelectorAll("tfoot tr")),w=a?Array.from(a.querySelectorAll("tfoot tr")):[],k=Math.max(b.length,x.length,w.length);for(let m=0;m<k;m++){const O=[((f=b[m])==null?void 0:f.getBoundingClientRect().height)||0,((u=x[m])==null?void 0:u.getBoundingClientRect().height)||0,((g=w[m])==null?void 0:g.getBoundingClientRect().height)||0],M=Math.max(...O);M>0&&(b[m]&&(b[m].style.height=`${M}px`),x[m]&&(x[m].style.height=`${M}px`),w[m]&&(w[m].style.height=`${M}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(y(this,U,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const n=e.contentRect.height;if(n>0){let r=0;const a=s.querySelector(".ng-part-header"),o=s.querySelector(".ng-part-footer");a&&(r+=a.offsetHeight),o&&(r+=o.offsetHeight);const c=Math.max(n-r,100);t(this,et)!==c&&(y(this,et,c),t(this,Et).call(this),t(this,I)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,R)))},"#initResizeObserver"));d(this,At,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,R).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Dt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,qe,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,R).querySelector(e);if(!s)return;const n=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr:not(.nodata)")),a=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const g=i+Math.floor(u/a);if(g>=c){f.style.display="none";return}const b=t(this,j).data.get(g);f.style.display="",t(this,Rt).call(this,f,b,g)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var f;const e=t(this,I);if(!e||e<=0)return;const s=t(this,j).data.length;v.log(s);const n=Math.max(0,Math.floor(i/e)),r=n*e,a=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,o=t(this,R).querySelector(".ng-container-body"),c=o==null?void 0:o.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"),l=c&&c.dataset.row!==void 0?parseInt(c.dataset.row,10):-1;[".ng-container-body .ng-part-body table",".ng-container-left .ng-part-body table",".ng-container-right .ng-part-body table"].forEach(u=>{u.style.transform=`translateY(${r}px)`}),v.log("#handleScroll",l,n),l!==n&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const g=t(this,R).querySelector(u);if(!g)return;const b=g.querySelector(".ng-part-body tbody.bindable-tbody");if(!b)return;Array.from(b.querySelectorAll("tr:not(.nodata)")).forEach((w,k)=>{const m=n+Math.floor(k/a);if(m>=s){w.style.display="none";return}const O=t(this,j).data.get(m);w.style.display="",t(this,Rt).call(this,w,O,m)})})},"#handleScroll"));d(this,Rt,h((i,e,s)=>{i.dataset.row=s,i.data=e,v.log(e,s),Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const a=Array.from(n.children).find(o=>o.tagName.toLowerCase().startsWith("cell-")||typeof o.refresh=="function");a&&typeof a.refresh=="function"&&a.refresh()})},"#bindRowData"));d(this,Vt,h(()=>{var c,l,f;v.log("rowManager.#syncHeaderHeights");const i=t(this,R).querySelector(".ng-container-left .ng-part-header table"),e=t(this,R).querySelector(".ng-container-body .ng-part-header table"),s=t(this,R).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const n=i?Array.from(i.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),a=s?Array.from(s.querySelectorAll("tr")):[],o=Math.max(n.length,r.length,a.length);for(let u=0;u<o;u++){const g=[((c=n[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=a[u])==null?void 0:f.getBoundingClientRect().height)||0],b=Math.max(...g);b>0&&(n[u]&&(n[u].style.height=`${b}px`),r[u]&&(r[u].style.height=`${b}px`),a[u]&&(a[u].style.height=`${b}px`))}},"#syncHeaderHeights"));q(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,R,i),t(this,Ft).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,R=new WeakMap,D=new WeakMap,I=new WeakMap,U=new WeakMap,et=new WeakMap,wt=new WeakMap,Re=new WeakMap,ct=new WeakMap,zt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,qe=new WeakMap,ht=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,h(ke,"RowManager");let ce=ke;const Yt=class Yt{static compileAll(i){return Array.isArray(i)?i.map(e=>Yt.compile(e)):[]}static compile(i){if(!i)return null;const e=h(o=>{o.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const g=l.getAttribute("data-bind"),b=l.getAttribute("data-expr"),x=l.getAttribute("maxbyte"),w=l.getAttribute("type");let k=[];g&&k.push(`data-bind="${g}"`),b&&k.push(`data-expr="${b}"`),x&&k.push(`maxbyte="${x}"`),w&&k.push(`type="${w}"`),l.innerHTML=`<${u} ${k.join(" ")}></${u}>`})},"processCellTypes"),s=h(o=>{if(!o.querySelector("colgroup")){const c=o.querySelector("tbody tr")||o.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(o.clientWidth/l),100);for(let g=0;g<l;g++){const b=document.createElement("col");b.setAttribute("width",u),f.appendChild(b)}o.prepend(f)}if(!o.querySelector("thead")){const c=document.createElement("thead"),l=o.querySelector("colgroup");l?l.after(c):o.prepend(c)}o.classList.add("nine-table-element"),o.style.display="table"},"ensureTableStructure"),n=h((o,c)=>{const l=Array.from(o.querySelectorAll(c+" tr")),f=Array.from(o.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let g=0;f.forEach(x=>{g+=x.colSpan||1});const b=Array.from(Array(u),()=>Array(g).fill(null));l.forEach(x=>{const w=x.sectionRowIndex;let k=0;Array.from(x.querySelectorAll("th,td")).forEach(m=>{for(let P=0;P<b[w].length;P++)if(b[w][P]===null){k=P;break}const O=m.rowSpan||1,M=m.colSpan||1;for(let P=0;P<O;P++)for(let _t=0;_t<M;_t++)w+P<u&&k+_t<g&&(b[w+P][k+_t]=P===0&&_t===0?"1":"0")})}),l.forEach(x=>{const w=x.sectionRowIndex;Array.from(x.querySelectorAll("th,td")).forEach(k=>{for(let m=0;m<b[w].length;m++)if(b[w][m]==="1"){k.dataset.col=m,b[w][m]="0";break}})})},"resetColIndex"),r=i.cloneNode(!0);return s(r),e(r),n(r,"thead"),n(r,"tbody"),n(r,"tfoot"),Array.from(r.querySelectorAll("colgroup col")).forEach((o,c)=>{const l=o.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};h(Yt,"TableCompiler");let he=Yt;const qt=class qt extends HTMLElement{constructor(){super();d(this,Ut);d(this,st,null);d(this,it);q(this,"invalidate",h(()=>{t(this,it).refresh()},"invalidate"));d(this,Xt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:n})=>{const r=this.querySelector(s);if(!r)return;r.innerHTML="";const a=document.createElement("div");a.className="ng-part-header",a.appendChild(t(this,dt).call(this,t(this,st),n,"header"));const o=document.createElement("div");o.className="ng-part-body";const c=document.createElement("div");c.className="ng-scroll-content",c.style.position="relative",c.style.width="100%",c.appendChild(t(this,dt).call(this,t(this,st),n,"body"));const l=document.createElement("div");l.className="ng-virtual-spacer",l.style.width="100%",l.style.pointerEvents="none",c.appendChild(l),o.appendChild(c);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,dt).call(this,t(this,st),n,"footer")),r.appendChild(a),r.appendChild(o),r.appendChild(f)})},"#renderSplitContainers"));d(this,Kt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),n=s==null?void 0:s.querySelectorAll("table");if(!s||!n||n.length===0)return;let r=0;n[0].querySelectorAll("col").forEach(a=>{const o=parseInt(a.getAttribute("width"),10);isNaN(r)||(r+=o)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${r}px`,s.style.width=`${r}px`)})},"#updateContainerWidths"));q(this,"generate",h(e=>{e&&(y(this,st,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this),t(this,it).initialize(),setTimeout(()=>{var s;(s=this.querySelector("nine-table-hscrollbar"))==null||s.refresh()},0))},"generate"));d(this,dt,h((e,s,n)=>{const r=e.cloneNode(!0),a=r.querySelector("thead"),o=r.querySelector("tbody"),c=r.querySelector("tfoot");if(n==="header"){if(o&&o.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(a&&a.remove(),c&&c.remove(),o&&(o.className="bindable-tbody")):n==="footer"&&(a&&a.remove(),o&&o.remove());return s==="left"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):r.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),r},"#createSplitTable"));q(this,"getRowHeight",h(()=>t(this,it).getRowHeight(),"getRowHeight"));q(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));q(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,h(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,h(()=>{const e=qt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;