@ninebone/table 0.0.446 → 0.0.447
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 +890 -678
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +12 -7
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(w
|
|
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 De=Object.defineProperty;var ze=S=>{throw TypeError(S)};var Ve=(S,w,k)=>w in S?De(S,w,{enumerable:!0,configurable:!0,writable:!0,value:k}):S[w]=k;var c=(S,w)=>De(S,"name",{value:w,configurable:!0});var A=(S,w,k)=>Ve(S,typeof w!="symbol"?w+"":w,k),je=(S,w,k)=>w.has(S)||ze("Cannot "+k);var t=(S,w,k)=>(je(S,w,"read from private field"),k?k.call(S):w.get(S)),d=(S,w,k)=>w.has(S)?ze("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(S):w.set(S,k),y=(S,w,k,F)=>(je(S,w,"write to private field"),F?F.call(S,k):w.set(S,k),k);var Fe=(S,w,k,F)=>({set _(mt){y(S,w,mt,k)},get _(){return t(S,w,F)}});var P,V,E,Z,G,J,Nt,Q,Wt,Y,lt,tt,T,xt,vt,Ot,j,R,D,I,U,et,wt,ct,Bt,Pt,Dt,St,Et,zt,jt,At,Ft,ht,Rt,Vt,Ut,st,it,Xt,Kt,dt,Zt,Gt,Jt,kt,_,Qt,Tt,te,Ct,ft,N,L,W,ut,ee,X,se,nt,Lt,ie,ne,gt,rt,bt,H,Ht,re,ot,oe,ae,C,p,He,$e,Me,Ie,_e,Oe,at,yt,pt,le,K,Be;const we=class we extends S.trace.constructor{constructor(){super(),this.init("nine-table","green")}};c(we,"Trace");let w=we;const k=new w,Se=class Se extends HTMLElement{constructor(){super();d(this,P);d(this,V,!1);d(this,E);d(this,Z);d(this,G);d(this,J);d(this,Nt,c(()=>{if(!t(this,P))return;const e=t(this,P).querySelector(".ng-container-body .ng-part-body");e&&(y(this,J,new ResizeObserver(()=>{this.refresh()})),t(this,J).observe(e))},"#observeResize"));A(this,"refresh",c(()=>{if(!t(this,P)||!t(this,E)||t(this,V))return;const e=t(this,E).container,s=e.querySelector("table");if(!s)return;const n=t(this,E).track,r=t(this,E).thumb,o=t(this,P).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,b=h-a;let g=0;b>0&&(g=parseInt(u/b*(l-f),10)),g<0&&(g=0);const m=l-f;g>m&&(g=m),r.style.left=`${g}px`,t(this,E).left.disabled=g===0,t(this,E).right.disabled=g>=m-1},"refresh"));d(this,Q,c(e=>{if(!t(this,E))return!1;const s=t(this,E).container,n=s.querySelector("table");if(!n)return!1;const r=t(this,E).track.getBoundingClientRect(),o=t(this,E).thumb.clientWidth;let a=e;a<0&&(a=0);const h=r.width-o;a>h&&(a=h),a=parseInt(a,10),t(this,E).thumb.style.left=`${a}px`,t(this,E).left.disabled=a===0,t(this,E).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,Wt,c(()=>{const e=c(n=>{clearInterval(t(this,Z)),clearInterval(t(this,G));const r=parseInt(t(this,E).thumb.style.left||0,10);t(this,Q).call(this,r+n),y(this,Z,setInterval(()=>{clearInterval(t(this,Z)),y(this,G,setInterval(()=>{const o=parseInt(t(this,E).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,E).left.addEventListener(n,s),t(this,E).right.addEventListener(n,s),t(this,E).track.addEventListener(n,s)}),t(this,E).left.addEventListener("mousedown",n=>{n.button===0&&e(-20)}),t(this,E).right.addEventListener("mousedown",n=>{n.button===0&&e(20)}),t(this,E).left.addEventListener("touchstart",()=>e(-20)),t(this,E).right.addEventListener("touchstart",()=>e(20)),t(this,E).track.addEventListener("mousedown",n=>{if(n.button!==0)return;n.preventDefault();const r=t(this,E).track.getBoundingClientRect(),o=t(this,E).thumb.clientWidth;t(this,Q).call(this,n.clientX-r.left-o/2)}),t(this,E).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,V,!0),this.shiftX=n.clientX-t(this,E).thumb.getBoundingClientRect().left;const r=c(a=>{if(!t(this,V))return;const h=t(this,E).track.getBoundingClientRect();t(this,Q).call(this,a.clientX-h.left-this.shiftX)},"onMouseMove"),o=c(()=>{y(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(y(this,P,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,P))return;this.innerHTML=`
|
|
2
2
|
<style>
|
|
3
3
|
nine-table-hscrollbar {
|
|
4
4
|
display: flex;
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
<button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
|
|
61
61
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
62
62
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
63
|
-
`;const e=
|
|
63
|
+
`;const e=c(()=>{const s=t(this,P).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,E,{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,Wt).call(this),t(this,Nt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};P=new WeakMap,V=new WeakMap,E=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Nt=new WeakMap,Q=new WeakMap,Wt=new WeakMap,c(Se,"NineTableHScrollBar");let F=Se;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ee=class Ee extends HTMLElement{constructor(){super();d(this,Y);d(this,lt);d(this,tt,!1);d(this,T);d(this,xt,0);d(this,vt,0);A(this,"refresh",c(()=>{if(!t(this,Y)||!t(this,T))return;const e=t(this,T).container,s=t(this,T).track,n=t(this,T).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,h=t(this,lt).getRowHeight(),l=a*h;if(l<=r){n.style.display="none",t(this,T).top.disabled=!0,t(this,T).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 b=e.scrollTop,g=Math.max(l-r,1);let m=0;g>0&&(m=b/g*(f-u));const v=f-u;m<0&&(m=0),m>v&&(m=v),n.style.top=`${m}px`,t(this,T).top.disabled=b<=0,t(this,T).bottom.disabled=b>=g-1},"refresh"));d(this,Ot,c(()=>{const e=t(this,T).container,s=c(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,lt).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,tt)||this.refresh()}),t(this,T).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,xt,n.clientY),y(this,vt,e.scrollTop);const r=c(a=>{if(!t(this,tt))return;const h=t(this,T).track.getBoundingClientRect(),l=t(this,T).thumb.clientHeight,u=h.height-l,b=a.clientY-t(this,xt),g=e.clientHeight,m=s(),v=Math.max(m-g,1);if(u>0&&v>0){const q=b/u*v;let x=t(this,vt)+q;const B=Math.max(0,m-g);x<0&&(x=0),x>B&&(x=B),e.scrollTop=x}this.refresh()},"onMouseMove"),o=c(()=>{y(this,tt,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,T).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,T).thumb)return;const r=t(this,T).track.getBoundingClientRect(),o=t(this,T).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.height-o,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(l>0&&b>0){const g=Math.max(0,Math.min(1,a/l));e.scrollTop=g*b}this.refresh()}),t(this,T).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,T).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,Y,this.getRootNode().host),y(this,lt,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 i=t(this,Y).shadowRoot.querySelector(".ng-container-body .ng-part-body");if(!i){setTimeout(e,10);return}y(this,q,{container:i,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,Ct).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,ot=new WeakMap,G=new WeakMap,q=new WeakMap,ut=new WeakMap,gt=new WeakMap,Ct=new WeakMap,h(de,"NineTableVScrollBar");let ft=de;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",ft);const fe=class fe{constructor(n){d(this,B);d(this,E);d(this,N,new Map);d(this,C,null);d(this,F,null);d(this,J,0);d(this,bt,40);d(this,st,!1);d(this,Ht,3);R(this,"refresh",h(()=>{var e;const n=t(this,E).querySelector(".ng-container-body .ng-part-body");n&&(t(this,yt).call(this),t(this,rt).call(this,n.scrollTop),(e=t(this,E).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));R(this,"initialize",h(()=>{y(this,C,null),t(this,N).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const r=t(this,E).querySelector(o);if(!r)return;const s=r.querySelector(".ng-part-body table");if(!s)return;const l=s.querySelector("tbody.bindable-tbody");if(!l)return;const a=Array.from(l.querySelectorAll("tr")).map(f=>f.cloneNode(!0));t(this,N).set(o,a)});const n=t(this,E).querySelector(".ng-container-body .ng-part-body"),e=t(this,E).querySelector(".ng-container-left .ng-part-body"),i=t(this,E).querySelector(".ng-container-right .ng-part-body");if(n){t(this,_t).call(this,n),t(this,mt).call(this),t(this,yt).call(this),t(this,rt).call(this,n.scrollTop);let o=!1;const r=h((s,l)=>{var c;o||(o=!0,n&&n.scrollTop!==s&&(n.scrollTop=s),e&&e.scrollTop!==s&&(e.scrollTop=s),i&&i.scrollTop!==s&&(i.scrollTop=s),t(this,rt).call(this,s),(c=t(this,E).querySelector("nine-table-vscrollbar"))==null||c.refresh(),o=!1)},"syncScroll");[n,e,i].forEach(s=>{s&&s.addEventListener("scroll",()=>{r(s.scrollTop)})})}},"initialize"));d(this,Mt,h((n,e)=>{const i=t(this,N).get(e);if(!i||i.length===0)return;const o=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;o.querySelectorAll("tr:not(.nodata)").forEach(l=>l.remove());const r=o.querySelector("tr.nodata"),s=document.createDocumentFragment();for(let l=0;l<t(this,bt);l++)i.forEach(c=>{s.appendChild(c.cloneNode(!0))});r?r.before(s):o.appendChild(s)},"#renderRows"));d(this,_t,h(n=>{if(t(this,C)!==null&&t(this,C)>0)return t(this,C);const e=t(this,N).get(".ng-container-body");if(!e||e.length===0)return 24;const i=n.querySelector("tbody.bindable-tbody");if(!i)return 24;i.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const o=i.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),o?o.before(r):i.appendChild(r);const s=t(this,E),l=s.style.display,c=s.style.visibility,a=s.style.position;(l==="none"||window.getComputedStyle(s).display==="none")&&(s.style.display="block",s.style.visibility="hidden",s.style.position="absolute");let f=0;const g=i.querySelectorAll("tr:not(.nodata)");return g.forEach(b=>{f+=b.offsetHeight||b.getBoundingClientRect().height}),g.forEach(b=>b.remove()),s.style.display=l,s.style.visibility=c,s.style.position=a,y(this,C,f>0?f:24),t(this,pt).call(this),t(this,C)},"#measureAndCacheHeight"));d(this,yt,h(()=>{const e=(t(this,B).data.get()||[]).length,i=t(this,C)||24,o=e*i;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const s=t(this,E).querySelector(r);if(!s)return;const l=s.querySelector(".ng-part-body .ng-virtual-spacer");l&&(l.style.height=`${o}px`)})},"#updateVirtualScrollHeight"));d(this,pt,h(()=>{if(t(this,J)>0&&t(this,C)>0){const n=Math.ceil(t(this,J)/t(this,C));y(this,bt,n+t(this,Ht))}},"#updateRowCount"));d(this,$t,h(()=>{var l,c,a,f,g,b;const n=t(this,E).querySelector(".ng-container-left .ng-part-body table"),e=t(this,E).querySelector(".ng-container-body .ng-part-body table"),i=t(this,E).querySelector(".ng-container-right .ng-part-body table");if(e){const u=n?Array.from(n.querySelectorAll("tbody tr")):[],p=Array.from(e.querySelectorAll("tbody tr")),x=i?Array.from(i.querySelectorAll("tbody tr")):[],T=Math.max(u.length,p.length,x.length);for(let m=0;m<T;m++){const U=[((l=u[m])==null?void 0:l.getBoundingClientRect().height)||0,((c=p[m])==null?void 0:c.getBoundingClientRect().height)||0,((a=x[m])==null?void 0:a.getBoundingClientRect().height)||0],W=Math.max(...U);W>0&&(u[m]&&(u[m].style.height=`${W}px`),p[m]&&(p[m].style.height=`${W}px`),x[m]&&(x[m].style.height=`${W}px`))}}const o=t(this,E).querySelector(".ng-container-left .ng-part-footer table"),r=t(this,E).querySelector(".ng-container-body .ng-part-footer table"),s=t(this,E).querySelector(".ng-container-right .ng-part-footer table");if(r){const u=o?Array.from(o.querySelectorAll("tfoot tr")):[],p=Array.from(r.querySelectorAll("tfoot tr")),x=s?Array.from(s.querySelectorAll("tfoot tr")):[],T=Math.max(u.length,p.length,x.length);for(let m=0;m<T;m++){const U=[((f=u[m])==null?void 0:f.getBoundingClientRect().height)||0,((g=p[m])==null?void 0:g.getBoundingClientRect().height)||0,((b=x[m])==null?void 0:b.getBoundingClientRect().height)||0],W=Math.max(...U);W>0&&(u[m]&&(u[m].style.height=`${W}px`),p[m]&&(p[m].style.height=`${W}px`),x[m]&&(x[m].style.height=`${W}px`))}}},"#syncRowHeights"));d(this,It,h(()=>{!t(this,E)||!(t(this,E)instanceof HTMLElement)||(y(this,F,new ResizeObserver(n=>{for(const e of n){const i=e.target;if(!i.classList.contains("active"))continue;const o=e.contentRect.height;if(o>0){let r=0;const s=i.querySelector(".ng-part-header"),l=i.querySelector(".ng-part-footer");s&&(r+=s.offsetHeight),l&&(r+=l.offsetHeight);const c=Math.max(o-r,100);t(this,J)!==c&&(y(this,J,c),t(this,pt).call(this),t(this,C)!==null&&t(this,mt).call(this))}}})),t(this,F).observe(t(this,E)))},"#initResizeObserver"));d(this,mt,h(()=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,E).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Mt).call(this,e,n)}),t(this,Ot).call(this),t(this,$t).call(this)},"#renderAllContainers"));d(this,Wt,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var a;const i=t(this,E).querySelector(e);if(!i)return;const o=i.querySelector(".ng-part-body tbody.bindable-tbody");if(!o)return;const r=Array.from(o.querySelectorAll("tr:not(.nodata)")),s=((a=t(this,N).get(e))==null?void 0:a.length)||1,c=(t(this,B).data.get()||[]).length;r.forEach((f,g)=>{const b=n+Math.floor(g/s);if(b>=c){f.style.display="none";return}const u=t(this,B).data.get(b);f.style.display="",t(this,xt).call(this,f,u,b)})})},"#adjustBufferRows"));d(this,rt,h(n=>{var c;const e=t(this,C);if(!e||e<=0)return;const o=(t(this,B).data.get()||[]).length,r=Math.max(0,Math.floor(n/e)),s=r*e,l=((c=t(this,N).get(".ng-container-body"))==null?void 0:c.length)||1;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(a=>{const f=t(this,E).querySelector(a);if(!f)return;const g=f.querySelector(".ng-part-body tbody.bindable-tbody");if(!g)return;g.style.transform=`translateY(${s}px)`,Array.from(g.querySelectorAll("tr:not(.nodata)")).forEach((u,p)=>{const x=r+Math.floor(p/l);if(x>=o){u.style.display="none";return}const T=t(this,B).data.get(x);u.style.display="",t(this,xt).call(this,u,T,x)})}),t(this,st)||(y(this,st,!0),setTimeout(()=>{t(this,Wt).call(this,r),y(this,st,!1)},0))},"#handleScroll"));d(this,xt,h((n,e,i)=>{n.dataset.row=i,n.data=e,Array.from(n.cells).forEach((o,r)=>{o.dataset.row=i,o.querySelector(':scope > [is^="cell-"], :scope > [class*="cell-"], :scope > cell-');const s=Array.from(o.children).find(l=>l.tagName.toLowerCase().startsWith("cell-")||typeof l.reset=="function");s&&typeof s.reset=="function"&&s.reset()})},"#bindRowData"));d(this,Ot,h(()=>{var c,a,f;const n=t(this,E).querySelector(".ng-container-left .ng-part-header table"),e=t(this,E).querySelector(".ng-container-body .ng-part-header table"),i=t(this,E).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const o=n?Array.from(n.querySelectorAll("tr")):[],r=Array.from(e.querySelectorAll("tr")),s=i?Array.from(i.querySelectorAll("tr")):[],l=Math.max(o.length,r.length,s.length);for(let g=0;g<l;g++){const b=[((c=o[g])==null?void 0:c.getBoundingClientRect().height)||0,((a=r[g])==null?void 0:a.getBoundingClientRect().height)||0,((f=s[g])==null?void 0:f.getBoundingClientRect().height)||0],u=Math.max(...b);u>0&&(o[g]&&(o[g].style.height=`${u}px`),r[g]&&(r[g].style.height=`${u}px`),s[g]&&(s[g].style.height=`${u}px`))}},"#syncHeaderHeights"));R(this,"destroy",h(()=>{t(this,F)&&(t(this,F).disconnect(),y(this,F,null))},"destroy"));y(this,B,n.getRootNode().host),y(this,E,n),t(this,It).call(this)}getRowHeight(){return t(this,C)}templateLength(n=".ng-container-body"){var e;return((e=t(this,N).get(n))==null?void 0:e.length)||1}};B=new WeakMap,E=new WeakMap,N=new WeakMap,C=new WeakMap,F=new WeakMap,J=new WeakMap,bt=new WeakMap,st=new WeakMap,Ht=new WeakMap,Mt=new WeakMap,_t=new WeakMap,yt=new WeakMap,pt=new WeakMap,$t=new WeakMap,It=new WeakMap,mt=new WeakMap,Wt=new WeakMap,rt=new WeakMap,xt=new WeakMap,Ot=new WeakMap,h(fe,"RowManager");let te=fe;const Nt=class Nt{static compileAll(n){return Array.isArray(n)?n.map(e=>Nt.compile(e)):[]}static compile(n){if(!n)return null;const e=h(l=>{l.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(a=>{const f=a.getAttribute("cell-type")||"renderer";if(a.children.length>0&&a.firstElementChild.tagName.includes("-"))return;let g=`cell-${f}`;const b=a.getAttribute("data-bind"),u=a.getAttribute("data-expr"),p=a.getAttribute("maxbyte"),x=a.getAttribute("type");let T=[];b&&T.push(`data-bind="${b}"`),u&&T.push(`data-expr="${u}"`),p&&T.push(`maxbyte="${p}"`),x&&T.push(`type="${x}"`),a.innerHTML=`<${g} ${T.join(" ")}></${g}>`})},"processCellTypes"),i=h(l=>{if(!l.querySelector("colgroup")){const c=l.querySelector("tbody tr")||l.querySelector("tr"),a=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),g=Math.max(Math.floor(l.clientWidth/a),100);for(let b=0;b<a;b++){const u=document.createElement("col");u.setAttribute("width",g),f.appendChild(u)}l.prepend(f)}if(!l.querySelector("thead")){const c=document.createElement("thead"),a=l.querySelector("colgroup");a?a.after(c):l.prepend(c)}l.classList.add("nine-table-element"),l.style.display="table"},"ensureTableStructure"),o=h((l,c)=>{const a=Array.from(l.querySelectorAll(c+" tr")),f=Array.from(l.querySelectorAll(c+" th,"+c+" td")),g=a.length;if(g===0||f.length===0)return;let b=0;f.forEach(p=>{b+=p.colSpan||1});const u=Array.from(Array(g),()=>Array(b).fill(null));a.forEach(p=>{const x=p.sectionRowIndex;let T=0;Array.from(p.querySelectorAll("th,td")).forEach(m=>{for(let z=0;z<u[x].length;z++)if(u[x][z]===null){T=z;break}const U=m.rowSpan||1,W=m.colSpan||1;for(let z=0;z<U;z++)for(let qt=0;qt<W;qt++)x+z<g&&T+qt<b&&(u[x+z][T+qt]=z===0&&qt===0?"1":"0")})}),a.forEach(p=>{const x=p.sectionRowIndex;Array.from(p.querySelectorAll("th,td")).forEach(T=>{for(let m=0;m<u[x].length;m++)if(u[x][m]==="1"){T.dataset.col=m,u[x][m]="0";break}})})},"resetColIndex"),r=n.cloneNode(!0);return i(r),e(r),o(r,"thead"),o(r,"tbody"),o(r,"tfoot"),Array.from(r.querySelectorAll("colgroup col")).forEach((l,c)=>{const a=l.getAttribute("fixed");a&&r.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",a)})}),r}};h(Nt,"TableCompiler");let ee=Nt;const vt=class vt extends HTMLElement{constructor(){super();d(this,zt);d(this,Q,null);d(this,tt);R(this,"invalidate",h(()=>{var e,i;t(this,tt).refresh(),(e=this.querySelector("nine-table-hscrollbar"))==null||e.refresh(),(i=this.querySelector("nine-table-vscrollbar"))==null||i.refresh()},"invalidate"));d(this,Bt,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:i,type:o})=>{const r=this.querySelector(i);if(!r)return;r.innerHTML="";const s=document.createElement("div");s.className="ng-part-header",s.appendChild(t(this,lt).call(this,t(this,Q),o,"header"));const l=document.createElement("div");l.className="ng-part-body";const c=document.createElement("div");c.className="ng-scroll-content",c.style.position="relative",c.style.width="100%",c.appendChild(t(this,lt).call(this,t(this,Q),o,"body"));const a=document.createElement("div");a.className="ng-virtual-spacer",a.style.width="100%",a.style.pointerEvents="none",c.appendChild(a),l.appendChild(c);const f=document.createElement("div");f.className="ng-part-footer",f.appendChild(t(this,lt).call(this,t(this,Q),o,"footer")),r.appendChild(s),r.appendChild(l),r.appendChild(f)})},"#renderSplitContainers"));d(this,Pt,h(()=>{["left","right","body"].forEach(e=>{const i=this.querySelector(`.ng-container-${e}`),o=i==null?void 0:i.querySelectorAll("table");if(!i||!o||o.length===0)return;let r=0;o[0].querySelectorAll("col").forEach(s=>{const l=parseInt(s.getAttribute("width"),10);isNaN(r)||(r+=l)}),e==="body"?i.style.flex="1":(i.style.flex=`0 0 ${r}px`,i.style.width=`${r}px`)})},"#updateContainerWidths"));R(this,"generate",h(e=>{e&&(y(this,Q,ee.compile(e)),t(this,Bt).call(this),t(this,Pt).call(this),t(this,tt).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0))},"generate"));d(this,lt,h((e,i,o)=>{const r=e.cloneNode(!0),s=r.querySelector("thead"),l=r.querySelector("tbody"),c=r.querySelector("tfoot");if(o==="header"){if(l&&l.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",r.appendChild(f)}}else o==="body"?(s&&s.remove(),c&&c.remove(),l&&(l.className="bindable-tbody")):o==="footer"&&(s&&s.remove(),l&&l.remove());return i==="left"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(a=>{a.getAttribute("fixed")!=="left"&&a.remove()}):i==="right"?r.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(a=>{a.getAttribute("fixed")!=="right"&&a.remove()}):r.querySelectorAll("[fixed=left], [fixed=right]").forEach(a=>{a.remove()}),r},"#createSplitTable"));R(this,"getRowHeight",h(()=>t(this,tt).getRowHeight(),"getRowHeight"));R(this,"scrollToX",h(e=>{const i=this.querySelector(".ng-container-body .ng-part-body");i&&(i.scrollLeft=e)},"scrollToX"));R(this,"scrollToY",h(e=>{const i=this.querySelector(".ng-container-body .ng-part-body");i&&(i.scrollTop=e)},"scrollToY"));d(this,Dt,h(()=>{t(this,Yt).call(this)},"#init"));d(this,Yt,h(()=>{const e=vt.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}y(this,T,{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,Ot).call(this),this.refresh()},"initWhenReady");e()}};Y=new WeakMap,lt=new WeakMap,tt=new WeakMap,T=new WeakMap,xt=new WeakMap,vt=new WeakMap,Ot=new WeakMap,c(Ee,"NineTableVScrollBar");let mt=Ee;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",mt);const Ae=class Ae{constructor(i){d(this,j);d(this,R);d(this,D,new Map);d(this,I,null);d(this,U,null);d(this,et,0);d(this,wt,40);d(this,ct,!1);d(this,Bt,3);A(this,"refresh",c(()=>{var e;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"));A(this,"initialize",c(()=>{y(this,I,null),t(this,D).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const r=t(this,R).querySelector(n);if(!r)return;const o=r.querySelector(".ng-part-body table");if(!o)return;const a=o.querySelector("tbody.bindable-tbody");if(!a)return;const l=Array.from(a.querySelectorAll("tr")).map(f=>f.cloneNode(!0));t(this,D).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");if(i){t(this,Dt).call(this,i),t(this,At).call(this),t(this,St).call(this),t(this,ht).call(this,i.scrollTop);let n=!1;const r=c((o,a)=>{var h;n||(n=!0,i&&i.scrollTop!==o&&(i.scrollTop=o),e&&e.scrollTop!==o&&(e.scrollTop=o),s&&s.scrollTop!==o&&(s.scrollTop=o),t(this,ht).call(this,o),(h=t(this,R).querySelector("nine-table-vscrollbar"))==null||h.refresh(),n=!1)},"syncScroll");[i,e,s].forEach(o=>{o&&o.addEventListener("scroll",()=>{r(o.scrollTop)})})}},"initialize"));d(this,Pt,c((i,e)=>{const s=t(this,D).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)},"#renderRows"));d(this,Dt,c(i=>{if(t(this,I)!==null&&t(this,I)>0)return t(this,I);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(b=>b.remove());const n=s.querySelector("tr.nodata"),r=document.createDocumentFragment();e.forEach(b=>{r.appendChild(b.cloneNode(!0))}),n?n.before(r):s.appendChild(r);const o=t(this,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(b=>{f+=b.offsetHeight||b.getBoundingClientRect().height}),u.forEach(b=>b.remove()),o.style.display=a,o.style.visibility=h,o.style.position=l,y(this,I,f>0?f:24),t(this,Et).call(this),t(this,I)},"#measureAndCacheHeight"));d(this,St,c(()=>{const e=(t(this,j).data.get()||[]).length,s=t(this,I)||24,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,et)>0&&t(this,I)>0){const i=Math.ceil(t(this,et)/t(this,I));y(this,wt,i+t(this,Bt))}},"#updateRowCount"));d(this,zt,c(()=>{var a,h,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")):[],m=Array.from(e.querySelectorAll("tbody tr")),v=s?Array.from(s.querySelectorAll("tbody tr")):[],q=Math.max(g.length,m.length,v.length);for(let x=0;x<q;x++){const B=[((a=g[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&&(g[x]&&(g[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 g=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(g.length,m.length,v.length);for(let x=0;x<q;x++){const B=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=v[x])==null?void 0:b.getBoundingClientRect().height)||0],M=Math.max(...B);M>0&&(g[x]&&(g[x].style.height=`${M}px`),m[x]&&(m[x].style.height=`${M}px`),v[x]&&(v[x].style.height=`${M}px`))}}},"#syncRowHeights"));d(this,jt,c(()=>{!t(this,R)||!(t(this,R)instanceof HTMLElement)||(y(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,et)!==h&&(y(this,et,h),t(this,Et).call(this),t(this,I)!==null&&t(this,At).call(this))}}})),t(this,U).observe(t(this,R)))},"#initResizeObserver"));d(this,At,c(()=>{[".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,zt).call(this)},"#renderAllContainers"));d(this,Ft,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,D).get(e))==null?void 0:l.length)||1,h=(t(this,j).data.get()||[]).length;r.forEach((f,u)=>{const b=i+Math.floor(u/o);if(b>=h){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"));d(this,ht,c(i=>{var h;const e=t(this,I);if(!e||e<=0)return;const n=(t(this,j).data.get()||[]).length,r=Math.max(0,Math.floor(i/e)),o=r*e,a=((h=t(this,D).get(".ng-container-body"))==null?void 0:h.length)||1;[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(l=>{const f=t(this,R).querySelector(l);if(!f)return;const u=f.querySelector(".ng-part-body tbody.bindable-tbody");if(!u)return;u.style.transform=`translateY(${o}px)`,Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((g,m)=>{const v=r+Math.floor(m/a);if(v>=n){g.style.display="none";return}const q=t(this,j).data.get(v);g.style.display="",t(this,Rt).call(this,g,q,v)})}),t(this,ct)||(y(this,ct,!0),setTimeout(()=>{t(this,Ft).call(this,r),y(this,ct,!1)},0))},"#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,n.querySelector(':scope > [is^="cell-"], :scope > [class*="cell-"], :scope > cell-');const o=Array.from(n.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.reset=="function");o&&typeof o.reset=="function"&&o.reset()})},"#bindRowData"));d(this,Vt,c(()=>{var h,l,f;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 b=[((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],g=Math.max(...b);g>0&&(n[u]&&(n[u].style.height=`${g}px`),r[u]&&(r[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`))}},"#syncHeaderHeights"));A(this,"destroy",c(()=>{t(this,U)&&(t(this,U).disconnect(),y(this,U,null))},"destroy"));y(this,j,i.getRootNode().host),y(this,R,i),t(this,jt).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,R=new WeakMap,D=new WeakMap,I=new WeakMap,U=new WeakMap,et=new WeakMap,wt=new WeakMap,ct=new WeakMap,Bt=new WeakMap,Pt=new WeakMap,Dt=new WeakMap,St=new WeakMap,Et=new WeakMap,zt=new WeakMap,jt=new WeakMap,At=new WeakMap,Ft=new WeakMap,ht=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,c(Ae,"RowManager");let ce=Ae;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 b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),v=l.getAttribute("type");let q=[];b&&q.push(`data-bind="${b}"`),g&&q.push(`data-expr="${g}"`),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 b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const 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 b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const v=m.sectionRowIndex;let q=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let z=0;z<g[v].length;z++)if(g[v][z]===null){q=z;break}const B=x.rowSpan||1,M=x.colSpan||1;for(let z=0;z<B;z++)for(let Mt=0;Mt<M;Mt++)v+z<u&&q+Mt<b&&(g[v+z][q+Mt]=z===0&&Mt===0?"1":"0")})}),l.forEach(m=>{const v=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(q=>{for(let x=0;x<g[v].length;x++)if(g[v][x]==="1"){q.dataset.col=x,g[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,st,null);d(this,it);A(this,"invalidate",c(()=>{var e,s;t(this,it).refresh(),(e=this.querySelector("nine-table-hscrollbar"))==null||e.refresh(),(s=this.querySelector("nine-table-vscrollbar"))==null||s.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,st),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,st),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,st),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"));A(this,"generate",c(e=>{e&&(y(this,st,he.compile(e)),t(this,Xt).call(this),t(this,Kt).call(this),t(this,it).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"));A(this,"getRowHeight",c(()=>t(this,it).getRowHeight(),"getRowHeight"));A(this,"scrollToX",c(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));A(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;
|
|
@@ -262,14 +262,14 @@
|
|
|
262
262
|
<nine-table-hscrollbar></nine-table-hscrollbar>
|
|
263
263
|
<div class='ng-scroll-edge'></div>
|
|
264
264
|
</div>
|
|
265
|
-
`},"#render"));y(this,
|
|
265
|
+
`},"#render"));y(this,it,new ce(this)),y(this,Ut,this.getRootNode().host)}connectedCallback(){t(this,Zt).call(this)}disconnectedCallback(){this.innerHTML="",k.log("NineTableSheet destroyed.")}};Ut=new WeakMap,st=new WeakMap,it=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,dt=new WeakMap,Zt=new WeakMap,Gt=new WeakMap,c(qt,"NineTableSheet"),A(qt,"SCROLLBAR_SIZE",16);let It=qt;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",It);const Re=class Re extends HTMLElement{constructor(){super();d(this,Jt,c(()=>{var e;(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{var o;const n=s.ctrlKey||s.metaKey||s.shiftKey,r=parseInt((o=s.target.closest(".nine-tab-item"))==null?void 0:o.dataset.index,10);t(this,kt).call(this,r,n)}),t(this,kt).call(this,0,!1)},"#init"));d(this,kt,c((e,s=!1)=>{const n=c(()=>{const f=Array.from(this.querySelectorAll("nine-table-sheet"));Array.from(this.querySelectorAll("nine-splitter")).forEach(g=>g.style.setProperty("display","none"));const b=f.filter(g=>g.classList.contains("active"));b.length<2||b.forEach(g=>{const m=parseInt(g.getAttribute("data-index"),10),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 b=u===e;f.classList.toggle("active",b),f.style.flex=b?"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 b=o.querySelector(`nine-table-sheet[data-index="${e}"]`);b&&(b.classList.toggle("active"),b.classList.contains("active")||(b.style.flex=""))}const l=o.querySelectorAll("nine-table-sheet.active");l==null||l.forEach(f=>{f.style.flex=l.length>1?"1 1 0%":"1 1 100%"}),n()},"#switchSheet"))}connectedCallback(){t(this,Jt).call(this)}};Jt=new WeakMap,kt=new WeakMap,c(Re,"NineTableSheets");let de=Re;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",de);const qe=class qe{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,Tt).call(this)}).observe(t(this,_))},"#init"));d(this,Tt,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=It.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>`,b=l<n-1?`<nine-splitter class="h" data-split-index="${l}"></nine-splitter>`:"";return u+b}).join(""),o=e.map((h,l)=>`<div class="nine-tab-item ${l===0?"active":""}" data-index="${l}">Sheet ${l+1}</div>`).join("");t(this,_).shadowRoot.innerHTML=`
|
|
266
266
|
<style>
|
|
267
267
|
:host {
|
|
268
268
|
display: flex;
|
|
269
269
|
flex-direction: column;
|
|
270
270
|
position: relative;
|
|
271
271
|
overflow: hidden;
|
|
272
|
-
height: ${
|
|
272
|
+
height: ${s?"auto":"100%"};
|
|
273
273
|
background: #fff;
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -345,12 +345,17 @@
|
|
|
345
345
|
<nine-table-sheets>
|
|
346
346
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
347
347
|
<nine-table-sheets-footer>
|
|
348
|
-
<div class="nine-tab-bar">${
|
|
348
|
+
<div class="nine-tab-bar">${o}</div>
|
|
349
349
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
350
350
|
</nine-table-sheets-footer>
|
|
351
351
|
</nine-table-sheets>
|
|
352
352
|
<nine-table-analysis></nine-table-analysis>
|
|
353
353
|
</nine-table-body>
|
|
354
354
|
<nine-table-footer></nine-table-footer>
|
|
355
|
-
`;const l=t(this,H).shadowRoot.querySelectorAll("nine-table-sheet");l==null||l.forEach((c,a)=>{e[a]&&setTimeout(()=>{c.generate(e[a]),i&&t(this,St).call(this)})})},"#render"));y(this,H,n),t(this,Vt).call(this)}};H=new WeakMap,Vt=new WeakMap,St=new WeakMap,Ut=new WeakMap,h(ge,"LayoutManager");let ie=ge;const be=class be{constructor(n){d(this,Et);d(this,at,-1);R(this,"count",h(()=>t(this,Et).rawRecords.length,"count"));y(this,Et,n)}get at(){return t(this,at)}set at(n){y(this,at,parseInt(n,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,at)}"]`)&&setTimeout(()=>{})}};Et=new WeakMap,at=new WeakMap,h(be,"ngRow");let oe=be;const I=class I{constructor(n,e){d(this,M);d(this,k);d(this,_,[]);d(this,ct,[]);d(this,Xt,0);d(this,V,[]);d(this,jt,h(()=>{y(this,V,[]);const n=t(this,M).template||[];Array.from(n).forEach(e=>{var i;t(this,V).push(((i=e.getBoundingClientRect)==null?void 0:i.call(e).height)||24)}),(t(this,k).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Rt).call(this)),e.__ng.height=t(this,V).slice()})},"#initialize"));d(this,et,h(()=>{t(this,M).shadowRoot.querySelectorAll("nine-table-sheet").forEach(n=>{n.invalidate()})},"#invalidate"));R(this,"get",h((n,e)=>{var r;const i=this.getValidData();if(!i||i.length<=0)return;if(n==null)return t(this,ht).call(this,i);if(n<0||n>=i.length)return null;const o=typeof((r=t(this,M).fields)==null?void 0:r.get)=="function"?t(this,M).fields.get():[];if(e!=null){const s=o.indexOf(e);return s>=0?i[n].v[s]:null}return t(this,ht).call(this,i[n])},"get"));R(this,"set",h(n=>{this.clear(),this.add(n,!1),t(this,et).call(this)},"set"));d(this,Rt,h(()=>({rowState:I.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,V).slice(),o:{},c:{},_:[0,0,0,0,I.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,V).slice(),-1,{},{}]}),"#getDefaultMeta"));R(this,"reset",h(()=>{y(this,_,[]),y(this,ct,[]),t(this,et).call(this)},"reset"));R(this,"clear",h(()=>{var n;t(this,k).rawRecords=[],y(this,_,[]),y(this,ct,[]),(n=t(this,k).viewRecords)!=null&&n.reset&&t(this,k).viewRecords.reset()},"clear"));d(this,Kt,h(n=>{var o;Array.isArray(n)||(n=[n]);const e=typeof((o=t(this,M).fields)==null?void 0:o.get)=="function"?t(this,M).fields.get():Object.keys(n[0]||{}),i=[];return n.forEach(r=>{const s={v:[]};e.forEach(l=>{s.v.push(r[l]!==void 0&&r[l]!==null?r[l]:"")}),i.push(s)}),i},"#json2Array"));d(this,Zt,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{e.__ng=t(this,Rt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=I.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),n),"#defaultInsert"));R(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const i=t(this,Kt).call(this,n);t(this,k).rawRecords=t(this,k).rawRecords.concat(t(this,Zt).call(this,i)),this.resetRecords();const o=this.count()-1;return e||i.forEach((r,s)=>{const l=t(this,k).rawRecords[o-s];l&&(l.__ng.rowState=I.ROW_STATE.EMPTY)}),t(this,et).call(this),o},"add"));R(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,k).host.row.at]:e=[parseInt(n,10)],e.sort((i,o)=>o-i).forEach(i=>{if(t(this,_)[i]){const o=t(this,_)[i].__ng.rowid;t(this,_)[i].__ng.rowState===I.ROW_STATE.INSERT?t(this,k).rawRecords=t(this,k).rawRecords.filter(r=>r.__ng.rowid!==o):t(this,k).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=I.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,et).call(this)},"delete"));R(this,"setValue",h((n,e,i)=>{var c;n=parseInt(n,10);const r=(typeof((c=t(this,M).fields)==null?void 0:c.get)=="function"?t(this,M).fields.get():[]).indexOf(e);if(r<0)return;const s=this.getValidData()[n];if(!s)return;const l=s.v[r];l!==i&&s.__ng.rowState!==I.ROW_STATE.INSERT&&(s.__ng.o.hasOwnProperty(e)||(s.__ng.o[e]=l),s.__ng.rowState=I.ROW_STATE.UPDATE),s.v[r]=i},"setValue"));R(this,"resetRecords",h(()=>{y(this,ct,t(this,k).rawRecords.filter(n=>!n.__ng.deleted)),y(this,_,t(this,k).rawRecords.filter(n=>!n.__ng.deleted&&!n.__ng.filtered)),t(this,k).rawRecords.forEach((n,e)=>{n.__ng.rowidx=e}),t(this,_).forEach((n,e)=>{n.__ng.i=e})},"resetRecords"));R(this,"getValidData",h(()=>(t(this,_).length===0&&t(this,k).rawRecords.length>0&&this.resetRecords(),t(this,_)),"getValidData"));d(this,ht,h(n=>{var s;if(!n)return n;const e=!Array.isArray(n),i=e?[n]:n,o=typeof((s=t(this,M).fields)==null?void 0:s.get)=="function"?t(this,M).fields.get():[],r=i.filter(l=>!l.__ng.deleted).map(l=>{const c={};return o.forEach((a,f)=>{c[a]=l.v?l.v[f]:l[a]}),c.__ng=l.__ng,c});return e?r[0]:r},"#conv"));R(this,"count",h(()=>this.getValidData().length,"count"));y(this,M,n),y(this,k,e),t(this,jt).call(this)}get source(){return t(this,ht).call(this,t(this,k).rawRecords)}set source(n){this.clear(),this.add(n,!1)}get nextId(){return++Se(this,Xt)._}get length(){return t(this,_).length}getRowCount(){return this.length}};M=new WeakMap,k=new WeakMap,_=new WeakMap,ct=new WeakMap,Xt=new WeakMap,V=new WeakMap,jt=new WeakMap,et=new WeakMap,Rt=new WeakMap,Kt=new WeakMap,Zt=new WeakMap,ht=new WeakMap,h(I,"ngData"),R(I,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let se=I;const ye=class ye{constructor(n){d(this,nt);y(this,nt,n),this.row=new oe(this),this.data=new se(t(this,nt),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,nt).view)!=null&&e.redraw&&t(this,nt).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var o,r;const i=parseInt(e,10);if(!(i>=this.data.count()))return(r=(o=this.data.getValidData()[i])==null?void 0:o.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,i)=>this.data.get(e,i),this.setColumn=(e,i,o)=>{e=parseInt(e,10),this.data.setValue(e,i,o)},this.setDataSource([])}};nt=new WeakMap,h(ye,"ngDataManager");let re=ye;const pe=class pe{constructor(n){d(this,dt);d(this,L,[]);R(this,"add",h((n,e="string")=>{n.forEach(i=>{t(this,L).some(o=>o.name===i)||t(this,L).push({name:i,type:e})}),t(this,At).call(this)},"add"));d(this,At,h(()=>{const n=new Map;t(this,L).forEach(e=>{n.set(e.name,e.type)}),y(this,L,Array.from(n,([e,i])=>({name:e,type:i}))),y(this,L,t(this,L).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,L).sort((e,i)=>e.name.length<i.name.length?1:-1)},"#adjust"));d(this,Gt,h(()=>{y(this,L,[]),A.log(t(this,dt).querySelectorAll("table"));const n=Array.from(t(this,dt).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)A.log(e),$("[data-bind]",e).each((i,o)=>{const r=o.dataset.bind,s=o.getAttribute("data-type")||"string";r&&t(this,L).push({name:r,type:s})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(i=>{$(`[${i}]`,e).each((o,r)=>{var s=r.getAttribute(i);if(s.indexOf("data.")<0){const l=s.search(/[(]/g);if(l>0)try{s=String(window[s.substring(0,l).trim()])}catch{s=""}}s.split("data.").forEach(l=>{if(l.trim()!=""){const c=l.search(/[^_A-Za-z0-9]/g);let a="";c>=0?a=l.substring(0,c):s.startsWith("data.")&&(a=l.replace("data.","")),a&&t(this,L).push({name:a,type:"string"})}})})});t(this,At).call(this)}},"#init"));y(this,dt,n),t(this,Gt).call(this)}get(){return t(this,L).map(n=>n.name)}getFields(){return t(this,L)}getType(n){const e=t(this,L).find(i=>i.name===n);return e?e.type:"string"}indexOf(n){return t(this,L).findIndex(e=>e.name===n)}includes(n){return t(this,L).some(e=>e.name===n)}};dt=new WeakMap,L=new WeakMap,At=new WeakMap,Gt=new WeakMap,h(pe,"ngFields");let le=pe;const me=class me extends HTMLElement{constructor(){super();d(this,it);d(this,Jt);d(this,Qt,h(()=>{this.fields=new le(this),y(this,Jt,new ie(this)),A.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,it,new re(this))}connectedCallback(){t(this,Qt).call(this)}disconnectedCallback(){A.log("NineTable disconnected.")}get data(){return t(this,it).data}get row(){return t(this,it).row}get dataManager(){return t(this,it)}};it=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,h(me,"NineTable");let ae=me;customElements.get("nine-table")||customElements.define("nine-table",ae)});
|
|
355
|
+
`;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,Tt).call(this)})})},"#render"));y(this,_,i),t(this,Qt).call(this)}};_=new WeakMap,Qt=new WeakMap,Tt=new WeakMap,te=new WeakMap,c(qe,"LayoutManager");let fe=qe;const ke=class ke{constructor(i){d(this,Ct);d(this,ft,-1);A(this,"count",c(()=>t(this,Ct).rawRecords.length,"count"));y(this,Ct,i)}get at(){return t(this,ft)}set at(i){y(this,ft,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,ft)}"]`)&&setTimeout(()=>{})}};Ct=new WeakMap,ft=new WeakMap,c(ke,"ngRow");let ue=ke;const O=class O{constructor(i,e){d(this,N);d(this,L);d(this,W,[]);d(this,ut,[]);d(this,ee,0);d(this,X,[]);d(this,se,c(()=>{y(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,L).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Lt).call(this)),e.__ng.height=t(this,X).slice()})},"#initialize"));d(this,nt,c(()=>{t(this,N).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));A(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"));A(this,"set",c(i=>{this.clear(),this.add(i,!1),t(this,nt).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"));A(this,"reset",c(()=>{y(this,W,[]),y(this,ut,[]),t(this,nt).call(this)},"reset"));A(this,"clear",c(()=>{var i;t(this,L).rawRecords=[],y(this,W,[]),y(this,ut,[]),(i=t(this,L).viewRecords)!=null&&i.reset&&t(this,L).viewRecords.reset()},"clear"));d(this,ie,c(i=>{var n;Array.isArray(i)||(i=[i]);const e=typeof((n=t(this,N).fields)==null?void 0:n.get)=="function"?t(this,N).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(r=>{const o={v:[]};e.forEach(a=>{o.v.push(r[a]!==void 0&&r[a]!==null?r[a]:"")}),s.push(o)}),s},"#json2Array"));d(this,ne,c(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,Lt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=O.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));A(this,"add",c((i,e=!0)=>{i===void 0&&(i={});const s=t(this,ie).call(this,i);t(this,L).rawRecords=t(this,L).rawRecords.concat(t(this,ne).call(this,s)),this.resetRecords();const n=this.count()-1;return e||s.forEach((r,o)=>{const a=t(this,L).rawRecords[n-o];a&&(a.__ng.rowState=O.ROW_STATE.EMPTY)}),t(this,nt).call(this),n},"add"));A(this,"delete",c(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,L).host.row.at]:e=[parseInt(i,10)],e.sort((s,n)=>n-s).forEach(s=>{if(t(this,W)[s]){const n=t(this,W)[s].__ng.rowid;t(this,W)[s].__ng.rowState===O.ROW_STATE.INSERT?t(this,L).rawRecords=t(this,L).rawRecords.filter(r=>r.__ng.rowid!==n):t(this,L).rawRecords.forEach(r=>{r.__ng.rowid===n&&(r.__ng.deleted=!0,r.__ng.rowState=O.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,nt).call(this)},"delete"));A(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"));A(this,"resetRecords",c(()=>{y(this,ut,t(this,L).rawRecords.filter(i=>!i.__ng.deleted)),y(this,W,t(this,L).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,L).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,W).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));A(this,"getValidData",c(()=>(t(this,W).length===0&&t(this,L).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"));A(this,"count",c(()=>this.getValidData().length,"count"));y(this,N,i),y(this,L,e),t(this,se).call(this)}get source(){return t(this,gt).call(this,t(this,L).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++Fe(this,ee)._}get length(){return t(this,W).length}getRowCount(){return this.length}};N=new WeakMap,L=new WeakMap,W=new WeakMap,ut=new WeakMap,ee=new WeakMap,X=new WeakMap,se=new WeakMap,nt=new WeakMap,Lt=new WeakMap,ie=new WeakMap,ne=new WeakMap,gt=new WeakMap,c(O,"ngData"),A(O,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let ge=O;const Te=class Te{constructor(i){d(this,rt);y(this,rt,i),this.row=new ue(this),this.data=new ge(t(this,rt),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,rt).view)!=null&&e.redraw&&t(this,rt).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([])}};rt=new WeakMap,c(Te,"ngDataManager");let be=Te;const Ce=class Ce{constructor(i){d(this,bt);d(this,H,[]);A(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)}),y(this,H,Array.from(i,([e,s])=>({name:e,type:s}))),y(this,H,t(this,H).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,H).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,re,c(()=>{y(this,H,[]),k.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)k.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"));y(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(Ce,"ngFields");let ye=Ce;const Le=class Le extends HTMLElement{constructor(){super();d(this,ot);d(this,oe);d(this,ae,c(()=>{this.fields=new ye(this),y(this,oe,new fe(this)),k.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))},"#init"));this.attachShadow({mode:"open"}),y(this,ot,new be(this))}connectedCallback(){t(this,ae).call(this)}disconnectedCallback(){k.log("NineTable disconnected.")}get data(){return t(this,ot).data}get row(){return t(this,ot).row}get dataManager(){return t(this,ot)}};ot=new WeakMap,oe=new WeakMap,ae=new WeakMap,c(Le,"NineTable");let pe=Le;customElements.get("nine-table")||customElements.define("nine-table",pe);const $t=class $t extends HTMLElement{constructor(){super()}applyBaseStyle(){const i=this.constructor.name;if(!ngElement._styleCache.has(i)){const s=new CSSStyleSheet;ngElement._styleCache.set(i,s);const n=`https://cdn.jsdelivr.net/npm/@ninebone/grid@0.0.447/dist/css/${i}.css`;fetch(n).then(r=>r.text()).then(r=>s.replaceSync(r)).catch(r=>console.error("Base CSS Load Error:",r))}const e=[ngElement._styleCache.get(i)];if(nine.cssPath){if(!ngElement._customStyleCache.has(i)){const s=new CSSStyleSheet;ngElement._customStyleCache.set(i,s);const n=`${nine.cssPath}/ninegrid/${i}.css`;fetch(n).then(r=>r.text()).then(r=>s.replaceSync(r)).catch(r=>console.error("Custom CSS Load Error:",r))}e.push(ngElement._customStyleCache.get(i))}this.shadowRoot.adoptedStyleSheets=e}connectedCallback(){}};c($t,"BasicCellElement"),A($t,"_styleCache",new Map),A($t,"_customStyleCache",new Map);let me=$t;const Ne=class Ne extends me{constructor(){super();d(this,C);d(this,p);d(this,He);d(this,$e);d(this,Me);d(this,Ie);A(this,"getDisplayText",c(e=>{if(t(this,p))if(t(this,p).closest("tbody")){const s=t(this,p).closest("tr").data,n=parseInt(t(this,p).dataset.row);if(!s)return"";if(ninegrid.isNull(t(this,p).dataset.expr)){if(!ninegrid.isNull(t(this,p).dataset.bind))return s[t(this,p).dataset.bind]||ninegrid.nvl(e,"")}else try{return this.getExprValue(t(this,p).dataset.expr,s,n,t(this,p))}catch{console.error(t(this,p).dataset.expr,s,t(this,p).dataset.row)}return ninegrid.nvl(e,"")}else try{return t(this,C).exprFunction(t(this,p).dataset.expr).call(this,null,-1,t(this,C).data)}catch{}},"getDisplayText"));A(this,"reset",c(()=>{parseInt(t(this,p).dataset.row);var e=t(this,p).closest("tr"),s=e.data;k.log(s)},"reset"));d(this,_e,c(()=>{if(!(!t(this,C)||!t(this,C).template||!t(this,p).closest("tbody.bindable"))){var e=ninegrid.j.querySelectorAll(t(this,p)).attr("suppress");if(e&&(e=parseInt(e)),e&&!isNaN(e)){var s=t(this,p).closest("tr"),n=[];$("th,td",s).each((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,C).template.length)>0)for(var o of n){if(o>e)break;var a=parseInt(t(this,p).dataset.row),h=a-1,l=t(this,p).closest("tr").data,f=t(this,C).data.get(h);t(this,p).dataset.matrixRow;var u=t(this,C).body.querySelector(`tbody.bindable [suppress="${o}"][data-matrix-row="${t(this,p).dataset.matrixRow}"]`),b=u.dataset.expr?this.getExprValue(u.dataset.expr,l,a):l[u.dataset.bind],g=u.dataset.expr?this.getExprValue(u.dataset.expr,f,h):f[u.dataset.bind];if(b!=g){r=!0;break}}else r=!0;r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("suppress"):ninegrid.j.querySelectorAll(t(this,p)).addClass("suppress"),ninegrid.j.querySelectorAll(t(this,p)).hasClass("hidden")||(r?ninegrid.j.querySelectorAll(t(this,p)).removeClass("hidden"):ninegrid.j.querySelectorAll(t(this,p)).addClass("hidden"));var m=parseInt(t(this,p).dataset.matrixRow),v=m-1,q=t(this,C).body.querySelector(`tbody.bindable [data-col="${t(this,p).dataset.col}"][data-matrix-row="${v}"]`);$(q).hasClass("suppress")&&!ninegrid.j.querySelectorAll(t(this,p)).hasClass("suppress")?ninegrid.j.querySelectorAll(q).removeClass("last-none-suppress").addClass("last-suppress"):!$(q).hasClass("suppress")&&ninegrid.j.querySelectorAll(t(this,p)).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"));A(this,"getExprValue",c((e,s,n,r)=>{if(typeof e<"u")try{n=parseInt(n);const o=e.replace("()","");return t(this,C)[o]?t(this,C)[o].call(this,s,n,t(this,p)):t(this,C).exprFunction(e).call(this,s,n,t(this,C).data)}catch{return["NG-COMBO"].includes(this.tagName)?"":e}else return e},"getExprValue"))}connectedCallback(){super.connectedCallback();let e=this.getRootNode().host;e&&e.tagName!="NINE-GRID"&&(e=e.getRootNode().host),y(this,C,this.getRootNode().host),y(this,p,this.closest("th,td")),k.log(t(this,C),t(this,p))}get value(){var e=!t(this,C)||!t(this,C).dataManager||!t(this,p)||!t(this,p).dataset||!t(this,p).dataset.row||!t(this,p).dataset.bind?"":t(this,p).closest("tr").data[t(this,p).dataset.bind];return e??""}set value(e){var s=parseInt(t(this,p).dataset.row);const n=this.getAttribute("update-row-state")!="false";s<0?t(this,C).data.setValueNF(parseInt(t(this,p).dataset.index),t(this,p).dataset.bind,e,n):t(this,C).data.setValue(s,t(this,p).dataset.bind,e,n)}get row(){return parseInt(t(this,p).dataset.row)}get data(){return t(this,p).closest("tr").data}};C=new WeakMap,p=new WeakMap,He=new WeakMap,$e=new WeakMap,Me=new WeakMap,Ie=new WeakMap,_e=new WeakMap,c(Ne,"CellElement");let xe=Ne;const We=class We extends xe{constructor(){super()}connectedCallback(){super.connectedCallback()}};c(We,"EditableCellElement");let ve=We;const Pe=class Pe extends ve{constructor(){super();d(this,Oe);d(this,at);d(this,yt);d(this,pt);d(this,le);d(this,K);d(this,Be,c(e=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code)){if(t(this,at)=="number"){let r=[];if(t(this,K)&&Number(t(this,K))>0&&r.push("."),t(this,pt)&&Number(t(this,pt))>=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,yt)&&ninegrid.getByteLength(e.target.value)>=Number(t(this,yt))&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()}},"#onKeyDown"));if(this.applyBaseStyle(),y(this,at,this.getAttribute("type")||"text"),y(this,yt,this.getAttribute("maxbyte")),y(this,pt,this.getAttribute("min")),y(this,le,this.getAttribute("max")),y(this,K,this.getAttribute("scale")),!["text","number"].includes(t(this,at)))throw`invalid type : ${t(this,at)}`}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.shadowRoot.innerHTML=`
|
|
356
|
+
<input type="text"
|
|
357
|
+
${e.join(" ")}
|
|
358
|
+
ondragstart="return false;"
|
|
359
|
+
>
|
|
360
|
+
`,super.connectedCallback()}};Oe=new WeakMap,at=new WeakMap,yt=new WeakMap,pt=new WeakMap,le=new WeakMap,K=new WeakMap,Be=new WeakMap,c(Pe,"CellInputText");let _t=Pe;customElements.get("cell-input-text")||customElements.define("cell-input-text",_t),customElements.get("cell-input")||customElements.define("cell-input",_t)});
|
|
356
361
|
//# sourceMappingURL=nine-table.umd.js.map
|