@ninebone/table 0.0.384 → 0.0.385

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