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