@ninebone/table 0.0.662 → 0.0.664
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.
package/dist/nine-table.umd.js
CHANGED
|
@@ -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,C,{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,C=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=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,A);d(this,et);d(this,P,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);R(this,"refresh",h(()=>{var e;x.log("rowManager.refresh");const i=t(this,A).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",h(()=>{x.log("rowManager.initialize"),y(this,et,{scrollTables:t(this,A).querySelectorAll(".ng-part-body table"),firstTr:t(this,A).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,A).querySelector(o);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const g=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(o,g)});const i=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),n=t(this,A).querySelector(".ng-container-body .ng-part-header"),r=t(this,A).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 o=!1;const a=h(c=>{if(o)return;o=!0;const l=c.scrollTop,f=c.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(c=>{c&&c.addEventListener("scroll",()=>{a(c)},{passive:!0})})}},"initialize"));d(this,Dt,h((i,e)=>{x.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(a=>a.remove());const r=n.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(c=>{o.appendChild(c.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,h(i=>{if(x.log("rowManager.#measureAndCacheHeight"),t(this,_)!==null&&t(this,_)>0)return t(this,_);x.log("#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=i.querySelector("tbody.bindable-tbody");if(x.log(s),!s)throw new Error("invalid dom");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 o=t(this,A),a=o.style.display,c=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 g=s.querySelectorAll("tr");if(g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const v=window.getComputedStyle(b);u=parseFloat(v.height)||parseFloat(v.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0)throw new Error("invalid dom");return y(this,_,f),t(this,Et).call(this),t(this,_)},"#measureAndCacheHeight"));d(this,St,h(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),n=e*s;x.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:n}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,A).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{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,h(()=>{var a,c,l,f,g,b;const i=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const u=i?Array.from(i.querySelectorAll("tbody tr")):[],v=Array.from(e.querySelectorAll("tbody tr")),q=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(u.length,v.length,q.length);for(let m=0;m<T;m++){const O=[((a=u[m])==null?void 0:a.getBoundingClientRect().height)||0,((c=v[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=q[m])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(u[m]&&(u[m].style.height=`${k}px`),v[m]&&(v[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}const n=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(r){const u=n?Array.from(n.querySelectorAll("tfoot tr")):[],v=Array.from(r.querySelectorAll("tfoot tr")),q=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(u.length,v.length,q.length);for(let m=0;m<T;m++){const O=[((f=u[m])==null?void 0:f.getBoundingClientRect().height)||0,((g=v[m])==null?void 0:g.getBoundingClientRect().height)||0,((b=q[m])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(u[m]&&(u[m].style.height=`${k}px`),v[m]&&(v[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,A)||!(t(this,A)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 c=Math.max(n-r,100);t(this,st)!==c&&(y(this,st,c),t(this,Et).call(this),t(this,_)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,A)))},"#initResizeObserver"));d(this,At,h(()=>{x.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,A).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,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).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,P).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;r.forEach((f,g)=>{const b=i+Math.floor(g/o);if(b>=c){f.style.visibility="hidden";return}const u=t(this,j).data.get(b);f.style.display="",t(this,qt).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var g,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const n=((g=t(this,P).get(".ng-container-body"))==null?void 0:g.length)||1,r=t(this,A).querySelector(".ng-container-body .ng-part-body"),o=Math.max(0,s-Math.floor(r.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(i/e)));let c=Math.floor(a*e);a===o&&(c=i-e),x.log(`📜 [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,et).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,et))==null||b.scrollTables.forEach(u=>{u.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const v=t(this,A).querySelector(u);if(!v)return;const q=v.querySelector(".ng-part-body tbody.bindable-tbody");if(!q)return;Array.from(q.querySelectorAll("tr:not(.nodata)")).forEach((m,O)=>{const k=a+Math.floor(O/n);if(k>=s){m.style.display="none";return}const B=t(this,j).data.get(k);m.style.display="",t(this,qt).call(this,m,B,k)})})},"#handleScroll"));d(this,qt,h((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,h(()=>{var c,l,f;x.log("rowManager.#syncHeaderHeights");const i=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).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 g=0;g<a;g++){const b=[((c=n[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=r[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(n[g]&&(n[g].style.height=`${u}px`),r[g]&&(r[g].style.height=`${u}px`),o[g]&&(o[g].style.height=`${u}px`))}},"#syncHeaderHeights"));R(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,A,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,A=new WeakMap,et=new WeakMap,P=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,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,Te=new WeakMap,ht=new WeakMap,qt=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(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 g=`cell-${f}`;const b=l.getAttribute("data-bind"),u=l.getAttribute("data-expr"),v=l.getAttribute("maxbyte"),q=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),u&&T.push(`data-expr="${u}"`),v&&T.push(`maxbyte="${v}"`),q&&T.push(`type="${q}"`),l.innerHTML=`<${g} ${T.join(" ")}></${g}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),g=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const u=document.createElement("col");u.setAttribute("width",g),f.appendChild(u)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),n=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),g=l.length;if(g===0||f.length===0)return;let b=0;f.forEach(v=>{b+=v.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(v=>{const q=v.sectionRowIndex;let T=0;Array.from(v.querySelectorAll("th,td")).forEach(m=>{for(let B=0;B<u[q].length;B++)if(u[q][B]===null){T=B;break}const O=m.rowSpan||1,k=m.colSpan||1;for(let B=0;B<O;B++)for(let _t=0;_t<k;_t++)q+B<g&&T+_t<b&&(u[q+B][T+_t]=B===0&&_t===0?"1":"0")})}),l.forEach(v=>{const q=v.sectionRowIndex;Array.from(v.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<u[q].length;m++)if(u[q][m]==="1"){T.dataset.col=m,u[q][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((a,c)=>{const l=a.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 Rt=class Rt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,nt);R(this,"invalidate",h(()=>{t(this,nt).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})=>{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,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(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"));R(this,"generate",h(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,h((e,s,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),c=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),c&&c.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"));R(this,"getRowHeight",h(()=>t(this,nt).getRowHeight(),"getRowHeight"));R(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));R(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=Rt.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,C,{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,C=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=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,A);d(this,et);d(this,P,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);R(this,"refresh",h(()=>{var e;x.log("rowManager.refresh");const i=t(this,A).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",h(()=>{x.log("rowManager.initialize"),y(this,et,{scrollTables:t(this,A).querySelectorAll(".ng-part-body table"),firstTr:t(this,A).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,A).querySelector(o);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const g=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(o,g)});const i=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),n=t(this,A).querySelector(".ng-container-body .ng-part-header"),r=t(this,A).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 o=!1;const a=h(c=>{if(o)return;o=!0;const l=c.scrollTop,f=c.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(c=>{c&&c.addEventListener("scroll",()=>{a(c)},{passive:!0})})}},"initialize"));d(this,Dt,h((i,e)=>{x.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(a=>a.remove());const r=n.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(c=>{o.appendChild(c.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,h(i=>{if(x.log("rowManager.#measureAndCacheHeight"),t(this,_)!==null&&t(this,_)>0)return t(this,_);x.log("#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=i.querySelector("tbody.bindable-tbody");if(x.log(s),!s)throw new Error("invalid dom");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 o=t(this,A),a=o.style.display,c=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 g=s.querySelectorAll("tr");if(g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const v=window.getComputedStyle(b);u=parseFloat(v.height)||parseFloat(v.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0)throw new Error("invalid dom");return y(this,_,f),t(this,Et).call(this),t(this,_)},"#measureAndCacheHeight"));d(this,St,h(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),n=e*s;x.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:n}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,A).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{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,h(()=>{var a,c,l,f,g,b;const i=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const u=i?Array.from(i.querySelectorAll("tbody tr")):[],v=Array.from(e.querySelectorAll("tbody tr")),q=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(u.length,v.length,q.length);for(let m=0;m<T;m++){const O=[((a=u[m])==null?void 0:a.getBoundingClientRect().height)||0,((c=v[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=q[m])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(u[m]&&(u[m].style.height=`${k}px`),v[m]&&(v[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}const n=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(r){const u=n?Array.from(n.querySelectorAll("tfoot tr")):[],v=Array.from(r.querySelectorAll("tfoot tr")),q=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(u.length,v.length,q.length);for(let m=0;m<T;m++){const O=[((f=u[m])==null?void 0:f.getBoundingClientRect().height)||0,((g=v[m])==null?void 0:g.getBoundingClientRect().height)||0,((b=q[m])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(u[m]&&(u[m].style.height=`${k}px`),v[m]&&(v[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,A)||!(t(this,A)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 c=Math.max(n-r,100);t(this,st)!==c&&(y(this,st,c),t(this,Et).call(this),t(this,_)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,A)))},"#initResizeObserver"));d(this,At,h(()=>{x.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,A).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,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).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,P).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;r.forEach((f,g)=>{const b=i+Math.floor(g/o);if(b>=c){f.style.visibility="hidden";return}const u=t(this,j).data.get(b);f.style.display="",t(this,qt).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var g,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const n=((g=t(this,P).get(".ng-container-body"))==null?void 0:g.length)||1,r=t(this,A).querySelector(".ng-container-body .ng-part-body"),o=Math.max(0,s-Math.floor(r.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(i/e)));let c=Math.floor(a*e);a===o&&(c=i),x.log(`📜 [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,et).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,et))==null||b.scrollTables.forEach(u=>{u.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const v=t(this,A).querySelector(u);if(!v)return;const q=v.querySelector(".ng-part-body tbody.bindable-tbody");if(!q)return;Array.from(q.querySelectorAll("tr:not(.nodata)")).forEach((m,O)=>{const k=a+Math.floor(O/n);if(k>=s){m.style.display="none";return}const B=t(this,j).data.get(k);m.style.display="",t(this,qt).call(this,m,B,k)})})},"#handleScroll"));d(this,qt,h((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,h(()=>{var c,l,f;x.log("rowManager.#syncHeaderHeights");const i=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).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 g=0;g<a;g++){const b=[((c=n[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=r[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(n[g]&&(n[g].style.height=`${u}px`),r[g]&&(r[g].style.height=`${u}px`),o[g]&&(o[g].style.height=`${u}px`))}},"#syncHeaderHeights"));R(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,A,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,A=new WeakMap,et=new WeakMap,P=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,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,Te=new WeakMap,ht=new WeakMap,qt=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(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 g=`cell-${f}`;const b=l.getAttribute("data-bind"),u=l.getAttribute("data-expr"),v=l.getAttribute("maxbyte"),q=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),u&&T.push(`data-expr="${u}"`),v&&T.push(`maxbyte="${v}"`),q&&T.push(`type="${q}"`),l.innerHTML=`<${g} ${T.join(" ")}></${g}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),g=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const u=document.createElement("col");u.setAttribute("width",g),f.appendChild(u)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),n=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),g=l.length;if(g===0||f.length===0)return;let b=0;f.forEach(v=>{b+=v.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(v=>{const q=v.sectionRowIndex;let T=0;Array.from(v.querySelectorAll("th,td")).forEach(m=>{for(let B=0;B<u[q].length;B++)if(u[q][B]===null){T=B;break}const O=m.rowSpan||1,k=m.colSpan||1;for(let B=0;B<O;B++)for(let _t=0;_t<k;_t++)q+B<g&&T+_t<b&&(u[q+B][T+_t]=B===0&&_t===0?"1":"0")})}),l.forEach(v=>{const q=v.sectionRowIndex;Array.from(v.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<u[q].length;m++)if(u[q][m]==="1"){T.dataset.col=m,u[q][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((a,c)=>{const l=a.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 Rt=class Rt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,nt);R(this,"invalidate",h(()=>{t(this,nt).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})=>{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,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(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"));R(this,"generate",h(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,h((e,s,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),c=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),c&&c.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"));R(this,"getRowHeight",h(()=>t(this,nt).getRowHeight(),"getRowHeight"));R(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));R(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=Rt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
127
127
|
<style>
|
|
128
128
|
nine-table-sheet {
|
|
129
129
|
display: none;
|