@ninebone/table 0.1.18 β†’ 0.1.20

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 xs=Object.defineProperty;var ws=A=>{throw TypeError(A)};var Es=(A,R,x)=>R in A?xs(A,R,{enumerable:!0,configurable:!0,writable:!0,value:x}):A[R]=x;var d=(A,R)=>xs(A,"name",{value:R,configurable:!0});var T=(A,R,x)=>Es(A,typeof R!="symbol"?R+"":R,x),gs=(A,R,x)=>R.has(A)||ws("Cannot "+x);var t=(A,R,x)=>(gs(A,R,"read from private field"),x?x.call(A):R.get(A)),h=(A,R,x)=>R.has(A)?ws("Cannot add the same private member more than once"):R instanceof WeakSet?R.add(A):R.set(A,x),y=(A,R,x,X)=>(gs(A,R,"write to private field"),X?X.call(A,x):R.set(A,x),x),Q=(A,R,x)=>(gs(A,R,"access private method"),x);var vs=(A,R,x,X)=>({set _(Tt){y(A,R,Tt,x)},get _(){return t(A,R,X)}});var F,K,q,tt,et,st,Jt,nt,Qt,rt,ot,pt,k,Ct,kt,te,it,E,at,U,D,Z,lt,Lt,Ve,Ye,ee,Xe,se,ne,It,Mt,Ht,re,oe,$t,yt,ie,ae,N,V,Y,Zt,Ss,B,ct,Nt,ce,he,mt,Rs,_t,Dt,Ot,ht,Ge,de,As,fe,dt,Wt,zt,j,ue,ge,xt,be,pe,ye,Pt,_,me,Ft,xe,jt,wt,O,L,z,vt,we,G,ve,ft,Ut,Se,Re,St,ut,Rt,H,Vt,Ae,gt,Ee,qe,I,Xt,v,os,is,as,ls,cs,Kt,bt,At,Et,Te,J,fs;const Fe=class Fe extends A.trace.constructor{constructor(){super(),this.init("nine-table","green")}};d(Fe,"Trace");let R=Fe;const x=new R,je=class je extends HTMLElement{constructor(){super();h(this,F);h(this,K,!1);h(this,q);h(this,tt);h(this,et);h(this,st);h(this,Jt,d(()=>{if(!t(this,F))return;const e=t(this,F).querySelector(".ng-container-body .ng-part-body");e&&(y(this,st,new ResizeObserver(()=>{this.refresh()})),t(this,st).observe(e))},"#observeResize"));T(this,"refresh",d(()=>{if(!t(this,F)||!t(this,q)||t(this,K))return;const e=t(this,q).container,s=e.querySelector("table");if(!s)return;const o=t(this,q).track,a=t(this,q).thumb,r=t(this,F).querySelector(".ng-container-bottom"),i=e.clientWidth,c=s.scrollWidth;if(i!==0&&c>i)r&&(r.style.display="flex");else{r&&(r.style.display="none");return}const l=o.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(i/c),l),20);a.style.width=`${f}px`;const g=e.scrollLeft,b=c-i;let u=0;b>0&&(u=parseInt(g/b*(l-f),10)),u<0&&(u=0);const p=l-f;u>p&&(u=p),a.style.left=`${u}px`,t(this,q).left.disabled=u===0,t(this,q).right.disabled=u>=p-1},"refresh"));h(this,nt,d(e=>{if(!t(this,q))return!1;const s=t(this,q).container,o=s.querySelector("table");if(!o)return!1;const a=t(this,q).track.getBoundingClientRect(),r=t(this,q).thumb.clientWidth;let i=e;i<0&&(i=0);const c=a.width-r;i>c&&(i=c),i=parseInt(i,10),t(this,q).thumb.style.left=`${i}px`,x.log("1111=========="),t(this,q).left.disabled=i===0,t(this,q).right.disabled=i>=c-1;const l=s.clientWidth,g=o.scrollWidth-l;return c>0&&g>0&&(s.scrollLeft=i/c*g),i>0&&i<c-1},"#thumbMoveTo"));h(this,Qt,d(()=>{const e=d(o=>{clearInterval(t(this,tt)),clearInterval(t(this,et));const a=parseInt(t(this,q).thumb.style.left||0,10);t(this,nt).call(this,a+o),y(this,tt,setInterval(()=>{clearInterval(t(this,tt)),y(this,et,setInterval(()=>{const r=parseInt(t(this,q).thumb.style.left||0,10);t(this,nt).call(this,r+o)||clearInterval(t(this,et))},50))},500))},"delayScroll"),s=d(()=>{clearInterval(t(this,tt)),clearInterval(t(this,et))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(o=>{t(this,q).left.addEventListener(o,s),t(this,q).right.addEventListener(o,s),t(this,q).track.addEventListener(o,s)}),t(this,q).left.addEventListener("mousedown",o=>{o.button===0&&e(-20)}),t(this,q).right.addEventListener("mousedown",o=>{o.button===0&&e(20)}),t(this,q).left.addEventListener("touchstart",()=>e(-20)),t(this,q).right.addEventListener("touchstart",()=>e(20)),t(this,q).track.addEventListener("mousedown",o=>{if(o.button!==0)return;o.preventDefault();const a=t(this,q).track.getBoundingClientRect(),r=t(this,q).thumb.clientWidth;t(this,nt).call(this,o.clientX-a.left-r/2)}),t(this,q).thumb.addEventListener("mousedown",o=>{if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),y(this,K,!0),this.shiftX=o.clientX-t(this,q).thumb.getBoundingClientRect().left;const a=d(i=>{if(!t(this,K))return;const c=t(this,q).track.getBoundingClientRect();t(this,nt).call(this,i.clientX-c.left-this.shiftX)},"onMouseMove"),r=d(()=>{y(this,K,!1),s(),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",r),this.refresh()},"onMouseUp");document.addEventListener("mousemove",a),document.addEventListener("mouseup",r)})},"#init"))}connectedCallback(){if(y(this,F,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,F))return;this.innerHTML=`
1
+ (function(E,R){typeof exports=="object"&&typeof module<"u"?R(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],R):(E=typeof globalThis<"u"?globalThis:E||self,R(E.NineboneUtil))})(this,function(E){"use strict";var vs=Object.defineProperty;var Ss=E=>{throw TypeError(E)};var Ts=(E,R,x)=>R in E?vs(E,R,{enumerable:!0,configurable:!0,writable:!0,value:x}):E[R]=x;var d=(E,R)=>vs(E,"name",{value:R,configurable:!0});var T=(E,R,x)=>Ts(E,typeof R!="symbol"?R+"":R,x),ps=(E,R,x)=>R.has(E)||Ss("Cannot "+x);var t=(E,R,x)=>(ps(E,R,"read from private field"),x?x.call(E):R.get(E)),h=(E,R,x)=>R.has(E)?Ss("Cannot add the same private member more than once"):R instanceof WeakSet?R.add(E):R.set(E,x),p=(E,R,x,K)=>(ps(E,R,"write to private field"),K?K.call(E,x):R.set(E,x),x),st=(E,R,x)=>(ps(E,R,"access private method"),x);var Rs=(E,R,x,K)=>({set _(Ct){p(E,R,Ct,x)},get _(){return t(E,R,K)}});var F,Z,q,rt,nt,ot,te,it,ee,at,lt,yt,k,kt,Lt,se,G,A,ct,U,D,J,ht,It,Ye,Xe,re,Ke,ne,oe,Mt,Ht,$t,ie,ae,Nt,dt,le,ce,M,ft,Y,Jt,As,H,_t,X,j,Je,Qe,mt,Es,de,Dt,Ot,Wt,zt,wt,fe,qs,ue,Q,Bt,Pt,V,ge,be,xt,pe,ye,me,jt,O,we,Vt,xe,Ut,vt,W,L,B,St,ve,tt,Se,ut,Yt,Re,Ae,Rt,gt,At,N,Xt,Ee,bt,qe,Te,I,Zt,w,as,ls,cs,hs,ds,Gt,pt,Et,qt,Ce,et,gs;const je=class je extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};d(je,"Trace");let R=je;const x=new R,Ve=class Ve extends HTMLElement{constructor(){super();h(this,F);h(this,Z,!1);h(this,q);h(this,rt);h(this,nt);h(this,ot);h(this,te,d(()=>{if(!t(this,F))return;const e=t(this,F).querySelector(".ng-container-body .ng-part-body");e&&(p(this,ot,new ResizeObserver(()=>{this.refresh()})),t(this,ot).observe(e))},"#observeResize"));T(this,"refresh",d(()=>{if(!t(this,F)||!t(this,q)||t(this,Z))return;const e=t(this,q).container,s=e.querySelector("table");if(!s)return;const n=t(this,q).track,o=t(this,q).thumb,i=t(this,F).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=n.clientWidth;if(l<=0)return;const u=Math.max(Math.min(l*(a/c),l),20);o.style.width=`${u}px`;const g=e.scrollLeft,b=c-a;let f=0;b>0&&(f=parseInt(g/b*(l-u),10)),f<0&&(f=0);const y=l-u;f>y&&(f=y),o.style.left=`${f}px`,t(this,q).left.disabled=f===0,t(this,q).right.disabled=f>=y-1},"refresh"));h(this,it,d(e=>{if(!t(this,q))return!1;const s=t(this,q).container,n=s.querySelector("table");if(!n)return!1;const o=t(this,q).track.getBoundingClientRect(),i=t(this,q).thumb.clientWidth;let a=e;a<0&&(a=0);const c=o.width-i;a>c&&(a=c),a=parseInt(a,10),t(this,q).thumb.style.left=`${a}px`,x.log("1111=========="),t(this,q).left.disabled=a===0,t(this,q).right.disabled=a>=c-1;const l=s.clientWidth,g=n.scrollWidth-l;return c>0&&g>0&&(s.scrollLeft=a/c*g),a>0&&a<c-1},"#thumbMoveTo"));h(this,ee,d(()=>{const e=d(n=>{clearInterval(t(this,rt)),clearInterval(t(this,nt));const o=parseInt(t(this,q).thumb.style.left||0,10);t(this,it).call(this,o+n),p(this,rt,setInterval(()=>{clearInterval(t(this,rt)),p(this,nt,setInterval(()=>{const i=parseInt(t(this,q).thumb.style.left||0,10);t(this,it).call(this,i+n)||clearInterval(t(this,nt))},50))},500))},"delayScroll"),s=d(()=>{clearInterval(t(this,rt)),clearInterval(t(this,nt))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{t(this,q).left.addEventListener(n,s),t(this,q).right.addEventListener(n,s),t(this,q).track.addEventListener(n,s)}),t(this,q).left.addEventListener("mousedown",n=>{n.button===0&&e(-20)}),t(this,q).right.addEventListener("mousedown",n=>{n.button===0&&e(20)}),t(this,q).left.addEventListener("touchstart",()=>e(-20)),t(this,q).right.addEventListener("touchstart",()=>e(20)),t(this,q).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const o=t(this,q).track.getBoundingClientRect(),i=t(this,q).thumb.clientWidth;t(this,it).call(this,n.clientX-o.left-i/2)}),t(this,q).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,Z,!0),this.shiftX=n.clientX-t(this,q).thumb.getBoundingClientRect().left;const o=d(a=>{if(!t(this,Z))return;const c=t(this,q).track.getBoundingClientRect();t(this,it).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),i=d(()=>{p(this,Z,!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,F,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,F))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=d(()=>{const s=t(this,F).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,q,{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,Qt).call(this),t(this,Jt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,st)&&t(this,st).disconnect()}};F=new WeakMap,K=new WeakMap,q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,Jt=new WeakMap,nt=new WeakMap,Qt=new WeakMap,d(je,"NineTableHScrollBar");let X=je;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",X);const Ue=class Ue extends HTMLElement{constructor(){super();h(this,rt);h(this,ot);h(this,pt,!1);h(this,k);h(this,Ct,0);h(this,kt,0);T(this,"refresh",d(()=>{if(!t(this,rt)||!t(this,k))return;const e=t(this,k).container,s=t(this,k).track,o=t(this,k).thumb,a=e.clientHeight,r=t(this,rt).data.length,i=t(this,ot).getRowHeight(),c=r*i;if(c<=a||r===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*(a/c),l),20);o.style.height=`${f}px`;const g=e.scrollTop,b=Math.max(c-a,1);let u=0;b>0&&(u=g/b*(l-f));const p=l-f;u<0&&(u=0),u>p&&(u=p),o.style.top=`${u}px`,t(this,k).top.disabled=g<=0,t(this,k).bottom.disabled=g>=b-1},"refresh"));h(this,te,d(()=>{x.log("nine-table-vscrollbar.#init");const e=t(this,k).container,s=d(()=>{const a=(t(this,rt).data.get()||[]).length,r=t(this,ot).getRowHeight();return a*r},"getContentHeight");t(this,k).thumb.addEventListener("mousedown",o=>{if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),y(this,pt,!0),y(this,Ct,o.clientY),y(this,kt,e.scrollTop);const a=d(i=>{if(!t(this,pt))return;const c=t(this,k).track.getBoundingClientRect(),l=t(this,k).thumb.clientHeight,g=c.height-l,b=i.clientY-t(this,Ct),u=e.clientHeight,p=s(),m=Math.max(p-u,1);if(g>0&&m>0){const S=b/g*m;let w=t(this,kt)+S;const M=Math.max(0,p-u);w<0&&(w=0),w>M&&(w=M),e.scrollTop=w}this.refresh()},"onMouseMove"),r=d(()=>{y(this,pt,!1),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",r),this.refresh()},"onMouseUp");document.addEventListener("mousemove",a),document.addEventListener("mouseup",r)}),t(this,k).track.addEventListener("mousedown",o=>{if(o.button!==0||o.target===t(this,k).thumb)return;const a=t(this,k).track.getBoundingClientRect(),r=t(this,k).thumb.clientHeight,i=o.clientY-a.top-r/2,l=a.height-r,f=e.clientHeight,g=s(),b=Math.max(g-f,1);if(l>0&&b>0){const u=Math.max(0,Math.min(1,i/l));e.scrollTop=u*b}this.refresh()}),t(this,k).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,k).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,rt,this.getRootNode().host),y(this,ot,this.closest("nine-table-sheet")),this.innerHTML=`
63
+ `;const e=d(()=>{const s=t(this,F).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,q,{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,Z)||this.refresh()}),t(this,ee).call(this),t(this,te).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,ot)&&t(this,ot).disconnect()}};F=new WeakMap,Z=new WeakMap,q=new WeakMap,rt=new WeakMap,nt=new WeakMap,ot=new WeakMap,te=new WeakMap,it=new WeakMap,ee=new WeakMap,d(Ve,"NineTableHScrollBar");let K=Ve;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",K);const Ue=class Ue extends HTMLElement{constructor(){super();h(this,at);h(this,lt);h(this,yt,!1);h(this,k);h(this,kt,0);h(this,Lt,0);T(this,"refresh",d(()=>{if(!t(this,at)||!t(this,k))return;const e=t(this,k).container,s=t(this,k).track,n=t(this,k).thumb,o=e.clientHeight,i=t(this,at).data.length,a=t(this,lt).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);n.style.height=`${u}px`;const g=e.scrollTop,b=Math.max(c-o,1);let f=0;b>0&&(f=g/b*(l-u));const y=l-u;f<0&&(f=0),f>y&&(f=y),n.style.top=`${f}px`,t(this,k).top.disabled=g<=0,t(this,k).bottom.disabled=g>=b-1},"refresh"));h(this,se,d(()=>{x.log("nine-table-vscrollbar.#init");const e=t(this,k).container,s=d(()=>{const o=(t(this,at).data.get()||[]).length,i=t(this,lt).getRowHeight();return o*i},"getContentHeight");t(this,k).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,yt,!0),p(this,kt,n.clientY),p(this,Lt,e.scrollTop);const o=d(a=>{if(!t(this,yt))return;const c=t(this,k).track.getBoundingClientRect(),l=t(this,k).thumb.clientHeight,g=c.height-l,b=a.clientY-t(this,kt),f=e.clientHeight,y=s(),v=Math.max(y-f,1);if(g>0&&v>0){const S=b/g*v;let m=t(this,Lt)+S;const _=Math.max(0,y-f);m<0&&(m=0),m>_&&(m=_),e.scrollTop=m}this.refresh()},"onMouseMove"),i=d(()=>{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,k).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,k).thumb)return;const o=t(this,k).track.getBoundingClientRect(),i=t(this,k).thumb.clientHeight,a=n.clientY-o.top-i/2,l=o.height-i,u=e.clientHeight,g=s(),b=Math.max(g-u,1);if(l>0&&b>0){const f=Math.max(0,Math.min(1,a/l));e.scrollTop=f*b}this.refresh()}),t(this,k).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,k).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,at,this.getRootNode().host),p(this,lt,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=d(()=>{const s=t(this,ot).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,k,{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,te).call(this),this.refresh()},"initWhenReady");e()}};rt=new WeakMap,ot=new WeakMap,pt=new WeakMap,k=new WeakMap,Ct=new WeakMap,kt=new WeakMap,te=new WeakMap,d(Ue,"NineTableVScrollBar");let Tt=Ue;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",Tt);const Ke=class Ke{constructor(n){h(this,it);h(this,E);h(this,at);h(this,U,new Map);h(this,D,null);h(this,Z,null);h(this,lt,0);h(this,Lt,40);h(this,Ve,!1);h(this,Ye,!1);h(this,ee,3);h(this,Xe,3);h(this,se,0);T(this,"refresh",d(()=>{var e;x.log("rowManager.refresh");const n=t(this,E).querySelector(".ng-container-body .ng-part-body");n&&(t(this,It).call(this),t(this,Mt).call(this),t(this,yt).call(this,n.scrollTop),(e=t(this,E).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",d(()=>{x.log("rowManager.initialize"),y(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)")}),y(this,D,null),t(this,U).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const i=t(this,E).querySelector(r);if(!i)return;const c=i.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const g=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,U).set(r,g)});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"),o=t(this,E).querySelector(".ng-container-body .ng-part-header"),a=t(this,E).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,It).call(this),t(this,$t).call(this),t(this,Mt).call(this),t(this,yt).call(this,n.scrollTop);let r=!1;y(this,se,n.scrollLeft);const i=d(c=>{var g;if(r)return;r=!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),o&&o.scrollLeft!==f&&(o.scrollLeft=f),a&&a.scrollLeft!==f&&(a.scrollLeft=f),t(this,yt).call(this,l),(g=t(this,E).querySelector("nine-table-vscrollbar"))==null||g.refresh(),r=!1},"handleContainerScroll");n==null||n.addEventListener("scroll",c=>{i(n)}),[e,s].forEach(c=>{c==null||c.addEventListener("scroll",l=>{if(r)return;r=!0;const f=c.scrollTop;n&&n.scrollTop!==f&&(n.scrollTop=f),r=!1})})}},"initialize"));h(this,ne,d((n,e)=>{x.log("rowManager.#renderRows");const s=t(this,U).get(e);if(!s||s.length===0)return;const o=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;o.querySelectorAll("tr:not(.nodata)").forEach(i=>i.remove());const a=o.querySelector("tr.nodata"),r=document.createDocumentFragment();for(let i=0;i<t(this,Lt);i++)s.forEach(c=>{r.appendChild(c.cloneNode(!0))});a?a.before(r):o.appendChild(r),e===".ng-container-body"&&(t(this,at).firstTr=o.querySelector("tr:not(.nodata)"))},"#renderRows"));h(this,It,d(()=>{if(t(this,D)!==null&&t(this,D)>0)return t(this,D);const n=t(this,E).querySelector(".ng-container-body .ng-part-body");x.log("rowManager.#measureAndCacheHeight");const e=t(this,U).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const o=s.querySelector("tr.nodata"),a=document.createDocumentFragment();e.forEach(b=>{a.appendChild(b.cloneNode(!0))}),o?o.before(a):s.appendChild(a);const r=t(this,E),i=r.style.display,c=r.style.visibility,l=r.style.position;(i==="none"||window.getComputedStyle(r).display==="none")&&(r.style.display="block",r.style.visibility="hidden",r.style.position="absolute");let f=0;const g=s.querySelectorAll("tr");return g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const p=window.getComputedStyle(b);u=parseFloat(p.height)||parseFloat(p.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),r.style.display=i,r.style.visibility=c,r.style.position=l,f<=0?-1:(y(this,D,f),t(this,Ht).call(this),t(this,D))},"#measureAndCacheHeight"));h(this,Mt,d(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,it).data.get()||[]).length,s=t(this,D),o=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const r=t(this,E).querySelector(a);if(!r)return;const i=r.querySelector(".ng-part-body .ng-virtual-spacer");i&&(i.style.height=`${o}px`)})},"#updateVirtualScrollHeight"));h(this,Ht,d(()=>{if(t(this,lt)>0&&t(this,D)>0){const n=Math.ceil(t(this,lt)/t(this,D));y(this,Lt,n+t(this,ee))}},"#updateRowCount"));h(this,re,d(()=>{var i,c,l,f,g,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 u=n?Array.from(n.querySelectorAll("tbody tr")):[],p=Array.from(e.querySelectorAll("tbody tr")),m=s?Array.from(s.querySelectorAll("tbody tr")):[],S=Math.max(u.length,p.length,m.length);for(let w=0;w<S;w++){const M=[((i=u[w])==null?void 0:i.getBoundingClientRect().height)||0,((c=p[w])==null?void 0:c.getBoundingClientRect().height)||0,((l=m[w])==null?void 0:l.getBoundingClientRect().height)||0],C=Math.max(...M);C>0&&(u[w]&&(u[w].style.height=`${C}px`),p[w]&&(p[w].style.height=`${C}px`),m[w]&&(m[w].style.height=`${C}px`))}}const o=t(this,E).querySelector(".ng-container-left .ng-part-footer table"),a=t(this,E).querySelector(".ng-container-body .ng-part-footer table"),r=t(this,E).querySelector(".ng-container-right .ng-part-footer table");if(a){const u=o?Array.from(o.querySelectorAll("tfoot tr")):[],p=Array.from(a.querySelectorAll("tfoot tr")),m=r?Array.from(r.querySelectorAll("tfoot tr")):[],S=Math.max(u.length,p.length,m.length);for(let w=0;w<S;w++){const M=[((f=u[w])==null?void 0:f.getBoundingClientRect().height)||0,((g=p[w])==null?void 0:g.getBoundingClientRect().height)||0,((b=m[w])==null?void 0:b.getBoundingClientRect().height)||0],C=Math.max(...M);C>0&&(u[w]&&(u[w].style.height=`${C}px`),p[w]&&(p[w].style.height=`${C}px`),m[w]&&(m[w].style.height=`${C}px`))}}},"#syncRowHeights"));h(this,oe,d(()=>{!t(this,E)||!(t(this,E)instanceof HTMLElement)||(y(this,Z,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const o=e.contentRect.height;if(o>0){let a=0;const r=s.querySelector(".ng-part-header"),i=s.querySelector(".ng-part-footer");r&&(a+=r.offsetHeight),i&&(a+=i.offsetHeight);const c=Math.max(o-a,100);t(this,lt)!==c&&(y(this,lt,c),t(this,Ht).call(this),t(this,D)!==null&&(t(this,$t).call(this),this.refresh()))}}})),t(this,Z).observe(t(this,E)))},"#initResizeObserver"));h(this,$t,d(()=>{x.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,ne).call(this,e,n)}),t(this,ae).call(this),t(this,re).call(this)},"#renderAllContainers"));h(this,yt,d(n=>{var g,b;const e=t(this,D);if(!e||e<=0)return;const s=t(this,it).data.length;if(s===0)return;const o=((g=t(this,U).get(".ng-container-body"))==null?void 0:g.length)||1,a=t(this,E).querySelector(".ng-container-body .ng-part-body"),r=Math.max(0,s-Math.floor(a.clientHeight/e)),i=Math.min(r,Math.max(0,Math.floor(n/e)));let c=Math.floor(i*e);const l=t(this,at).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,at))==null||b.scrollTables.forEach(u=>{u.style.transform=`translate3d(0, ${c}px, 0)`}),f!==i&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const p=t(this,E).querySelector(u);if(!p)return;const m=p.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((w,M)=>{const C=i+Math.floor(M/o);if(C>=s){w.style.display="none";return}const W=t(this,it).data.get(C);w.style.display="",t(this,ie).call(this,w,W,C)})})},"#handleScroll"));h(this,ie,d((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((o,a)=>{o.dataset.row=s;const r=Array.from(o.children).find(i=>i.tagName.toLowerCase().startsWith("cell-")||typeof i.refresh=="function");r&&typeof r.refresh=="function"&&r.refresh()})},"#bindRowData"));h(this,ae,d(()=>{var c,l,f;x.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 o=n?Array.from(n.querySelectorAll("tr")):[],a=Array.from(e.querySelectorAll("tr")),r=s?Array.from(s.querySelectorAll("tr")):[],i=Math.max(o.length,a.length,r.length);for(let g=0;g<i;g++){const b=[((c=o[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=a[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=r[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(o[g]&&(o[g].style.height=`${u}px`),a[g]&&(a[g].style.height=`${u}px`),r[g]&&(r[g].style.height=`${u}px`))}},"#syncHeaderHeights"));T(this,"destroy",d(()=>{t(this,Z)&&(t(this,Z).disconnect(),y(this,Z,null))},"destroy"));y(this,it,n.getRootNode().host),y(this,E,n),t(this,oe).call(this)}getRowHeight(){return t(this,D)}templateLength(n=".ng-container-body"){var e;return((e=t(this,U).get(n))==null?void 0:e.length)||1}};it=new WeakMap,E=new WeakMap,at=new WeakMap,U=new WeakMap,D=new WeakMap,Z=new WeakMap,lt=new WeakMap,Lt=new WeakMap,Ve=new WeakMap,Ye=new WeakMap,ee=new WeakMap,Xe=new WeakMap,se=new WeakMap,ne=new WeakMap,It=new WeakMap,Mt=new WeakMap,Ht=new WeakMap,re=new WeakMap,oe=new WeakMap,$t=new WeakMap,yt=new WeakMap,ie=new WeakMap,ae=new WeakMap,d(Ke,"RowManager");let Ce=Ke;const le=class le{static compileAll(n){return Array.isArray(n)?n.map(e=>le.compile(e)):[]}static compile(n){if(!n)return null;const e=d(i=>{i.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let g=`cell-${f}`;const b=l.getAttribute("data-bind"),u=l.getAttribute("data-expr"),p=l.getAttribute("maxbyte"),m=l.getAttribute("type");let S=[];b&&S.push(`data-bind="${b}"`),u&&S.push(`data-expr="${u}"`),p&&S.push(`maxbyte="${p}"`),m&&S.push(`type="${m}"`),l.innerHTML=`<${g} ${S.join(" ")}></${g}>`}),i.querySelectorAll("tbody td, tfoot td").forEach(l=>{l.setAttribute("tabindex","0")})},"processCellTypes"),s=d(i=>{if(!i.querySelector("colgroup")){const c=i.querySelector("tbody tr")||i.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),g=Math.max(Math.floor(i.clientWidth/l),100);for(let b=0;b<l;b++){const u=document.createElement("col");u.setAttribute("width",g),f.appendChild(u)}i.prepend(f)}if(!i.querySelector("thead")){const c=document.createElement("thead"),l=i.querySelector("colgroup");l?l.after(c):i.prepend(c)}i.classList.add("nine-table-element")},"ensureTableStructure"),o=d((i,c)=>{const l=Array.from(i.querySelectorAll(c+" tr")),f=Array.from(i.querySelectorAll(c+" th,"+c+" td")),g=l.length;if(g===0||f.length===0)return;let b=0;f.forEach(p=>{b+=p.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(p=>{const m=p.sectionRowIndex;let S=0;p.dataset.subrow=m,Array.from(p.querySelectorAll("th,td")).forEach(w=>{for(let W=0;W<u[m].length;W++)if(u[m][W]===null){S=W;break}const M=w.rowSpan||1,C=w.colSpan||1;for(let W=0;W<M;W++)for(let qt=0;qt<C;qt++)m+W<g&&S+qt<b&&(u[m+W][S+qt]=W===0&&qt===0?"1":"0")})}),l.forEach(p=>{const m=p.sectionRowIndex;Array.from(p.querySelectorAll("th,td")).forEach(S=>{for(let w=0;w<u[m].length;w++)if(u[m][w]==="1"){S.dataset.col=w,u[m][w]="0";break}})})},"resetColIndex"),a=n.cloneNode(!0);return s(a),e(a),o(a,"thead"),o(a,"tbody"),o(a,"tfoot"),Array.from(a.querySelectorAll("colgroup col")).forEach((i,c)=>{const l=i.getAttribute("fixed");l&&a.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),a}};d(le,"TableCompiler");let ke=le;const Ze=class Ze{constructor(n){h(this,Y);h(this,N);h(this,V,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});T(this,"render",d(()=>{const{startRow:n,startCol:e,endRow:s,endCol:o}=t(this,V);x.log("🎨 [CellSelection.render] Rendering range ->",t(this,V));const a=t(this,N).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(a.forEach(i=>{i.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){x.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let r=0;a.forEach(i=>{i.querySelectorAll("tbody tr").forEach(c=>{const{matrixRow:l}=Q(this,Y,Zt).call(this,c);l<0||c.querySelectorAll("td, th").forEach(f=>{const g=parseInt(f.dataset.col,10);if(isNaN(g))return;const b=parseInt(f.rowSpan||1,10),u=parseInt(f.colSpan||1,10),p=l+b-1,m=g+u-1;p>=n&&l<=s&&m>=e&&g<=o&&(r++,f.classList.add("selected"),x.log(f,n,e,s,o),l<=n&&f.classList.add("selected-top"),p>=s&&f.classList.add("selected-bottom"),g<=e&&f.classList.add("selected-left"),m>=o&&f.classList.add("selected-right"))})})}),x.log(`✨ [CellSelection.render] Total rendered cells marked: ${r}`)},"render"));y(this,N,n),Q(this,Y,Ss).call(this),t(this,N).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,V).startRow>=0&&t(this,V).startCol>=0&&this.render()})}),x.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,o){x.log(`πŸ” [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${o}`);let a=Math.min(n,s),r=Math.max(n,s),i=Math.min(e,o),c=Math.max(e,o);const l=t(this,N).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");let f=!0,g=0;for(;f&&g<5;)f=!1,g++,l.forEach(b=>{b.querySelectorAll("tbody tr").forEach(u=>{if(u.classList.contains("nodata"))return;const{matrixRow:p}=Q(this,Y,Zt).call(this,u);p<0||u.querySelectorAll("td, th").forEach(m=>{const S=parseInt(m.dataset.col,10);if(isNaN(S))return;const w=parseInt(m.rowSpan||1,10),M=parseInt(m.colSpan||1,10),C=p+w-1,W=S+M-1;if(C>=a&&p<=r&&W>=i&&S<=c){const bs=Math.min(a,p),ps=Math.max(r,C),ys=Math.min(i,S),ms=Math.max(c,W);(bs!==a||ps!==r||ys!==i||ms!==c)&&(a=bs,r=ps,i=ys,c=ms,f=!0)}})})});y(this,V,{startRow:a,startCol:i,endRow:r,endCol:c}),x.log("πŸ“¦ [CellSelection.setRange] Final Range ->",t(this,V)),this.render()}};N=new WeakMap,V=new WeakMap,Y=new WeakSet,Zt=d(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"),a=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===e),r=a.indexOf(n),i=a.length>0?a.length:1,c=e*i+(r>=0?r:n.sectionRowIndex%i);return{dataRow:e,subRowIndex:r,matrixRow:c}},"#getMatrixRow"),Ss=d(function(){const n=t(this,N).querySelector(".ng-container-top");if(!n){x.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,N).style.userSelect="none",t(this,N).style.webkitUserSelect="none";const o=s.closest("tr"),{matrixRow:a}=Q(this,Y,Zt).call(this,o),r=parseInt(s.dataset.col,10);if(a<0){t(this,N).style.userSelect="",t(this,N).style.webkitUserSelect="";return}x.log(`πŸ–±οΈ [MouseDown Success] startRow: ${a}, startCol: ${r}`),t(this,N).navigation.currentCell=s;let i=a,c=r;const l=d(g=>{const b=document.elementFromPoint(g.clientX,g.clientY);let u=b==null?void 0:b.closest("td, th");if(!u||!t(this,N).contains(u)){const w=t(this,N).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const M of w){const C=M.getBoundingClientRect();if(g.clientX>=C.left&&g.clientX<=C.right&&g.clientY>=C.top&&g.clientY<=C.bottom){u=M;break}}}if(!u||u.dataset.row===void 0||u.dataset.col===void 0||u.closest("tr").classList.contains("nodata"))return;const p=u.closest("tr"),{matrixRow:m}=Q(this,Y,Zt).call(this,p),S=parseInt(u.dataset.col,10);m<0||i===m&&c===S||(i=m,c=S,this.setRange(a,r,m,S))},"onMouseMove"),f=d(()=>{x.log("πŸ–±οΈ [MouseUp] Drag ended."),t(this,N).style.userSelect="",t(this,N).style.webkitUserSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",f)},"onMouseUp");document.addEventListener("mousemove",l),document.addEventListener("mouseup",f)})},"#initEvents"),d(Ze,"CellSelection");let Le=Ze;const Je=class Je{constructor(n){h(this,mt);h(this,B);h(this,ct,null);h(this,Nt,null);h(this,ce,-1);h(this,he,-1);h(this,_t,d(n=>{const e=[];return n.forEach(s=>e.push(...Array.from(s.querySelectorAll("td")))),e.length===0?null:(e.sort((s,o)=>parseInt(s.dataset.col,10)-parseInt(o.dataset.col,10)),e[e.length-1])},"#getMaxColCell"));h(this,Dt,d((n,e)=>{const s=t(this,ht).call(this,n);if(s.length===0)return e+1;let o=e+1;const a=[];s.forEach(r=>a.push(...Array.from(r.querySelectorAll("td")))),a.sort((r,i)=>parseInt(r.dataset.col,10)-parseInt(i.dataset.col,10));for(const r of a){const i=parseInt(r.dataset.col,10),c=parseInt(r.colSpan||1,10);if(e>=i&&e<i+c){o=i+c;break}}return o},"#getNextCol"));h(this,Ot,d((n,e)=>{const s=t(this,ht).call(this,n);if(s.length===0)return Math.max(0,e-1);let o=-1;const a=[];s.forEach(r=>a.push(...Array.from(r.querySelectorAll("td")))),a.sort((r,i)=>parseInt(r.dataset.col,10)-parseInt(i.dataset.col,10));for(const r of a){const i=parseInt(r.dataset.col,10);if(i<e)o=i;else break}return o},"#getPreviousCol"));h(this,ht,d(n=>{const e=t(this,B).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"),s=[];return e.forEach(o=>{const a=Array.from(o.querySelectorAll("tbody tr:not(.nodata)"));for(const r of a){const i=parseInt(r.dataset.row,10),c=a.filter(p=>parseInt(p.dataset.row,10)===i),l=c.length>0?c.length:1,f=c.indexOf(r),g=i*l+(f>=0?f:0);if(g===n){s.push(r);break}const b=Array.from(r.querySelectorAll("td"));let u=!1;for(const p of b){const m=parseInt(p.rowSpan||1,10);if(m>1&&n>=g&&n<g+m){s.push(r),u=!0;break}}if(u)break}}),s},"#findTargetTrsByMatrix"));h(this,Ge,d((n,e,s,o)=>{const a=t(this,B).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"),r=o!==void 0?o:n*1+e;for(const i of a){const c=Array.from(i.querySelectorAll("tbody tr"));for(const l of c){const f=parseInt(l.dataset.row,10),g=t(this,B).templateLength,b=parseInt(l.dataset.subrow,10),u=f*g+(b>=0?b:0),p=Array.from(l.querySelectorAll("td"));for(const m of p){const S=parseInt(m.dataset.col,10),w=parseInt(m.colSpan||1,10),M=parseInt(m.rowSpan||1,10);if(!isNaN(S)&&s>=S&&s<S+w&&r>=u&&r<u+M&&window.getComputedStyle(m).display!=="none")return m}}}return null},"#getNearElement_BAK"));h(this,de,d((n,e,s,o)=>{const a=o!==void 0?o:n*1+e,r=Array.from(t(this,B).querySelectorAll(".ng-part-body tbody tr"));for(const i of r){const c=parseInt(i.dataset.row,10),l=t(this,B).templateLength,f=parseInt(i.dataset.subrow,10),g=c*l+(f>=0?f:0),b=Array.from(i.querySelectorAll("td"));for(const u of b){const p=parseInt(u.dataset.col,10),m=parseInt(u.colSpan||1,10),S=parseInt(u.rowSpan||1,10);if(!isNaN(p)&&s>=p&&s<p+m&&a>=g&&a<g+S&&window.getComputedStyle(u).display!=="none")return u}}return null},"#getNearElement"));y(this,B,n),Q(this,mt,As).call(this),x.log("🎯 [CellNavigation] Initialized")}get currentCell(){return t(this,ct)}set currentCell(n){if(!n)return;y(this,ct,n),n.focus({preventScroll:!0}),y(this,Nt,n.closest("tr"));const e=parseInt(n.dataset.row,10),s=parseInt(n.dataset.col,10);if(!isNaN(e)&&!isNaN(s)){y(this,ce,e),y(this,he,s);const o=n.closest("tr"),a=o==null?void 0:o.closest("tbody");if(a){const i=Array.from(a.querySelectorAll("tr:not(.nodata)")).filter(g=>parseInt(g.dataset.row,10)===e),c=i.length>0?i.length:1,l=i.indexOf(o),f=e*c+(l>=0?l:0);t(this,B).selection.setRange(f,s,f,s)}}}moveCell(n){if(!t(this,ct))return;const e=t(this,ct),s=parseInt(e.dataset.row,10),o=parseInt(e.dataset.col,10),a=t(this,B).templateLength,r=parseInt(t(this,Nt).dataset.subrow,10),i=s*a+(r>=0?r:0);let c=i,l=o;switch(n.code){case"Tab":if(n.preventDefault(),n.shiftKey){if(l=t(this,Ot).call(this,i,o),l<0&&i>0){c=i-1;const u=t(this,ht).call(this,c),p=t(this,_t).call(this,u);l=p?parseInt(p.dataset.col,10):0}}else{l=t(this,Dt).call(this,i,o);const u=t(this,ht).call(this,i),p=t(this,_t).call(this,u),m=p?parseInt(p.dataset.col,10)+parseInt(p.colSpan||1,10):0;l>=m&&(c=i+1,l=0)}break;case"ArrowRight":l=t(this,Dt).call(this,i,o);break;case"ArrowLeft":l=t(this,Ot).call(this,i,o);break;case"ArrowDown":n.preventDefault(),c=i+(e.rowSpan||1);break;case"ArrowUp":n.preventDefault(),c=Math.max(0,i-(e.rowSpan||1));break}const f=Math.floor(c/a),g=c%a;x.log("templateLength",a,"matrixRow:",i,"nextMatrixRow",c);let b=t(this,de).call(this,f,g,l,c);x.log(b,f,g,l,c),b&&(this.currentCell=b,Q(this,mt,Rs).call(this,b))}};B=new WeakMap,ct=new WeakMap,Nt=new WeakMap,ce=new WeakMap,he=new WeakMap,mt=new WeakSet,Rs=d(function(n){},"#ensureCellVisible"),_t=new WeakMap,Dt=new WeakMap,Ot=new WeakMap,ht=new WeakMap,Ge=new WeakMap,de=new WeakMap,As=d(function(){t(this,B).addEventListener("keydown",n=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n.code)&&this.moveCell(n)})},"#initEvents"),d(Je,"CellNavigation");let Ie=Je;const Bt=class Bt extends HTMLElement{constructor(){super();h(this,fe);h(this,dt);h(this,Wt);h(this,zt);h(this,j,{table:null});T(this,"invalidate",d(()=>{x.log("sheet.invalidate()"),t(this,dt).refresh()},"invalidate"));T(this,"generate",d(e=>{if(x.log("sheet.generate()"),!e)return;t(this,j).table=ke.compile(e),t(this,j).tbody={tr:t(this,j).table.querySelectorAll("tbody tr")},t(this,ue).call(this),t(this,ge).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),o=this.querySelector(".ng-container-body .ng-part-footer"),a=this.querySelector(".ng-nodata-overlay");s&&a&&(a.style.top=`${s.offsetHeight}px`),o&&a&&(a.style.bottom=`${o.offsetHeight}px`),t(this,dt).initialize(),setTimeout(()=>{var r;(r=this.querySelector("nine-table-hscrollbar"))==null||r.refresh()},0)},"generate"));h(this,ue,d(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:o})=>{var a,r,i;(a=this.querySelector(`${s} .ng-part-header`))==null||a.appendChild(t(this,xt).call(this,t(this,j).table,o,"header")),(r=this.querySelector(`${s} .ng-virtual-spacer`))==null||r.before(t(this,xt).call(this,t(this,j).table,o,"body")),(i=this.querySelector(`${s} .ng-part-footer`))==null||i.appendChild(t(this,xt).call(this,t(this,j).table,o,"footer"))})},"#renderSplitContainers"));h(this,ge,d(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),o=s==null?void 0:s.querySelectorAll("table");if(!s||!o||o.length===0)return;let a=0;o[0].querySelectorAll("col").forEach(r=>{const i=parseInt(r.getAttribute("width"),10);isNaN(i)||(a+=i)}),e==="body"?(s.style.flex="1",o.forEach(r=>{r.style.width=`${a}px`,r.style.minWidth=`${a}px`})):(s.style.flex=`0 0 ${a}px`,s.style.width=`${a}px`,o.forEach(r=>{r.style.width=`${a}px`,r.style.minWidth=`${a}px`}))})},"#updateContainerWidths"));h(this,xt,d((e,s,o)=>{const a=e.cloneNode(!0),r=a.querySelector("thead"),i=a.querySelector("tbody"),c=a.querySelector("tfoot");if(o==="header"){if(i&&i.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",a.appendChild(f)}}else o==="body"?(r&&r.remove(),c&&c.remove(),i&&(i.className="bindable-tbody")):o==="footer"&&(r&&r.remove(),i&&i.remove());return s==="left"?a.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?a.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):a.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),a},"#createSplitTable"));T(this,"getRowHeight",d(()=>t(this,dt).getRowHeight(),"getRowHeight"));T(this,"scrollToX",d(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",d(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));h(this,be,d(()=>{t(this,pe).call(this),y(this,Wt,new Le(this)),y(this,zt,new Ie(this))},"#init"));h(this,pe,d(()=>{const e=Bt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=d(()=>{const s=t(this,lt).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,k,{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,se).call(this),this.refresh()},"initWhenReady");e()}};at=new WeakMap,lt=new WeakMap,yt=new WeakMap,k=new WeakMap,kt=new WeakMap,Lt=new WeakMap,se=new WeakMap,d(Ue,"NineTableVScrollBar");let Ct=Ue;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",Ct);const Ze=class Ze{constructor(r){h(this,G);h(this,A);h(this,ct);h(this,U,new Map);h(this,D,null);h(this,J,null);h(this,ht,0);h(this,It,40);h(this,Ye,!1);h(this,Xe,!1);h(this,re,3);h(this,Ke,3);h(this,ne,0);T(this,"refresh",d(()=>{var e;x.log("rowManager.refresh");const r=t(this,A).querySelector(".ng-container-body .ng-part-body");r&&(t(this,Mt).call(this),t(this,Ht).call(this),t(this,dt).call(this,r.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",d(()=>{x.log("rowManager.initialize"),p(this,ct,{scrollTables:t(this,A).querySelectorAll(".ng-part-body table"),firstTr:t(this,A).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),p(this,D,null),t(this,U).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const a=t(this,A).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 g=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,U).set(i,g)});const r=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),n=t(this,A).querySelector(".ng-container-body .ng-part-header"),o=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(r){t(this,Mt).call(this),t(this,Nt).call(this),t(this,Ht).call(this),t(this,dt).call(this,r.scrollTop);let i=!1;p(this,ne,r.scrollLeft);const a=d(c=>{var g;if(i)return;i=!0;const l=c.scrollTop,u=c.scrollLeft;r&&r.scrollTop!==l&&(r.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),n&&n.scrollLeft!==u&&(n.scrollLeft=u),o&&o.scrollLeft!==u&&(o.scrollLeft=u),t(this,dt).call(this,l),(g=t(this,A).querySelector("nine-table-vscrollbar"))==null||g.refresh(),i=!1},"handleContainerScroll");r==null||r.addEventListener("scroll",c=>{a(r)}),[e,s].forEach(c=>{c==null||c.addEventListener("scroll",l=>{if(i)return;i=!0;const u=c.scrollTop;r&&r.scrollTop!==u&&(r.scrollTop=u),i=!1})})}},"initialize"));h(this,oe,d((r,e)=>{x.log("rowManager.#renderRows");const s=t(this,U).get(e);if(!s||s.length===0)return;const n=r.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;n.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const o=n.querySelector("tr.nodata"),i=document.createDocumentFragment();for(let a=0;a<t(this,It);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});o?o.before(i):n.appendChild(i),e===".ng-container-body"&&(t(this,ct).firstTr=n.querySelector("tr:not(.nodata)"))},"#renderRows"));h(this,Mt,d(()=>{if(t(this,D)!==null&&t(this,D)>0)return t(this,D);const r=t(this,A).querySelector(".ng-container-body .ng-part-body");x.log("rowManager.#measureAndCacheHeight");const e=t(this,U).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=r.querySelector("tbody.bindable-tbody");if(!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const n=s.querySelector("tr.nodata"),o=document.createDocumentFragment();e.forEach(b=>{o.appendChild(b.cloneNode(!0))}),n?n.before(o):s.appendChild(o);const i=t(this,A),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 g=s.querySelectorAll("tr");return g.forEach(b=>{let f=b.offsetHeight||b.getBoundingClientRect().height;if(f===0){const y=window.getComputedStyle(b);f=parseFloat(y.height)||parseFloat(y.minHeight)||0}u+=f}),g.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,u<=0?-1:(p(this,D,u),t(this,$t).call(this),t(this,D))},"#measureAndCacheHeight"));h(this,Ht,d(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,G).data.get()||[]).length,s=t(this,D),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const i=t(this,A).querySelector(o);if(!i)return;const a=i.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));h(this,$t,d(()=>{if(t(this,ht)>0&&t(this,D)>0){const r=Math.ceil(t(this,ht)/t(this,D));p(this,It,r+t(this,re))}},"#updateRowCount"));h(this,ie,d(()=>{var a,c,l,u,g,b;const r=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const f=r?Array.from(r.querySelectorAll("tbody tr")):[],y=Array.from(e.querySelectorAll("tbody tr")),v=s?Array.from(s.querySelectorAll("tbody tr")):[],S=Math.max(f.length,y.length,v.length);for(let m=0;m<S;m++){const _=[((a=f[m])==null?void 0:a.getBoundingClientRect().height)||0,((c=y[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=v[m])==null?void 0:l.getBoundingClientRect().height)||0],C=Math.max(..._);C>0&&(f[m]&&(f[m].style.height=`${C}px`),y[m]&&(y[m].style.height=`${C}px`),v[m]&&(v[m].style.height=`${C}px`))}}const n=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),i=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(o){const f=n?Array.from(n.querySelectorAll("tfoot tr")):[],y=Array.from(o.querySelectorAll("tfoot tr")),v=i?Array.from(i.querySelectorAll("tfoot tr")):[],S=Math.max(f.length,y.length,v.length);for(let m=0;m<S;m++){const _=[((u=f[m])==null?void 0:u.getBoundingClientRect().height)||0,((g=y[m])==null?void 0:g.getBoundingClientRect().height)||0,((b=v[m])==null?void 0:b.getBoundingClientRect().height)||0],C=Math.max(..._);C>0&&(f[m]&&(f[m].style.height=`${C}px`),y[m]&&(y[m].style.height=`${C}px`),v[m]&&(v[m].style.height=`${C}px`))}}},"#syncRowHeights"));h(this,ae,d(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,J,new ResizeObserver(r=>{for(const e of r){const s=e.target;if(!s.classList.contains("active"))continue;const n=e.contentRect.height;if(n>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(n-o,100);t(this,ht)!==c&&(p(this,ht,c),t(this,$t).call(this),t(this,D)!==null&&(t(this,Nt).call(this),this.refresh()))}}})),t(this,J).observe(t(this,A)))},"#initResizeObserver"));h(this,Nt,d(()=>{x.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const e=t(this,A).querySelector(r);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,oe).call(this,e,r)}),t(this,ce).call(this),t(this,ie).call(this)},"#renderAllContainers"));h(this,dt,d(r=>{var g,b;x.log("rowManager.#handleScroll()",t(this,D));const e=t(this,D);if(!e||e<=0)return;const s=t(this,G).data.length;if(s===0)return;const n=((g=t(this,U).get(".ng-container-body"))==null?void 0:g.length)||1,o=t(this,A).querySelector(".ng-container-body .ng-part-body"),i=Math.max(0,s-Math.floor(o.clientHeight/e)),a=Math.min(i,Math.max(0,Math.floor(r/e)));let c=Math.floor(a*e);const l=t(this,ct).firstTr,u=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,ct))==null||b.scrollTables.forEach(f=>{f.style.transform=`translate3d(0, ${c}px, 0)`}),u!==a&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(f=>{const y=t(this,A).querySelector(f);if(!y)return;const v=y.querySelector(".ng-part-body tbody.bindable-tbody");if(!v)return;Array.from(v.querySelectorAll("tr:not(.nodata)")).forEach((m,_)=>{const C=a+Math.floor(_/n);if(C>=s){m.style.display="none",m.dataset.matrixRow=null,m.dataset.row=null;return}const z=t(this,G).data.get(C);m.style.display="",t(this,le).call(this,m,z,C)})})},"#handleScroll"));h(this,le,d((r,e,s)=>{const n=t(this,A).templateLength||1,o=parseInt(r.dataset.subrow,10)||0,i=s*n+o;r.dataset.row=s,r.dataset.matrixRow=i,r.data=e,Array.from(r.cells).forEach((a,c)=>{a.dataset.row=s;const l=Array.from(a.children).find(u=>u.tagName.toLowerCase().startsWith("cell-")||typeof u.refresh=="function");l&&typeof l.refresh=="function"&&l.refresh()})},"#bindRowData"));h(this,ce,d(()=>{var c,l,u;x.log("rowManager.#syncHeaderHeights");const r=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const n=r?Array.from(r.querySelectorAll("tr")):[],o=Array.from(e.querySelectorAll("tr")),i=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(n.length,o.length,i.length);for(let g=0;g<a;g++){const b=[((c=n[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=o[g])==null?void 0:l.getBoundingClientRect().height)||0,((u=i[g])==null?void 0:u.getBoundingClientRect().height)||0],f=Math.max(...b);f>0&&(n[g]&&(n[g].style.height=`${f}px`),o[g]&&(o[g].style.height=`${f}px`),i[g]&&(i[g].style.height=`${f}px`))}},"#syncHeaderHeights"));T(this,"destroy",d(()=>{t(this,J)&&(t(this,J).disconnect(),p(this,J,null))},"destroy"));p(this,G,r.getRootNode().host),p(this,A,r),t(this,ae).call(this)}getRowHeight(){return t(this,D)}templateLength(r=".ng-container-body"){var e;return((e=t(this,U).get(r))==null?void 0:e.length)||1}scrollToDataRow(r,e){const s=t(this,D);if(!s||s<=0){typeof e=="function"&&e();return}const n=t(this,A).querySelector(".ng-container-body .ng-part-body");if(!n){typeof e=="function"&&e();return}const o=t(this,G).data.length,i=Math.max(0,Math.min(r,o-1)),a=i*s,c=n.scrollTop,l=n.clientHeight,u=i*s,g=u+s;u>=c&&g<=c+l?typeof e=="function"&&e():(n.scrollTop=a,t(this,dt).call(this,a),requestAnimationFrame(()=>{typeof e=="function"&&e()}))}};G=new WeakMap,A=new WeakMap,ct=new WeakMap,U=new WeakMap,D=new WeakMap,J=new WeakMap,ht=new WeakMap,It=new WeakMap,Ye=new WeakMap,Xe=new WeakMap,re=new WeakMap,Ke=new WeakMap,ne=new WeakMap,oe=new WeakMap,Mt=new WeakMap,Ht=new WeakMap,$t=new WeakMap,ie=new WeakMap,ae=new WeakMap,Nt=new WeakMap,dt=new WeakMap,le=new WeakMap,ce=new WeakMap,d(Ze,"RowManager");let ke=Ze;const he=class he{static compileAll(r){return Array.isArray(r)?r.map(e=>he.compile(e)):[]}static compile(r){if(!r)return null;const e=d(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 g=`cell-${u}`;const b=l.getAttribute("data-bind"),f=l.getAttribute("data-expr"),y=l.getAttribute("maxbyte"),v=l.getAttribute("type");let S=[];b&&S.push(`data-bind="${b}"`),f&&S.push(`data-expr="${f}"`),y&&S.push(`maxbyte="${y}"`),v&&S.push(`type="${v}"`),l.innerHTML=`<${g} ${S.join(" ")}></${g}>`}),a.querySelectorAll("tbody td, tfoot td").forEach(l=>{l.setAttribute("tabindex","0")})},"processCellTypes"),s=d(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"),g=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const f=document.createElement("col");f.setAttribute("width",g),u.appendChild(f)}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"),n=d((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),u=Array.from(a.querySelectorAll(c+" th,"+c+" td")),g=l.length;if(g===0||u.length===0)return;let b=0;u.forEach(y=>{b+=y.colSpan||1});const f=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(y=>{const v=y.sectionRowIndex;let S=0;y.dataset.subrow=v,Array.from(y.querySelectorAll("th,td")).forEach(m=>{for(let z=0;z<f[v].length;z++)if(f[v][z]===null){S=z;break}const _=m.rowSpan||1,C=m.colSpan||1;for(let z=0;z<_;z++)for(let Tt=0;Tt<C;Tt++)v+z<g&&S+Tt<b&&(f[v+z][S+Tt]=z===0&&Tt===0?"1":"0")})}),l.forEach(y=>{const v=y.sectionRowIndex;Array.from(y.querySelectorAll("th,td")).forEach(S=>{for(let m=0;m<f[v].length;m++)if(f[v][m]==="1"){S.dataset.col=m,f[v][m]="0";break}})})},"resetColIndex"),o=r.cloneNode(!0);return s(o),e(o),n(o,"thead"),n(o,"tbody"),n(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}};d(he,"TableCompiler");let Le=he;const Ge=class Ge{constructor(r){h(this,Y);h(this,M);h(this,ft,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});T(this,"render",d(()=>{const{startRow:r,startCol:e,endRow:s,endCol:n}=t(this,ft),o=t(this,M).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(o.forEach(i=>{i.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(a=>{a.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),this.setFocus(r,e),r<0||e<0){x.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}o.forEach(i=>{i.querySelectorAll("tbody tr").forEach(a=>{const{matrixRow:c}=st(this,Y,Jt).call(this,a);c<0||a.querySelectorAll("td, th").forEach(l=>{const u=parseInt(l.dataset.col,10);if(isNaN(u))return;const g=parseInt(l.rowSpan||1,10),b=parseInt(l.colSpan||1,10),f=c+g-1,y=u+b-1;f>=r&&c<=s&&y>=e&&u<=n&&(l.classList.add("selected"),c<=r&&l.classList.add("selected-top"),f>=s&&l.classList.add("selected-bottom"),u<=e&&l.classList.add("selected-left"),y>=n&&l.classList.add("selected-right"))})})})},"render"));p(this,M,r),st(this,Y,As).call(this),t(this,M).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,ft).startRow>=0&&t(this,ft).startCol>=0&&this.render()})}),x.log("🎯 [CellSelection] Initialized")}setFocus(r,e){t(this,M).querySelectorAll(".ng-part-body tr.selected-start").forEach(n=>{n.classList.remove("selected-start"),n.querySelectorAll("td.selected-start").forEach(o=>{o.classList.remove("selected-start")})});const s=t(this,M).querySelector(`.ng-part-body tr[data-matrix-row="${r}"] td[data-col="${e}"]`);s&&(s==null||s.classList.add("selected-start"),t(this,M).querySelectorAll(`.ng-part-body tr[data-row="${s==null?void 0:s.dataset.row}"]`).forEach(n=>{n==null||n.classList.add("selected-start")}))}setRange(r,e,s,n){x.log(`πŸ” [CellSelection.setRange] Input -> startRow: ${r}, startCol: ${e}, endRow: ${s}, endCol: ${n}`);let o=Math.min(r,s),i=Math.max(r,s),a=Math.min(e,n),c=Math.max(e,n);const l=t(this,M).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");let u=!0,g=0;for(;u&&g<5;)u=!1,g++,l.forEach(b=>{b.querySelectorAll("tbody tr").forEach(f=>{if(f.classList.contains("nodata"))return;const{matrixRow:y}=st(this,Y,Jt).call(this,f);y<0||f.querySelectorAll("td, th").forEach(v=>{const S=parseInt(v.dataset.col,10);if(isNaN(S))return;const m=parseInt(v.rowSpan||1,10),_=parseInt(v.colSpan||1,10),C=y+m-1,z=S+_-1;if(C>=o&&y<=i&&z>=a&&S<=c){const ys=Math.min(o,y),ms=Math.max(i,C),ws=Math.min(a,S),xs=Math.max(c,z);(ys!==o||ms!==i||ws!==a||xs!==c)&&(o=ys,i=ms,a=ws,c=xs,u=!0)}})})});p(this,ft,{startRow:o,startCol:a,endRow:i,endCol:c}),this.render()}};M=new WeakMap,ft=new WeakMap,Y=new WeakSet,Jt=d(function(r){if(!r)return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const e=parseInt(r.dataset.row,10);if(isNaN(e))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const s=r.closest("tbody"),o=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===e),i=o.indexOf(r),a=o.length>0?o.length:1,c=e*a+(i>=0?i:r.sectionRowIndex%a);return{dataRow:e,subRowIndex:i,matrixRow:c}},"#getMatrixRow"),As=d(function(){const r=t(this,M).querySelector(".ng-container-top");if(!r){x.log("❌ [CellSelection] .ng-container-top not found!");return}r.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,M).style.userSelect="none",t(this,M).style.webkitUserSelect="none";const n=s.closest("tr"),{matrixRow:o}=st(this,Y,Jt).call(this,n),i=parseInt(s.dataset.col,10);if(o<0){t(this,M).style.userSelect="",t(this,M).style.webkitUserSelect="";return}this.setFocus(o,i),this.setRange(o,i,o,i);let a=o,c=i;const l=d(g=>{const b=document.elementFromPoint(g.clientX,g.clientY);let f=b==null?void 0:b.closest("td, th");if(!f||!t(this,M).contains(f)){const m=t(this,M).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const _ of m){const C=_.getBoundingClientRect();if(g.clientX>=C.left&&g.clientX<=C.right&&g.clientY>=C.top&&g.clientY<=C.bottom){f=_;break}}}if(!f||f.dataset.row===void 0||f.dataset.col===void 0||f.closest("tr").classList.contains("nodata"))return;const y=f.closest("tr"),{matrixRow:v}=st(this,Y,Jt).call(this,y),S=parseInt(f.dataset.col,10);v<0||a===v&&c===S||(a=v,c=S,this.setRange(o,i,v,S))},"onMouseMove"),u=d(()=>{x.log("πŸ–±οΈ [MouseUp] Drag ended."),t(this,M).style.userSelect="",t(this,M).style.webkitUserSelect="",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)},"onMouseUp");document.addEventListener("mousemove",l),document.addEventListener("mouseup",u)})},"#initEvents"),d(Ge,"CellSelection");let Ie=Ge;const ts=class ts{constructor(r){h(this,mt);h(this,H);h(this,_t);h(this,X,null);h(this,j,null);h(this,Je,-1);h(this,Qe,-1);h(this,de,d(r=>{const e=t(this,H).querySelectorAll(`.ng-part-body td[data-row="${r}"]`);if(!e||e.length===0)return 0;let s=1/0;return e.forEach(n=>{const o=parseInt(n.dataset.col,10);!isNaN(o)&&window.getComputedStyle(n).display!=="none"&&(s=Math.min(s,o))}),s===1/0?0:s},"#getMinCol"));h(this,Dt,d(r=>{const e=t(this,H).querySelectorAll(`.ng-part-body td[data-row="${r}"]`);if(!e||e.length===0)return 0;let s=0;return e.forEach(n=>{const o=parseInt(n.dataset.col,10);!isNaN(o)&&window.getComputedStyle(n).display!=="none"&&(s=Math.max(s,o))}),s},"#getMaxCol"));h(this,Ot,d(r=>{const e=[];return r.forEach(s=>e.push(...Array.from(s.querySelectorAll("td")))),e.length===0?null:(e.sort((s,n)=>parseInt(s.dataset.col,10)-parseInt(n.dataset.col,10)),e[e.length-1])},"#getMaxColCell"));h(this,Wt,d((r,e)=>{const s=t(this,H).querySelector(`.ng-part-body tr[data-matrix-row="${r}"] td[data-col="${e}"]`);return e+(s.colSpan||1)},"#getNextCol"));h(this,zt,d((r,e)=>{if(e<=0)return 0;const s=t(this,j)?Array.from(t(this,j).querySelectorAll("td, th")):[],n=new Set;s.forEach(i=>{const a=parseInt(i.dataset.col,10);!isNaN(a)&&window.getComputedStyle(i).display!=="none"&&n.add(a)}),n.size===0&&t(this,wt).call(this,r).forEach(a=>{Array.from(a.querySelectorAll("td, th")).forEach(c=>{const l=parseInt(c.dataset.col,10);!isNaN(l)&&window.getComputedStyle(c).display!=="none"&&n.add(l)})});const o=Array.from(n).filter(i=>i<e);return o.length===0?Math.max(0,e-1):Math.max(...o)},"#getPreviousCol"));h(this,wt,d(r=>{const e=t(this,H).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body"),s=[];return e.forEach(n=>{const o=Array.from(n.querySelectorAll("tbody tr"));for(const i of o){const a=parseInt(i.dataset.row,10),c=o.filter(y=>parseInt(y.dataset.row,10)===a),l=c.length>0?c.length:1,u=c.indexOf(i),g=a*l+(u>=0?u:0);if(g===r){s.push(i);break}const b=Array.from(i.querySelectorAll("td"));let f=!1;for(const y of b){const v=parseInt(y.rowSpan||1,10);if(v>1&&r>=g&&r<g+v){s.push(i),f=!0;break}}if(f)break}}),s},"#findTargetTrsByMatrix"));h(this,fe,d((r,e,s,n)=>{const o=n!==void 0?n:r*1+e;for(const i of Array.from(t(this,H).querySelectorAll(".ng-part-body tbody tr"))){const a=parseInt(i.dataset.row,10),c=t(this,H).templateLength,l=parseInt(i.dataset.subrow,10),u=a*c+(l>=0?l:0);for(const g of Array.from(i.querySelectorAll("td"))){const b=parseInt(g.dataset.col,10),f=parseInt(g.colSpan||1,10),y=parseInt(g.rowSpan||1,10);if(!isNaN(b)&&s>=b&&s<b+f&&o>=u&&o<u+y&&window.getComputedStyle(g).display!=="none")return g}}return null},"#getNearElement"));p(this,H,r),p(this,_t,r.getRootNode().host),st(this,mt,qs).call(this),x.log("🎯 [CellNavigation] Initialized")}get currentCell(){return t(this,X)}set currentCell(r){r&&(p(this,X,r),r.focus({preventScroll:!0}),p(this,j,r.closest("tr")),t(this,H).selection.setFocus(t(this,j).dataset.matrixRow,t(this,X).dataset.col))}moveCell(r){if(x.log(t(this,X)),!t(this,X))return;const e=t(this,X),s=parseInt(e.dataset.row,10),n=parseInt(e.dataset.col,10),o=t(this,H).templateLength,i=parseInt(t(this,j).dataset.subrow,10),a=s*o+(i>=0?i:0);let c=a,l=n;switch(r.code){case"Tab":if(r.preventDefault(),r.shiftKey){if(l=t(this,zt).call(this,a,n),l<0&&a>0){c=a-1;const b=t(this,wt).call(this,c),f=t(this,Ot).call(this,b);l=f?parseInt(f.dataset.col,10):0}}else{l=t(this,Wt).call(this,a,n);const b=t(this,wt).call(this,a),f=t(this,Ot).call(this,b),y=f?parseInt(f.dataset.col,10)+parseInt(f.colSpan||1,10):0;l>=y&&(c=a+1,l=0)}break;case"ArrowRight":l=t(this,Wt).call(this,a,n);break;case"ArrowLeft":l=t(this,zt).call(this,a,n);break;case"ArrowDown":r.preventDefault(),c=a+(e.rowSpan||1),x.log("templateLength",o,"matrixRow:",a,"nextMatrixRow",c);break;case"ArrowUp":r.preventDefault(),c=Math.max(0,a-(e.rowSpan||1));break}switch(r.code){case"Tab":break;case"ArrowRight":if(x.log(l,t(this,Dt).call(this,s)),l>t(this,Dt).call(this,s))return;break;case"ArrowLeft":if(n<=t(this,de).call(this,s))return;break;case"ArrowDown":const f=t(this,_t).data.length*o-1;if(a+(e.rowSpan||1)>f)return;break;case"ArrowUp":if(a<=0)return;break}const u=Math.floor(c/o),g=c%o;t(this,H).rowManager.scrollToDataRow(u,()=>{let b=t(this,fe).call(this,u,g,l,c);this.currentCell=b,t(this,H).selection.setRange(t(this,j).dataset.matrixRow,b.dataset.col,t(this,j).dataset.matrixRow,b.dataset.col),st(this,mt,Es).call(this,b)})}};H=new WeakMap,_t=new WeakMap,X=new WeakMap,j=new WeakMap,Je=new WeakMap,Qe=new WeakMap,mt=new WeakSet,Es=d(function(r){const e=t(this,H).querySelector(".ng-container-body .ng-part-body");if(!e)return;const s=r.getBoundingClientRect(),n=e.getBoundingClientRect();s.top<n.top?e.scrollTop-=n.top-s.top:s.bottom>n.bottom&&(e.scrollTop+=s.bottom-n.bottom),s.left<n.left?e.scrollLeft-=n.left-s.left:s.right>n.right&&(e.scrollLeft+=s.right-n.right)},"#ensureCellVisible"),de=new WeakMap,Dt=new WeakMap,Ot=new WeakMap,Wt=new WeakMap,zt=new WeakMap,wt=new WeakMap,fe=new WeakMap,qs=d(function(){if(!t(this,H).querySelector(".ng-container-top")){x.log("❌ [CellSelection] .ng-container-top not found!");return}t(this,H).addEventListener("mousedown",e=>{if(e.button!==0)return;const s=e.target.closest("td, th");s&&(s.dataset.row===void 0||s.dataset.col===void 0||(this.currentCell=s))}),t(this,H).addEventListener("keydown",e=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code)&&this.moveCell(e)})},"#initEvents"),d(ts,"CellNavigation");let Me=ts;const Ft=class Ft extends HTMLElement{constructor(){super();h(this,ue);h(this,Q);h(this,Bt);h(this,Pt);h(this,V,{table:null});T(this,"invalidate",d(()=>{x.log("sheet.invalidate()"),t(this,Q).refresh()},"invalidate"));T(this,"generate",d(e=>{if(x.log("sheet.generate()"),!e)return;t(this,V).table=Le.compile(e),t(this,V).tbody={tr:t(this,V).table.querySelectorAll("tbody tr")},t(this,ge).call(this),t(this,be).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),n=this.querySelector(".ng-container-body .ng-part-footer"),o=this.querySelector(".ng-nodata-overlay");s&&o&&(o.style.top=`${s.offsetHeight}px`),n&&o&&(o.style.bottom=`${n.offsetHeight}px`),t(this,Q).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));h(this,ge,d(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:n})=>{var o,i,a;(o=this.querySelector(`${s} .ng-part-header`))==null||o.appendChild(t(this,xt).call(this,t(this,V).table,n,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,xt).call(this,t(this,V).table,n,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,xt).call(this,t(this,V).table,n,"footer"))})},"#renderSplitContainers"));h(this,be,d(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),n=s==null?void 0:s.querySelectorAll("table");if(!s||!n||n.length===0)return;let o=0;n[0].querySelectorAll("col").forEach(i=>{const a=parseInt(i.getAttribute("width"),10);isNaN(a)||(o+=a)}),e==="body"?(s.style.flex="1",n.forEach(i=>{i.style.width=`${o}px`,i.style.minWidth=`${o}px`})):(s.style.flex=`0 0 ${o}px`,s.style.width=`${o}px`,n.forEach(i=>{i.style.width=`${o}px`,i.style.minWidth=`${o}px`}))})},"#updateContainerWidths"));h(this,xt,d((e,s,n)=>{const o=e.cloneNode(!0),i=o.querySelector("thead"),a=o.querySelector("tbody"),c=o.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const u=document.createElement("tbody");u.className="fixed-tbody",o.appendChild(u)}}else n==="body"?(i&&i.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):n==="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"));T(this,"getRowHeight",d(()=>t(this,Q).getRowHeight(),"getRowHeight"));T(this,"scrollToX",d(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",d(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));h(this,pe,d(()=>{t(this,ye).call(this),p(this,Bt,new Ie(this)),p(this,Pt,new Me(this))},"#init"));h(this,ye,d(()=>{const e=Ft.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;
@@ -269,10 +269,20 @@
269
269
  --display: none;
270
270
  }
271
271
 
272
+ nine-table-sheet td,
273
+ nine-table-sheet th {
274
+ outline: none;
275
+ }
276
+
272
277
  nine-table-sheet td.selected,
273
278
  nine-table-sheet th.selected {
274
279
  background-color: rgba(37, 99, 235, 0.08);
275
- position: relative; /* z-index와 가상 μš”μ†Œ 기쀀점 */
280
+ --position: relative; /* z-index와 가상 μš”μ†Œ 기쀀점 */
281
+ }
282
+
283
+ nine-table-sheet td.selected-start,
284
+ nine-table-sheet th.selected-start {
285
+ background-color: transparent;
276
286
  }
277
287
 
278
288
  /* box-shadow λŒ€μ‹  z-indexλ₯Ό 높이고 ν…Œλ‘λ¦¬ 선을 λšœλ ·ν•˜κ²Œ μ˜€λ²„λ ˆμ΄ */
@@ -321,7 +331,7 @@
321
331
  <nine-table-hscrollbar></nine-table-hscrollbar>
322
332
  <div class='ng-scroll-edge'></div>
323
333
  </div>
324
- `},"#render"));y(this,dt,new Ce(this)),y(this,fe,this.getRootNode().host)}connectedCallback(){t(this,be).call(this)}get selection(){return t(this,Wt)}get templateLength(){return t(this,j).tbody.tr.length}get navigation(){return t(this,zt)}disconnectedCallback(){this.innerHTML="",x.log("NineTableSheet destroyed.")}};fe=new WeakMap,dt=new WeakMap,Wt=new WeakMap,zt=new WeakMap,j=new WeakMap,ue=new WeakMap,ge=new WeakMap,xt=new WeakMap,be=new WeakMap,pe=new WeakMap,d(Bt,"NineTableSheet"),T(Bt,"SCROLLBAR_SIZE",16);let Gt=Bt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Gt);const Qe=class Qe extends HTMLElement{constructor(){super();h(this,ye,d(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var r;const o=s.ctrlKey||s.metaKey||s.shiftKey,a=parseInt((r=s.target.closest(".nine-tab-item"))==null?void 0:r.dataset.index,10);t(this,Pt).call(this,a,o)}),t(this,Pt).call(this,0,!1)},"#init"));h(this,Pt,d((e,s=!1)=>{const o=d(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(u=>u.style.setProperty("display","none"));const b=f.filter(u=>u.classList.contains("active"));b.length<2||b.forEach(u=>{const p=parseInt(u.getAttribute("data-index"),10),m=this.querySelector(`nine-splitter[data-split-index="${p}"]`),S=f[p+1];m&&S&&S.classList.contains("active")&&m.style.setProperty("display","flex")})},"updateSplitters"),a=this.querySelector(".nine-tab-bar"),r=this.querySelector("nine-table-sheets-body"),i=a.querySelectorAll(".nine-tab-item"),c=r.querySelectorAll("nine-table-sheet");if(!i[e])return;if(!s)i.forEach((f,g)=>{f.classList.toggle("active",g===e)}),c.forEach((f,g)=>{const b=g===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=i[e],g=a.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&g.length<=1)return;f.classList.toggle("active");const b=r.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=r.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(f=>{f.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),o()},"#switchSheet"))}connectedCallback(){t(this,ye).call(this)}};ye=new WeakMap,Pt=new WeakMap,d(Qe,"NineTableSheets");let Me=Qe;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",Me);const ts=class ts{constructor(n){h(this,_);h(this,me,d(()=>{t(this,xe).call(this),new ResizeObserver(n=>{for(let e of n)t(this,_).getAttribute("auto-height")==="true"&&t(this,Ft).call(this)}).observe(t(this,_))},"#init"));h(this,Ft,d(()=>{var c,l;const n=Array.from(t(this,_).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,_).getAttribute("max-display-row"),10)||10,s=Math.max(...n.map(f=>f.getRowHeight())),o=(c=t(this,_).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,a=(l=t(this,_).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,r=Gt.SCROLLBAR_SIZE,i=e*s+o+a+r;t(this,_).style.height=`${i}px`},"#applyAutoHeight"));h(this,xe,d(()=>{const e=Array.from(t(this,_).children).filter(c=>c.tagName==="TABLE"),s=t(this,_).getAttribute("auto-height")==="true",o=e.length,a=e.map((c,l)=>{const g=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<o-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return g+b}).join(""),r=e.map((c,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,_).shadowRoot.innerHTML=`
334
+ `},"#render"));p(this,Q,new ke(this)),p(this,ue,this.getRootNode().host)}connectedCallback(){t(this,pe).call(this)}get rowManager(){return t(this,Q)}get selection(){return t(this,Bt)}get templateLength(){return t(this,V).tbody.tr.length}get navigation(){return t(this,Pt)}disconnectedCallback(){this.innerHTML="",x.log("NineTableSheet destroyed.")}};ue=new WeakMap,Q=new WeakMap,Bt=new WeakMap,Pt=new WeakMap,V=new WeakMap,ge=new WeakMap,be=new WeakMap,xt=new WeakMap,pe=new WeakMap,ye=new WeakMap,d(Ft,"NineTableSheet"),T(Ft,"SCROLLBAR_SIZE",16);let Qt=Ft;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Qt);const es=class es extends HTMLElement{constructor(){super();h(this,me,d(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var i;const n=s.ctrlKey||s.metaKey||s.shiftKey,o=parseInt((i=s.target.closest(".nine-tab-item"))==null?void 0:i.dataset.index,10);t(this,jt).call(this,o,n)}),t(this,jt).call(this,0,!1)},"#init"));h(this,jt,d((e,s=!1)=>{const n=d(()=>{const u=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(f=>f.style.setProperty("display","none"));const b=u.filter(f=>f.classList.contains("active"));b.length<2||b.forEach(f=>{const y=parseInt(f.getAttribute("data-index"),10),v=this.querySelector(`nine-splitter[data-split-index="${y}"]`),S=u[y+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,g)=>{u.classList.toggle("active",g===e)}),c.forEach((u,g)=>{const b=g===e;u.classList.toggle("active",b),u.style.flex=b?"1 1 100%":""});else{const u=a[e],g=o.querySelectorAll(".nine-tab-item.active");if(u.classList.contains("active")&&g.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%"}),n()},"#switchSheet"))}connectedCallback(){t(this,me).call(this)}};me=new WeakMap,jt=new WeakMap,d(es,"NineTableSheets");let He=es;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",He);const ss=class ss{constructor(r){h(this,O);h(this,we,d(()=>{t(this,xe).call(this),new ResizeObserver(r=>{for(let e of r)t(this,O).getAttribute("auto-height")==="true"&&t(this,Vt).call(this)}).observe(t(this,O))},"#init"));h(this,Vt,d(()=>{var c,l;const r=Array.from(t(this,O).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(r.length===0)return;const e=parseInt(t(this,O).getAttribute("max-display-row"),10)||10,s=Math.max(...r.map(u=>u.getRowHeight())),n=(c=t(this,O).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,o=(l=t(this,O).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,i=Qt.SCROLLBAR_SIZE,a=e*s+n+o+i;t(this,O).style.height=`${a}px`},"#applyAutoHeight"));h(this,xe,d(()=>{const e=Array.from(t(this,O).children).filter(c=>c.tagName==="TABLE"),s=t(this,O).getAttribute("auto-height")==="true",n=e.length,o=e.map((c,l)=>{const g=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return g+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,O).shadowRoot.innerHTML=`
325
335
  <style>
326
336
  :host {
327
337
  display: flex;
@@ -432,19 +442,19 @@
432
442
  <nine-table-body>
433
443
  <nine-table-summary></nine-table-summary>
434
444
  <nine-table-sheets>
435
- <nine-table-sheets-body>${a}</nine-table-sheets-body>
445
+ <nine-table-sheets-body>${o}</nine-table-sheets-body>
436
446
  <nine-table-sheets-footer>
437
- <div class="nine-tab-bar">${r}</div>
447
+ <div class="nine-tab-bar">${i}</div>
438
448
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
439
449
  </nine-table-sheets-footer>
440
450
  </nine-table-sheets>
441
451
  <nine-table-analysis></nine-table-analysis>
442
452
  </nine-table-body>
443
453
  <nine-table-footer></nine-table-footer>
444
- `,t(this,_).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const i=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");i==null||i.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Ft).call(this)})})},"#render"));y(this,_,n),t(this,me).call(this)}};_=new WeakMap,me=new WeakMap,Ft=new WeakMap,xe=new WeakMap,d(ts,"LayoutManager");let He=ts;const es=class es{constructor(n){h(this,jt);h(this,wt,-1);T(this,"count",d(()=>t(this,jt).rawRecords.length,"count"));y(this,jt,n)}get at(){return t(this,wt)}set at(n){y(this,wt,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,wt)}"]`)&&setTimeout(()=>{})}};jt=new WeakMap,wt=new WeakMap,d(es,"ngRow");let $e=es;const P=class P{constructor(n,e){h(this,O);h(this,L);h(this,z,[]);h(this,vt,[]);h(this,we,0);h(this,G,[]);h(this,ve,d(()=>{y(this,G,[]);const n=t(this,O).template||[];Array.from(n).forEach(e=>{var s;t(this,G).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Ut).call(this)),e.__ng.height=t(this,G).slice()})},"#initialize"));h(this,ft,d(()=>{const n=t(this,O).shadowRoot.querySelector("nine-table-sheets");n==null||n.classList.toggle("nodata",this.length===0),t(this,O).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));T(this,"get",d((n,e)=>{var a;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 o=typeof((a=t(this,O).fields)==null?void 0:a.get)=="function"?t(this,O).fields.get():[];if(e!=null){const r=o.indexOf(e);return r>=0?s[n].v[r]:null}return t(this,St).call(this,s[n])},"get"));T(this,"set",d(n=>{this.clear(),this.add(n,!1),t(this,ft).call(this)},"set"));h(this,Ut,d(()=>({rowState:P.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,G).slice(),o:{},c:{},_:[0,0,0,0,P.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,G).slice(),-1,{},{}]}),"#getDefaultMeta"));T(this,"reset",d(()=>{y(this,z,[]),y(this,vt,[]),t(this,ft).call(this)},"reset"));T(this,"clear",d(()=>{var n;t(this,L).rawRecords=[],y(this,z,[]),y(this,vt,[]),(n=t(this,L).viewRecords)!=null&&n.reset&&t(this,L).viewRecords.reset()},"clear"));h(this,Se,d(n=>{var o;Array.isArray(n)||(n=[n]);const e=typeof((o=t(this,O).fields)==null?void 0:o.get)=="function"?t(this,O).fields.get():Object.keys(n[0]||{}),s=[];return n.forEach(a=>{const r={v:[]};e.forEach(i=>{r.v.push(a[i]!==void 0&&a[i]!==null?a[i]:"")}),s.push(r)}),s},"#json2Array"));h(this,Re,d(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,Ut).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=P.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));T(this,"add",d((n,e=!0)=>{n===void 0&&(n={});const s=t(this,Se).call(this,n);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,Re).call(this,s)),this.resetRecords();const o=this.count()-1;return e||s.forEach((a,r)=>{const i=t(this,L).rawRecords[o-r];i&&(i.__ng.rowState=P.ROW_STATE.EMPTY)}),t(this,ft).call(this),o},"add"));T(this,"delete",d(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,L).host.row.at]:e=[parseInt(n,10)],e.sort((s,o)=>o-s).forEach(s=>{if(t(this,z)[s]){const o=t(this,z)[s].__ng.rowid;t(this,z)[s].__ng.rowState===P.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(a=>a.__ng.rowid!==o):t(this,L).rawRecords.forEach(a=>{a.__ng.rowid===o&&(a.__ng.deleted=!0,a.__ng.rowState=P.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,ft).call(this)},"delete"));T(this,"setValue",d((n,e,s)=>{var c;n=parseInt(n,10);const a=(typeof((c=t(this,O).fields)==null?void 0:c.get)=="function"?t(this,O).fields.get():[]).indexOf(e);if(a<0)return;const r=this.getValidData()[n];if(!r)return;const i=r.v[a];i!==s&&r.__ng.rowState!==P.ROW_STATE.INSERT&&(r.__ng.o.hasOwnProperty(e)||(r.__ng.o[e]=i),r.__ng.rowState=P.ROW_STATE.UPDATE),r.v[a]=s},"setValue"));T(this,"resetRecords",d(()=>{y(this,vt,t(this,L).rawRecords.filter(n=>!n.__ng.deleted)),y(this,z,t(this,L).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,L).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,z).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));T(this,"getValidData",d(()=>(t(this,z).length===0&&t(this,L).rawRecords.length>0&&this.resetRecords(),t(this,z)),"getValidData"));h(this,St,d(n=>{var r;if(!n)return n;const e=!Array.isArray(n),s=e?[n]:n,o=typeof((r=t(this,O).fields)==null?void 0:r.get)=="function"?t(this,O).fields.get():[],a=s.filter(i=>!i.__ng.deleted).map(i=>{const c={};return o.forEach((l,f)=>{c[l]=i.v?i.v[f]:i[l]}),c.__ng=i.__ng,c});return e?a[0]:a},"#conv"));T(this,"count",d(()=>this.getValidData().length,"count"));y(this,O,n),y(this,L,e),t(this,ve).call(this)}get source(){return t(this,St).call(this,t(this,L).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++vs(this,we)._}get count(){return t(this,z).length}get length(){return t(this,z).length}getRowCount(){return this.length}};O=new WeakMap,L=new WeakMap,z=new WeakMap,vt=new WeakMap,we=new WeakMap,G=new WeakMap,ve=new WeakMap,ft=new WeakMap,Ut=new WeakMap,Se=new WeakMap,Re=new WeakMap,St=new WeakMap,d(P,"ngData"),T(P,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Ne=P;const ss=class ss{constructor(n){h(this,ut);y(this,ut,n),this.row=new $e(this),this.data=new Ne(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 o,a;const s=parseInt(e,10);if(!(s>=this.data.count()))return(a=(o=this.data.getValidData()[s])==null?void 0:o.__ng)==null?void 0:a.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,o)=>{e=parseInt(e,10),this.data.setValue(e,s,o)},this.setDataSource([])}};ut=new WeakMap,d(ss,"ngDataManager");let _e=ss;const ns=class ns{constructor(n){h(this,Rt);h(this,H,[]);T(this,"add",d((n,e="string")=>{n.forEach(s=>{t(this,H).some(o=>o.name===s)||t(this,H).push({name:s,type:e})}),t(this,Vt).call(this)},"add"));h(this,Vt,d(()=>{const n=new Map;t(this,H).forEach(e=>{n.set(e.name,e.type)}),y(this,H,Array.from(n,([e,s])=>({name:e,type:s}))),y(this,H,t(this,H).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,H).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));h(this,Ae,d(()=>{y(this,H,[]),x.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)x.log(e),$("[data-bind]",e).each((s,o)=>{const a=o.dataset.bind,r=o.getAttribute("data-type")||"string";a&&t(this,H).push({name:a,type:r})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((o,a)=>{var r=a.getAttribute(s);if(r.indexOf("data.")<0){const i=r.search(/[(]/g);if(i>0)try{r=String(window[r.substring(0,i).trim()])}catch{r=""}}r.split("data.").forEach(i=>{if(i.trim()!=""){const c=i.search(/[^_A-Za-z0-9]/g);let l="";c>=0?l=i.substring(0,c):r.startsWith("data.")&&(l=i.replace("data.","")),l&&t(this,H).push({name:l,type:"string"})}})})});t(this,Vt).call(this)}},"#init"));y(this,Rt,n),t(this,Ae).call(this)}get(){return t(this,H).map(n=>n.name)}getFields(){return t(this,H)}getType(n){const e=t(this,H).find(s=>s.name===n);return e?e.type:"string"}indexOf(n){return t(this,H).findIndex(e=>e.name===n)}includes(n){return t(this,H).some(e=>e.name===n)}};Rt=new WeakMap,H=new WeakMap,Vt=new WeakMap,Ae=new WeakMap,d(ns,"ngFields");let De=ns;const rs=class rs extends HTMLElement{constructor(){super();h(this,gt);h(this,Ee);h(this,qe,d(()=>{this.fields=new De(this),y(this,Ee,new He(this)),x.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,gt,new _e(this))}connectedCallback(){t(this,qe).call(this)}disconnectedCallback(){x.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,Ee=new WeakMap,qe=new WeakMap,d(rs,"NineTable");let Oe=rs;customElements.get("nine-table")||customElements.define("nine-table",Oe);const Yt=class Yt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};d(Yt,"BasicCellElement"),T(Yt,"_styleCache",new Map),T(Yt,"_customStyleCache",new Map);let We=Yt;const hs=class hs extends We{constructor(){super();h(this,I);h(this,Xt);h(this,v);h(this,os);h(this,is);h(this,as);h(this,ls);T(this,"getDisplayText",d(e=>{if(t(this,v))if(t(this,v).closest("tbody")){const s=t(this,v).closest("tr").data,o=parseInt(t(this,v).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,v).dataset.expr)){if(!ninegrid.isNull(t(this,v).dataset.bind))return s[t(this,v).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,v).dataset.expr,s,o,t(this,v))}catch{console.error(t(this,v).dataset.expr,s,t(this,v).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,I).exprFunction(t(this,v).dataset.expr).call(this,null,-1,t(this,I).data)}catch{}},"getDisplayText"));h(this,cs,d(()=>{if(!(!t(this,I)||!t(this,I).template||!t(this,v).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,v)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,v).closest("tr"),o=[];$("th,td",s).each((w,M)=>{var C=ninegrid.j.querySelectorAll(M).attr("suppress");C&&M.dataset.row&&(C=parseInt(C),!isNaN(C)&&C<=e&&o.push(C))}),o.sort();var a=!1;if(parseInt(s.sectionRowIndex/t(this,I).template.length)>0)for(var r of o){if(r>e)break;var i=parseInt(t(this,v).dataset.row),c=i-1,l=t(this,v).closest("tr").data,f=t(this,I).data.get(c);t(this,v).dataset.matrixRow;var g=t(this,I).body.querySelector(`tbody.bindable [suppress="${r}"][data-matrix-row="${t(this,v).dataset.matrixRow}"]`),b=g.dataset.expr?this.getExprValue(g.dataset.expr,l,i):l[g.dataset.bind],u=g.dataset.expr?this.getExprValue(g.dataset.expr,f,c):f[g.dataset.bind];if(b!=u){a=!0;break}}else a=!0;a?ninegrid.j.querySelectorAll(t(this,v)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,v)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,v)).hasClass("hidden")||(a?ninegrid.j.querySelectorAll(t(this,v)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,v)).addClass("hidden"));var p=parseInt(t(this,v).dataset.matrixRow),m=p-1,S=t(this,I).body.querySelector(`tbody.bindable [data-col="${t(this,v).dataset.col}"][data-matrix-row="${m}"]`);$(S).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,v)).hasClass("suppress")?ninegrid.j.querySelectorAll(S).removeClass("last-none-suppress").addClass("last-suppress"):!$(S).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,v)).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"));T(this,"getExprValue",d((e,s,o,a)=>{if(typeof e<"u")try{o=parseInt(o);const r=e.replace("()","");return t(this,I)[r]?t(this,I)[r].call(this,s,o,t(this,v)):t(this,I).exprFunction(e).call(this,s,o,t(this,I).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,I,this.getRootNode().host),y(this,v,this.closest("th,td")),y(this,Xt,t(this,v).closest("tr"))}get value(){var e=!t(this,I)||!t(this,I).dataManager||!t(this,v)||!t(this,v).dataset||!t(this,v).dataset.row||!t(this,v).dataset.bind?"":t(this,v).closest("tr").data[t(this,v).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,v).dataset.row);const o=this.getAttribute("update-row-state")!="false";s<0?t(this,I).data.setValueNF(parseInt(t(this,v).dataset.index),t(this,v).dataset.bind,e,o):t(this,I).data.setValue(s,t(this,v).dataset.bind,e,o)}get row(){return parseInt(t(this,v).dataset.row)}get data(){return t(this,v).closest("tr").data}refresh(){const e=t(this,v).dataset.bind;return parseInt(t(this,v).dataset.row),t(this,Xt).data[e]}};I=new WeakMap,Xt=new WeakMap,v=new WeakMap,os=new WeakMap,is=new WeakMap,as=new WeakMap,ls=new WeakMap,cs=new WeakMap,d(hs,"CellElement");let ze=hs;const ds=class ds extends ze{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};d(ds,"EditableCellElement");let Be=ds;const us=class us extends Be{constructor(){super();h(this,Kt);h(this,bt);h(this,At);h(this,Et);h(this,Te);h(this,J);T(this,"refresh",d(()=>{const e=super.refresh();t(this,Kt).value=e},"refresh"));h(this,fs,d(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,bt)=="number"){let a=[];if(t(this,J)&&Number(t(this,J))>0&&a.push("."),t(this,Et)&&Number(t(this,Et))>=0&&a.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!a.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,o=s.indexOf(".");if(o>=0){var s=s.substr(o+1,s.length);s.length>=Number(t(this,J))&&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(),y(this,bt,this.getAttribute("type")||"text"),y(this,At,this.getAttribute("maxbyte")),y(this,Et,this.getAttribute("min")),y(this,Te,this.getAttribute("max")),y(this,J,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=`
454
+ `,t(this,O).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,O).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Vt).call(this)})})},"#render"));p(this,O,r),t(this,we).call(this)}};O=new WeakMap,we=new WeakMap,Vt=new WeakMap,xe=new WeakMap,d(ss,"LayoutManager");let $e=ss;const rs=class rs{constructor(r){h(this,Ut);h(this,vt,-1);T(this,"count",d(()=>t(this,Ut).rawRecords.length,"count"));p(this,Ut,r)}get at(){return t(this,vt)}set at(r){p(this,vt,parseInt(r,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,vt)}"]`)&&setTimeout(()=>{})}};Ut=new WeakMap,vt=new WeakMap,d(rs,"ngRow");let Ne=rs;const P=class P{constructor(r,e){h(this,W);h(this,L);h(this,B,[]);h(this,St,[]);h(this,ve,0);h(this,tt,[]);h(this,Se,d(()=>{p(this,tt,[]);const r=t(this,W).template||[];Array.from(r).forEach(e=>{var s;t(this,tt).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Yt).call(this)),e.__ng.height=t(this,tt).slice()})},"#initialize"));h(this,ut,d(()=>{const r=t(this,W).shadowRoot.querySelector("nine-table-sheets");r==null||r.classList.toggle("nodata",this.length===0),t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));T(this,"get",d((r,e)=>{var o;const s=this.getValidData();if(!s||s.length<=0)return;if(r==null)return t(this,Rt).call(this,s);if(r<0||r>=s.length)return null;const n=typeof((o=t(this,W).fields)==null?void 0:o.get)=="function"?t(this,W).fields.get():[];if(e!=null){const i=n.indexOf(e);return i>=0?s[r].v[i]:null}return t(this,Rt).call(this,s[r])},"get"));T(this,"set",d(r=>{this.clear(),this.add(r,!1),t(this,ut).call(this)},"set"));h(this,Yt,d(()=>({rowState:P.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,tt).slice(),o:{},c:{},_:[0,0,0,0,P.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,tt).slice(),-1,{},{}]}),"#getDefaultMeta"));T(this,"reset",d(()=>{p(this,B,[]),p(this,St,[]),t(this,ut).call(this)},"reset"));T(this,"clear",d(()=>{var r;t(this,L).rawRecords=[],p(this,B,[]),p(this,St,[]),(r=t(this,L).viewRecords)!=null&&r.reset&&t(this,L).viewRecords.reset()},"clear"));h(this,Re,d(r=>{var n;Array.isArray(r)||(r=[r]);const e=typeof((n=t(this,W).fields)==null?void 0:n.get)=="function"?t(this,W).fields.get():Object.keys(r[0]||{}),s=[];return r.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"));h(this,Ae,d(r=>(Array.isArray(r)||(r=[r]),r.forEach(e=>{e.__ng=t(this,Yt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=P.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),r),"#defaultInsert"));T(this,"add",d((r,e=!0)=>{r===void 0&&(r={});const s=t(this,Re).call(this,r);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,Ae).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((o,i)=>{const a=t(this,L).rawRecords[n-i];a&&(a.__ng.rowState=P.ROW_STATE.EMPTY)}),t(this,ut).call(this),n},"add"));T(this,"delete",d(r=>{let e=[];Array.isArray(r)?e=r:typeof r>"u"?e=[t(this,L).host.row.at]:e=[parseInt(r,10)],e.sort((s,n)=>n-s).forEach(s=>{if(t(this,B)[s]){const n=t(this,B)[s].__ng.rowid;t(this,B)[s].__ng.rowState===P.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(o=>o.__ng.rowid!==n):t(this,L).rawRecords.forEach(o=>{o.__ng.rowid===n&&(o.__ng.deleted=!0,o.__ng.rowState=P.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,ut).call(this)},"delete"));T(this,"setValue",d((r,e,s)=>{var c;r=parseInt(r,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()[r];if(!i)return;const a=i.v[o];a!==s&&i.__ng.rowState!==P.ROW_STATE.INSERT&&(i.__ng.o.hasOwnProperty(e)||(i.__ng.o[e]=a),i.__ng.rowState=P.ROW_STATE.UPDATE),i.v[o]=s},"setValue"));T(this,"resetRecords",d(()=>{p(this,St,t(this,L).rawRecords.filter(r=>!r.__ng.deleted)),p(this,B,t(this,L).rawRecords.filter(r=>!r.__ng.deleted&&!r.__ng.filtered)),t(this,L).rawRecords.forEach((r,e)=>{r.__ng.rowidx=e}),t(this,B).forEach((r,e)=>{r.__ng.i=e})},"resetRecords"));T(this,"getValidData",d(()=>(t(this,B).length===0&&t(this,L).rawRecords.length>0&&this.resetRecords(),t(this,B)),"getValidData"));h(this,Rt,d(r=>{var i;if(!r)return r;const e=!Array.isArray(r),s=e?[r]:r,n=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 n.forEach((l,u)=>{c[l]=a.v?a.v[u]:a[l]}),c.__ng=a.__ng,c});return e?o[0]:o},"#conv"));T(this,"count",d(()=>this.getValidData().length,"count"));p(this,W,r),p(this,L,e),t(this,Se).call(this)}get source(){return t(this,Rt).call(this,t(this,L).rawRecords)}set source(r){this.clear(),this.add(r,!1)}get nextId(){return++Rs(this,ve)._}get count(){return t(this,B).length}get length(){return t(this,B).length}getRowCount(){return this.length}};W=new WeakMap,L=new WeakMap,B=new WeakMap,St=new WeakMap,ve=new WeakMap,tt=new WeakMap,Se=new WeakMap,ut=new WeakMap,Yt=new WeakMap,Re=new WeakMap,Ae=new WeakMap,Rt=new WeakMap,d(P,"ngData"),T(P,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let _e=P;const ns=class ns{constructor(r){h(this,gt);p(this,gt,r),this.row=new Ne(this),this.data=new _e(t(this,gt),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,gt).view)!=null&&e.redraw&&t(this,gt).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var n,o;const s=parseInt(e,10);if(!(s>=this.data.count()))return(o=(n=this.data.getValidData()[s])==null?void 0:n.__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,n)=>{e=parseInt(e,10),this.data.setValue(e,s,n)},this.setDataSource([])}};gt=new WeakMap,d(ns,"ngDataManager");let De=ns;const os=class os{constructor(r){h(this,At);h(this,N,[]);T(this,"add",d((r,e="string")=>{r.forEach(s=>{t(this,N).some(n=>n.name===s)||t(this,N).push({name:s,type:e})}),t(this,Xt).call(this)},"add"));h(this,Xt,d(()=>{const r=new Map;t(this,N).forEach(e=>{r.set(e.name,e.type)}),p(this,N,Array.from(r,([e,s])=>({name:e,type:s}))),p(this,N,t(this,N).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,N).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));h(this,Ee,d(()=>{p(this,N,[]),x.log(t(this,At).querySelectorAll("table"));const r=Array.from(t(this,At).querySelectorAll("table"));if(!(!r||r.length===0)){for(const e of r)x.log(e),$("[data-bind]",e).each((s,n)=>{const o=n.dataset.bind,i=n.getAttribute("data-type")||"string";o&&t(this,N).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((n,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,N).push({name:l,type:"string"})}})})});t(this,Xt).call(this)}},"#init"));p(this,At,r),t(this,Ee).call(this)}get(){return t(this,N).map(r=>r.name)}getFields(){return t(this,N)}getType(r){const e=t(this,N).find(s=>s.name===r);return e?e.type:"string"}indexOf(r){return t(this,N).findIndex(e=>e.name===r)}includes(r){return t(this,N).some(e=>e.name===r)}};At=new WeakMap,N=new WeakMap,Xt=new WeakMap,Ee=new WeakMap,d(os,"ngFields");let Oe=os;const is=class is extends HTMLElement{constructor(){super();h(this,bt);h(this,qe);h(this,Te,d(()=>{this.fields=new Oe(this),p(this,qe,new $e(this)),x.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),p(this,bt,new De(this))}connectedCallback(){t(this,Te).call(this)}disconnectedCallback(){x.log("NineTable disconnected.")}get data(){return t(this,bt).data}get row(){return t(this,bt).row}get dataManager(){return t(this,bt)}};bt=new WeakMap,qe=new WeakMap,Te=new WeakMap,d(is,"NineTable");let We=is;customElements.get("nine-table")||customElements.define("nine-table",We);const Kt=class Kt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};d(Kt,"BasicCellElement"),T(Kt,"_styleCache",new Map),T(Kt,"_customStyleCache",new Map);let ze=Kt;const fs=class fs extends ze{constructor(){super();h(this,I);h(this,Zt);h(this,w);h(this,as);h(this,ls);h(this,cs);h(this,hs);T(this,"getDisplayText",d(e=>{if(t(this,w))if(t(this,w).closest("tbody")){const s=t(this,w).closest("tr").data,n=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,n,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,I).exprFunction(t(this,w).dataset.expr).call(this,null,-1,t(this,I).data)}catch{}},"getDisplayText"));h(this,ds,d(()=>{if(!(!t(this,I)||!t(this,I).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"),n=[];$("th,td",s).each((m,_)=>{var C=ninegrid.j.querySelectorAll(_).attr("suppress");C&&_.dataset.row&&(C=parseInt(C),!isNaN(C)&&C<=e&&n.push(C))}),n.sort();var o=!1;if(parseInt(s.sectionRowIndex/t(this,I).template.length)>0)for(var i of n){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,I).data.get(c);t(this,w).dataset.matrixRow;var g=t(this,I).body.querySelector(`tbody.bindable [suppress="${i}"][data-matrix-row="${t(this,w).dataset.matrixRow}"]`),b=g.dataset.expr?this.getExprValue(g.dataset.expr,l,a):l[g.dataset.bind],f=g.dataset.expr?this.getExprValue(g.dataset.expr,u,c):u[g.dataset.bind];if(b!=f){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 y=parseInt(t(this,w).dataset.matrixRow),v=y-1,S=t(this,I).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"));T(this,"getExprValue",d((e,s,n,o)=>{if(typeof e<"u")try{n=parseInt(n);const i=e.replace("()","");return t(this,I)[i]?t(this,I)[i].call(this,s,n,t(this,w)):t(this,I).exprFunction(e).call(this,s,n,t(this,I).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),p(this,I,this.getRootNode().host),p(this,w,this.closest("th,td")),p(this,Zt,t(this,w).closest("tr"))}get value(){var e=!t(this,I)||!t(this,I).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 n=this.getAttribute("update-row-state")!="false";s<0?t(this,I).data.setValueNF(parseInt(t(this,w).dataset.index),t(this,w).dataset.bind,e,n):t(this,I).data.setValue(s,t(this,w).dataset.bind,e,n)}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,Zt).data[e]}};I=new WeakMap,Zt=new WeakMap,w=new WeakMap,as=new WeakMap,ls=new WeakMap,cs=new WeakMap,hs=new WeakMap,ds=new WeakMap,d(fs,"CellElement");let Be=fs;const us=class us extends Be{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};d(us,"EditableCellElement");let Pe=us;const bs=class bs extends Pe{constructor(){super();h(this,Gt);h(this,pt);h(this,Et);h(this,qt);h(this,Ce);h(this,et);T(this,"refresh",d(()=>{const e=super.refresh();t(this,Gt).value=e},"refresh"));h(this,gs,d(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,pt)=="number"){let o=[];if(t(this,et)&&Number(t(this,et))>0&&o.push("."),t(this,qt)&&Number(t(this,qt))>=0&&o.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!o.includes(e.key)&&e.preventDefault(),t(this,et)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,n=s.indexOf(".");if(n>=0){var s=s.substr(n+1,s.length);s.length>=Number(t(this,et))&&e.preventDefault()}}}t(this,Et)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,Et))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),p(this,pt,this.getAttribute("type")||"text"),p(this,Et,this.getAttribute("maxbyte")),p(this,qt,this.getAttribute("min")),p(this,Ce,this.getAttribute("max")),p(this,et,this.getAttribute("scale")),!["text","number"].includes(t(this,pt)))throw`invalid type : ${t(this,pt)}`}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
455
  <input type="text"
446
456
  ${e.join(" ")}
447
457
  ondragstart="return false;"
448
458
  >
449
- `,super.connectedCallback(),y(this,Kt,this.querySelector("input"))}};Kt=new WeakMap,bt=new WeakMap,At=new WeakMap,Et=new WeakMap,Te=new WeakMap,J=new WeakMap,fs=new WeakMap,d(us,"CellInputText");let Pe=us;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",Pe)});
459
+ `,super.connectedCallback(),p(this,Gt,this.querySelector("input"))}};Gt=new WeakMap,pt=new WeakMap,Et=new WeakMap,qt=new WeakMap,Ce=new WeakMap,et=new WeakMap,gs=new WeakMap,d(bs,"CellInputText");let Fe=bs;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",Fe)});
450
460
  //# sourceMappingURL=nine-table.umd.js.map