@ninebone/table 0.0.643 → 0.0.644
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 +386 -384
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +7 -7
- 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(
|
|
1
|
+
(function(E,w){typeof exports=="object"&&typeof module<"u"?w(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],w):(E=typeof globalThis<"u"?globalThis:E||self,w(E.NineboneUtil))})(this,function(E){"use strict";var Fe=Object.defineProperty;var Ve=E=>{throw TypeError(E)};var Ke=(E,w,x)=>w in E?Fe(E,w,{enumerable:!0,configurable:!0,writable:!0,value:x}):E[w]=x;var c=(E,w)=>Fe(E,"name",{value:w,configurable:!0});var R=(E,w,x)=>Ke(E,typeof w!="symbol"?w+"":w,x),Ye=(E,w,x)=>w.has(E)||Ve("Cannot "+x);var t=(E,w,x)=>(Ye(E,w,"read from private field"),x?x.call(E):w.get(E)),d=(E,w,x)=>w.has(E)?Ve("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(E):w.set(E,x),y=(E,w,x,V)=>(Ye(E,w,"write to private field"),V?V.call(E,x):w.set(E,x),x);var Ue=(E,w,x,V)=>({set _(vt){y(E,w,vt,x)},get _(){return t(E,w,V)}});var D,Y,A,G,J,Q,Wt,tt,Ot,U,ht,et,C,xt,wt,zt,j,q,st,P,_,X,it,St,qe,Re,Bt,Dt,Pt,Et,At,jt,Ft,qt,Te,dt,Rt,Vt,Ut,nt,rt,Xt,Kt,ft,Zt,Gt,Jt,kt,I,Qt,Ct,te,Lt,ut,N,L,W,gt,ee,K,se,ot,Ht,ie,ne,bt,at,yt,M,Mt,re,lt,oe,ae,H,It,p,_e,Ne,We,Oe,ze,_t,ct,pt,mt,le,Z,Pe;const Se=class Se extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};c(Se,"Trace");let w=Se;const x=new w,Ee=class Ee extends HTMLElement{constructor(){super();d(this,D);d(this,Y,!1);d(this,A);d(this,G);d(this,J);d(this,Q);d(this,Wt,c(()=>{if(!t(this,D))return;const e=t(this,D).querySelector(".ng-container-body .ng-part-body");e&&(y(this,Q,new ResizeObserver(()=>{this.refresh()})),t(this,Q).observe(e))},"#observeResize"));R(this,"refresh",c(()=>{if(!t(this,D)||!t(this,A)||t(this,Y))return;const e=t(this,A).container,s=e.querySelector("table");if(!s)return;const n=t(this,A).track,r=t(this,A).thumb,o=t(this,D).querySelector(".ng-container-bottom"),a=e.clientWidth,h=s.scrollWidth;if(a!==0&&h>a)o&&(o.style.display="flex");else{o&&(o.style.display="none");return}const l=n.clientWidth;if(l<=0)return;const f=Math.max(Math.min(l*(a/h),l),20);r.style.width=`${f}px`;const g=e.scrollLeft,b=h-a;let u=0;b>0&&(u=parseInt(g/b*(l-f),10)),u<0&&(u=0);const v=l-f;u>v&&(u=v),r.style.left=`${u}px`,t(this,A).left.disabled=u===0,t(this,A).right.disabled=u>=v-1},"refresh"));d(this,tt,c(e=>{if(!t(this,A))return!1;const s=t(this,A).container,n=s.querySelector("table");if(!n)return!1;const r=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;let a=e;a<0&&(a=0);const h=r.width-o;a>h&&(a=h),a=parseInt(a,10),t(this,A).thumb.style.left=`${a}px`,t(this,A).left.disabled=a===0,t(this,A).right.disabled=a>=h-1;const l=s.clientWidth,g=n.scrollWidth-l;return h>0&&g>0&&(s.scrollLeft=a/h*g),a>0&&a<h-1},"#thumbMoveTo"));d(this,Ot,c(()=>{const e=c(n=>{clearInterval(t(this,G)),clearInterval(t(this,J));const r=parseInt(t(this,A).thumb.style.left||0,10);t(this,tt).call(this,r+n),y(this,G,setInterval(()=>{clearInterval(t(this,G)),y(this,J,setInterval(()=>{const o=parseInt(t(this,A).thumb.style.left||0,10);t(this,tt).call(this,o+n)||clearInterval(t(this,J))},50))},500))},"delayScroll"),s=c(()=>{clearInterval(t(this,G)),clearInterval(t(this,J))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(n=>{t(this,A).left.addEventListener(n,s),t(this,A).right.addEventListener(n,s),t(this,A).track.addEventListener(n,s)}),t(this,A).left.addEventListener("mousedown",n=>{n.button===0&&e(-20)}),t(this,A).right.addEventListener("mousedown",n=>{n.button===0&&e(20)}),t(this,A).left.addEventListener("touchstart",()=>e(-20)),t(this,A).right.addEventListener("touchstart",()=>e(20)),t(this,A).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const r=t(this,A).track.getBoundingClientRect(),o=t(this,A).thumb.clientWidth;t(this,tt).call(this,n.clientX-r.left-o/2)}),t(this,A).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,Y,!0),this.shiftX=n.clientX-t(this,A).thumb.getBoundingClientRect().left;const r=c(a=>{if(!t(this,Y))return;const h=t(this,A).track.getBoundingClientRect();t(this,tt).call(this,a.clientX-h.left-this.shiftX)},"onMouseMove"),o=c(()=>{y(this,Y,!1),s(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(y(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=
|
|
63
|
+
`;const e=c(()=>{const s=t(this,D).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,A,{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,Ot).call(this),t(this,Wt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,Q)&&t(this,Q).disconnect()}};D=new WeakMap,Y=new WeakMap,A=new WeakMap,G=new WeakMap,J=new WeakMap,Q=new WeakMap,Wt=new WeakMap,tt=new WeakMap,Ot=new WeakMap,c(Ee,"NineTableHScrollBar");let V=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",V);const Ae=class Ae extends HTMLElement{constructor(){super();d(this,U);d(this,ht);d(this,et,!1);d(this,C);d(this,xt,0);d(this,wt,0);R(this,"refresh",c(()=>{if(!t(this,U)||!t(this,C))return;const e=t(this,C).container,s=t(this,C).track,n=t(this,C).thumb,r=e.clientHeight,o=t(this,U).data.length,a=t(this,ht).getRowHeight(),h=o*a;if(h<=r||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*(r/h),l),20);n.style.height=`${f}px`;const g=e.scrollTop,b=Math.max(h-r,1);let u=0;b>0&&(u=g/b*(l-f));const v=l-f;u<0&&(u=0),u>v&&(u=v),n.style.top=`${u}px`,t(this,C).top.disabled=g<=0,t(this,C).bottom.disabled=g>=b-1},"refresh"));d(this,zt,c(()=>{x.log("nine-table-vscrollbar.#init");const e=t(this,C).container,s=c(()=>{const r=(t(this,U).data.get()||[]).length,o=t(this,ht).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,et)||this.refresh()}),t(this,C).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,et,!0),y(this,xt,n.clientY),y(this,wt,e.scrollTop);const r=c(a=>{if(!t(this,et))return;const h=t(this,C).track.getBoundingClientRect(),l=t(this,C).thumb.clientHeight,g=h.height-l,b=a.clientY-t(this,xt),u=e.clientHeight,v=s(),S=Math.max(v-u,1);if(g>0&&S>0){const T=b/g*S;let m=t(this,wt)+T;const z=Math.max(0,v-u);m<0&&(m=0),m>z&&(m=z),e.scrollTop=m}this.refresh()},"onMouseMove"),o=c(()=>{y(this,et,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,C).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,C).thumb)return;const r=t(this,C).track.getBoundingClientRect(),o=t(this,C).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.height-o,f=e.clientHeight,g=s(),b=Math.max(g-f,1);if(l>0&&b>0){const u=Math.max(0,Math.min(1,a/l));e.scrollTop=u*b}this.refresh()}),t(this,C).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,C).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,U,this.getRootNode().host),y(this,ht,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,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(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,zt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,tt=new WeakMap,k=new WeakMap,vt=new WeakMap,xt=new WeakMap,zt=new WeakMap,h(Ae,"NineTableVScrollBar");let mt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){d(this,j);d(this,A);d(this,et);d(this,D,new Map);d(this,_,null);d(this,U,null);d(this,st,0);d(this,wt,40);d(this,qe,!1);d(this,Re,!1);d(this,Bt,3);T(this,"refresh",h(()=>{var e;x.log("rowManager.refresh");const i=t(this,A).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",h(()=>{x.log("rowManager.initialize"),p(this,et,{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,D).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 g=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,D).set(o,g)});const i=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"),n=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let o=!1;const a=h(c=>{if(o)return;o=!0;const l=c.scrollTop,f=c.scrollLeft;i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),n&&n.scrollLeft!==f&&(n.scrollLeft=f),t(this,ht).call(this,l),o=!1},"handleContainerScroll");[i,e,s].forEach(c=>{c&&c.addEventListener("scroll",()=>{a(c)},{passive:!0})})}},"initialize"));d(this,Dt,h((i,e)=>{x.log("rowManager.#renderRows");const s=t(this,D).get(e);if(!s||s.length===0)return;const r=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const n=r.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,wt);a++)s.forEach(c=>{o.appendChild(c.cloneNode(!0))});n?n.before(o):r.appendChild(o),e===".ng-container-body"&&(t(this,et).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Pt,h(i=>{if(x.log("rowManager.#measureAndCacheHeight"),t(this,_)!==null&&t(this,_)>0)return t(this,_);x.log("#measureAndCacheHeight");const e=t(this,D).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=i.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"),n=document.createDocumentFragment();e.forEach(b=>{n.appendChild(b.cloneNode(!0))}),r?r.before(n):s.appendChild(n);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 g=s.querySelectorAll("tr");if(g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const m=window.getComputedStyle(b);u=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=c,o.style.position=l,f<=0)throw new Error("invalid dom");return p(this,_,f),t(this,Et).call(this),t(this,_)},"#measureAndCacheHeight"));d(this,St,h(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).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(n=>{const o=t(this,A).querySelector(n);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,Et,h(()=>{if(t(this,st)>0&&t(this,_)>0){const i=Math.ceil(t(this,st)/t(this,_));p(this,wt,i+t(this,Bt))}},"#updateRowCount"));d(this,jt,h(()=>{var a,c,l,f,g,b;const i=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 u=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),q=s?Array.from(s.querySelectorAll("tbody tr")):[],R=Math.max(u.length,m.length,q.length);for(let v=0;v<R;v++){const W=[((a=u[v])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[v])==null?void 0:c.getBoundingClientRect().height)||0,((l=q[v])==null?void 0:l.getBoundingClientRect().height)||0],H=Math.max(...W);H>0&&(u[v]&&(u[v].style.height=`${H}px`),m[v]&&(m[v].style.height=`${H}px`),q[v]&&(q[v].style.height=`${H}px`))}}const r=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),n=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(n){const u=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(n.querySelectorAll("tfoot tr")),q=o?Array.from(o.querySelectorAll("tfoot tr")):[],R=Math.max(u.length,m.length,q.length);for(let v=0;v<R;v++){const W=[((f=u[v])==null?void 0:f.getBoundingClientRect().height)||0,((g=m[v])==null?void 0:g.getBoundingClientRect().height)||0,((b=q[v])==null?void 0:b.getBoundingClientRect().height)||0],H=Math.max(...W);H>0&&(u[v]&&(u[v].style.height=`${H}px`),m[v]&&(m[v].style.height=`${H}px`),q[v]&&(q[v].style.height=`${H}px`))}}},"#syncRowHeights"));d(this,Ft,h(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,U,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let n=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(n+=o.offsetHeight),a&&(n+=a.offsetHeight);const c=Math.max(r-n,100);t(this,st)!==c&&(p(this,st,c),t(this,Et).call(this),t(this,_)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,A)))},"#initResizeObserver"));d(this,At,h(()=>{x.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,A).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Dt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,Te,h(i=>{[".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 n=Array.from(r.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,D).get(e))==null?void 0:l.length)||1,c=(t(this,j).data.get()||[]).length;n.forEach((f,g)=>{const b=i+Math.floor(g/o);if(b>=c){f.style.visibility="hidden";return}const u=t(this,j).data.get(b);f.style.display="",t(this,qt).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,ht,h(i=>{var f,g;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const r=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,n=Math.max(0,s-1),o=Math.min(n,Math.max(0,Math.floor(i/e))),a=Math.floor(o*e);x.log(`📜 [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, startIndex: ${o}, offsetY: ${a}`);const c=t(this,et).firstTr,l=c&&c.dataset.row!==void 0?parseInt(c.dataset.row,10):-1;(g=t(this,et))==null||g.scrollTables.forEach(b=>{b.style.transform=`translate3d(0, ${a}px, 0)`}),l!==o&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(b=>{const u=t(this,A).querySelector(b);if(!u)return;const m=u.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((R,v)=>{const W=o+Math.floor(v/r);if(W>=s){R.style.display="none";return}const H=t(this,j).data.get(W);R.style.display="",t(this,qt).call(this,R,H,W)})})},"#handleScroll"));d(this,qt,h((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((r,n)=>{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,Vt,h(()=>{var c,l,f;x.log("rowManager.#syncHeaderHeights");const i=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=i?Array.from(i.querySelectorAll("tr")):[],n=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,n.length,o.length);for(let g=0;g<a;g++){const b=[((c=r[g])==null?void 0:c.getBoundingClientRect().height)||0,((l=n[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(r[g]&&(r[g].style.height=`${u}px`),n[g]&&(n[g].style.height=`${u}px`),o[g]&&(o[g].style.height=`${u}px`))}},"#syncHeaderHeights"));T(this,"destroy",h(()=>{t(this,U)&&(t(this,U).disconnect(),p(this,U,null))},"destroy"));p(this,j,i.getRootNode().host),p(this,A,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,A=new WeakMap,et=new WeakMap,D=new WeakMap,_=new WeakMap,U=new WeakMap,st=new WeakMap,wt=new WeakMap,qe=new WeakMap,Re=new WeakMap,Bt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,Te=new WeakMap,ht=new WeakMap,qt=new WeakMap,Vt=new WeakMap,h(ke,"RowManager");let ce=ke;const Yt=class Yt{static compileAll(i){return Array.isArray(i)?i.map(e=>Yt.compile(e)):[]}static compile(i){if(!i)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 g=`cell-${f}`;const b=l.getAttribute("data-bind"),u=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),q=l.getAttribute("type");let R=[];b&&R.push(`data-bind="${b}"`),u&&R.push(`data-expr="${u}"`),m&&R.push(`maxbyte="${m}"`),q&&R.push(`type="${q}"`),l.innerHTML=`<${g} ${R.join(" ")}></${g}>`})},"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"),g=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const u=document.createElement("col");u.setAttribute("width",g),f.appendChild(u)}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")),g=l.length;if(g===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(m=>{const q=m.sectionRowIndex;let R=0;Array.from(m.querySelectorAll("th,td")).forEach(v=>{for(let P=0;P<u[q].length;P++)if(u[q][P]===null){R=P;break}const W=v.rowSpan||1,H=v.colSpan||1;for(let P=0;P<W;P++)for(let _t=0;_t<H;_t++)q+P<g&&R+_t<b&&(u[q+P][R+_t]=P===0&&_t===0?"1":"0")})}),l.forEach(m=>{const q=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(R=>{for(let v=0;v<u[q].length;v++)if(u[q][v]==="1"){R.dataset.col=v,u[q][v]="0";break}})})},"resetColIndex"),n=i.cloneNode(!0);return s(n),e(n),r(n,"thead"),r(n,"tbody"),r(n,"tfoot"),Array.from(n.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&n.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),n}};h(Yt,"TableCompiler");let he=Yt;const Rt=class Rt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,rt);T(this,"invalidate",h(()=>{t(this,rt).refresh()},"invalidate"));d(this,Xt,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 n,o,a;(n=this.querySelector(`${s} .ng-part-header`))==null||n.appendChild(t(this,dt).call(this,t(this,it),r,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,dt).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,dt).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,Kt,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 n=0;r[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.getAttribute("width"),10);isNaN(n)||(n+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${n}px`,s.style.width=`${n}px`)})},"#updateContainerWidths"));T(this,"generate",h(e=>{if(!e)return;p(this,it,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),n=this.querySelector(".ng-nodata-overlay");s&&n&&(n.style.top=`${s.offsetHeight}px`),r&&n&&(n.style.bottom=`${r.offsetHeight}px`),t(this,rt).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,dt,h((e,s,r)=>{const n=e.cloneNode(!0),o=n.querySelector("thead"),a=n.querySelector("tbody"),c=n.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",n.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"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):n.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),n},"#createSplitTable"));T(this,"getRowHeight",h(()=>t(this,rt).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,Zt,h(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,h(()=>{const e=Rt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
126
|
+
`;const e=c(()=>{const s=t(this,U).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(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,zt).call(this),this.refresh()},"initWhenReady");e()}};U=new WeakMap,ht=new WeakMap,et=new WeakMap,C=new WeakMap,xt=new WeakMap,wt=new WeakMap,zt=new WeakMap,c(Ae,"NineTableVScrollBar");let vt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",vt);const ke=class ke{constructor(i){d(this,j);d(this,q);d(this,st);d(this,P,new Map);d(this,_,null);d(this,X,null);d(this,it,0);d(this,St,40);d(this,qe,!1);d(this,Re,!1);d(this,Bt,3);R(this,"refresh",c(()=>{var e;x.log("rowManager.refresh");const i=t(this,q).querySelector(".ng-container-body .ng-part-body");i&&(t(this,Et).call(this),t(this,dt).call(this,i.scrollTop),(e=t(this,q).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",c(()=>{x.log("rowManager.initialize"),y(this,st,{scrollTables:t(this,q).querySelectorAll(".ng-part-body table"),firstTr:t(this,q).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(o=>{const a=t(this,q).querySelector(o);if(!a)return;const h=a.querySelector(".ng-part-body table");if(!h)return;const l=h.querySelector("tbody.bindable-tbody");if(!l)return;const g=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(o,g)});const i=t(this,q).querySelector(".ng-container-body .ng-part-body"),e=t(this,q).querySelector(".ng-container-left .ng-part-body"),s=t(this,q).querySelector(".ng-container-right .ng-part-body"),n=t(this,q).querySelector(".ng-container-body .ng-part-header"),r=t(this,q).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Pt).call(this,i),t(this,qt).call(this),t(this,Et).call(this),t(this,dt).call(this,i.scrollTop);let o=!1;const a=c(h=>{if(o)return;o=!0;const l=h.scrollTop,f=h.scrollLeft;i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),n&&n.scrollLeft!==f&&(n.scrollLeft=f),r&&r.scrollLeft!==f&&(r.scrollLeft=f),t(this,dt).call(this,l),o=!1},"handleContainerScroll");[i,e,s].forEach(h=>{h&&h.addEventListener("scroll",()=>{a(h)},{passive:!0})})}},"initialize"));d(this,Dt,c((i,e)=>{x.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const n=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;n.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const r=n.querySelector("tr.nodata"),o=document.createDocumentFragment();for(let a=0;a<t(this,St);a++)s.forEach(h=>{o.appendChild(h.cloneNode(!0))});r?r.before(o):n.appendChild(o),e===".ng-container-body"&&(t(this,st).firstTr=n.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Pt,c(i=>{if(x.log("rowManager.#measureAndCacheHeight"),t(this,_)!==null&&t(this,_)>0)return t(this,_);x.log("#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=i.querySelector("tbody.bindable-tbody");if(x.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),n?n.before(r):s.appendChild(r);const o=t(this,q),a=o.style.display,h=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 g=s.querySelectorAll("tr");if(g.forEach(b=>{let u=b.offsetHeight||b.getBoundingClientRect().height;if(u===0){const v=window.getComputedStyle(b);u=parseFloat(v.height)||parseFloat(v.minHeight)||0}f+=u}),g.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=h,o.style.position=l,f<=0)throw new Error("invalid dom");return y(this,_,f),t(this,At).call(this),t(this,_)},"#measureAndCacheHeight"));d(this,Et,c(()=>{x.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,_),n=e*s;x.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:n}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,q).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,At,c(()=>{if(t(this,it)>0&&t(this,_)>0){const i=Math.ceil(t(this,it)/t(this,_));y(this,St,i+t(this,Bt))}},"#updateRowCount"));d(this,jt,c(()=>{var a,h,l,f,g,b;const i=t(this,q).querySelector(".ng-container-left .ng-part-body table"),e=t(this,q).querySelector(".ng-container-body .ng-part-body table"),s=t(this,q).querySelector(".ng-container-right .ng-part-body table");if(e){const u=i?Array.from(i.querySelectorAll("tbody tr")):[],v=Array.from(e.querySelectorAll("tbody tr")),S=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(u.length,v.length,S.length);for(let m=0;m<T;m++){const z=[((a=u[m])==null?void 0:a.getBoundingClientRect().height)||0,((h=v[m])==null?void 0:h.getBoundingClientRect().height)||0,((l=S[m])==null?void 0:l.getBoundingClientRect().height)||0],k=Math.max(...z);k>0&&(u[m]&&(u[m].style.height=`${k}px`),v[m]&&(v[m].style.height=`${k}px`),S[m]&&(S[m].style.height=`${k}px`))}}const n=t(this,q).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,q).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,q).querySelector(".ng-container-right .ng-part-footer table");if(r){const u=n?Array.from(n.querySelectorAll("tfoot tr")):[],v=Array.from(r.querySelectorAll("tfoot tr")),S=o?Array.from(o.querySelectorAll("tfoot tr")):[],T=Math.max(u.length,v.length,S.length);for(let m=0;m<T;m++){const z=[((f=u[m])==null?void 0:f.getBoundingClientRect().height)||0,((g=v[m])==null?void 0:g.getBoundingClientRect().height)||0,((b=S[m])==null?void 0:b.getBoundingClientRect().height)||0],k=Math.max(...z);k>0&&(u[m]&&(u[m].style.height=`${k}px`),v[m]&&(v[m].style.height=`${k}px`),S[m]&&(S[m].style.height=`${k}px`))}}},"#syncRowHeights"));d(this,Ft,c(()=>{!t(this,q)||!(t(this,q)instanceof HTMLElement)||(y(this,X,new ResizeObserver(i=>{for(const e of i){const s=e.target;if(!s.classList.contains("active"))continue;const n=e.contentRect.height;if(n>0){let r=0;const o=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");o&&(r+=o.offsetHeight),a&&(r+=a.offsetHeight);const h=Math.max(n-r,100);t(this,it)!==h&&(y(this,it,h),t(this,At).call(this),t(this,_)!==null&&(t(this,qt).call(this),this.refresh()))}}})),t(this,X).observe(t(this,q)))},"#initResizeObserver"));d(this,qt,c(()=>{x.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,q).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Dt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));d(this,Te,c(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,q).querySelector(e);if(!s)return;const n=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!n)return;const r=Array.from(n.querySelectorAll("tr:not(.nodata)")),o=((l=t(this,P).get(e))==null?void 0:l.length)||1,h=(t(this,j).data.get()||[]).length;r.forEach((f,g)=>{const b=i+Math.floor(g/o);if(b>=h){f.style.visibility="hidden";return}const u=t(this,j).data.get(b);f.style.display="",t(this,Rt).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,dt,c(i=>{var u,v;const e=t(this,_);if(!e||e<=0)return;const s=t(this,j).data.length;if(s===0)return;const n=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,r=Math.max(0,s-1),o=Math.min(r,Math.max(0,Math.floor(i/e)));let a=Math.floor(o*e);const h=t(this,q).querySelector(".ng-container-body .ng-part-body"),l=h?h.clientHeight:0,f=Math.max(0,s*e-l);i>=f-e&&f>0&&(a=Math.min(i,f)),x.log(`📜 [Scroll Inspect] scrollTop: ${i}, rowHeight: ${e}, startIndex: ${o}, offsetY: ${a}`);const g=t(this,st).firstTr,b=g&&g.dataset.row!==void 0?parseInt(g.dataset.row,10):-1;(v=t(this,st))==null||v.scrollTables.forEach(S=>{S.style.transform=`translate3d(0, ${a}px, 0)`}),b!==o&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(S=>{const T=t(this,q).querySelector(S);if(!T)return;const m=T.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((k,B)=>{const F=o+Math.floor(B/n);if(F>=s){k.style.display="none";return}const Xe=t(this,j).data.get(F);k.style.display="",t(this,Rt).call(this,k,Xe,F)})})},"#handleScroll"));d(this,Rt,c((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((n,r)=>{n.dataset.row=s;const o=Array.from(n.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");o&&typeof o.refresh=="function"&&o.refresh()})},"#bindRowData"));d(this,Vt,c(()=>{var h,l,f;x.log("rowManager.#syncHeaderHeights");const i=t(this,q).querySelector(".ng-container-left .ng-part-header table"),e=t(this,q).querySelector(".ng-container-body .ng-part-header table"),s=t(this,q).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const n=i?Array.from(i.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),o=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(n.length,r.length,o.length);for(let g=0;g<a;g++){const b=[((h=n[g])==null?void 0:h.getBoundingClientRect().height)||0,((l=r[g])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(n[g]&&(n[g].style.height=`${u}px`),r[g]&&(r[g].style.height=`${u}px`),o[g]&&(o[g].style.height=`${u}px`))}},"#syncHeaderHeights"));R(this,"destroy",c(()=>{t(this,X)&&(t(this,X).disconnect(),y(this,X,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,q,i),t(this,Ft).call(this)}getRowHeight(){return t(this,_)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,q=new WeakMap,st=new WeakMap,P=new WeakMap,_=new WeakMap,X=new WeakMap,it=new WeakMap,St=new WeakMap,qe=new WeakMap,Re=new WeakMap,Bt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,Et=new WeakMap,At=new WeakMap,jt=new WeakMap,Ft=new WeakMap,qt=new WeakMap,Te=new WeakMap,dt=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,c(ke,"RowManager");let ce=ke;const Yt=class Yt{static compileAll(i){return Array.isArray(i)?i.map(e=>Yt.compile(e)):[]}static compile(i){if(!i)return null;const e=c(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 g=`cell-${f}`;const b=l.getAttribute("data-bind"),u=l.getAttribute("data-expr"),v=l.getAttribute("maxbyte"),S=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),u&&T.push(`data-expr="${u}"`),v&&T.push(`maxbyte="${v}"`),S&&T.push(`type="${S}"`),l.innerHTML=`<${g} ${T.join(" ")}></${g}>`})},"processCellTypes"),s=c(a=>{if(!a.querySelector("colgroup")){const h=a.querySelector("tbody tr")||a.querySelector("tr"),l=h?h.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),g=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const u=document.createElement("col");u.setAttribute("width",g),f.appendChild(u)}a.prepend(f)}if(!a.querySelector("thead")){const h=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(h):a.prepend(h)}a.classList.add("nine-table-element")},"ensureTableStructure"),n=c((a,h)=>{const l=Array.from(a.querySelectorAll(h+" tr")),f=Array.from(a.querySelectorAll(h+" th,"+h+" td")),g=l.length;if(g===0||f.length===0)return;let b=0;f.forEach(v=>{b+=v.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));l.forEach(v=>{const S=v.sectionRowIndex;let T=0;Array.from(v.querySelectorAll("th,td")).forEach(m=>{for(let B=0;B<u[S].length;B++)if(u[S][B]===null){T=B;break}const z=m.rowSpan||1,k=m.colSpan||1;for(let B=0;B<z;B++)for(let F=0;F<k;F++)S+B<g&&T+F<b&&(u[S+B][T+F]=B===0&&F===0?"1":"0")})}),l.forEach(v=>{const S=v.sectionRowIndex;Array.from(v.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<u[S].length;m++)if(u[S][m]==="1"){T.dataset.col=m,u[S][m]="0";break}})})},"resetColIndex"),r=i.cloneNode(!0);return s(r),e(r),n(r,"thead"),n(r,"tbody"),n(r,"tfoot"),Array.from(r.querySelectorAll("colgroup col")).forEach((a,h)=>{const l=a.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};c(Yt,"TableCompiler");let he=Yt;const Tt=class Tt extends HTMLElement{constructor(){super();d(this,Ut);d(this,nt,null);d(this,rt);R(this,"invalidate",c(()=>{t(this,rt).refresh()},"invalidate"));d(this,Xt,c(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:n})=>{var r,o,a;(r=this.querySelector(`${s} .ng-part-header`))==null||r.appendChild(t(this,ft).call(this,t(this,nt),n,"header")),(o=this.querySelector(`${s} .ng-virtual-spacer`))==null||o.before(t(this,ft).call(this,t(this,nt),n,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,ft).call(this,t(this,nt),n,"footer"))})},"#renderSplitContainers"));d(this,Kt,c(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),n=s==null?void 0:s.querySelectorAll("table");if(!s||!n||n.length===0)return;let r=0;n[0].querySelectorAll("col").forEach(o=>{const a=parseInt(o.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"));R(this,"generate",c(e=>{if(!e)return;y(this,nt,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),n=this.querySelector(".ng-container-body .ng-part-footer"),r=this.querySelector(".ng-nodata-overlay");s&&r&&(r.style.top=`${s.offsetHeight}px`),n&&r&&(r.style.bottom=`${n.offsetHeight}px`),t(this,rt).initialize(),setTimeout(()=>{var o;(o=this.querySelector("nine-table-hscrollbar"))==null||o.refresh()},0)},"generate"));d(this,ft,c((e,s,n)=>{const r=e.cloneNode(!0),o=r.querySelector("thead"),a=r.querySelector("tbody"),h=r.querySelector("tfoot");if(n==="header"){if(a&&a.remove(),h&&h.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(o&&o.remove(),h&&h.remove(),a&&(a.className="bindable-tbody")):n==="footer"&&(o&&o.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"));R(this,"getRowHeight",c(()=>t(this,rt).getRowHeight(),"getRowHeight"));R(this,"scrollToX",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));R(this,"scrollToY",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Zt,c(()=>{t(this,Gt).call(this)},"#init"));d(this,Gt,c(()=>{const e=Tt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
127
127
|
<style>
|
|
128
128
|
nine-table-sheet {
|
|
129
129
|
display: none;
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
309
309
|
<div class='ng-scroll-edge'></div>
|
|
310
310
|
</div>
|
|
311
|
-
`},"#render"));
|
|
311
|
+
`},"#render"));y(this,rt,new ce(this)),y(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",x.log("NineTableSheet destroyed.")}};Ut=new WeakMap,nt=new WeakMap,rt=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,ft=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,c(Tt,"NineTableSheet"),R(Tt,"SCROLLBAR_SIZE",16);let Nt=Tt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Nt);const Ce=class Ce extends HTMLElement{constructor(){super();d(this,Jt,c(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.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);t(this,kt).call(this,r,n)}),t(this,kt).call(this,0,!1)},"#init"));d(this,kt,c((e,s=!1)=>{const n=c(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(u=>u.style.setProperty("display","none"));const b=f.filter(u=>u.classList.contains("active"));b.length<2||b.forEach(u=>{const v=parseInt(u.getAttribute("data-index"),10),S=this.querySelector(`nine-splitter[data-split-index="${v}"]`),T=f[v+1];S&&T&&T.classList.contains("active")&&S.style.setProperty("display","flex")})},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),o=this.querySelector("nine-table-sheets-body"),a=r.querySelectorAll(".nine-tab-item"),h=o.querySelectorAll("nine-table-sheet");if(!a[e])return;if(!s)a.forEach((f,g)=>{f.classList.toggle("active",g===e)}),h.forEach((f,g)=>{const b=g===e;f.classList.toggle("active",b),f.style.flex=b?"1 1 100%":""});else{const f=a[e],g=r.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&g.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%"}),n()},"#switchSheet"))}connectedCallback(){t(this,Jt).call(this)}};Jt=new WeakMap,kt=new WeakMap,c(Ce,"NineTableSheets");let de=Ce;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",de);const Le=class Le{constructor(i){d(this,I);d(this,Qt,c(()=>{t(this,te).call(this),new ResizeObserver(i=>{for(let e of i)t(this,I).getAttribute("auto-height")==="true"&&t(this,Ct).call(this)}).observe(t(this,I))},"#init"));d(this,Ct,c(()=>{var h,l;const i=Array.from(t(this,I).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const e=parseInt(t(this,I).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(f=>f.getRowHeight())),n=(h=t(this,I).shadowRoot.querySelector("nine-table-header"))==null?void 0:h.getBoundingClientRect().height,r=(l=t(this,I).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Nt.SCROLLBAR_SIZE,a=e*s+n+r+o;t(this,I).style.height=`${a}px`},"#applyAutoHeight"));d(this,te,c(()=>{const e=Array.from(t(this,I).children).filter(h=>h.tagName==="TABLE"),s=t(this,I).getAttribute("auto-height")==="true",n=e.length,r=e.map((h,l)=>{const g=`<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 g+b}).join(""),o=e.map((h,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,I).shadowRoot.innerHTML=`
|
|
312
312
|
<style>
|
|
313
313
|
:host {
|
|
314
314
|
display: flex;
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
<nine-table-body>
|
|
420
420
|
<nine-table-summary></nine-table-summary>
|
|
421
421
|
<nine-table-sheets>
|
|
422
|
-
<nine-table-sheets-body>${
|
|
422
|
+
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
423
423
|
<nine-table-sheets-footer>
|
|
424
424
|
<div class="nine-tab-bar">${o}</div>
|
|
425
425
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
@@ -428,10 +428,10 @@
|
|
|
428
428
|
<nine-table-analysis></nine-table-analysis>
|
|
429
429
|
</nine-table-body>
|
|
430
430
|
<nine-table-footer></nine-table-footer>
|
|
431
|
-
`,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,kt).call(this)})})},"#render"));p(this,I,i),t(this,Qt).call(this)}};I=new WeakMap,Qt=new WeakMap,kt=new WeakMap,te=new WeakMap,h(Le,"LayoutManager");let fe=Le;const He=class He{constructor(i){d(this,Ct);d(this,ft,-1);T(this,"count",h(()=>t(this,Ct).rawRecords.length,"count"));p(this,Ct,i)}get at(){return t(this,ft)}set at(i){p(this,ft,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ft)}"]`)&&setTimeout(()=>{})}};Ct=new WeakMap,ft=new WeakMap,h(He,"ngRow");let ue=He;const z=class z{constructor(i,e){d(this,N);d(this,C);d(this,O,[]);d(this,ut,[]);d(this,ee,0);d(this,X,[]);d(this,se,h(()=>{p(this,X,[]);const i=t(this,N).template||[];Array.from(i).forEach(e=>{var s;t(this,X).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,C).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Lt).call(this)),e.__ng.height=t(this,X).slice()})},"#initialize"));d(this,nt,h(()=>{const i=t(this,N).shadowRoot.querySelector("nine-table-sheets");i==null||i.classList.toggle("nodata",this.length===0),t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));T(this,"get",h((i,e)=>{var n;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return t(this,gt).call(this,s);if(i<0||i>=s.length)return null;const r=typeof((n=t(this,N).fields)==null?void 0:n.get)=="function"?t(this,N).fields.get():[];if(e!=null){const o=r.indexOf(e);return o>=0?s[i].v[o]:null}return t(this,gt).call(this,s[i])},"get"));T(this,"set",h(i=>{this.clear(),this.add(i,!1),t(this,nt).call(this)},"set"));d(this,Lt,h(()=>({rowState:z.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,X).slice(),o:{},c:{},_:[0,0,0,0,z.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,X).slice(),-1,{},{}]}),"#getDefaultMeta"));T(this,"reset",h(()=>{p(this,O,[]),p(this,ut,[]),t(this,nt).call(this)},"reset"));T(this,"clear",h(()=>{var i;t(this,C).rawRecords=[],p(this,O,[]),p(this,ut,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).viewRecords.reset()},"clear"));d(this,ie,h(i=>{var r;Array.isArray(i)||(i=[i]);const e=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(n=>{const o={v:[]};e.forEach(a=>{o.v.push(n[a]!==void 0&&n[a]!==null?n[a]:"")}),s.push(o)}),s},"#json2Array"));d(this,re,h(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Lt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=z.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));T(this,"add",h((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,C).rawRecords=t(this,C).rawRecords.concat(t(this,re).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((n,o)=>{const a=t(this,C).rawRecords[r-o];a&&(a.__ng.rowState=z.ROW_STATE.EMPTY)}),t(this,nt).call(this),r},"add"));T(this,"delete",h(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,C).host.row.at]:e=[parseInt(i,10)],e.sort((s,r)=>r-s).forEach(s=>{if(t(this,O)[s]){const r=t(this,O)[s].__ng.rowid;t(this,O)[s].__ng.rowState===z.ROW_STATE.INSERT?t(this,C).rawRecords=t(this,C).rawRecords.filter(n=>n.__ng.rowid!==r):t(this,C).rawRecords.forEach(n=>{n.__ng.rowid===r&&(n.__ng.deleted=!0,n.__ng.rowState=z.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,nt).call(this)},"delete"));T(this,"setValue",h((i,e,s)=>{var c;i=parseInt(i,10);const n=(typeof((c=t(this,N).fields)==null?void 0:c.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(n<0)return;const o=this.getValidData()[i];if(!o)return;const a=o.v[n];a!==s&&o.__ng.rowState!==z.ROW_STATE.INSERT&&(o.__ng.o.hasOwnProperty(e)||(o.__ng.o[e]=a),o.__ng.rowState=z.ROW_STATE.UPDATE),o.v[n]=s},"setValue"));T(this,"resetRecords",h(()=>{p(this,ut,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),p(this,O,t(this,C).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,C).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,O).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));T(this,"getValidData",h(()=>(t(this,O).length===0&&t(this,C).rawRecords.length>0&&this.resetRecords(),t(this,O)),"getValidData"));d(this,gt,h(i=>{var o;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,r=typeof((o=t(this,N).fields)==null?void 0:o.get)=="function"?t(this,N).fields.get():[],n=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?n[0]:n},"#conv"));T(this,"count",h(()=>this.getValidData().length,"count"));p(this,N,i),p(this,C,e),t(this,se).call(this)}get source(){return t(this,gt).call(this,t(this,C).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ue(this,ee)._}get count(){return t(this,O).length}get length(){return t(this,O).length}getRowCount(){return this.length}};N=new WeakMap,C=new WeakMap,O=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,nt=new WeakMap,Lt=new WeakMap,ie=new WeakMap,re=new WeakMap,gt=new WeakMap,h(z,"ngData"),T(z,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=z;const Me=class Me{constructor(i){d(this,ot);p(this,ot,i),this.row=new ue(this),this.data=new ge(t(this,ot),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,ot).view)!=null&&e.redraw&&t(this,ot).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,n;const s=parseInt(e,10);if(!(s>=this.data.count()))return(n=(r=this.data.getValidData()[s])==null?void 0:r.__ng)==null?void 0:n.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([])}};ot=new WeakMap,h(Me,"ngDataManager");let be=Me;const $e=class $e{constructor(i){d(this,bt);d(this,M,[]);T(this,"add",h((i,e="string")=>{i.forEach(s=>{t(this,M).some(r=>r.name===s)||t(this,M).push({name:s,type:e})}),t(this,Ht).call(this)},"add"));d(this,Ht,h(()=>{const i=new Map;t(this,M).forEach(e=>{i.set(e.name,e.type)}),p(this,M,Array.from(i,([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,ne,h(()=>{p(this,M,[]),x.log(t(this,bt).querySelectorAll("table"));const i=Array.from(t(this,bt).querySelectorAll("table"));if(!(!i||i.length===0)){for(const e of i)x.log(e),$("[data-bind]",e).each((s,r)=>{const n=r.dataset.bind,o=r.getAttribute("data-type")||"string";n&&t(this,M).push({name:n,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,n)=>{var o=n.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,Ht).call(this)}},"#init"));p(this,bt,i),t(this,ne).call(this)}get(){return t(this,M).map(i=>i.name)}getFields(){return t(this,M)}getType(i){const e=t(this,M).find(s=>s.name===i);return e?e.type:"string"}indexOf(i){return t(this,M).findIndex(e=>e.name===i)}includes(i){return t(this,M).some(e=>e.name===i)}};bt=new WeakMap,M=new WeakMap,Ht=new WeakMap,ne=new WeakMap,h($e,"ngFields");let pe=$e;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,at);d(this,oe);d(this,ae,h(()=>{this.fields=new pe(this),p(this,oe,new fe(this)),x.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),p(this,at,new be(this))}connectedCallback(){t(this,ae).call(this)}disconnectedCallback(){x.log("NineTable disconnected.")}get data(){return t(this,at).data}get row(){return t(this,at).row}get dataManager(){return t(this,at)}};at=new WeakMap,oe=new WeakMap,ae=new WeakMap,h(Ie,"NineTable");let ye=Ie;customElements.get("nine-table")||customElements.define("nine-table",ye);const Mt=class Mt extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Mt,"BasicCellElement"),T(Mt,"_styleCache",new Map),T(Mt,"_customStyleCache",new Map);let me=Mt;const Be=class Be extends me{constructor(){super();d(this,L);d(this,$t);d(this,y);d(this,_e);d(this,Ne);d(this,We);d(this,Oe);T(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,L).exprFunction(t(this,y).dataset.expr).call(this,null,-1,t(this,L).data)}catch{}},"getDisplayText"));d(this,ze,h(()=>{if(!(!t(this,L)||!t(this,L).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 H=ninegrid.j.querySelectorAll(W).attr("suppress");H&&W.dataset.row&&(H=parseInt(H),!isNaN(H)&&H<=e&&r.push(H))}),r.sort();var n=!1;if(parseInt(s.sectionRowIndex/t(this,L).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,L).data.get(c);t(this,y).dataset.matrixRow;var g=t(this,L).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,y).dataset.matrixRow}"]`),b=g.dataset.expr?this.getExprValue(g.dataset.expr,l,a):l[g.dataset.bind],u=g.dataset.expr?this.getExprValue(g.dataset.expr,f,c):f[g.dataset.bind];if(b!=u){n=!0;break}}else n=!0;n?ninegrid.j.querySelectorAll(t(this,y)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,y)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,y)).hasClass("hidden")||(n?ninegrid.j.querySelectorAll(t(this,y)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,y)).addClass("hidden"));var m=parseInt(t(this,y).dataset.matrixRow),q=m-1,R=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,y).dataset.col}"][data-matrix-row="${q}"]`);$(R).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,y)).hasClass("suppress")?ninegrid.j.querySelectorAll(R).removeClass("last-none-suppress").addClass("last-suppress"):!$(R).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,y)).hasClass("suppress")?ninegrid.j.querySelectorAll(R).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(R).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));T(this,"getExprValue",h((e,s,r,n)=>{if(typeof e<"u")try{r=parseInt(r);const o=e.replace("()","");return t(this,L)[o]?t(this,L)[o].call(this,s,r,t(this,y)):t(this,L).exprFunction(e).call(this,s,r,t(this,L).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),p(this,L,this.getRootNode().host),p(this,y,this.closest("th,td")),p(this,$t,t(this,y).closest("tr"))}get value(){var e=!t(this,L)||!t(this,L).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,L).data.setValueNF(parseInt(t(this,y).dataset.index),t(this,y).dataset.bind,e,r):t(this,L).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,$t).data[e]}};L=new WeakMap,$t=new WeakMap,y=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,ze=new WeakMap,h(Be,"CellElement");let ve=Be;const De=class De extends ve{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(De,"EditableCellElement");let xe=De;const je=class je extends xe{constructor(){super();d(this,It);d(this,lt);d(this,pt);d(this,yt);d(this,le);d(this,K);T(this,"refresh",h(()=>{const e=super.refresh();t(this,It).value=e},"refresh"));d(this,Pe,h(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,lt)=="number"){let n=[];if(t(this,K)&&Number(t(this,K))>0&&n.push("."),t(this,yt)&&Number(t(this,yt))>=0&&n.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!n.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,pt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,pt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),p(this,lt,this.getAttribute("type")||"text"),p(this,pt,this.getAttribute("maxbyte")),p(this,yt,this.getAttribute("min")),p(this,le,this.getAttribute("max")),p(this,K,this.getAttribute("scale")),!["text","number"].includes(t(this,lt)))throw`invalid type : ${t(this,lt)}`}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=`
|
|
431
|
+
`,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((h,l)=>{e[l]&&setTimeout(()=>{h.generate(e[l]),s&&t(this,Ct).call(this)})})},"#render"));y(this,I,i),t(this,Qt).call(this)}};I=new WeakMap,Qt=new WeakMap,Ct=new WeakMap,te=new WeakMap,c(Le,"LayoutManager");let fe=Le;const He=class He{constructor(i){d(this,Lt);d(this,ut,-1);R(this,"count",c(()=>t(this,Lt).rawRecords.length,"count"));y(this,Lt,i)}get at(){return t(this,ut)}set at(i){y(this,ut,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ut)}"]`)&&setTimeout(()=>{})}};Lt=new WeakMap,ut=new WeakMap,c(He,"ngRow");let ue=He;const O=class O{constructor(i,e){d(this,N);d(this,L);d(this,W,[]);d(this,gt,[]);d(this,ee,0);d(this,K,[]);d(this,se,c(()=>{y(this,K,[]);const i=t(this,N).template||[];Array.from(i).forEach(e=>{var s;t(this,K).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Ht).call(this)),e.__ng.height=t(this,K).slice()})},"#initialize"));d(this,ot,c(()=>{const i=t(this,N).shadowRoot.querySelector("nine-table-sheets");i==null||i.classList.toggle("nodata",this.length===0),t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(e=>{e.invalidate()})},"#invalidate"));R(this,"get",c((i,e)=>{var r;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return t(this,bt).call(this,s);if(i<0||i>=s.length)return null;const n=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():[];if(e!=null){const o=n.indexOf(e);return o>=0?s[i].v[o]:null}return t(this,bt).call(this,s[i])},"get"));R(this,"set",c(i=>{this.clear(),this.add(i,!1),t(this,ot).call(this)},"set"));d(this,Ht,c(()=>({rowState:O.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,K).slice(),o:{},c:{},_:[0,0,0,0,O.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,K).slice(),-1,{},{}]}),"#getDefaultMeta"));R(this,"reset",c(()=>{y(this,W,[]),y(this,gt,[]),t(this,ot).call(this)},"reset"));R(this,"clear",c(()=>{var i;t(this,L).rawRecords=[],y(this,W,[]),y(this,gt,[]),(i=t(this,L).viewRecords)!=null&&i.reset&&t(this,L).viewRecords.reset()},"clear"));d(this,ie,c(i=>{var n;Array.isArray(i)||(i=[i]);const e=typeof((n=t(this,N).fields)==null?void 0:n.get)=="function"?t(this,N).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(r=>{const o={v:[]};e.forEach(a=>{o.v.push(r[a]!==void 0&&r[a]!==null?r[a]:"")}),s.push(o)}),s},"#json2Array"));d(this,ne,c(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Ht).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=O.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));R(this,"add",c((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,ne).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((r,o)=>{const a=t(this,L).rawRecords[n-o];a&&(a.__ng.rowState=O.ROW_STATE.EMPTY)}),t(this,ot).call(this),n},"add"));R(this,"delete",c(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,L).host.row.at]:e=[parseInt(i,10)],e.sort((s,n)=>n-s).forEach(s=>{if(t(this,W)[s]){const n=t(this,W)[s].__ng.rowid;t(this,W)[s].__ng.rowState===O.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(r=>r.__ng.rowid!==n):t(this,L).rawRecords.forEach(r=>{r.__ng.rowid===n&&(r.__ng.deleted=!0,r.__ng.rowState=O.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,ot).call(this)},"delete"));R(this,"setValue",c((i,e,s)=>{var h;i=parseInt(i,10);const r=(typeof((h=t(this,N).fields)==null?void 0:h.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(r<0)return;const o=this.getValidData()[i];if(!o)return;const a=o.v[r];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[r]=s},"setValue"));R(this,"resetRecords",c(()=>{y(this,gt,t(this,L).rawRecords.filter(i=>!i.__ng.deleted)),y(this,W,t(this,L).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,L).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,W).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));R(this,"getValidData",c(()=>(t(this,W).length===0&&t(this,L).rawRecords.length>0&&this.resetRecords(),t(this,W)),"getValidData"));d(this,bt,c(i=>{var o;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,n=typeof((o=t(this,N).fields)==null?void 0:o.get)=="function"?t(this,N).fields.get():[],r=s.filter(a=>!a.__ng.deleted).map(a=>{const h={};return n.forEach((l,f)=>{h[l]=a.v?a.v[f]:a[l]}),h.__ng=a.__ng,h});return e?r[0]:r},"#conv"));R(this,"count",c(()=>this.getValidData().length,"count"));y(this,N,i),y(this,L,e),t(this,se).call(this)}get source(){return t(this,bt).call(this,t(this,L).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ue(this,ee)._}get count(){return t(this,W).length}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,L=new WeakMap,W=new WeakMap,gt=new WeakMap,ee=new WeakMap,K=new WeakMap,se=new WeakMap,ot=new WeakMap,Ht=new WeakMap,ie=new WeakMap,ne=new WeakMap,bt=new WeakMap,c(O,"ngData"),R(O,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=O;const Me=class Me{constructor(i){d(this,at);y(this,at,i),this.row=new ue(this),this.data=new ge(t(this,at),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,at).view)!=null&&e.redraw&&t(this,at).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var n,r;const s=parseInt(e,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=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,n)=>{e=parseInt(e,10),this.data.setValue(e,s,n)},this.setDataSource([])}};at=new WeakMap,c(Me,"ngDataManager");let be=Me;const $e=class $e{constructor(i){d(this,yt);d(this,M,[]);R(this,"add",c((i,e="string")=>{i.forEach(s=>{t(this,M).some(n=>n.name===s)||t(this,M).push({name:s,type:e})}),t(this,Mt).call(this)},"add"));d(this,Mt,c(()=>{const i=new Map;t(this,M).forEach(e=>{i.set(e.name,e.type)}),y(this,M,Array.from(i,([e,s])=>({name:e,type:s}))),y(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,re,c(()=>{y(this,M,[]),x.log(t(this,yt).querySelectorAll("table"));const i=Array.from(t(this,yt).querySelectorAll("table"));if(!(!i||i.length===0)){for(const e of i)x.log(e),$("[data-bind]",e).each((s,n)=>{const r=n.dataset.bind,o=n.getAttribute("data-type")||"string";r&&t(this,M).push({name:r,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((n,r)=>{var o=r.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 h=a.search(/[^_A-Za-z0-9]/g);let l="";h>=0?l=a.substring(0,h):o.startsWith("data.")&&(l=a.replace("data.","")),l&&t(this,M).push({name:l,type:"string"})}})})});t(this,Mt).call(this)}},"#init"));y(this,yt,i),t(this,re).call(this)}get(){return t(this,M).map(i=>i.name)}getFields(){return t(this,M)}getType(i){const e=t(this,M).find(s=>s.name===i);return e?e.type:"string"}indexOf(i){return t(this,M).findIndex(e=>e.name===i)}includes(i){return t(this,M).some(e=>e.name===i)}};yt=new WeakMap,M=new WeakMap,Mt=new WeakMap,re=new WeakMap,c($e,"ngFields");let ye=$e;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,lt);d(this,oe);d(this,ae,c(()=>{this.fields=new ye(this),y(this,oe,new fe(this)),x.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,lt,new be(this))}connectedCallback(){t(this,ae).call(this)}disconnectedCallback(){x.log("NineTable disconnected.")}get data(){return t(this,lt).data}get row(){return t(this,lt).row}get dataManager(){return t(this,lt)}};lt=new WeakMap,oe=new WeakMap,ae=new WeakMap,c(Ie,"NineTable");let pe=Ie;customElements.get("nine-table")||customElements.define("nine-table",pe);const $t=class $t extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};c($t,"BasicCellElement"),R($t,"_styleCache",new Map),R($t,"_customStyleCache",new Map);let me=$t;const Be=class Be extends me{constructor(){super();d(this,H);d(this,It);d(this,p);d(this,_e);d(this,Ne);d(this,We);d(this,Oe);R(this,"getDisplayText",c(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,n=parseInt(t(this,p).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,p).dataset.expr)){if(!ninegrid.isNull(t(this,p).dataset.bind))return s[t(this,p).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,p).dataset.expr,s,n,t(this,p))}catch{console.error(t(this,p).dataset.expr,s,t(this,p).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,H).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,H).data)}catch{}},"getDisplayText"));d(this,ze,c(()=>{if(!(!t(this,H)||!t(this,H).template||!t(this,p).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,p)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,p).closest("tr"),n=[];$("th,td",s).each((m,z)=>{var k=ninegrid.j.querySelectorAll(z).attr("suppress");k&&z.dataset.row&&(k=parseInt(k),!isNaN(k)&&k<=e&&n.push(k))}),n.sort();var r=!1;if(parseInt(s.sectionRowIndex/t(this,H).template.length)>0)for(var o of n){if(o>e)break;var a=parseInt(t(this,p).dataset.row),h=a-1,l=t(this,p).closest("tr").data,f=t(this,H).data.get(h);t(this,p).dataset.matrixRow;var g=t(this,H).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,p).dataset.matrixRow}"]`),b=g.dataset.expr?this.getExprValue(g.dataset.expr,l,a):l[g.dataset.bind],u=g.dataset.expr?this.getExprValue(g.dataset.expr,f,h):f[g.dataset.bind];if(b!=u){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var v=parseInt(t(this,p).dataset.matrixRow),S=v-1,T=t(this,H).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${S}"]`);$(T).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(T).removeClass("last-none-suppress").addClass("last-suppress"):!$(T).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).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"));R(this,"getExprValue",c((e,s,n,r)=>{if(typeof e<"u")try{n=parseInt(n);const o=e.replace("()","");return t(this,H)[o]?t(this,H)[o].call(this,s,n,t(this,p)):t(this,H).exprFunction(e).call(this,s,n,t(this,H).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback(),y(this,H,this.getRootNode().host),y(this,p,this.closest("th,td")),y(this,It,t(this,p).closest("tr"))}get value(){var e=!t(this,H)||!t(this,H).dataManager||!t(this,p)||!t(this,p).dataset||!t(this,p).dataset.row||!t(this,p).dataset.bind?"":t(this,p).closest("tr").data[t(this,p).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,p).dataset.row);const n=this.getAttribute("update-row-state")!="false";s<0?t(this,H).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,n):t(this,H).data.setValue(s,t(this,p).dataset.bind,e,n)}get row(){return parseInt(t(this,p).dataset.row)}get data(){return t(this,p).closest("tr").data}refresh(){const e=t(this,p).dataset.bind;return parseInt(t(this,p).dataset.row),t(this,It).data[e]}};H=new WeakMap,It=new WeakMap,p=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,ze=new WeakMap,c(Be,"CellElement");let ve=Be;const De=class De extends ve{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};c(De,"EditableCellElement");let xe=De;const je=class je extends xe{constructor(){super();d(this,_t);d(this,ct);d(this,pt);d(this,mt);d(this,le);d(this,Z);R(this,"refresh",c(()=>{const e=super.refresh();t(this,_t).value=e},"refresh"));d(this,Pe,c(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,ct)=="number"){let r=[];if(t(this,Z)&&Number(t(this,Z))>0&&r.push("."),t(this,mt)&&Number(t(this,mt))>=0&&r.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!r.includes(e.key)&&e.preventDefault(),t(this,Z)&&(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&e.target.selectionStart==e.target.selectionEnd){var s=e.target.value,n=s.indexOf(".");if(n>=0){var s=s.substr(n+1,s.length);s.length>=Number(t(this,Z))&&e.preventDefault()}}}t(this,pt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,pt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),y(this,ct,this.getAttribute("type")||"text"),y(this,pt,this.getAttribute("maxbyte")),y(this,mt,this.getAttribute("min")),y(this,le,this.getAttribute("max")),y(this,Z,this.getAttribute("scale")),!["text","number"].includes(t(this,ct)))throw`invalid type : ${t(this,ct)}`}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=`
|
|
432
432
|
<input type="text"
|
|
433
433
|
${e.join(" ")}
|
|
434
434
|
ondragstart="return false;"
|
|
435
435
|
>
|
|
436
|
-
`,super.connectedCallback(),
|
|
436
|
+
`,super.connectedCallback(),y(this,_t,this.querySelector("input"))}};_t=new WeakMap,ct=new WeakMap,pt=new WeakMap,mt=new WeakMap,le=new WeakMap,Z=new WeakMap,Pe=new WeakMap,c(je,"CellInputText");let we=je;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",we)});
|
|
437
437
|
//# sourceMappingURL=nine-table.umd.js.map
|