@ninebone/table 0.0.242 โ†’ 0.0.243

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(m,y){typeof exports=="object"&&typeof module<"u"?y(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],y):(m=typeof globalThis<"u"?globalThis:m||self,y(m.NineboneUtil))})(this,function(m){"use strict";var $e=Object.defineProperty;var We=m=>{throw TypeError(m)};var Be=(m,y,S)=>y in m?$e(m,y,{enumerable:!0,configurable:!0,writable:!0,value:S}):m[y]=S;var a=(m,y)=>$e(m,"name",{value:y,configurable:!0});var R=(m,y,S)=>Be(m,typeof y!="symbol"?y+"":y,S),ze=(m,y,S)=>y.has(m)||We("Cannot "+S);var e=(m,y,S)=>(ze(m,y,"read from private field"),S?S.call(m):y.get(m)),d=(m,y,S)=>y.has(m)?We("Cannot add the same private member more than once"):y instanceof WeakSet?y.add(m):y.set(m,S),p=(m,y,S,z)=>(ze(m,y,"write to private field"),z?z.call(m,S):y.set(m,S),S);var Oe=(m,y,S,z)=>({set _(Q){p(m,y,Q,S)},get _(){return e(m,y,z)}});var _,P,w,V,X,F,re,Y,oe,O,H,T,B,M,I,le,ae,ce,he,$,Z,de,fe,ue,te,E,ge,ie,be,D,U,q,x,k,j,pe,N,ye,se,me,we,G,K,ve;const qe=class qe extends m.trace.constructor{constructor(){super(),this.init("nine-table","green")}};a(qe,"Trace");let y=qe;const S=new y,ke=class ke extends HTMLElement{constructor(){super();d(this,_);d(this,P,!1);d(this,w);d(this,V);d(this,X);d(this,F);d(this,re,a(()=>{if(!e(this,_))return;const t=e(this,_).querySelector(".ng-container-body");t&&(p(this,F,new ResizeObserver(()=>{this.refresh()})),e(this,F).observe(t))},"#observeResize"));R(this,"refresh",a(()=>{if(!e(this,_)||!e(this,w)||e(this,P))return;const t=e(this,w).container,s=t.querySelector("table");if(!s)return;const n=e(this,w).track,r=e(this,w).thumb,o=e(this,_).querySelector(".ng-container-bottom"),c=t.clientWidth,f=s.scrollWidth;if(c!==0&&f>c)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=n.clientWidth;if(l<=0)return;const h=Math.max(Math.min(l*(c/f),l),20);r.style.width=`${h}px`;const u=t.scrollLeft,g=f-c;let b=0;g>0&&(b=parseInt(u/g*(l-h),10)),b<0&&(b=0);const v=l-h;b>v&&(b=v),r.style.left=`${b}px`,S.log(b),e(this,w).left.disabled=b===0,e(this,w).right.disabled=b>=v-1},"refresh"));d(this,Y,a(t=>{if(!e(this,w))return!1;const s=e(this,w).container,n=s.querySelector("table");if(!n)return!1;const r=e(this,w).track.getBoundingClientRect(),o=e(this,w).thumb.clientWidth;let c=t;c<0&&(c=0);const f=r.width-o;c>f&&(c=f),c=parseInt(c,10),e(this,w).thumb.style.left=`${c}px`,e(this,w).left.disabled=c===0,e(this,w).right.disabled=c>=f-1;const l=s.clientWidth,h=n.scrollWidth;let u=f>0?-c*(h-l)/f:0;return-u>h-l&&(u=-(h-l)),-u+5>h-l&&(u=-(h-l)),l>=h&&(u=0),n.style.transform=`translateX(${u}px)`,c>0&&c<f-1},"#thumbMoveTo"));d(this,oe,a(()=>{const t=a(n=>{clearInterval(e(this,V)),clearInterval(e(this,X));const r=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,r+n),p(this,V,setInterval(()=>{clearInterval(e(this,V)),p(this,X,setInterval(()=>{const o=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,o+n)||clearInterval(e(this,X))},50))},500))},"delayScroll"),s=a(()=>{clearInterval(e(this,V)),clearInterval(e(this,X))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{e(this,w).left.addEventListener(n,s),e(this,w).right.addEventListener(n,s),e(this,w).track.addEventListener(n,s)}),e(this,w).left.addEventListener("mousedown",n=>{n.button===0&&t(-20)}),e(this,w).right.addEventListener("mousedown",n=>{n.button===0&&t(20)}),e(this,w).left.addEventListener("touchstart",()=>t(-20)),e(this,w).right.addEventListener("touchstart",()=>t(20)),e(this,w).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const r=e(this,w).track.getBoundingClientRect(),o=e(this,w).thumb.clientWidth;e(this,Y).call(this,n.clientX-r.left-o/2)}),e(this,w).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,P,!0),this.shiftX=n.clientX-e(this,w).thumb.getBoundingClientRect().left;const r=a(c=>{if(!e(this,P))return;const f=e(this,w).track.getBoundingClientRect();e(this,Y).call(this,c.clientX-f.left-this.shiftX)},"onMouseMove"),o=a(()=>{p(this,P,!1),s(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(p(this,_,this.closest("nine-table-sheet")||this.getRootNode().host),!e(this,_))return;this.innerHTML=`
1
+ (function(m,p){typeof exports=="object"&&typeof module<"u"?p(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],p):(m=typeof globalThis<"u"?globalThis:m||self,p(m.NineboneUtil))})(this,function(m){"use strict";var ze=Object.defineProperty;var Oe=m=>{throw TypeError(m)};var Ne=(m,p,S)=>p in m?ze(m,p,{enumerable:!0,configurable:!0,writable:!0,value:S}):m[p]=S;var h=(m,p)=>ze(m,"name",{value:p,configurable:!0});var E=(m,p,S)=>Ne(m,typeof p!="symbol"?p+"":p,S),Be=(m,p,S)=>p.has(m)||Oe("Cannot "+S);var e=(m,p,S)=>(Be(m,p,"read from private field"),S?S.call(m):p.get(m)),u=(m,p,S)=>p.has(m)?Oe("Cannot add the same private member more than once"):p instanceof WeakSet?p.add(m):p.set(m,S),y=(m,p,S,W)=>(Be(m,p,"write to private field"),W?W.call(m,S):p.set(m,S),S);var De=(m,p,S,W)=>({set _(J){y(m,p,J,S)},get _(){return e(m,p,W)}});var I,N,w,P,V,X,re,Y,oe,z,H,q,O,M,$,le,ae,ce,he,k,K,Q,Z,de,fe,ue,te,A,ge,ie,be,B,U,L,x,C,j,ye,D,pe,se,me,we,G,F,xe;const qe=class qe extends m.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(qe,"Trace");let p=qe;const S=new p,ke=class ke extends HTMLElement{constructor(){super();u(this,I);u(this,N,!1);u(this,w);u(this,P);u(this,V);u(this,X);u(this,re,h(()=>{if(!e(this,I))return;const t=e(this,I).querySelector(".ng-container-body");t&&(y(this,X,new ResizeObserver(()=>{this.refresh()})),e(this,X).observe(t))},"#observeResize"));E(this,"refresh",h(()=>{if(!e(this,I)||!e(this,w)||e(this,N))return;const t=e(this,w).container,i=t.querySelector("table");if(!i)return;const s=e(this,w).track,r=e(this,w).thumb,o=e(this,I).querySelector(".ng-container-bottom"),a=t.clientWidth,d=i.scrollWidth;if(a!==0&&d>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=s.clientWidth;if(l<=0)return;const c=Math.max(Math.min(l*(a/d),l),20);r.style.width=`${c}px`;const f=t.scrollLeft,g=d-a;let b=0;g>0&&(b=parseInt(f/g*(l-c),10)),b<0&&(b=0);const v=l-c;b>v&&(b=v),r.style.left=`${b}px`,S.log(b),e(this,w).left.disabled=b===0,e(this,w).right.disabled=b>=v-1},"refresh"));u(this,Y,h(t=>{if(!e(this,w))return!1;const i=e(this,w).container,s=i.querySelector("table");if(!s)return!1;const r=e(this,w).track.getBoundingClientRect(),o=e(this,w).thumb.clientWidth;let a=t;a<0&&(a=0);const d=r.width-o;a>d&&(a=d),a=parseInt(a,10),e(this,w).thumb.style.left=`${a}px`,e(this,w).left.disabled=a===0,e(this,w).right.disabled=a>=d-1;const l=i.clientWidth,c=s.scrollWidth;let f=d>0?-a*(c-l)/d:0;return-f>c-l&&(f=-(c-l)),-f+5>c-l&&(f=-(c-l)),l>=c&&(f=0),s.style.transform=`translateX(${f}px)`,a>0&&a<d-1},"#thumbMoveTo"));u(this,oe,h(()=>{const t=h(s=>{clearInterval(e(this,P)),clearInterval(e(this,V));const r=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,r+s),y(this,P,setInterval(()=>{clearInterval(e(this,P)),y(this,V,setInterval(()=>{const o=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,o+s)||clearInterval(e(this,V))},50))},500))},"delayScroll"),i=h(()=>{clearInterval(e(this,P)),clearInterval(e(this,V))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(s=>{e(this,w).left.addEventListener(s,i),e(this,w).right.addEventListener(s,i),e(this,w).track.addEventListener(s,i)}),e(this,w).left.addEventListener("mousedown",s=>{s.button===0&&t(-20)}),e(this,w).right.addEventListener("mousedown",s=>{s.button===0&&t(20)}),e(this,w).left.addEventListener("touchstart",()=>t(-20)),e(this,w).right.addEventListener("touchstart",()=>t(20)),e(this,w).track.addEventListener("mousedown",s=>{if(s.button!==0)return;s.preventDefault();const r=e(this,w).track.getBoundingClientRect(),o=e(this,w).thumb.clientWidth;e(this,Y).call(this,s.clientX-r.left-o/2)}),e(this,w).thumb.addEventListener("mousedown",s=>{if(s.button!==0)return;s.stopPropagation(),s.preventDefault(),y(this,N,!0),this.shiftX=s.clientX-e(this,w).thumb.getBoundingClientRect().left;const r=h(a=>{if(!e(this,N))return;const d=e(this,w).track.getBoundingClientRect();e(this,Y).call(this,a.clientX-d.left-this.shiftX)},"onMouseMove"),o=h(()=>{y(this,N,!1),i(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(y(this,I,this.closest("nine-table-sheet")||this.getRootNode().host),!e(this,I))return;this.innerHTML=`
2
2
  <style>
3
3
  nine-table-hscrollbar {
4
4
  display: flex;
@@ -60,7 +60,7 @@
60
60
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
61
61
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
62
62
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
63
- `;const t=a(()=>{const s=e(this,_).querySelector(".ng-container-body");if(!s){setTimeout(t,10);return}p(this,w,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),e(this,oe).call(this),e(this,re).call(this),this.refresh()},"initWhenReady");t()}disconnectedCallback(){e(this,F)&&e(this,F).disconnect()}};_=new WeakMap,P=new WeakMap,w=new WeakMap,V=new WeakMap,X=new WeakMap,F=new WeakMap,re=new WeakMap,Y=new WeakMap,oe=new WeakMap,a(ke,"NineTableHScrollBar");let z=ke;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",z);const Le=class Le{constructor(i){d(this,O);d(this,H,[]);d(this,T,null);d(this,B,null);d(this,M,0);d(this,I,0);R(this,"getRowHeight",a(()=>e(this,T),"getRowHeight"));d(this,le,a(()=>{e(this,ae).call(this)},"#init"));d(this,ae,a(()=>{!e(this,O)||!(e(this,O)instanceof HTMLElement)||(p(this,B,new ResizeObserver(i=>{for(const t of i){const s=t.target;if(!s.classList.contains("active"))continue;const n=t.contentRect.height||(t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:0);if(n>0){const r=s.clientHeight||s.getBoundingClientRect().height||n;let o=0;const c=s.querySelector(".ng-container-body")||s,f=c.querySelector("thead"),l=c.querySelector("tfoot");f&&(o+=f.offsetHeight||f.getBoundingClientRect().height),l&&(o+=l.offsetHeight||l.getBoundingClientRect().height);const h=Math.max(r-o,100);if(e(this,M)!==h&&(p(this,M,h),e(this,T)!==null)){const u=Math.ceil(e(this,M)/e(this,T));p(this,I,u+20),S.log(`[RowManager] Resized. Height: ${e(this,M)}px | Target Rows: ${e(this,I)}`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const b=s.querySelector(g);b&&b.querySelector("tbody")&&e(this,he).call(this,b)})}}}})),e(this,B).observe(e(this,O)))},"#initResizeObserver"));R(this,"initialize",a(i=>{S.log(i);const t=e(this,O).querySelector(".ng-container-body"),s=i.querySelector("tbody"),n=Array.from(s.querySelectorAll("tr"));p(this,H,n.map(r=>r.cloneNode(!0))),p(this,T,null),e(this,ce).call(this,t)},"initialize"));d(this,ce,a(i=>{if(e(this,T)!==null&&e(this,T)>0)return e(this,T);if(e(this,H).length===0)throw new Error("[RowManager] Template TRs are empty.");const t=i.querySelector("tbody.bindable")||i.querySelector("tbody");if(!t)return 24;t.querySelectorAll("tr:not(.nodata)").forEach(u=>u.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment();e(this,H).forEach(u=>{n.appendChild(u.cloneNode(!0))}),s?s.before(n):t.appendChild(n);const r=i.closest("nine-table-sheet"),o=r?r.style.display:"",c=r?r.style.visibility:"",f=r?r.style.position:"";r&&(r.style.display==="none"||window.getComputedStyle(r).display==="none")&&(r.style.display="block",r.style.visibility="hidden",r.style.position="absolute");let l=0;const h=t.querySelectorAll("tr:not(.nodata)");if(h.forEach((u,g)=>{l+=u.offsetHeight||u.getBoundingClientRect().height}),h.forEach(u=>u.remove()),r&&(r.style.display=o,r.style.visibility=c,r.style.position=f),p(this,T,l),e(this,M)>0){const u=Math.ceil(e(this,M)/e(this,T));p(this,I,u+20)}else p(this,I,40);return console.log(`[RowManager] Template Height Cached: ${e(this,T)}px | RowCount: ${e(this,I)}`),e(this,T)},"#measureAndCacheHeight"));d(this,he,a(i=>{if(e(this,H).length===0)return;const t=i.querySelector("tbody.bindable")||i.querySelector("tbody");if(!t)return;t.querySelectorAll("tr:not(.nodata)").forEach(o=>o.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment(),r=e(this,I);for(let o=0;o<r;o++)e(this,H).forEach(c=>{n.appendChild(c.cloneNode(!0))});s?s.before(n):t.appendChild(n),console.log(`[RowManager] Rendered ${r} sets into DOM.`)},"#renderRows"));R(this,"destroy",a(()=>{e(this,B)&&(e(this,B).disconnect(),p(this,B,null))},"destroy"));p(this,O,i),e(this,le).call(this)}get templateLength(){return e(this,H).length||1}};O=new WeakMap,H=new WeakMap,T=new WeakMap,B=new WeakMap,M=new WeakMap,I=new WeakMap,le=new WeakMap,ae=new WeakMap,ce=new WeakMap,he=new WeakMap,a(Le,"RowManager");let Q=Le;const ee=class ee extends HTMLElement{constructor(){super();d(this,$,null);d(this,Z);R(this,"generate",a(t=>{if(!t)return;const s=a(l=>{const h=a(g=>{if(g.querySelector("colgroup"))return;const b=g.querySelector("tbody tr")||g.querySelector("tr"),v=b?b.querySelectorAll("th, td").length:1,A=document.createElement("colgroup"),L=Math.max(Math.floor(g.clientWidth/v),100);for(let W=0;W<v;W++){const J=document.createElement("col");J.setAttribute("width",L),A.appendChild(J)}g.prepend(A)},"ensureColgroup"),u=a(g=>{if(g.querySelector("thead"))return;const b=document.createElement("thead"),v=g.querySelector("colgroup");v?v.after(b):g.prepend(b)},"ensureThead");return h(l),u(l),l.classList.add("nine-table-element"),l},"initializeTable"),n=t.cloneNode(!0);p(this,$,s(n)),e(this,$).style.display="table";const r=this.querySelector(".ng-container-left"),o=this.querySelector(".ng-container-body"),c=this.querySelector(".ng-container-right"),f=a((l,h,u=!1)=>{const g=l.cloneNode(!0),b=Array.from(g.querySelectorAll("colgroup col")),v=[];return b.forEach((A,L)=>{const W=A.getAttribute("fixed");let J=!1;u?J=W!=="left"&&W!=="right":J=W===h,J||v.push(L)}),v.reverse().forEach(A=>{b[A]&&b[A].remove(),g.querySelectorAll("tr").forEach(L=>{const W=L.querySelectorAll("th, td");W[A]&&W[A].remove()})}),g},"filterTableByFixed");if(o){const l=f(e(this,$),null,!0);o.innerHTML="",o.appendChild(l),e(this,Z).initialize(e(this,$))}if(r){const l=f(e(this,$),"left",!1);let h=0;l.querySelectorAll("col").forEach(g=>{const b=parseInt(g.getAttribute("width"),10);isNaN(b)||(h+=b)}),r.innerHTML="",r.appendChild(l);const u=h>0?h:0;r.style.flex=`0 0 ${u}px`,r.style.width=`${u}px`}if(c){const l=f(e(this,$),"right",!1);let h=0;l.querySelectorAll("col").forEach(g=>{const b=parseInt(g.getAttribute("width"),10);isNaN(b)||(h+=b)}),c.innerHTML="",c.appendChild(l);const u=h>0?h:0;c.style.flex=`0 0 ${u}px`,c.style.width=`${u}px`}o&&o.addEventListener("scroll",()=>{var l;(l=this.querySelector("nine-table-hscrollbar"))==null||l.refresh()}),setTimeout(()=>{var l;(l=this.querySelector("nine-table-hscrollbar"))==null||l.refresh()},0)},"generate"));R(this,"getRowHeight",a(()=>e(this,Z).getRowHeight(),"getRowHeight"));R(this,"scrollToX",a(t=>{const s=this.querySelector(".ng-container-body");s&&(s.scrollLeft=t)},"scrollToX"));R(this,"scrollToY",a(t=>{const s=this.querySelector(".ng-container-body");s&&(s.scrollTop=t)},"scrollToY"));d(this,de,a(()=>{e(this,fe).call(this),new MutationObserver(t=>{const s=a(()=>{requestAnimationFrame(()=>{var u,g,b;const n=this.querySelector(".ng-container-left table"),r=this.querySelector(".ng-container-body table"),o=this.querySelector(".ng-container-right table");if(!r)return;const c=n?Array.from(n.querySelectorAll("tr")):[],f=Array.from(r.querySelectorAll("tr")),l=o?Array.from(o.querySelectorAll("tr")):[],h=Math.max(c.length,f.length,l.length);for(let v=0;v<h;v++){const A=[((u=c[v])==null?void 0:u.getBoundingClientRect().height)||0,((g=f[v])==null?void 0:g.getBoundingClientRect().height)||0,((b=l[v])==null?void 0:b.getBoundingClientRect().height)||0],L=Math.max(...A);L>0&&(c[v]&&(c[v].style.height=`${L}px`),f[v]&&(f[v].style.height=`${L}px`),l[v]&&(l[v].style.height=`${L}px`))}})},"syncRowHeights");for(const n of t)n.attributeName==="class"&&this.classList.contains("active")&&s()}).observe(this,{attributes:!0})},"#init"));d(this,fe,a(()=>{const t=ee.SCROLLBAR_SIZE;this.innerHTML=`
63
+ `;const t=h(()=>{const i=e(this,I).querySelector(".ng-container-body");if(!i){setTimeout(t,10);return}y(this,w,{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")}),e(this,oe).call(this),e(this,re).call(this),this.refresh()},"initWhenReady");t()}disconnectedCallback(){e(this,X)&&e(this,X).disconnect()}};I=new WeakMap,N=new WeakMap,w=new WeakMap,P=new WeakMap,V=new WeakMap,X=new WeakMap,re=new WeakMap,Y=new WeakMap,oe=new WeakMap,h(ke,"NineTableHScrollBar");let W=ke;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",W);const Le=class Le{constructor(n){u(this,z);u(this,H,[]);u(this,q,null);u(this,O,null);u(this,M,0);u(this,$,0);E(this,"getRowHeight",h(()=>e(this,q),"getRowHeight"));u(this,le,h(()=>{e(this,ae).call(this)},"#init"));u(this,ae,h(()=>{!e(this,z)||!(e(this,z)instanceof HTMLElement)||(y(this,O,new ResizeObserver(n=>{for(const t of n){const i=t.target;if(!i.classList.contains("active"))continue;const s=t.contentRect.height||(t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:0);if(s>0){const r=i.clientHeight||i.getBoundingClientRect().height||s;let o=0;const a=i.querySelector(".ng-container-body")||i,d=a.querySelector("thead"),l=a.querySelector("tfoot");d&&(o+=d.offsetHeight||d.getBoundingClientRect().height),l&&(o+=l.offsetHeight||l.getBoundingClientRect().height);const c=Math.max(r-o,100);if(e(this,M)!==c&&(y(this,M,c),e(this,q)!==null)){const f=Math.ceil(e(this,M)/e(this,q));y(this,$,f+20),S.log(`[RowManager] Resized. Height: ${e(this,M)}px | Target Rows: ${e(this,$)}`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const b=i.querySelector(g);b&&b.querySelector("tbody")&&e(this,he).call(this,b)})}}}})),e(this,O).observe(e(this,z)))},"#initResizeObserver"));E(this,"initialize",h(n=>{S.log(n);const t=e(this,z).querySelector(".ng-container-body"),i=n.querySelector("tbody"),s=Array.from(i.querySelectorAll("tr"));y(this,H,s.map(r=>r.cloneNode(!0))),y(this,q,null),e(this,ce).call(this,t)},"initialize"));u(this,ce,h(n=>{if(e(this,q)!==null&&e(this,q)>0)return e(this,q);if(e(this,H).length===0)throw new Error("[RowManager] Template TRs are empty.");const t=n.querySelector("tbody.bindable")||n.querySelector("tbody");if(!t)return 24;t.querySelectorAll("tr:not(.nodata)").forEach(f=>f.remove());const i=t.querySelector("tr.nodata"),s=document.createDocumentFragment();e(this,H).forEach(f=>{s.appendChild(f.cloneNode(!0))}),i?i.before(s):t.appendChild(s);const r=n.closest("nine-table-sheet"),o=r?r.style.display:"",a=r?r.style.visibility:"",d=r?r.style.position:"";r&&(r.style.display==="none"||window.getComputedStyle(r).display==="none")&&(r.style.display="block",r.style.visibility="hidden",r.style.position="absolute");let l=0;const c=t.querySelectorAll("tr:not(.nodata)");if(c.forEach((f,g)=>{l+=f.offsetHeight||f.getBoundingClientRect().height}),c.forEach(f=>f.remove()),r&&(r.style.display=o,r.style.visibility=a,r.style.position=d),y(this,q,l),e(this,M)>0){const f=Math.ceil(e(this,M)/e(this,q));y(this,$,f+20)}else y(this,$,40);return console.log(`[RowManager] Template Height Cached: ${e(this,q)}px | RowCount: ${e(this,$)}`),e(this,q)},"#measureAndCacheHeight"));u(this,he,h(n=>{if(e(this,H).length===0)return;const t=n.querySelector("tbody.bindable")||n.querySelector("tbody");if(!t)return;t.querySelectorAll("tr:not(.nodata)").forEach(o=>o.remove());const i=t.querySelector("tr.nodata"),s=document.createDocumentFragment(),r=e(this,$);for(let o=0;o<r;o++)e(this,H).forEach(a=>{s.appendChild(a.cloneNode(!0))});i?i.before(s):t.appendChild(s),console.log(`[RowManager] Rendered ${r} sets into DOM.`)},"#renderRows"));E(this,"destroy",h(()=>{e(this,O)&&(e(this,O).disconnect(),y(this,O,null))},"destroy"));y(this,z,n),e(this,le).call(this)}get templateLength(){return e(this,H).length||1}};z=new WeakMap,H=new WeakMap,q=new WeakMap,O=new WeakMap,M=new WeakMap,$=new WeakMap,le=new WeakMap,ae=new WeakMap,ce=new WeakMap,he=new WeakMap,h(Le,"RowManager");let J=Le;const ee=class ee extends HTMLElement{constructor(){super();u(this,k,null);u(this,K);u(this,Q,h((t,i)=>{const s=Array.from(t.querySelectorAll(i+" tr")),r=Array.from(t.querySelectorAll(i+" th,"+i+" td")),o=s.length;if(o===0||r.length===0)return;let a=0;r.forEach(l=>{a+=l.colSpan||1});const d=Array.from(Array(o),()=>Array(a).fill(null));s.forEach(l=>{const c=l.sectionRowIndex;let f=0;Array.from(l.querySelectorAll("th,td")).forEach(g=>{for(let R=0;R<d[c].length;R++)if(d[c][R]===null){f=R;break}const b=g.rowSpan||1,v=g.colSpan||1;for(let R=0;R<b;R++)for(let T=0;T<v;T++)c+R<o&&f+T<a&&(d[c+R][f+T]=R===0&&T===0?"1":"0")})}),s.forEach(l=>{const c=l.sectionRowIndex;Array.from(l.querySelectorAll("th,td")).forEach(f=>{for(let g=0;g<d[c].length;g++)if(d[c][g]==="1"){f.dataset.col=g,d[c][g]="0";break}})})},"#resetColIndex"));u(this,Z,h((t,i)=>{const s=t.cloneNode(!0),r=s.querySelector("colgroup");if(!r)return s;const o=Array.from(r.querySelectorAll("col")),a=[];return o.forEach((d,l)=>{const c=d.getAttribute("fixed");let f=!1;i==="left"?f=c==="left":i==="right"?f=c==="right":f=c!=="left"&&c!=="right",f||a.push(l)}),a.reverse().forEach(d=>{o[d]&&o[d].remove(),s.querySelectorAll("tr").forEach(l=>{Array.from(l.querySelectorAll("th, td")).forEach(f=>{parseInt(f.dataset.col,10)===d&&f.remove()})})}),s},"#createSplitTable"));E(this,"generate",h(t=>{if(!t)return;const i=h(l=>{const c=h(g=>{if(g.querySelector("colgroup"))return;const b=g.querySelector("tbody tr")||g.querySelector("tr"),v=b?b.querySelectorAll("th, td").length:1,R=document.createElement("colgroup"),T=Math.max(Math.floor(g.clientWidth/v),100);for(let $e=0;$e<v;$e++){const We=document.createElement("col");We.setAttribute("width",T),R.appendChild(We)}g.prepend(R)},"ensureColgroup"),f=h(g=>{if(g.querySelector("thead"))return;const b=document.createElement("thead"),v=g.querySelector("colgroup");v?v.after(b):g.prepend(b)},"ensureThead");return c(l),f(l),l.classList.add("nine-table-element"),l},"initializeTable"),s=t.cloneNode(!0);y(this,k,i(s)),e(this,k).style.display="table",e(this,Q).call(this,e(this,k),"thead"),e(this,Q).call(this,e(this,k),"tbody"),Array.from(e(this,k).querySelectorAll("colgroup col")).forEach((l,c)=>{const f=l.getAttribute("fixed");f&&e(this,k).querySelectorAll(`[data-col="${c}"]`).forEach(g=>{g.setAttribute("fixed",f)})}),S.log(e(this,k));const o=this.querySelector(".ng-container-left"),a=this.querySelector(".ng-container-body"),d=this.querySelector(".ng-container-right");if(a){const l=e(this,Z).call(this,e(this,k),null);a.innerHTML="",a.appendChild(l),e(this,K).initialize(e(this,k))}if(o){const l=e(this,Z).call(this,e(this,k),"left");let c=0;l.querySelectorAll("col").forEach(g=>{const b=parseInt(g.getAttribute("width"),10);isNaN(b)||(c+=b)}),o.innerHTML="",o.appendChild(l);const f=c>0?c:0;o.style.flex=`0 0 ${f}px`,o.style.width=`${f}px`}if(d){const l=e(this,Z).call(this,e(this,k),"right");let c=0;l.querySelectorAll("col").forEach(g=>{const b=parseInt(g.getAttribute("width"),10);isNaN(b)||(c+=b)}),d.innerHTML="",d.appendChild(l);const f=c>0?c:0;d.style.flex=`0 0 ${f}px`,d.style.width=`${f}px`}a&&a.addEventListener("scroll",()=>{var l;(l=this.querySelector("nine-table-hscrollbar"))==null||l.refresh()}),setTimeout(()=>{var l;(l=this.querySelector("nine-table-hscrollbar"))==null||l.refresh()},0)},"generate"));E(this,"getRowHeight",h(()=>e(this,K).getRowHeight(),"getRowHeight"));E(this,"scrollToX",h(t=>{const i=this.querySelector(".ng-container-body");i&&(i.scrollLeft=t)},"scrollToX"));E(this,"scrollToY",h(t=>{const i=this.querySelector(".ng-container-body");i&&(i.scrollTop=t)},"scrollToY"));u(this,de,h(()=>{e(this,fe).call(this),new MutationObserver(t=>{const i=h(()=>{requestAnimationFrame(()=>{var f,g,b;const s=this.querySelector(".ng-container-left table"),r=this.querySelector(".ng-container-body table"),o=this.querySelector(".ng-container-right table");if(!r)return;const a=s?Array.from(s.querySelectorAll("tr")):[],d=Array.from(r.querySelectorAll("tr")),l=o?Array.from(o.querySelectorAll("tr")):[],c=Math.max(a.length,d.length,l.length);for(let v=0;v<c;v++){const R=[((f=a[v])==null?void 0:f.getBoundingClientRect().height)||0,((g=d[v])==null?void 0:g.getBoundingClientRect().height)||0,((b=l[v])==null?void 0:b.getBoundingClientRect().height)||0],T=Math.max(...R);T>0&&(a[v]&&(a[v].style.height=`${T}px`),d[v]&&(d[v].style.height=`${T}px`),l[v]&&(l[v].style.height=`${T}px`))}})},"syncRowHeights");for(const s of t)s.attributeName==="class"&&this.classList.contains("active")&&i()}).observe(this,{attributes:!0})},"#init"));u(this,fe,h(()=>{const t=ee.SCROLLBAR_SIZE;this.innerHTML=`
64
64
  <style>
65
65
  nine-table-sheet {
66
66
  display: none;
@@ -96,7 +96,6 @@
96
96
  flex-shrink: 0;
97
97
  }
98
98
 
99
- /* ๐ŸŽฏ ์ปจํ…Œ์ด๋„ˆ ์ž์ฒด ์Šคํฌ๋กค๋ฐ” ์ƒ์„ฑ์„ ๋ง‰๊ณ  ์™ธ๋ถ€ ์ปค์Šคํ…€ ์Šคํฌ๋กค๋ฐ” ์ œ์–ด์— ์˜์กด */
100
99
  nine-table-sheet .ng-container-body {
101
100
  display: flex;
102
101
  flex-direction: column;
@@ -106,18 +105,17 @@
106
105
  background: #ffffff;
107
106
  position: relative;
108
107
 
109
- /* ์›นํ‚ท ๋ธŒ๋ผ์šฐ์ €(Chrome, Safari) ์Šคํฌ๋กค๋ฐ” ํˆฌ๋ช…ํ™” */
110
108
  &::-webkit-scrollbar {
111
109
  display: none;
112
110
  height: 0px;
113
111
  }
114
112
 
115
- /* ํŒŒ์ด์–ดํญ์Šค ์Šคํฌ๋กค๋ฐ” ์ˆจ๊ธฐ๊ธฐ */
116
113
  scrollbar-width: none;
117
114
  }
118
115
 
119
116
  nine-table-sheet .ng-container-right {
120
117
  display: flex;
118
+ flex-init: 0;
121
119
  flex-direction: column;
122
120
  overflow: hidden;
123
121
  background: #ffffff;
@@ -182,14 +180,14 @@
182
180
  <nine-table-hscrollbar></nine-table-hscrollbar>
183
181
  <div class='ng-scroll-edge'></div>
184
182
  </div>
185
- `},"#render"));p(this,Z,new Q(this))}connectedCallback(){e(this,de).call(this)}disconnectedCallback(){this.innerHTML="",S.log("NineTableSheet destroyed.")}};$=new WeakMap,Z=new WeakMap,de=new WeakMap,fe=new WeakMap,a(ee,"NineTableSheet"),R(ee,"SCROLLBAR_SIZE",16);let ne=ee;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",ne);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,ue,a(()=>{var t;(t=this.querySelector(".nine-tab-bar"))==null||t.addEventListener("click",s=>{var o;const n=s.ctrlKey||s.metaKey||s.shiftKey,r=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);e(this,te).call(this,r,n)}),e(this,te).call(this,0,!1)},"#init"));d(this,te,a((t,s=!1)=>{const n=a(()=>{const h=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(b=>b.style.setProperty("display","none"));const g=h.filter(b=>b.classList.contains("active"));g.length<2||g.forEach(b=>{const v=parseInt(b.getAttribute("data-index"),10),A=this.querySelector(`nine-splitter[data-split-index="${v}"]`),L=h[v+1];A&&L&&L.classList.contains("active")&&A.style.setProperty("display","flex")})},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),c=r.querySelectorAll(".nine-tab-item"),f=o.querySelectorAll("nine-table-sheet");if(!c[t])return;if(!s)c.forEach((h,u)=>{h.classList.toggle("active",u===t)}),f.forEach((h,u)=>{const g=u===t;h.classList.toggle("active",g),h.style.flex=g?"1 1 100%":""});else{const h=c[t],u=r.querySelectorAll(".nine-tab-item.active");if(h.classList.contains("active")&&u.length<=1)return;h.classList.toggle("active");const g=o.querySelector(`nine-table-sheet[data-index="${t}"]`);g&&(g.classList.toggle("active"),g.classList.contains("active")||(g.style.flex=""))}const l=o.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(h=>{h.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),n()},"#switchSheet"))}connectedCallback(){e(this,ue).call(this)}};ue=new WeakMap,te=new WeakMap,a(Ce,"NineTableSheets");let xe=Ce;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",xe);const _e=class _e{constructor(i){d(this,E);d(this,ge,a(()=>{e(this,be).call(this),new ResizeObserver(i=>{for(let t of i)e(this,E).getAttribute("auto-height")==="true"&&e(this,ie).call(this)}).observe(e(this,E))},"#init"));d(this,ie,a(()=>{var f,l;const i=Array.from(e(this,E).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const t=parseInt(e(this,E).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(h=>h.getRowHeight())),n=(f=e(this,E).shadowRoot.querySelector("nine-table-header"))==null?void 0:f.getBoundingClientRect().height,r=(l=e(this,E).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=ne.SCROLLBAR_SIZE,c=t*s+n+r+o;e(this,E).style.height=`${c}px`},"#applyAutoHeight"));d(this,be,a(()=>{const t=Array.from(e(this,E).children).filter(f=>f.tagName==="TABLE"),s=e(this,E).getAttribute("auto-height")==="true",n=t.length,r=t.map((f,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,g=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+g}).join(""),o=t.map((f,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");e(this,E).shadowRoot.innerHTML=`
183
+ `},"#render"));y(this,K,new J(this))}connectedCallback(){e(this,de).call(this)}disconnectedCallback(){this.innerHTML="",S.log("NineTableSheet destroyed.")}};k=new WeakMap,K=new WeakMap,Q=new WeakMap,Z=new WeakMap,de=new WeakMap,fe=new WeakMap,h(ee,"NineTableSheet"),E(ee,"SCROLLBAR_SIZE",16);let ne=ee;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",ne);const Ce=class Ce extends HTMLElement{constructor(){super();u(this,ue,h(()=>{var t;(t=this.querySelector(".nine-tab-bar"))==null||t.addEventListener("click",i=>{var o;const s=i.ctrlKey||i.metaKey||i.shiftKey,r=parseInt((o=i.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);e(this,te).call(this,r,s)}),e(this,te).call(this,0,!1)},"#init"));u(this,te,h((t,i=!1)=>{const s=h(()=>{const c=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(b=>b.style.setProperty("display","none"));const g=c.filter(b=>b.classList.contains("active"));g.length<2||g.forEach(b=>{const v=parseInt(b.getAttribute("data-index"),10),R=this.querySelector(`nine-splitter[data-split-index="${v}"]`),T=c[v+1];R&&T&&T.classList.contains("active")&&R.style.setProperty("display","flex")})},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),a=r.querySelectorAll(".nine-tab-item"),d=o.querySelectorAll("nine-table-sheet");if(!a[t])return;if(!i)a.forEach((c,f)=>{c.classList.toggle("active",f===t)}),d.forEach((c,f)=>{const g=f===t;c.classList.toggle("active",g),c.style.flex=g?"1 1 100%":""});else{const c=a[t],f=r.querySelectorAll(".nine-tab-item.active");if(c.classList.contains("active")&&f.length<=1)return;c.classList.toggle("active");const g=o.querySelector(`nine-table-sheet[data-index="${t}"]`);g&&(g.classList.toggle("active"),g.classList.contains("active")||(g.style.flex=""))}const l=o.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(c=>{c.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),s()},"#switchSheet"))}connectedCallback(){e(this,ue).call(this)}};ue=new WeakMap,te=new WeakMap,h(Ce,"NineTableSheets");let ve=Ce;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ve);const _e=class _e{constructor(n){u(this,A);u(this,ge,h(()=>{e(this,be).call(this),new ResizeObserver(n=>{for(let t of n)e(this,A).getAttribute("auto-height")==="true"&&e(this,ie).call(this)}).observe(e(this,A))},"#init"));u(this,ie,h(()=>{var d,l;const n=Array.from(e(this,A).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const t=parseInt(e(this,A).getAttribute("max-display-row"),10)||10,i=Math.max(...n.map(c=>c.getRowHeight())),s=(d=e(this,A).shadowRoot.querySelector("nine-table-header"))==null?void 0:d.getBoundingClientRect().height,r=(l=e(this,A).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=ne.SCROLLBAR_SIZE,a=t*i+s+r+o;e(this,A).style.height=`${a}px`},"#applyAutoHeight"));u(this,be,h(()=>{const t=Array.from(e(this,A).children).filter(d=>d.tagName==="TABLE"),i=e(this,A).getAttribute("auto-height")==="true",s=t.length,r=t.map((d,l)=>{const f=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,g=l<s-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return f+g}).join(""),o=t.map((d,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");e(this,A).shadowRoot.innerHTML=`
186
184
  <style>
187
185
  :host {
188
186
  display: flex;
189
187
  flex-direction: column;
190
188
  position: relative;
191
189
  overflow: hidden;
192
- height: ${s?"auto":"100%"};
190
+ height: ${i?"auto":"100%"};
193
191
  background: #fff;
194
192
  }
195
193
 
@@ -280,5 +278,5 @@
280
278
  <nine-table-analysis></nine-table-analysis>
281
279
  </nine-table-body>
282
280
  <nine-table-footer></nine-table-footer>
283
- `;const c=e(this,E).shadowRoot.querySelectorAll("nine-table-sheet");c==null||c.forEach((f,l)=>{t[l]&&setTimeout(()=>{f.generate(t[l]),s&&e(this,ie).call(this)})})},"#render"));p(this,E,i),e(this,ge).call(this)}};E=new WeakMap,ge=new WeakMap,ie=new WeakMap,be=new WeakMap,a(_e,"LayoutManager");let Se=_e;const He=class He{constructor(i){d(this,D);d(this,U,-1);R(this,"count",a(()=>e(this,D).rawRecords.length,"count"));p(this,D,i)}get at(){return e(this,U)}set at(i){var s,n;p(this,U,parseInt(i,10));const t=((n=(s=e(this,D).owner).querySelector)==null?void 0:n.call(s,".ng-container-body"))||e(this,D).owner.body;t&&!t.querySelector(`tbody.bindable tr[data-row="${e(this,U)}"]`)&&setTimeout(()=>{var r,o;(o=(r=e(this,D).owner).scrollTo_V1)==null||o.call(r,e(this,U))})}};D=new WeakMap,U=new WeakMap,a(He,"ngRow");let Re=He;const C=class C{constructor(i,t){d(this,q);d(this,x);d(this,k,[]);d(this,j,[]);d(this,pe,0);d(this,N,[]);d(this,ye,a(()=>{p(this,N,[]);const i=e(this,q).template||[];Array.from(i).forEach(t=>{var s;e(this,N).push(((s=t.getBoundingClientRect)==null?void 0:s.call(t).height)||24)}),(e(this,x).rawRecords||[]).forEach(t=>{t.__ng||(t.__ng=e(this,se).call(this)),t.__ng.height=e(this,N).slice()})},"#initialize"));R(this,"set",a(i=>{this.clear(),this.add(i,!1)},"set"));d(this,se,a(()=>({rowState:C.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:e(this,N).slice(),o:{},c:{},_:[0,0,0,0,C.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,e(this,N).slice(),-1,{},{}]}),"#getDefaultMeta"));R(this,"reset",a(()=>{p(this,k,[]),p(this,j,[])},"reset"));R(this,"clear",a(()=>{var i;e(this,x).rawRecords=[],p(this,k,[]),p(this,j,[]),(i=e(this,x).viewRecords)!=null&&i.reset&&e(this,x).viewRecords.reset()},"clear"));d(this,me,a(i=>{var n;Array.isArray(i)||(i=[i]);const t=typeof((n=e(this,q).fields)==null?void 0:n.get)=="function"?e(this,q).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(r=>{const o={v:[]};t.forEach(c=>{o.v.push(r[c]!==void 0&&r[c]!==null?r[c]:"")}),s.push(o)}),s},"#json2Array"));d(this,we,a(i=>(Array.isArray(i)||(i=[i]),i.forEach(t=>{t.__ng=e(this,se).call(this),t.__ng.rowid=this.nextId,t.__ng.rowState=C.ROW_STATE.INSERT,t.__ng._[0]=t.__ng.rowid}),i),"#defaultInsert"));R(this,"add",a((i,t=!0)=>{var r;i===void 0&&(i={});const s=e(this,me).call(this,i);e(this,x).rawRecords=e(this,x).rawRecords.concat(e(this,we).call(this,s)),this.resetRecords();const n=this.count()-1;return t||s.forEach((o,c)=>{const f=e(this,x).rawRecords[n-c];f&&(f.__ng.rowState=C.ROW_STATE.EMPTY)}),(r=e(this,x).viewRecords)!=null&&r.reset&&e(this,x).viewRecords.reset(),n},"add"));R(this,"delete",a(i=>{var s;let t=[];Array.isArray(i)?t=i:typeof i>"u"?t=[e(this,x).owner.row.at]:t=[parseInt(i,10)],t.sort((n,r)=>r-n).forEach(n=>{if(e(this,k)[n]){const r=e(this,k)[n].__ng.rowid;e(this,k)[n].__ng.rowState===C.ROW_STATE.INSERT?e(this,x).rawRecords=e(this,x).rawRecords.filter(o=>o.__ng.rowid!==r):e(this,x).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=C.ROW_STATE.DELETE)})}}),this.resetRecords(),(s=e(this,x).viewRecords)!=null&&s.reset&&e(this,x).viewRecords.reset()},"delete"));R(this,"setValue",a((i,t,s)=>{var f;i=parseInt(i,10);const r=(typeof((f=e(this,q).fields)==null?void 0:f.get)=="function"?e(this,q).fields.get():[]).indexOf(t);if(r<0)return;const o=this.getValidData()[i];if(!o)return;const c=o.v[r];c!==s&&o.__ng.rowState!==C.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(t)||(o.__ng.o[t]=c),o.__ng.rowState=C.ROW_STATE.UPDATE),o.v[r]=s,e(this,x).owner.refreshData&&e(this,x).owner.refreshData(i)},"setValue"));R(this,"resetRecords",a(()=>{p(this,j,e(this,x).rawRecords.filter(i=>!i.__ng.deleted)),p(this,k,e(this,x).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),e(this,x).rawRecords.forEach((i,t)=>{i.__ng.rowidx=t}),e(this,k).forEach((i,t)=>{i.__ng.i=t})},"resetRecords"));R(this,"getValidData",a(()=>(e(this,k).length===0&&e(this,x).rawRecords.length>0&&this.resetRecords(),e(this,k)),"getValidData"));d(this,G,a(i=>{var s;if(!i)return i;const t=typeof((s=e(this,q).fields)==null?void 0:s.get)=="function"?e(this,q).fields.get():[];return Array.isArray(i)?i.filter(n=>!n.__ng.deleted).map(n=>{const r={};return t.forEach((o,c)=>{r[o]=n.v?n.v[c]:n[o]}),r.__ng=n.__ng,r}):i},"#conv2"));R(this,"count",a(()=>this.getValidData().length,"count"));R(this,"get",a((i,t)=>{var r;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return e(this,G).call(this,s);if(i<0||i>=s.length)return null;const n=typeof((r=e(this,q).fields)==null?void 0:r.get)=="function"?e(this,q).fields.get():[];if(t!=null){const o=n.indexOf(t);return o>=0?s[i].v[o]:null}return e(this,G).call(this,s[i])},"get"));p(this,q,i),p(this,x,t),e(this,ye).call(this)}get source(){return e(this,G).call(this,e(this,x).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Oe(this,pe)._}get length(){return e(this,k).length}getRowCount(){return this.length}};q=new WeakMap,x=new WeakMap,k=new WeakMap,j=new WeakMap,pe=new WeakMap,N=new WeakMap,ye=new WeakMap,se=new WeakMap,me=new WeakMap,we=new WeakMap,G=new WeakMap,a(C,"ngData"),R(C,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Ee=C;const Me=class Me{constructor(i){this.owner=i,this.row=new Re(this),this.data=new Ee(i,this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var t;(t=this.owner.view)!=null&&t.redraw&&this.owner.view.redraw()},this.setDataSource=t=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(t||[])},this.getRowState=t=>{var n,r;const s=parseInt(t,10);if(!(s>=this.data.count()))return(r=(n=this.data.getValidData()[s])==null?void 0:n.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=t=>{this.row.at=t},this.scrollTo_V1=t=>(t<0&&(t=0),t>=this.rawRecords.length&&(t=this.rawRecords.length-1),this.viewRecords.rawIndex=t,this.viewRecords.reset&&this.viewRecords.reset(),!(t<=0||t>=this.rawRecords.length-1)),this.getColumn=(t,s)=>this.data.get(t,s),this.setColumn=(t,s,n)=>{t=parseInt(t,10),this.data.setValue(t,s,n)},this.setDataSource([])}};a(Me,"ngDataManager");let Te=Me;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,K);d(this,ve);this.attachShadow({mode:"open"}),p(this,K,new Te(this))}connectedCallback(){p(this,ve,new Se(this)),S.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))}disconnectedCallback(){S.log("NineTable disconnected.")}get data(){return e(this,K).data}get row(){return e(this,K).row}get dataManager(){return e(this,K)}};K=new WeakMap,ve=new WeakMap,a(Ie,"NineTable");let Ae=Ie;customElements.get("nine-table")||customElements.define("nine-table",Ae)});
281
+ `;const a=e(this,A).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((d,l)=>{t[l]&&setTimeout(()=>{d.generate(t[l]),i&&e(this,ie).call(this)})})},"#render"));y(this,A,n),e(this,ge).call(this)}};A=new WeakMap,ge=new WeakMap,ie=new WeakMap,be=new WeakMap,h(_e,"LayoutManager");let Se=_e;const Ie=class Ie{constructor(n){u(this,B);u(this,U,-1);E(this,"count",h(()=>e(this,B).rawRecords.length,"count"));y(this,B,n)}get at(){return e(this,U)}set at(n){var i,s;y(this,U,parseInt(n,10));const t=((s=(i=e(this,B).owner).querySelector)==null?void 0:s.call(i,".ng-container-body"))||e(this,B).owner.body;t&&!t.querySelector(`tbody.bindable tr[data-row="${e(this,U)}"]`)&&setTimeout(()=>{var r,o;(o=(r=e(this,B).owner).scrollTo_V1)==null||o.call(r,e(this,U))})}};B=new WeakMap,U=new WeakMap,h(Ie,"ngRow");let Ee=Ie;const _=class _{constructor(n,t){u(this,L);u(this,x);u(this,C,[]);u(this,j,[]);u(this,ye,0);u(this,D,[]);u(this,pe,h(()=>{y(this,D,[]);const n=e(this,L).template||[];Array.from(n).forEach(t=>{var i;e(this,D).push(((i=t.getBoundingClientRect)==null?void 0:i.call(t).height)||24)}),(e(this,x).rawRecords||[]).forEach(t=>{t.__ng||(t.__ng=e(this,se).call(this)),t.__ng.height=e(this,D).slice()})},"#initialize"));E(this,"set",h(n=>{this.clear(),this.add(n,!1)},"set"));u(this,se,h(()=>({rowState:_.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:e(this,D).slice(),o:{},c:{},_:[0,0,0,0,_.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,e(this,D).slice(),-1,{},{}]}),"#getDefaultMeta"));E(this,"reset",h(()=>{y(this,C,[]),y(this,j,[])},"reset"));E(this,"clear",h(()=>{var n;e(this,x).rawRecords=[],y(this,C,[]),y(this,j,[]),(n=e(this,x).viewRecords)!=null&&n.reset&&e(this,x).viewRecords.reset()},"clear"));u(this,me,h(n=>{var s;Array.isArray(n)||(n=[n]);const t=typeof((s=e(this,L).fields)==null?void 0:s.get)=="function"?e(this,L).fields.get():Object.keys(n[0]||{}),i=[];return n.forEach(r=>{const o={v:[]};t.forEach(a=>{o.v.push(r[a]!==void 0&&r[a]!==null?r[a]:"")}),i.push(o)}),i},"#json2Array"));u(this,we,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(t=>{t.__ng=e(this,se).call(this),t.__ng.rowid=this.nextId,t.__ng.rowState=_.ROW_STATE.INSERT,t.__ng._[0]=t.__ng.rowid}),n),"#defaultInsert"));E(this,"add",h((n,t=!0)=>{var r;n===void 0&&(n={});const i=e(this,me).call(this,n);e(this,x).rawRecords=e(this,x).rawRecords.concat(e(this,we).call(this,i)),this.resetRecords();const s=this.count()-1;return t||i.forEach((o,a)=>{const d=e(this,x).rawRecords[s-a];d&&(d.__ng.rowState=_.ROW_STATE.EMPTY)}),(r=e(this,x).viewRecords)!=null&&r.reset&&e(this,x).viewRecords.reset(),s},"add"));E(this,"delete",h(n=>{var i;let t=[];Array.isArray(n)?t=n:typeof n>"u"?t=[e(this,x).owner.row.at]:t=[parseInt(n,10)],t.sort((s,r)=>r-s).forEach(s=>{if(e(this,C)[s]){const r=e(this,C)[s].__ng.rowid;e(this,C)[s].__ng.rowState===_.ROW_STATE.INSERT?e(this,x).rawRecords=e(this,x).rawRecords.filter(o=>o.__ng.rowid!==r):e(this,x).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=_.ROW_STATE.DELETE)})}}),this.resetRecords(),(i=e(this,x).viewRecords)!=null&&i.reset&&e(this,x).viewRecords.reset()},"delete"));E(this,"setValue",h((n,t,i)=>{var d;n=parseInt(n,10);const r=(typeof((d=e(this,L).fields)==null?void 0:d.get)=="function"?e(this,L).fields.get():[]).indexOf(t);if(r<0)return;const o=this.getValidData()[n];if(!o)return;const a=o.v[r];a!==i&&o.__ng.rowState!==_.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(t)||(o.__ng.o[t]=a),o.__ng.rowState=_.ROW_STATE.UPDATE),o.v[r]=i,e(this,x).owner.refreshData&&e(this,x).owner.refreshData(n)},"setValue"));E(this,"resetRecords",h(()=>{y(this,j,e(this,x).rawRecords.filter(n=>!n.__ng.deleted)),y(this,C,e(this,x).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),e(this,x).rawRecords.forEach((n,t)=>{n.__ng.rowidx=t}),e(this,C).forEach((n,t)=>{n.__ng.i=t})},"resetRecords"));E(this,"getValidData",h(()=>(e(this,C).length===0&&e(this,x).rawRecords.length>0&&this.resetRecords(),e(this,C)),"getValidData"));u(this,G,h(n=>{var i;if(!n)return n;const t=typeof((i=e(this,L).fields)==null?void 0:i.get)=="function"?e(this,L).fields.get():[];return Array.isArray(n)?n.filter(s=>!s.__ng.deleted).map(s=>{const r={};return t.forEach((o,a)=>{r[o]=s.v?s.v[a]:s[o]}),r.__ng=s.__ng,r}):n},"#conv2"));E(this,"count",h(()=>this.getValidData().length,"count"));E(this,"get",h((n,t)=>{var r;const i=this.getValidData();if(!i||i.length<=0)return;if(n==null)return e(this,G).call(this,i);if(n<0||n>=i.length)return null;const s=typeof((r=e(this,L).fields)==null?void 0:r.get)=="function"?e(this,L).fields.get():[];if(t!=null){const o=s.indexOf(t);return o>=0?i[n].v[o]:null}return e(this,G).call(this,i[n])},"get"));y(this,L,n),y(this,x,t),e(this,pe).call(this)}get source(){return e(this,G).call(this,e(this,x).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++De(this,ye)._}get length(){return e(this,C).length}getRowCount(){return this.length}};L=new WeakMap,x=new WeakMap,C=new WeakMap,j=new WeakMap,ye=new WeakMap,D=new WeakMap,pe=new WeakMap,se=new WeakMap,me=new WeakMap,we=new WeakMap,G=new WeakMap,h(_,"ngData"),E(_,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Re=_;const He=class He{constructor(n){this.owner=n,this.row=new Ee(this),this.data=new Re(n,this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var t;(t=this.owner.view)!=null&&t.redraw&&this.owner.view.redraw()},this.setDataSource=t=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(t||[])},this.getRowState=t=>{var s,r;const i=parseInt(t,10);if(!(i>=this.data.count()))return(r=(s=this.data.getValidData()[i])==null?void 0:s.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=t=>{this.row.at=t},this.scrollTo_V1=t=>(t<0&&(t=0),t>=this.rawRecords.length&&(t=this.rawRecords.length-1),this.viewRecords.rawIndex=t,this.viewRecords.reset&&this.viewRecords.reset(),!(t<=0||t>=this.rawRecords.length-1)),this.getColumn=(t,i)=>this.data.get(t,i),this.setColumn=(t,i,s)=>{t=parseInt(t,10),this.data.setValue(t,i,s)},this.setDataSource([])}};h(He,"ngDataManager");let Ae=He;const Me=class Me extends HTMLElement{constructor(){super();u(this,F);u(this,xe);this.attachShadow({mode:"open"}),y(this,F,new Ae(this))}connectedCallback(){y(this,xe,new Se(this)),S.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))}disconnectedCallback(){S.log("NineTable disconnected.")}get data(){return e(this,F).data}get row(){return e(this,F).row}get dataManager(){return e(this,F)}};F=new WeakMap,xe=new WeakMap,h(Me,"NineTable");let Te=Me;customElements.get("nine-table")||customElements.define("nine-table",Te)});
284
282
  //# sourceMappingURL=nine-table.umd.js.map