@ninebone/table 0.0.615 → 0.0.616

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=c(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,k,{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,zt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,tt=new WeakMap,k=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=new WeakMap,c(Ee,"NineTableVScrollBar");let mt=Ee;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,q);d(this,et);d(this,D,new Map);d(this,_,null);d(this,U,null);d(this,st,0);d(this,wt,40);d(this,qe,!1);d(this,Re,!1);d(this,Bt,3);T(this,"refresh",c(()=>{var e;A.log("rowManager.refresh");const i=t(this,q).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,q).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",c(()=>{A.log("rowManager.initialize"),y(this,et,{scrollTables:t(this,q).querySelectorAll(".ng-part-body table"),firstTr:t(this,q).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,q).querySelector(o);if(!a)return;const h=a.querySelector(".ng-part-body table");if(!h)return;const l=h.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,D).set(o,u)});const i=t(this,q).querySelector(".ng-container-body .ng-part-body"),e=t(this,q).querySelector(".ng-container-left .ng-part-body"),s=t(this,q).querySelector(".ng-container-right .ng-part-body"),n=t(this,q).querySelector(".ng-container-body .ng-part-header"),r=t(this,q).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,Et).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=c(h=>{if(o)return;o=!0;const l=h.scrollTop,f=h.scrollLeft;i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),n&&n.scrollLeft!==f&&(n.scrollLeft=f),r&&r.scrollLeft!==f&&(r.scrollLeft=f),t(this,ht).call(this,l),o=!1},"handleContainerScroll");[i,e,s].forEach(h=>{h&&h.addEventListener("scroll",()=>{a(h)},{passive:!0})})}},"initialize"));d(this,Dt,c((i,e)=>{A.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(a=>a.remove());const r=n.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(h=>{o.appendChild(h.cloneNode(!0))});r?r.before(o):n.appendChild(o),e===".ng-container-body"&&(t(this,et).firstTr=n.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Pt,c(i=>{if(A.log("rowManager.#measureAndCacheHeight"),t(this,_)!==null&&t(this,_)>0)return t(this,_);A.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 o=t(this,q),a=o.style.display,h=o.style.visibility,l=o.style.position;(a==="none"||window.getComputedStyle(o).display==="none")&&(o.style.display="block",o.style.visibility="hidden",o.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()),o.style.display=a,o.style.visibility=h,o.style.position=l,y(this,_,f>0?f:24),t(this,At).call(this),t(this,_)},"#measureAndCacheHeight"));d(this,St,c(()=>{A.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,q).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,At,c(()=>{if(t(this,st)>0&&t(this,_)>0){const i=Math.ceil(t(this,st)/t(this,_));y(this,wt,i+t(this,Bt))}},"#updateRowCount"));d(this,jt,c(()=>{var a,h,l,f,u,g;const i=t(this,q).querySelector(".ng-container-left .ng-part-body table"),e=t(this,q).querySelector(".ng-container-body .ng-part-body table"),s=t(this,q).querySelector(".ng-container-right .ng-part-body table");if(e){const b=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],R=Math.max(b.length,m.length,w.length);for(let v=0;v<R;v++){const W=[((a=b[v])==null?void 0:a.getBoundingClientRect().height)||0,((h=m[v])==null?void 0:h.getBoundingClientRect().height)||0,((l=w[v])==null?void 0:l.getBoundingClientRect().height)||0],H=Math.max(...W);H>0&&(b[v]&&(b[v].style.height=`${H}px`),m[v]&&(m[v].style.height=`${H}px`),w[v]&&(w[v].style.height=`${H}px`))}}const n=t(this,q).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,q).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,q).querySelector(".ng-container-right .ng-part-footer table");if(r){const b=n?Array.from(n.querySelectorAll("tfoot tr")):[],m=Array.from(r.querySelectorAll("tfoot tr")),w=o?Array.from(o.querySelectorAll("tfoot tr")):[],R=Math.max(b.length,m.length,w.length);for(let v=0;v<R;v++){const W=[((f=b[v])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[v])==null?void 0:u.getBoundingClientRect().height)||0,((g=w[v])==null?void 0:g.getBoundingClientRect().height)||0],H=Math.max(...W);H>0&&(b[v]&&(b[v].style.height=`${H}px`),m[v]&&(m[v].style.height=`${H}px`),w[v]&&(w[v].style.height=`${H}px`))}}},"#syncRowHeights"));d(this,Ft,c(()=>{!t(this,q)||!(t(this,q)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 o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(r+=o.offsetHeight),a&&(r+=a.offsetHeight);const h=Math.max(n-r,100);t(this,st)!==h&&(y(this,st,h),t(this,At).call(this),t(this,_)!==null&&(t(this,Et).call(this),this.refresh()))}}})),t(this,U).observe(t(this,q)))},"#initResizeObserver"));d(this,Et,c(()=>{A.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,q).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,Te,c(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,q).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)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,h=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const g=i+Math.floor(u/o);if(g>=h){f.style.display="none";return}const b=t(this,j).data.get(g);f.style.display="",t(this,qt).call(this,f,b,g)})})},"#adjustBufferRows"));d(this,ht,c(i=>{var f,u;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const n=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,r=Math.max(0,s-1),o=Math.min(r,Math.max(0,Math.floor(i/e))),a=Math.floor(o*e),h=t(this,et).firstTr,l=h&&h.dataset.row!==void 0?parseInt(h.dataset.row,10):-1;(u=t(this,et))==null||u.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${a}px, 0)`}),l!==o&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const b=t(this,q).querySelector(g);if(!b)return;const m=b.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((R,v)=>{const W=o+Math.floor(v/n);if(W>=s){R.style.display="none";return}const H=t(this,j).data.get(W);R.style.display="",t(this,qt).call(this,R,H,W)})})},"#handleScroll"));d(this,qt,c((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const o=Array.from(n.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Vt,c(()=>{var h,l,f;A.log("rowManager.#syncHeaderHeights");const i=t(this,q).querySelector(".ng-container-left .ng-part-header table"),e=t(this,q).querySelector(".ng-container-body .ng-part-header table"),s=t(this,q).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")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(n.length,r.length,o.length);for(let u=0;u<a;u++){const g=[((h=n[u])==null?void 0:h.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[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`),o[u]&&(o[u].style.height=`${b}px`))}},"#syncHeaderHeights"));T(this,"destroy",c(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,q,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,q=new WeakMap,et=new WeakMap,D=new WeakMap,_=new WeakMap,U=new WeakMap,st=new WeakMap,wt=new WeakMap,qe=new WeakMap,Re=new WeakMap,Bt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,At=new WeakMap,jt=new WeakMap,Ft=new WeakMap,Et=new WeakMap,Te=new WeakMap,ht=new WeakMap,qt=new WeakMap,Vt=new WeakMap,c(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=c(a=>{a.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"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let R=[];g&&R.push(`data-bind="${g}"`),b&&R.push(`data-expr="${b}"`),m&&R.push(`maxbyte="${m}"`),w&&R.push(`type="${w}"`),l.innerHTML=`<${u} ${R.join(" ")}></${u}>`})},"processCellTypes"),s=c(a=>{if(!a.querySelector("colgroup")){const h=a.querySelector("tbody tr")||a.querySelector("tr"),l=h?h.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let g=0;g<l;g++){const b=document.createElement("col");b.setAttribute("width",u),f.appendChild(b)}a.prepend(f)}if(!a.querySelector("thead")){const h=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(h):a.prepend(h)}a.classList.add("nine-table-element")},"ensureTableStructure"),n=c((a,h)=>{const l=Array.from(a.querySelectorAll(h+" tr")),f=Array.from(a.querySelectorAll(h+" th,"+h+" td")),u=l.length;if(u===0||f.length===0)return;let g=0;f.forEach(m=>{g+=m.colSpan||1});const b=Array.from(Array(u),()=>Array(g).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let R=0;Array.from(m.querySelectorAll("th,td")).forEach(v=>{for(let P=0;P<b[w].length;P++)if(b[w][P]===null){R=P;break}const W=v.rowSpan||1,H=v.colSpan||1;for(let P=0;P<W;P++)for(let _t=0;_t<H;_t++)w+P<u&&R+_t<g&&(b[w+P][R+_t]=P===0&&_t===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(R=>{for(let v=0;v<b[w].length;v++)if(b[w][v]==="1"){R.dataset.col=v,b[w][v]="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((a,h)=>{const l=a.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};c(Yt,"TableCompiler");let he=Yt;const Rt=class Rt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,nt);T(this,"invalidate",c(()=>{t(this,nt).refresh()},"invalidate"));d(this,Xt,c(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:n})=>{var r,o,a;(r=this.querySelector(`${s} .ng-part-header`))==null||r.appendChild(t(this,dt).call(this,t(this,it),n,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,dt).call(this,t(this,it),n,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,dt).call(this,t(this,it),n,"footer"))})},"#renderSplitContainers"));d(this,Kt,c(()=>{["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(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(r)||(r+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${r}px`,s.style.width=`${r}px`)})},"#updateContainerWidths"));T(this,"generate",c(e=>{if(!e)return;y(this,it,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),n=this.querySelector(".ng-container-body .ng-part-footer"),r=this.querySelector(".ng-nodata-overlay");s&&r&&(r.style.top=`${s.offsetHeight}px`),n&&r&&(r.style.bottom=`${n.offsetHeight}px`),t(this,nt).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,dt,c((e,s,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),h=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),h&&h.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),h&&h.remove(),a&&(a.className="bindable-tbody")):n==="footer"&&(o&&o.remove(),a&&a.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"));T(this,"getRowHeight",c(()=>t(this,nt).getRowHeight(),"getRowHeight"));T(this,"scrollToX",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,c(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,c(()=>{const e=Rt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=c(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,k,{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,zt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,tt=new WeakMap,k=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=new WeakMap,c(Ee,"NineTableVScrollBar");let mt=Ee;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,q);d(this,et);d(this,D,new Map);d(this,_,null);d(this,U,null);d(this,st,0);d(this,wt,40);d(this,qe,!1);d(this,Re,!1);d(this,Bt,3);T(this,"refresh",c(()=>{var e;A.log("rowManager.refresh");const i=t(this,q).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,q).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",c(()=>{A.log("rowManager.initialize"),y(this,et,{scrollTables:t(this,q).querySelectorAll(".ng-part-body table"),firstTr:t(this,q).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,q).querySelector(o);if(!a)return;const h=a.querySelector(".ng-part-body table");if(!h)return;const l=h.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,D).set(o,u)});const i=t(this,q).querySelector(".ng-container-body .ng-part-body"),e=t(this,q).querySelector(".ng-container-left .ng-part-body"),s=t(this,q).querySelector(".ng-container-right .ng-part-body"),n=t(this,q).querySelector(".ng-container-body .ng-part-header"),r=t(this,q).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,Et).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=c(h=>{if(o)return;o=!0;const l=h.scrollTop,f=h.scrollLeft;i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),n&&n.scrollLeft!==f&&(n.scrollLeft=f),r&&r.scrollLeft!==f&&(r.scrollLeft=f),t(this,ht).call(this,l),o=!1},"handleContainerScroll");[i,e,s].forEach(h=>{h&&h.addEventListener("scroll",()=>{a(h)},{passive:!0})})}},"initialize"));d(this,Dt,c((i,e)=>{A.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(a=>a.remove());const r=n.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(h=>{o.appendChild(h.cloneNode(!0))});r?r.before(o):n.appendChild(o),e===".ng-container-body"&&(t(this,et).firstTr=n.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Pt,c(i=>{if(A.log("rowManager.#measureAndCacheHeight"),t(this,_)!==null&&t(this,_)>0)return t(this,_);A.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 o=t(this,q),a=o.style.display,h=o.style.visibility,l=o.style.position;(a==="none"||window.getComputedStyle(o).display==="none")&&(o.style.display="block",o.style.visibility="hidden",o.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()),o.style.display=a,o.style.visibility=h,o.style.position=l,y(this,_,f>0?f:24),t(this,At).call(this),t(this,_)},"#measureAndCacheHeight"));d(this,St,c(()=>{A.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,q).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,At,c(()=>{if(t(this,st)>0&&t(this,_)>0){const i=Math.ceil(t(this,st)/t(this,_));y(this,wt,i+t(this,Bt))}},"#updateRowCount"));d(this,jt,c(()=>{var a,h,l,f,u,g;const i=t(this,q).querySelector(".ng-container-left .ng-part-body table"),e=t(this,q).querySelector(".ng-container-body .ng-part-body table"),s=t(this,q).querySelector(".ng-container-right .ng-part-body table");if(e){const b=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],R=Math.max(b.length,m.length,w.length);for(let v=0;v<R;v++){const W=[((a=b[v])==null?void 0:a.getBoundingClientRect().height)||0,((h=m[v])==null?void 0:h.getBoundingClientRect().height)||0,((l=w[v])==null?void 0:l.getBoundingClientRect().height)||0],H=Math.max(...W);H>0&&(b[v]&&(b[v].style.height=`${H}px`),m[v]&&(m[v].style.height=`${H}px`),w[v]&&(w[v].style.height=`${H}px`))}}const n=t(this,q).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,q).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,q).querySelector(".ng-container-right .ng-part-footer table");if(r){const b=n?Array.from(n.querySelectorAll("tfoot tr")):[],m=Array.from(r.querySelectorAll("tfoot tr")),w=o?Array.from(o.querySelectorAll("tfoot tr")):[],R=Math.max(b.length,m.length,w.length);for(let v=0;v<R;v++){const W=[((f=b[v])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[v])==null?void 0:u.getBoundingClientRect().height)||0,((g=w[v])==null?void 0:g.getBoundingClientRect().height)||0],H=Math.max(...W);H>0&&(b[v]&&(b[v].style.height=`${H}px`),m[v]&&(m[v].style.height=`${H}px`),w[v]&&(w[v].style.height=`${H}px`))}}},"#syncRowHeights"));d(this,Ft,c(()=>{!t(this,q)||!(t(this,q)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 o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(r+=o.offsetHeight),a&&(r+=a.offsetHeight);const h=Math.max(n-r,100);t(this,st)!==h&&(y(this,st,h),t(this,At).call(this),t(this,_)!==null&&(t(this,Et).call(this),this.refresh()))}}})),t(this,U).observe(t(this,q)))},"#initResizeObserver"));d(this,Et,c(()=>{A.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,q).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,Te,c(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,q).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)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,h=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const g=i+Math.floor(u/o);if(g>=h){f.style.visibility="hidden";return}const b=t(this,j).data.get(g);f.style.display="",t(this,qt).call(this,f,b,g)})})},"#adjustBufferRows"));d(this,ht,c(i=>{var f,u;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const n=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,r=Math.max(0,s-1),o=Math.min(r,Math.max(0,Math.floor(i/e))),a=Math.floor(o*e),h=t(this,et).firstTr,l=h&&h.dataset.row!==void 0?parseInt(h.dataset.row,10):-1;(u=t(this,et))==null||u.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${a}px, 0)`}),l!==o&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const b=t(this,q).querySelector(g);if(!b)return;const m=b.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((R,v)=>{const W=o+Math.floor(v/n);if(W>=s){R.style.display="none";return}const H=t(this,j).data.get(W);R.style.display="",t(this,qt).call(this,R,H,W)})})},"#handleScroll"));d(this,qt,c((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const o=Array.from(n.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Vt,c(()=>{var h,l,f;A.log("rowManager.#syncHeaderHeights");const i=t(this,q).querySelector(".ng-container-left .ng-part-header table"),e=t(this,q).querySelector(".ng-container-body .ng-part-header table"),s=t(this,q).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")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(n.length,r.length,o.length);for(let u=0;u<a;u++){const g=[((h=n[u])==null?void 0:h.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[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`),o[u]&&(o[u].style.height=`${b}px`))}},"#syncHeaderHeights"));T(this,"destroy",c(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,q,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,q=new WeakMap,et=new WeakMap,D=new WeakMap,_=new WeakMap,U=new WeakMap,st=new WeakMap,wt=new WeakMap,qe=new WeakMap,Re=new WeakMap,Bt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,At=new WeakMap,jt=new WeakMap,Ft=new WeakMap,Et=new WeakMap,Te=new WeakMap,ht=new WeakMap,qt=new WeakMap,Vt=new WeakMap,c(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=c(a=>{a.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"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let R=[];g&&R.push(`data-bind="${g}"`),b&&R.push(`data-expr="${b}"`),m&&R.push(`maxbyte="${m}"`),w&&R.push(`type="${w}"`),l.innerHTML=`<${u} ${R.join(" ")}></${u}>`})},"processCellTypes"),s=c(a=>{if(!a.querySelector("colgroup")){const h=a.querySelector("tbody tr")||a.querySelector("tr"),l=h?h.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let g=0;g<l;g++){const b=document.createElement("col");b.setAttribute("width",u),f.appendChild(b)}a.prepend(f)}if(!a.querySelector("thead")){const h=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(h):a.prepend(h)}a.classList.add("nine-table-element")},"ensureTableStructure"),n=c((a,h)=>{const l=Array.from(a.querySelectorAll(h+" tr")),f=Array.from(a.querySelectorAll(h+" th,"+h+" td")),u=l.length;if(u===0||f.length===0)return;let g=0;f.forEach(m=>{g+=m.colSpan||1});const b=Array.from(Array(u),()=>Array(g).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let R=0;Array.from(m.querySelectorAll("th,td")).forEach(v=>{for(let P=0;P<b[w].length;P++)if(b[w][P]===null){R=P;break}const W=v.rowSpan||1,H=v.colSpan||1;for(let P=0;P<W;P++)for(let _t=0;_t<H;_t++)w+P<u&&R+_t<g&&(b[w+P][R+_t]=P===0&&_t===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(R=>{for(let v=0;v<b[w].length;v++)if(b[w][v]==="1"){R.dataset.col=v,b[w][v]="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((a,h)=>{const l=a.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};c(Yt,"TableCompiler");let he=Yt;const Rt=class Rt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,nt);T(this,"invalidate",c(()=>{t(this,nt).refresh()},"invalidate"));d(this,Xt,c(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:n})=>{var r,o,a;(r=this.querySelector(`${s} .ng-part-header`))==null||r.appendChild(t(this,dt).call(this,t(this,it),n,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,dt).call(this,t(this,it),n,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,dt).call(this,t(this,it),n,"footer"))})},"#renderSplitContainers"));d(this,Kt,c(()=>{["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(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(r)||(r+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${r}px`,s.style.width=`${r}px`)})},"#updateContainerWidths"));T(this,"generate",c(e=>{if(!e)return;y(this,it,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),n=this.querySelector(".ng-container-body .ng-part-footer"),r=this.querySelector(".ng-nodata-overlay");s&&r&&(r.style.top=`${s.offsetHeight}px`),n&&r&&(r.style.bottom=`${n.offsetHeight}px`),t(this,nt).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,dt,c((e,s,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),h=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),h&&h.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),h&&h.remove(),a&&(a.className="bindable-tbody")):n==="footer"&&(o&&o.remove(),a&&a.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"));T(this,"getRowHeight",c(()=>t(this,nt).getRowHeight(),"getRowHeight"));T(this,"scrollToX",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,c(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,c(()=>{const e=Rt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;