@ninebone/table 0.0.199 β†’ 0.0.200

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 Me=Object.defineProperty;var He=m=>{throw TypeError(m)};var We=(m,y,S)=>y in m?Me(m,y,{enumerable:!0,configurable:!0,writable:!0,value:S}):m[y]=S;var a=(m,y)=>Me(m,"name",{value:y,configurable:!0});var x=(m,y,S)=>We(m,typeof y!="symbol"?y+"":y,S),Ie=(m,y,S)=>y.has(m)||He("Cannot "+S);var e=(m,y,S)=>(Ie(m,y,"read from private field"),S?S.call(m):y.get(m)),d=(m,y,S)=>y.has(m)?He("Cannot add the same private member more than once"):y instanceof WeakSet?y.add(m):y.set(m,S),p=(m,y,S,W)=>(Ie(m,y,"write to private field"),W?W.call(m,S):y.set(m,S),S);var $e=(m,y,S,W)=>({set _(J){p(m,y,J,S)},get _(){return e(m,y,W)}});var _,B,w,P,V,X,ne,Y,re,F,M,A,z,H,I,oe,le,C,U,ae,ce,ee,E,he,te,de,O,K,q,v,k,j,fe,D,ue,ie,be,ge,G,Z,pe;const Re=class Re extends m.trace.constructor{constructor(){super(),this.init("nine-table","green")}};a(Re,"Trace");let y=Re;const S=new y,Ee=class Ee extends HTMLElement{constructor(){super();d(this,_);d(this,B,!1);d(this,w);d(this,P);d(this,V);d(this,X);d(this,ne,a(()=>{if(!e(this,_))return;const t=e(this,_).querySelector(".ng-container-body");t&&(p(this,X,new ResizeObserver(()=>{this.refresh()})),e(this,X).observe(t))},"#observeResize"));x(this,"refresh",a(()=>{if(!e(this,_)||!e(this,w)||e(this,B))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,u=s.scrollWidth;if(c!==0&&u>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/u),l),20);r.style.width=`${h}px`;let f=0;const b=s.style.transform;if(b&&b.includes("translateX")){const R=b.match(/translateX\(([-\d.]+)px\)/);R&&R[1]&&(f=parseFloat(R[1]))}else f=parseInt(s.style.left||0,10);let g=parseInt(Math.abs(f)*l/u,10);g<0&&(g=0);const T=l-h;g>T&&(g=T),r.style.left=`${g}px`,e(this,w).left.disabled=g===0,e(this,w).right.disabled=g>=T-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 u=r.width-o;c>u&&(c=u),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>=u-1;const l=s.clientWidth,h=n.scrollWidth;let f=u>0?-c*(h-l)/u:0;return-f>h-l&&(f=-(h-l)),-f+5>h-l&&(f=-(h-l)),l>=h&&(f=0),n.style.transform=`translateX(${f}px)`,c>0&&c<u-1},"#thumbMoveTo"));d(this,re,a(()=>{const t=a(n=>{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+n),p(this,P,setInterval(()=>{clearInterval(e(this,P)),p(this,V,setInterval(()=>{const o=parseInt(e(this,w).thumb.style.left||0,10);e(this,Y).call(this,o+n)||clearInterval(e(this,V))},50))},500))},"delayScroll"),s=a(()=>{clearInterval(e(this,P)),clearInterval(e(this,V))},"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,B,!0),this.shiftX=n.clientX-e(this,w).thumb.getBoundingClientRect().left;const r=a(c=>{if(!e(this,B))return;const u=e(this,w).track.getBoundingClientRect();e(this,Y).call(this,c.clientX-u.left-this.shiftX)},"onMouseMove"),o=a(()=>{p(this,B,!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(p,g){typeof exports=="object"&&typeof module<"u"?g(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],g):(p=typeof globalThis<"u"?globalThis:p||self,g(p.NineboneUtil))})(this,function(p){"use strict";var Me=Object.defineProperty;var He=p=>{throw TypeError(p)};var We=(p,g,R)=>g in p?Me(p,g,{enumerable:!0,configurable:!0,writable:!0,value:R}):p[g]=R;var a=(p,g)=>Me(p,"name",{value:g,configurable:!0});var x=(p,g,R)=>We(p,typeof g!="symbol"?g+"":g,R),Ie=(p,g,R)=>g.has(p)||He("Cannot "+R);var e=(p,g,R)=>(Ie(p,g,"read from private field"),R?R.call(p):g.get(p)),c=(p,g,R)=>g.has(p)?He("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(p):g.set(p,R),b=(p,g,R,W)=>(Ie(p,g,"write to private field"),W?W.call(p,R):g.set(p,R),R);var $e=(p,g,R,W)=>({set _(G){b(p,g,G,R)},get _(){return e(p,g,W)}});var _,N,y,B,P,V,ne,X,re,Y,M,E,z,H,I,oe,le,L,F,ae,he,Q,S,ce,ee,de,O,U,T,m,k,Z,fe,D,ue,te,be,ge,j,K,pe;const Se=class Se extends p.trace.constructor{constructor(){super(),this.init("nine-table","green")}};a(Se,"Trace");let g=Se;const R=new g,Ee=class Ee extends HTMLElement{constructor(){super();c(this,_);c(this,N,!1);c(this,y);c(this,B);c(this,P);c(this,V);c(this,ne,a(()=>{if(!e(this,_))return;const t=e(this,_).querySelector(".ng-container-body");t&&(b(this,V,new ResizeObserver(()=>{this.refresh()})),e(this,V).observe(t))},"#observeResize"));x(this,"refresh",a(()=>{if(!e(this,_)||!e(this,y)||e(this,N))return;const t=e(this,y).container,s=t.querySelector("table");if(!s)return;const n=e(this,y).track,r=e(this,y).thumb,o=e(this,_).querySelector(".ng-container-bottom"),h=t.clientWidth,f=s.scrollWidth;if(h!==0&&f>h)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=n.clientWidth;if(l<=0)return;const u=Math.max(Math.min(l*(h/f),l),20);r.style.width=`${u}px`;let d=0;const v=s.style.transform;if(v&&v.includes("translateX")){const q=v.match(/translateX\(([-\d.]+)px\)/);q&&q[1]&&(d=parseFloat(q[1]))}else d=parseInt(s.style.left||0,10);let w=parseInt(Math.abs(d)*l/f,10);w<0&&(w=0);const C=l-u;w>C&&(w=C),r.style.left=`${w}px`,e(this,y).left.disabled=w===0,e(this,y).right.disabled=w>=C-1},"refresh"));c(this,X,a(t=>{if(!e(this,y))return!1;const s=e(this,y).container,n=s.querySelector("table");if(!n)return!1;const r=e(this,y).track.getBoundingClientRect(),o=e(this,y).thumb.clientWidth;let h=t;h<0&&(h=0);const f=r.width-o;h>f&&(h=f),h=parseInt(h,10),e(this,y).thumb.style.left=`${h}px`,e(this,y).left.disabled=h===0,e(this,y).right.disabled=h>=f-1;const l=s.clientWidth,u=n.scrollWidth;let d=f>0?-h*(u-l)/f:0;return-d>u-l&&(d=-(u-l)),-d+5>u-l&&(d=-(u-l)),l>=u&&(d=0),n.style.transform=`translateX(${d}px)`,h>0&&h<f-1},"#thumbMoveTo"));c(this,re,a(()=>{const t=a(n=>{clearInterval(e(this,B)),clearInterval(e(this,P));const r=parseInt(e(this,y).thumb.style.left||0,10);e(this,X).call(this,r+n),b(this,B,setInterval(()=>{clearInterval(e(this,B)),b(this,P,setInterval(()=>{const o=parseInt(e(this,y).thumb.style.left||0,10);e(this,X).call(this,o+n)||clearInterval(e(this,P))},50))},500))},"delayScroll"),s=a(()=>{clearInterval(e(this,B)),clearInterval(e(this,P))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{e(this,y).left.addEventListener(n,s),e(this,y).right.addEventListener(n,s),e(this,y).track.addEventListener(n,s)}),e(this,y).left.addEventListener("mousedown",n=>{n.button===0&&t(-20)}),e(this,y).right.addEventListener("mousedown",n=>{n.button===0&&t(20)}),e(this,y).left.addEventListener("touchstart",()=>t(-20)),e(this,y).right.addEventListener("touchstart",()=>t(20)),e(this,y).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const r=e(this,y).track.getBoundingClientRect(),o=e(this,y).thumb.clientWidth;e(this,X).call(this,n.clientX-r.left-o/2)}),e(this,y).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),b(this,N,!0),this.shiftX=n.clientX-e(this,y).thumb.getBoundingClientRect().left;const r=a(h=>{if(!e(this,N))return;const f=e(this,y).track.getBoundingClientRect();e(this,X).call(this,h.clientX-f.left-this.shiftX)},"onMouseMove"),o=a(()=>{b(this,N,!1),s(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(b(this,_,this.closest("nine-table-sheet")||this.getRootNode().host),!e(this,_))return;this.innerHTML=`
2
2
  <style>
3
3
  nine-table-hscrollbar {
4
4
  display: flex;
@@ -60,7 +60,7 @@
60
60
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
61
61
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
62
62
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
63
- `;const 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,re).call(this),e(this,ne).call(this),this.refresh()},"initWhenReady");t()}disconnectedCallback(){e(this,X)&&e(this,X).disconnect()}};_=new WeakMap,B=new WeakMap,w=new WeakMap,P=new WeakMap,V=new WeakMap,X=new WeakMap,ne=new WeakMap,Y=new WeakMap,re=new WeakMap,a(Ee,"NineTableHScrollBar");let W=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",W);const Te=class Te{constructor(i){d(this,F);d(this,M,[]);d(this,A,null);d(this,z,null);d(this,H,0);d(this,I,0);x(this,"getRowHeight",a(()=>e(this,A),"getRowHeight"));d(this,oe,a(()=>{e(this,le).call(this)},"#init"));d(this,le,a(()=>{!e(this,F)||!(e(this,F)instanceof HTMLElement)||(p(this,z,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,u=c.querySelector("thead"),l=c.querySelector("tfoot");u&&(o+=u.offsetHeight||u.getBoundingClientRect().height),l&&(o+=l.offsetHeight||l.getBoundingClientRect().height);const h=Math.max(r-o,100);if(e(this,H)!==h&&(p(this,H,h),e(this,A)!==null)){const f=Math.ceil(e(this,H)/e(this,A));p(this,I,f+20),S.log(`[RowManager] Resized. Height: ${e(this,H)}px | Target Rows: ${e(this,I)}`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const g=s.querySelector(b);g&&g.querySelector("tbody")&&this.renderRows(g)})}}}})),e(this,z).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,M,s.map(n=>n.cloneNode(!0))),p(this,A,null),console.log(`[RowManager] Template initialized with ${e(this,M).length} row(s).`)},"initTemplate"));x(this,"measureAndCacheHeight",a(i=>{if(e(this,A)!==null&&e(this,A)>0)return e(this,A);if(e(this,M).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(f=>f.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment();e(this,M).forEach(f=>{n.appendChild(f.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:"",u=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;if(t.querySelectorAll("tr:not(.nodata)").forEach((f,b)=>{const g=f.offsetHeight||f.getBoundingClientRect().height;g===0?l+=40:l+=g}),r&&(r.style.display=o,r.style.visibility=c,r.style.position=u),p(this,A,l),e(this,H)>0){const f=Math.ceil(e(this,H)/e(this,A));p(this,I,f+20)}else p(this,I,40);return console.log(`[RowManager] Template Height Cached: ${e(this,A)}px | RowCount: ${e(this,I)}`),e(this,A)},"measureAndCacheHeight"));x(this,"renderRows",a(i=>{if(e(this,M).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,M).forEach(c=>{n.appendChild(c.cloneNode(!0))});s?s.before(n):t.appendChild(n),console.log(`[RowManager] Rendered ${r} sets into DOM.`)},"renderRows"));x(this,"destroy",a(()=>{e(this,z)&&(e(this,z).disconnect(),p(this,z,null))},"destroy"));p(this,F,i),e(this,oe).call(this)}get templateLength(){return e(this,M).length||1}};F=new WeakMap,M=new WeakMap,A=new WeakMap,z=new WeakMap,H=new WeakMap,I=new WeakMap,oe=new WeakMap,le=new WeakMap,a(Te,"RowManager");let J=Te;const Q=class Q extends HTMLElement{constructor(){super();d(this,C,null);d(this,U);x(this,"init",a(t=>{if(!t)return;const s=a(l=>{const h=a(b=>{if(b.querySelector("colgroup"))return;const g=b.querySelector("tbody tr")||b.querySelector("tr"),T=g?g.querySelectorAll("th, td").length:1,R=document.createElement("colgroup"),N=Math.max(Math.floor((b.clientWidth||600)/T),100);for(let $=0;$<T;$++){const _e=document.createElement("col");_e.setAttribute("width",N),R.appendChild(_e)}b.prepend(R)},"ensureColgroup"),f=a(b=>{if(b.querySelector("thead"))return;const g=document.createElement("thead"),T=b.querySelector("colgroup");T?T.after(g):b.prepend(g)},"ensureThead");return h(l),f(l),l.classList.add("nine-table-element"),l},"initializeTable"),n=t.cloneNode(!0);p(this,C,s(n)),e(this,C).style.display="table",e(this,U).initTemplate(e(this,C));const r=this.querySelector(".ng-container-left"),o=this.querySelector(".ng-container-body"),c=this.querySelector(".ng-container-right"),u=a((l,h,f=!1)=>{const b=l.cloneNode(!0),g=Array.from(b.querySelectorAll("colgroup col")),T=[];return g.forEach((R,N)=>{const $=R.getAttribute("fixed");(f?$!=="left"&&$!=="right":$===h)||T.push(N)}),T.reverse().forEach(R=>{g[R]&&g[R].remove(),b.querySelectorAll("tr").forEach(N=>{const $=N.querySelectorAll("th, td");$[R]&&$[R].remove()})}),b},"filterTableByFixed");if(o){const l=u(e(this,C),null,!0);o.innerHTML="",o.appendChild(l),e(this,U).measureAndCacheHeight(o)}if(r){const l=u(e(this,C),"left",!1);let h=0;l.querySelectorAll("col").forEach(b=>{const g=parseInt(b.getAttribute("width"),10);isNaN(g)||(h+=g)}),r.innerHTML="",r.appendChild(l);const f=h>0?h:0;r.style.flex=`0 0 ${f}px`,r.style.width=`${f}px`}if(c){const l=u(e(this,C),"right",!1);let h=0;l.querySelectorAll("col").forEach(b=>{const g=parseInt(b.getAttribute("width"),10);isNaN(g)||(h+=g)}),c.innerHTML="",c.appendChild(l);const f=h>0?h:0;c.style.flex=`0 0 ${f}px`,c.style.width=`${f}px`}if(o){const l=this.getRowCount();o.style.overflowY=l>10?"auto":"hidden",o.addEventListener("scroll",()=>{const h=this.querySelector("nine-table-hscrollbar");h&&typeof h.refresh=="function"&&h.refresh()})}setTimeout(()=>{const l=this.querySelector("nine-table-hscrollbar");l&&typeof l.refresh=="function"&&l.refresh()},0),S.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`)},"init"));x(this,"getRowHeight",a(()=>e(this,U).getRowHeight(),"getRowHeight"));x(this,"getRowCount",a(()=>e(this,C)?e(this,C).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"));d(this,ae,a(()=>{const t=Q.SCROLLBAR_SIZE;this.innerHTML=`
63
+ `;const t=a(()=>{const s=e(this,_).querySelector(".ng-container-body");if(!s){setTimeout(t,10);return}b(this,y,{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,re).call(this),e(this,ne).call(this),this.refresh()},"initWhenReady");t()}disconnectedCallback(){e(this,V)&&e(this,V).disconnect()}};_=new WeakMap,N=new WeakMap,y=new WeakMap,B=new WeakMap,P=new WeakMap,V=new WeakMap,ne=new WeakMap,X=new WeakMap,re=new WeakMap,a(Ee,"NineTableHScrollBar");let W=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",W);const Te=class Te{constructor(i){c(this,Y);c(this,M,[]);c(this,E,null);c(this,z,null);c(this,H,0);c(this,I,0);x(this,"getRowHeight",a(()=>e(this,E),"getRowHeight"));c(this,oe,a(()=>{e(this,le).call(this)},"#init"));c(this,le,a(()=>{!e(this,Y)||!(e(this,Y)instanceof HTMLElement)||(b(this,z,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 h=s.querySelector(".ng-container-body")||s,f=h.querySelector("thead"),l=h.querySelector("tfoot");f&&(o+=f.offsetHeight||f.getBoundingClientRect().height),l&&(o+=l.offsetHeight||l.getBoundingClientRect().height);const u=Math.max(r-o,100);if(e(this,H)!==u&&(b(this,H,u),e(this,E)!==null)){const d=Math.ceil(e(this,H)/e(this,E));b(this,I,d+20),R.log(`[RowManager] Resized. Height: ${e(this,H)}px | Target Rows: ${e(this,I)}`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(v=>{const w=s.querySelector(v);w&&w.querySelector("tbody")&&this.renderRows(w)})}}}})),e(this,z).observe(e(this,Y)))},"#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"));b(this,M,s.map(n=>n.cloneNode(!0))),b(this,E,null),console.log(`[RowManager] Template initialized with ${e(this,M).length} row(s).`)},"initTemplate"));x(this,"measureAndCacheHeight",a(i=>{if(e(this,E)!==null&&e(this,E)>0)return e(this,E);if(e(this,M).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(d=>d.remove());const s=t.querySelector("tr.nodata"),n=document.createDocumentFragment();e(this,M).forEach(d=>{n.appendChild(d.cloneNode(!0))}),s?s.before(n):t.appendChild(n);const r=i.closest("nine-table-sheet"),o=r?r.style.display:"",h=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;if(t.querySelectorAll("tr:not(.nodata)").forEach((d,v)=>{const w=d.offsetHeight||d.getBoundingClientRect().height;w===0?l+=40:l+=w}),r&&(r.style.display=o,r.style.visibility=h,r.style.position=f),b(this,E,l),e(this,H)>0){const d=Math.ceil(e(this,H)/e(this,E));b(this,I,d+20)}else b(this,I,40);return console.log(`[RowManager] Template Height Cached: ${e(this,E)}px | RowCount: ${e(this,I)}`),e(this,E)},"measureAndCacheHeight"));x(this,"renderRows",a(i=>{if(e(this,M).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,M).forEach(h=>{n.appendChild(h.cloneNode(!0))});s?s.before(n):t.appendChild(n),console.log(`[RowManager] Rendered ${r} sets into DOM.`)},"renderRows"));x(this,"destroy",a(()=>{e(this,z)&&(e(this,z).disconnect(),b(this,z,null))},"destroy"));b(this,Y,i),e(this,oe).call(this)}get templateLength(){return e(this,M).length||1}};Y=new WeakMap,M=new WeakMap,E=new WeakMap,z=new WeakMap,H=new WeakMap,I=new WeakMap,oe=new WeakMap,le=new WeakMap,a(Te,"RowManager");let G=Te;const J=class J extends HTMLElement{constructor(){super();c(this,L,null);c(this,F);x(this,"init",a(t=>{if(!t)return;const s=a(l=>{const u=a(v=>{if(v.querySelector("colgroup"))return;const w=v.querySelector("tbody tr")||v.querySelector("tr"),C=w?w.querySelectorAll("th, td").length:1,q=document.createElement("colgroup"),ie=Math.max(Math.floor((v.clientWidth||600)/C),100);for(let $=0;$<C;$++){const _e=document.createElement("col");_e.setAttribute("width",ie),q.appendChild(_e)}v.prepend(q)},"ensureColgroup"),d=a(v=>{if(v.querySelector("thead"))return;const w=document.createElement("thead"),C=v.querySelector("colgroup");C?C.after(w):v.prepend(w)},"ensureThead");return u(l),d(l),l.classList.add("nine-table-element"),l},"initializeTable"),n=t.cloneNode(!0);b(this,L,s(n)),e(this,L).style.display="table",e(this,F).initTemplate(e(this,L));const r=this.querySelector(".ng-container-left"),o=this.querySelector(".ng-container-body"),h=this.querySelector(".ng-container-right"),f=a((l,u,d=!1)=>{const v=l.cloneNode(!0),w=Array.from(v.querySelectorAll("colgroup col")),C=[];return w.forEach((q,ie)=>{const $=q.getAttribute("fixed");(d?$!=="left"&&$!=="right":$===u)||C.push(ie)}),C.reverse().forEach(q=>{w[q]&&w[q].remove(),v.querySelectorAll("tr").forEach(ie=>{const $=ie.querySelectorAll("th, td");$[q]&&$[q].remove()})}),v},"filterTableByFixed");if(o){const l=f(e(this,L),null,!0);o.innerHTML="",o.appendChild(l),e(this,F).measureAndCacheHeight(o)}if(r){const l=f(e(this,L),"left",!1);let u=0;l.querySelectorAll("col").forEach(v=>{const w=parseInt(v.getAttribute("width"),10);isNaN(w)||(u+=w)}),r.innerHTML="",r.appendChild(l);const d=u>0?u:0;r.style.flex=`0 0 ${d}px`,r.style.width=`${d}px`}if(h){const l=f(e(this,L),"right",!1);let u=0;l.querySelectorAll("col").forEach(v=>{const w=parseInt(v.getAttribute("width"),10);isNaN(w)||(u+=w)}),h.innerHTML="",h.appendChild(l);const d=u>0?u:0;h.style.flex=`0 0 ${d}px`,h.style.width=`${d}px`}if(o){const l=this.getRowCount();o.style.overflowY=l>10?"auto":"hidden",o.addEventListener("scroll",()=>{const u=this.querySelector("nine-table-hscrollbar");u&&typeof u.refresh=="function"&&u.refresh()})}setTimeout(()=>{const l=this.querySelector("nine-table-hscrollbar");l&&typeof l.refresh=="function"&&l.refresh()},0),R.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`)},"init"));x(this,"getRowHeight",a(()=>e(this,F).getRowHeight(),"getRowHeight"));x(this,"getRowCount",a(()=>e(this,L)?e(this,L).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"));c(this,ae,a(()=>{const t=J.SCROLLBAR_SIZE;this.innerHTML=`
64
64
  <style>
65
65
  nine-table-sheet {
66
66
  flex-direction: column;
@@ -160,6 +160,19 @@
160
160
  font-weight: 600;
161
161
  text-align: left;
162
162
  }
163
+
164
+ nine-splitter {
165
+ display: none;
166
+ }
167
+
168
+ /*
169
+ 🎯 [핡심 CSS]
170
+ μžμ‹ (nine-splitter) λ°”λ‘œ λ‹€μŒμ— μ˜€λŠ” μ‹œνŠΈ(.active)κ°€ 켜져 있고,
171
+ κ·Έ μŠ€ν”Œλ¦¬ν„° λ°”λ‘œ μ•žμ— μžˆλŠ” μ‹œνŠΈ(.active)도 켜져 μžˆμ„ λ•Œλ§Œ display: block
172
+ */
173
+ nine-table-sheet.active + nine-splitter + nine-table-sheet.active {
174
+ display: flex;
175
+ }
163
176
  </style>
164
177
 
165
178
  <div class='ng-container-top'>
@@ -172,7 +185,7 @@
172
185
  <nine-table-hscrollbar></nine-table-hscrollbar>
173
186
  <div class='ng-scroll-edge'></div>
174
187
  </div>
175
- `},"#render"));p(this,U,new J(this))}connectedCallback(){e(this,ae).call(this)}disconnectedCallback(){this.innerHTML="",S.log("NineTableSheet destroyed.")}};C=new WeakMap,U=new WeakMap,ae=new WeakMap,a(Q,"NineTableSheet"),x(Q,"SCROLLBAR_SIZE",16);let se=Q;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",se);const Ae=class Ae extends HTMLElement{constructor(){super();d(this,ce,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,ee).call(this,r,n)}),e(this,ee).call(this,0,!1)},"#init"));d(this,ee,a((t,s=!1)=>{const n=a(()=>{const h=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=h.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const T=parseInt(g.getAttribute("data-index"),10),R=this.querySelector(`nine-splitter[data-split-index="${T}"]`),N=h[T+1];R&&N&&N.classList.contains("active")&&R.style.setProperty("display","block")})},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),c=r.querySelectorAll(".nine-tab-item"),u=o.querySelectorAll("nine-table-sheet");if(!c[t])return;if(!s)c.forEach((h,f)=>{h.classList.toggle("active",f===t)}),u.forEach((h,f)=>{const b=f===t;h.classList.toggle("active",b),h.style.flex=b?"1 1 100%":""});else{const h=c[t],f=r.querySelectorAll(".nine-tab-item.active");if(h.classList.contains("active")&&f.length<=1)return;h.classList.toggle("active");const b=o.querySelector(`nine-table-sheet[data-index="${t}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=Array.from(o.querySelectorAll("nine-table-sheet.active"));l.length>1?l.forEach(h=>{h.style.flex="1 1 0%"}):l.forEach(h=>{h.style.flex="1 1 100%"}),n()},"#switchSheet"))}connectedCallback(){e(this,ce).call(this)}};ce=new WeakMap,ee=new WeakMap,a(Ae,"NineTableSheets");let ye=Ae;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ye);const qe=class qe{constructor(i){d(this,E);d(this,he,a(()=>{e(this,de).call(this),new ResizeObserver(i=>{for(let t of i)e(this,E).getAttribute("auto-height")==="true"&&e(this,te).call(this)}).observe(e(this,E))},"#init"));d(this,te,a(()=>{var u,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=(u=e(this,E).shadowRoot.querySelector("nine-table-header"))==null?void 0:u.getBoundingClientRect().height,r=(l=e(this,E).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=se.SCROLLBAR_SIZE,c=t*s+n+r+o;e(this,E).style.height=`${c}px`},"#applyAutoHeight"));d(this,de,a(()=>{const t=Array.from(e(this,E).children).filter(u=>u.tagName==="TABLE"),s=e(this,E).getAttribute("auto-height")==="true",n=t.length,r=t.map((u,l)=>{const f=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return f+b}).join(""),o=t.map((u,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");e(this,E).shadowRoot.innerHTML=`
188
+ `},"#render"));b(this,F,new G(this))}connectedCallback(){e(this,ae).call(this)}disconnectedCallback(){this.innerHTML="",R.log("NineTableSheet destroyed.")}};L=new WeakMap,F=new WeakMap,ae=new WeakMap,a(J,"NineTableSheet"),x(J,"SCROLLBAR_SIZE",16);let se=J;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",se);const ke=class ke extends HTMLElement{constructor(){super();c(this,he,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,Q).call(this,r,n)}),e(this,Q).call(this,0,!1)},"#init"));c(this,Q,a((t,s=!1)=>{var f;const n=this.querySelector(".nine-tab-bar"),r=this.querySelector("nine-table-sheets-body"),o=n.querySelectorAll(".nine-tab-item"),h=r.querySelectorAll("nine-table-sheet");if(o[t]){if(!s)o.forEach((l,u)=>{l.classList.toggle("active",u===t)}),h.forEach((l,u)=>{const d=u===t;l.classList.toggle("active",d),l.style.flex=d?"1 1 100%":""});else{const l=o[t],u=n.querySelectorAll(".nine-tab-item.active");if(l.classList.contains("active")&&u.length<=1)return;l.classList.toggle("active");const d=r.querySelector(`nine-table-sheet[data-index="${t}"]`);d&&(d.classList.toggle("active"),d.classList.contains("active")||(d.style.flex=""))}(f=r.querySelectorAll("nine-table-sheet.active"))==null||f.forEach(l=>{l.style.flex=activeSheets.length>1?"1 1 0%":"1 1 100%"})}},"#switchSheet"))}connectedCallback(){e(this,he).call(this)}};he=new WeakMap,Q=new WeakMap,a(ke,"NineTableSheets");let ye=ke;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ye);const qe=class qe{constructor(i){c(this,S);c(this,ce,a(()=>{e(this,de).call(this),new ResizeObserver(i=>{for(let t of i)e(this,S).getAttribute("auto-height")==="true"&&e(this,ee).call(this)}).observe(e(this,S))},"#init"));c(this,ee,a(()=>{var f,l;const i=Array.from(e(this,S).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const t=parseInt(e(this,S).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(u=>u.getRowHeight())),n=(f=e(this,S).shadowRoot.querySelector("nine-table-header"))==null?void 0:f.getBoundingClientRect().height,r=(l=e(this,S).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=se.SCROLLBAR_SIZE,h=t*s+n+r+o;e(this,S).style.height=`${h}px`},"#applyAutoHeight"));c(this,de,a(()=>{const t=Array.from(e(this,S).children).filter(f=>f.tagName==="TABLE"),s=e(this,S).getAttribute("auto-height")==="true",n=t.length,r=t.map((f,l)=>{const d=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,v=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return d+v}).join(""),o=t.map((f,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");e(this,S).shadowRoot.innerHTML=`
176
189
  <style>
177
190
  :host {
178
191
  display: flex;
@@ -270,5 +283,5 @@
270
283
  <nine-table-analysis></nine-table-analysis>
271
284
  </nine-table-body>
272
285
  <nine-table-footer></nine-table-footer>
273
- `;const c=e(this,E).shadowRoot.querySelectorAll("nine-table-sheet");c==null||c.forEach((u,l)=>{t[l]&&setTimeout(()=>{u.init(t[l]),s&&e(this,te).call(this)})})},"#render"));p(this,E,i),e(this,he).call(this)}};E=new WeakMap,he=new WeakMap,te=new WeakMap,de=new WeakMap,a(qe,"LayoutManager");let me=qe;const ke=class ke{constructor(i){d(this,O);d(this,K,-1);x(this,"count",a(()=>e(this,O).rawRecords.length,"count"));p(this,O,i)}get at(){return e(this,K)}set at(i){var s,n;p(this,K,parseInt(i,10));const t=((n=(s=e(this,O).owner).querySelector)==null?void 0:n.call(s,".ng-container-body"))||e(this,O).owner.body;t&&!t.querySelector(`tbody.bindable tr[data-row="${e(this,K)}"]`)&&setTimeout(()=>{var r,o;(o=(r=e(this,O).owner).scrollTo_V1)==null||o.call(r,e(this,K))})}};O=new WeakMap,K=new WeakMap,a(ke,"ngRow");let we=ke;const L=class L{constructor(i,t){d(this,q);d(this,v);d(this,k,[]);d(this,j,[]);d(this,fe,0);d(this,D,[]);d(this,ue,a(()=>{p(this,D,[]);const i=e(this,q).template||[];Array.from(i).forEach(t=>{var s;e(this,D).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,D).slice()})},"#initialize"));x(this,"set",a(i=>{this.clear(),this.add(i,!1)},"set"));d(this,ie,a(()=>({rowState:L.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:e(this,D).slice(),o:{},c:{},_:[0,0,0,0,L.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,e(this,D).slice(),-1,{},{}]}),"#getDefaultMeta"));x(this,"reset",a(()=>{p(this,k,[]),p(this,j,[])},"reset"));x(this,"clear",a(()=>{var i;e(this,v).rawRecords=[],p(this,k,[]),p(this,j,[]),(i=e(this,v).viewRecords)!=null&&i.reset&&e(this,v).viewRecords.reset()},"clear"));d(this,be,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,ge,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=L.ROW_STATE.INSERT,t.__ng._[0]=t.__ng.rowid}),i),"#defaultInsert"));x(this,"add",a((i,t=!0)=>{var r;i===void 0&&(i={});const s=e(this,be).call(this,i);e(this,v).rawRecords=e(this,v).rawRecords.concat(e(this,ge).call(this,s)),this.resetRecords();const n=this.count()-1;return t||s.forEach((o,c)=>{const u=e(this,v).rawRecords[n-c];u&&(u.__ng.rowState=L.ROW_STATE.EMPTY)}),(r=e(this,v).viewRecords)!=null&&r.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,r)=>r-n).forEach(n=>{if(e(this,k)[n]){const r=e(this,k)[n].__ng.rowid;e(this,k)[n].__ng.rowState===L.ROW_STATE.INSERT?e(this,v).rawRecords=e(this,v).rawRecords.filter(o=>o.__ng.rowid!==r):e(this,v).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=L.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 u;i=parseInt(i,10);const r=(typeof((u=e(this,q).fields)==null?void 0:u.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!==L.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(t)||(o.__ng.o[t]=c),o.__ng.rowState=L.ROW_STATE.UPDATE),o.v[r]=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,k,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,k).forEach((i,t)=>{i.__ng.i=t})},"resetRecords"));x(this,"getValidData",a(()=>(e(this,k).length===0&&e(this,v).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"));x(this,"count",a(()=>this.getValidData().length,"count"));x(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,v,t),e(this,ue).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++$e(this,fe)._}get length(){return e(this,k).length}getRowCount(){return this.length}};q=new WeakMap,v=new WeakMap,k=new WeakMap,j=new WeakMap,fe=new WeakMap,D=new WeakMap,ue=new WeakMap,ie=new WeakMap,be=new WeakMap,ge=new WeakMap,G=new WeakMap,a(L,"ngData"),x(L,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ve=L;const Le=class Le{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,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(Le,"ngDataManager");let xe=Le;const Ce=class Ce extends HTMLElement{constructor(){super();d(this,Z);d(this,pe);this.attachShadow({mode:"open"}),p(this,Z,new xe(this))}connectedCallback(){p(this,pe,new me(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,Z).data}get row(){return e(this,Z).row}get dataManager(){return e(this,Z)}};Z=new WeakMap,pe=new WeakMap,a(Ce,"NineTable");let Se=Ce;customElements.get("nine-table")||customElements.define("nine-table",Se)});
286
+ `;const h=e(this,S).shadowRoot.querySelectorAll("nine-table-sheet");h==null||h.forEach((f,l)=>{t[l]&&setTimeout(()=>{f.init(t[l]),s&&e(this,ee).call(this)})})},"#render"));b(this,S,i),e(this,ce).call(this)}};S=new WeakMap,ce=new WeakMap,ee=new WeakMap,de=new WeakMap,a(qe,"LayoutManager");let we=qe;const Ae=class Ae{constructor(i){c(this,O);c(this,U,-1);x(this,"count",a(()=>e(this,O).rawRecords.length,"count"));b(this,O,i)}get at(){return e(this,U)}set at(i){var s,n;b(this,U,parseInt(i,10));const t=((n=(s=e(this,O).owner).querySelector)==null?void 0:n.call(s,".ng-container-body"))||e(this,O).owner.body;t&&!t.querySelector(`tbody.bindable tr[data-row="${e(this,U)}"]`)&&setTimeout(()=>{var r,o;(o=(r=e(this,O).owner).scrollTo_V1)==null||o.call(r,e(this,U))})}};O=new WeakMap,U=new WeakMap,a(Ae,"ngRow");let me=Ae;const A=class A{constructor(i,t){c(this,T);c(this,m);c(this,k,[]);c(this,Z,[]);c(this,fe,0);c(this,D,[]);c(this,ue,a(()=>{b(this,D,[]);const i=e(this,T).template||[];Array.from(i).forEach(t=>{var s;e(this,D).push(((s=t.getBoundingClientRect)==null?void 0:s.call(t).height)||24)}),(e(this,m).rawRecords||[]).forEach(t=>{t.__ng||(t.__ng=e(this,te).call(this)),t.__ng.height=e(this,D).slice()})},"#initialize"));x(this,"set",a(i=>{this.clear(),this.add(i,!1)},"set"));c(this,te,a(()=>({rowState:A.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:e(this,D).slice(),o:{},c:{},_:[0,0,0,0,A.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,e(this,D).slice(),-1,{},{}]}),"#getDefaultMeta"));x(this,"reset",a(()=>{b(this,k,[]),b(this,Z,[])},"reset"));x(this,"clear",a(()=>{var i;e(this,m).rawRecords=[],b(this,k,[]),b(this,Z,[]),(i=e(this,m).viewRecords)!=null&&i.reset&&e(this,m).viewRecords.reset()},"clear"));c(this,be,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(r=>{const o={v:[]};t.forEach(h=>{o.v.push(r[h]!==void 0&&r[h]!==null?r[h]:"")}),s.push(o)}),s},"#json2Array"));c(this,ge,a(i=>(Array.isArray(i)||(i=[i]),i.forEach(t=>{t.__ng=e(this,te).call(this),t.__ng.rowid=this.nextId,t.__ng.rowState=A.ROW_STATE.INSERT,t.__ng._[0]=t.__ng.rowid}),i),"#defaultInsert"));x(this,"add",a((i,t=!0)=>{var r;i===void 0&&(i={});const s=e(this,be).call(this,i);e(this,m).rawRecords=e(this,m).rawRecords.concat(e(this,ge).call(this,s)),this.resetRecords();const n=this.count()-1;return t||s.forEach((o,h)=>{const f=e(this,m).rawRecords[n-h];f&&(f.__ng.rowState=A.ROW_STATE.EMPTY)}),(r=e(this,m).viewRecords)!=null&&r.reset&&e(this,m).viewRecords.reset(),n},"add"));x(this,"delete",a(i=>{var s;let t=[];Array.isArray(i)?t=i:typeof i>"u"?t=[e(this,m).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===A.ROW_STATE.INSERT?e(this,m).rawRecords=e(this,m).rawRecords.filter(o=>o.__ng.rowid!==r):e(this,m).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=A.ROW_STATE.DELETE)})}}),this.resetRecords(),(s=e(this,m).viewRecords)!=null&&s.reset&&e(this,m).viewRecords.reset()},"delete"));x(this,"setValue",a((i,t,s)=>{var f;i=parseInt(i,10);const r=(typeof((f=e(this,T).fields)==null?void 0:f.get)=="function"?e(this,T).fields.get():[]).indexOf(t);if(r<0)return;const o=this.getValidData()[i];if(!o)return;const h=o.v[r];h!==s&&o.__ng.rowState!==A.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(t)||(o.__ng.o[t]=h),o.__ng.rowState=A.ROW_STATE.UPDATE),o.v[r]=s,e(this,m).owner.refreshData&&e(this,m).owner.refreshData(i)},"setValue"));x(this,"resetRecords",a(()=>{b(this,Z,e(this,m).rawRecords.filter(i=>!i.__ng.deleted)),b(this,k,e(this,m).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),e(this,m).rawRecords.forEach((i,t)=>{i.__ng.rowidx=t}),e(this,k).forEach((i,t)=>{i.__ng.i=t})},"resetRecords"));x(this,"getValidData",a(()=>(e(this,k).length===0&&e(this,m).rawRecords.length>0&&this.resetRecords(),e(this,k)),"getValidData"));c(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 r={};return t.forEach((o,h)=>{r[o]=n.v?n.v[h]:n[o]}),r.__ng=n.__ng,r}):i},"#conv2"));x(this,"count",a(()=>this.getValidData().length,"count"));x(this,"get",a((i,t)=>{var r;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((r=e(this,T).fields)==null?void 0:r.get)=="function"?e(this,T).fields.get():[];if(t!=null){const o=n.indexOf(t);return o>=0?s[i].v[o]:null}return e(this,j).call(this,s[i])},"get"));b(this,T,i),b(this,m,t),e(this,ue).call(this)}get source(){return e(this,j).call(this,e(this,m).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++$e(this,fe)._}get length(){return e(this,k).length}getRowCount(){return this.length}};T=new WeakMap,m=new WeakMap,k=new WeakMap,Z=new WeakMap,fe=new WeakMap,D=new WeakMap,ue=new WeakMap,te=new WeakMap,be=new WeakMap,ge=new WeakMap,j=new WeakMap,a(A,"ngData"),x(A,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ve=A;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,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(Ce,"ngDataManager");let xe=Ce;const Le=class Le extends HTMLElement{constructor(){super();c(this,K);c(this,pe);this.attachShadow({mode:"open"}),b(this,K,new xe(this))}connectedCallback(){b(this,pe,new we(this)),R.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))}disconnectedCallback(){R.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,pe=new WeakMap,a(Le,"NineTable");let Re=Le;customElements.get("nine-table")||customElements.define("nine-table",Re)});
274
287
  //# sourceMappingURL=nine-table.umd.js.map