@ninebone/table 0.0.550 → 0.0.551

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