@ninebone/table 0.0.767 β†’ 0.0.769

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(A,R){typeof exports=="object"&&typeof module<"u"?R(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],R):(A=typeof globalThis<"u"?globalThis:A||self,R(A.NineboneUtil))})(this,function(A){"use strict";var fs=Object.defineProperty;var us=A=>{throw TypeError(A)};var ys=(A,R,y)=>R in A?fs(A,R,{enumerable:!0,configurable:!0,writable:!0,value:y}):A[R]=y;var h=(A,R)=>fs(A,"name",{value:R,configurable:!0});var C=(A,R,y)=>ys(A,typeof R!="symbol"?R+"":R,y),ls=(A,R,y)=>R.has(A)||us("Cannot "+y);var t=(A,R,y)=>(ls(A,R,"read from private field"),y?y.call(A):R.get(A)),d=(A,R,y)=>R.has(A)?us("Cannot add the same private member more than once"):R instanceof WeakSet?R.add(A):R.set(A,y),p=(A,R,y,K)=>(ls(A,R,"write to private field"),K?K.call(A,y):R.set(A,y),y),pt=(A,R,y)=>(ls(A,R,"access private method"),y);var gs=(A,R,y,K)=>({set _(qt){p(A,R,qt,y)},get _(){return t(A,R,K)}});var P,G,T,et,st,nt,Xt,rt,Kt,ot,it,yt,L,Tt,Ct,Gt,j,E,at,F,O,Z,lt,kt,ze,Be,Zt,Jt,Lt,It,Ht,Qt,te,Mt,Pe,mt,$t,ee,_,Y,U,Ut,bs,V,ct,ne,re,Ye,oe,ps,ie,ht,dt,Nt,_t,ae,le,xt,ce,he,de,Ot,D,fe,Wt,ue,zt,wt,W,I,z,vt,ge,J,be,ft,Bt,pe,ye,St,ut,Rt,M,Pt,me,gt,xe,we,H,jt,w,Qe,ts,es,ss,ns,Yt,bt,At,Et,ve,Q,is;const De=class De extends A.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(De,"Trace");let R=De;const y=new R,Oe=class Oe extends HTMLElement{constructor(){super();d(this,P);d(this,G,!1);d(this,T);d(this,et);d(this,st);d(this,nt);d(this,Xt,h(()=>{if(!t(this,P))return;const e=t(this,P).querySelector(".ng-container-body .ng-part-body");e&&(p(this,nt,new ResizeObserver(()=>{this.refresh()})),t(this,nt).observe(e))},"#observeResize"));C(this,"refresh",h(()=>{if(!t(this,P)||!t(this,T)||t(this,G))return;const e=t(this,T).container,s=e.querySelector("table");if(!s)return;const r=t(this,T).track,o=t(this,T).thumb,i=t(this,P).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)i&&(i.style.display="flex");else{i&&(i.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);o.style.width=`${f}px`;const u=e.scrollLeft,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const m=l-f;g>m&&(g=m),o.style.left=`${g}px`,t(this,T).left.disabled=g===0,t(this,T).right.disabled=g>=m-1},"refresh"));d(this,rt,h(e=>{if(!t(this,T))return!1;const s=t(this,T).container,r=s.querySelector("table");if(!r)return!1;const o=t(this,T).track.getBoundingClientRect(),i=t(this,T).thumb.clientWidth;let a=e;a<0&&(a=0);const c=o.width-i;a>c&&(a=c),a=parseInt(a,10),t(this,T).thumb.style.left=`${a}px`,t(this,T).left.disabled=a===0,t(this,T).right.disabled=a>=c-1;const l=s.clientWidth,u=r.scrollWidth-l;return c>0&&u>0&&(s.scrollLeft=a/c*u),a>0&&a<c-1},"#thumbMoveTo"));d(this,Kt,h(()=>{const e=h(r=>{clearInterval(t(this,et)),clearInterval(t(this,st));const o=parseInt(t(this,T).thumb.style.left||0,10);t(this,rt).call(this,o+r),p(this,et,setInterval(()=>{clearInterval(t(this,et)),p(this,st,setInterval(()=>{const i=parseInt(t(this,T).thumb.style.left||0,10);t(this,rt).call(this,i+r)||clearInterval(t(this,st))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,et)),clearInterval(t(this,st))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,T).left.addEventListener(r,s),t(this,T).right.addEventListener(r,s),t(this,T).track.addEventListener(r,s)}),t(this,T).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,T).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,T).left.addEventListener("touchstart",()=>e(-20)),t(this,T).right.addEventListener("touchstart",()=>e(20)),t(this,T).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const o=t(this,T).track.getBoundingClientRect(),i=t(this,T).thumb.clientWidth;t(this,rt).call(this,r.clientX-o.left-i/2)}),t(this,T).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,G,!0),this.shiftX=r.clientX-t(this,T).thumb.getBoundingClientRect().left;const o=h(a=>{if(!t(this,G))return;const c=t(this,T).track.getBoundingClientRect();t(this,rt).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),i=h(()=>{p(this,G,!1),s(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i),this.refresh()},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)})},"#init"))}connectedCallback(){if(p(this,P,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,P))return;this.innerHTML=`
1
+ (function(A,R){typeof exports=="object"&&typeof module<"u"?R(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],R):(A=typeof globalThis<"u"?globalThis:A||self,R(A.NineboneUtil))})(this,function(A){"use strict";var fs=Object.defineProperty;var us=A=>{throw TypeError(A)};var ys=(A,R,y)=>R in A?fs(A,R,{enumerable:!0,configurable:!0,writable:!0,value:y}):A[R]=y;var h=(A,R)=>fs(A,"name",{value:R,configurable:!0});var C=(A,R,y)=>ys(A,typeof R!="symbol"?R+"":R,y),ls=(A,R,y)=>R.has(A)||us("Cannot "+y);var t=(A,R,y)=>(ls(A,R,"read from private field"),y?y.call(A):R.get(A)),d=(A,R,y)=>R.has(A)?us("Cannot add the same private member more than once"):R instanceof WeakSet?R.add(A):R.set(A,y),p=(A,R,y,X)=>(ls(A,R,"write to private field"),X?X.call(A,y):R.set(A,y),y),pt=(A,R,y)=>(ls(A,R,"access private method"),y);var gs=(A,R,y,X)=>({set _(qt){p(A,R,qt,y)},get _(){return t(A,R,X)}});var P,K,T,et,st,nt,Xt,rt,Kt,ot,it,yt,L,Tt,Ct,Gt,j,E,at,F,O,G,lt,kt,ze,Be,Zt,Jt,Lt,It,Ht,Qt,te,Mt,Pe,mt,$t,ee,_,Y,U,Ut,bs,Z,ct,ne,re,Ye,oe,ps,ie,ht,dt,Nt,_t,ae,le,xt,ce,he,de,Ot,D,fe,Wt,ue,zt,wt,W,I,z,vt,ge,J,be,ft,Bt,pe,ye,St,ut,Rt,M,Pt,me,gt,xe,we,H,jt,w,Qe,ts,es,ss,ns,Yt,bt,At,Et,ve,Q,is;const De=class De extends A.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(De,"Trace");let R=De;const y=new R,Oe=class Oe extends HTMLElement{constructor(){super();d(this,P);d(this,K,!1);d(this,T);d(this,et);d(this,st);d(this,nt);d(this,Xt,h(()=>{if(!t(this,P))return;const e=t(this,P).querySelector(".ng-container-body .ng-part-body");e&&(p(this,nt,new ResizeObserver(()=>{this.refresh()})),t(this,nt).observe(e))},"#observeResize"));C(this,"refresh",h(()=>{if(!t(this,P)||!t(this,T)||t(this,K))return;const e=t(this,T).container,s=e.querySelector("table");if(!s)return;const r=t(this,T).track,o=t(this,T).thumb,i=t(this,P).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)i&&(i.style.display="flex");else{i&&(i.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);o.style.width=`${f}px`;const u=e.scrollLeft,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const m=l-f;g>m&&(g=m),o.style.left=`${g}px`,t(this,T).left.disabled=g===0,t(this,T).right.disabled=g>=m-1},"refresh"));d(this,rt,h(e=>{if(!t(this,T))return!1;const s=t(this,T).container,r=s.querySelector("table");if(!r)return!1;const o=t(this,T).track.getBoundingClientRect(),i=t(this,T).thumb.clientWidth;let a=e;a<0&&(a=0);const c=o.width-i;a>c&&(a=c),a=parseInt(a,10),t(this,T).thumb.style.left=`${a}px`,t(this,T).left.disabled=a===0,t(this,T).right.disabled=a>=c-1;const l=s.clientWidth,u=r.scrollWidth-l;return c>0&&u>0&&(s.scrollLeft=a/c*u),a>0&&a<c-1},"#thumbMoveTo"));d(this,Kt,h(()=>{const e=h(r=>{clearInterval(t(this,et)),clearInterval(t(this,st));const o=parseInt(t(this,T).thumb.style.left||0,10);t(this,rt).call(this,o+r),p(this,et,setInterval(()=>{clearInterval(t(this,et)),p(this,st,setInterval(()=>{const i=parseInt(t(this,T).thumb.style.left||0,10);t(this,rt).call(this,i+r)||clearInterval(t(this,st))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,et)),clearInterval(t(this,st))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,T).left.addEventListener(r,s),t(this,T).right.addEventListener(r,s),t(this,T).track.addEventListener(r,s)}),t(this,T).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,T).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,T).left.addEventListener("touchstart",()=>e(-20)),t(this,T).right.addEventListener("touchstart",()=>e(20)),t(this,T).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const o=t(this,T).track.getBoundingClientRect(),i=t(this,T).thumb.clientWidth;t(this,rt).call(this,r.clientX-o.left-i/2)}),t(this,T).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,K,!0),this.shiftX=r.clientX-t(this,T).thumb.getBoundingClientRect().left;const o=h(a=>{if(!t(this,K))return;const c=t(this,T).track.getBoundingClientRect();t(this,rt).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),i=h(()=>{p(this,K,!1),s(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i),this.refresh()},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)})},"#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,T,{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,G)||this.refresh()}),t(this,Kt).call(this),t(this,Xt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,nt)&&t(this,nt).disconnect()}};P=new WeakMap,G=new WeakMap,T=new WeakMap,et=new WeakMap,st=new WeakMap,nt=new WeakMap,Xt=new WeakMap,rt=new WeakMap,Kt=new WeakMap,h(Oe,"NineTableHScrollBar");let K=Oe;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",K);const We=class We extends HTMLElement{constructor(){super();d(this,ot);d(this,it);d(this,yt,!1);d(this,L);d(this,Tt,0);d(this,Ct,0);C(this,"refresh",h(()=>{if(y.log("vscrollbar.refresh"),!t(this,ot)||!t(this,L))return;const e=t(this,L).container,s=t(this,L).track,r=t(this,L).thumb,o=e.clientHeight,i=t(this,ot).data.length,a=t(this,it).getRowHeight(),c=i*a;if(c<=o||i===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*(o/c),l),20);r.style.height=`${f}px`;const u=e.scrollTop,b=Math.max(c-o,1);y.log(e,u,b);let g=0;b>0&&(g=u/b*(l-f));const m=l-f;g<0&&(g=0),g>m&&(g=m),r.style.top=`${g}px`,t(this,L).top.disabled=u<=0,t(this,L).bottom.disabled=u>=b-1},"refresh"));d(this,Gt,h(()=>{y.log("nine-table-vscrollbar.#init");const e=t(this,L).container,s=h(()=>{const o=(t(this,ot).data.get()||[]).length,i=t(this,it).getRowHeight();return o*i},"getContentHeight");t(this,L).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,yt,!0),p(this,Tt,r.clientY),p(this,Ct,e.scrollTop);const o=h(a=>{if(!t(this,yt))return;const c=t(this,L).track.getBoundingClientRect(),l=t(this,L).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,Tt),g=e.clientHeight,m=s(),v=Math.max(m-g,1);if(u>0&&v>0){const S=b/u*v;let x=t(this,Ct)+S;const k=Math.max(0,m-g);x<0&&(x=0),x>k&&(x=k),e.scrollTop=x}this.refresh()},"onMouseMove"),i=h(()=>{p(this,yt,!1),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i),this.refresh()},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)}),t(this,L).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,L).thumb)return;const o=t(this,L).track.getBoundingClientRect(),i=t(this,L).thumb.clientHeight,a=r.clientY-o.top-i/2,l=o.height-i,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(l>0&&b>0){const g=Math.max(0,Math.min(1,a/l));e.scrollTop=g*b}this.refresh()}),t(this,L).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,L).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,ot,this.getRootNode().host),p(this,it,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,T,{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,K)||this.refresh()}),t(this,Kt).call(this),t(this,Xt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,nt)&&t(this,nt).disconnect()}};P=new WeakMap,K=new WeakMap,T=new WeakMap,et=new WeakMap,st=new WeakMap,nt=new WeakMap,Xt=new WeakMap,rt=new WeakMap,Kt=new WeakMap,h(Oe,"NineTableHScrollBar");let X=Oe;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",X);const We=class We extends HTMLElement{constructor(){super();d(this,ot);d(this,it);d(this,yt,!1);d(this,L);d(this,Tt,0);d(this,Ct,0);C(this,"refresh",h(()=>{if(y.log("vscrollbar.refresh"),!t(this,ot)||!t(this,L))return;const e=t(this,L).container,s=t(this,L).track,r=t(this,L).thumb,o=e.clientHeight,i=t(this,ot).data.length,a=t(this,it).getRowHeight(),c=i*a;if(c<=o||i===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*(o/c),l),20);r.style.height=`${f}px`;const u=e.scrollTop,b=Math.max(c-o,1);y.log(e,u,b);let g=0;b>0&&(g=u/b*(l-f));const m=l-f;g<0&&(g=0),g>m&&(g=m),r.style.top=`${g}px`,t(this,L).top.disabled=u<=0,t(this,L).bottom.disabled=u>=b-1},"refresh"));d(this,Gt,h(()=>{y.log("nine-table-vscrollbar.#init");const e=t(this,L).container,s=h(()=>{const o=(t(this,ot).data.get()||[]).length,i=t(this,it).getRowHeight();return o*i},"getContentHeight");t(this,L).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,yt,!0),p(this,Tt,r.clientY),p(this,Ct,e.scrollTop);const o=h(a=>{if(!t(this,yt))return;const c=t(this,L).track.getBoundingClientRect(),l=t(this,L).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,Tt),g=e.clientHeight,m=s(),v=Math.max(m-g,1);if(u>0&&v>0){const S=b/u*v;let x=t(this,Ct)+S;const k=Math.max(0,m-g);x<0&&(x=0),x>k&&(x=k),e.scrollTop=x}this.refresh()},"onMouseMove"),i=h(()=>{p(this,yt,!1),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i),this.refresh()},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)}),t(this,L).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,L).thumb)return;const o=t(this,L).track.getBoundingClientRect(),i=t(this,L).thumb.clientHeight,a=r.clientY-o.top-i/2,l=o.height-i,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(l>0&&b>0){const g=Math.max(0,Math.min(1,a/l));e.scrollTop=g*b}this.refresh()}),t(this,L).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,L).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,ot,this.getRootNode().host),p(this,it,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,it).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,L,{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,Gt).call(this),this.refresh()},"initWhenReady");e()}};ot=new WeakMap,it=new WeakMap,yt=new WeakMap,L=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,Gt=new WeakMap,h(We,"NineTableVScrollBar");let qt=We;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",qt);const Fe=class Fe{constructor(n){d(this,j);d(this,E);d(this,at);d(this,F,new Map);d(this,O,null);d(this,Z,null);d(this,lt,0);d(this,kt,40);d(this,ze,!1);d(this,Be,!1);d(this,Zt,3);C(this,"refresh",h(()=>{var e;y.log("rowManager.refresh");const n=t(this,E).querySelector(".ng-container-body .ng-part-body");n&&(t(this,Lt).call(this),t(this,It).call(this),t(this,mt).call(this,n.scrollTop),(e=t(this,E).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));C(this,"initialize",h(()=>{y.log("rowManager.initialize"),p(this,at,{scrollTables:t(this,E).querySelectorAll(".ng-part-body table"),firstTr:t(this,E).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),p(this,O,null),t(this,F).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const a=t(this,E).querySelector(i);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,F).set(i,u)});const n=t(this,E).querySelector(".ng-container-body .ng-part-body"),e=t(this,E).querySelector(".ng-container-left .ng-part-body"),s=t(this,E).querySelector(".ng-container-right .ng-part-body"),r=t(this,E).querySelector(".ng-container-body .ng-part-header"),o=t(this,E).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,Lt).call(this),t(this,Mt).call(this),t(this,It).call(this),t(this,mt).call(this,n.scrollTop);let i=!1;const a=h(c=>{var u;if(i)return;i=!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),o&&o.scrollLeft!==f&&(o.scrollLeft=f),t(this,mt).call(this,l),(u=t(this,E).querySelector("nine-table-vscrollbar"))==null||u.refresh(),i=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",l=>{y.log(l),y.log("rowManager.scroll event"),a(c)})})}},"initialize"));d(this,Jt,h((n,e)=>{y.log("rowManager.#renderRows");const s=t(this,F).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 o=r.querySelector("tr.nodata"),i=document.createDocumentFragment();for(let a=0;a<t(this,kt);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});o?o.before(i):r.appendChild(i),e===".ng-container-body"&&(t(this,at).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Lt,h(()=>{if(t(this,O)!==null&&t(this,O)>0)return t(this,O);const n=t(this,E).querySelector(".ng-container-body .ng-part-body");y.log("rowManager.#measureAndCacheHeight");const e=t(this,F).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(y.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),o=document.createDocumentFragment();e.forEach(b=>{o.appendChild(b.cloneNode(!0))}),r?r.before(o):s.appendChild(o);const i=t(this,E),a=i.style.display,c=i.style.visibility,l=i.style.position;(a==="none"||window.getComputedStyle(i).display==="none")&&(i.style.display="block",i.style.visibility="hidden",i.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const m=window.getComputedStyle(b);g=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,f<=0?-1:(p(this,O,f),t(this,Ht).call(this),t(this,O))},"#measureAndCacheHeight"));d(this,It,h(()=>{y.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,O),r=e*s;y.log("πŸ” [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const i=t(this,E).querySelector(o);if(!i)return;const a=i.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,Ht,h(()=>{if(t(this,lt)>0&&t(this,O)>0){const n=Math.ceil(t(this,lt)/t(this,O));p(this,kt,n+t(this,Zt))}},"#updateRowCount"));d(this,Qt,h(()=>{var a,c,l,f,u,b;const n=t(this,E).querySelector(".ng-container-left .ng-part-body table"),e=t(this,E).querySelector(".ng-container-body .ng-part-body table"),s=t(this,E).querySelector(".ng-container-right .ng-part-body table");if(e){const g=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),v=s?Array.from(s.querySelectorAll("tbody tr")):[],S=Math.max(g.length,m.length,v.length);for(let x=0;x<S;x++){const k=[((a=g[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=v[x])==null?void 0:l.getBoundingClientRect().height)||0],q=Math.max(...k);q>0&&(g[x]&&(g[x].style.height=`${q}px`),m[x]&&(m[x].style.height=`${q}px`),v[x]&&(v[x].style.height=`${q}px`))}}const r=t(this,E).querySelector(".ng-container-left .ng-part-footer table"),o=t(this,E).querySelector(".ng-container-body .ng-part-footer table"),i=t(this,E).querySelector(".ng-container-right .ng-part-footer table");if(o){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(o.querySelectorAll("tfoot tr")),v=i?Array.from(i.querySelectorAll("tfoot tr")):[],S=Math.max(g.length,m.length,v.length);for(let x=0;x<S;x++){const k=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=v[x])==null?void 0:b.getBoundingClientRect().height)||0],q=Math.max(...k);q>0&&(g[x]&&(g[x].style.height=`${q}px`),m[x]&&(m[x].style.height=`${q}px`),v[x]&&(v[x].style.height=`${q}px`))}}},"#syncRowHeights"));d(this,te,h(()=>{!t(this,E)||!(t(this,E)instanceof HTMLElement)||(p(this,Z,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 o=0;const i=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");i&&(o+=i.offsetHeight),a&&(o+=a.offsetHeight);const c=Math.max(r-o,100);t(this,lt)!==c&&(p(this,lt,c),t(this,Ht).call(this),t(this,O)!==null&&(t(this,Mt).call(this),this.refresh()))}}})),t(this,Z).observe(t(this,E)))},"#initResizeObserver"));d(this,Mt,h(()=>{y.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,E).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Jt).call(this,e,n)}),t(this,ee).call(this),t(this,Qt).call(this)},"#renderAllContainers"));d(this,Pe,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,E).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const o=Array.from(r.querySelectorAll("tr:not(.nodata)")),i=((l=t(this,F).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;o.forEach((f,u)=>{const b=n+Math.floor(u/i);if(b>=c){f.style.visibility="hidden";return}const g=t(this,j).data.get(b);f.style.display="",t(this,$t).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,mt,h(n=>{var u,b;const e=t(this,O);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((u=t(this,F).get(".ng-container-body"))==null?void 0:u.length)||1,o=t(this,E).querySelector(".ng-container-body .ng-part-body");y.log("bodyContainer.clientHeight",o.clientHeight);const i=Math.max(0,s-Math.floor(o.clientHeight/e)),a=Math.min(i,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);y.log(`πŸ“œ [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`),a===i&&y.log(`πŸ“œ [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,at).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,at))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(y.log(`πŸ”„ [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const m=t(this,E).querySelector(g);if(!m)return;const v=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!v)return;Array.from(v.querySelectorAll("tr:not(.nodata)")).forEach((x,k)=>{const q=a+Math.floor(k/r);if(q>=s){x.style.display="none";return}const N=t(this,j).data.get(q);x.style.display="",t(this,$t).call(this,x,N,q)})}))},"#handleScroll"));d(this,$t,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,o)=>{r.dataset.row=s;const i=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");i&&typeof i.refresh=="function"&&i.refresh()})},"#bindRowData"));d(this,ee,h(()=>{var c,l,f;y.log("rowManager.#syncHeaderHeights");const n=t(this,E).querySelector(".ng-container-left .ng-part-header table"),e=t(this,E).querySelector(".ng-container-body .ng-part-header table"),s=t(this,E).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=n?Array.from(n.querySelectorAll("tr")):[],o=Array.from(e.querySelectorAll("tr")),i=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,o.length,i.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=o[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=i[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`),i[u]&&(i[u].style.height=`${g}px`))}},"#syncHeaderHeights"));C(this,"destroy",h(()=>{t(this,Z)&&(t(this,Z).disconnect(),p(this,Z,null))},"destroy"));p(this,j,n.getRootNode().host),p(this,E,n),t(this,te).call(this)}getRowHeight(){return t(this,O)}templateLength(n=".ng-container-body"){var e;return((e=t(this,F).get(n))==null?void 0:e.length)||1}};j=new WeakMap,E=new WeakMap,at=new WeakMap,F=new WeakMap,O=new WeakMap,Z=new WeakMap,lt=new WeakMap,kt=new WeakMap,ze=new WeakMap,Be=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,Lt=new WeakMap,It=new WeakMap,Ht=new WeakMap,Qt=new WeakMap,te=new WeakMap,Mt=new WeakMap,Pe=new WeakMap,mt=new WeakMap,$t=new WeakMap,ee=new WeakMap,h(Fe,"RowManager");let Se=Fe;const se=class se{static compileAll(n){return Array.isArray(n)?n.map(e=>se.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 u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),v=l.getAttribute("type");let S=[];b&&S.push(`data-bind="${b}"`),g&&S.push(`data-expr="${g}"`),m&&S.push(`maxbyte="${m}"`),v&&S.push(`type="${v}"`),l.innerHTML=`<${u} ${S.join(" ")}></${u}>`}),a.querySelectorAll("tbody td, tfoot td").forEach(l=>{l.setAttribute("tabindex","0")})},"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")},"ensureTableStructure"),r=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 v=m.sectionRowIndex;let S=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let N=0;N<g[v].length;N++)if(g[v][N]===null){S=N;break}const k=x.rowSpan||1,q=x.colSpan||1;for(let N=0;N<k;N++)for(let X=0;X<q;X++)v+N<u&&S+X<b&&(g[v+N][S+X]=N===0&&X===0?"1":"0")})}),l.forEach(m=>{const v=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(S=>{for(let x=0;x<g[v].length;x++)if(g[v][x]==="1"){S.dataset.col=x,g[v][x]="0";break}})})},"resetColIndex"),o=n.cloneNode(!0);return s(o),e(o),r(o,"thead"),r(o,"tbody"),r(o,"tfoot"),Array.from(o.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&o.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),o}};h(se,"TableCompiler");let Re=se;const je=class je{constructor(n){d(this,U);d(this,_);d(this,Y,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});C(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,Y);y.log("🎨 [CellSelection.render] Rendering range ->",t(this,Y));const o=t(this,_).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(o.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),n<0||e<0){y.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let i=0;o.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{const{matrixRow:l}=pt(this,U,Ut).call(this,c);l<0||c.querySelectorAll("td, th").forEach(f=>{const u=parseInt(f.dataset.col,10);if(isNaN(u))return;const b=parseInt(f.rowSpan||1,10),g=parseInt(f.colSpan||1,10),m=l+b-1,v=u+g-1;m>=n&&l<=s&&v>=e&&u<=r&&(i++,f.classList.add("selected"),y.log(f,n,e,s,r),l<=n&&f.classList.add("selected-top"),m>=s&&f.classList.add("selected-bottom"),u<=e&&f.classList.add("selected-left"),v>=r&&f.classList.add("selected-right"))})})}),y.log(`✨ [CellSelection.render] Total rendered cells marked: ${i}`)},"render"));p(this,_,n),pt(this,U,bs).call(this),t(this,_).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body").forEach(s=>{s.addEventListener("scroll",()=>{t(this,Y).startRow>=0&&t(this,Y).startCol>=0&&this.render()})}),y.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,r){y.log(`πŸ” [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${r}`);let o=Math.min(n,s),i=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);const l=t(this,_).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");let f=!0,u=0;for(;f&&u<5;)f=!1,u++,l.forEach(b=>{b.querySelectorAll("tbody tr").forEach(g=>{if(g.classList.contains("nodata"))return;const{matrixRow:m}=pt(this,U,Ut).call(this,g);m<0||g.querySelectorAll("td, th").forEach(v=>{const S=parseInt(v.dataset.col,10);if(isNaN(S))return;const x=parseInt(v.rowSpan||1,10),k=parseInt(v.colSpan||1,10),q=m+x-1,N=S+k-1;if(q>=o&&m<=i&&N>=a&&S<=c){const tt=Math.min(o,m),cs=Math.max(i,q),hs=Math.min(a,S),ds=Math.max(c,N);(tt!==o||cs!==i||hs!==a||ds!==c)&&(o=tt,i=cs,a=hs,c=ds,f=!0)}})})});p(this,Y,{startRow:o,startCol:a,endRow:i,endCol:c}),y.log("πŸ“¦ [CellSelection.setRange] Final Range ->",t(this,Y)),this.render()}};_=new WeakMap,Y=new WeakMap,U=new WeakSet,Ut=h(function(n){if(!n||n.classList.contains("nodata"))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const e=parseInt(n.dataset.row,10);if(isNaN(e))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const s=n.closest("tbody"),o=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===e),i=o.indexOf(n),a=o.length>0?o.length:1,c=e*a+(i>=0?i:n.sectionRowIndex%a);return{dataRow:e,subRowIndex:i,matrixRow:c}},"#getMatrixRow"),bs=h(function(){const n=t(this,_).querySelector(".ng-container-top");if(!n){y.log("❌ [CellSelection] .ng-container-top not found!");return}n.addEventListener("mousedown",e=>{if(e.button!==0)return;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;t(this,_).style.userSelect="none",t(this,_).style.webkitUserSelect="none";const r=s.closest("tr"),{matrixRow:o}=pt(this,U,Ut).call(this,r),i=parseInt(s.dataset.col,10);if(o<0){t(this,_).style.userSelect="",t(this,_).style.webkitUserSelect="";return}y.log(`πŸ–±οΈ [MouseDown Success] startRow: ${o}, startCol: ${i}`),this.setRange(o,i,o,i);let a=o,c=i;const l=h(u=>{const b=document.elementFromPoint(u.clientX,u.clientY);let g=b==null?void 0:b.closest("td, th");if(!g||!t(this,_).contains(g)){const x=t(this,_).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const k of x){const q=k.getBoundingClientRect();if(u.clientX>=q.left&&u.clientX<=q.right&&u.clientY>=q.top&&u.clientY<=q.bottom){g=k;break}}}if(!g||g.dataset.row===void 0||g.dataset.col===void 0||g.closest("tr").classList.contains("nodata"))return;const m=g.closest("tr"),{matrixRow:v}=pt(this,U,Ut).call(this,m),S=parseInt(g.dataset.col,10);v<0||a===v&&c===S||(a=v,c=S,this.setRange(o,i,v,S))},"onMouseMove"),f=h(()=>{y.log("πŸ–±οΈ [MouseUp] Drag ended."),t(this,_).style.userSelect="",t(this,_).style.webkitUserSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",f)},"onMouseUp");document.addEventListener("mousemove",l),document.addEventListener("mouseup",f)})},"#initEvents"),h(je,"CellSelection");let Ae=je;const Ue=class Ue{constructor(n){d(this,oe);d(this,V);d(this,ct,null);d(this,ne,-1);d(this,re,-1);d(this,Ye,!1);p(this,V,n),pt(this,oe,ps).call(this),y.log("🎯 [CellNavigation] Initialized")}get currentCell(){return t(this,ct)}set currentCell(n){if(!n)return;p(this,ct,n),n.focus({preventScroll:!0});const e=parseInt(n.dataset.row,10),s=parseInt(n.dataset.col,10);if(!isNaN(e)&&!isNaN(s)){p(this,ne,e),p(this,re,s);const r=n.closest("tr"),o=r==null?void 0:r.closest("tbody");if(o){const a=Array.from(o.querySelectorAll("tr:not(.nodata)")).filter(u=>parseInt(u.dataset.row,10)===e),c=a.length>0?a.length:1,l=a.indexOf(r),f=e*c+(l>=0?l:0);y.log("====================",f,s,f,s),t(this,V).selection.setRange(f,s,f,s)}}}moveCell(n){var k,q,N,X;if(!t(this,ct))return;const e=t(this,ct),s=e.closest("tr"),r=parseInt(e.dataset.row,10),o=parseInt(e.dataset.col,10),i=s==null?void 0:s.closest("tbody"),c=Array.from(i.querySelectorAll("tr:not(.nodata)")).filter(tt=>parseInt(tt.dataset.row,10)===r),l=c.length>0?c.length:1,f=c.indexOf(s);let u=r,b=f,g=o;switch(n.code){case"Tab":n.preventDefault(),g=n.shiftKey?o-1:o+1;break;case"ArrowRight":g=o+1;break;case"ArrowLeft":g=o-1;break;case"ArrowDown":n.preventDefault(),f<l-1?b=f+1:(u=r+1,b=0);break;case"ArrowUp":n.preventDefault(),f>0?b=f-1:(u=r-1,b=l-1);break}let m=null;const x=Array.from(i.querySelectorAll("tr:not(.nodata)")).filter(tt=>parseInt(tt.dataset.row,10)===u)[b];if(x&&(m=x.querySelector(`[data-col="${g}"]`)),m)this.currentCell=m;else if(u!==r&&u>=0){const tt=((q=(k=t(this,V)).getRowHeight)==null?void 0:q.call(k))||40;(X=(N=t(this,V)).scrollToY)==null||X.call(N,u*tt)}}};V=new WeakMap,ct=new WeakMap,ne=new WeakMap,re=new WeakMap,Ye=new WeakMap,oe=new WeakSet,ps=h(function(){t(this,V).addEventListener("mousedown",n=>{const e=n.target.closest("td, th");!e||e.dataset.row===void 0||e.dataset.col===void 0||(this.currentCell=e)}),t(this,V).addEventListener("keydown",n=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n.code)&&this.moveCell(n)})},"#initEvents"),h(Ue,"CellNavigation");let Ee=Ue;const Dt=class Dt extends HTMLElement{constructor(){super();d(this,ie);d(this,ht,null);d(this,dt);d(this,Nt);d(this,_t);C(this,"invalidate",h(()=>{y.log("sheet.invalidate()"),t(this,dt).refresh()},"invalidate"));C(this,"generate",h(e=>{if(y.log("sheet.generate()"),!e)return;p(this,ht,Re.compile(e)),t(this,ae).call(this),t(this,le).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),o=this.querySelector(".ng-nodata-overlay");s&&o&&(o.style.top=`${s.offsetHeight}px`),r&&o&&(o.style.bottom=`${r.offsetHeight}px`),t(this,dt).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));d(this,ae,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 o,i,a;(o=this.querySelector(`${s} .ng-part-header`))==null||o.appendChild(t(this,xt).call(this,t(this,ht),r,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,xt).call(this,t(this,ht),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,xt).call(this,t(this,ht),r,"footer"))})},"#renderSplitContainers"));d(this,le,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 o=0;r[0].querySelectorAll("col").forEach(i=>{const a=parseInt(i.getAttribute("width"),10);isNaN(a)||(o+=a)}),e==="body"?(s.style.flex="1",r.forEach(i=>{i.style.width=`${o}px`,i.style.minWidth=`${o}px`})):(s.style.flex=`0 0 ${o}px`,s.style.width=`${o}px`,r.forEach(i=>{i.style.width=`${o}px`,i.style.minWidth=`${o}px`}))})},"#updateContainerWidths"));d(this,xt,h((e,s,r)=>{const o=e.cloneNode(!0),i=o.querySelector("thead"),a=o.querySelector("tbody"),c=o.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",o.appendChild(f)}}else r==="body"?(i&&i.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(i&&i.remove(),a&&a.remove());return s==="left"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):o.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),o},"#createSplitTable"));C(this,"getRowHeight",h(()=>t(this,dt).getRowHeight(),"getRowHeight"));C(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));C(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,ce,h(()=>{t(this,he).call(this),p(this,Nt,new Ae(this)),p(this,_t,new Ee(this))},"#init"));d(this,he,h(()=>{const e=Dt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=h(()=>{const s=t(this,it).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,L,{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,Gt).call(this),this.refresh()},"initWhenReady");e()}};ot=new WeakMap,it=new WeakMap,yt=new WeakMap,L=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,Gt=new WeakMap,h(We,"NineTableVScrollBar");let qt=We;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",qt);const Fe=class Fe{constructor(n){d(this,j);d(this,E);d(this,at);d(this,F,new Map);d(this,O,null);d(this,G,null);d(this,lt,0);d(this,kt,40);d(this,ze,!1);d(this,Be,!1);d(this,Zt,3);C(this,"refresh",h(()=>{var e;y.log("rowManager.refresh");const n=t(this,E).querySelector(".ng-container-body .ng-part-body");n&&(t(this,Lt).call(this),t(this,It).call(this),t(this,mt).call(this,n.scrollTop),(e=t(this,E).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));C(this,"initialize",h(()=>{y.log("rowManager.initialize"),p(this,at,{scrollTables:t(this,E).querySelectorAll(".ng-part-body table"),firstTr:t(this,E).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),p(this,O,null),t(this,F).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const a=t(this,E).querySelector(i);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,F).set(i,u)});const n=t(this,E).querySelector(".ng-container-body .ng-part-body"),e=t(this,E).querySelector(".ng-container-left .ng-part-body"),s=t(this,E).querySelector(".ng-container-right .ng-part-body"),r=t(this,E).querySelector(".ng-container-body .ng-part-header"),o=t(this,E).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,Lt).call(this),t(this,Mt).call(this),t(this,It).call(this),t(this,mt).call(this,n.scrollTop);let i=!1;const a=h(c=>{var u;if(i)return;i=!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),o&&o.scrollLeft!==f&&(o.scrollLeft=f),t(this,mt).call(this,l),(u=t(this,E).querySelector("nine-table-vscrollbar"))==null||u.refresh(),i=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",l=>{y.log(l),y.log("rowManager.scroll event"),a(c)})})}},"initialize"));d(this,Jt,h((n,e)=>{y.log("rowManager.#renderRows");const s=t(this,F).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 o=r.querySelector("tr.nodata"),i=document.createDocumentFragment();for(let a=0;a<t(this,kt);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});o?o.before(i):r.appendChild(i),e===".ng-container-body"&&(t(this,at).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Lt,h(()=>{if(t(this,O)!==null&&t(this,O)>0)return t(this,O);const n=t(this,E).querySelector(".ng-container-body .ng-part-body");y.log("rowManager.#measureAndCacheHeight");const e=t(this,F).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(y.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),o=document.createDocumentFragment();e.forEach(b=>{o.appendChild(b.cloneNode(!0))}),r?r.before(o):s.appendChild(o);const i=t(this,E),a=i.style.display,c=i.style.visibility,l=i.style.position;(a==="none"||window.getComputedStyle(i).display==="none")&&(i.style.display="block",i.style.visibility="hidden",i.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const m=window.getComputedStyle(b);g=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,f<=0?-1:(p(this,O,f),t(this,Ht).call(this),t(this,O))},"#measureAndCacheHeight"));d(this,It,h(()=>{y.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,O),r=e*s;y.log("πŸ” [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const i=t(this,E).querySelector(o);if(!i)return;const a=i.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,Ht,h(()=>{if(t(this,lt)>0&&t(this,O)>0){const n=Math.ceil(t(this,lt)/t(this,O));p(this,kt,n+t(this,Zt))}},"#updateRowCount"));d(this,Qt,h(()=>{var a,c,l,f,u,b;const n=t(this,E).querySelector(".ng-container-left .ng-part-body table"),e=t(this,E).querySelector(".ng-container-body .ng-part-body table"),s=t(this,E).querySelector(".ng-container-right .ng-part-body table");if(e){const g=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),v=s?Array.from(s.querySelectorAll("tbody tr")):[],S=Math.max(g.length,m.length,v.length);for(let x=0;x<S;x++){const k=[((a=g[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=v[x])==null?void 0:l.getBoundingClientRect().height)||0],q=Math.max(...k);q>0&&(g[x]&&(g[x].style.height=`${q}px`),m[x]&&(m[x].style.height=`${q}px`),v[x]&&(v[x].style.height=`${q}px`))}}const r=t(this,E).querySelector(".ng-container-left .ng-part-footer table"),o=t(this,E).querySelector(".ng-container-body .ng-part-footer table"),i=t(this,E).querySelector(".ng-container-right .ng-part-footer table");if(o){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(o.querySelectorAll("tfoot tr")),v=i?Array.from(i.querySelectorAll("tfoot tr")):[],S=Math.max(g.length,m.length,v.length);for(let x=0;x<S;x++){const k=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=v[x])==null?void 0:b.getBoundingClientRect().height)||0],q=Math.max(...k);q>0&&(g[x]&&(g[x].style.height=`${q}px`),m[x]&&(m[x].style.height=`${q}px`),v[x]&&(v[x].style.height=`${q}px`))}}},"#syncRowHeights"));d(this,te,h(()=>{!t(this,E)||!(t(this,E)instanceof HTMLElement)||(p(this,G,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 o=0;const i=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");i&&(o+=i.offsetHeight),a&&(o+=a.offsetHeight);const c=Math.max(r-o,100);t(this,lt)!==c&&(p(this,lt,c),t(this,Ht).call(this),t(this,O)!==null&&(t(this,Mt).call(this),this.refresh()))}}})),t(this,G).observe(t(this,E)))},"#initResizeObserver"));d(this,Mt,h(()=>{y.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,E).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Jt).call(this,e,n)}),t(this,ee).call(this),t(this,Qt).call(this)},"#renderAllContainers"));d(this,Pe,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,E).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const o=Array.from(r.querySelectorAll("tr:not(.nodata)")),i=((l=t(this,F).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;o.forEach((f,u)=>{const b=n+Math.floor(u/i);if(b>=c){f.style.visibility="hidden";return}const g=t(this,j).data.get(b);f.style.display="",t(this,$t).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,mt,h(n=>{var u,b;const e=t(this,O);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((u=t(this,F).get(".ng-container-body"))==null?void 0:u.length)||1,o=t(this,E).querySelector(".ng-container-body .ng-part-body");y.log("bodyContainer.clientHeight",o.clientHeight);const i=Math.max(0,s-Math.floor(o.clientHeight/e)),a=Math.min(i,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);y.log(`πŸ“œ [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`),a===i&&y.log(`πŸ“œ [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,at).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,at))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(y.log(`πŸ”„ [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const m=t(this,E).querySelector(g);if(!m)return;const v=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!v)return;Array.from(v.querySelectorAll("tr:not(.nodata)")).forEach((x,k)=>{const q=a+Math.floor(k/r);if(q>=s){x.style.display="none";return}const N=t(this,j).data.get(q);x.style.display="",t(this,$t).call(this,x,N,q)})}))},"#handleScroll"));d(this,$t,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,o)=>{r.dataset.row=s;const i=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");i&&typeof i.refresh=="function"&&i.refresh()})},"#bindRowData"));d(this,ee,h(()=>{var c,l,f;y.log("rowManager.#syncHeaderHeights");const n=t(this,E).querySelector(".ng-container-left .ng-part-header table"),e=t(this,E).querySelector(".ng-container-body .ng-part-header table"),s=t(this,E).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=n?Array.from(n.querySelectorAll("tr")):[],o=Array.from(e.querySelectorAll("tr")),i=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,o.length,i.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=o[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=i[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`),i[u]&&(i[u].style.height=`${g}px`))}},"#syncHeaderHeights"));C(this,"destroy",h(()=>{t(this,G)&&(t(this,G).disconnect(),p(this,G,null))},"destroy"));p(this,j,n.getRootNode().host),p(this,E,n),t(this,te).call(this)}getRowHeight(){return t(this,O)}templateLength(n=".ng-container-body"){var e;return((e=t(this,F).get(n))==null?void 0:e.length)||1}};j=new WeakMap,E=new WeakMap,at=new WeakMap,F=new WeakMap,O=new WeakMap,G=new WeakMap,lt=new WeakMap,kt=new WeakMap,ze=new WeakMap,Be=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,Lt=new WeakMap,It=new WeakMap,Ht=new WeakMap,Qt=new WeakMap,te=new WeakMap,Mt=new WeakMap,Pe=new WeakMap,mt=new WeakMap,$t=new WeakMap,ee=new WeakMap,h(Fe,"RowManager");let Se=Fe;const se=class se{static compileAll(n){return Array.isArray(n)?n.map(e=>se.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 u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),v=l.getAttribute("type");let S=[];b&&S.push(`data-bind="${b}"`),g&&S.push(`data-expr="${g}"`),m&&S.push(`maxbyte="${m}"`),v&&S.push(`type="${v}"`),l.innerHTML=`<${u} ${S.join(" ")}></${u}>`}),a.querySelectorAll("tbody td, tfoot td").forEach(l=>{l.setAttribute("tabindex","0")})},"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")},"ensureTableStructure"),r=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 v=m.sectionRowIndex;let S=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let N=0;N<g[v].length;N++)if(g[v][N]===null){S=N;break}const k=x.rowSpan||1,q=x.colSpan||1;for(let N=0;N<k;N++)for(let V=0;V<q;V++)v+N<u&&S+V<b&&(g[v+N][S+V]=N===0&&V===0?"1":"0")})}),l.forEach(m=>{const v=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(S=>{for(let x=0;x<g[v].length;x++)if(g[v][x]==="1"){S.dataset.col=x,g[v][x]="0";break}})})},"resetColIndex"),o=n.cloneNode(!0);return s(o),e(o),r(o,"thead"),r(o,"tbody"),r(o,"tfoot"),Array.from(o.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&o.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),o}};h(se,"TableCompiler");let Re=se;const je=class je{constructor(n){d(this,U);d(this,_);d(this,Y,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});C(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,Y);y.log("🎨 [CellSelection.render] Rendering range ->",t(this,Y));const o=t(this,_).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(o.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),n<0||e<0){y.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let i=0;o.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{const{matrixRow:l}=pt(this,U,Ut).call(this,c);l<0||c.querySelectorAll("td, th").forEach(f=>{const u=parseInt(f.dataset.col,10);if(isNaN(u))return;const b=parseInt(f.rowSpan||1,10),g=parseInt(f.colSpan||1,10),m=l+b-1,v=u+g-1;m>=n&&l<=s&&v>=e&&u<=r&&(i++,f.classList.add("selected"),y.log(f,n,e,s,r),l<=n&&f.classList.add("selected-top"),m>=s&&f.classList.add("selected-bottom"),u<=e&&f.classList.add("selected-left"),v>=r&&f.classList.add("selected-right"))})})}),y.log(`✨ [CellSelection.render] Total rendered cells marked: ${i}`)},"render"));p(this,_,n),pt(this,U,bs).call(this),t(this,_).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body").forEach(s=>{s.addEventListener("scroll",()=>{t(this,Y).startRow>=0&&t(this,Y).startCol>=0&&this.render()})}),y.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,r){y.log(`πŸ” [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${r}`);let o=Math.min(n,s),i=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);const l=t(this,_).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");let f=!0,u=0;for(;f&&u<5;)f=!1,u++,l.forEach(b=>{b.querySelectorAll("tbody tr").forEach(g=>{if(g.classList.contains("nodata"))return;const{matrixRow:m}=pt(this,U,Ut).call(this,g);m<0||g.querySelectorAll("td, th").forEach(v=>{const S=parseInt(v.dataset.col,10);if(isNaN(S))return;const x=parseInt(v.rowSpan||1,10),k=parseInt(v.colSpan||1,10),q=m+x-1,N=S+k-1;if(q>=o&&m<=i&&N>=a&&S<=c){const tt=Math.min(o,m),cs=Math.max(i,q),hs=Math.min(a,S),ds=Math.max(c,N);(tt!==o||cs!==i||hs!==a||ds!==c)&&(o=tt,i=cs,a=hs,c=ds,f=!0)}})})});p(this,Y,{startRow:o,startCol:a,endRow:i,endCol:c}),y.log("πŸ“¦ [CellSelection.setRange] Final Range ->",t(this,Y)),this.render()}};_=new WeakMap,Y=new WeakMap,U=new WeakSet,Ut=h(function(n){if(!n||n.classList.contains("nodata"))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const e=parseInt(n.dataset.row,10);if(isNaN(e))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const s=n.closest("tbody"),o=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===e),i=o.indexOf(n),a=o.length>0?o.length:1,c=e*a+(i>=0?i:n.sectionRowIndex%a);return{dataRow:e,subRowIndex:i,matrixRow:c}},"#getMatrixRow"),bs=h(function(){const n=t(this,_).querySelector(".ng-container-top");if(!n){y.log("❌ [CellSelection] .ng-container-top not found!");return}n.addEventListener("mousedown",e=>{if(e.button!==0)return;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;t(this,_).style.userSelect="none",t(this,_).style.webkitUserSelect="none";const r=s.closest("tr"),{matrixRow:o}=pt(this,U,Ut).call(this,r),i=parseInt(s.dataset.col,10);if(o<0){t(this,_).style.userSelect="",t(this,_).style.webkitUserSelect="";return}y.log(`πŸ–±οΈ [MouseDown Success] startRow: ${o}, startCol: ${i}`),t(this,_).navigation.currentCell=s;let a=o,c=i;const l=h(u=>{const b=document.elementFromPoint(u.clientX,u.clientY);let g=b==null?void 0:b.closest("td, th");if(!g||!t(this,_).contains(g)){const x=t(this,_).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const k of x){const q=k.getBoundingClientRect();if(u.clientX>=q.left&&u.clientX<=q.right&&u.clientY>=q.top&&u.clientY<=q.bottom){g=k;break}}}if(!g||g.dataset.row===void 0||g.dataset.col===void 0||g.closest("tr").classList.contains("nodata"))return;const m=g.closest("tr"),{matrixRow:v}=pt(this,U,Ut).call(this,m),S=parseInt(g.dataset.col,10);v<0||a===v&&c===S||(a=v,c=S,this.setRange(o,i,v,S))},"onMouseMove"),f=h(()=>{y.log("πŸ–±οΈ [MouseUp] Drag ended."),t(this,_).style.userSelect="",t(this,_).style.webkitUserSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",f)},"onMouseUp");document.addEventListener("mousemove",l),document.addEventListener("mouseup",f)})},"#initEvents"),h(je,"CellSelection");let Ae=je;const Ue=class Ue{constructor(n){d(this,oe);d(this,Z);d(this,ct,null);d(this,ne,-1);d(this,re,-1);d(this,Ye,!1);p(this,Z,n),pt(this,oe,ps).call(this),y.log("🎯 [CellNavigation] Initialized")}get currentCell(){return t(this,ct)}set currentCell(n){if(!n)return;p(this,ct,n),n.focus({preventScroll:!0});const e=parseInt(n.dataset.row,10),s=parseInt(n.dataset.col,10);if(!isNaN(e)&&!isNaN(s)){p(this,ne,e),p(this,re,s);const r=n.closest("tr"),o=r==null?void 0:r.closest("tbody");if(o){const a=Array.from(o.querySelectorAll("tr:not(.nodata)")).filter(u=>parseInt(u.dataset.row,10)===e),c=a.length>0?a.length:1,l=a.indexOf(r),f=e*c+(l>=0?l:0);y.log("====================",f,s,f,s),t(this,Z).selection.setRange(f,s,f,s)}}}moveCell(n){var k,q,N,V;if(!t(this,ct))return;const e=t(this,ct),s=e.closest("tr"),r=parseInt(e.dataset.row,10),o=parseInt(e.dataset.col,10),i=s==null?void 0:s.closest("tbody"),c=Array.from(i.querySelectorAll("tr:not(.nodata)")).filter(tt=>parseInt(tt.dataset.row,10)===r),l=c.length>0?c.length:1,f=c.indexOf(s);let u=r,b=f,g=o;switch(n.code){case"Tab":n.preventDefault(),g=n.shiftKey?o-1:o+1;break;case"ArrowRight":g=o+1;break;case"ArrowLeft":g=o-1;break;case"ArrowDown":n.preventDefault(),f<l-1?b=f+1:(u=r+1,b=0);break;case"ArrowUp":n.preventDefault(),f>0?b=f-1:(u=r-1,b=l-1);break}let m=null;const x=Array.from(i.querySelectorAll("tr:not(.nodata)")).filter(tt=>parseInt(tt.dataset.row,10)===u)[b];if(x&&(m=x.querySelector(`[data-col="${g}"]`)),m)this.currentCell=m;else if(u!==r&&u>=0){const tt=((q=(k=t(this,Z)).getRowHeight)==null?void 0:q.call(k))||40;(V=(N=t(this,Z)).scrollToY)==null||V.call(N,u*tt)}}};Z=new WeakMap,ct=new WeakMap,ne=new WeakMap,re=new WeakMap,Ye=new WeakMap,oe=new WeakSet,ps=h(function(){t(this,Z).addEventListener("keydown",n=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n.code)&&this.moveCell(n)})},"#initEvents"),h(Ue,"CellNavigation");let Ee=Ue;const Dt=class Dt extends HTMLElement{constructor(){super();d(this,ie);d(this,ht,null);d(this,dt);d(this,Nt);d(this,_t);C(this,"invalidate",h(()=>{y.log("sheet.invalidate()"),t(this,dt).refresh()},"invalidate"));C(this,"generate",h(e=>{if(y.log("sheet.generate()"),!e)return;p(this,ht,Re.compile(e)),t(this,ae).call(this),t(this,le).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),o=this.querySelector(".ng-nodata-overlay");s&&o&&(o.style.top=`${s.offsetHeight}px`),r&&o&&(o.style.bottom=`${r.offsetHeight}px`),t(this,dt).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));d(this,ae,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 o,i,a;(o=this.querySelector(`${s} .ng-part-header`))==null||o.appendChild(t(this,xt).call(this,t(this,ht),r,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,xt).call(this,t(this,ht),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,xt).call(this,t(this,ht),r,"footer"))})},"#renderSplitContainers"));d(this,le,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 o=0;r[0].querySelectorAll("col").forEach(i=>{const a=parseInt(i.getAttribute("width"),10);isNaN(a)||(o+=a)}),e==="body"?(s.style.flex="1",r.forEach(i=>{i.style.width=`${o}px`,i.style.minWidth=`${o}px`})):(s.style.flex=`0 0 ${o}px`,s.style.width=`${o}px`,r.forEach(i=>{i.style.width=`${o}px`,i.style.minWidth=`${o}px`}))})},"#updateContainerWidths"));d(this,xt,h((e,s,r)=>{const o=e.cloneNode(!0),i=o.querySelector("thead"),a=o.querySelector("tbody"),c=o.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",o.appendChild(f)}}else r==="body"?(i&&i.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(i&&i.remove(),a&&a.remove());return s==="left"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):o.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),o},"#createSplitTable"));C(this,"getRowHeight",h(()=>t(this,dt).getRowHeight(),"getRowHeight"));C(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));C(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,ce,h(()=>{t(this,he).call(this),p(this,Nt,new Ae(this)),p(this,_t,new Ee(this))},"#init"));d(this,he,h(()=>{const e=Dt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;
@@ -273,10 +273,6 @@
273
273
  nine-table-sheet th.selected {
274
274
  background-color: rgba(37, 99, 235, 0.08);
275
275
  position: relative; /* z-index와 가상 μš”μ†Œ 기쀀점 */
276
- border-top: 1px solid #e5e7eb;
277
- border-bottom: 1px solid #e5e7eb;
278
- border-left: 1px solid #e5e7eb;
279
- border-right: 1px solid #e5e7eb;
280
276
  }
281
277
 
282
278
  /* box-shadow λŒ€μ‹  z-indexλ₯Ό 높이고 ν…Œλ‘λ¦¬ 선을 λšœλ ·ν•˜κ²Œ μ˜€λ²„λ ˆμ΄ */