@ninebone/table 0.0.317 → 0.0.319

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