@ninebone/table 0.0.697 → 0.0.698

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.
@@ -1,4 +1,4 @@
1
- (function(E,S){typeof exports=="object"&&typeof module<"u"?S(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.NineboneUtil))})(this,function(E){"use strict";var es=Object.defineProperty;var ss=E=>{throw TypeError(E)};var os=(E,S,v)=>S in E?es(E,S,{enumerable:!0,configurable:!0,writable:!0,value:v}):E[S]=v;var h=(E,S)=>es(E,"name",{value:S,configurable:!0});var q=(E,S,v)=>os(E,typeof S!="symbol"?S+"":S,v),Ze=(E,S,v)=>S.has(E)||ss("Cannot "+v);var t=(E,S,v)=>(Ze(E,S,"read from private field"),v?v.call(E):S.get(E)),d=(E,S,v)=>S.has(E)?ss("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(E):S.set(E,v),p=(E,S,v,V)=>(Ze(E,S,"write to private field"),V?V.call(E,v):S.set(E,v),v),Ge=(E,S,v)=>(Ze(E,S,"access private method"),v);var ns=(E,S,v,V)=>({set _(wt){p(E,S,wt,v)},get _(){return t(E,S,V)}});var P,Y,R,G,J,Q,Dt,tt,jt,et,st,dt,C,St,Et,Ft,j,A,nt,D,N,U,rt,At,Le,He,Vt,Yt,Rt,qt,Tt,Ut,Xt,kt,Me,ft,Ct,Kt,F,Lt,ut,rs,is,Gt,it,ot,Ht,Jt,Qt,gt,te,ee,se,It,I,ne,$t,re,_t,bt,z,L,W,pt,ie,X,oe,at,Nt,ae,le,yt,lt,mt,M,zt,ce,ct,he,de,H,Ot,y,Pe,De,je,Fe,Ve,Bt,ht,xt,vt,fe,K,Xe;const Te=class Te extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Te,"Trace");let S=Te;const v=new S,ke=class ke extends HTMLElement{constructor(){super();d(this,P);d(this,Y,!1);d(this,R);d(this,G);d(this,J);d(this,Q);d(this,Dt,h(()=>{if(!t(this,P))return;const e=t(this,P).querySelector(".ng-container-body .ng-part-body");e&&(p(this,Q,new ResizeObserver(()=>{this.refresh()})),t(this,Q).observe(e))},"#observeResize"));q(this,"refresh",h(()=>{if(!t(this,P)||!t(this,R)||t(this,Y))return;const e=t(this,R).container,s=e.querySelector("table");if(!s)return;const r=t(this,R).track,i=t(this,R).thumb,o=t(this,P).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);i.style.width=`${f}px`;const g=e.scrollLeft,b=c-a;let u=0;b>0&&(u=parseInt(g/b*(l-f),10)),u<0&&(u=0);const m=l-f;u>m&&(u=m),i.style.left=`${u}px`,t(this,R).left.disabled=u===0,t(this,R).right.disabled=u>=m-1},"refresh"));d(this,tt,h(e=>{if(!t(this,R))return!1;const s=t(this,R).container,r=s.querySelector("table");if(!r)return!1;const i=t(this,R).track.getBoundingClientRect(),o=t(this,R).thumb.clientWidth;let a=e;a<0&&(a=0);const c=i.width-o;a>c&&(a=c),a=parseInt(a,10),t(this,R).thumb.style.left=`${a}px`,t(this,R).left.disabled=a===0,t(this,R).right.disabled=a>=c-1;const l=s.clientWidth,g=r.scrollWidth-l;return c>0&&g>0&&(s.scrollLeft=a/c*g),a>0&&a<c-1},"#thumbMoveTo"));d(this,jt,h(()=>{const e=h(r=>{clearInterval(t(this,G)),clearInterval(t(this,J));const i=parseInt(t(this,R).thumb.style.left||0,10);t(this,tt).call(this,i+r),p(this,G,setInterval(()=>{clearInterval(t(this,G)),p(this,J,setInterval(()=>{const o=parseInt(t(this,R).thumb.style.left||0,10);t(this,tt).call(this,o+r)||clearInterval(t(this,J))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,G)),clearInterval(t(this,J))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,R).left.addEventListener(r,s),t(this,R).right.addEventListener(r,s),t(this,R).track.addEventListener(r,s)}),t(this,R).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,R).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,R).left.addEventListener("touchstart",()=>e(-20)),t(this,R).right.addEventListener("touchstart",()=>e(20)),t(this,R).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const i=t(this,R).track.getBoundingClientRect(),o=t(this,R).thumb.clientWidth;t(this,tt).call(this,r.clientX-i.left-o/2)}),t(this,R).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,Y,!0),this.shiftX=r.clientX-t(this,R).thumb.getBoundingClientRect().left;const i=h(a=>{if(!t(this,Y))return;const c=t(this,R).track.getBoundingClientRect();t(this,tt).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{p(this,Y,!1),s(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(p(this,P,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,P))return;this.innerHTML=`
1
+ (function(E,S){typeof exports=="object"&&typeof module<"u"?S(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.NineboneUtil))})(this,function(E){"use strict";var es=Object.defineProperty;var ss=E=>{throw TypeError(E)};var os=(E,S,v)=>S in E?es(E,S,{enumerable:!0,configurable:!0,writable:!0,value:v}):E[S]=v;var h=(E,S)=>es(E,"name",{value:S,configurable:!0});var q=(E,S,v)=>os(E,typeof S!="symbol"?S+"":S,v),Ze=(E,S,v)=>S.has(E)||ss("Cannot "+v);var t=(E,S,v)=>(Ze(E,S,"read from private field"),v?v.call(E):S.get(E)),d=(E,S,v)=>S.has(E)?ss("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(E):S.set(E,v),p=(E,S,v,F)=>(Ze(E,S,"write to private field"),F?F.call(E,v):S.set(E,v),v),Ge=(E,S,v)=>(Ze(E,S,"access private method"),v);var ns=(E,S,v,F)=>({set _(wt){p(E,S,wt,v)},get _(){return t(E,S,F)}});var P,V,R,G,J,Q,Dt,tt,jt,et,st,dt,C,St,Et,Ft,j,A,nt,D,N,Y,rt,At,Le,He,Vt,Yt,Rt,qt,Tt,Ut,Xt,kt,Me,ft,Ct,Kt,U,Lt,ut,rs,is,Gt,it,ot,Ht,Jt,Qt,gt,te,ee,se,It,I,ne,$t,re,_t,bt,z,L,W,pt,ie,X,oe,at,Nt,ae,le,yt,lt,mt,M,zt,ce,ct,he,de,H,Ot,y,Pe,De,je,Fe,Ve,Bt,ht,xt,vt,fe,K,Xe;const Te=class Te extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Te,"Trace");let S=Te;const v=new S,ke=class ke extends HTMLElement{constructor(){super();d(this,P);d(this,V,!1);d(this,R);d(this,G);d(this,J);d(this,Q);d(this,Dt,h(()=>{if(!t(this,P))return;const e=t(this,P).querySelector(".ng-container-body .ng-part-body");e&&(p(this,Q,new ResizeObserver(()=>{this.refresh()})),t(this,Q).observe(e))},"#observeResize"));q(this,"refresh",h(()=>{if(!t(this,P)||!t(this,R)||t(this,V))return;const e=t(this,R).container,s=e.querySelector("table");if(!s)return;const r=t(this,R).track,i=t(this,R).thumb,o=t(this,P).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);i.style.width=`${f}px`;const g=e.scrollLeft,b=c-a;let u=0;b>0&&(u=parseInt(g/b*(l-f),10)),u<0&&(u=0);const m=l-f;u>m&&(u=m),i.style.left=`${u}px`,t(this,R).left.disabled=u===0,t(this,R).right.disabled=u>=m-1},"refresh"));d(this,tt,h(e=>{if(!t(this,R))return!1;const s=t(this,R).container,r=s.querySelector("table");if(!r)return!1;const i=t(this,R).track.getBoundingClientRect(),o=t(this,R).thumb.clientWidth;let a=e;a<0&&(a=0);const c=i.width-o;a>c&&(a=c),a=parseInt(a,10),t(this,R).thumb.style.left=`${a}px`,t(this,R).left.disabled=a===0,t(this,R).right.disabled=a>=c-1;const l=s.clientWidth,g=r.scrollWidth-l;return c>0&&g>0&&(s.scrollLeft=a/c*g),a>0&&a<c-1},"#thumbMoveTo"));d(this,jt,h(()=>{const e=h(r=>{clearInterval(t(this,G)),clearInterval(t(this,J));const i=parseInt(t(this,R).thumb.style.left||0,10);t(this,tt).call(this,i+r),p(this,G,setInterval(()=>{clearInterval(t(this,G)),p(this,J,setInterval(()=>{const o=parseInt(t(this,R).thumb.style.left||0,10);t(this,tt).call(this,o+r)||clearInterval(t(this,J))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,G)),clearInterval(t(this,J))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,R).left.addEventListener(r,s),t(this,R).right.addEventListener(r,s),t(this,R).track.addEventListener(r,s)}),t(this,R).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,R).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,R).left.addEventListener("touchstart",()=>e(-20)),t(this,R).right.addEventListener("touchstart",()=>e(20)),t(this,R).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const i=t(this,R).track.getBoundingClientRect(),o=t(this,R).thumb.clientWidth;t(this,tt).call(this,r.clientX-i.left-o/2)}),t(this,R).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,V,!0),this.shiftX=r.clientX-t(this,R).thumb.getBoundingClientRect().left;const i=h(a=>{if(!t(this,V))return;const c=t(this,R).track.getBoundingClientRect();t(this,tt).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{p(this,V,!1),s(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(p(this,P,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,P))return;this.innerHTML=`
2
2
  <style>
3
3
  nine-table-hscrollbar {
4
4
  display: flex;
@@ -60,7 +60,7 @@
60
60
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
61
61
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
62
62
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
63
- `;const e=h(()=>{const s=t(this,P).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,R,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),s.addEventListener("scroll",()=>{t(this,Y)||this.refresh()}),t(this,jt).call(this),t(this,Dt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,Q)&&t(this,Q).disconnect()}};P=new WeakMap,Y=new WeakMap,R=new WeakMap,G=new WeakMap,J=new WeakMap,Q=new WeakMap,Dt=new WeakMap,tt=new WeakMap,jt=new WeakMap,h(ke,"NineTableHScrollBar");let V=ke;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",V);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,et);d(this,st);d(this,dt,!1);d(this,C);d(this,St,0);d(this,Et,0);q(this,"refresh",h(()=>{if(v.log("vscrollbar.refresh"),!t(this,et)||!t(this,C))return;const e=t(this,C).container,s=t(this,C).track,r=t(this,C).thumb,i=e.clientHeight,o=t(this,et).data.length,a=t(this,st).getRowHeight(),c=o*a;if(c<=i||o===0){this.style.display="none";return}else this.style.display="flex";const l=s.clientHeight;if(l<=0)return;const f=Math.max(Math.min(l*(i/c),l),20);r.style.height=`${f}px`;const g=e.scrollTop,b=Math.max(c-i,1);v.log(e,g,b);let u=0;b>0&&(u=g/b*(l-f));const m=l-f;u<0&&(u=0),u>m&&(u=m),r.style.top=`${u}px`,t(this,C).top.disabled=g<=0,t(this,C).bottom.disabled=g>=b-1},"refresh"));d(this,Ft,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,C).container,s=h(()=>{const i=(t(this,et).data.get()||[]).length,o=t(this,st).getRowHeight();return i*o},"getContentHeight");t(this,C).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,dt,!0),p(this,St,r.clientY),p(this,Et,e.scrollTop);const i=h(a=>{if(!t(this,dt))return;const c=t(this,C).track.getBoundingClientRect(),l=t(this,C).thumb.clientHeight,g=c.height-l,b=a.clientY-t(this,St),u=e.clientHeight,m=s(),w=Math.max(m-u,1);if(g>0&&w>0){const T=b/g*w;let x=t(this,Et)+T;const _=Math.max(0,m-u);x<0&&(x=0),x>_&&(x=_),e.scrollTop=x}this.refresh()},"onMouseMove"),o=h(()=>{p(this,dt,!1),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)}),t(this,C).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,C).thumb)return;const i=t(this,C).track.getBoundingClientRect(),o=t(this,C).thumb.clientHeight,a=r.clientY-i.top-o/2,l=i.height-o,f=e.clientHeight,g=s(),b=Math.max(g-f,1);if(l>0&&b>0){const u=Math.max(0,Math.min(1,a/l));e.scrollTop=u*b}this.refresh()}),t(this,C).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,C).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,et,this.getRootNode().host),p(this,st,this.closest("nine-table-sheet")),this.innerHTML=`
63
+ `;const e=h(()=>{const s=t(this,P).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,R,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),s.addEventListener("scroll",()=>{t(this,V)||this.refresh()}),t(this,jt).call(this),t(this,Dt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,Q)&&t(this,Q).disconnect()}};P=new WeakMap,V=new WeakMap,R=new WeakMap,G=new WeakMap,J=new WeakMap,Q=new WeakMap,Dt=new WeakMap,tt=new WeakMap,jt=new WeakMap,h(ke,"NineTableHScrollBar");let F=ke;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,et);d(this,st);d(this,dt,!1);d(this,C);d(this,St,0);d(this,Et,0);q(this,"refresh",h(()=>{if(v.log("vscrollbar.refresh"),!t(this,et)||!t(this,C))return;const e=t(this,C).container,s=t(this,C).track,r=t(this,C).thumb,i=e.clientHeight,o=t(this,et).data.length,a=t(this,st).getRowHeight(),c=o*a;if(c<=i||o===0){this.style.display="none";return}else this.style.display="flex";const l=s.clientHeight;if(l<=0)return;const f=Math.max(Math.min(l*(i/c),l),20);r.style.height=`${f}px`;const g=e.scrollTop,b=Math.max(c-i,1);v.log(e,g,b);let u=0;b>0&&(u=g/b*(l-f));const m=l-f;u<0&&(u=0),u>m&&(u=m),r.style.top=`${u}px`,t(this,C).top.disabled=g<=0,t(this,C).bottom.disabled=g>=b-1},"refresh"));d(this,Ft,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,C).container,s=h(()=>{const i=(t(this,et).data.get()||[]).length,o=t(this,st).getRowHeight();return i*o},"getContentHeight");t(this,C).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,dt,!0),p(this,St,r.clientY),p(this,Et,e.scrollTop);const i=h(a=>{if(!t(this,dt))return;const c=t(this,C).track.getBoundingClientRect(),l=t(this,C).thumb.clientHeight,g=c.height-l,b=a.clientY-t(this,St),u=e.clientHeight,m=s(),w=Math.max(m-u,1);if(g>0&&w>0){const T=b/g*w;let x=t(this,Et)+T;const _=Math.max(0,m-u);x<0&&(x=0),x>_&&(x=_),e.scrollTop=x}this.refresh()},"onMouseMove"),o=h(()=>{p(this,dt,!1),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)}),t(this,C).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,C).thumb)return;const i=t(this,C).track.getBoundingClientRect(),o=t(this,C).thumb.clientHeight,a=r.clientY-i.top-o/2,l=i.height-o,f=e.clientHeight,g=s(),b=Math.max(g-f,1);if(l>0&&b>0){const u=Math.max(0,Math.min(1,a/l));e.scrollTop=u*b}this.refresh()}),t(this,C).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,C).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,et,this.getRootNode().host),p(this,st,this.closest("nine-table-sheet")),this.innerHTML=`
64
64
  <style>
65
65
  nine-table-vscrollbar {
66
66
  display: flex;
@@ -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,st).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(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,Ft).call(this),this.refresh()},"initWhenReady");e()}};et=new WeakMap,st=new WeakMap,dt=new WeakMap,C=new WeakMap,St=new WeakMap,Et=new WeakMap,Ft=new WeakMap,h(Ce,"NineTableVScrollBar");let wt=Ce;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",wt);const Ie=class Ie{constructor(n){d(this,j);d(this,A);d(this,nt);d(this,D,new Map);d(this,N,null);d(this,U,null);d(this,rt,0);d(this,At,40);d(this,Le,!1);d(this,He,!1);d(this,Vt,3);q(this,"refresh",h(()=>{var e;v.log("rowManager.refresh");const n=t(this,A).querySelector(".ng-container-body .ng-part-body");n&&(t(this,Rt).call(this),t(this,qt).call(this),t(this,ft).call(this,n.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));q(this,"initialize",h(()=>{v.log("rowManager.initialize"),p(this,nt,{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)")}),p(this,N,null),t(this,D).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,D).set(o,g)});const n=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"),r=t(this,A).querySelector(".ng-container-body .ng-part-header"),i=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,Rt).call(this),t(this,kt).call(this),t(this,qt).call(this),t(this,ft).call(this,n.scrollTop);let o=!1;const a=h(c=>{var g;if(o)return;o=!0;const l=c.scrollTop,f=c.scrollLeft;n&&n.scrollTop!==l&&(n.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),i&&i.scrollLeft!==f&&(i.scrollLeft=f),t(this,ft).call(this,l),(g=t(this,A).querySelector("nine-table-vscrollbar"))==null||g.refresh(),o=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Yt,h((n,e)=>{v.log("rowManager.#renderRows");const s=t(this,D).get(e);if(!s||s.length===0)return;const r=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const i=r.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,At);a++)s.forEach(c=>{o.appendChild(c.cloneNode(!0))});i?i.before(o):r.appendChild(o),e===".ng-container-body"&&(t(this,nt).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Rt,h(()=>{if(t(this,N)!==null&&t(this,N)>0)return t(this,N);const n=t(this,A).querySelector(".ng-container-body .ng-part-body");v.log("rowManager.#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(v.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),i=document.createDocumentFragment();e.forEach(b=>{i.appendChild(b.cloneNode(!0))}),r?r.before(i):s.appendChild(i);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");return g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const m=window.getComputedStyle(b);u=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0?-1:(p(this,N,f),t(this,Tt).call(this),t(this,N))},"#measureAndCacheHeight"));d(this,qt,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,N),r=e*s;v.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const o=t(this,A).querySelector(i);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,Tt,h(()=>{if(t(this,rt)>0&&t(this,N)>0){const n=Math.ceil(t(this,rt)/t(this,N));p(this,At,n+t(this,Vt))}},"#updateRowCount"));d(this,Ut,h(()=>{var a,c,l,f,g,b;const n=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=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(u.length,m.length,w.length);for(let x=0;x<T;x++){const _=[((a=u[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[x])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(..._);k>0&&(u[x]&&(u[x].style.height=`${k}px`),m[x]&&(m[x].style.height=`${k}px`),w[x]&&(w[x].style.height=`${k}px`))}}const r=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),i=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(i){const u=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(i.querySelectorAll("tfoot tr")),w=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(u.length,m.length,w.length);for(let x=0;x<T;x++){const _=[((f=u[x])==null?void 0:f.getBoundingClientRect().height)||0,((g=m[x])==null?void 0:g.getBoundingClientRect().height)||0,((b=w[x])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(..._);k>0&&(u[x]&&(u[x].style.height=`${k}px`),m[x]&&(m[x].style.height=`${k}px`),w[x]&&(w[x].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Xt,h(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,U,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let i=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(i+=o.offsetHeight),a&&(i+=a.offsetHeight);const c=Math.max(r-i,100);t(this,rt)!==c&&(p(this,rt,c),t(this,Tt).call(this),t(this,N)!==null&&(t(this,kt).call(this),this.refresh()))}}})),t(this,U).observe(t(this,A)))},"#initResizeObserver"));d(this,kt,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,A).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Yt).call(this,e,n)}),t(this,Kt).call(this),t(this,Ut).call(this)},"#renderAllContainers"));d(this,Me,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const i=Array.from(r.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;i.forEach((f,g)=>{const b=n+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,Ct).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,ft,h(n=>{var g,b;const e=t(this,N);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((g=t(this,D).get(".ng-container-body"))==null?void 0:g.length)||1,i=t(this,A).querySelector(".ng-container-body .ng-part-body");v.log("bodyContainer.clientHeight",i.clientHeight);const o=Math.max(0,s-Math.floor(i.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);v.log(`📜 [Scroll Calc] maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`),a===o&&v.log(`📜 [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,nt).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,nt))==null||b.scrollTables.forEach(u=>{u.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(v.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const m=t(this,A).querySelector(u);if(!m)return;const w=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!w)return;Array.from(w.querySelectorAll("tr:not(.nodata)")).forEach((x,_)=>{const k=a+Math.floor(_/r);if(k>=s){x.style.display="none";return}const O=t(this,j).data.get(k);x.style.display="",t(this,Ct).call(this,x,O,k)})}))},"#handleScroll"));d(this,Ct,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,i)=>{r.dataset.row=s;const o=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Kt,h(()=>{var c,l,f;v.log("rowManager.#syncHeaderHeights");const n=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 r=n?Array.from(n.querySelectorAll("tr")):[],i=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,i.length,o.length);for(let g=0;g<a;g++){const b=[((c=r[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=i[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(r[g]&&(r[g].style.height=`${u}px`),i[g]&&(i[g].style.height=`${u}px`),o[g]&&(o[g].style.height=`${u}px`))}},"#syncHeaderHeights"));q(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),p(this,U,null))},"destroy"));p(this,j,n.getRootNode().host),p(this,A,n),t(this,Xt).call(this)}getRowHeight(){return t(this,N)}templateLength(n=".ng-container-body"){var e;return((e=t(this,D).get(n))==null?void 0:e.length)||1}};j=new WeakMap,A=new WeakMap,nt=new WeakMap,D=new WeakMap,N=new WeakMap,U=new WeakMap,rt=new WeakMap,At=new WeakMap,Le=new WeakMap,He=new WeakMap,Vt=new WeakMap,Yt=new WeakMap,Rt=new WeakMap,qt=new WeakMap,Tt=new WeakMap,Ut=new WeakMap,Xt=new WeakMap,kt=new WeakMap,Me=new WeakMap,ft=new WeakMap,Ct=new WeakMap,Kt=new WeakMap,h(Ie,"RowManager");let ue=Ie;const Zt=class Zt{static compileAll(n){return Array.isArray(n)?n.map(e=>Zt.compile(e)):[]}static compile(n){if(!n)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"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),u&&T.push(`data-expr="${u}"`),m&&T.push(`maxbyte="${m}"`),w&&T.push(`type="${w}"`),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"),r=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(m=>{b+=m.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let T=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let O=0;O<u[w].length;O++)if(u[w][O]===null){T=O;break}const _=x.rowSpan||1,k=x.colSpan||1;for(let O=0;O<_;O++)for(let Z=0;Z<k;Z++)w+O<g&&T+Z<b&&(u[w+O][T+Z]=O===0&&Z===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(T=>{for(let x=0;x<u[w].length;x++)if(u[w][x]==="1"){T.dataset.col=x,u[w][x]="0";break}})})},"resetColIndex"),i=n.cloneNode(!0);return s(i),e(i),r(i,"thead"),r(i,"tbody"),r(i,"tfoot"),Array.from(i.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&i.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),i}};h(Zt,"TableCompiler");let ge=Zt;const $e=class $e{constructor(n){d(this,ut);d(this,F);d(this,Lt,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});q(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,Lt);t(this,F).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body").forEach(o=>{o.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(a=>{a.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")}),!(n<0)&&o.querySelectorAll("tbody tr").forEach(a=>{const c=parseInt(a.dataset.row,10);isNaN(c)||a.querySelectorAll("td, th").forEach(l=>{const f=parseInt(l.dataset.col,10);if(isNaN(f))return;const g=parseInt(l.rowSpan||1,10),b=parseInt(l.colSpan||1,10),u=c+g-1,m=f+b-1;c<=s&&u>=n&&f<=r&&m>=e&&(l.classList.add("selected"),c===n&&l.classList.add("selected-top"),u===s&&l.classList.add("selected-bottom"),f===e&&l.classList.add("selected-left"),m===r&&l.classList.add("selected-right"))})})})},"render"));p(this,F,n),Ge(this,ut,is).call(this)}setRange(n,e,s,r){let i=Math.min(n,s),o=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);const l=Ge(this,ut,rs).call(this,i,a,o,c);p(this,Lt,l),this.render()}};F=new WeakMap,Lt=new WeakMap,ut=new WeakSet,rs=h(function(n,e,s,r){let i=n,o=e,a=s,c=r,l=!0;const f=t(this,F).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");for(;l;)l=!1,f.forEach(g=>{g.querySelectorAll("tbody tr").forEach(b=>{const u=parseInt(b.dataset.row,10);isNaN(u)||b.querySelectorAll("td, th").forEach(m=>{const w=parseInt(m.dataset.col,10);if(isNaN(w))return;const T=parseInt(m.rowSpan||1,10),x=parseInt(m.colSpan||1,10),_=u+T-1,k=w+x-1;if(u<=a&&_>=i&&w<=c&&k>=o){const Z=Math.min(i,u),Je=Math.max(a,_),Qe=Math.min(o,w),ts=Math.max(c,k);(Z!==i||Je!==a||Qe!==o||ts!==c)&&(i=Z,a=Je,o=Qe,c=ts,l=!0)}})})});return{startRow:i,startCol:o,endRow:a,endCol:c}},"#expandRangeByMerge"),is=h(function(){const n=this.selector?t(this,F).querySelector(".ng-container-top"):t(this,F).querySelector(".ng-container-top");n&&n.addEventListener("mousedown",e=>{const s=e.target.closest("td, th");if(!s||s.dataset.row===void 0||s.dataset.col===void 0||s.closest("tr").classList.contains("nodata"))return;const r=parseInt(s.dataset.row,10),i=parseInt(s.dataset.col,10);this.setRange(r,i,r,i);const o=h(c=>{const l=document.elementFromPoint(c.clientX,c.clientY),f=l==null?void 0:l.closest("td, th");if(!f||!t(this,F).contains(f)||f.dataset.row===void 0||f.dataset.col===void 0||f.closest("tr").classList.contains("nodata"))return;const g=parseInt(f.dataset.row,10),b=parseInt(f.dataset.col,10);this.setRange(r,i,g,b)},"onMouseMove"),a=h(()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})},"#initEvents"),h($e,"CellSelection");let be=$e;const Mt=class Mt extends HTMLElement{constructor(){super();d(this,Gt);d(this,it,null);d(this,ot);d(this,Ht);q(this,"invalidate",h(()=>{v.log("sheet.invalidate()"),t(this,ot).refresh()},"invalidate"));q(this,"generate",h(e=>{if(v.log("sheet.generate()"),!e)return;p(this,it,ge.compile(e)),t(this,Jt).call(this),t(this,Qt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),i=this.querySelector(".ng-nodata-overlay");s&&i&&(i.style.top=`${s.offsetHeight}px`),r&&i&&(i.style.bottom=`${r.offsetHeight}px`),t(this,ot).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,Jt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var i,o,a;(i=this.querySelector(`${s} .ng-part-header`))==null||i.appendChild(t(this,gt).call(this,t(this,it),r,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,gt).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,gt).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,Qt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let i=0;r[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(i)||(i+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${i}px`,s.style.width=`${i}px`)})},"#updateContainerWidths"));d(this,gt,h((e,s,r)=>{const i=e.cloneNode(!0),o=i.querySelector("thead"),a=i.querySelector("tbody"),c=i.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",i.appendChild(f)}}else r==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(o&&o.remove(),a&&a.remove());return s==="left"?i.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?i.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):i.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),i},"#createSplitTable"));q(this,"getRowHeight",h(()=>t(this,ot).getRowHeight(),"getRowHeight"));q(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));q(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,te,h(()=>{t(this,ee).call(this),p(this,Ht,new be(this))},"#init"));d(this,ee,h(()=>{const e=Mt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=h(()=>{const s=t(this,st).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(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,Ft).call(this),this.refresh()},"initWhenReady");e()}};et=new WeakMap,st=new WeakMap,dt=new WeakMap,C=new WeakMap,St=new WeakMap,Et=new WeakMap,Ft=new WeakMap,h(Ce,"NineTableVScrollBar");let wt=Ce;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",wt);const Ie=class Ie{constructor(n){d(this,j);d(this,A);d(this,nt);d(this,D,new Map);d(this,N,null);d(this,Y,null);d(this,rt,0);d(this,At,40);d(this,Le,!1);d(this,He,!1);d(this,Vt,3);q(this,"refresh",h(()=>{var e;v.log("rowManager.refresh");const n=t(this,A).querySelector(".ng-container-body .ng-part-body");n&&(t(this,Rt).call(this),t(this,qt).call(this),t(this,ft).call(this,n.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));q(this,"initialize",h(()=>{v.log("rowManager.initialize"),p(this,nt,{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)")}),p(this,N,null),t(this,D).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,D).set(o,g)});const n=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"),r=t(this,A).querySelector(".ng-container-body .ng-part-header"),i=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,Rt).call(this),t(this,kt).call(this),t(this,qt).call(this),t(this,ft).call(this,n.scrollTop);let o=!1;const a=h(c=>{var g;if(o)return;o=!0;const l=c.scrollTop,f=c.scrollLeft;n&&n.scrollTop!==l&&(n.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),i&&i.scrollLeft!==f&&(i.scrollLeft=f),t(this,ft).call(this,l),(g=t(this,A).querySelector("nine-table-vscrollbar"))==null||g.refresh(),o=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Yt,h((n,e)=>{v.log("rowManager.#renderRows");const s=t(this,D).get(e);if(!s||s.length===0)return;const r=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const i=r.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,At);a++)s.forEach(c=>{o.appendChild(c.cloneNode(!0))});i?i.before(o):r.appendChild(o),e===".ng-container-body"&&(t(this,nt).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Rt,h(()=>{if(t(this,N)!==null&&t(this,N)>0)return t(this,N);const n=t(this,A).querySelector(".ng-container-body .ng-part-body");v.log("rowManager.#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(v.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),i=document.createDocumentFragment();e.forEach(b=>{i.appendChild(b.cloneNode(!0))}),r?r.before(i):s.appendChild(i);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");return g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const m=window.getComputedStyle(b);u=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0?-1:(p(this,N,f),t(this,Tt).call(this),t(this,N))},"#measureAndCacheHeight"));d(this,qt,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,N),r=e*s;v.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const o=t(this,A).querySelector(i);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,Tt,h(()=>{if(t(this,rt)>0&&t(this,N)>0){const n=Math.ceil(t(this,rt)/t(this,N));p(this,At,n+t(this,Vt))}},"#updateRowCount"));d(this,Ut,h(()=>{var a,c,l,f,g,b;const n=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=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(u.length,m.length,w.length);for(let x=0;x<T;x++){const _=[((a=u[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[x])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(..._);k>0&&(u[x]&&(u[x].style.height=`${k}px`),m[x]&&(m[x].style.height=`${k}px`),w[x]&&(w[x].style.height=`${k}px`))}}const r=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),i=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(i){const u=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(i.querySelectorAll("tfoot tr")),w=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(u.length,m.length,w.length);for(let x=0;x<T;x++){const _=[((f=u[x])==null?void 0:f.getBoundingClientRect().height)||0,((g=m[x])==null?void 0:g.getBoundingClientRect().height)||0,((b=w[x])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(..._);k>0&&(u[x]&&(u[x].style.height=`${k}px`),m[x]&&(m[x].style.height=`${k}px`),w[x]&&(w[x].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Xt,h(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,Y,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let i=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(i+=o.offsetHeight),a&&(i+=a.offsetHeight);const c=Math.max(r-i,100);t(this,rt)!==c&&(p(this,rt,c),t(this,Tt).call(this),t(this,N)!==null&&(t(this,kt).call(this),this.refresh()))}}})),t(this,Y).observe(t(this,A)))},"#initResizeObserver"));d(this,kt,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,A).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Yt).call(this,e,n)}),t(this,Kt).call(this),t(this,Ut).call(this)},"#renderAllContainers"));d(this,Me,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const i=Array.from(r.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;i.forEach((f,g)=>{const b=n+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,Ct).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,ft,h(n=>{var g,b;const e=t(this,N);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((g=t(this,D).get(".ng-container-body"))==null?void 0:g.length)||1,i=t(this,A).querySelector(".ng-container-body .ng-part-body");v.log("bodyContainer.clientHeight",i.clientHeight);const o=Math.max(0,s-Math.floor(i.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);v.log(`📜 [Scroll Calc] maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`),a===o&&v.log(`📜 [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,nt).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,nt))==null||b.scrollTables.forEach(u=>{u.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(v.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const m=t(this,A).querySelector(u);if(!m)return;const w=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!w)return;Array.from(w.querySelectorAll("tr:not(.nodata)")).forEach((x,_)=>{const k=a+Math.floor(_/r);if(k>=s){x.style.display="none";return}const O=t(this,j).data.get(k);x.style.display="",t(this,Ct).call(this,x,O,k)})}))},"#handleScroll"));d(this,Ct,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,i)=>{r.dataset.row=s;const o=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Kt,h(()=>{var c,l,f;v.log("rowManager.#syncHeaderHeights");const n=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 r=n?Array.from(n.querySelectorAll("tr")):[],i=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,i.length,o.length);for(let g=0;g<a;g++){const b=[((c=r[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=i[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(r[g]&&(r[g].style.height=`${u}px`),i[g]&&(i[g].style.height=`${u}px`),o[g]&&(o[g].style.height=`${u}px`))}},"#syncHeaderHeights"));q(this,"destroy",h(()=>{t(this,Y)&&(t(this,Y).disconnect(),p(this,Y,null))},"destroy"));p(this,j,n.getRootNode().host),p(this,A,n),t(this,Xt).call(this)}getRowHeight(){return t(this,N)}templateLength(n=".ng-container-body"){var e;return((e=t(this,D).get(n))==null?void 0:e.length)||1}};j=new WeakMap,A=new WeakMap,nt=new WeakMap,D=new WeakMap,N=new WeakMap,Y=new WeakMap,rt=new WeakMap,At=new WeakMap,Le=new WeakMap,He=new WeakMap,Vt=new WeakMap,Yt=new WeakMap,Rt=new WeakMap,qt=new WeakMap,Tt=new WeakMap,Ut=new WeakMap,Xt=new WeakMap,kt=new WeakMap,Me=new WeakMap,ft=new WeakMap,Ct=new WeakMap,Kt=new WeakMap,h(Ie,"RowManager");let ue=Ie;const Zt=class Zt{static compileAll(n){return Array.isArray(n)?n.map(e=>Zt.compile(e)):[]}static compile(n){if(!n)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"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),u&&T.push(`data-expr="${u}"`),m&&T.push(`maxbyte="${m}"`),w&&T.push(`type="${w}"`),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"),r=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(m=>{b+=m.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let T=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let O=0;O<u[w].length;O++)if(u[w][O]===null){T=O;break}const _=x.rowSpan||1,k=x.colSpan||1;for(let O=0;O<_;O++)for(let Z=0;Z<k;Z++)w+O<g&&T+Z<b&&(u[w+O][T+Z]=O===0&&Z===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(T=>{for(let x=0;x<u[w].length;x++)if(u[w][x]==="1"){T.dataset.col=x,u[w][x]="0";break}})})},"resetColIndex"),i=n.cloneNode(!0);return s(i),e(i),r(i,"thead"),r(i,"tbody"),r(i,"tfoot"),Array.from(i.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&i.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),i}};h(Zt,"TableCompiler");let ge=Zt;const $e=class $e{constructor(n){d(this,ut);d(this,U);d(this,Lt,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});q(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,Lt);t(this,U).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body").forEach(o=>{o.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(a=>{a.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")}),!(n<0)&&o.querySelectorAll("tbody tr").forEach(a=>{const c=parseInt(a.dataset.row,10);isNaN(c)||a.querySelectorAll("td, th").forEach(l=>{const f=parseInt(l.dataset.col,10);if(isNaN(f))return;const g=parseInt(l.rowSpan||1,10),b=parseInt(l.colSpan||1,10),u=c+g-1,m=f+b-1;c<=s&&u>=n&&f<=r&&m>=e&&(l.classList.add("selected"),c===n&&l.classList.add("selected-top"),u===s&&l.classList.add("selected-bottom"),f===e&&l.classList.add("selected-left"),m===r&&l.classList.add("selected-right"))})})})},"render"));p(this,U,n),Ge(this,ut,is).call(this)}setRange(n,e,s,r){let i=Math.min(n,s),o=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);const l=Ge(this,ut,rs).call(this,i,a,o,c);p(this,Lt,l),this.render()}};U=new WeakMap,Lt=new WeakMap,ut=new WeakSet,rs=h(function(n,e,s,r){let i=n,o=e,a=s,c=r,l=!0;const f=t(this,U).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");for(;l;)l=!1,f.forEach(g=>{g.querySelectorAll("tbody tr").forEach(b=>{const u=parseInt(b.dataset.row,10);isNaN(u)||b.querySelectorAll("td, th").forEach(m=>{const w=parseInt(m.dataset.col,10);if(isNaN(w))return;const T=parseInt(m.rowSpan||1,10),x=parseInt(m.colSpan||1,10),_=u+T-1,k=w+x-1;if(u<=a&&_>=i&&w<=c&&k>=o){const Z=Math.min(i,u),Je=Math.max(a,_),Qe=Math.min(o,w),ts=Math.max(c,k);(Z!==i||Je!==a||Qe!==o||ts!==c)&&(i=Z,a=Je,o=Qe,c=ts,l=!0)}})})});return{startRow:i,startCol:o,endRow:a,endCol:c}},"#expandRangeByMerge"),is=h(function(){const n=t(this,U).querySelector(".ng-container-top");n&&n.addEventListener("mousedown",e=>{const s=e.target.closest("td, th");if(!s||s.dataset.row===void 0||s.dataset.col===void 0||s.closest("tr").classList.contains("nodata"))return;const r=parseInt(s.dataset.row,10),i=parseInt(s.dataset.col,10);this.setRange(r,i,r,i);const o=h(c=>{const l=document.elementFromPoint(c.clientX,c.clientY),f=l==null?void 0:l.closest("td, th");if(!f||!t(this,U).contains(f)||f.dataset.row===void 0||f.dataset.col===void 0||f.closest("tr").classList.contains("nodata"))return;const g=parseInt(f.dataset.row,10),b=parseInt(f.dataset.col,10);this.setRange(r,i,g,b)},"onMouseMove"),a=h(()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})},"#initEvents"),h($e,"CellSelection");let be=$e;const Mt=class Mt extends HTMLElement{constructor(){super();d(this,Gt);d(this,it,null);d(this,ot);d(this,Ht);q(this,"invalidate",h(()=>{v.log("sheet.invalidate()"),t(this,ot).refresh()},"invalidate"));q(this,"generate",h(e=>{if(v.log("sheet.generate()"),!e)return;p(this,it,ge.compile(e)),t(this,Jt).call(this),t(this,Qt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),i=this.querySelector(".ng-nodata-overlay");s&&i&&(i.style.top=`${s.offsetHeight}px`),r&&i&&(i.style.bottom=`${r.offsetHeight}px`),t(this,ot).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,Jt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var i,o,a;(i=this.querySelector(`${s} .ng-part-header`))==null||i.appendChild(t(this,gt).call(this,t(this,it),r,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,gt).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,gt).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,Qt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let i=0;r[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(i)||(i+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${i}px`,s.style.width=`${i}px`)})},"#updateContainerWidths"));d(this,gt,h((e,s,r)=>{const i=e.cloneNode(!0),o=i.querySelector("thead"),a=i.querySelector("tbody"),c=i.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",i.appendChild(f)}}else r==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(o&&o.remove(),a&&a.remove());return s==="left"?i.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?i.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):i.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),i},"#createSplitTable"));q(this,"getRowHeight",h(()=>t(this,ot).getRowHeight(),"getRowHeight"));q(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));q(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,te,h(()=>{t(this,ee).call(this),p(this,Ht,new be(this))},"#init"));d(this,ee,h(()=>{const e=Mt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;