@ninebone/table 0.0.536 → 0.0.537
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 +239 -238
- 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(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
|
|
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 Ve=Object.defineProperty;var Ye=E=>{throw TypeError(E)};var Ke=(E,w,v)=>w in E?Ve(E,w,{enumerable:!0,configurable:!0,writable:!0,value:v}):E[w]=v;var h=(E,w)=>Ve(E,"name",{value:w,configurable:!0});var T=(E,w,v)=>Ke(E,typeof w!="symbol"?w+"":w,v),Ue=(E,w,v)=>w.has(E)||Ye("Cannot "+v);var t=(E,w,v)=>(Ue(E,w,"read from private field"),v?v.call(E):w.get(E)),d=(E,w,v)=>w.has(E)?Ye("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(E):w.set(E,v),b=(E,w,v,F)=>(Ue(E,w,"write to private field"),F?F.call(E,v):w.set(E,v),v);var Xe=(E,w,v,F)=>({set _(xt){b(E,w,xt,v)},get _(){return t(E,w,F)}});var z,V,A,G,J,Q,Bt,tt,zt,Y,ct,et,k,vt,wt,Dt,j,q,U,D,I,X,st,St,Te,ht,Pt,Et,jt,Ft,At,qt,Vt,Yt,Rt,ke,dt,Tt,Ut,Kt,it,rt,Zt,Gt,ft,Jt,Qt,te,Ct,_,ee,Lt,se,Ht,ut,W,C,O,gt,ie,K,re,nt,Mt,ne,oe,bt,ot,yt,M,$t,ae,at,le,ce,L,_t,p,Ne,We,Oe,Be,ze,Nt,lt,pt,mt,he,Z,je;const Ae=class Ae extends E.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(Ae,"Trace");let w=Ae;const v=new w,qe=class qe extends HTMLElement{constructor(){super();d(this,z);d(this,V,!1);d(this,A);d(this,G);d(this,J);d(this,Q);d(this,Bt,h(()=>{if(!t(this,z))return;const e=t(this,z).querySelector(".ng-container-body .ng-part-body");e&&(b(this,Q,new ResizeObserver(()=>{this.refresh()})),t(this,Q).observe(e))},"#observeResize"));T(this,"refresh",h(()=>{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 r=t(this,A).track,n=t(this,A).thumb,a=t(this,z).querySelector(".ng-container-bottom"),o=e.clientWidth,l=s.scrollWidth;if(o!==0&&l>o)a&&(a.style.display="flex");else{a&&(a.style.display="none");return}const c=r.clientWidth;if(c<=0)return;const f=Math.max(Math.min(c*(o/l),c),20);n.style.width=`${f}px`;const u=e.scrollLeft,g=l-o;let y=0;g>0&&(y=parseInt(u/g*(c-f),10)),y<0&&(y=0);const m=c-f;y>m&&(y=m),n.style.left=`${y}px`,t(this,A).left.disabled=y===0,t(this,A).right.disabled=y>=m-1},"refresh"));d(this,tt,h(e=>{if(!t(this,A))return!1;const s=t(this,A).container,r=s.querySelector("table");if(!r)return!1;const n=t(this,A).track.getBoundingClientRect(),a=t(this,A).thumb.clientWidth;let o=e;o<0&&(o=0);const l=n.width-a;o>l&&(o=l),o=parseInt(o,10),t(this,A).thumb.style.left=`${o}px`,t(this,A).left.disabled=o===0,t(this,A).right.disabled=o>=l-1;const c=s.clientWidth,u=r.scrollWidth-c;return l>0&&u>0&&(s.scrollLeft=o/l*u),o>0&&o<l-1},"#thumbMoveTo"));d(this,zt,h(()=>{const e=h(r=>{clearInterval(t(this,G)),clearInterval(t(this,J));const n=parseInt(t(this,A).thumb.style.left||0,10);t(this,tt).call(this,n+r),b(this,G,setInterval(()=>{clearInterval(t(this,G)),b(this,J,setInterval(()=>{const a=parseInt(t(this,A).thumb.style.left||0,10);t(this,tt).call(this,a+r)||clearInterval(t(this,J))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,G)),clearInterval(t(this,J))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(r=>{t(this,A).left.addEventListener(r,s),t(this,A).right.addEventListener(r,s),t(this,A).track.addEventListener(r,s)}),t(this,A).left.addEventListener("mousedown",r=>{r.button===0&&e(-20)}),t(this,A).right.addEventListener("mousedown",r=>{r.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",r=>{if(r.button!==0)return;r.preventDefault();const n=t(this,A).track.getBoundingClientRect(),a=t(this,A).thumb.clientWidth;t(this,tt).call(this,r.clientX-n.left-a/2)}),t(this,A).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),b(this,V,!0),this.shiftX=r.clientX-t(this,A).thumb.getBoundingClientRect().left;const n=h(o=>{if(!t(this,V))return;const l=t(this,A).track.getBoundingClientRect();t(this,tt).call(this,o.clientX-l.left-this.shiftX)},"onMouseMove"),a=h(()=>{b(this,V,!1),s(),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",a),this.refresh()},"onMouseUp");document.addEventListener("mousemove",n),document.addEventListener("mouseup",a)})},"#init"))}connectedCallback(){if(b(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=h(()=>{const s=t(this,z).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}
|
|
63
|
+
`;const e=h(()=>{const s=t(this,z).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}b(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,zt).call(this),t(this,Bt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,Q)&&t(this,Q).disconnect()}};z=new WeakMap,V=new WeakMap,A=new WeakMap,G=new WeakMap,J=new WeakMap,Q=new WeakMap,Bt=new WeakMap,tt=new WeakMap,zt=new WeakMap,h(qe,"NineTableHScrollBar");let F=qe;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Re=class Re extends HTMLElement{constructor(){super();d(this,Y);d(this,ct);d(this,et,!1);d(this,k);d(this,vt,0);d(this,wt,0);T(this,"refresh",h(()=>{if(!t(this,Y)||!t(this,k))return;v.log("nine-table-vscrollbar.refresh");const e=t(this,k).container,s=t(this,k).track,r=t(this,k).thumb,n=e.clientHeight,o=(t(this,Y).data.get()||[]).length,l=t(this,ct).getRowHeight(),c=o*l;if(c<=n){r.style.display="none",t(this,k).top.disabled=!0,t(this,k).bottom.disabled=!0;return}else r.style.display="block";const f=s.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(n/c),f),20);r.style.height=`${u}px`;const g=e.scrollTop,y=Math.max(c-n,1);let m=0;y>0&&(m=g/y*(f-u));const S=f-u;m<0&&(m=0),m>S&&(m=S),r.style.top=`${m}px`,t(this,k).top.disabled=g<=0,t(this,k).bottom.disabled=g>=y-1},"refresh"));d(this,Dt,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,k).container,s=h(()=>{const n=(t(this,Y).data.get()||[]).length,a=t(this,ct).getRowHeight();return n*a},"getContentHeight");e.addEventListener("scroll",()=>{t(this,et)||this.refresh()}),t(this,k).thumb.addEventListener("mousedown",r=>{if(r.button!==0)return;r.stopPropagation(),r.preventDefault(),b(this,et,!0),b(this,vt,r.clientY),b(this,wt,e.scrollTop);const n=h(o=>{if(!t(this,et))return;const l=t(this,k).track.getBoundingClientRect(),c=t(this,k).thumb.clientHeight,u=l.height-c,g=o.clientY-t(this,vt),y=e.clientHeight,m=s(),S=Math.max(m-y,1);if(u>0&&S>0){const R=g/u*S;let x=t(this,wt)+R;const N=Math.max(0,m-y);x<0&&(x=0),x>N&&(x=N),e.scrollTop=x}this.refresh()},"onMouseMove"),a=h(()=>{b(this,et,!1),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",a),this.refresh()},"onMouseUp");document.addEventListener("mousemove",n),document.addEventListener("mouseup",a)}),t(this,k).track.addEventListener("mousedown",r=>{if(r.button!==0||r.target===t(this,k).thumb)return;const n=t(this,k).track.getBoundingClientRect(),a=t(this,k).thumb.clientHeight,o=r.clientY-n.top-a/2,c=n.height-a,f=e.clientHeight,u=s(),g=Math.max(u-f,1);if(c>0&&g>0){const y=Math.max(0,Math.min(1,o/c));e.scrollTop=y*g}this.refresh()}),t(this,k).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,k).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){b(this,Y,this.getRootNode().host),b(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=h(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,k,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,zt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,et=new WeakMap,k=new WeakMap,vt=new WeakMap,wt=new WeakMap,zt=new WeakMap,h(qe,"NineTableVScrollBar");let xt=qe;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",xt);const ke=class ke{constructor(i){d(this,j);d(this,q);d(this,U);d(this,D,new Map);d(this,I,null);d(this,X,null);d(this,st,0);d(this,St,40);d(this,Re,!1);d(this,ht,!1);d(this,Dt,3);T(this,"refresh",h(()=>{v.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))},"refresh"));T(this,"initialize",h(()=>{v.log("rowManager.initialize"),y(this,U,{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,I,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const o=t(this,q).querySelector(a);if(!o)return;const l=o.querySelector(".ng-part-body table");if(!l)return;const c=l.querySelector("tbody.bindable-tbody");if(!c)return;const u=Array.from(c.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,D).set(a,u)});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"),r=t(this,q).querySelector(".ng-container-body .ng-part-header"),n=t(this,q).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,jt).call(this,i),t(this,qt).call(this),t(this,Et).call(this),t(this,dt).call(this,i.scrollTop);let a=!1;const o=h((l,c,f)=>{var u;a||(a=!0,i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==c&&(r.scrollLeft=c),n&&n.scrollLeft!==c&&(n.scrollLeft=c),t(this,dt).call(this,l),(u=t(this,q).querySelector("nine-table-vscrollbar"))==null||u.refresh(),a=!1)},"syncScroll");[i,e,s].forEach(l=>{l&&l.addEventListener("scroll",()=>{t(this,ht)||(y(this,ht,!0),requestAnimationFrame(()=>{o(l.scrollTop,l.scrollLeft),y(this,ht,!1)}))})})}},"initialize"));d(this,Pt,h((i,e)=>{v.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(o=>o.remove());const n=r.querySelector("tr.nodata"),a=document.createDocumentFragment();for(let o=0;o<t(this,St);o++)s.forEach(l=>{a.appendChild(l.cloneNode(!0))});n?n.before(a):r.appendChild(a),e===".ng-container-body"&&(t(this,U).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,jt,h(i=>{if(v.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);v.log("#measureAndCacheHeight");const e=t(this,D).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 r=s.querySelector("tr.nodata"),n=document.createDocumentFragment();e.forEach(g=>{n.appendChild(g.cloneNode(!0))}),r?r.before(n):s.appendChild(n);const a=t(this,q),o=a.style.display,l=a.style.visibility,c=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(g=>{f+=g.offsetHeight||g.getBoundingClientRect().height}),u.forEach(g=>g.remove()),a.style.display=o,a.style.visibility=l,a.style.position=c,y(this,I,f>0?f:24),t(this,At).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,Et,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),r=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const a=t(this,q).querySelector(n);if(!a)return;const o=a.querySelector(".ng-part-body .ng-virtual-spacer");o&&(o.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,At,h(()=>{if(t(this,st)>0&&t(this,I)>0){const i=Math.ceil(t(this,st)/t(this,I));y(this,St,i+t(this,Dt))}},"#updateRowCount"));d(this,Ft,h(()=>{var o,l,c,f,u,g;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 b=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),S=s?Array.from(s.querySelectorAll("tbody tr")):[],R=Math.max(b.length,m.length,S.length);for(let x=0;x<R;x++){const N=[((o=b[x])==null?void 0:o.getBoundingClientRect().height)||0,((l=m[x])==null?void 0:l.getBoundingClientRect().height)||0,((c=S[x])==null?void 0:c.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(b[x]&&(b[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),S[x]&&(S[x].style.height=`${H}px`))}}const r=t(this,q).querySelector(".ng-container-left .ng-part-footer table"),n=t(this,q).querySelector(".ng-container-body .ng-part-footer table"),a=t(this,q).querySelector(".ng-container-right .ng-part-footer table");if(n){const b=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(n.querySelectorAll("tfoot tr")),S=a?Array.from(a.querySelectorAll("tfoot tr")):[],R=Math.max(b.length,m.length,S.length);for(let x=0;x<R;x++){const N=[((f=b[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((g=S[x])==null?void 0:g.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(b[x]&&(b[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),S[x]&&(S[x].style.height=`${H}px`))}}},"#syncRowHeights"));d(this,Vt,h(()=>{!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 r=e.contentRect.height;if(r>0){let n=0;const a=s.querySelector(".ng-part-header"),o=s.querySelector(".ng-part-footer");a&&(n+=a.offsetHeight),o&&(n+=o.offsetHeight);const l=Math.max(r-n,100);t(this,st)!==l&&(y(this,st,l),t(this,At).call(this),t(this,I)!==null&&(t(this,qt).call(this),this.refresh()))}}})),t(this,X).observe(t(this,q)))},"#initResizeObserver"));d(this,qt,h(()=>{v.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,Pt).call(this,e,i)}),t(this,Yt).call(this),t(this,Ft).call(this)},"#renderAllContainers"));d(this,Te,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var c;const s=t(this,q).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)")),a=((c=t(this,D).get(e))==null?void 0:c.length)||1,l=(t(this,j).data.get()||[]).length;n.forEach((f,u)=>{const g=i+Math.floor(u/a);if(g>=l){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,dt,h(i=>{var f,u;const e=t(this,I);if(!e||e<=0)return;const s=t(this,j).data.length,r=Math.max(0,Math.floor(i/e)),n=r*e,a=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,o=t(this,q).querySelector(".ng-container-body"),l=o==null?void 0:o.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)");v.log(t(this,U).firstTr,t(this,U).firstTr.dataset.row);const c=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(u=t(this,U))==null||u.scrollTables.forEach(g=>{g.style.transform=`translateY(${n}px)`}),c!==r&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const b=t(this,q).querySelector(g);if(!b)return;const m=b.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((R,x)=>{const N=r+Math.floor(x/a);if(N>=s){R.style.display="none";return}const H=t(this,j).data.get(N);R.style.display="",t(this,Rt).call(this,R,H,N)})})},"#handleScroll"));d(this,Rt,h((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((r,n)=>{r.dataset.row=s;const a=Array.from(r.children).find(o=>o.tagName.toLowerCase().startsWith("cell-")||typeof o.refresh=="function");a&&typeof a.refresh=="function"&&a.refresh()})},"#bindRowData"));d(this,Yt,h(()=>{var l,c,f;v.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 r=i?Array.from(i.querySelectorAll("tr")):[],n=Array.from(e.querySelectorAll("tr")),a=s?Array.from(s.querySelectorAll("tr")):[],o=Math.max(r.length,n.length,a.length);for(let u=0;u<o;u++){const g=[((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((c=n[u])==null?void 0:c.getBoundingClientRect().height)||0,((f=a[u])==null?void 0:f.getBoundingClientRect().height)||0],b=Math.max(...g);b>0&&(r[u]&&(r[u].style.height=`${b}px`),n[u]&&(n[u].style.height=`${b}px`),a[u]&&(a[u].style.height=`${b}px`))}},"#syncHeaderHeights"));T(this,"destroy",h(()=>{t(this,X)&&(t(this,X).disconnect(),y(this,X,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,q,i),t(this,Vt).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,q=new WeakMap,U=new WeakMap,D=new WeakMap,I=new WeakMap,X=new WeakMap,st=new WeakMap,St=new WeakMap,Re=new WeakMap,ht=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,jt=new WeakMap,Et=new WeakMap,At=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,qt=new WeakMap,Te=new WeakMap,dt=new WeakMap,Rt=new WeakMap,Yt=new WeakMap,h(ke,"RowManager");let he=ke;const Ut=class Ut{static compileAll(i){return Array.isArray(i)?i.map(e=>Ut.compile(e)):[]}static compile(i){if(!i)return null;const e=h(o=>{o.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(c=>{const f=c.getAttribute("cell-type")||"renderer";if(c.children.length>0&&c.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const g=c.getAttribute("data-bind"),b=c.getAttribute("data-expr"),m=c.getAttribute("maxbyte"),S=c.getAttribute("type");let R=[];g&&R.push(`data-bind="${g}"`),b&&R.push(`data-expr="${b}"`),m&&R.push(`maxbyte="${m}"`),S&&R.push(`type="${S}"`),c.innerHTML=`<${u} ${R.join(" ")}></${u}>`})},"processCellTypes"),s=h(o=>{if(!o.querySelector("colgroup")){const l=o.querySelector("tbody tr")||o.querySelector("tr"),c=l?l.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(o.clientWidth/c),100);for(let g=0;g<c;g++){const b=document.createElement("col");b.setAttribute("width",u),f.appendChild(b)}o.prepend(f)}if(!o.querySelector("thead")){const l=document.createElement("thead"),c=o.querySelector("colgroup");c?c.after(l):o.prepend(l)}o.classList.add("nine-table-element"),o.style.display="table"},"ensureTableStructure"),r=h((o,l)=>{const c=Array.from(o.querySelectorAll(l+" tr")),f=Array.from(o.querySelectorAll(l+" th,"+l+" td")),u=c.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));c.forEach(m=>{const S=m.sectionRowIndex;let R=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let P=0;P<b[S].length;P++)if(b[S][P]===null){R=P;break}const N=x.rowSpan||1,H=x.colSpan||1;for(let P=0;P<N;P++)for(let Nt=0;Nt<H;Nt++)S+P<u&&R+Nt<g&&(b[S+P][R+Nt]=P===0&&Nt===0?"1":"0")})}),c.forEach(m=>{const S=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(R=>{for(let x=0;x<b[S].length;x++)if(b[S][x]==="1"){R.dataset.col=x,b[S][x]="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((o,l)=>{const c=o.getAttribute("fixed");c&&n.querySelectorAll(`thead [data-col="${l}"], tbody [data-col="${l}"], tfoot [data-col="${l}"]`).forEach(f=>{f.setAttribute("fixed",c)})}),n}};h(Ut,"TableCompiler");let de=Ut;const Tt=class Tt extends HTMLElement{constructor(){super();d(this,Xt);d(this,it,null);d(this,rt);T(this,"invalidate",h(()=>{t(this,rt).refresh()},"invalidate"));d(this,Kt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{const n=this.querySelector(s);if(!n)return;n.innerHTML="";const a=document.createElement("div");a.className="ng-part-header",a.appendChild(t(this,ft).call(this,t(this,it),r,"header"));const o=document.createElement("div");o.className="ng-part-body";const l=document.createElement("div");l.className="ng-scroll-content",l.style.position="relative",l.style.width="100%",l.appendChild(t(this,ft).call(this,t(this,it),r,"body"));const c=document.createElement("div");c.className="ng-virtual-spacer",c.style.width="100%",c.style.pointerEvents="none",l.appendChild(c),o.appendChild(l);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,ft).call(this,t(this,it),r,"footer")),n.appendChild(a),n.appendChild(o),n.appendChild(f)})},"#renderSplitContainers"));d(this,Zt,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(a=>{const o=parseInt(a.getAttribute("width"),10);isNaN(n)||(n+=o)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${n}px`,s.style.width=`${n}px`)})},"#updateContainerWidths"));T(this,"generate",h(e=>{e&&(y(this,it,de.compile(e)),t(this,Kt).call(this),t(this,Zt).call(this),t(this,rt).initialize(),setTimeout(()=>{var s;(s=this.querySelector("nine-table-hscrollbar"))==null||s.refresh()},0))},"generate"));d(this,ft,h((e,s,r)=>{const n=e.cloneNode(!0),a=n.querySelector("thead"),o=n.querySelector("tbody"),l=n.querySelector("tfoot");if(r==="header"){if(o&&o.remove(),l&&l.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",n.appendChild(f)}}else r==="body"?(a&&a.remove(),l&&l.remove(),o&&(o.className="bindable-tbody")):r==="footer"&&(a&&a.remove(),o&&o.remove());return s==="left"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(c=>{c.getAttribute("fixed")!=="left"&&c.remove()}):s==="right"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(c=>{c.getAttribute("fixed")!=="right"&&c.remove()}):n.querySelectorAll("[fixed=left], [fixed=right]").forEach(c=>{c.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,Gt,h(()=>{t(this,Jt).call(this)},"#init"));d(this,Jt,h(()=>{const e=Tt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
126
|
+
`;const e=h(()=>{const s=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}b(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,Dt).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ct=new WeakMap,et=new WeakMap,k=new WeakMap,vt=new WeakMap,wt=new WeakMap,Dt=new WeakMap,h(Re,"NineTableVScrollBar");let xt=Re;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",xt);const Ce=class Ce{constructor(i){d(this,j);d(this,q);d(this,U);d(this,D,new Map);d(this,I,null);d(this,X,null);d(this,st,0);d(this,St,40);d(this,Te,!1);d(this,ht,!1);d(this,Pt,3);T(this,"refresh",h(()=>{v.log("rowManager.refresh");const i=t(this,q).querySelector(".ng-container-body .ng-part-body");i&&(t(this,At).call(this),t(this,dt).call(this,i.scrollTop))},"refresh"));T(this,"initialize",h(()=>{v.log("rowManager.initialize"),b(this,U,{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)")}),b(this,I,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const o=t(this,q).querySelector(a);if(!o)return;const l=o.querySelector(".ng-part-body table");if(!l)return;const c=l.querySelector("tbody.bindable-tbody");if(!c)return;const u=Array.from(c.querySelectorAll("tr")).map(g=>g.cloneNode(!0));t(this,D).set(a,u)});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"),r=t(this,q).querySelector(".ng-container-body .ng-part-header"),n=t(this,q).querySelector(".ng-container-body .ng-part-footer");if(i){t(this,Ft).call(this,i),t(this,Rt).call(this),t(this,At).call(this),t(this,dt).call(this,i.scrollTop);let a=!1;const o=h((l,c,f)=>{var u;a||(a=!0,i&&i.scrollTop!==l&&(i.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==c&&(r.scrollLeft=c),n&&n.scrollLeft!==c&&(n.scrollLeft=c),t(this,dt).call(this,l),(u=t(this,q).querySelector("nine-table-vscrollbar"))==null||u.refresh(),a=!1)},"syncScroll");[i,e,s].forEach(l=>{l&&l.addEventListener("scroll",()=>{t(this,ht)||(b(this,ht,!0),requestAnimationFrame(()=>{o(l.scrollTop,l.scrollLeft),b(this,ht,!1)}))})})}},"initialize"));d(this,Et);d(this,jt,h((i,e)=>{v.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(o=>o.remove());const n=r.querySelector("tr.nodata"),a=document.createDocumentFragment();for(let o=0;o<t(this,St);o++)s.forEach(l=>{a.appendChild(l.cloneNode(!0))});n?n.before(a):r.appendChild(a),e===".ng-container-body"&&(b(this,Et,r.querySelector("tr:not(.nodata)")),t(this,U).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Ft,h(i=>{if(v.log("rowManager.#measureAndCacheHeight"),t(this,I)!==null&&t(this,I)>0)return t(this,I);v.log("#measureAndCacheHeight");const e=t(this,D).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 r=s.querySelector("tr.nodata"),n=document.createDocumentFragment();e.forEach(g=>{n.appendChild(g.cloneNode(!0))}),r?r.before(n):s.appendChild(n);const a=t(this,q),o=a.style.display,l=a.style.visibility,c=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(g=>{f+=g.offsetHeight||g.getBoundingClientRect().height}),u.forEach(g=>g.remove()),a.style.display=o,a.style.visibility=l,a.style.position=c,b(this,I,f>0?f:24),t(this,qt).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,At,h(()=>{v.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,j).data.get()||[]).length,s=t(this,I),r=e*s;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const a=t(this,q).querySelector(n);if(!a)return;const o=a.querySelector(".ng-part-body .ng-virtual-spacer");o&&(o.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,qt,h(()=>{if(t(this,st)>0&&t(this,I)>0){const i=Math.ceil(t(this,st)/t(this,I));b(this,St,i+t(this,Pt))}},"#updateRowCount"));d(this,Vt,h(()=>{var o,l,c,f,u,g;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 y=i?Array.from(i.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),S=s?Array.from(s.querySelectorAll("tbody tr")):[],R=Math.max(y.length,m.length,S.length);for(let x=0;x<R;x++){const N=[((o=y[x])==null?void 0:o.getBoundingClientRect().height)||0,((l=m[x])==null?void 0:l.getBoundingClientRect().height)||0,((c=S[x])==null?void 0:c.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(y[x]&&(y[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),S[x]&&(S[x].style.height=`${H}px`))}}const r=t(this,q).querySelector(".ng-container-left .ng-part-footer table"),n=t(this,q).querySelector(".ng-container-body .ng-part-footer table"),a=t(this,q).querySelector(".ng-container-right .ng-part-footer table");if(n){const y=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(n.querySelectorAll("tfoot tr")),S=a?Array.from(a.querySelectorAll("tfoot tr")):[],R=Math.max(y.length,m.length,S.length);for(let x=0;x<R;x++){const N=[((f=y[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((g=S[x])==null?void 0:g.getBoundingClientRect().height)||0],H=Math.max(...N);H>0&&(y[x]&&(y[x].style.height=`${H}px`),m[x]&&(m[x].style.height=`${H}px`),S[x]&&(S[x].style.height=`${H}px`))}}},"#syncRowHeights"));d(this,Yt,h(()=>{!t(this,q)||!(t(this,q)instanceof HTMLElement)||(b(this,X,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 a=s.querySelector(".ng-part-header"),o=s.querySelector(".ng-part-footer");a&&(n+=a.offsetHeight),o&&(n+=o.offsetHeight);const l=Math.max(r-n,100);t(this,st)!==l&&(b(this,st,l),t(this,qt).call(this),t(this,I)!==null&&(t(this,Rt).call(this),this.refresh()))}}})),t(this,X).observe(t(this,q)))},"#initResizeObserver"));d(this,Rt,h(()=>{v.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,jt).call(this,e,i)}),t(this,Ut).call(this),t(this,Vt).call(this)},"#renderAllContainers"));d(this,ke,h(i=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var c;const s=t(this,q).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)")),a=((c=t(this,D).get(e))==null?void 0:c.length)||1,l=(t(this,j).data.get()||[]).length;n.forEach((f,u)=>{const g=i+Math.floor(u/a);if(g>=l){f.style.display="none";return}const y=t(this,j).data.get(g);f.style.display="",t(this,Tt).call(this,f,y,g)})})},"#adjustBufferRows"));d(this,dt,h(i=>{var f,u;const e=t(this,I);if(!e||e<=0)return;const s=t(this,j).data.length,r=Math.max(0,Math.floor(i/e)),n=r*e,a=((f=t(this,D).get(".ng-container-body"))==null?void 0:f.length)||1,o=t(this,q).querySelector(".ng-container-body"),l=o==null?void 0:o.querySelector(".ng-part-body tbody.bindable-tbody tr:not(.nodata)");v.log(t(this,Et),t(this,U).firstTr,t(this,U).firstTr.dataset.row);const c=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(u=t(this,U))==null||u.scrollTables.forEach(g=>{g.style.transform=`translateY(${n}px)`}),c!==r&&[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const y=t(this,q).querySelector(g);if(!y)return;const m=y.querySelector(".ng-part-body tbody.bindable-tbody");if(!m)return;Array.from(m.querySelectorAll("tr:not(.nodata)")).forEach((R,x)=>{const N=r+Math.floor(x/a);if(N>=s){R.style.display="none";return}const H=t(this,j).data.get(N);R.style.display="",t(this,Tt).call(this,R,H,N)})})},"#handleScroll"));d(this,Tt,h((i,e,s)=>{i.dataset.row=s,i.data=e,Array.from(i.cells).forEach((r,n)=>{r.dataset.row=s;const a=Array.from(r.children).find(o=>o.tagName.toLowerCase().startsWith("cell-")||typeof o.refresh=="function");a&&typeof a.refresh=="function"&&a.refresh()})},"#bindRowData"));d(this,Ut,h(()=>{var l,c,f;v.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 r=i?Array.from(i.querySelectorAll("tr")):[],n=Array.from(e.querySelectorAll("tr")),a=s?Array.from(s.querySelectorAll("tr")):[],o=Math.max(r.length,n.length,a.length);for(let u=0;u<o;u++){const g=[((l=r[u])==null?void 0:l.getBoundingClientRect().height)||0,((c=n[u])==null?void 0:c.getBoundingClientRect().height)||0,((f=a[u])==null?void 0:f.getBoundingClientRect().height)||0],y=Math.max(...g);y>0&&(r[u]&&(r[u].style.height=`${y}px`),n[u]&&(n[u].style.height=`${y}px`),a[u]&&(a[u].style.height=`${y}px`))}},"#syncHeaderHeights"));T(this,"destroy",h(()=>{t(this,X)&&(t(this,X).disconnect(),b(this,X,null))},"destroy"));b(this,j,i.getRootNode().host),b(this,q,i),t(this,Yt).call(this)}getRowHeight(){return t(this,I)}templateLength(i=".ng-container-body"){var e;return((e=t(this,D).get(i))==null?void 0:e.length)||1}};j=new WeakMap,q=new WeakMap,U=new WeakMap,D=new WeakMap,I=new WeakMap,X=new WeakMap,st=new WeakMap,St=new WeakMap,Te=new WeakMap,ht=new WeakMap,Pt=new WeakMap,Et=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakMap,qt=new WeakMap,Vt=new WeakMap,Yt=new WeakMap,Rt=new WeakMap,ke=new WeakMap,dt=new WeakMap,Tt=new WeakMap,Ut=new WeakMap,h(Ce,"RowManager");let de=Ce;const Xt=class Xt{static compileAll(i){return Array.isArray(i)?i.map(e=>Xt.compile(e)):[]}static compile(i){if(!i)return null;const e=h(o=>{o.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(c=>{const f=c.getAttribute("cell-type")||"renderer";if(c.children.length>0&&c.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const g=c.getAttribute("data-bind"),y=c.getAttribute("data-expr"),m=c.getAttribute("maxbyte"),S=c.getAttribute("type");let R=[];g&&R.push(`data-bind="${g}"`),y&&R.push(`data-expr="${y}"`),m&&R.push(`maxbyte="${m}"`),S&&R.push(`type="${S}"`),c.innerHTML=`<${u} ${R.join(" ")}></${u}>`})},"processCellTypes"),s=h(o=>{if(!o.querySelector("colgroup")){const l=o.querySelector("tbody tr")||o.querySelector("tr"),c=l?l.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(o.clientWidth/c),100);for(let g=0;g<c;g++){const y=document.createElement("col");y.setAttribute("width",u),f.appendChild(y)}o.prepend(f)}if(!o.querySelector("thead")){const l=document.createElement("thead"),c=o.querySelector("colgroup");c?c.after(l):o.prepend(l)}o.classList.add("nine-table-element"),o.style.display="table"},"ensureTableStructure"),r=h((o,l)=>{const c=Array.from(o.querySelectorAll(l+" tr")),f=Array.from(o.querySelectorAll(l+" th,"+l+" td")),u=c.length;if(u===0||f.length===0)return;let g=0;f.forEach(m=>{g+=m.colSpan||1});const y=Array.from(Array(u),()=>Array(g).fill(null));c.forEach(m=>{const S=m.sectionRowIndex;let R=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let P=0;P<y[S].length;P++)if(y[S][P]===null){R=P;break}const N=x.rowSpan||1,H=x.colSpan||1;for(let P=0;P<N;P++)for(let Wt=0;Wt<H;Wt++)S+P<u&&R+Wt<g&&(y[S+P][R+Wt]=P===0&&Wt===0?"1":"0")})}),c.forEach(m=>{const S=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(R=>{for(let x=0;x<y[S].length;x++)if(y[S][x]==="1"){R.dataset.col=x,y[S][x]="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((o,l)=>{const c=o.getAttribute("fixed");c&&n.querySelectorAll(`thead [data-col="${l}"], tbody [data-col="${l}"], tfoot [data-col="${l}"]`).forEach(f=>{f.setAttribute("fixed",c)})}),n}};h(Xt,"TableCompiler");let fe=Xt;const kt=class kt extends HTMLElement{constructor(){super();d(this,Kt);d(this,it,null);d(this,rt);T(this,"invalidate",h(()=>{t(this,rt).refresh()},"invalidate"));d(this,Zt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{const n=this.querySelector(s);if(!n)return;n.innerHTML="";const a=document.createElement("div");a.className="ng-part-header",a.appendChild(t(this,ft).call(this,t(this,it),r,"header"));const o=document.createElement("div");o.className="ng-part-body";const l=document.createElement("div");l.className="ng-scroll-content",l.style.position="relative",l.style.width="100%",l.appendChild(t(this,ft).call(this,t(this,it),r,"body"));const c=document.createElement("div");c.className="ng-virtual-spacer",c.style.width="100%",c.style.pointerEvents="none",l.appendChild(c),o.appendChild(l);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,ft).call(this,t(this,it),r,"footer")),n.appendChild(a),n.appendChild(o),n.appendChild(f)})},"#renderSplitContainers"));d(this,Gt,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(a=>{const o=parseInt(a.getAttribute("width"),10);isNaN(n)||(n+=o)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${n}px`,s.style.width=`${n}px`)})},"#updateContainerWidths"));T(this,"generate",h(e=>{e&&(b(this,it,fe.compile(e)),t(this,Zt).call(this),t(this,Gt).call(this),t(this,rt).initialize(),setTimeout(()=>{var s;(s=this.querySelector("nine-table-hscrollbar"))==null||s.refresh()},0))},"generate"));d(this,ft,h((e,s,r)=>{const n=e.cloneNode(!0),a=n.querySelector("thead"),o=n.querySelector("tbody"),l=n.querySelector("tfoot");if(r==="header"){if(o&&o.remove(),l&&l.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",n.appendChild(f)}}else r==="body"?(a&&a.remove(),l&&l.remove(),o&&(o.className="bindable-tbody")):r==="footer"&&(a&&a.remove(),o&&o.remove());return s==="left"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(c=>{c.getAttribute("fixed")!=="left"&&c.remove()}):s==="right"?n.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(c=>{c.getAttribute("fixed")!=="right"&&c.remove()}):n.querySelectorAll("[fixed=left], [fixed=right]").forEach(c=>{c.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,Jt,h(()=>{t(this,Qt).call(this)},"#init"));d(this,Qt,h(()=>{const e=kt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
127
127
|
<style>
|
|
128
128
|
nine-table-sheet {
|
|
129
129
|
display: none;
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
263
263
|
<div class='ng-scroll-edge'></div>
|
|
264
264
|
</div>
|
|
265
|
-
`},"#render"));
|
|
265
|
+
`},"#render"));b(this,rt,new de(this)),b(this,Kt,this.getRootNode().host)}connectedCallback(){t(this,Jt).call(this)}disconnectedCallback(){this.innerHTML="",v.log("NineTableSheet destroyed.")}};Kt=new WeakMap,it=new WeakMap,rt=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,ft=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,h(kt,"NineTableSheet"),T(kt,"SCROLLBAR_SIZE",16);let Ot=kt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Ot);const Le=class Le extends HTMLElement{constructor(){super();d(this,te,h(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var a;const r=s.ctrlKey||s.metaKey||s.shiftKey,n=parseInt((a=s.target.closest(".nine-tab-item"))==null?void 0:a.dataset.index,10);t(this,Ct).call(this,n,r)}),t(this,Ct).call(this,0,!1)},"#init"));d(this,Ct,h((e,s=!1)=>{const r=h(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(y=>y.style.setProperty("display","none"));const g=f.filter(y=>y.classList.contains("active"));g.length<2||g.forEach(y=>{const m=parseInt(y.getAttribute("data-index"),10),S=this.querySelector(`nine-splitter[data-split-index="${m}"]`),R=f[m+1];S&&R&&R.classList.contains("active")&&S.style.setProperty("display","flex")})},"updateSplitters"),n=this.querySelector(".nine-tab-bar"),a=this.querySelector("nine-table-sheets-body"),o=n.querySelectorAll(".nine-tab-item"),l=a.querySelectorAll("nine-table-sheet");if(!o[e])return;if(!s)o.forEach((f,u)=>{f.classList.toggle("active",u===e)}),l.forEach((f,u)=>{const g=u===e;f.classList.toggle("active",g),f.style.flex=g?"1 1 100%":""});else{const f=o[e],u=n.querySelectorAll(".nine-tab-item.active");if(f.classList.contains("active")&&u.length<=1)return;f.classList.toggle("active");const g=a.querySelector(`nine-table-sheet[data-index="${e}"]`);g&&(g.classList.toggle("active"),g.classList.contains("active")||(g.style.flex=""))}const c=a.querySelectorAll("nine-table-sheet.active");c==null||c.forEach(f=>{f.style.flex=c.length>1?"1 1 0%":"1 1 100%"}),r()},"#switchSheet"))}connectedCallback(){t(this,te).call(this)}};te=new WeakMap,Ct=new WeakMap,h(Le,"NineTableSheets");let ue=Le;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",ue);const He=class He{constructor(i){d(this,_);d(this,ee,h(()=>{t(this,se).call(this),new ResizeObserver(i=>{for(let e of i)t(this,_).getAttribute("auto-height")==="true"&&t(this,Lt).call(this)}).observe(t(this,_))},"#init"));d(this,Lt,h(()=>{var l,c;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())),r=(l=t(this,_).shadowRoot.querySelector("nine-table-header"))==null?void 0:l.getBoundingClientRect().height,n=(c=t(this,_).shadowRoot.querySelector("nine-table-sheets-footer"))==null?void 0:c.getBoundingClientRect().height,a=Ot.SCROLLBAR_SIZE,o=e*s+r+n+a;t(this,_).style.height=`${o}px`},"#applyAutoHeight"));d(this,se,h(()=>{const e=Array.from(t(this,_).children).filter(l=>l.tagName==="TABLE"),s=t(this,_).getAttribute("auto-height")==="true",r=e.length,n=e.map((l,c)=>{const u=`<nine-table-sheet class="${c===0?"active":""}" data-index="${c}"></nine-table-sheet>`,g=c<r-1?`<nine-splitter class="h" data-split-index="${c}"></nine-splitter>`:"";return u+g}).join(""),a=e.map((l,c)=>`<div class="nine-tab-item ${c===0?"active":""}" data-index="${c}">Sheet ${c+1}</div>`).join("");t(this,_).shadowRoot.innerHTML=`
|
|
266
266
|
<style>
|
|
267
267
|
:host {
|
|
268
268
|
display: flex;
|
|
@@ -352,10 +352,10 @@
|
|
|
352
352
|
<nine-table-analysis></nine-table-analysis>
|
|
353
353
|
</nine-table-body>
|
|
354
354
|
<nine-table-footer></nine-table-footer>
|
|
355
|
-
`;const o=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");o==null||o.forEach((l,c)=>{e[c]&&setTimeout(()=>{l.generate(e[c]),s&&t(this,Ct).call(this)})})},"#render"));y(this,_,i),t(this,te).call(this)}};_=new WeakMap,te=new WeakMap,Ct=new WeakMap,ee=new WeakMap,h(Le,"LayoutManager");let ue=Le;const He=class He{constructor(i){d(this,Lt);d(this,ut,-1);T(this,"count",h(()=>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,h(He,"ngRow");let ge=He;const B=class B{constructor(i,e){d(this,W);d(this,C);d(this,O,[]);d(this,gt,[]);d(this,se,0);d(this,K,[]);d(this,ie,h(()=>{y(this,K,[]);const i=t(this,W).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,C).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Ht).call(this)),e.__ng.height=t(this,K).slice()})},"#initialize"));d(this,nt,h(()=>{t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.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,bt).call(this,s);if(i<0||i>=s.length)return null;const r=typeof((n=t(this,W).fields)==null?void 0:n.get)=="function"?t(this,W).fields.get():[];if(e!=null){const a=r.indexOf(e);return a>=0?s[i].v[a]:null}return t(this,bt).call(this,s[i])},"get"));T(this,"set",h(i=>{this.clear(),this.add(i,!1),t(this,nt).call(this)},"set"));d(this,Ht,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,K).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,K).slice(),-1,{},{}]}),"#getDefaultMeta"));T(this,"reset",h(()=>{y(this,O,[]),y(this,gt,[]),t(this,nt).call(this)},"reset"));T(this,"clear",h(()=>{var i;t(this,C).rawRecords=[],y(this,O,[]),y(this,gt,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).viewRecords.reset()},"clear"));d(this,re,h(i=>{var r;Array.isArray(i)||(i=[i]);const e=typeof((r=t(this,W).fields)==null?void 0:r.get)=="function"?t(this,W).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(n=>{const a={v:[]};e.forEach(o=>{a.v.push(n[o]!==void 0&&n[o]!==null?n[o]:"")}),s.push(a)}),s},"#json2Array"));d(this,ne,h(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Ht).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.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,re).call(this,i);t(this,C).rawRecords=t(this,C).rawRecords.concat(t(this,ne).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((n,a)=>{const o=t(this,C).rawRecords[r-a];o&&(o.__ng.rowState=B.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===B.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=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,nt).call(this)},"delete"));T(this,"setValue",h((i,e,s)=>{var l;i=parseInt(i,10);const n=(typeof((l=t(this,W).fields)==null?void 0:l.get)=="function"?t(this,W).fields.get():[]).indexOf(e);if(n<0)return;const a=this.getValidData()[i];if(!a)return;const o=a.v[n];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[n]=s},"setValue"));T(this,"resetRecords",h(()=>{y(this,gt,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),y(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,bt,h(i=>{var a;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,r=typeof((a=t(this,W).fields)==null?void 0:a.get)=="function"?t(this,W).fields.get():[],n=s.filter(o=>!o.__ng.deleted).map(o=>{const l={};return r.forEach((c,f)=>{l[c]=o.v?o.v[f]:o[c]}),l.__ng=o.__ng,l});return e?n[0]:n},"#conv"));T(this,"count",h(()=>this.getValidData().length,"count"));y(this,W,i),y(this,C,e),t(this,ie).call(this)}get source(){return t(this,bt).call(this,t(this,C).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Ue(this,se)._}get count(){return t(this,O).length}get length(){return t(this,O).length}getRowCount(){return this.length}};W=new WeakMap,C=new WeakMap,O=new WeakMap,gt=new WeakMap,se=new WeakMap,K=new WeakMap,ie=new WeakMap,nt=new WeakMap,Ht=new WeakMap,re=new WeakMap,ne=new WeakMap,bt=new WeakMap,h(B,"ngData"),T(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let be=B;const Me=class Me{constructor(i){d(this,ot);y(this,ot,i),this.row=new ge(this),this.data=new be(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 ye=Me;const $e=class $e{constructor(i){d(this,yt);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,Mt).call(this)},"add"));d(this,Mt,h(()=>{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,oe,h(()=>{y(this,M,[]),v.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)v.log(e),$("[data-bind]",e).each((s,r)=>{const n=r.dataset.bind,a=r.getAttribute("data-type")||"string";n&&t(this,M).push({name:n,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((r,n)=>{var a=n.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 l=o.search(/[^_A-Za-z0-9]/g);let c="";l>=0?c=o.substring(0,l):a.startsWith("data.")&&(c=o.replace("data.","")),c&&t(this,M).push({name:c,type:"string"})}})})});t(this,Mt).call(this)}},"#init"));y(this,yt,i),t(this,oe).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,oe=new WeakMap,h($e,"ngFields");let pe=$e;const Ie=class Ie extends HTMLElement{constructor(){super();d(this,at);d(this,ae);d(this,le,h(()=>{this.fields=new pe(this),y(this,ae,new ue(this)),v.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,at,new ye(this))}connectedCallback(){t(this,le).call(this)}disconnectedCallback(){v.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,ae=new WeakMap,le=new WeakMap,h(Ie,"NineTable");let me=Ie;customElements.get("nine-table")||customElements.define("nine-table",me);const $t=class $t extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h($t,"BasicCellElement"),T($t,"_styleCache",new Map),T($t,"_customStyleCache",new Map);let xe=$t;const ze=class ze extends xe{constructor(){super();d(this,L);d(this,It);d(this,p);d(this,_e);d(this,Ne);d(this,We);d(this,Oe);T(this,"getDisplayText",h(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,r=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,r,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,L).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,L).data)}catch{}},"getDisplayText"));d(this,Be,h(()=>{if(!(!t(this,L)||!t(this,L).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"),r=[];$("th,td",s).each((x,N)=>{var H=ninegrid.j.querySelectorAll(N).attr("suppress");H&&N.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 a of r){if(a>e)break;var o=parseInt(t(this,p).dataset.row),l=o-1,c=t(this,p).closest("tr").data,f=t(this,L).data.get(l);t(this,p).dataset.matrixRow;var u=t(this,L).body.querySelector(`tbody.bindable [suppress="${a}"][data-matrix-row="${t(this,p).dataset.matrixRow}"]`),g=u.dataset.expr?this.getExprValue(u.dataset.expr,c,o):c[u.dataset.bind],b=u.dataset.expr?this.getExprValue(u.dataset.expr,f,l):f[u.dataset.bind];if(g!=b){n=!0;break}}else n=!0;n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var m=parseInt(t(this,p).dataset.matrixRow),S=m-1,R=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${S}"]`);$(R).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(R).removeClass("last-none-suppress").addClass("last-suppress"):!$(R).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).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 a=e.replace("()","");return t(this,L)[a]?t(this,L)[a].call(this,s,r,t(this,p)):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(),y(this,L,this.getRootNode().host),y(this,p,this.closest("th,td")),y(this,It,t(this,p).closest("tr"))}get value(){var e=!t(this,L)||!t(this,L).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 r=this.getAttribute("update-row-state")!="false";s<0?t(this,L).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,r):t(this,L).data.setValue(s,t(this,p).dataset.bind,e,r)}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]}};L=new WeakMap,It=new WeakMap,p=new WeakMap,_e=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,Be=new WeakMap,h(ze,"CellElement");let ve=ze;const De=class De extends ve{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(De,"EditableCellElement");let we=De;const je=class je extends we{constructor(){super();d(this,_t);d(this,lt);d(this,pt);d(this,mt);d(this,ce);d(this,Z);T(this,"refresh",h(()=>{const e=super.refresh();v.log("::",e),t(this,_t).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,Z)&&Number(t(this,Z))>0&&n.push("."),t(this,mt)&&Number(t(this,mt))>=0&&n.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!n.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,r=s.indexOf(".");if(r>=0){var s=s.substr(r+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,lt,this.getAttribute("type")||"text"),y(this,pt,this.getAttribute("maxbyte")),y(this,mt,this.getAttribute("min")),y(this,ce,this.getAttribute("max")),y(this,Z,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=`
|
|
355
|
+
`;const o=t(this,_).shadowRoot.querySelectorAll("nine-table-sheet");o==null||o.forEach((l,c)=>{e[c]&&setTimeout(()=>{l.generate(e[c]),s&&t(this,Lt).call(this)})})},"#render"));b(this,_,i),t(this,ee).call(this)}};_=new WeakMap,ee=new WeakMap,Lt=new WeakMap,se=new WeakMap,h(He,"LayoutManager");let ge=He;const Me=class Me{constructor(i){d(this,Ht);d(this,ut,-1);T(this,"count",h(()=>t(this,Ht).rawRecords.length,"count"));b(this,Ht,i)}get at(){return t(this,ut)}set at(i){b(this,ut,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ut)}"]`)&&setTimeout(()=>{})}};Ht=new WeakMap,ut=new WeakMap,h(Me,"ngRow");let be=Me;const B=class B{constructor(i,e){d(this,W);d(this,C);d(this,O,[]);d(this,gt,[]);d(this,ie,0);d(this,K,[]);d(this,re,h(()=>{b(this,K,[]);const i=t(this,W).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,C).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Mt).call(this)),e.__ng.height=t(this,K).slice()})},"#initialize"));d(this,nt,h(()=>{t(this,W).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.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,bt).call(this,s);if(i<0||i>=s.length)return null;const r=typeof((n=t(this,W).fields)==null?void 0:n.get)=="function"?t(this,W).fields.get():[];if(e!=null){const a=r.indexOf(e);return a>=0?s[i].v[a]:null}return t(this,bt).call(this,s[i])},"get"));T(this,"set",h(i=>{this.clear(),this.add(i,!1),t(this,nt).call(this)},"set"));d(this,Mt,h(()=>({rowState:B.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,K).slice(),o:{},c:{},_:[0,0,0,0,B.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,K).slice(),-1,{},{}]}),"#getDefaultMeta"));T(this,"reset",h(()=>{b(this,O,[]),b(this,gt,[]),t(this,nt).call(this)},"reset"));T(this,"clear",h(()=>{var i;t(this,C).rawRecords=[],b(this,O,[]),b(this,gt,[]),(i=t(this,C).viewRecords)!=null&&i.reset&&t(this,C).viewRecords.reset()},"clear"));d(this,ne,h(i=>{var r;Array.isArray(i)||(i=[i]);const e=typeof((r=t(this,W).fields)==null?void 0:r.get)=="function"?t(this,W).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(n=>{const a={v:[]};e.forEach(o=>{a.v.push(n[o]!==void 0&&n[o]!==null?n[o]:"")}),s.push(a)}),s},"#json2Array"));d(this,oe,h(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Mt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=B.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,ne).call(this,i);t(this,C).rawRecords=t(this,C).rawRecords.concat(t(this,oe).call(this,s)),this.resetRecords();const r=this.count()-1;return e||s.forEach((n,a)=>{const o=t(this,C).rawRecords[r-a];o&&(o.__ng.rowState=B.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===B.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=B.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,nt).call(this)},"delete"));T(this,"setValue",h((i,e,s)=>{var l;i=parseInt(i,10);const n=(typeof((l=t(this,W).fields)==null?void 0:l.get)=="function"?t(this,W).fields.get():[]).indexOf(e);if(n<0)return;const a=this.getValidData()[i];if(!a)return;const o=a.v[n];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[n]=s},"setValue"));T(this,"resetRecords",h(()=>{b(this,gt,t(this,C).rawRecords.filter(i=>!i.__ng.deleted)),b(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,bt,h(i=>{var a;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,r=typeof((a=t(this,W).fields)==null?void 0:a.get)=="function"?t(this,W).fields.get():[],n=s.filter(o=>!o.__ng.deleted).map(o=>{const l={};return r.forEach((c,f)=>{l[c]=o.v?o.v[f]:o[c]}),l.__ng=o.__ng,l});return e?n[0]:n},"#conv"));T(this,"count",h(()=>this.getValidData().length,"count"));b(this,W,i),b(this,C,e),t(this,re).call(this)}get source(){return t(this,bt).call(this,t(this,C).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Xe(this,ie)._}get count(){return t(this,O).length}get length(){return t(this,O).length}getRowCount(){return this.length}};W=new WeakMap,C=new WeakMap,O=new WeakMap,gt=new WeakMap,ie=new WeakMap,K=new WeakMap,re=new WeakMap,nt=new WeakMap,Mt=new WeakMap,ne=new WeakMap,oe=new WeakMap,bt=new WeakMap,h(B,"ngData"),T(B,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ye=B;const $e=class $e{constructor(i){d(this,ot);b(this,ot,i),this.row=new be(this),this.data=new ye(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($e,"ngDataManager");let pe=$e;const Ie=class Ie{constructor(i){d(this,yt);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,$t).call(this)},"add"));d(this,$t,h(()=>{const i=new Map;t(this,M).forEach(e=>{i.set(e.name,e.type)}),b(this,M,Array.from(i,([e,s])=>({name:e,type:s}))),b(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,ae,h(()=>{b(this,M,[]),v.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)v.log(e),$("[data-bind]",e).each((s,r)=>{const n=r.dataset.bind,a=r.getAttribute("data-type")||"string";n&&t(this,M).push({name:n,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((r,n)=>{var a=n.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 l=o.search(/[^_A-Za-z0-9]/g);let c="";l>=0?c=o.substring(0,l):a.startsWith("data.")&&(c=o.replace("data.","")),c&&t(this,M).push({name:c,type:"string"})}})})});t(this,$t).call(this)}},"#init"));b(this,yt,i),t(this,ae).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,$t=new WeakMap,ae=new WeakMap,h(Ie,"ngFields");let me=Ie;const _e=class _e extends HTMLElement{constructor(){super();d(this,at);d(this,le);d(this,ce,h(()=>{this.fields=new me(this),b(this,le,new ge(this)),v.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),b(this,at,new pe(this))}connectedCallback(){t(this,ce).call(this)}disconnectedCallback(){v.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,le=new WeakMap,ce=new WeakMap,h(_e,"NineTable");let xe=_e;customElements.get("nine-table")||customElements.define("nine-table",xe);const It=class It extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(It,"BasicCellElement"),T(It,"_styleCache",new Map),T(It,"_customStyleCache",new Map);let ve=It;const De=class De extends ve{constructor(){super();d(this,L);d(this,_t);d(this,p);d(this,Ne);d(this,We);d(this,Oe);d(this,Be);T(this,"getDisplayText",h(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,r=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,r,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,L).exprFunction(t(this,p).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,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"),r=[];$("th,td",s).each((x,N)=>{var H=ninegrid.j.querySelectorAll(N).attr("suppress");H&&N.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 a of r){if(a>e)break;var o=parseInt(t(this,p).dataset.row),l=o-1,c=t(this,p).closest("tr").data,f=t(this,L).data.get(l);t(this,p).dataset.matrixRow;var u=t(this,L).body.querySelector(`tbody.bindable [suppress="${a}"][data-matrix-row="${t(this,p).dataset.matrixRow}"]`),g=u.dataset.expr?this.getExprValue(u.dataset.expr,c,o):c[u.dataset.bind],y=u.dataset.expr?this.getExprValue(u.dataset.expr,f,l):f[u.dataset.bind];if(g!=y){n=!0;break}}else n=!0;n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(n?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var m=parseInt(t(this,p).dataset.matrixRow),S=m-1,R=t(this,L).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${S}"]`);$(R).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(R).removeClass("last-none-suppress").addClass("last-suppress"):!$(R).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).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 a=e.replace("()","");return t(this,L)[a]?t(this,L)[a].call(this,s,r,t(this,p)):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(),b(this,L,this.getRootNode().host),b(this,p,this.closest("th,td")),b(this,_t,t(this,p).closest("tr"))}get value(){var e=!t(this,L)||!t(this,L).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 r=this.getAttribute("update-row-state")!="false";s<0?t(this,L).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,r):t(this,L).data.setValue(s,t(this,p).dataset.bind,e,r)}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,_t).data[e]}};L=new WeakMap,_t=new WeakMap,p=new WeakMap,Ne=new WeakMap,We=new WeakMap,Oe=new WeakMap,Be=new WeakMap,ze=new WeakMap,h(De,"CellElement");let we=De;const Pe=class Pe extends we{constructor(){super()}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(Pe,"EditableCellElement");let Se=Pe;const Fe=class Fe extends Se{constructor(){super();d(this,Nt);d(this,lt);d(this,pt);d(this,mt);d(this,he);d(this,Z);T(this,"refresh",h(()=>{const e=super.refresh();v.log("::",e),t(this,Nt).value=e},"refresh"));d(this,je,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,Z)&&Number(t(this,Z))>0&&n.push("."),t(this,mt)&&Number(t(this,mt))>=0&&n.push("-"),!(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105)&&!n.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,r=s.indexOf(".");if(r>=0){var s=s.substr(r+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(),b(this,lt,this.getAttribute("type")||"text"),b(this,pt,this.getAttribute("maxbyte")),b(this,mt,this.getAttribute("min")),b(this,he,this.getAttribute("max")),b(this,Z,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=`
|
|
356
356
|
<input type="text"
|
|
357
357
|
${e.join(" ")}
|
|
358
358
|
ondragstart="return false;"
|
|
359
359
|
>
|
|
360
|
-
`,super.connectedCallback(),
|
|
360
|
+
`,super.connectedCallback(),b(this,Nt,this.querySelector("input"))}};Nt=new WeakMap,lt=new WeakMap,pt=new WeakMap,mt=new WeakMap,he=new WeakMap,Z=new WeakMap,je=new WeakMap,h(Fe,"CellInputText");let Ee=Fe;customElements.get("cell-input-text"),customElements.get("cell-input")||customElements.define("cell-input",Ee)});
|
|
361
361
|
//# sourceMappingURL=nine-table.umd.js.map
|