@ninebone/table 0.0.552 → 0.0.554
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 +379 -382
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +6 -6
- 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(S,w){typeof exports=="object"&&typeof module<"u"?w(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],w):(S=typeof globalThis<"u"?globalThis:S||self,w(S.NineboneUtil))})(this,function(S){"use strict";var Fe=Object.defineProperty;var Ve=S=>{throw TypeError(S)};var Xe=(S,w,E)=>w in S?Fe(S,w,{enumerable:!0,configurable:!0,writable:!0,value:E}):S[w]=E;var c=(S,w)=>Fe(S,"name",{value:w,configurable:!0});var
|
|
1
|
+
(function(S,w){typeof exports=="object"&&typeof module<"u"?w(require("@ninebone/util")):typeof define=="function"&&define.amd?define(["@ninebone/util"],w):(S=typeof globalThis<"u"?globalThis:S||self,w(S.NineboneUtil))})(this,function(S){"use strict";var Fe=Object.defineProperty;var Ve=S=>{throw TypeError(S)};var Xe=(S,w,E)=>w in S?Fe(S,w,{enumerable:!0,configurable:!0,writable:!0,value:E}):S[w]=E;var c=(S,w)=>Fe(S,"name",{value:w,configurable:!0});var T=(S,w,E)=>Xe(S,typeof w!="symbol"?w+"":w,E),Ye=(S,w,E)=>w.has(S)||Ve("Cannot "+E);var t=(S,w,E)=>(Ye(S,w,"read from private field"),E?E.call(S):w.get(S)),d=(S,w,E)=>w.has(S)?Ve("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(S):w.set(S,E),p=(S,w,E,F)=>(Ye(S,w,"write to private field"),F?F.call(S,E):w.set(S,E),E);var Ue=(S,w,E,F)=>({set _(mt){p(S,w,mt,E)},get _(){return t(S,w,F)}});var z,V,A,Z,G,J,Wt,Q,Ot,Y,ct,tt,k,xt,vt,Bt,j,R,et,P,I,U,st,wt,Re,qe,zt,Pt,Dt,St,Et,jt,Ft,At,Te,ht,Rt,Vt,Ut,it,nt,Xt,Kt,dt,Zt,Gt,Jt,Tt,_,Qt,kt,te,Ct,ft,N,C,W,ut,ee,X,se,rt,Lt,ie,ne,gt,ot,bt,H,Ht,re,at,oe,ae,L,$t,y,_e,Ne,We,Oe,Be,It,lt,pt,yt,le,K,De;const Se=class Se extends S.trace.constructor{constructor(){super(),this.init("nine-table","green")}};c(Se,"Trace");let w=Se;const E=new w,Ee=class Ee extends HTMLElement{constructor(){super();d(this,z);d(this,V,!1);d(this,A);d(this,Z);d(this,G);d(this,J);d(this,Wt,c(()=>{if(!t(this,z))return;const e=t(this,z).querySelector(".ng-container-body .ng-part-body");e&&(p(this,J,new ResizeObserver(()=>{this.refresh()})),t(this,J).observe(e))},"#observeResize"));T(this,"refresh",c(()=>{if(!t(this,z)||!t(this,A)||t(this,V))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,z).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 u=e.scrollLeft,g=h-a;let b=0;g>0&&(b=parseInt(u/g*(l-f),10)),b<0&&(b=0);const m=l-f;b>m&&(b=m),r.style.left=`${b}px`,t(this,A).left.disabled=b===0,t(this,A).right.disabled=b>=m-1},"refresh"));d(this,Q,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,u=n.scrollWidth-l;return h>0&&u>0&&(s.scrollLeft=a/h*u),a>0&&a<h-1},"#thumbMoveTo"));d(this,Ot,c(()=>{const e=c(n=>{clearInterval(t(this,Z)),clearInterval(t(this,G));const r=parseInt(t(this,A).thumb.style.left||0,10);t(this,Q).call(this,r+n),p(this,Z,setInterval(()=>{clearInterval(t(this,Z)),p(this,G,setInterval(()=>{const o=parseInt(t(this,A).thumb.style.left||0,10);t(this,Q).call(this,o+n)||clearInterval(t(this,G))},50))},500))},"delayScroll"),s=c(()=>{clearInterval(t(this,Z)),clearInterval(t(this,G))},"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,Q).call(this,n.clientX-r.left-o/2)}),t(this,A).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,V,!0),this.shiftX=n.clientX-t(this,A).thumb.getBoundingClientRect().left;const r=c(a=>{if(!t(this,V))return;const h=t(this,A).track.getBoundingClientRect();t(this,Q).call(this,a.clientX-h.left-this.shiftX)},"onMouseMove"),o=c(()=>{p(this,V,!1),s(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(p(this,z,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,z))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=c(()=>{const s=t(this,z).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(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,V)||this.refresh()}),t(this,Ot).call(this),t(this,Wt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};z=new WeakMap,V=new WeakMap,A=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Wt=new WeakMap,Q=new WeakMap,Ot=new WeakMap,c(Ee,"NineTableHScrollBar");let F=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ae=class Ae extends HTMLElement{constructor(){super();
|
|
63
|
+
`;const e=c(()=>{const s=t(this,z).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(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,V)||this.refresh()}),t(this,Ot).call(this),t(this,Wt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};z=new WeakMap,V=new WeakMap,A=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Wt=new WeakMap,Q=new WeakMap,Ot=new WeakMap,c(Ee,"NineTableHScrollBar");let F=Ee;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ae=class Ae extends HTMLElement{constructor(){super();d(this,Y);d(this,ct);d(this,tt,!1);d(this,k);d(this,xt,0);d(this,vt,0);T(this,"refresh",c(()=>{if(!t(this,Y)||!t(this,k))return;const e=t(this,k).container,s=t(this,k).track,n=t(this,k).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,h=t(this,ct).getRowHeight(),l=a*h;if(l<=r){n.style.display="none",t(this,k).top.disabled=!0,t(this,k).bottom.disabled=!0;return}else n.style.display="block";const f=s.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/l),f),20);n.style.height=`${u}px`;const g=e.scrollTop,b=Math.max(l-r,1);let m=0;b>0&&(m=g/b*(f-u));const v=f-u;m<0&&(m=0),m>v&&(m=v),n.style.top=`${m}px`,t(this,k).top.disabled=g<=0,t(this,k).bottom.disabled=g>=b-1},"refresh"));d(this,Bt,c(()=>{E.log("nine-table-vscrollbar.#init");const e=t(this,k).container,s=c(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,ct).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,tt)||this.refresh()}),t(this,k).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),p(this,tt,!0),p(this,xt,n.clientY),p(this,vt,e.scrollTop);const r=c(a=>{if(!t(this,tt))return;const h=t(this,k).track.getBoundingClientRect(),l=t(this,k).thumb.clientHeight,u=h.height-l,g=a.clientY-t(this,xt),b=e.clientHeight,m=s(),v=Math.max(m-b,1);if(u>0&&v>0){const q=g/u*v;let x=t(this,vt)+q;const B=Math.max(0,m-b);x<0&&(x=0),x>B&&(x=B),e.scrollTop=x}this.refresh()},"onMouseMove"),o=c(()=>{p(this,tt,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,k).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,k).thumb)return;const r=t(this,k).track.getBoundingClientRect(),o=t(this,k).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.height-o,f=e.clientHeight,u=s(),g=Math.max(u-f,1);if(l>0&&g>0){const b=Math.max(0,Math.min(1,a/l));e.scrollTop=b*g}this.refresh()}),t(this,k).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,k).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){p(this,Y,this.getRootNode().host),p(this,ct,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=c(()=>{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,Bt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,tt=new WeakMap,k=new WeakMap,xt=new WeakMap,vt=new WeakMap,Bt=new WeakMap,c(Ae,"NineTableVScrollBar");let mt=Ae;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const ke=class ke{constructor(i){h(this,j);h(this,R);h(this,et);h(this,P,new Map);h(this,I,null);h(this,U,null);h(this,st,0);h(this,wt,40);h(this,Re,!1);h(this,qe,!1);h(this,zt,3);q(this,"refresh",c(()=>{var e;E.log("rowManager.refresh");const i=t(this,R).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,R).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));q(this,"initialize",c(()=>{E.log("rowManager.initialize"),p(this,et,{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)")}),p(this,I,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const r=t(this,R).querySelector(n);if(!r)return;const a=r.querySelector(".ng-part-body table");if(!a)return;const o=a.querySelector("tbody.bindable-tbody");if(!o)return;const l=Array.from(o.querySelectorAll("tr")).map(f=>f.cloneNode(!0));t(this,P).set(n,l)});const i=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");t(this,R).querySelector(".ng-container-body .ng-part-header"),t(this,R).querySelector(".ng-container-body .ng-part-footer"),i&&(t(this,Dt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop),i.addEventListener("scroll",()=>{const n=i.scrollTop;i.scrollLeft,e&&(e.scrollTop=n),s&&(s.scrollTop=n),t(this,ht).call(this,n)}))},"initialize"));h(this,Pt,c((i,e)=>{E.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(o=>o.remove());const r=n.querySelector("tr.nodata"),a=document.createDocumentFragment();for(let o=0;o<t(this,wt);o++)s.forEach(d=>{a.appendChild(d.cloneNode(!0))});r?r.before(a):n.appendChild(a),e===".ng-container-body"&&(t(this,et).firstTr=n.querySelector("tr:not(.nodata)"))},"#renderRows"));h(this,Dt,c(i=>{if(E.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);E.log("#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)return 24;const s=i.querySelector("tbody.bindable-tbody");if(!s)return 24;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 a=t(this,R),o=a.style.display,d=a.style.visibility,l=a.style.position;(o==="none"||window.getComputedStyle(a).display==="none")&&(a.style.display="block",a.style.visibility="hidden",a.style.position="absolute");let f=0;const u=s.querySelectorAll("tr:not(.nodata)");return u.forEach(b=>{f+=b.offsetHeight||b.getBoundingClientRect().height}),u.forEach(b=>b.remove()),a.style.display=o,a.style.visibility=d,a.style.position=l,p(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));h(this,St,c(()=>{E.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const a=t(this,R).querySelector(r);if(!a)return;const o=a.querySelector(".ng-part-body .ng-virtual-spacer");o&&(o.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));h(this,Et,c(()=>{if(t(this,st)>0&&t(this,I)>0){const i=Math.ceil(t(this,st)/t(this,I));p(this,wt,i+t(this,zt))}},"#updateRowCount"));h(this,jt,c(()=>{var o,d,l,f,u,b;const i=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=i?Array.from(i.querySelectorAll("tbody tr")):[],x=Array.from(e.querySelectorAll("tbody tr")),v=s?Array.from(s.querySelectorAll("tbody tr")):[],T=Math.max(g.length,x.length,v.length);for(let m=0;m<T;m++){const O=[((o=g[m])==null?void 0:o.getBoundingClientRect().height)||0,((d=x[m])==null?void 0:d.getBoundingClientRect().height)||0,((l=v[m])==null?void 0:l.getBoundingClientRect().height)||0],M=Math.max(...O);M>0&&(g[m]&&(g[m].style.height=`${M}px`),x[m]&&(x[m].style.height=`${M}px`),v[m]&&(v[m].style.height=`${M}px`))}}const n=t(this,R).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer table"),a=t(this,R).querySelector(".ng-container-right .ng-part-footer table");if(r){const g=n?Array.from(n.querySelectorAll("tfoot tr")):[],x=Array.from(r.querySelectorAll("tfoot tr")),v=a?Array.from(a.querySelectorAll("tfoot tr")):[],T=Math.max(g.length,x.length,v.length);for(let m=0;m<T;m++){const O=[((f=g[m])==null?void 0:f.getBoundingClientRect().height)||0,((u=x[m])==null?void 0:u.getBoundingClientRect().height)||0,((b=v[m])==null?void 0:b.getBoundingClientRect().height)||0],M=Math.max(...O);M>0&&(g[m]&&(g[m].style.height=`${M}px`),x[m]&&(x[m].style.height=`${M}px`),v[m]&&(v[m].style.height=`${M}px`))}}},"#syncRowHeights"));h(this,Ft,c(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(p(this,U,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 a=s.querySelector(".ng-part-header"),o=s.querySelector(".ng-part-footer");a&&(r+=a.offsetHeight),o&&(r+=o.offsetHeight);const d=Math.max(n-r,100);t(this,st)!==d&&(p(this,st,d),t(this,Et).call(this),t(this,I)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,R)))},"#initResizeObserver"));h(this,At,c(()=>{E.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,R).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Pt).call(this,e,i)}),t(this,Vt).call(this),t(this,jt).call(this)},"#renderAllContainers"));h(this,Te,c(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,R).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)")),a=((l=t(this,P).get(e))==null?void 0:l.length)||1,d=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const b=i+Math.floor(u/a);if(b>=d){f.style.display="none";return}const g=t(this,j).data.get(b);f.style.display="",t(this,Rt).call(this,f,g,b)})})},"#adjustBufferRows"));h(this,ht,c(i=>{var l,f;const e=t(this,I);if(!e||e<=0)return;const s=t(this,j).data.length,n=Math.max(0,Math.floor(i/e)),r=n*e,a=((l=t(this,P).get(".ng-container-body"))==null?void 0:l.length)||1,o=t(this,et).firstTr,d=o&&o.dataset.row!==void 0?parseInt(o.dataset.row,10):-1;(f=t(this,et))==null||f.scrollTables.forEach(u=>{setTimeout(()=>{u.style.transform=`translate3d(0, ${r}px, 0)`})}),d!==n&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(u=>{const b=t(this,R).querySelector(u);if(!b)return;const g=b.querySelector(".ng-part-body tbody.bindable-tbody");if(!g)return;Array.from(g.querySelectorAll("tr:not(.nodata)")).forEach((v,T)=>{const m=n+Math.floor(T/a);if(m>=s){v.style.display="none";return}const O=t(this,j).data.get(m);v.style.display="",t(this,Rt).call(this,v,O,m)})})},"#handleScroll"));h(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 a=Array.from(n.children).find(o=>o.tagName.toLowerCase().startsWith("cell-")||typeof o.refresh=="function");a&&typeof a.refresh=="function"&&a.refresh()})},"#bindRowData"));h(this,Vt,c(()=>{var d,l,f;E.log("rowManager.#syncHeaderHeights");const i=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 n=i?Array.from(i.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),a=s?Array.from(s.querySelectorAll("tr")):[],o=Math.max(n.length,r.length,a.length);for(let u=0;u<o;u++){const b=[((d=n[u])==null?void 0:d.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=a[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(n[u]&&(n[u].style.height=`${g}px`),r[u]&&(r[u].style.height=`${g}px`),a[u]&&(a[u].style.height=`${g}px`))}},"#syncHeaderHeights"));q(this,"destroy",c(()=>{t(this,U)&&(t(this,U).disconnect(),p(this,U,null))},"destroy"));p(this,j,i.getRootNode().host),p(this,R,i),t(this,Ft).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,R=new WeakMap,et=new WeakMap,P=new WeakMap,I=new WeakMap,U=new WeakMap,st=new WeakMap,wt=new WeakMap,Re=new WeakMap,qe=new WeakMap,zt=new WeakMap,Pt=new WeakMap,Dt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,Te=new WeakMap,ht=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(o=>{o.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"),x=l.getAttribute("maxbyte"),v=l.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),g&&T.push(`data-expr="${g}"`),x&&T.push(`maxbyte="${x}"`),v&&T.push(`type="${v}"`),l.innerHTML=`<${u} ${T.join(" ")}></${u}>`})},"processCellTypes"),s=c(o=>{if(!o.querySelector("colgroup")){const d=o.querySelector("tbody tr")||o.querySelector("tr"),l=d?d.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(o.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}o.prepend(f)}if(!o.querySelector("thead")){const d=document.createElement("thead"),l=o.querySelector("colgroup");l?l.after(d):o.prepend(d)}o.classList.add("nine-table-element"),o.style.display="table"},"ensureTableStructure"),n=c((o,d)=>{const l=Array.from(o.querySelectorAll(d+" tr")),f=Array.from(o.querySelectorAll(d+" th,"+d+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(x=>{b+=x.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(x=>{const v=x.sectionRowIndex;let T=0;Array.from(x.querySelectorAll("th,td")).forEach(m=>{for(let D=0;D<g[v].length;D++)if(g[v][D]===null){T=D;break}const O=m.rowSpan||1,M=m.colSpan||1;for(let D=0;D<O;D++)for(let _t=0;_t<M;_t++)v+D<u&&T+_t<b&&(g[v+D][T+_t]=D===0&&_t===0?"1":"0")})}),l.forEach(x=>{const v=x.sectionRowIndex;Array.from(x.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<g[v].length;m++)if(g[v][m]==="1"){T.dataset.col=m,g[v][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((o,d)=>{const l=o.getAttribute("fixed");l&&r.querySelectorAll(`thead [data-col="${d}"], tbody [data-col="${d}"], tfoot [data-col="${d}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),r}};c(Yt,"TableCompiler");let he=Yt;const qt=class qt extends HTMLElement{constructor(){super();h(this,Ut);h(this,it,null);h(this,nt);q(this,"invalidate",c(()=>{t(this,nt).refresh()},"invalidate"));h(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})=>{const r=this.querySelector(s);if(!r)return;r.innerHTML="";const a=document.createElement("div");a.className="ng-part-header",a.appendChild(t(this,dt).call(this,t(this,it),n,"header"));const o=document.createElement("div");o.className="ng-part-body";const d=document.createElement("div");d.className="ng-scroll-content",d.style.position="relative",d.style.width="100%",d.appendChild(t(this,dt).call(this,t(this,it),n,"body"));const l=document.createElement("div");l.className="ng-virtual-spacer",l.style.width="100%",l.style.pointerEvents="none",d.appendChild(l),o.appendChild(d);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,dt).call(this,t(this,it),n,"footer")),r.appendChild(a),r.appendChild(o),r.appendChild(f)})},"#renderSplitContainers"));h(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(a=>{const o=parseInt(a.getAttribute("width"),10);isNaN(r)||(r+=o)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${r}px`,s.style.width=`${r}px`)})},"#updateContainerWidths"));q(this,"generate",c(e=>{e&&(p(this,it,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this),t(this,nt).initialize(),setTimeout(()=>{var s;(s=this.querySelector("nine-table-hscrollbar"))==null||s.refresh()},0))},"generate"));h(this,dt,c((e,s,n)=>{const r=e.cloneNode(!0),a=r.querySelector("thead"),o=r.querySelector("tbody"),d=r.querySelector("tfoot");if(n==="header"){if(o&&o.remove(),d&&d.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else n==="body"?(a&&a.remove(),d&&d.remove(),o&&(o.className="bindable-tbody")):n==="footer"&&(a&&a.remove(),o&&o.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"));q(this,"getRowHeight",c(()=>t(this,nt).getRowHeight(),"getRowHeight"));q(this,"scrollToX",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));q(this,"scrollToY",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));h(this,Zt,c(()=>{t(this,Gt).call(this)},"#init"));h(this,Gt,c(()=>{const e=qt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
126
|
+
`;const e=c(()=>{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,Bt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,tt=new WeakMap,k=new WeakMap,xt=new WeakMap,vt=new WeakMap,Bt=new WeakMap,c(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,R);d(this,et);d(this,P,new Map);d(this,I,null);d(this,U,null);d(this,st,0);d(this,wt,40);d(this,Re,!1);d(this,qe,!1);d(this,zt,3);T(this,"refresh",c(()=>{var e;E.log("rowManager.refresh");const i=t(this,R).querySelector(".ng-container-body .ng-part-body");i&&(t(this,St).call(this),t(this,ht).call(this,i.scrollTop),(e=t(this,R).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",c(()=>{E.log("rowManager.initialize"),p(this,et,{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)")}),p(this,I,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const a=t(this,R).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 u=Array.from(l.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,P).set(o,u)});const i=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"),n=t(this,R).querySelector(".ng-container-body .ng-part-header"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer");i&&(t(this,Dt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop),i.addEventListener("scroll",()=>{const o=i.scrollTop,a=i.scrollLeft;e&&(e.scrollTop=o),s&&(s.scrollTop=o),n&&(n.scrollLeft=a),r&&(r.scrollLeft=a),t(this,ht).call(this,o)}))},"initialize"));d(this,Pt,c((i,e)=>{E.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,wt);a++)s.forEach(h=>{o.appendChild(h.cloneNode(!0))});r?r.before(o):n.appendChild(o),e===".ng-container-body"&&(t(this,et).firstTr=n.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Dt,c(i=>{if(E.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);E.log("#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)return 24;const s=i.querySelector("tbody.bindable-tbody");if(!s)return 24;s.querySelectorAll("tr:not(.nodata)").forEach(g=>g.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(g=>{r.appendChild(g.cloneNode(!0))}),n?n.before(r):s.appendChild(r);const o=t(this,R),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 u=s.querySelectorAll("tr:not(.nodata)");return u.forEach(g=>{f+=g.offsetHeight||g.getBoundingClientRect().height}),u.forEach(g=>g.remove()),o.style.display=a,o.style.visibility=h,o.style.position=l,p(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,St,c(()=>{E.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),n=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const o=t(this,R).querySelector(r);if(!o)return;const a=o.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${n}px`)})},"#updateVirtualScrollHeight"));d(this,Et,c(()=>{if(t(this,st)>0&&t(this,I)>0){const i=Math.ceil(t(this,st)/t(this,I));p(this,wt,i+t(this,zt))}},"#updateRowCount"));d(this,jt,c(()=>{var a,h,l,f,u,g;const i=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 b=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),v=s?Array.from(s.querySelectorAll("tbody tr")):[],q=Math.max(b.length,m.length,v.length);for(let x=0;x<q;x++){const B=[((a=b[x])==null?void 0:a.getBoundingClientRect().height)||0,((h=m[x])==null?void 0:h.getBoundingClientRect().height)||0,((l=v[x])==null?void 0:l.getBoundingClientRect().height)||0],M=Math.max(...B);M>0&&(b[x]&&(b[x].style.height=`${M}px`),m[x]&&(m[x].style.height=`${M}px`),v[x]&&(v[x].style.height=`${M}px`))}}const n=t(this,R).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,R).querySelector(".ng-container-body .ng-part-footer table"),o=t(this,R).querySelector(".ng-container-right .ng-part-footer table");if(r){const b=n?Array.from(n.querySelectorAll("tfoot tr")):[],m=Array.from(r.querySelectorAll("tfoot tr")),v=o?Array.from(o.querySelectorAll("tfoot tr")):[],q=Math.max(b.length,m.length,v.length);for(let x=0;x<q;x++){const B=[((f=b[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((g=v[x])==null?void 0:g.getBoundingClientRect().height)||0],M=Math.max(...B);M>0&&(b[x]&&(b[x].style.height=`${M}px`),m[x]&&(m[x].style.height=`${M}px`),v[x]&&(v[x].style.height=`${M}px`))}}},"#syncRowHeights"));d(this,Ft,c(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(p(this,U,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,st)!==h&&(p(this,st,h),t(this,Et).call(this),t(this,I)!==null&&(t(this,At).call(this),this.refresh()))}}})),t(this,U).observe(t(this,R)))},"#initResizeObserver"));d(this,At,c(()=>{E.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const e=t(this,R).querySelector(i);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Pt).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,R).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,u)=>{const g=i+Math.floor(u/o);if(g>=h){f.style.display="none";return}const b=t(this,j).data.get(g);f.style.display="",t(this,Rt).call(this,f,b,g)})})},"#adjustBufferRows"));d(this,ht,c(i=>{var h,l;const e=t(this,I);if(!e||e<=0)return;const s=t(this,j).data.length,n=Math.max(0,Math.floor(i/e)),r=((h=t(this,P).get(".ng-container-body"))==null?void 0:h.length)||1,o=t(this,et).firstTr,a=o&&o.dataset.row!==void 0?parseInt(o.dataset.row,10):-1;(l=t(this,et))==null||l.scrollTables.forEach(f=>{}),a!==n&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(f=>{const u=t(this,R).querySelector(f);if(!u)return;const g=u.querySelector(".ng-part-body tbody.bindable-tbody");if(!g)return;Array.from(g.querySelectorAll("tr:not(.nodata)")).forEach((m,v)=>{const q=n+Math.floor(v/r);if(q>=s){m.style.display="none";return}const x=t(this,j).data.get(q);m.style.display="",t(this,Rt).call(this,m,x,q)})})},"#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;E.log("rowManager.#syncHeaderHeights");const i=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 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 u=0;u<a;u++){const g=[((h=n[u])==null?void 0:h.getBoundingClientRect().height)||0,((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=o[u])==null?void 0:f.getBoundingClientRect().height)||0],b=Math.max(...g);b>0&&(n[u]&&(n[u].style.height=`${b}px`),r[u]&&(r[u].style.height=`${b}px`),o[u]&&(o[u].style.height=`${b}px`))}},"#syncHeaderHeights"));T(this,"destroy",c(()=>{t(this,U)&&(t(this,U).disconnect(),p(this,U,null))},"destroy"));p(this,j,i.getRootNode().host),p(this,R,i),t(this,Ft).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,P).get(i))==null?void 0:e.length)||1}};j=new WeakMap,R=new WeakMap,et=new WeakMap,P=new WeakMap,I=new WeakMap,U=new WeakMap,st=new WeakMap,wt=new WeakMap,Re=new WeakMap,qe=new WeakMap,zt=new WeakMap,Pt=new WeakMap,Dt=new WeakMap,St=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,Te=new WeakMap,ht=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 u=`cell-${f}`;const g=l.getAttribute("data-bind"),b=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),v=l.getAttribute("type");let q=[];g&&q.push(`data-bind="${g}"`),b&&q.push(`data-expr="${b}"`),m&&q.push(`maxbyte="${m}"`),v&&q.push(`type="${v}"`),l.innerHTML=`<${u} ${q.join(" ")}></${u}>`})},"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"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let g=0;g<l;g++){const b=document.createElement("col");b.setAttribute("width",u),f.appendChild(b)}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"),a.style.display="table"},"ensureTableStructure"),n=c((a,h)=>{const l=Array.from(a.querySelectorAll(h+" tr")),f=Array.from(a.querySelectorAll(h+" th,"+h+" td")),u=l.length;if(u===0||f.length===0)return;let g=0;f.forEach(m=>{g+=m.colSpan||1});const b=Array.from(Array(u),()=>Array(g).fill(null));l.forEach(m=>{const v=m.sectionRowIndex;let q=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let D=0;D<b[v].length;D++)if(b[v][D]===null){q=D;break}const B=x.rowSpan||1,M=x.colSpan||1;for(let D=0;D<B;D++)for(let _t=0;_t<M;_t++)v+D<u&&q+_t<g&&(b[v+D][q+_t]=D===0&&_t===0?"1":"0")})}),l.forEach(m=>{const v=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(q=>{for(let x=0;x<b[v].length;x++)if(b[v][x]==="1"){q.dataset.col=x,b[v][x]="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 qt=class qt extends HTMLElement{constructor(){super();d(this,Ut);d(this,it,null);d(this,nt);T(this,"invalidate",c(()=>{t(this,nt).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})=>{const r=this.querySelector(s);if(!r)return;r.innerHTML="";const o=document.createElement("div");o.className="ng-part-header",o.appendChild(t(this,dt).call(this,t(this,it),n,"header"));const a=document.createElement("div");a.className="ng-part-body";const h=document.createElement("div");h.className="ng-scroll-content",h.style.position="relative",h.style.width="100%",h.appendChild(t(this,dt).call(this,t(this,it),n,"body"));const l=document.createElement("div");l.className="ng-virtual-spacer",l.style.width="100%",l.style.pointerEvents="none",h.appendChild(l),a.appendChild(h);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,dt).call(this,t(this,it),n,"footer")),r.appendChild(o),r.appendChild(a),r.appendChild(f)})},"#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"));T(this,"generate",c(e=>{e&&(p(this,it,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this),t(this,nt).initialize(),setTimeout(()=>{var s;(s=this.querySelector("nine-table-hscrollbar"))==null||s.refresh()},0))},"generate"));d(this,dt,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"));T(this,"getRowHeight",c(()=>t(this,nt).getRowHeight(),"getRowHeight"));T(this,"scrollToX",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(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=qt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
127
127
|
<style>
|
|
128
128
|
nine-table-sheet {
|
|
129
129
|
display: none;
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
275
275
|
<div class='ng-scroll-edge'></div>
|
|
276
276
|
</div>
|
|
277
|
-
`},"#render"));p(this,nt,new ce(this)),p(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",E.log("NineTableSheet destroyed.")}};Ut=new WeakMap,it=new WeakMap,nt=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,dt=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,c(qt,"NineTableSheet"),
|
|
277
|
+
`},"#render"));p(this,nt,new ce(this)),p(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",E.log("NineTableSheet destroyed.")}};Ut=new WeakMap,it=new WeakMap,nt=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,dt=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,c(qt,"NineTableSheet"),T(qt,"SCROLLBAR_SIZE",16);let Nt=qt;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,Tt).call(this,r,n)}),t(this,Tt).call(this,0,!1)},"#init"));d(this,Tt,c((e,s=!1)=>{const n=c(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(b=>b.style.setProperty("display","none"));const g=f.filter(b=>b.classList.contains("active"));g.length<2||g.forEach(b=>{const m=parseInt(b.getAttribute("data-index"),10),v=this.querySelector(`nine-splitter[data-split-index="${m}"]`),q=f[m+1];v&&q&&q.classList.contains("active")&&v.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,u)=>{f.classList.toggle("active",u===e)}),h.forEach((f,u)=>{const g=u===e;f.classList.toggle("active",g),f.style.flex=g?"1 1 100%":""});else{const f=a[e],u=r.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const g=o.querySelector(`nine-table-sheet[data-index="${e}"]`);g&&(g.classList.toggle("active"),g.classList.contains("active")||(g.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,Tt=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,_);d(this,Qt,c(()=>{t(this,te).call(this),new ResizeObserver(i=>{for(let e of i)t(this,_).getAttribute("auto-height")==="true"&&t(this,kt).call(this)}).observe(t(this,_))},"#init"));d(this,kt,c(()=>{var h,l;const i=Array.from(t(this,_).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(i.length===0)return;const e=parseInt(t(this,_).getAttribute("max-display-row"),10)||10,s=Math.max(...i.map(f=>f.getRowHeight())),n=(h=t(this,_).shadowRoot.querySelector("nine-table-header"))==null?void 0:h.getBoundingClientRect().height,r=(l=t(this,_).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:l.getBoundingClientRect().height,o=Nt.SCROLLBAR_SIZE,a=e*s+n+r+o;t(this,_).style.height=`${a}px`},"#applyAutoHeight"));d(this,te,c(()=>{const e=Array.from(t(this,_).children).filter(h=>h.tagName==="TABLE"),s=t(this,_).getAttribute("auto-height")==="true",n=e.length,r=e.map((h,l)=>{const u=`<nine-table-sheet class="${l===0?"active":""}" data-index="${l}"></nine-table-sheet>`,g=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+g}).join(""),o=e.map((h,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,_).shadowRoot.innerHTML=`
|
|
278
278
|
<style>
|
|
279
279
|
:host {
|
|
280
280
|
display: flex;
|
|
@@ -357,14 +357,14 @@
|
|
|
357
357
|
<nine-table-sheets>
|
|
358
358
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
359
359
|
<nine-table-sheets-footer>
|
|
360
|
-
<div class="nine-tab-bar">${
|
|
360
|
+
<div class="nine-tab-bar">${o}</div>
|
|
361
361
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
362
362
|
</nine-table-sheets-footer>
|
|
363
363
|
</nine-table-sheets>
|
|
364
364
|
<nine-table-analysis></nine-table-analysis>
|
|
365
365
|
</nine-table-body>
|
|
366
366
|
<nine-table-footer></nine-table-footer>
|
|
367
|
-
`;const o=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");o==null||o.forEach((d,l)=>{e[l]&&setTimeout(()=>{d.generate(e[l]),s&&t(this,kt).call(this)})})},"#render"));p(this,_,i),t(this,Qt).call(this)}};_=new WeakMap,Qt=new WeakMap,kt=new WeakMap,te=new WeakMap,c(Le,"LayoutManager");let fe=Le;const He=class He{constructor(i){h(this,Ct);h(this,ft,-1);q(this,"count",c(()=>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,c(He,"ngRow");let ue=He;const B=class B{constructor(i,e){h(this,N);h(this,C);h(this,W,[]);h(this,ut,[]);h(this,ee,0);h(this,X,[]);h(this,se,c(()=>{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"));h(this,rt,c(()=>{t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));q(this,"get",c((i,e)=>{var r;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 n=typeof((r=t(this,N).fields)==null?void 0:r.get)=="function"?t(this,N).fields.get():[];if(e!=null){const a=n.indexOf(e);return a>=0?s[i].v[a]:null}return t(this,gt).call(this,s[i])},"get"));q(this,"set",c(i=>{this.clear(),this.add(i,!1),t(this,rt).call(this)},"set"));h(this,Lt,c(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,X).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,X).slice(),-1,{},{}]}),"#getDefaultMeta"));q(this,"reset",c(()=>{p(this,W,[]),p(this,ut,[]),t(this,rt).call(this)},"reset"));q(this,"clear",c(()=>{var i;t(this,C).rawRecords=[],p(this,W,[]),p(this,ut,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).viewRecords.reset()},"clear"));h(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 a={v:[]};e.forEach(o=>{a.v.push(r[o]!==void 0&&r[o]!==null?r[o]:"")}),s.push(a)}),s},"#json2Array"));h(this,ne,c(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Lt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));q(this,"add",c((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,ne).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((r,a)=>{const o=t(this,C).rawRecords[n-a];o&&(o.__ng.rowState=B.ROW_STATE.EMPTY)}),t(this,rt).call(this),n},"add"));q(this,"delete",c(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,n)=>n-s).forEach(s=>{if(t(this,W)[s]){const n=t(this,W)[s].__ng.rowid;t(this,W)[s].__ng.rowState===B.ROW_STATE.INSERT?t(this,C).rawRecords=t(this,C).rawRecords.filter(r=>r.__ng.rowid!==n):t(this,C).rawRecords.forEach(r=>{r.__ng.rowid===n&&(r.__ng.deleted=!0,r.__ng.rowState=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,rt).call(this)},"delete"));q(this,"setValue",c((i,e,s)=>{var d;i=parseInt(i,10);const r=(typeof((d=t(this,N).fields)==null?void 0:d.get)=="function"?t(this,N).fields.get():[]).indexOf(e);if(r<0)return;const a=this.getValidData()[i];if(!a)return;const o=a.v[r];o!==s&&a.__ng.rowState!==B.ROW_STATE.INSERT&&(a.__ng.o.hasOwnProperty(e)||(a.__ng.o[e]=o),a.__ng.rowState=B.ROW_STATE.UPDATE),a.v[r]=s},"setValue"));q(this,"resetRecords",c(()=>{p(this,ut,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),p(this,W,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,W).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));q(this,"getValidData",c(()=>(t(this,W).length===0&&t(this,C).rawRecords.length>0&&this.resetRecords(),t(this,W)),"getValidData"));h(this,gt,c(i=>{var a;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,n=typeof((a=t(this,N).fields)==null?void 0:a.get)=="function"?t(this,N).fields.get():[],r=s.filter(o=>!o.__ng.deleted).map(o=>{const d={};return n.forEach((l,f)=>{d[l]=o.v?o.v[f]:o[l]}),d.__ng=o.__ng,d});return e?r[0]:r},"#conv"));q(this,"count",c(()=>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,W).length}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,C=new WeakMap,W=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,rt=new WeakMap,Lt=new WeakMap,ie=new WeakMap,ne=new WeakMap,gt=new WeakMap,c(B,"ngData"),q(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=B;const Me=class Me{constructor(i){h(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 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([])}};ot=new WeakMap,c(Me,"ngDataManager");let be=Me;const $e=class $e{constructor(i){h(this,bt);h(this,H,[]);q(this,"add",c((i,e="string")=>{i.forEach(s=>{t(this,H).some(n=>n.name===s)||t(this,H).push({name:s,type:e})}),t(this,Ht).call(this)},"add"));h(this,Ht,c(()=>{const i=new Map;t(this,H).forEach(e=>{i.set(e.name,e.type)}),p(this,H,Array.from(i,([e,s])=>({name:e,type:s}))),p(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"));h(this,re,c(()=>{p(this,H,[]),E.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)E.log(e),$("[data-bind]",e).each((s,n)=>{const r=n.dataset.bind,a=n.getAttribute("data-type")||"string";r&&t(this,H).push({name:r,type:a})}),["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 a=r.getAttribute(s);if(a.indexOf("data.")<0){const o=a.search(/[(]/g);if(o>0)try{a=String(window[a.substring(0,o).trim()])}catch{a=""}}a.split("data.").forEach(o=>{if(o.trim()!=""){const d=o.search(/[^_A-Za-z0-9]/g);let l="";d>=0?l=o.substring(0,d):a.startsWith("data.")&&(l=o.replace("data.","")),l&&t(this,H).push({name:l,type:"string"})}})})});t(this,Ht).call(this)}},"#init"));p(this,bt,i),t(this,re).call(this)}get(){return t(this,H).map(i=>i.name)}getFields(){return t(this,H)}getType(i){const e=t(this,H).find(s=>s.name===i);return e?e.type:"string"}indexOf(i){return t(this,H).findIndex(e=>e.name===i)}includes(i){return t(this,H).some(e=>e.name===i)}};bt=new WeakMap,H=new WeakMap,Ht=new WeakMap,re=new WeakMap,c($e,"ngFields");let pe=$e;const Ie=class Ie extends HTMLElement{constructor(){super();h(this,at);h(this,oe);h(this,ae,c(()=>{this.fields=new pe(this),p(this,oe,new fe(this)),E.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(){E.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,c(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(){}};c(Mt,"BasicCellElement"),q(Mt,"_styleCache",new Map),q(Mt,"_customStyleCache",new Map);let me=Mt;const ze=class ze extends me{constructor(){super();h(this,L);h(this,$t);h(this,y);h(this,_e);h(this,Ne);h(this,We);h(this,Oe);q(this,"getDisplayText",c(e=>{if(t(this,y))if(t(this,y).closest("tbody")){const s=t(this,y).closest("tr").data,n=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,n,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"));h(this,Be,c(()=>{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"),n=[];$("th,td",s).each((m,O)=>{var M=ninegrid.j.querySelectorAll(O).attr("suppress");M&&O.dataset.row&&(M=parseInt(M),!isNaN(M)&&M<=e&&n.push(M))}),n.sort();var r=!1;if(parseInt(s.sectionRowIndex/t(this,L).template.length)>0)for(var a of n){if(a>e)break;var o=parseInt(t(this,y).dataset.row),d=o-1,l=t(this,y).closest("tr").data,f=t(this,L).data.get(d);t(this,y).dataset.matrixRow;var u=t(this,L).body.querySelector(`tbody.bindable [suppress="${a}"][data-matrix-row="${t(this,y).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,o):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,d):f[u.dataset.bind];if(b!=g){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,y)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,y)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,y)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,y)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,y)).addClass("hidden"));var x=parseInt(t(this,y).dataset.matrixRow),v=x-1,T=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,y).dataset.col}"][data-matrix-row="${v}"]`);$(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",c((e,s,n,r)=>{if(typeof e<"u")try{n=parseInt(n);const a=e.replace("()","");return t(this,L)[a]?t(this,L)[a].call(this,s,n,t(this,y)):t(this,L).exprFunction(e).call(this,s,n,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 n=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,n):t(this,L).data.setValue(s,t(this,y).dataset.bind,e,n)}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,Be=new WeakMap,c(ze,"CellElement");let xe=ze;const Pe=class Pe extends xe{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};c(Pe,"EditableCellElement");let ve=Pe;const je=class je extends ve{constructor(){super();h(this,It);h(this,lt);h(this,pt);h(this,yt);h(this,le);h(this,K);q(this,"refresh",c(()=>{const e=super.refresh();t(this,It).value=e},"refresh"));h(this,De,c(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,lt)=="number"){let r=[];if(t(this,K)&&Number(t(this,K))>0&&r.push("."),t(this,yt)&&Number(t(this,yt))>=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,n=s.indexOf(".");if(n>=0){var s=s.substr(n+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=`
|
|
367
|
+
`;const a=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");a==null||a.forEach((h,l)=>{e[l]&&setTimeout(()=>{h.generate(e[l]),s&&t(this,kt).call(this)})})},"#render"));p(this,_,i),t(this,Qt).call(this)}};_=new WeakMap,Qt=new WeakMap,kt=new WeakMap,te=new WeakMap,c(Le,"LayoutManager");let fe=Le;const He=class He{constructor(i){d(this,Ct);d(this,ft,-1);T(this,"count",c(()=>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,c(He,"ngRow");let ue=He;const O=class O{constructor(i,e){d(this,N);d(this,C);d(this,W,[]);d(this,ut,[]);d(this,ee,0);d(this,X,[]);d(this,se,c(()=>{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,rt,c(()=>{t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));T(this,"get",c((i,e)=>{var r;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 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,gt).call(this,s[i])},"get"));T(this,"set",c(i=>{this.clear(),this.add(i,!1),t(this,rt).call(this)},"set"));d(this,Lt,c(()=>({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"));T(this,"reset",c(()=>{p(this,W,[]),p(this,ut,[]),t(this,rt).call(this)},"reset"));T(this,"clear",c(()=>{var i;t(this,C).rawRecords=[],p(this,W,[]),p(this,ut,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).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,Lt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=O.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));T(this,"add",c((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,ne).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((r,o)=>{const a=t(this,C).rawRecords[n-o];a&&(a.__ng.rowState=O.ROW_STATE.EMPTY)}),t(this,rt).call(this),n},"add"));T(this,"delete",c(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,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,C).rawRecords=t(this,C).rawRecords.filter(r=>r.__ng.rowid!==n):t(this,C).rawRecords.forEach(r=>{r.__ng.rowid===n&&(r.__ng.deleted=!0,r.__ng.rowState=O.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,rt).call(this)},"delete"));T(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"));T(this,"resetRecords",c(()=>{p(this,ut,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),p(this,W,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,W).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));T(this,"getValidData",c(()=>(t(this,W).length===0&&t(this,C).rawRecords.length>0&&this.resetRecords(),t(this,W)),"getValidData"));d(this,gt,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"));T(this,"count",c(()=>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,W).length}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,C=new WeakMap,W=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,rt=new WeakMap,Lt=new WeakMap,ie=new WeakMap,ne=new WeakMap,gt=new WeakMap,c(O,"ngData"),T(O,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=O;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 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([])}};ot=new WeakMap,c(Me,"ngDataManager");let be=Me;const $e=class $e{constructor(i){d(this,bt);d(this,H,[]);T(this,"add",c((i,e="string")=>{i.forEach(s=>{t(this,H).some(n=>n.name===s)||t(this,H).push({name:s,type:e})}),t(this,Ht).call(this)},"add"));d(this,Ht,c(()=>{const i=new Map;t(this,H).forEach(e=>{i.set(e.name,e.type)}),p(this,H,Array.from(i,([e,s])=>({name:e,type:s}))),p(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,re,c(()=>{p(this,H,[]),E.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)E.log(e),$("[data-bind]",e).each((s,n)=>{const r=n.dataset.bind,o=n.getAttribute("data-type")||"string";r&&t(this,H).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,H).push({name:l,type:"string"})}})})});t(this,Ht).call(this)}},"#init"));p(this,bt,i),t(this,re).call(this)}get(){return t(this,H).map(i=>i.name)}getFields(){return t(this,H)}getType(i){const e=t(this,H).find(s=>s.name===i);return e?e.type:"string"}indexOf(i){return t(this,H).findIndex(e=>e.name===i)}includes(i){return t(this,H).some(e=>e.name===i)}};bt=new WeakMap,H=new WeakMap,Ht=new WeakMap,re=new WeakMap,c($e,"ngFields");let pe=$e;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,at);d(this,oe);d(this,ae,c(()=>{this.fields=new pe(this),p(this,oe,new fe(this)),E.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(){E.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,c(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(){}};c(Mt,"BasicCellElement"),T(Mt,"_styleCache",new Map),T(Mt,"_customStyleCache",new Map);let me=Mt;const ze=class ze 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",c(e=>{if(t(this,y))if(t(this,y).closest("tbody")){const s=t(this,y).closest("tr").data,n=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,n,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,Be,c(()=>{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"),n=[];$("th,td",s).each((x,B)=>{var M=ninegrid.j.querySelectorAll(B).attr("suppress");M&&B.dataset.row&&(M=parseInt(M),!isNaN(M)&&M<=e&&n.push(M))}),n.sort();var r=!1;if(parseInt(s.sectionRowIndex/t(this,L).template.length)>0)for(var o of n){if(o>e)break;var a=parseInt(t(this,y).dataset.row),h=a-1,l=t(this,y).closest("tr").data,f=t(this,L).data.get(h);t(this,y).dataset.matrixRow;var u=t(this,L).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,y).dataset.matrixRow}"]`),g=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],b=u.dataset.expr?this.getExprValue(u.dataset.expr,f,h):f[u.dataset.bind];if(g!=b){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,y)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,y)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,y)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,y)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,y)).addClass("hidden"));var m=parseInt(t(this,y).dataset.matrixRow),v=m-1,q=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,y).dataset.col}"][data-matrix-row="${v}"]`);$(q).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,y)).hasClass("suppress")?ninegrid.j.querySelectorAll(q).removeClass("last-none-suppress").addClass("last-suppress"):!$(q).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,y)).hasClass("suppress")?ninegrid.j.querySelectorAll(q).removeClass("last-suppress").addClass("last-none-suppress"):ninegrid.j.querySelectorAll(q).removeClass("last-none-suppress").removeClass("last-suppress")}}},"#resetSuppress"));T(this,"getExprValue",c((e,s,n,r)=>{if(typeof e<"u")try{n=parseInt(n);const o=e.replace("()","");return t(this,L)[o]?t(this,L)[o].call(this,s,n,t(this,y)):t(this,L).exprFunction(e).call(this,s,n,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 n=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,n):t(this,L).data.setValue(s,t(this,y).dataset.bind,e,n)}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,Be=new WeakMap,c(ze,"CellElement");let xe=ze;const Pe=class Pe extends xe{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};c(Pe,"EditableCellElement");let ve=Pe;const je=class je extends ve{constructor(){super();d(this,It);d(this,lt);d(this,pt);d(this,yt);d(this,le);d(this,K);T(this,"refresh",c(()=>{const e=super.refresh();t(this,It).value=e},"refresh"));d(this,De,c(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,lt)=="number"){let r=[];if(t(this,K)&&Number(t(this,K))>0&&r.push("."),t(this,yt)&&Number(t(this,yt))>=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,n=s.indexOf(".");if(n>=0){var s=s.substr(n+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=`
|
|
368
368
|
<input type="text"
|
|
369
369
|
${e.join(" ")}
|
|
370
370
|
ondragstart="return false;"
|