@ninebone/table 0.0.518 → 0.0.520

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 je=Object.defineProperty;var Fe=S=>{throw TypeError(S)};var Ue=(S,v,k)=>v in S?je(S,v,{enumerable:!0,configurable:!0,writable:!0,value:k}):S[v]=k;var h=(S,v)=>je(S,"name",{value:v,configurable:!0});var R=(S,v,k)=>Ue(S,typeof v!="symbol"?v+"":v,k),Ve=(S,v,k)=>v.has(S)||Fe("Cannot "+k);var t=(S,v,k)=>(Ve(S,v,"read from private field"),k?k.call(S):v.get(S)),d=(S,v,k)=>v.has(S)?Fe("Cannot add the same private member more than once"):v instanceof WeakSet?v.add(S):v.set(S,k),y=(S,v,k,F)=>(Ve(S,v,"write to private field"),F?F.call(S,k):v.set(S,k),k);var Ye=(S,v,k,F)=>({set _(mt){y(S,v,mt,k)},get _(){return t(S,v,F)}});var z,V,E,Z,G,J,Wt,Q,Ot,Y,lt,tt,T,xt,vt,Bt,j,A,D,I,U,et,wt,qe,ct,zt,Dt,Pt,St,Et,jt,Ft,At,Re,ht,qt,Vt,Ut,st,it,Xt,Kt,dt,Zt,Gt,Jt,kt,_,Qt,Tt,te,Ct,ft,W,C,O,ut,ee,X,se,nt,Lt,ie,ne,gt,rt,bt,M,Ht,re,ot,oe,ae,L,$t,p,Ie,_e,Ne,We,Oe,It,at,yt,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 k=new v,Ee=class Ee extends HTMLElement{constructor(){super();d(this,z);d(this,V,!1);d(this,E);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&&(y(this,J,new ResizeObserver(()=>{this.refresh()})),t(this,J).observe(e))},"#observeResize"));R(this,"refresh",h(()=>{if(!t(this,z)||!t(this,E)||t(this,V))return;const e=t(this,E).container,s=e.querySelector("table");if(!s)return;const n=t(this,E).track,r=t(this,E).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=n.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,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const m=l-f;g>m&&(g=m),r.style.left=`${g}px`,t(this,E).left.disabled=g===0,t(this,E).right.disabled=g>=m-1},"refresh"));d(this,Q,h(e=>{if(!t(this,E))return!1;const s=t(this,E).container,n=s.querySelector("table");if(!n)return!1;const r=t(this,E).track.getBoundingClientRect(),o=t(this,E).thumb.clientWidth;let a=e;a<0&&(a=0);const c=r.width-o;a>c&&(a=c),a=parseInt(a,10),t(this,E).thumb.style.left=`${a}px`,t(this,E).left.disabled=a===0,t(this,E).right.disabled=a>=c-1;const l=s.clientWidth,u=n.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(n=>{clearInterval(t(this,Z)),clearInterval(t(this,G));const r=parseInt(t(this,E).thumb.style.left||0,10);t(this,Q).call(this,r+n),y(this,Z,setInterval(()=>{clearInterval(t(this,Z)),y(this,G,setInterval(()=>{const o=parseInt(t(this,E).thumb.style.left||0,10);t(this,Q).call(this,o+n)||clearInterval(t(this,G))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,Z)),clearInterval(t(this,G))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{t(this,E).left.addEventListener(n,s),t(this,E).right.addEventListener(n,s),t(this,E).track.addEventListener(n,s)}),t(this,E).left.addEventListener("mousedown",n=>{n.button===0&&e(-20)}),t(this,E).right.addEventListener("mousedown",n=>{n.button===0&&e(20)}),t(this,E).left.addEventListener("touchstart",()=>e(-20)),t(this,E).right.addEventListener("touchstart",()=>e(20)),t(this,E).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const r=t(this,E).track.getBoundingClientRect(),o=t(this,E).thumb.clientWidth;t(this,Q).call(this,n.clientX-r.left-o/2)}),t(this,E).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,V,!0),this.shiftX=n.clientX-t(this,E).thumb.getBoundingClientRect().left;const r=h(a=>{if(!t(this,V))return;const c=t(this,E).track.getBoundingClientRect();t(this,Q).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{y(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(y(this,z,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,z))return;this.innerHTML=`
1
+ (function(E,w){typeof exports=="object"&&typeof module<"u"?w(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],w):(E=typeof globalThis<"u"?globalThis:E||self,w(E.NineboneUtil))})(this,function(E){"use strict";var je=Object.defineProperty;var Fe=E=>{throw TypeError(E)};var Ue=(E,w,v)=>w in E?je(E,w,{enumerable:!0,configurable:!0,writable:!0,value:v}):E[w]=v;var h=(E,w)=>je(E,"name",{value:w,configurable:!0});var k=(E,w,v)=>Ue(E,typeof w!="symbol"?w+"":w,v),Ve=(E,w,v)=>w.has(E)||Fe("Cannot "+v);var t=(E,w,v)=>(Ve(E,w,"read from private field"),v?v.call(E):w.get(E)),d=(E,w,v)=>w.has(E)?Fe("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(E):w.set(E,v),y=(E,w,v,F)=>(Ve(E,w,"write to private field"),F?F.call(E,v):w.set(E,v),v);var Ye=(E,w,v,F)=>({set _(mt){y(E,w,mt,v)},get _(){return t(E,w,F)}});var z,V,A,Z,G,J,Wt,Q,Ot,Y,lt,tt,T,xt,vt,Bt,j,R,D,I,U,et,wt,Re,ct,zt,Dt,Pt,St,Et,jt,Ft,At,qe,ht,Rt,Vt,Ut,st,it,Xt,Kt,dt,Zt,Gt,Jt,kt,_,Qt,Tt,te,Ct,ft,W,C,O,ut,ee,X,se,nt,Lt,ie,ne,gt,rt,bt,M,Ht,re,ot,oe,ae,L,$t,p,Ie,_e,Ne,We,Oe,It,at,yt,pt,le,K,De;const Se=class Se extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Se,"Trace");let w=Se;const v=new w,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&&(y(this,J,new ResizeObserver(()=>{this.refresh()})),t(this,J).observe(e))},"#observeResize"));k(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 n=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=n.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,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const m=l-f;g>m&&(g=m),r.style.left=`${g}px`,t(this,A).left.disabled=g===0,t(this,A).right.disabled=g>=m-1},"refresh"));d(this,Q,h(e=>{if(!t(this,A))return!1;const s=t(this,A).container,n=s.querySelector("table");if(!n)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=n.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(n=>{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+n),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+n)||clearInterval(t(this,G))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,Z)),clearInterval(t(this,G))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{t(this,A).left.addEventListener(n,s),t(this,A).right.addEventListener(n,s),t(this,A).track.addEventListener(n,s)}),t(this,A).left.addEventListener("mousedown",n=>{n.button===0&&e(-20)}),t(this,A).right.addEventListener("mousedown",n=>{n.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",n=>{if(n.button!==0)return;n.preventDefault();const r=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;t(this,Q).call(this,n.clientX-r.left-o/2)}),t(this,A).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,V,!0),this.shiftX=n.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(()=>{y(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(y(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}y(this,E,{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,E=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,T);d(this,xt,0);d(this,vt,0);R(this,"refresh",h(()=>{if(!t(this,Y)||!t(this,T))return;k.log("nine-table-vscrollbar.refresh");const e=t(this,T).container,s=t(this,T).track,n=t(this,T).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,c=t(this,lt).getRowHeight(),l=a*c;if(l<=r){n.style.display="none",t(this,T).top.disabled=!0,t(this,T).bottom.disabled=!0;return}else n.style.display="block";const f=s.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/l),f),20);n.style.height=`${u}px`;const b=e.scrollTop,g=Math.max(l-r,1);let m=0;g>0&&(m=b/g*(f-u));const w=f-u;m<0&&(m=0),m>w&&(m=w),n.style.top=`${m}px`,t(this,T).top.disabled=b<=0,t(this,T).bottom.disabled=b>=g-1},"refresh"));d(this,Bt,h(()=>{k.log("nine-table-vscrollbar.#init");const e=t(this,T).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,T).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,xt,n.clientY),y(this,vt,e.scrollTop);const r=h(a=>{if(!t(this,tt))return;const c=t(this,T).track.getBoundingClientRect(),l=t(this,T).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,xt),g=e.clientHeight,m=s(),w=Math.max(m-g,1);if(u>0&&w>0){const q=b/u*w;let x=t(this,vt)+q;const N=Math.max(0,m-g);x<0&&(x=0),x>N&&(x=N),e.scrollTop=x}this.refresh()},"onMouseMove"),o=h(()=>{y(this,tt,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,T).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,T).thumb)return;const r=t(this,T).track.getBoundingClientRect(),o=t(this,T).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.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,T).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,T).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,z).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,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,T);d(this,xt,0);d(this,vt,0);k(this,"refresh",h(()=>{if(!t(this,Y)||!t(this,T))return;v.log("nine-table-vscrollbar.refresh");const e=t(this,T).container,s=t(this,T).track,n=t(this,T).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,c=t(this,lt).getRowHeight(),l=a*c;if(l<=r){n.style.display="none",t(this,T).top.disabled=!0,t(this,T).bottom.disabled=!0;return}else n.style.display="block";const f=s.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/l),f),20);n.style.height=`${u}px`;const b=e.scrollTop,g=Math.max(l-r,1);let m=0;g>0&&(m=b/g*(f-u));const S=f-u;m<0&&(m=0),m>S&&(m=S),n.style.top=`${m}px`,t(this,T).top.disabled=b<=0,t(this,T).bottom.disabled=b>=g-1},"refresh"));d(this,Bt,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,T).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,T).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,xt,n.clientY),y(this,vt,e.scrollTop);const r=h(a=>{if(!t(this,tt))return;const c=t(this,T).track.getBoundingClientRect(),l=t(this,T).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,xt),g=e.clientHeight,m=s(),S=Math.max(m-g,1);if(u>0&&S>0){const q=b/u*S;let x=t(this,vt)+q;const N=Math.max(0,m-g);x<0&&(x=0),x>N&&(x=N),e.scrollTop=x}this.refresh()},"onMouseMove"),o=h(()=>{y(this,tt,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,T).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,T).thumb)return;const r=t(this,T).track.getBoundingClientRect(),o=t(this,T).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.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,T).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,T).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,Y,this.getRootNode().host),y(this,lt,this.closest("nine-table-sheet")),this.innerHTML=`
64
64
  <style>
65
65
  nine-table-vscrollbar {
66
66
  display: flex;
@@ -123,7 +123,7 @@
123
123
  <button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
124
124
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
125
125
  <button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
126
- `;const e=h(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,T,{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,T=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(i){d(this,j);d(this,A);d(this,D,new Map);d(this,I,null);d(this,U,null);d(this,et,0);d(this,wt,40);d(this,qe,!1);d(this,ct,!1);d(this,zt,3);R(this,"refresh",h(()=>{k.log("rowManager.refresh");const i=t(this,A).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop))},"refresh"));R(this,"initialize",h(()=>{y(this,I,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,A).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,D).set(o,u)});const i=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),n=t(this,A).querySelector(".ng-container-body .ng-part-header"),r=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=h((c,l,f)=>{var u;o||(o=!0,i&&i.scrollTop!==c&&(i.scrollTop=c),e&&e.scrollTop!==c&&(e.scrollTop=c),s&&s.scrollTop!==c&&(s.scrollTop=c),n&&n.scrollLeft!==l&&(n.scrollLeft=l),r&&r.scrollLeft!==l&&(r.scrollLeft=l),t(this,ht).call(this,c),(u=t(this,A).querySelector("nine-table-vscrollbar"))==null||u.refresh(),o=!1)},"syncScroll");[i,e,s].forEach(c=>{c&&c.addEventListener("scroll",()=>{t(this,ct)||(y(this,ct,!0),requestAnimationFrame(()=>{a(c.scrollTop,c.scrollLeft),y(this,ct,!1)}))})})}},"initialize"));d(this,Dt,h((i,e)=>{const s=t(this,D).get(e);if(!s||s.length===0)return;const n=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;n.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const r=n.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):n.appendChild(o)},"#renderRows"));d(this,Pt,h(i=>{if(t(this,I)!==null&&t(this,I)>0)return t(this,I);k.log("#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)return 24;const s=i.querySelector("tbody.bindable-tbody");if(!s)return 24;s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),n?n.before(r):s.appendChild(r);const o=t(this,A),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(b=>{f+=b.offsetHeight||b.getBoundingClientRect().height}),u.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,y(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,St,h(()=>{const e=(t(this,j).data.get()||[]).length,s=t(this,I),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,A).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{if(t(this,et)>0&&t(this,I)>0){const i=Math.ceil(t(this,et)/t(this,I));y(this,wt,i+t(this,zt))}},"#updateRowCount"));d(this,jt,h(()=>{var a,c,l,f,u,b;const i=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const g=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],q=Math.max(g.length,m.length,w.length);for(let x=0;x<q;x++){const N=[((a=g[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(...N);H>0&&(g[x]&&(g[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),w[x]&&(w[x].style.height=`${H}px`))}}const n=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(r){const g=n?Array.from(n.querySelectorAll("tfoot tr")):[],m=Array.from(r.querySelectorAll("tfoot tr")),w=o?Array.from(o.querySelectorAll("tfoot tr")):[],q=Math.max(g.length,m.length,w.length);for(let x=0;x<q;x++){const N=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=w[x])==null?void 0:b.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(g[x]&&(g[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,A)||!(t(this,A)instanceof HTMLElement)||(y(this,U,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const n=e.contentRect.height;if(n>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(n-r,100);t(this,et)!==c&&(y(this,et,c),t(this,Et).call(this),t(this,I)!==null&&t(this,At).call(this))}}})),t(this,U).observe(t(this,A)))},"#initResizeObserver"));d(this,At,h(()=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,A).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Dt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,Re,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).querySelector(e);if(!s)return;const n=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const b=i+Math.floor(u/o);if(b>=c){f.style.display="none";return}const g=t(this,j).data.get(b);f.style.display="",t(this,qt).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var u;const e=t(this,I);if(!e||e<=0)return;const n=(t(this,j).data.get()||[]).length,r=Math.max(0,Math.floor(i/e)),o=r*e,a=((u=t(this,D).get(".ng-container-body"))==null?void 0:u.length)||1,c=t(this,A).querySelector(".ng-container-body"),l=c==null?void 0:c.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"),f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const g=t(this,A).querySelector(b);if(!g)return;const m=g.querySelector(".ng-part-body tbody.bindable-tbody");m&&(m.style.transform=`translateY(${o}px)`)}),k.log("#handleScroll",f,r),f!==r&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const g=t(this,A).querySelector(b);if(!g)return;const m=g.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((q,x)=>{const N=r+Math.floor(x/a);if(N>=n){q.style.display="none";return}const H=t(this,j).data.get(N);q.style.display="",t(this,qt).call(this,q,H,N)})})},"#handleScroll"));d(this,qt,h((i,e,s)=>{i.dataset.row=s,i.data=e,k.log(e,s),Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const o=Array.from(n.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;const i=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const n=i?Array.from(i.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(n.length,r.length,o.length);for(let u=0;u<a;u++){const b=[((c=n[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],g=Math.max(...b);g>0&&(n[u]&&(n[u].style.height=`${g}px`),r[u]&&(r[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,A,i),t(this,Ft).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,A=new WeakMap,D=new WeakMap,I=new WeakMap,U=new WeakMap,et=new WeakMap,wt=new WeakMap,qe=new WeakMap,ct=new WeakMap,zt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,Re=new WeakMap,ht=new WeakMap,qt=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"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let q=[];b&&q.push(`data-bind="${b}"`),g&&q.push(`data-expr="${g}"`),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 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"),a.style.display="table"},"ensureTableStructure"),n=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let q=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let P=0;P<g[w].length;P++)if(g[w][P]===null){q=P;break}const N=x.rowSpan||1,H=x.colSpan||1;for(let P=0;P<N;P++)for(let _t=0;_t<H;_t++)w+P<u&&q+_t<b&&(g[w+P][q+_t]=P===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<g[w].length;x++)if(g[w][x]==="1"){q.dataset.col=x,g[w][x]="0";break}})})},"resetColIndex"),r=i.cloneNode(!0);return s(r),e(r),n(r,"thead"),n(r,"tbody"),n(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 Rt=class Rt extends HTMLElement{constructor(){super();d(this,Ut);d(this,st,null);d(this,it);R(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:n})=>{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,st),n,"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,st),n,"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,st),n,"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}`),n=s==null?void 0:s.querySelectorAll("table");if(!s||!n||n.length===0)return;let r=0;n[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"));R(this,"generate",h(e=>{e&&(y(this,st,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,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),c=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):n==="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"));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=Rt.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}y(this,T,{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,T=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(i){d(this,j);d(this,R);d(this,D,new Map);d(this,I,null);d(this,U,null);d(this,et,0);d(this,wt,40);d(this,Re,!1);d(this,ct,!1);d(this,zt,3);k(this,"refresh",h(()=>{v.log("rowManager.refresh");const i=t(this,R).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop))},"refresh"));k(this,"initialize",h(()=>{v.log("rowManager.initialize"),y(this,I,null),t(this,D).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(b=>b.cloneNode(!0));t(this,D).set(o,u)});const i=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"),n=t(this,R).querySelector(".ng-container-body .ng-part-header"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=h((c,l,f)=>{var u;o||(o=!0,i&&i.scrollTop!==c&&(i.scrollTop=c),e&&e.scrollTop!==c&&(e.scrollTop=c),s&&s.scrollTop!==c&&(s.scrollTop=c),n&&n.scrollLeft!==l&&(n.scrollLeft=l),r&&r.scrollLeft!==l&&(r.scrollLeft=l),t(this,ht).call(this,c),(u=t(this,R).querySelector("nine-table-vscrollbar"))==null||u.refresh(),o=!1)},"syncScroll");[i,e,s].forEach(c=>{c&&c.addEventListener("scroll",()=>{t(this,ct)||(y(this,ct,!0),requestAnimationFrame(()=>{a(c.scrollTop,c.scrollLeft),y(this,ct,!1)}))})})}},"initialize"));d(this,Dt,h((i,e)=>{v.log("rowManager.#renderRows");const s=t(this,D).get(e);if(!s||s.length===0)return;const n=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;n.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const r=n.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):n.appendChild(o)},"#renderRows"));d(this,Pt,h(i=>{if(v.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);v.log("#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)return 24;const s=i.querySelector("tbody.bindable-tbody");if(!s)return 24;s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),n?n.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(b=>{f+=b.offsetHeight||b.getBoundingClientRect().height}),u.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,y(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,St,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),n=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=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{if(t(this,et)>0&&t(this,I)>0){const i=Math.ceil(t(this,et)/t(this,I));y(this,wt,i+t(this,zt))}},"#updateRowCount"));d(this,jt,h(()=>{var a,c,l,f,u,b;const i=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 g=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),S=s?Array.from(s.querySelectorAll("tbody tr")):[],q=Math.max(g.length,m.length,S.length);for(let x=0;x<q;x++){const N=[((a=g[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=S[x])==null?void 0:l.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(g[x]&&(g[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),S[x]&&(S[x].style.height=`${H}px`))}}const n=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 g=n?Array.from(n.querySelectorAll("tfoot tr")):[],m=Array.from(r.querySelectorAll("tfoot tr")),S=o?Array.from(o.querySelectorAll("tfoot tr")):[],q=Math.max(g.length,m.length,S.length);for(let x=0;x<q;x++){const N=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=S[x])==null?void 0:b.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(g[x]&&(g[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),S[x]&&(S[x].style.height=`${H}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(y(this,U,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const n=e.contentRect.height;if(n>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(n-r,100);t(this,et)!==c&&(y(this,et,c),t(this,Et).call(this),t(this,I)!==null&&t(this,At).call(this))}}})),t(this,U).observe(t(this,R)))},"#initResizeObserver"));d(this,At,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,R).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Dt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,qe,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,R).querySelector(e);if(!s)return;const n=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const b=i+Math.floor(u/o);if(b>=c){f.style.display="none";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;const e=t(this,I);if(!e||e<=0)return;const n=(t(this,j).data.get()||[]).length,r=Math.max(0,Math.floor(i/e)),o=r*e,a=((u=t(this,D).get(".ng-container-body"))==null?void 0:u.length)||1,c=t(this,R).querySelector(".ng-container-body"),l=c==null?void 0:c.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)"),f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const g=t(this,R).querySelector(b);if(!g)return;const m=g.querySelector(".ng-part-body tbody.bindable-tbody");m&&(m.style.transform=`translateY(${o}px)`)}),v.log("#handleScroll",f,r),f!==r&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const g=t(this,R).querySelector(b);if(!g)return;const m=g.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((q,x)=>{const N=r+Math.floor(x/a);if(N>=n){q.style.display="none";return}const H=t(this,j).data.get(N);q.style.display="",t(this,Rt).call(this,q,H,N)})})},"#handleScroll"));d(this,Rt,h((i,e,s)=>{i.dataset.row=s,i.data=e,v.log(e,s),Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const o=Array.from(n.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,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 n=i?Array.from(i.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(n.length,r.length,o.length);for(let u=0;u<a;u++){const b=[((c=n[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],g=Math.max(...b);g>0&&(n[u]&&(n[u].style.height=`${g}px`),r[u]&&(r[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`))}},"#syncHeaderHeights"));k(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,R,i),t(this,Ft).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,R=new WeakMap,D=new WeakMap,I=new WeakMap,U=new WeakMap,et=new WeakMap,wt=new WeakMap,Re=new WeakMap,ct=new WeakMap,zt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,qe=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"),m=l.getAttribute("maxbyte"),S=l.getAttribute("type");let q=[];b&&q.push(`data-bind="${b}"`),g&&q.push(`data-expr="${g}"`),m&&q.push(`maxbyte="${m}"`),S&&q.push(`type="${S}"`),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 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"),a.style.display="table"},"ensureTableStructure"),n=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const S=m.sectionRowIndex;let q=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let P=0;P<g[S].length;P++)if(g[S][P]===null){q=P;break}const N=x.rowSpan||1,H=x.colSpan||1;for(let P=0;P<N;P++)for(let _t=0;_t<H;_t++)S+P<u&&q+_t<b&&(g[S+P][q+_t]=P===0&&_t===0?"1":"0")})}),l.forEach(m=>{const S=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(q=>{for(let x=0;x<g[S].length;x++)if(g[S][x]==="1"){q.dataset.col=x,g[S][x]="0";break}})})},"resetColIndex"),r=i.cloneNode(!0);return s(r),e(r),n(r,"thead"),n(r,"tbody"),n(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,st,null);d(this,it);k(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:n})=>{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,st),n,"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,st),n,"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,st),n,"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}`),n=s==null?void 0:s.querySelectorAll("table");if(!s||!n||n.length===0)return;let r=0;n[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"));k(this,"generate",h(e=>{e&&(y(this,st,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,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),c=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):n==="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"));k(this,"getRowHeight",h(()=>t(this,it).getRowHeight(),"getRowHeight"));k(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));k(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;
@@ -262,7 +262,7 @@
262
262
  <nine-table-hscrollbar></nine-table-hscrollbar>
263
263
  <div class='ng-scroll-edge'></div>
264
264
  </div>
265
- `},"#render"));y(this,it,new ce(this)),y(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",k.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(Rt,"NineTableSheet"),R(Rt,"SCROLLBAR_SIZE",16);let Nt=Rt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Nt);const Te=class Te extends HTMLElement{constructor(){super();d(this,Jt,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var o;const n=s.ctrlKey||s.metaKey||s.shiftKey,r=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,kt).call(this,r,n)}),t(this,kt).call(this,0,!1)},"#init"));d(this,kt,h((e,s=!1)=>{const n=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const m=parseInt(g.getAttribute("data-index"),10),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 b=u===e;f.classList.toggle("active",b),f.style.flex=b?"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 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%"}),n()},"#switchSheet"))}connectedCallback(){t(this,Jt).call(this)}};Jt=new WeakMap,kt=new WeakMap,h(Te,"NineTableSheets");let de=Te;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",de);const Ce=class Ce{constructor(i){d(this,_);d(this,Qt,h(()=>{t(this,te).call(this),new ResizeObserver(i=>{for(let e of i)t(this,_).getAttribute("auto-height")==="true"&&t(this,Tt).call(this)}).observe(t(this,_))},"#init"));d(this,Tt,h(()=>{var c,l;const i=Array.from(t(this,_).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const e=parseInt(t(this,_).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(f=>f.getRowHeight())),n=(c=t(this,_).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,r=(l=t(this,_).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Nt.SCROLLBAR_SIZE,a=e*s+n+r+o;t(this,_).style.height=`${a}px`},"#applyAutoHeight"));d(this,te,h(()=>{const e=Array.from(t(this,_).children).filter(c=>c.tagName==="TABLE"),s=t(this,_).getAttribute("auto-height")==="true",n=e.length,r=e.map((c,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return 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,_).shadowRoot.innerHTML=`
265
+ `},"#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(qt,"NineTableSheet"),k(qt,"SCROLLBAR_SIZE",16);let Nt=qt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Nt);const Te=class Te extends HTMLElement{constructor(){super();d(this,Jt,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var o;const n=s.ctrlKey||s.metaKey||s.shiftKey,r=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,kt).call(this,r,n)}),t(this,kt).call(this,0,!1)},"#init"));d(this,kt,h((e,s=!1)=>{const n=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const m=parseInt(g.getAttribute("data-index"),10),S=this.querySelector(`nine-splitter[data-split-index="${m}"]`),q=f[m+1];S&&q&&q.classList.contains("active")&&S.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 b=u===e;f.classList.toggle("active",b),f.style.flex=b?"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 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%"}),n()},"#switchSheet"))}connectedCallback(){t(this,Jt).call(this)}};Jt=new WeakMap,kt=new WeakMap,h(Te,"NineTableSheets");let de=Te;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",de);const Ce=class Ce{constructor(i){d(this,_);d(this,Qt,h(()=>{t(this,te).call(this),new ResizeObserver(i=>{for(let e of i)t(this,_).getAttribute("auto-height")==="true"&&t(this,Tt).call(this)}).observe(t(this,_))},"#init"));d(this,Tt,h(()=>{var c,l;const i=Array.from(t(this,_).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const e=parseInt(t(this,_).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(f=>f.getRowHeight())),n=(c=t(this,_).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,r=(l=t(this,_).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Nt.SCROLLBAR_SIZE,a=e*s+n+r+o;t(this,_).style.height=`${a}px`},"#applyAutoHeight"));d(this,te,h(()=>{const e=Array.from(t(this,_).children).filter(c=>c.tagName==="TABLE"),s=t(this,_).getAttribute("auto-height")==="true",n=e.length,r=e.map((c,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return 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,_).shadowRoot.innerHTML=`
266
266
  <style>
267
267
  :host {
268
268
  display: flex;
@@ -352,7 +352,7 @@
352
352
  <nine-table-analysis></nine-table-analysis>
353
353
  </nine-table-body>
354
354
  <nine-table-footer></nine-table-footer>
355
- `;const a=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Tt).call(this)})})},"#render"));y(this,_,i),t(this,Qt).call(this)}};_=new WeakMap,Qt=new WeakMap,Tt=new WeakMap,te=new WeakMap,h(Ce,"LayoutManager");let fe=Ce;const Le=class Le{constructor(i){d(this,Ct);d(this,ft,-1);R(this,"count",h(()=>t(this,Ct).rawRecords.length,"count"));y(this,Ct,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(()=>{})}};Ct=new WeakMap,ft=new WeakMap,h(Le,"ngRow");let ue=Le;const B=class B{constructor(i,e){d(this,W);d(this,C);d(this,O,[]);d(this,ut,[]);d(this,ee,0);d(this,X,[]);d(this,se,h(()=>{y(this,X,[]);const i=t(this,W).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,C).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Lt).call(this)),e.__ng.height=t(this,X).slice()})},"#initialize"));d(this,nt,h(()=>{t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));R(this,"get",h((i,e)=>{var r;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 n=typeof((r=t(this,W).fields)==null?void 0:r.get)=="function"?t(this,W).fields.get():[];if(e!=null){const o=n.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,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"));R(this,"reset",h(()=>{y(this,O,[]),y(this,ut,[]),t(this,nt).call(this)},"reset"));R(this,"clear",h(()=>{var i;t(this,C).rawRecords=[],y(this,O,[]),y(this,ut,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).viewRecords.reset()},"clear"));d(this,ie,h(i=>{var n;Array.isArray(i)||(i=[i]);const e=typeof((n=t(this,W).fields)==null?void 0:n.get)=="function"?t(this,W).fields.get():Object.keys(i[0]||{}),s=[];return i.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,ne,h(i=>(Array.isArray(i)||(i=[i]),i.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}),i),"#defaultInsert"));R(this,"add",h((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,C).rawRecords=t(this,C).rawRecords.concat(t(this,ne).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((r,o)=>{const a=t(this,C).rawRecords[n-o];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,nt).call(this),n},"add"));R(this,"delete",h(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,C).host.row.at]:e=[parseInt(i,10)],e.sort((s,n)=>n-s).forEach(s=>{if(t(this,O)[s]){const n=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!==n):t(this,C).rawRecords.forEach(r=>{r.__ng.rowid===n&&(r.__ng.deleted=!0,r.__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 r=(typeof((c=t(this,W).fields)==null?void 0:c.get)=="function"?t(this,W).fields.get():[]).indexOf(e);if(r<0)return;const o=this.getValidData()[i];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"));R(this,"resetRecords",h(()=>{y(this,ut,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),y(this,O,t(this,C).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,C).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,O).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));R(this,"getValidData",h(()=>(t(this,O).length===0&&t(this,C).rawRecords.length>0&&this.resetRecords(),t(this,O)),"getValidData"));d(this,gt,h(i=>{var o;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,n=typeof((o=t(this,W).fields)==null?void 0:o.get)=="function"?t(this,W).fields.get():[],r=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return n.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?r[0]:r},"#conv"));R(this,"count",h(()=>this.getValidData().length,"count"));y(this,W,i),y(this,C,e),t(this,se).call(this)}get source(){return t(this,gt).call(this,t(this,C).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ye(this,ee)._}get length(){return t(this,O).length}getRowCount(){return this.length}};W=new WeakMap,C=new WeakMap,O=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,nt=new WeakMap,Lt=new WeakMap,ie=new WeakMap,ne=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 He=class He{constructor(i){d(this,rt);y(this,rt,i),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 n,r;const s=parseInt(e,10);if(!(s>=this.data.count()))return(r=(n=this.data.getValidData()[s])==null?void 0:n.__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,n)=>{e=parseInt(e,10),this.data.setValue(e,s,n)},this.setDataSource([])}};rt=new WeakMap,h(He,"ngDataManager");let be=He;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(n=>n.name===s)||t(this,M).push({name:s,type:e})}),t(this,Ht).call(this)},"add"));d(this,Ht,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,re,h(()=>{y(this,M,[]),k.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)k.log(e),$("[data-bind]",e).each((s,n)=>{const r=n.dataset.bind,o=n.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((n,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"));y(this,bt,i),t(this,re).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,Ht=new WeakMap,re=new WeakMap,h(Me,"ngFields");let ye=Me;const $e=class $e 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)),k.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(){k.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($e,"NineTable");let pe=$e;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 Be=class Be extends me{constructor(){super();d(this,L);d(this,$t);d(this,p);d(this,Ie);d(this,_e);d(this,Ne);d(this,We);R(this,"getDisplayText",h(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,n=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,n,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,L).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,L).data)}catch{}},"getDisplayText"));d(this,Oe,h(()=>{if(!(!t(this,L)||!t(this,L).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"),n=[];$("th,td",s).each((x,N)=>{var H=ninegrid.j.querySelectorAll(N).attr("suppress");H&&N.dataset.row&&(H=parseInt(H),!isNaN(H)&&H<=e&&n.push(H))}),n.sort();var r=!1;if(parseInt(s.sectionRowIndex/t(this,L).template.length)>0)for(var o of n){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,L).data.get(c);t(this,p).dataset.matrixRow;var u=t(this,L).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){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var m=parseInt(t(this,p).dataset.matrixRow),w=m-1,q=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${w}"]`);$(q).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(q).removeClass("last-none-suppress").addClass("last-suppress"):!$(q).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).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"));R(this,"getExprValue",h((e,s,n,r)=>{if(typeof e<"u")try{n=parseInt(n);const o=e.replace("()","");return t(this,L)[o]?t(this,L)[o].call(this,s,n,t(this,p)):t(this,L).exprFunction(e).call(this,s,n,t(this,L).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,L,this.getRootNode().host),y(this,p,this.closest("th,td")),y(this,$t,t(this,p).closest("tr"))}get value(){var e=!t(this,L)||!t(this,L).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 n=this.getAttribute("update-row-state")!="false";s<0?t(this,L).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,n):t(this,L).data.setValue(s,t(this,p).dataset.bind,e,n)}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,$t).data[e]}};L=new WeakMap,$t=new WeakMap,p=new WeakMap,Ie=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,h(Be,"CellElement");let xe=Be;const ze=class ze extends xe{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(ze,"EditableCellElement");let ve=ze;const Pe=class Pe extends ve{constructor(){super();d(this,It);d(this,at);d(this,yt);d(this,pt);d(this,le);d(this,K);R(this,"refresh",h(()=>{t(this,It).value="a"},"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,n=s.indexOf(".");if(n>=0){var s=s.substr(n+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=`
355
+ `;const a=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,Tt).call(this)})})},"#render"));y(this,_,i),t(this,Qt).call(this)}};_=new WeakMap,Qt=new WeakMap,Tt=new WeakMap,te=new WeakMap,h(Ce,"LayoutManager");let fe=Ce;const Le=class Le{constructor(i){d(this,Ct);d(this,ft,-1);k(this,"count",h(()=>t(this,Ct).rawRecords.length,"count"));y(this,Ct,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(()=>{})}};Ct=new WeakMap,ft=new WeakMap,h(Le,"ngRow");let ue=Le;const B=class B{constructor(i,e){d(this,W);d(this,C);d(this,O,[]);d(this,ut,[]);d(this,ee,0);d(this,X,[]);d(this,se,h(()=>{y(this,X,[]);const i=t(this,W).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,C).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Lt).call(this)),e.__ng.height=t(this,X).slice()})},"#initialize"));d(this,nt,h(()=>{t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));k(this,"get",h((i,e)=>{var r;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 n=typeof((r=t(this,W).fields)==null?void 0:r.get)=="function"?t(this,W).fields.get():[];if(e!=null){const o=n.indexOf(e);return o>=0?s[i].v[o]:null}return t(this,gt).call(this,s[i])},"get"));k(this,"set",h(i=>{this.clear(),this.add(i,!1),t(this,nt).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"));k(this,"reset",h(()=>{y(this,O,[]),y(this,ut,[]),t(this,nt).call(this)},"reset"));k(this,"clear",h(()=>{var i;t(this,C).rawRecords=[],y(this,O,[]),y(this,ut,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).viewRecords.reset()},"clear"));d(this,ie,h(i=>{var n;Array.isArray(i)||(i=[i]);const e=typeof((n=t(this,W).fields)==null?void 0:n.get)=="function"?t(this,W).fields.get():Object.keys(i[0]||{}),s=[];return i.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,ne,h(i=>(Array.isArray(i)||(i=[i]),i.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}),i),"#defaultInsert"));k(this,"add",h((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,C).rawRecords=t(this,C).rawRecords.concat(t(this,ne).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((r,o)=>{const a=t(this,C).rawRecords[n-o];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,nt).call(this),n},"add"));k(this,"delete",h(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,C).host.row.at]:e=[parseInt(i,10)],e.sort((s,n)=>n-s).forEach(s=>{if(t(this,O)[s]){const n=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!==n):t(this,C).rawRecords.forEach(r=>{r.__ng.rowid===n&&(r.__ng.deleted=!0,r.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,nt).call(this)},"delete"));k(this,"setValue",h((i,e,s)=>{var c;i=parseInt(i,10);const r=(typeof((c=t(this,W).fields)==null?void 0:c.get)=="function"?t(this,W).fields.get():[]).indexOf(e);if(r<0)return;const o=this.getValidData()[i];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"));k(this,"resetRecords",h(()=>{y(this,ut,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),y(this,O,t(this,C).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,C).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,O).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));k(this,"getValidData",h(()=>(t(this,O).length===0&&t(this,C).rawRecords.length>0&&this.resetRecords(),t(this,O)),"getValidData"));d(this,gt,h(i=>{var o;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,n=typeof((o=t(this,W).fields)==null?void 0:o.get)=="function"?t(this,W).fields.get():[],r=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return n.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?r[0]:r},"#conv"));k(this,"count",h(()=>this.getValidData().length,"count"));y(this,W,i),y(this,C,e),t(this,se).call(this)}get source(){return t(this,gt).call(this,t(this,C).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ye(this,ee)._}get length(){return t(this,O).length}getRowCount(){return this.length}};W=new WeakMap,C=new WeakMap,O=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,nt=new WeakMap,Lt=new WeakMap,ie=new WeakMap,ne=new WeakMap,gt=new WeakMap,h(B,"ngData"),k(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=B;const He=class He{constructor(i){d(this,rt);y(this,rt,i),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 n,r;const s=parseInt(e,10);if(!(s>=this.data.count()))return(r=(n=this.data.getValidData()[s])==null?void 0:n.__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,n)=>{e=parseInt(e,10),this.data.setValue(e,s,n)},this.setDataSource([])}};rt=new WeakMap,h(He,"ngDataManager");let be=He;const Me=class Me{constructor(i){d(this,bt);d(this,M,[]);k(this,"add",h((i,e="string")=>{i.forEach(s=>{t(this,M).some(n=>n.name===s)||t(this,M).push({name:s,type:e})}),t(this,Ht).call(this)},"add"));d(this,Ht,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,re,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,n)=>{const r=n.dataset.bind,o=n.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((n,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"));y(this,bt,i),t(this,re).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,Ht=new WeakMap,re=new WeakMap,h(Me,"ngFields");let ye=Me;const $e=class $e 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($e,"NineTable");let pe=$e;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"),k(Mt,"_styleCache",new Map),k(Mt,"_customStyleCache",new Map);let me=Mt;const Be=class Be extends me{constructor(){super();d(this,L);d(this,$t);d(this,p);d(this,Ie);d(this,_e);d(this,Ne);d(this,We);k(this,"getDisplayText",h(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,n=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,n,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,L).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,L).data)}catch{}},"getDisplayText"));d(this,Oe,h(()=>{if(!(!t(this,L)||!t(this,L).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"),n=[];$("th,td",s).each((x,N)=>{var H=ninegrid.j.querySelectorAll(N).attr("suppress");H&&N.dataset.row&&(H=parseInt(H),!isNaN(H)&&H<=e&&n.push(H))}),n.sort();var r=!1;if(parseInt(s.sectionRowIndex/t(this,L).template.length)>0)for(var o of n){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,L).data.get(c);t(this,p).dataset.matrixRow;var u=t(this,L).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){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var m=parseInt(t(this,p).dataset.matrixRow),S=m-1,q=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${S}"]`);$(q).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(q).removeClass("last-none-suppress").addClass("last-suppress"):!$(q).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).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"));k(this,"getExprValue",h((e,s,n,r)=>{if(typeof e<"u")try{n=parseInt(n);const o=e.replace("()","");return t(this,L)[o]?t(this,L)[o].call(this,s,n,t(this,p)):t(this,L).exprFunction(e).call(this,s,n,t(this,L).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,L,this.getRootNode().host),y(this,p,this.closest("th,td")),y(this,$t,t(this,p).closest("tr"))}get value(){var e=!t(this,L)||!t(this,L).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 n=this.getAttribute("update-row-state")!="false";s<0?t(this,L).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,n):t(this,L).data.setValue(s,t(this,p).dataset.bind,e,n)}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,$t).data[e]}};L=new WeakMap,$t=new WeakMap,p=new WeakMap,Ie=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,h(Be,"CellElement");let xe=Be;const ze=class ze extends xe{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(ze,"EditableCellElement");let ve=ze;const Pe=class Pe extends ve{constructor(){super();d(this,It);d(this,at);d(this,yt);d(this,pt);d(this,le);d(this,K);k(this,"refresh",h(()=>{const e=super.refresh();v.log("::",e),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,n=s.indexOf(".");if(n>=0){var s=s.substr(n+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=`
356
356
  <input type="text"
357
357
  ${e.join(" ")}
358
358
  ondragstart="return false;"