@ninebone/table 0.0.771 → 0.0.772

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,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 u=Math.max(Math.min(l*(a/c),l),20);o.style.width=`${u}px`;const f=e.scrollLeft,b=c-a;let g=0;b>0&&(g=parseInt(f/b*(l-u),10)),g<0&&(g=0);const m=l-u;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,f=r.scrollWidth-l;return c>0&&f>0&&(s.scrollLeft=a/c*f),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=`
1
+ (function(R,A){typeof exports=="object"&&typeof module<"u"?A(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],A):(R=typeof globalThis<"u"?globalThis:R||self,A(R.NineboneUtil))})(this,function(R){"use strict";var bs=Object.defineProperty;var ps=R=>{throw TypeError(R)};var ws=(R,A,y)=>A in R?bs(R,A,{enumerable:!0,configurable:!0,writable:!0,value:y}):R[A]=y;var h=(R,A)=>bs(R,"name",{value:A,configurable:!0});var C=(R,A,y)=>ws(R,typeof A!="symbol"?A+"":A,y),hs=(R,A,y)=>A.has(R)||ps("Cannot "+y);var t=(R,A,y)=>(hs(R,A,"read from private field"),y?y.call(R):A.get(R)),d=(R,A,y)=>A.has(R)?ps("Cannot add the same private member more than once"):A instanceof WeakSet?A.add(R):A.set(R,y),p=(R,A,y,X)=>(hs(R,A,"write to private field"),X?X.call(R,y):A.set(R,y),y),gt=(R,A,y)=>(hs(R,A,"access private method"),y);var ys=(R,A,y,X)=>({set _(Et){p(R,A,Et,y)},get _(){return t(R,A,X)}});var P,G,T,Q,tt,et,Zt,st,Jt,nt,rt,bt,L,qt,Tt,Qt,Y,E,ot,F,O,K,it,Ct,Fe,je,te,ee,kt,Lt,It,se,ne,Ht,Ye,pt,Mt,re,_,U,V,Gt,ms,j,at,ie,ae,$t,Nt,_t,Dt,le,xs,ce,lt,ct,Ot,Wt,he,de,yt,fe,ue,ge,Bt,D,be,Pt,pe,Ft,mt,W,I,z,xt,ye,Z,me,ht,jt,xe,we,wt,dt,vt,M,Yt,ve,ft,Se,Ae,H,Vt,w,es,ss,ns,rs,os,Xt,ut,St,At,Re,J,ls;const ze=class ze extends R.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(ze,"Trace");let A=ze;const y=new A,Be=class Be extends HTMLElement{constructor(){super();d(this,P);d(this,G,!1);d(this,T);d(this,Q);d(this,tt);d(this,et);d(this,Zt,h(()=>{if(!t(this,P))return;const e=t(this,P).querySelector(".ng-container-body .ng-part-body");e&&(p(this,et,new ResizeObserver(()=>{this.refresh()})),t(this,et).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,st,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,Jt,h(()=>{const e=h(r=>{clearInterval(t(this,Q)),clearInterval(t(this,tt));const o=parseInt(t(this,T).thumb.style.left||0,10);t(this,st).call(this,o+r),p(this,Q,setInterval(()=>{clearInterval(t(this,Q)),p(this,tt,setInterval(()=>{const i=parseInt(t(this,T).thumb.style.left||0,10);t(this,st).call(this,i+r)||clearInterval(t(this,tt))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,Q)),clearInterval(t(this,tt))},"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,st).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,st).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=`
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,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 u=Math.max(Math.min(l*(o/c),l),20);r.style.height=`${u}px`;const f=e.scrollTop,b=Math.max(c-o,1);y.log(e,f,b);let g=0;b>0&&(g=f/b*(l-u));const m=l-u;g<0&&(g=0),g>m&&(g=m),r.style.top=`${g}px`,t(this,L).top.disabled=f<=0,t(this,L).bottom.disabled=f>=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,f=c.height-l,b=a.clientY-t(this,Tt),g=e.clientHeight,m=s(),v=Math.max(m-g,1);if(f>0&&v>0){const S=b/f*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,u=e.clientHeight,f=s(),b=Math.max(f-u,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,G)||this.refresh()}),t(this,Jt).call(this),t(this,Zt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,et)&&t(this,et).disconnect()}};P=new WeakMap,G=new WeakMap,T=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,Zt=new WeakMap,st=new WeakMap,Jt=new WeakMap,h(Be,"NineTableHScrollBar");let X=Be;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",X);const Pe=class Pe extends HTMLElement{constructor(){super();d(this,nt);d(this,rt);d(this,bt,!1);d(this,L);d(this,qt,0);d(this,Tt,0);C(this,"refresh",h(()=>{if(y.log("vscrollbar.refresh"),!t(this,nt)||!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,nt).data.length,a=t(this,rt).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,Qt,h(()=>{y.log("nine-table-vscrollbar.#init");const e=t(this,L).container,s=h(()=>{const o=(t(this,nt).data.get()||[]).length,i=t(this,rt).getRowHeight();return o*i},"getContentHeight");t(this,L).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,bt,!0),p(this,qt,r.clientY),p(this,Tt,e.scrollTop);const o=h(a=>{if(!t(this,bt))return;const c=t(this,L).track.getBoundingClientRect(),l=t(this,L).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,qt),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,Tt)+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,bt,!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,nt,this.getRootNode().host),p(this,rt,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,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 f=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,F).set(i,f)});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 f;if(i)return;i=!0;const l=c.scrollTop,u=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!==u&&(r.scrollLeft=u),o&&o.scrollLeft!==u&&(o.scrollLeft=u),t(this,mt).call(this,l),(f=t(this,E).querySelector("nine-table-vscrollbar"))==null||f.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 u=0;const f=s.querySelectorAll("tr");return f.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}u+=g}),f.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,u<=0?-1:(p(this,O,u),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,u,f,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=[((u=g[x])==null?void 0:u.getBoundingClientRect().height)||0,((f=m[x])==null?void 0:f.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((u,f)=>{const b=n+Math.floor(f/i);if(b>=c){u.style.visibility="hidden";return}const g=t(this,j).data.get(b);u.style.display="",t(this,$t).call(this,u,g,b)})})},"#adjustBufferRows"));d(this,mt,h(n=>{var f,b;const e=t(this,O);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((f=t(this,F).get(".ng-container-body"))==null?void 0:f.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,u=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)`}),u!==a&&(y.log(`🔄 [Row Bind Trigger] currentStartIndex(${u}) !== 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,u;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 f=0;f<a;f++){const b=[((c=r[f])==null?void 0:c.getBoundingClientRect().height)||0,((l=o[f])==null?void 0:l.getBoundingClientRect().height)||0,((u=i[f])==null?void 0:u.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[f]&&(r[f].style.height=`${g}px`),o[f]&&(o[f].style.height=`${g}px`),i[f]&&(i[f].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 u=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let f=`cell-${u}`;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=`<${f} ${S.join(" ")}></${f}>`}),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,u=document.createElement("colgroup"),f=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",f),u.appendChild(g)}a.prepend(u)}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")),u=Array.from(a.querySelectorAll(c+" th,"+c+" td")),f=l.length;if(f===0||u.length===0)return;let b=0;u.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(f),()=>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<f&&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(u=>{u.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(()=>{var a;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(c=>{c.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(l=>{l.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),(a=o[0])==null||a.offsetHeight,n<0||e<0){y.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let i=0;o.forEach(c=>{c.querySelectorAll("tbody tr").forEach(l=>{const{matrixRow:u}=pt(this,U,Ut).call(this,l);u<0||l.querySelectorAll("td, th").forEach(f=>{const b=parseInt(f.dataset.col,10);if(isNaN(b))return;const g=parseInt(f.rowSpan||1,10),m=parseInt(f.colSpan||1,10),v=u+g-1,S=b+m-1;v>=n&&u<=s&&S>=e&&b<=r&&(i++,f.classList.add("selected"),y.log(f,n,e,s,r),u<=n&&f.classList.add("selected-top"),v>=s&&f.classList.add("selected-bottom"),b<=e&&f.classList.add("selected-left"),S>=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 u=!0,f=0;for(;u&&f<5;)u=!1,f++,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,u=!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(f=>{const b=document.elementFromPoint(f.clientX,f.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(f.clientX>=q.left&&f.clientX<=q.right&&f.clientY>=q.top&&f.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"),u=h(()=>{y.log("🖱️ [MouseUp] Drag ended."),t(this,_).style.userSelect="",t(this,_).style.webkitUserSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)},"onMouseUp");document.addEventListener("mousemove",l),document.addEventListener("mouseup",u)})},"#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(f=>parseInt(f.dataset.row,10)===e),c=a.length>0?a.length:1,l=a.indexOf(r),u=e*c+(l>=0?l:0);y.log("====================",u,s,u,s),t(this,Z).selection.setRange(u,s,u,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,u=c.indexOf(s);let f=r,b=u,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(),u<l-1?b=u+1:(f=r+1,b=0);break;case"ArrowUp":n.preventDefault(),u>0?b=u-1:(f=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)===f)[b];if(x&&(m=x.querySelector(`[data-col="${g}"]`)),m)this.currentCell=m;else if(f!==r&&f>=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,f*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 u=document.createElement("tbody");u.className="fixed-tbody",o.appendChild(u)}}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,rt).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,Qt).call(this),this.refresh()},"initWhenReady");e()}};nt=new WeakMap,rt=new WeakMap,bt=new WeakMap,L=new WeakMap,qt=new WeakMap,Tt=new WeakMap,Qt=new WeakMap,h(Pe,"NineTableVScrollBar");let Et=Pe;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",Et);const Ue=class Ue{constructor(n){d(this,Y);d(this,E);d(this,ot);d(this,F,new Map);d(this,O,null);d(this,K,null);d(this,it,0);d(this,Ct,40);d(this,Fe,!1);d(this,je,!1);d(this,te,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,kt).call(this),t(this,Lt).call(this),t(this,pt).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,ot,{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,kt).call(this),t(this,Ht).call(this),t(this,Lt).call(this),t(this,pt).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,pt).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,ee,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,Ct);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});o?o.before(i):r.appendChild(i),e===".ng-container-body"&&(t(this,ot).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,kt,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,It).call(this),t(this,O))},"#measureAndCacheHeight"));d(this,Lt,h(()=>{y.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,Y).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,It,h(()=>{if(t(this,it)>0&&t(this,O)>0){const n=Math.ceil(t(this,it)/t(this,O));p(this,Ct,n+t(this,te))}},"#updateRowCount"));d(this,se,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,ne,h(()=>{!t(this,E)||!(t(this,E)instanceof HTMLElement)||(p(this,K,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,it)!==c&&(p(this,it,c),t(this,It).call(this),t(this,O)!==null&&(t(this,Ht).call(this),this.refresh()))}}})),t(this,K).observe(t(this,E)))},"#initResizeObserver"));d(this,Ht,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,ee).call(this,e,n)}),t(this,re).call(this),t(this,se).call(this)},"#renderAllContainers"));d(this,Ye,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,Y).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,Y).data.get(b);f.style.display="",t(this,Mt).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,pt,h(n=>{var u,b;const e=t(this,O);if(!e||e<=0)return;const s=t(this,Y).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,ot).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,ot))==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,Y).data.get(q);x.style.display="",t(this,Mt).call(this,x,N,q)})}))},"#handleScroll"));d(this,Mt,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,re,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,K)&&(t(this,K).disconnect(),p(this,K,null))},"destroy"));p(this,Y,n.getRootNode().host),p(this,E,n),t(this,ne).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}};Y=new WeakMap,E=new WeakMap,ot=new WeakMap,F=new WeakMap,O=new WeakMap,K=new WeakMap,it=new WeakMap,Ct=new WeakMap,Fe=new WeakMap,je=new WeakMap,te=new WeakMap,ee=new WeakMap,kt=new WeakMap,Lt=new WeakMap,It=new WeakMap,se=new WeakMap,ne=new WeakMap,Ht=new WeakMap,Ye=new WeakMap,pt=new WeakMap,Mt=new WeakMap,re=new WeakMap,h(Ue,"RowManager");let Ee=Ue;const oe=class oe{static compileAll(n){return Array.isArray(n)?n.map(e=>oe.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 Rt=0;Rt<q;Rt++)v+N<u&&S+Rt<b&&(g[v+N][S+Rt]=N===0&&Rt===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(oe,"TableCompiler");let qe=oe;const Ve=class Ve{constructor(n){d(this,V);d(this,_);d(this,U,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});C(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,U);y.log("🎨 [CellSelection.render] Rendering range ->",t(this,U));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}=gt(this,V,Gt).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),gt(this,V,ms).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,U).startRow>=0&&t(this,U).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}=gt(this,V,Gt).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 ds=Math.min(o,m),fs=Math.max(i,q),us=Math.min(a,S),gs=Math.max(c,N);(ds!==o||fs!==i||us!==a||gs!==c)&&(o=ds,i=fs,a=us,c=gs,f=!0)}})})});p(this,U,{startRow:o,startCol:a,endRow:i,endCol:c}),y.log("📦 [CellSelection.setRange] Final Range ->",t(this,U)),this.render()}};_=new WeakMap,U=new WeakMap,V=new WeakSet,Gt=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"),ms=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}=gt(this,V,Gt).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}=gt(this,V,Gt).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(Ve,"CellSelection");let Te=Ve;const Xe=class Xe{constructor(n){d(this,le);d(this,j);d(this,at,null);d(this,ie,-1);d(this,ae,-1);d(this,$t,h((n,e,s)=>{const r=t(this,_t).call(this,n,e);if(!r)return s+1;const o=Array.from(r.querySelectorAll("th, td"));let i=!1,a=s+1;for(const c of o){const l=parseInt(c.dataset.col,10),f=parseInt(c.colSpan||1,10);if(l===s){a=s+f,i=!0;break}}return i?a:s+1},"#getNextCol"));d(this,Nt,h((n,e,s)=>{const r=t(this,_t).call(this,n,e);if(!r)return Math.max(0,s-1);const o=Array.from(r.querySelectorAll("th, td"));let i=Math.max(0,s-1);for(const a of o){const c=parseInt(a.dataset.col,10),l=parseInt(a.colSpan||1,10);if(c+l===s){i=c;break}}return i},"#getPreviousCol"));d(this,_t,h((n,e)=>{const s=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");for(const r of s){const i=Array.from(r.querySelectorAll("tbody tr:not(.nodata)")).filter(a=>parseInt(a.dataset.row,10)===n);if(i[e])return i[e]}return null},"#findTargetTr"));d(this,Dt,h((n,e,s)=>{const r=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");for(const o of r){const c=Array.from(o.querySelectorAll("tbody tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===n)[e];if(c){const l=c.querySelector(`[data-col="${s}"]`);if(l&&window.getComputedStyle(l).display!=="none")return l}}return null},"#getNearElement"));p(this,j,n),gt(this,le,xs).call(this),y.log("🎯 [CellNavigation] Initialized")}get currentCell(){return t(this,at)}set currentCell(n){if(!n)return;p(this,at,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,ie,e),p(this,ae,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);t(this,j).selection.setRange(f,s,f,s)}}}moveCell(n){var v,S,x,k;if(!t(this,at))return;const e=t(this,at),s=e.closest("tr"),r=parseInt(e.dataset.row,10),o=parseInt(e.dataset.col,10),i=s==null?void 0:s.closest("tbody");if(!i)return;const c=Array.from(i.querySelectorAll("tr:not(.nodata)")).filter(q=>parseInt(q.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?t(this,Nt).call(this,r,f,o):t(this,$t).call(this,r,f,o);break;case"ArrowRight":g=t(this,$t).call(this,r,f,o);break;case"ArrowLeft":g=t(this,Nt).call(this,r,f,o);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=t(this,Dt).call(this,u,b,g);if(m)this.currentCell=m;else if(u!==r&&u>=0){const q=((S=(v=t(this,j)).getRowHeight)==null?void 0:S.call(v))||40;(k=(x=t(this,j)).scrollToY)==null||k.call(x,u*q),setTimeout(()=>{const N=t(this,Dt).call(this,u,b,g);N&&(this.currentCell=N)},0)}}};j=new WeakMap,at=new WeakMap,ie=new WeakMap,ae=new WeakMap,$t=new WeakMap,Nt=new WeakMap,_t=new WeakMap,Dt=new WeakMap,le=new WeakSet,xs=h(function(){t(this,j).addEventListener("keydown",n=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n.code)&&this.moveCell(n)})},"#initEvents"),h(Xe,"CellNavigation");let Ce=Xe;const zt=class zt extends HTMLElement{constructor(){super();d(this,ce);d(this,lt,null);d(this,ct);d(this,Ot);d(this,Wt);C(this,"invalidate",h(()=>{y.log("sheet.invalidate()"),t(this,ct).refresh()},"invalidate"));C(this,"generate",h(e=>{if(y.log("sheet.generate()"),!e)return;p(this,lt,qe.compile(e)),t(this,he).call(this),t(this,de).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,ct).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));d(this,he,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,yt).call(this,t(this,lt),r,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,yt).call(this,t(this,lt),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,yt).call(this,t(this,lt),r,"footer"))})},"#renderSplitContainers"));d(this,de,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,yt,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,ct).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,fe,h(()=>{t(this,ue).call(this),p(this,Ot,new Te(this)),p(this,Wt,new Ce(this))},"#init"));d(this,ue,h(()=>{const e=zt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;
@@ -321,7 +321,7 @@
321
321
  <nine-table-hscrollbar></nine-table-hscrollbar>
322
322
  <div class='ng-scroll-edge'></div>
323
323
  </div>
324
- `},"#render"));p(this,dt,new Se(this)),p(this,ie,this.getRootNode().host)}connectedCallback(){t(this,ce).call(this)}get selection(){return t(this,Nt)}get navigation(){return t(this,_t)}disconnectedCallback(){this.innerHTML="",y.log("NineTableSheet destroyed.")}};ie=new WeakMap,ht=new WeakMap,dt=new WeakMap,Nt=new WeakMap,_t=new WeakMap,ae=new WeakMap,le=new WeakMap,xt=new WeakMap,ce=new WeakMap,he=new WeakMap,h(Dt,"NineTableSheet"),C(Dt,"SCROLLBAR_SIZE",16);let Vt=Dt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Vt);const Ve=class Ve extends HTMLElement{constructor(){super();d(this,de,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var i;const r=s.ctrlKey||s.metaKey||s.shiftKey,o=parseInt((i=s.target.closest(".nine-tab-item"))==null?void 0:i.dataset.index,10);t(this,Ot).call(this,o,r)}),t(this,Ot).call(this,0,!1)},"#init"));d(this,Ot,h((e,s=!1)=>{const r=h(()=>{const u=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=u.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const m=parseInt(g.getAttribute("data-index"),10),v=this.querySelector(`nine-splitter[data-split-index="${m}"]`),S=u[m+1];v&&S&&S.classList.contains("active")&&v.style.setProperty("display","flex")})},"updateSplitters"),o=this.querySelector(".nine-tab-bar"),i=this.querySelector("nine-table-sheets-body"),a=o.querySelectorAll(".nine-tab-item"),c=i.querySelectorAll("nine-table-sheet");if(!a[e])return;if(!s)a.forEach((u,f)=>{u.classList.toggle("active",f===e)}),c.forEach((u,f)=>{const b=f===e;u.classList.toggle("active",b),u.style.flex=b?"1 1 100%":""});else{const u=a[e],f=o.querySelectorAll(".nine-tab-item.active");if(u.classList.contains("active")&&f.length<=1)return;u.classList.toggle("active");const b=i.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=i.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(u=>{u.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),r()},"#switchSheet"))}connectedCallback(){t(this,de).call(this)}};de=new WeakMap,Ot=new WeakMap,h(Ve,"NineTableSheets");let qe=Ve;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",qe);const Xe=class Xe{constructor(n){d(this,D);d(this,fe,h(()=>{t(this,ue).call(this),new ResizeObserver(n=>{for(let e of n)t(this,D).getAttribute("auto-height")==="true"&&t(this,Wt).call(this)}).observe(t(this,D))},"#init"));d(this,Wt,h(()=>{var c,l;const n=Array.from(t(this,D).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,D).getAttribute("max-display-row"),10)||10,s=Math.max(...n.map(u=>u.getRowHeight())),r=(c=t(this,D).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,o=(l=t(this,D).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,i=Vt.SCROLLBAR_SIZE,a=e*s+r+o+i;t(this,D).style.height=`${a}px`},"#applyAutoHeight"));d(this,ue,h(()=>{const e=Array.from(t(this,D).children).filter(c=>c.tagName==="TABLE"),s=t(this,D).getAttribute("auto-height")==="true",r=e.length,o=e.map((c,l)=>{const f=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<r-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return f+b}).join(""),i=e.map((c,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,D).shadowRoot.innerHTML=`
324
+ `},"#render"));p(this,ct,new Ee(this)),p(this,ce,this.getRootNode().host)}connectedCallback(){t(this,fe).call(this)}get selection(){return t(this,Ot)}get navigation(){return t(this,Wt)}disconnectedCallback(){this.innerHTML="",y.log("NineTableSheet destroyed.")}};ce=new WeakMap,lt=new WeakMap,ct=new WeakMap,Ot=new WeakMap,Wt=new WeakMap,he=new WeakMap,de=new WeakMap,yt=new WeakMap,fe=new WeakMap,ue=new WeakMap,h(zt,"NineTableSheet"),C(zt,"SCROLLBAR_SIZE",16);let Kt=zt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Kt);const Ge=class Ge extends HTMLElement{constructor(){super();d(this,ge,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var i;const r=s.ctrlKey||s.metaKey||s.shiftKey,o=parseInt((i=s.target.closest(".nine-tab-item"))==null?void 0:i.dataset.index,10);t(this,Bt).call(this,o,r)}),t(this,Bt).call(this,0,!1)},"#init"));d(this,Bt,h((e,s=!1)=>{const r=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const m=parseInt(g.getAttribute("data-index"),10),v=this.querySelector(`nine-splitter[data-split-index="${m}"]`),S=f[m+1];v&&S&&S.classList.contains("active")&&v.style.setProperty("display","flex")})},"updateSplitters"),o=this.querySelector(".nine-tab-bar"),i=this.querySelector("nine-table-sheets-body"),a=o.querySelectorAll(".nine-tab-item"),c=i.querySelectorAll("nine-table-sheet");if(!a[e])return;if(!s)a.forEach((f,u)=>{f.classList.toggle("active",u===e)}),c.forEach((f,u)=>{const b=u===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=a[e],u=o.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const b=i.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=i.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(f=>{f.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),r()},"#switchSheet"))}connectedCallback(){t(this,ge).call(this)}};ge=new WeakMap,Bt=new WeakMap,h(Ge,"NineTableSheets");let ke=Ge;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ke);const Ke=class Ke{constructor(n){d(this,D);d(this,be,h(()=>{t(this,pe).call(this),new ResizeObserver(n=>{for(let e of n)t(this,D).getAttribute("auto-height")==="true"&&t(this,Pt).call(this)}).observe(t(this,D))},"#init"));d(this,Pt,h(()=>{var c,l;const n=Array.from(t(this,D).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,D).getAttribute("max-display-row"),10)||10,s=Math.max(...n.map(f=>f.getRowHeight())),r=(c=t(this,D).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,o=(l=t(this,D).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,i=Kt.SCROLLBAR_SIZE,a=e*s+r+o+i;t(this,D).style.height=`${a}px`},"#applyAutoHeight"));d(this,pe,h(()=>{const e=Array.from(t(this,D).children).filter(c=>c.tagName==="TABLE"),s=t(this,D).getAttribute("auto-height")==="true",r=e.length,o=e.map((c,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<r-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+b}).join(""),i=e.map((c,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,D).shadowRoot.innerHTML=`
325
325
  <style>
326
326
  :host {
327
327
  display: flex;
@@ -441,10 +441,10 @@
441
441
  <nine-table-analysis></nine-table-analysis>
442
442
  </nine-table-body>
443
443
  <nine-table-footer></nine-table-footer>
444
- `,t(this,D).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,D).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Wt).call(this)})})},"#render"));p(this,D,n),t(this,fe).call(this)}};D=new WeakMap,fe=new WeakMap,Wt=new WeakMap,ue=new WeakMap,h(Xe,"LayoutManager");let Te=Xe;const Ke=class Ke{constructor(n){d(this,zt);d(this,wt,-1);C(this,"count",h(()=>t(this,zt).rawRecords.length,"count"));p(this,zt,n)}get at(){return t(this,wt)}set at(n){p(this,wt,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,wt)}"]`)&&setTimeout(()=>{})}};zt=new WeakMap,wt=new WeakMap,h(Ke,"ngRow");let Ce=Ke;const B=class B{constructor(n,e){d(this,W);d(this,I);d(this,z,[]);d(this,vt,[]);d(this,ge,0);d(this,J,[]);d(this,be,h(()=>{p(this,J,[]);const n=t(this,W).template||[];Array.from(n).forEach(e=>{var s;t(this,J).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,I).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Bt).call(this)),e.__ng.height=t(this,J).slice()})},"#initialize"));d(this,ft,h(()=>{const n=t(this,W).shadowRoot.querySelector("nine-table-sheets");n==null||n.classList.toggle("nodata",this.length===0),t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));C(this,"get",h((n,e)=>{var o;const s=this.getValidData();if(!s||s.length<=0)return;if(n==null)return t(this,St).call(this,s);if(n<0||n>=s.length)return null;const r=typeof((o=t(this,W).fields)==null?void 0:o.get)=="function"?t(this,W).fields.get():[];if(e!=null){const i=r.indexOf(e);return i>=0?s[n].v[i]:null}return t(this,St).call(this,s[n])},"get"));C(this,"set",h(n=>{this.clear(),this.add(n,!1),t(this,ft).call(this)},"set"));d(this,Bt,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,J).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,J).slice(),-1,{},{}]}),"#getDefaultMeta"));C(this,"reset",h(()=>{p(this,z,[]),p(this,vt,[]),t(this,ft).call(this)},"reset"));C(this,"clear",h(()=>{var n;t(this,I).rawRecords=[],p(this,z,[]),p(this,vt,[]),(n=t(this,I).viewRecords)!=null&&n.reset&&t(this,I).viewRecords.reset()},"clear"));d(this,pe,h(n=>{var r;Array.isArray(n)||(n=[n]);const e=typeof((r=t(this,W).fields)==null?void 0:r.get)=="function"?t(this,W).fields.get():Object.keys(n[0]||{}),s=[];return n.forEach(o=>{const i={v:[]};e.forEach(a=>{i.v.push(o[a]!==void 0&&o[a]!==null?o[a]:"")}),s.push(i)}),s},"#json2Array"));d(this,ye,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,Bt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));C(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const s=t(this,pe).call(this,n);t(this,I).rawRecords=t(this,I).rawRecords.concat(t(this,ye).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((o,i)=>{const a=t(this,I).rawRecords[r-i];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,ft).call(this),r},"add"));C(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,I).host.row.at]:e=[parseInt(n,10)],e.sort((s,r)=>r-s).forEach(s=>{if(t(this,z)[s]){const r=t(this,z)[s].__ng.rowid;t(this,z)[s].__ng.rowState===B.ROW_STATE.INSERT?t(this,I).rawRecords=t(this,I).rawRecords.filter(o=>o.__ng.rowid!==r):t(this,I).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,ft).call(this)},"delete"));C(this,"setValue",h((n,e,s)=>{var c;n=parseInt(n,10);const o=(typeof((c=t(this,W).fields)==null?void 0:c.get)=="function"?t(this,W).fields.get():[]).indexOf(e);if(o<0)return;const i=this.getValidData()[n];if(!i)return;const a=i.v[o];a!==s&&i.__ng.rowState!==B.ROW_STATE.INSERT&&(i.__ng.o.hasOwnProperty(e)||(i.__ng.o[e]=a),i.__ng.rowState=B.ROW_STATE.UPDATE),i.v[o]=s},"setValue"));C(this,"resetRecords",h(()=>{p(this,vt,t(this,I).rawRecords.filter(n=>!n.__ng.deleted)),p(this,z,t(this,I).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,I).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,z).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));C(this,"getValidData",h(()=>(t(this,z).length===0&&t(this,I).rawRecords.length>0&&this.resetRecords(),t(this,z)),"getValidData"));d(this,St,h(n=>{var i;if(!n)return n;const e=!Array.isArray(n),s=e?[n]:n,r=typeof((i=t(this,W).fields)==null?void 0:i.get)=="function"?t(this,W).fields.get():[],o=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return r.forEach((l,u)=>{c[l]=a.v?a.v[u]:a[l]}),c.__ng=a.__ng,c});return e?o[0]:o},"#conv"));C(this,"count",h(()=>this.getValidData().length,"count"));p(this,W,n),p(this,I,e),t(this,be).call(this)}get source(){return t(this,St).call(this,t(this,I).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++gs(this,ge)._}get count(){return t(this,z).length}get length(){return t(this,z).length}getRowCount(){return this.length}};W=new WeakMap,I=new WeakMap,z=new WeakMap,vt=new WeakMap,ge=new WeakMap,J=new WeakMap,be=new WeakMap,ft=new WeakMap,Bt=new WeakMap,pe=new WeakMap,ye=new WeakMap,St=new WeakMap,h(B,"ngData"),C(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ke=B;const Ge=class Ge{constructor(n){d(this,ut);p(this,ut,n),this.row=new Ce(this),this.data=new ke(t(this,ut),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,ut).view)!=null&&e.redraw&&t(this,ut).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var r,o;const s=parseInt(e,10);if(!(s>=this.data.count()))return(o=(r=this.data.getValidData()[s])==null?void 0:r.__ng)==null?void 0:o.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,r)=>{e=parseInt(e,10),this.data.setValue(e,s,r)},this.setDataSource([])}};ut=new WeakMap,h(Ge,"ngDataManager");let Le=Ge;const Ze=class Ze{constructor(n){d(this,Rt);d(this,M,[]);C(this,"add",h((n,e="string")=>{n.forEach(s=>{t(this,M).some(r=>r.name===s)||t(this,M).push({name:s,type:e})}),t(this,Pt).call(this)},"add"));d(this,Pt,h(()=>{const n=new Map;t(this,M).forEach(e=>{n.set(e.name,e.type)}),p(this,M,Array.from(n,([e,s])=>({name:e,type:s}))),p(this,M,t(this,M).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,M).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,me,h(()=>{p(this,M,[]),y.log(t(this,Rt).querySelectorAll("table"));const n=Array.from(t(this,Rt).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)y.log(e),$("[data-bind]",e).each((s,r)=>{const o=r.dataset.bind,i=r.getAttribute("data-type")||"string";o&&t(this,M).push({name:o,type:i})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((r,o)=>{var i=o.getAttribute(s);if(i.indexOf("data.")<0){const a=i.search(/[(]/g);if(a>0)try{i=String(window[i.substring(0,a).trim()])}catch{i=""}}i.split("data.").forEach(a=>{if(a.trim()!=""){const c=a.search(/[^_A-Za-z0-9]/g);let l="";c>=0?l=a.substring(0,c):i.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,M).push({name:l,type:"string"})}})})});t(this,Pt).call(this)}},"#init"));p(this,Rt,n),t(this,me).call(this)}get(){return t(this,M).map(n=>n.name)}getFields(){return t(this,M)}getType(n){const e=t(this,M).find(s=>s.name===n);return e?e.type:"string"}indexOf(n){return t(this,M).findIndex(e=>e.name===n)}includes(n){return t(this,M).some(e=>e.name===n)}};Rt=new WeakMap,M=new WeakMap,Pt=new WeakMap,me=new WeakMap,h(Ze,"ngFields");let Ie=Ze;const Je=class Je extends HTMLElement{constructor(){super();d(this,gt);d(this,xe);d(this,we,h(()=>{this.fields=new Ie(this),p(this,xe,new Te(this)),y.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),p(this,gt,new Le(this))}connectedCallback(){t(this,we).call(this)}disconnectedCallback(){y.log("NineTable disconnected.")}get data(){return t(this,gt).data}get row(){return t(this,gt).row}get dataManager(){return t(this,gt)}};gt=new WeakMap,xe=new WeakMap,we=new WeakMap,h(Je,"NineTable");let He=Je;customElements.get("nine-table")||customElements.define("nine-table",He);const Ft=class Ft extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Ft,"BasicCellElement"),C(Ft,"_styleCache",new Map),C(Ft,"_customStyleCache",new Map);let Me=Ft;const rs=class rs extends Me{constructor(){super();d(this,H);d(this,jt);d(this,w);d(this,Qe);d(this,ts);d(this,es);d(this,ss);C(this,"getDisplayText",h(e=>{if(t(this,w))if(t(this,w).closest("tbody")){const s=t(this,w).closest("tr").data,r=parseInt(t(this,w).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,w).dataset.expr)){if(!ninegrid.isNull(t(this,w).dataset.bind))return s[t(this,w).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,w).dataset.expr,s,r,t(this,w))}catch{console.error(t(this,w).dataset.expr,s,t(this,w).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,H).exprFunction(t(this,w).dataset.expr).call(this,null,-1,t(this,H).data)}catch{}},"getDisplayText"));d(this,ns,h(()=>{if(!(!t(this,H)||!t(this,H).template||!t(this,w).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,w)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,w).closest("tr"),r=[];$("th,td",s).each((x,k)=>{var q=ninegrid.j.querySelectorAll(k).attr("suppress");q&&k.dataset.row&&(q=parseInt(q),!isNaN(q)&&q<=e&&r.push(q))}),r.sort();var o=!1;if(parseInt(s.sectionRowIndex/t(this,H).template.length)>0)for(var i of r){if(i>e)break;var a=parseInt(t(this,w).dataset.row),c=a-1,l=t(this,w).closest("tr").data,u=t(this,H).data.get(c);t(this,w).dataset.matrixRow;var f=t(this,H).body.querySelector(`tbody.bindable [suppress="${i}"][data-matrix-row="${t(this,w).dataset.matrixRow}"]`),b=f.dataset.expr?this.getExprValue(f.dataset.expr,l,a):l[f.dataset.bind],g=f.dataset.expr?this.getExprValue(f.dataset.expr,u,c):u[f.dataset.bind];if(b!=g){o=!0;break}}else o=!0;o?ninegrid.j.querySelectorAll(t(this,w)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,w)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,w)).hasClass("hidden")||(o?ninegrid.j.querySelectorAll(t(this,w)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,w)).addClass("hidden"));var m=parseInt(t(this,w).dataset.matrixRow),v=m-1,S=t(this,H).body.querySelector(`tbody.bindable [data-col="${t(this,w).dataset.col}"][data-matrix-row="${v}"]`);$(S).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,w)).hasClass("suppress")?ninegrid.j.querySelectorAll(S).removeClass("last-none-suppress").addClass("last-suppress"):!$(S).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,w)).hasClass("suppress")?ninegrid.j.querySelectorAll(S).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(S).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));C(this,"getExprValue",h((e,s,r,o)=>{if(typeof e<"u")try{r=parseInt(r);const i=e.replace("()","");return t(this,H)[i]?t(this,H)[i].call(this,s,r,t(this,w)):t(this,H).exprFunction(e).call(this,s,r,t(this,H).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),p(this,H,this.getRootNode().host),p(this,w,this.closest("th,td")),p(this,jt,t(this,w).closest("tr"))}get value(){var e=!t(this,H)||!t(this,H).dataManager||!t(this,w)||!t(this,w).dataset||!t(this,w).dataset.row||!t(this,w).dataset.bind?"":t(this,w).closest("tr").data[t(this,w).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,w).dataset.row);const r=this.getAttribute("update-row-state")!="false";s<0?t(this,H).data.setValueNF(parseInt(t(this,w).dataset.index),t(this,w).dataset.bind,e,r):t(this,H).data.setValue(s,t(this,w).dataset.bind,e,r)}get row(){return parseInt(t(this,w).dataset.row)}get data(){return t(this,w).closest("tr").data}refresh(){const e=t(this,w).dataset.bind;return parseInt(t(this,w).dataset.row),t(this,jt).data[e]}};H=new WeakMap,jt=new WeakMap,w=new WeakMap,Qe=new WeakMap,ts=new WeakMap,es=new WeakMap,ss=new WeakMap,ns=new WeakMap,h(rs,"CellElement");let $e=rs;const os=class os extends $e{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(os,"EditableCellElement");let Ne=os;const as=class as extends Ne{constructor(){super();d(this,Yt);d(this,bt);d(this,At);d(this,Et);d(this,ve);d(this,Q);C(this,"refresh",h(()=>{const e=super.refresh();t(this,Yt).value=e},"refresh"));d(this,is,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,bt)=="number"){let o=[];if(t(this,Q)&&Number(t(this,Q))>0&&o.push("."),t(this,Et)&&Number(t(this,Et))>=0&&o.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!o.includes(e.key)&&e.preventDefault(),t(this,Q)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,r=s.indexOf(".");if(r>=0){var s=s.substr(r+1,s.length);s.length>=Number(t(this,Q))&&e.preventDefault()}}}t(this,At)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,At))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),p(this,bt,this.getAttribute("type")||"text"),p(this,At,this.getAttribute("maxbyte")),p(this,Et,this.getAttribute("min")),p(this,ve,this.getAttribute("max")),p(this,Q,this.getAttribute("scale")),!["text","number"].includes(t(this,bt)))throw`invalid type : ${t(this,bt)}`}connectedCallback(){for(var e=[],s=0;s<this.attributes.length;s++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[s].name)&&e.push(`${this.attributes[s].name}="${this.attributes[s].value}"`);this.innerHTML=`
444
+ `,t(this,D).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,D).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Pt).call(this)})})},"#render"));p(this,D,n),t(this,be).call(this)}};D=new WeakMap,be=new WeakMap,Pt=new WeakMap,pe=new WeakMap,h(Ke,"LayoutManager");let Le=Ke;const Ze=class Ze{constructor(n){d(this,Ft);d(this,mt,-1);C(this,"count",h(()=>t(this,Ft).rawRecords.length,"count"));p(this,Ft,n)}get at(){return t(this,mt)}set at(n){p(this,mt,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,mt)}"]`)&&setTimeout(()=>{})}};Ft=new WeakMap,mt=new WeakMap,h(Ze,"ngRow");let Ie=Ze;const B=class B{constructor(n,e){d(this,W);d(this,I);d(this,z,[]);d(this,xt,[]);d(this,ye,0);d(this,Z,[]);d(this,me,h(()=>{p(this,Z,[]);const n=t(this,W).template||[];Array.from(n).forEach(e=>{var s;t(this,Z).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,I).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,jt).call(this)),e.__ng.height=t(this,Z).slice()})},"#initialize"));d(this,ht,h(()=>{const n=t(this,W).shadowRoot.querySelector("nine-table-sheets");n==null||n.classList.toggle("nodata",this.length===0),t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));C(this,"get",h((n,e)=>{var o;const s=this.getValidData();if(!s||s.length<=0)return;if(n==null)return t(this,wt).call(this,s);if(n<0||n>=s.length)return null;const r=typeof((o=t(this,W).fields)==null?void 0:o.get)=="function"?t(this,W).fields.get():[];if(e!=null){const i=r.indexOf(e);return i>=0?s[n].v[i]:null}return t(this,wt).call(this,s[n])},"get"));C(this,"set",h(n=>{this.clear(),this.add(n,!1),t(this,ht).call(this)},"set"));d(this,jt,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,Z).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,Z).slice(),-1,{},{}]}),"#getDefaultMeta"));C(this,"reset",h(()=>{p(this,z,[]),p(this,xt,[]),t(this,ht).call(this)},"reset"));C(this,"clear",h(()=>{var n;t(this,I).rawRecords=[],p(this,z,[]),p(this,xt,[]),(n=t(this,I).viewRecords)!=null&&n.reset&&t(this,I).viewRecords.reset()},"clear"));d(this,xe,h(n=>{var r;Array.isArray(n)||(n=[n]);const e=typeof((r=t(this,W).fields)==null?void 0:r.get)=="function"?t(this,W).fields.get():Object.keys(n[0]||{}),s=[];return n.forEach(o=>{const i={v:[]};e.forEach(a=>{i.v.push(o[a]!==void 0&&o[a]!==null?o[a]:"")}),s.push(i)}),s},"#json2Array"));d(this,we,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,jt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));C(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const s=t(this,xe).call(this,n);t(this,I).rawRecords=t(this,I).rawRecords.concat(t(this,we).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((o,i)=>{const a=t(this,I).rawRecords[r-i];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,ht).call(this),r},"add"));C(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,I).host.row.at]:e=[parseInt(n,10)],e.sort((s,r)=>r-s).forEach(s=>{if(t(this,z)[s]){const r=t(this,z)[s].__ng.rowid;t(this,z)[s].__ng.rowState===B.ROW_STATE.INSERT?t(this,I).rawRecords=t(this,I).rawRecords.filter(o=>o.__ng.rowid!==r):t(this,I).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,ht).call(this)},"delete"));C(this,"setValue",h((n,e,s)=>{var c;n=parseInt(n,10);const o=(typeof((c=t(this,W).fields)==null?void 0:c.get)=="function"?t(this,W).fields.get():[]).indexOf(e);if(o<0)return;const i=this.getValidData()[n];if(!i)return;const a=i.v[o];a!==s&&i.__ng.rowState!==B.ROW_STATE.INSERT&&(i.__ng.o.hasOwnProperty(e)||(i.__ng.o[e]=a),i.__ng.rowState=B.ROW_STATE.UPDATE),i.v[o]=s},"setValue"));C(this,"resetRecords",h(()=>{p(this,xt,t(this,I).rawRecords.filter(n=>!n.__ng.deleted)),p(this,z,t(this,I).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,I).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,z).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));C(this,"getValidData",h(()=>(t(this,z).length===0&&t(this,I).rawRecords.length>0&&this.resetRecords(),t(this,z)),"getValidData"));d(this,wt,h(n=>{var i;if(!n)return n;const e=!Array.isArray(n),s=e?[n]:n,r=typeof((i=t(this,W).fields)==null?void 0:i.get)=="function"?t(this,W).fields.get():[],o=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return r.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?o[0]:o},"#conv"));C(this,"count",h(()=>this.getValidData().length,"count"));p(this,W,n),p(this,I,e),t(this,me).call(this)}get source(){return t(this,wt).call(this,t(this,I).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++ys(this,ye)._}get count(){return t(this,z).length}get length(){return t(this,z).length}getRowCount(){return this.length}};W=new WeakMap,I=new WeakMap,z=new WeakMap,xt=new WeakMap,ye=new WeakMap,Z=new WeakMap,me=new WeakMap,ht=new WeakMap,jt=new WeakMap,xe=new WeakMap,we=new WeakMap,wt=new WeakMap,h(B,"ngData"),C(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let He=B;const Je=class Je{constructor(n){d(this,dt);p(this,dt,n),this.row=new Ie(this),this.data=new He(t(this,dt),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,dt).view)!=null&&e.redraw&&t(this,dt).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var r,o;const s=parseInt(e,10);if(!(s>=this.data.count()))return(o=(r=this.data.getValidData()[s])==null?void 0:r.__ng)==null?void 0:o.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,r)=>{e=parseInt(e,10),this.data.setValue(e,s,r)},this.setDataSource([])}};dt=new WeakMap,h(Je,"ngDataManager");let Me=Je;const Qe=class Qe{constructor(n){d(this,vt);d(this,M,[]);C(this,"add",h((n,e="string")=>{n.forEach(s=>{t(this,M).some(r=>r.name===s)||t(this,M).push({name:s,type:e})}),t(this,Yt).call(this)},"add"));d(this,Yt,h(()=>{const n=new Map;t(this,M).forEach(e=>{n.set(e.name,e.type)}),p(this,M,Array.from(n,([e,s])=>({name:e,type:s}))),p(this,M,t(this,M).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,M).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,ve,h(()=>{p(this,M,[]),y.log(t(this,vt).querySelectorAll("table"));const n=Array.from(t(this,vt).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)y.log(e),$("[data-bind]",e).each((s,r)=>{const o=r.dataset.bind,i=r.getAttribute("data-type")||"string";o&&t(this,M).push({name:o,type:i})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((r,o)=>{var i=o.getAttribute(s);if(i.indexOf("data.")<0){const a=i.search(/[(]/g);if(a>0)try{i=String(window[i.substring(0,a).trim()])}catch{i=""}}i.split("data.").forEach(a=>{if(a.trim()!=""){const c=a.search(/[^_A-Za-z0-9]/g);let l="";c>=0?l=a.substring(0,c):i.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,M).push({name:l,type:"string"})}})})});t(this,Yt).call(this)}},"#init"));p(this,vt,n),t(this,ve).call(this)}get(){return t(this,M).map(n=>n.name)}getFields(){return t(this,M)}getType(n){const e=t(this,M).find(s=>s.name===n);return e?e.type:"string"}indexOf(n){return t(this,M).findIndex(e=>e.name===n)}includes(n){return t(this,M).some(e=>e.name===n)}};vt=new WeakMap,M=new WeakMap,Yt=new WeakMap,ve=new WeakMap,h(Qe,"ngFields");let $e=Qe;const ts=class ts extends HTMLElement{constructor(){super();d(this,ft);d(this,Se);d(this,Ae,h(()=>{this.fields=new $e(this),p(this,Se,new Le(this)),y.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),p(this,ft,new Me(this))}connectedCallback(){t(this,Ae).call(this)}disconnectedCallback(){y.log("NineTable disconnected.")}get data(){return t(this,ft).data}get row(){return t(this,ft).row}get dataManager(){return t(this,ft)}};ft=new WeakMap,Se=new WeakMap,Ae=new WeakMap,h(ts,"NineTable");let Ne=ts;customElements.get("nine-table")||customElements.define("nine-table",Ne);const Ut=class Ut extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Ut,"BasicCellElement"),C(Ut,"_styleCache",new Map),C(Ut,"_customStyleCache",new Map);let _e=Ut;const is=class is extends _e{constructor(){super();d(this,H);d(this,Vt);d(this,w);d(this,es);d(this,ss);d(this,ns);d(this,rs);C(this,"getDisplayText",h(e=>{if(t(this,w))if(t(this,w).closest("tbody")){const s=t(this,w).closest("tr").data,r=parseInt(t(this,w).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,w).dataset.expr)){if(!ninegrid.isNull(t(this,w).dataset.bind))return s[t(this,w).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,w).dataset.expr,s,r,t(this,w))}catch{console.error(t(this,w).dataset.expr,s,t(this,w).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,H).exprFunction(t(this,w).dataset.expr).call(this,null,-1,t(this,H).data)}catch{}},"getDisplayText"));d(this,os,h(()=>{if(!(!t(this,H)||!t(this,H).template||!t(this,w).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,w)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,w).closest("tr"),r=[];$("th,td",s).each((x,k)=>{var q=ninegrid.j.querySelectorAll(k).attr("suppress");q&&k.dataset.row&&(q=parseInt(q),!isNaN(q)&&q<=e&&r.push(q))}),r.sort();var o=!1;if(parseInt(s.sectionRowIndex/t(this,H).template.length)>0)for(var i of r){if(i>e)break;var a=parseInt(t(this,w).dataset.row),c=a-1,l=t(this,w).closest("tr").data,f=t(this,H).data.get(c);t(this,w).dataset.matrixRow;var u=t(this,H).body.querySelector(`tbody.bindable [suppress="${i}"][data-matrix-row="${t(this,w).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,c):f[u.dataset.bind];if(b!=g){o=!0;break}}else o=!0;o?ninegrid.j.querySelectorAll(t(this,w)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,w)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,w)).hasClass("hidden")||(o?ninegrid.j.querySelectorAll(t(this,w)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,w)).addClass("hidden"));var m=parseInt(t(this,w).dataset.matrixRow),v=m-1,S=t(this,H).body.querySelector(`tbody.bindable [data-col="${t(this,w).dataset.col}"][data-matrix-row="${v}"]`);$(S).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,w)).hasClass("suppress")?ninegrid.j.querySelectorAll(S).removeClass("last-none-suppress").addClass("last-suppress"):!$(S).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,w)).hasClass("suppress")?ninegrid.j.querySelectorAll(S).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(S).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));C(this,"getExprValue",h((e,s,r,o)=>{if(typeof e<"u")try{r=parseInt(r);const i=e.replace("()","");return t(this,H)[i]?t(this,H)[i].call(this,s,r,t(this,w)):t(this,H).exprFunction(e).call(this,s,r,t(this,H).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),p(this,H,this.getRootNode().host),p(this,w,this.closest("th,td")),p(this,Vt,t(this,w).closest("tr"))}get value(){var e=!t(this,H)||!t(this,H).dataManager||!t(this,w)||!t(this,w).dataset||!t(this,w).dataset.row||!t(this,w).dataset.bind?"":t(this,w).closest("tr").data[t(this,w).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,w).dataset.row);const r=this.getAttribute("update-row-state")!="false";s<0?t(this,H).data.setValueNF(parseInt(t(this,w).dataset.index),t(this,w).dataset.bind,e,r):t(this,H).data.setValue(s,t(this,w).dataset.bind,e,r)}get row(){return parseInt(t(this,w).dataset.row)}get data(){return t(this,w).closest("tr").data}refresh(){const e=t(this,w).dataset.bind;return parseInt(t(this,w).dataset.row),t(this,Vt).data[e]}};H=new WeakMap,Vt=new WeakMap,w=new WeakMap,es=new WeakMap,ss=new WeakMap,ns=new WeakMap,rs=new WeakMap,os=new WeakMap,h(is,"CellElement");let De=is;const as=class as extends De{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(as,"EditableCellElement");let Oe=as;const cs=class cs extends Oe{constructor(){super();d(this,Xt);d(this,ut);d(this,St);d(this,At);d(this,Re);d(this,J);C(this,"refresh",h(()=>{const e=super.refresh();t(this,Xt).value=e},"refresh"));d(this,ls,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,ut)=="number"){let o=[];if(t(this,J)&&Number(t(this,J))>0&&o.push("."),t(this,At)&&Number(t(this,At))>=0&&o.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!o.includes(e.key)&&e.preventDefault(),t(this,J)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,r=s.indexOf(".");if(r>=0){var s=s.substr(r+1,s.length);s.length>=Number(t(this,J))&&e.preventDefault()}}}t(this,St)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,St))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),p(this,ut,this.getAttribute("type")||"text"),p(this,St,this.getAttribute("maxbyte")),p(this,At,this.getAttribute("min")),p(this,Re,this.getAttribute("max")),p(this,J,this.getAttribute("scale")),!["text","number"].includes(t(this,ut)))throw`invalid type : ${t(this,ut)}`}connectedCallback(){for(var e=[],s=0;s<this.attributes.length;s++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[s].name)&&e.push(`${this.attributes[s].name}="${this.attributes[s].value}"`);this.innerHTML=`
445
445
  <input type="text"
446
446
  ${e.join(" ")}
447
447
  ondragstart="return false;"
448
448
  >
449
- `,super.connectedCallback(),p(this,Yt,this.querySelector("input"))}};Yt=new WeakMap,bt=new WeakMap,At=new WeakMap,Et=new WeakMap,ve=new WeakMap,Q=new WeakMap,is=new WeakMap,h(as,"CellInputText");let _e=as;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",_e)});
449
+ `,super.connectedCallback(),p(this,Xt,this.querySelector("input"))}};Xt=new WeakMap,ut=new WeakMap,St=new WeakMap,At=new WeakMap,Re=new WeakMap,J=new WeakMap,ls=new WeakMap,h(cs,"CellInputText");let We=cs;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",We)});
450
450
  //# sourceMappingURL=nine-table.umd.js.map