@ninebone/table 0.0.578 → 0.0.580

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