@ninebone/table 0.0.357 → 0.0.359

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