@ninebone/table 0.0.544 → 0.0.546

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