@ninebone/table 0.0.703 → 0.0.705
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.
- package/dist/nine-table.js +638 -686
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +8 -8
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,S){typeof exports=="object"&&typeof module<"u"?S(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.NineboneUtil))})(this,function(E){"use strict";var
|
|
1
|
+
(function(E,S){typeof exports=="object"&&typeof module<"u"?S(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],S):(E=typeof globalThis<"u"?globalThis:E||self,S(E.NineboneUtil))})(this,function(E){"use strict";var Ge=Object.defineProperty;var Je=E=>{throw TypeError(E)};var ss=(E,S,x)=>S in E?Ge(E,S,{enumerable:!0,configurable:!0,writable:!0,value:x}):E[S]=x;var h=(E,S)=>Ge(E,"name",{value:S,configurable:!0});var q=(E,S,x)=>ss(E,typeof S!="symbol"?S+"":S,x),Ze=(E,S,x)=>S.has(E)||Je("Cannot "+x);var t=(E,S,x)=>(Ze(E,S,"read from private field"),x?x.call(E):S.get(E)),d=(E,S,x)=>S.has(E)?Je("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(E):S.set(E,x),p=(E,S,x,j)=>(Ze(E,S,"write to private field"),j?j.call(E,x):S.set(E,x),x),Qe=(E,S,x)=>(Ze(E,S,"access private method"),x);var ts=(E,S,x,j)=>({set _(vt){p(E,S,vt,x)},get _(){return t(E,S,j)}});var D,Y,R,Z,G,J,Dt,Q,Pt,tt,et,dt,C,wt,St,Ft,F,A,st,P,_,V,nt,Et,Le,He,jt,Yt,At,Rt,qt,Vt,Ut,Tt,$e,ft,kt,Xt,U,rt,Zt,es,Gt,it,ot,Ct,Jt,Qt,ut,te,ee,se,Ht,I,ne,$t,re,Mt,gt,N,L,z,bt,ie,X,oe,at,It,ae,le,pt,lt,yt,M,_t,ce,ct,he,de,H,zt,y,De,Pe,Fe,je,Ye,Wt,ht,mt,xt,fe,K,Xe;const Te=class Te extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Te,"Trace");let S=Te;const x=new S,ke=class ke extends HTMLElement{constructor(){super();d(this,D);d(this,Y,!1);d(this,R);d(this,Z);d(this,G);d(this,J);d(this,Dt,h(()=>{if(!t(this,D))return;const e=t(this,D).querySelector(".ng-container-body .ng-part-body");e&&(p(this,J,new ResizeObserver(()=>{this.refresh()})),t(this,J).observe(e))},"#observeResize"));q(this,"refresh",h(()=>{if(!t(this,D)||!t(this,R)||t(this,Y))return;const e=t(this,R).container,s=e.querySelector("table");if(!s)return;const r=t(this,R).track,i=t(this,R).thumb,o=t(this,D).querySelector(".ng-container-bottom"),a=e.clientWidth,c=s.scrollWidth;if(a!==0&&c>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=r.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/c),l),20);i.style.width=`${f}px`;const u=e.scrollLeft,b=c-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const m=l-f;g>m&&(g=m),i.style.left=`${g}px`,t(this,R).left.disabled=g===0,t(this,R).right.disabled=g>=m-1},"refresh"));d(this,Q,h(e=>{if(!t(this,R))return!1;const s=t(this,R).container,r=s.querySelector("table");if(!r)return!1;const i=t(this,R).track.getBoundingClientRect(),o=t(this,R).thumb.clientWidth;let a=e;a<0&&(a=0);const c=i.width-o;a>c&&(a=c),a=parseInt(a,10),t(this,R).thumb.style.left=`${a}px`,t(this,R).left.disabled=a===0,t(this,R).right.disabled=a>=c-1;const l=s.clientWidth,u=r.scrollWidth-l;return c>0&&u>0&&(s.scrollLeft=a/c*u),a>0&&a<c-1},"#thumbMoveTo"));d(this,Pt,h(()=>{const e=h(r=>{clearInterval(t(this,Z)),clearInterval(t(this,G));const i=parseInt(t(this,R).thumb.style.left||0,10);t(this,Q).call(this,i+r),p(this,Z,setInterval(()=>{clearInterval(t(this,Z)),p(this,G,setInterval(()=>{const o=parseInt(t(this,R).thumb.style.left||0,10);t(this,Q).call(this,o+r)||clearInterval(t(this,G))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,Z)),clearInterval(t(this,G))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,R).left.addEventListener(r,s),t(this,R).right.addEventListener(r,s),t(this,R).track.addEventListener(r,s)}),t(this,R).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,R).right.addEventListener("mousedown",r=>{r.button===0&&e(20)}),t(this,R).left.addEventListener("touchstart",()=>e(-20)),t(this,R).right.addEventListener("touchstart",()=>e(20)),t(this,R).track.addEventListener("mousedown",r=>{if(r.button!==0)return;r.preventDefault();const i=t(this,R).track.getBoundingClientRect(),o=t(this,R).thumb.clientWidth;t(this,Q).call(this,r.clientX-i.left-o/2)}),t(this,R).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,Y,!0),this.shiftX=r.clientX-t(this,R).thumb.getBoundingClientRect().left;const i=h(a=>{if(!t(this,Y))return;const c=t(this,R).track.getBoundingClientRect();t(this,Q).call(this,a.clientX-c.left-this.shiftX)},"onMouseMove"),o=h(()=>{p(this,Y,!1),s(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(p(this,D,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,D))return;this.innerHTML=`
|
|
2
2
|
<style>
|
|
3
3
|
nine-table-hscrollbar {
|
|
4
4
|
display: flex;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
<button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
|
|
61
61
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
62
62
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
63
|
-
`;const e=h(()=>{const s=t(this,
|
|
63
|
+
`;const e=h(()=>{const s=t(this,D).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,R,{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")}),s.addEventListener("scroll",()=>{t(this,Y)||this.refresh()}),t(this,Pt).call(this),t(this,Dt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};D=new WeakMap,Y=new WeakMap,R=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Dt=new WeakMap,Q=new WeakMap,Pt=new WeakMap,h(ke,"NineTableHScrollBar");let j=ke;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",j);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,tt);d(this,et);d(this,dt,!1);d(this,C);d(this,wt,0);d(this,St,0);q(this,"refresh",h(()=>{if(x.log("vscrollbar.refresh"),!t(this,tt)||!t(this,C))return;const e=t(this,C).container,s=t(this,C).track,r=t(this,C).thumb,i=e.clientHeight,o=t(this,tt).data.length,a=t(this,et).getRowHeight(),c=o*a;if(c<=i||o===0){this.style.display="none";return}else this.style.display="flex";const l=s.clientHeight;if(l<=0)return;const f=Math.max(Math.min(l*(i/c),l),20);r.style.height=`${f}px`;const u=e.scrollTop,b=Math.max(c-i,1);x.log(e,u,b);let g=0;b>0&&(g=u/b*(l-f));const m=l-f;g<0&&(g=0),g>m&&(g=m),r.style.top=`${g}px`,t(this,C).top.disabled=u<=0,t(this,C).bottom.disabled=u>=b-1},"refresh"));d(this,Ft,h(()=>{x.log("nine-table-vscrollbar.#init");const e=t(this,C).container,s=h(()=>{const i=(t(this,tt).data.get()||[]).length,o=t(this,et).getRowHeight();return i*o},"getContentHeight");t(this,C).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),p(this,dt,!0),p(this,wt,r.clientY),p(this,St,e.scrollTop);const i=h(a=>{if(!t(this,dt))return;const c=t(this,C).track.getBoundingClientRect(),l=t(this,C).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,wt),g=e.clientHeight,m=s(),w=Math.max(m-g,1);if(u>0&&w>0){const T=b/u*w;let v=t(this,St)+T;const W=Math.max(0,m-g);v<0&&(v=0),v>W&&(v=W),e.scrollTop=v}this.refresh()},"onMouseMove"),o=h(()=>{p(this,dt,!1),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)}),t(this,C).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,C).thumb)return;const i=t(this,C).track.getBoundingClientRect(),o=t(this,C).thumb.clientHeight,a=r.clientY-i.top-o/2,l=i.height-o,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(l>0&&b>0){const g=Math.max(0,Math.min(1,a/l));e.scrollTop=g*b}this.refresh()}),t(this,C).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,C).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,tt,this.getRootNode().host),p(this,et,this.closest("nine-table-sheet")),this.innerHTML=`
|
|
64
64
|
<style>
|
|
65
65
|
nine-table-vscrollbar {
|
|
66
66
|
display: flex;
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
124
124
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
125
125
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
126
|
-
`;const e=h(()=>{const s=t(this,st).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,k,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,jt).call(this),this.refresh()},"initWhenReady");e()}};et=new WeakMap,st=new WeakMap,ft=new WeakMap,k=new WeakMap,Et=new WeakMap,Rt=new WeakMap,jt=new WeakMap,h(ke,"NineTableVScrollBar");let St=ke;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",St);const $e=class $e{constructor(n){d(this,F);d(this,R);d(this,nt);d(this,P,new Map);d(this,_,null);d(this,X,null);d(this,ot,0);d(this,At,40);d(this,Me,!1);d(this,Le,!1);d(this,Yt,3);T(this,"refresh",h(()=>{var e;p.log("rowManager.refresh");const n=t(this,R).querySelector(".ng-container-body .ng-part-body");n&&(t(this,qt).call(this),t(this,Tt).call(this),t(this,ut).call(this,n.scrollTop),(e=t(this,R).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",h(()=>{p.log("rowManager.initialize"),y(this,nt,{scrollTables:t(this,R).querySelectorAll(".ng-part-body table"),firstTr:t(this,R).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),y(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const a=t(this,R).querySelector(i);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(i,u)});const n=t(this,R).querySelector(".ng-container-body .ng-part-body"),e=t(this,R).querySelector(".ng-container-left .ng-part-body"),s=t(this,R).querySelector(".ng-container-right .ng-part-body"),o=t(this,R).querySelector(".ng-container-body .ng-part-header"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,qt).call(this),t(this,kt).call(this),t(this,Tt).call(this),t(this,ut).call(this,n.scrollTop);let i=!1;const a=h(c=>{var u;if(i)return;i=!0;const l=c.scrollTop,f=c.scrollLeft;n&&n.scrollTop!==l&&(n.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),o&&o.scrollLeft!==f&&(o.scrollLeft=f),r&&r.scrollLeft!==f&&(r.scrollLeft=f),t(this,ut).call(this,l),(u=t(this,R).querySelector("nine-table-vscrollbar"))==null||u.refresh(),i=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Vt,h((n,e)=>{p.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const o=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;o.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const r=o.querySelector("tr.nodata"),i=document.createDocumentFragment();for(let a=0;a<t(this,At);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});r?r.before(i):o.appendChild(i),e===".ng-container-body"&&(t(this,nt).firstTr=o.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,qt,h(()=>{if(t(this,_)!==null&&t(this,_)>0)return t(this,_);const n=t(this,R).querySelector(".ng-container-body .ng-part-body");p.log("rowManager.#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(p.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const o=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),o?o.before(r):s.appendChild(r);const i=t(this,R),a=i.style.display,c=i.style.visibility,l=i.style.position;(a==="none"||window.getComputedStyle(i).display==="none")&&(i.style.display="block",i.style.visibility="hidden",i.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const m=window.getComputedStyle(b);g=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,f<=0?-1:(y(this,_,f),t(this,Ct).call(this),t(this,_))},"#measureAndCacheHeight"));d(this,Tt,h(()=>{p.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,F).data.get()||[]).length,s=t(this,_),o=e*s;p.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:o}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const i=t(this,R).querySelector(r);if(!i)return;const a=i.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${o}px`)})},"#updateVirtualScrollHeight"));d(this,Ct,h(()=>{if(t(this,ot)>0&&t(this,_)>0){const n=Math.ceil(t(this,ot)/t(this,_));y(this,At,n+t(this,Yt))}},"#updateRowCount"));d(this,Xt,h(()=>{var a,c,l,f,u,b;const n=t(this,R).querySelector(".ng-container-left .ng-part-body table"),e=t(this,R).querySelector(".ng-container-body .ng-part-body table"),s=t(this,R).querySelector(".ng-container-right .ng-part-body table");if(e){const g=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],A=Math.max(g.length,m.length,w.length);for(let x=0;x<A;x++){const z=[((a=g[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[x])==null?void 0:l.getBoundingClientRect().height)||0],C=Math.max(...z);C>0&&(g[x]&&(g[x].style.height=`${C}px`),m[x]&&(m[x].style.height=`${C}px`),w[x]&&(w[x].style.height=`${C}px`))}}const o=t(this,R).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer table"),i=t(this,R).querySelector(".ng-container-right .ng-part-footer table");if(r){const g=o?Array.from(o.querySelectorAll("tfoot tr")):[],m=Array.from(r.querySelectorAll("tfoot tr")),w=i?Array.from(i.querySelectorAll("tfoot tr")):[],A=Math.max(g.length,m.length,w.length);for(let x=0;x<A;x++){const z=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=w[x])==null?void 0:b.getBoundingClientRect().height)||0],C=Math.max(...z);C>0&&(g[x]&&(g[x].style.height=`${C}px`),m[x]&&(m[x].style.height=`${C}px`),w[x]&&(w[x].style.height=`${C}px`))}}},"#syncRowHeights"));d(this,Ut,h(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(y(this,X,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const o=e.contentRect.height;if(o>0){let r=0;const i=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");i&&(r+=i.offsetHeight),a&&(r+=a.offsetHeight);const c=Math.max(o-r,100);t(this,ot)!==c&&(y(this,ot,c),t(this,Ct).call(this),t(this,_)!==null&&(t(this,kt).call(this),this.refresh()))}}})),t(this,X).observe(t(this,R)))},"#initResizeObserver"));d(this,kt,h(()=>{p.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,R).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Vt).call(this,e,n)}),t(this,Kt).call(this),t(this,Xt).call(this)},"#renderAllContainers"));d(this,He,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,R).querySelector(e);if(!s)return;const o=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;const r=Array.from(o.querySelectorAll("tr:not(.nodata)")),i=((l=t(this,P).get(e))==null?void 0:l.length)||1,c=(t(this,F).data.get()||[]).length;r.forEach((f,u)=>{const b=n+Math.floor(u/i);if(b>=c){f.style.visibility="hidden";return}const g=t(this,F).data.get(b);f.style.display="",t(this,Mt).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ut,h(n=>{var u,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,F).data.length;if(s===0)return;const o=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,r=t(this,R).querySelector(".ng-container-body .ng-part-body");p.log("bodyContainer.clientHeight",r.clientHeight);const i=Math.max(0,s-Math.floor(r.clientHeight/e)),a=Math.min(i,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);p.log(`📜 [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`),a===i&&p.log(`📜 [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,nt).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,nt))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(p.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const m=t(this,R).querySelector(g);if(!m)return;const w=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!w)return;Array.from(w.querySelectorAll("tr:not(.nodata)")).forEach((x,z)=>{const C=a+Math.floor(z/o);if(C>=s){x.style.display="none";return}const D=t(this,F).data.get(C);x.style.display="",t(this,Mt).call(this,x,D,C)})}))},"#handleScroll"));d(this,Mt,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((o,r)=>{o.dataset.row=s;const i=Array.from(o.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");i&&typeof i.refresh=="function"&&i.refresh()})},"#bindRowData"));d(this,Kt,h(()=>{var c,l,f;p.log("rowManager.#syncHeaderHeights");const n=t(this,R).querySelector(".ng-container-left .ng-part-header table"),e=t(this,R).querySelector(".ng-container-body .ng-part-header table"),s=t(this,R).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const o=n?Array.from(n.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),i=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(o.length,r.length,i.length);for(let u=0;u<a;u++){const b=[((c=o[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=i[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(o[u]&&(o[u].style.height=`${g}px`),r[u]&&(r[u].style.height=`${g}px`),i[u]&&(i[u].style.height=`${g}px`))}},"#syncHeaderHeights"));T(this,"destroy",h(()=>{t(this,X)&&(t(this,X).disconnect(),y(this,X,null))},"destroy"));y(this,F,n.getRootNode().host),y(this,R,n),t(this,Ut).call(this)}getRowHeight(){return t(this,_)}templateLength(n=".ng-container-body"){var e;return((e=t(this,P).get(n))==null?void 0:e.length)||1}};F=new WeakMap,R=new WeakMap,nt=new WeakMap,P=new WeakMap,_=new WeakMap,X=new WeakMap,ot=new WeakMap,At=new WeakMap,Me=new WeakMap,Le=new WeakMap,Yt=new WeakMap,Vt=new WeakMap,qt=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,Xt=new WeakMap,Ut=new WeakMap,kt=new WeakMap,He=new WeakMap,ut=new WeakMap,Mt=new WeakMap,Kt=new WeakMap,h($e,"RowManager");let ue=$e;const Zt=class Zt{static compileAll(n){return Array.isArray(n)?n.map(e=>Zt.compile(e)):[]}static compile(n){if(!n)return null;const e=h(a=>{a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let A=[];b&&A.push(`data-bind="${b}"`),g&&A.push(`data-expr="${g}"`),m&&A.push(`maxbyte="${m}"`),w&&A.push(`type="${w}"`),l.innerHTML=`<${u} ${A.join(" ")}></${u}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),o=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let A=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let D=0;D<g[w].length;D++)if(g[w][D]===null){A=D;break}const z=x.rowSpan||1,C=x.colSpan||1;for(let D=0;D<z;D++)for(let Z=0;Z<C;Z++)w+D<u&&A+Z<b&&(g[w+D][A+Z]=D===0&&Z===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(A=>{for(let x=0;x<g[w].length;x++)if(g[w][x]==="1"){A.dataset.col=x,g[w][x]="0";break}})})},"resetColIndex"),r=n.cloneNode(!0);return s(r),e(r),o(r,"thead"),o(r,"tbody"),o(r,"tfoot"),Array.from(r.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};h(Zt,"TableCompiler");let ge=Zt;const Ie=class Ie{constructor(n){d(this,gt);d(this,j);d(this,rt,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});T(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:o}=t(this,rt);p.log("🎨 [CellSelection.render] Rendering range ->",t(this,rt));const r=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(r.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),n<0||e<0){p.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let i=0;r.forEach((a,c)=>{a.querySelectorAll("tbody tr").forEach(l=>{if(l.classList.contains("nodata"))return;const f=parseInt(l.dataset.row,10);isNaN(f)||l.querySelectorAll("td, th").forEach(u=>{const b=parseInt(u.dataset.col,10);if(isNaN(b))return;const g=parseInt(u.rowSpan||1,10),m=parseInt(u.colSpan||1,10),w=f+g-1,A=b+m-1;f<=s&&w>=n&&b<=o&&A>=e&&(i++,u.classList.add("selected"),f===n&&u.classList.add("selected-top"),w===s&&u.classList.add("selected-bottom"),b===e&&u.classList.add("selected-left"),A===o&&u.classList.add("selected-right"))})})}),p.log(`✨ [CellSelection.render] Total rendered cells marked: ${i}`)},"render"));y(this,j,n),Ge(this,gt,is).call(this),p.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,o){p.log(`🔍 [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${o}`);let r=Math.min(n,s),i=Math.max(n,s),a=Math.min(e,o),c=Math.max(e,o);const l=Ge(this,gt,rs).call(this,r,a,i,c);y(this,rt,l),p.log("📦 [CellSelection.setRange] Expanded Range ->",t(this,rt)),this.render()}};j=new WeakMap,rt=new WeakMap,gt=new WeakSet,rs=h(function(n,e,s,o){let r=n,i=e,a=s,c=o,l=!0,f=0;const u=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");for(;l&&f<10;)l=!1,f++,u.forEach((b,g)=>{b.querySelectorAll("tbody tr").forEach(m=>{const w=parseInt(m.dataset.row,10);isNaN(w)||m.querySelectorAll("td, th").forEach(A=>{const x=parseInt(A.dataset.col,10);if(isNaN(x))return;const z=parseInt(A.rowSpan||1,10),C=parseInt(A.colSpan||1,10),D=w+z-1,Z=x+C-1;if(w<=a&&D>=r&&x<=c&&Z>=i){const Je=Math.min(r,w),Qe=Math.max(a,D),ts=Math.min(i,x),es=Math.max(c,Z);(Je!==r||Qe!==a||ts!==i||es!==c)&&(r=Je,a=Qe,i=ts,c=es,l=!0)}})})});return{startRow:r,startCol:i,endRow:a,endCol:c}},"#expandRangeByMerge"),is=h(function(){const n=t(this,j).querySelector(".ng-container-top");if(!n){p.log("❌ [CellSelection] .ng-container-top not found!");return}n.addEventListener("mousedown",e=>{if(e.button!==0)return;const s=e.target.closest("td, th");if(!s){p.log("🖱️ [MouseDown] Target is not td or th:",e.target);return}if(s.dataset.row===void 0||s.dataset.col===void 0){p.log("🖱️ [MouseDown] Cell missing dataset.row or dataset.col:",s);return}if(s.closest("tr").classList.contains("nodata")){p.log("🖱️ [MouseDown] Clicked on .nodata row");return}const o=parseInt(s.dataset.row,10),r=parseInt(s.dataset.col,10);p.log(`🖱️ [MouseDown Success] startRow: ${o}, startCol: ${r}`),this.setRange(o,r,o,r);const i=h(c=>{p.log(`🏃 [MouseMove Event] clientX: ${c.clientX}, clientY: ${c.clientY}`);const l=document.elementFromPoint(c.clientX,c.clientY);let f=l==null?void 0:l.closest("td, th");if(f?p.log("🎯 [MouseMove] elementFromPoint found cell:",{row:f.dataset.row,col:f.dataset.col}):p.log("🔍 [MouseMove] elementFromPoint failed to find td/th. Element found:",l),!f||!t(this,j).contains(f)){p.log("⚠️ [MouseMove] Fallback to bounding rect check...");const g=t(this,j).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const m of g){const w=m.getBoundingClientRect();if(c.clientX>=w.left&&c.clientX<=w.right&&c.clientY>=w.top&&c.clientY<=w.bottom){f=m;break}}p.log(`🔍 [MouseMove Fallback Result] Matched cell found: ${!!f}, total checked cells: ${g.length}`)}if(!f){p.log("❌ [MouseMove] Target cell is still null after fallback.");return}if(f.dataset.row===void 0||f.dataset.col===void 0){p.log("❌ [MouseMove] Target cell missing dataset.row or dataset.col",f);return}if(f.closest("tr").classList.contains("nodata")){p.log("🏃 [MouseMove] Target cell is in .nodata row");return}const u=parseInt(f.dataset.row,10),b=parseInt(f.dataset.col,10);p.log(`🏃 [MouseMove Dragging Success] endRow: ${u}, endCol: ${b}`),this.setRange(o,r,u,b)},"onMouseMove"),a=h(()=>{p.log("🖱️ [MouseUp] Drag ended."),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",a)},"onMouseUp");document.addEventListener("mousemove",i),document.addEventListener("mouseup",a)})},"#initEvents"),h(Ie,"CellSelection");let be=Ie;const Ht=class Ht extends HTMLElement{constructor(){super();d(this,Gt);d(this,it,null);d(this,at);d(this,Lt);T(this,"invalidate",h(()=>{p.log("sheet.invalidate()"),t(this,at).refresh()},"invalidate"));T(this,"generate",h(e=>{if(p.log("sheet.generate()"),!e)return;y(this,it,ge.compile(e)),t(this,Jt).call(this),t(this,Qt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),o=this.querySelector(".ng-container-body .ng-part-footer"),r=this.querySelector(".ng-nodata-overlay");s&&r&&(r.style.top=`${s.offsetHeight}px`),o&&r&&(r.style.bottom=`${o.offsetHeight}px`),t(this,at).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));d(this,Jt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:o})=>{var r,i,a;(r=this.querySelector(`${s} .ng-part-header`))==null||r.appendChild(t(this,bt).call(this,t(this,it),o,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,bt).call(this,t(this,it),o,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,bt).call(this,t(this,it),o,"footer"))})},"#renderSplitContainers"));d(this,Qt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),o=s==null?void 0:s.querySelectorAll("table");if(!s||!o||o.length===0)return;let r=0;o[0].querySelectorAll("col").forEach(i=>{const a=parseInt(i.getAttribute("width"),10);isNaN(r)||(r+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${r}px`,s.style.width=`${r}px`)})},"#updateContainerWidths"));d(this,bt,h((e,s,o)=>{const r=e.cloneNode(!0),i=r.querySelector("thead"),a=r.querySelector("tbody"),c=r.querySelector("tfoot");if(o==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else o==="body"?(i&&i.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):o==="footer"&&(i&&i.remove(),a&&a.remove());return s==="left"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):r.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),r},"#createSplitTable"));T(this,"getRowHeight",h(()=>t(this,at).getRowHeight(),"getRowHeight"));T(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,te,h(()=>{t(this,ee).call(this),y(this,Lt,new be(this))},"#init"));d(this,ee,h(()=>{const e=Ht.SCROLLBAR_SIZE;this.innerHTML=`
|
|
126
|
+
`;const e=h(()=>{const s=t(this,et).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,C,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,Ft).call(this),this.refresh()},"initWhenReady");e()}};tt=new WeakMap,et=new WeakMap,dt=new WeakMap,C=new WeakMap,wt=new WeakMap,St=new WeakMap,Ft=new WeakMap,h(Ce,"NineTableVScrollBar");let vt=Ce;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",vt);const Me=class Me{constructor(n){d(this,F);d(this,A);d(this,st);d(this,P,new Map);d(this,_,null);d(this,V,null);d(this,nt,0);d(this,Et,40);d(this,Le,!1);d(this,He,!1);d(this,jt,3);q(this,"refresh",h(()=>{var e;x.log("rowManager.refresh");const n=t(this,A).querySelector(".ng-container-body .ng-part-body");n&&(t(this,At).call(this),t(this,Rt).call(this),t(this,ft).call(this,n.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));q(this,"initialize",h(()=>{x.log("rowManager.initialize"),p(this,st,{scrollTables:t(this,A).querySelectorAll(".ng-part-body table"),firstTr:t(this,A).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),p(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,A).querySelector(o);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(o,u)});const n=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),r=t(this,A).querySelector(".ng-container-body .ng-part-header"),i=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,At).call(this),t(this,Tt).call(this),t(this,Rt).call(this),t(this,ft).call(this,n.scrollTop);let o=!1;const a=h(c=>{var u;if(o)return;o=!0;const l=c.scrollTop,f=c.scrollLeft;n&&n.scrollTop!==l&&(n.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),i&&i.scrollLeft!==f&&(i.scrollLeft=f),t(this,ft).call(this,l),(u=t(this,A).querySelector("nine-table-vscrollbar"))==null||u.refresh(),o=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Yt,h((n,e)=>{x.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const r=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const i=r.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,Et);a++)s.forEach(c=>{o.appendChild(c.cloneNode(!0))});i?i.before(o):r.appendChild(o),e===".ng-container-body"&&(t(this,st).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,At,h(()=>{if(t(this,_)!==null&&t(this,_)>0)return t(this,_);const n=t(this,A).querySelector(".ng-container-body .ng-part-body");x.log("rowManager.#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(x.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),i=document.createDocumentFragment();e.forEach(b=>{i.appendChild(b.cloneNode(!0))}),r?r.before(i):s.appendChild(i);const o=t(this,A),a=o.style.display,c=o.style.visibility,l=o.style.position;(a==="none"||window.getComputedStyle(o).display==="none")&&(o.style.display="block",o.style.visibility="hidden",o.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const m=window.getComputedStyle(b);g=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0?-1:(p(this,_,f),t(this,qt).call(this),t(this,_))},"#measureAndCacheHeight"));d(this,Rt,h(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,F).data.get()||[]).length,s=t(this,_),r=e*s;x.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const o=t(this,A).querySelector(i);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,qt,h(()=>{if(t(this,nt)>0&&t(this,_)>0){const n=Math.ceil(t(this,nt)/t(this,_));p(this,Et,n+t(this,jt))}},"#updateRowCount"));d(this,Vt,h(()=>{var a,c,l,f,u,b;const n=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const g=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(g.length,m.length,w.length);for(let v=0;v<T;v++){const W=[((a=g[v])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[v])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[v])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(...W);k>0&&(g[v]&&(g[v].style.height=`${k}px`),m[v]&&(m[v].style.height=`${k}px`),w[v]&&(w[v].style.height=`${k}px`))}}const r=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),i=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(i){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(i.querySelectorAll("tfoot tr")),w=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(g.length,m.length,w.length);for(let v=0;v<T;v++){const W=[((f=g[v])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[v])==null?void 0:u.getBoundingClientRect().height)||0,((b=w[v])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(...W);k>0&&(g[v]&&(g[v].style.height=`${k}px`),m[v]&&(m[v].style.height=`${k}px`),w[v]&&(w[v].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Ut,h(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,V,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let i=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(i+=o.offsetHeight),a&&(i+=a.offsetHeight);const c=Math.max(r-i,100);t(this,nt)!==c&&(p(this,nt,c),t(this,qt).call(this),t(this,_)!==null&&(t(this,Tt).call(this),this.refresh()))}}})),t(this,V).observe(t(this,A)))},"#initResizeObserver"));d(this,Tt,h(()=>{x.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,A).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Yt).call(this,e,n)}),t(this,Xt).call(this),t(this,Vt).call(this)},"#renderAllContainers"));d(this,$e,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const i=Array.from(r.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,P).get(e))==null?void 0:l.length)||1,c=(t(this,F).data.get()||[]).length;i.forEach((f,u)=>{const b=n+Math.floor(u/o);if(b>=c){f.style.visibility="hidden";return}const g=t(this,F).data.get(b);f.style.display="",t(this,kt).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ft,h(n=>{var u,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,F).data.length;if(s===0)return;const r=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,i=t(this,A).querySelector(".ng-container-body .ng-part-body");x.log("bodyContainer.clientHeight",i.clientHeight);const o=Math.max(0,s-Math.floor(i.clientHeight/e)),a=Math.min(o,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);x.log(`📜 [Scroll Calc] maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`),a===o&&x.log(`📜 [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${o}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,st).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,st))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(x.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const m=t(this,A).querySelector(g);if(!m)return;const w=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!w)return;Array.from(w.querySelectorAll("tr:not(.nodata)")).forEach((v,W)=>{const k=a+Math.floor(W/r);if(k>=s){v.style.display="none";return}const B=t(this,F).data.get(k);v.style.display="",t(this,kt).call(this,v,B,k)})}))},"#handleScroll"));d(this,kt,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,i)=>{r.dataset.row=s;const o=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Xt,h(()=>{var c,l,f;x.log("rowManager.#syncHeaderHeights");const n=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=n?Array.from(n.querySelectorAll("tr")):[],i=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,i.length,o.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=i[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),i[u]&&(i[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`))}},"#syncHeaderHeights"));q(this,"destroy",h(()=>{t(this,V)&&(t(this,V).disconnect(),p(this,V,null))},"destroy"));p(this,F,n.getRootNode().host),p(this,A,n),t(this,Ut).call(this)}getRowHeight(){return t(this,_)}templateLength(n=".ng-container-body"){var e;return((e=t(this,P).get(n))==null?void 0:e.length)||1}};F=new WeakMap,A=new WeakMap,st=new WeakMap,P=new WeakMap,_=new WeakMap,V=new WeakMap,nt=new WeakMap,Et=new WeakMap,Le=new WeakMap,He=new WeakMap,jt=new WeakMap,Yt=new WeakMap,At=new WeakMap,Rt=new WeakMap,qt=new WeakMap,Vt=new WeakMap,Ut=new WeakMap,Tt=new WeakMap,$e=new WeakMap,ft=new WeakMap,kt=new WeakMap,Xt=new WeakMap,h(Me,"RowManager");let ue=Me;const Kt=class Kt{static compileAll(n){return Array.isArray(n)?n.map(e=>Kt.compile(e)):[]}static compile(n){if(!n)return null;const e=h(a=>{a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),g&&T.push(`data-expr="${g}"`),m&&T.push(`maxbyte="${m}"`),w&&T.push(`type="${w}"`),l.innerHTML=`<${u} ${T.join(" ")}></${u}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),r=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let T=0;Array.from(m.querySelectorAll("th,td")).forEach(v=>{for(let B=0;B<g[w].length;B++)if(g[w][B]===null){T=B;break}const W=v.rowSpan||1,k=v.colSpan||1;for(let B=0;B<W;B++)for(let Ot=0;Ot<k;Ot++)w+B<u&&T+Ot<b&&(g[w+B][T+Ot]=B===0&&Ot===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(T=>{for(let v=0;v<g[w].length;v++)if(g[w][v]==="1"){T.dataset.col=v,g[w][v]="0";break}})})},"resetColIndex"),i=n.cloneNode(!0);return s(i),e(i),r(i,"thead"),r(i,"tbody"),r(i,"tfoot"),Array.from(i.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&i.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),i}};h(Kt,"TableCompiler");let ge=Kt;const Ie=class Ie{constructor(n){d(this,Zt);d(this,U);d(this,rt,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});q(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,rt);trace.log("🎨 [CellSelection.render] Rendering range ->",t(this,rt));const i=t(this,U).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(i.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),n<0||e<0){trace.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let o=0;i.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{if(c.classList.contains("nodata"))return;const l=parseInt(c.dataset.row,10);isNaN(l)||c.querySelectorAll("td, th").forEach(f=>{const u=parseInt(f.dataset.col,10);if(isNaN(u))return;const b=parseInt(f.rowSpan||1,10),g=parseInt(f.colSpan||1,10),m=l+b-1,w=u+g-1;m>=n&&l<=s&&w>=e&&u<=r&&(o++,f.classList.add("selected"),l===n&&f.classList.add("selected-top"),m===s&&f.classList.add("selected-bottom"),u===e&&f.classList.add("selected-left"),w===r&&f.classList.add("selected-right"))})})}),trace.log(`✨ [CellSelection.render] Total rendered cells marked: ${o}`)},"render"));p(this,U,n),Qe(this,Zt,es).call(this),trace.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,r){trace.log(`🔍 [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${r}`);let i=Math.min(n,s),o=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);p(this,rt,{startRow:i,startCol:a,endRow:o,endCol:c}),trace.log("📦 [CellSelection.setRange] Final Range ->",t(this,rt)),this.render()}};U=new WeakMap,rt=new WeakMap,Zt=new WeakSet,es=h(function(){const n=t(this,U).querySelector(".ng-container-top");if(!n){trace.log("❌ [CellSelection] .ng-container-top not found!");return}n.addEventListener("mousedown",e=>{if(e.button!==0)return;const s=e.target.closest("td, th");if(!s||s.dataset.row===void 0||s.dataset.col===void 0||s.closest("tr").classList.contains("nodata"))return;const r=parseInt(s.dataset.row,10),i=parseInt(s.dataset.col,10);trace.log(`🖱️ [MouseDown Success] startRow: ${r}, startCol: ${i}`),this.setRange(r,i,r,i);const o=h(c=>{const l=document.elementFromPoint(c.clientX,c.clientY);let f=l==null?void 0:l.closest("td, th");if(!f||!t(this,U).contains(f)){const g=t(this,U).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const m of g){const w=m.getBoundingClientRect();if(c.clientX>=w.left&&c.clientX<=w.right&&c.clientY>=w.top&&c.clientY<=w.bottom){f=m;break}}}if(!f||f.dataset.row===void 0||f.dataset.col===void 0||f.closest("tr").classList.contains("nodata"))return;const u=parseInt(f.dataset.row,10),b=parseInt(f.dataset.col,10);this.setRange(r,i,u,b)},"onMouseMove"),a=h(()=>{trace.log("🖱️ [MouseUp] Drag ended."),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)},"onMouseUp");document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})},"#initEvents"),h(Ie,"CellSelection");let be=Ie;const Lt=class Lt extends HTMLElement{constructor(){super();d(this,Gt);d(this,it,null);d(this,ot);d(this,Ct);q(this,"invalidate",h(()=>{x.log("sheet.invalidate()"),t(this,ot).refresh()},"invalidate"));q(this,"generate",h(e=>{if(x.log("sheet.generate()"),!e)return;p(this,it,ge.compile(e)),t(this,Jt).call(this),t(this,Qt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),i=this.querySelector(".ng-nodata-overlay");s&&i&&(i.style.top=`${s.offsetHeight}px`),r&&i&&(i.style.bottom=`${r.offsetHeight}px`),t(this,ot).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,Jt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var i,o,a;(i=this.querySelector(`${s} .ng-part-header`))==null||i.appendChild(t(this,ut).call(this,t(this,it),r,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,ut).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,ut).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,Qt,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let i=0;r[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(i)||(i+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${i}px`,s.style.width=`${i}px`)})},"#updateContainerWidths"));d(this,ut,h((e,s,r)=>{const i=e.cloneNode(!0),o=i.querySelector("thead"),a=i.querySelector("tbody"),c=i.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",i.appendChild(f)}}else r==="body"?(o&&o.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(o&&o.remove(),a&&a.remove());return s==="left"?i.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?i.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):i.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),i},"#createSplitTable"));q(this,"getRowHeight",h(()=>t(this,ot).getRowHeight(),"getRowHeight"));q(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));q(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,te,h(()=>{t(this,ee).call(this),p(this,Ct,new be(this))},"#init"));d(this,ee,h(()=>{const e=Lt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
127
127
|
<style>
|
|
128
128
|
nine-table-sheet {
|
|
129
129
|
display: none;
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
321
321
|
<div class='ng-scroll-edge'></div>
|
|
322
322
|
</div>
|
|
323
|
-
`},"#render"));
|
|
323
|
+
`},"#render"));p(this,ot,new ue(this)),p(this,Gt,this.getRootNode().host)}connectedCallback(){t(this,te).call(this)}get selection(){return t(this,Ct)}disconnectedCallback(){this.innerHTML="",x.log("NineTableSheet destroyed.")}};Gt=new WeakMap,it=new WeakMap,ot=new WeakMap,Ct=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,ut=new WeakMap,te=new WeakMap,ee=new WeakMap,h(Lt,"NineTableSheet"),q(Lt,"SCROLLBAR_SIZE",16);let Bt=Lt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Bt);const _e=class _e extends HTMLElement{constructor(){super();d(this,se,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var o;const r=s.ctrlKey||s.metaKey||s.shiftKey,i=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,Ht).call(this,i,r)}),t(this,Ht).call(this,0,!1)},"#init"));d(this,Ht,h((e,s=!1)=>{const r=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const m=parseInt(g.getAttribute("data-index"),10),w=this.querySelector(`nine-splitter[data-split-index="${m}"]`),T=f[m+1];w&&T&&T.classList.contains("active")&&w.style.setProperty("display","flex")})},"updateSplitters"),i=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),a=i.querySelectorAll(".nine-tab-item"),c=o.querySelectorAll("nine-table-sheet");if(!a[e])return;if(!s)a.forEach((f,u)=>{f.classList.toggle("active",u===e)}),c.forEach((f,u)=>{const b=u===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=a[e],u=i.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const b=o.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=o.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(f=>{f.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),r()},"#switchSheet"))}connectedCallback(){t(this,se).call(this)}};se=new WeakMap,Ht=new WeakMap,h(_e,"NineTableSheets");let pe=_e;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",pe);const Ne=class Ne{constructor(n){d(this,I);d(this,ne,h(()=>{t(this,re).call(this),new ResizeObserver(n=>{for(let e of n)t(this,I).getAttribute("auto-height")==="true"&&t(this,$t).call(this)}).observe(t(this,I))},"#init"));d(this,$t,h(()=>{var c,l;const n=Array.from(t(this,I).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,I).getAttribute("max-display-row"),10)||10,s=Math.max(...n.map(f=>f.getRowHeight())),r=(c=t(this,I).shadowRoot.querySelector("nine-table-header"))==null?void 0:c.getBoundingClientRect().height,i=(l=t(this,I).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Bt.SCROLLBAR_SIZE,a=e*s+r+i+o;t(this,I).style.height=`${a}px`},"#applyAutoHeight"));d(this,re,h(()=>{const e=Array.from(t(this,I).children).filter(c=>c.tagName==="TABLE"),s=t(this,I).getAttribute("auto-height")==="true",r=e.length,i=e.map((c,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,b=l<r-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+b}).join(""),o=e.map((c,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,I).shadowRoot.innerHTML=`
|
|
324
324
|
<style>
|
|
325
325
|
:host {
|
|
326
326
|
display: flex;
|
|
@@ -431,19 +431,19 @@
|
|
|
431
431
|
<nine-table-body>
|
|
432
432
|
<nine-table-summary></nine-table-summary>
|
|
433
433
|
<nine-table-sheets>
|
|
434
|
-
<nine-table-sheets-body>${
|
|
434
|
+
<nine-table-sheets-body>${i}</nine-table-sheets-body>
|
|
435
435
|
<nine-table-sheets-footer>
|
|
436
|
-
<div class="nine-tab-bar">${
|
|
436
|
+
<div class="nine-tab-bar">${o}</div>
|
|
437
437
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
438
438
|
</nine-table-sheets-footer>
|
|
439
439
|
</nine-table-sheets>
|
|
440
440
|
<nine-table-analysis></nine-table-analysis>
|
|
441
441
|
</nine-table-body>
|
|
442
442
|
<nine-table-footer></nine-table-footer>
|
|
443
|
-
`,t(this,I).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,I).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,It).call(this)})})},"#render"));y(this,I,n),t(this,ne).call(this)}};I=new WeakMap,ne=new WeakMap,It=new WeakMap,oe=new WeakMap,h(Ne,"LayoutManager");let ye=Ne;const ze=class ze{constructor(n){d(this,_t);d(this,pt,-1);T(this,"count",h(()=>t(this,_t).rawRecords.length,"count"));y(this,_t,n)}get at(){return t(this,pt)}set at(n){y(this,pt,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,pt)}"]`)&&setTimeout(()=>{})}};_t=new WeakMap,pt=new WeakMap,h(ze,"ngRow");let me=ze;const B=class B{constructor(n,e){d(this,N);d(this,M);d(this,W,[]);d(this,yt,[]);d(this,re,0);d(this,U,[]);d(this,ie,h(()=>{y(this,U,[]);const n=t(this,N).template||[];Array.from(n).forEach(e=>{var s;t(this,U).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,M).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Nt).call(this)),e.__ng.height=t(this,U).slice()})},"#initialize"));d(this,lt,h(()=>{const n=t(this,N).shadowRoot.querySelector("nine-table-sheets");n==null||n.classList.toggle("nodata",this.length===0),t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));T(this,"get",h((n,e)=>{var r;const s=this.getValidData();if(!s||s.length<=0)return;if(n==null)return t(this,mt).call(this,s);if(n<0||n>=s.length)return null;const o=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():[];if(e!=null){const i=o.indexOf(e);return i>=0?s[n].v[i]:null}return t(this,mt).call(this,s[n])},"get"));T(this,"set",h(n=>{this.clear(),this.add(n,!1),t(this,lt).call(this)},"set"));d(this,Nt,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,U).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,U).slice(),-1,{},{}]}),"#getDefaultMeta"));T(this,"reset",h(()=>{y(this,W,[]),y(this,yt,[]),t(this,lt).call(this)},"reset"));T(this,"clear",h(()=>{var n;t(this,M).rawRecords=[],y(this,W,[]),y(this,yt,[]),(n=t(this,M).viewRecords)!=null&&n.reset&&t(this,M).viewRecords.reset()},"clear"));d(this,ae,h(n=>{var o;Array.isArray(n)||(n=[n]);const e=typeof((o=t(this,N).fields)==null?void 0:o.get)=="function"?t(this,N).fields.get():Object.keys(n[0]||{}),s=[];return n.forEach(r=>{const i={v:[]};e.forEach(a=>{i.v.push(r[a]!==void 0&&r[a]!==null?r[a]:"")}),s.push(i)}),s},"#json2Array"));d(this,le,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,Nt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));T(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const s=t(this,ae).call(this,n);t(this,M).rawRecords=t(this,M).rawRecords.concat(t(this,le).call(this,s)),this.resetRecords();const o=this.count()-1;return e||s.forEach((r,i)=>{const a=t(this,M).rawRecords[o-i];a&&(a.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,lt).call(this),o},"add"));T(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,M).host.row.at]:e=[parseInt(n,10)],e.sort((s,o)=>o-s).forEach(s=>{if(t(this,W)[s]){const o=t(this,W)[s].__ng.rowid;t(this,W)[s].__ng.rowState===B.ROW_STATE.INSERT?t(this,M).rawRecords=t(this,M).rawRecords.filter(r=>r.__ng.rowid!==o):t(this,M).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,lt).call(this)},"delete"));T(this,"setValue",h((n,e,s)=>{var c;n=parseInt(n,10);const r=(typeof((c=t(this,N).fields)==null?void 0:c.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(r<0)return;const i=this.getValidData()[n];if(!i)return;const a=i.v[r];a!==s&&i.__ng.rowState!==B.ROW_STATE.INSERT&&(i.__ng.o.hasOwnProperty(e)||(i.__ng.o[e]=a),i.__ng.rowState=B.ROW_STATE.UPDATE),i.v[r]=s},"setValue"));T(this,"resetRecords",h(()=>{y(this,yt,t(this,M).rawRecords.filter(n=>!n.__ng.deleted)),y(this,W,t(this,M).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,M).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,W).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));T(this,"getValidData",h(()=>(t(this,W).length===0&&t(this,M).rawRecords.length>0&&this.resetRecords(),t(this,W)),"getValidData"));d(this,mt,h(n=>{var i;if(!n)return n;const e=!Array.isArray(n),s=e?[n]:n,o=typeof((i=t(this,N).fields)==null?void 0:i.get)=="function"?t(this,N).fields.get():[],r=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return o.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?r[0]:r},"#conv"));T(this,"count",h(()=>this.getValidData().length,"count"));y(this,N,n),y(this,M,e),t(this,ie).call(this)}get source(){return t(this,mt).call(this,t(this,M).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++os(this,re)._}get count(){return t(this,W).length}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,M=new WeakMap,W=new WeakMap,yt=new WeakMap,re=new WeakMap,U=new WeakMap,ie=new WeakMap,lt=new WeakMap,Nt=new WeakMap,ae=new WeakMap,le=new WeakMap,mt=new WeakMap,h(B,"ngData"),T(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let xe=B;const De=class De{constructor(n){d(this,ct);y(this,ct,n),this.row=new me(this),this.data=new xe(t(this,ct),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,ct).view)!=null&&e.redraw&&t(this,ct).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var o,r;const s=parseInt(e,10);if(!(s>=this.data.count()))return(r=(o=this.data.getValidData()[s])==null?void 0:o.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,o)=>{e=parseInt(e,10),this.data.setValue(e,s,o)},this.setDataSource([])}};ct=new WeakMap,h(De,"ngDataManager");let ve=De;const We=class We{constructor(n){d(this,xt);d(this,H,[]);T(this,"add",h((n,e="string")=>{n.forEach(s=>{t(this,H).some(o=>o.name===s)||t(this,H).push({name:s,type:e})}),t(this,zt).call(this)},"add"));d(this,zt,h(()=>{const n=new Map;t(this,H).forEach(e=>{n.set(e.name,e.type)}),y(this,H,Array.from(n,([e,s])=>({name:e,type:s}))),y(this,H,t(this,H).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,H).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,ce,h(()=>{y(this,H,[]),p.log(t(this,xt).querySelectorAll("table"));const n=Array.from(t(this,xt).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)p.log(e),$("[data-bind]",e).each((s,o)=>{const r=o.dataset.bind,i=o.getAttribute("data-type")||"string";r&&t(this,H).push({name:r,type:i})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((o,r)=>{var i=r.getAttribute(s);if(i.indexOf("data.")<0){const a=i.search(/[(]/g);if(a>0)try{i=String(window[i.substring(0,a).trim()])}catch{i=""}}i.split("data.").forEach(a=>{if(a.trim()!=""){const c=a.search(/[^_A-Za-z0-9]/g);let l="";c>=0?l=a.substring(0,c):i.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,H).push({name:l,type:"string"})}})})});t(this,zt).call(this)}},"#init"));y(this,xt,n),t(this,ce).call(this)}get(){return t(this,H).map(n=>n.name)}getFields(){return t(this,H)}getType(n){const e=t(this,H).find(s=>s.name===n);return e?e.type:"string"}indexOf(n){return t(this,H).findIndex(e=>e.name===n)}includes(n){return t(this,H).some(e=>e.name===n)}};xt=new WeakMap,H=new WeakMap,zt=new WeakMap,ce=new WeakMap,h(We,"ngFields");let we=We;const Be=class Be extends HTMLElement{constructor(){super();d(this,ht);d(this,he);d(this,de,h(()=>{this.fields=new we(this),y(this,he,new ye(this)),p.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,ht,new ve(this))}connectedCallback(){t(this,de).call(this)}disconnectedCallback(){p.log("NineTable disconnected.")}get data(){return t(this,ht).data}get row(){return t(this,ht).row}get dataManager(){return t(this,ht)}};ht=new WeakMap,he=new WeakMap,de=new WeakMap,h(Be,"NineTable");let Se=Be;customElements.get("nine-table")||customElements.define("nine-table",Se);const Dt=class Dt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Dt,"BasicCellElement"),T(Dt,"_styleCache",new Map),T(Dt,"_customStyleCache",new Map);let Ee=Dt;const Ve=class Ve extends Ee{constructor(){super();d(this,L);d(this,Wt);d(this,v);d(this,Oe);d(this,Pe);d(this,Fe);d(this,je);T(this,"getDisplayText",h(e=>{if(t(this,v))if(t(this,v).closest("tbody")){const s=t(this,v).closest("tr").data,o=parseInt(t(this,v).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,v).dataset.expr)){if(!ninegrid.isNull(t(this,v).dataset.bind))return s[t(this,v).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,v).dataset.expr,s,o,t(this,v))}catch{console.error(t(this,v).dataset.expr,s,t(this,v).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,L).exprFunction(t(this,v).dataset.expr).call(this,null,-1,t(this,L).data)}catch{}},"getDisplayText"));d(this,Ye,h(()=>{if(!(!t(this,L)||!t(this,L).template||!t(this,v).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,v)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,v).closest("tr"),o=[];$("th,td",s).each((x,z)=>{var C=ninegrid.j.querySelectorAll(z).attr("suppress");C&&z.dataset.row&&(C=parseInt(C),!isNaN(C)&&C<=e&&o.push(C))}),o.sort();var r=!1;if(parseInt(s.sectionRowIndex/t(this,L).template.length)>0)for(var i of o){if(i>e)break;var a=parseInt(t(this,v).dataset.row),c=a-1,l=t(this,v).closest("tr").data,f=t(this,L).data.get(c);t(this,v).dataset.matrixRow;var u=t(this,L).body.querySelector(`tbody.bindable [suppress="${i}"][data-matrix-row="${t(this,v).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,c):f[u.dataset.bind];if(b!=g){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,v)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,v)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,v)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,v)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,v)).addClass("hidden"));var m=parseInt(t(this,v).dataset.matrixRow),w=m-1,A=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,v).dataset.col}"][data-matrix-row="${w}"]`);$(A).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,v)).hasClass("suppress")?ninegrid.j.querySelectorAll(A).removeClass("last-none-suppress").addClass("last-suppress"):!$(A).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,v)).hasClass("suppress")?ninegrid.j.querySelectorAll(A).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(A).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));T(this,"getExprValue",h((e,s,o,r)=>{if(typeof e<"u")try{o=parseInt(o);const i=e.replace("()","");return t(this,L)[i]?t(this,L)[i].call(this,s,o,t(this,v)):t(this,L).exprFunction(e).call(this,s,o,t(this,L).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,L,this.getRootNode().host),y(this,v,this.closest("th,td")),y(this,Wt,t(this,v).closest("tr"))}get value(){var e=!t(this,L)||!t(this,L).dataManager||!t(this,v)||!t(this,v).dataset||!t(this,v).dataset.row||!t(this,v).dataset.bind?"":t(this,v).closest("tr").data[t(this,v).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,v).dataset.row);const o=this.getAttribute("update-row-state")!="false";s<0?t(this,L).data.setValueNF(parseInt(t(this,v).dataset.index),t(this,v).dataset.bind,e,o):t(this,L).data.setValue(s,t(this,v).dataset.bind,e,o)}get row(){return parseInt(t(this,v).dataset.row)}get data(){return t(this,v).closest("tr").data}refresh(){const e=t(this,v).dataset.bind;return parseInt(t(this,v).dataset.row),t(this,Wt).data[e]}};L=new WeakMap,Wt=new WeakMap,v=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Fe=new WeakMap,je=new WeakMap,Ye=new WeakMap,h(Ve,"CellElement");let Re=Ve;const Xe=class Xe extends Re{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(Xe,"EditableCellElement");let Ae=Xe;const Ke=class Ke extends Ae{constructor(){super();d(this,Bt);d(this,dt);d(this,vt);d(this,wt);d(this,fe);d(this,K);T(this,"refresh",h(()=>{const e=super.refresh();t(this,Bt).value=e},"refresh"));d(this,Ue,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,dt)=="number"){let r=[];if(t(this,K)&&Number(t(this,K))>0&&r.push("."),t(this,wt)&&Number(t(this,wt))>=0&&r.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!r.includes(e.key)&&e.preventDefault(),t(this,K)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,o=s.indexOf(".");if(o>=0){var s=s.substr(o+1,s.length);s.length>=Number(t(this,K))&&e.preventDefault()}}}t(this,vt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,vt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),y(this,dt,this.getAttribute("type")||"text"),y(this,vt,this.getAttribute("maxbyte")),y(this,wt,this.getAttribute("min")),y(this,fe,this.getAttribute("max")),y(this,K,this.getAttribute("scale")),!["text","number"].includes(t(this,dt)))throw`invalid type : ${t(this,dt)}`}connectedCallback(){for(var e=[],s=0;s<this.attributes.length;s++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[s].name)&&e.push(`${this.attributes[s].name}="${this.attributes[s].value}"`);this.innerHTML=`
|
|
443
|
+
`,t(this,I).shadowRoot.querySelector("nine-table-sheets").classList.add("nodata");const a=t(this,I).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((c,l)=>{e[l]&&setTimeout(()=>{c.generate(e[l]),s&&t(this,$t).call(this)})})},"#render"));p(this,I,n),t(this,ne).call(this)}};I=new WeakMap,ne=new WeakMap,$t=new WeakMap,re=new WeakMap,h(Ne,"LayoutManager");let ye=Ne;const ze=class ze{constructor(n){d(this,Mt);d(this,gt,-1);q(this,"count",h(()=>t(this,Mt).rawRecords.length,"count"));p(this,Mt,n)}get at(){return t(this,gt)}set at(n){p(this,gt,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,gt)}"]`)&&setTimeout(()=>{})}};Mt=new WeakMap,gt=new WeakMap,h(ze,"ngRow");let me=ze;const O=class O{constructor(n,e){d(this,N);d(this,L);d(this,z,[]);d(this,bt,[]);d(this,ie,0);d(this,X,[]);d(this,oe,h(()=>{p(this,X,[]);const n=t(this,N).template||[];Array.from(n).forEach(e=>{var s;t(this,X).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,It).call(this)),e.__ng.height=t(this,X).slice()})},"#initialize"));d(this,at,h(()=>{const n=t(this,N).shadowRoot.querySelector("nine-table-sheets");n==null||n.classList.toggle("nodata",this.length===0),t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));q(this,"get",h((n,e)=>{var i;const s=this.getValidData();if(!s||s.length<=0)return;if(n==null)return t(this,pt).call(this,s);if(n<0||n>=s.length)return null;const r=typeof((i=t(this,N).fields)==null?void 0:i.get)=="function"?t(this,N).fields.get():[];if(e!=null){const o=r.indexOf(e);return o>=0?s[n].v[o]:null}return t(this,pt).call(this,s[n])},"get"));q(this,"set",h(n=>{this.clear(),this.add(n,!1),t(this,at).call(this)},"set"));d(this,It,h(()=>({rowState:O.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,X).slice(),o:{},c:{},_:[0,0,0,0,O.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,X).slice(),-1,{},{}]}),"#getDefaultMeta"));q(this,"reset",h(()=>{p(this,z,[]),p(this,bt,[]),t(this,at).call(this)},"reset"));q(this,"clear",h(()=>{var n;t(this,L).rawRecords=[],p(this,z,[]),p(this,bt,[]),(n=t(this,L).viewRecords)!=null&&n.reset&&t(this,L).viewRecords.reset()},"clear"));d(this,ae,h(n=>{var r;Array.isArray(n)||(n=[n]);const e=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():Object.keys(n[0]||{}),s=[];return n.forEach(i=>{const o={v:[]};e.forEach(a=>{o.v.push(i[a]!==void 0&&i[a]!==null?i[a]:"")}),s.push(o)}),s},"#json2Array"));d(this,le,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,It).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=O.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));q(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const s=t(this,ae).call(this,n);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,le).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((i,o)=>{const a=t(this,L).rawRecords[r-o];a&&(a.__ng.rowState=O.ROW_STATE.EMPTY)}),t(this,at).call(this),r},"add"));q(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,L).host.row.at]:e=[parseInt(n,10)],e.sort((s,r)=>r-s).forEach(s=>{if(t(this,z)[s]){const r=t(this,z)[s].__ng.rowid;t(this,z)[s].__ng.rowState===O.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(i=>i.__ng.rowid!==r):t(this,L).rawRecords.forEach(i=>{i.__ng.rowid===r&&(i.__ng.deleted=!0,i.__ng.rowState=O.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,at).call(this)},"delete"));q(this,"setValue",h((n,e,s)=>{var c;n=parseInt(n,10);const i=(typeof((c=t(this,N).fields)==null?void 0:c.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(i<0)return;const o=this.getValidData()[n];if(!o)return;const a=o.v[i];a!==s&&o.__ng.rowState!==O.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(e)||(o.__ng.o[e]=a),o.__ng.rowState=O.ROW_STATE.UPDATE),o.v[i]=s},"setValue"));q(this,"resetRecords",h(()=>{p(this,bt,t(this,L).rawRecords.filter(n=>!n.__ng.deleted)),p(this,z,t(this,L).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,L).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,z).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));q(this,"getValidData",h(()=>(t(this,z).length===0&&t(this,L).rawRecords.length>0&&this.resetRecords(),t(this,z)),"getValidData"));d(this,pt,h(n=>{var o;if(!n)return n;const e=!Array.isArray(n),s=e?[n]:n,r=typeof((o=t(this,N).fields)==null?void 0:o.get)=="function"?t(this,N).fields.get():[],i=s.filter(a=>!a.__ng.deleted).map(a=>{const c={};return r.forEach((l,f)=>{c[l]=a.v?a.v[f]:a[l]}),c.__ng=a.__ng,c});return e?i[0]:i},"#conv"));q(this,"count",h(()=>this.getValidData().length,"count"));p(this,N,n),p(this,L,e),t(this,oe).call(this)}get source(){return t(this,pt).call(this,t(this,L).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++ts(this,ie)._}get count(){return t(this,z).length}get length(){return t(this,z).length}getRowCount(){return this.length}};N=new WeakMap,L=new WeakMap,z=new WeakMap,bt=new WeakMap,ie=new WeakMap,X=new WeakMap,oe=new WeakMap,at=new WeakMap,It=new WeakMap,ae=new WeakMap,le=new WeakMap,pt=new WeakMap,h(O,"ngData"),q(O,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let xe=O;const We=class We{constructor(n){d(this,lt);p(this,lt,n),this.row=new me(this),this.data=new xe(t(this,lt),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,lt).view)!=null&&e.redraw&&t(this,lt).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var r,i;const s=parseInt(e,10);if(!(s>=this.data.count()))return(i=(r=this.data.getValidData()[s])==null?void 0:r.__ng)==null?void 0:i.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,r)=>{e=parseInt(e,10),this.data.setValue(e,s,r)},this.setDataSource([])}};lt=new WeakMap,h(We,"ngDataManager");let ve=We;const Oe=class Oe{constructor(n){d(this,yt);d(this,M,[]);q(this,"add",h((n,e="string")=>{n.forEach(s=>{t(this,M).some(r=>r.name===s)||t(this,M).push({name:s,type:e})}),t(this,_t).call(this)},"add"));d(this,_t,h(()=>{const n=new Map;t(this,M).forEach(e=>{n.set(e.name,e.type)}),p(this,M,Array.from(n,([e,s])=>({name:e,type:s}))),p(this,M,t(this,M).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,M).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,ce,h(()=>{p(this,M,[]),x.log(t(this,yt).querySelectorAll("table"));const n=Array.from(t(this,yt).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)x.log(e),$("[data-bind]",e).each((s,r)=>{const i=r.dataset.bind,o=r.getAttribute("data-type")||"string";i&&t(this,M).push({name:i,type:o})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(s=>{$(`[${s}]`,e).each((r,i)=>{var o=i.getAttribute(s);if(o.indexOf("data.")<0){const a=o.search(/[(]/g);if(a>0)try{o=String(window[o.substring(0,a).trim()])}catch{o=""}}o.split("data.").forEach(a=>{if(a.trim()!=""){const c=a.search(/[^_A-Za-z0-9]/g);let l="";c>=0?l=a.substring(0,c):o.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,M).push({name:l,type:"string"})}})})});t(this,_t).call(this)}},"#init"));p(this,yt,n),t(this,ce).call(this)}get(){return t(this,M).map(n=>n.name)}getFields(){return t(this,M)}getType(n){const e=t(this,M).find(s=>s.name===n);return e?e.type:"string"}indexOf(n){return t(this,M).findIndex(e=>e.name===n)}includes(n){return t(this,M).some(e=>e.name===n)}};yt=new WeakMap,M=new WeakMap,_t=new WeakMap,ce=new WeakMap,h(Oe,"ngFields");let we=Oe;const Be=class Be extends HTMLElement{constructor(){super();d(this,ct);d(this,he);d(this,de,h(()=>{this.fields=new we(this),p(this,he,new ye(this)),x.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),p(this,ct,new ve(this))}connectedCallback(){t(this,de).call(this)}disconnectedCallback(){x.log("NineTable disconnected.")}get data(){return t(this,ct).data}get row(){return t(this,ct).row}get dataManager(){return t(this,ct)}};ct=new WeakMap,he=new WeakMap,de=new WeakMap,h(Be,"NineTable");let Se=Be;customElements.get("nine-table")||customElements.define("nine-table",Se);const Nt=class Nt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Nt,"BasicCellElement"),q(Nt,"_styleCache",new Map),q(Nt,"_customStyleCache",new Map);let Ee=Nt;const Ve=class Ve extends Ee{constructor(){super();d(this,H);d(this,zt);d(this,y);d(this,De);d(this,Pe);d(this,Fe);d(this,je);q(this,"getDisplayText",h(e=>{if(t(this,y))if(t(this,y).closest("tbody")){const s=t(this,y).closest("tr").data,r=parseInt(t(this,y).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,y).dataset.expr)){if(!ninegrid.isNull(t(this,y).dataset.bind))return s[t(this,y).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,y).dataset.expr,s,r,t(this,y))}catch{console.error(t(this,y).dataset.expr,s,t(this,y).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,H).exprFunction(t(this,y).dataset.expr).call(this,null,-1,t(this,H).data)}catch{}},"getDisplayText"));d(this,Ye,h(()=>{if(!(!t(this,H)||!t(this,H).template||!t(this,y).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,y)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,y).closest("tr"),r=[];$("th,td",s).each((v,W)=>{var k=ninegrid.j.querySelectorAll(W).attr("suppress");k&&W.dataset.row&&(k=parseInt(k),!isNaN(k)&&k<=e&&r.push(k))}),r.sort();var i=!1;if(parseInt(s.sectionRowIndex/t(this,H).template.length)>0)for(var o of r){if(o>e)break;var a=parseInt(t(this,y).dataset.row),c=a-1,l=t(this,y).closest("tr").data,f=t(this,H).data.get(c);t(this,y).dataset.matrixRow;var u=t(this,H).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,y).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,c):f[u.dataset.bind];if(b!=g){i=!0;break}}else i=!0;i?ninegrid.j.querySelectorAll(t(this,y)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,y)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,y)).hasClass("hidden")||(i?ninegrid.j.querySelectorAll(t(this,y)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,y)).addClass("hidden"));var m=parseInt(t(this,y).dataset.matrixRow),w=m-1,T=t(this,H).body.querySelector(`tbody.bindable [data-col="${t(this,y).dataset.col}"][data-matrix-row="${w}"]`);$(T).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,y)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").addClass("last-suppress"):!$(T).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,y)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));q(this,"getExprValue",h((e,s,r,i)=>{if(typeof e<"u")try{r=parseInt(r);const o=e.replace("()","");return t(this,H)[o]?t(this,H)[o].call(this,s,r,t(this,y)):t(this,H).exprFunction(e).call(this,s,r,t(this,H).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),p(this,H,this.getRootNode().host),p(this,y,this.closest("th,td")),p(this,zt,t(this,y).closest("tr"))}get value(){var e=!t(this,H)||!t(this,H).dataManager||!t(this,y)||!t(this,y).dataset||!t(this,y).dataset.row||!t(this,y).dataset.bind?"":t(this,y).closest("tr").data[t(this,y).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,y).dataset.row);const r=this.getAttribute("update-row-state")!="false";s<0?t(this,H).data.setValueNF(parseInt(t(this,y).dataset.index),t(this,y).dataset.bind,e,r):t(this,H).data.setValue(s,t(this,y).dataset.bind,e,r)}get row(){return parseInt(t(this,y).dataset.row)}get data(){return t(this,y).closest("tr").data}refresh(){const e=t(this,y).dataset.bind;return parseInt(t(this,y).dataset.row),t(this,zt).data[e]}};H=new WeakMap,zt=new WeakMap,y=new WeakMap,De=new WeakMap,Pe=new WeakMap,Fe=new WeakMap,je=new WeakMap,Ye=new WeakMap,h(Ve,"CellElement");let Ae=Ve;const Ue=class Ue extends Ae{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(Ue,"EditableCellElement");let Re=Ue;const Ke=class Ke extends Re{constructor(){super();d(this,Wt);d(this,ht);d(this,mt);d(this,xt);d(this,fe);d(this,K);q(this,"refresh",h(()=>{const e=super.refresh();t(this,Wt).value=e},"refresh"));d(this,Xe,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,ht)=="number"){let i=[];if(t(this,K)&&Number(t(this,K))>0&&i.push("."),t(this,xt)&&Number(t(this,xt))>=0&&i.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!i.includes(e.key)&&e.preventDefault(),t(this,K)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,r=s.indexOf(".");if(r>=0){var s=s.substr(r+1,s.length);s.length>=Number(t(this,K))&&e.preventDefault()}}}t(this,mt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,mt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),p(this,ht,this.getAttribute("type")||"text"),p(this,mt,this.getAttribute("maxbyte")),p(this,xt,this.getAttribute("min")),p(this,fe,this.getAttribute("max")),p(this,K,this.getAttribute("scale")),!["text","number"].includes(t(this,ht)))throw`invalid type : ${t(this,ht)}`}connectedCallback(){for(var e=[],s=0;s<this.attributes.length;s++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[s].name)&&e.push(`${this.attributes[s].name}="${this.attributes[s].value}"`);this.innerHTML=`
|
|
444
444
|
<input type="text"
|
|
445
445
|
${e.join(" ")}
|
|
446
446
|
ondragstart="return false;"
|
|
447
447
|
>
|
|
448
|
-
`,super.connectedCallback(),
|
|
448
|
+
`,super.connectedCallback(),p(this,Wt,this.querySelector("input"))}};Wt=new WeakMap,ht=new WeakMap,mt=new WeakMap,xt=new WeakMap,fe=new WeakMap,K=new WeakMap,Xe=new WeakMap,h(Ke,"CellInputText");let qe=Ke;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",qe)});
|
|
449
449
|
//# sourceMappingURL=nine-table.umd.js.map
|