@ninebone/grid 0.0.54 → 0.0.55

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.
@@ -1,4 +1,4 @@
1
- (function(de,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("jquery"),require("@ninebone/util")):typeof define=="function"&&define.amd?define(["exports","jquery","@ninebone/util"],Se):(de=typeof globalThis<"u"?globalThis:de||self,Se(de.NineGrid={},de.$,de.util))})(this,(function(de,Se,Ue){"use strict";var Df=Object.defineProperty;var Tu=de=>{throw TypeError(de)};var Bf=(de,Se,Ue)=>Se in de?Df(de,Se,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):de[Se]=Ue;var it=(de,Se,Ue)=>Bf(de,typeof Se!="symbol"?Se+"":Se,Ue),bu=(de,Se,Ue)=>Se.has(de)||Tu("Cannot "+Ue);var f=(de,Se,Ue)=>(bu(de,Se,"read from private field"),Ue?Ue.call(de):Se.get(de)),Y=(de,Se,Ue)=>Se.has(de)?Tu("Cannot add the same private member more than once"):Se instanceof WeakSet?Se.add(de):Se.set(de,Ue),tt=(de,Se,Ue,Cs)=>(bu(de,Se,"write to private field"),Cs?Cs.call(de,Ue):Se.set(de,Ue),Ue),er=(de,Se,Ue)=>(bu(de,Se,"access private method"),Ue);var Ru=(de,Se,Ue,Cs)=>({set _(Ri){tt(de,Se,Ri,Ue)},get _(){return f(de,Se,Cs)}});var Jn,Qn,to,hs,Fl,Es,Ye,ql,Hl,zl,Ul,Wt,Vl,Mi,As,Ts,Ii,Rs,Ni,eo,Oi,ji,lr,Mu,Iu,Ff,Nu,Ou,ju,qf,$u,ei,$i,ro,so,io,no,kt,Sr,Li,Wl,oo,Ot,cs,ao,lo,ho,jr,co,uo,dr,fo,Xl,Yl,Gl,Kl,Zl,Jl,po,mo,go,bo,Ql,th,Pi,yo,Di,Bi,Fi,vo,qi,Hi,ri,Fr,wo,zi,xo,eh,ve,$r,qr,_o,kr,Ui,Hr,So,ou,ko,au,Co,Eo,Vi,Wi,Ao,Ne,Cr,Er,Ms,Is,zr,Ar,Ns,Os,To,Ro,Mo,lu,Io,rh,No,Xi,Yi,Gi,si,Ki,sh,ce,ii,Lr,Zi,Oo,ih,nh,Ji,De,nr,jo,js,ni,Qi,oh,ah,lh,hh,hu,$o,Be,$s,oi,tn,ch,Lo,uh,Po,en,cu,dh,fh,rn,Do,sn,ai,nn,Kr,ph,Bo,mh,Fo,gh,Ur,qo,bh,yh,vh,Zr,Ho,us,Ve,Dt,Pe,Tr,li,Ls,on,zo,an,Uo,Vo,wh,Wo,Xo,ln,hn,Yo,Go,Ko,Oe,Zo,cn,ds,hi,un,Jo,uu,du,xh,Qo,hr,ta,_h,Sh,dn,fs,Vr,ps,kh,ea,fn,Ch,Ps,pn,Eh,Ah,Th,Rh,Mh,Ih,ra,mn,Nh,sa,Jr,Oh,Qr,ci,jh,Ke,ms,Wr,Ds,gn,ts,$h,ke,ui,bn,yn,vn,di,fi,es,rs,Lt,ia,Lh,Fe,na,oa,Rr,aa,We,rr,Bs,Ph,wn,Dh,pi,la,Fs,Pr,qs,mi,Bh,Fh,xn,qh,sr,cr,gi,Hh,He,ha,ca,ua,gs,da,fa,pa,ma,or,gr,bi,zh,Uh,ga,ba,Vh,fr,ss,ya,br,Hs,yi,fu,is,Wh,Xh,Yh,va,wa,xa,Gh,Kh,Le,pr,qt,ns,ge,yr,vr,Sn,Zh,Jh,_a,Qh,Sa,ka,kn,Cn,Ze,bs,ae,Xr,Yr,zs,tc,Ca,ec,Ea,rc,Aa,Ta,En,Xe,os,Ra,Ma,Ia,sc,ic,Gt,nc,Na,Oa,ys,ja,$a,La,Pa,Da,Ba,Fa,vi,Ll,oc,ac,lc,hc,pu,qa,Ha,cc,uc,dc,yt,Ge,wr,wi,xi,za,Ua,Va,Wa,Xa,fc,pc,mc,An,Us,Vs,Je,Ws,gc,Ya,Tn,Ga,Mr,Ka,Za,bc,yc,vc,wc,Ja,_i,Qa,Rn,as,tl,el,xc,vs,_c,rl,Sc,ls,kc,sl,Cc,il,Xs,Ys,ws,Ec,nl,Mn,ol,al,In,ll,hl,Gs,cl,Nn,xs,Si,On,Ac,jn,$n,Tc,ul,dl,Ln,Pn,fl,pl,ml,Rc,ki,Mc,Ic,Lu,Dn,Nc,Oc,Pu,jc,$c,gl,Bn,bl,Lc,yl,Fn,vl,qn,_s,Ci,Pc,ur,wl,Dc,Hn,Du,Bu,Bc,Dr,Fc,qc,Hc,xl,mu,zc,Ir,_l,Sl,kl,Cl,Uc,El,Ei,Al,Nr,Pl,yu,vu,Tl,Vc,Rl,Wc,zn,Ml,wu,Un,Ks,xu,_u,Xc,Yc,Gc,Ss,Kc,Il,Vn,Nl,Ol,Wn,jl;class Cs extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML=`
1
+ (function(de,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("jquery"),require("@ninebone/util")):typeof define=="function"&&define.amd?define(["exports","jquery","@ninebone/util"],Se):(de=typeof globalThis<"u"?globalThis:de||self,Se(de.NineGrid={},de.$,de.util))})(this,(function(de,Se,Ue){"use strict";var Df=Object.defineProperty;var Tu=de=>{throw TypeError(de)};var Bf=(de,Se,Ue)=>Se in de?Df(de,Se,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):de[Se]=Ue;var it=(de,Se,Ue)=>Bf(de,typeof Se!="symbol"?Se+"":Se,Ue),bu=(de,Se,Ue)=>Se.has(de)||Tu("Cannot "+Ue);var f=(de,Se,Ue)=>(bu(de,Se,"read from private field"),Ue?Ue.call(de):Se.get(de)),Y=(de,Se,Ue)=>Se.has(de)?Tu("Cannot add the same private member more than once"):Se instanceof WeakSet?Se.add(de):Se.set(de,Ue),tt=(de,Se,Ue,Cs)=>(bu(de,Se,"write to private field"),Cs?Cs.call(de,Ue):Se.set(de,Ue),Ue),er=(de,Se,Ue)=>(bu(de,Se,"access private method"),Ue);var Ru=(de,Se,Ue,Cs)=>({set _(Ri){tt(de,Se,Ri,Ue)},get _(){return f(de,Se,Cs)}});var Jn,Qn,to,hs,Fl,Es,Ye,ql,Hl,zl,Ul,Wt,Vl,Mi,As,Ts,Ii,Rs,Ni,eo,Oi,ji,lr,Mu,Iu,Ff,Nu,Ou,ju,qf,$u,ei,$i,ro,so,io,no,kt,Sr,Li,Wl,oo,Ot,cs,ao,lo,ho,$r,co,uo,dr,fo,Xl,Yl,Gl,Kl,Zl,Jl,po,mo,go,bo,Ql,th,Pi,yo,Di,Bi,Fi,vo,qi,Hi,ri,Fr,wo,zi,xo,eh,ve,Lr,qr,_o,kr,Ui,Hr,So,ou,ko,au,Co,Eo,Vi,Wi,Ao,Ne,Cr,Er,Ms,Is,zr,Ar,Ns,Os,To,Ro,Mo,lu,Io,rh,No,Xi,Yi,Gi,si,Ki,sh,ce,ii,Pr,Zi,Oo,ih,nh,Ji,De,nr,jo,js,ni,Qi,oh,ah,lh,hh,hu,$o,Be,$s,oi,tn,ch,Lo,uh,Po,en,cu,dh,fh,rn,Do,sn,ai,nn,Kr,ph,Bo,mh,Fo,gh,Ur,qo,bh,yh,vh,Zr,Ho,us,Ve,Dt,Pe,Tr,li,Ls,on,zo,an,Uo,Vo,wh,Wo,Xo,ln,hn,Yo,Go,Ko,Oe,Zo,cn,ds,hi,un,Jo,uu,du,xh,Qo,hr,ta,_h,Sh,dn,fs,Vr,ps,kh,ea,fn,Ch,Ps,pn,Eh,Ah,Th,Rh,Mh,Ih,ra,mn,Nh,sa,Jr,Oh,Qr,ci,jh,Ke,ms,Wr,Ds,gn,ts,$h,ke,ui,bn,yn,vn,di,fi,es,rs,Lt,ia,Lh,Fe,na,oa,Rr,aa,We,rr,Bs,Ph,wn,Dh,pi,la,Fs,Dr,qs,mi,Bh,Fh,xn,qh,sr,cr,gi,Hh,He,ha,ca,ua,gs,da,fa,pa,ma,or,gr,bi,zh,Uh,ga,ba,Vh,fr,ss,ya,br,Hs,yi,fu,is,Wh,Xh,Yh,va,wa,xa,Gh,Kh,Le,pr,qt,ns,ge,yr,vr,Sn,Zh,Jh,_a,Qh,Sa,ka,kn,Cn,Ze,bs,ae,Xr,Yr,zs,tc,Ca,ec,Ea,rc,Aa,Ta,En,Xe,os,Ra,Ma,Ia,sc,ic,Gt,nc,Na,Oa,ys,ja,$a,La,Pa,Da,Ba,Fa,vi,Ll,oc,ac,lc,hc,pu,qa,Ha,cc,uc,dc,yt,Ge,wr,wi,xi,za,Ua,Va,Wa,Xa,fc,pc,mc,An,Us,Vs,Je,Ws,gc,Ya,Tn,Ga,Mr,Ka,Za,bc,yc,vc,wc,Ja,_i,Qa,Rn,as,tl,el,xc,vs,_c,rl,Sc,ls,kc,sl,Cc,il,Xs,Ys,ws,Ec,nl,Mn,ol,al,In,ll,hl,Gs,cl,Nn,xs,Si,On,Ac,jn,$n,Tc,ul,dl,Ln,Pn,fl,pl,ml,Rc,ki,Mc,Ic,Lu,Dn,Nc,Oc,Pu,jc,$c,gl,Bn,bl,Lc,yl,Fn,vl,qn,_s,Ci,Pc,ur,wl,Dc,Hn,Du,Bu,Bc,Br,Fc,qc,Hc,xl,mu,zc,Ir,_l,Sl,kl,Cl,Uc,El,Ei,Al,Nr,Pl,yu,vu,Tl,Vc,Rl,Wc,zn,Ml,wu,Un,Ks,xu,_u,Xc,Yc,Gc,Ss,Kc,Il,Vn,Nl,Ol,Wn,jl;class Cs extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML=`
2
2
  <nx-dialog css-file="nxConfirm.css">
3
3
  <div class="msg"></div>
4
4
  <buttons class="buttons-confirm">
@@ -42,7 +42,7 @@
42
42
  <button class="button" ${t.join(" ")}>${this.getAttribute("text")}</button>
43
43
  `,super.connectedCallback(),tt(this,Es,this.shadowRoot.querySelector("button")),$(this.cell).on("keydown",c=>{c.code=="Enter"&&$(f(this,Es)).trigger("click")})}}Es=new WeakMap,customElements.get("ng-button")||customElements.define("ng-button",Hu);class zu{constructor(C){Y(this,Ye);Y(this,ql,C=>{!C.ctrlKey&&!C.metaKey||(["C","c"].includes(C.key)?f(this,zl).call(this):["V","v"].includes(C.key)&&f(this,Hl).call(this))});Y(this,Hl,()=>{const C=f(this,Ye).cell.currentCell;C&&f(this,Ye).selection.rows[0]&&C.dataset.row==f(this,Ye).selection.rows[0]&&(parseInt(C.dataset.row),parseInt(C.dataset.row),navigator.clipboard.readText().then(t=>{t.split(`
44
44
  `).forEach(l=>{l.split(" ").forEach(c=>{})})}).catch(t=>{console.error("Failed to read clipboard contents: ",t)}))});Y(this,zl,()=>{const C=[];for(var t=f(this,Ye).selection.selected.startRow;t<=f(this,Ye).selection.selected.endRow;t++){for(var l=[],c=f(this,Ye).selection.selected.startCol;c<=f(this,Ye).selection.selected.endCol;c++)l.push(f(this,Ul).call(this,t,c));C.push(l.join(" "))}C.length<=0||navigator.clipboard.writeText(C.join(`
45
- `)).then(()=>{setTimeout(()=>{H.j.querySelectorAll(".selected",f(this,Ye).body).addClass("copied")}),setTimeout(()=>{H.j.querySelectorAll(".copied",f(this,Ye).body).removeClass("copied")},1e3)}).catch(o=>{console.error("Failed to copy text: ",o)})});Y(this,Ul,(C,t)=>{const l=parseInt(C/f(this,Ye).template.length),o=f(this,Ye).template[C%f(this,Ye).template.length].querySelector(`[data-col="${t}"]`);if(!o||!o.dataset)return"";if(o.dataset.expr)return f(this,Ye).exprFunction(o.dataset.expr).call(this,f(this,Ye).data.get(l),l);if(o.dataset.bind)return f(this,Ye).data.get(l,o.dataset.bind)});tt(this,Ye,C),$(f(this,Ye).body).on("keydown",f(this,ql))}}Ye=new WeakMap,ql=new WeakMap,Hl=new WeakMap,zl=new WeakMap,Ul=new WeakMap;class Uu{constructor(C){Y(this,lr);Y(this,Wt);Y(this,Vl);Y(this,Mi);Y(this,As);Y(this,Ts);Y(this,Ii);Y(this,Rs);Y(this,Ni);Y(this,eo);Y(this,Oi);Y(this,ji);it(this,"moveCell",C=>{var t=C.target.closest("th,td")||C.target.getRootNode().host.closest("th,td")||document.activeElement.closest("th,td"),l=t.closest("tr");l.sectionRowIndex;var c=parseInt(t.dataset.col);parseInt(l.dataset.row);var o=parseInt(l.dataset.matrixRow),r,n;switch(C.code){case"Tab":case"ArrowRight":case"ArrowLeft":r=o;break;case"ArrowDown":case"ArrowUp":case"PageDown":case"PageUp":n=c;break}switch(C.code){case"Tab":C.preventDefault(),n=C.shiftKey?f(this,ei).call(this,o,c):f(this,$i).call(this,o,c);break;case"ArrowRight":n=f(this,$i).call(this,o,c);break;case"ArrowLeft":n=f(this,ei).call(this,o,c);break;case"ArrowDown":if(t.closest("tbody.fixed"))r=parseInt(t.dataset.matrixRow)+(t.rowSpan||1);else{const e=parseInt(t.dataset.row),i=f(this,Wt).view.getVisibleLastRow();f(this,Wt).isLastPage&&e==i-1&&$(".ng-container-body .nodata",f(this,Wt).shadowRoot).height()<=0||!f(this,Wt).isLastPage&&f(this,Wt).lastRowHidden&&e>=i-1||!f(this,Wt).isLastPage&&!f(this,Wt).lastRowHidden&&e>=i?(f(this,Wt).scrollBy(1),this.currentCell=t,setTimeout(()=>{t.focus()})):r=parseInt(t.dataset.matrixRow)+(t.rowSpan||1)}break;case"ArrowUp":t.closest("tbody.fixed")?r=parseInt(t.dataset.matrixRow)-(t.rowSpan||1):t.closest("tr").sectionRowIndex==0?f(this,Wt).isFirstPage||(f(this,Wt).scrollBy(-1),this.currentCell=t,setTimeout(()=>{t.focus()})):r=parseInt(t.dataset.matrixRow)-(t.rowSpan||1);break;case"PageDown":f(this,Wt).pageDown();break;case"PageUp":f(this,Wt).pageUp();break}if(r!=null&&n!=null&&isFinite(r)){var s=f(this,ro).call(this,r,n);s&&!s.querySelector("ng-row-indicator")&&(this.currentCell=s)}["Tab","ArrowLeft","ArrowRight"].includes(C.code)&&f(this,Wt).body.querySelector("ng-hscrollbar").refresh()});Y(this,ei,(C,t)=>{var l=parseInt(C/f(this,Wt).template.length),c;return $(`tbody tr[data-matrix-row=${C}]`,f(this,Wt).body).find("th,td").each((o,r)=>{var n=parseInt(r.dataset.col);if(t-1>=n&&t-1<=n+r.colSpan-1)return c=H.j.querySelectorAll(r).hasClass("dummy")?f(this,ei).call(this,C,r.dataset.col):r.dataset.col,!1}),c==null&&$(`tbody tr[data-row=${l}]`,f(this,Wt).body).find("th,td").each((o,r)=>{var n=parseInt(r.dataset.col);if(t-1>=n&&t-1<=n+r.colSpan-1)return c=H.j.querySelectorAll(r).hasClass("dummy")?f(this,ei).call(this,C,r.dataset.col):r.dataset.col,!1}),c});Y(this,$i,(C,t)=>{var l=f(this,Wt).body.querySelector(`tbody [data-matrix-row="${C}"][data-col="${t}"]`),c=t+(l.colSpan||1),o=f(this,Wt).body.querySelector(`tbody [data-matrix-row="${C}"][data-col="${c}"]`);return H.j.querySelectorAll(o).hasClass("dummy")&&(c=f(this,$i).call(this,C,c)),c});Y(this,ro,(C,t)=>{var l=parseInt(C/f(this,Wt).template.length),c=$(`[data-matrix-row=${C}][data-col=${t}]`,f(this,Wt).body).not(".dummy").filter(":visible");return c.length==0&&(c=$(`[data-row=${l}][data-col=${t}]`,f(this,Wt).body).not(".dummy").filter(":visible")),c[0]});it(this,"refresh",()=>{f(this,Wt).selection.refresh()});Y(this,so,C=>{C.altKey||C.shiftKey||C.ctrlKey||(C.preventDefault(),C.originalEvent.deltaY>0?f(this,Wt).scrollBy(1):f(this,Wt).scrollBy(-1))});Y(this,io,C=>{if(!(C.ctrlKey||C.altKey)&&!(C.target.tagName=="NG-ROW-INDICATOR"&&[H.SELECTTYPE.CELL,H.SELECTTYPE.AREA].includes(f(this,Wt).selection.type)))if(C.shiftKey){if([H.SELECTTYPE.COLS,H.SELECTTYPE.ROWS,H.SELECTTYPE.AREA].includes(f(this,Wt).selection.type)){var t=f(this,Wt).selection.getActiveCell();if(t){var l=t.closest("tr"),c=parseInt(t.dataset.row)*f(this,Wt).template.length+l.sectionRowIndex%f(this,Wt).template.length,o=parseInt(t.dataset.col),r=C.target.closest("th,td"),n=r.closest("tr"),s=parseInt(r.dataset.row)*f(this,Wt).template.length+n.sectionRowIndex%f(this,Wt).template.length,e=parseInt(r.dataset.col);f(this,Wt).selection.selectArea(c,o,s,e)}}}else{const i=C.target.closest("th,td"),u=f(this,Wt).view.getVisibleLastRow(),a=parseInt(i.closest("tr").dataset.row),h=!!i.closest("tbody.fixed"),p=f(this,Wt).shadowRoot.querySelector(".ng-container-body tr.nodata");if(!h&&$(p).height()<=0&&f(this,Wt).lastRowHidden&&u==a){const m=parseInt(i.closest("tr").dataset.matrixRow),d=parseInt(i.dataset.col);f(this,Wt).scrollBy(1);const b=f(this,ro).call(this,m,d);this.currentCell=b,setTimeout(()=>{b.focus()})}else this.currentCell=i}});Y(this,no,C=>{if(!(C.ctrlKey||C.altKey))if(["TH","TD"].includes(C.target.tagName)){if(["Tab","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(C.code))C.preventDefault(),this.moveCell(C);else if(["Enter"].includes(C.code)){C.preventDefault();const t=C.target.querySelector("ng-input");if(t){const l=t.shadowRoot.querySelector("input[type=text]");l.focus(),l.select()}}}else["NG-INPUT"].includes(C.target.tagName)&&["Enter"].includes(C.code)});it(this,"resetEvent",()=>{document.addEventListener("contextmenu",C=>C.preventDefault()),$(".ng-table tbody.bindable",f(this,Wt).body).off("wheel",f(this,so)),$(".ng-table tbody",f(this,Wt).body).off("keydown","th,td",f(this,no)),$(".ng-table tbody",f(this,Wt).body).off("mousedown","th,td",f(this,io)),$(".ng-table tbody.bindable",f(this,Wt).body).on("wheel",f(this,so)),$(".ng-table tbody",f(this,Wt).body).on("keydown","th,td",f(this,no)),$(".ng-table tbody",f(this,Wt).body).on("mousedown","th,td",f(this,io)),f(this,Wt).selection&&f(this,Wt).selection.resetEvent()});tt(this,Wt,C),tt(this,As,-1),tt(this,Ts,-1),tt(this,Ii,-1),tt(this,Rs,-1),this.resetEvent()}get matrixRow(){return f(this,Ts)}get col(){return f(this,Rs)}get currentCell(){return f(this,Mi)}set currentCell(C){if(!C)return;tt(this,Vl,f(this,Mi)),tt(this,Mi,C),C.focus();var t=C.closest("tr");tt(this,lr,parseInt(t.dataset.row)*f(this,Wt).template.length+t.sectionRowIndex%f(this,Wt).template.length,Iu),tt(this,lr,parseInt(C.dataset.col),ju),tt(this,lr,C.cellIndex,Nu),tt(this,lr,C.dataset.bind,$u),t.closest("tbody.fixed")||(f(this,Wt).row.at=C.dataset.row),f(this,Wt).selection.selectCell(f(this,lr,Mu),f(this,lr,Ou));const l=C,c=parseInt(l.dataset.row),o=parseInt(l.dataset.matrixRow)%parseInt(l.dataset.row),r=parseInt(l.dataset.col),n=l.cellIndex,s=parseInt(f(this,As)/f(this,Wt).template.length),e=parseInt(f(this,As))%parseInt(f(this,As)/f(this,Wt).template.length),i=f(this,Ii),u=f(this,eo);if(c!=s||o!=e||r!=i){const a=new CustomEvent(H.EVENT.CELL_POS_CHANGED,{bubbles:!0,detail:{}});a.col=r,a.cellIndex=n,a.row=c,a.subrow=o,a.bind=l.dataset.bind,a.prev={col:i,cellIndex:u,col:i,row:s,subrow:e,bind:f(this,Oi)},f(this,Wt).dispatchEvent(a)}if(c!=s){const a=new CustomEvent(H.EVENT.ROW_POS_CHANGED,{bubbles:!0,detail:{}});a.col=r,a.cellIndex=n,a.row=c,a.subrow=o,a.bind=l.dataset.bind,a.prev={col:i,cellIndex:u,row:s,subrow:e,bind:f(this,Oi)},f(this,Wt).dispatchEvent(a)}}}Wt=new WeakMap,Vl=new WeakMap,Mi=new WeakMap,As=new WeakMap,Ts=new WeakMap,Ii=new WeakMap,Rs=new WeakMap,Ni=new WeakMap,eo=new WeakMap,Oi=new WeakMap,ji=new WeakMap,lr=new WeakSet,Mu=function(){return f(this,Ts)},Iu=function(C){tt(this,As,f(this,Ts)),tt(this,Ts,parseInt(C))},Ff=function(){return f(this,Ni)},Nu=function(C){tt(this,eo,f(this,Ni)),tt(this,Ni,parseInt(C))},Ou=function(){return f(this,Rs)},ju=function(C){tt(this,Ii,f(this,Rs)),tt(this,Rs,parseInt(C))},qf=function(){return f(this,ji)},$u=function(C){tt(this,Oi,f(this,ji)),tt(this,ji,C)},ei=new WeakMap,$i=new WeakMap,ro=new WeakMap,so=new WeakMap,io=new WeakMap,no=new WeakMap;class Vu{constructor(C){Y(this,kt);Y(this,Sr);Y(this,Li);it(this,"getActiveCell",()=>{var C=this.selected.currentRow,t=this.selected.currentCol,l=parseInt(this.selected.currentMatrixRow%f(this,kt).template.length),c=$(`tbody.bindable [data-row=${C}]`,f(this,kt).body).find(`[data-col=${t}]`).not(".dummy").eq(l);return c.length>0?c[0]:null});it(this,"refresh",()=>{switch(this.type){case H.SELECTTYPE.ROW:this.selected.startRow=parseInt(f(this,kt).row.at*f(this,kt).template.length),this.selected.endRow=this.selected.startRow+f(this,kt).template.length-1;var t=[];$(`tbody tr[data-row=${parseInt(this.selected.startRow/f(this,kt).template.length)}] td`,f(this,kt).body).not(".dummy").not(".first").each((o,r)=>{parseInt(H.j.querySelectorAll(r).attr("tabindex"))>=0&&t.push(Number(r.dataset.col))}),this.selected.startCol=t.length>0?Math.min.apply(null,t):-1,this.selected.endCol=t.length>0?Math.max.apply(null,t):-1;break;case H.SELECTTYPE.ROWS:this.selected.startRow=parseInt(this.selected.startRow/f(this,kt).template.length)*f(this,kt).template.length,this.selected.endRow=parseInt(this.selected.endRow/f(this,kt).template.length)*f(this,kt).template.length-1+f(this,kt).template.length,this.selected.startCol=f(this,kt).firstCol,this.selected.endCol=f(this,kt).lastCol;break;case H.SELECTTYPE.COL:this.selected.startRow=0,this.selected.endRow=parseInt(f(this,kt).data.count()*f(this,kt).template.length-1),this.selected.endCol=this.selected.startCol;var C=[];f(this,kt).template.each((o,r)=>{r.querySelectorAll("th,td").forEach(n=>{const s=parseInt(n.dataset.col),e=parseInt(n.colSpan||1);this.selected.startCol>=s&&this.selected.endCol<=s+e-1&&C.push(n)})});var t=[];C.forEach(o=>{t.push(parseInt(o.dataset.col)),t.push(parseInt(o.dataset.col)+parseInt(o.colSpan||1)-1)}),this.selected.startCol=Math.min.apply(null,t),this.selected.endCol=Math.max.apply(null,t);break;case H.SELECTTYPE.COLS:this.selected.startRow=0,this.selected.endRow=parseInt(f(this,kt).data.count()*f(this,kt).template.length-1);var C=[];f(this,kt).template.each((o,r)=>{r.querySelectorAll("th,td").forEach(n=>{const s=parseInt(n.dataset.col),e=parseInt(n.colSpan||1);(this.selected.startCol>=s&&this.selected.startCol<=s+e-1||this.selected.endCol>=s&&this.selected.endCol<=s+e-1)&&C.push(n)})});var t=[];C.forEach(o=>{t.push(parseInt(o.dataset.col)),t.push(parseInt(o.dataset.col)+parseInt(o.colSpan||1)-1)}),this.selected.startCol=Math.min.apply(null,t),this.selected.endCol=Math.max.apply(null,t);break;case H.SELECTTYPE.CELL:this.selected.endRow=this.selected.startRow,this.selected.endCol=this.selected.startCol;break;case H.SELECTTYPE.AREA:break;case H.SELECTTYPE.NONE:this.selected.startRow=this.selected.endRow=this.selected.startCol=this.selected.endCol=-1;break}H.j.querySelectorAll("th,td",f(this,kt).body).removeClass("active").removeClass("multi-selected").removeClass("selected").removeClass("selected-current").removeClass("selected-area").removeClass("selected-top").removeClass("selected-bottom").removeClass("selected-left").removeClass("selected-right"),H.j.querySelectorAll(".selected-current",f(this,kt).body).removeClass("selected-current"),H.j.querySelectorAll(`tr[data-row="${this.selected.currentRow}"] ng-row-indicator`,f(this,kt).body).addClass("selected-current"),H.j.querySelectorAll(`.col-indicator[data-col="${this.selected.currentCol}"]`,f(this,kt).body).addClass("selected-current"),$(`tr[data-row="${this.selected.currentRow}"] ng-row-indicator`,f(this,kt).body).closest("th,td").addClass("selected-current");var l=this.getActiveCell();l&&H.j.querySelectorAll(l).addClass("active"),$("tbody th,tbody td",f(this,kt).body).each((o,r)=>{var n=parseInt(r.dataset.col),s=parseInt(r.dataset.row)*f(this,kt).template.length+r.closest("tr").sectionRowIndex%f(this,kt).template.length;s==this.selected.currentMatrixRow&&n==this.selected.currentCol,s+r.rowSpan-1>=this.selected.startRow&&s<=this.selected.endRow&&n+r.colSpan-1>=this.selected.startCol&&n<=this.selected.endCol&&(H.j.querySelectorAll(r).addClass("selected"),this.selected.startRow==this.selected.endRow&&this.selected.startCol==this.selected.endCol?H.j.querySelectorAll(r).addClass("selected-top").addClass("selected-bottom").addClass("selected-left").addClass("selected-right"):(s==this.selected.startRow&&H.j.querySelectorAll(r).addClass("selected-top"),s+r.rowSpan-1==this.selected.endRow&&H.j.querySelectorAll(r).addClass("selected-bottom"),n==this.selected.startCol&&H.j.querySelectorAll(r).addClass("selected-left"),n+r.colSpan-1==this.selected.endCol&&H.j.querySelectorAll(r).addClass("selected-right"),H.j.querySelectorAll(r).addClass("multi-selected")))}),$("tbody.bindable tr",f(this,kt).body).each((o,r)=>{var n=r.querySelector("ng-row-indicator");if(n){n=n.closest("th,td");for(var s=parseInt(n.dataset.row),e=0;e<n.rowSpan;e++){var s=parseInt(n.dataset.row)*f(this,kt).template.length+r.sectionRowIndex%f(this,kt).template.length+e;s>=this.selected.startRow&&s<=this.selected.endRow&&H.j.querySelectorAll(n).addClass("selected-area")}}});for(var c=this.selected.startCol;c<=this.selected.endCol;c++)H.j.querySelectorAll(`.col-indicator[data-col="${c}"]`,f(this,kt).body).addClass("selected-area");(this.selected.oldStartRow!=this.selected.startRow||this.selected.oldEndRow!=this.selected.endRow||this.selected.oldStartCol!=this.selected.startCol||this.selected.oldEndCol!=this.selected.endCol)&&(f(this,Sr).oldStartRow=this.selected.oldStartRow,f(this,Sr).oldEndRow=this.selected.oldEndRow,f(this,Sr).oldStartCol=this.selected.oldStartCol,f(this,Sr).oldEndCol=this.selected.oldEndCol,f(this,Sr).startRow=this.selected.startRow,f(this,Sr).endRow=this.selected.endRow,f(this,Sr).startCol=this.selected.startCol,f(this,Sr).endCol=this.selected.endCol,f(this,kt).dispatchEvent(f(this,Sr))),this.selected.oldStartRow=this.selected.startRow,this.selected.oldEndRow=this.selected.endRow,this.selected.oldStartCol=this.selected.startCol,this.selected.oldEndCol=this.selected.endCol});it(this,"resetEvent",()=>{$(".ng-table tbody.bindable",f(this,kt).body).off("mousedown","th,td",f(this,oo)).on("mousedown","th,td",f(this,oo))});Y(this,Wl,()=>{this.resetEvent()});Y(this,oo,C=>{if(C.buttons!=1||C.altKey||C.ctrlKey||C.shiftKey)return;const t=C.target.closest("th,td"),l=t.closest("tr"),c=parseInt(t.dataset.row)*f(this,kt).template.length+l.sectionRowIndex%f(this,kt).template.length,o=parseInt(t.dataset.col);this.selected.currentCol=t.dataset.col,this.selected.currentRow=t.dataset.row,this.selected.currentMatrixRow=parseInt(t.dataset.row*f(this,kt).template.length)+parseInt(t.closest("tr").sectionRowIndex%f(this,kt).template.length);var r={row:-1,col:-1};const n=a=>{const h=a.target.closest("th,td"),p=h.closest("tr");if(p.sectionRowIndex==r.row&&h.dataset.col==r.col||$(h).find("NG-ROW-INDICATOR").length>0)return;const m=parseInt(h.dataset.row)*f(this,kt).template.length+p.sectionRowIndex%f(this,kt).template.length,d=parseInt(h.dataset.col);this.selectArea(c,o,m,d),r={row:p.sectionRowIndex,col:h.dataset.col}},s=a=>{f(this,kt).body.querySelector("ng-vscrollbar").stopScroll(),clearInterval(f(this,Li)),$(".ng-table tbody.bindable",f(this,kt).body).off("mousemove",n),$(".ng-table tbody.bindable",f(this,kt).body).off("mouseenter",e),$(".ng-table tbody.bindable",f(this,kt).body).off("mouseleave",i),$(document).off("mousemove",u),$(document).off("mouseup",s)},e=a=>{clearInterval(f(this,Li)),$(document).off("mousemove",u)},i=a=>{const h=$(".ng-container-body",f(this,kt).body),p=h.find("thead"),m=h.find("tfoot");var d;parseInt(a.pageY)>=parseInt(h.offset().top+h.height()-m.height())?d=1:parseInt(a.pageY)<=parseInt(h.offset().top+p.height())&&(d=-1),this.selected.col=this.selected.startCol,d&&($(document).on("mousemove",u),tt(this,Li,setInterval(()=>{if(d>0){this.selected.endRow=h.find("tbody.bindable tr:last-child")[0].sectionRowIndex+f(this,kt).dataManager.viewRecords.rawIndex*f(this,kt).template.length;const b=parseInt(this.selected.startRow/f(this,kt).template.length),g=parseInt(this.selected.endRow/f(this,kt).template.length);b!=g&&(this.selected.endRow=Math.floor(this.selected.endRow/f(this,kt).template.length)*f(this,kt).template.length+f(this,kt).template.length-1),this.selected.endRow>parseInt(f(this,kt).data.count()*f(this,kt).template.length)-1&&(this.selected.endRow=parseInt(f(this,kt).data.count()*f(this,kt).template.length)-1)}else{this.selected.startRow=h.find("tbody.bindable tr:first-child")[0].sectionRowIndex+f(this,kt).dataManager.viewRecords.rawIndex*f(this,kt).template.length-f(this,kt).template.length;const b=parseInt(this.selected.startRow/f(this,kt).template.length),g=parseInt(this.selected.endRow/f(this,kt).template.length);b!=g&&(this.selected.startRow=Math.floor(this.selected.startRow/f(this,kt).template.length)*f(this,kt).template.length),this.selected.startRow<0&&(this.selected.startRow=0)}f(this,kt).scrollBy(d)},500)))},u=a=>{var h;if($(".col-indicator",f(this,kt).body).each((p,m)=>{var d=$(m).offset().left,b=$(m).width();if(a.pageX>d&&a.pageX<d+b)return h=m,!1}),h){let p=parseInt(h.dataset.col);if(f(this,kt).body.querySelector(`tbody.bindable [data-col="${p}"] ng-row-indicator`))return;$("th,td",f(this,kt).template).each((m,d)=>{p>=parseInt(d.dataset.col)&&p<=parseInt(d.dataset.col)+d.colSpan-1&&(p=p>=o?Math.max(p,parseInt(d.dataset.col)+d.colSpan-1):Math.min(p,parseInt(d.dataset.col)))}),p>=this.selected.startCol&&p<=this.selected.endCol?p>this.selected.col?this.selected.endCol=p:p<this.selected.col?this.selected.startCol=p:this.selected.startCol=this.selected.endCol=p:p>this.selected.endCol?this.selected.endCol=p:p<this.selected.startCol&&(this.selected.startCol=p)}};[H.SELECTTYPE.AREA,H.SELECTTYPE.ROWS,H.SELECTTYPE.COLS].includes(this.type)&&($(".ng-table tbody.bindable",f(this,kt).body).on("mousemove",n),$(".ng-table tbody.bindable",f(this,kt).body).on("mouseenter",e),$(".ng-table tbody.bindable",f(this,kt).body).on("mouseleave",i)),$(document).on("mouseup",s),this.rawIndex=f(this,kt).dataManager.viewRecords.rawIndex});it(this,"selectArea",(C,t,l,c)=>{var o=Math.min(C,l),r=Math.max(C,l),n=Math.min(t,c),s=Math.max(t,c);$("tbody.bindable th,tbody.bindable td",f(this,kt).body).each((e,i)=>{var u=i.closest("tr"),a=parseInt(i.dataset.row)*f(this,kt).template.length+u.sectionRowIndex%f(this,kt).template.length,h=parseInt(i.dataset.col);a+i.rowSpan-1>=o&&a<=r&&h+i.colSpan-1>=n&&h<=s&&(o=Math.min(a,o),n=Math.min(h,n),r=Math.max(a+i.rowSpan-1,r),s=Math.max(h+i.colSpan-1,s))}),this.selected.startRow=o,this.selected.endRow=r,this.selected.startCol=n,this.selected.endCol=s,this.refresh()});it(this,"selectCell",(C,t)=>{this.selected.currentCol=t,this.selected.currentMatrixRow=C,this.selected.currentRow=parseInt(C/f(this,kt).template.length),this.selectArea(C,t,C,t)});it(this,"clear",()=>{this.selected.clear()});tt(this,kt,C),tt(this,Sr,new CustomEvent("selectchanged",{bubbles:!0,detail:{}})),this.selected={currentRow:-1,currentMatrixRow:-1,currentCol:-1,startRow:-1,startCol:-1,endRow:-1,endCol:-1,oldStartRow:-1,oldStartCol:-1,oldEndRow:-1,oldEndCol:-1,clear:()=>{this.selected.startRow=this.selected.endRow=this.selected.startCol=this.selected.endCol=-1,H.j.querySelectorAll("th,td",f(this,kt).body).removeClass("selected").removeClass("selected-area").removeClass("selected-top").removeClass("selected-bottom").removeClass("selected-left").removeClass("selected-right")}},f(this,Wl).call(this)}get type(){return f(this,kt).getAttribute("select-type")}set type(C){if(!Object.values(H.SELECTTYPE).includes(C))throw`invalid select type : ${C}`;Object.values(H.SELECTTYPE).forEach(t=>{H.j.querySelectorAll(".ng-table",f(this,kt).body).removeClass(`select-type-${t}`)}),H.j.querySelectorAll(".ng-table",f(this,kt).body).addClass(`select-type-${C}`),f(this,kt).cell.refresh()}get rows(){const C=[];for(var t=this.selected.startRow;t<=this.selected.endRow;t++)t>=0&&C.push(parseInt(t/f(this,kt).template.length));return[...new Set(C)]}get subrows(){const C=[];for(var t=this.selected.startRow;t<=this.selected.endRow;t++)t>=0&&C.push(parseInt(t%f(this,kt).template.length));return[...new Set(C)]}get cols(){const C=[],t=this.subrows;for(var l=this.selected.startCol;l<=this.selected.endCol;l++)for(var c of t)$(`[data-col="${l}"]`,f(this,kt).template[c]).length>0&&C.push(l);return[...new Set(C)]}get binds(){const C=[],t=this.subrows;for(var l=this.selected.startCol;l<=this.selected.endCol;l++)for(var c of t){const o=$(`[data-col="${l}"]`,f(this,kt).template[c]);o.length>0&&o[0].dataset.bind&&C.push(o[0].dataset.bind)}return[...new Set(C)]}get firstRow(){return parseInt(this.selected.startRow/f(this,kt).template.length)}get lastRow(){return parseInt(this.selected.endRow/f(this,kt).template.length)}get firstCol(){return this.selected.startCol}get lastCol(){return this.selected.endCol}}kt=new WeakMap,Sr=new WeakMap,Li=new WeakMap,Wl=new WeakMap,oo=new WeakMap;class Wu{constructor(C){Y(this,Ot);Y(this,cs);Y(this,ao);Y(this,lo);Y(this,ho);Y(this,jr);Y(this,co);Y(this,uo);Y(this,dr,0);Y(this,fo,C=>{var t;return $(".ng-container-body tbody.bindable tr",f(this,Ot).body).each((l,c)=>{var o=$(c).offset();if(C>=o.top&&C<=o.top+$(c).height())return t=c,!1}),t});Y(this,Xl,C=>{var t=f(this,Gl).call(this,C);if(t>0){t>f(this,Ot).dataManager.viewRecords.rawIndex&&(t=f(this,Ot).dataManager.viewRecords.rawIndex);const c=f(this,Ot).template.clone(),o=c.clone(),r=c.clone();c.find("th,td").not("[fixed=left]").remove(),o.find("th,td").not("[fixed=right]").remove(),r.find("th[fixed=left],td[fixed=left],th[fixed=right],td[fixed=right]").remove();const n=$("tbody.bindable tr:first-child",f(this,Ot).body.querySelector(".ng-container-left")),s=$("tbody.bindable tr:first-child",f(this,Ot).body.querySelector(".ng-container-right")),e=$("tbody.bindable tr:first-child",f(this,Ot).body.querySelector(".ng-container-body")),i=f(this,Ot).view.getVisibleFirstRow();for(var l=0;l<t;l++)c.each((u,a)=>{a.dataset.row=i-t+l,n.before(a.outerHTML)}),o.each((u,a)=>{a.dataset.row=i-t+l,s.before(a.outerHTML)}),r.each((u,a)=>{a.dataset.row=i-t+l,e.before(a.outerHTML)})}return t});Y(this,Yl,C=>{var t=f(this,Kl).call(this,C);if(t>0){f(this,Ot).view.getVisibleLastRow()+t>=f(this,Ot).data.count()&&(t=f(this,Ot).data.count()-f(this,Ot).view.getVisibleLastRow()-1);const c=f(this,Ot).template.clone(),o=c.clone(),r=c.clone();c.find("th,td").not("[fixed=left]").remove(),o.find("th,td").not("[fixed=right]").remove(),r.find("th[fixed=left],td[fixed=left],th[fixed=right],td[fixed=right]").remove();const n=$("tr.nodata",f(this,Ot).body.querySelector(".ng-container-left")),s=$("tr.nodata",f(this,Ot).body.querySelector(".ng-container-right")),e=$("tr.nodata",f(this,Ot).body.querySelector(".ng-container-body")),i=f(this,Ot).view.getVisibleLastRow()+1;for(var l=0;l<t;l++)c.each((u,a)=>{a.dataset.row=i+l,n.before(a.outerHTML)}),o.each((u,a)=>{a.dataset.row=i+l,s.before(a.outerHTML)}),r.each((u,a)=>{a.dataset.row=i+l,e.before(a.outerHTML)})}return t});Y(this,Gl,C=>{const t=f(this,Ot).view.getVisibleFirstRow(),l=f(this,dr)+C;if(t<=0)return 0;for(var c=0,o=0;o<l;)o+=f(this,Ot).view.getRowHeight(t-++c);return c});Y(this,Kl,C=>{const t=f(this,Ot).view.getTotalSpace()-f(this,Ot).view.getTranslateY()+C,l=f(this,Ot).view.getVisibleFirstRow(),c=f(this,Ot).view.getVisibleLastRow();for(var o=0,r=0;o<t;)o+=f(this,Ot).view.getRowHeight(l+r++);return r+1-(c-l+1)});Y(this,Zl,()=>{const C=f(this,Ot).view.getVisibleFirstRow(),t=f(this,Ot).view.getVisibleLastRow();for(var l=C,c=0,o=C;o<t;o++)if(c+=f(this,Ot).view.getRowHeight(o),c>f(this,dr)*-1){c-=f(this,Ot).view.getRowHeight(o),l=o;break}if(l>C){for(var o=C;o<l;o++)f(this,Ot).body.querySelectorAll(`tbody.bindable tr[data-row="${o}"]`).forEach(n=>{$(n).remove()});tt(this,dr,(c*-1-f(this,dr))*-1),f(this,Ot).body.querySelectorAll("tbody.bindable").forEach(r=>{r.style.transform=`translateY(${f(this,dr)}px)`})}return l-C});Y(this,Jl,()=>{const C=f(this,Ot).view.getTotalSpace()-f(this,Ot).view.getTranslateY(),t=f(this,Ot).view.getVisibleFirstRow(),l=f(this,Ot).view.getVisibleLastRow();for(var c=f(this,Ot).data.count(),o=0,r=t;r<=l;r++)if(o+=f(this,Ot).view.getRowHeight(r),o>C){c=r+1;break}for(r=c;r<=l;r++)f(this,Ot).body.querySelectorAll(`tbody.bindable tr[data-row="${r}"]`).forEach(n=>{$(n).remove()});return l-c});it(this,"scrollTop",()=>{tt(this,dr,0),f(this,Ot).body.querySelectorAll("tbody.bindable").forEach(C=>{C.style.transform=`translateY(${f(this,dr)}px)`})});Y(this,po,C=>{clearInterval(f(this,cs)),tt(this,ao,C.touches[0].pageX),tt(this,lo,C.touches[0].pageX-$(".ng-container-body table",f(this,Ot).body).position().left),tt(this,ho,C.touches[0].pageY),tt(this,jr,C.touches[0].pageY),tt(this,uo,new Date);const t=f(this,fo).call(this,C.touches[0].pageY);t&&tt(this,co,parseInt(t.dataset.row))});Y(this,mo,C=>{if(!(C.touches.length>1||C.changedTouches.length>1)){if(C.preventDefault(),Math.abs(C.changedTouches[0].pageY-f(this,jr))>0){if(C.changedTouches[0].pageY>f(this,jr)){if(f(this,dr)+C.changedTouches[0].pageY-f(this,jr)>0&&f(this,Ot).view.getVisibleFirstRow()!=0){const o=f(this,Xl).call(this,C.changedTouches[0].pageY-f(this,jr));if(o>0){for(var t=f(this,Ot).view.getVisibleFirstRow(),l=t;l<t+o;l++)tt(this,dr,f(this,dr)-f(this,Ot).view.getRowHeight(l));f(this,Ot).dataManager.viewRecords.rawIndex-=o,f(this,Ot).view.redrawV3()}}}else C.changedTouches[0].pageY<f(this,jr)&&f(this,Yl).call(this,f(this,jr)-C.changedTouches[0].pageY)>0&&f(this,Ot).view.redrawV3();tt(this,dr,f(this,dr)+(C.changedTouches[0].pageY-f(this,jr))),f(this,Ot).body.querySelectorAll("tbody.bindable").forEach(o=>{o.style.transform=`translateY(${f(this,dr)}px)`}),tt(this,jr,C.changedTouches[0].pageY)}else if(Math.abs(C.changedTouches[0].pageX-f(this,ao))>20){var c=C.changedTouches[0].pageX-f(this,lo);c>0&&(c=0),$(".ng-container-body table",f(this,Ot).body).css({left:c}),f(this,Ot).body.querySelector("ng-hscrollbar").adjustThumb2()}}});Y(this,go,C=>{f(this,Ot).view.getVisibleFirstRow()==0&&f(this,dr)>0&&this.scrollTop();var t=f(this,Zl).call(this);f(this,Ot).dataManager.viewRecords.rawIndex+=t,f(this,Jl).call(this);const l=f(this,Ot).view.getTotalSpace()-f(this,Ot).view.getTranslateY();for(var c=0,o=f(this,Ot).view.getVisibleFirstRow();o<=f(this,Ot).view.getVisibleLastRow();o++)c+=f(this,Ot).view.getRowHeight(o);$(".ng-container tbody.bindable tr.nodata",f(this,Ot).body).height(l-c),f(this,Ot).view.fitPage();const r=f(this,fo).call(this,C.changedTouches[0].pageY);if(!r||f(this,co)==parseInt(r.dataset.row))return;const n=500,s=parseInt(new Date-f(this,uo));if(s>n)return;const e=parseInt((n-s)/1*((f(this,Ot).data.count()-f(this,Ot).dataManager.viewRecords.rawIndex)/1)/(n*1)),i=f(this,Ot).dataManager.viewRecords.rawIndex+e*(C.changedTouches[0].pageY>f(this,ho)?-1:1);clearInterval(f(this,cs)),i>f(this,Ot).dataManager.viewRecords.rawIndex?tt(this,cs,setInterval(()=>{f(this,Ot).scrollBy(1),f(this,Ot).view.getVisibleLastRow()>=i&&clearInterval(f(this,cs))},10)):tt(this,cs,setInterval(()=>{f(this,Ot).scrollBy(-1),f(this,Ot).dataManager.viewRecords.rawIndex<=i&&clearInterval(f(this,cs))},10))});Y(this,bo,C=>{});it(this,"resetEvent",()=>{$("tbody.bindable",f(this,Ot).body).off("touchstart",f(this,po)),$("tbody.bindable",f(this,Ot).body).off("touchend",f(this,go)),$("tbody.bindable",f(this,Ot).body).off("touchmove",f(this,mo)),$("tbody.bindable",f(this,Ot).body).off("touchcancel",f(this,bo)),$("tbody.bindable",f(this,Ot).body).on("touchstart",f(this,po)),$("tbody.bindable",f(this,Ot).body).on("touchend",f(this,go)),$("tbody.bindable",f(this,Ot).body).on("touchmove",f(this,mo)),$("tbody.bindable",f(this,Ot).body).on("touchcancel",f(this,bo))});tt(this,Ot,C),this.resetEvent()}}Ot=new WeakMap,cs=new WeakMap,ao=new WeakMap,lo=new WeakMap,ho=new WeakMap,jr=new WeakMap,co=new WeakMap,uo=new WeakMap,dr=new WeakMap,fo=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Gl=new WeakMap,Kl=new WeakMap,Zl=new WeakMap,Jl=new WeakMap,po=new WeakMap,mo=new WeakMap,go=new WeakMap,bo=new WeakMap;class Xu extends _r{constructor(){super();Y(this,Ql);Y(this,th);Y(this,Pi);Y(this,yo);Y(this,Di);it(this,"dataRefresh",t=>{var l=this.cell.closest("tr").data;for(var c of f(this,Di).data.datasets){var t=l[c["data-bind"]];switch(typeof t){case"string":c.data=t.split(",");break;case"object":Array.isArray(t)&&(c.data=t);break}}$(f(this,Pi)).height(28),setTimeout(()=>{f(this,yo).update()}),t||this.reset()})}connectedCallback(){tt(this,Ql,this.getRootNode().host),tt(this,th,this.closest("th,td")),this.shadowRoot.innerHTML=`
45
+ `)).then(()=>{setTimeout(()=>{H.j.querySelectorAll(".selected",f(this,Ye).body).addClass("copied")}),setTimeout(()=>{H.j.querySelectorAll(".copied",f(this,Ye).body).removeClass("copied")},1e3)}).catch(o=>{console.error("Failed to copy text: ",o)})});Y(this,Ul,(C,t)=>{const l=parseInt(C/f(this,Ye).template.length),o=f(this,Ye).template[C%f(this,Ye).template.length].querySelector(`[data-col="${t}"]`);if(!o||!o.dataset)return"";if(o.dataset.expr)return f(this,Ye).exprFunction(o.dataset.expr).call(this,f(this,Ye).data.get(l),l);if(o.dataset.bind)return f(this,Ye).data.get(l,o.dataset.bind)});tt(this,Ye,C),$(f(this,Ye).body).on("keydown",f(this,ql))}}Ye=new WeakMap,ql=new WeakMap,Hl=new WeakMap,zl=new WeakMap,Ul=new WeakMap;class Uu{constructor(C){Y(this,lr);Y(this,Wt);Y(this,Vl);Y(this,Mi);Y(this,As);Y(this,Ts);Y(this,Ii);Y(this,Rs);Y(this,Ni);Y(this,eo);Y(this,Oi);Y(this,ji);it(this,"moveCell",C=>{var t=C.target.closest("th,td")||C.target.getRootNode().host.closest("th,td")||document.activeElement.closest("th,td"),l=t.closest("tr");l.sectionRowIndex;var c=parseInt(t.dataset.col);parseInt(l.dataset.row);var o=parseInt(l.dataset.matrixRow),r,n;switch(C.code){case"Tab":case"ArrowRight":case"ArrowLeft":r=o;break;case"ArrowDown":case"ArrowUp":case"PageDown":case"PageUp":n=c;break}switch(C.code){case"Tab":C.preventDefault(),n=C.shiftKey?f(this,ei).call(this,o,c):f(this,$i).call(this,o,c);break;case"ArrowRight":n=f(this,$i).call(this,o,c);break;case"ArrowLeft":n=f(this,ei).call(this,o,c);break;case"ArrowDown":if(t.closest("tbody.fixed"))r=parseInt(t.dataset.matrixRow)+(t.rowSpan||1);else{const e=parseInt(t.dataset.row),i=f(this,Wt).view.getVisibleLastRow();f(this,Wt).isLastPage&&e==i-1&&$(".ng-container-body .nodata",f(this,Wt).shadowRoot).height()<=0||!f(this,Wt).isLastPage&&f(this,Wt).lastRowHidden&&e>=i-1||!f(this,Wt).isLastPage&&!f(this,Wt).lastRowHidden&&e>=i?(f(this,Wt).scrollBy(1),this.currentCell=t,setTimeout(()=>{t.focus()})):r=parseInt(t.dataset.matrixRow)+(t.rowSpan||1)}break;case"ArrowUp":t.closest("tbody.fixed")?r=parseInt(t.dataset.matrixRow)-(t.rowSpan||1):t.closest("tr").sectionRowIndex==0?f(this,Wt).isFirstPage||(f(this,Wt).scrollBy(-1),this.currentCell=t,setTimeout(()=>{t.focus()})):r=parseInt(t.dataset.matrixRow)-(t.rowSpan||1);break;case"PageDown":f(this,Wt).pageDown();break;case"PageUp":f(this,Wt).pageUp();break}if(r!=null&&n!=null&&isFinite(r)){var s=f(this,ro).call(this,r,n);s&&!s.querySelector("ng-row-indicator")&&(this.currentCell=s)}["Tab","ArrowLeft","ArrowRight"].includes(C.code)&&f(this,Wt).body.querySelector("ng-hscrollbar").refresh()});Y(this,ei,(C,t)=>{var l=parseInt(C/f(this,Wt).template.length),c;return $(`tbody tr[data-matrix-row=${C}]`,f(this,Wt).body).find("th,td").each((o,r)=>{var n=parseInt(r.dataset.col);if(t-1>=n&&t-1<=n+r.colSpan-1)return c=H.j.querySelectorAll(r).hasClass("dummy")?f(this,ei).call(this,C,r.dataset.col):r.dataset.col,!1}),c==null&&$(`tbody tr[data-row=${l}]`,f(this,Wt).body).find("th,td").each((o,r)=>{var n=parseInt(r.dataset.col);if(t-1>=n&&t-1<=n+r.colSpan-1)return c=H.j.querySelectorAll(r).hasClass("dummy")?f(this,ei).call(this,C,r.dataset.col):r.dataset.col,!1}),c});Y(this,$i,(C,t)=>{var l=f(this,Wt).body.querySelector(`tbody [data-matrix-row="${C}"][data-col="${t}"]`),c=t+(l.colSpan||1),o=f(this,Wt).body.querySelector(`tbody [data-matrix-row="${C}"][data-col="${c}"]`);return H.j.querySelectorAll(o).hasClass("dummy")&&(c=f(this,$i).call(this,C,c)),c});Y(this,ro,(C,t)=>{var l=parseInt(C/f(this,Wt).template.length),c=$(`[data-matrix-row=${C}][data-col=${t}]`,f(this,Wt).body).not(".dummy").filter(":visible");return c.length==0&&(c=$(`[data-row=${l}][data-col=${t}]`,f(this,Wt).body).not(".dummy").filter(":visible")),c[0]});it(this,"refresh",()=>{f(this,Wt).selection.refresh()});Y(this,so,C=>{C.altKey||C.shiftKey||C.ctrlKey||(C.preventDefault(),C.originalEvent.deltaY>0?f(this,Wt).scrollBy(1):f(this,Wt).scrollBy(-1))});Y(this,io,C=>{if(!(C.ctrlKey||C.altKey)&&!(C.target.tagName=="NG-ROW-INDICATOR"&&[H.SELECTTYPE.CELL,H.SELECTTYPE.AREA].includes(f(this,Wt).selection.type)))if(C.shiftKey){if([H.SELECTTYPE.COLS,H.SELECTTYPE.ROWS,H.SELECTTYPE.AREA].includes(f(this,Wt).selection.type)){var t=f(this,Wt).selection.getActiveCell();if(t){var l=t.closest("tr"),c=parseInt(t.dataset.row)*f(this,Wt).template.length+l.sectionRowIndex%f(this,Wt).template.length,o=parseInt(t.dataset.col),r=C.target.closest("th,td"),n=r.closest("tr"),s=parseInt(r.dataset.row)*f(this,Wt).template.length+n.sectionRowIndex%f(this,Wt).template.length,e=parseInt(r.dataset.col);f(this,Wt).selection.selectArea(c,o,s,e)}}}else{const i=C.target.closest("th,td"),u=f(this,Wt).view.getVisibleLastRow(),a=parseInt(i.closest("tr").dataset.row),h=!!i.closest("tbody.fixed"),p=f(this,Wt).shadowRoot.querySelector(".ng-container-body tr.nodata");if(!h&&$(p).height()<=0&&f(this,Wt).lastRowHidden&&u==a){const m=parseInt(i.closest("tr").dataset.matrixRow),d=parseInt(i.dataset.col);f(this,Wt).scrollBy(1);const b=f(this,ro).call(this,m,d);this.currentCell=b,setTimeout(()=>{b.focus()})}else this.currentCell=i}});Y(this,no,C=>{if(!(C.ctrlKey||C.altKey))if(["TH","TD"].includes(C.target.tagName)){if(["Tab","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(C.code))C.preventDefault(),this.moveCell(C);else if(["Enter"].includes(C.code)){C.preventDefault();const t=C.target.querySelector("ng-input");if(t){const l=t.shadowRoot.querySelector("input[type=text]");l.focus(),l.select()}}}else["NG-INPUT"].includes(C.target.tagName)&&["Enter"].includes(C.code)});it(this,"resetEvent",()=>{document.addEventListener("contextmenu",C=>C.preventDefault()),$(".ng-table tbody.bindable",f(this,Wt).body).off("wheel",f(this,so)),$(".ng-table tbody",f(this,Wt).body).off("keydown","th,td",f(this,no)),$(".ng-table tbody",f(this,Wt).body).off("mousedown","th,td",f(this,io)),$(".ng-table tbody.bindable",f(this,Wt).body).on("wheel",f(this,so)),$(".ng-table tbody",f(this,Wt).body).on("keydown","th,td",f(this,no)),$(".ng-table tbody",f(this,Wt).body).on("mousedown","th,td",f(this,io)),f(this,Wt).selection&&f(this,Wt).selection.resetEvent()});tt(this,Wt,C),tt(this,As,-1),tt(this,Ts,-1),tt(this,Ii,-1),tt(this,Rs,-1),this.resetEvent()}get matrixRow(){return f(this,Ts)}get col(){return f(this,Rs)}get currentCell(){return f(this,Mi)}set currentCell(C){if(!C)return;tt(this,Vl,f(this,Mi)),tt(this,Mi,C),C.focus();var t=C.closest("tr");tt(this,lr,parseInt(t.dataset.row)*f(this,Wt).template.length+t.sectionRowIndex%f(this,Wt).template.length,Iu),tt(this,lr,parseInt(C.dataset.col),ju),tt(this,lr,C.cellIndex,Nu),tt(this,lr,C.dataset.bind,$u),t.closest("tbody.fixed")||(f(this,Wt).row.at=C.dataset.row),f(this,Wt).selection.selectCell(f(this,lr,Mu),f(this,lr,Ou));const l=C,c=parseInt(l.dataset.row),o=parseInt(l.dataset.matrixRow)%parseInt(l.dataset.row),r=parseInt(l.dataset.col),n=l.cellIndex,s=parseInt(f(this,As)/f(this,Wt).template.length),e=parseInt(f(this,As))%parseInt(f(this,As)/f(this,Wt).template.length),i=f(this,Ii),u=f(this,eo);if(c!=s||o!=e||r!=i){const a=new CustomEvent(H.EVENT.CELL_POS_CHANGED,{bubbles:!0,detail:{}});a.col=r,a.cellIndex=n,a.row=c,a.subrow=o,a.bind=l.dataset.bind,a.prev={col:i,cellIndex:u,col:i,row:s,subrow:e,bind:f(this,Oi)},f(this,Wt).dispatchEvent(a)}if(c!=s){const a=new CustomEvent(H.EVENT.ROW_POS_CHANGED,{bubbles:!0,detail:{}});a.col=r,a.cellIndex=n,a.row=c,a.subrow=o,a.bind=l.dataset.bind,a.prev={col:i,cellIndex:u,row:s,subrow:e,bind:f(this,Oi)},f(this,Wt).dispatchEvent(a)}}}Wt=new WeakMap,Vl=new WeakMap,Mi=new WeakMap,As=new WeakMap,Ts=new WeakMap,Ii=new WeakMap,Rs=new WeakMap,Ni=new WeakMap,eo=new WeakMap,Oi=new WeakMap,ji=new WeakMap,lr=new WeakSet,Mu=function(){return f(this,Ts)},Iu=function(C){tt(this,As,f(this,Ts)),tt(this,Ts,parseInt(C))},Ff=function(){return f(this,Ni)},Nu=function(C){tt(this,eo,f(this,Ni)),tt(this,Ni,parseInt(C))},Ou=function(){return f(this,Rs)},ju=function(C){tt(this,Ii,f(this,Rs)),tt(this,Rs,parseInt(C))},qf=function(){return f(this,ji)},$u=function(C){tt(this,Oi,f(this,ji)),tt(this,ji,C)},ei=new WeakMap,$i=new WeakMap,ro=new WeakMap,so=new WeakMap,io=new WeakMap,no=new WeakMap;class Vu{constructor(C){Y(this,kt);Y(this,Sr);Y(this,Li);it(this,"getActiveCell",()=>{var C=this.selected.currentRow,t=this.selected.currentCol,l=parseInt(this.selected.currentMatrixRow%f(this,kt).template.length),c=$(`tbody.bindable [data-row=${C}]`,f(this,kt).body).find(`[data-col=${t}]`).not(".dummy").eq(l);return c.length>0?c[0]:null});it(this,"refresh",()=>{switch(this.type){case H.SELECTTYPE.ROW:this.selected.startRow=parseInt(f(this,kt).row.at*f(this,kt).template.length),this.selected.endRow=this.selected.startRow+f(this,kt).template.length-1;var t=[];$(`tbody tr[data-row=${parseInt(this.selected.startRow/f(this,kt).template.length)}] td`,f(this,kt).body).not(".dummy").not(".first").each((o,r)=>{parseInt(H.j.querySelectorAll(r).attr("tabindex"))>=0&&t.push(Number(r.dataset.col))}),this.selected.startCol=t.length>0?Math.min.apply(null,t):-1,this.selected.endCol=t.length>0?Math.max.apply(null,t):-1;break;case H.SELECTTYPE.ROWS:this.selected.startRow=parseInt(this.selected.startRow/f(this,kt).template.length)*f(this,kt).template.length,this.selected.endRow=parseInt(this.selected.endRow/f(this,kt).template.length)*f(this,kt).template.length-1+f(this,kt).template.length,this.selected.startCol=f(this,kt).firstCol,this.selected.endCol=f(this,kt).lastCol;break;case H.SELECTTYPE.COL:this.selected.startRow=0,this.selected.endRow=parseInt(f(this,kt).data.count()*f(this,kt).template.length-1),this.selected.endCol=this.selected.startCol;var C=[];f(this,kt).template.each((o,r)=>{r.querySelectorAll("th,td").forEach(n=>{const s=parseInt(n.dataset.col),e=parseInt(n.colSpan||1);this.selected.startCol>=s&&this.selected.endCol<=s+e-1&&C.push(n)})});var t=[];C.forEach(o=>{t.push(parseInt(o.dataset.col)),t.push(parseInt(o.dataset.col)+parseInt(o.colSpan||1)-1)}),this.selected.startCol=Math.min.apply(null,t),this.selected.endCol=Math.max.apply(null,t);break;case H.SELECTTYPE.COLS:this.selected.startRow=0,this.selected.endRow=parseInt(f(this,kt).data.count()*f(this,kt).template.length-1);var C=[];f(this,kt).template.each((o,r)=>{r.querySelectorAll("th,td").forEach(n=>{const s=parseInt(n.dataset.col),e=parseInt(n.colSpan||1);(this.selected.startCol>=s&&this.selected.startCol<=s+e-1||this.selected.endCol>=s&&this.selected.endCol<=s+e-1)&&C.push(n)})});var t=[];C.forEach(o=>{t.push(parseInt(o.dataset.col)),t.push(parseInt(o.dataset.col)+parseInt(o.colSpan||1)-1)}),this.selected.startCol=Math.min.apply(null,t),this.selected.endCol=Math.max.apply(null,t);break;case H.SELECTTYPE.CELL:this.selected.endRow=this.selected.startRow,this.selected.endCol=this.selected.startCol;break;case H.SELECTTYPE.AREA:break;case H.SELECTTYPE.NONE:this.selected.startRow=this.selected.endRow=this.selected.startCol=this.selected.endCol=-1;break}H.j.querySelectorAll("th,td",f(this,kt).body).removeClass("active").removeClass("multi-selected").removeClass("selected").removeClass("selected-current").removeClass("selected-area").removeClass("selected-top").removeClass("selected-bottom").removeClass("selected-left").removeClass("selected-right"),H.j.querySelectorAll(".selected-current",f(this,kt).body).removeClass("selected-current"),H.j.querySelectorAll(`tr[data-row="${this.selected.currentRow}"] ng-row-indicator`,f(this,kt).body).addClass("selected-current"),H.j.querySelectorAll(`.col-indicator[data-col="${this.selected.currentCol}"]`,f(this,kt).body).addClass("selected-current"),$(`tr[data-row="${this.selected.currentRow}"] ng-row-indicator`,f(this,kt).body).closest("th,td").addClass("selected-current");var l=this.getActiveCell();l&&H.j.querySelectorAll(l).addClass("active"),$("tbody th,tbody td",f(this,kt).body).each((o,r)=>{var n=parseInt(r.dataset.col),s=parseInt(r.dataset.row)*f(this,kt).template.length+r.closest("tr").sectionRowIndex%f(this,kt).template.length;s==this.selected.currentMatrixRow&&n==this.selected.currentCol,s+r.rowSpan-1>=this.selected.startRow&&s<=this.selected.endRow&&n+r.colSpan-1>=this.selected.startCol&&n<=this.selected.endCol&&(H.j.querySelectorAll(r).addClass("selected"),this.selected.startRow==this.selected.endRow&&this.selected.startCol==this.selected.endCol?H.j.querySelectorAll(r).addClass("selected-top").addClass("selected-bottom").addClass("selected-left").addClass("selected-right"):(s==this.selected.startRow&&H.j.querySelectorAll(r).addClass("selected-top"),s+r.rowSpan-1==this.selected.endRow&&H.j.querySelectorAll(r).addClass("selected-bottom"),n==this.selected.startCol&&H.j.querySelectorAll(r).addClass("selected-left"),n+r.colSpan-1==this.selected.endCol&&H.j.querySelectorAll(r).addClass("selected-right"),H.j.querySelectorAll(r).addClass("multi-selected")))}),$("tbody.bindable tr",f(this,kt).body).each((o,r)=>{var n=r.querySelector("ng-row-indicator");if(n){n=n.closest("th,td");for(var s=parseInt(n.dataset.row),e=0;e<n.rowSpan;e++){var s=parseInt(n.dataset.row)*f(this,kt).template.length+r.sectionRowIndex%f(this,kt).template.length+e;s>=this.selected.startRow&&s<=this.selected.endRow&&H.j.querySelectorAll(n).addClass("selected-area")}}});for(var c=this.selected.startCol;c<=this.selected.endCol;c++)H.j.querySelectorAll(`.col-indicator[data-col="${c}"]`,f(this,kt).body).addClass("selected-area");(this.selected.oldStartRow!=this.selected.startRow||this.selected.oldEndRow!=this.selected.endRow||this.selected.oldStartCol!=this.selected.startCol||this.selected.oldEndCol!=this.selected.endCol)&&(f(this,Sr).oldStartRow=this.selected.oldStartRow,f(this,Sr).oldEndRow=this.selected.oldEndRow,f(this,Sr).oldStartCol=this.selected.oldStartCol,f(this,Sr).oldEndCol=this.selected.oldEndCol,f(this,Sr).startRow=this.selected.startRow,f(this,Sr).endRow=this.selected.endRow,f(this,Sr).startCol=this.selected.startCol,f(this,Sr).endCol=this.selected.endCol,f(this,kt).dispatchEvent(f(this,Sr))),this.selected.oldStartRow=this.selected.startRow,this.selected.oldEndRow=this.selected.endRow,this.selected.oldStartCol=this.selected.startCol,this.selected.oldEndCol=this.selected.endCol});it(this,"resetEvent",()=>{$(".ng-table tbody.bindable",f(this,kt).body).off("mousedown","th,td",f(this,oo)).on("mousedown","th,td",f(this,oo))});Y(this,Wl,()=>{this.resetEvent()});Y(this,oo,C=>{if(C.buttons!=1||C.altKey||C.ctrlKey||C.shiftKey)return;const t=C.target.closest("th,td"),l=t.closest("tr"),c=parseInt(t.dataset.row)*f(this,kt).template.length+l.sectionRowIndex%f(this,kt).template.length,o=parseInt(t.dataset.col);this.selected.currentCol=t.dataset.col,this.selected.currentRow=t.dataset.row,this.selected.currentMatrixRow=parseInt(t.dataset.row*f(this,kt).template.length)+parseInt(t.closest("tr").sectionRowIndex%f(this,kt).template.length);var r={row:-1,col:-1};const n=a=>{const h=a.target.closest("th,td"),p=h.closest("tr");if(p.sectionRowIndex==r.row&&h.dataset.col==r.col||$(h).find("NG-ROW-INDICATOR").length>0)return;const m=parseInt(h.dataset.row)*f(this,kt).template.length+p.sectionRowIndex%f(this,kt).template.length,d=parseInt(h.dataset.col);this.selectArea(c,o,m,d),r={row:p.sectionRowIndex,col:h.dataset.col}},s=a=>{f(this,kt).body.querySelector("ng-vscrollbar").stopScroll(),clearInterval(f(this,Li)),$(".ng-table tbody.bindable",f(this,kt).body).off("mousemove",n),$(".ng-table tbody.bindable",f(this,kt).body).off("mouseenter",e),$(".ng-table tbody.bindable",f(this,kt).body).off("mouseleave",i),$(document).off("mousemove",u),$(document).off("mouseup",s)},e=a=>{clearInterval(f(this,Li)),$(document).off("mousemove",u)},i=a=>{const h=$(".ng-container-body",f(this,kt).body),p=h.find("thead"),m=h.find("tfoot");var d;parseInt(a.pageY)>=parseInt(h.offset().top+h.height()-m.height())?d=1:parseInt(a.pageY)<=parseInt(h.offset().top+p.height())&&(d=-1),this.selected.col=this.selected.startCol,d&&($(document).on("mousemove",u),tt(this,Li,setInterval(()=>{if(d>0){this.selected.endRow=h.find("tbody.bindable tr:last-child")[0].sectionRowIndex+f(this,kt).dataManager.viewRecords.rawIndex*f(this,kt).template.length;const b=parseInt(this.selected.startRow/f(this,kt).template.length),g=parseInt(this.selected.endRow/f(this,kt).template.length);b!=g&&(this.selected.endRow=Math.floor(this.selected.endRow/f(this,kt).template.length)*f(this,kt).template.length+f(this,kt).template.length-1),this.selected.endRow>parseInt(f(this,kt).data.count()*f(this,kt).template.length)-1&&(this.selected.endRow=parseInt(f(this,kt).data.count()*f(this,kt).template.length)-1)}else{this.selected.startRow=h.find("tbody.bindable tr:first-child")[0].sectionRowIndex+f(this,kt).dataManager.viewRecords.rawIndex*f(this,kt).template.length-f(this,kt).template.length;const b=parseInt(this.selected.startRow/f(this,kt).template.length),g=parseInt(this.selected.endRow/f(this,kt).template.length);b!=g&&(this.selected.startRow=Math.floor(this.selected.startRow/f(this,kt).template.length)*f(this,kt).template.length),this.selected.startRow<0&&(this.selected.startRow=0)}f(this,kt).scrollBy(d)},500)))},u=a=>{var h;if($(".col-indicator",f(this,kt).body).each((p,m)=>{var d=$(m).offset().left,b=$(m).width();if(a.pageX>d&&a.pageX<d+b)return h=m,!1}),h){let p=parseInt(h.dataset.col);if(f(this,kt).body.querySelector(`tbody.bindable [data-col="${p}"] ng-row-indicator`))return;$("th,td",f(this,kt).template).each((m,d)=>{p>=parseInt(d.dataset.col)&&p<=parseInt(d.dataset.col)+d.colSpan-1&&(p=p>=o?Math.max(p,parseInt(d.dataset.col)+d.colSpan-1):Math.min(p,parseInt(d.dataset.col)))}),p>=this.selected.startCol&&p<=this.selected.endCol?p>this.selected.col?this.selected.endCol=p:p<this.selected.col?this.selected.startCol=p:this.selected.startCol=this.selected.endCol=p:p>this.selected.endCol?this.selected.endCol=p:p<this.selected.startCol&&(this.selected.startCol=p)}};[H.SELECTTYPE.AREA,H.SELECTTYPE.ROWS,H.SELECTTYPE.COLS].includes(this.type)&&($(".ng-table tbody.bindable",f(this,kt).body).on("mousemove",n),$(".ng-table tbody.bindable",f(this,kt).body).on("mouseenter",e),$(".ng-table tbody.bindable",f(this,kt).body).on("mouseleave",i)),$(document).on("mouseup",s),this.rawIndex=f(this,kt).dataManager.viewRecords.rawIndex});it(this,"selectArea",(C,t,l,c)=>{var o=Math.min(C,l),r=Math.max(C,l),n=Math.min(t,c),s=Math.max(t,c);$("tbody.bindable th,tbody.bindable td",f(this,kt).body).each((e,i)=>{var u=i.closest("tr"),a=parseInt(i.dataset.row)*f(this,kt).template.length+u.sectionRowIndex%f(this,kt).template.length,h=parseInt(i.dataset.col);a+i.rowSpan-1>=o&&a<=r&&h+i.colSpan-1>=n&&h<=s&&(o=Math.min(a,o),n=Math.min(h,n),r=Math.max(a+i.rowSpan-1,r),s=Math.max(h+i.colSpan-1,s))}),this.selected.startRow=o,this.selected.endRow=r,this.selected.startCol=n,this.selected.endCol=s,this.refresh()});it(this,"selectCell",(C,t)=>{this.selected.currentCol=t,this.selected.currentMatrixRow=C,this.selected.currentRow=parseInt(C/f(this,kt).template.length),this.selectArea(C,t,C,t)});it(this,"clear",()=>{this.selected.clear()});tt(this,kt,C),tt(this,Sr,new CustomEvent("selectchanged",{bubbles:!0,detail:{}})),this.selected={currentRow:-1,currentMatrixRow:-1,currentCol:-1,startRow:-1,startCol:-1,endRow:-1,endCol:-1,oldStartRow:-1,oldStartCol:-1,oldEndRow:-1,oldEndCol:-1,clear:()=>{this.selected.startRow=this.selected.endRow=this.selected.startCol=this.selected.endCol=-1,H.j.querySelectorAll("th,td",f(this,kt).body).removeClass("selected").removeClass("selected-area").removeClass("selected-top").removeClass("selected-bottom").removeClass("selected-left").removeClass("selected-right")}},f(this,Wl).call(this)}get type(){return f(this,kt).getAttribute("select-type")}set type(C){if(!Object.values(H.SELECTTYPE).includes(C))throw`invalid select type : ${C}`;Object.values(H.SELECTTYPE).forEach(t=>{H.j.querySelectorAll(".ng-table",f(this,kt).body).removeClass(`select-type-${t}`)}),H.j.querySelectorAll(".ng-table",f(this,kt).body).addClass(`select-type-${C}`),f(this,kt).cell.refresh()}get rows(){const C=[];for(var t=this.selected.startRow;t<=this.selected.endRow;t++)t>=0&&C.push(parseInt(t/f(this,kt).template.length));return[...new Set(C)]}get subrows(){const C=[];for(var t=this.selected.startRow;t<=this.selected.endRow;t++)t>=0&&C.push(parseInt(t%f(this,kt).template.length));return[...new Set(C)]}get cols(){const C=[],t=this.subrows;for(var l=this.selected.startCol;l<=this.selected.endCol;l++)for(var c of t)$(`[data-col="${l}"]`,f(this,kt).template[c]).length>0&&C.push(l);return[...new Set(C)]}get binds(){const C=[],t=this.subrows;for(var l=this.selected.startCol;l<=this.selected.endCol;l++)for(var c of t){const o=$(`[data-col="${l}"]`,f(this,kt).template[c]);o.length>0&&o[0].dataset.bind&&C.push(o[0].dataset.bind)}return[...new Set(C)]}get firstRow(){return parseInt(this.selected.startRow/f(this,kt).template.length)}get lastRow(){return parseInt(this.selected.endRow/f(this,kt).template.length)}get firstCol(){return this.selected.startCol}get lastCol(){return this.selected.endCol}}kt=new WeakMap,Sr=new WeakMap,Li=new WeakMap,Wl=new WeakMap,oo=new WeakMap;class Wu{constructor(C){Y(this,Ot);Y(this,cs);Y(this,ao);Y(this,lo);Y(this,ho);Y(this,$r);Y(this,co);Y(this,uo);Y(this,dr,0);Y(this,fo,C=>{var t;return $(".ng-container-body tbody.bindable tr",f(this,Ot).body).each((l,c)=>{var o=$(c).offset();if(C>=o.top&&C<=o.top+$(c).height())return t=c,!1}),t});Y(this,Xl,C=>{var t=f(this,Gl).call(this,C);if(t>0){t>f(this,Ot).dataManager.viewRecords.rawIndex&&(t=f(this,Ot).dataManager.viewRecords.rawIndex);const c=f(this,Ot).template.clone(),o=c.clone(),r=c.clone();c.find("th,td").not("[fixed=left]").remove(),o.find("th,td").not("[fixed=right]").remove(),r.find("th[fixed=left],td[fixed=left],th[fixed=right],td[fixed=right]").remove();const n=$("tbody.bindable tr:first-child",f(this,Ot).body.querySelector(".ng-container-left")),s=$("tbody.bindable tr:first-child",f(this,Ot).body.querySelector(".ng-container-right")),e=$("tbody.bindable tr:first-child",f(this,Ot).body.querySelector(".ng-container-body")),i=f(this,Ot).view.getVisibleFirstRow();for(var l=0;l<t;l++)c.each((u,a)=>{a.dataset.row=i-t+l,n.before(a.outerHTML)}),o.each((u,a)=>{a.dataset.row=i-t+l,s.before(a.outerHTML)}),r.each((u,a)=>{a.dataset.row=i-t+l,e.before(a.outerHTML)})}return t});Y(this,Yl,C=>{var t=f(this,Kl).call(this,C);if(t>0){f(this,Ot).view.getVisibleLastRow()+t>=f(this,Ot).data.count()&&(t=f(this,Ot).data.count()-f(this,Ot).view.getVisibleLastRow()-1);const c=f(this,Ot).template.clone(),o=c.clone(),r=c.clone();c.find("th,td").not("[fixed=left]").remove(),o.find("th,td").not("[fixed=right]").remove(),r.find("th[fixed=left],td[fixed=left],th[fixed=right],td[fixed=right]").remove();const n=$("tr.nodata",f(this,Ot).body.querySelector(".ng-container-left")),s=$("tr.nodata",f(this,Ot).body.querySelector(".ng-container-right")),e=$("tr.nodata",f(this,Ot).body.querySelector(".ng-container-body")),i=f(this,Ot).view.getVisibleLastRow()+1;for(var l=0;l<t;l++)c.each((u,a)=>{a.dataset.row=i+l,n.before(a.outerHTML)}),o.each((u,a)=>{a.dataset.row=i+l,s.before(a.outerHTML)}),r.each((u,a)=>{a.dataset.row=i+l,e.before(a.outerHTML)})}return t});Y(this,Gl,C=>{const t=f(this,Ot).view.getVisibleFirstRow(),l=f(this,dr)+C;if(t<=0)return 0;for(var c=0,o=0;o<l;)o+=f(this,Ot).view.getRowHeight(t-++c);return c});Y(this,Kl,C=>{const t=f(this,Ot).view.getTotalSpace()-f(this,Ot).view.getTranslateY()+C,l=f(this,Ot).view.getVisibleFirstRow(),c=f(this,Ot).view.getVisibleLastRow();for(var o=0,r=0;o<t;)o+=f(this,Ot).view.getRowHeight(l+r++);return r+1-(c-l+1)});Y(this,Zl,()=>{const C=f(this,Ot).view.getVisibleFirstRow(),t=f(this,Ot).view.getVisibleLastRow();for(var l=C,c=0,o=C;o<t;o++)if(c+=f(this,Ot).view.getRowHeight(o),c>f(this,dr)*-1){c-=f(this,Ot).view.getRowHeight(o),l=o;break}if(l>C){for(var o=C;o<l;o++)f(this,Ot).body.querySelectorAll(`tbody.bindable tr[data-row="${o}"]`).forEach(n=>{$(n).remove()});tt(this,dr,(c*-1-f(this,dr))*-1),f(this,Ot).body.querySelectorAll("tbody.bindable").forEach(r=>{r.style.transform=`translateY(${f(this,dr)}px)`})}return l-C});Y(this,Jl,()=>{const C=f(this,Ot).view.getTotalSpace()-f(this,Ot).view.getTranslateY(),t=f(this,Ot).view.getVisibleFirstRow(),l=f(this,Ot).view.getVisibleLastRow();for(var c=f(this,Ot).data.count(),o=0,r=t;r<=l;r++)if(o+=f(this,Ot).view.getRowHeight(r),o>C){c=r+1;break}for(r=c;r<=l;r++)f(this,Ot).body.querySelectorAll(`tbody.bindable tr[data-row="${r}"]`).forEach(n=>{$(n).remove()});return l-c});it(this,"scrollTop",()=>{tt(this,dr,0),f(this,Ot).body.querySelectorAll("tbody.bindable").forEach(C=>{C.style.transform=`translateY(${f(this,dr)}px)`})});Y(this,po,C=>{clearInterval(f(this,cs)),tt(this,ao,C.touches[0].pageX),tt(this,lo,C.touches[0].pageX-$(".ng-container-body table",f(this,Ot).body).position().left),tt(this,ho,C.touches[0].pageY),tt(this,$r,C.touches[0].pageY),tt(this,uo,new Date);const t=f(this,fo).call(this,C.touches[0].pageY);t&&tt(this,co,parseInt(t.dataset.row))});Y(this,mo,C=>{if(!(C.touches.length>1||C.changedTouches.length>1)){if(C.preventDefault(),Math.abs(C.changedTouches[0].pageY-f(this,$r))>0){if(C.changedTouches[0].pageY>f(this,$r)){if(f(this,dr)+C.changedTouches[0].pageY-f(this,$r)>0&&f(this,Ot).view.getVisibleFirstRow()!=0){const o=f(this,Xl).call(this,C.changedTouches[0].pageY-f(this,$r));if(o>0){for(var t=f(this,Ot).view.getVisibleFirstRow(),l=t;l<t+o;l++)tt(this,dr,f(this,dr)-f(this,Ot).view.getRowHeight(l));f(this,Ot).dataManager.viewRecords.rawIndex-=o,f(this,Ot).view.redrawV3()}}}else C.changedTouches[0].pageY<f(this,$r)&&f(this,Yl).call(this,f(this,$r)-C.changedTouches[0].pageY)>0&&f(this,Ot).view.redrawV3();tt(this,dr,f(this,dr)+(C.changedTouches[0].pageY-f(this,$r))),f(this,Ot).body.querySelectorAll("tbody.bindable").forEach(o=>{o.style.transform=`translateY(${f(this,dr)}px)`}),tt(this,$r,C.changedTouches[0].pageY)}else if(Math.abs(C.changedTouches[0].pageX-f(this,ao))>20){var c=C.changedTouches[0].pageX-f(this,lo);c>0&&(c=0),$(".ng-container-body table",f(this,Ot).body).css({left:c}),f(this,Ot).body.querySelector("ng-hscrollbar").adjustThumb2()}}});Y(this,go,C=>{f(this,Ot).view.getVisibleFirstRow()==0&&f(this,dr)>0&&this.scrollTop();var t=f(this,Zl).call(this);f(this,Ot).dataManager.viewRecords.rawIndex+=t,f(this,Jl).call(this);const l=f(this,Ot).view.getTotalSpace()-f(this,Ot).view.getTranslateY();for(var c=0,o=f(this,Ot).view.getVisibleFirstRow();o<=f(this,Ot).view.getVisibleLastRow();o++)c+=f(this,Ot).view.getRowHeight(o);$(".ng-container tbody.bindable tr.nodata",f(this,Ot).body).height(l-c),f(this,Ot).view.fitPage();const r=f(this,fo).call(this,C.changedTouches[0].pageY);if(!r||f(this,co)==parseInt(r.dataset.row))return;const n=500,s=parseInt(new Date-f(this,uo));if(s>n)return;const e=parseInt((n-s)/1*((f(this,Ot).data.count()-f(this,Ot).dataManager.viewRecords.rawIndex)/1)/(n*1)),i=f(this,Ot).dataManager.viewRecords.rawIndex+e*(C.changedTouches[0].pageY>f(this,ho)?-1:1);clearInterval(f(this,cs)),i>f(this,Ot).dataManager.viewRecords.rawIndex?tt(this,cs,setInterval(()=>{f(this,Ot).scrollBy(1),f(this,Ot).view.getVisibleLastRow()>=i&&clearInterval(f(this,cs))},10)):tt(this,cs,setInterval(()=>{f(this,Ot).scrollBy(-1),f(this,Ot).dataManager.viewRecords.rawIndex<=i&&clearInterval(f(this,cs))},10))});Y(this,bo,C=>{});it(this,"resetEvent",()=>{$("tbody.bindable",f(this,Ot).body).off("touchstart",f(this,po)),$("tbody.bindable",f(this,Ot).body).off("touchend",f(this,go)),$("tbody.bindable",f(this,Ot).body).off("touchmove",f(this,mo)),$("tbody.bindable",f(this,Ot).body).off("touchcancel",f(this,bo)),$("tbody.bindable",f(this,Ot).body).on("touchstart",f(this,po)),$("tbody.bindable",f(this,Ot).body).on("touchend",f(this,go)),$("tbody.bindable",f(this,Ot).body).on("touchmove",f(this,mo)),$("tbody.bindable",f(this,Ot).body).on("touchcancel",f(this,bo))});tt(this,Ot,C),this.resetEvent()}}Ot=new WeakMap,cs=new WeakMap,ao=new WeakMap,lo=new WeakMap,ho=new WeakMap,$r=new WeakMap,co=new WeakMap,uo=new WeakMap,dr=new WeakMap,fo=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Gl=new WeakMap,Kl=new WeakMap,Zl=new WeakMap,Jl=new WeakMap,po=new WeakMap,mo=new WeakMap,go=new WeakMap,bo=new WeakMap;class Xu extends _r{constructor(){super();Y(this,Ql);Y(this,th);Y(this,Pi);Y(this,yo);Y(this,Di);it(this,"dataRefresh",t=>{var l=this.cell.closest("tr").data;for(var c of f(this,Di).data.datasets){var t=l[c["data-bind"]];switch(typeof t){case"string":c.data=t.split(",");break;case"object":Array.isArray(t)&&(c.data=t);break}}$(f(this,Pi)).height(28),setTimeout(()=>{f(this,yo).update()}),t||this.reset()})}connectedCallback(){tt(this,Ql,this.getRootNode().host),tt(this,th,this.closest("th,td")),this.shadowRoot.innerHTML=`
46
46
  <style>
47
47
  :host {
48
48
  height: 100%;
@@ -157,7 +157,7 @@
157
157
  </style>
158
158
 
159
159
  <div></div>
160
- `}}customElements.get("ng-col-mover-grip")||customElements.define("ng-col-mover-grip",Ku),customElements.get("ng-col-mover-indi")||customElements.define("ng-col-mover-indi",Zu);class Ju{constructor(C){Y(this,ve);Y(this,$r);Y(this,qr);Y(this,_o);Y(this,kr);Y(this,Ui);Y(this,Hr);it(this,"resetEvent",()=>{$(document).off("mouseup",f(this,Vi)),$(".ng-table thead",f(this,ve).body).off("mousedown",f(this,Co)),f(this,ve).body.querySelectorAll(".ng-table thead").forEach(C=>{C.removeEventListener("click",f(this,So))}),$(document).on("mouseup",f(this,Vi)),$(".ng-table thead",f(this,ve).body).on("mousedown",f(this,Co)),f(this,ve).body.querySelectorAll(".ng-table thead").forEach(C=>{C.addEventListener("click",f(this,So))})});Y(this,So,C=>{if(C.target.closest("ng-filter-button"))return;const t=C.currentTarget||C.target,l=getComputedStyle(t,":before"),c=getComputedStyle(t,":after");if(!(!l&&!c)){if(l){const i=Number(l.getPropertyValue("top").slice(0,-2)),u=6,a=Number(l.getPropertyValue("left").slice(0,-2));if(C.layerX>=a&&C.layerX<=a+6&&C.layerY>=i&&C.layerY<=i+u){var o=C.target.closest(".ng-container-left")||C.target.closest(".ng-container-body");if(o){var r=o.querySelectorAll("thead tr:nth-child(2) th:not(.dummy),thead tr:nth-child(2) td:not(.dummy)"),n=C.target.closest(".ng-container-left")?f(this,ve).body.querySelector(".ng-container-body"):f(this,ve).body.querySelector(".ng-container-right"),s=n.querySelector("thead tr:nth-child(2) th:first-child,thead tr:nth-child(2) td:first-child");const p=parseInt(r[r.length-1].dataset.col),m=r[r.length-1].colSpan;for(var e=0;e<m;e++)f(this,ve).body.querySelectorAll(`[data-col="${p+e}"] ng-col-expand:not(.expand)`).forEach(d=>{d.expand()});C.target.closest(".ng-container-body")?f(this,ve).body.querySelectorAll(".ng-container-right colgroup col:not(.dummy)").length==0?f(this,ve).columns.moveColumn(r[r.length-1],s):(f(this,ve).columns.moveColumn(r[r.length-1],s),f(this,ve).columns.moveColumn(r[r.length-1],s)):(f(this,ve).columns.moveColumn(r[r.length-1],s),f(this,ve).columns.moveColumn(r[r.length-1],s))}}}if(c){const i=Number(c.getPropertyValue("top").slice(0,-2)),u=6,a=Number(c.getPropertyValue("left").slice(0,-2));if(C.layerX>=a&&C.layerX<=a+6&&C.layerY>=i&&C.layerY<=i+u){var o=C.target.closest(".ng-container-body")||C.target.closest(".ng-container-right");if(o){var r=o.querySelector("thead tr:nth-child(2) th:first-child,thead tr:nth-child(2) td:first-child"),n=C.target.closest(".ng-container-body")?f(this,ve).body.querySelector(".ng-container-left"):f(this,ve).body.querySelector(".ng-container-body"),s=n.querySelectorAll("thead tr:nth-child(2) th:not(.dummy),thead tr:nth-child(2) td:not(.dummy)");const g=parseInt(r.dataset.col),S=r.colSpan;for(var e=0;e<S;e++)f(this,ve).body.querySelectorAll(`[data-col="${g+e}"] ng-col-expand:not(.expand)`).forEach(I=>{I.expand()});C.target.closest(".ng-container-right")?(f(this,ve).columns.moveColumn(r,s[s.length-1]),f(this,ve).columns.moveColumn(s[s.length-1],r)):(f(this,ve).columns.moveColumn(r,s[s.length-1]),f(this,ve).columns.moveColumn(r,s[s.length-1]))}}}}});Y(this,ou,C=>{if(!["INPUT"].includes(C.target.tagName)){var t=C.target.getBoundingClientRect();C.offsetX=C.targetTouches[0].pageX-t.left,C.pageX=C.changedTouches[0].pageX,C.pageY=C.changedTouches[0].pageY,C.buttons=1,f(this,Eo).call(this,C),$(document).on("touchmove",l=>f(this,ko).call(this,l))}});Y(this,ko,C=>{var t=C.target.getBoundingClientRect();C.offsetX=C.targetTouches[0].pageX-t.left,C.pageX=C.changedTouches[0].pageX,C.pageY=C.changedTouches[0].pageY,C.clientX=C.changedTouches[0].clientX,f(this,Wi).call(this,C)});Y(this,au,C=>{C.clientX=C.changedTouches[0].clientX,f(this,Vi).call(this,C)});Y(this,Co,C=>{H.j.querySelectorAll(f(this,ve)).attr("col-movable")=="true"&&C.target.tagName!="NG-FILTER-BUTTON"&&(tt(this,Ui,!0),setTimeout(()=>{f(this,Ui)&&f(this,Eo).call(this,C)},500))});Y(this,Eo,C=>{if(C.buttons!=1||C.altKey||C.ctrlKey||C.shiftkey||["INPUT"].includes(C.target.tagName))return;var t=C.pageX-$(C.target).offset().left;if(t<=3||$(C.target).width()-t<=3)return;C.target.closest(".ng-container-right")&&f(this,ve).body.querySelector("ng-hscrollbar").scrollToEnd();var l=C.target.closest("th,td");tt(this,kr,{col:parseInt(l.dataset.col),row:C.target.closest("tr").sectionRowIndex,target:l}),tt(this,_o,t+f(this,$r)[0].getBoundingClientRect().x);const c=f(this,$r)[0].shadowRoot.querySelector("span");c.innerHTML=$(C.target).html(),$(c).css({font:$(l).css("font")}),f(this,$r).show(),f(this,$r).width($(l).width()),f(this,$r).height($(l).height()),f(this,$r).offset({top:$(l).offset().top-1}),$(document).on("mousemove",f(this,Wi)),f(this,Ao).call(this,C.pageX);const o=f(this,ve).tableUtils.getElement("thead",f(this,kr).row,C.clientX);f(this,qr).height($(o).height())});Y(this,Vi,C=>{if(tt(this,Ui,!1),$(document).off("mousemove",f(this,Wi)),$(document).off("touchmove",f(this,ko)),f(this,Hr)&&$(f(this,Hr).target).css({cursor:f(this,Hr).cursor}),f(this,kr)){var t=f(this,ve).tableUtils.getElement("thead",f(this,kr).row,C.clientX);f(this,ve).columns.moveColumn(f(this,kr).target,t)}tt(this,Hr,null),tt(this,kr,null),f(this,$r).hide(),f(this,qr).hide()});Y(this,Wi,C=>{if(f(this,kr)!=null){f(this,Hr)&&$(f(this,Hr).target).css({cursor:f(this,Hr).cursor}),tt(this,Hr,{target:C.target,cursor:$(C.target).css("cursor")}),$(C.target).css({cursor:C.target.closest("thead")||C.target.tagName=="ng-col-mover-grip"?"move":"not-allowed"});var t=f(this,ve).tableUtils.getElement("thead",f(this,kr).row,C.clientX);if(t)if(f(this,kr).col>parseInt(t.dataset.col)){var l=$(t).offset();f(this,qr).show(),f(this,qr).offset({left:parseInt(l.left-1),top:l.top})}else if(f(this,kr).col<parseInt(t.dataset.col)){var l=$(t).offset();f(this,qr).show(),f(this,qr).offset({left:parseInt(l.left+$(t).width()-1),top:l.top})}else f(this,qr).hide();f(this,Ao).call(this,C.pageX)}});Y(this,Ao,C=>{f(this,$r).offset({left:C-f(this,_o)})});tt(this,ve,C),$(".ng-container",f(this,ve).body).append($("<ng-col-mover-grip></ng-col-mover-grip>").hide()).append($("<ng-col-mover-indi></ng-col-mover-indi>").hide()),tt(this,$r,$("ng-col-mover-grip",f(this,ve).body)),tt(this,qr,$("ng-col-mover-indi",f(this,ve).body)),this.resetEvent()}}ve=new WeakMap,$r=new WeakMap,qr=new WeakMap,_o=new WeakMap,kr=new WeakMap,Ui=new WeakMap,Hr=new WeakMap,So=new WeakMap,ou=new WeakMap,ko=new WeakMap,au=new WeakMap,Co=new WeakMap,Eo=new WeakMap,Vi=new WeakMap,Wi=new WeakMap,Ao=new WeakMap;class Qu{constructor(C){Y(this,Ne);Y(this,Cr);Y(this,Er);Y(this,Ms);Y(this,Is);Y(this,zr);Y(this,Ar);Y(this,Ns);Y(this,Os,[]);it(this,"resetEvent",()=>{$(".ng-table > thead",f(this,Ne).body).off("mousemove",f(this,Mo)).off("mousedown",f(this,Io)).off("dblclick",f(this,To)),$(document).off("mouseup",f(this,Ro)),$(".ng-table > thead",f(this,Ne).body).on("mousemove",f(this,Mo)).on("mousedown",f(this,Io)).on("dblclick",f(this,To)),$(document).on("mouseup",f(this,Ro))});it(this,"autoFit",C=>{if(f(this,Ne).body)if(C){f(this,Ne).body.querySelector("ng-hscrollbar").scrollToHome(),tt(this,Os,[]);var t=0;$(".ng-container-body col",f(this,Ne).body).each((c,o)=>{f(this,Os).push({col:o,width:parseInt(o.getAttribute("width"))})}),f(this,Os).forEach(c=>{t+=c.width}),$(".ng-container-body > table",f(this,Ne).body).css({width:"100%","min-width":"100%"});var l=$(".ng-container-body",f(this,Ne).body).width();l!=0&&f(this,Os).forEach(c=>{var o=c.width*l/t;c.col.setAttribute("width",o)})}else $(".ng-container-body > table",f(this,Ne).body).css({width:"0","min-width":"0"}),f(this,Os).forEach(c=>{c.col.setAttribute("width",c.width)})});Y(this,To,C=>{C.target.style.cursor=="col-resize"&&f(this,sh).call(this,C)});Y(this,Ro,C=>{tt(this,Is,!1)});Y(this,Mo,C=>{if(!C.target.closest("ng-info")&&(C.target=C.target.closest("th,td"),!!C.target&&f(this,Ne).getAttribute("col-resizable")=="true"&&!(C.altKey||C.ctrlKey||C.shiftkey)))if(C.preventDefault(),C.offsetX<=2||C.offsetX>=C.target.offsetWidth-2){if(C.offsetX<=2&&f(this,Ne).tableUtils.isFirst(C.target)||C.offsetX>=C.target.offsetWidth-2&&f(this,Ne).tableUtils.isLast(C.target))return;C.target.style.cursor="col-resize"}else C.target.style.cursor="auto"});Y(this,lu,C=>{tt(this,Is,!0),setTimeout(()=>{f(this,Is)&&f(this,rh).call(this,C)},500)});Y(this,Io,C=>{const t=C.target.closest("th,td");!t||t.style.cursor!="col-resize"||(tt(this,Is,!0),setTimeout(()=>{f(this,Is)&&f(this,No).call(this,C)},500))});Y(this,rh,C=>{C.target=C.target.closest("th,td");var t=C.target.getBoundingClientRect();C.offsetX=C.targetTouches[0].pageX-t.left,C.pageX=C.changedTouches[0].pageX,C.buttons=1,f(this,No).call(this,C),f(this,Cr).is(":visible")?($(C.target).on("touchmove",l=>f(this,Xi).call(this,l)),$(C.target).on("touchend",l=>f(this,Gi).call(this,l))):($(C.target).off("touchmove",l=>f(this,Xi).call(this,l)),$(C.target).off("touchend",l=>f(this,Gi).call(this,l)))});Y(this,No,C=>{if(C.target=C.target.closest("th,td"),!(C.buttons!=1||C.altKey||C.ctrlKey||C.shiftkey)){if(tt(this,Ns,!!C.target.closest(".ng-container-right")),C.pageX-$(C.target).offset().left<=3){var t=$(`.col-indicator[data-col=${C.target.dataset.col}]`,f(this,Ne).body).not(".dummy")[0];tt(this,zr,f(this,Ne).tableUtils.prev(t)),tt(this,Ar,$(t))}else{if($(C.target).width()-C.offsetX>2)return;var l=parseInt(C.target.dataset.col)+C.target.colSpan-1,t=$(`.col-indicator[data-col=${l}]`,f(this,Ne).body).not(".dummy")[0];tt(this,zr,$(t)),tt(this,Ar,f(this,Ne).tableUtils.next(t))}f(this,Cr).show(),f(this,Er).offset({top:$(".ng-container-body",f(this,Ne).body).offset().top,left:f(this,Ar).offset().left-1}),f(this,Er).height(f(this,Ne).body.querySelector(".ng-container-body").offsetHeight),f(this,Ms).offset({top:$(".ng-container-body",f(this,Ne).body).offset().top}),f(this,Ki).call(this,C.pageX),$(f(this,Cr)).off("mousemove",f(this,Yi)).off("mouseup",f(this,si)).on("mousemove",f(this,Yi)).on("mouseup",f(this,si))}});Y(this,Xi,C=>{f(this,Ki).call(this,C.changedTouches[0].pageX)});Y(this,Yi,C=>{f(this,Ki).call(this,C.pageX)});Y(this,Gi,C=>{$(C.target).off("touchmove",t=>f(this,Xi).call(this,t)),$(C.target).off("touchend",t=>f(this,Gi).call(this,t)),f(this,si).call(this,C)});Y(this,si,C=>{if(!f(this,Er).is(":visible"))return;var t;f(this,Ns)?t=f(this,Ar).offset().left-f(this,Er).offset().left+f(this,Ar).width():t=f(this,Er).offset().left-f(this,zr).offset().left+1,t<=1&&(t=0);const l=f(this,Ns)?f(this,Ar)[0].dataset.col:f(this,zr)[0].dataset.col;f(this,Ne).columns.width(l,t),$(f(this,Cr)).off("mousemove",f(this,Yi)),$(f(this,Cr)).off("mouseup",f(this,si)),f(this,Cr).hide()});Y(this,Ki,C=>{!f(this,Ns)&&C<f(this,zr).offset().left&&(C=f(this,zr).offset().left),f(this,Er).offset({left:C});var t=parseInt(f(this,Er).offset().left),l,c,o;f(this,Ns)?(c=f(this,Ar).width()+f(this,Ar).offset().left-f(this,Er).offset().left,o=c<10?10:c-1,l=parseInt(f(this,Ar).width()+f(this,Ar).offset().left-f(this,Er).offset().left)):(c=parseInt(t-f(this,zr).offset().left),o=c,l=parseInt(t-f(this,zr).offset().left+1),t=t-o),l<=1&&(l=0),f(this,Ms).offset({left:t}),f(this,Ms).width(o),f(this,Ms).find("span").text(l)});Y(this,sh,C=>{var t=C.target.closest("th,td"),l=f(this,Ne).tableUtils.prev(t),c=f(this,Ne).tableUtils.next(t),o=f(this,Ne).getBand(t.dataset.col)==H.BAND.RIGHT?C.offsetX<=2?$(t):c:C.offsetX<=2?l:$(t);f(this,Ne).setColumnWidthFit(o[0].dataset.col)});tt(this,Ne,C),tt(this,Cr,$('<div class="resizer-col-panel"><div class="grip"></div><div class="tooltip"><div></div><span></span><div></div></div></div>').hide()),$(f(this,Ne).body).append(f(this,Cr)),tt(this,Er,f(this,Cr).find(".grip")),tt(this,Ms,f(this,Cr).find(".tooltip")),this.resetEvent()}}Ne=new WeakMap,Cr=new WeakMap,Er=new WeakMap,Ms=new WeakMap,Is=new WeakMap,zr=new WeakMap,Ar=new WeakMap,Ns=new WeakMap,Os=new WeakMap,To=new WeakMap,Ro=new WeakMap,Mo=new WeakMap,lu=new WeakMap,Io=new WeakMap,rh=new WeakMap,No=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Gi=new WeakMap,si=new WeakMap,Ki=new WeakMap,sh=new WeakMap;class td{constructor(C){Y(this,ce);it(this,"count",()=>f(this,ce).activeTmpl.querySelectorAll("[data-bind]").length);it(this,"info",C=>{const t=l=>{if(!l)return null;const c=f(this,ce).body.querySelectorAll(`thead [data-col="${l.dataset.col}"]`);return{name:l.dataset.bind,type:(l.dataset.type||"string").toLocaleLowerCase(),desc:c.length>0?c[c.length-1].getAttribute("title"):null}};return C?t(f(this,ce).activeTmpl.querySelector(`[data-bind="${C}"]`)):Array.from(f(this,ce).activeTmpl.querySelectorAll("[data-bind]")).filter(l=>l.dataset.bind!=="rowState").map(l=>t(l))});Y(this,ii,(C,t)=>{var l=Array.from(C.querySelectorAll("col"));return l[t]});Y(this,Lr,(C,t,l)=>{var c=[];if(!C)return c;for(var o=t;o<=l;o++)c=c.concat(Array.from(C.querySelectorAll(`[data-col="${o}"]:not(.dummy)`)));return c});Y(this,Zi,(C,t,l)=>{const c=(r,n)=>{const s=parseInt(n.dataset.col);return r.closest("thead,tbody,tfoot"),r.querySelector(`[data-col="${s}"]`)},o=(r,n)=>{const s=parseInt(n.dataset.col),e=n.colSpan||1,i=!r.closest("thead,tbody,tfoot");var u=r.querySelectorAll("th:not(.tmp),td:not(.tmp)");for(var a of u)if(parseInt(a.dataset.col)>s+e-1)return a};return parseInt(t.dataset.col)>parseInt(l.dataset.col)?c(C,l):o(C,l)});Y(this,Oo,C=>{const t={org:{thead:{cells:[]},tfoot:{cells:[]},tbody:{cells:[]},fixed:{cells:[]},cols:[]},thead:{cells:[]},tfoot:{cells:[]},tbody:{cells:[]},fixed:{cells:[]},template:{cells:[]},cols:[]},l=C.colSpan||1,c=C.closest("table"),o=parseInt(C.dataset.col),r=C.closest("tr").sectionRowIndex;$("thead tr",c).each((e,i)=>{if(i.sectionRowIndex<r&&i.sectionRowIndex!=0)return!0;t.thead.cells=t.thead.cells.concat(f(this,Lr).call(this,i,o,o+l-1))}),t.tfoot.cells=f(this,Lr).call(this,c.querySelector("tfoot"),o,o+l-1),t.tbody.cells=f(this,Lr).call(this,c.querySelector("tbody.bindable"),o,o+l-1),t.fixed.cells=f(this,Lr).call(this,c.querySelector("tbody.fixed"),o,o+l-1);const n=f(this,ce).shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout");t.org.thead.cells=f(this,Lr).call(this,n.currentTable.querySelector("thead"),o,o+l-1),t.org.tfoot.cells=f(this,Lr).call(this,n.currentTable.querySelector("tfoot"),o,o+l-1),t.org.tbody.cells=f(this,Lr).call(this,n.currentTable.querySelector("tbody.bindable"),o,o+l-1),t.org.fixed.cells=f(this,Lr).call(this,n.currentTable.querySelector("tbody.fixed"),o,o+l-1),f(this,ce).template.each((e,i)=>{t.template.cells=t.template.cells.concat(f(this,Lr).call(this,i,o,o+l-1))});for(var s=o;s<=o+l-1;s++)t.cols.push(f(this,ii).call(this,f(this,ce).body,s));for(var s=o;s<=o+l-1;s++)t.org.cols.push(f(this,ii).call(this,n.currentTable,s));return t});Y(this,ih,(C,t,l,c)=>{if(C.closest("tr").rowIndex!=t.closest("tr").rowIndex)return!1;const o=parseInt(C.dataset.col),r=C.colSpan;parseInt(t.dataset.col),t.colSpan;for(var n of[l.thead.cells,l.tfoot.cells,l.tbody.cells,l.fixed.cells,l.template.cells])for(var s of n){const e=parseInt(s.dataset.col),i=s.colSpan;if(e<o||e+i-1>o+r-1)return!1}return!0});it(this,"moveColumn",(C,t)=>{if(!C||!t)return!1;const l=f(this,ce).shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout"),c=f(this,Oo).call(this,C),o=f(this,Oo).call(this,t),r=t.closest("table"),n=!!(C.closest(".ng-container-left")||t.closest(".ng-container-left")),s=!!(C.closest(".ng-container-right")||t.closest(".ng-container-right"));if(!f(this,ih).call(this,C,t,c,o))return!1;for(var e of[c.thead.cells,c.tfoot.cells,c.tbody.cells,c.fixed.cells])for(var i of e){H.j.querySelectorAll(i).addClass("tmp");const b=i.closest("tr").rowIndex,g=r.querySelectorAll("tr")[b];var u=f(this,Zi).call(this,g,C,t);u?g.insertBefore(i,u):g.appendChild(i)}for(var e of[c.org.thead.cells,c.org.tfoot.cells,c.org.tbody.cells,c.org.fixed.cells])for(var i of e){H.j.querySelectorAll(i).addClass("tmp");const S=i.closest("table"),E=i.closest("tr").rowIndex,I=S.querySelectorAll("tr")[E];var u=f(this,Zi).call(this,I,C,t);u?I.insertBefore(i,u):I.appendChild(i)}for(var i of c.template.cells){H.j.querySelectorAll(i).addClass("tmp");const g=i.closest("tr");var u=f(this,Zi).call(this,g,C,t);u?g.insertBefore(i,u):g.appendChild(i)}var a;parseInt(C.dataset.col)>parseInt(t.dataset.col)?a=parseInt(t.dataset.col):a=parseInt(t.dataset.col)+(t.colSpan||1)-1+(parseInt(C.dataset.col)>parseInt(t.dataset.col)?0:1);let h=f(this,ii).call(this,f(this,ce).body,a);const p=t.closest("table")==h.closest("table");for(var m of c.cols)m&&(p?t.closest("table").querySelector("colgroup").insertBefore(m,h):t.closest("table").querySelector("colgroup").appendChild(m));for(var m of c.org.cols)h=f(this,ii).call(this,l.currentTable,a),m&&m.closest("colgroup").insertBefore(m,h);for(var e of[c.thead.cells,c.tfoot.cells,c.tbody.cells,c.fixed.cells])for(var i of e)H.j.querySelectorAll(i).removeClass("tmp");for(var e of[c.org.thead.cells,c.org.tfoot.cells,c.org.tbody.cells,c.org.fixed.cells])for(var i of e)H.j.querySelectorAll(i).removeClass("tmp");for(var i of c.template.cells)H.j.querySelectorAll(i).removeClass("tmp");if(f(this,ce).body.querySelectorAll(".ng-container-left col").forEach(b=>{b.setAttribute("fixed","left")}),f(this,ce).body.querySelectorAll(".ng-container-left .col-indicator").forEach(b=>{b.setAttribute("fixed","left")}),f(this,ce).body.querySelectorAll(".ng-container-right col").forEach(b=>{b.setAttribute("fixed","right")}),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{b.setAttribute("fixed","right")}),f(this,ce).body.querySelectorAll(".ng-container-body col").forEach(b=>{b.removeAttribute("fixed")}),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{b.removeAttribute("fixed")}),l.currentTable.querySelectorAll("colgroup col").forEach(b=>{b.removeAttribute("fixed")}),$("th,td",f(this,ce).template).each((b,g)=>{g.removeAttribute("fixed")}),$("th,td",l.currentTable).each((b,g)=>{g.removeAttribute("fixed")}),f(this,ce).body.querySelectorAll(".ng-container-left .col-indicator").forEach(b=>{$(`[data-col="${b.dataset.col}"]`,f(this,ce).template).each((g,S)=>{S.setAttribute("fixed","left")}),$(`[data-col="${b.dataset.col}"]`,l.currentTable).each((g,S)=>{S.setAttribute("fixed","left")}),$("colgroup col",l.currentTable).each((g,S)=>{g<=parseInt(b.dataset.col)&&S.setAttribute("fixed","left")})}),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{$(`[data-col="${b.dataset.col}"]`,f(this,ce).template).each((g,S)=>{S.setAttribute("fixed","right")}),$(`[data-col="${b.dataset.col}"]`,l.currentTable).each((g,S)=>{S.setAttribute("fixed","right")})}),f(this,ce).resetTemplate(),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{$("colgroup col",l.currentTable).each((g,S)=>{g>=parseInt(b.dataset.col)&&S.setAttribute("fixed","right")})}),n){var d=t.closest(".ng-container-body")?-C.offsetWidth:0;$(".ng-container-left .col-indicator",f(this,ce).body).each((b,g)=>{d+=g.offsetWidth}),$(".ng-container-left",f(this,ce).body).css({width:d,"min-width":d})}if(s){var d=t.closest(".ng-container-body")?-C.offsetWidth:0;$(".ng-container-right .col-indicator",f(this,ce).body).each((g,S)=>{d+=S.offsetWidth}),$(".ng-container-right",f(this,ce).body).css({width:d,"min-width":d})}f(this,ce).refreshData()});it(this,"width",(C,t)=>{t=parseFloat(t);const l=f(this,ce).body.querySelector(`colgroup col[data-col="${C}"]`),c=!!l.closest(".ng-container-left"),o=!!l.closest(".ng-container-right"),r=!!l.closest(".ng-container-body"),n=c?"left":o?"right":"body";if(r)if(f(this,ce).getAttribute("auto-fit-col")=="true"){var s=0;$(".ng-container-body .col-indicator",f(this,ce).body).not(`[data-col=${C}]`).each((u,a)=>{s+=a.offsetWidth});const i=$(".ng-container-body",f(this,ce).body).width();$(".ng-container-body col",f(this,ce).body).each((u,a)=>{var h=parseInt(C==a.dataset.col?t:a.getAttribute("width"))*i/s;a.setAttribute("width",h)})}else l.setAttribute("width",t);else{var e=0;$(`.ng-container-${n} .col-indicator`,f(this,ce).body).not(`[data-col=${C}]`).each((i,u)=>{e+=parseInt(u.offsetWidth)}),$(`.ng-container-${n}`,f(this,ce).body).css({width:parseInt(e+t),"min-width":parseInt(e+t)}),l.setAttribute("width",t)}});tt(this,ce,C)}}ce=new WeakMap,ii=new WeakMap,Lr=new WeakMap,Zi=new WeakMap,Oo=new WeakMap,ih=new WeakMap;class ed extends ti{constructor(){super();Y(this,nh,10);Y(this,Ji);Y(this,De);Y(this,nr);Y(this,jo);Y(this,js);Y(this,ni);Y(this,Qi);it(this,"dataRefresh",t=>{f(this,nr)&&(f(this,oh).call(this)?H.j.querySelectorAll(this).removeClass("invalid"):H.j.querySelectorAll(this).addClass("invalid")),f(this,Ji).innerHTML=this.getDisplayText()||"Select",t||this.reset()});Y(this,oh,()=>{if(H.isNull(this.value))return!0;var t=this.multi?this.value.split(this.multiSeparator):[this.value];for(var l of t){var c=f(this,nr).findIndex(o=>l==o[f(this,js)]);if(c<0)return!1}return!0});Y(this,ah,()=>{if(this.owner){if(tt(this,De,this.owner.shadowRoot.querySelector("ng-combo-panel")),this.owner.shadowRoot.querySelectorAll("ng-combo-panel").length>1)throw"too many ng-combo-panel";var t=this.getAttribute("data-source");t&&this.owner&&this.owner.exprFunction}});Y(this,lh,t=>{if(console.log(f(this,nr)),!!f(this,nr)){console.log(f(this,nr)),f(this,De).col=this.cell.dataset.col,f(this,De).row=this.cell.closest("tr").sectionRowIndex,f(this,nr).length>f(this,nh)?H.j.querySelectorAll(f(this,De)).addClass("expand"):H.j.querySelectorAll(f(this,De)).removeClass("expand"),this.multi?H.j.querySelectorAll(f(this,De)).addClass("multi"):H.j.querySelectorAll(f(this,De)).removeClass("multi"),f(this,De).refresh(this,f(this,nr),f(this,js),f(this,Qi));var l=$(".btn1",this.shadowRoot).offset().left-$(this.owner).offset().left;l+$(f(this,De)).width()>$(this.owner).width()&&(l=$(".btn2",this.shadowRoot).offset().left-$(this.owner).offset().left-$(f(this,De)).width()+8),l<0&&(l=0);var c=Math.min(f(this,nr).length,f(this,jo))*26;this.multi?(H.j.querySelectorAll(f(this,De)).hasClass("expand")&&(c+=12,c+=3,c+=24),c+=2,c+=3,c+=25):(H.j.querySelectorAll(f(this,De)).hasClass("expand")&&(c+=12,c+=3,c+=24),c+=3);var o=$(".btn1",this.shadowRoot).offset().top+$(".btn1",this.shadowRoot).height()-$(this.owner).offset().top+3;o+c>$(this.owner).height()&&(o-=c+$(".btn1",this.shadowRoot).height()+6);var r=this.getAttribute("template");r&&console.error("logic error !!!!"),$(f(this,De)).css({left:l,top:o,height:c,"min-height":c}).show(),H.j.querySelectorAll(f(this,De)).hasClass("expand")&&$("div",f(this,De)).eq(0).find("input").focus().val("")}});Y(this,hh,t=>{t.target.closest("ng-combo-panel")||(f(this,De).row=f(this,De).col=-1,$(f(this,De)).hide())});Y(this,hu,()=>"a")}connectedCallback(){this.multi=this.getAttribute("multi")=="true",this.multiSeparator=this.getAttribute("multi-separator")||",",tt(this,jo,this.getAttribute("rows")||5),tt(this,js,this.getAttribute("code")||"code"),tt(this,ni,this.getAttribute("codename")||"codename"),tt(this,Qi,(this.getAttribute("items")||f(this,ni)||"").split(",")),f(this,Qi).unshift("CHK");var t=this.querySelector("datalist");t&&(tt(this,nr,[]),t.querySelectorAll("option").forEach(n=>{const s=n.getAttribute(f(this,js)),e=n.getAttribute(f(this,ni));s&&e&&f(this,nr).push({[f(this,js)]:s,[f(this,ni)]:e})})),this.shadowRoot.innerHTML=`
160
+ `}}customElements.get("ng-col-mover-grip")||customElements.define("ng-col-mover-grip",Ku),customElements.get("ng-col-mover-indi")||customElements.define("ng-col-mover-indi",Zu);class Ju{constructor(C){Y(this,ve);Y(this,Lr);Y(this,qr);Y(this,_o);Y(this,kr);Y(this,Ui);Y(this,Hr);it(this,"resetEvent",()=>{$(document).off("mouseup",f(this,Vi)),$(".ng-table thead",f(this,ve).body).off("mousedown",f(this,Co)),f(this,ve).body.querySelectorAll(".ng-table thead").forEach(C=>{C.removeEventListener("click",f(this,So))}),$(document).on("mouseup",f(this,Vi)),$(".ng-table thead",f(this,ve).body).on("mousedown",f(this,Co)),f(this,ve).body.querySelectorAll(".ng-table thead").forEach(C=>{C.addEventListener("click",f(this,So))})});Y(this,So,C=>{if(C.target.closest("ng-filter-button"))return;const t=C.currentTarget||C.target,l=getComputedStyle(t,":before"),c=getComputedStyle(t,":after");if(!(!l&&!c)){if(l){const i=Number(l.getPropertyValue("top").slice(0,-2)),u=6,a=Number(l.getPropertyValue("left").slice(0,-2));if(C.layerX>=a&&C.layerX<=a+6&&C.layerY>=i&&C.layerY<=i+u){var o=C.target.closest(".ng-container-left")||C.target.closest(".ng-container-body");if(o){var r=o.querySelectorAll("thead tr:nth-child(2) th:not(.dummy),thead tr:nth-child(2) td:not(.dummy)"),n=C.target.closest(".ng-container-left")?f(this,ve).body.querySelector(".ng-container-body"):f(this,ve).body.querySelector(".ng-container-right"),s=n.querySelector("thead tr:nth-child(2) th:first-child,thead tr:nth-child(2) td:first-child");const p=parseInt(r[r.length-1].dataset.col),m=r[r.length-1].colSpan;for(var e=0;e<m;e++)f(this,ve).body.querySelectorAll(`[data-col="${p+e}"] ng-col-expand:not(.expand)`).forEach(d=>{d.expand()});C.target.closest(".ng-container-body")?f(this,ve).body.querySelectorAll(".ng-container-right colgroup col:not(.dummy)").length==0?f(this,ve).columns.moveColumn(r[r.length-1],s):(f(this,ve).columns.moveColumn(r[r.length-1],s),f(this,ve).columns.moveColumn(r[r.length-1],s)):(f(this,ve).columns.moveColumn(r[r.length-1],s),f(this,ve).columns.moveColumn(r[r.length-1],s))}}}if(c){const i=Number(c.getPropertyValue("top").slice(0,-2)),u=6,a=Number(c.getPropertyValue("left").slice(0,-2));if(C.layerX>=a&&C.layerX<=a+6&&C.layerY>=i&&C.layerY<=i+u){var o=C.target.closest(".ng-container-body")||C.target.closest(".ng-container-right");if(o){var r=o.querySelector("thead tr:nth-child(2) th:first-child,thead tr:nth-child(2) td:first-child"),n=C.target.closest(".ng-container-body")?f(this,ve).body.querySelector(".ng-container-left"):f(this,ve).body.querySelector(".ng-container-body"),s=n.querySelectorAll("thead tr:nth-child(2) th:not(.dummy),thead tr:nth-child(2) td:not(.dummy)");const g=parseInt(r.dataset.col),S=r.colSpan;for(var e=0;e<S;e++)f(this,ve).body.querySelectorAll(`[data-col="${g+e}"] ng-col-expand:not(.expand)`).forEach(I=>{I.expand()});C.target.closest(".ng-container-right")?(f(this,ve).columns.moveColumn(r,s[s.length-1]),f(this,ve).columns.moveColumn(s[s.length-1],r)):(f(this,ve).columns.moveColumn(r,s[s.length-1]),f(this,ve).columns.moveColumn(r,s[s.length-1]))}}}}});Y(this,ou,C=>{if(!["INPUT"].includes(C.target.tagName)){var t=C.target.getBoundingClientRect();C.offsetX=C.targetTouches[0].pageX-t.left,C.pageX=C.changedTouches[0].pageX,C.pageY=C.changedTouches[0].pageY,C.buttons=1,f(this,Eo).call(this,C),$(document).on("touchmove",l=>f(this,ko).call(this,l))}});Y(this,ko,C=>{var t=C.target.getBoundingClientRect();C.offsetX=C.targetTouches[0].pageX-t.left,C.pageX=C.changedTouches[0].pageX,C.pageY=C.changedTouches[0].pageY,C.clientX=C.changedTouches[0].clientX,f(this,Wi).call(this,C)});Y(this,au,C=>{C.clientX=C.changedTouches[0].clientX,f(this,Vi).call(this,C)});Y(this,Co,C=>{H.j.querySelectorAll(f(this,ve)).attr("col-movable")=="true"&&C.target.tagName!="NG-FILTER-BUTTON"&&(tt(this,Ui,!0),setTimeout(()=>{f(this,Ui)&&f(this,Eo).call(this,C)},500))});Y(this,Eo,C=>{if(C.buttons!=1||C.altKey||C.ctrlKey||C.shiftkey||["INPUT"].includes(C.target.tagName))return;var t=C.pageX-$(C.target).offset().left;if(t<=3||$(C.target).width()-t<=3)return;C.target.closest(".ng-container-right")&&f(this,ve).body.querySelector("ng-hscrollbar").scrollToEnd();var l=C.target.closest("th,td");tt(this,kr,{col:parseInt(l.dataset.col),row:C.target.closest("tr").sectionRowIndex,target:l}),tt(this,_o,t+f(this,Lr)[0].getBoundingClientRect().x);const c=f(this,Lr)[0].shadowRoot.querySelector("span");c.innerHTML=$(C.target).html(),$(c).css({font:$(l).css("font")}),f(this,Lr).show(),f(this,Lr).width($(l).width()),f(this,Lr).height($(l).height()),f(this,Lr).offset({top:$(l).offset().top-1}),$(document).on("mousemove",f(this,Wi)),f(this,Ao).call(this,C.pageX);const o=f(this,ve).tableUtils.getElement("thead",f(this,kr).row,C.clientX);f(this,qr).height($(o).height())});Y(this,Vi,C=>{if(tt(this,Ui,!1),$(document).off("mousemove",f(this,Wi)),$(document).off("touchmove",f(this,ko)),f(this,Hr)&&$(f(this,Hr).target).css({cursor:f(this,Hr).cursor}),f(this,kr)){var t=f(this,ve).tableUtils.getElement("thead",f(this,kr).row,C.clientX);f(this,ve).columns.moveColumn(f(this,kr).target,t)}tt(this,Hr,null),tt(this,kr,null),f(this,Lr).hide(),f(this,qr).hide()});Y(this,Wi,C=>{if(f(this,kr)!=null){f(this,Hr)&&$(f(this,Hr).target).css({cursor:f(this,Hr).cursor}),tt(this,Hr,{target:C.target,cursor:$(C.target).css("cursor")}),$(C.target).css({cursor:C.target.closest("thead")||C.target.tagName=="ng-col-mover-grip"?"move":"not-allowed"});var t=f(this,ve).tableUtils.getElement("thead",f(this,kr).row,C.clientX);if(t)if(f(this,kr).col>parseInt(t.dataset.col)){var l=$(t).offset();f(this,qr).show(),f(this,qr).offset({left:parseInt(l.left-1),top:l.top})}else if(f(this,kr).col<parseInt(t.dataset.col)){var l=$(t).offset();f(this,qr).show(),f(this,qr).offset({left:parseInt(l.left+$(t).width()-1),top:l.top})}else f(this,qr).hide();f(this,Ao).call(this,C.pageX)}});Y(this,Ao,C=>{f(this,Lr).offset({left:C-f(this,_o)})});tt(this,ve,C),$(".ng-container",f(this,ve).body).append($("<ng-col-mover-grip></ng-col-mover-grip>").hide()).append($("<ng-col-mover-indi></ng-col-mover-indi>").hide()),tt(this,Lr,$("ng-col-mover-grip",f(this,ve).body)),tt(this,qr,$("ng-col-mover-indi",f(this,ve).body)),this.resetEvent()}}ve=new WeakMap,Lr=new WeakMap,qr=new WeakMap,_o=new WeakMap,kr=new WeakMap,Ui=new WeakMap,Hr=new WeakMap,So=new WeakMap,ou=new WeakMap,ko=new WeakMap,au=new WeakMap,Co=new WeakMap,Eo=new WeakMap,Vi=new WeakMap,Wi=new WeakMap,Ao=new WeakMap;class Qu{constructor(C){Y(this,Ne);Y(this,Cr);Y(this,Er);Y(this,Ms);Y(this,Is);Y(this,zr);Y(this,Ar);Y(this,Ns);Y(this,Os,[]);it(this,"resetEvent",()=>{$(".ng-table > thead",f(this,Ne).body).off("mousemove",f(this,Mo)).off("mousedown",f(this,Io)).off("dblclick",f(this,To)),$(document).off("mouseup",f(this,Ro)),$(".ng-table > thead",f(this,Ne).body).on("mousemove",f(this,Mo)).on("mousedown",f(this,Io)).on("dblclick",f(this,To)),$(document).on("mouseup",f(this,Ro))});it(this,"autoFit",C=>{if(f(this,Ne).body)if(C){f(this,Ne).body.querySelector("ng-hscrollbar").scrollToHome(),tt(this,Os,[]);var t=0;$(".ng-container-body col",f(this,Ne).body).each((c,o)=>{f(this,Os).push({col:o,width:parseInt(o.getAttribute("width"))})}),f(this,Os).forEach(c=>{t+=c.width}),$(".ng-container-body > table",f(this,Ne).body).css({width:"100%","min-width":"100%"});var l=$(".ng-container-body",f(this,Ne).body).width();l!=0&&f(this,Os).forEach(c=>{var o=c.width*l/t;c.col.setAttribute("width",o)})}else $(".ng-container-body > table",f(this,Ne).body).css({width:"0","min-width":"0"}),f(this,Os).forEach(c=>{c.col.setAttribute("width",c.width)})});Y(this,To,C=>{C.target.style.cursor=="col-resize"&&f(this,sh).call(this,C)});Y(this,Ro,C=>{tt(this,Is,!1)});Y(this,Mo,C=>{if(!C.target.closest("ng-info")&&(C.target=C.target.closest("th,td"),!!C.target&&f(this,Ne).getAttribute("col-resizable")=="true"&&!(C.altKey||C.ctrlKey||C.shiftkey)))if(C.preventDefault(),C.offsetX<=2||C.offsetX>=C.target.offsetWidth-2){if(C.offsetX<=2&&f(this,Ne).tableUtils.isFirst(C.target)||C.offsetX>=C.target.offsetWidth-2&&f(this,Ne).tableUtils.isLast(C.target))return;C.target.style.cursor="col-resize"}else C.target.style.cursor="auto"});Y(this,lu,C=>{tt(this,Is,!0),setTimeout(()=>{f(this,Is)&&f(this,rh).call(this,C)},500)});Y(this,Io,C=>{const t=C.target.closest("th,td");!t||t.style.cursor!="col-resize"||(tt(this,Is,!0),setTimeout(()=>{f(this,Is)&&f(this,No).call(this,C)},500))});Y(this,rh,C=>{C.target=C.target.closest("th,td");var t=C.target.getBoundingClientRect();C.offsetX=C.targetTouches[0].pageX-t.left,C.pageX=C.changedTouches[0].pageX,C.buttons=1,f(this,No).call(this,C),f(this,Cr).is(":visible")?($(C.target).on("touchmove",l=>f(this,Xi).call(this,l)),$(C.target).on("touchend",l=>f(this,Gi).call(this,l))):($(C.target).off("touchmove",l=>f(this,Xi).call(this,l)),$(C.target).off("touchend",l=>f(this,Gi).call(this,l)))});Y(this,No,C=>{if(C.target=C.target.closest("th,td"),!(C.buttons!=1||C.altKey||C.ctrlKey||C.shiftkey)){if(tt(this,Ns,!!C.target.closest(".ng-container-right")),C.pageX-$(C.target).offset().left<=3){var t=$(`.col-indicator[data-col=${C.target.dataset.col}]`,f(this,Ne).body).not(".dummy")[0];tt(this,zr,f(this,Ne).tableUtils.prev(t)),tt(this,Ar,$(t))}else{if($(C.target).width()-C.offsetX>2)return;var l=parseInt(C.target.dataset.col)+C.target.colSpan-1,t=$(`.col-indicator[data-col=${l}]`,f(this,Ne).body).not(".dummy")[0];tt(this,zr,$(t)),tt(this,Ar,f(this,Ne).tableUtils.next(t))}f(this,Cr).show(),f(this,Er).offset({top:$(".ng-container-body",f(this,Ne).body).offset().top,left:f(this,Ar).offset().left-1}),f(this,Er).height(f(this,Ne).body.querySelector(".ng-container-body").offsetHeight),f(this,Ms).offset({top:$(".ng-container-body",f(this,Ne).body).offset().top}),f(this,Ki).call(this,C.pageX),$(f(this,Cr)).off("mousemove",f(this,Yi)).off("mouseup",f(this,si)).on("mousemove",f(this,Yi)).on("mouseup",f(this,si))}});Y(this,Xi,C=>{f(this,Ki).call(this,C.changedTouches[0].pageX)});Y(this,Yi,C=>{f(this,Ki).call(this,C.pageX)});Y(this,Gi,C=>{$(C.target).off("touchmove",t=>f(this,Xi).call(this,t)),$(C.target).off("touchend",t=>f(this,Gi).call(this,t)),f(this,si).call(this,C)});Y(this,si,C=>{if(!f(this,Er).is(":visible"))return;var t;f(this,Ns)?t=f(this,Ar).offset().left-f(this,Er).offset().left+f(this,Ar).width():t=f(this,Er).offset().left-f(this,zr).offset().left+1,t<=1&&(t=0);const l=f(this,Ns)?f(this,Ar)[0].dataset.col:f(this,zr)[0].dataset.col;f(this,Ne).columns.width(l,t),$(f(this,Cr)).off("mousemove",f(this,Yi)),$(f(this,Cr)).off("mouseup",f(this,si)),f(this,Cr).hide()});Y(this,Ki,C=>{!f(this,Ns)&&C<f(this,zr).offset().left&&(C=f(this,zr).offset().left),f(this,Er).offset({left:C});var t=parseInt(f(this,Er).offset().left),l,c,o;f(this,Ns)?(c=f(this,Ar).width()+f(this,Ar).offset().left-f(this,Er).offset().left,o=c<10?10:c-1,l=parseInt(f(this,Ar).width()+f(this,Ar).offset().left-f(this,Er).offset().left)):(c=parseInt(t-f(this,zr).offset().left),o=c,l=parseInt(t-f(this,zr).offset().left+1),t=t-o),l<=1&&(l=0),f(this,Ms).offset({left:t}),f(this,Ms).width(o),f(this,Ms).find("span").text(l)});Y(this,sh,C=>{var t=C.target.closest("th,td"),l=f(this,Ne).tableUtils.prev(t),c=f(this,Ne).tableUtils.next(t),o=f(this,Ne).getBand(t.dataset.col)==H.BAND.RIGHT?C.offsetX<=2?$(t):c:C.offsetX<=2?l:$(t);f(this,Ne).setColumnWidthFit(o[0].dataset.col)});tt(this,Ne,C),tt(this,Cr,$('<div class="resizer-col-panel"><div class="grip"></div><div class="tooltip"><div></div><span></span><div></div></div></div>').hide()),$(f(this,Ne).body).append(f(this,Cr)),tt(this,Er,f(this,Cr).find(".grip")),tt(this,Ms,f(this,Cr).find(".tooltip")),this.resetEvent()}}Ne=new WeakMap,Cr=new WeakMap,Er=new WeakMap,Ms=new WeakMap,Is=new WeakMap,zr=new WeakMap,Ar=new WeakMap,Ns=new WeakMap,Os=new WeakMap,To=new WeakMap,Ro=new WeakMap,Mo=new WeakMap,lu=new WeakMap,Io=new WeakMap,rh=new WeakMap,No=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Gi=new WeakMap,si=new WeakMap,Ki=new WeakMap,sh=new WeakMap;class td{constructor(C){Y(this,ce);it(this,"count",()=>f(this,ce).activeTmpl.querySelectorAll("[data-bind]").length);it(this,"info",C=>{const t=l=>{if(!l)return null;const c=f(this,ce).body.querySelectorAll(`thead [data-col="${l.dataset.col}"]`);return{name:l.dataset.bind,type:(l.dataset.type||"string").toLocaleLowerCase(),desc:c.length>0?c[c.length-1].getAttribute("title"):null}};return C?t(f(this,ce).activeTmpl.querySelector(`[data-bind="${C}"]`)):Array.from(f(this,ce).activeTmpl.querySelectorAll("[data-bind]")).filter(l=>l.dataset.bind!=="rowState").map(l=>t(l))});Y(this,ii,(C,t)=>{var l=Array.from(C.querySelectorAll("col"));return l[t]});Y(this,Pr,(C,t,l)=>{var c=[];if(!C)return c;for(var o=t;o<=l;o++)c=c.concat(Array.from(C.querySelectorAll(`[data-col="${o}"]:not(.dummy)`)));return c});Y(this,Zi,(C,t,l)=>{const c=(r,n)=>{const s=parseInt(n.dataset.col);return r.closest("thead,tbody,tfoot"),r.querySelector(`[data-col="${s}"]`)},o=(r,n)=>{const s=parseInt(n.dataset.col),e=n.colSpan||1,i=!r.closest("thead,tbody,tfoot");var u=r.querySelectorAll("th:not(.tmp),td:not(.tmp)");for(var a of u)if(parseInt(a.dataset.col)>s+e-1)return a};return parseInt(t.dataset.col)>parseInt(l.dataset.col)?c(C,l):o(C,l)});Y(this,Oo,C=>{const t={org:{thead:{cells:[]},tfoot:{cells:[]},tbody:{cells:[]},fixed:{cells:[]},cols:[]},thead:{cells:[]},tfoot:{cells:[]},tbody:{cells:[]},fixed:{cells:[]},template:{cells:[]},cols:[]},l=C.colSpan||1,c=C.closest("table"),o=parseInt(C.dataset.col),r=C.closest("tr").sectionRowIndex;$("thead tr",c).each((e,i)=>{if(i.sectionRowIndex<r&&i.sectionRowIndex!=0)return!0;t.thead.cells=t.thead.cells.concat(f(this,Pr).call(this,i,o,o+l-1))}),t.tfoot.cells=f(this,Pr).call(this,c.querySelector("tfoot"),o,o+l-1),t.tbody.cells=f(this,Pr).call(this,c.querySelector("tbody.bindable"),o,o+l-1),t.fixed.cells=f(this,Pr).call(this,c.querySelector("tbody.fixed"),o,o+l-1);const n=f(this,ce).shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout");t.org.thead.cells=f(this,Pr).call(this,n.currentTable.querySelector("thead"),o,o+l-1),t.org.tfoot.cells=f(this,Pr).call(this,n.currentTable.querySelector("tfoot"),o,o+l-1),t.org.tbody.cells=f(this,Pr).call(this,n.currentTable.querySelector("tbody.bindable"),o,o+l-1),t.org.fixed.cells=f(this,Pr).call(this,n.currentTable.querySelector("tbody.fixed"),o,o+l-1),f(this,ce).template.each((e,i)=>{t.template.cells=t.template.cells.concat(f(this,Pr).call(this,i,o,o+l-1))});for(var s=o;s<=o+l-1;s++)t.cols.push(f(this,ii).call(this,f(this,ce).body,s));for(var s=o;s<=o+l-1;s++)t.org.cols.push(f(this,ii).call(this,n.currentTable,s));return t});Y(this,ih,(C,t,l,c)=>{if(C.closest("tr").rowIndex!=t.closest("tr").rowIndex)return!1;const o=parseInt(C.dataset.col),r=C.colSpan;parseInt(t.dataset.col),t.colSpan;for(var n of[l.thead.cells,l.tfoot.cells,l.tbody.cells,l.fixed.cells,l.template.cells])for(var s of n){const e=parseInt(s.dataset.col),i=s.colSpan;if(e<o||e+i-1>o+r-1)return!1}return!0});it(this,"moveColumn",(C,t)=>{if(!C||!t)return!1;const l=f(this,ce).shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout"),c=f(this,Oo).call(this,C),o=f(this,Oo).call(this,t),r=t.closest("table"),n=!!(C.closest(".ng-container-left")||t.closest(".ng-container-left")),s=!!(C.closest(".ng-container-right")||t.closest(".ng-container-right"));if(!f(this,ih).call(this,C,t,c,o))return!1;for(var e of[c.thead.cells,c.tfoot.cells,c.tbody.cells,c.fixed.cells])for(var i of e){H.j.querySelectorAll(i).addClass("tmp");const b=i.closest("tr").rowIndex,g=r.querySelectorAll("tr")[b];var u=f(this,Zi).call(this,g,C,t);u?g.insertBefore(i,u):g.appendChild(i)}for(var e of[c.org.thead.cells,c.org.tfoot.cells,c.org.tbody.cells,c.org.fixed.cells])for(var i of e){H.j.querySelectorAll(i).addClass("tmp");const S=i.closest("table"),E=i.closest("tr").rowIndex,I=S.querySelectorAll("tr")[E];var u=f(this,Zi).call(this,I,C,t);u?I.insertBefore(i,u):I.appendChild(i)}for(var i of c.template.cells){H.j.querySelectorAll(i).addClass("tmp");const g=i.closest("tr");var u=f(this,Zi).call(this,g,C,t);u?g.insertBefore(i,u):g.appendChild(i)}var a;parseInt(C.dataset.col)>parseInt(t.dataset.col)?a=parseInt(t.dataset.col):a=parseInt(t.dataset.col)+(t.colSpan||1)-1+(parseInt(C.dataset.col)>parseInt(t.dataset.col)?0:1);let h=f(this,ii).call(this,f(this,ce).body,a);const p=t.closest("table")==h.closest("table");for(var m of c.cols)m&&(p?t.closest("table").querySelector("colgroup").insertBefore(m,h):t.closest("table").querySelector("colgroup").appendChild(m));for(var m of c.org.cols)h=f(this,ii).call(this,l.currentTable,a),m&&m.closest("colgroup").insertBefore(m,h);for(var e of[c.thead.cells,c.tfoot.cells,c.tbody.cells,c.fixed.cells])for(var i of e)H.j.querySelectorAll(i).removeClass("tmp");for(var e of[c.org.thead.cells,c.org.tfoot.cells,c.org.tbody.cells,c.org.fixed.cells])for(var i of e)H.j.querySelectorAll(i).removeClass("tmp");for(var i of c.template.cells)H.j.querySelectorAll(i).removeClass("tmp");if(f(this,ce).body.querySelectorAll(".ng-container-left col").forEach(b=>{b.setAttribute("fixed","left")}),f(this,ce).body.querySelectorAll(".ng-container-left .col-indicator").forEach(b=>{b.setAttribute("fixed","left")}),f(this,ce).body.querySelectorAll(".ng-container-right col").forEach(b=>{b.setAttribute("fixed","right")}),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{b.setAttribute("fixed","right")}),f(this,ce).body.querySelectorAll(".ng-container-body col").forEach(b=>{b.removeAttribute("fixed")}),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{b.removeAttribute("fixed")}),l.currentTable.querySelectorAll("colgroup col").forEach(b=>{b.removeAttribute("fixed")}),$("th,td",f(this,ce).template).each((b,g)=>{g.removeAttribute("fixed")}),$("th,td",l.currentTable).each((b,g)=>{g.removeAttribute("fixed")}),f(this,ce).body.querySelectorAll(".ng-container-left .col-indicator").forEach(b=>{$(`[data-col="${b.dataset.col}"]`,f(this,ce).template).each((g,S)=>{S.setAttribute("fixed","left")}),$(`[data-col="${b.dataset.col}"]`,l.currentTable).each((g,S)=>{S.setAttribute("fixed","left")}),$("colgroup col",l.currentTable).each((g,S)=>{g<=parseInt(b.dataset.col)&&S.setAttribute("fixed","left")})}),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{$(`[data-col="${b.dataset.col}"]`,f(this,ce).template).each((g,S)=>{S.setAttribute("fixed","right")}),$(`[data-col="${b.dataset.col}"]`,l.currentTable).each((g,S)=>{S.setAttribute("fixed","right")})}),f(this,ce).resetTemplate(),f(this,ce).body.querySelectorAll(".ng-container-right .col-indicator").forEach(b=>{$("colgroup col",l.currentTable).each((g,S)=>{g>=parseInt(b.dataset.col)&&S.setAttribute("fixed","right")})}),n){var d=t.closest(".ng-container-body")?-C.offsetWidth:0;$(".ng-container-left .col-indicator",f(this,ce).body).each((b,g)=>{d+=g.offsetWidth}),$(".ng-container-left",f(this,ce).body).css({width:d,"min-width":d})}if(s){var d=t.closest(".ng-container-body")?-C.offsetWidth:0;$(".ng-container-right .col-indicator",f(this,ce).body).each((g,S)=>{d+=S.offsetWidth}),$(".ng-container-right",f(this,ce).body).css({width:d,"min-width":d})}f(this,ce).refreshData()});it(this,"width",(C,t)=>{t=parseFloat(t);const l=f(this,ce).body.querySelector(`colgroup col[data-col="${C}"]`),c=!!l.closest(".ng-container-left"),o=!!l.closest(".ng-container-right"),r=!!l.closest(".ng-container-body"),n=c?"left":o?"right":"body";if(r)if(f(this,ce).getAttribute("auto-fit-col")=="true"){var s=0;$(".ng-container-body .col-indicator",f(this,ce).body).not(`[data-col=${C}]`).each((u,a)=>{s+=a.offsetWidth});const i=$(".ng-container-body",f(this,ce).body).width();$(".ng-container-body col",f(this,ce).body).each((u,a)=>{var h=parseInt(C==a.dataset.col?t:a.getAttribute("width"))*i/s;a.setAttribute("width",h)})}else l.setAttribute("width",t);else{var e=0;$(`.ng-container-${n} .col-indicator`,f(this,ce).body).not(`[data-col=${C}]`).each((i,u)=>{e+=parseInt(u.offsetWidth)}),$(`.ng-container-${n}`,f(this,ce).body).css({width:parseInt(e+t),"min-width":parseInt(e+t)}),l.setAttribute("width",t)}});tt(this,ce,C)}}ce=new WeakMap,ii=new WeakMap,Pr=new WeakMap,Zi=new WeakMap,Oo=new WeakMap,ih=new WeakMap;class ed extends ti{constructor(){super();Y(this,nh,10);Y(this,Ji);Y(this,De);Y(this,nr);Y(this,jo);Y(this,js);Y(this,ni);Y(this,Qi);it(this,"dataRefresh",t=>{f(this,nr)&&(f(this,oh).call(this)?H.j.querySelectorAll(this).removeClass("invalid"):H.j.querySelectorAll(this).addClass("invalid")),f(this,Ji).innerHTML=this.getDisplayText()||"Select",t||this.reset()});Y(this,oh,()=>{if(H.isNull(this.value))return!0;var t=this.multi?this.value.split(this.multiSeparator):[this.value];for(var l of t){var c=f(this,nr).findIndex(o=>l==o[f(this,js)]);if(c<0)return!1}return!0});Y(this,ah,()=>{if(this.owner){if(tt(this,De,this.owner.shadowRoot.querySelector("ng-combo-panel")),this.owner.shadowRoot.querySelectorAll("ng-combo-panel").length>1)throw"too many ng-combo-panel";var t=this.getAttribute("data-source");t&&this.owner&&this.owner.exprFunction}});Y(this,lh,t=>{if(console.log(f(this,nr)),!!f(this,nr)){console.log(f(this,nr)),f(this,De).col=this.cell.dataset.col,f(this,De).row=this.cell.closest("tr").sectionRowIndex,f(this,nr).length>f(this,nh)?H.j.querySelectorAll(f(this,De)).addClass("expand"):H.j.querySelectorAll(f(this,De)).removeClass("expand"),this.multi?H.j.querySelectorAll(f(this,De)).addClass("multi"):H.j.querySelectorAll(f(this,De)).removeClass("multi"),f(this,De).refresh(this,f(this,nr),f(this,js),f(this,Qi));var l=$(".btn1",this.shadowRoot).offset().left-$(this.owner).offset().left;l+$(f(this,De)).width()>$(this.owner).width()&&(l=$(".btn2",this.shadowRoot).offset().left-$(this.owner).offset().left-$(f(this,De)).width()+8),l<0&&(l=0);var c=Math.min(f(this,nr).length,f(this,jo))*26;this.multi?(H.j.querySelectorAll(f(this,De)).hasClass("expand")&&(c+=12,c+=3,c+=24),c+=2,c+=3,c+=25):(H.j.querySelectorAll(f(this,De)).hasClass("expand")&&(c+=12,c+=3,c+=24),c+=3);var o=$(".btn1",this.shadowRoot).offset().top+$(".btn1",this.shadowRoot).height()-$(this.owner).offset().top+3;o+c>$(this.owner).height()&&(o-=c+$(".btn1",this.shadowRoot).height()+6);var r=this.getAttribute("template");r&&console.error("logic error !!!!"),$(f(this,De)).css({left:l,top:o,height:c,"min-height":c}).show(),H.j.querySelectorAll(f(this,De)).hasClass("expand")&&$("div",f(this,De)).eq(0).find("input").focus().val("")}});Y(this,hh,t=>{t.target.closest("ng-combo-panel")||(f(this,De).row=f(this,De).col=-1,$(f(this,De)).hide())});Y(this,hu,()=>"a")}connectedCallback(){this.multi=this.getAttribute("multi")=="true",this.multiSeparator=this.getAttribute("multi-separator")||",",tt(this,jo,this.getAttribute("rows")||5),tt(this,js,this.getAttribute("code")||"code"),tt(this,ni,this.getAttribute("codename")||"codename"),tt(this,Qi,(this.getAttribute("items")||f(this,ni)||"").split(",")),f(this,Qi).unshift("CHK");var t=this.querySelector("datalist");t&&(tt(this,nr,[]),t.querySelectorAll("option").forEach(n=>{const s=n.getAttribute(f(this,js)),e=n.getAttribute(f(this,ni));s&&e&&f(this,nr).push({[f(this,js)]:s,[f(this,ni)]:e})})),this.shadowRoot.innerHTML=`
161
161
  <style>
162
162
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngCombo.css";
163
163
  ${H.getCustomPath(this,"ngCombo.css")}
@@ -212,8 +212,8 @@
212
212
  <input id="chkAll" type="checkbox" checked><label for="chkAll">Select All</label>
213
213
  <button id="btnOk">OK</button>
214
214
  </div>
215
- `,f(this,ch).call(this)}}$o=new WeakMap,Be=new WeakMap,$s=new WeakMap,oi=new WeakMap,tn=new WeakMap,ch=new WeakMap,Lo=new WeakMap,uh=new WeakMap,Po=new WeakMap,en=new WeakMap,cu=new WeakMap,dh=new WeakMap,fh=new WeakMap,customElements.get("ng-combo")||customElements.define("ng-combo",ed),customElements.get("ng-combo-panel")||customElements.define("ng-combo-panel",rd);class sd{constructor(C){Y(this,rn);Y(this,Do);Y(this,sn);Y(this,ai);Y(this,nn);Y(this,Kr);it(this,"openMenu",(C,t)=>{var l=$(f(this,Kr)).css("font"),c=150;for(const o of f(this,sn))c=Math.max(c,H.measureTextSize(o.name,l).width+60);$(f(this,Kr)).css({width:c,top:t,left:C}),f(this,Kr).open(),f(this,ai)&&f(this,ai).show&&f(this,ai).show.call(this,{source:f(this,Do)})});Y(this,ph,C=>{tt(this,sn,f(this,Bo).call(this,C.items,0)),tt(this,ai,C.events),tt(this,Kr,$(`<ng-context-menu-panel id="${C.id}"></ng-context-menu-panel>`)[0]),$(f(this,rn).shadowRoot).append($(f(this,Kr)).hide()),f(this,Kr).init(f(this,sn)),$("li",f(this,Kr)).on("mousedown",t=>{C.callback&&(t.menuId=t.currentTarget.getAttribute("menu-id"),t.source=f(this,Do),C.callback(t)),$("ng-context-menu-panel",f(this,rn).shadowRoot).hide()})});Y(this,Bo,(C,t)=>{tt(this,nn,Math.max(t,f(this,nn))+1),C=f(this,mh).call(this,C);for(const l of C)l.level=t,l.hasOwnProperty("items")&&(l.items=f(this,Bo).call(this,l.items,t+1));return C});Y(this,mh,C=>{if(Array.isArray(C))return C;var t=[];for(const c in C){var l=C[c];l.menuId=c,t.push(l)}return t});tt(this,nn,0),tt(this,rn,C.owner),f(this,ph).call(this,C)}}rn=new WeakMap,Do=new WeakMap,sn=new WeakMap,ai=new WeakMap,nn=new WeakMap,Kr=new WeakMap,ph=new WeakMap,Bo=new WeakMap,mh=new WeakMap;class id extends HTMLElement{constructor(){super();it(this,"init",t=>{var l=$("ul",this);$("li",l).remove(),f(this,Fo).call(this,l,t),$("li",this).on("mouseover",f(this,gh)),$("li",this).on("mouseout",c=>{H.j.querySelectorAll(c.currentTarget).removeClass("visible")})});it(this,"open",()=>{$(this).show()});Y(this,Fo,(t,l)=>{for(const n of l){var c=(n.hasOwnProperty("className")?n.className:"")+(n.hasOwnProperty("items")?" submenu":""),o=$(`<li menu-id='${n.menuId}' id="${n.name}" class="${c.trim()}"><span>${n.name}</span></li>`);if(t.append(o),n.hasOwnProperty("items")){var r=$("<ul></ul>");o.append(r),f(this,Fo).call(this,r,n.items)}}});Y(this,gh,t=>{H.j.querySelectorAll(t.currentTarget).addClass("visible");var l=$(this).css("font"),c=150;$("ul > li:visible > span",t.currentTarget).each((o,r)=>{c=Math.max(c,H.measureTextSize($(r).text(),l).width+60)}),$("ul",t.currentTarget).eq(0).css({width:c,top:-9,left:$(t.currentTarget.closest("ul")).width()-8,"z-index":Number($(this).css("z-index"))+1})})}connectedCallback(){this.innerHTML="<ul></ul>"}}Fo=new WeakMap,gh=new WeakMap,customElements.get("ng-context-menu-panel")||customElements.define("ng-context-menu-panel",id);class nd{constructor(C){Y(this,Ur);Y(this,qo,()=>{$(".ng-table tbody",f(this,Ur).shadowRoot).on("click","th,td",f(this,bh)),$(".ng-table thead",f(this,Ur).shadowRoot).on("click","th,td",f(this,yh)),$(".ng-table tfoot",f(this,Ur).shadowRoot).on("click","th,td",f(this,vh))});Y(this,bh,C=>{if(![1,2].includes(C.detail))return;const t=["altKey","ctrlKey","shiftKey","clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","button","buttons","whitch"],l=C.target.closest("th,td"),c=C.detail==1?H.EVENT.CELL_CLICK:H.EVENT.CELL_DBL_CLICK,o=new CustomEvent(c,{bubbles:!0,composed:!0,detail:{target:l}});o.col=l.dataset.col,o.row=l.dataset.row,o.subrow=parseInt(l.dataset.matrixRow)%parseInt(l.dataset.row),o.bind=l.dataset.bind,H.copyProperty(o,C,t),f(this,Ur).dispatchEvent(o)});Y(this,yh,C=>{if(![1,2].includes(C.detail))return;const t=["altKey","ctrlKey","shiftKey","clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","button","buttons","whitch"],l=C.target.closest("th,td"),c=C.detail==1?H.EVENT.HEADCELL_CLICK:H.EVENT.HEADCELL_DBL_CLICK,o=new CustomEvent(c,{bubbles:!0,composed:!0,detail:{target:l}});o.col=l.dataset.col,H.copyProperty(o,C,t),f(this,Ur).dispatchEvent(o)});Y(this,vh,C=>{if(![1,2].includes(C.detail))return;const t=["altKey","ctrlKey","shiftKey","clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","button","buttons","whitch"],l=C.target.closest("th,td"),c=C.detail==1?H.EVENT.FOOTCELL_CLICK:H.EVENT.FOOTCELL_DBL_CLICK,o=new CustomEvent(c,{bubbles:!0,composed:!0,detail:{target:l}});o.col=l.dataset.col,H.copyProperty(o,C,t),f(this,Ur).dispatchEvent(o)});tt(this,Ur,C),f(this,qo).call(this),f(this,Ur).addEventListener(H.EVENT.LAYOUT_CHANGED,t=>{f(this,qo).call(this)})}}Ur=new WeakMap,qo=new WeakMap,bh=new WeakMap,yh=new WeakMap,vh=new WeakMap;class od extends Ue.trace.constructor{constructor(){super(),this.init("nine-grid","green")}}const Br=new od;class ad{constructor(C){Y(this,Zr);Y(this,Ho);Y(this,us);it(this,"count",()=>f(this,Zr).rawRecords.length);it(this,"has",C=>f(this,Zr).data.filter(C).length>0);it(this,"first",C=>(f(this,Zr).data.first(C).__ng||{rowidx:-1}).rowidx);it(this,"last",C=>(f(this,Zr).data.last(C).__ng||{rowidx:-1}).rowidx);tt(this,Zr,C),tt(this,Ho,-1),tt(this,us,-1)}get at(){return f(this,us)}set at(C){tt(this,Ho,f(this,us)),tt(this,us,parseInt(C)),f(this,Zr).owner.body.querySelector(`tbody.bindable tr[data-row="${f(this,us)}"]`)||setTimeout(()=>{f(this,Zr).owner.scrollTo_V1(f(this,us))})}}Zr=new WeakMap,Ho=new WeakMap,us=new WeakMap;class ld{constructor(C,t){Y(this,Ve);Y(this,Dt);Y(this,Pe);Y(this,Tr);Y(this,li);Y(this,Ls);it(this,"initialize",()=>{tt(this,Ls,[]),$(f(this,Ve).template).each((C,t)=>{f(this,Ls).push($(t).height())}),(f(this,Dt).rawRecords||[]).forEach(C=>{C.__ng.height=f(this,Ls).slice()})});it(this,"set",C=>{Br.log("ngData.set"),this.clear(),this.add(C,!1);const t=()=>{var l,c,o,r;(c=(l=f(this,Dt))==null?void 0:l.owner)!=null&&c.matrix?(r=(o=f(this,Dt))==null?void 0:o.owner)==null||r.matrix.updateCumulativeHeights():setTimeout(t,50)};t()});it(this,"assign",C=>{this.source=C;for(var t=0;t<C.length;t++)f(this,Pe)[t].__ng._[H.ROW.ID]=C[t].__ng._[H.ROW.ID],tt(this,li,Math.max(f(this,li),C[t].__ng.rowid))});it(this,"getId",C=>C.__ng._[H.ROW.ID]);it(this,"reset",()=>{tt(this,Pe,[]),tt(this,Tr,[])});it(this,"refresh",()=>{f(this,Dt).viewRecords.reset()});it(this,"clearFilter",()=>(f(this,Dt).rawRecords.map(C=>{C.__ng.filtered=!1}),tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng.filtered)),f(this,Pe)));it(this,"refreshFilter",()=>(tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng.filtered)),f(this,an).call(this),f(this,Pe)));it(this,"setFilter",C=>{f(this,Ve).filtering.on();let t={};if(Array.isArray(C))for(let c in C[0])console.log(`::::::${c}::::::`),t[c]=Array.from(new Set(C.map(o=>o[c])));else t=C;this.clearFilter();for(let c in t){const o=t[c],r=f(this,Dt).owner.fields.indexOf(c);let n=!1;for(let s of this.getValidData())if(s.v[r]!=null){n=typeof s.v[r]=="number";break}if(n)for(var l=0;l<o.length;l++)o[l]=Number(o[l]);this.getValidData().filter(s=>o.nineBinarySearch(s.v[r]||"")<0).map(s=>{s.__ng.filtered=!0})}this.refreshFilter(),f(this,Ve).shadowRoot.querySelectorAll("ng-filter-button").forEach(c=>{c.filterOptions.forEach(o=>{o.data=[]})}),Object.entries(t).forEach(([c,o])=>{f(this,Ve).shadowRoot.querySelectorAll("ng-filter-button").forEach(r=>{let n=r.filterOptions;n.forEach(s=>{s.colnm===c&&(s.data=o)}),r.filterOptions=n})}),f(this,Dt).owner.scrollTo_V1(0),f(this,Dt).owner.paging.reset()});it(this,"indexOf",C=>f(this,on).call(this,this.recordsNF(),C,this.records()));Y(this,on,(C,t,l)=>{const c=C[t];return l.findIndex(o=>o.__ng._[H.ROW.ID]==c.__ng._[H.ROW.ID])});it(this,"moveRow",(C,t)=>{C!=t&&(H.move(f(this,Dt).rawRecords,this.total.indexOf(C),this.total.indexOf(t)),this.resetRecords(),f(this,Dt).owner.dataManager.viewRecords.reset())});it(this,"filter",C=>f(this,Pe).filter(C));it(this,"max",(C,t)=>{var l=(t?this.filter(t):f(this,Dt).rawRecords).map(c=>c[C]);return l&&l.length>0?l.reduce((c,o)=>c>o?c:o):null});it(this,"min",(C,t)=>{var l=(t?this.filter(t):f(this,Dt).rawRecords).map(c=>c[C]);return l&&l.length>0?l.reduce((c,o)=>c>o?o:c):null});it(this,"first",C=>this.filter(C).first());it(this,"last",C=>this.filter(C).last());it(this,"count",()=>this.getValidData().length);it(this,"countNF",()=>this.getValidDataNF().length);it(this,"onRowStateChanged",()=>{const C=this.getChangedData(),t=$("tbody td[data-bind=rowState]",f(this,Dt).owner.body);if(t.length<=0)return;const l=t.eq(0)[0].dataset.col,c=H.j.querySelectorAll(`thead th[data-col="${l}"]:not(.col-indicator)`,f(this,Dt).owner.body);c.removeClass("deleted").removeClass("added").removeClass("updated"),C.delete.length>0?c.addClass("deleted"):C.insert.length>0?c.addClass("added"):C.update.length>0&&c.addClass("updated"),f(this,Dt).owner.paging.refreshTotal()});Y(this,zo,C=>(Array.isArray(C)||(C=[C]),C.forEach((t,l)=>{t.__ng=this.default,t.__ng.rowid=this.nextId,t.__ng.rowState=H.ROW_STATE.INSERT,t.__ng._[H.ROW.ID]=t.__ng.rowid}),this.onRowStateChanged(),C));it(this,"sort",C=>{f(this,Dt).rawRecords.sort(C),f(this,Tr).sort(C),f(this,Pe).sort(C),f(this,an).call(this),f(this,Dt).owner.refresh()});Y(this,an,()=>{f(this,Dt).rawRecords.forEach((t,l)=>{t.__ng._[H.ROW.INDEX]=l}),f(this,Dt).rawRecords.filter(t=>!t.__ng.deleted&&!t.__ng.filtered&&t.__ng.visible).forEach((t,l)=>{t.__ng._[H.ROW.ORDER]=l+1});const C=f(this,Dt).rawRecords.filter(t=>!t.__ng.deleted&&t.__ng._[H.ROW.PIN]);C.forEach((t,l)=>{t.__ng._[H.ROW.VISIBLE_ROW]=(C.length-l)*-1}),f(this,Pe).forEach((t,l)=>{t.__ng._[H.ROW.VISIBLE_ROW]=l});//!m.__ng.deleted && !m.__ng.pin && !m.__ng._[ninegrid.ROW.PIN] && !m.__ng.filtered && m.__ng.visible && m.__ng.paging;
216
- });it(this,"resetIndex",()=>{f(this,Dt).rawRecords.forEach((C,t)=>{C.__ng.ii=t,C.__ng.rowidx=t,C.__ng.rowidx1=t}),this.getValidData().forEach((C,t)=>{C.__ng.i=t,C.__ng.rowidx=t}),f(this,an).call(this)});it(this,"resetRecords",()=>{tt(this,Tr,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted)),tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng._[H.ROW.PIN]&&!C.__ng._[H.ROW.COLLAPSE]&&!C.__ng.filtered&&C.__ng.visible&&C.__ng.paging)),this.resetIndex()});Y(this,Uo,C=>{Array.isArray(C)||(C=[C]);var t=[];return C.forEach(l=>{var c={v:[]};for(const o of f(this,Ve).fields.get())c.v.push(H.nvl(l[o],""));t.push(c)}),t});it(this,"exprFunction",C=>{let t="...args",l="let [data, currow] = args; currow = Number(currow); return "+C+";";return new Function(t,l)});it(this,"__ng",C=>{var t=this.getValidData();if(t.length==0)return null;try{return t[C].__ng}catch(l){console.error(l,t,C)}});it(this,"getValidData",()=>(f(this,Pe).length==0&&tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng._[H.ROW.PIN]&&!C.__ng._[H.ROW.COLLAPSE]&&C.__ng._[H.ROW.VISIBLE]&&!C.__ng.filtered&&C.__ng.visible&&C.__ng.paging)),f(this,Pe)));it(this,"getValidDataNF",()=>(f(this,Tr).length==0&&tt(this,Tr,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted)),f(this,Tr)));it(this,"conv",C=>{if(H.isNull(C))return C;if(Array.isArray(C)){var t=[];for(const r of C){for(var l={},c=0;c<f(this,Ve).fields.get().length;c++){const n=f(this,Ve).fields.get()[c];l[n]=r.v[c]}l.__ng=r.__ng,t.push(l)}return t}else{for(var o=C,l={},c=0;c<f(this,Ve).fields.get().length;c++){const s=f(this,Ve).fields.get()[c];l[s]=o.v[c]}return l.__ng=o.__ng,l}});it(this,"conv2",C=>{if(H.isNull(C))return C;if(Array.isArray(C)){var t=[];for(const r of C){for(var l={},c=0;c<f(this,Ve).fields.get().length;c++){const n=f(this,Ve).fields.get()[c];l[n]=r.v[c]}l.__ng=r.__ng,t.push(l)}return t}else{for(var o=C,l={},c=0;c<f(this,Ve).fields.get().length;c++){const s=f(this,Ve).fields.get()[c];l[s]=o.v[c]}return l.__ng=o.__ng,l}});it(this,"changeRowState",(C,t,l)=>{const c=o=>{[H.ROW_STATE.EMPTY,H.ROW_STATE.NORMAL].includes(C)&&(o.__ng.o={}),o.__ng.rowState=C};C||(C=H.ROW_STATE.EMPTY),!t&&!l&&(t=0,l=this.count()-1),t||(t=0),l||(l=t),l>=this.count()&&(l=this.count()-1),f(this,Pe).forEach((o,r)=>{o.__ng.rowidx>=t&&o.__ng.rowidx<=l&&c(o)}),f(this,Tr).forEach((o,r)=>{o.__ng.rowidx>=t&&o.__ng.rowidx<=l&&c(o)}),this.getValidDataNF().forEach((o,r)=>{o.__ng.rowidx>=t&&o.__ng.rowidx<=l&&c(o)}),this.onRowStateChanged(),f(this,Dt).viewRecords.reset()});it(this,"getCheckedData",C=>this.get().filter(t=>t.__ng.c[C]==!0));it(this,"search",(C,t)=>this.get().filter(l=>l[C]==t));Y(this,Vo,(C,t,l,c)=>{if(l==c)return;const o=new CustomEvent(H.EVENT.DATA_CHANGED,{bubbles:!0,detail:{}});o.row=C,o.bind=t,o.oldvalue=l,o.value=c,o.data=this.get(C),f(this,Dt).owner.dispatchEvent(o)});it(this,"add",(C,t)=>{C==null&&(C={}),t==null&&(t=!0);const l=f(this,Uo).call(this,C);f(this,Dt).rawRecords=f(this,Dt).rawRecords.concat(f(this,zo).call(this,l));const c=f(this,Dt).rawRecords.map(r=>r.__ng._[H.ROW.ORIGIN_ORDER]);if(c.length>0){const r=c.reduce(function(n,s){return n>s?n:s});f(this,Dt).rawRecords.forEach((n,s)=>{n.__ng._[H.ROW.ORIGIN_ORDER]<0&&(n.__ng._[H.ROW.ORIGIN_ORDER]=r+1+s)})}this.resetRecords();const o=this.count()-1;return t||this.changeRowState(H.ROW_STATE.EMPTY,o-l.length+1,o),f(this,Dt).viewRecords.reset(),o});it(this,"insert",(C,t,l)=>{C==null&&(C={}),t==null&&(t=0),l==null&&(l=!0);var c=f(this,Uo).call(this,C);const o=f(this,Dt).rawRecords[t].__ng._[H.ROW.ORIGIN_ORDER];return f(this,Dt).rawRecords.filter(r=>r.__ng._[H.ROW.ORIGIN_ORDER]>=o).forEach(r=>{r.__ng._[H.ROW.ORIGIN_ORDER]+=c.length}),c=f(this,zo).call(this,c),c.forEach((r,n)=>{r.__ng._[H.ROW.ORIGIN_ORDER]=o+n}),f(this,Dt).rawRecords.splice(t,0,...c),this.resetRecords(),l||this.changeRowState(H.ROW_STATE.EMPTY,t,t+c.length-1),f(this,Dt).viewRecords.reset(),t});Y(this,wh,C=>{var t=!1;C.sort((l,c)=>c-l).forEach(l=>{f(this,Pe)[l].__ng.rowState==H.ROW_STATE.INSERT?H.removeIf(f(this,Dt).rawRecords,c=>c.__ng.rowid==f(this,Pe)[l].__ng.rowid):(f(this,Dt).rawRecords.filter(c=>c.__ng.rowid==f(this,Pe)[l].__ng.rowid).map(c=>{c.__ng.deleted=!0,c.__ng.rowState=H.ROW_STATE.DELETE}),t=!0)}),t&&this.onRowStateChanged(),tt(this,Pe,f(this,Dt).rawRecords.filter(l=>!l.__ng.deleted&&!l.__ng.filtered)),tt(this,Tr,f(this,Dt).rawRecords.filter(l=>!l.__ng.deleted)),this.getValidDataNF().forEach((l,c)=>{l.__ng.rowidx=c}),this.getValidData().forEach((l,c)=>{l.__ng.rowidx=c}),f(this,Dt).viewRecords.reset()});it(this,"delete",C=>{var t=[];if(Array.isArray(C))t=C;else if(typeof C>"u"){if(f(this,Dt).owner.row.at<0)throw`invalid ${f(this,Dt).owner.row.at}`;t=[f(this,Dt).owner.row.at]}else if(typeof C=="number"||typeof C=="string")t=[C];else if(typeof C=="object"){const l=f(this,Pe).findIndex(c=>c.__ng._[H.ROW.ID]==C.__ng._[H.ROW.ID]);if(l<0)throw new Error(`${C.__ng._[H.ROW.ID]} not found.`);t=[l]}else throw`invalid ${C}`;f(this,wh).call(this,t)});it(this,"deleteFromId",C=>{var t=this.records();const l=t.findIndex(c=>c.__ng._[H.ROW.ID]==C);if(l<0)throw new Error(`${C} not found.`);this.delete(l)});Y(this,Wo,(C,t,l)=>{if(typeof l>"u")l=C.findIndex(e=>e.__ng._[H.ROW.ID]==t.__ng._[H.ROW.ID]);else if(typeof l=="number"||typeof l=="string")l=parseInt(l);else throw`invalid ${l}`;var c=C[l],o=!1;for(const e in t)if(!["__ng","rowState"].includes(e)){var r=f(this,Ve).fields.indexOf(e);if(!(r<0)){var n=c.v[r],s=t[e];c.v[r]=s,n!=s&&(c.__ng.rowState=H.ROW_STATE.UPDATE,o=!0,f(this,Vo).call(this,l,e,n,s))}}o&&this.onRowStateChanged(),f(this,Dt).owner.refreshData()});it(this,"update",(C,t)=>{f(this,Wo).call(this,f(this,Pe),C,t)});it(this,"setValue",(C,t,l,c)=>{f(this,Xo).call(this,C,t,l,c,!1)});it(this,"setValueNF",(C,t,l,c)=>{f(this,Xo).call(this,C,t,l,c,!0)});Y(this,Xo,(C,t,l,c,o)=>{C=parseInt(C),c==null&&(c=!0);const r=f(this,Ve).fields.indexOf(t);if(!(r<0)){var n=o?this.getValidDataNF()[C]:this.getValidData()[C],s=n.v[r];n.v[r]!=l&&n.__ng.rowState!=H.ROW_STATE.INSERT&&(n.__ng.o.hasOwnProperty(t)||(n.__ng.o[t]=s),c&&(n.__ng.rowState=H.ROW_STATE.UPDATE,this.onRowStateChanged())),n.v[r]=l,f(this,Dt).owner.refreshData(C),f(this,Vo).call(this,C,t,s,l)}});it(this,"setRecord",(C,t,l,c)=>{f(this,ln).call(this,this.getValidData(),C,t,l,c,!1)});it(this,"setRecordNF",(C,t,l,c)=>{f(this,ln).call(this,this.getValidDataNF(),C,t,l,c,!0)});Y(this,ln,(C,t,l,c,o)=>{t=parseInt(t),l=parseInt(l),o==null&&(o=!0);var r=C[t];r.v[l],r.v[l]!=c&&r.__ng.rowState!=H.ROW_STATE.INSERT&&o&&(r.__ng.rowState=H.ROW_STATE.UPDATE),r.v[l]=c});it(this,"getChangedData",C=>C?this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==C)):{insert:this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.INSERT)),update:this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.UPDATE)),delete:this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.DELETE))});it(this,"isChanged",()=>f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.INSERT||t.__ng.rowState==H.ROW_STATE.UPDATE||t.__ng.rowState==H.ROW_STATE.DELETE).length>0);Y(this,hn,(C,t,l)=>{if(!(!C||C.length<=0)){if(H.isNull(t))return this.conv2(C);if(t<0||t>=C.length)throw`invalid row : ${t}`;if(l!=null){var c=f(this,Ve).fields.indexOf(l);return c>=0?C[t].v[c]:null}var o=t==null?C:C[t];return this.conv(o)}});it(this,"get",(C,t)=>f(this,hn).call(this,this.getValidData(),C,t));it(this,"getNF",(C,t)=>f(this,hn).call(this,this.getValidDataNF(),C,t));it(this,"records",C=>H.isNull(C)?this.getValidData():this.getValidData(C));it(this,"recordsNF",C=>H.isNull(C)?this.getValidDataNF():this.getValidDataNF(C));it(this,"getRow",C=>this.getValidData()[C]);it(this,"getRowNF",C=>this.getValidDataNF()[C]);Y(this,Yo,(C,t)=>{var l=f(this,Ve).fields.indexOf(t);return l<0?[]:C.map(c=>c.v[l])});it(this,"getMap",C=>f(this,Yo).call(this,this.getValidData(),C));it(this,"getMapNF",C=>f(this,Yo).call(this,this.getValidDataNF(),C));it(this,"findIndex",C=>f(this,Go).call(this,this.getValidData(),C));it(this,"findIndexNF",C=>f(this,Go).call(this,this.getValidDataNF(),C));Y(this,Go,function(C,t){return this.conv2(C).findIndex(t)});it(this,"findIndex_1",C=>f(this,Ko).call(this,this.getValidData(),C));it(this,"findIndexNF_1",C=>f(this,Ko).call(this,this.getValidDataNF(),C));Y(this,Ko,function(C,t){let l=0,c=C.length-1,o;for(;l<=c;){if(o=parseInt((l+c)/2),t===C[o].__ng._[H.ROW.INDEX])return o;t<C[o].__ng._[H.ROW.INDEX]?c=o-1:l=o+1}return-1});tt(this,Ve,C),tt(this,Dt,t),tt(this,Pe,[]),tt(this,Tr,[]),tt(this,li,0),this.all={get:(l,c)=>f(this,hn).call(this,this.recordsNF(),l,c),records:l=>this.recordsNF(l),count:()=>this.recordsNF().length,setRecord:(l,c,o,r)=>f(this,ln).call(this,this.all.records(),l,c,o,r),indexOf:l=>f(this,on).call(this,this.records(),l,this.recordsNF()),update:(l,c)=>f(this,Wo).call(this,this.records(),l,c)},this.total={indexOf:l=>f(this,on).call(this,this.records(),l,f(this,Dt).rawRecords)},this.initialize()}get source(){return this.conv2(f(this,Dt).rawRecords)}set source(C){this.clear(),this.add(C,!1),Br.log("ngData.source",C);const t=()=>{var l,c,o,r;(c=(l=f(this,Dt))==null?void 0:l.owner)!=null&&c.matrix?(r=(o=f(this,Dt))==null?void 0:o.owner)==null||r.matrix.updateCumulativeHeights():setTimeout(t,50)};t()}get nextId(){return++Ru(this,li)._}get default(){return{rowState:H.ROW_STATE.EMPTY,deleted:!1,filtered:!1,pin:!1,expand:!0,visible:!0,paging:!0,height:f(this,Ls).slice(),o:{},c:{},_:[0,0,0,0,H.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,f(this,Ls).slice(),-1,{},{}]}}clear(){delete f(this,Dt).rawRecords,tt(this,Pe,[]),tt(this,Tr,[]),f(this,Dt).rawRecords=[],f(this,Dt).viewRecords.reset()}}Ve=new WeakMap,Dt=new WeakMap,Pe=new WeakMap,Tr=new WeakMap,li=new WeakMap,Ls=new WeakMap,on=new WeakMap,zo=new WeakMap,an=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,wh=new WeakMap,Wo=new WeakMap,Xo=new WeakMap,ln=new WeakMap,hn=new WeakMap,Yo=new WeakMap,Go=new WeakMap,Ko=new WeakMap;class hd{constructor(C){this.owner=C,this.row=new ad(this),this.data=new ld(C,this),this.setDataSource=l=>{Br.log(l),this.data&&this.data.reset(),this.pageCnt=25,this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.viewRecords.touch=()=>{this.viewRecords.updateCnt=(this.viewRecords.updateCnt||0)+1},this.viewRecords.rawIndex=0,this.viewRecords.setPageCnt=c=>{this.pageCnt=c},this.viewRecords.reset=()=>{this.owner.view&&this.owner.view.redraw()},this.viewRecords.resetV2=()=>{this.owner.view.redrawV2()},this.data.set(l)},this.getRowState=c=>{var c=parseInt(c);if(!(c>=this.data.count()))return this.data.__ng(c).rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=l=>{this.row.at=l},this.pageUp=()=>{if(!this.owner.isFirstPage){var l=$(".ng-container-body",this.owner.body).height()-($(".ng-container-body thead",this.owner.body).height()||0)-($(".ng-container-body tfoot",this.owner.body).height()||0);l-=$(".ng-container-body tbody.fixed",this.owner.body).height();for(var c=0,o=this.viewRecords.rawIndex;c<l;){o--;for(var r=0;r<this.owner.template.length;r++){var n=parseInt(o*this.owner.template.length+r);c+=this.owner.matrix.getHeight(n)}}return this.scrollTo_V1(o+1)}},this.pageDown=()=>{if(this.owner.isLastPage||!$("ng-vscrollbar",this.owner.body).is(":visible"))return;const l=parseInt(Array.from(this.owner.body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)")).pop().dataset.row);return this.scrollTo_V1(l)},this.scrollTo_V1=l=>(l<0&&(l=0),l>=this.rawRecords.length&&(l=this.rawRecords.length-1),this.viewRecords.rawIndex=l,this.viewRecords.reset(),!(l<=0||l>=this.rawRecords.length-1)),this.scrollToV2=l=>(l<0&&(l=0),l>=this.rawRecords.length&&(l=this.rawRecords.length-1),this.viewRecords.rawIndex=l,this.viewRecords.resetV2(),!(l<=0||l>=this.rawRecords.length-1)),this.exprFunction=l=>{l=l.replaceAll("ninegrid.ROW.ORDER",H.ROW.ORDER);let c="...args",o="let [data, currow, all] = args; currow = Number(currow); return "+l+";";return new Function(c,o)},this.exprFunction2=l=>{this.owner.fields.get().forEach(r=>{const n=this.owner.fields.indexOf(r);l=l.replaceAll(`data.${r}`,`data.v[${n}]`)});let c="...args",o="let [data, currow, all] = args; currow = Number(currow); return "+l+";";return new Function(c,o)},this.getColumn=(l,c)=>this.data.get(l,c),this.setColumn=(l,c,o)=>{l=parseInt(l),this.data.get(l)[c]!=o&&this.data.get(l).__ng.rowState!=H.ROW_STATE.INSERT&&(this.data.get(l).__ng.rowState=H.ROW_STATE.UPDATE,this.data.onRowStateChanged()),this.setColumnSilent(l,c,o)},this.setColumnSilent=(l,c,o)=>{this.data.set(l,c,o)},this.setDataSource([]);for(var t in this.row)["first","last","count","add","insert","move","delete"].includes(t)||(this.data[t]=this.row[t])}}class cd extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const C=this.getAttribute("type")||"sphere",t=this.getAttribute("size")||this.getAttribute("width")||this.getAttribute("height")||"8",l=this.getAttribute("width")||this.getAttribute("size")||"8",c=this.getAttribute("height")||this.getAttribute("size")||"8",o=this.getAttribute("color")||"gray";var r="";switch(C){case"sphere":r=`<div class="ng-expand-icon-sphere" style="width: ${t}px; height: ${t}px; background: radial-gradient(circle farthest-corner at 33% 33%, white 0%, ${o} 80%), radial-gradient(circle farthest-corner at 45% 45%, rgba(0, 0, 0, 0) 50%, #000000 80%);" />`;break;case"circle":var n=Number(t)/2,s=this.getAttribute("stroke")||"#666",e=Number(this.getAttribute("stroke-width")||0),i=n+e,u=n+e;r=`
215
+ `,f(this,ch).call(this)}}$o=new WeakMap,Be=new WeakMap,$s=new WeakMap,oi=new WeakMap,tn=new WeakMap,ch=new WeakMap,Lo=new WeakMap,uh=new WeakMap,Po=new WeakMap,en=new WeakMap,cu=new WeakMap,dh=new WeakMap,fh=new WeakMap,customElements.get("ng-combo")||customElements.define("ng-combo",ed),customElements.get("ng-combo-panel")||customElements.define("ng-combo-panel",rd);class sd{constructor(C){Y(this,rn);Y(this,Do);Y(this,sn);Y(this,ai);Y(this,nn);Y(this,Kr);it(this,"openMenu",(C,t)=>{var l=$(f(this,Kr)).css("font"),c=150;for(const o of f(this,sn))c=Math.max(c,H.measureTextSize(o.name,l).width+60);$(f(this,Kr)).css({width:c,top:t,left:C}),f(this,Kr).open(),f(this,ai)&&f(this,ai).show&&f(this,ai).show.call(this,{source:f(this,Do)})});Y(this,ph,C=>{tt(this,sn,f(this,Bo).call(this,C.items,0)),tt(this,ai,C.events),tt(this,Kr,$(`<ng-context-menu-panel id="${C.id}"></ng-context-menu-panel>`)[0]),$(f(this,rn).shadowRoot).append($(f(this,Kr)).hide()),f(this,Kr).init(f(this,sn)),$("li",f(this,Kr)).on("mousedown",t=>{C.callback&&(t.menuId=t.currentTarget.getAttribute("menu-id"),t.source=f(this,Do),C.callback(t)),$("ng-context-menu-panel",f(this,rn).shadowRoot).hide()})});Y(this,Bo,(C,t)=>{tt(this,nn,Math.max(t,f(this,nn))+1),C=f(this,mh).call(this,C);for(const l of C)l.level=t,l.hasOwnProperty("items")&&(l.items=f(this,Bo).call(this,l.items,t+1));return C});Y(this,mh,C=>{if(Array.isArray(C))return C;var t=[];for(const c in C){var l=C[c];l.menuId=c,t.push(l)}return t});tt(this,nn,0),tt(this,rn,C.owner),f(this,ph).call(this,C)}}rn=new WeakMap,Do=new WeakMap,sn=new WeakMap,ai=new WeakMap,nn=new WeakMap,Kr=new WeakMap,ph=new WeakMap,Bo=new WeakMap,mh=new WeakMap;class id extends HTMLElement{constructor(){super();it(this,"init",t=>{var l=$("ul",this);$("li",l).remove(),f(this,Fo).call(this,l,t),$("li",this).on("mouseover",f(this,gh)),$("li",this).on("mouseout",c=>{H.j.querySelectorAll(c.currentTarget).removeClass("visible")})});it(this,"open",()=>{$(this).show()});Y(this,Fo,(t,l)=>{for(const n of l){var c=(n.hasOwnProperty("className")?n.className:"")+(n.hasOwnProperty("items")?" submenu":""),o=$(`<li menu-id='${n.menuId}' id="${n.name}" class="${c.trim()}"><span>${n.name}</span></li>`);if(t.append(o),n.hasOwnProperty("items")){var r=$("<ul></ul>");o.append(r),f(this,Fo).call(this,r,n.items)}}});Y(this,gh,t=>{H.j.querySelectorAll(t.currentTarget).addClass("visible");var l=$(this).css("font"),c=150;$("ul > li:visible > span",t.currentTarget).each((o,r)=>{c=Math.max(c,H.measureTextSize($(r).text(),l).width+60)}),$("ul",t.currentTarget).eq(0).css({width:c,top:-9,left:$(t.currentTarget.closest("ul")).width()-8,"z-index":Number($(this).css("z-index"))+1})})}connectedCallback(){this.innerHTML="<ul></ul>"}}Fo=new WeakMap,gh=new WeakMap,customElements.get("ng-context-menu-panel")||customElements.define("ng-context-menu-panel",id);class nd{constructor(C){Y(this,Ur);Y(this,qo,()=>{$(".ng-table tbody",f(this,Ur).shadowRoot).on("click","th,td",f(this,bh)),$(".ng-table thead",f(this,Ur).shadowRoot).on("click","th,td",f(this,yh)),$(".ng-table tfoot",f(this,Ur).shadowRoot).on("click","th,td",f(this,vh))});Y(this,bh,C=>{if(![1,2].includes(C.detail))return;const t=["altKey","ctrlKey","shiftKey","clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","button","buttons","whitch"],l=C.target.closest("th,td"),c=C.detail==1?H.EVENT.CELL_CLICK:H.EVENT.CELL_DBL_CLICK,o=new CustomEvent(c,{bubbles:!0,composed:!0,detail:{target:l}});o.col=l.dataset.col,o.row=l.dataset.row,o.subrow=parseInt(l.dataset.matrixRow)%parseInt(l.dataset.row),o.bind=l.dataset.bind,H.copyProperty(o,C,t),f(this,Ur).dispatchEvent(o)});Y(this,yh,C=>{if(![1,2].includes(C.detail))return;const t=["altKey","ctrlKey","shiftKey","clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","button","buttons","whitch"],l=C.target.closest("th,td"),c=C.detail==1?H.EVENT.HEADCELL_CLICK:H.EVENT.HEADCELL_DBL_CLICK,o=new CustomEvent(c,{bubbles:!0,composed:!0,detail:{target:l}});o.col=l.dataset.col,H.copyProperty(o,C,t),f(this,Ur).dispatchEvent(o)});Y(this,vh,C=>{if(![1,2].includes(C.detail))return;const t=["altKey","ctrlKey","shiftKey","clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","button","buttons","whitch"],l=C.target.closest("th,td"),c=C.detail==1?H.EVENT.FOOTCELL_CLICK:H.EVENT.FOOTCELL_DBL_CLICK,o=new CustomEvent(c,{bubbles:!0,composed:!0,detail:{target:l}});o.col=l.dataset.col,H.copyProperty(o,C,t),f(this,Ur).dispatchEvent(o)});tt(this,Ur,C),f(this,qo).call(this),f(this,Ur).addEventListener(H.EVENT.LAYOUT_CHANGED,t=>{f(this,qo).call(this)})}}Ur=new WeakMap,qo=new WeakMap,bh=new WeakMap,yh=new WeakMap,vh=new WeakMap;class od extends Ue.trace.constructor{constructor(){super(),this.init("nine-grid","green")}}const jr=new od;class ad{constructor(C){Y(this,Zr);Y(this,Ho);Y(this,us);it(this,"count",()=>f(this,Zr).rawRecords.length);it(this,"has",C=>f(this,Zr).data.filter(C).length>0);it(this,"first",C=>(f(this,Zr).data.first(C).__ng||{rowidx:-1}).rowidx);it(this,"last",C=>(f(this,Zr).data.last(C).__ng||{rowidx:-1}).rowidx);tt(this,Zr,C),tt(this,Ho,-1),tt(this,us,-1)}get at(){return f(this,us)}set at(C){tt(this,Ho,f(this,us)),tt(this,us,parseInt(C)),f(this,Zr).owner.body.querySelector(`tbody.bindable tr[data-row="${f(this,us)}"]`)||setTimeout(()=>{f(this,Zr).owner.scrollTo_V1(f(this,us))})}}Zr=new WeakMap,Ho=new WeakMap,us=new WeakMap;class ld{constructor(C,t){Y(this,Ve);Y(this,Dt);Y(this,Pe);Y(this,Tr);Y(this,li);Y(this,Ls);it(this,"initialize",()=>{tt(this,Ls,[]),$(f(this,Ve).template).each((C,t)=>{f(this,Ls).push($(t).height())}),(f(this,Dt).rawRecords||[]).forEach(C=>{C.__ng.height=f(this,Ls).slice()})});it(this,"set",C=>{jr.log("ngData.set"),this.clear(),this.add(C,!1);const t=()=>{var l,c,o,r;(c=(l=f(this,Dt))==null?void 0:l.owner)!=null&&c.matrix?(r=(o=f(this,Dt))==null?void 0:o.owner)==null||r.matrix.updateCumulativeHeights():setTimeout(t,50)};t()});it(this,"assign",C=>{this.source=C;for(var t=0;t<C.length;t++)f(this,Pe)[t].__ng._[H.ROW.ID]=C[t].__ng._[H.ROW.ID],tt(this,li,Math.max(f(this,li),C[t].__ng.rowid))});it(this,"getId",C=>C.__ng._[H.ROW.ID]);it(this,"reset",()=>{tt(this,Pe,[]),tt(this,Tr,[])});it(this,"refresh",()=>{f(this,Dt).viewRecords.reset()});it(this,"clearFilter",()=>(f(this,Dt).rawRecords.map(C=>{C.__ng.filtered=!1}),tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng.filtered)),f(this,Pe)));it(this,"refreshFilter",()=>(tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng.filtered)),f(this,an).call(this),f(this,Pe)));it(this,"setFilter",C=>{f(this,Ve).filtering.on();let t={};if(Array.isArray(C))for(let c in C[0])console.log(`::::::${c}::::::`),t[c]=Array.from(new Set(C.map(o=>o[c])));else t=C;this.clearFilter();for(let c in t){const o=t[c],r=f(this,Dt).owner.fields.indexOf(c);let n=!1;for(let s of this.getValidData())if(s.v[r]!=null){n=typeof s.v[r]=="number";break}if(n)for(var l=0;l<o.length;l++)o[l]=Number(o[l]);this.getValidData().filter(s=>o.nineBinarySearch(s.v[r]||"")<0).map(s=>{s.__ng.filtered=!0})}this.refreshFilter(),f(this,Ve).shadowRoot.querySelectorAll("ng-filter-button").forEach(c=>{c.filterOptions.forEach(o=>{o.data=[]})}),Object.entries(t).forEach(([c,o])=>{f(this,Ve).shadowRoot.querySelectorAll("ng-filter-button").forEach(r=>{let n=r.filterOptions;n.forEach(s=>{s.colnm===c&&(s.data=o)}),r.filterOptions=n})}),f(this,Dt).owner.scrollTo_V1(0),f(this,Dt).owner.paging.reset()});it(this,"indexOf",C=>f(this,on).call(this,this.recordsNF(),C,this.records()));Y(this,on,(C,t,l)=>{const c=C[t];return l.findIndex(o=>o.__ng._[H.ROW.ID]==c.__ng._[H.ROW.ID])});it(this,"moveRow",(C,t)=>{C!=t&&(H.move(f(this,Dt).rawRecords,this.total.indexOf(C),this.total.indexOf(t)),this.resetRecords(),f(this,Dt).owner.dataManager.viewRecords.reset())});it(this,"filter",C=>f(this,Pe).filter(C));it(this,"max",(C,t)=>{var l=(t?this.filter(t):f(this,Dt).rawRecords).map(c=>c[C]);return l&&l.length>0?l.reduce((c,o)=>c>o?c:o):null});it(this,"min",(C,t)=>{var l=(t?this.filter(t):f(this,Dt).rawRecords).map(c=>c[C]);return l&&l.length>0?l.reduce((c,o)=>c>o?o:c):null});it(this,"first",C=>this.filter(C).first());it(this,"last",C=>this.filter(C).last());it(this,"count",()=>this.getValidData().length);it(this,"countNF",()=>this.getValidDataNF().length);it(this,"onRowStateChanged",()=>{const C=this.getChangedData(),t=$("tbody td[data-bind=rowState]",f(this,Dt).owner.body);if(t.length<=0)return;const l=t.eq(0)[0].dataset.col,c=H.j.querySelectorAll(`thead th[data-col="${l}"]:not(.col-indicator)`,f(this,Dt).owner.body);c.removeClass("deleted").removeClass("added").removeClass("updated"),C.delete.length>0?c.addClass("deleted"):C.insert.length>0?c.addClass("added"):C.update.length>0&&c.addClass("updated"),f(this,Dt).owner.paging.refreshTotal()});Y(this,zo,C=>(Array.isArray(C)||(C=[C]),C.forEach((t,l)=>{t.__ng=this.default,t.__ng.rowid=this.nextId,t.__ng.rowState=H.ROW_STATE.INSERT,t.__ng._[H.ROW.ID]=t.__ng.rowid}),this.onRowStateChanged(),C));it(this,"sort",C=>{f(this,Dt).rawRecords.sort(C),f(this,Tr).sort(C),f(this,Pe).sort(C),f(this,an).call(this),f(this,Dt).owner.refresh()});Y(this,an,()=>{f(this,Dt).rawRecords.forEach((t,l)=>{t.__ng._[H.ROW.INDEX]=l}),f(this,Dt).rawRecords.filter(t=>!t.__ng.deleted&&!t.__ng.filtered&&t.__ng.visible).forEach((t,l)=>{t.__ng._[H.ROW.ORDER]=l+1});const C=f(this,Dt).rawRecords.filter(t=>!t.__ng.deleted&&t.__ng._[H.ROW.PIN]);C.forEach((t,l)=>{t.__ng._[H.ROW.VISIBLE_ROW]=(C.length-l)*-1}),f(this,Pe).forEach((t,l)=>{t.__ng._[H.ROW.VISIBLE_ROW]=l});//!m.__ng.deleted && !m.__ng.pin && !m.__ng._[ninegrid.ROW.PIN] && !m.__ng.filtered && m.__ng.visible && m.__ng.paging;
216
+ });it(this,"resetIndex",()=>{f(this,Dt).rawRecords.forEach((C,t)=>{C.__ng.ii=t,C.__ng.rowidx=t,C.__ng.rowidx1=t}),this.getValidData().forEach((C,t)=>{C.__ng.i=t,C.__ng.rowidx=t}),f(this,an).call(this)});it(this,"resetRecords",()=>{tt(this,Tr,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted)),tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng._[H.ROW.PIN]&&!C.__ng._[H.ROW.COLLAPSE]&&!C.__ng.filtered&&C.__ng.visible&&C.__ng.paging)),this.resetIndex()});Y(this,Uo,C=>{Array.isArray(C)||(C=[C]);var t=[];return C.forEach(l=>{var c={v:[]};for(const o of f(this,Ve).fields.get())c.v.push(H.nvl(l[o],""));t.push(c)}),t});it(this,"exprFunction",C=>{let t="...args",l="let [data, currow] = args; currow = Number(currow); return "+C+";";return new Function(t,l)});it(this,"__ng",C=>{var t=this.getValidData();if(t.length==0)return null;try{return t[C].__ng}catch(l){console.error(l,t,C)}});it(this,"getValidData",()=>(f(this,Pe).length==0&&tt(this,Pe,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted&&!C.__ng._[H.ROW.PIN]&&!C.__ng._[H.ROW.COLLAPSE]&&C.__ng._[H.ROW.VISIBLE]&&!C.__ng.filtered&&C.__ng.visible&&C.__ng.paging)),f(this,Pe)));it(this,"getValidDataNF",()=>(f(this,Tr).length==0&&tt(this,Tr,f(this,Dt).rawRecords.filter(C=>!C.__ng.deleted)),f(this,Tr)));it(this,"conv",C=>{if(H.isNull(C))return C;if(Array.isArray(C)){var t=[];for(const r of C){for(var l={},c=0;c<f(this,Ve).fields.get().length;c++){const n=f(this,Ve).fields.get()[c];l[n]=r.v[c]}l.__ng=r.__ng,t.push(l)}return t}else{for(var o=C,l={},c=0;c<f(this,Ve).fields.get().length;c++){const s=f(this,Ve).fields.get()[c];l[s]=o.v[c]}return l.__ng=o.__ng,l}});it(this,"conv2",C=>{if(H.isNull(C))return C;if(Array.isArray(C)){var t=[];for(const r of C){for(var l={},c=0;c<f(this,Ve).fields.get().length;c++){const n=f(this,Ve).fields.get()[c];l[n]=r.v[c]}l.__ng=r.__ng,t.push(l)}return t}else{for(var o=C,l={},c=0;c<f(this,Ve).fields.get().length;c++){const s=f(this,Ve).fields.get()[c];l[s]=o.v[c]}return l.__ng=o.__ng,l}});it(this,"changeRowState",(C,t,l)=>{const c=o=>{[H.ROW_STATE.EMPTY,H.ROW_STATE.NORMAL].includes(C)&&(o.__ng.o={}),o.__ng.rowState=C};C||(C=H.ROW_STATE.EMPTY),!t&&!l&&(t=0,l=this.count()-1),t||(t=0),l||(l=t),l>=this.count()&&(l=this.count()-1),f(this,Pe).forEach((o,r)=>{o.__ng.rowidx>=t&&o.__ng.rowidx<=l&&c(o)}),f(this,Tr).forEach((o,r)=>{o.__ng.rowidx>=t&&o.__ng.rowidx<=l&&c(o)}),this.getValidDataNF().forEach((o,r)=>{o.__ng.rowidx>=t&&o.__ng.rowidx<=l&&c(o)}),this.onRowStateChanged(),f(this,Dt).viewRecords.reset()});it(this,"getCheckedData",C=>this.get().filter(t=>t.__ng.c[C]==!0));it(this,"search",(C,t)=>this.get().filter(l=>l[C]==t));Y(this,Vo,(C,t,l,c)=>{if(l==c)return;const o=new CustomEvent(H.EVENT.DATA_CHANGED,{bubbles:!0,detail:{}});o.row=C,o.bind=t,o.oldvalue=l,o.value=c,o.data=this.get(C),f(this,Dt).owner.dispatchEvent(o)});it(this,"add",(C,t)=>{C==null&&(C={}),t==null&&(t=!0);const l=f(this,Uo).call(this,C);f(this,Dt).rawRecords=f(this,Dt).rawRecords.concat(f(this,zo).call(this,l));const c=f(this,Dt).rawRecords.map(r=>r.__ng._[H.ROW.ORIGIN_ORDER]);if(c.length>0){const r=c.reduce(function(n,s){return n>s?n:s});f(this,Dt).rawRecords.forEach((n,s)=>{n.__ng._[H.ROW.ORIGIN_ORDER]<0&&(n.__ng._[H.ROW.ORIGIN_ORDER]=r+1+s)})}this.resetRecords();const o=this.count()-1;return t||this.changeRowState(H.ROW_STATE.EMPTY,o-l.length+1,o),f(this,Dt).viewRecords.reset(),o});it(this,"insert",(C,t,l)=>{C==null&&(C={}),t==null&&(t=0),l==null&&(l=!0);var c=f(this,Uo).call(this,C);const o=f(this,Dt).rawRecords[t].__ng._[H.ROW.ORIGIN_ORDER];return f(this,Dt).rawRecords.filter(r=>r.__ng._[H.ROW.ORIGIN_ORDER]>=o).forEach(r=>{r.__ng._[H.ROW.ORIGIN_ORDER]+=c.length}),c=f(this,zo).call(this,c),c.forEach((r,n)=>{r.__ng._[H.ROW.ORIGIN_ORDER]=o+n}),f(this,Dt).rawRecords.splice(t,0,...c),this.resetRecords(),l||this.changeRowState(H.ROW_STATE.EMPTY,t,t+c.length-1),f(this,Dt).viewRecords.reset(),t});Y(this,wh,C=>{var t=!1;C.sort((l,c)=>c-l).forEach(l=>{f(this,Pe)[l].__ng.rowState==H.ROW_STATE.INSERT?H.removeIf(f(this,Dt).rawRecords,c=>c.__ng.rowid==f(this,Pe)[l].__ng.rowid):(f(this,Dt).rawRecords.filter(c=>c.__ng.rowid==f(this,Pe)[l].__ng.rowid).map(c=>{c.__ng.deleted=!0,c.__ng.rowState=H.ROW_STATE.DELETE}),t=!0)}),t&&this.onRowStateChanged(),tt(this,Pe,f(this,Dt).rawRecords.filter(l=>!l.__ng.deleted&&!l.__ng.filtered)),tt(this,Tr,f(this,Dt).rawRecords.filter(l=>!l.__ng.deleted)),this.getValidDataNF().forEach((l,c)=>{l.__ng.rowidx=c}),this.getValidData().forEach((l,c)=>{l.__ng.rowidx=c}),f(this,Dt).viewRecords.reset()});it(this,"delete",C=>{var t=[];if(Array.isArray(C))t=C;else if(typeof C>"u"){if(f(this,Dt).owner.row.at<0)throw`invalid ${f(this,Dt).owner.row.at}`;t=[f(this,Dt).owner.row.at]}else if(typeof C=="number"||typeof C=="string")t=[C];else if(typeof C=="object"){const l=f(this,Pe).findIndex(c=>c.__ng._[H.ROW.ID]==C.__ng._[H.ROW.ID]);if(l<0)throw new Error(`${C.__ng._[H.ROW.ID]} not found.`);t=[l]}else throw`invalid ${C}`;f(this,wh).call(this,t)});it(this,"deleteFromId",C=>{var t=this.records();const l=t.findIndex(c=>c.__ng._[H.ROW.ID]==C);if(l<0)throw new Error(`${C} not found.`);this.delete(l)});Y(this,Wo,(C,t,l)=>{if(typeof l>"u")l=C.findIndex(e=>e.__ng._[H.ROW.ID]==t.__ng._[H.ROW.ID]);else if(typeof l=="number"||typeof l=="string")l=parseInt(l);else throw`invalid ${l}`;var c=C[l],o=!1;for(const e in t)if(!["__ng","rowState"].includes(e)){var r=f(this,Ve).fields.indexOf(e);if(!(r<0)){var n=c.v[r],s=t[e];c.v[r]=s,n!=s&&(c.__ng.rowState=H.ROW_STATE.UPDATE,o=!0,f(this,Vo).call(this,l,e,n,s))}}o&&this.onRowStateChanged(),f(this,Dt).owner.refreshData()});it(this,"update",(C,t)=>{f(this,Wo).call(this,f(this,Pe),C,t)});it(this,"setValue",(C,t,l,c)=>{f(this,Xo).call(this,C,t,l,c,!1)});it(this,"setValueNF",(C,t,l,c)=>{f(this,Xo).call(this,C,t,l,c,!0)});Y(this,Xo,(C,t,l,c,o)=>{C=parseInt(C),c==null&&(c=!0);const r=f(this,Ve).fields.indexOf(t);if(!(r<0)){var n=o?this.getValidDataNF()[C]:this.getValidData()[C],s=n.v[r];n.v[r]!=l&&n.__ng.rowState!=H.ROW_STATE.INSERT&&(n.__ng.o.hasOwnProperty(t)||(n.__ng.o[t]=s),c&&(n.__ng.rowState=H.ROW_STATE.UPDATE,this.onRowStateChanged())),n.v[r]=l,f(this,Dt).owner.refreshData(C),f(this,Vo).call(this,C,t,s,l)}});it(this,"setRecord",(C,t,l,c)=>{f(this,ln).call(this,this.getValidData(),C,t,l,c,!1)});it(this,"setRecordNF",(C,t,l,c)=>{f(this,ln).call(this,this.getValidDataNF(),C,t,l,c,!0)});Y(this,ln,(C,t,l,c,o)=>{t=parseInt(t),l=parseInt(l),o==null&&(o=!0);var r=C[t];r.v[l],r.v[l]!=c&&r.__ng.rowState!=H.ROW_STATE.INSERT&&o&&(r.__ng.rowState=H.ROW_STATE.UPDATE),r.v[l]=c});it(this,"getChangedData",C=>C?this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==C)):{insert:this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.INSERT)),update:this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.UPDATE)),delete:this.conv2(f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.DELETE))});it(this,"isChanged",()=>f(this,Dt).rawRecords.filter(t=>t.__ng.rowState==H.ROW_STATE.INSERT||t.__ng.rowState==H.ROW_STATE.UPDATE||t.__ng.rowState==H.ROW_STATE.DELETE).length>0);Y(this,hn,(C,t,l)=>{if(!(!C||C.length<=0)){if(H.isNull(t))return this.conv2(C);if(t<0||t>=C.length)throw`invalid row : ${t}`;if(l!=null){var c=f(this,Ve).fields.indexOf(l);return c>=0?C[t].v[c]:null}var o=t==null?C:C[t];return this.conv(o)}});it(this,"get",(C,t)=>f(this,hn).call(this,this.getValidData(),C,t));it(this,"getNF",(C,t)=>f(this,hn).call(this,this.getValidDataNF(),C,t));it(this,"records",C=>H.isNull(C)?this.getValidData():this.getValidData(C));it(this,"recordsNF",C=>H.isNull(C)?this.getValidDataNF():this.getValidDataNF(C));it(this,"getRow",C=>this.getValidData()[C]);it(this,"getRowNF",C=>this.getValidDataNF()[C]);Y(this,Yo,(C,t)=>{var l=f(this,Ve).fields.indexOf(t);return l<0?[]:C.map(c=>c.v[l])});it(this,"getMap",C=>f(this,Yo).call(this,this.getValidData(),C));it(this,"getMapNF",C=>f(this,Yo).call(this,this.getValidDataNF(),C));it(this,"findIndex",C=>f(this,Go).call(this,this.getValidData(),C));it(this,"findIndexNF",C=>f(this,Go).call(this,this.getValidDataNF(),C));Y(this,Go,function(C,t){return this.conv2(C).findIndex(t)});it(this,"findIndex_1",C=>f(this,Ko).call(this,this.getValidData(),C));it(this,"findIndexNF_1",C=>f(this,Ko).call(this,this.getValidDataNF(),C));Y(this,Ko,function(C,t){let l=0,c=C.length-1,o;for(;l<=c;){if(o=parseInt((l+c)/2),t===C[o].__ng._[H.ROW.INDEX])return o;t<C[o].__ng._[H.ROW.INDEX]?c=o-1:l=o+1}return-1});tt(this,Ve,C),tt(this,Dt,t),tt(this,Pe,[]),tt(this,Tr,[]),tt(this,li,0),this.all={get:(l,c)=>f(this,hn).call(this,this.recordsNF(),l,c),records:l=>this.recordsNF(l),count:()=>this.recordsNF().length,setRecord:(l,c,o,r)=>f(this,ln).call(this,this.all.records(),l,c,o,r),indexOf:l=>f(this,on).call(this,this.records(),l,this.recordsNF()),update:(l,c)=>f(this,Wo).call(this,this.records(),l,c)},this.total={indexOf:l=>f(this,on).call(this,this.records(),l,f(this,Dt).rawRecords)},this.initialize()}get source(){return this.conv2(f(this,Dt).rawRecords)}set source(C){this.clear(),this.add(C,!1),jr.log("ngData.source",C);const t=()=>{var l,c,o,r;(c=(l=f(this,Dt))==null?void 0:l.owner)!=null&&c.matrix?(r=(o=f(this,Dt))==null?void 0:o.owner)==null||r.matrix.updateCumulativeHeights():setTimeout(t,50)};t()}get nextId(){return++Ru(this,li)._}get default(){return{rowState:H.ROW_STATE.EMPTY,deleted:!1,filtered:!1,pin:!1,expand:!0,visible:!0,paging:!0,height:f(this,Ls).slice(),o:{},c:{},_:[0,0,0,0,H.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,f(this,Ls).slice(),-1,{},{}]}}clear(){delete f(this,Dt).rawRecords,tt(this,Pe,[]),tt(this,Tr,[]),f(this,Dt).rawRecords=[],f(this,Dt).viewRecords.reset()}}Ve=new WeakMap,Dt=new WeakMap,Pe=new WeakMap,Tr=new WeakMap,li=new WeakMap,Ls=new WeakMap,on=new WeakMap,zo=new WeakMap,an=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,wh=new WeakMap,Wo=new WeakMap,Xo=new WeakMap,ln=new WeakMap,hn=new WeakMap,Yo=new WeakMap,Go=new WeakMap,Ko=new WeakMap;class hd{constructor(C){this.owner=C,this.row=new ad(this),this.data=new ld(C,this),this.setDataSource=l=>{jr.log(l),this.data&&this.data.reset(),this.pageCnt=25,this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.viewRecords.touch=()=>{this.viewRecords.updateCnt=(this.viewRecords.updateCnt||0)+1},this.viewRecords.rawIndex=0,this.viewRecords.setPageCnt=c=>{this.pageCnt=c},this.viewRecords.reset=()=>{this.owner.view&&this.owner.view.redraw()},this.viewRecords.resetV2=()=>{this.owner.view.redrawV2()},this.data.set(l)},this.getRowState=c=>{var c=parseInt(c);if(!(c>=this.data.count()))return this.data.__ng(c).rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=l=>{this.row.at=l},this.pageUp=()=>{if(!this.owner.isFirstPage){var l=$(".ng-container-body",this.owner.body).height()-($(".ng-container-body thead",this.owner.body).height()||0)-($(".ng-container-body tfoot",this.owner.body).height()||0);l-=$(".ng-container-body tbody.fixed",this.owner.body).height();for(var c=0,o=this.viewRecords.rawIndex;c<l;){o--;for(var r=0;r<this.owner.template.length;r++){var n=parseInt(o*this.owner.template.length+r);c+=this.owner.matrix.getHeight(n)}}return this.scrollTo_V1(o+1)}},this.pageDown=()=>{if(this.owner.isLastPage||!$("ng-vscrollbar",this.owner.body).is(":visible"))return;const l=parseInt(Array.from(this.owner.body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)")).pop().dataset.row);return this.scrollTo_V1(l)},this.scrollTo_V1=l=>(l<0&&(l=0),l>=this.rawRecords.length&&(l=this.rawRecords.length-1),this.viewRecords.rawIndex=l,this.viewRecords.reset(),!(l<=0||l>=this.rawRecords.length-1)),this.scrollToV2=l=>(l<0&&(l=0),l>=this.rawRecords.length&&(l=this.rawRecords.length-1),this.viewRecords.rawIndex=l,this.viewRecords.resetV2(),!(l<=0||l>=this.rawRecords.length-1)),this.exprFunction=l=>{l=l.replaceAll("ninegrid.ROW.ORDER",H.ROW.ORDER);let c="...args",o="let [data, currow, all] = args; currow = Number(currow); return "+l+";";return new Function(c,o)},this.exprFunction2=l=>{this.owner.fields.get().forEach(r=>{const n=this.owner.fields.indexOf(r);l=l.replaceAll(`data.${r}`,`data.v[${n}]`)});let c="...args",o="let [data, currow, all] = args; currow = Number(currow); return "+l+";";return new Function(c,o)},this.getColumn=(l,c)=>this.data.get(l,c),this.setColumn=(l,c,o)=>{l=parseInt(l),this.data.get(l)[c]!=o&&this.data.get(l).__ng.rowState!=H.ROW_STATE.INSERT&&(this.data.get(l).__ng.rowState=H.ROW_STATE.UPDATE,this.data.onRowStateChanged()),this.setColumnSilent(l,c,o)},this.setColumnSilent=(l,c,o)=>{this.data.set(l,c,o)},this.setDataSource([]);for(var t in this.row)["first","last","count","add","insert","move","delete"].includes(t)||(this.data[t]=this.row[t])}}class cd extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const C=this.getAttribute("type")||"sphere",t=this.getAttribute("size")||this.getAttribute("width")||this.getAttribute("height")||"8",l=this.getAttribute("width")||this.getAttribute("size")||"8",c=this.getAttribute("height")||this.getAttribute("size")||"8",o=this.getAttribute("color")||"gray";var r="";switch(C){case"sphere":r=`<div class="ng-expand-icon-sphere" style="width: ${t}px; height: ${t}px; background: radial-gradient(circle farthest-corner at 33% 33%, white 0%, ${o} 80%), radial-gradient(circle farthest-corner at 45% 45%, rgba(0, 0, 0, 0) 50%, #000000 80%);" />`;break;case"circle":var n=Number(t)/2,s=this.getAttribute("stroke")||"#666",e=Number(this.getAttribute("stroke-width")||0),i=n+e,u=n+e;r=`
217
217
  <svg class="ng-expand-icon-circle" viewBox="0 0 ${t} ${t}" width="${t}" height="${t}" xmlns="http://www.w3.org/2000/svg">
218
218
  <circle fill="${o}" stroke="${s}" stroke-width="${e}" cx="${i}" cy="${u}" r="${n}"/>
219
219
  </svg>
@@ -499,7 +499,7 @@ use chrome, FireFox or Internet Explorer 11`)}var s=t("safe-buffer"),e=t("random
499
499
  ${t.join(" ")}
500
500
  ondragstart="return false;"
501
501
  >
502
- `,super.connectedCallback(),tt(this,Ke,this.shadowRoot.querySelector("input")),f(this,Ke).addEventListener("keydown",f(this,$h)),f(this,Ke).addEventListener("compositionstart",c=>{c.target.selectionStart==c.target.selectionEnd&&f(this,Wr)&&H.getByteLength(c.target.value)>=Number(f(this,Wr))&&(c.target.value=H.cut(c.target.value,Number(f(this,Wr))),this.value=c.target.value)}),f(this,Ke).addEventListener("compositionupdate",c=>{f(this,ms)=="number"&&(c.target.value=c.target.value.replace(c.data,""))}),f(this,Ke).addEventListener("compositionend",c=>{}),f(this,Ke).addEventListener("keydown",c=>{c.isComposing||c.keyCode===229||(["Enter","Escape"].includes(c.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown","ArrowUp","ArrowDown"].includes(c.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(c)))})}}Ke=new WeakMap,ms=new WeakMap,Wr=new WeakMap,Ds=new WeakMap,gn=new WeakMap,ts=new WeakMap,$h=new WeakMap,customElements.get("ng-input")||customElements.define("ng-input",jd);class $d{constructor(C){Y(this,ke);Y(this,ui);Y(this,bn);Y(this,yn);Y(this,vn);Y(this,di,[]);it(this,"getHeight",C=>{const t=parseInt(C/f(this,ke).template.length);if(t<0||t>=f(this,ke).data.count())return 32;const l=f(this,ke).data.__ng(t);return l?l.height[parseInt(C%f(this,ke).template.length)]:32});it(this,"setHeight",(C,t)=>{f(this,ke).data.get(parseInt(C/f(this,ke).template.length)).__ng.height[parseInt(C%f(this,ke).template.length)]=t});Y(this,fi,C=>typeof C=="object"&&C.tagName=="TR"?parseInt(C.getAttribute("data-row"))*f(this,ke).template.length+C.sectionRowIndex%f(this,ke).template.length:C);it(this,"attr",(C,t,l,c)=>{t=f(this,fi).call(this,t);var o=parseInt(t/f(this,ke).template.length),r=f(this,ke).data.get(o,"rowid"),n=t%f(this,ke).template.length,s=H.decode(C,"head",f(this,bn),"foot",f(this,vn),f(this,yn)),e=s.findIndex(u=>u.rowid==r&&u.subrow==n);if(c)if(e<0){var i={rowid:r,subrow:n,cells:[]};i[l]=c,s.push(i)}else s[e][l]=c;else return e<0?null:s[e][l]});it(this,"height",(C,t,l)=>{var c=this.attr(C,t,"height",l);return c||(c=$(f(this,ke).template[f(this,fi).call(this,t)%f(this,ke).template.length]).height()),c});it(this,"attr2",(C,t,l,c,o)=>{l=f(this,fi).call(this,l);var r=parseInt(l/f(this,ke).template.length),n=C&&C.hasOwnProperty("rowid")?C[r].rowid:null,s=l%f(this,ke).template.length,e=H.decode(t,"head",f(this,bn),"foot",f(this,vn),f(this,yn)),i=e.findIndex(a=>a.rowid==n&&a.subrow==s);if(o)if(i<0){var u={rowid:n,subrow:s,cells:[]};u[c]=o,e.push(u)}else e[i][c]=o;else return i<0?null:e[i][c]});it(this,"height2",(C,t,l,c)=>{var o=this.attr2(C,t,l,"height",c);return o||(o=$(f(this,ke).template[f(this,fi).call(this,l)%f(this,ke).template.length]).height()),o});tt(this,ke,C),tt(this,ui,-1),tt(this,bn,[]),tt(this,yn,[]),tt(this,vn,[]),this.head={attr:(t,l,c)=>this.attr("head",t,l,c),height:(t,l)=>this.height("head",t,l)},this.body={attr:(t,l,c)=>this.attr("body",t,l,c),height:(t,l)=>this.height("body",t,l),height2:(t,l,c)=>this.height2(t,"body",l,c)},this.foot={attr:(t,l,c)=>this.attr("foot",t,l,c),height:(t,l)=>this.height("foot",t,l)},tt(this,di,[0])}get row(){return f(this,ui)}set row(C){tt(this,ui,parseInt(C)),f(this,ke).selection.selectedStartRow==f(this,ke).selection.selectedEndRow&&(f(this,ke).selection.selectedStartRow=f(this,ke).selection.selectedEndRow=f(this,ke).selection.startRow=f(this,ui))}updateCumulativeHeights(){Br.log("***********************====================="),Br.log(f(this,ke).data),tt(this,di,[0]);let C=0;const t=f(this,ke).data.count();for(let l=0;l<t;l++){let c=0;for(let o=0;o<f(this,ke).template.length;o++)c+=this.getHeight(l*f(this,ke).template.length+o);C+=c,f(this,di).push(C)}Br.log(f(this,di))}getRowInfoAt(C){const t=this.cumulativeHeights;if(!t||t.length<2)return{index:0,offset:C};if(C<=0)return{index:0,offset:C};if(C>=t[t.length-1])return{index:t.length-2,offset:C-t[t.length-2]};let l=0,c=t.length-2,o=0;for(;l<=c;){let n=Math.floor((l+c)/2);t[n]<=C?(o=n,l=n+1):c=n-1}const r=t[o];return{index:o,offset:C-r}}}ke=new WeakMap,ui=new WeakMap,bn=new WeakMap,yn=new WeakMap,vn=new WeakMap,di=new WeakMap,fi=new WeakMap;class Ld extends HTMLElement{constructor(){super();Y(this,es);Y(this,rs);it(this,"popup",()=>{setTimeout(()=>{f(this,rs).data.assign(f(this,es).data.get()),this.shadowRoot.querySelector("dialog").showModal()},100)});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,es,this.getRootNode().host),this.shadowRoot.innerHTML=`
502
+ `,super.connectedCallback(),tt(this,Ke,this.shadowRoot.querySelector("input")),f(this,Ke).addEventListener("keydown",f(this,$h)),f(this,Ke).addEventListener("compositionstart",c=>{c.target.selectionStart==c.target.selectionEnd&&f(this,Wr)&&H.getByteLength(c.target.value)>=Number(f(this,Wr))&&(c.target.value=H.cut(c.target.value,Number(f(this,Wr))),this.value=c.target.value)}),f(this,Ke).addEventListener("compositionupdate",c=>{f(this,ms)=="number"&&(c.target.value=c.target.value.replace(c.data,""))}),f(this,Ke).addEventListener("compositionend",c=>{}),f(this,Ke).addEventListener("keydown",c=>{c.isComposing||c.keyCode===229||(["Enter","Escape"].includes(c.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown","ArrowUp","ArrowDown"].includes(c.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(c)))})}}Ke=new WeakMap,ms=new WeakMap,Wr=new WeakMap,Ds=new WeakMap,gn=new WeakMap,ts=new WeakMap,$h=new WeakMap,customElements.get("ng-input")||customElements.define("ng-input",jd);class $d{constructor(C){Y(this,ke);Y(this,ui);Y(this,bn);Y(this,yn);Y(this,vn);Y(this,di,[]);it(this,"getHeight",C=>{const t=parseInt(C/f(this,ke).template.length);if(t<0||t>=f(this,ke).data.count())return 32;const l=f(this,ke).data.__ng(t);return l?l.height[parseInt(C%f(this,ke).template.length)]:32});it(this,"setHeight",(C,t)=>{f(this,ke).data.get(parseInt(C/f(this,ke).template.length)).__ng.height[parseInt(C%f(this,ke).template.length)]=t});Y(this,fi,C=>typeof C=="object"&&C.tagName=="TR"?parseInt(C.getAttribute("data-row"))*f(this,ke).template.length+C.sectionRowIndex%f(this,ke).template.length:C);it(this,"attr",(C,t,l,c)=>{t=f(this,fi).call(this,t);var o=parseInt(t/f(this,ke).template.length),r=f(this,ke).data.get(o,"rowid"),n=t%f(this,ke).template.length,s=H.decode(C,"head",f(this,bn),"foot",f(this,vn),f(this,yn)),e=s.findIndex(u=>u.rowid==r&&u.subrow==n);if(c)if(e<0){var i={rowid:r,subrow:n,cells:[]};i[l]=c,s.push(i)}else s[e][l]=c;else return e<0?null:s[e][l]});it(this,"height",(C,t,l)=>{var c=this.attr(C,t,"height",l);return c||(c=$(f(this,ke).template[f(this,fi).call(this,t)%f(this,ke).template.length]).height()),c});it(this,"attr2",(C,t,l,c,o)=>{l=f(this,fi).call(this,l);var r=parseInt(l/f(this,ke).template.length),n=C&&C.hasOwnProperty("rowid")?C[r].rowid:null,s=l%f(this,ke).template.length,e=H.decode(t,"head",f(this,bn),"foot",f(this,vn),f(this,yn)),i=e.findIndex(a=>a.rowid==n&&a.subrow==s);if(o)if(i<0){var u={rowid:n,subrow:s,cells:[]};u[c]=o,e.push(u)}else e[i][c]=o;else return i<0?null:e[i][c]});it(this,"height2",(C,t,l,c)=>{var o=this.attr2(C,t,l,"height",c);return o||(o=$(f(this,ke).template[f(this,fi).call(this,l)%f(this,ke).template.length]).height()),o});tt(this,ke,C),tt(this,ui,-1),tt(this,bn,[]),tt(this,yn,[]),tt(this,vn,[]),this.head={attr:(t,l,c)=>this.attr("head",t,l,c),height:(t,l)=>this.height("head",t,l)},this.body={attr:(t,l,c)=>this.attr("body",t,l,c),height:(t,l)=>this.height("body",t,l),height2:(t,l,c)=>this.height2(t,"body",l,c)},this.foot={attr:(t,l,c)=>this.attr("foot",t,l,c),height:(t,l)=>this.height("foot",t,l)},tt(this,di,[0])}get row(){return f(this,ui)}set row(C){tt(this,ui,parseInt(C)),f(this,ke).selection.selectedStartRow==f(this,ke).selection.selectedEndRow&&(f(this,ke).selection.selectedStartRow=f(this,ke).selection.selectedEndRow=f(this,ke).selection.startRow=f(this,ui))}updateCumulativeHeights(){jr.log("***********************====================="),jr.log(f(this,ke).data),tt(this,di,[0]);let C=0;const t=f(this,ke).data.count();for(let l=0;l<t;l++){let c=0;for(let o=0;o<f(this,ke).template.length;o++)c+=this.getHeight(l*f(this,ke).template.length+o);C+=c,f(this,di).push(C)}jr.log(f(this,di))}getRowInfoAt(C){const t=this.cumulativeHeights;if(!t||t.length<2)return{index:0,offset:C};if(C<=0)return{index:0,offset:C};if(C>=t[t.length-1])return{index:t.length-2,offset:C-t[t.length-2]};let l=0,c=t.length-2,o=0;for(;l<=c;){let n=Math.floor((l+c)/2);t[n]<=C?(o=n,l=n+1):c=n-1}jr.log(o);const r=t[o];return{index:o,offset:C-r}}}ke=new WeakMap,ui=new WeakMap,bn=new WeakMap,yn=new WeakMap,vn=new WeakMap,di=new WeakMap,fi=new WeakMap;class Ld extends HTMLElement{constructor(){super();Y(this,es);Y(this,rs);it(this,"popup",()=>{setTimeout(()=>{f(this,rs).data.assign(f(this,es).data.get()),this.shadowRoot.querySelector("dialog").showModal()},100)});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,es,this.getRootNode().host),this.shadowRoot.innerHTML=`
503
503
  <style>
504
504
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ninegrid.css";
505
505
  :host {
@@ -543,7 +543,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
543
543
  <progress ${n.join(" ")}></progress>
544
544
  <span></span>
545
545
  </div>
546
- `,super.connectedCallback(),tt(this,pi,this.shadowRoot.querySelector("progress")),tt(this,la,this.shadowRoot.querySelector("span")),f(this,pi).getAttribute("max")||f(this,pi).setAttribute("max",100)}}pi=new WeakMap,la=new WeakMap,customElements.get("ng-progress")||customElements.define("ng-progress",Bd);class Fd extends ti{constructor(){super();Y(this,Fs);Y(this,Pr);Y(this,qs);Y(this,mi);it(this,"dataRefresh",t=>{f(this,Pr)&&(f(this,Bh).call(this)?H.j.querySelectorAll(this).removeClass("invalid"):H.j.querySelectorAll(this).addClass("invalid")),$(f(this,Fs)).each((l,c)=>{$(c).prop("checked",this.value==c.getAttribute("value"))}),t||this.reset()});Y(this,Bh,()=>{if(H.isNull(this.value))return!0;var t=f(this,Pr).findIndex(l=>this.value==l[f(this,qs)]);return!(t<0)});Y(this,Fh,()=>{})}async connectedCallback(){tt(this,qs,this.getAttribute("code")||"code"),tt(this,mi,this.getAttribute("codename")||"codename");var t=this.querySelector("datalist");t&&(tt(this,Pr,[]),t.querySelectorAll("option").forEach(n=>{const s=n.getAttribute(f(this,qs)),e=n.getAttribute(f(this,mi));s&&e&&f(this,Pr).push({[f(this,qs)]:s,[f(this,mi)]:e})})),this.owner=this.getRootNode().host,this.cell=this.closest("th,td");const l=this.closest("th,td").getAttribute("text-align")||"center",c=l=="left"?"flex-start":l=="right"?"flex-end":"center";var o=this.getAttribute("data-source");o&&this.owner&&this.owner.exprFunction&&(this.owner[o]?tt(this,Pr,this.owner[o]):tt(this,Pr,this.owner.exprFunction(o).call(this,this.owner.data.get(this.cell.dataset.row),this.cell.dataset.row)));var r="";f(this,Pr)&&f(this,Pr).forEach(n=>{r+=`<label><input type="radio" value="${n[f(this,qs)]}"><span>${n[f(this,mi)]}</span></label>`}),this.shadowRoot.innerHTML=`
546
+ `,super.connectedCallback(),tt(this,pi,this.shadowRoot.querySelector("progress")),tt(this,la,this.shadowRoot.querySelector("span")),f(this,pi).getAttribute("max")||f(this,pi).setAttribute("max",100)}}pi=new WeakMap,la=new WeakMap,customElements.get("ng-progress")||customElements.define("ng-progress",Bd);class Fd extends ti{constructor(){super();Y(this,Fs);Y(this,Dr);Y(this,qs);Y(this,mi);it(this,"dataRefresh",t=>{f(this,Dr)&&(f(this,Bh).call(this)?H.j.querySelectorAll(this).removeClass("invalid"):H.j.querySelectorAll(this).addClass("invalid")),$(f(this,Fs)).each((l,c)=>{$(c).prop("checked",this.value==c.getAttribute("value"))}),t||this.reset()});Y(this,Bh,()=>{if(H.isNull(this.value))return!0;var t=f(this,Dr).findIndex(l=>this.value==l[f(this,qs)]);return!(t<0)});Y(this,Fh,()=>{})}async connectedCallback(){tt(this,qs,this.getAttribute("code")||"code"),tt(this,mi,this.getAttribute("codename")||"codename");var t=this.querySelector("datalist");t&&(tt(this,Dr,[]),t.querySelectorAll("option").forEach(n=>{const s=n.getAttribute(f(this,qs)),e=n.getAttribute(f(this,mi));s&&e&&f(this,Dr).push({[f(this,qs)]:s,[f(this,mi)]:e})})),this.owner=this.getRootNode().host,this.cell=this.closest("th,td");const l=this.closest("th,td").getAttribute("text-align")||"center",c=l=="left"?"flex-start":l=="right"?"flex-end":"center";var o=this.getAttribute("data-source");o&&this.owner&&this.owner.exprFunction&&(this.owner[o]?tt(this,Dr,this.owner[o]):tt(this,Dr,this.owner.exprFunction(o).call(this,this.owner.data.get(this.cell.dataset.row),this.cell.dataset.row)));var r="";f(this,Dr)&&f(this,Dr).forEach(n=>{r+=`<label><input type="radio" value="${n[f(this,qs)]}"><span>${n[f(this,mi)]}</span></label>`}),this.shadowRoot.innerHTML=`
547
547
  <style>
548
548
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngRadio.css";
549
549
  ${H.getCustomPath(this,"ngRadio.css")}
@@ -556,7 +556,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
556
556
  <div class="ng-wrap">
557
557
  ${r}
558
558
  </div>
559
- `,super.connectedCallback(),f(this,Fh).call(this),tt(this,Fs,this.shadowRoot.querySelectorAll("input")),$(this.cell).on("keydown",n=>{switch(n.preventDefault(),n.code){case"Space":var s=-1;$(f(this,Fs)).each((e,i)=>{if(this.value==i.getAttribute("value"))return s=e,!1}),s=s==f(this,Fs).length-1?0:s>=0?s+1:0,this.value=f(this,Fs)[s].getAttribute("value");break}})}get dataSource(){return f(this,Pr)}}Fs=new WeakMap,Pr=new WeakMap,qs=new WeakMap,mi=new WeakMap,Bh=new WeakMap,Fh=new WeakMap,customElements.get("ng-radio")||customElements.define("ng-radio",Fd);class qd extends _r{constructor(){super();Y(this,xn);it(this,"dataRefresh",t=>{f(this,xn)&&(f(this,xn).innerHTML=this.getDisplayText(),t||this.reset())})}connectedCallback(){this.getAttribute("link")=="true";const t=this.closest("th,td").getAttribute("text-align")||"left",l=t=="left"?"flex-start":t=="right"?"flex-end":"center";if(this.cell=this.closest("th,td"),!this.cell)return;const c=this.getAttribute("color")||this.cell.getAttribute("color")||"";this.shadowRoot.innerHTML=`
559
+ `,super.connectedCallback(),f(this,Fh).call(this),tt(this,Fs,this.shadowRoot.querySelectorAll("input")),$(this.cell).on("keydown",n=>{switch(n.preventDefault(),n.code){case"Space":var s=-1;$(f(this,Fs)).each((e,i)=>{if(this.value==i.getAttribute("value"))return s=e,!1}),s=s==f(this,Fs).length-1?0:s>=0?s+1:0,this.value=f(this,Fs)[s].getAttribute("value");break}})}get dataSource(){return f(this,Dr)}}Fs=new WeakMap,Dr=new WeakMap,qs=new WeakMap,mi=new WeakMap,Bh=new WeakMap,Fh=new WeakMap,customElements.get("ng-radio")||customElements.define("ng-radio",Fd);class qd extends _r{constructor(){super();Y(this,xn);it(this,"dataRefresh",t=>{f(this,xn)&&(f(this,xn).innerHTML=this.getDisplayText(),t||this.reset())})}connectedCallback(){this.getAttribute("link")=="true";const t=this.closest("th,td").getAttribute("text-align")||"left",l=t=="left"?"flex-start":t=="right"?"flex-end":"center";if(this.cell=this.closest("th,td"),!this.cell)return;const c=this.getAttribute("color")||this.cell.getAttribute("color")||"";this.shadowRoot.innerHTML=`
560
560
  <style>
561
561
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngRenderer.css";
562
562
  ${H.getCustomPath(this,"ngRenderer.css")}
@@ -652,7 +652,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
652
652
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngRowState.css";
653
653
  ${H.getCustomPath(this,"ngRowState.css")}
654
654
  </style>
655
- `,super.connectedCallback(),this.cell.dataset.bind="rowState"}}customElements.get("ng-row-state")||customElements.define("ng-row-state",Kd);class Zd extends HTMLElement{constructor(){super();Y(this,qt);Y(this,ns);Y(this,ge);Y(this,yr);Y(this,vr);Y(this,Sn);it(this,"refresh",()=>{if(!f(this,qt))return;var t=$(".ng-container-body",f(this,qt).body),l=$(".ng-scroll-thumb",this.shadowRoot),c=$("table > thead",t),o=f(this,qt).dataManager.viewRecords.rawIndex,r=$(f(this,ge).track).height(),n=$(f(this,ge).thumb).height();Number(f(this,qt).getAttribute("display-row-count")||0)>=f(this,qt).dataManager.rawRecords.length||parseInt($(".ng-container .ng-table tr.nodata",f(this,qt).body).height())>0&&(f(this,qt).dataManager.rawRecords.length==0||f(this,qt).dataManager.viewRecords.rawIndex==0)?$(this).hide():$(this).show();var e=Math.min(r*(t.height()-c.height())/(f(this,qt).template.height()*f(this,qt).template.length*f(this,qt).data.count()),r);l[0].dataset.height=e,e<16&&(e=16);var i=r-f(this,Cn).call(this);if(i!=0){e>=r?l.css({top:0,height:e-20}):l.css({height:e});var u;if(f(this,qt).isFirstPage)u=0;else if(f(this,qt).isLastPage)u=r-n-2;else{var a=parseInt($(".ng-container-body tbody.bindable tr",f(this,qt).body).not(".nodata").length/f(this,qt).template.length);u=parseInt(o*i/(f(this,qt).data.count()-a+1)),u>r-n-3&&(u=r-n-3)}f(this,ge).thumb.style.top=u+"px",f(this,ge).top.disabled=!!f(this,qt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,qt).isLastPage,$(this).is(":visible")&&$("ng-hscrollbar",f(this,qt).body).is(":visible")?$(".ng-scroll-edge",f(this,qt).body).show():$(".ng-scroll-edge",f(this,qt).body).hide()}});it(this,"refreshV2",()=>{if(f(this,qt)){var t=$(".ng-scroll-thumb",this.shadowRoot),l=f(this,qt).dataManager.viewRecords.rawIndex,c=this.trackHeight,o=this.thumbHeight,r=Math.min(c*(this.bodyHeight-this.theadHeight)/(this.templateHeight*f(this,qt).template.length*f(this,qt).data.count()),c);t[0].dataset.height=r,r<16&&(r=16);var n=c-f(this,Cn).call(this),s;if(f(this,qt).isFirstPage)s=0;else if(f(this,qt).isLastPage)s=c-o-2;else{var e=parseInt($(".ng-container-body tbody.bindable tr",f(this,qt).body).not(".nodata").length/f(this,qt).template.length);s=parseInt(l*n/(f(this,qt).data.count()-e+1)),s>c-o-3&&(s=c-o-3)}f(this,ge).thumb.style.top=s+"px",f(this,ge).top.disabled=!!f(this,qt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,qt).isLastPage}});it(this,"delayScroll",(t,l,c,o)=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,qt).scrollBy(t),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,qt).scrollBy(t)?o&&o.call():clearInterval(f(this,vr))},c))},l))});it(this,"stopScroll",()=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))});Y(this,Zh,()=>{var t=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,qt).scrollBy(l),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,qt).scrollBy(l)},10))},500))};$(f(this,ge).top).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(-1)}),$(f(this,ge).bottom).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(1)}),$(f(this,ge).top).on("touchstart",l=>{t(-1)}),$(f(this,ge).bottom).on("touchstart",l=>{t(1)}),f(this,ge).top.ontouchend=f(this,ge).bottom.ontouchend=f(this,ge).track.ontouchend=f(this,ge).top.onmouseup=f(this,ge).top.onmouseleave=f(this,ge).bottom.onmouseup=f(this,ge).bottom.onmouseleave=f(this,ge).track.onmouseup=f(this,ge).track.onmouseleave=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))},$(f(this,ge).track).on("mousedown",f(this,_a)),$(f(this,ge).track).on("touchstart",f(this,Jh)),$(f(this,ge).thumb).on("mousedown",f(this,ka)),$(f(this,ge).thumb).on("touchstart",f(this,Qh)),document.addEventListener("mouseup",l=>{f(this,ns)&&tt(this,ns,!1),document.removeEventListener("mousemove",f(this,kn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,ns,!1),document.removeEventListener("touchmove",f(this,Sa)),typeof this.onDragStop=="function"&&this.onDragStop()})});Y(this,Jh,t=>{var l=t.target.getBoundingClientRect();t.offsetX=t.targetTouches[0].pageX-l.left,t.offsetY=t.targetTouches[0].pageY-l.top,t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,t.buttons=1,f(this,_a).call(this,t)});Y(this,_a,t=>{if(!f(this,ns)&&!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftKey)){t.preventDefault();var l=f(this,ge).thumb.getBoundingClientRect();clearInterval(f(this,yr)),clearInterval(f(this,vr)),t.clientY>l.y?f(this,qt).pageDown():f(this,qt).pageUp(),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{var c=f(this,ge).thumb.getBoundingClientRect();if(t.clientY>c.y&&t.clientY<c.y+c.height)clearInterval(f(this,vr));else{var o=t.clientY>c.y?f(this,qt).pageDown():f(this,qt).pageUp();o||clearInterval(f(this,vr))}},10))},500))}});Y(this,Qh,t=>{var l=t.target.getBoundingClientRect();t.offsetX=t.targetTouches[0].pageX-l.left,t.offsetY=t.targetTouches[0].pageY-l.top,t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,t.buttons=1,f(this,ka).call(this,t),document.addEventListener("touchmove",f(this,Sa))});Y(this,Sa,t=>{var l=t.target.getBoundingClientRect();t.offsetX=t.targetTouches[0].pageX-l.left,t.offsetY=t.targetTouches[0].pageY-l.top,t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,t.buttons=1,f(this,kn).call(this,t)});Y(this,ka,t=>{tt(this,ns,!0),this.shiftY=t.offsetY+f(this,ge).track.getBoundingClientRect().y,this.trackHeight=$(f(this,ge).track).height(),this.thumbHeight=$(f(this,ge).thumb).height(),this.nodataHeight=$(".ng-container .ng-table tr.nodata",f(this,qt).body).height(),this.bodyHeight=$(".ng-container-body",f(this,qt).body).height(),this.templateHeight=f(this,qt).template.height(),this.theadHeight=$(".ng-container-body table > thead",f(this,qt).body).height()||0,this.tfootHeight=$(".ng-container-body table > tfoot",f(this,qt).body).height()||0,this.fixedHeight=$(".ng-container-body tbody.fixed",f(this,qt).body).height(),this.tableHeight=$(".ng-container-body .ng-table",f(this,qt).body).height(),tt(this,Sn,!0),document.addEventListener("mousemove",f(this,kn)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,kn,t=>{if(f(this,ns)){t.preventDefault(),f(this,Sn)&&(H.j.querySelectorAll("th,td",f(this,qt).body).removeClass("active").removeClass("multi-selected").removeClass("selected").removeClass("selected-current").removeClass("selected-area").removeClass("selected-top").removeClass("selected-bottom").removeClass("selected-left").removeClass("selected-right"),tt(this,Sn,!1));var l=this.trackHeight,c=f(this,Cn).call(this),o=l-c,r=t.clientY-this.shiftY;r=Math.max(0,Math.min(r,o>0?o:0));var n=f(this,qt).matrix.totalHeight||0,s=o>0?r/o:0,e=s*Math.max(0,n-this.bodyHeight),{index:i,offset:u}=f(this,qt).matrix.getRowInfoAt(e);if(i=isNaN(i)?0:i,u=isNaN(u)?0:u,f(this,qt).dataManager.viewRecords.rawIndex!==i){f(this,qt).scrollToV2(i);const a=f(this,qt).body.querySelector(".ng-container-body tbody.bindable");a&&(a.style.transform="translateY(0px)")}else{const a=f(this,qt).body.querySelector(".ng-container-body tbody.bindable");a&&(a.style.transform=`translateY(-${u}px)`)}Br.log("#thumb_onMouseMove",i,u,e)}});Y(this,Cn,()=>parseInt(f(this,ge).thumb.dataset.height));this.attachShadow({mode:"open"})}connectedCallback(){tt(this,qt,this.getRootNode().host),f(this,qt)&&(this.shadowRoot.innerHTML=`
655
+ `,super.connectedCallback(),this.cell.dataset.bind="rowState"}}customElements.get("ng-row-state")||customElements.define("ng-row-state",Kd);class Zd extends HTMLElement{constructor(){super();Y(this,qt);Y(this,ns);Y(this,ge);Y(this,yr);Y(this,vr);Y(this,Sn);it(this,"refresh",()=>{if(!f(this,qt))return;var t=$(".ng-container-body",f(this,qt).body),l=$(".ng-scroll-thumb",this.shadowRoot),c=$("table > thead",t),o=f(this,qt).dataManager.viewRecords.rawIndex,r=$(f(this,ge).track).height(),n=$(f(this,ge).thumb).height();Number(f(this,qt).getAttribute("display-row-count")||0)>=f(this,qt).dataManager.rawRecords.length||parseInt($(".ng-container .ng-table tr.nodata",f(this,qt).body).height())>0&&(f(this,qt).dataManager.rawRecords.length==0||f(this,qt).dataManager.viewRecords.rawIndex==0)?$(this).hide():$(this).show();var e=Math.min(r*(t.height()-c.height())/(f(this,qt).template.height()*f(this,qt).template.length*f(this,qt).data.count()),r);l[0].dataset.height=e,e<16&&(e=16);var i=r-f(this,Cn).call(this);if(i!=0){e>=r?l.css({top:0,height:e-20}):l.css({height:e});var u;if(f(this,qt).isFirstPage)u=0;else if(f(this,qt).isLastPage)u=r-n-2;else{var a=parseInt($(".ng-container-body tbody.bindable tr",f(this,qt).body).not(".nodata").length/f(this,qt).template.length);u=parseInt(o*i/(f(this,qt).data.count()-a+1)),u>r-n-3&&(u=r-n-3)}f(this,ge).thumb.style.top=u+"px",f(this,ge).top.disabled=!!f(this,qt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,qt).isLastPage,$(this).is(":visible")&&$("ng-hscrollbar",f(this,qt).body).is(":visible")?$(".ng-scroll-edge",f(this,qt).body).show():$(".ng-scroll-edge",f(this,qt).body).hide()}});it(this,"refreshV2",()=>{if(f(this,qt)){var t=$(".ng-scroll-thumb",this.shadowRoot),l=f(this,qt).dataManager.viewRecords.rawIndex,c=this.trackHeight,o=this.thumbHeight,r=Math.min(c*(this.bodyHeight-this.theadHeight)/(this.templateHeight*f(this,qt).template.length*f(this,qt).data.count()),c);t[0].dataset.height=r,r<16&&(r=16);var n=c-f(this,Cn).call(this),s;if(f(this,qt).isFirstPage)s=0;else if(f(this,qt).isLastPage)s=c-o-2;else{var e=parseInt($(".ng-container-body tbody.bindable tr",f(this,qt).body).not(".nodata").length/f(this,qt).template.length);s=parseInt(l*n/(f(this,qt).data.count()-e+1)),s>c-o-3&&(s=c-o-3)}f(this,ge).thumb.style.top=s+"px",f(this,ge).top.disabled=!!f(this,qt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,qt).isLastPage}});it(this,"delayScroll",(t,l,c,o)=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,qt).scrollBy(t),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,qt).scrollBy(t)?o&&o.call():clearInterval(f(this,vr))},c))},l))});it(this,"stopScroll",()=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))});Y(this,Zh,()=>{var t=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,qt).scrollBy(l),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,qt).scrollBy(l)},10))},500))};$(f(this,ge).top).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(-1)}),$(f(this,ge).bottom).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(1)}),$(f(this,ge).top).on("touchstart",l=>{t(-1)}),$(f(this,ge).bottom).on("touchstart",l=>{t(1)}),f(this,ge).top.ontouchend=f(this,ge).bottom.ontouchend=f(this,ge).track.ontouchend=f(this,ge).top.onmouseup=f(this,ge).top.onmouseleave=f(this,ge).bottom.onmouseup=f(this,ge).bottom.onmouseleave=f(this,ge).track.onmouseup=f(this,ge).track.onmouseleave=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))},$(f(this,ge).track).on("mousedown",f(this,_a)),$(f(this,ge).track).on("touchstart",f(this,Jh)),$(f(this,ge).thumb).on("mousedown",f(this,ka)),$(f(this,ge).thumb).on("touchstart",f(this,Qh)),document.addEventListener("mouseup",l=>{f(this,ns)&&tt(this,ns,!1),document.removeEventListener("mousemove",f(this,kn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,ns,!1),document.removeEventListener("touchmove",f(this,Sa)),typeof this.onDragStop=="function"&&this.onDragStop()})});Y(this,Jh,t=>{var l=t.target.getBoundingClientRect();t.offsetX=t.targetTouches[0].pageX-l.left,t.offsetY=t.targetTouches[0].pageY-l.top,t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,t.buttons=1,f(this,_a).call(this,t)});Y(this,_a,t=>{if(!f(this,ns)&&!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftKey)){t.preventDefault();var l=f(this,ge).thumb.getBoundingClientRect();clearInterval(f(this,yr)),clearInterval(f(this,vr)),t.clientY>l.y?f(this,qt).pageDown():f(this,qt).pageUp(),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{var c=f(this,ge).thumb.getBoundingClientRect();if(t.clientY>c.y&&t.clientY<c.y+c.height)clearInterval(f(this,vr));else{var o=t.clientY>c.y?f(this,qt).pageDown():f(this,qt).pageUp();o||clearInterval(f(this,vr))}},10))},500))}});Y(this,Qh,t=>{var l=t.target.getBoundingClientRect();t.offsetX=t.targetTouches[0].pageX-l.left,t.offsetY=t.targetTouches[0].pageY-l.top,t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,t.buttons=1,f(this,ka).call(this,t),document.addEventListener("touchmove",f(this,Sa))});Y(this,Sa,t=>{var l=t.target.getBoundingClientRect();t.offsetX=t.targetTouches[0].pageX-l.left,t.offsetY=t.targetTouches[0].pageY-l.top,t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,t.buttons=1,f(this,kn).call(this,t)});Y(this,ka,t=>{tt(this,ns,!0),this.shiftY=t.offsetY+f(this,ge).track.getBoundingClientRect().y,this.trackHeight=$(f(this,ge).track).height(),this.thumbHeight=$(f(this,ge).thumb).height(),this.nodataHeight=$(".ng-container .ng-table tr.nodata",f(this,qt).body).height(),this.bodyHeight=$(".ng-container-body",f(this,qt).body).height(),this.templateHeight=f(this,qt).template.height(),this.theadHeight=$(".ng-container-body table > thead",f(this,qt).body).height()||0,this.tfootHeight=$(".ng-container-body table > tfoot",f(this,qt).body).height()||0,this.fixedHeight=$(".ng-container-body tbody.fixed",f(this,qt).body).height(),this.tableHeight=$(".ng-container-body .ng-table",f(this,qt).body).height(),tt(this,Sn,!0),document.addEventListener("mousemove",f(this,kn)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,kn,t=>{if(f(this,ns)){t.preventDefault(),f(this,Sn)&&(H.j.querySelectorAll("th,td",f(this,qt).body).removeClass("active").removeClass("multi-selected").removeClass("selected").removeClass("selected-current").removeClass("selected-area").removeClass("selected-top").removeClass("selected-bottom").removeClass("selected-left").removeClass("selected-right"),tt(this,Sn,!1));var l=this.trackHeight,c=f(this,Cn).call(this),o=l-c,r=t.clientY-this.shiftY;r=Math.max(0,Math.min(r,o>0?o:0));var n=f(this,qt).matrix.totalHeight||0,s=o>0?r/o:0,e=s*Math.max(0,n-this.bodyHeight),{index:i,offset:u}=f(this,qt).matrix.getRowInfoAt(e);if(i=isNaN(i)?0:i,u=isNaN(u)?0:u,f(this,qt).dataManager.viewRecords.rawIndex!==i){f(this,qt).scrollToV2(i);const a=f(this,qt).body.querySelector(".ng-container-body tbody.bindable");a&&(a.style.transform="translateY(0px)")}else{const a=f(this,qt).body.querySelector(".ng-container-body tbody.bindable");a&&(a.style.transform=`translateY(-${u}px)`)}jr.log("#thumb_onMouseMove",i,u,e)}});Y(this,Cn,()=>parseInt(f(this,ge).thumb.dataset.height));this.attachShadow({mode:"open"})}connectedCallback(){tt(this,qt,this.getRootNode().host),f(this,qt)&&(this.shadowRoot.innerHTML=`
656
656
  <style>
657
657
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngVScrollBar.css";
658
658
  ${H.getCustomPath(this,"ngVScrollBar.css")}
@@ -750,7 +750,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
750
750
  <button id="btnOk">OK</button>
751
751
  <button id="btnCancel">Cancel</button>
752
752
  </div>
753
- `,this.shadowRoot.querySelector("input[type=text]").addEventListener("input",f(this,wc)),this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change",f(this,vc)),this.shadowRoot.querySelector("#btnOk").addEventListener("click",f(this,bc)),this.shadowRoot.querySelector("#btnCancel").addEventListener("click",f(this,yc))}}Mr=new WeakMap,Ka=new WeakMap,Za=new WeakMap,bc=new WeakMap,yc=new WeakMap,vc=new WeakMap,wc=new WeakMap,customElements.get("ng-filter-button")||customElements.define("ng-filter-button",lf),customElements.get("ng-filter-panel")||customElements.define("ng-filter-panel",hf);class Zn extends HTMLElement{constructor(){super();Y(this,Ja,!1);Y(this,_i);Y(this,Qa);Y(this,Rn);Y(this,as);it(this,"export",()=>{const t=this.shadowRoot.querySelector("ng-export");t&&t.remove();const l=document.createElement("ng-export");this.shadowRoot.appendChild(l),setTimeout(()=>{l.exportExcel()})});it(this,"maximize",()=>{const t=this.shadowRoot.querySelector("ng-max-popup");t&&t.remove();const l=document.createElement("ng-max-popup");this.shadowRoot.appendChild(l),setTimeout(()=>{l.popup()})});it(this,"refreshData",t=>{if(t==null){var l=[];$(".ng-container-body tbody.bindable tr",this.body).not(".nodata").each((r,n)=>{l.push(this.dataManager.viewRecords.rawIndex+parseInt(n.sectionRowIndex/this.template.length))}),l=[...new Set(l)],l.forEach(r=>{const n=this.data.get(r);this.body.querySelectorAll(`.ng-container tbody.bindable tr[data-row="${r}"]`).forEach(s=>{s.data=n})});var c=[];$(".ng-container-body tbody.fixed tr",this.body).not(".nodata").each((r,n)=>{c.push({INDEX:n.data.__ng._[H.ROW.INDEX],ROW:n.dataset.row})}),c.forEach(r=>{const n=this.data.getNF(r.INDEX);this.body.querySelectorAll(`.ng-container tbody.fixed tr[data-row="${r.ROW}"]`).forEach(s=>{s.data=n})})}else{t=parseInt(t);const r=t<0?this.data.getNF(this.body.querySelector(`tbody.fixed tr[data-row="${t}"]`).dataset.index):this.data.get(t);this.body.querySelectorAll(`.ng-container tbody tr[data-row="${t}"]`).forEach(n=>{n.data=r})}(t==null?$(".ng-container tbody tr th,.ng-container tbody tr td",this.body):$(`.ng-container tbody tr[data-row=${t}] th,.ng-container tbody tr[data-row=${t}] td`,this.body)).each((r,n)=>{n.children[0]&&n.children[0].dataRefresh&&n.dataset.row&&n.children[0].dataRefresh()}),$(".ng-container thead tr th,.ng-container thead tr td,.ng-container tfoot tr th,.ng-container tfoot tr td",this.body).each((r,n)=>{n.children[0]&&n.children[0].dataRefresh&&n.children[0].dataRefresh()})});it(this,"refreshDataV2",()=>{$(".ng-container tbody tr th,.ng-container tbody tr td",this.body).each((l,c)=>{c.children[0]&&c.children[0].dataRefresh&&c.dataset.row&&c.children[0].dataRefresh(!0)}),$(".ng-container thead tr th,.ng-container thead tr td,.ng-container tfoot tr th,.ng-container tfoot tr td",this.body).each((l,c)=>{c.children[0]&&c.children[0].dataRefresh&&c.children[0].dataRefresh(!0)})});Y(this,tl,t=>{this.dataManager&&(this.data.clear(),this.dataManager.setDataSource(t),this.refresh(),this.paging&&this.paging.refresh(),this.scrollTo_V1(0))});it(this,"changeRayout",t=>{$(".ng-container-left",this.body).children().remove(),$(".ng-container-right",this.body).children().remove(),$(".ng-container-body",this.body).children().remove(),$(".ng-container-body",this.shadowRoot).append(f(this,as)[t]),f(this,sl).call(this),this.createTemplate(),f(this,el).call(this),this.resetTemplate(),f(this,rl).call(this),this.cell.resetEvent(),this.touchEvent.resetEvent(),f(this,_i).resetEvent(),f(this,Qa).resetEvent(),f(this,Rn)&&f(this,Rn).resetEvent(),this.sorting&&this.sorting.initialize(),this.filtering&&this.filtering.initialize(),this.pin&&this.pin.initialize(),this.data.initialize(),setTimeout(()=>{this.paging&&this.paging.refresh(),this.scrollTo_V1(0)})});Y(this,el,()=>{this.elements={table:$(this.body.querySelector(".ng-container-body > table")),hscrollbar:$(this.body.querySelector("ng-hscrollbar")),vscrollbar:$(this.body.querySelector("ng-vscrollbar")),bodyLeft:$(this.body.querySelector(".ng-container-left")),bodyBody:$(this.body.querySelector(".ng-container-body")),bodyRight:$(this.body.querySelector(".ng-container-right"))},this.elements.table.show();var t=this.elements.table.clone();this.elements.bodyLeft.html(t.clone()),$("col,th,td",this.elements.bodyLeft).not("[fixed=left]").remove();var l=0;if($("col",this.elements.bodyLeft).each((o,r)=>{l+=parseInt(H.j.querySelectorAll(r).attr("width"))}),this.elements.bodyLeft.css({width:l,"min-width":l}),this.elements.bodyRight.html(t.clone()),$("col,th,td",this.elements.bodyRight).not("[fixed=right]").remove(),l=0,$("col",this.elements.bodyRight).each((o,r)=>{l+=parseInt(H.j.querySelectorAll(r).attr("width"))}),this.elements.bodyRight.css({width:l,"min-width":l}),this.elements.bodyBody.html(t.clone()),this.elements.bodyBody.find("[fixed=left]").remove(),this.elements.bodyBody.find("[fixed=right]").remove(),this.elements.bodyLeft.find("tbody tr").remove(),this.elements.bodyRight.find("tbody tr").remove(),this.elements.bodyBody.find("tbody tr").remove(),this.elements.bodyBody.find("table").width(0),$(".ng-container .ng-table tr.nodata",this.body).length<=0){var c='<tr class="nodata"></tr>';this.elements.bodyLeft.find("tbody.bindable").append(c),this.elements.bodyRight.find("tbody.bindable").append(c),this.elements.bodyBody.find("tbody.bindable").append(c)}});Y(this,xc,()=>{if(!this.template)return 0;var t=0;return this.template.each((l,c)=>{t+=$(c).height()}),t});Y(this,vs,()=>{const t=parseInt(this.getAttribute("display-row-count"));if(isNaN(t))return;const l=this.shadowRoot.querySelector("ng-head");l&&setTimeout(()=>{const c=parseInt(window.getComputedStyle(l).getPropertyValue("padding-bottom"),10);var o=($(l).height()||0)+($("ng-foot",this.shadowRoot).height()||0)+($(".ng-container-body thead",this.shadowRoot).height()||0)+($(".ng-container-body tfoot:visible",this.shadowRoot).height()||0)+($(".ng-container-bottom:visible",this.shadowRoot).height()||0)+c+(f(this,xc).call(this)||0)*t+3;$(this).height(o)})});Y(this,_c,()=>{if(Br.log("1111111"),f(this,Ja))return;Br.log("222222"),this.originFormat=this.outerHTML,this.uuid=H.randomUUID(),this.id||(this.id=this.uuid),$("table",this).each((r,n)=>{if($("colgroup",n).length==0){var s=0;$("tbody tr",n).eq(0).find("th,td").each((i,u)=>{s+=u.colSpan||1}),$(n).prepend("<colgroup></colgroup>");for(var e=Math.max(parseInt(($(n).width()-16)/s)-1,100),r=0;r<s;r++)$("colgroup",n).append(`<col width="${e}" />`)}n.querySelector("thead")||$("colgroup",n).after("<thead></thead>"),$("tbody th,tbody td",n).each((i,u)=>{u.innerHTML.trim()==""&&(u.innerHTML="<ng-renderer>")}),$("thead th,thead td,tfoot th,tfoot td",n).each((i,u)=>{u.dataset&&u.dataset.expr&&(u.innerHTML="<ng-renderer>"),u.getAttribute("title")||u.setAttribute("title",u.innerHTML)}),$("datalist_BAK",n).each((i,u)=>{if(u.parentNode.getAttribute("data-source"))return!0;const a=[];u.querySelectorAll("option").forEach(m=>{for(var d={},b=0;b<m.attributes.length;b++)d[m.attributes[b].name]=m.attributes[b].value;a.push(d)}),window[this.id]||(window[this.id]=this),window[this.id]["code"+i]=a;const h=u.closest("th,td");if(h){const m=h.getAttribute("key")||"key",d=h.getAttribute("value")||"value",b=h.getAttribute("multi-separator")||",";var p=`window["${this.id}"]["code${i}"]`;u.parentNode.setAttribute("data-source",p),h.dataset.expr=`ninegrid.binarySearchValue(${p}, "${m}", data["${h.dataset.bind}"].split("${b}"), "${d}")`}}),$(n).hide(),f(this,as).push(n),H.j.querySelectorAll(this).hasClass("simple")||f(this,Cc).call(this,n)});const t=`
753
+ `,this.shadowRoot.querySelector("input[type=text]").addEventListener("input",f(this,wc)),this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change",f(this,vc)),this.shadowRoot.querySelector("#btnOk").addEventListener("click",f(this,bc)),this.shadowRoot.querySelector("#btnCancel").addEventListener("click",f(this,yc))}}Mr=new WeakMap,Ka=new WeakMap,Za=new WeakMap,bc=new WeakMap,yc=new WeakMap,vc=new WeakMap,wc=new WeakMap,customElements.get("ng-filter-button")||customElements.define("ng-filter-button",lf),customElements.get("ng-filter-panel")||customElements.define("ng-filter-panel",hf);class Zn extends HTMLElement{constructor(){super();Y(this,Ja,!1);Y(this,_i);Y(this,Qa);Y(this,Rn);Y(this,as);it(this,"export",()=>{const t=this.shadowRoot.querySelector("ng-export");t&&t.remove();const l=document.createElement("ng-export");this.shadowRoot.appendChild(l),setTimeout(()=>{l.exportExcel()})});it(this,"maximize",()=>{const t=this.shadowRoot.querySelector("ng-max-popup");t&&t.remove();const l=document.createElement("ng-max-popup");this.shadowRoot.appendChild(l),setTimeout(()=>{l.popup()})});it(this,"refreshData",t=>{if(t==null){var l=[];$(".ng-container-body tbody.bindable tr",this.body).not(".nodata").each((r,n)=>{l.push(this.dataManager.viewRecords.rawIndex+parseInt(n.sectionRowIndex/this.template.length))}),l=[...new Set(l)],l.forEach(r=>{const n=this.data.get(r);this.body.querySelectorAll(`.ng-container tbody.bindable tr[data-row="${r}"]`).forEach(s=>{s.data=n})});var c=[];$(".ng-container-body tbody.fixed tr",this.body).not(".nodata").each((r,n)=>{c.push({INDEX:n.data.__ng._[H.ROW.INDEX],ROW:n.dataset.row})}),c.forEach(r=>{const n=this.data.getNF(r.INDEX);this.body.querySelectorAll(`.ng-container tbody.fixed tr[data-row="${r.ROW}"]`).forEach(s=>{s.data=n})})}else{t=parseInt(t);const r=t<0?this.data.getNF(this.body.querySelector(`tbody.fixed tr[data-row="${t}"]`).dataset.index):this.data.get(t);this.body.querySelectorAll(`.ng-container tbody tr[data-row="${t}"]`).forEach(n=>{n.data=r})}(t==null?$(".ng-container tbody tr th,.ng-container tbody tr td",this.body):$(`.ng-container tbody tr[data-row=${t}] th,.ng-container tbody tr[data-row=${t}] td`,this.body)).each((r,n)=>{n.children[0]&&n.children[0].dataRefresh&&n.dataset.row&&n.children[0].dataRefresh()}),$(".ng-container thead tr th,.ng-container thead tr td,.ng-container tfoot tr th,.ng-container tfoot tr td",this.body).each((r,n)=>{n.children[0]&&n.children[0].dataRefresh&&n.children[0].dataRefresh()})});it(this,"refreshDataV2",()=>{$(".ng-container tbody tr th,.ng-container tbody tr td",this.body).each((l,c)=>{c.children[0]&&c.children[0].dataRefresh&&c.dataset.row&&c.children[0].dataRefresh(!0)}),$(".ng-container thead tr th,.ng-container thead tr td,.ng-container tfoot tr th,.ng-container tfoot tr td",this.body).each((l,c)=>{c.children[0]&&c.children[0].dataRefresh&&c.children[0].dataRefresh(!0)})});Y(this,tl,t=>{this.dataManager&&(this.data.clear(),this.dataManager.setDataSource(t),this.refresh(),this.paging&&this.paging.refresh(),this.scrollTo_V1(0))});it(this,"changeRayout",t=>{$(".ng-container-left",this.body).children().remove(),$(".ng-container-right",this.body).children().remove(),$(".ng-container-body",this.body).children().remove(),$(".ng-container-body",this.shadowRoot).append(f(this,as)[t]),f(this,sl).call(this),this.createTemplate(),f(this,el).call(this),this.resetTemplate(),f(this,rl).call(this),this.cell.resetEvent(),this.touchEvent.resetEvent(),f(this,_i).resetEvent(),f(this,Qa).resetEvent(),f(this,Rn)&&f(this,Rn).resetEvent(),this.sorting&&this.sorting.initialize(),this.filtering&&this.filtering.initialize(),this.pin&&this.pin.initialize(),this.data.initialize(),setTimeout(()=>{this.paging&&this.paging.refresh(),this.scrollTo_V1(0)})});Y(this,el,()=>{this.elements={table:$(this.body.querySelector(".ng-container-body > table")),hscrollbar:$(this.body.querySelector("ng-hscrollbar")),vscrollbar:$(this.body.querySelector("ng-vscrollbar")),bodyLeft:$(this.body.querySelector(".ng-container-left")),bodyBody:$(this.body.querySelector(".ng-container-body")),bodyRight:$(this.body.querySelector(".ng-container-right"))},this.elements.table.show();var t=this.elements.table.clone();this.elements.bodyLeft.html(t.clone()),$("col,th,td",this.elements.bodyLeft).not("[fixed=left]").remove();var l=0;if($("col",this.elements.bodyLeft).each((o,r)=>{l+=parseInt(H.j.querySelectorAll(r).attr("width"))}),this.elements.bodyLeft.css({width:l,"min-width":l}),this.elements.bodyRight.html(t.clone()),$("col,th,td",this.elements.bodyRight).not("[fixed=right]").remove(),l=0,$("col",this.elements.bodyRight).each((o,r)=>{l+=parseInt(H.j.querySelectorAll(r).attr("width"))}),this.elements.bodyRight.css({width:l,"min-width":l}),this.elements.bodyBody.html(t.clone()),this.elements.bodyBody.find("[fixed=left]").remove(),this.elements.bodyBody.find("[fixed=right]").remove(),this.elements.bodyLeft.find("tbody tr").remove(),this.elements.bodyRight.find("tbody tr").remove(),this.elements.bodyBody.find("tbody tr").remove(),this.elements.bodyBody.find("table").width(0),$(".ng-container .ng-table tr.nodata",this.body).length<=0){var c='<tr class="nodata"></tr>';this.elements.bodyLeft.find("tbody.bindable").append(c),this.elements.bodyRight.find("tbody.bindable").append(c),this.elements.bodyBody.find("tbody.bindable").append(c)}});Y(this,xc,()=>{if(!this.template)return 0;var t=0;return this.template.each((l,c)=>{t+=$(c).height()}),t});Y(this,vs,()=>{const t=parseInt(this.getAttribute("display-row-count"));if(isNaN(t))return;const l=this.shadowRoot.querySelector("ng-head");l&&setTimeout(()=>{const c=parseInt(window.getComputedStyle(l).getPropertyValue("padding-bottom"),10);var o=($(l).height()||0)+($("ng-foot",this.shadowRoot).height()||0)+($(".ng-container-body thead",this.shadowRoot).height()||0)+($(".ng-container-body tfoot:visible",this.shadowRoot).height()||0)+($(".ng-container-bottom:visible",this.shadowRoot).height()||0)+c+(f(this,xc).call(this)||0)*t+3;$(this).height(o)})});Y(this,_c,()=>{if(jr.log("1111111"),f(this,Ja))return;jr.log("222222"),this.originFormat=this.outerHTML,this.uuid=H.randomUUID(),this.id||(this.id=this.uuid),$("table",this).each((r,n)=>{if($("colgroup",n).length==0){var s=0;$("tbody tr",n).eq(0).find("th,td").each((i,u)=>{s+=u.colSpan||1}),$(n).prepend("<colgroup></colgroup>");for(var e=Math.max(parseInt(($(n).width()-16)/s)-1,100),r=0;r<s;r++)$("colgroup",n).append(`<col width="${e}" />`)}n.querySelector("thead")||$("colgroup",n).after("<thead></thead>"),$("tbody th,tbody td",n).each((i,u)=>{u.innerHTML.trim()==""&&(u.innerHTML="<ng-renderer>")}),$("thead th,thead td,tfoot th,tfoot td",n).each((i,u)=>{u.dataset&&u.dataset.expr&&(u.innerHTML="<ng-renderer>"),u.getAttribute("title")||u.setAttribute("title",u.innerHTML)}),$("datalist_BAK",n).each((i,u)=>{if(u.parentNode.getAttribute("data-source"))return!0;const a=[];u.querySelectorAll("option").forEach(m=>{for(var d={},b=0;b<m.attributes.length;b++)d[m.attributes[b].name]=m.attributes[b].value;a.push(d)}),window[this.id]||(window[this.id]=this),window[this.id]["code"+i]=a;const h=u.closest("th,td");if(h){const m=h.getAttribute("key")||"key",d=h.getAttribute("value")||"value",b=h.getAttribute("multi-separator")||",";var p=`window["${this.id}"]["code${i}"]`;u.parentNode.setAttribute("data-source",p),h.dataset.expr=`ninegrid.binarySearchValue(${p}, "${m}", data["${h.dataset.bind}"].split("${b}"), "${d}")`}}),$(n).hide(),f(this,as).push(n),H.j.querySelectorAll(this).hasClass("simple")||f(this,Cc).call(this,n)});const t=`
754
754
  <style>
755
755
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ninegrid.css";
756
756
  ${H.getCustomPath(this,"ninegrid.css")}
@@ -775,7 +775,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
775
775
  <div class='ng-etc2'></div>
776
776
  </div>
777
777
  <ng-foot></ng-foot>
778
- `;this.comboExpr=(r,n,s)=>{const e=s.querySelector("ng-combo");if(!e)return"";const i=e.getAttribute("code")||"code",u=e.getAttribute("codename")||"codename",a=e.getAttribute("multi-separator")||",";return H.binarySearchValue(e.dataSource,i,r[s.dataset.bind],u,a)};for(const r of f(this,as))$(H.j.querySelectorAll("tbody",r).addClass("bindable").elem()).before('<tbody class="fixed"></tbody>');$(this.shadowRoot).append(t),$(".ng-container-body",this.shadowRoot).append(f(this,as)[0]),this.body=this.shadowRoot.querySelector(".ng-body"),this.querySelectorAll("nx-buttons *").forEach(r=>{r.grid=this}),$(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("nx-buttons")),f(this,sl).call(this),this.createTemplate(),f(this,el).call(this),this.resetTemplate(),f(this,Sc).call(this);const l=this.shadowRoot.querySelector("ng-foot");this.paging=l.shadowRoot.querySelector("ng-paging"),this.layout=l.shadowRoot.querySelector("ng-layout"),this.layout&&this.layout.add(f(this,as)),new zu(this),this.pin=new Gd(this),this.fields=new yd(this),this.cell=new Uu(this),this.touchEvent=new Wu(this),this.selection=new Vu(this),this.tables=new tf(this),this.dataManager=new hd(this),this.view=new of(this),this.tableUtils=new ef(this),this.columns=new td(this);for(var c in this.dataManager)this.dataManager[c]instanceof Function&&!["xxx"].includes(c)?this[c]=this.dataManager[c].bind(this):["data","row","tree"].includes(c)&&(this[c]=this.dataManager[c]);for(var c in this.tableUtils)["columns"].includes(c)&&(this[c]=this.tableUtils[c]);for(var c in this.cell)this.cell[c]instanceof Function&&!["refresh"].includes(c)||["xx"].includes(c)&&(this[c]=this.cell[c]);H.j.querySelectorAll(this).hasClass("simple")||(this.filtering=new af(this)),!H.j.querySelectorAll(this).hasClass("combo")&&!H.j.querySelectorAll(this).hasClass("filter")&&$(this.shadowRoot).append($("<ng-combo-panel></ng-combo-panel").hide()),this.sorting=new Qd(this),this.matrix=new $d(this),Br.log("==============================="),Br.log(this,this.matrix),tt(this,_i,new Qu(this)),tt(this,Qa,new Ju(this)),H.j.querySelectorAll(this).hasClass("simple")||tt(this,Rn,new Ud(this)),f(this,rl).call(this),this.refresh(),this.body.querySelector(".ng-container-body .nodata")&&new ResizeObserver((r,n)=>{this.body.querySelector("ng-vscrollbar").refresh()}).observe(this.body.querySelector(".ng-container-body .nodata")),!H.j.querySelectorAll(this).hasClass("filter")&&!H.j.querySelectorAll(this).hasClass("combo")&&($(this.body).on("mousedown",r=>{this.shadowRoot.querySelectorAll("ng-combo-panel,ng-filter-panel,ng-context-menu-panel").forEach(n=>{$(n).is(":visible")&&$(n).hide()})}),$(this).on("click",r=>{r.target.shadowRoot.querySelectorAll("ng-info").forEach(n=>{n.close()})})),new nd(this),this.classList.contains("simple")||setTimeout(()=>{this.dispatchEvent(new CustomEvent(H.EVENT.LOAD,{bubbles:!0,detail:{}}))},100);const o=this.shadowRoot.querySelector("ng-head");o&&o.shadowRoot.querySelectorAll("nx-buttons button").forEach(r=>{r.addEventListener("click",n=>{const s=new CustomEvent(H.EVENT.BUTTON_CLICK,{bubbles:!0,detail:{target:r}});this.dispatchEvent(s)})}),tt(this,Ja,!0)});Y(this,rl,()=>{this.lastRowHidden=isNaN(parseInt(H.j.querySelectorAll(this).attr("display-row-count"))),this.paging||(this.paging={}),H.j.querySelectorAll(this).attr("col-indicator-type",H.j.querySelectorAll(this).attr("col-indicator-type")||H.COLINDICATORTYPE.COLLAPSE),H.j.querySelectorAll(this).attr("auto-fit-col",H.j.querySelectorAll(this).attr("auto-fit-col")||"false"),H.j.querySelectorAll(this).attr("col-resizable",H.j.querySelectorAll(this).attr("col-resizable")||"true"),H.j.querySelectorAll(this).attr("row-resizable",H.j.querySelectorAll(this).attr("row-resizable")||"false"),H.j.querySelectorAll(this).attr("col-movable",H.j.querySelectorAll(this).attr("col-movable")||"false"),H.j.querySelectorAll(this).attr("enable-fixed-col",H.j.querySelectorAll(this).attr("enable-fixed-col")||"false"),H.j.querySelectorAll(this).attr("show-title-bar",H.j.querySelectorAll(this).attr("show-title-bar")||"false"),H.j.querySelectorAll(this).attr("show-menu-icon",H.j.querySelectorAll(this).attr("show-menu-icon")||"false"),H.j.querySelectorAll(this).attr("show-status-bar",H.j.querySelectorAll(this).attr("show-status-bar")||"false"),H.j.querySelectorAll(this).attr("show-thead",H.j.querySelectorAll(this).attr("show-thead")||"true"),H.j.querySelectorAll(this).attr("show-tfoot",H.j.querySelectorAll(this).attr("show-tfoot")||"true"),H.j.querySelectorAll(this).attr("select-type",H.j.querySelectorAll(this).attr("select-type")||H.SELECTTYPE.CELL),H.j.querySelectorAll(this).attr("paging-type",H.j.querySelectorAll(this).attr("paging-type")||H.PAGINGTYPE.NONE),H.j.querySelectorAll(this).attr("paging-count",H.j.querySelectorAll(this).attr("paging-count")||H.PAGINGCOUNT.AUTO)});Y(this,Sc,()=>{new ResizeObserver(l=>{this.view&&this.view.redraw(),this.refreshScroll(),this.refreshBindRows(),$("tbody.bindable tr:not([data-matrix-row])",this.body).not(".nodata").length>0&&this.dataManager.viewRecords.reset()}).observe(this);const t=new MutationObserver((l,c)=>{this.body.querySelector("ng-hscrollbar").refresh()});$("colgroup",this.body).each((l,c)=>{t.observe(c,{childList:!0,subtree:!0,attributeOldValue:!0})}),this.body.querySelector("ng-hscrollbar").refresh(),new ResizeObserver((l,c)=>{if(this.getAttribute("auto-fit-col")=="true"){let n=[];var o=0;$(".ng-container-body col",this.body).each((e,i)=>{n.push({col:i,width:Number(H.j.querySelectorAll(i).attr("width"))})}),n.forEach(e=>{o+=e.width});const s=$(".ng-container-body",this.body).width();s!=0&&n.forEach(e=>{var i=e.width*s/o;H.j.querySelectorAll(e.col).attr("width",i)})}this.body.querySelector("ng-hscrollbar").refresh();const r=this.shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout");r&&r.resize(),f(this,vs).call(this)}).observe(this.body.querySelector(".ng-container-body"))});it(this,"createTemplate",()=>{this.template=$(".ng-container-body tbody.bindable tr:not(.nodata)",this.body).clone(),this.tmpl=this.body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)"),this.activeTmpl=this.body.querySelector(".ng-container-body tbody.bindable tr:not(.nodata)")});it(this,"resetTemplate",()=>{var t=0;["left","body","right"].forEach(o=>{$(`.ng-container-${o} colgroup col`,this.body).each((r,n)=>{n.dataset.col=t++})});var l=[];$(".col-indicator",this.body).each((o,r)=>{l.push({from:parseInt(r.dataset.col),to:o}),r.innerHTML=`<div>${H.num2ExcelCol(o)}</div>`}),this.template.find("th,td").each((o,r)=>{const n=l.findIndex(s=>s.from==r.dataset.col);n>=0&&(r.dataset.col=l[n].to)}),$(".ng-table th,.ng-table td",this.body).each((o,r)=>{const n=l.findIndex(s=>s.from==r.dataset.col);n>=0&&(r.dataset.col=l[n].to)});const c=this.shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout");c&&($("th,td",c.currentTable).each((o,r)=>{const n=l.findIndex(s=>s.from==r.dataset.col);n>=0&&(r.dataset.col=l[n].to)}),$(".last",c.currentTable).each((o,r)=>{H.j.querySelectorAll(r).addClass("dummy")})),this.template.find(".last").each((o,r)=>{H.j.querySelectorAll(r).addClass("dummy")}),$(".last",this.body).each((o,r)=>{H.j.querySelectorAll(r).addClass("dummy")})});Y(this,ls,(t,l)=>{var c=$(l+" tr",t),o=$(l+" th,"+l+" td",t),r=c.length,n=0;o.each((e,i)=>{n+=i.colSpan});var s=Array.from(Array(r),()=>Array(n).fill(null));c.each((e,i)=>{var u=i.sectionRowIndex,a=0;$(i).find("th,td").each((h,p)=>{for(var m=0;m<s[u].length;m++)if(s[u][m]==null){a=m;break}for(var m=0;m<p.rowSpan;m++)for(var d=0;d<p.colSpan;d++)try{s[u+m][a+d]=m==0&&d==0?"1":"0"}catch(g){console.error(g)}})}),c.each((e,i)=>{var u=i.sectionRowIndex;$(i).find("th,td").not(".dummy").each((a,h)=>{for(var p=0;p<s[u].length;p++)if(s[u][p]=="1"){h.dataset.col=p,s[u][p]="0";break}})})});Y(this,kc,()=>{const t='<th data-col="@col" class="col-indicator" scope="col"><div>@text</div></th>';var l=this.body.querySelector(".ng-container-body > table > thead");if(!l||l.querySelector(".col-indicator-rowgroup"))return;const c=H.j.querySelectorAll(l.insertRow(0)).attr("role","row").addClass("col-indicator-rowgroup").elem();var o=0;$(".ng-container-body > table > tbody.bindable > tr",this.body).eq(0).find("th,td").each((n,s)=>{if(!H.j.querySelectorAll(s).hasClass("dummy"))for(var e=0;e<s.colSpan;e++)$(c).append(t.replace("@col",o).replace("@text",H.num2ExcelCol(o++)))});var r=[];$("colgroup col",this.body).each((n,s)=>{r.push({width:parseInt(H.j.querySelectorAll(s).attr("width")),background:H.j.querySelectorAll(s).attr("background-color")})}),$("thead .col-indicator",this.body).each((n,s)=>{if(!r[n])return!1;$(s).css({width:r[n].width,"min-width":r[n].width,"background-color":r[n].background,"border-top-color":r[n].background}),H.j.querySelectorAll(s).attr("background-color",r[n].background)})});Y(this,sl,()=>{var t=this.body.querySelector(".ng-container-body > table");if(t){t.querySelectorAll("tbody tr").forEach(c=>{c.style.height||(c.style.height="32px")});var l=t.querySelector("thead");l.length<=0&&$("<thead></thead>").appendTo(t),H.j.querySelectorAll(t).attr("role","table").addClass("ng-table"),H.j.querySelectorAll("tbody th,tbody td",t).attr("tabindex",0),H.j.querySelectorAll("thead,tbody,tfoot",t).attr("role","rowgroup"),H.j.querySelectorAll("tr",t).attr("role","row"),H.j.querySelectorAll("tbody > tr",t).attr("role","gridcell"),H.j.querySelectorAll("th,td",t).attr("scope","col"),f(this,ls).call(this,$(t),"thead"),f(this,ls).call(this,$(t),"tbody.bindable"),f(this,ls).call(this,$(t),"tbody.fixed"),f(this,ls).call(this,$(t),"tfoot"),f(this,kc).call(this),t.querySelectorAll("col").forEach((c,o)=>{H.j.querySelectorAll(`[data-col="${o}"]`,t).attr("fixed",H.j.querySelectorAll(c).attr("fixed"))})}});Y(this,Cc,t=>{f(this,ls).call(this,t,"thead"),f(this,ls).call(this,t,"tbody"),f(this,ls).call(this,t,"tfoot"),$("colgroup col[fixed=left]",t).index($(".dummy[fixed=left]",t)),$("tr",t).each((l,c)=>{}),$("colgroup",t).prepend('<col width="0" fixed="left" class="first" />'),$("tr",t).each((l,c)=>{$(c).prepend('<td class="first"></td>')}),$("colgroup",t).append('<col width="0" fixed="right" class="last" />'),$("tr",t).each((l,c)=>{$(c).append('<td class="last"></td>')})});Y(this,il,()=>{var t=[];return $("th,td",this.template).not(".dummy").not(".first").each((l,c)=>{c.querySelector("ng-row-indicator")||t.push(Number(c.dataset.col))}),t});it(this,"selectArea",(t,l,c,o)=>{const r=f(this,Xs).call(this,t),n=f(this,Xs).call(this,c),s=f(this,Ys).call(this,l),e=f(this,Ys).call(this,o),i=parseInt(r*this.template.length),u=parseInt(n*this.template.length)+this.template.length-1;this.row.at=r,r>=0&&n>=0?this.selection.selectArea(i,s,u,e):this.clearSelection()});it(this,"selectRow",(t,l)=>{const c=f(this,Xs).call(this,t),o=H.isNull(oRow2)?c:f(this,Xs).call(this,l),r=parseInt(c*this.template.length),n=parseInt(o*this.template.length)+this.template.length-1;this.row.at=c,c>=0&&o>=0?this.selection.selectArea(r,this.firstCol,n,this.lastCol):this.clearSelection()});it(this,"selectCol",(t,l)=>{const c=f(this,Ys).call(this,t),o=H.isNull(l)?c:f(this,Ys).call(this,l),r=0,n=parseInt(this.data.count()*this.template.length-1);c>=0&&o>=0?this.selection.selectArea(r,c,n,o):this.clearSelection()});it(this,"selectCell",(t,l,c)=>{const o=f(this,Xs).call(this,t),r=f(this,Ys).call(this,l),n=parseInt(o*this.template.length)+H.nvl(c,0);this.row.at=o,o>=0?this.selection.selectArea(n,r,n,r):this.clearSelection()});Y(this,Xs,t=>{if(typeof t=="number")return t;if(typeof t=="function")return this.data.findIndex(t);throw`invalid ${t}`});Y(this,Ys,t=>{if(typeof t=="number")return t;if(typeof t=="string"&&this.fields.includes(t))return parseInt($(`[data-bind="${t}"]`,this.template)[0].dataset.col);throw`invalid ${t}`});it(this,"scrollTo",t=>{this.row.at=t});it(this,"scrollBy",t=>this.dataManager.scrollTo_V1(this.dataManager.viewRecords.rawIndex+t));it(this,"scrollFirst",()=>{this.scrollTo(0)});it(this,"scrollLast",()=>{this.scrollTo(this.data.count()-1)});this.attachShadow({mode:"open"}),H.extendElementPrototype(),tt(this,as,[]),this.refreshBindRows=()=>{this.bindRows=[],this.bindMatrixRows=[],H.j.querySelectorAll(".ng-container tbody.bindable tr:not(.nodata)",this.body).elements.forEach(o=>{this.bindRows.push(parseInt(o.dataset.row)),this.bindMatrixRows.push(parseInt(o.dataset.matrixRow))}),this.bindRows=[...new Set(this.bindRows)],this.bindMatrixRows=[...new Set(this.bindMatrixRows)];var t=$(`.ng-container-body tr[data-row="${this.bindRows[this.bindRows.length-1]}"]`,this.body);if(t.length>0){var l=$(".ng-container-body",this.body);$("tfoot",l),t.eq(0).position().top;var c=0;t.each((o,r)=>{c+=$(r).height()})}},this.refresh=()=>{this.refreshScroll()},this.refreshScroll=()=>{},this.setCurrCell=t=>{this.currCell=t}}connectedCallback(){$(()=>{f(this,_c).call(this)}),document.addEventListener("DOMContentLoaded",t=>{}),$(document.body).on("mousedown",t=>{t.target.closest("ng-combo-panel")||$("ng-combo-panel").hide()})}disconnectedCallback(){}adoptedCallback(){}get currentRow(){return this.row.at}get dataSource(){return this.dataManager.rawRecords}set dataSource(t){this.dataManager?f(this,tl).call(this,t):setTimeout(()=>{f(this,tl).call(this,t)},300)}get layouts(){return f(this,as)}attributeChangedCallback(t,l,c){switch(t){case"lang":break;case"caption":const o=this.shadowRoot.querySelector("ng-head");o&&$("span:first-child",o.shadowRoot.querySelector("ng-title")).html(v);break;case"display-row-count":this.lastRowHidden=!!isNaN(parseInt(c));break;case"row-resizable":c=="true"?$(".row-resizer",this.shadowRoot).show():$(".row-resizer",this.shadowRoot).hide();break;case"col-indicator-type":H.j.querySelectorAll(".ng-table thead .col-indicator-rowgroup",this.body).removeClass(H.COLINDICATORTYPE.EXPAND).removeClass(H.COLINDICATORTYPE.COLLAPSE).addClass(c),f(this,vs).call(this);break;case"auto-fit-col":f(this,_i)&&f(this,_i).autoFit(c=="true"),f(this,vs).call(this);break;case"enable-fixed-col":c=="true"?H.j.querySelectorAll(this).addClass(t):H.j.querySelectorAll(this).removeClass(t);break;case"select-type":this.selection&&(this.selection.type=c);break;case"paging-type":this.paging&&(this.paging.type=c);break;case"paging-count":this.paging&&(this.paging.count=c);break;case"show-menu-icon":case"show-title-bar":const r=H.j.querySelectorAll(this).attr("show-title-bar")=="true",n=H.j.querySelectorAll(this).attr("show-menu-icon")=="true",s=this.shadowRoot.querySelector("ng-head");if(!s)break;const e=s.shadowRoot.querySelector("ng-menu");r?(H.j.querySelectorAll(s).addClass("expand"),$(s.shadowRoot).children().not("style").show(),n||H.j.querySelectorAll(e).hide()):n?H.j.querySelectorAll(s).removeClass("expand").show():H.j.querySelectorAll(s).hide(),f(this,vs).call(this);break;case"show-tfoot":$("tfoot",this.body).css({visibility:c=="true"?"unset":"collapse"}),f(this,vs).call(this);break;case"show-status-bar":c=="true"?H.j.querySelectorAll("ng-foot",this.shadowRoot).addClass("expand"):H.j.querySelectorAll("ng-foot",this.shadowRoot).removeClass("expand"),f(this,vs).call(this);break}}get firstCol(){return Math.min.apply(null,f(this,il).call(this))}get lastCol(){return Math.max.apply(null,f(this,il).call(this))}}Ja=new WeakMap,_i=new WeakMap,Qa=new WeakMap,Rn=new WeakMap,as=new WeakMap,tl=new WeakMap,el=new WeakMap,xc=new WeakMap,vs=new WeakMap,_c=new WeakMap,rl=new WeakMap,Sc=new WeakMap,ls=new WeakMap,kc=new WeakMap,sl=new WeakMap,Cc=new WeakMap,il=new WeakMap,Xs=new WeakMap,Ys=new WeakMap,it(Zn,"observedAttributes",["lang","caption","display-row-count","row-resizable","col-indicator-type","auto-fit-col","enable-fixed-col","select-type","paging-type","paging-count","show-menu-icon","show-title-bar","show-tfoot","show-status-bar"]),customElements.get("nine-grid")||customElements.define("nine-grid",Zn);class cf extends Zn{constructor(){super()}connectedCallback(){super.connectedCallback()}}customElements.get("ng-source")||customElements.define("ng-source",cf);class uf extends HTMLElement{constructor(){super();Y(this,ws);it(this,"showModal",()=>{this.querySelector("dialog").showModal()});it(this,"close",()=>{$(".head",this).off("mousedown",f(this,nl)),$(".head",this).off("touchstart",f(this,al)),$(document).off("mouseup",f(this,ol)),$(document).off("touchend",f(this,ll)),$(document).off("mousemove",f(this,Mn)),$(document).off("touchmove",f(this,In)),this.querySelector("dialog").close()});Y(this,Ec,()=>{$(".close",this).on("click",t=>{H.j.querySelectorAll("dialog",this).addClass("out"),setTimeout(()=>{this.close()},300)}),$(".close2",this).on("click",t=>{this.close()}),$(".head",this).on("mousedown",f(this,nl)),$(".head",this).on("touchstart",f(this,al)),$(document).on("mouseup",f(this,ol)),$(document).on("touchend",f(this,ll))});Y(this,nl,t=>{if(!t.target.closest("buttons")&&!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftkey)){var l=this.querySelector("dialog").getBoundingClientRect();tt(this,ws,{x:t.clientX-l.x,y:t.clientY-l.y}),$(document).on("mousemove",f(this,Mn))}});Y(this,Mn,t=>{$(this.querySelector("dialog")).offset({left:t.pageX-f(this,ws).x,top:t.pageY-f(this,ws).y})});Y(this,ol,t=>{$(document).off("mousemove",f(this,Mn))});Y(this,al,t=>{if(!t.target.closest("buttons")){var l=this.querySelector("dialog").getBoundingClientRect();tt(this,ws,{x:t.changedTouches[0].pageX-l.x,y:t.changedTouches[0].pageY-l.y}),$(document).on("touchmove",f(this,In))}});Y(this,In,t=>{$(this.querySelector("dialog")).offset({left:t.changedTouches[0].pageX-f(this,ws).x,top:t.changedTouches[0].pageY-f(this,ws).y})});Y(this,ll,t=>{$(document).off("touchmove",f(this,In))})}connectedCallback(){const t=this.innerHTML,l=this.getAttribute("css-file"),c=l?`@import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/${l}";`:"",o=l?H.getCustomPath(this,l):"";this.innerHTML=`
778
+ `;this.comboExpr=(r,n,s)=>{const e=s.querySelector("ng-combo");if(!e)return"";const i=e.getAttribute("code")||"code",u=e.getAttribute("codename")||"codename",a=e.getAttribute("multi-separator")||",";return H.binarySearchValue(e.dataSource,i,r[s.dataset.bind],u,a)};for(const r of f(this,as))$(H.j.querySelectorAll("tbody",r).addClass("bindable").elem()).before('<tbody class="fixed"></tbody>');$(this.shadowRoot).append(t),$(".ng-container-body",this.shadowRoot).append(f(this,as)[0]),this.body=this.shadowRoot.querySelector(".ng-body"),this.querySelectorAll("nx-buttons *").forEach(r=>{r.grid=this}),$(this.shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-custom")).append(this.querySelectorAll("nx-buttons")),f(this,sl).call(this),this.createTemplate(),f(this,el).call(this),this.resetTemplate(),f(this,Sc).call(this);const l=this.shadowRoot.querySelector("ng-foot");this.paging=l.shadowRoot.querySelector("ng-paging"),this.layout=l.shadowRoot.querySelector("ng-layout"),this.layout&&this.layout.add(f(this,as)),new zu(this),this.pin=new Gd(this),this.fields=new yd(this),this.cell=new Uu(this),this.touchEvent=new Wu(this),this.selection=new Vu(this),this.tables=new tf(this),this.dataManager=new hd(this),this.view=new of(this),this.tableUtils=new ef(this),this.columns=new td(this);for(var c in this.dataManager)this.dataManager[c]instanceof Function&&!["xxx"].includes(c)?this[c]=this.dataManager[c].bind(this):["data","row","tree"].includes(c)&&(this[c]=this.dataManager[c]);for(var c in this.tableUtils)["columns"].includes(c)&&(this[c]=this.tableUtils[c]);for(var c in this.cell)this.cell[c]instanceof Function&&!["refresh"].includes(c)||["xx"].includes(c)&&(this[c]=this.cell[c]);H.j.querySelectorAll(this).hasClass("simple")||(this.filtering=new af(this)),!H.j.querySelectorAll(this).hasClass("combo")&&!H.j.querySelectorAll(this).hasClass("filter")&&$(this.shadowRoot).append($("<ng-combo-panel></ng-combo-panel").hide()),this.sorting=new Qd(this),this.matrix=new $d(this),jr.log("==============================="),jr.log(this,this.matrix),tt(this,_i,new Qu(this)),tt(this,Qa,new Ju(this)),H.j.querySelectorAll(this).hasClass("simple")||tt(this,Rn,new Ud(this)),f(this,rl).call(this),this.refresh(),this.body.querySelector(".ng-container-body .nodata")&&new ResizeObserver((r,n)=>{this.body.querySelector("ng-vscrollbar").refresh()}).observe(this.body.querySelector(".ng-container-body .nodata")),!H.j.querySelectorAll(this).hasClass("filter")&&!H.j.querySelectorAll(this).hasClass("combo")&&($(this.body).on("mousedown",r=>{this.shadowRoot.querySelectorAll("ng-combo-panel,ng-filter-panel,ng-context-menu-panel").forEach(n=>{$(n).is(":visible")&&$(n).hide()})}),$(this).on("click",r=>{r.target.shadowRoot.querySelectorAll("ng-info").forEach(n=>{n.close()})})),new nd(this),this.classList.contains("simple")||setTimeout(()=>{this.dispatchEvent(new CustomEvent(H.EVENT.LOAD,{bubbles:!0,detail:{}}))},100);const o=this.shadowRoot.querySelector("ng-head");o&&o.shadowRoot.querySelectorAll("nx-buttons button").forEach(r=>{r.addEventListener("click",n=>{const s=new CustomEvent(H.EVENT.BUTTON_CLICK,{bubbles:!0,detail:{target:r}});this.dispatchEvent(s)})}),tt(this,Ja,!0)});Y(this,rl,()=>{this.lastRowHidden=isNaN(parseInt(H.j.querySelectorAll(this).attr("display-row-count"))),this.paging||(this.paging={}),H.j.querySelectorAll(this).attr("col-indicator-type",H.j.querySelectorAll(this).attr("col-indicator-type")||H.COLINDICATORTYPE.COLLAPSE),H.j.querySelectorAll(this).attr("auto-fit-col",H.j.querySelectorAll(this).attr("auto-fit-col")||"false"),H.j.querySelectorAll(this).attr("col-resizable",H.j.querySelectorAll(this).attr("col-resizable")||"true"),H.j.querySelectorAll(this).attr("row-resizable",H.j.querySelectorAll(this).attr("row-resizable")||"false"),H.j.querySelectorAll(this).attr("col-movable",H.j.querySelectorAll(this).attr("col-movable")||"false"),H.j.querySelectorAll(this).attr("enable-fixed-col",H.j.querySelectorAll(this).attr("enable-fixed-col")||"false"),H.j.querySelectorAll(this).attr("show-title-bar",H.j.querySelectorAll(this).attr("show-title-bar")||"false"),H.j.querySelectorAll(this).attr("show-menu-icon",H.j.querySelectorAll(this).attr("show-menu-icon")||"false"),H.j.querySelectorAll(this).attr("show-status-bar",H.j.querySelectorAll(this).attr("show-status-bar")||"false"),H.j.querySelectorAll(this).attr("show-thead",H.j.querySelectorAll(this).attr("show-thead")||"true"),H.j.querySelectorAll(this).attr("show-tfoot",H.j.querySelectorAll(this).attr("show-tfoot")||"true"),H.j.querySelectorAll(this).attr("select-type",H.j.querySelectorAll(this).attr("select-type")||H.SELECTTYPE.CELL),H.j.querySelectorAll(this).attr("paging-type",H.j.querySelectorAll(this).attr("paging-type")||H.PAGINGTYPE.NONE),H.j.querySelectorAll(this).attr("paging-count",H.j.querySelectorAll(this).attr("paging-count")||H.PAGINGCOUNT.AUTO)});Y(this,Sc,()=>{new ResizeObserver(l=>{this.view&&this.view.redraw(),this.refreshScroll(),this.refreshBindRows(),$("tbody.bindable tr:not([data-matrix-row])",this.body).not(".nodata").length>0&&this.dataManager.viewRecords.reset()}).observe(this);const t=new MutationObserver((l,c)=>{this.body.querySelector("ng-hscrollbar").refresh()});$("colgroup",this.body).each((l,c)=>{t.observe(c,{childList:!0,subtree:!0,attributeOldValue:!0})}),this.body.querySelector("ng-hscrollbar").refresh(),new ResizeObserver((l,c)=>{if(this.getAttribute("auto-fit-col")=="true"){let n=[];var o=0;$(".ng-container-body col",this.body).each((e,i)=>{n.push({col:i,width:Number(H.j.querySelectorAll(i).attr("width"))})}),n.forEach(e=>{o+=e.width});const s=$(".ng-container-body",this.body).width();s!=0&&n.forEach(e=>{var i=e.width*s/o;H.j.querySelectorAll(e.col).attr("width",i)})}this.body.querySelector("ng-hscrollbar").refresh();const r=this.shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout");r&&r.resize(),f(this,vs).call(this)}).observe(this.body.querySelector(".ng-container-body"))});it(this,"createTemplate",()=>{this.template=$(".ng-container-body tbody.bindable tr:not(.nodata)",this.body).clone(),this.tmpl=this.body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)"),this.activeTmpl=this.body.querySelector(".ng-container-body tbody.bindable tr:not(.nodata)")});it(this,"resetTemplate",()=>{var t=0;["left","body","right"].forEach(o=>{$(`.ng-container-${o} colgroup col`,this.body).each((r,n)=>{n.dataset.col=t++})});var l=[];$(".col-indicator",this.body).each((o,r)=>{l.push({from:parseInt(r.dataset.col),to:o}),r.innerHTML=`<div>${H.num2ExcelCol(o)}</div>`}),this.template.find("th,td").each((o,r)=>{const n=l.findIndex(s=>s.from==r.dataset.col);n>=0&&(r.dataset.col=l[n].to)}),$(".ng-table th,.ng-table td",this.body).each((o,r)=>{const n=l.findIndex(s=>s.from==r.dataset.col);n>=0&&(r.dataset.col=l[n].to)});const c=this.shadowRoot.querySelector("ng-foot").shadowRoot.querySelector("ng-layout");c&&($("th,td",c.currentTable).each((o,r)=>{const n=l.findIndex(s=>s.from==r.dataset.col);n>=0&&(r.dataset.col=l[n].to)}),$(".last",c.currentTable).each((o,r)=>{H.j.querySelectorAll(r).addClass("dummy")})),this.template.find(".last").each((o,r)=>{H.j.querySelectorAll(r).addClass("dummy")}),$(".last",this.body).each((o,r)=>{H.j.querySelectorAll(r).addClass("dummy")})});Y(this,ls,(t,l)=>{var c=$(l+" tr",t),o=$(l+" th,"+l+" td",t),r=c.length,n=0;o.each((e,i)=>{n+=i.colSpan});var s=Array.from(Array(r),()=>Array(n).fill(null));c.each((e,i)=>{var u=i.sectionRowIndex,a=0;$(i).find("th,td").each((h,p)=>{for(var m=0;m<s[u].length;m++)if(s[u][m]==null){a=m;break}for(var m=0;m<p.rowSpan;m++)for(var d=0;d<p.colSpan;d++)try{s[u+m][a+d]=m==0&&d==0?"1":"0"}catch(g){console.error(g)}})}),c.each((e,i)=>{var u=i.sectionRowIndex;$(i).find("th,td").not(".dummy").each((a,h)=>{for(var p=0;p<s[u].length;p++)if(s[u][p]=="1"){h.dataset.col=p,s[u][p]="0";break}})})});Y(this,kc,()=>{const t='<th data-col="@col" class="col-indicator" scope="col"><div>@text</div></th>';var l=this.body.querySelector(".ng-container-body > table > thead");if(!l||l.querySelector(".col-indicator-rowgroup"))return;const c=H.j.querySelectorAll(l.insertRow(0)).attr("role","row").addClass("col-indicator-rowgroup").elem();var o=0;$(".ng-container-body > table > tbody.bindable > tr",this.body).eq(0).find("th,td").each((n,s)=>{if(!H.j.querySelectorAll(s).hasClass("dummy"))for(var e=0;e<s.colSpan;e++)$(c).append(t.replace("@col",o).replace("@text",H.num2ExcelCol(o++)))});var r=[];$("colgroup col",this.body).each((n,s)=>{r.push({width:parseInt(H.j.querySelectorAll(s).attr("width")),background:H.j.querySelectorAll(s).attr("background-color")})}),$("thead .col-indicator",this.body).each((n,s)=>{if(!r[n])return!1;$(s).css({width:r[n].width,"min-width":r[n].width,"background-color":r[n].background,"border-top-color":r[n].background}),H.j.querySelectorAll(s).attr("background-color",r[n].background)})});Y(this,sl,()=>{var t=this.body.querySelector(".ng-container-body > table");if(t){t.querySelectorAll("tbody tr").forEach(c=>{c.style.height||(c.style.height="32px")});var l=t.querySelector("thead");l.length<=0&&$("<thead></thead>").appendTo(t),H.j.querySelectorAll(t).attr("role","table").addClass("ng-table"),H.j.querySelectorAll("tbody th,tbody td",t).attr("tabindex",0),H.j.querySelectorAll("thead,tbody,tfoot",t).attr("role","rowgroup"),H.j.querySelectorAll("tr",t).attr("role","row"),H.j.querySelectorAll("tbody > tr",t).attr("role","gridcell"),H.j.querySelectorAll("th,td",t).attr("scope","col"),f(this,ls).call(this,$(t),"thead"),f(this,ls).call(this,$(t),"tbody.bindable"),f(this,ls).call(this,$(t),"tbody.fixed"),f(this,ls).call(this,$(t),"tfoot"),f(this,kc).call(this),t.querySelectorAll("col").forEach((c,o)=>{H.j.querySelectorAll(`[data-col="${o}"]`,t).attr("fixed",H.j.querySelectorAll(c).attr("fixed"))})}});Y(this,Cc,t=>{f(this,ls).call(this,t,"thead"),f(this,ls).call(this,t,"tbody"),f(this,ls).call(this,t,"tfoot"),$("colgroup col[fixed=left]",t).index($(".dummy[fixed=left]",t)),$("tr",t).each((l,c)=>{}),$("colgroup",t).prepend('<col width="0" fixed="left" class="first" />'),$("tr",t).each((l,c)=>{$(c).prepend('<td class="first"></td>')}),$("colgroup",t).append('<col width="0" fixed="right" class="last" />'),$("tr",t).each((l,c)=>{$(c).append('<td class="last"></td>')})});Y(this,il,()=>{var t=[];return $("th,td",this.template).not(".dummy").not(".first").each((l,c)=>{c.querySelector("ng-row-indicator")||t.push(Number(c.dataset.col))}),t});it(this,"selectArea",(t,l,c,o)=>{const r=f(this,Xs).call(this,t),n=f(this,Xs).call(this,c),s=f(this,Ys).call(this,l),e=f(this,Ys).call(this,o),i=parseInt(r*this.template.length),u=parseInt(n*this.template.length)+this.template.length-1;this.row.at=r,r>=0&&n>=0?this.selection.selectArea(i,s,u,e):this.clearSelection()});it(this,"selectRow",(t,l)=>{const c=f(this,Xs).call(this,t),o=H.isNull(oRow2)?c:f(this,Xs).call(this,l),r=parseInt(c*this.template.length),n=parseInt(o*this.template.length)+this.template.length-1;this.row.at=c,c>=0&&o>=0?this.selection.selectArea(r,this.firstCol,n,this.lastCol):this.clearSelection()});it(this,"selectCol",(t,l)=>{const c=f(this,Ys).call(this,t),o=H.isNull(l)?c:f(this,Ys).call(this,l),r=0,n=parseInt(this.data.count()*this.template.length-1);c>=0&&o>=0?this.selection.selectArea(r,c,n,o):this.clearSelection()});it(this,"selectCell",(t,l,c)=>{const o=f(this,Xs).call(this,t),r=f(this,Ys).call(this,l),n=parseInt(o*this.template.length)+H.nvl(c,0);this.row.at=o,o>=0?this.selection.selectArea(n,r,n,r):this.clearSelection()});Y(this,Xs,t=>{if(typeof t=="number")return t;if(typeof t=="function")return this.data.findIndex(t);throw`invalid ${t}`});Y(this,Ys,t=>{if(typeof t=="number")return t;if(typeof t=="string"&&this.fields.includes(t))return parseInt($(`[data-bind="${t}"]`,this.template)[0].dataset.col);throw`invalid ${t}`});it(this,"scrollTo",t=>{this.row.at=t});it(this,"scrollBy",t=>this.dataManager.scrollTo_V1(this.dataManager.viewRecords.rawIndex+t));it(this,"scrollFirst",()=>{this.scrollTo(0)});it(this,"scrollLast",()=>{this.scrollTo(this.data.count()-1)});this.attachShadow({mode:"open"}),H.extendElementPrototype(),tt(this,as,[]),this.refreshBindRows=()=>{this.bindRows=[],this.bindMatrixRows=[],H.j.querySelectorAll(".ng-container tbody.bindable tr:not(.nodata)",this.body).elements.forEach(o=>{this.bindRows.push(parseInt(o.dataset.row)),this.bindMatrixRows.push(parseInt(o.dataset.matrixRow))}),this.bindRows=[...new Set(this.bindRows)],this.bindMatrixRows=[...new Set(this.bindMatrixRows)];var t=$(`.ng-container-body tr[data-row="${this.bindRows[this.bindRows.length-1]}"]`,this.body);if(t.length>0){var l=$(".ng-container-body",this.body);$("tfoot",l),t.eq(0).position().top;var c=0;t.each((o,r)=>{c+=$(r).height()})}},this.refresh=()=>{this.refreshScroll()},this.refreshScroll=()=>{},this.setCurrCell=t=>{this.currCell=t}}connectedCallback(){$(()=>{f(this,_c).call(this)}),document.addEventListener("DOMContentLoaded",t=>{}),$(document.body).on("mousedown",t=>{t.target.closest("ng-combo-panel")||$("ng-combo-panel").hide()})}disconnectedCallback(){}adoptedCallback(){}get currentRow(){return this.row.at}get dataSource(){return this.dataManager.rawRecords}set dataSource(t){this.dataManager?f(this,tl).call(this,t):setTimeout(()=>{f(this,tl).call(this,t)},300)}get layouts(){return f(this,as)}attributeChangedCallback(t,l,c){switch(t){case"lang":break;case"caption":const o=this.shadowRoot.querySelector("ng-head");o&&$("span:first-child",o.shadowRoot.querySelector("ng-title")).html(v);break;case"display-row-count":this.lastRowHidden=!!isNaN(parseInt(c));break;case"row-resizable":c=="true"?$(".row-resizer",this.shadowRoot).show():$(".row-resizer",this.shadowRoot).hide();break;case"col-indicator-type":H.j.querySelectorAll(".ng-table thead .col-indicator-rowgroup",this.body).removeClass(H.COLINDICATORTYPE.EXPAND).removeClass(H.COLINDICATORTYPE.COLLAPSE).addClass(c),f(this,vs).call(this);break;case"auto-fit-col":f(this,_i)&&f(this,_i).autoFit(c=="true"),f(this,vs).call(this);break;case"enable-fixed-col":c=="true"?H.j.querySelectorAll(this).addClass(t):H.j.querySelectorAll(this).removeClass(t);break;case"select-type":this.selection&&(this.selection.type=c);break;case"paging-type":this.paging&&(this.paging.type=c);break;case"paging-count":this.paging&&(this.paging.count=c);break;case"show-menu-icon":case"show-title-bar":const r=H.j.querySelectorAll(this).attr("show-title-bar")=="true",n=H.j.querySelectorAll(this).attr("show-menu-icon")=="true",s=this.shadowRoot.querySelector("ng-head");if(!s)break;const e=s.shadowRoot.querySelector("ng-menu");r?(H.j.querySelectorAll(s).addClass("expand"),$(s.shadowRoot).children().not("style").show(),n||H.j.querySelectorAll(e).hide()):n?H.j.querySelectorAll(s).removeClass("expand").show():H.j.querySelectorAll(s).hide(),f(this,vs).call(this);break;case"show-tfoot":$("tfoot",this.body).css({visibility:c=="true"?"unset":"collapse"}),f(this,vs).call(this);break;case"show-status-bar":c=="true"?H.j.querySelectorAll("ng-foot",this.shadowRoot).addClass("expand"):H.j.querySelectorAll("ng-foot",this.shadowRoot).removeClass("expand"),f(this,vs).call(this);break}}get firstCol(){return Math.min.apply(null,f(this,il).call(this))}get lastCol(){return Math.max.apply(null,f(this,il).call(this))}}Ja=new WeakMap,_i=new WeakMap,Qa=new WeakMap,Rn=new WeakMap,as=new WeakMap,tl=new WeakMap,el=new WeakMap,xc=new WeakMap,vs=new WeakMap,_c=new WeakMap,rl=new WeakMap,Sc=new WeakMap,ls=new WeakMap,kc=new WeakMap,sl=new WeakMap,Cc=new WeakMap,il=new WeakMap,Xs=new WeakMap,Ys=new WeakMap,it(Zn,"observedAttributes",["lang","caption","display-row-count","row-resizable","col-indicator-type","auto-fit-col","enable-fixed-col","select-type","paging-type","paging-count","show-menu-icon","show-title-bar","show-tfoot","show-status-bar"]),customElements.get("nine-grid")||customElements.define("nine-grid",Zn);class cf extends Zn{constructor(){super()}connectedCallback(){super.connectedCallback()}}customElements.get("ng-source")||customElements.define("ng-source",cf);class uf extends HTMLElement{constructor(){super();Y(this,ws);it(this,"showModal",()=>{this.querySelector("dialog").showModal()});it(this,"close",()=>{$(".head",this).off("mousedown",f(this,nl)),$(".head",this).off("touchstart",f(this,al)),$(document).off("mouseup",f(this,ol)),$(document).off("touchend",f(this,ll)),$(document).off("mousemove",f(this,Mn)),$(document).off("touchmove",f(this,In)),this.querySelector("dialog").close()});Y(this,Ec,()=>{$(".close",this).on("click",t=>{H.j.querySelectorAll("dialog",this).addClass("out"),setTimeout(()=>{this.close()},300)}),$(".close2",this).on("click",t=>{this.close()}),$(".head",this).on("mousedown",f(this,nl)),$(".head",this).on("touchstart",f(this,al)),$(document).on("mouseup",f(this,ol)),$(document).on("touchend",f(this,ll))});Y(this,nl,t=>{if(!t.target.closest("buttons")&&!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftkey)){var l=this.querySelector("dialog").getBoundingClientRect();tt(this,ws,{x:t.clientX-l.x,y:t.clientY-l.y}),$(document).on("mousemove",f(this,Mn))}});Y(this,Mn,t=>{$(this.querySelector("dialog")).offset({left:t.pageX-f(this,ws).x,top:t.pageY-f(this,ws).y})});Y(this,ol,t=>{$(document).off("mousemove",f(this,Mn))});Y(this,al,t=>{if(!t.target.closest("buttons")){var l=this.querySelector("dialog").getBoundingClientRect();tt(this,ws,{x:t.changedTouches[0].pageX-l.x,y:t.changedTouches[0].pageY-l.y}),$(document).on("touchmove",f(this,In))}});Y(this,In,t=>{$(this.querySelector("dialog")).offset({left:t.changedTouches[0].pageX-f(this,ws).x,top:t.changedTouches[0].pageY-f(this,ws).y})});Y(this,ll,t=>{$(document).off("touchmove",f(this,In))})}connectedCallback(){const t=this.innerHTML,l=this.getAttribute("css-file"),c=l?`@import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/${l}";`:"",o=l?H.getCustomPath(this,l):"";this.innerHTML=`
779
779
  <style>
780
780
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/nxDialog.css";
781
781
  ${H.getCustomPath(this,"nxDialog.css")||""}
@@ -1278,13 +1278,13 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
1278
1278
 
1279
1279
  <div class="tabs"></div>
1280
1280
  <div class="tab-pages"></div>
1281
- `,this.switchTabHandler=er(this,Hn,Bu).bind(this),this.tabpage={show:t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((l,c)=>{l.innerText.trim()===t&&(l.style.display="unset")})},showAll:()=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((t,l)=>{t.style.display="unset"})},hide:t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((l,c)=>{l.innerText.trim()===t&&(l.style.display="none")})}}}connectedCallback(){f(this,Bc).call(this),this.dispatchEvent(new CustomEvent(H.EVENT.TAB_LOAD,{bubbles:!0,detail:{}}))}}Hn=new WeakSet,Du=function(){const t=this.shadowRoot.querySelector(".tabs"),l=this.shadowRoot.querySelector(".tab-pages"),c=this.querySelectorAll("nx-tab-page");c.forEach((o,r)=>{const n=document.createElement("div");n.classList.add("tab-button"),n.textContent=o.getAttribute("caption"),n.setAttribute("data-target",`content${r}`),t.appendChild(n);const s=document.createElement("div");s.id=`content${r}`,s.classList.add("tab-page"),s.innerHTML=o.innerHTML,l.appendChild(s)}),c.forEach(o=>{o.remove()})},Bu=function(t){const l=t.target;if(console.log(t),!l.classList.contains("tab-button"))return;const c=l.getAttribute("data-target"),o=this.shadowRoot.querySelector(".tab-button.active"),r=this.shadowRoot.querySelector(".tab-page.active"),n=this.shadowRoot.getElementById(c);console.log(c,o,r,n),o!==l&&(console.log("*******"),o&&r?(o.classList.remove("active"),r.classList.remove("active","exit-left","exit-right"),r.style.left="",o.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?r.classList.add("exit-left"):r.classList.add("exit-right"),n.classList.add("active"),n.style.left="",n.classList.remove("exit-left","exit-right")):r&&n&&(r.classList.remove("active","exit-left","exit-right"),r.style.left="",r.classList.add("exit-left"),n.classList.add("active"),n.style.left="",n.classList.remove("exit-left","exit-right")),l.classList.add("active"),this.shadowRoot.querySelector(".tab-pages").style.height=`${n.scrollHeight}px`)},Bc=new WeakMap;class Af extends HTMLElement{constructor(){super()}connectedCallback(){this.caption=this.getAttribute("caption")}}customElements.get("nx-tab")||customElements.define("nx-tab",Ef),customElements.get("nx-tab-page")||customElements.define("nx-tab-page",Af);class Tf extends HTMLElement{constructor(){super();Y(this,Dr);Y(this,Fc,t=>{const l=t.previousElementSibling,c=t.nextElementSibling;if(!l||!c){tt(this,Dr,this.classList.contains("h")?"h":"v");return}const o=l.getBoundingClientRect(),r=c.getBoundingClientRect();this.classList.contains("h")?tt(this,Dr,"h"):this.classList.contains("v")?tt(this,Dr,"v"):tt(this,Dr,Math.abs(o.top-r.top)<5?"h":"v")});Y(this,qc,t=>{t.preventDefault(),t.stopPropagation();const l=this.getBoundingClientRect(),c=f(this,Dr)==="h",o=c?t.clientX-l.left:t.clientY-l.top,r=document.createElement("div");r.className=`nx-splitter-drag-bar-${f(this,Dr)}`,Object.assign(r.style,{position:"absolute",zIndex:"999",background:"#666",opacity:"0.6",pointerEvents:"none"});const n=this.getRootNode({composed:!0}),s=n instanceof ShadowRoot?n.host:this.parentElement,e=this.previousElementSibling,i=this.nextElementSibling;if(!s||!e||!i){console.warn("Spliter's parent or siblings not found.");return}(s.shadowRoot||s).appendChild(r);const u=r.offsetParent.getBoundingClientRect(),a=e.getBoundingClientRect(),h=i.getBoundingClientRect(),p=(c?l.left-u.left:l.top-u.top)+o;c?(r.style.top="0",r.style.left=`${p}px`,r.style.width="1px",r.style.height="100%"):(r.style.left="0",r.style.top=`${p}px`,r.style.height="1px",r.style.width="100%"),r.style.zIndex="99999";const m=c?a.left-u.left:a.top-u.top,d=c?h.right-u.left-l.width:h.bottom-u.top-l.height,b=S=>{const E=c?S.clientX:S.clientY,I=c?E-u.left:E-u.top,D=Math.max(m,Math.min(I,d));c?r.style.left=`${D}px`:r.style.top=`${D}px`},g=()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",g),r.remove();const S=Array.from(s.children),E=S.filter(O=>O.tagName.toLowerCase()!=="nx-splitter"),I=window.getComputedStyle(s),D=c?I.getPropertyValue("column-gap"):I.getPropertyValue("row-gap"),z=parseFloat(D)||0,B=(S.length>1?S.length-1:0)*z,W=parseFloat(c?r.style.left:r.style.top)-p,q=c?e.getBoundingClientRect().width:e.getBoundingClientRect().height,A=c?i.getBoundingClientRect().width:i.getBoundingClientRect().height;let M=q+W,k=A-W;M<0&&(k+=M,M=0),k<0&&(M+=k,k=0);const y=E.map(O=>c?O.getBoundingClientRect().width:O.getBoundingClientRect().height),w=S.reduce((O,j)=>j.tagName.toLowerCase()==="nx-splitter"?O+(c?j.getBoundingClientRect().width:j.getBoundingClientRect().height):O,0),_=(c?s.getBoundingClientRect().width:s.getBoundingClientRect().height)-w-B;let T=0;E.forEach((O,j)=>{let V;O===e?V=M:O===i?V=k:V=y[j];const X=V/_;console.log(O),O.classList.contains("sidebar")?O.style.flex=`0 0 ${V}px`:O.style.flex=`${X} ${X} 0`,T+=X}),console.log(`dragOffset: ${W}`),console.log(`Calculated FlexSum: ${T}`)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",g)});Y(this,Hc,()=>{f(this,Fc).call(this,this),this.classList.add(f(this,Dr));const t=this.innerHTML.trim(),l=`grip-${f(this,Dr)}`,c=t===""?`<div class="${l}"></div>`:`<div class="${l}"></div><div class="inner-container">${t}</div><div class="${l}"></div>`;this.innerHTML="";const o=document.createElement("template");o.innerHTML=`
1281
+ `,this.switchTabHandler=er(this,Hn,Bu).bind(this),this.tabpage={show:t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((l,c)=>{l.innerText.trim()===t&&(l.style.display="unset")})},showAll:()=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((t,l)=>{t.style.display="unset"})},hide:t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((l,c)=>{l.innerText.trim()===t&&(l.style.display="none")})}}}connectedCallback(){f(this,Bc).call(this),this.dispatchEvent(new CustomEvent(H.EVENT.TAB_LOAD,{bubbles:!0,detail:{}}))}}Hn=new WeakSet,Du=function(){const t=this.shadowRoot.querySelector(".tabs"),l=this.shadowRoot.querySelector(".tab-pages"),c=this.querySelectorAll("nx-tab-page");c.forEach((o,r)=>{const n=document.createElement("div");n.classList.add("tab-button"),n.textContent=o.getAttribute("caption"),n.setAttribute("data-target",`content${r}`),t.appendChild(n);const s=document.createElement("div");s.id=`content${r}`,s.classList.add("tab-page"),s.innerHTML=o.innerHTML,l.appendChild(s)}),c.forEach(o=>{o.remove()})},Bu=function(t){const l=t.target;if(console.log(t),!l.classList.contains("tab-button"))return;const c=l.getAttribute("data-target"),o=this.shadowRoot.querySelector(".tab-button.active"),r=this.shadowRoot.querySelector(".tab-page.active"),n=this.shadowRoot.getElementById(c);console.log(c,o,r,n),o!==l&&(console.log("*******"),o&&r?(o.classList.remove("active"),r.classList.remove("active","exit-left","exit-right"),r.style.left="",o.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?r.classList.add("exit-left"):r.classList.add("exit-right"),n.classList.add("active"),n.style.left="",n.classList.remove("exit-left","exit-right")):r&&n&&(r.classList.remove("active","exit-left","exit-right"),r.style.left="",r.classList.add("exit-left"),n.classList.add("active"),n.style.left="",n.classList.remove("exit-left","exit-right")),l.classList.add("active"),this.shadowRoot.querySelector(".tab-pages").style.height=`${n.scrollHeight}px`)},Bc=new WeakMap;class Af extends HTMLElement{constructor(){super()}connectedCallback(){this.caption=this.getAttribute("caption")}}customElements.get("nx-tab")||customElements.define("nx-tab",Ef),customElements.get("nx-tab-page")||customElements.define("nx-tab-page",Af);class Tf extends HTMLElement{constructor(){super();Y(this,Br);Y(this,Fc,t=>{const l=t.previousElementSibling,c=t.nextElementSibling;if(!l||!c){tt(this,Br,this.classList.contains("h")?"h":"v");return}const o=l.getBoundingClientRect(),r=c.getBoundingClientRect();this.classList.contains("h")?tt(this,Br,"h"):this.classList.contains("v")?tt(this,Br,"v"):tt(this,Br,Math.abs(o.top-r.top)<5?"h":"v")});Y(this,qc,t=>{t.preventDefault(),t.stopPropagation();const l=this.getBoundingClientRect(),c=f(this,Br)==="h",o=c?t.clientX-l.left:t.clientY-l.top,r=document.createElement("div");r.className=`nx-splitter-drag-bar-${f(this,Br)}`,Object.assign(r.style,{position:"absolute",zIndex:"999",background:"#666",opacity:"0.6",pointerEvents:"none"});const n=this.getRootNode({composed:!0}),s=n instanceof ShadowRoot?n.host:this.parentElement,e=this.previousElementSibling,i=this.nextElementSibling;if(!s||!e||!i){console.warn("Spliter's parent or siblings not found.");return}(s.shadowRoot||s).appendChild(r);const u=r.offsetParent.getBoundingClientRect(),a=e.getBoundingClientRect(),h=i.getBoundingClientRect(),p=(c?l.left-u.left:l.top-u.top)+o;c?(r.style.top="0",r.style.left=`${p}px`,r.style.width="1px",r.style.height="100%"):(r.style.left="0",r.style.top=`${p}px`,r.style.height="1px",r.style.width="100%"),r.style.zIndex="99999";const m=c?a.left-u.left:a.top-u.top,d=c?h.right-u.left-l.width:h.bottom-u.top-l.height,b=S=>{const E=c?S.clientX:S.clientY,I=c?E-u.left:E-u.top,D=Math.max(m,Math.min(I,d));c?r.style.left=`${D}px`:r.style.top=`${D}px`},g=()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",g),r.remove();const S=Array.from(s.children),E=S.filter(O=>O.tagName.toLowerCase()!=="nx-splitter"),I=window.getComputedStyle(s),D=c?I.getPropertyValue("column-gap"):I.getPropertyValue("row-gap"),z=parseFloat(D)||0,B=(S.length>1?S.length-1:0)*z,W=parseFloat(c?r.style.left:r.style.top)-p,q=c?e.getBoundingClientRect().width:e.getBoundingClientRect().height,A=c?i.getBoundingClientRect().width:i.getBoundingClientRect().height;let M=q+W,k=A-W;M<0&&(k+=M,M=0),k<0&&(M+=k,k=0);const y=E.map(O=>c?O.getBoundingClientRect().width:O.getBoundingClientRect().height),w=S.reduce((O,j)=>j.tagName.toLowerCase()==="nx-splitter"?O+(c?j.getBoundingClientRect().width:j.getBoundingClientRect().height):O,0),_=(c?s.getBoundingClientRect().width:s.getBoundingClientRect().height)-w-B;let T=0;E.forEach((O,j)=>{let V;O===e?V=M:O===i?V=k:V=y[j];const X=V/_;console.log(O),O.classList.contains("sidebar")?O.style.flex=`0 0 ${V}px`:O.style.flex=`${X} ${X} 0`,T+=X}),console.log(`dragOffset: ${W}`),console.log(`Calculated FlexSum: ${T}`)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",g)});Y(this,Hc,()=>{f(this,Fc).call(this,this),this.classList.add(f(this,Br));const t=this.innerHTML.trim(),l=`grip-${f(this,Br)}`,c=t===""?`<div class="${l}"></div>`:`<div class="${l}"></div><div class="inner-container">${t}</div><div class="${l}"></div>`;this.innerHTML="";const o=document.createElement("template");o.innerHTML=`
1282
1282
  <style>
1283
1283
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/nxSplitter.css";
1284
1284
  ${H.getCustomPath(this,"nxSplitter.css")}
1285
1285
  </style>
1286
1286
  ${c}
1287
- `,this.shadowRoot.appendChild(o.content.cloneNode(!0)),this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(r=>{r.addEventListener("mousedown",n=>f(this,qc).call(this,n))}),f(this,xl).call(this),window.addEventListener("resize",()=>f(this,xl).call(this))});Y(this,xl,()=>{const t=f(this,Dr)==="h",l=this.parentElement,c=Array.from(l.children).filter(s=>s.tagName.toLowerCase()!=="nx-splitter");if(c.length<2)return;const o=l.getBoundingClientRect(),r=c.reduce((s,e)=>{const i=t?e.getBoundingClientRect().width:e.getBoundingClientRect().height;return s+i},0),n=t?o.width:o.height;c.forEach(s=>{const e=t?s.getBoundingClientRect().width:s.getBoundingClientRect().height,u=n*(e/r)/n;s.style.flex=`${u} ${u} 0`})});this.attachShadow({mode:"open"})}connectedCallback(){f(this,Hc).call(this)}}Dr=new WeakMap,Fc=new WeakMap,qc=new WeakMap,Hc=new WeakMap,xl=new WeakMap,customElements.get("nx-splitter")||customElements.define("nx-splitter",Tf);class Rf extends HTMLElement{constructor(){super();Y(this,mu);it(this,"getData_BAK",()=>{const t={};return this.shadowRoot.querySelectorAll("[id]").forEach(l=>{l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"?t[l.id]=l.value:t[l.id]=l.textContent.trim()}),t});it(this,"getData",()=>{const t={};return this.shadowRoot.querySelectorAll("input, textarea, select, [id], [name]").forEach(l=>{const c=l.id||l.name;if(!c)return;const o=l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"?l.value:l.textContent.trim();t[c]?(Array.isArray(t[c])||(t[c]=[t[c]]),t[c].push(o)):t[c]=o}),t});Y(this,zc,()=>{const t=this.innerHTML.trim();this.innerHTML="";const l=document.createElement("template");l.innerHTML=`
1287
+ `,this.shadowRoot.appendChild(o.content.cloneNode(!0)),this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(r=>{r.addEventListener("mousedown",n=>f(this,qc).call(this,n))}),f(this,xl).call(this),window.addEventListener("resize",()=>f(this,xl).call(this))});Y(this,xl,()=>{const t=f(this,Br)==="h",l=this.parentElement,c=Array.from(l.children).filter(s=>s.tagName.toLowerCase()!=="nx-splitter");if(c.length<2)return;const o=l.getBoundingClientRect(),r=c.reduce((s,e)=>{const i=t?e.getBoundingClientRect().width:e.getBoundingClientRect().height;return s+i},0),n=t?o.width:o.height;c.forEach(s=>{const e=t?s.getBoundingClientRect().width:s.getBoundingClientRect().height,u=n*(e/r)/n;s.style.flex=`${u} ${u} 0`})});this.attachShadow({mode:"open"})}connectedCallback(){f(this,Hc).call(this)}}Br=new WeakMap,Fc=new WeakMap,qc=new WeakMap,Hc=new WeakMap,xl=new WeakMap,customElements.get("nx-splitter")||customElements.define("nx-splitter",Tf);class Rf extends HTMLElement{constructor(){super();Y(this,mu);it(this,"getData_BAK",()=>{const t={};return this.shadowRoot.querySelectorAll("[id]").forEach(l=>{l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"?t[l.id]=l.value:t[l.id]=l.textContent.trim()}),t});it(this,"getData",()=>{const t={};return this.shadowRoot.querySelectorAll("input, textarea, select, [id], [name]").forEach(l=>{const c=l.id||l.name;if(!c)return;const o=l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"?l.value:l.textContent.trim();t[c]?(Array.isArray(t[c])||(t[c]=[t[c]]),t[c].push(o)):t[c]=o}),t});Y(this,zc,()=>{const t=this.innerHTML.trim();this.innerHTML="";const l=document.createElement("template");l.innerHTML=`
1288
1288
  <style>
1289
1289
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/nxForm.css";
1290
1290
  ${H.getCustomPath(this,"nxForm.css")}