@ninebone/table 0.0.692 → 0.0.693

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(E,S){typeof exports=="object"&&typeof module<"u"?S(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.NineboneUtil))})(this,function(E){"use strict";var Fe=Object.defineProperty;var Ve=E=>{throw TypeError(E)};var Xe=(E,S,v)=>S in E?Fe(E,S,{enumerable:!0,configurable:!0,writable:!0,value:v}):E[S]=v;var h=(E,S)=>Fe(E,"name",{value:S,configurable:!0});var R=(E,S,v)=>Xe(E,typeof S!="symbol"?S+"":S,v),Ye=(E,S,v)=>S.has(E)||Ve("Cannot "+v);var t=(E,S,v)=>(Ye(E,S,"read from private field"),v?v.call(E):S.get(E)),d=(E,S,v)=>S.has(E)?Ve("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(E):S.set(E,v),y=(E,S,v,F)=>(Ye(E,S,"write to private field"),F?F.call(E,v):S.set(E,v),v);var Ue=(E,S,v,F)=>({set _(mt){y(E,S,mt,v)},get _(){return t(E,S,F)}});var D,V,A,Z,G,J,Ot,Q,Bt,Y,lt,ct,C,vt,xt,zt,j,w,tt,P,_,U,et,wt,qe,Re,Dt,Pt,St,Et,At,jt,Ft,qt,Te,ht,Rt,Vt,Ut,st,it,Xt,Kt,dt,Zt,Gt,Jt,kt,I,Qt,Ct,te,Lt,ft,N,L,W,ut,ee,X,se,rt,Ht,ie,re,gt,nt,bt,M,$t,ne,ot,oe,ae,H,It,p,_e,Ne,We,Oe,Be,_t,at,yt,pt,le,K,Pe;const Se=class Se extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Se,"Trace");let S=Se;const v=new S,Ee=class Ee extends HTMLElement{constructor(){super();d(this,D);d(this,V,!1);d(this,A);d(this,Z);d(this,G);d(this,J);d(this,Ot,h(()=>{if(!t(this,D))return;const e=t(this,D).querySelector(".ng-container-body .ng-part-body");e&&(y(this,J,new ResizeObserver(()=>{this.refresh()})),t(this,J).observe(e))},"#observeResize"));R(this,"refresh",h(()=>{if(!t(this,D)||!t(this,A)||t(this,V))return;const e=t(this,A).container,s=e.querySelector("table");if(!s)return;const r=t(this,A).track,n=t(this,A).thumb,o=t(this,D).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);n.style.width=`${f}px`;const u=e.scrollLeft,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const x=l-f;g>x&&(g=x),n.style.left=`${g}px`,t(this,A).left.disabled=g===0,t(this,A).right.disabled=g>=x-1},"refresh"));d(this,Q,h(e=>{if(!t(this,A))return!1;const s=t(this,A).container,r=s.querySelector("table");if(!r)return!1;const n=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;let a=e;a<0&&(a=0);const c=n.width-o;a>c&&(a=c),a=parseInt(a,10),t(this,A).thumb.style.left=`${a}px`,t(this,A).left.disabled=a===0,t(this,A).right.disabled=a>=c-1;const l=s.clientWidth,u=r.scrollWidth-l;return c>0&&u>0&&(s.scrollLeft=a/c*u),a>0&&a<c-1},"#thumbMoveTo"));d(this,Bt,h(()=>{const e=h(r=>{clearInterval(t(this,Z)),clearInterval(t(this,G));const n=parseInt(t(this,A).thumb.style.left||0,10);t(this,Q).call(this,n+r),y(this,Z,setInterval(()=>{clearInterval(t(this,Z)),y(this,G,setInterval(()=>{const o=parseInt(t(this,A).thumb.style.left||0,10);t(this,Q).call(this,o+r)||clearInterval(t(this,G))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,Z)),clearInterval(t(this,G))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,A).left.addEventListener(r,s),t(this,A).right.addEventListener(r,s),t(this,A).track.addEventListener(r,s)}),t(this,A).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,A).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,A).left.addEventListener("touchstart",()=>e(-20)),t(this,A).right.addEventListener("touchstart",()=>e(20)),t(this,A).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const n=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;t(this,Q).call(this,r.clientX-n.left-o/2)}),t(this,A).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),y(this,V,!0),this.shiftX=r.clientX-t(this,A).thumb.getBoundingClientRect().left;const n=h(a=>{if(!t(this,V))return;const c=t(this,A).track.getBoundingClientRect();t(this,Q).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{y(this,V,!1),s(),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",n),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(y(this,D,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,D))return;this.innerHTML=`
1
+ (function(E,S){typeof exports=="object"&&typeof module<"u"?S(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.NineboneUtil))})(this,function(E){"use strict";var Fe=Object.defineProperty;var Ve=E=>{throw TypeError(E)};var Xe=(E,S,v)=>S in E?Fe(E,S,{enumerable:!0,configurable:!0,writable:!0,value:v}):E[S]=v;var h=(E,S)=>Fe(E,"name",{value:S,configurable:!0});var R=(E,S,v)=>Xe(E,typeof S!="symbol"?S+"":S,v),Ye=(E,S,v)=>S.has(E)||Ve("Cannot "+v);var t=(E,S,v)=>(Ye(E,S,"read from private field"),v?v.call(E):S.get(E)),d=(E,S,v)=>S.has(E)?Ve("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(E):S.set(E,v),y=(E,S,v,F)=>(Ye(E,S,"write to private field"),F?F.call(E,v):S.set(E,v),v);var Ue=(E,S,v,F)=>({set _(mt){y(E,S,mt,v)},get _(){return t(E,S,F)}});var D,V,A,K,Z,G,Ot,J,Bt,Q,tt,ct,C,vt,xt,zt,j,w,et,P,_,Y,st,wt,qe,Re,Dt,Pt,St,Et,At,jt,Ft,qt,Te,ht,Rt,Vt,Ut,it,rt,Xt,Kt,dt,Zt,Gt,Jt,kt,I,Qt,Ct,te,Lt,ft,N,L,W,ut,ee,U,se,nt,Ht,ie,re,gt,ot,bt,M,$t,ne,at,oe,ae,H,It,p,_e,Ne,We,Oe,Be,_t,lt,yt,pt,le,X,Pe;const Se=class Se extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Se,"Trace");let S=Se;const v=new S,Ee=class Ee extends HTMLElement{constructor(){super();d(this,D);d(this,V,!1);d(this,A);d(this,K);d(this,Z);d(this,G);d(this,Ot,h(()=>{if(!t(this,D))return;const e=t(this,D).querySelector(".ng-container-body .ng-part-body");e&&(y(this,G,new ResizeObserver(()=>{this.refresh()})),t(this,G).observe(e))},"#observeResize"));R(this,"refresh",h(()=>{if(!t(this,D)||!t(this,A)||t(this,V))return;const e=t(this,A).container,s=e.querySelector("table");if(!s)return;const r=t(this,A).track,n=t(this,A).thumb,o=t(this,D).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);n.style.width=`${f}px`;const u=e.scrollLeft,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const x=l-f;g>x&&(g=x),n.style.left=`${g}px`,t(this,A).left.disabled=g===0,t(this,A).right.disabled=g>=x-1},"refresh"));d(this,J,h(e=>{if(!t(this,A))return!1;const s=t(this,A).container,r=s.querySelector("table");if(!r)return!1;const n=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;let a=e;a<0&&(a=0);const c=n.width-o;a>c&&(a=c),a=parseInt(a,10),t(this,A).thumb.style.left=`${a}px`,t(this,A).left.disabled=a===0,t(this,A).right.disabled=a>=c-1;const l=s.clientWidth,u=r.scrollWidth-l;return c>0&&u>0&&(s.scrollLeft=a/c*u),a>0&&a<c-1},"#thumbMoveTo"));d(this,Bt,h(()=>{const e=h(r=>{clearInterval(t(this,K)),clearInterval(t(this,Z));const n=parseInt(t(this,A).thumb.style.left||0,10);t(this,J).call(this,n+r),y(this,K,setInterval(()=>{clearInterval(t(this,K)),y(this,Z,setInterval(()=>{const o=parseInt(t(this,A).thumb.style.left||0,10);t(this,J).call(this,o+r)||clearInterval(t(this,Z))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,K)),clearInterval(t(this,Z))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,A).left.addEventListener(r,s),t(this,A).right.addEventListener(r,s),t(this,A).track.addEventListener(r,s)}),t(this,A).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,A).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,A).left.addEventListener("touchstart",()=>e(-20)),t(this,A).right.addEventListener("touchstart",()=>e(20)),t(this,A).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const n=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;t(this,J).call(this,r.clientX-n.left-o/2)}),t(this,A).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),y(this,V,!0),this.shiftX=r.clientX-t(this,A).thumb.getBoundingClientRect().left;const n=h(a=>{if(!t(this,V))return;const c=t(this,A).track.getBoundingClientRect();t(this,J).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{y(this,V,!1),s(),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",n),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(y(this,D,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,D))return;this.innerHTML=`
2
2
  <style>
3
3
  nine-table-hscrollbar {
4
4
  display: flex;
@@ -60,7 +60,7 @@
60
60
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
61
61
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
62
62
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
63
- `;const e=h(()=>{const s=t(this,D).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,A,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),s.addEventListener("scroll",()=>{t(this,V)||this.refresh()}),t(this,Bt).call(this),t(this,Ot).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};D=new WeakMap,V=new WeakMap,A=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Ot=new WeakMap,Q=new WeakMap,Bt=new WeakMap,h(Ee,"NineTableHScrollBar");let F=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ae=class Ae extends HTMLElement{constructor(){super();d(this,Y);d(this,lt);d(this,ct,!1);d(this,C);d(this,vt,0);d(this,xt,0);R(this,"refresh",h(()=>{if(v.log("vscrollbar.refresh"),!t(this,Y)||!t(this,C))return;const e=t(this,C).container,s=t(this,C).track,r=t(this,C).thumb,n=e.clientHeight,o=t(this,Y).data.length,a=t(this,lt).getRowHeight(),c=o*a;if(c<=n||o===0){this.style.display="none";return}else this.style.display="flex";const l=s.clientHeight;if(l<=0)return;const f=Math.max(Math.min(l*(n/c),l),20);r.style.height=`${f}px`;const u=e.scrollTop,b=Math.max(c-n,1);v.log(e,u,b);let g=0;b>0&&(g=u/b*(l-f));const x=l-f;g<0&&(g=0),g>x&&(g=x),r.style.top=`${g}px`,t(this,C).top.disabled=u<=0,t(this,C).bottom.disabled=u>=b-1},"refresh"));d(this,zt,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,C).container,s=h(()=>{const n=(t(this,Y).data.get()||[]).length,o=t(this,lt).getRowHeight();return n*o},"getContentHeight");t(this,C).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),y(this,ct,!0),y(this,vt,r.clientY),y(this,xt,e.scrollTop);const n=h(a=>{if(!t(this,ct))return;const c=t(this,C).track.getBoundingClientRect(),l=t(this,C).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,vt),g=e.clientHeight,x=s(),q=Math.max(x-g,1);if(u>0&&q>0){const T=b/u*q;let m=t(this,xt)+T;const O=Math.max(0,x-g);m<0&&(m=0),m>O&&(m=O),e.scrollTop=m}this.refresh()},"onMouseMove"),o=h(()=>{y(this,ct,!1),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",n),document.addEventListener("mouseup",o)}),t(this,C).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,C).thumb)return;const n=t(this,C).track.getBoundingClientRect(),o=t(this,C).thumb.clientHeight,a=r.clientY-n.top-o/2,l=n.height-o,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(l>0&&b>0){const g=Math.max(0,Math.min(1,a/l));e.scrollTop=g*b}this.refresh()}),t(this,C).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,C).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,Y,this.getRootNode().host),y(this,lt,this.closest("nine-table-sheet")),this.innerHTML=`
63
+ `;const e=h(()=>{const s=t(this,D).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,A,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),s.addEventListener("scroll",()=>{t(this,V)||this.refresh()}),t(this,Bt).call(this),t(this,Ot).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,G)&&t(this,G).disconnect()}};D=new WeakMap,V=new WeakMap,A=new WeakMap,K=new WeakMap,Z=new WeakMap,G=new WeakMap,Ot=new WeakMap,J=new WeakMap,Bt=new WeakMap,h(Ee,"NineTableHScrollBar");let F=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ae=class Ae extends HTMLElement{constructor(){super();d(this,Q);d(this,tt);d(this,ct,!1);d(this,C);d(this,vt,0);d(this,xt,0);R(this,"refresh",h(()=>{if(v.log("vscrollbar.refresh"),!t(this,Q)||!t(this,C))return;const e=t(this,C).container,s=t(this,C).track,r=t(this,C).thumb,n=e.clientHeight,o=t(this,Q).data.length,a=t(this,tt).getRowHeight(),c=o*a;if(c<=n||o===0){this.style.display="none";return}else this.style.display="flex";const l=s.clientHeight;if(l<=0)return;const f=Math.max(Math.min(l*(n/c),l),20);r.style.height=`${f}px`;const u=e.scrollTop,b=Math.max(c-n,1);v.log(e,u,b);let g=0;b>0&&(g=u/b*(l-f));const x=l-f;g<0&&(g=0),g>x&&(g=x),r.style.top=`${g}px`,t(this,C).top.disabled=u<=0,t(this,C).bottom.disabled=u>=b-1},"refresh"));d(this,zt,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,C).container,s=h(()=>{const n=(t(this,Q).data.get()||[]).length,o=t(this,tt).getRowHeight();return n*o},"getContentHeight");t(this,C).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),y(this,ct,!0),y(this,vt,r.clientY),y(this,xt,e.scrollTop);const n=h(a=>{if(!t(this,ct))return;const c=t(this,C).track.getBoundingClientRect(),l=t(this,C).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,vt),g=e.clientHeight,x=s(),q=Math.max(x-g,1);if(u>0&&q>0){const T=b/u*q;let m=t(this,xt)+T;const O=Math.max(0,x-g);m<0&&(m=0),m>O&&(m=O),e.scrollTop=m}this.refresh()},"onMouseMove"),o=h(()=>{y(this,ct,!1),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",n),document.addEventListener("mouseup",o)}),t(this,C).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,C).thumb)return;const n=t(this,C).track.getBoundingClientRect(),o=t(this,C).thumb.clientHeight,a=r.clientY-n.top-o/2,l=n.height-o,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(l>0&&b>0){const g=Math.max(0,Math.min(1,a/l));e.scrollTop=g*b}this.refresh()}),t(this,C).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,C).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,Q,this.getRootNode().host),y(this,tt,this.closest("nine-table-sheet")),this.innerHTML=`
64
64
  <style>
65
65
  nine-table-vscrollbar {
66
66
  display: flex;
@@ -123,7 +123,7 @@
123
123
  <button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
124
124
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
125
125
  <button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
126
- `;const e=h(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,C,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,zt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,lt=new WeakMap,ct=new WeakMap,C=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=new WeakMap,h(Ae,"NineTableVScrollBar");let mt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,w);d(this,tt);d(this,P,new Map);d(this,_,null);d(this,U,null);d(this,et,0);d(this,wt,40);d(this,qe,!1);d(this,Re,!1);d(this,Dt,3);R(this,"refresh",h(()=>{var e;v.log("rowManager.refresh");const i=t(this,w).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,Et).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,w).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",h(()=>{v.log("rowManager.initialize"),y(this,tt,{scrollTables:t(this,w).querySelectorAll(".ng-part-body table"),firstTr:t(this,w).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,w).querySelector(o);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(o,u)});const i=t(this,w).querySelector(".ng-container-body .ng-part-body"),e=t(this,w).querySelector(".ng-container-left .ng-part-body"),s=t(this,w).querySelector(".ng-container-right .ng-part-body"),r=t(this,w).querySelector(".ng-container-body .ng-part-header"),n=t(this,w).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,St).call(this),t(this,qt).call(this),t(this,Et).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=h(c=>{var u;if(o)return;o=!0;const l=c.scrollTop,f=c.scrollLeft;i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),n&&n.scrollLeft!==f&&(n.scrollLeft=f),t(this,ht).call(this,l),(u=t(this,w).querySelector("nine-table-vscrollbar"))==null||u.refresh(),o=!1},"handleContainerScroll");[i,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Pt,h((i,e)=>{v.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const r=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const n=r.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(c=>{o.appendChild(c.cloneNode(!0))});n?n.before(o):r.appendChild(o),e===".ng-container-body"&&(t(this,tt).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,St,h(()=>{if(t(this,_)!==null&&t(this,_)>0)return t(this,_);const i=t(this,w).querySelector(".ng-container-body .ng-part-body");v.log("rowManager.#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=i.querySelector("tbody.bindable-tbody");if(v.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),n=document.createDocumentFragment();e.forEach(b=>{n.appendChild(b.cloneNode(!0))}),r?r.before(n):s.appendChild(n);const o=t(this,w),a=o.style.display,c=o.style.visibility,l=o.style.position;(a==="none"||window.getComputedStyle(o).display==="none")&&(o.style.display="block",o.style.visibility="hidden",o.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const x=window.getComputedStyle(b);g=parseFloat(x.height)||parseFloat(x.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0?-1:(y(this,_,f),t(this,At).call(this),t(this,_))},"#measureAndCacheHeight"));d(this,Et,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),r=e*s;v.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const o=t(this,w).querySelector(n);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,At,h(()=>{if(t(this,et)>0&&t(this,_)>0){const i=Math.ceil(t(this,et)/t(this,_));y(this,wt,i+t(this,Dt))}},"#updateRowCount"));d(this,jt,h(()=>{var a,c,l,f,u,b;const i=t(this,w).querySelector(".ng-container-left .ng-part-body table"),e=t(this,w).querySelector(".ng-container-body .ng-part-body table"),s=t(this,w).querySelector(".ng-container-right .ng-part-body table");if(e){const g=i?Array.from(i.querySelectorAll("tbody tr")):[],x=Array.from(e.querySelectorAll("tbody tr")),q=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(g.length,x.length,q.length);for(let m=0;m<T;m++){const O=[((a=g[m])==null?void 0:a.getBoundingClientRect().height)||0,((c=x[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=q[m])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(g[m]&&(g[m].style.height=`${k}px`),x[m]&&(x[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}const r=t(this,w).querySelector(".ng-container-left .ng-part-footer table"),n=t(this,w).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,w).querySelector(".ng-container-right .ng-part-footer table");if(n){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],x=Array.from(n.querySelectorAll("tfoot tr")),q=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(g.length,x.length,q.length);for(let m=0;m<T;m++){const O=[((f=g[m])==null?void 0:f.getBoundingClientRect().height)||0,((u=x[m])==null?void 0:u.getBoundingClientRect().height)||0,((b=q[m])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(g[m]&&(g[m].style.height=`${k}px`),x[m]&&(x[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,w)||!(t(this,w)instanceof HTMLElement)||(y(this,U,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let n=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(n+=o.offsetHeight),a&&(n+=a.offsetHeight);const c=Math.max(r-n,100);t(this,et)!==c&&(y(this,et,c),t(this,At).call(this),t(this,_)!==null&&(t(this,qt).call(this),this.refresh()))}}})),t(this,U).observe(t(this,w)))},"#initResizeObserver"));d(this,qt,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,w).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Pt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,Te,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,w).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const n=Array.from(r.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,P).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;n.forEach((f,u)=>{const b=i+Math.floor(u/o);if(b>=c){f.style.visibility="hidden";return}const g=t(this,j).data.get(b);f.style.display="",t(this,Rt).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var u,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,n=t(this,w).querySelector(".ng-container-body .ng-part-body");v.log("bodyContainer.clientHeight",n.clientHeight);const o=Math.max(0,s-Math.floor(n.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(i/e)));let c=Math.floor(a*e);v.log(`📜 [Scroll Calc] maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`),a===o&&v.log(`📜 [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,tt).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,tt))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(v.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const x=t(this,w).querySelector(g);if(!x)return;const q=x.querySelector(".ng-part-body tbody.bindable-tbody");if(!q)return;Array.from(q.querySelectorAll("tr:not(.nodata)")).forEach((m,O)=>{const k=a+Math.floor(O/r);if(k>=s){m.style.display="none";return}const z=t(this,j).data.get(k);m.style.display="",t(this,Rt).call(this,m,z,k)})}))},"#handleScroll"));d(this,Rt,h((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((r,n)=>{r.dataset.row=s;const o=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Vt,h(()=>{var c,l,f;v.log("rowManager.#syncHeaderHeights");const i=t(this,w).querySelector(".ng-container-left .ng-part-header table"),e=t(this,w).querySelector(".ng-container-body .ng-part-header table"),s=t(this,w).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=i?Array.from(i.querySelectorAll("tr")):[],n=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,n.length,o.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=n[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),n[u]&&(n[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`))}},"#syncHeaderHeights"));R(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,w,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,w=new WeakMap,tt=new WeakMap,P=new WeakMap,_=new WeakMap,U=new WeakMap,et=new WeakMap,wt=new WeakMap,qe=new WeakMap,Re=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,At=new WeakMap,jt=new WeakMap,Ft=new WeakMap,qt=new WeakMap,Te=new WeakMap,ht=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,h(ke,"RowManager");let ce=ke;const Yt=class Yt{static compileAll(i){return Array.isArray(i)?i.map(e=>Yt.compile(e)):[]}static compile(i){if(!i)return null;const e=h(a=>{a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),x=l.getAttribute("maxbyte"),q=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),g&&T.push(`data-expr="${g}"`),x&&T.push(`maxbyte="${x}"`),q&&T.push(`type="${q}"`),l.innerHTML=`<${u} ${T.join(" ")}></${u}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),r=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(x=>{b+=x.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(x=>{const q=x.sectionRowIndex;let T=0;Array.from(x.querySelectorAll("th,td")).forEach(m=>{for(let z=0;z<g[q].length;z++)if(g[q][z]===null){T=z;break}const O=m.rowSpan||1,k=m.colSpan||1;for(let z=0;z<O;z++)for(let Nt=0;Nt<k;Nt++)q+z<u&&T+Nt<b&&(g[q+z][T+Nt]=z===0&&Nt===0?"1":"0")})}),l.forEach(x=>{const q=x.sectionRowIndex;Array.from(x.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<g[q].length;m++)if(g[q][m]==="1"){T.dataset.col=m,g[q][m]="0";break}})})},"resetColIndex"),n=i.cloneNode(!0);return s(n),e(n),r(n,"thead"),r(n,"tbody"),r(n,"tfoot"),Array.from(n.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&n.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),n}};h(Yt,"TableCompiler");let he=Yt;const Tt=class Tt extends HTMLElement{constructor(){super();d(this,Ut);d(this,st,null);d(this,it);R(this,"invalidate",h(()=>{v.log("sheet.invalidate()"),t(this,it).refresh()},"invalidate"));R(this,"generate",h(e=>{if(v.log("sheet.generate()"),!e)return;y(this,st,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),n=this.querySelector(".ng-nodata-overlay");s&&n&&(n.style.top=`${s.offsetHeight}px`),r&&n&&(n.style.bottom=`${r.offsetHeight}px`),t(this,it).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,Xt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var n,o,a;(n=this.querySelector(`${s} .ng-part-header`))==null||n.appendChild(t(this,dt).call(this,t(this,st),r,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,dt).call(this,t(this,st),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,dt).call(this,t(this,st),r,"footer"))})},"#renderSplitContainers"));d(this,Kt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let n=0;r[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(n)||(n+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${n}px`,s.style.width=`${n}px`)})},"#updateContainerWidths"));d(this,dt,h((e,s,r)=>{const n=e.cloneNode(!0),o=n.querySelector("thead"),a=n.querySelector("tbody"),c=n.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",n.appendChild(f)}}else r==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(o&&o.remove(),a&&a.remove());return s==="left"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):n.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),n},"#createSplitTable"));R(this,"getRowHeight",h(()=>t(this,it).getRowHeight(),"getRowHeight"));R(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));R(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,h(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,h(()=>{const e=Tt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=h(()=>{const s=t(this,tt).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,C,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,zt).call(this),this.refresh()},"initWhenReady");e()}};Q=new WeakMap,tt=new WeakMap,ct=new WeakMap,C=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=new WeakMap,h(Ae,"NineTableVScrollBar");let mt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,w);d(this,et);d(this,P,new Map);d(this,_,null);d(this,Y,null);d(this,st,0);d(this,wt,40);d(this,qe,!1);d(this,Re,!1);d(this,Dt,3);R(this,"refresh",h(()=>{var e;v.log("rowManager.refresh");const i=t(this,w).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,Et).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,w).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",h(()=>{v.log("rowManager.initialize"),y(this,et,{scrollTables:t(this,w).querySelectorAll(".ng-part-body table"),firstTr:t(this,w).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,w).querySelector(o);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(o,u)});const i=t(this,w).querySelector(".ng-container-body .ng-part-body"),e=t(this,w).querySelector(".ng-container-left .ng-part-body"),s=t(this,w).querySelector(".ng-container-right .ng-part-body"),r=t(this,w).querySelector(".ng-container-body .ng-part-header"),n=t(this,w).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,St).call(this),t(this,qt).call(this),t(this,Et).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=h(c=>{var u;if(o)return;o=!0;const l=c.scrollTop,f=c.scrollLeft;i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),n&&n.scrollLeft!==f&&(n.scrollLeft=f),t(this,ht).call(this,l),(u=t(this,w).querySelector("nine-table-vscrollbar"))==null||u.refresh(),o=!1},"handleContainerScroll");[i,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Pt,h((i,e)=>{v.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const r=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const n=r.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(c=>{o.appendChild(c.cloneNode(!0))});n?n.before(o):r.appendChild(o),e===".ng-container-body"&&(t(this,et).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,St,h(()=>{if(t(this,_)!==null&&t(this,_)>0)return t(this,_);const i=t(this,w).querySelector(".ng-container-body .ng-part-body");v.log("rowManager.#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=i.querySelector("tbody.bindable-tbody");if(v.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),n=document.createDocumentFragment();e.forEach(b=>{n.appendChild(b.cloneNode(!0))}),r?r.before(n):s.appendChild(n);const o=t(this,w),a=o.style.display,c=o.style.visibility,l=o.style.position;(a==="none"||window.getComputedStyle(o).display==="none")&&(o.style.display="block",o.style.visibility="hidden",o.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const x=window.getComputedStyle(b);g=parseFloat(x.height)||parseFloat(x.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0?-1:(y(this,_,f),t(this,At).call(this),t(this,_))},"#measureAndCacheHeight"));d(this,Et,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),r=e*s;v.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const o=t(this,w).querySelector(n);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,At,h(()=>{if(t(this,st)>0&&t(this,_)>0){const i=Math.ceil(t(this,st)/t(this,_));y(this,wt,i+t(this,Dt))}},"#updateRowCount"));d(this,jt,h(()=>{var a,c,l,f,u,b;const i=t(this,w).querySelector(".ng-container-left .ng-part-body table"),e=t(this,w).querySelector(".ng-container-body .ng-part-body table"),s=t(this,w).querySelector(".ng-container-right .ng-part-body table");if(e){const g=i?Array.from(i.querySelectorAll("tbody tr")):[],x=Array.from(e.querySelectorAll("tbody tr")),q=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(g.length,x.length,q.length);for(let m=0;m<T;m++){const O=[((a=g[m])==null?void 0:a.getBoundingClientRect().height)||0,((c=x[m])==null?void 0:c.getBoundingClientRect().height)||0,((l=q[m])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(g[m]&&(g[m].style.height=`${k}px`),x[m]&&(x[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}const r=t(this,w).querySelector(".ng-container-left .ng-part-footer table"),n=t(this,w).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,w).querySelector(".ng-container-right .ng-part-footer table");if(n){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],x=Array.from(n.querySelectorAll("tfoot tr")),q=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(g.length,x.length,q.length);for(let m=0;m<T;m++){const O=[((f=g[m])==null?void 0:f.getBoundingClientRect().height)||0,((u=x[m])==null?void 0:u.getBoundingClientRect().height)||0,((b=q[m])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(...O);k>0&&(g[m]&&(g[m].style.height=`${k}px`),x[m]&&(x[m].style.height=`${k}px`),q[m]&&(q[m].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,w)||!(t(this,w)instanceof HTMLElement)||(y(this,Y,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let n=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(n+=o.offsetHeight),a&&(n+=a.offsetHeight);const c=Math.max(r-n,100);t(this,st)!==c&&(y(this,st,c),t(this,At).call(this),t(this,_)!==null&&(t(this,qt).call(this),this.refresh()))}}})),t(this,Y).observe(t(this,w)))},"#initResizeObserver"));d(this,qt,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,w).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Pt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,Te,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,w).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const n=Array.from(r.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,P).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;n.forEach((f,u)=>{const b=i+Math.floor(u/o);if(b>=c){f.style.visibility="hidden";return}const g=t(this,j).data.get(b);f.style.display="",t(this,Rt).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var u,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,n=t(this,w).querySelector(".ng-container-body .ng-part-body");v.log("bodyContainer.clientHeight",n.clientHeight);const o=Math.max(0,s-Math.floor(n.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(i/e)));let c=Math.floor(a*e);v.log(`📜 [Scroll Calc] maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`),a===o&&v.log(`📜 [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,et).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,et))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(v.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const x=t(this,w).querySelector(g);if(!x)return;const q=x.querySelector(".ng-part-body tbody.bindable-tbody");if(!q)return;Array.from(q.querySelectorAll("tr:not(.nodata)")).forEach((m,O)=>{const k=a+Math.floor(O/r);if(k>=s){m.style.display="none";return}const z=t(this,j).data.get(k);m.style.display="",t(this,Rt).call(this,m,z,k)})}))},"#handleScroll"));d(this,Rt,h((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((r,n)=>{r.dataset.row=s;const o=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Vt,h(()=>{var c,l,f;v.log("rowManager.#syncHeaderHeights");const i=t(this,w).querySelector(".ng-container-left .ng-part-header table"),e=t(this,w).querySelector(".ng-container-body .ng-part-header table"),s=t(this,w).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=i?Array.from(i.querySelectorAll("tr")):[],n=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,n.length,o.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=n[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),n[u]&&(n[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`))}},"#syncHeaderHeights"));R(this,"destroy",h(()=>{t(this,Y)&&(t(this,Y).disconnect(),y(this,Y,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,w,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,w=new WeakMap,et=new WeakMap,P=new WeakMap,_=new WeakMap,Y=new WeakMap,st=new WeakMap,wt=new WeakMap,qe=new WeakMap,Re=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,At=new WeakMap,jt=new WeakMap,Ft=new WeakMap,qt=new WeakMap,Te=new WeakMap,ht=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,h(ke,"RowManager");let ce=ke;const Yt=class Yt{static compileAll(i){return Array.isArray(i)?i.map(e=>Yt.compile(e)):[]}static compile(i){if(!i)return null;const e=h(a=>{a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),x=l.getAttribute("maxbyte"),q=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),g&&T.push(`data-expr="${g}"`),x&&T.push(`maxbyte="${x}"`),q&&T.push(`type="${q}"`),l.innerHTML=`<${u} ${T.join(" ")}></${u}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),r=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(x=>{b+=x.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(x=>{const q=x.sectionRowIndex;let T=0;Array.from(x.querySelectorAll("th,td")).forEach(m=>{for(let z=0;z<g[q].length;z++)if(g[q][z]===null){T=z;break}const O=m.rowSpan||1,k=m.colSpan||1;for(let z=0;z<O;z++)for(let Nt=0;Nt<k;Nt++)q+z<u&&T+Nt<b&&(g[q+z][T+Nt]=z===0&&Nt===0?"1":"0")})}),l.forEach(x=>{const q=x.sectionRowIndex;Array.from(x.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<g[q].length;m++)if(g[q][m]==="1"){T.dataset.col=m,g[q][m]="0";break}})})},"resetColIndex"),n=i.cloneNode(!0);return s(n),e(n),r(n,"thead"),r(n,"tbody"),r(n,"tfoot"),Array.from(n.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&n.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),n}};h(Yt,"TableCompiler");let he=Yt;const Tt=class Tt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,rt);R(this,"invalidate",h(()=>{v.log("sheet.invalidate()"),t(this,rt).refresh()},"invalidate"));R(this,"generate",h(e=>{if(v.log("sheet.generate()"),!e)return;y(this,it,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),n=this.querySelector(".ng-nodata-overlay");s&&n&&(n.style.top=`${s.offsetHeight}px`),r&&n&&(n.style.bottom=`${r.offsetHeight}px`),t(this,rt).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,Xt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var n,o,a;(n=this.querySelector(`${s} .ng-part-header`))==null||n.appendChild(t(this,dt).call(this,t(this,it),r,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,dt).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,dt).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,Kt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let n=0;r[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(n)||(n+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${n}px`,s.style.width=`${n}px`)})},"#updateContainerWidths"));d(this,dt,h((e,s,r)=>{const n=e.cloneNode(!0),o=n.querySelector("thead"),a=n.querySelector("tbody"),c=n.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",n.appendChild(f)}}else r==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(o&&o.remove(),a&&a.remove());return s==="left"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):n.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),n},"#createSplitTable"));R(this,"getRowHeight",h(()=>t(this,rt).getRowHeight(),"getRowHeight"));R(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));R(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,h(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,h(()=>{const e=Tt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;
@@ -310,7 +310,7 @@
310
310
  <nine-table-hscrollbar></nine-table-hscrollbar>
311
311
  <div class='ng-scroll-edge'></div>
312
312
  </div>
313
- `},"#render"));y(this,it,new ce(this)),y(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",v.log("NineTableSheet destroyed.")}};Ut=new WeakMap,st=new WeakMap,it=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,dt=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,h(Tt,"NineTableSheet"),R(Tt,"SCROLLBAR_SIZE",16);let Wt=Tt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Wt);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,Jt,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var o;const r=s.ctrlKey||s.metaKey||s.shiftKey,n=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,kt).call(this,n,r)}),t(this,kt).call(this,0,!1)},"#init"));d(this,kt,h((e,s=!1)=>{const r=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const x=parseInt(g.getAttribute("data-index"),10),q=this.querySelector(`nine-splitter[data-split-index="${x}"]`),T=f[x+1];q&&T&&T.classList.contains("active")&&q.style.setProperty("display","flex")})},"updateSplitters"),n=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),a=n.querySelectorAll(".nine-tab-item"),c=o.querySelectorAll("nine-table-sheet");if(!a[e])return;if(!s)a.forEach((f,u)=>{f.classList.toggle("active",u===e)}),c.forEach((f,u)=>{const b=u===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=a[e],u=n.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const b=o.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=o.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(f=>{f.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),r()},"#switchSheet"))}connectedCallback(){t(this,Jt).call(this)}};Jt=new WeakMap,kt=new WeakMap,h(Ce,"NineTableSheets");let de=Ce;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",de);const Le=class Le{constructor(i){d(this,I);d(this,Qt,h(()=>{t(this,te).call(this),new ResizeObserver(i=>{for(let e of i)t(this,I).getAttribute("auto-height")==="true"&&t(this,Ct).call(this)}).observe(t(this,I))},"#init"));d(this,Ct,h(()=>{var c,l;const i=Array.from(t(this,I).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const e=parseInt(t(this,I).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(f=>f.getRowHeight())),r=(c=t(this,I).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,n=(l=t(this,I).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Wt.SCROLLBAR_SIZE,a=e*s+r+n+o;t(this,I).style.height=`${a}px`},"#applyAutoHeight"));d(this,te,h(()=>{const e=Array.from(t(this,I).children).filter(c=>c.tagName==="TABLE"),s=t(this,I).getAttribute("auto-height")==="true",r=e.length,n=e.map((c,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<r-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+b}).join(""),o=e.map((c,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,I).shadowRoot.innerHTML=`
313
+ `},"#render"));y(this,rt,new ce(this)),y(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",v.log("NineTableSheet destroyed.")}};Ut=new WeakMap,it=new WeakMap,rt=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,dt=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,h(Tt,"NineTableSheet"),R(Tt,"SCROLLBAR_SIZE",16);let Wt=Tt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Wt);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,Jt,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var o;const r=s.ctrlKey||s.metaKey||s.shiftKey,n=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,kt).call(this,n,r)}),t(this,kt).call(this,0,!1)},"#init"));d(this,kt,h((e,s=!1)=>{const r=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const x=parseInt(g.getAttribute("data-index"),10),q=this.querySelector(`nine-splitter[data-split-index="${x}"]`),T=f[x+1];q&&T&&T.classList.contains("active")&&q.style.setProperty("display","flex")})},"updateSplitters"),n=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),a=n.querySelectorAll(".nine-tab-item"),c=o.querySelectorAll("nine-table-sheet");if(!a[e])return;if(!s)a.forEach((f,u)=>{f.classList.toggle("active",u===e)}),c.forEach((f,u)=>{const b=u===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=a[e],u=n.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const b=o.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=o.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(f=>{f.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),r()},"#switchSheet"))}connectedCallback(){t(this,Jt).call(this)}};Jt=new WeakMap,kt=new WeakMap,h(Ce,"NineTableSheets");let de=Ce;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",de);const Le=class Le{constructor(i){d(this,I);d(this,Qt,h(()=>{t(this,te).call(this),new ResizeObserver(i=>{for(let e of i)t(this,I).getAttribute("auto-height")==="true"&&t(this,Ct).call(this)}).observe(t(this,I))},"#init"));d(this,Ct,h(()=>{var c,l;const i=Array.from(t(this,I).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const e=parseInt(t(this,I).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(f=>f.getRowHeight())),r=(c=t(this,I).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,n=(l=t(this,I).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Wt.SCROLLBAR_SIZE,a=e*s+r+n+o;t(this,I).style.height=`${a}px`},"#applyAutoHeight"));d(this,te,h(()=>{const e=Array.from(t(this,I).children).filter(c=>c.tagName==="TABLE"),s=t(this,I).getAttribute("auto-height")==="true",r=e.length,n=e.map((c,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<r-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+b}).join(""),o=e.map((c,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,I).shadowRoot.innerHTML=`
314
314
  <style>
315
315
  :host {
316
316
  display: flex;
@@ -430,10 +430,10 @@
430
430
  <nine-table-analysis></nine-table-analysis>
431
431
  </nine-table-body>
432
432
  <nine-table-footer></nine-table-footer>
433
- `,t(this,I).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,I).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Ct).call(this)})})},"#render"));y(this,I,i),t(this,Qt).call(this)}};I=new WeakMap,Qt=new WeakMap,Ct=new WeakMap,te=new WeakMap,h(Le,"LayoutManager");let fe=Le;const He=class He{constructor(i){d(this,Lt);d(this,ft,-1);R(this,"count",h(()=>t(this,Lt).rawRecords.length,"count"));y(this,Lt,i)}get at(){return t(this,ft)}set at(i){y(this,ft,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ft)}"]`)&&setTimeout(()=>{})}};Lt=new WeakMap,ft=new WeakMap,h(He,"ngRow");let ue=He;const B=class B{constructor(i,e){d(this,N);d(this,L);d(this,W,[]);d(this,ut,[]);d(this,ee,0);d(this,X,[]);d(this,se,h(()=>{y(this,X,[]);const i=t(this,N).template||[];Array.from(i).forEach(e=>{var s;t(this,X).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Ht).call(this)),e.__ng.height=t(this,X).slice()})},"#initialize"));d(this,rt,h(()=>{const i=t(this,N).shadowRoot.querySelector("nine-table-sheets");i==null||i.classList.toggle("nodata",this.length===0),t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));R(this,"get",h((i,e)=>{var n;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return t(this,gt).call(this,s);if(i<0||i>=s.length)return null;const r=typeof((n=t(this,N).fields)==null?void 0:n.get)=="function"?t(this,N).fields.get():[];if(e!=null){const o=r.indexOf(e);return o>=0?s[i].v[o]:null}return t(this,gt).call(this,s[i])},"get"));R(this,"set",h(i=>{this.clear(),this.add(i,!1),t(this,rt).call(this)},"set"));d(this,Ht,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,X).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,X).slice(),-1,{},{}]}),"#getDefaultMeta"));R(this,"reset",h(()=>{y(this,W,[]),y(this,ut,[]),t(this,rt).call(this)},"reset"));R(this,"clear",h(()=>{var i;t(this,L).rawRecords=[],y(this,W,[]),y(this,ut,[]),(i=t(this,L).viewRecords)!=null&&i.reset&&t(this,L).viewRecords.reset()},"clear"));d(this,ie,h(i=>{var r;Array.isArray(i)||(i=[i]);const e=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(n=>{const o={v:[]};e.forEach(a=>{o.v.push(n[a]!==void 0&&n[a]!==null?n[a]:"")}),s.push(o)}),s},"#json2Array"));d(this,re,h(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Ht).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));R(this,"add",h((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,re).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((n,o)=>{const a=t(this,L).rawRecords[r-o];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,rt).call(this),r},"add"));R(this,"delete",h(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,L).host.row.at]:e=[parseInt(i,10)],e.sort((s,r)=>r-s).forEach(s=>{if(t(this,W)[s]){const r=t(this,W)[s].__ng.rowid;t(this,W)[s].__ng.rowState===B.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(n=>n.__ng.rowid!==r):t(this,L).rawRecords.forEach(n=>{n.__ng.rowid===r&&(n.__ng.deleted=!0,n.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,rt).call(this)},"delete"));R(this,"setValue",h((i,e,s)=>{var c;i=parseInt(i,10);const n=(typeof((c=t(this,N).fields)==null?void 0:c.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(n<0)return;const o=this.getValidData()[i];if(!o)return;const a=o.v[n];a!==s&&o.__ng.rowState!==B.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(e)||(o.__ng.o[e]=a),o.__ng.rowState=B.ROW_STATE.UPDATE),o.v[n]=s},"setValue"));R(this,"resetRecords",h(()=>{y(this,ut,t(this,L).rawRecords.filter(i=>!i.__ng.deleted)),y(this,W,t(this,L).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,L).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,W).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));R(this,"getValidData",h(()=>(t(this,W).length===0&&t(this,L).rawRecords.length>0&&this.resetRecords(),t(this,W)),"getValidData"));d(this,gt,h(i=>{var o;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,r=typeof((o=t(this,N).fields)==null?void 0:o.get)=="function"?t(this,N).fields.get():[],n=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return r.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?n[0]:n},"#conv"));R(this,"count",h(()=>this.getValidData().length,"count"));y(this,N,i),y(this,L,e),t(this,se).call(this)}get source(){return t(this,gt).call(this,t(this,L).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ue(this,ee)._}get count(){return t(this,W).length}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,L=new WeakMap,W=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,rt=new WeakMap,Ht=new WeakMap,ie=new WeakMap,re=new WeakMap,gt=new WeakMap,h(B,"ngData"),R(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=B;const $e=class $e{constructor(i){d(this,nt);y(this,nt,i),this.row=new ue(this),this.data=new ge(t(this,nt),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,nt).view)!=null&&e.redraw&&t(this,nt).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var r,n;const s=parseInt(e,10);if(!(s>=this.data.count()))return(n=(r=this.data.getValidData()[s])==null?void 0:r.__ng)==null?void 0:n.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,r)=>{e=parseInt(e,10),this.data.setValue(e,s,r)},this.setDataSource([])}};nt=new WeakMap,h($e,"ngDataManager");let be=$e;const Me=class Me{constructor(i){d(this,bt);d(this,M,[]);R(this,"add",h((i,e="string")=>{i.forEach(s=>{t(this,M).some(r=>r.name===s)||t(this,M).push({name:s,type:e})}),t(this,$t).call(this)},"add"));d(this,$t,h(()=>{const i=new Map;t(this,M).forEach(e=>{i.set(e.name,e.type)}),y(this,M,Array.from(i,([e,s])=>({name:e,type:s}))),y(this,M,t(this,M).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,M).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,ne,h(()=>{y(this,M,[]),v.log(t(this,bt).querySelectorAll("table"));const i=Array.from(t(this,bt).querySelectorAll("table"));if(!(!i||i.length===0)){for(const e of i)v.log(e),$("[data-bind]",e).each((s,r)=>{const n=r.dataset.bind,o=r.getAttribute("data-type")||"string";n&&t(this,M).push({name:n,type:o})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((r,n)=>{var o=n.getAttribute(s);if(o.indexOf("data.")<0){const a=o.search(/[(]/g);if(a>0)try{o=String(window[o.substring(0,a).trim()])}catch{o=""}}o.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):o.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,M).push({name:l,type:"string"})}})})});t(this,$t).call(this)}},"#init"));y(this,bt,i),t(this,ne).call(this)}get(){return t(this,M).map(i=>i.name)}getFields(){return t(this,M)}getType(i){const e=t(this,M).find(s=>s.name===i);return e?e.type:"string"}indexOf(i){return t(this,M).findIndex(e=>e.name===i)}includes(i){return t(this,M).some(e=>e.name===i)}};bt=new WeakMap,M=new WeakMap,$t=new WeakMap,ne=new WeakMap,h(Me,"ngFields");let ye=Me;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,ot);d(this,oe);d(this,ae,h(()=>{this.fields=new ye(this),y(this,oe,new fe(this)),v.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,ot,new be(this))}connectedCallback(){t(this,ae).call(this)}disconnectedCallback(){v.log("NineTable disconnected.")}get data(){return t(this,ot).data}get row(){return t(this,ot).row}get dataManager(){return t(this,ot)}};ot=new WeakMap,oe=new WeakMap,ae=new WeakMap,h(Ie,"NineTable");let pe=Ie;customElements.get("nine-table")||customElements.define("nine-table",pe);const Mt=class Mt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Mt,"BasicCellElement"),R(Mt,"_styleCache",new Map),R(Mt,"_customStyleCache",new Map);let me=Mt;const ze=class ze extends me{constructor(){super();d(this,H);d(this,It);d(this,p);d(this,_e);d(this,Ne);d(this,We);d(this,Oe);R(this,"getDisplayText",h(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,r=parseInt(t(this,p).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,p).dataset.expr)){if(!ninegrid.isNull(t(this,p).dataset.bind))return s[t(this,p).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,p).dataset.expr,s,r,t(this,p))}catch{console.error(t(this,p).dataset.expr,s,t(this,p).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,H).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,H).data)}catch{}},"getDisplayText"));d(this,Be,h(()=>{if(!(!t(this,H)||!t(this,H).template||!t(this,p).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,p)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,p).closest("tr"),r=[];$("th,td",s).each((m,O)=>{var k=ninegrid.j.querySelectorAll(O).attr("suppress");k&&O.dataset.row&&(k=parseInt(k),!isNaN(k)&&k<=e&&r.push(k))}),r.sort();var n=!1;if(parseInt(s.sectionRowIndex/t(this,H).template.length)>0)for(var o of r){if(o>e)break;var a=parseInt(t(this,p).dataset.row),c=a-1,l=t(this,p).closest("tr").data,f=t(this,H).data.get(c);t(this,p).dataset.matrixRow;var u=t(this,H).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,p).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,c):f[u.dataset.bind];if(b!=g){n=!0;break}}else n=!0;n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var x=parseInt(t(this,p).dataset.matrixRow),q=x-1,T=t(this,H).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${q}"]`);$(T).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").addClass("last-suppress"):!$(T).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));R(this,"getExprValue",h((e,s,r,n)=>{if(typeof e<"u")try{r=parseInt(r);const o=e.replace("()","");return t(this,H)[o]?t(this,H)[o].call(this,s,r,t(this,p)):t(this,H).exprFunction(e).call(this,s,r,t(this,H).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,H,this.getRootNode().host),y(this,p,this.closest("th,td")),y(this,It,t(this,p).closest("tr"))}get value(){var e=!t(this,H)||!t(this,H).dataManager||!t(this,p)||!t(this,p).dataset||!t(this,p).dataset.row||!t(this,p).dataset.bind?"":t(this,p).closest("tr").data[t(this,p).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,p).dataset.row);const r=this.getAttribute("update-row-state")!="false";s<0?t(this,H).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,r):t(this,H).data.setValue(s,t(this,p).dataset.bind,e,r)}get row(){return parseInt(t(this,p).dataset.row)}get data(){return t(this,p).closest("tr").data}refresh(){const e=t(this,p).dataset.bind;return parseInt(t(this,p).dataset.row),t(this,It).data[e]}};H=new WeakMap,It=new WeakMap,p=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,Be=new WeakMap,h(ze,"CellElement");let ve=ze;const De=class De extends ve{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(De,"EditableCellElement");let xe=De;const je=class je extends xe{constructor(){super();d(this,_t);d(this,at);d(this,yt);d(this,pt);d(this,le);d(this,K);R(this,"refresh",h(()=>{const e=super.refresh();t(this,_t).value=e},"refresh"));d(this,Pe,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,at)=="number"){let n=[];if(t(this,K)&&Number(t(this,K))>0&&n.push("."),t(this,pt)&&Number(t(this,pt))>=0&&n.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!n.includes(e.key)&&e.preventDefault(),t(this,K)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,r=s.indexOf(".");if(r>=0){var s=s.substr(r+1,s.length);s.length>=Number(t(this,K))&&e.preventDefault()}}}t(this,yt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,yt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),y(this,at,this.getAttribute("type")||"text"),y(this,yt,this.getAttribute("maxbyte")),y(this,pt,this.getAttribute("min")),y(this,le,this.getAttribute("max")),y(this,K,this.getAttribute("scale")),!["text","number"].includes(t(this,at)))throw`invalid type : ${t(this,at)}`}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=`
433
+ `,t(this,I).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,I).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Ct).call(this)})})},"#render"));y(this,I,i),t(this,Qt).call(this)}};I=new WeakMap,Qt=new WeakMap,Ct=new WeakMap,te=new WeakMap,h(Le,"LayoutManager");let fe=Le;const He=class He{constructor(i){d(this,Lt);d(this,ft,-1);R(this,"count",h(()=>t(this,Lt).rawRecords.length,"count"));y(this,Lt,i)}get at(){return t(this,ft)}set at(i){y(this,ft,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ft)}"]`)&&setTimeout(()=>{})}};Lt=new WeakMap,ft=new WeakMap,h(He,"ngRow");let ue=He;const B=class B{constructor(i,e){d(this,N);d(this,L);d(this,W,[]);d(this,ut,[]);d(this,ee,0);d(this,U,[]);d(this,se,h(()=>{y(this,U,[]);const i=t(this,N).template||[];Array.from(i).forEach(e=>{var s;t(this,U).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Ht).call(this)),e.__ng.height=t(this,U).slice()})},"#initialize"));d(this,nt,h(()=>{const i=t(this,N).shadowRoot.querySelector("nine-table-sheets");i==null||i.classList.toggle("nodata",this.length===0),t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));R(this,"get",h((i,e)=>{var n;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return t(this,gt).call(this,s);if(i<0||i>=s.length)return null;const r=typeof((n=t(this,N).fields)==null?void 0:n.get)=="function"?t(this,N).fields.get():[];if(e!=null){const o=r.indexOf(e);return o>=0?s[i].v[o]:null}return t(this,gt).call(this,s[i])},"get"));R(this,"set",h(i=>{this.clear(),this.add(i,!1),t(this,nt).call(this)},"set"));d(this,Ht,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,U).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,U).slice(),-1,{},{}]}),"#getDefaultMeta"));R(this,"reset",h(()=>{y(this,W,[]),y(this,ut,[]),t(this,nt).call(this)},"reset"));R(this,"clear",h(()=>{var i;t(this,L).rawRecords=[],y(this,W,[]),y(this,ut,[]),(i=t(this,L).viewRecords)!=null&&i.reset&&t(this,L).viewRecords.reset()},"clear"));d(this,ie,h(i=>{var r;Array.isArray(i)||(i=[i]);const e=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(n=>{const o={v:[]};e.forEach(a=>{o.v.push(n[a]!==void 0&&n[a]!==null?n[a]:"")}),s.push(o)}),s},"#json2Array"));d(this,re,h(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Ht).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));R(this,"add",h((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,re).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((n,o)=>{const a=t(this,L).rawRecords[r-o];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,nt).call(this),r},"add"));R(this,"delete",h(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,L).host.row.at]:e=[parseInt(i,10)],e.sort((s,r)=>r-s).forEach(s=>{if(t(this,W)[s]){const r=t(this,W)[s].__ng.rowid;t(this,W)[s].__ng.rowState===B.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(n=>n.__ng.rowid!==r):t(this,L).rawRecords.forEach(n=>{n.__ng.rowid===r&&(n.__ng.deleted=!0,n.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,nt).call(this)},"delete"));R(this,"setValue",h((i,e,s)=>{var c;i=parseInt(i,10);const n=(typeof((c=t(this,N).fields)==null?void 0:c.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(n<0)return;const o=this.getValidData()[i];if(!o)return;const a=o.v[n];a!==s&&o.__ng.rowState!==B.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(e)||(o.__ng.o[e]=a),o.__ng.rowState=B.ROW_STATE.UPDATE),o.v[n]=s},"setValue"));R(this,"resetRecords",h(()=>{y(this,ut,t(this,L).rawRecords.filter(i=>!i.__ng.deleted)),y(this,W,t(this,L).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,L).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,W).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));R(this,"getValidData",h(()=>(t(this,W).length===0&&t(this,L).rawRecords.length>0&&this.resetRecords(),t(this,W)),"getValidData"));d(this,gt,h(i=>{var o;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,r=typeof((o=t(this,N).fields)==null?void 0:o.get)=="function"?t(this,N).fields.get():[],n=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return r.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?n[0]:n},"#conv"));R(this,"count",h(()=>this.getValidData().length,"count"));y(this,N,i),y(this,L,e),t(this,se).call(this)}get source(){return t(this,gt).call(this,t(this,L).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ue(this,ee)._}get count(){return t(this,W).length}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,L=new WeakMap,W=new WeakMap,ut=new WeakMap,ee=new WeakMap,U=new WeakMap,se=new WeakMap,nt=new WeakMap,Ht=new WeakMap,ie=new WeakMap,re=new WeakMap,gt=new WeakMap,h(B,"ngData"),R(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=B;const $e=class $e{constructor(i){d(this,ot);y(this,ot,i),this.row=new ue(this),this.data=new ge(t(this,ot),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,ot).view)!=null&&e.redraw&&t(this,ot).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var r,n;const s=parseInt(e,10);if(!(s>=this.data.count()))return(n=(r=this.data.getValidData()[s])==null?void 0:r.__ng)==null?void 0:n.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,r)=>{e=parseInt(e,10),this.data.setValue(e,s,r)},this.setDataSource([])}};ot=new WeakMap,h($e,"ngDataManager");let be=$e;const Me=class Me{constructor(i){d(this,bt);d(this,M,[]);R(this,"add",h((i,e="string")=>{i.forEach(s=>{t(this,M).some(r=>r.name===s)||t(this,M).push({name:s,type:e})}),t(this,$t).call(this)},"add"));d(this,$t,h(()=>{const i=new Map;t(this,M).forEach(e=>{i.set(e.name,e.type)}),y(this,M,Array.from(i,([e,s])=>({name:e,type:s}))),y(this,M,t(this,M).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,M).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,ne,h(()=>{y(this,M,[]),v.log(t(this,bt).querySelectorAll("table"));const i=Array.from(t(this,bt).querySelectorAll("table"));if(!(!i||i.length===0)){for(const e of i)v.log(e),$("[data-bind]",e).each((s,r)=>{const n=r.dataset.bind,o=r.getAttribute("data-type")||"string";n&&t(this,M).push({name:n,type:o})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((r,n)=>{var o=n.getAttribute(s);if(o.indexOf("data.")<0){const a=o.search(/[(]/g);if(a>0)try{o=String(window[o.substring(0,a).trim()])}catch{o=""}}o.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):o.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,M).push({name:l,type:"string"})}})})});t(this,$t).call(this)}},"#init"));y(this,bt,i),t(this,ne).call(this)}get(){return t(this,M).map(i=>i.name)}getFields(){return t(this,M)}getType(i){const e=t(this,M).find(s=>s.name===i);return e?e.type:"string"}indexOf(i){return t(this,M).findIndex(e=>e.name===i)}includes(i){return t(this,M).some(e=>e.name===i)}};bt=new WeakMap,M=new WeakMap,$t=new WeakMap,ne=new WeakMap,h(Me,"ngFields");let ye=Me;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,at);d(this,oe);d(this,ae,h(()=>{this.fields=new ye(this),y(this,oe,new fe(this)),v.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,at,new be(this))}connectedCallback(){t(this,ae).call(this)}disconnectedCallback(){v.log("NineTable disconnected.")}get data(){return t(this,at).data}get row(){return t(this,at).row}get dataManager(){return t(this,at)}};at=new WeakMap,oe=new WeakMap,ae=new WeakMap,h(Ie,"NineTable");let pe=Ie;customElements.get("nine-table")||customElements.define("nine-table",pe);const Mt=class Mt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Mt,"BasicCellElement"),R(Mt,"_styleCache",new Map),R(Mt,"_customStyleCache",new Map);let me=Mt;const ze=class ze extends me{constructor(){super();d(this,H);d(this,It);d(this,p);d(this,_e);d(this,Ne);d(this,We);d(this,Oe);R(this,"getDisplayText",h(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,r=parseInt(t(this,p).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,p).dataset.expr)){if(!ninegrid.isNull(t(this,p).dataset.bind))return s[t(this,p).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,p).dataset.expr,s,r,t(this,p))}catch{console.error(t(this,p).dataset.expr,s,t(this,p).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,H).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,H).data)}catch{}},"getDisplayText"));d(this,Be,h(()=>{if(!(!t(this,H)||!t(this,H).template||!t(this,p).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,p)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,p).closest("tr"),r=[];$("th,td",s).each((m,O)=>{var k=ninegrid.j.querySelectorAll(O).attr("suppress");k&&O.dataset.row&&(k=parseInt(k),!isNaN(k)&&k<=e&&r.push(k))}),r.sort();var n=!1;if(parseInt(s.sectionRowIndex/t(this,H).template.length)>0)for(var o of r){if(o>e)break;var a=parseInt(t(this,p).dataset.row),c=a-1,l=t(this,p).closest("tr").data,f=t(this,H).data.get(c);t(this,p).dataset.matrixRow;var u=t(this,H).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,p).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,c):f[u.dataset.bind];if(b!=g){n=!0;break}}else n=!0;n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var x=parseInt(t(this,p).dataset.matrixRow),q=x-1,T=t(this,H).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${q}"]`);$(T).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").addClass("last-suppress"):!$(T).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));R(this,"getExprValue",h((e,s,r,n)=>{if(typeof e<"u")try{r=parseInt(r);const o=e.replace("()","");return t(this,H)[o]?t(this,H)[o].call(this,s,r,t(this,p)):t(this,H).exprFunction(e).call(this,s,r,t(this,H).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,H,this.getRootNode().host),y(this,p,this.closest("th,td")),y(this,It,t(this,p).closest("tr"))}get value(){var e=!t(this,H)||!t(this,H).dataManager||!t(this,p)||!t(this,p).dataset||!t(this,p).dataset.row||!t(this,p).dataset.bind?"":t(this,p).closest("tr").data[t(this,p).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,p).dataset.row);const r=this.getAttribute("update-row-state")!="false";s<0?t(this,H).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,r):t(this,H).data.setValue(s,t(this,p).dataset.bind,e,r)}get row(){return parseInt(t(this,p).dataset.row)}get data(){return t(this,p).closest("tr").data}refresh(){const e=t(this,p).dataset.bind;return parseInt(t(this,p).dataset.row),t(this,It).data[e]}};H=new WeakMap,It=new WeakMap,p=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,Be=new WeakMap,h(ze,"CellElement");let ve=ze;const De=class De extends ve{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(De,"EditableCellElement");let xe=De;const je=class je extends xe{constructor(){super();d(this,_t);d(this,lt);d(this,yt);d(this,pt);d(this,le);d(this,X);R(this,"refresh",h(()=>{const e=super.refresh();t(this,_t).value=e},"refresh"));d(this,Pe,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,lt)=="number"){let n=[];if(t(this,X)&&Number(t(this,X))>0&&n.push("."),t(this,pt)&&Number(t(this,pt))>=0&&n.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!n.includes(e.key)&&e.preventDefault(),t(this,X)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,r=s.indexOf(".");if(r>=0){var s=s.substr(r+1,s.length);s.length>=Number(t(this,X))&&e.preventDefault()}}}t(this,yt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,yt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),y(this,lt,this.getAttribute("type")||"text"),y(this,yt,this.getAttribute("maxbyte")),y(this,pt,this.getAttribute("min")),y(this,le,this.getAttribute("max")),y(this,X,this.getAttribute("scale")),!["text","number"].includes(t(this,lt)))throw`invalid type : ${t(this,lt)}`}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=`
434
434
  <input type="text"
435
435
  ${e.join(" ")}
436
436
  ondragstart="return false;"
437
437
  >
438
- `,super.connectedCallback(),y(this,_t,this.querySelector("input"))}};_t=new WeakMap,at=new WeakMap,yt=new WeakMap,pt=new WeakMap,le=new WeakMap,K=new WeakMap,Pe=new WeakMap,h(je,"CellInputText");let we=je;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",we)});
438
+ `,super.connectedCallback(),y(this,_t,this.querySelector("input"))}};_t=new WeakMap,lt=new WeakMap,yt=new WeakMap,pt=new WeakMap,le=new WeakMap,X=new WeakMap,Pe=new WeakMap,h(je,"CellInputText");let we=je;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",we)});
439
439
  //# sourceMappingURL=nine-table.umd.js.map