@ninebone/table 0.0.156 → 0.0.157

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(w,y){typeof exports=="object"&&typeof module<"u"?y(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],y):(w=typeof globalThis<"u"?globalThis:w||self,y(w.NineboneUtil))})(this,function(w){"use strict";var Me=Object.defineProperty;var Ie=w=>{throw TypeError(w)};var ze=(w,y,S)=>y in w?Me(w,y,{enumerable:!0,configurable:!0,writable:!0,value:S}):w[y]=S;var a=(w,y)=>Me(w,"name",{value:y,configurable:!0});var x=(w,y,S)=>ze(w,typeof y!="symbol"?y+"":y,S),$e=(w,y,S)=>y.has(w)||Ie("Cannot "+S);var e=(w,y,S)=>($e(w,y,"read from private field"),S?S.call(w):y.get(w)),u=(w,y,S)=>y.has(w)?Ie("Cannot add the same private member more than once"):y instanceof WeakSet?y.add(w):y.set(w,S),p=(w,y,S,z)=>($e(w,y,"write to private field"),z?z.call(w,S):y.set(w,S),S);var He=(w,y,S,z)=>({set _(G){p(w,y,G,S)},get _(){return e(w,y,z)}});var I,D,m,P,X,V,se,Y,ne,F,$,q,W,H,O,re,oe,_,Z,le,ae,k,ee,ce,te,he,B,U,T,v,A,j,de,N,fe,ie,ue,be,J,K,ge;const Ee=class Ee extends w.trace.constructor{constructor(){super(),this.init("nine-table","green")}};a(Ee,"Trace");let y=Ee;const S=new y,Re=class Re extends HTMLElement{constructor(){super();u(this,I);u(this,D,!1);u(this,m);u(this,P);u(this,X);u(this,V);u(this,se,a(()=>{if(!e(this,I))return;const t=e(this,I).querySelector(".ng-container-body");t&&(p(this,V,new ResizeObserver(()=>{this.refresh()})),e(this,V).observe(t))},"#observeResize"));x(this,"refresh",a(()=>{if(!e(this,I)||!e(this,m)||e(this,D))return;const t=e(this,m).container,s=t.querySelector("table");if(!s)return;const n=e(this,m).track,o=e(this,m).thumb,r=e(this,I).querySelector(".ng-container-bottom"),l=t.clientWidth,g=s.scrollWidth;if(l!==0&&g>l)r&&(r.style.display="flex");else{r&&(r.style.display="none");return}const c=n.clientWidth;if(c<=0)return;const h=Math.max(Math.min(c*(l/g),c),20);o.style.width=`${h}px`;let d=0;const b=s.style.transform;if(b&&b.includes("translateX")){const E=b.match(/translateX\(([-\d.]+)px\)/);E&&E[1]&&(d=parseFloat(E[1]))}else d=parseInt(s.style.left||0,10);let f=parseInt(Math.abs(d)*c/g,10);f<0&&(f=0);const R=c-h;f>R&&(f=R),o.style.left=`${f}px`,e(this,m).left.disabled=f===0,e(this,m).right.disabled=f>=R-1},"refresh"));u(this,Y,a(t=>{if(!e(this,m))return!1;const s=e(this,m).container,n=s.querySelector("table");if(!n)return!1;const o=e(this,m).track.getBoundingClientRect(),r=e(this,m).thumb.clientWidth;let l=t;l<0&&(l=0);const g=o.width-r;l>g&&(l=g),l=parseInt(l,10),e(this,m).thumb.style.left=`${l}px`,e(this,m).left.disabled=l===0,e(this,m).right.disabled=l>=g-1;const c=s.clientWidth,h=n.scrollWidth;let d=g>0?-l*(h-c)/g:0;return-d>h-c&&(d=-(h-c)),-d+5>h-c&&(d=-(h-c)),c>=h&&(d=0),n.style.transform=`translateX(${d}px)`,l>0&&l<g-1},"#thumbMoveTo"));u(this,ne,a(()=>{const t=a(n=>{clearInterval(e(this,P)),clearInterval(e(this,X));const o=parseInt(e(this,m).thumb.style.left||0,10);e(this,Y).call(this,o+n),p(this,P,setInterval(()=>{clearInterval(e(this,P)),p(this,X,setInterval(()=>{const r=parseInt(e(this,m).thumb.style.left||0,10);e(this,Y).call(this,r+n)||clearInterval(e(this,X))},50))},500))},"delayScroll"),s=a(()=>{clearInterval(e(this,P)),clearInterval(e(this,X))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{e(this,m).left.addEventListener(n,s),e(this,m).right.addEventListener(n,s),e(this,m).track.addEventListener(n,s)}),e(this,m).left.addEventListener("mousedown",n=>{n.button===0&&t(-20)}),e(this,m).right.addEventListener("mousedown",n=>{n.button===0&&t(20)}),e(this,m).left.addEventListener("touchstart",()=>t(-20)),e(this,m).right.addEventListener("touchstart",()=>t(20)),e(this,m).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const o=e(this,m).track.getBoundingClientRect(),r=e(this,m).thumb.clientWidth;e(this,Y).call(this,n.clientX-o.left-r/2)}),e(this,m).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,D,!0),this.shiftX=n.clientX-e(this,m).thumb.getBoundingClientRect().left;const o=a(l=>{if(!e(this,D))return;const g=e(this,m).track.getBoundingClientRect();e(this,Y).call(this,l.clientX-g.left-this.shiftX)},"onMouseMove"),r=a(()=>{p(this,D,!1),s(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),this.refresh()},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)})},"#init"))}connectedCallback(){if(p(this,I,this.closest("nine-table-sheet")||this.getRootNode().host),!e(this,I))return;this.innerHTML=`
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 Me=Object.defineProperty;var $e=m=>{throw TypeError(m)};var ze=(m,y,S)=>y in m?Me(m,y,{enumerable:!0,configurable:!0,writable:!0,value:S}):m[y]=S;var l=(m,y)=>Me(m,"name",{value:y,configurable:!0});var x=(m,y,S)=>ze(m,typeof y!="symbol"?y+"":y,S),Ie=(m,y,S)=>y.has(m)||$e("Cannot "+S);var e=(m,y,S)=>(Ie(m,y,"read from private field"),S?S.call(m):y.get(m)),u=(m,y,S)=>y.has(m)?$e("Cannot add the same private member more than once"):y instanceof WeakSet?y.add(m):y.set(m,S),p=(m,y,S,z)=>(Ie(m,y,"write to private field"),z?z.call(m,S):y.set(m,S),S);var He=(m,y,S,z)=>({set _(J){p(m,y,J,S)},get _(){return e(m,y,z)}});var M,D,w,P,X,V,se,Y,ne,F,$,k,W,I,O,re,oe,L,Z,le,ae,T,ee,ce,te,he,B,U,q,v,A,j,de,N,fe,ie,ue,be,G,K,ge;const Ee=class Ee extends m.trace.constructor{constructor(){super(),this.init("nine-table","green")}};l(Ee,"Trace");let y=Ee;const S=new y,Re=class Re extends HTMLElement{constructor(){super();u(this,M);u(this,D,!1);u(this,w);u(this,P);u(this,X);u(this,V);u(this,se,l(()=>{if(!e(this,M))return;const t=e(this,M).querySelector(".ng-container-body");t&&(p(this,V,new ResizeObserver(()=>{this.refresh()})),e(this,V).observe(t))},"#observeResize"));x(this,"refresh",l(()=>{if(!e(this,M)||!e(this,w)||e(this,D))return;const t=e(this,w).container,s=t.querySelector("table");if(!s)return;const n=e(this,w).track,o=e(this,w).thumb,r=e(this,M).querySelector(".ng-container-bottom"),a=t.clientWidth,g=s.scrollWidth;if(a!==0&&g>a)r&&(r.style.display="flex");else{r&&(r.style.display="none");return}const c=n.clientWidth;if(c<=0)return;const h=Math.max(Math.min(c*(a/g),c),20);o.style.width=`${h}px`;let d=0;const b=s.style.transform;if(b&&b.includes("translateX")){const E=b.match(/translateX\(([-\d.]+)px\)/);E&&E[1]&&(d=parseFloat(E[1]))}else d=parseInt(s.style.left||0,10);let f=parseInt(Math.abs(d)*c/g,10);f<0&&(f=0);const R=c-h;f>R&&(f=R),o.style.left=`${f}px`,e(this,w).left.disabled=f===0,e(this,w).right.disabled=f>=R-1},"refresh"));u(this,Y,l(t=>{if(!e(this,w))return!1;const s=e(this,w).container,n=s.querySelector("table");if(!n)return!1;const o=e(this,w).track.getBoundingClientRect(),r=e(this,w).thumb.clientWidth;let a=t;a<0&&(a=0);const g=o.width-r;a>g&&(a=g),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>=g-1;const c=s.clientWidth,h=n.scrollWidth;let d=g>0?-a*(h-c)/g:0;return-d>h-c&&(d=-(h-c)),-d+5>h-c&&(d=-(h-c)),c>=h&&(d=0),n.style.transform=`translateX(${d}px)`,a>0&&a<g-1},"#thumbMoveTo"));u(this,ne,l(()=>{const t=l(n=>{clearInterval(e(this,P)),clearInterval(e(this,X));const o=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,o+n),p(this,P,setInterval(()=>{clearInterval(e(this,P)),p(this,X,setInterval(()=>{const r=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,r+n)||clearInterval(e(this,X))},50))},500))},"delayScroll"),s=l(()=>{clearInterval(e(this,P)),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 o=e(this,w).track.getBoundingClientRect(),r=e(this,w).thumb.clientWidth;e(this,Y).call(this,n.clientX-o.left-r/2)}),e(this,w).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,D,!0),this.shiftX=n.clientX-e(this,w).thumb.getBoundingClientRect().left;const o=l(a=>{if(!e(this,D))return;const g=e(this,w).track.getBoundingClientRect();e(this,Y).call(this,a.clientX-g.left-this.shiftX)},"onMouseMove"),r=l(()=>{p(this,D,!1),s(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),this.refresh()},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)})},"#init"))}connectedCallback(){if(p(this,M,this.closest("nine-table-sheet")||this.getRootNode().host),!e(this,M))return;this.innerHTML=`
2
2
  <style>
3
3
  nine-table-hscrollbar {
4
4
  display: flex;
@@ -60,7 +60,7 @@
60
60
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
61
61
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
62
62
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
63
- `;const t=a(()=>{const s=e(this,I).querySelector(".ng-container-body");if(!s){setTimeout(t,10);return}p(this,m,{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,ne).call(this),e(this,se).call(this),this.refresh()},"initWhenReady");t()}disconnectedCallback(){e(this,V)&&e(this,V).disconnect()}};I=new WeakMap,D=new WeakMap,m=new WeakMap,P=new WeakMap,X=new WeakMap,V=new WeakMap,se=new WeakMap,Y=new WeakMap,ne=new WeakMap,a(Re,"NineTableHScrollBar");let z=Re;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",z);const Te=class Te{constructor(i){u(this,F);u(this,$,[]);u(this,q,null);u(this,W,null);u(this,H,0);u(this,O,0);u(this,re,a(()=>{e(this,oe).call(this)},"#init"));u(this,oe,a(()=>{!e(this,F)||!(e(this,F)instanceof HTMLElement)||(p(this,W,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 o=s.clientHeight||s.getBoundingClientRect().height||n;let r=0;const l=s.querySelector(".ng-container-body")||s,g=l.querySelector("thead"),c=l.querySelector("tfoot");g&&(r+=g.offsetHeight||g.getBoundingClientRect().height),c&&(r+=c.offsetHeight||c.getBoundingClientRect().height);const h=Math.max(o-r,100);if(e(this,H)!==h&&(p(this,H,h),e(this,q)!==null)){const d=Math.ceil(e(this,H)/e(this,q));p(this,O,d+20),S.log(`[RowManager] Resized. Height: ${e(this,H)}px | Target Rows: ${e(this,O)}`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const f=s.querySelector(b);f&&f.querySelector("tbody")&&this.renderRows(f)})}}}})),e(this,W).observe(e(this,F)))},"#initResizeObserver"));x(this,"initTemplate",a(i=>{const t=i.querySelector("tbody.bindable")||i.querySelector("tbody");if(!t)return;const s=Array.from(t.querySelectorAll("tr")).filter(n=>!n.classList.contains("nodata"));p(this,$,s.map(n=>n.cloneNode(!0))),p(this,q,null),console.log(`[RowManager] Template initialized with ${e(this,$).length} row(s).`)},"initTemplate"));x(this,"measureAndCacheHeight",a(i=>{if(e(this,q)!==null)return e(this,q);if(e(this,$).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(l=>l.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment();e(this,$).forEach(l=>{n.appendChild(l.cloneNode(!0))}),s?s.before(n):t.appendChild(n);let o=0;if(t.querySelectorAll("tr:not(.nodata)").forEach((l,g)=>{const c=l.offsetHeight;if(c===0)throw new Error(`[RowManager] Rendered TR[${g}] height is 0. Check CSS styles.`);o+=c}),p(this,q,o),e(this,H)>0){const l=Math.ceil(e(this,H)/e(this,q));p(this,O,l+20)}return console.log(`[RowManager] Template Height Cached: ${e(this,q)}px | RowCount: ${e(this,O)}`),e(this,q)},"measureAndCacheHeight"));x(this,"renderRows",a(i=>{if(e(this,$).length===0)return;const t=i.querySelector("tbody.bindable")||i.querySelector("tbody");if(!t)return;t.querySelectorAll("tr:not(.nodata)").forEach(r=>r.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment(),o=e(this,O);for(let r=0;r<o;r++)e(this,$).forEach(l=>{n.appendChild(l.cloneNode(!0))});s?s.before(n):t.appendChild(n),console.log(`[RowManager] Rendered ${o} sets into DOM.`)},"renderRows"));x(this,"destroy",a(()=>{e(this,W)&&(e(this,W).disconnect(),p(this,W,null))},"destroy"));p(this,F,i),e(this,re).call(this)}get templateLength(){return e(this,$).length||1}};F=new WeakMap,$=new WeakMap,q=new WeakMap,W=new WeakMap,H=new WeakMap,O=new WeakMap,re=new WeakMap,oe=new WeakMap,a(Te,"RowManager");let G=Te;const Q=class Q extends HTMLElement{constructor(){super();u(this,_,null);u(this,Z);x(this,"init",a(t=>{if(!t)return;const s=a(c=>{const h=a(b=>{if(b.querySelector("colgroup"))return;const f=b.querySelector("tbody tr")||b.querySelector("tr"),R=f?f.querySelectorAll("th, td").length:1,E=document.createElement("colgroup"),M=Math.max(Math.floor((b.clientWidth||600)/R),100);for(let L=0;L<R;L++){const _e=document.createElement("col");_e.setAttribute("width",M),E.appendChild(_e)}b.prepend(E)},"ensureColgroup"),d=a(b=>{if(b.querySelector("thead"))return;const f=document.createElement("thead"),R=b.querySelector("colgroup");R?R.after(f):b.prepend(f)},"ensureThead");return h(c),d(c),c.classList.add("nine-table-element"),c},"initializeTable"),n=t.cloneNode(!0);p(this,_,s(n)),e(this,_).style.display="table",e(this,Z).initTemplate(e(this,_));const o=this.querySelector(".ng-container-left"),r=this.querySelector(".ng-container-body"),l=this.querySelector(".ng-container-right"),g=a((c,h,d=!1)=>{const b=c.cloneNode(!0),f=Array.from(b.querySelectorAll("colgroup col")),R=[];return f.forEach((E,M)=>{const L=E.getAttribute("fixed");(d?!L||L==="":L===h)||R.push(M)}),R.reverse().forEach(E=>{f[E]&&f[E].remove(),b.querySelectorAll("tr").forEach(M=>{const L=M.querySelectorAll("th, td");L[E]&&L[E].remove()})}),b},"filterTableByFixed");if(r){const c=g(e(this,_),null,!0);r.innerHTML="",r.appendChild(c),e(this,Z).measureAndCacheHeight(r)}if(o){const c=g(e(this,_),"left",!1);let h=0;c.querySelectorAll("col").forEach(b=>{const f=parseInt(b.getAttribute("width"),10);isNaN(f)||(h+=f)}),o.innerHTML="",o.appendChild(c);const d=h>0?h:0;o.style.flex=`0 0 ${d}px`,o.style.width=`${d}px`}if(l){const c=g(e(this,_),"right",!1);let h=0;c.querySelectorAll("col").forEach(b=>{const f=parseInt(b.getAttribute("width"),10);isNaN(f)||(h+=f)}),l.innerHTML="",l.appendChild(c);const d=h>0?h:0;l.style.flex=`0 0 ${d}px`,l.style.width=`${d}px`}if(r){const c=this.getRowCount();r.style.overflowY=c>10?"auto":"hidden",r.addEventListener("scroll",()=>{const h=this.querySelector("nine-table-hscrollbar");h&&typeof h.refresh=="function"&&h.refresh()})}setTimeout(()=>{const c=this.querySelector("nine-table-hscrollbar");c&&typeof c.refresh=="function"&&c.refresh()},0),S.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`)},"init"));x(this,"getRowCount",a(()=>e(this,_)?e(this,_).querySelectorAll("tbody tr").length:0,"getRowCount"));x(this,"scrollToX",a(t=>{const s=this.querySelector(".ng-container-body");s&&(s.scrollLeft=t)},"scrollToX"));x(this,"scrollToY",a(t=>{const s=this.querySelector(".ng-container-body");s&&(s.scrollTop=t)},"scrollToY"));u(this,le,a(()=>{const t=Q.SCROLLBAR_SIZE;this.innerHTML=`
63
+ `;const t=l(()=>{const s=e(this,M).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,ne).call(this),e(this,se).call(this),this.refresh()},"initWhenReady");t()}disconnectedCallback(){e(this,V)&&e(this,V).disconnect()}};M=new WeakMap,D=new WeakMap,w=new WeakMap,P=new WeakMap,X=new WeakMap,V=new WeakMap,se=new WeakMap,Y=new WeakMap,ne=new WeakMap,l(Re,"NineTableHScrollBar");let z=Re;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",z);const Te=class Te{constructor(i){u(this,F);u(this,$,[]);u(this,k,null);u(this,W,null);u(this,I,0);u(this,O,0);u(this,re,l(()=>{e(this,oe).call(this)},"#init"));u(this,oe,l(()=>{!e(this,F)||!(e(this,F)instanceof HTMLElement)||(p(this,W,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 o=s.clientHeight||s.getBoundingClientRect().height||n;let r=0;const a=s.querySelector(".ng-container-body")||s,g=a.querySelector("thead"),c=a.querySelector("tfoot");g&&(r+=g.offsetHeight||g.getBoundingClientRect().height),c&&(r+=c.offsetHeight||c.getBoundingClientRect().height);const h=Math.max(o-r,100);if(e(this,I)!==h&&(p(this,I,h),e(this,k)!==null)){const d=Math.ceil(e(this,I)/e(this,k));p(this,O,d+20),S.log(`[RowManager] Resized. Height: ${e(this,I)}px | Target Rows: ${e(this,O)}`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const f=s.querySelector(b);f&&f.querySelector("tbody")&&this.renderRows(f)})}}}})),e(this,W).observe(e(this,F)))},"#initResizeObserver"));x(this,"initTemplate",l(i=>{const t=i.querySelector("tbody.bindable")||i.querySelector("tbody");if(!t)return;const s=Array.from(t.querySelectorAll("tr")).filter(n=>!n.classList.contains("nodata"));p(this,$,s.map(n=>n.cloneNode(!0))),p(this,k,null),console.log(`[RowManager] Template initialized with ${e(this,$).length} row(s).`)},"initTemplate"));x(this,"measureAndCacheHeight",l(i=>{if(e(this,k)!==null)return e(this,k);if(e(this,$).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(a=>a.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment();e(this,$).forEach(a=>{n.appendChild(a.cloneNode(!0))}),s?s.before(n):t.appendChild(n);let o=0;if(t.querySelectorAll("tr:not(.nodata)").forEach((a,g)=>{const c=a.offsetHeight;if(c===0)throw new Error(`[RowManager] Rendered TR[${g}] height is 0. Check CSS styles.`);o+=c}),p(this,k,o),e(this,I)>0){const a=Math.ceil(e(this,I)/e(this,k));p(this,O,a+20)}return console.log(`[RowManager] Template Height Cached: ${e(this,k)}px | RowCount: ${e(this,O)}`),e(this,k)},"measureAndCacheHeight"));x(this,"renderRows",l(i=>{if(e(this,$).length===0)return;const t=i.querySelector("tbody.bindable")||i.querySelector("tbody");if(!t)return;t.querySelectorAll("tr:not(.nodata)").forEach(r=>r.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment(),o=e(this,O);for(let r=0;r<o;r++)e(this,$).forEach(a=>{n.appendChild(a.cloneNode(!0))});s?s.before(n):t.appendChild(n),console.log(`[RowManager] Rendered ${o} sets into DOM.`)},"renderRows"));x(this,"destroy",l(()=>{e(this,W)&&(e(this,W).disconnect(),p(this,W,null))},"destroy"));p(this,F,i),e(this,re).call(this)}get templateLength(){return e(this,$).length||1}};F=new WeakMap,$=new WeakMap,k=new WeakMap,W=new WeakMap,I=new WeakMap,O=new WeakMap,re=new WeakMap,oe=new WeakMap,l(Te,"RowManager");let J=Te;const Q=class Q extends HTMLElement{constructor(){super();u(this,L,null);u(this,Z);x(this,"init",l(t=>{if(!t)return;const s=l(c=>{const h=l(b=>{if(b.querySelector("colgroup"))return;const f=b.querySelector("tbody tr")||b.querySelector("tr"),R=f?f.querySelectorAll("th, td").length:1,E=document.createElement("colgroup"),_=Math.max(Math.floor((b.clientWidth||600)/R),100);for(let H=0;H<R;H++){const _e=document.createElement("col");_e.setAttribute("width",_),E.appendChild(_e)}b.prepend(E)},"ensureColgroup"),d=l(b=>{if(b.querySelector("thead"))return;const f=document.createElement("thead"),R=b.querySelector("colgroup");R?R.after(f):b.prepend(f)},"ensureThead");return h(c),d(c),c.classList.add("nine-table-element"),c},"initializeTable"),n=t.cloneNode(!0);p(this,L,s(n)),e(this,L).style.display="table",e(this,Z).initTemplate(e(this,L));const o=this.querySelector(".ng-container-left"),r=this.querySelector(".ng-container-body"),a=this.querySelector(".ng-container-right"),g=l((c,h,d=!1)=>{const b=c.cloneNode(!0),f=Array.from(b.querySelectorAll("colgroup col")),R=[];return f.forEach((E,_)=>{const H=E.getAttribute("fixed");(d?!H||H==="":H===h)||R.push(_)}),R.reverse().forEach(E=>{f[E]&&f[E].remove(),b.querySelectorAll("tr").forEach(_=>{const H=_.querySelectorAll("th, td");H[E]&&H[E].remove()})}),b},"filterTableByFixed");if(r){const c=g(e(this,L),null,!0);r.innerHTML="",r.appendChild(c),e(this,Z).measureAndCacheHeight(r)}if(o){const c=g(e(this,L),"left",!1);let h=0;c.querySelectorAll("col").forEach(b=>{const f=parseInt(b.getAttribute("width"),10);isNaN(f)||(h+=f)}),o.innerHTML="",o.appendChild(c);const d=h>0?h:0;o.style.flex=`0 0 ${d}px`,o.style.width=`${d}px`}if(a){const c=g(e(this,L),"right",!1);let h=0;c.querySelectorAll("col").forEach(b=>{const f=parseInt(b.getAttribute("width"),10);isNaN(f)||(h+=f)}),a.innerHTML="",a.appendChild(c);const d=h>0?h:0;a.style.flex=`0 0 ${d}px`,a.style.width=`${d}px`}if(r){const c=this.getRowCount();r.style.overflowY=c>10?"auto":"hidden",r.addEventListener("scroll",()=>{const h=this.querySelector("nine-table-hscrollbar");h&&typeof h.refresh=="function"&&h.refresh()})}setTimeout(()=>{const c=this.querySelector("nine-table-hscrollbar");c&&typeof c.refresh=="function"&&c.refresh()},0),S.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`)},"init"));x(this,"getRowCount",l(()=>e(this,L)?e(this,L).querySelectorAll("tbody tr").length:0,"getRowCount"));x(this,"scrollToX",l(t=>{const s=this.querySelector(".ng-container-body");s&&(s.scrollLeft=t)},"scrollToX"));x(this,"scrollToY",l(t=>{const s=this.querySelector(".ng-container-body");s&&(s.scrollTop=t)},"scrollToY"));u(this,le,l(()=>{const t=Q.SCROLLBAR_SIZE;this.innerHTML=`
64
64
  <style>
65
65
  nine-table-sheet {
66
66
  display: flex;
@@ -173,7 +173,7 @@
173
173
  <nine-table-hscrollbar></nine-table-hscrollbar>
174
174
  <div class='ng-scroll-edge'></div>
175
175
  </div>
176
- `},"#render"));p(this,Z,new G(this))}connectedCallback(){e(this,le).call(this)}disconnectedCallback(){this.innerHTML="",S.log("NineTableSheet destroyed.")}};_=new WeakMap,Z=new WeakMap,le=new WeakMap,a(Q,"NineTableSheet"),x(Q,"SCROLLBAR_SIZE",16);let pe=Q;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",pe);const qe=class qe extends HTMLElement{constructor(){super();u(this,ae,a(()=>{const t=this.querySelector(".nine-tab-bar");t&&(t.addEventListener("click",s=>{const n=s.target.closest(".nine-tab-item");if(!n)return;const o=s.ctrlKey||s.metaKey||s.shiftKey,r=parseInt(n.dataset.index,10);this.switchSheet(r,o)}),this.switchSheet(0,!1))},"#init"));x(this,"switchSheet",a((t,s=!1)=>{const n=a(()=>{const d=this.querySelector("nine-table-sheets-body");d.querySelectorAll("nine-splitter").forEach(f=>{const R=parseInt(f.dataset.splitIndex,10),E=d.querySelector(`nine-table-sheet[data-index="${R-1}"]`),M=d.querySelector(`nine-table-sheet[data-index="${R}"]`);E&&M&&E.classList.contains("active")&&M.classList.contains("active")?f.classList.add("active"):f.classList.remove("active")})},"updateSplitters"),o=this.querySelector(".nine-tab-bar"),r=this.querySelector("nine-table-sheets-body"),l=o.querySelectorAll(".nine-tab-item"),g=r.querySelectorAll("nine-table-sheet");if(!l[t])return;if(!s)l.forEach((d,b)=>{d.classList.toggle("active",b===t);const f=r.querySelector(`nine-table-sheet[data-index="${b}"]`);f&&(f.style.flex="")}),g.forEach((d,b)=>{d.classList.toggle("active",b===t)});else{const d=l[t],b=o.querySelectorAll(".nine-tab-item.active");if(d.classList.contains("active")&&b.length<=1)return;d.classList.toggle("active");const f=r.querySelector(`nine-table-sheet[data-index="${t}"]`);f&&(f.classList.toggle("active"),f.classList.contains("active")||(f.style.flex=""))}const c=Array.from(r.querySelectorAll("nine-table-sheet.active"));if(c.length>1){const d=1/c.length;c.forEach(b=>{(!b.style.flex||b.style.flex==="1 1 100%")&&(b.style.flex=`${d} ${d} 0px`)})}else c.forEach(d=>{d.style.flex="1 1 100%"});n();const h=r.querySelector("nine-table-sheet.active");if(h&&typeof h.getRowCount=="function"){const d=this.querySelector("#row-count");d&&(d.textContent=h.getRowCount().toLocaleString())}},"switchSheet"))}connectedCallback(){e(this,ae).call(this)}};ae=new WeakMap,a(qe,"NineTableSheets");let ye=qe;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ye);const ke=class ke{constructor(i){u(this,k);u(this,ee,null);u(this,ce,a(()=>{const i=e(this,k).host;i&&(p(this,ee,new ResizeObserver(t=>{for(let s of t)i.getAttribute("auto-height")==="true"&&e(this,te).call(this,i)})),e(this,ee).observe(i))},"#observeResize"));u(this,te,a(i=>{var M,L;const t=(M=i.shadowRoot)==null?void 0:M.querySelector("nine-table-sheet.active");if(!t)return;const s=((L=t.getRowCount)==null?void 0:L.call(t))||0,n=parseInt(i.getAttribute("max-display-row"),10)||10,o=Math.min(s,n),r=t.querySelector("tbody tr")||t.querySelector("tr"),l=r?r.getBoundingClientRect().height:32,g=e(this,k).querySelector("nine-table-header"),c=e(this,k).querySelector("nine-table-sheets-footer"),h=g?g.getBoundingClientRect().height:40,d=c?c.getBoundingClientRect().height:32,f=h+d+16,R=o*l+f;i.style.height=`${R}px`,i.style.maxHeight=`${n*l+f}px`;const E=e(this,k).querySelector("nine-table-sheets-body");E&&(E.style.overflowY=s>n?"auto":"hidden")},"#applyAutoHeight"));x(this,"updateSplitters",a(()=>{const i=e(this,k).querySelector("nine-table-sheets-body");if(!i)return;const t=Array.from(i.querySelectorAll("nine-table-sheet"));Array.from(i.querySelectorAll("nine-splitter.h")).forEach((n,o)=>{const r=t[o],l=t[o+1];r&&l&&r.classList.contains("active")&&l.classList.contains("active")?n.style.setProperty("display","block","important"):n.style.setProperty("display","none","important")})},"updateSplitters"));u(this,he,a(()=>{const i=e(this,k).host,s=Array.from(i.children).filter(c=>c.tagName==="TABLE"),n=i.getAttribute("auto-height")==="true",o=s.length,r=s.map((c,h)=>{const b=`<nine-table-sheet class="${h===0?"active":""}" data-index="${h}"></nine-table-sheet>`,f=h<o-1?`<nine-splitter class="h" data-split-index="${h}"></nine-splitter>`:"";return b+f}).join(""),l=s.map((c,h)=>`<div class="nine-tab-item ${h===0?"active":""}" data-index="${h}">Sheet ${h+1}</div>`).join("");e(this,k).innerHTML=`
176
+ `},"#render"));p(this,Z,new J(this))}connectedCallback(){e(this,le).call(this)}disconnectedCallback(){this.innerHTML="",S.log("NineTableSheet destroyed.")}};L=new WeakMap,Z=new WeakMap,le=new WeakMap,l(Q,"NineTableSheet"),x(Q,"SCROLLBAR_SIZE",16);let pe=Q;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",pe);const qe=class qe extends HTMLElement{constructor(){super();u(this,ae,l(()=>{const t=this.querySelector(".nine-tab-bar");t&&(t.addEventListener("click",s=>{const n=s.target.closest(".nine-tab-item");if(!n)return;const o=s.ctrlKey||s.metaKey||s.shiftKey,r=parseInt(n.dataset.index,10);this.switchSheet(r,o)}),this.switchSheet(0,!1))},"#init"));x(this,"switchSheet",l((t,s=!1)=>{const n=l(()=>{const d=this.querySelector("nine-table-sheets-body");d.querySelectorAll("nine-splitter").forEach(f=>{const R=parseInt(f.dataset.splitIndex,10),E=d.querySelector(`nine-table-sheet[data-index="${R-1}"]`),_=d.querySelector(`nine-table-sheet[data-index="${R}"]`);E&&_&&E.classList.contains("active")&&_.classList.contains("active")?f.classList.add("active"):f.classList.remove("active")})},"updateSplitters"),o=this.querySelector(".nine-tab-bar"),r=this.querySelector("nine-table-sheets-body"),a=o.querySelectorAll(".nine-tab-item"),g=r.querySelectorAll("nine-table-sheet");if(!a[t])return;if(!s)a.forEach((d,b)=>{d.classList.toggle("active",b===t);const f=r.querySelector(`nine-table-sheet[data-index="${b}"]`);f&&(f.style.flex="")}),g.forEach((d,b)=>{d.classList.toggle("active",b===t)});else{const d=a[t],b=o.querySelectorAll(".nine-tab-item.active");if(d.classList.contains("active")&&b.length<=1)return;d.classList.toggle("active");const f=r.querySelector(`nine-table-sheet[data-index="${t}"]`);f&&(f.classList.toggle("active"),f.classList.contains("active")||(f.style.flex=""))}const c=Array.from(r.querySelectorAll("nine-table-sheet.active"));if(c.length>1){const d=1/c.length;c.forEach(b=>{(!b.style.flex||b.style.flex==="1 1 100%")&&(b.style.flex=`${d} ${d} 0px`)})}else c.forEach(d=>{d.style.flex="1 1 100%"});n();const h=r.querySelector("nine-table-sheet.active");if(h&&typeof h.getRowCount=="function"){const d=this.querySelector("#row-count");d&&(d.textContent=h.getRowCount().toLocaleString())}},"switchSheet"))}connectedCallback(){e(this,ae).call(this)}};ae=new WeakMap,l(qe,"NineTableSheets");let ye=qe;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ye);const ke=class ke{constructor(i){u(this,T);u(this,ee,null);u(this,ce,l(()=>{const i=e(this,T).host;i&&(p(this,ee,new ResizeObserver(t=>{for(let s of t)i.getAttribute("auto-height")==="true"&&e(this,te).call(this,i)})),e(this,ee).observe(i))},"#observeResize"));u(this,te,l(i=>{var _;const t=e(this,T).querySelector("nine-table-sheet.active");if(!t)return;const s=((_=t.getRowCount)==null?void 0:_.call(t))||0,n=parseInt(i.getAttribute("max-display-row"),10)||10,o=Math.min(s,n),r=t.querySelector("tbody tr")||t.querySelector("tr"),a=r?r.getBoundingClientRect().height:32,g=e(this,T).querySelector("nine-table-header"),c=e(this,T).querySelector("nine-table-sheets-footer"),h=g?g.getBoundingClientRect().height:40,d=c?c.getBoundingClientRect().height:32,f=h+d+16,R=o*a+f;i.style.height=`${R}px`,i.style.maxHeight=`${n*a+f}px`;const E=e(this,T).querySelector("nine-table-sheets-body");E&&(E.style.overflowY=s>n?"auto":"hidden")},"#applyAutoHeight"));x(this,"updateSplitters",l(()=>{const i=e(this,T).querySelector("nine-table-sheets-body");if(!i)return;const t=Array.from(i.querySelectorAll("nine-table-sheet")),s=Array.from(i.querySelectorAll("nine-splitter.h"));if(t.length<=1){s.forEach(n=>n.style.setProperty("display","none","important"));return}s.forEach(n=>{n.style.setProperty("display","block","important")})},"updateSplitters"));u(this,he,l(()=>{const i=e(this,T).host,s=Array.from(i.children).filter(c=>c.tagName==="TABLE"),n=i.getAttribute("auto-height")==="true",o=s.length,r=s.map((c,h)=>{const b=`<nine-table-sheet class="${h===0?"active":""}" data-index="${h}"></nine-table-sheet>`,f=h<o-1?`<nine-splitter class="h" data-split-index="${h}"></nine-splitter>`:"";return b+f}).join(""),a=s.map((c,h)=>`<div class="nine-tab-item ${h===0?"active":""}" data-index="${h}">Sheet ${h+1}</div>`).join("");e(this,T).innerHTML=`
177
177
  <style>
178
178
  :host {
179
179
  display: flex;
@@ -216,13 +216,12 @@
216
216
  display: block !important;
217
217
  }
218
218
 
219
- /* 🎯 스플리터 기본 스타일 (JS로 직접 display 조작) */
220
219
  nine-table-sheets-body nine-splitter.h {
221
220
  width: 4px;
222
221
  background: #e5e7eb;
223
222
  cursor: col-resize;
224
223
  flex-shrink: 0;
225
- display: none;
224
+ display: ${o>1?"block":"none"};
226
225
  }
227
226
 
228
227
  nine-table-sheets-footer {
@@ -274,12 +273,12 @@
274
273
  <nine-table-sheets>
275
274
  <nine-table-sheets-body>${r}</nine-table-sheets-body>
276
275
  <nine-table-sheets-footer>
277
- <div class="nine-tab-bar">${l}</div>
276
+ <div class="nine-tab-bar">${a}</div>
278
277
  <div class="sheets-counter">Total : <span id="row-count">0</span></div>
279
278
  </nine-table-sheets-footer>
280
279
  </nine-table-sheets>
281
280
  <nine-table-analysis></nine-table-analysis>
282
281
  </nine-table-body>
283
282
  <nine-table-footer></nine-table-footer>
284
- `;const g=e(this,k).querySelectorAll("nine-table-sheet");g==null||g.forEach((c,h)=>{s[h]&&setTimeout(()=>{c.init(s[h]),n&&e(this,te).call(this,i),this.updateSplitters()})})},"#render"));p(this,k,i),e(this,he).call(this),e(this,ce).call(this)}};k=new WeakMap,ee=new WeakMap,ce=new WeakMap,te=new WeakMap,he=new WeakMap,a(ke,"LayoutManager");let we=ke;const Ae=class Ae{constructor(i){u(this,B);u(this,U,-1);x(this,"count",a(()=>e(this,B).rawRecords.length,"count"));p(this,B,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,B).owner).querySelector)==null?void 0:n.call(s,".ng-container-body"))||e(this,B).owner.body;t&&!t.querySelector(`tbody.bindable tr[data-row="${e(this,U)}"]`)&&setTimeout(()=>{var o,r;(r=(o=e(this,B).owner).scrollTo_V1)==null||r.call(o,e(this,U))})}};B=new WeakMap,U=new WeakMap,a(Ae,"ngRow");let me=Ae;const C=class C{constructor(i,t){u(this,T);u(this,v);u(this,A,[]);u(this,j,[]);u(this,de,0);u(this,N,[]);u(this,fe,a(()=>{p(this,N,[]);const i=e(this,T).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,v).rawRecords||[]).forEach(t=>{t.__ng||(t.__ng=e(this,ie).call(this)),t.__ng.height=e(this,N).slice()})},"#initialize"));x(this,"set",a(i=>{this.clear(),this.add(i,!1)},"set"));u(this,ie,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"));x(this,"reset",a(()=>{p(this,A,[]),p(this,j,[])},"reset"));x(this,"clear",a(()=>{var i;e(this,v).rawRecords=[],p(this,A,[]),p(this,j,[]),(i=e(this,v).viewRecords)!=null&&i.reset&&e(this,v).viewRecords.reset()},"clear"));u(this,ue,a(i=>{var n;Array.isArray(i)||(i=[i]);const t=typeof((n=e(this,T).fields)==null?void 0:n.get)=="function"?e(this,T).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(o=>{const r={v:[]};t.forEach(l=>{r.v.push(o[l]!==void 0&&o[l]!==null?o[l]:"")}),s.push(r)}),s},"#json2Array"));u(this,be,a(i=>(Array.isArray(i)||(i=[i]),i.forEach(t=>{t.__ng=e(this,ie).call(this),t.__ng.rowid=this.nextId,t.__ng.rowState=C.ROW_STATE.INSERT,t.__ng._[0]=t.__ng.rowid}),i),"#defaultInsert"));x(this,"add",a((i,t=!0)=>{var o;i===void 0&&(i={});const s=e(this,ue).call(this,i);e(this,v).rawRecords=e(this,v).rawRecords.concat(e(this,be).call(this,s)),this.resetRecords();const n=this.count()-1;return t||s.forEach((r,l)=>{const g=e(this,v).rawRecords[n-l];g&&(g.__ng.rowState=C.ROW_STATE.EMPTY)}),(o=e(this,v).viewRecords)!=null&&o.reset&&e(this,v).viewRecords.reset(),n},"add"));x(this,"delete",a(i=>{var s;let t=[];Array.isArray(i)?t=i:typeof i>"u"?t=[e(this,v).owner.row.at]:t=[parseInt(i,10)],t.sort((n,o)=>o-n).forEach(n=>{if(e(this,A)[n]){const o=e(this,A)[n].__ng.rowid;e(this,A)[n].__ng.rowState===C.ROW_STATE.INSERT?e(this,v).rawRecords=e(this,v).rawRecords.filter(r=>r.__ng.rowid!==o):e(this,v).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=C.ROW_STATE.DELETE)})}}),this.resetRecords(),(s=e(this,v).viewRecords)!=null&&s.reset&&e(this,v).viewRecords.reset()},"delete"));x(this,"setValue",a((i,t,s)=>{var g;i=parseInt(i,10);const o=(typeof((g=e(this,T).fields)==null?void 0:g.get)=="function"?e(this,T).fields.get():[]).indexOf(t);if(o<0)return;const r=this.getValidData()[i];if(!r)return;const l=r.v[o];l!==s&&r.__ng.rowState!==C.ROW_STATE.INSERT&&(r.__ng.o.hasOwnProperty(t)||(r.__ng.o[t]=l),r.__ng.rowState=C.ROW_STATE.UPDATE),r.v[o]=s,e(this,v).owner.refreshData&&e(this,v).owner.refreshData(i)},"setValue"));x(this,"resetRecords",a(()=>{p(this,j,e(this,v).rawRecords.filter(i=>!i.__ng.deleted)),p(this,A,e(this,v).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),e(this,v).rawRecords.forEach((i,t)=>{i.__ng.rowidx=t}),e(this,A).forEach((i,t)=>{i.__ng.i=t})},"resetRecords"));x(this,"getValidData",a(()=>(e(this,A).length===0&&e(this,v).rawRecords.length>0&&this.resetRecords(),e(this,A)),"getValidData"));u(this,J,a(i=>{var s;if(!i)return i;const t=typeof((s=e(this,T).fields)==null?void 0:s.get)=="function"?e(this,T).fields.get():[];return Array.isArray(i)?i.filter(n=>!n.__ng.deleted).map(n=>{const o={};return t.forEach((r,l)=>{o[r]=n.v?n.v[l]:n[r]}),o.__ng=n.__ng,o}):i},"#conv2"));x(this,"count",a(()=>this.getValidData().length,"count"));x(this,"get",a((i,t)=>{var o;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return e(this,J).call(this,s);if(i<0||i>=s.length)return null;const n=typeof((o=e(this,T).fields)==null?void 0:o.get)=="function"?e(this,T).fields.get():[];if(t!=null){const r=n.indexOf(t);return r>=0?s[i].v[r]:null}return e(this,J).call(this,s[i])},"get"));p(this,T,i),p(this,v,t),e(this,fe).call(this)}get source(){return e(this,J).call(this,e(this,v).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++He(this,de)._}};T=new WeakMap,v=new WeakMap,A=new WeakMap,j=new WeakMap,de=new WeakMap,N=new WeakMap,fe=new WeakMap,ie=new WeakMap,ue=new WeakMap,be=new WeakMap,J=new WeakMap,a(C,"ngData"),x(C,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ve=C;const Ce=class Ce{constructor(i){this.owner=i,this.row=new me(this),this.data=new ve(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,o;const s=parseInt(t,10);if(!(s>=this.data.count()))return(o=(n=this.data.getValidData()[s])==null?void 0:n.__ng)==null?void 0:o.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(Ce,"ngDataManager");let xe=Ce;const Le=class Le extends HTMLElement{constructor(){super();u(this,K);u(this,ge);this.attachShadow({mode:"open"}),p(this,K,new xe(this))}connectedCallback(){p(this,ge,new we(this.shadowRoot)),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,ge=new WeakMap,a(Le,"NineTable");let Se=Le;customElements.get("nine-table")||customElements.define("nine-table",Se)});
283
+ `;const g=e(this,T).querySelectorAll("nine-table-sheet");g==null||g.forEach((c,h)=>{s[h]&&setTimeout(()=>{c.init(s[h]),n&&e(this,te).call(this,i),this.updateSplitters()})})},"#render"));p(this,T,i),e(this,he).call(this),e(this,ce).call(this)}};T=new WeakMap,ee=new WeakMap,ce=new WeakMap,te=new WeakMap,he=new WeakMap,l(ke,"LayoutManager");let me=ke;const Ae=class Ae{constructor(i){u(this,B);u(this,U,-1);x(this,"count",l(()=>e(this,B).rawRecords.length,"count"));p(this,B,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,B).owner).querySelector)==null?void 0:n.call(s,".ng-container-body"))||e(this,B).owner.body;t&&!t.querySelector(`tbody.bindable tr[data-row="${e(this,U)}"]`)&&setTimeout(()=>{var o,r;(r=(o=e(this,B).owner).scrollTo_V1)==null||r.call(o,e(this,U))})}};B=new WeakMap,U=new WeakMap,l(Ae,"ngRow");let we=Ae;const C=class C{constructor(i,t){u(this,q);u(this,v);u(this,A,[]);u(this,j,[]);u(this,de,0);u(this,N,[]);u(this,fe,l(()=>{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,v).rawRecords||[]).forEach(t=>{t.__ng||(t.__ng=e(this,ie).call(this)),t.__ng.height=e(this,N).slice()})},"#initialize"));x(this,"set",l(i=>{this.clear(),this.add(i,!1)},"set"));u(this,ie,l(()=>({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"));x(this,"reset",l(()=>{p(this,A,[]),p(this,j,[])},"reset"));x(this,"clear",l(()=>{var i;e(this,v).rawRecords=[],p(this,A,[]),p(this,j,[]),(i=e(this,v).viewRecords)!=null&&i.reset&&e(this,v).viewRecords.reset()},"clear"));u(this,ue,l(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(o=>{const r={v:[]};t.forEach(a=>{r.v.push(o[a]!==void 0&&o[a]!==null?o[a]:"")}),s.push(r)}),s},"#json2Array"));u(this,be,l(i=>(Array.isArray(i)||(i=[i]),i.forEach(t=>{t.__ng=e(this,ie).call(this),t.__ng.rowid=this.nextId,t.__ng.rowState=C.ROW_STATE.INSERT,t.__ng._[0]=t.__ng.rowid}),i),"#defaultInsert"));x(this,"add",l((i,t=!0)=>{var o;i===void 0&&(i={});const s=e(this,ue).call(this,i);e(this,v).rawRecords=e(this,v).rawRecords.concat(e(this,be).call(this,s)),this.resetRecords();const n=this.count()-1;return t||s.forEach((r,a)=>{const g=e(this,v).rawRecords[n-a];g&&(g.__ng.rowState=C.ROW_STATE.EMPTY)}),(o=e(this,v).viewRecords)!=null&&o.reset&&e(this,v).viewRecords.reset(),n},"add"));x(this,"delete",l(i=>{var s;let t=[];Array.isArray(i)?t=i:typeof i>"u"?t=[e(this,v).owner.row.at]:t=[parseInt(i,10)],t.sort((n,o)=>o-n).forEach(n=>{if(e(this,A)[n]){const o=e(this,A)[n].__ng.rowid;e(this,A)[n].__ng.rowState===C.ROW_STATE.INSERT?e(this,v).rawRecords=e(this,v).rawRecords.filter(r=>r.__ng.rowid!==o):e(this,v).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=C.ROW_STATE.DELETE)})}}),this.resetRecords(),(s=e(this,v).viewRecords)!=null&&s.reset&&e(this,v).viewRecords.reset()},"delete"));x(this,"setValue",l((i,t,s)=>{var g;i=parseInt(i,10);const o=(typeof((g=e(this,q).fields)==null?void 0:g.get)=="function"?e(this,q).fields.get():[]).indexOf(t);if(o<0)return;const r=this.getValidData()[i];if(!r)return;const a=r.v[o];a!==s&&r.__ng.rowState!==C.ROW_STATE.INSERT&&(r.__ng.o.hasOwnProperty(t)||(r.__ng.o[t]=a),r.__ng.rowState=C.ROW_STATE.UPDATE),r.v[o]=s,e(this,v).owner.refreshData&&e(this,v).owner.refreshData(i)},"setValue"));x(this,"resetRecords",l(()=>{p(this,j,e(this,v).rawRecords.filter(i=>!i.__ng.deleted)),p(this,A,e(this,v).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),e(this,v).rawRecords.forEach((i,t)=>{i.__ng.rowidx=t}),e(this,A).forEach((i,t)=>{i.__ng.i=t})},"resetRecords"));x(this,"getValidData",l(()=>(e(this,A).length===0&&e(this,v).rawRecords.length>0&&this.resetRecords(),e(this,A)),"getValidData"));u(this,G,l(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 o={};return t.forEach((r,a)=>{o[r]=n.v?n.v[a]:n[r]}),o.__ng=n.__ng,o}):i},"#conv2"));x(this,"count",l(()=>this.getValidData().length,"count"));x(this,"get",l((i,t)=>{var o;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((o=e(this,q).fields)==null?void 0:o.get)=="function"?e(this,q).fields.get():[];if(t!=null){const r=n.indexOf(t);return r>=0?s[i].v[r]:null}return e(this,G).call(this,s[i])},"get"));p(this,q,i),p(this,v,t),e(this,fe).call(this)}get source(){return e(this,G).call(this,e(this,v).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++He(this,de)._}};q=new WeakMap,v=new WeakMap,A=new WeakMap,j=new WeakMap,de=new WeakMap,N=new WeakMap,fe=new WeakMap,ie=new WeakMap,ue=new WeakMap,be=new WeakMap,G=new WeakMap,l(C,"ngData"),x(C,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ve=C;const Ce=class Ce{constructor(i){this.owner=i,this.row=new we(this),this.data=new ve(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,o;const s=parseInt(t,10);if(!(s>=this.data.count()))return(o=(n=this.data.getValidData()[s])==null?void 0:n.__ng)==null?void 0:o.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([])}};l(Ce,"ngDataManager");let xe=Ce;const Le=class Le extends HTMLElement{constructor(){super();u(this,K);u(this,ge);this.attachShadow({mode:"open"}),p(this,K,new xe(this))}connectedCallback(){p(this,ge,new me(this.shadowRoot)),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,ge=new WeakMap,l(Le,"NineTable");let Se=Le;customElements.get("nine-table")||customElements.define("nine-table",Se)});
285
284
  //# sourceMappingURL=nine-table.umd.js.map