@ninebone/table 0.0.440 → 0.0.442

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(m,p){typeof exports=="object"&&typeof module<"u"?p(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],p):(m=typeof globalThis<"u"?globalThis:m||self,p(m.NineboneUtil))})(this,function(m){"use strict";var me=Object.defineProperty;var xe=m=>{throw TypeError(m)};var Se=(m,p,E)=>p in m?me(m,p,{enumerable:!0,configurable:!0,writable:!0,value:E}):m[p]=E;var c=(m,p)=>me(m,"name",{value:p,configurable:!0});var S=(m,p,E)=>Se(m,typeof p!="symbol"?p+"":p,E),ve=(m,p,E)=>p.has(m)||xe("Cannot "+E);var t=(m,p,E)=>(ve(m,p,"read from private field"),E?E.call(m):p.get(m)),d=(m,p,E)=>p.has(m)?xe("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(m):p.set(m,E),g=(m,p,E,z)=>(ve(m,p,"write to private field"),z?z.call(m,E):p.set(m,E),E);var we=(m,p,E,z)=>({set _(ht){g(m,p,ht,E)},get _(){return t(m,p,z)}});var _,N,x,Y,V,U,qt,X,Tt,B,tt,j,R,dt,ft,kt,O,w,I,k,P,F,ut,et,Lt,Ct,Ht,gt,bt,Mt,_t,yt,It,nt,pt,$t,Wt,it,Ot,K,Z,zt,Nt,st,Bt,Pt,Dt,xt,L,Yt,vt,Vt,wt,ot,C,A,H,rt,Ut,D,Xt,G,St,jt,Ft,lt,J,at,q,Et,Kt,Q,Zt,Gt;const le=class le extends m.trace.constructor{constructor(){super(),this.init("nine-table","green")}};c(le,"Trace");let p=le;const E=new p,ae=class ae extends HTMLElement{constructor(){super();d(this,_);d(this,N,!1);d(this,x);d(this,Y);d(this,V);d(this,U);d(this,qt,c(()=>{if(!t(this,_))return;const e=t(this,_).querySelector(".ng-container-body");e&&(g(this,U,new ResizeObserver(()=>{this.refresh()})),t(this,U).observe(e))},"#observeResize"));S(this,"refresh",c(()=>{if(!t(this,_)||!t(this,x)||t(this,N))return;const e=t(this,x).container,i=e.querySelector("table");if(!i)return;const o=t(this,x).track,r=t(this,x).thumb,s=t(this,_).querySelector(".ng-container-bottom"),l=e.clientWidth,h=i.scrollWidth;if(l!==0&&h>l)s&&(s.style.display="flex");else{s&&(s.style.display="none");return}const a=o.clientWidth;if(a<=0)return;const f=Math.max(Math.min(a*(l/h),a),20);r.style.width=`${f}px`;const u=e.scrollLeft,b=h-l;let y=0;b>0&&(y=parseInt(u/b*(a-f),10)),y<0&&(y=0);const v=a-f;y>v&&(y=v),r.style.left=`${y}px`,E.log(y),t(this,x).left.disabled=y===0,t(this,x).right.disabled=y>=v-1},"refresh"));d(this,X,c(e=>{if(!t(this,x))return!1;const i=t(this,x).container,o=i.querySelector("table");if(!o)return!1;const r=t(this,x).track.getBoundingClientRect(),s=t(this,x).thumb.clientWidth;let l=e;l<0&&(l=0);const h=r.width-s;l>h&&(l=h),l=parseInt(l,10),t(this,x).thumb.style.left=`${l}px`,t(this,x).left.disabled=l===0,t(this,x).right.disabled=l>=h-1;const a=i.clientWidth,u=o.scrollWidth-a;return h>0&&u>0&&(i.scrollLeft=l/h*u),l>0&&l<h-1},"#thumbMoveTo"));d(this,Tt,c(()=>{const e=c(o=>{clearInterval(t(this,Y)),clearInterval(t(this,V));const r=parseInt(t(this,x).thumb.style.left||0,10);t(this,X).call(this,r+o),g(this,Y,setInterval(()=>{clearInterval(t(this,Y)),g(this,V,setInterval(()=>{const s=parseInt(t(this,x).thumb.style.left||0,10);t(this,X).call(this,s+o)||clearInterval(t(this,V))},50))},500))},"delayScroll"),i=c(()=>{clearInterval(t(this,Y)),clearInterval(t(this,V))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(o=>{t(this,x).left.addEventListener(o,i),t(this,x).right.addEventListener(o,i),t(this,x).track.addEventListener(o,i)}),t(this,x).left.addEventListener("mousedown",o=>{o.button===0&&e(-20)}),t(this,x).right.addEventListener("mousedown",o=>{o.button===0&&e(20)}),t(this,x).left.addEventListener("touchstart",()=>e(-20)),t(this,x).right.addEventListener("touchstart",()=>e(20)),t(this,x).track.addEventListener("mousedown",o=>{if(o.button!==0)return;o.preventDefault();const r=t(this,x).track.getBoundingClientRect(),s=t(this,x).thumb.clientWidth;t(this,X).call(this,o.clientX-r.left-s/2)}),t(this,x).thumb.addEventListener("mousedown",o=>{if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),g(this,N,!0),this.shiftX=o.clientX-t(this,x).thumb.getBoundingClientRect().left;const r=c(l=>{if(!t(this,N))return;const h=t(this,x).track.getBoundingClientRect();t(this,X).call(this,l.clientX-h.left-this.shiftX)},"onMouseMove"),s=c(()=>{g(this,N,!1),i(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",s)})},"#init"))}connectedCallback(){if(g(this,_,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,_))return;this.innerHTML=`
1
+ (function(x,m){typeof exports=="object"&&typeof module<"u"?m(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],m):(x=typeof globalThis<"u"?globalThis:x||self,m(x.NineboneUtil))})(this,function(x){"use strict";var xe=Object.defineProperty;var ve=x=>{throw TypeError(x)};var Ee=(x,m,A)=>m in x?xe(x,m,{enumerable:!0,configurable:!0,writable:!0,value:A}):x[m]=A;var h=(x,m)=>xe(x,"name",{value:m,configurable:!0});var R=(x,m,A)=>Ee(x,typeof m!="symbol"?m+"":m,A),we=(x,m,A)=>m.has(x)||ve("Cannot "+A);var t=(x,m,A)=>(we(x,m,"read from private field"),A?A.call(x):m.get(x)),d=(x,m,A)=>m.has(x)?ve("Cannot add the same private member more than once"):m instanceof WeakSet?m.add(x):m.set(x,A),g=(x,m,A,P)=>(we(x,m,"write to private field"),P?P.call(x,A):m.set(x,A),A);var Se=(x,m,A,P)=>({set _(ut){g(x,m,ut,A)},get _(){return t(x,m,P)}});var I,D,v,U,X,j,kt,K,Lt,Y,it,Z,q,gt,bt,Ct,B,S,W,L,F,G,yt,ot,Ht,Mt,_t,pt,mt,$t,It,xt,Wt,st,vt,Ot,zt,rt,Bt,J,Q,Nt,Pt,lt,Dt,Yt,Ft,St,C,Vt,Et,Ut,Rt,at,H,T,M,ct,Xt,V,jt,tt,At,Kt,Zt,ht,et,dt,k,qt,Gt,nt,Jt,Qt;const ce=class ce extends x.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(ce,"Trace");let m=ce;const A=new m,he=class he extends HTMLElement{constructor(){super();d(this,I);d(this,D,!1);d(this,v);d(this,U);d(this,X);d(this,j);d(this,kt,h(()=>{if(!t(this,I))return;const e=t(this,I).querySelector(".ng-container-body .ng-part-body");e&&(g(this,j,new ResizeObserver(()=>{this.refresh()})),t(this,j).observe(e))},"#observeResize"));R(this,"refresh",h(()=>{if(!t(this,I)||!t(this,v)||t(this,D))return;const e=t(this,v).container,i=e.querySelector("table");if(!i)return;const s=t(this,v).track,r=t(this,v).thumb,o=t(this,I).querySelector(".ng-container-bottom"),l=e.clientWidth,c=i.scrollWidth;if(l!==0&&c>l)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const a=s.clientWidth;if(a<=0)return;const f=Math.max(Math.min(a*(l/c),a),20);r.style.width=`${f}px`;const u=e.scrollLeft,y=c-l;let b=0;y>0&&(b=parseInt(u/y*(a-f),10)),b<0&&(b=0);const p=a-f;b>p&&(b=p),r.style.left=`${b}px`,t(this,v).left.disabled=b===0,t(this,v).right.disabled=b>=p-1},"refresh"));d(this,K,h(e=>{if(!t(this,v))return!1;const i=t(this,v).container,s=i.querySelector("table");if(!s)return!1;const r=t(this,v).track.getBoundingClientRect(),o=t(this,v).thumb.clientWidth;let l=e;l<0&&(l=0);const c=r.width-o;l>c&&(l=c),l=parseInt(l,10),t(this,v).thumb.style.left=`${l}px`,t(this,v).left.disabled=l===0,t(this,v).right.disabled=l>=c-1;const a=i.clientWidth,u=s.scrollWidth-a;return c>0&&u>0&&(i.scrollLeft=l/c*u),l>0&&l<c-1},"#thumbMoveTo"));d(this,Lt,h(()=>{const e=h(s=>{clearInterval(t(this,U)),clearInterval(t(this,X));const r=parseInt(t(this,v).thumb.style.left||0,10);t(this,K).call(this,r+s),g(this,U,setInterval(()=>{clearInterval(t(this,U)),g(this,X,setInterval(()=>{const o=parseInt(t(this,v).thumb.style.left||0,10);t(this,K).call(this,o+s)||clearInterval(t(this,X))},50))},500))},"delayScroll"),i=h(()=>{clearInterval(t(this,U)),clearInterval(t(this,X))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(s=>{t(this,v).left.addEventListener(s,i),t(this,v).right.addEventListener(s,i),t(this,v).track.addEventListener(s,i)}),t(this,v).left.addEventListener("mousedown",s=>{s.button===0&&e(-20)}),t(this,v).right.addEventListener("mousedown",s=>{s.button===0&&e(20)}),t(this,v).left.addEventListener("touchstart",()=>e(-20)),t(this,v).right.addEventListener("touchstart",()=>e(20)),t(this,v).track.addEventListener("mousedown",s=>{if(s.button!==0)return;s.preventDefault();const r=t(this,v).track.getBoundingClientRect(),o=t(this,v).thumb.clientWidth;t(this,K).call(this,s.clientX-r.left-o/2)}),t(this,v).thumb.addEventListener("mousedown",s=>{if(s.button!==0)return;s.stopPropagation(),s.preventDefault(),g(this,D,!0),this.shiftX=s.clientX-t(this,v).thumb.getBoundingClientRect().left;const r=h(l=>{if(!t(this,D))return;const c=t(this,v).track.getBoundingClientRect();t(this,K).call(this,l.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{g(this,D,!1),i(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(g(this,I,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,I))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=c(()=>{const i=t(this,_).querySelector(".ng-container-body");if(!i){setTimeout(e,10);return}g(this,x,{container:i,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),i.addEventListener("scroll",()=>{t(this,N)||this.refresh()}),t(this,Tt).call(this),t(this,qt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,U)&&t(this,U).disconnect()}};_=new WeakMap,N=new WeakMap,x=new WeakMap,Y=new WeakMap,V=new WeakMap,U=new WeakMap,qt=new WeakMap,X=new WeakMap,Tt=new WeakMap,c(ae,"NineTableHScrollBar");let z=ae;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",z);const ce=class ce extends HTMLElement{constructor(){super();d(this,B);d(this,tt);d(this,j,!1);d(this,R);d(this,dt,0);d(this,ft,0);S(this,"refresh",c(()=>{if(!t(this,B)||!t(this,R))return;const e=t(this,R).container,i=t(this,R).track,o=t(this,R).thumb,r=e.clientHeight,l=(t(this,B).data.get()||[]).length,h=t(this,tt).getRowHeight(),a=l*h;if(a<=r){o.style.display="none",t(this,R).top.disabled=!0,t(this,R).bottom.disabled=!0;return}else o.style.display="block";const f=i.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/a),f),20);o.style.height=`${u}px`;const b=e.scrollTop,y=Math.max(a-r,1);let v=0;y>0&&(v=b/y*(f-u));const T=f-u;v<0&&(v=0),v>T&&(v=T),o.style.top=`${v}px`,t(this,R).top.disabled=b<=0,t(this,R).bottom.disabled=b>=y-1},"refresh"));d(this,kt,c(()=>{const e=t(this,R).container,i=c(()=>{const r=(t(this,B).data.get()||[]).length,s=t(this,tt).getRowHeight();return r*s},"getContentHeight");e.addEventListener("scroll",()=>{t(this,j)||this.refresh()}),t(this,R).thumb.addEventListener("mousedown",o=>{if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),g(this,j,!0),g(this,dt,o.clientY),g(this,ft,e.scrollTop);const r=c(l=>{if(!t(this,j))return;const h=t(this,R).track.getBoundingClientRect(),a=t(this,R).thumb.clientHeight,u=h.height-a,b=l.clientY-t(this,dt),y=e.clientHeight,v=i(),T=Math.max(v-y,1);if(u>0&&T>0){const ct=b/u*T;let Rt=t(this,ft)+ct;const pe=Math.max(0,v-y);Rt<0&&(Rt=0),Rt>pe&&(Rt=pe),e.scrollTop=Rt}this.refresh()},"onMouseMove"),s=c(()=>{g(this,j,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",s)}),t(this,R).track.addEventListener("mousedown",o=>{if(o.button!==0||o.target===t(this,R).thumb)return;const r=t(this,R).track.getBoundingClientRect(),s=t(this,R).thumb.clientHeight,l=o.clientY-r.top-s/2,a=r.height-s,f=e.clientHeight,u=i(),b=Math.max(u-f,1);if(a>0&&b>0){const y=Math.max(0,Math.min(1,l/a));e.scrollTop=y*b}this.refresh()}),t(this,R).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,R).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){g(this,B,this.getRootNode().host),g(this,tt,this.closest("nine-table-sheet")),this.innerHTML=`
63
+ `;const e=h(()=>{const i=t(this,I).querySelector(".ng-container-body .ng-part-body");if(!i){setTimeout(e,10);return}g(this,v,{container:i,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),i.addEventListener("scroll",()=>{t(this,D)||this.refresh()}),t(this,Lt).call(this),t(this,kt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,j)&&t(this,j).disconnect()}};I=new WeakMap,D=new WeakMap,v=new WeakMap,U=new WeakMap,X=new WeakMap,j=new WeakMap,kt=new WeakMap,K=new WeakMap,Lt=new WeakMap,h(he,"NineTableHScrollBar");let P=he;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",P);const de=class de extends HTMLElement{constructor(){super();d(this,Y);d(this,it);d(this,Z,!1);d(this,q);d(this,gt,0);d(this,bt,0);R(this,"refresh",h(()=>{if(!t(this,Y)||!t(this,q))return;const e=t(this,q).container,i=t(this,q).track,s=t(this,q).thumb,r=e.clientHeight,l=(t(this,Y).data.get()||[]).length,c=t(this,it).getRowHeight(),a=l*c;if(a<=r){s.style.display="none",t(this,q).top.disabled=!0,t(this,q).bottom.disabled=!0;return}else s.style.display="block";const f=i.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/a),f),20);s.style.height=`${u}px`;const y=e.scrollTop,b=Math.max(a-r,1);let p=0;b>0&&(p=y/b*(f-u));const E=f-u;p<0&&(p=0),p>E&&(p=E),s.style.top=`${p}px`,t(this,q).top.disabled=y<=0,t(this,q).bottom.disabled=y>=b-1},"refresh"));d(this,Ct,h(()=>{const e=t(this,q).container,i=h(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,it).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,Z)||this.refresh()}),t(this,q).thumb.addEventListener("mousedown",s=>{if(s.button!==0)return;s.stopPropagation(),s.preventDefault(),g(this,Z,!0),g(this,gt,s.clientY),g(this,bt,e.scrollTop);const r=h(l=>{if(!t(this,Z))return;const c=t(this,q).track.getBoundingClientRect(),a=t(this,q).thumb.clientHeight,u=c.height-a,y=l.clientY-t(this,gt),b=e.clientHeight,p=i(),E=Math.max(p-b,1);if(u>0&&E>0){const z=y/u*E;let w=t(this,bt)+z;const ft=Math.max(0,p-b);w<0&&(w=0),w>ft&&(w=ft),e.scrollTop=w}this.refresh()},"onMouseMove"),o=h(()=>{g(this,Z,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,q).track.addEventListener("mousedown",s=>{if(s.button!==0||s.target===t(this,q).thumb)return;const r=t(this,q).track.getBoundingClientRect(),o=t(this,q).thumb.clientHeight,l=s.clientY-r.top-o/2,a=r.height-o,f=e.clientHeight,u=i(),y=Math.max(u-f,1);if(a>0&&y>0){const b=Math.max(0,Math.min(1,l/a));e.scrollTop=b*y}this.refresh()}),t(this,q).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,q).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){g(this,Y,this.getRootNode().host),g(this,it,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=c(()=>{const i=t(this,B).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!i){setTimeout(e,10);return}g(this,R,{container:i,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,kt).call(this),this.refresh()},"initWhenReady");e()}};B=new WeakMap,tt=new WeakMap,j=new WeakMap,R=new WeakMap,dt=new WeakMap,ft=new WeakMap,kt=new WeakMap,c(ce,"NineTableVScrollBar");let ht=ce;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",ht);const he=class he{constructor(n){d(this,O);d(this,w);d(this,I,new Map);d(this,k,null);d(this,P,null);d(this,F,0);d(this,ut,40);d(this,et,!1);d(this,Lt,3);S(this,"refresh",c(()=>{var e;const n=t(this,w).querySelector(".ng-container-body .ng-part-body");n&&(t(this,gt).call(this),t(this,nt).call(this,n.scrollTop),(e=t(this,w).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));S(this,"initialize",c(()=>{g(this,k,null),t(this,I).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const r=t(this,w).querySelector(o);if(!r)return;const s=r.querySelector(".ng-part-body table");if(!s)return;const l=s.querySelector("tbody.bindable-tbody");if(!l)return;const a=Array.from(l.querySelectorAll("tr")).map(f=>f.cloneNode(!0));t(this,I).set(o,a)});const n=t(this,w).querySelector(".ng-container-body .ng-part-body"),e=t(this,w).querySelector(".ng-container-left .ng-part-body"),i=t(this,w).querySelector(".ng-container-right .ng-part-body");if(n){t(this,Ht).call(this,n),t(this,yt).call(this),t(this,gt).call(this),t(this,nt).call(this,n.scrollTop);let o=n.scrollTop;const r=c(s=>{var l;e&&e.scrollTop!==s&&(e.scrollTop=s),i&&i.scrollTop!==s&&(i.scrollTop=s),t(this,nt).call(this,s),(l=t(this,w).querySelector("nine-table-vscrollbar"))==null||l.refresh()},"syncScroll");n.addEventListener("scroll",()=>{const s=n.scrollTop;o!==s&&(o=s,r(s))})}},"initialize"));d(this,Ct,c((n,e)=>{const i=t(this,I).get(e);if(!i||i.length===0)return;const o=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;o.querySelectorAll("tr:not(.nodata)").forEach(l=>l.remove());const r=o.querySelector("tr.nodata"),s=document.createDocumentFragment();for(let l=0;l<t(this,ut);l++)i.forEach(h=>{s.appendChild(h.cloneNode(!0))});r?r.before(s):o.appendChild(s)},"#renderRows"));d(this,Ht,c(n=>{if(t(this,k)!==null&&t(this,k)>0)return t(this,k);const e=t(this,I).get(".ng-container-body");if(!e||e.length===0)return 24;const i=n.querySelector("tbody.bindable-tbody");if(!i)return 24;i.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const o=i.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),o?o.before(r):i.appendChild(r);const s=t(this,w),l=s.style.display,h=s.style.visibility,a=s.style.position;(l==="none"||window.getComputedStyle(s).display==="none")&&(s.style.display="block",s.style.visibility="hidden",s.style.position="absolute");let f=0;const u=i.querySelectorAll("tr:not(.nodata)");return u.forEach(b=>{f+=b.offsetHeight||b.getBoundingClientRect().height}),u.forEach(b=>b.remove()),s.style.display=l,s.style.visibility=h,s.style.position=a,g(this,k,f>0?f:24),t(this,bt).call(this),t(this,k)},"#measureAndCacheHeight"));d(this,gt,c(()=>{const e=(t(this,O).data.get()||[]).length,i=t(this,k)||24,o=e*i;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const s=t(this,w).querySelector(r);if(!s)return;const l=s.querySelector(".ng-part-body .ng-virtual-spacer");l&&(l.style.height=`${o}px`)})},"#updateVirtualScrollHeight"));d(this,bt,c(()=>{if(t(this,F)>0&&t(this,k)>0){const n=Math.ceil(t(this,F)/t(this,k));g(this,ut,n+t(this,Lt))}},"#updateRowCount"));d(this,Mt,c(()=>{var h,a,f;const n=t(this,w).querySelector(".ng-container-left .ng-part-body table"),e=t(this,w).querySelector(".ng-container-body .ng-part-body table"),i=t(this,w).querySelector(".ng-container-right .ng-part-body table");if(!e)return;const o=n?Array.from(n.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),s=i?Array.from(i.querySelectorAll("tr")):[],l=Math.max(o.length,r.length,s.length);for(let u=0;u<l;u++){const b=[((h=o[u])==null?void 0:h.getBoundingClientRect().height)||0,((a=r[u])==null?void 0:a.getBoundingClientRect().height)||0,((f=s[u])==null?void 0:f.getBoundingClientRect().height)||0],y=Math.max(...b);y>0&&(o[u]&&(o[u].style.height=`${y}px`),r[u]&&(r[u].style.height=`${y}px`),s[u]&&(s[u].style.height=`${y}px`))}},"#syncRowHeights"));d(this,_t,c(()=>{!t(this,w)||!(t(this,w)instanceof HTMLElement)||(g(this,P,new ResizeObserver(n=>{for(const e of n){const i=e.target;if(!i.classList.contains("active"))continue;const o=e.contentRect.height;if(o>0){let r=0;const s=i.querySelector(".ng-part-header"),l=i.querySelector(".ng-part-footer");s&&(r+=s.offsetHeight),l&&(r+=l.offsetHeight);const h=Math.max(o-r,100);t(this,F)!==h&&(g(this,F,h),t(this,bt).call(this),t(this,k)!==null&&t(this,yt).call(this))}}})),t(this,P).observe(t(this,w)))},"#initResizeObserver"));d(this,yt,c(()=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,w).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Ct).call(this,e,n)}),t(this,$t).call(this),t(this,Mt).call(this)},"#renderAllContainers"));d(this,It,c(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var a;const i=t(this,w).querySelector(e);if(!i)return;const o=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;const r=Array.from(o.querySelectorAll("tr:not(.nodata)")),s=((a=t(this,I).get(e))==null?void 0:a.length)||1,h=(t(this,O).data.get()||[]).length;r.forEach((f,u)=>{const b=n+Math.floor(u/s);if(b>=h){f.style.display="none";return}const y=t(this,O).data.get(b);f.style.display="",t(this,pt).call(this,f,y,b)})})},"#adjustBufferRows"));d(this,nt,c(n=>{var h;const e=t(this,k);if(!e||e<=0)return;const o=(t(this,O).data.get()||[]).length,r=Math.max(0,Math.floor(n/e)),s=r*e,l=((h=t(this,I).get(".ng-container-body"))==null?void 0:h.length)||1;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const f=t(this,w).querySelector(a);if(!f)return;const u=f.querySelector(".ng-part-body tbody.bindable-tbody");if(!u)return;u.style.transform=`translateY(${s}px)`,Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y,v)=>{const T=r+Math.floor(v/l);if(T>=o){y.style.display="none";return}const ct=t(this,O).data.get(T);y.style.display="",t(this,pt).call(this,y,ct,T)})}),t(this,et)||(g(this,et,!0),setTimeout(()=>{t(this,It).call(this,r),g(this,et,!1)},0))},"#handleScroll"));d(this,pt,c((n,e,i)=>{n.dataset.row=i,Array.from(n.cells).forEach((o,r)=>{const s=o.dataset.bind;s&&e&&e[s]!==void 0?o.textContent=e[s]:o.textContent=e?e[Object.keys(e)[r]]??`R${i}C${r}`:`행 ${i+1}`,o.dataset.row=i})},"#bindRowData"));d(this,$t,c(()=>{var h,a,f;const n=t(this,w).querySelector(".ng-container-left .ng-part-header table"),e=t(this,w).querySelector(".ng-container-body .ng-part-header table"),i=t(this,w).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const o=n?Array.from(n.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),s=i?Array.from(i.querySelectorAll("tr")):[],l=Math.max(o.length,r.length,s.length);for(let u=0;u<l;u++){const b=[((h=o[u])==null?void 0:h.getBoundingClientRect().height)||0,((a=r[u])==null?void 0:a.getBoundingClientRect().height)||0,((f=s[u])==null?void 0:f.getBoundingClientRect().height)||0],y=Math.max(...b);y>0&&(o[u]&&(o[u].style.height=`${y}px`),r[u]&&(r[u].style.height=`${y}px`),s[u]&&(s[u].style.height=`${y}px`))}},"#syncHeaderHeights"));S(this,"destroy",c(()=>{t(this,P)&&(t(this,P).disconnect(),g(this,P,null))},"destroy"));g(this,O,n.getRootNode().host),g(this,w,n),t(this,_t).call(this)}getRowHeight(){return t(this,k)}templateLength(n=".ng-container-body"){var e;return((e=t(this,I).get(n))==null?void 0:e.length)||1}};O=new WeakMap,w=new WeakMap,I=new WeakMap,k=new WeakMap,P=new WeakMap,F=new WeakMap,ut=new WeakMap,et=new WeakMap,Lt=new WeakMap,Ct=new WeakMap,Ht=new WeakMap,gt=new WeakMap,bt=new WeakMap,Mt=new WeakMap,_t=new WeakMap,yt=new WeakMap,It=new WeakMap,nt=new WeakMap,pt=new WeakMap,$t=new WeakMap,c(he,"RowManager");let Jt=he;const W=class W{static compileAll(n){return Array.isArray(n)?n.map(e=>W.compile(e)):[]}static compile(n){var o,r,s,l;if(!n)return null;const e=n.cloneNode(!0);return t(o=W,Wt).call(o,e),t(r=W,it).call(r,e,"thead"),t(s=W,it).call(s,e,"tbody"),t(l=W,it).call(l,e,"tfoot"),Array.from(e.querySelectorAll("colgroup col")).forEach((h,a)=>{const f=h.getAttribute("fixed");f&&e.querySelectorAll(`thead [data-col="${a}"], tbody [data-col="${a}"], tfoot [data-col="${a}"]`).forEach(u=>{u.setAttribute("fixed",f)})}),e}};Wt=new WeakMap,it=new WeakMap,c(W,"TableCompiler"),d(W,Wt,c(n=>{if(!n.querySelector("colgroup")){const e=n.querySelector("tbody tr")||n.querySelector("tr"),i=e?e.querySelectorAll("th, td").length:1,o=document.createElement("colgroup"),r=Math.max(Math.floor(n.clientWidth/i),100);for(let s=0;s<i;s++){const l=document.createElement("col");l.setAttribute("width",r),o.appendChild(l)}n.prepend(o)}if(!n.querySelector("thead")){const e=document.createElement("thead"),i=n.querySelector("colgroup");i?i.after(e):n.prepend(e)}n.classList.add("nine-table-element"),n.style.display="table"},"#ensureTableStructure")),d(W,it,c((n,e)=>{const i=Array.from(n.querySelectorAll(e+" tr")),o=Array.from(n.querySelectorAll(e+" th,"+e+" td")),r=i.length;if(r===0||o.length===0)return;let s=0;o.forEach(h=>{s+=h.colSpan||1});const l=Array.from(Array(r),()=>Array(s).fill(null));i.forEach(h=>{const a=h.sectionRowIndex;let f=0;Array.from(h.querySelectorAll("th,td")).forEach(u=>{for(let v=0;v<l[a].length;v++)if(l[a][v]===null){f=v;break}const b=u.rowSpan||1,y=u.colSpan||1;for(let v=0;v<b;v++)for(let T=0;T<y;T++)a+v<r&&f+T<s&&(l[a+v][f+T]=v===0&&T===0?"1":"0")})}),i.forEach(h=>{const a=h.sectionRowIndex;Array.from(h.querySelectorAll("th,td")).forEach(f=>{for(let u=0;u<l[a].length;u++)if(l[a][u]==="1"){f.dataset.col=u,l[a][u]="0";break}})})},"#resetColIndex"));let Qt=W;const mt=class mt extends HTMLElement{constructor(){super();d(this,Ot);d(this,K,null);d(this,Z);S(this,"invalidate",c(()=>{var e,i;t(this,Z).refresh(),(e=this.querySelector("nine-table-hscrollbar"))==null||e.refresh(),(i=this.querySelector("nine-table-vscrollbar"))==null||i.refresh()},"invalidate"));d(this,zt,c(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:i,type:o})=>{const r=this.querySelector(i);if(!r)return;r.innerHTML="";const s=document.createElement("div");s.className="ng-part-header",s.appendChild(t(this,st).call(this,t(this,K),o,"header"));const l=document.createElement("div");l.className="ng-part-body";const h=document.createElement("div");h.className="ng-scroll-content",h.style.position="relative",h.style.width="100%",h.appendChild(t(this,st).call(this,t(this,K),o,"body"));const a=document.createElement("div");a.className="ng-virtual-spacer",a.style.width="100%",a.style.pointerEvents="none",h.appendChild(a),l.appendChild(h);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,st).call(this,t(this,K),o,"footer")),r.appendChild(s),r.appendChild(l),r.appendChild(f)})},"#renderSplitContainers"));d(this,Nt,c(()=>{["left","right","body"].forEach(e=>{const i=this.querySelector(`.ng-container-${e}`),o=i==null?void 0:i.querySelectorAll("table");if(!i||!o||o.length===0)return;let r=0;o[0].querySelectorAll("col").forEach(s=>{const l=parseInt(s.getAttribute("width"),10);isNaN(r)||(r+=l)}),e==="body"?i.style.flex="1":(i.style.flex=`0 0 ${r}px`,i.style.width=`${r}px`)})},"#updateContainerWidths"));S(this,"generate",c(e=>{e&&(g(this,K,Qt.compile(e)),t(this,zt).call(this),t(this,Nt).call(this),t(this,Z).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0))},"generate"));d(this,st,c((e,i,o)=>{const r=e.cloneNode(!0),s=r.querySelector("thead"),l=r.querySelector("tbody"),h=r.querySelector("tfoot");if(o==="header"){if(l&&l.remove(),h&&h.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else o==="body"?(s&&s.remove(),h&&h.remove(),l&&(l.className="bindable-tbody")):o==="footer"&&(s&&s.remove(),l&&l.remove());return i==="left"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(a=>{a.getAttribute("fixed")!=="left"&&a.remove()}):i==="right"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(a=>{a.getAttribute("fixed")!=="right"&&a.remove()}):r.querySelectorAll("[fixed=left], [fixed=right]").forEach(a=>{a.remove()}),r},"#createSplitTable"));S(this,"getRowHeight",c(()=>t(this,Z).getRowHeight(),"getRowHeight"));S(this,"scrollToX",c(e=>{const i=this.querySelector(".ng-container-body .ng-part-body");i&&(i.scrollLeft=e)},"scrollToX"));S(this,"scrollToY",c(e=>{const i=this.querySelector(".ng-container-body .ng-part-body");i&&(i.scrollTop=e)},"scrollToY"));d(this,Bt,c(()=>{t(this,Pt).call(this)},"#init"));d(this,Pt,c(()=>{const e=mt.SCROLLBAR_SIZE;this.innerHTML=`
126
+ `;const e=h(()=>{const i=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!i){setTimeout(e,10);return}g(this,q,{container:i,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,Ct).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,it=new WeakMap,Z=new WeakMap,q=new WeakMap,gt=new WeakMap,bt=new WeakMap,Ct=new WeakMap,h(de,"NineTableVScrollBar");let ut=de;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",ut);const fe=class fe{constructor(n){d(this,B);d(this,S);d(this,W,new Map);d(this,L,null);d(this,F,null);d(this,G,0);d(this,yt,40);d(this,ot,!1);d(this,Ht,3);R(this,"refresh",h(()=>{var e;const n=t(this,S).querySelector(".ng-container-body .ng-part-body");n&&(t(this,pt).call(this),t(this,st).call(this,n.scrollTop),(e=t(this,S).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",h(()=>{g(this,L,null),t(this,W).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(s=>{const r=t(this,S).querySelector(s);if(!r)return;const o=r.querySelector(".ng-part-body table");if(!o)return;const l=o.querySelector("tbody.bindable-tbody");if(!l)return;const a=Array.from(l.querySelectorAll("tr")).map(f=>f.cloneNode(!0));t(this,W).set(s,a)});const n=t(this,S).querySelector(".ng-container-body .ng-part-body"),e=t(this,S).querySelector(".ng-container-left .ng-part-body"),i=t(this,S).querySelector(".ng-container-right .ng-part-body");if(n){t(this,_t).call(this,n),t(this,xt).call(this),t(this,pt).call(this),t(this,st).call(this,n.scrollTop);let s=!1;const r=h((o,l)=>{var c;s||(s=!0,n&&n.scrollTop!==o&&(n.scrollTop=o),e&&e.scrollTop!==o&&(e.scrollTop=o),i&&i.scrollTop!==o&&(i.scrollTop=o),t(this,st).call(this,o),(c=t(this,S).querySelector("nine-table-vscrollbar"))==null||c.refresh(),s=!1)},"syncScroll");[n,e,i].forEach(o=>{o&&o.addEventListener("scroll",()=>{r(o.scrollTop)})})}},"initialize"));d(this,Mt,h((n,e)=>{const i=t(this,W).get(e);if(!i||i.length===0)return;const s=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!s)return;s.querySelectorAll("tr:not(.nodata)").forEach(l=>l.remove());const r=s.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let l=0;l<t(this,yt);l++)i.forEach(c=>{o.appendChild(c.cloneNode(!0))});r?r.before(o):s.appendChild(o)},"#renderRows"));d(this,_t,h(n=>{if(t(this,L)!==null&&t(this,L)>0)return t(this,L);const e=t(this,W).get(".ng-container-body");if(!e||e.length===0)return 24;const i=n.querySelector("tbody.bindable-tbody");if(!i)return 24;i.querySelectorAll("tr:not(.nodata)").forEach(y=>y.remove());const s=i.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(y=>{r.appendChild(y.cloneNode(!0))}),s?s.before(r):i.appendChild(r);const o=t(this,S),l=o.style.display,c=o.style.visibility,a=o.style.position;(l==="none"||window.getComputedStyle(o).display==="none")&&(o.style.display="block",o.style.visibility="hidden",o.style.position="absolute");let f=0;const u=i.querySelectorAll("tr:not(.nodata)");return u.forEach(y=>{f+=y.offsetHeight||y.getBoundingClientRect().height}),u.forEach(y=>y.remove()),o.style.display=l,o.style.visibility=c,o.style.position=a,g(this,L,f>0?f:24),t(this,mt).call(this),t(this,L)},"#measureAndCacheHeight"));d(this,pt,h(()=>{const e=(t(this,B).data.get()||[]).length,i=t(this,L)||24,s=e*i;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,S).querySelector(r);if(!o)return;const l=o.querySelector(".ng-part-body .ng-virtual-spacer");l&&(l.style.height=`${s}px`)})},"#updateVirtualScrollHeight"));d(this,mt,h(()=>{if(t(this,G)>0&&t(this,L)>0){const n=Math.ceil(t(this,G)/t(this,L));g(this,yt,n+t(this,Ht))}},"#updateRowCount"));d(this,$t,h(()=>{var l,c,a,f,u,y;const n=t(this,S).querySelector(".ng-container-left .ng-part-body table"),e=t(this,S).querySelector(".ng-container-body .ng-part-body table"),i=t(this,S).querySelector(".ng-container-right .ng-part-body table");if(e){const b=n?Array.from(n.querySelectorAll("tbody tr")):[],p=Array.from(e.querySelectorAll("tbody tr")),E=i?Array.from(i.querySelectorAll("tbody tr")):[],z=Math.max(b.length,p.length,E.length);for(let w=0;w<z;w++){const ft=[((l=b[w])==null?void 0:l.getBoundingClientRect().height)||0,((c=p[w])==null?void 0:c.getBoundingClientRect().height)||0,((a=E[w])==null?void 0:a.getBoundingClientRect().height)||0],N=Math.max(...ft);N>0&&(b[w]&&(b[w].style.height=`${N}px`),p[w]&&(p[w].style.height=`${N}px`),E[w]&&(E[w].style.height=`${N}px`))}}const s=t(this,S).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,S).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,S).querySelector(".ng-container-right .ng-part-footer table");if(r){const b=s?Array.from(s.querySelectorAll("tfoot tr")):[],p=Array.from(r.querySelectorAll("tfoot tr")),E=o?Array.from(o.querySelectorAll("tfoot tr")):[],z=Math.max(b.length,p.length,E.length);for(let w=0;w<z;w++){const ft=[((f=b[w])==null?void 0:f.getBoundingClientRect().height)||0,((u=p[w])==null?void 0:u.getBoundingClientRect().height)||0,((y=E[w])==null?void 0:y.getBoundingClientRect().height)||0],N=Math.max(...ft);N>0&&(b[w]&&(b[w].style.height=`${N}px`),p[w]&&(p[w].style.height=`${N}px`),E[w]&&(E[w].style.height=`${N}px`))}}},"#syncRowHeights"));d(this,It,h(()=>{!t(this,S)||!(t(this,S)instanceof HTMLElement)||(g(this,F,new ResizeObserver(n=>{for(const e of n){const i=e.target;if(!i.classList.contains("active"))continue;const s=e.contentRect.height;if(s>0){let r=0;const o=i.querySelector(".ng-part-header"),l=i.querySelector(".ng-part-footer");o&&(r+=o.offsetHeight),l&&(r+=l.offsetHeight);const c=Math.max(s-r,100);t(this,G)!==c&&(g(this,G,c),t(this,mt).call(this),t(this,L)!==null&&t(this,xt).call(this))}}})),t(this,F).observe(t(this,S)))},"#initResizeObserver"));d(this,xt,h(()=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,S).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Mt).call(this,e,n)}),t(this,Ot).call(this),t(this,$t).call(this)},"#renderAllContainers"));d(this,Wt,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var a;const i=t(this,S).querySelector(e);if(!i)return;const s=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!s)return;const r=Array.from(s.querySelectorAll("tr:not(.nodata)")),o=((a=t(this,W).get(e))==null?void 0:a.length)||1,c=(t(this,B).data.get()||[]).length;r.forEach((f,u)=>{const y=n+Math.floor(u/o);if(y>=c){f.style.display="none";return}const b=t(this,B).data.get(y);f.style.display="",t(this,vt).call(this,f,b,y)})})},"#adjustBufferRows"));d(this,st,h(n=>{var c;const e=t(this,L);if(!e||e<=0)return;const s=(t(this,B).data.get()||[]).length,r=Math.max(0,Math.floor(n/e)),o=r*e,l=((c=t(this,W).get(".ng-container-body"))==null?void 0:c.length)||1;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const f=t(this,S).querySelector(a);if(!f)return;const u=f.querySelector(".ng-part-body tbody.bindable-tbody");if(!u)return;u.style.transform=`translateY(${o}px)`,Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((b,p)=>{const E=r+Math.floor(p/l);if(E>=s){b.style.display="none";return}const z=t(this,B).data.get(E);b.style.display="",t(this,vt).call(this,b,z,E)})}),t(this,ot)||(g(this,ot,!0),setTimeout(()=>{t(this,Wt).call(this,r),g(this,ot,!1)},0))},"#handleScroll"));d(this,vt,h((n,e,i)=>{n.dataset.row=i,Array.from(n.cells).forEach((s,r)=>{const o=s.dataset.bind;o&&e&&e[o]!==void 0?s.textContent=e[o]:s.textContent=e?e[Object.keys(e)[r]]??`R${i}C${r}`:`행 ${i+1}`,s.dataset.row=i})},"#bindRowData"));d(this,Ot,h(()=>{var c,a,f;const n=t(this,S).querySelector(".ng-container-left .ng-part-header table"),e=t(this,S).querySelector(".ng-container-body .ng-part-header table"),i=t(this,S).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const s=n?Array.from(n.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),o=i?Array.from(i.querySelectorAll("tr")):[],l=Math.max(s.length,r.length,o.length);for(let u=0;u<l;u++){const y=[((c=s[u])==null?void 0:c.getBoundingClientRect().height)||0,((a=r[u])==null?void 0:a.getBoundingClientRect().height)||0,((f=o[u])==null?void 0:f.getBoundingClientRect().height)||0],b=Math.max(...y);b>0&&(s[u]&&(s[u].style.height=`${b}px`),r[u]&&(r[u].style.height=`${b}px`),o[u]&&(o[u].style.height=`${b}px`))}},"#syncHeaderHeights"));R(this,"destroy",h(()=>{t(this,F)&&(t(this,F).disconnect(),g(this,F,null))},"destroy"));g(this,B,n.getRootNode().host),g(this,S,n),t(this,It).call(this)}getRowHeight(){return t(this,L)}templateLength(n=".ng-container-body"){var e;return((e=t(this,W).get(n))==null?void 0:e.length)||1}};B=new WeakMap,S=new WeakMap,W=new WeakMap,L=new WeakMap,F=new WeakMap,G=new WeakMap,yt=new WeakMap,ot=new WeakMap,Ht=new WeakMap,Mt=new WeakMap,_t=new WeakMap,pt=new WeakMap,mt=new WeakMap,$t=new WeakMap,It=new WeakMap,xt=new WeakMap,Wt=new WeakMap,st=new WeakMap,vt=new WeakMap,Ot=new WeakMap,h(fe,"RowManager");let te=fe;const O=class O{static compileAll(n){return Array.isArray(n)?n.map(e=>O.compile(e)):[]}static compile(n){var s,r,o,l;if(!n)return null;const e=n.cloneNode(!0);return t(s=O,zt).call(s,e),t(r=O,rt).call(r,e,"thead"),t(o=O,rt).call(o,e,"tbody"),t(l=O,rt).call(l,e,"tfoot"),Array.from(e.querySelectorAll("colgroup col")).forEach((c,a)=>{const f=c.getAttribute("fixed");f&&e.querySelectorAll(`thead [data-col="${a}"], tbody [data-col="${a}"], tfoot [data-col="${a}"]`).forEach(u=>{u.setAttribute("fixed",f)})}),e}};zt=new WeakMap,rt=new WeakMap,h(O,"TableCompiler"),d(O,zt,h(n=>{if(!n.querySelector("colgroup")){const e=n.querySelector("tbody tr")||n.querySelector("tr"),i=e?e.querySelectorAll("th, td").length:1,s=document.createElement("colgroup"),r=Math.max(Math.floor(n.clientWidth/i),100);for(let o=0;o<i;o++){const l=document.createElement("col");l.setAttribute("width",r),s.appendChild(l)}n.prepend(s)}if(!n.querySelector("thead")){const e=document.createElement("thead"),i=n.querySelector("colgroup");i?i.after(e):n.prepend(e)}n.classList.add("nine-table-element"),n.style.display="table"},"#ensureTableStructure")),d(O,rt,h((n,e)=>{const i=Array.from(n.querySelectorAll(e+" tr")),s=Array.from(n.querySelectorAll(e+" th,"+e+" td")),r=i.length;if(r===0||s.length===0)return;let o=0;s.forEach(c=>{o+=c.colSpan||1});const l=Array.from(Array(r),()=>Array(o).fill(null));i.forEach(c=>{const a=c.sectionRowIndex;let f=0;Array.from(c.querySelectorAll("th,td")).forEach(u=>{for(let p=0;p<l[a].length;p++)if(l[a][p]===null){f=p;break}const y=u.rowSpan||1,b=u.colSpan||1;for(let p=0;p<y;p++)for(let E=0;E<b;E++)a+p<r&&f+E<o&&(l[a+p][f+E]=p===0&&E===0?"1":"0")})}),i.forEach(c=>{const a=c.sectionRowIndex;Array.from(c.querySelectorAll("th,td")).forEach(f=>{for(let u=0;u<l[a].length;u++)if(l[a][u]==="1"){f.dataset.col=u,l[a][u]="0";break}})})},"#resetColIndex"));let ee=O;const wt=class wt extends HTMLElement{constructor(){super();d(this,Bt);d(this,J,null);d(this,Q);R(this,"invalidate",h(()=>{var e,i;t(this,Q).refresh(),(e=this.querySelector("nine-table-hscrollbar"))==null||e.refresh(),(i=this.querySelector("nine-table-vscrollbar"))==null||i.refresh()},"invalidate"));d(this,Nt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:i,type:s})=>{const r=this.querySelector(i);if(!r)return;r.innerHTML="";const o=document.createElement("div");o.className="ng-part-header",o.appendChild(t(this,lt).call(this,t(this,J),s,"header"));const l=document.createElement("div");l.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,lt).call(this,t(this,J),s,"body"));const a=document.createElement("div");a.className="ng-virtual-spacer",a.style.width="100%",a.style.pointerEvents="none",c.appendChild(a),l.appendChild(c);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,lt).call(this,t(this,J),s,"footer")),r.appendChild(o),r.appendChild(l),r.appendChild(f)})},"#renderSplitContainers"));d(this,Pt,h(()=>{["left","right","body"].forEach(e=>{const i=this.querySelector(`.ng-container-${e}`),s=i==null?void 0:i.querySelectorAll("table");if(!i||!s||s.length===0)return;let r=0;s[0].querySelectorAll("col").forEach(o=>{const l=parseInt(o.getAttribute("width"),10);isNaN(r)||(r+=l)}),e==="body"?i.style.flex="1":(i.style.flex=`0 0 ${r}px`,i.style.width=`${r}px`)})},"#updateContainerWidths"));R(this,"generate",h(e=>{e&&(g(this,J,ee.compile(e)),t(this,Nt).call(this),t(this,Pt).call(this),t(this,Q).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0))},"generate"));d(this,lt,h((e,i,s)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),l=r.querySelector("tbody"),c=r.querySelector("tfoot");if(s==="header"){if(l&&l.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else s==="body"?(o&&o.remove(),c&&c.remove(),l&&(l.className="bindable-tbody")):s==="footer"&&(o&&o.remove(),l&&l.remove());return i==="left"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(a=>{a.getAttribute("fixed")!=="left"&&a.remove()}):i==="right"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(a=>{a.getAttribute("fixed")!=="right"&&a.remove()}):r.querySelectorAll("[fixed=left], [fixed=right]").forEach(a=>{a.remove()}),r},"#createSplitTable"));R(this,"getRowHeight",h(()=>t(this,Q).getRowHeight(),"getRowHeight"));R(this,"scrollToX",h(e=>{const i=this.querySelector(".ng-container-body .ng-part-body");i&&(i.scrollLeft=e)},"scrollToX"));R(this,"scrollToY",h(e=>{const i=this.querySelector(".ng-container-body .ng-part-body");i&&(i.scrollTop=e)},"scrollToY"));d(this,Dt,h(()=>{t(this,Yt).call(this)},"#init"));d(this,Yt,h(()=>{const e=wt.SCROLLBAR_SIZE;this.innerHTML=`
127
127
  <style>
128
128
  nine-table-sheet {
129
129
  display: none;
@@ -261,7 +261,7 @@
261
261
  <nine-table-hscrollbar></nine-table-hscrollbar>
262
262
  <div class='ng-scroll-edge'></div>
263
263
  </div>
264
- `},"#render"));g(this,Z,new Jt(this)),g(this,Ot,this.getRootNode().host)}connectedCallback(){t(this,Bt).call(this)}disconnectedCallback(){this.innerHTML="",E.log("NineTableSheet destroyed.")}};Ot=new WeakMap,K=new WeakMap,Z=new WeakMap,zt=new WeakMap,Nt=new WeakMap,st=new WeakMap,Bt=new WeakMap,Pt=new WeakMap,c(mt,"NineTableSheet"),S(mt,"SCROLLBAR_SIZE",16);let At=mt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",At);const de=class de extends HTMLElement{constructor(){super();d(this,Dt,c(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",i=>{var s;const o=i.ctrlKey||i.metaKey||i.shiftKey,r=parseInt((s=i.target.closest(".nine-tab-item"))==null?void 0:s.dataset.index,10);t(this,xt).call(this,r,o)}),t(this,xt).call(this,0,!1)},"#init"));d(this,xt,c((e,i=!1)=>{const o=c(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(y=>y.style.setProperty("display","none"));const b=f.filter(y=>y.classList.contains("active"));b.length<2||b.forEach(y=>{const v=parseInt(y.getAttribute("data-index"),10),T=this.querySelector(`nine-splitter[data-split-index="${v}"]`),ct=f[v+1];T&&ct&&ct.classList.contains("active")&&T.style.setProperty("display","flex")})},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),s=this.querySelector("nine-table-sheets-body"),l=r.querySelectorAll(".nine-tab-item"),h=s.querySelectorAll("nine-table-sheet");if(!l[e])return;if(!i)l.forEach((f,u)=>{f.classList.toggle("active",u===e)}),h.forEach((f,u)=>{const b=u===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=l[e],u=r.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const b=s.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const a=s.querySelectorAll("nine-table-sheet.active");a==null||a.forEach(f=>{f.style.flex=a.length>1?"1 1 0%":"1 1 100%"}),o()},"#switchSheet"))}connectedCallback(){t(this,Dt).call(this)}};Dt=new WeakMap,xt=new WeakMap,c(de,"NineTableSheets");let te=de;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",te);const fe=class fe{constructor(n){d(this,L);d(this,Yt,c(()=>{t(this,Vt).call(this),new ResizeObserver(n=>{for(let e of n)t(this,L).getAttribute("auto-height")==="true"&&t(this,vt).call(this)}).observe(t(this,L))},"#init"));d(this,vt,c(()=>{var h,a;const n=Array.from(t(this,L).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,L).getAttribute("max-display-row"),10)||10,i=Math.max(...n.map(f=>f.getRowHeight())),o=(h=t(this,L).shadowRoot.querySelector("nine-table-header"))==null?void 0:h.getBoundingClientRect().height,r=(a=t(this,L).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:a.getBoundingClientRect().height,s=At.SCROLLBAR_SIZE,l=e*i+o+r+s;t(this,L).style.height=`${l}px`},"#applyAutoHeight"));d(this,Vt,c(()=>{const e=Array.from(t(this,L).children).filter(h=>h.tagName==="TABLE"),i=t(this,L).getAttribute("auto-height")==="true",o=e.length,r=e.map((h,a)=>{const u=`<nine-table-sheet class="${a===0?"active":""}" data-index="${a}"></nine-table-sheet>`,b=a<o-1?`<nine-splitter class="h" data-split-index="${a}"></nine-splitter>`:"";return u+b}).join(""),s=e.map((h,a)=>`<div class="nine-tab-item ${a===0?"active":""}" data-index="${a}">Sheet ${a+1}</div>`).join("");t(this,L).shadowRoot.innerHTML=`
264
+ `},"#render"));g(this,Q,new te(this)),g(this,Bt,this.getRootNode().host)}connectedCallback(){t(this,Dt).call(this)}disconnectedCallback(){this.innerHTML="",A.log("NineTableSheet destroyed.")}};Bt=new WeakMap,J=new WeakMap,Q=new WeakMap,Nt=new WeakMap,Pt=new WeakMap,lt=new WeakMap,Dt=new WeakMap,Yt=new WeakMap,h(wt,"NineTableSheet"),R(wt,"SCROLLBAR_SIZE",16);let Tt=wt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Tt);const ue=class ue extends HTMLElement{constructor(){super();d(this,Ft,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",i=>{var o;const s=i.ctrlKey||i.metaKey||i.shiftKey,r=parseInt((o=i.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,St).call(this,r,s)}),t(this,St).call(this,0,!1)},"#init"));d(this,St,h((e,i=!1)=>{const s=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(b=>b.style.setProperty("display","none"));const y=f.filter(b=>b.classList.contains("active"));y.length<2||y.forEach(b=>{const p=parseInt(b.getAttribute("data-index"),10),E=this.querySelector(`nine-splitter[data-split-index="${p}"]`),z=f[p+1];E&&z&&z.classList.contains("active")&&E.style.setProperty("display","flex")})},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),l=r.querySelectorAll(".nine-tab-item"),c=o.querySelectorAll("nine-table-sheet");if(!l[e])return;if(!i)l.forEach((f,u)=>{f.classList.toggle("active",u===e)}),c.forEach((f,u)=>{const y=u===e;f.classList.toggle("active",y),f.style.flex=y?"1 1 100%":""});else{const f=l[e],u=r.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const y=o.querySelector(`nine-table-sheet[data-index="${e}"]`);y&&(y.classList.toggle("active"),y.classList.contains("active")||(y.style.flex=""))}const a=o.querySelectorAll("nine-table-sheet.active");a==null||a.forEach(f=>{f.style.flex=a.length>1?"1 1 0%":"1 1 100%"}),s()},"#switchSheet"))}connectedCallback(){t(this,Ft).call(this)}};Ft=new WeakMap,St=new WeakMap,h(ue,"NineTableSheets");let ne=ue;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ne);const ge=class ge{constructor(n){d(this,C);d(this,Vt,h(()=>{t(this,Ut).call(this),new ResizeObserver(n=>{for(let e of n)t(this,C).getAttribute("auto-height")==="true"&&t(this,Et).call(this)}).observe(t(this,C))},"#init"));d(this,Et,h(()=>{var c,a;const n=Array.from(t(this,C).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,C).getAttribute("max-display-row"),10)||10,i=Math.max(...n.map(f=>f.getRowHeight())),s=(c=t(this,C).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,r=(a=t(this,C).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:a.getBoundingClientRect().height,o=Tt.SCROLLBAR_SIZE,l=e*i+s+r+o;t(this,C).style.height=`${l}px`},"#applyAutoHeight"));d(this,Ut,h(()=>{const e=Array.from(t(this,C).children).filter(c=>c.tagName==="TABLE"),i=t(this,C).getAttribute("auto-height")==="true",s=e.length,r=e.map((c,a)=>{const u=`<nine-table-sheet class="${a===0?"active":""}" data-index="${a}"></nine-table-sheet>`,y=a<s-1?`<nine-splitter class="h" data-split-index="${a}"></nine-splitter>`:"";return u+y}).join(""),o=e.map((c,a)=>`<div class="nine-tab-item ${a===0?"active":""}" data-index="${a}">Sheet ${a+1}</div>`).join("");t(this,C).shadowRoot.innerHTML=`
265
265
  <style>
266
266
  :host {
267
267
  display: flex;
@@ -344,12 +344,12 @@
344
344
  <nine-table-sheets>
345
345
  <nine-table-sheets-body>${r}</nine-table-sheets-body>
346
346
  <nine-table-sheets-footer>
347
- <div class="nine-tab-bar">${s}</div>
347
+ <div class="nine-tab-bar">${o}</div>
348
348
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
349
349
  </nine-table-sheets-footer>
350
350
  </nine-table-sheets>
351
351
  <nine-table-analysis></nine-table-analysis>
352
352
  </nine-table-body>
353
353
  <nine-table-footer></nine-table-footer>
354
- `;const l=t(this,L).shadowRoot.querySelectorAll("nine-table-sheet");l==null||l.forEach((h,a)=>{e[a]&&setTimeout(()=>{h.generate(e[a]),i&&t(this,vt).call(this)})})},"#render"));g(this,L,n),t(this,Yt).call(this)}};L=new WeakMap,Yt=new WeakMap,vt=new WeakMap,Vt=new WeakMap,c(fe,"LayoutManager");let ee=fe;const ue=class ue{constructor(n){d(this,wt);d(this,ot,-1);S(this,"count",c(()=>t(this,wt).rawRecords.length,"count"));g(this,wt,n)}get at(){return t(this,ot)}set at(n){g(this,ot,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ot)}"]`)&&setTimeout(()=>{})}};wt=new WeakMap,ot=new WeakMap,c(ue,"ngRow");let ne=ue;const M=class M{constructor(n,e){d(this,C);d(this,A);d(this,H,[]);d(this,rt,[]);d(this,Ut,0);d(this,D,[]);d(this,Xt,c(()=>{g(this,D,[]);const n=t(this,C).template||[];Array.from(n).forEach(e=>{var i;t(this,D).push(((i=e.getBoundingClientRect)==null?void 0:i.call(e).height)||24)}),(t(this,A).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,St).call(this)),e.__ng.height=t(this,D).slice()})},"#initialize"));d(this,G,c(()=>{t(this,C).shadowRoot.querySelectorAll("nine-table-sheet").forEach(n=>{n.invalidate()})},"#invalidate"));S(this,"get",c((n,e)=>{var r;const i=this.getValidData();if(!i||i.length<=0)return;if(n==null)return t(this,lt).call(this,i);if(n<0||n>=i.length)return null;const o=typeof((r=t(this,C).fields)==null?void 0:r.get)=="function"?t(this,C).fields.get():[];if(e!=null){const s=o.indexOf(e);return s>=0?i[n].v[s]:null}return t(this,lt).call(this,i[n])},"get"));S(this,"set",c(n=>{this.clear(),this.add(n,!1),t(this,G).call(this)},"set"));d(this,St,c(()=>({rowState:M.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,D).slice(),o:{},c:{},_:[0,0,0,0,M.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,D).slice(),-1,{},{}]}),"#getDefaultMeta"));S(this,"reset",c(()=>{g(this,H,[]),g(this,rt,[]),t(this,G).call(this)},"reset"));S(this,"clear",c(()=>{var n;t(this,A).rawRecords=[],g(this,H,[]),g(this,rt,[]),(n=t(this,A).viewRecords)!=null&&n.reset&&t(this,A).viewRecords.reset()},"clear"));d(this,jt,c(n=>{var o;Array.isArray(n)||(n=[n]);const e=typeof((o=t(this,C).fields)==null?void 0:o.get)=="function"?t(this,C).fields.get():Object.keys(n[0]||{}),i=[];return n.forEach(r=>{const s={v:[]};e.forEach(l=>{s.v.push(r[l]!==void 0&&r[l]!==null?r[l]:"")}),i.push(s)}),i},"#json2Array"));d(this,Ft,c(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,St).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=M.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));S(this,"add",c((n,e=!0)=>{n===void 0&&(n={});const i=t(this,jt).call(this,n);t(this,A).rawRecords=t(this,A).rawRecords.concat(t(this,Ft).call(this,i)),this.resetRecords();const o=this.count()-1;return e||i.forEach((r,s)=>{const l=t(this,A).rawRecords[o-s];l&&(l.__ng.rowState=M.ROW_STATE.EMPTY)}),t(this,G).call(this),o},"add"));S(this,"delete",c(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,A).host.row.at]:e=[parseInt(n,10)],e.sort((i,o)=>o-i).forEach(i=>{if(t(this,H)[i]){const o=t(this,H)[i].__ng.rowid;t(this,H)[i].__ng.rowState===M.ROW_STATE.INSERT?t(this,A).rawRecords=t(this,A).rawRecords.filter(r=>r.__ng.rowid!==o):t(this,A).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=M.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,G).call(this)},"delete"));S(this,"setValue",c((n,e,i)=>{var h;n=parseInt(n,10);const r=(typeof((h=t(this,C).fields)==null?void 0:h.get)=="function"?t(this,C).fields.get():[]).indexOf(e);if(r<0)return;const s=this.getValidData()[n];if(!s)return;const l=s.v[r];l!==i&&s.__ng.rowState!==M.ROW_STATE.INSERT&&(s.__ng.o.hasOwnProperty(e)||(s.__ng.o[e]=l),s.__ng.rowState=M.ROW_STATE.UPDATE),s.v[r]=i},"setValue"));S(this,"resetRecords",c(()=>{g(this,rt,t(this,A).rawRecords.filter(n=>!n.__ng.deleted)),g(this,H,t(this,A).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,A).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,H).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));S(this,"getValidData",c(()=>(t(this,H).length===0&&t(this,A).rawRecords.length>0&&this.resetRecords(),t(this,H)),"getValidData"));d(this,lt,c(n=>{var s;if(!n)return n;const e=!Array.isArray(n),i=e?[n]:n,o=typeof((s=t(this,C).fields)==null?void 0:s.get)=="function"?t(this,C).fields.get():[],r=i.filter(l=>!l.__ng.deleted).map(l=>{const h={};return o.forEach((a,f)=>{h[a]=l.v?l.v[f]:l[a]}),h.__ng=l.__ng,h});return e?r[0]:r},"#conv"));S(this,"count",c(()=>this.getValidData().length,"count"));g(this,C,n),g(this,A,e),t(this,Xt).call(this)}get source(){return t(this,lt).call(this,t(this,A).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++we(this,Ut)._}get length(){return t(this,H).length}getRowCount(){return this.length}};C=new WeakMap,A=new WeakMap,H=new WeakMap,rt=new WeakMap,Ut=new WeakMap,D=new WeakMap,Xt=new WeakMap,G=new WeakMap,St=new WeakMap,jt=new WeakMap,Ft=new WeakMap,lt=new WeakMap,c(M,"ngData"),S(M,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ie=M;const ge=class ge{constructor(n){d(this,J);g(this,J,n),this.row=new ne(this),this.data=new ie(t(this,J),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,J).view)!=null&&e.redraw&&t(this,J).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var o,r;const i=parseInt(e,10);if(!(i>=this.data.count()))return(r=(o=this.data.getValidData()[i])==null?void 0:o.__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,i)=>this.data.get(e,i),this.setColumn=(e,i,o)=>{e=parseInt(e,10),this.data.setValue(e,i,o)},this.setDataSource([])}};J=new WeakMap,c(ge,"ngDataManager");let se=ge;const be=class be{constructor(n){d(this,at);d(this,q,[]);S(this,"add",c((n,e="string")=>{n.forEach(i=>{t(this,q).some(o=>o.name===i)||t(this,q).push({name:i,type:e})}),t(this,Et).call(this)},"add"));d(this,Et,c(()=>{const n=new Map;t(this,q).forEach(e=>{n.set(e.name,e.type)}),g(this,q,Array.from(n,([e,i])=>({name:e,type:i}))),g(this,q,t(this,q).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,q).sort((e,i)=>e.name.length<i.name.length?1:-1)},"#adjust"));d(this,Kt,c(()=>{g(this,q,[]),E.log(t(this,at).querySelectorAll("table"));const n=Array.from(t(this,at).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)E.log(e),$("[data-bind]",e).each((i,o)=>{const r=o.dataset.bind,s=o.getAttribute("data-type")||"string";r&&t(this,q).push({name:r,type:s})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(i=>{$(`[${i}]`,e).each((o,r)=>{var s=r.getAttribute(i);if(s.indexOf("data.")<0){const l=s.search(/[(]/g);if(l>0)try{s=String(window[s.substring(0,l).trim()])}catch{s=""}}s.split("data.").forEach(l=>{if(l.trim()!=""){const h=l.search(/[^_A-Za-z0-9]/g);let a="";h>=0?a=l.substring(0,h):s.startsWith("data.")&&(a=l.replace("data.","")),a&&t(this,q).push({name:a,type:"string"})}})})});t(this,Et).call(this)}},"#init"));g(this,at,n),t(this,Kt).call(this)}get(){return t(this,q).map(n=>n.name)}getFields(){return t(this,q)}getType(n){const e=t(this,q).find(i=>i.name===n);return e?e.type:"string"}indexOf(n){return t(this,q).findIndex(e=>e.name===n)}includes(n){return t(this,q).some(e=>e.name===n)}};at=new WeakMap,q=new WeakMap,Et=new WeakMap,Kt=new WeakMap,c(be,"ngFields");let oe=be;const ye=class ye extends HTMLElement{constructor(){super();d(this,Q);d(this,Zt);d(this,Gt,c(()=>{this.fields=new oe(this),g(this,Zt,new ee(this)),E.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),g(this,Q,new se(this))}connectedCallback(){t(this,Gt).call(this)}disconnectedCallback(){E.log("NineTable disconnected.")}get data(){return t(this,Q).data}get row(){return t(this,Q).row}get dataManager(){return t(this,Q)}};Q=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,c(ye,"NineTable");let re=ye;customElements.get("nine-table")||customElements.define("nine-table",re)});
354
+ `;const l=t(this,C).shadowRoot.querySelectorAll("nine-table-sheet");l==null||l.forEach((c,a)=>{e[a]&&setTimeout(()=>{c.generate(e[a]),i&&t(this,Et).call(this)})})},"#render"));g(this,C,n),t(this,Vt).call(this)}};C=new WeakMap,Vt=new WeakMap,Et=new WeakMap,Ut=new WeakMap,h(ge,"LayoutManager");let ie=ge;const be=class be{constructor(n){d(this,Rt);d(this,at,-1);R(this,"count",h(()=>t(this,Rt).rawRecords.length,"count"));g(this,Rt,n)}get at(){return t(this,at)}set at(n){g(this,at,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,at)}"]`)&&setTimeout(()=>{})}};Rt=new WeakMap,at=new WeakMap,h(be,"ngRow");let oe=be;const _=class _{constructor(n,e){d(this,H);d(this,T);d(this,M,[]);d(this,ct,[]);d(this,Xt,0);d(this,V,[]);d(this,jt,h(()=>{g(this,V,[]);const n=t(this,H).template||[];Array.from(n).forEach(e=>{var i;t(this,V).push(((i=e.getBoundingClientRect)==null?void 0:i.call(e).height)||24)}),(t(this,T).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,At).call(this)),e.__ng.height=t(this,V).slice()})},"#initialize"));d(this,tt,h(()=>{t(this,H).shadowRoot.querySelectorAll("nine-table-sheet").forEach(n=>{n.invalidate()})},"#invalidate"));R(this,"get",h((n,e)=>{var r;const i=this.getValidData();if(!i||i.length<=0)return;if(n==null)return t(this,ht).call(this,i);if(n<0||n>=i.length)return null;const s=typeof((r=t(this,H).fields)==null?void 0:r.get)=="function"?t(this,H).fields.get():[];if(e!=null){const o=s.indexOf(e);return o>=0?i[n].v[o]:null}return t(this,ht).call(this,i[n])},"get"));R(this,"set",h(n=>{this.clear(),this.add(n,!1),t(this,tt).call(this)},"set"));d(this,At,h(()=>({rowState:_.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,V).slice(),o:{},c:{},_:[0,0,0,0,_.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,V).slice(),-1,{},{}]}),"#getDefaultMeta"));R(this,"reset",h(()=>{g(this,M,[]),g(this,ct,[]),t(this,tt).call(this)},"reset"));R(this,"clear",h(()=>{var n;t(this,T).rawRecords=[],g(this,M,[]),g(this,ct,[]),(n=t(this,T).viewRecords)!=null&&n.reset&&t(this,T).viewRecords.reset()},"clear"));d(this,Kt,h(n=>{var s;Array.isArray(n)||(n=[n]);const e=typeof((s=t(this,H).fields)==null?void 0:s.get)=="function"?t(this,H).fields.get():Object.keys(n[0]||{}),i=[];return n.forEach(r=>{const o={v:[]};e.forEach(l=>{o.v.push(r[l]!==void 0&&r[l]!==null?r[l]:"")}),i.push(o)}),i},"#json2Array"));d(this,Zt,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,At).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=_.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));R(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const i=t(this,Kt).call(this,n);t(this,T).rawRecords=t(this,T).rawRecords.concat(t(this,Zt).call(this,i)),this.resetRecords();const s=this.count()-1;return e||i.forEach((r,o)=>{const l=t(this,T).rawRecords[s-o];l&&(l.__ng.rowState=_.ROW_STATE.EMPTY)}),t(this,tt).call(this),s},"add"));R(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,T).host.row.at]:e=[parseInt(n,10)],e.sort((i,s)=>s-i).forEach(i=>{if(t(this,M)[i]){const s=t(this,M)[i].__ng.rowid;t(this,M)[i].__ng.rowState===_.ROW_STATE.INSERT?t(this,T).rawRecords=t(this,T).rawRecords.filter(r=>r.__ng.rowid!==s):t(this,T).rawRecords.forEach(r=>{r.__ng.rowid===s&&(r.__ng.deleted=!0,r.__ng.rowState=_.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,tt).call(this)},"delete"));R(this,"setValue",h((n,e,i)=>{var c;n=parseInt(n,10);const r=(typeof((c=t(this,H).fields)==null?void 0:c.get)=="function"?t(this,H).fields.get():[]).indexOf(e);if(r<0)return;const o=this.getValidData()[n];if(!o)return;const l=o.v[r];l!==i&&o.__ng.rowState!==_.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(e)||(o.__ng.o[e]=l),o.__ng.rowState=_.ROW_STATE.UPDATE),o.v[r]=i},"setValue"));R(this,"resetRecords",h(()=>{g(this,ct,t(this,T).rawRecords.filter(n=>!n.__ng.deleted)),g(this,M,t(this,T).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,T).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,M).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));R(this,"getValidData",h(()=>(t(this,M).length===0&&t(this,T).rawRecords.length>0&&this.resetRecords(),t(this,M)),"getValidData"));d(this,ht,h(n=>{var o;if(!n)return n;const e=!Array.isArray(n),i=e?[n]:n,s=typeof((o=t(this,H).fields)==null?void 0:o.get)=="function"?t(this,H).fields.get():[],r=i.filter(l=>!l.__ng.deleted).map(l=>{const c={};return s.forEach((a,f)=>{c[a]=l.v?l.v[f]:l[a]}),c.__ng=l.__ng,c});return e?r[0]:r},"#conv"));R(this,"count",h(()=>this.getValidData().length,"count"));g(this,H,n),g(this,T,e),t(this,jt).call(this)}get source(){return t(this,ht).call(this,t(this,T).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++Se(this,Xt)._}get length(){return t(this,M).length}getRowCount(){return this.length}};H=new WeakMap,T=new WeakMap,M=new WeakMap,ct=new WeakMap,Xt=new WeakMap,V=new WeakMap,jt=new WeakMap,tt=new WeakMap,At=new WeakMap,Kt=new WeakMap,Zt=new WeakMap,ht=new WeakMap,h(_,"ngData"),R(_,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let se=_;const ye=class ye{constructor(n){d(this,et);g(this,et,n),this.row=new oe(this),this.data=new se(t(this,et),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,et).view)!=null&&e.redraw&&t(this,et).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var s,r;const i=parseInt(e,10);if(!(i>=this.data.count()))return(r=(s=this.data.getValidData()[i])==null?void 0:s.__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,i)=>this.data.get(e,i),this.setColumn=(e,i,s)=>{e=parseInt(e,10),this.data.setValue(e,i,s)},this.setDataSource([])}};et=new WeakMap,h(ye,"ngDataManager");let re=ye;const pe=class pe{constructor(n){d(this,dt);d(this,k,[]);R(this,"add",h((n,e="string")=>{n.forEach(i=>{t(this,k).some(s=>s.name===i)||t(this,k).push({name:i,type:e})}),t(this,qt).call(this)},"add"));d(this,qt,h(()=>{const n=new Map;t(this,k).forEach(e=>{n.set(e.name,e.type)}),g(this,k,Array.from(n,([e,i])=>({name:e,type:i}))),g(this,k,t(this,k).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,k).sort((e,i)=>e.name.length<i.name.length?1:-1)},"#adjust"));d(this,Gt,h(()=>{g(this,k,[]),A.log(t(this,dt).querySelectorAll("table"));const n=Array.from(t(this,dt).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)A.log(e),$("[data-bind]",e).each((i,s)=>{const r=s.dataset.bind,o=s.getAttribute("data-type")||"string";r&&t(this,k).push({name:r,type:o})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(i=>{$(`[${i}]`,e).each((s,r)=>{var o=r.getAttribute(i);if(o.indexOf("data.")<0){const l=o.search(/[(]/g);if(l>0)try{o=String(window[o.substring(0,l).trim()])}catch{o=""}}o.split("data.").forEach(l=>{if(l.trim()!=""){const c=l.search(/[^_A-Za-z0-9]/g);let a="";c>=0?a=l.substring(0,c):o.startsWith("data.")&&(a=l.replace("data.","")),a&&t(this,k).push({name:a,type:"string"})}})})});t(this,qt).call(this)}},"#init"));g(this,dt,n),t(this,Gt).call(this)}get(){return t(this,k).map(n=>n.name)}getFields(){return t(this,k)}getType(n){const e=t(this,k).find(i=>i.name===n);return e?e.type:"string"}indexOf(n){return t(this,k).findIndex(e=>e.name===n)}includes(n){return t(this,k).some(e=>e.name===n)}};dt=new WeakMap,k=new WeakMap,qt=new WeakMap,Gt=new WeakMap,h(pe,"ngFields");let le=pe;const me=class me extends HTMLElement{constructor(){super();d(this,nt);d(this,Jt);d(this,Qt,h(()=>{this.fields=new le(this),g(this,Jt,new ie(this)),A.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),g(this,nt,new re(this))}connectedCallback(){t(this,Qt).call(this)}disconnectedCallback(){A.log("NineTable disconnected.")}get data(){return t(this,nt).data}get row(){return t(this,nt).row}get dataManager(){return t(this,nt)}};nt=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,h(me,"NineTable");let ae=me;customElements.get("nine-table")||customElements.define("nine-table",ae)});
355
355
  //# sourceMappingURL=nine-table.umd.js.map