@ninebone/grid 0.0.44 → 0.0.45

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,Es)=>(bu(de,Se,"write to private field"),Es?Es.call(de,Ue):Se.set(de,Ue),Ue),er=(de,Se,Ue)=>(bu(de,Se,"access private method"),Ue);var Ru=(de,Se,Ue,Es)=>({set _(Ri){tt(de,Se,Ri,Ue)},get _(){return f(de,Se,Es)}});var Jn,Qn,to,cs,Fl,As,Ye,ql,Hl,zl,Ul,Wt,Vl,Mi,Ts,Rs,Ii,Ms,Ni,eo,Oi,ji,lr,Mu,Iu,Ff,Nu,Ou,ju,qf,$u,ri,$i,ro,so,io,no,kt,Sr,Li,Wl,oo,Ot,us,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,si,Br,wo,zi,xo,eh,ve,$r,Fr,_o,kr,Ui,qr,So,ou,ko,au,Co,Eo,Vi,Wi,Ao,Ne,Cr,Er,Is,Ns,Hr,Ar,Os,js,To,Ro,Mo,lu,Io,rh,No,Xi,Yi,Gi,ii,Ki,sh,ce,ni,Lr,Zi,Oo,ih,nh,Ji,De,nr,jo,$s,oi,Qi,oh,ah,lh,hh,hu,$o,Be,Ls,ai,tn,ch,Lo,uh,Po,en,cu,dh,fh,rn,Do,sn,li,nn,Gr,ph,Bo,mh,Fo,gh,zr,qo,bh,yh,vh,Kr,Ho,ds,Ve,Dt,Pe,Tr,hi,Ps,on,zo,an,Uo,Vo,wh,Wo,Xo,ln,hn,Yo,Go,Ko,Oe,Zo,cn,fs,ci,un,Jo,uu,du,xh,Qo,hr,ta,_h,Sh,dn,ps,Ur,ms,kh,ea,fn,Ch,Ds,pn,Eh,Ah,Th,Rh,Mh,Ih,ra,mn,Nh,sa,Zr,Oh,Jr,ui,jh,Ke,gs,Vr,Bs,gn,Qr,$h,ke,di,bn,yn,vn,ts,fi,es,rs,Lt,ia,Lh,Fe,na,oa,Rr,aa,We,rr,Fs,Ph,wn,Dh,pi,la,qs,Pr,Hs,mi,Bh,Fh,xn,qh,sr,cr,gi,Hh,He,ha,ca,ua,bs,da,fa,pa,ma,or,gr,bi,zh,Uh,ga,ba,Vh,fr,ss,ya,br,zs,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,ys,ae,Wr,Xr,Us,tc,Ca,ec,Ea,rc,Aa,Ta,En,Xe,os,Ra,Ma,Ia,sc,ic,Gt,nc,Na,Oa,vs,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,Vs,Ws,Je,Xs,gc,Ya,Tn,Ga,Mr,Ka,Za,bc,yc,vc,wc,Ja,_i,Qa,Rn,as,tl,el,xc,ws,_c,rl,Sc,ls,kc,sl,Cc,il,Ys,Gs,xs,Ec,nl,Mn,ol,al,In,ll,hl,Ks,cl,Nn,_s,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,Ss,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,Zs,xu,_u,Xc,Yc,Gc,ks,Kc,Il,Vn,Nl,Ol,Wn,jl;class Es 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,Es)=>(bu(de,Se,"write to private field"),Es?Es.call(de,Ue):Se.set(de,Ue),Ue),er=(de,Se,Ue)=>(bu(de,Se,"access private method"),Ue);var Ru=(de,Se,Ue,Es)=>({set _(Ri){tt(de,Se,Ri,Ue)},get _(){return f(de,Se,Es)}});var Jn,Qn,to,cs,Fl,As,Ye,ql,Hl,zl,Ul,Wt,Vl,Mi,Ts,Rs,Ii,Ms,Ni,eo,Oi,ji,lr,Mu,Iu,Ff,Nu,Ou,ju,qf,$u,ri,$i,ro,so,io,no,kt,Sr,Li,Wl,oo,Ot,us,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,si,Br,wo,zi,xo,eh,ve,$r,Fr,_o,kr,Ui,qr,So,ou,ko,au,Co,Eo,Vi,Wi,Ao,Ne,Cr,Er,Is,Ns,Hr,Ar,Os,js,To,Ro,Mo,lu,Io,rh,No,Xi,Yi,Gi,ii,Ki,sh,ce,ni,Lr,Zi,Oo,ih,nh,Ji,De,nr,jo,$s,oi,Qi,oh,ah,lh,hh,hu,$o,Be,Ls,ai,tn,ch,Lo,uh,Po,en,cu,dh,fh,rn,Do,sn,li,nn,Kr,ph,Bo,mh,Fo,gh,zr,qo,bh,yh,vh,Zr,Ho,ds,Ve,Dt,Pe,Tr,hi,Ps,on,zo,an,Uo,Vo,wh,Wo,Xo,ln,hn,Yo,Go,Ko,Oe,Zo,cn,fs,ci,un,Jo,uu,du,xh,Qo,hr,ta,_h,Sh,dn,ps,Ur,ms,kh,ea,fn,Ch,Ds,pn,Eh,Ah,Th,Rh,Mh,Ih,ra,mn,Nh,sa,Jr,Oh,Qr,ui,jh,Ke,gs,Vr,Bs,gn,ts,$h,ke,di,bn,yn,vn,es,fi,rs,ss,Lt,ia,Lh,Fe,na,oa,Rr,aa,We,rr,Fs,Ph,wn,Dh,pi,la,qs,Pr,Hs,mi,Bh,Fh,xn,qh,sr,cr,gi,Hh,He,ha,ca,ua,bs,da,fa,pa,ma,or,gr,bi,zh,Uh,ga,ba,Vh,fr,is,ya,br,zs,yi,fu,ns,Wh,Xh,Yh,va,wa,xa,Gh,Kh,Le,pr,qt,os,ge,yr,vr,Sn,Zh,Jh,_a,Qh,Sa,ka,kn,Cn,Ze,ys,ae,Wr,Xr,Us,tc,Ca,ec,Ea,rc,Aa,Ta,En,Xe,as,Ra,Ma,Ia,sc,ic,Gt,nc,Na,Oa,vs,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,Vs,Ws,Je,Xs,gc,Ya,Tn,Ga,Mr,Ka,Za,bc,yc,vc,wc,Ja,_i,Qa,Rn,ls,tl,el,xc,ws,_c,rl,Sc,hs,kc,sl,Cc,il,Ys,Gs,xs,Ec,nl,Mn,ol,al,In,ll,hl,Ks,cl,Nn,_s,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,Ss,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,Zs,xu,_u,Xc,Yc,Gc,ks,Kc,Il,Vn,Nl,Ol,Wn,jl;class Es 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">
@@ -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,Ls=new WeakMap,ai=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,li);Y(this,nn);Y(this,Gr);it(this,"openMenu",(C,t)=>{var l=$(f(this,Gr)).css("font"),c=150;for(const o of f(this,sn))c=Math.max(c,H.measureTextSize(o.name,l).width+60);$(f(this,Gr)).css({width:c,top:t,left:C}),f(this,Gr).open(),f(this,li)&&f(this,li).show&&f(this,li).show.call(this,{source:f(this,Do)})});Y(this,ph,C=>{tt(this,sn,f(this,Bo).call(this,C.items,0)),tt(this,li,C.events),tt(this,Gr,$(`<ng-context-menu-panel id="${C.id}"></ng-context-menu-panel>`)[0]),$(f(this,rn).shadowRoot).append($(f(this,Gr)).hide()),f(this,Gr).init(f(this,sn)),$("li",f(this,Gr)).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,li=new WeakMap,nn=new WeakMap,Gr=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,zr);Y(this,qo,()=>{$(".ng-table tbody",f(this,zr).shadowRoot).on("click","th,td",f(this,bh)),$(".ng-table thead",f(this,zr).shadowRoot).on("click","th,td",f(this,yh)),$(".ng-table tfoot",f(this,zr).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,zr).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,zr).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,zr).dispatchEvent(o)});tt(this,zr,C),f(this,qo).call(this),f(this,zr).addEventListener(H.EVENT.LAYOUT_CHANGED,t=>{f(this,qo).call(this)})}}zr=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 hs=new od;class ad{constructor(C){Y(this,Kr);Y(this,Ho);Y(this,ds);it(this,"count",()=>f(this,Kr).rawRecords.length);it(this,"has",C=>f(this,Kr).data.filter(C).length>0);it(this,"first",C=>(f(this,Kr).data.first(C).__ng||{rowidx:-1}).rowidx);it(this,"last",C=>(f(this,Kr).data.last(C).__ng||{rowidx:-1}).rowidx);tt(this,Kr,C),tt(this,Ho,-1),tt(this,ds,-1)}get at(){return f(this,ds)}set at(C){tt(this,Ho,f(this,ds)),tt(this,ds,parseInt(C)),f(this,Kr).owner.body.querySelector(`tbody.bindable tr[data-row="${f(this,ds)}"]`)||setTimeout(()=>{f(this,Kr).owner.scrollTo_V1(f(this,ds))})}}Kr=new WeakMap,Ho=new WeakMap,ds=new WeakMap;class ld{constructor(C,t){Y(this,Ve);Y(this,Dt);Y(this,Pe);Y(this,Tr);Y(this,hi);Y(this,Ps);it(this,"initialize",()=>{tt(this,Ps,[]),$(f(this,Ve).template).each((C,t)=>{f(this,Ps).push($(t).height())}),(f(this,Dt).rawRecords||[]).forEach(C=>{C.__ng.height=f(this,Ps).slice()})});it(this,"set",C=>{hs.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,hi,Math.max(f(this,hi),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,hi,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),hs.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,hi)._}get default(){return{rowState:H.ROW_STATE.EMPTY,deleted:!1,filtered:!1,pin:!1,expand:!0,visible:!0,paging:!0,height:f(this,Ps).slice(),o:{},c:{},_:[0,0,0,0,H.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,f(this,Ps).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,hi=new WeakMap,Ps=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=>{hs.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,Ls=new WeakMap,ai=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,li);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,li)&&f(this,li).show&&f(this,li).show.call(this,{source:f(this,Do)})});Y(this,ph,C=>{tt(this,sn,f(this,Bo).call(this,C.items,0)),tt(this,li,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,li=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,zr);Y(this,qo,()=>{$(".ng-table tbody",f(this,zr).shadowRoot).on("click","th,td",f(this,bh)),$(".ng-table thead",f(this,zr).shadowRoot).on("click","th,td",f(this,yh)),$(".ng-table tfoot",f(this,zr).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,zr).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,zr).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,zr).dispatchEvent(o)});tt(this,zr,C),f(this,qo).call(this),f(this,zr).addEventListener(H.EVENT.LAYOUT_CHANGED,t=>{f(this,qo).call(this)})}}zr=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 Gr=new od;class ad{constructor(C){Y(this,Zr);Y(this,Ho);Y(this,ds);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,ds,-1)}get at(){return f(this,ds)}set at(C){tt(this,Ho,f(this,ds)),tt(this,ds,parseInt(C)),f(this,Zr).owner.body.querySelector(`tbody.bindable tr[data-row="${f(this,ds)}"]`)||setTimeout(()=>{f(this,Zr).owner.scrollTo_V1(f(this,ds))})}}Zr=new WeakMap,Ho=new WeakMap,ds=new WeakMap;class ld{constructor(C,t){Y(this,Ve);Y(this,Dt);Y(this,Pe);Y(this,Tr);Y(this,hi);Y(this,Ps);it(this,"initialize",()=>{tt(this,Ps,[]),$(f(this,Ve).template).each((C,t)=>{f(this,Ps).push($(t).height())}),(f(this,Dt).rawRecords||[]).forEach(C=>{C.__ng.height=f(this,Ps).slice()})});it(this,"set",C=>{Gr.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,hi,Math.max(f(this,hi),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,hi,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),Gr.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,hi)._}get default(){return{rowState:H.ROW_STATE.EMPTY,deleted:!1,filtered:!1,pin:!1,expand:!0,visible:!0,paging:!0,height:f(this,Ps).slice(),o:{},c:{},_:[0,0,0,0,H.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,f(this,Ps).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,hi=new WeakMap,Ps=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=>{Gr.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>
@@ -458,7 +458,7 @@ use chrome, FireFox or Internet Explorer 11`)}var s=t("safe-buffer"),e=t("random
458
458
  <div class="panel">
459
459
  ${t}
460
460
  </div>
461
- `,tt(this,ra,this.getRootNode().host),tt(this,mn,this.closest("th,td")),$("svg.icon",this.shadowRoot).on("click",l=>{l.preventDefault(),l.stopPropagation(),$("div.panel",this.shadowRoot).is(":visible")?f(this,sa).call(this):(f(this,sa).call(this),f(this,Nh).call(this))}),$(this).on("click",l=>{l.stopPropagation()})}}ra=new WeakMap,mn=new WeakMap,Nh=new WeakMap,sa=new WeakMap,customElements.get("ng-info")||customElements.define("ng-info",Id);class Nd extends ei{constructor(){super();Y(this,Zr);it(this,"dataRefresh",t=>{f(this,Oh).call(this,this.value)?(f(this,Zr).value=H.nvl(this.value,"#ffffff"),H.j.querySelectorAll(this).removeClass("invalid")):(f(this,Zr).value="#ffffff",H.j.querySelectorAll(this).addClass("invalid")),f(this,Zr).setAttribute("title",this.value),t||this.reset()});Y(this,Oh,t=>{if(H.isNull(t))return!0;if(typeof t!="string"||t.length!=7||!t.startsWith("#"))return!1;var l=parseInt(t.substr(1,2),16),c=parseInt(t.substr(3,2),16),o=parseInt(t.substr(5,2),16);return!(l<0||l>255||c<0||c>255||o<0||o>255)})}connectedCallback(){this.shadowRoot.innerHTML=`
461
+ `,tt(this,ra,this.getRootNode().host),tt(this,mn,this.closest("th,td")),$("svg.icon",this.shadowRoot).on("click",l=>{l.preventDefault(),l.stopPropagation(),$("div.panel",this.shadowRoot).is(":visible")?f(this,sa).call(this):(f(this,sa).call(this),f(this,Nh).call(this))}),$(this).on("click",l=>{l.stopPropagation()})}}ra=new WeakMap,mn=new WeakMap,Nh=new WeakMap,sa=new WeakMap,customElements.get("ng-info")||customElements.define("ng-info",Id);class Nd extends ei{constructor(){super();Y(this,Jr);it(this,"dataRefresh",t=>{f(this,Oh).call(this,this.value)?(f(this,Jr).value=H.nvl(this.value,"#ffffff"),H.j.querySelectorAll(this).removeClass("invalid")):(f(this,Jr).value="#ffffff",H.j.querySelectorAll(this).addClass("invalid")),f(this,Jr).setAttribute("title",this.value),t||this.reset()});Y(this,Oh,t=>{if(H.isNull(t))return!0;if(typeof t!="string"||t.length!=7||!t.startsWith("#"))return!1;var l=parseInt(t.substr(1,2),16),c=parseInt(t.substr(3,2),16),o=parseInt(t.substr(5,2),16);return!(l<0||l>255||c<0||c>255||o<0||o>255)})}connectedCallback(){this.shadowRoot.innerHTML=`
462
462
  <style>
463
463
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngInputColor.css";
464
464
  ${H.getCustomPath(this,"ngInputColor.css")}
@@ -466,7 +466,7 @@ use chrome, FireFox or Internet Explorer 11`)}var s=t("safe-buffer"),e=t("random
466
466
 
467
467
  <input type="color" required />
468
468
  <button tabindex="-1"></button>
469
- `,super.connectedCallback(),tt(this,Zr,this.shadowRoot.querySelector("input")),$("button",this.shadowRoot).on("click",t=>{$("input",this.shadowRoot).trigger("click")}),$(this.cell).on("keydown",t=>{switch(t.target.tagName){case"TH":case"TD":["Enter"].includes(t.code)&&$(f(this,Zr)).trigger("click");break}}),f(this,Zr).addEventListener("keydown",t=>{["Enter"].includes(t.code)?$(f(this,Zr)).trigger("click"):["Escape"].includes(t.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(t))})}}Zr=new WeakMap,Oh=new WeakMap,customElements.get("ng-input-color")||customElements.define("ng-input-color",Nd);class Od extends ei{constructor(){super();Y(this,Jr);Y(this,ui);it(this,"dataRefresh",t=>{var l=this.value;switch(f(this,Jr).type){case"date":l=l.substr(0,10);break;case"datetime-local":l=l.substr(0,16);break;case"time":var c=new Date(l);c!="Invalid Date"&&(l=("00"+c.getHours()).slice(-2)+":"+("00"+c.getMinutes()).slice(-2));break;case"month":var c=new Date(l);c!="Invalid Date"&&(l=("0000"+c.getFullYear()).slice(-4)+"-"+("00"+(c.getMonth()+1)).slice(-2));break}f(this,Jr).value=l,f(this,jh).call(this,l)?H.j.querySelectorAll(this).removeClass("invalid"):H.j.querySelectorAll(this).addClass("invalid"),t||this.reset()});Y(this,jh,t=>{if(H.isNull(t))return!0;if(typeof t!="string")return!1;var l=!0;switch(f(this,Jr).type){case"date":case"datetime-local":var c=Number(t.substr(0,4)),o=Number(t.substr(5,2)),r=Number(t.substr(8,2));if(isNaN(c)||isNaN(o)||isNaN(r))l=!1;else if(o<1||o>12||r<1||r>31)l=!1;else if([4,6,9,11].includes(o)&&r==31)l=!1;else if(o==2){var n=c%4==0&&(c%100!=0||c%400==0);(r>29||r==29&&!n)&&(l=!1)}break}if(l)switch(f(this,Jr).type){case"datetime-local":var s=t.substr(10,1),e=Number(t.substr(11,2)),i=Number(t.substr(14,2));(s!="T"||isNaN(e)||isNaN(i)||e<0||e>23||i<0||i>59)&&(l=!1);break;case"month":var c=Number(t.substr(0,4)),o=Number(t.substr(5,2));(isNaN(c)||isNaN(o)||o<1||o>12)&&(l=!1);break;case"week":var c=Number(t.substr(0,4)),u=t.substr(5,1),a=Number(t.substr(6,2));(u!="W"||isNaN(c)||isNaN(a)||a<=0||a>53)&&(l=!1);break}return l});if(tt(this,ui,this.getAttribute("type")||"date"),!["date","datetime-local","time","week","month"].includes(f(this,ui)))throw`invalid type : ${f(this,ui)}`}connectedCallback(){const t=parseInt(this.closest("tr").style.height,10)-1;for(var l=[],c=0;c<this.attributes.length;c++)["value","max","min","step"].includes(this.attributes[c].name)&&l.push(`${this.attributes[c].name}="${this.attributes[c].value}"`);this.shadowRoot.innerHTML=`
469
+ `,super.connectedCallback(),tt(this,Jr,this.shadowRoot.querySelector("input")),$("button",this.shadowRoot).on("click",t=>{$("input",this.shadowRoot).trigger("click")}),$(this.cell).on("keydown",t=>{switch(t.target.tagName){case"TH":case"TD":["Enter"].includes(t.code)&&$(f(this,Jr)).trigger("click");break}}),f(this,Jr).addEventListener("keydown",t=>{["Enter"].includes(t.code)?$(f(this,Jr)).trigger("click"):["Escape"].includes(t.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(t))})}}Jr=new WeakMap,Oh=new WeakMap,customElements.get("ng-input-color")||customElements.define("ng-input-color",Nd);class Od extends ei{constructor(){super();Y(this,Qr);Y(this,ui);it(this,"dataRefresh",t=>{var l=this.value;switch(f(this,Qr).type){case"date":l=l.substr(0,10);break;case"datetime-local":l=l.substr(0,16);break;case"time":var c=new Date(l);c!="Invalid Date"&&(l=("00"+c.getHours()).slice(-2)+":"+("00"+c.getMinutes()).slice(-2));break;case"month":var c=new Date(l);c!="Invalid Date"&&(l=("0000"+c.getFullYear()).slice(-4)+"-"+("00"+(c.getMonth()+1)).slice(-2));break}f(this,Qr).value=l,f(this,jh).call(this,l)?H.j.querySelectorAll(this).removeClass("invalid"):H.j.querySelectorAll(this).addClass("invalid"),t||this.reset()});Y(this,jh,t=>{if(H.isNull(t))return!0;if(typeof t!="string")return!1;var l=!0;switch(f(this,Qr).type){case"date":case"datetime-local":var c=Number(t.substr(0,4)),o=Number(t.substr(5,2)),r=Number(t.substr(8,2));if(isNaN(c)||isNaN(o)||isNaN(r))l=!1;else if(o<1||o>12||r<1||r>31)l=!1;else if([4,6,9,11].includes(o)&&r==31)l=!1;else if(o==2){var n=c%4==0&&(c%100!=0||c%400==0);(r>29||r==29&&!n)&&(l=!1)}break}if(l)switch(f(this,Qr).type){case"datetime-local":var s=t.substr(10,1),e=Number(t.substr(11,2)),i=Number(t.substr(14,2));(s!="T"||isNaN(e)||isNaN(i)||e<0||e>23||i<0||i>59)&&(l=!1);break;case"month":var c=Number(t.substr(0,4)),o=Number(t.substr(5,2));(isNaN(c)||isNaN(o)||o<1||o>12)&&(l=!1);break;case"week":var c=Number(t.substr(0,4)),u=t.substr(5,1),a=Number(t.substr(6,2));(u!="W"||isNaN(c)||isNaN(a)||a<=0||a>53)&&(l=!1);break}return l});if(tt(this,ui,this.getAttribute("type")||"date"),!["date","datetime-local","time","week","month"].includes(f(this,ui)))throw`invalid type : ${f(this,ui)}`}connectedCallback(){const t=parseInt(this.closest("tr").style.height,10)-1;for(var l=[],c=0;c<this.attributes.length;c++)["value","max","min","step"].includes(this.attributes[c].name)&&l.push(`${this.attributes[c].name}="${this.attributes[c].value}"`);this.shadowRoot.innerHTML=`
470
470
  <style>
471
471
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngInputDate.css";
472
472
  ${H.getCustomPath(this,"ngInputDate.css")}
@@ -489,7 +489,7 @@ use chrome, FireFox or Internet Explorer 11`)}var s=t("safe-buffer"),e=t("random
489
489
  ${l.join(" ")}
490
490
  required
491
491
  />
492
- `,super.connectedCallback(),tt(this,Jr,this.shadowRoot.querySelector("input")),$(this.cell).on("keydown",o=>{switch(o.target.tagName){case"TH":case"TD":["Enter"].includes(o.code)&&f(this,Jr).focus();break}}),f(this,Jr).addEventListener("keydown",o=>{["Enter","Escape"].includes(o.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown"].includes(o.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(o))})}}Jr=new WeakMap,ui=new WeakMap,jh=new WeakMap,customElements.get("ng-input-date")||customElements.define("ng-input-date",Od);class jd extends ei{constructor(){super();Y(this,Ke);Y(this,gs);Y(this,Vr);Y(this,Bs);Y(this,gn);Y(this,Qr);it(this,"dataRefresh",t=>{f(this,Ke).value=this.value,H.j.querySelectorAll(f(this,Ke)).removeClass("invalid"),f(this,gs)=="number"&&(isNaN(this.value)||f(this,gn)&&Number(f(this,Ke).value)>Number(f(this,gn))||f(this,Bs)&&Number(f(this,Ke).value)<Number(f(this,Bs))?H.j.querySelectorAll(f(this,Ke)).addClass("invalid"):f(this,Qr)&&f(this,Ke).value.indexOf(".")>=0&&f(this,Ke).value.substring(f(this,Ke).value.indexOf(".")+1).length>Number(f(this,Qr))&&H.j.querySelectorAll(f(this,Ke)).addClass("invalid")),f(this,Vr)&&H.getByteLength(this.value)>Number(f(this,Vr))&&H.j.querySelectorAll(f(this,Ke)).addClass("invalid"),t||this.reset()});Y(this,$h,t=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(t.code)){if(f(this,gs)=="number"){let o=[];if(f(this,Qr)&&Number(f(this,Qr))>0&&o.push("."),f(this,Bs)&&Number(f(this,Bs))>=0&&o.push("-"),!(t.keyCode>=48&&t.keyCode<=57||t.keyCode>=96&&t.keyCode<=105)&&!o.includes(t.key)&&t.preventDefault(),f(this,Qr)&&(t.keyCode>=48&&t.keyCode<=57||t.keyCode>=96&&t.keyCode<=105)&&t.target.selectionStart==t.target.selectionEnd){var l=t.target.value,c=l.indexOf(".");if(c>=0){var l=l.substr(c+1,l.length);l.length>=Number(f(this,Qr))&&t.preventDefault()}}}f(this,Vr)&&H.getByteLength(t.target.value)>=Number(f(this,Vr))&&t.target.selectionStart==t.target.selectionEnd&&t.preventDefault()}});if(tt(this,gs,this.getAttribute("type")||"text"),tt(this,Vr,this.getAttribute("maxbyte")),tt(this,Bs,this.getAttribute("min")),tt(this,gn,this.getAttribute("max")),tt(this,Qr,this.getAttribute("scale")),!["text","number"].includes(f(this,gs)))throw`invalid type : ${f(this,gs)}`}connectedCallback(){for(var t=[],l=0;l<this.attributes.length;l++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[l].name)&&t.push(`${this.attributes[l].name}="${this.attributes[l].value}"`);this.shadowRoot.innerHTML=`
492
+ `,super.connectedCallback(),tt(this,Qr,this.shadowRoot.querySelector("input")),$(this.cell).on("keydown",o=>{switch(o.target.tagName){case"TH":case"TD":["Enter"].includes(o.code)&&f(this,Qr).focus();break}}),f(this,Qr).addEventListener("keydown",o=>{["Enter","Escape"].includes(o.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown"].includes(o.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(o))})}}Qr=new WeakMap,ui=new WeakMap,jh=new WeakMap,customElements.get("ng-input-date")||customElements.define("ng-input-date",Od);class jd extends ei{constructor(){super();Y(this,Ke);Y(this,gs);Y(this,Vr);Y(this,Bs);Y(this,gn);Y(this,ts);it(this,"dataRefresh",t=>{f(this,Ke).value=this.value,H.j.querySelectorAll(f(this,Ke)).removeClass("invalid"),f(this,gs)=="number"&&(isNaN(this.value)||f(this,gn)&&Number(f(this,Ke).value)>Number(f(this,gn))||f(this,Bs)&&Number(f(this,Ke).value)<Number(f(this,Bs))?H.j.querySelectorAll(f(this,Ke)).addClass("invalid"):f(this,ts)&&f(this,Ke).value.indexOf(".")>=0&&f(this,Ke).value.substring(f(this,Ke).value.indexOf(".")+1).length>Number(f(this,ts))&&H.j.querySelectorAll(f(this,Ke)).addClass("invalid")),f(this,Vr)&&H.getByteLength(this.value)>Number(f(this,Vr))&&H.j.querySelectorAll(f(this,Ke)).addClass("invalid"),t||this.reset()});Y(this,$h,t=>{if(!["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(t.code)){if(f(this,gs)=="number"){let o=[];if(f(this,ts)&&Number(f(this,ts))>0&&o.push("."),f(this,Bs)&&Number(f(this,Bs))>=0&&o.push("-"),!(t.keyCode>=48&&t.keyCode<=57||t.keyCode>=96&&t.keyCode<=105)&&!o.includes(t.key)&&t.preventDefault(),f(this,ts)&&(t.keyCode>=48&&t.keyCode<=57||t.keyCode>=96&&t.keyCode<=105)&&t.target.selectionStart==t.target.selectionEnd){var l=t.target.value,c=l.indexOf(".");if(c>=0){var l=l.substr(c+1,l.length);l.length>=Number(f(this,ts))&&t.preventDefault()}}}f(this,Vr)&&H.getByteLength(t.target.value)>=Number(f(this,Vr))&&t.target.selectionStart==t.target.selectionEnd&&t.preventDefault()}});if(tt(this,gs,this.getAttribute("type")||"text"),tt(this,Vr,this.getAttribute("maxbyte")),tt(this,Bs,this.getAttribute("min")),tt(this,gn,this.getAttribute("max")),tt(this,ts,this.getAttribute("scale")),!["text","number"].includes(f(this,gs)))throw`invalid type : ${f(this,gs)}`}connectedCallback(){for(var t=[],l=0;l<this.attributes.length;l++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[l].name)&&t.push(`${this.attributes[l].name}="${this.attributes[l].value}"`);this.shadowRoot.innerHTML=`
493
493
  <style>
494
494
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngInputText.css";
495
495
  ${H.getCustomPath(this,"ngInputText.css")}
@@ -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,Vr)&&H.getByteLength(c.target.value)>=Number(f(this,Vr))&&(c.target.value=H.cut(c.target.value,Number(f(this,Vr))),this.value=c.target.value)}),f(this,Ke).addEventListener("compositionupdate",c=>{f(this,gs)=="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,gs=new WeakMap,Vr=new WeakMap,Bs=new WeakMap,gn=new WeakMap,Qr=new WeakMap,$h=new WeakMap,customElements.get("ng-input")||customElements.define("ng-input",jd);class $d{constructor(C){Y(this,ke);Y(this,di);Y(this,bn);Y(this,yn);Y(this,vn);Y(this,ts,[]);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,di,-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,ts,[0])}get row(){return f(this,di)}set row(C){tt(this,di,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,di))}updateCumulativeHeights(){hs.log("====================="),hs.log(f(this,ke).data),tt(this,ts,[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,ts).push(C)}console.log(f(this,ts))}getRowInfoAt(C){let t=0,l=f(this,ts).length-2,c=0;for(;t<=l;){let o=Math.floor((t+l)/2);f(this,ts)[o]<=C?(c=o,t=o+1):l=o-1}return{index:c,offset:C-f(this,ts)[c]}}}ke=new WeakMap,di=new WeakMap,bn=new WeakMap,yn=new WeakMap,vn=new WeakMap,ts=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,Vr)&&H.getByteLength(c.target.value)>=Number(f(this,Vr))&&(c.target.value=H.cut(c.target.value,Number(f(this,Vr))),this.value=c.target.value)}),f(this,Ke).addEventListener("compositionupdate",c=>{f(this,gs)=="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,gs=new WeakMap,Vr=new WeakMap,Bs=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,di);Y(this,bn);Y(this,yn);Y(this,vn);Y(this,es,[]);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,di,-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,es,[0])}get row(){return f(this,di)}set row(C){tt(this,di,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,di))}updateCumulativeHeights(){Gr.log("***********************====================="),Gr.log(f(this,ke).data),tt(this,es,[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,es).push(C)}Gr.log(f(this,es))}getRowInfoAt(C){let t=0,l=f(this,es).length-2,c=0;for(;t<=l;){let o=Math.floor((t+l)/2);f(this,es)[o]<=C?(c=o,t=o+1):l=o-1}return{index:c,offset:C-f(this,es)[c]}}}ke=new WeakMap,di=new WeakMap,bn=new WeakMap,yn=new WeakMap,vn=new WeakMap,es=new WeakMap,fi=new WeakMap;class Ld extends HTMLElement{constructor(){super();Y(this,rs);Y(this,ss);it(this,"popup",()=>{setTimeout(()=>{f(this,ss).data.assign(f(this,rs).data.get()),this.shadowRoot.querySelector("dialog").showModal()},100)});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,rs,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 {
@@ -511,10 +511,10 @@ use chrome, FireFox or Internet Explorer 11`)}var s=t("safe-buffer"),e=t("random
511
511
  </style>
512
512
 
513
513
  <nx-dialog>
514
- ${f(this,es).originFormat}
514
+ ${f(this,rs).originFormat}
515
515
  </nx-dialog>
516
- `,tt(this,rs,this.shadowRoot.querySelector("nine-grid")),f(this,rs).removeAttribute("display-row-count"),$(".reset",this.shadowRoot).on("click",t=>{f(this,rs).data.assign(f(this,es).data.get())}),$(".apply",this.shadowRoot).on("click",t=>{var l=f(this,rs).data.getChangedData();f(this,es).data.add(l.insert);for(var c of l.update)f(this,es).data.update(c);for(var c of l.delete)f(this,es).data.delete(c);f(this,rs).data.changeRowState()}),this.shadowRoot.addEventListener("click",t=>{f(this,rs).data.isChanged()&&(t.stopImmediatePropagation(),H.confirm(`There is changed data.
517
- Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"}).then(l=>{l&&$(".apply",this.shadowRoot).trigger("click"),this.shadowRoot.querySelector("nx-dialog").close()}))})}}es=new WeakMap,rs=new WeakMap,customElements.get("ng-max-popup")||customElements.define("ng-max-popup",Ld);class Pd extends HTMLElement{constructor(){super();Y(this,Lt);Y(this,ia);Y(this,Lh);tt(this,ia,new Md(f(this,Lt))),tt(this,Lh,new ku(f(this,Lt)))}connectedCallback(){tt(this,Lt,this.getRootNode().host.getRootNode().host),this.innerHTML="";var t=new sd({owner:f(this,Lt),items:{filtering:{name:"Filtering",className:"ng-menu-filtering"},maximize:{name:"Maximize",className:"maximize"},export:{name:"export",items:{"export-excel":{name:"Excel",className:"export-excel"},"export-pdf":{name:"Pdf",className:"export-pdf",disabled:function(l,c){return!0}}}},import:{name:"import",className:"import",disabled:function(l,c){return!0}},properties:{name:"options",items:{"show-title-bar":{name:"title bar show/hide",className:"show-title-bar"},"show-menu-icon":{name:"menu icon show/hide",className:"show-menu-icon"},"show-status-bar":{name:"status bar show/hide",className:"show-status-bar"},"show-tfoot":{name:"table footer show/hide",className:"show-tfoot",disabled:function(l,c){return!($(".ng-table tfoot",this.getRootNode().host).length>0)}},"select-type":{name:"select type",items:{[`select-type-${H.SELECTTYPE.ROW}`]:{name:"row",className:`select-type select-type-${H.SELECTTYPE.ROW}`},[`select-type-${H.SELECTTYPE.ROWS}`]:{name:"multi row",className:`select-type select-type-${H.SELECTTYPE.ROWS}`},[`select-type-${H.SELECTTYPE.COL}`]:{name:"column",className:`select-type select-type-${H.SELECTTYPE.COL}`},[`select-type-${H.SELECTTYPE.COLS}`]:{name:"multi column",className:`select-type select-type-${H.SELECTTYPE.COLS}`},[`select-type-${H.SELECTTYPE.CELL}`]:{name:"cell",className:`select-type select-type-${H.SELECTTYPE.CELL}`},[`select-type-${H.SELECTTYPE.AREA}`]:{name:"area",className:`select-type select-type-${H.SELECTTYPE.AREA}`},[`select-type-${H.SELECTTYPE.NONE}`]:{name:"none",className:`select-type select-type-${H.SELECTTYPE.NONE}`}}},"paging-type":{name:"paging type",items:{[`paging-type-${H.PAGINGTYPE.NONE}`]:{name:"none",className:`paging-type paging-type-${H.PAGINGTYPE.NONE}`},[`paging-type-${H.PAGINGTYPE.CLIENT}`]:{name:"client",className:`paging-type paging-type-${H.PAGINGTYPE.CLIENT}`},[`paging-type-${H.PAGINGTYPE.SERVER}`]:{name:"server",className:`paging-type paging-type-${H.PAGINGTYPE.SERVER}`},"paging-count":{name:"entries per page",items:{[`paging-count-${H.PAGINGCOUNT.AUTO}`]:{name:"auto",className:`paging-count paging-count-${H.PAGINGCOUNT.AUTO}`},[`paging-count-${H.PAGINGCOUNT.NUM_1}`]:{name:"1",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_1}`},[`paging-count-${H.PAGINGCOUNT.NUM_5}`]:{name:"5",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_5}`},[`paging-count-${H.PAGINGCOUNT.NUM_10}`]:{name:"10",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_10}`},[`paging-count-${H.PAGINGCOUNT.NUM_20}`]:{name:"20",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_20}`},[`paging-count-${H.PAGINGCOUNT.NUM_30}`]:{name:"30",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_30}`},[`paging-count-${H.PAGINGCOUNT.NUM_50}`]:{name:"50",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_50}`},[`paging-count-${H.PAGINGCOUNT.NUM_100}`]:{name:"100",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_100}`},[`paging-count-${H.PAGINGCOUNT.NUM_1000}`]:{name:"1000",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_1000}`},[`paging-count-${H.PAGINGCOUNT.NUM_10000}`]:{name:"10000",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_10000}`}}}}},"auto-fit-col":{name:"auto fit columns",className:"auto-fit-col"}}}},callback:l=>{switch(l.menuId){case"maximize":$("ng-max-popup",f(this,Lt).shadowRoot).remove(),$(f(this,Lt).shadowRoot).append($("<ng-max-popup></ng-max-popup>")),f(this,Lt).shadowRoot.querySelector("ng-max-popup").popup();break;case"import":f(this,ia).importExcel();break;case"export-excel":f(this,Lt).export();break;case"export-pdf":$("ng-export",f(this,Lt).shadowRoot).remove(),$(f(this,Lt).shadowRoot).append($("<ng-export></ng-export>")),f(this,Lt).shadowRoot.querySelector("ng-export").exportPdf();break;case"detail":break;case"filtering":f(this,Lt).filtering.isFiltering()?f(this,Lt).filtering.off():f(this,Lt).filtering.on();break;case`select-type-${H.SELECTTYPE.ROW}`:case`select-type-${H.SELECTTYPE.ROWS}`:case`select-type-${H.SELECTTYPE.COL}`:case`select-type-${H.SELECTTYPE.COLS}`:case`select-type-${H.SELECTTYPE.CELL}`:case`select-type-${H.SELECTTYPE.AREA}`:case`select-type-${H.SELECTTYPE.NONE}`:f(this,Lt).setAttribute("select-type",l.menuId.replace("select-type-",""));break;case"show-title-bar":f(this,Lt).setAttribute("show-title-bar",f(this,Lt).getAttribute("show-title-bar")=="true"?"false":"true");break;case"show-menu-icon":f(this,Lt).setAttribute("show-menu-icon",f(this,Lt).getAttribute("show-menu-icon")=="true"?"false":"true");break;case"show-status-bar":f(this,Lt).setAttribute("show-status-bar",f(this,Lt).getAttribute("show-status-bar")=="true"?"false":"true");break;case`paging-type-${H.PAGINGTYPE.NONE}`:case`paging-type-${H.PAGINGTYPE.CLIENT}`:case`paging-type-${H.PAGINGTYPE.SERVER}`:f(this,Lt).setAttribute("paging-type",l.menuId.replace("paging-type-",""));break;case`paging-count-${H.PAGINGCOUNT.AUTO}`:case`paging-count-${H.PAGINGCOUNT.NUM_1}`:case`paging-count-${H.PAGINGCOUNT.NUM_5}`:case`paging-count-${H.PAGINGCOUNT.NUM_10}`:case`paging-count-${H.PAGINGCOUNT.NUM_20}`:case`paging-count-${H.PAGINGCOUNT.NUM_30}`:case`paging-count-${H.PAGINGCOUNT.NUM_50}`:case`paging-count-${H.PAGINGCOUNT.NUM_100}`:case`paging-count-${H.PAGINGCOUNT.NUM_1000}`:case`paging-count-${H.PAGINGCOUNT.NUM_10000}`:f(this,Lt).setAttribute("paging-count",l.menuId.replace("paging-count-",""));break;case"col-indicator-type":f(this,Lt).setAttribute("col-indicator-type",f(this,Lt).getAttribute("col-indicator-type")==H.COLINDICATORTYPE.EXPAND?H.COLINDICATORTYPE.COLLAPSE:H.COLINDICATORTYPE.EXPAND);break;case"auto-fit-col":f(this,Lt).setAttribute("auto-fit-col",f(this,Lt).getAttribute("auto-fit-col")=="true"?"false":"true");break;case"show-tfoot":f(this,Lt).setAttribute("show-tfoot",f(this,Lt).getAttribute("show-tfoot")=="true"?"false":"true");break;default:console.log(l.menuId)}},events:{show:l=>{H.j.querySelectorAll(f(this,Lt)).hasClass("ng-maximize")?H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("show-title-bar")=="true"?H.j.querySelectorAll("ng-context-menu-panel .show-title-bar",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .show-title-bar",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("show-menu-icon")=="true"?H.j.querySelectorAll("ng-context-menu-panel .show-menu-icon",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .show-menu-icon",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("show-status-bar")=="true"?H.j.querySelectorAll("ng-context-menu-panel .show-status-bar",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .show-status-bar",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll("ng-context-menu-panel .select-type",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll(`ng-context-menu-panel .select-type-${f(this,Lt).getAttribute("select-type")}`,f(this,Lt).shadowRoot).addClass("on"),H.j.querySelectorAll("ng-context-menu-panel .paging-type",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll(`ng-context-menu-panel .paging-type-${f(this,Lt).getAttribute("paging-type")}`,f(this,Lt).shadowRoot).addClass("on"),H.j.querySelectorAll("ng-context-menu-panel .paging-count",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll(`ng-context-menu-panel .paging-count-${f(this,Lt).getAttribute("paging-count")}`,f(this,Lt).shadowRoot).addClass("on"),f(this,Lt).filtering.isFiltering()?H.j.querySelectorAll("ng-context-menu-panel .ng-menu-filtering",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .ng-menu-filtering",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("auto-fit-col")=="true"?H.j.querySelectorAll("ng-context-menu-panel .auto-fit-col",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .auto-fit-col",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("col-indicator-type")==H.COLINDICATORTYPE.EXPAND?H.j.querySelectorAll("ng-context-menu-panel .col-indicator-type",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .col-indicator-type",f(this,Lt).shadowRoot).removeClass("on");const c=f(this,Lt).body.querySelector(".ng-table tfoot"),o=H.j.querySelectorAll("ng-context-menu-panel .show-tfoot",f(this,Lt).shadowRoot);c?(o.removeClass("disabled"),c.style.visibility=="collapse"?o.removeClass("on"):o.addClass("on")):o.addClass("disabled"),typeof ExcelJS>"u"&&H.j.querySelectorAll("ng-context-menu-panel .import,ng-context-menu-panel .export-excel",f(this,Lt).shadowRoot).addClass("disabled"),H.j.querySelectorAll("ng-context-menu-panel .import,ng-context-menu-panel .export-pdf",f(this,Lt).shadowRoot).addClass("disabled"),f(this,Lt).closest("dialog")?H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).addClass("disabled"):H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).removeClass("disabled")},hide:()=>{}}});$(f(this,Lt).shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-menu")).on("click",l=>{t.openMenu(l.offsetX,l.offsetY)})}}Lt=new WeakMap,ia=new WeakMap,Lh=new WeakMap,customElements.get("ng-menu")||customElements.define("ng-menu",Pd);class Dd extends HTMLElement{constructor(){super();Y(this,Fe);Y(this,na);Y(this,oa);Y(this,Rr);Y(this,aa);Y(this,We);Y(this,rr);Y(this,Fs);it(this,"refreshTotal",()=>{});Y(this,Ph,()=>{f(this,Fe).data.getValidDataNF().map(t=>{t.__ng.paging=!0}),f(this,Fe).data.resetRecords()});Y(this,wn,()=>{this.type==H.PAGINGTYPE.CLIENT?$("span",this).eq(1).html(`<b>Total</b> : ${f(this,Fe).data.countNF().toLocaleString()}`):this.type==H.PAGINGTYPE.SERVER?$("span",this).eq(1).html(`<b>Total</b> : ${f(this,Fs).toLocaleString()}`):this.type==H.PAGINGTYPE.NONE&&$("span",this).eq(1).html(`<b>Total</b> : ${f(this,Fs).toLocaleString()}`),f(this,rr)==0?$("span",this).eq(0).html(""):$("span",this).eq(0).html(`${f(this,We).toLocaleString()} <i>of</i> ${f(this,rr).toLocaleString()}`),H.j.querySelectorAll(".ng-paging-first",this).attr("disabled",f(this,We)==1||f(this,rr)<1),H.j.querySelectorAll(".ng-paging-prev",this).attr("disabled",f(this,We)==1||f(this,rr)<1),H.j.querySelectorAll(".ng-paging-next",this).attr("disabled",f(this,We)==f(this,rr)||f(this,rr)<1),H.j.querySelectorAll(".ng-paging-last",this).attr("disabled",f(this,We)==f(this,rr)||f(this,rr)<1)});Y(this,Dh,()=>{this.type==H.PAGINGTYPE.CLIENT?this.movePage(Math.ceil(f(this,Fe).data.countNF()/f(this,Rr))):this.type==H.PAGINGTYPE.SERVER&&this.movePage(Math.ceil(f(this,Fs)/f(this,Rr)))});it(this,"movePage",t=>{if(!(!f(this,Fe)||!f(this,Fe).data||isNaN(t))){if(this.type==H.PAGINGTYPE.SERVER&&(H.j.querySelectorAll(".ng-paging-first",this).attr("disabled",!0),H.j.querySelectorAll(".ng-paging-prev",this).attr("disabled",!0),H.j.querySelectorAll(".ng-paging-next",this).attr("disabled",!0),H.j.querySelectorAll(".ng-paging-last",this).attr("disabled",!0)),tt(this,aa,f(this,We)),tt(this,We,t),this.type==H.PAGINGTYPE.CLIENT){var l=f(this,Fe).data.getValidDataNF();if(tt(this,rr,Math.ceil(l.length/f(this,Rr))),l.length==0)tt(this,rr,0);else if(t<1||t>f(this,rr))throw`1invalid page ${t} of ${f(this,rr)}`;f(this,wn).call(this),l.map(o=>{o.__ng.paging=!1});for(var c=(f(this,We)-1)*f(this,Rr);c<Math.min(f(this,We)*f(this,Rr),f(this,Fe).data.countNF());c++)l[c].__ng.paging=!0;f(this,Fe).data.resetRecords(),f(this,Fe).scrollTo_V1(0)}this.type==H.PAGINGTYPE.SERVER&&f(this,aa)!=f(this,We)&&(this.onpagechanged.pageIndex=f(this,We),this.onpagechanged.pageCnt=f(this,Rr),f(this,Fe).dispatchEvent(this.onpagechanged))}});it(this,"reset",()=>{this.refresh()});it(this,"refresh",()=>{switch(this.type){case H.PAGINGTYPE.NONE:f(this,Ph).call(this),$(".ng-container tbody tr.bindable:not(.nodata)",f(this,Fe).body).remove(),f(this,Fe).scrollTo_V1(0);break;case H.PAGINGTYPE.CLIENT:this.movePage(1),f(this,Fe).refresh();break;case H.PAGINGTYPE.SERVER:break}f(this,wn).call(this)});tt(this,Fe,this.getRootNode().host.getRootNode().host),tt(this,We,0),tt(this,rr,0),tt(this,Fs,0),this.onpagechanged=new CustomEvent("pagechanged",{bubbles:!0,detail:{}})}connectedCallback(){this.innerHTML=`
516
+ `,tt(this,ss,this.shadowRoot.querySelector("nine-grid")),f(this,ss).removeAttribute("display-row-count"),$(".reset",this.shadowRoot).on("click",t=>{f(this,ss).data.assign(f(this,rs).data.get())}),$(".apply",this.shadowRoot).on("click",t=>{var l=f(this,ss).data.getChangedData();f(this,rs).data.add(l.insert);for(var c of l.update)f(this,rs).data.update(c);for(var c of l.delete)f(this,rs).data.delete(c);f(this,ss).data.changeRowState()}),this.shadowRoot.addEventListener("click",t=>{f(this,ss).data.isChanged()&&(t.stopImmediatePropagation(),H.confirm(`There is changed data.
517
+ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"}).then(l=>{l&&$(".apply",this.shadowRoot).trigger("click"),this.shadowRoot.querySelector("nx-dialog").close()}))})}}rs=new WeakMap,ss=new WeakMap,customElements.get("ng-max-popup")||customElements.define("ng-max-popup",Ld);class Pd extends HTMLElement{constructor(){super();Y(this,Lt);Y(this,ia);Y(this,Lh);tt(this,ia,new Md(f(this,Lt))),tt(this,Lh,new ku(f(this,Lt)))}connectedCallback(){tt(this,Lt,this.getRootNode().host.getRootNode().host),this.innerHTML="";var t=new sd({owner:f(this,Lt),items:{filtering:{name:"Filtering",className:"ng-menu-filtering"},maximize:{name:"Maximize",className:"maximize"},export:{name:"export",items:{"export-excel":{name:"Excel",className:"export-excel"},"export-pdf":{name:"Pdf",className:"export-pdf",disabled:function(l,c){return!0}}}},import:{name:"import",className:"import",disabled:function(l,c){return!0}},properties:{name:"options",items:{"show-title-bar":{name:"title bar show/hide",className:"show-title-bar"},"show-menu-icon":{name:"menu icon show/hide",className:"show-menu-icon"},"show-status-bar":{name:"status bar show/hide",className:"show-status-bar"},"show-tfoot":{name:"table footer show/hide",className:"show-tfoot",disabled:function(l,c){return!($(".ng-table tfoot",this.getRootNode().host).length>0)}},"select-type":{name:"select type",items:{[`select-type-${H.SELECTTYPE.ROW}`]:{name:"row",className:`select-type select-type-${H.SELECTTYPE.ROW}`},[`select-type-${H.SELECTTYPE.ROWS}`]:{name:"multi row",className:`select-type select-type-${H.SELECTTYPE.ROWS}`},[`select-type-${H.SELECTTYPE.COL}`]:{name:"column",className:`select-type select-type-${H.SELECTTYPE.COL}`},[`select-type-${H.SELECTTYPE.COLS}`]:{name:"multi column",className:`select-type select-type-${H.SELECTTYPE.COLS}`},[`select-type-${H.SELECTTYPE.CELL}`]:{name:"cell",className:`select-type select-type-${H.SELECTTYPE.CELL}`},[`select-type-${H.SELECTTYPE.AREA}`]:{name:"area",className:`select-type select-type-${H.SELECTTYPE.AREA}`},[`select-type-${H.SELECTTYPE.NONE}`]:{name:"none",className:`select-type select-type-${H.SELECTTYPE.NONE}`}}},"paging-type":{name:"paging type",items:{[`paging-type-${H.PAGINGTYPE.NONE}`]:{name:"none",className:`paging-type paging-type-${H.PAGINGTYPE.NONE}`},[`paging-type-${H.PAGINGTYPE.CLIENT}`]:{name:"client",className:`paging-type paging-type-${H.PAGINGTYPE.CLIENT}`},[`paging-type-${H.PAGINGTYPE.SERVER}`]:{name:"server",className:`paging-type paging-type-${H.PAGINGTYPE.SERVER}`},"paging-count":{name:"entries per page",items:{[`paging-count-${H.PAGINGCOUNT.AUTO}`]:{name:"auto",className:`paging-count paging-count-${H.PAGINGCOUNT.AUTO}`},[`paging-count-${H.PAGINGCOUNT.NUM_1}`]:{name:"1",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_1}`},[`paging-count-${H.PAGINGCOUNT.NUM_5}`]:{name:"5",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_5}`},[`paging-count-${H.PAGINGCOUNT.NUM_10}`]:{name:"10",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_10}`},[`paging-count-${H.PAGINGCOUNT.NUM_20}`]:{name:"20",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_20}`},[`paging-count-${H.PAGINGCOUNT.NUM_30}`]:{name:"30",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_30}`},[`paging-count-${H.PAGINGCOUNT.NUM_50}`]:{name:"50",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_50}`},[`paging-count-${H.PAGINGCOUNT.NUM_100}`]:{name:"100",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_100}`},[`paging-count-${H.PAGINGCOUNT.NUM_1000}`]:{name:"1000",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_1000}`},[`paging-count-${H.PAGINGCOUNT.NUM_10000}`]:{name:"10000",className:`paging-count paging-count-${H.PAGINGCOUNT.NUM_10000}`}}}}},"auto-fit-col":{name:"auto fit columns",className:"auto-fit-col"}}}},callback:l=>{switch(l.menuId){case"maximize":$("ng-max-popup",f(this,Lt).shadowRoot).remove(),$(f(this,Lt).shadowRoot).append($("<ng-max-popup></ng-max-popup>")),f(this,Lt).shadowRoot.querySelector("ng-max-popup").popup();break;case"import":f(this,ia).importExcel();break;case"export-excel":f(this,Lt).export();break;case"export-pdf":$("ng-export",f(this,Lt).shadowRoot).remove(),$(f(this,Lt).shadowRoot).append($("<ng-export></ng-export>")),f(this,Lt).shadowRoot.querySelector("ng-export").exportPdf();break;case"detail":break;case"filtering":f(this,Lt).filtering.isFiltering()?f(this,Lt).filtering.off():f(this,Lt).filtering.on();break;case`select-type-${H.SELECTTYPE.ROW}`:case`select-type-${H.SELECTTYPE.ROWS}`:case`select-type-${H.SELECTTYPE.COL}`:case`select-type-${H.SELECTTYPE.COLS}`:case`select-type-${H.SELECTTYPE.CELL}`:case`select-type-${H.SELECTTYPE.AREA}`:case`select-type-${H.SELECTTYPE.NONE}`:f(this,Lt).setAttribute("select-type",l.menuId.replace("select-type-",""));break;case"show-title-bar":f(this,Lt).setAttribute("show-title-bar",f(this,Lt).getAttribute("show-title-bar")=="true"?"false":"true");break;case"show-menu-icon":f(this,Lt).setAttribute("show-menu-icon",f(this,Lt).getAttribute("show-menu-icon")=="true"?"false":"true");break;case"show-status-bar":f(this,Lt).setAttribute("show-status-bar",f(this,Lt).getAttribute("show-status-bar")=="true"?"false":"true");break;case`paging-type-${H.PAGINGTYPE.NONE}`:case`paging-type-${H.PAGINGTYPE.CLIENT}`:case`paging-type-${H.PAGINGTYPE.SERVER}`:f(this,Lt).setAttribute("paging-type",l.menuId.replace("paging-type-",""));break;case`paging-count-${H.PAGINGCOUNT.AUTO}`:case`paging-count-${H.PAGINGCOUNT.NUM_1}`:case`paging-count-${H.PAGINGCOUNT.NUM_5}`:case`paging-count-${H.PAGINGCOUNT.NUM_10}`:case`paging-count-${H.PAGINGCOUNT.NUM_20}`:case`paging-count-${H.PAGINGCOUNT.NUM_30}`:case`paging-count-${H.PAGINGCOUNT.NUM_50}`:case`paging-count-${H.PAGINGCOUNT.NUM_100}`:case`paging-count-${H.PAGINGCOUNT.NUM_1000}`:case`paging-count-${H.PAGINGCOUNT.NUM_10000}`:f(this,Lt).setAttribute("paging-count",l.menuId.replace("paging-count-",""));break;case"col-indicator-type":f(this,Lt).setAttribute("col-indicator-type",f(this,Lt).getAttribute("col-indicator-type")==H.COLINDICATORTYPE.EXPAND?H.COLINDICATORTYPE.COLLAPSE:H.COLINDICATORTYPE.EXPAND);break;case"auto-fit-col":f(this,Lt).setAttribute("auto-fit-col",f(this,Lt).getAttribute("auto-fit-col")=="true"?"false":"true");break;case"show-tfoot":f(this,Lt).setAttribute("show-tfoot",f(this,Lt).getAttribute("show-tfoot")=="true"?"false":"true");break;default:console.log(l.menuId)}},events:{show:l=>{H.j.querySelectorAll(f(this,Lt)).hasClass("ng-maximize")?H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("show-title-bar")=="true"?H.j.querySelectorAll("ng-context-menu-panel .show-title-bar",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .show-title-bar",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("show-menu-icon")=="true"?H.j.querySelectorAll("ng-context-menu-panel .show-menu-icon",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .show-menu-icon",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("show-status-bar")=="true"?H.j.querySelectorAll("ng-context-menu-panel .show-status-bar",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .show-status-bar",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll("ng-context-menu-panel .select-type",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll(`ng-context-menu-panel .select-type-${f(this,Lt).getAttribute("select-type")}`,f(this,Lt).shadowRoot).addClass("on"),H.j.querySelectorAll("ng-context-menu-panel .paging-type",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll(`ng-context-menu-panel .paging-type-${f(this,Lt).getAttribute("paging-type")}`,f(this,Lt).shadowRoot).addClass("on"),H.j.querySelectorAll("ng-context-menu-panel .paging-count",f(this,Lt).shadowRoot).removeClass("on"),H.j.querySelectorAll(`ng-context-menu-panel .paging-count-${f(this,Lt).getAttribute("paging-count")}`,f(this,Lt).shadowRoot).addClass("on"),f(this,Lt).filtering.isFiltering()?H.j.querySelectorAll("ng-context-menu-panel .ng-menu-filtering",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .ng-menu-filtering",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("auto-fit-col")=="true"?H.j.querySelectorAll("ng-context-menu-panel .auto-fit-col",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .auto-fit-col",f(this,Lt).shadowRoot).removeClass("on"),f(this,Lt).getAttribute("col-indicator-type")==H.COLINDICATORTYPE.EXPAND?H.j.querySelectorAll("ng-context-menu-panel .col-indicator-type",f(this,Lt).shadowRoot).addClass("on"):H.j.querySelectorAll("ng-context-menu-panel .col-indicator-type",f(this,Lt).shadowRoot).removeClass("on");const c=f(this,Lt).body.querySelector(".ng-table tfoot"),o=H.j.querySelectorAll("ng-context-menu-panel .show-tfoot",f(this,Lt).shadowRoot);c?(o.removeClass("disabled"),c.style.visibility=="collapse"?o.removeClass("on"):o.addClass("on")):o.addClass("disabled"),typeof ExcelJS>"u"&&H.j.querySelectorAll("ng-context-menu-panel .import,ng-context-menu-panel .export-excel",f(this,Lt).shadowRoot).addClass("disabled"),H.j.querySelectorAll("ng-context-menu-panel .import,ng-context-menu-panel .export-pdf",f(this,Lt).shadowRoot).addClass("disabled"),f(this,Lt).closest("dialog")?H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).addClass("disabled"):H.j.querySelectorAll("ng-context-menu-panel .maximize",f(this,Lt).shadowRoot).removeClass("disabled")},hide:()=>{}}});$(f(this,Lt).shadowRoot.querySelector("ng-head").shadowRoot.querySelector("ng-menu")).on("click",l=>{t.openMenu(l.offsetX,l.offsetY)})}}Lt=new WeakMap,ia=new WeakMap,Lh=new WeakMap,customElements.get("ng-menu")||customElements.define("ng-menu",Pd);class Dd extends HTMLElement{constructor(){super();Y(this,Fe);Y(this,na);Y(this,oa);Y(this,Rr);Y(this,aa);Y(this,We);Y(this,rr);Y(this,Fs);it(this,"refreshTotal",()=>{});Y(this,Ph,()=>{f(this,Fe).data.getValidDataNF().map(t=>{t.__ng.paging=!0}),f(this,Fe).data.resetRecords()});Y(this,wn,()=>{this.type==H.PAGINGTYPE.CLIENT?$("span",this).eq(1).html(`<b>Total</b> : ${f(this,Fe).data.countNF().toLocaleString()}`):this.type==H.PAGINGTYPE.SERVER?$("span",this).eq(1).html(`<b>Total</b> : ${f(this,Fs).toLocaleString()}`):this.type==H.PAGINGTYPE.NONE&&$("span",this).eq(1).html(`<b>Total</b> : ${f(this,Fs).toLocaleString()}`),f(this,rr)==0?$("span",this).eq(0).html(""):$("span",this).eq(0).html(`${f(this,We).toLocaleString()} <i>of</i> ${f(this,rr).toLocaleString()}`),H.j.querySelectorAll(".ng-paging-first",this).attr("disabled",f(this,We)==1||f(this,rr)<1),H.j.querySelectorAll(".ng-paging-prev",this).attr("disabled",f(this,We)==1||f(this,rr)<1),H.j.querySelectorAll(".ng-paging-next",this).attr("disabled",f(this,We)==f(this,rr)||f(this,rr)<1),H.j.querySelectorAll(".ng-paging-last",this).attr("disabled",f(this,We)==f(this,rr)||f(this,rr)<1)});Y(this,Dh,()=>{this.type==H.PAGINGTYPE.CLIENT?this.movePage(Math.ceil(f(this,Fe).data.countNF()/f(this,Rr))):this.type==H.PAGINGTYPE.SERVER&&this.movePage(Math.ceil(f(this,Fs)/f(this,Rr)))});it(this,"movePage",t=>{if(!(!f(this,Fe)||!f(this,Fe).data||isNaN(t))){if(this.type==H.PAGINGTYPE.SERVER&&(H.j.querySelectorAll(".ng-paging-first",this).attr("disabled",!0),H.j.querySelectorAll(".ng-paging-prev",this).attr("disabled",!0),H.j.querySelectorAll(".ng-paging-next",this).attr("disabled",!0),H.j.querySelectorAll(".ng-paging-last",this).attr("disabled",!0)),tt(this,aa,f(this,We)),tt(this,We,t),this.type==H.PAGINGTYPE.CLIENT){var l=f(this,Fe).data.getValidDataNF();if(tt(this,rr,Math.ceil(l.length/f(this,Rr))),l.length==0)tt(this,rr,0);else if(t<1||t>f(this,rr))throw`1invalid page ${t} of ${f(this,rr)}`;f(this,wn).call(this),l.map(o=>{o.__ng.paging=!1});for(var c=(f(this,We)-1)*f(this,Rr);c<Math.min(f(this,We)*f(this,Rr),f(this,Fe).data.countNF());c++)l[c].__ng.paging=!0;f(this,Fe).data.resetRecords(),f(this,Fe).scrollTo_V1(0)}this.type==H.PAGINGTYPE.SERVER&&f(this,aa)!=f(this,We)&&(this.onpagechanged.pageIndex=f(this,We),this.onpagechanged.pageCnt=f(this,Rr),f(this,Fe).dispatchEvent(this.onpagechanged))}});it(this,"reset",()=>{this.refresh()});it(this,"refresh",()=>{switch(this.type){case H.PAGINGTYPE.NONE:f(this,Ph).call(this),$(".ng-container tbody tr.bindable:not(.nodata)",f(this,Fe).body).remove(),f(this,Fe).scrollTo_V1(0);break;case H.PAGINGTYPE.CLIENT:this.movePage(1),f(this,Fe).refresh();break;case H.PAGINGTYPE.SERVER:break}f(this,wn).call(this)});tt(this,Fe,this.getRootNode().host.getRootNode().host),tt(this,We,0),tt(this,rr,0),tt(this,Fs,0),this.onpagechanged=new CustomEvent("pagechanged",{bubbles:!0,detail:{}})}connectedCallback(){this.innerHTML=`
518
518
  <button class="ng-paging-last" disabled></button>
519
519
  <button class="ng-paging-next" disabled></button>
520
520
  <span></span>
@@ -638,7 +638,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
638
638
  </svg>
639
639
  </div>
640
640
  </div>
641
- `,super.connectedCallback(),this.cell.removeAttribute("tabindex"),this.cell.dataset.bind="rowState",this.cell.dataset.expr=H.nvl(this.cell.dataset.expr,"data.__ng._[ninegrid.ROW.ORDER]"),this.cell.setAttribute("text-align","center"),tt(this,ba,this.shadowRoot.querySelector("span")),f(this,Vh).call(this)}}ba=new WeakMap,Vh=new WeakMap;class Xd extends HTMLElement{constructor(){super();Y(this,fr);Y(this,ss);Y(this,ya);Y(this,br);Y(this,zs);Y(this,yi);Y(this,fu);Y(this,is);Y(this,Wh);Y(this,Xh,()=>{if(f(this,fr)){var t=f(this,fr).querySelector("div.resizer-row-panel");t?tt(this,br,$(t)):(tt(this,br,$('<div class="resizer-row-panel"><div class="grip"></div><div class="tooltip"><div></div><span></span><div></div></div></div>').hide()),$(f(this,fr).body).append(f(this,br))),tt(this,zs,$(".grip",f(this,br))),tt(this,yi,$(".tooltip",f(this,br))),$(this).on("mousedown",l=>{H.j.querySelectorAll(f(this,ss).closest("tbody")).hasClass("fixed")||tt(this,ya,setTimeout(()=>{f(this,Yh).call(this,l)},500))}).on("dblclick",l=>{H.j.querySelectorAll(f(this,ss).closest("tbody")).hasClass("fixed")||f(this,Gh).call(this,l)}),$(document).on("mouseup",l=>{clearTimeout(f(this,ya))})}});Y(this,Yh,t=>{if(!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftkey)){var l=parseInt(t.target.getAttribute("rowIndex"));l<0||(f(this,ss).busy=!0,tt(this,Wh,t.target),tt(this,is,$(".ng-container-body table tbody.bindable tr",f(this,fr).body).eq(l)),f(this,br).show(),f(this,zs).width(f(this,fr).body.querySelector(".ng-container").offsetWidth),f(this,xa).call(this,t.pageY),$(f(this,br)).on("mousemove",f(this,va)),$(f(this,br)).on("mouseup",f(this,wa)))}});Y(this,va,t=>{t.altKey||t.ctrlKey||t.shiftKey||f(this,xa).call(this,t.pageY)});Y(this,wa,t=>{var l=f(this,zs).offset().top-f(this,is).offset().top;l<=1&&(l=0),l=f(this,fr).tableUtils.height(f(this,is)[0].sectionRowIndex,l);var c=parseInt(f(this,is)[0].dataset.row*f(this,fr).template.length+f(this,is)[0].sectionRowIndex%f(this,fr).template.length);f(this,fr).matrix.setHeight(c,l),f(this,ss).querySelector("ng-row-indicator").refresh(),$(f(this,br)).off("mousemove",f(this,va)),$(f(this,br)).off("mouseup",f(this,wa)),f(this,br).hide(),f(this,fr).view.redraw(),f(this,ss).busy=!1});Y(this,xa,t=>{var l=$(".ng-container-body table tbody.bindable",f(this,fr).body);if(!(t<l.offset().top)){f(this,zs).offset({top:t});var c=parseInt(f(this,zs).offset().top),o=parseInt(c-f(this,is).offset().top);o<=1&&(o=0),f(this,yi).height(o),f(this,yi).offset({top:f(this,is).offset().top-1}),f(this,yi).find("span").text(o)}});Y(this,Gh,t=>{})}connectedCallback(){tt(this,ss,this.cell),tt(this,fr,f(this,ss).getRootNode().host),this.setAttribute("class","row-resizer"),f(this,Xh).call(this)}}fr=new WeakMap,ss=new WeakMap,ya=new WeakMap,br=new WeakMap,zs=new WeakMap,yi=new WeakMap,fu=new WeakMap,is=new WeakMap,Wh=new WeakMap,Xh=new WeakMap,Yh=new WeakMap,va=new WeakMap,wa=new WeakMap,xa=new WeakMap,Gh=new WeakMap,customElements.get("ng-row-indicator")||customElements.define("ng-row-indicator",Wd),customElements.get("ng-row-resizer")||customElements.define("ng-row-resizer",Xd);class Yd extends _r{constructor(){super();it(this,"dataRefresh",t=>{!this.owner||!this.cell||!this.data||(this.cell.closest("tbody.fixed")?H.j.querySelectorAll(this).addClass("pin"):H.j.querySelectorAll(this).removeClass("pin"),t||this.reset())});Y(this,Kh,()=>{H.isMobile()||this.shadowRoot.querySelector("svg").addEventListener("click",t=>{const l=this.cell.closest("tr").dataset.row;this.cell.closest("tbody.fixed")?this.owner.pin.remove(l):this.owner.pin.add(this.data.__ng._[H.ROW.INDEX])})})}connectedCallback(){this.shadowRoot.innerHTML=`
641
+ `,super.connectedCallback(),this.cell.removeAttribute("tabindex"),this.cell.dataset.bind="rowState",this.cell.dataset.expr=H.nvl(this.cell.dataset.expr,"data.__ng._[ninegrid.ROW.ORDER]"),this.cell.setAttribute("text-align","center"),tt(this,ba,this.shadowRoot.querySelector("span")),f(this,Vh).call(this)}}ba=new WeakMap,Vh=new WeakMap;class Xd extends HTMLElement{constructor(){super();Y(this,fr);Y(this,is);Y(this,ya);Y(this,br);Y(this,zs);Y(this,yi);Y(this,fu);Y(this,ns);Y(this,Wh);Y(this,Xh,()=>{if(f(this,fr)){var t=f(this,fr).querySelector("div.resizer-row-panel");t?tt(this,br,$(t)):(tt(this,br,$('<div class="resizer-row-panel"><div class="grip"></div><div class="tooltip"><div></div><span></span><div></div></div></div>').hide()),$(f(this,fr).body).append(f(this,br))),tt(this,zs,$(".grip",f(this,br))),tt(this,yi,$(".tooltip",f(this,br))),$(this).on("mousedown",l=>{H.j.querySelectorAll(f(this,is).closest("tbody")).hasClass("fixed")||tt(this,ya,setTimeout(()=>{f(this,Yh).call(this,l)},500))}).on("dblclick",l=>{H.j.querySelectorAll(f(this,is).closest("tbody")).hasClass("fixed")||f(this,Gh).call(this,l)}),$(document).on("mouseup",l=>{clearTimeout(f(this,ya))})}});Y(this,Yh,t=>{if(!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftkey)){var l=parseInt(t.target.getAttribute("rowIndex"));l<0||(f(this,is).busy=!0,tt(this,Wh,t.target),tt(this,ns,$(".ng-container-body table tbody.bindable tr",f(this,fr).body).eq(l)),f(this,br).show(),f(this,zs).width(f(this,fr).body.querySelector(".ng-container").offsetWidth),f(this,xa).call(this,t.pageY),$(f(this,br)).on("mousemove",f(this,va)),$(f(this,br)).on("mouseup",f(this,wa)))}});Y(this,va,t=>{t.altKey||t.ctrlKey||t.shiftKey||f(this,xa).call(this,t.pageY)});Y(this,wa,t=>{var l=f(this,zs).offset().top-f(this,ns).offset().top;l<=1&&(l=0),l=f(this,fr).tableUtils.height(f(this,ns)[0].sectionRowIndex,l);var c=parseInt(f(this,ns)[0].dataset.row*f(this,fr).template.length+f(this,ns)[0].sectionRowIndex%f(this,fr).template.length);f(this,fr).matrix.setHeight(c,l),f(this,is).querySelector("ng-row-indicator").refresh(),$(f(this,br)).off("mousemove",f(this,va)),$(f(this,br)).off("mouseup",f(this,wa)),f(this,br).hide(),f(this,fr).view.redraw(),f(this,is).busy=!1});Y(this,xa,t=>{var l=$(".ng-container-body table tbody.bindable",f(this,fr).body);if(!(t<l.offset().top)){f(this,zs).offset({top:t});var c=parseInt(f(this,zs).offset().top),o=parseInt(c-f(this,ns).offset().top);o<=1&&(o=0),f(this,yi).height(o),f(this,yi).offset({top:f(this,ns).offset().top-1}),f(this,yi).find("span").text(o)}});Y(this,Gh,t=>{})}connectedCallback(){tt(this,is,this.cell),tt(this,fr,f(this,is).getRootNode().host),this.setAttribute("class","row-resizer"),f(this,Xh).call(this)}}fr=new WeakMap,is=new WeakMap,ya=new WeakMap,br=new WeakMap,zs=new WeakMap,yi=new WeakMap,fu=new WeakMap,ns=new WeakMap,Wh=new WeakMap,Xh=new WeakMap,Yh=new WeakMap,va=new WeakMap,wa=new WeakMap,xa=new WeakMap,Gh=new WeakMap,customElements.get("ng-row-indicator")||customElements.define("ng-row-indicator",Wd),customElements.get("ng-row-resizer")||customElements.define("ng-row-resizer",Xd);class Yd extends _r{constructor(){super();it(this,"dataRefresh",t=>{!this.owner||!this.cell||!this.data||(this.cell.closest("tbody.fixed")?H.j.querySelectorAll(this).addClass("pin"):H.j.querySelectorAll(this).removeClass("pin"),t||this.reset())});Y(this,Kh,()=>{H.isMobile()||this.shadowRoot.querySelector("svg").addEventListener("click",t=>{const l=this.cell.closest("tr").dataset.row;this.cell.closest("tbody.fixed")?this.owner.pin.remove(l):this.owner.pin.add(this.data.__ng._[H.ROW.INDEX])})})}connectedCallback(){this.shadowRoot.innerHTML=`
642
642
  <style>
643
643
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngRowPin.css";
644
644
  ${H.getCustomPath(this,"ngRowPin.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))return;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=t.clientY-this.shiftY,r=o/(l-c),n=f(this,qt).matrix.totalHeight,s=r*(n-this.bodyHeight),{index:e,offset:i}=f(this,qt).matrix.getRowInfoAt(s);f(this,qt).dataManager.viewRecords.rawIndex!==e&&f(this,qt).scrollToV2(e);const u=f(this,qt).body.querySelector(".ng-container-body tbody.bindable");u&&(u.style.transform=`translateY(-${i}px)`)});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,os);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,os)&&tt(this,os,!1),document.removeEventListener("mousemove",f(this,kn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,os,!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,os)&&!(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,os,!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,os))return;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=t.clientY-this.shiftY,r=o/(l-c),n=f(this,qt).matrix.totalHeight,s=r*(n-this.bodyHeight),{index:e,offset:i}=f(this,qt).matrix.getRowInfoAt(s);f(this,qt).dataManager.viewRecords.rawIndex!==e&&f(this,qt).scrollToV2(e);const u=f(this,qt).body.querySelector(".ng-container-body tbody.bindable");u&&(u.style.transform=`translateY(-${i}px)`)});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")}
@@ -661,7 +661,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
661
661
  <button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
662
662
  <div class='ng-scroll-track'> <div class='ng-scroll-thumb'></div> </div>
663
663
  <button class='ng-scroll-bottom'><div class='ng-scroll-icon'></div></button>
664
- `,tt(this,ge,{track:this.shadowRoot.querySelector(".ng-scroll-track"),thumb:this.shadowRoot.querySelector(".ng-scroll-thumb"),top:this.shadowRoot.querySelector(".ng-scroll-top"),bottom:this.shadowRoot.querySelector(".ng-scroll-bottom")}),f(this,ns),this.shiftX,f(this,Zh).call(this))}}qt=new WeakMap,ns=new WeakMap,ge=new WeakMap,yr=new WeakMap,vr=new WeakMap,Sn=new WeakMap,Zh=new WeakMap,Jh=new WeakMap,_a=new WeakMap,Qh=new WeakMap,Sa=new WeakMap,ka=new WeakMap,kn=new WeakMap,Cn=new WeakMap;class Jd extends HTMLElement{constructor(){super();Y(this,Ze);Y(this,ys);Y(this,ae);Y(this,Wr);Y(this,Xr);it(this,"refresh",()=>{if(f(this,Ze)){var t=$(".ng-container-body",f(this,Ze).body),l=$("table",t),c=$(".ng-scroll-track",this.shadowRoot),o=$(".ng-scroll-thumb",this.shadowRoot);t.width()!=0&&l.width()>t.width()?$(f(this,Ze).body.querySelector(".ng-container-bottom")).show():$(f(this,Ze).body.querySelector(".ng-container-bottom")).hide(),o.width(Math.min(c.width()*t.width()/l.width(),c.width()));var r=parseInt(Math.abs(l.position().left)*c.width()/l.width());r<0&&(r=0),r+o.width()>c.width()&&(r=c.width()-o.width()),o.css({left:r}),H.j.querySelectorAll(".ng-scroll-left",this.shadowRoot).attr("disabled",r==0),H.j.querySelectorAll(".ng-scroll-right",this.shadowRoot).attr("disabled",r==c.width()-o.width());var n=f(this,Ze).body.querySelector("ng-vscrollbar");$(this).is(":visible")&&$(n).is(":visible")?$(".ng-scroll-edge",f(this,Ze).body).show():$(".ng-scroll-edge",f(this,Ze).body).hide()}});it(this,"scrollToHome",()=>{f(this,Us).call(this,0)});it(this,"scrollToEnd",()=>{var t=f(this,ae).track.getBoundingClientRect(),l=f(this,ae).thumb.getBoundingClientRect(),c=t.width-l.width;f(this,Us).call(this,c)});Y(this,Us,t=>{if(f(this,ae)){var l=$("table",f(this,ae).container),c=f(this,ae).track.getBoundingClientRect(),o=f(this,ae).thumb.getBoundingClientRect();t<0&&(t=0),t+o.width>c.width&&(t=c.width-o.width),t=parseInt(t),f(this,ae).thumb.style.left=t+"px",f(this,ae).left.disabled=t==0,f(this,ae).right.disabled=t==parseInt(c.width-o.width);var r=$(f(this,ae).container).width(),n=$(l).width(),s=-t*(n-r)/(c.width-o.width);return-s>n-r&&(s=n-r),-s+5>n-r&&(s=-(n-r)),r>=n&&(s=0),$(l).css({left:s}),!(t==0||t==c.width-o.width)}});it(this,"adjustThumb2",()=>{var t=$(".ng-container-body > table",f(this,Ze).body),l=$(".ng-scroll-track",this.shadowRoot),c=$(".ng-scroll-thumb",this.shadowRoot),o=parseInt(Math.abs(t.position().left)*l.width()/t.width());o<0&&(o=0),o+c.width()>l.width()&&(o=l.width()-c.width()),c.css({left:o}),H.j.querySelectorAll(".ng-scroll-left",this.shadowRoot).attr("disabled",o==0),H.j.querySelectorAll(".ng-scroll-right",this.shadowRoot).attr("disabled",o==l.width()-c.width())});Y(this,tc,()=>{var t=l=>{clearInterval(f(this,Wr)),clearInterval(f(this,Xr));var c=f(this,ae).track.getBoundingClientRect(),o=f(this,ae).thumb.getBoundingClientRect();f(this,Us).call(this,o.x-c.x+l),tt(this,Wr,setInterval(()=>{clearInterval(f(this,Wr)),tt(this,Xr,setInterval(()=>{var r=f(this,ae).thumb.getBoundingClientRect();f(this,Us).call(this,r.x-c.x+l)||clearInterval(f(this,Xr))},10))},500))};f(this,ae).left.ontouchend=f(this,ae).right.ontouchend=f(this,ae).track.ontouchend=f(this,ae).left.onmouseup=f(this,ae).left.onmouseleave=f(this,ae).right.onmouseup=f(this,ae).right.onmouseleave=f(this,ae).track.onmouseup,f(this,ae).track.onmouseleave=l=>{clearInterval(f(this,Wr)),clearInterval(f(this,Xr))},$(f(this,ae).left).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(-10)}),$(f(this,ae).right).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(10)}),$(f(this,ae).left).on("touchstart",l=>{t(-10)}),$(f(this,ae).right).on("touchstart",l=>{t(10)}),$(f(this,ae).track).on("mousedown",f(this,Ea)),$(f(this,ae).track).on("touchstart",f(this,ec)),$(f(this,ae).thumb).on("mousedown",f(this,Aa)),$(f(this,ae).thumb).on("touchstart",f(this,rc)),document.addEventListener("touchend",l=>{tt(this,ys,!1),clearInterval(f(this,Wr)),clearInterval(f(this,Xr)),$(document).off("touchmove",f(this,Ta)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("mouseup",l=>{tt(this,ys,!1),clearInterval(f(this,Wr)),clearInterval(f(this,Xr)),document.removeEventListener("mousemove",f(this,En)),typeof this.onDragStop=="function"&&this.onDragStop()})});Y(this,Ca,t=>{var l=f(this,ae).thumb.getBoundingClientRect(),c=parseInt($(".ng-container-body > table",f(this,Ze).body).position().left),o=0;t>l.x?$(".ng-container-body .col-indicator",f(this,Ze).body).each((r,n)=>{if(o+=parseInt($(n).width())+2,o>Math.abs(c)+1)return!1}):$(".ng-container-body .col-indicator",f(this,Ze).body).each((r,n)=>{if(o+parseInt($(n).width())+2>=Math.abs(c))return!1;o+=parseInt($(n).width())+2}),$(".ng-container-body > table",f(this,Ze).body).css({left:-o}),this.refresh()});Y(this,ec,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,Ea).call(this,t)});Y(this,Ea,t=>{f(this,ys)||t.buttons!=1||t.altKey||t.ctrlKey||t.shiftKey||(t.preventDefault(),f(this,Ca).call(this,t.clientX),tt(this,Wr,setInterval(()=>{clearInterval(f(this,Wr)),tt(this,Xr,setInterval(()=>{var l=f(this,ae).thumb.getBoundingClientRect();t.clientX>l.x&&t.clientX<l.x+l.width?clearInterval(f(this,Xr)):f(this,Ca).call(this,t.clientX)},10))},500)))});Y(this,rc,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,Aa).call(this,t),document.addEventListener("touchmove",f(this,Ta))});Y(this,Aa,t=>{tt(this,ys,!0);var l=Math.min($(f(this,ae).track).width()*$(f(this,Ze).body.querySelector(".ng-container-body")).width()/$(f(this,Ze).body.querySelector(".ng-container-body > table")).width(),$(f(this,ae).track).width());$(f(this,ae).thumb).width(parseInt(l)),$(f(this,ae).thumb).css({width:parseInt(l),"min-width":parseInt(l)}),this.shiftX=t.offsetX+f(this,ae).track.getBoundingClientRect().x,document.addEventListener("mousemove",f(this,En)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,Ta,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,En).call(this,t)});Y(this,En,t=>{f(this,ys)&&f(this,Us).call(this,t.pageX-this.shiftX)});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Ze,this.getRootNode().host),this.shadowRoot.innerHTML=`
664
+ `,tt(this,ge,{track:this.shadowRoot.querySelector(".ng-scroll-track"),thumb:this.shadowRoot.querySelector(".ng-scroll-thumb"),top:this.shadowRoot.querySelector(".ng-scroll-top"),bottom:this.shadowRoot.querySelector(".ng-scroll-bottom")}),f(this,os),this.shiftX,f(this,Zh).call(this))}}qt=new WeakMap,os=new WeakMap,ge=new WeakMap,yr=new WeakMap,vr=new WeakMap,Sn=new WeakMap,Zh=new WeakMap,Jh=new WeakMap,_a=new WeakMap,Qh=new WeakMap,Sa=new WeakMap,ka=new WeakMap,kn=new WeakMap,Cn=new WeakMap;class Jd extends HTMLElement{constructor(){super();Y(this,Ze);Y(this,ys);Y(this,ae);Y(this,Wr);Y(this,Xr);it(this,"refresh",()=>{if(f(this,Ze)){var t=$(".ng-container-body",f(this,Ze).body),l=$("table",t),c=$(".ng-scroll-track",this.shadowRoot),o=$(".ng-scroll-thumb",this.shadowRoot);t.width()!=0&&l.width()>t.width()?$(f(this,Ze).body.querySelector(".ng-container-bottom")).show():$(f(this,Ze).body.querySelector(".ng-container-bottom")).hide(),o.width(Math.min(c.width()*t.width()/l.width(),c.width()));var r=parseInt(Math.abs(l.position().left)*c.width()/l.width());r<0&&(r=0),r+o.width()>c.width()&&(r=c.width()-o.width()),o.css({left:r}),H.j.querySelectorAll(".ng-scroll-left",this.shadowRoot).attr("disabled",r==0),H.j.querySelectorAll(".ng-scroll-right",this.shadowRoot).attr("disabled",r==c.width()-o.width());var n=f(this,Ze).body.querySelector("ng-vscrollbar");$(this).is(":visible")&&$(n).is(":visible")?$(".ng-scroll-edge",f(this,Ze).body).show():$(".ng-scroll-edge",f(this,Ze).body).hide()}});it(this,"scrollToHome",()=>{f(this,Us).call(this,0)});it(this,"scrollToEnd",()=>{var t=f(this,ae).track.getBoundingClientRect(),l=f(this,ae).thumb.getBoundingClientRect(),c=t.width-l.width;f(this,Us).call(this,c)});Y(this,Us,t=>{if(f(this,ae)){var l=$("table",f(this,ae).container),c=f(this,ae).track.getBoundingClientRect(),o=f(this,ae).thumb.getBoundingClientRect();t<0&&(t=0),t+o.width>c.width&&(t=c.width-o.width),t=parseInt(t),f(this,ae).thumb.style.left=t+"px",f(this,ae).left.disabled=t==0,f(this,ae).right.disabled=t==parseInt(c.width-o.width);var r=$(f(this,ae).container).width(),n=$(l).width(),s=-t*(n-r)/(c.width-o.width);return-s>n-r&&(s=n-r),-s+5>n-r&&(s=-(n-r)),r>=n&&(s=0),$(l).css({left:s}),!(t==0||t==c.width-o.width)}});it(this,"adjustThumb2",()=>{var t=$(".ng-container-body > table",f(this,Ze).body),l=$(".ng-scroll-track",this.shadowRoot),c=$(".ng-scroll-thumb",this.shadowRoot),o=parseInt(Math.abs(t.position().left)*l.width()/t.width());o<0&&(o=0),o+c.width()>l.width()&&(o=l.width()-c.width()),c.css({left:o}),H.j.querySelectorAll(".ng-scroll-left",this.shadowRoot).attr("disabled",o==0),H.j.querySelectorAll(".ng-scroll-right",this.shadowRoot).attr("disabled",o==l.width()-c.width())});Y(this,tc,()=>{var t=l=>{clearInterval(f(this,Wr)),clearInterval(f(this,Xr));var c=f(this,ae).track.getBoundingClientRect(),o=f(this,ae).thumb.getBoundingClientRect();f(this,Us).call(this,o.x-c.x+l),tt(this,Wr,setInterval(()=>{clearInterval(f(this,Wr)),tt(this,Xr,setInterval(()=>{var r=f(this,ae).thumb.getBoundingClientRect();f(this,Us).call(this,r.x-c.x+l)||clearInterval(f(this,Xr))},10))},500))};f(this,ae).left.ontouchend=f(this,ae).right.ontouchend=f(this,ae).track.ontouchend=f(this,ae).left.onmouseup=f(this,ae).left.onmouseleave=f(this,ae).right.onmouseup=f(this,ae).right.onmouseleave=f(this,ae).track.onmouseup,f(this,ae).track.onmouseleave=l=>{clearInterval(f(this,Wr)),clearInterval(f(this,Xr))},$(f(this,ae).left).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(-10)}),$(f(this,ae).right).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(10)}),$(f(this,ae).left).on("touchstart",l=>{t(-10)}),$(f(this,ae).right).on("touchstart",l=>{t(10)}),$(f(this,ae).track).on("mousedown",f(this,Ea)),$(f(this,ae).track).on("touchstart",f(this,ec)),$(f(this,ae).thumb).on("mousedown",f(this,Aa)),$(f(this,ae).thumb).on("touchstart",f(this,rc)),document.addEventListener("touchend",l=>{tt(this,ys,!1),clearInterval(f(this,Wr)),clearInterval(f(this,Xr)),$(document).off("touchmove",f(this,Ta)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("mouseup",l=>{tt(this,ys,!1),clearInterval(f(this,Wr)),clearInterval(f(this,Xr)),document.removeEventListener("mousemove",f(this,En)),typeof this.onDragStop=="function"&&this.onDragStop()})});Y(this,Ca,t=>{var l=f(this,ae).thumb.getBoundingClientRect(),c=parseInt($(".ng-container-body > table",f(this,Ze).body).position().left),o=0;t>l.x?$(".ng-container-body .col-indicator",f(this,Ze).body).each((r,n)=>{if(o+=parseInt($(n).width())+2,o>Math.abs(c)+1)return!1}):$(".ng-container-body .col-indicator",f(this,Ze).body).each((r,n)=>{if(o+parseInt($(n).width())+2>=Math.abs(c))return!1;o+=parseInt($(n).width())+2}),$(".ng-container-body > table",f(this,Ze).body).css({left:-o}),this.refresh()});Y(this,ec,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,Ea).call(this,t)});Y(this,Ea,t=>{f(this,ys)||t.buttons!=1||t.altKey||t.ctrlKey||t.shiftKey||(t.preventDefault(),f(this,Ca).call(this,t.clientX),tt(this,Wr,setInterval(()=>{clearInterval(f(this,Wr)),tt(this,Xr,setInterval(()=>{var l=f(this,ae).thumb.getBoundingClientRect();t.clientX>l.x&&t.clientX<l.x+l.width?clearInterval(f(this,Xr)):f(this,Ca).call(this,t.clientX)},10))},500)))});Y(this,rc,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,Aa).call(this,t),document.addEventListener("touchmove",f(this,Ta))});Y(this,Aa,t=>{tt(this,ys,!0);var l=Math.min($(f(this,ae).track).width()*$(f(this,Ze).body.querySelector(".ng-container-body")).width()/$(f(this,Ze).body.querySelector(".ng-container-body > table")).width(),$(f(this,ae).track).width());$(f(this,ae).thumb).width(parseInt(l)),$(f(this,ae).thumb).css({width:parseInt(l),"min-width":parseInt(l)}),this.shiftX=t.offsetX+f(this,ae).track.getBoundingClientRect().x,document.addEventListener("mousemove",f(this,En)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,Ta,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,En).call(this,t)});Y(this,En,t=>{f(this,ys)&&f(this,Us).call(this,t.pageX-this.shiftX)});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Ze,this.getRootNode().host),this.shadowRoot.innerHTML=`
665
665
  <style>
666
666
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngHScrollBar.css";
667
667
  ${H.getCustomPath(this,"ngHScrollBar.css")}
@@ -670,7 +670,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
670
670
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
671
671
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
672
672
  <button class='ng-scroll-right'><div class='ng-scroll-icon'></div></button>
673
- `,tt(this,ae,{container:f(this,Ze).shadowRoot.querySelector(".ng-container-body"),track:this.shadowRoot.querySelector(".ng-scroll-track"),thumb:this.shadowRoot.querySelector(".ng-scroll-thumb"),left:this.shadowRoot.querySelector(".ng-scroll-left"),right:this.shadowRoot.querySelector(".ng-scroll-right")}),f(this,ys),this.shiftX,f(this,tc).call(this)}}Ze=new WeakMap,ys=new WeakMap,ae=new WeakMap,Wr=new WeakMap,Xr=new WeakMap,Us=new WeakMap,tc=new WeakMap,Ca=new WeakMap,ec=new WeakMap,Ea=new WeakMap,rc=new WeakMap,Aa=new WeakMap,Ta=new WeakMap,En=new WeakMap,customElements.get("ng-hscrollbar")||customElements.define("ng-hscrollbar",Jd),customElements.get("ng-vscrollbar")||customElements.define("ng-vscrollbar",Zd);class Qd{constructor(C){Y(this,Xe);Y(this,os);it(this,"initialize",()=>{f(this,Ma).call(this),f(this,Ra).call(this)});Y(this,Ra,()=>{tt(this,os,[]),$(".ng-table thead",f(this,Xe).body).off("click","th,td",f(this,Ia)),$(".ng-table thead",f(this,Xe).body).on("click","th,td",f(this,Ia))});Y(this,Ma,()=>{f(this,Xe).data.sort((C,t)=>C.__ng._[H.ROW.ORIGIN_ORDER]-t.__ng._[H.ROW.ORIGIN_ORDER])});Y(this,Ia,C=>{if(C.target.tagName!="NG-CHECKBOX"&&(C.target=C.target.closest("th,td"),!(C.offsetX<=2)&&!(C.offsetX>=C.target.offsetWidth-2)&&C.target.closest("tr").sectionRowIndex+C.target.rowSpan==C.target.closest("thead").rows.length))switch(C.detail){case 1:H.j.querySelectorAll(f(this,Xe)).addClass("loading"),setTimeout(()=>{f(this,sc).call(this,C),H.j.querySelectorAll(f(this,Xe)).removeClass("loading")});break;case 2:console.log("double click action here");break;default:console.log("higher multi-click actions can be added as needed");break}});Y(this,sc,C=>{var t=C.target.closest("th,td"),l=t.dataset.col,c,o;$(f(this,Xe).template).find(`[data-col="${l}"]`).each((r,n)=>{if(n.dataset.bind)return o=n.dataset.bind,n.dataset.expr&&(c=f(this,Xe).exprFunction(n.dataset.expr)),!1}),o&&(!C.ctrlKey&&!C.shiftKey&&(H.j.querySelectorAll(`thead th:not([data-col="${l}"],thead td:not([data-col="${l}"])`,f(this,Xe).body).removeClass("asc").removeClass("desc"),f(this,os).splice(0,f(this,os).length)),H.removeIf(f(this,os),r=>r.colnm==o),!H.j.querySelectorAll(t).hasClass("asc")&&!H.j.querySelectorAll(t).hasClass("desc")?(H.j.querySelectorAll(t).removeClass("desc").addClass("asc"),f(this,os).push({colnm:o,asc:!0,"expr-func":c})):H.j.querySelectorAll(t).hasClass("asc")?(H.j.querySelectorAll(t).removeClass("asc").addClass("desc"),f(this,os).push({colnm:o,asc:!1,"expr-func":c})):H.j.querySelectorAll(t).removeClass("asc").removeClass("desc"),!H.j.querySelectorAll("thead th,thead td",f(this,Xe).body).hasClass("asc")&&!H.j.querySelectorAll("thead th,thead td",f(this,Xe).body).hasClass("desc")?f(this,Ma).call(this):f(this,Xe).data.sort((r,n)=>f(this,ic).call(this,r,n)),f(this,Xe).paging.type==H.PAGINGTYPE.CLIENT?f(this,Xe).paging.movePage(1):f(this,Xe).view.redraw())});Y(this,ic,(C,t)=>{for(var l of f(this,os))if(l["expr-func"]){const c=f(this,Xe).data.conv(C),o=f(this,Xe).data.conv(t);if(l["expr-func"](c,c.__ng._[H.ROW.INDEX])>l["expr-func"](o,o.__ng._[H.ROW.INDEX]))return l.asc?1:-1;if(l["expr-func"](c,c.__ng._[H.ROW.INDEX])<l["expr-func"](o,o.__ng._[H.ROW.INDEX]))return l.asc?-1:1}else{const c=f(this,Xe).fields.indexOf(l.colnm);if(C.v[c]>t.v[c])return l.asc?1:-1;if(C.v[c]<t.v[c])return l.asc?-1:1}return 0});tt(this,Xe,C),f(this,Ra).call(this)}}Xe=new WeakMap,os=new WeakMap,Ra=new WeakMap,Ma=new WeakMap,Ia=new WeakMap,sc=new WeakMap,ic=new WeakMap;class tf{constructor(C){Y(this,Gt);it(this,"getDisplayValue3",(C,t)=>{const l=parseInt(C/f(this,Gt).template.length),o=f(this,Gt).template[C%f(this,Gt).template.length].querySelector(`[data-col="${t}"]`);if(!o||!o.dataset)return"";if(o.dataset.expr)return f(this,Gt).exprFunction(o.dataset.expr).call(this,f(this,Gt).data.get(l),l);if(o.dataset.bind)return f(this,Gt).data.get(l,o.dataset.bind)});it(this,"getDisplayValue2",(C,t,l,c,o)=>{var r=f(this,Gt).data.get(C);return this.getDisplayValue(r,C,l,c,o)});it(this,"getDisplayValue",(C,t,l,c,o)=>{var r={code:0,value:""};if(c)r.value=c(C,t);else if(o==null)r.value=C[l];else switch(o.tagName){case"NG-COMBO":var n=o.getAttribute("multi")=="true",s=o.getAttribute("multi-separator")||",",e=o.getAttribute("key")||"key",i=o.getAttribute("value")||e,u=o.dataSource,a=[];if(n)C[l].split(s).forEach(p=>{var m=u.findIndex(d=>p==d[e]);m>=0?a.push(u[m][i]):r.code=-1});else{var h=u.findIndex(p=>C[l]==p[e]);h>=0?a.push(u[h][i]):r.code=-1}r.value=a.length>0?a.join(s):C[l];break;case"NG-CHECKBOX":r.value=C[l],r.value!=null&&r.value!=""&&(r.code=o.dataSource.map(p=>p.value).includes(r.value)?0:-1);break;case"NG-RADIO":r.value=C[l],r.value!=null&&r.value!=""&&!H.isNull(o.dataSource)&&(r.code=o.dataSource.map(p=>p[o.getAttribute("key")||"key"]).includes(r.value)?0:-1);break;default:r.value=C[l];break}return r});it(this,"setRowHeightFitAll",C=>{f(this,nc).call(this,null,C)});Y(this,nc,(C,t)=>{if(!t){t=[];for(var l=0;l<f(this,Gt).template.length;l++)t.push($("th,td",f(this,Gt).template.eq(l)))}for(var c=$(f(this,Gt)).css("font"),o=[],l=0;l<t.length;l++){var r=[];t[l].each((u,a)=>{r.push($(a).css("font")||c)}),o.push(r)}if(C==null)H.j.querySelectorAll(f(this,Gt)).addClass("loading"),setTimeout(()=>{for(var i=0;i<f(this,Gt).data.count();i++)for(var u=0;u<f(this,Gt).template.length;u++){var a=i*f(this,Gt).template.length+u,h=parseInt(a%f(this,Gt).template.length),p=0;$(f(this,Gt).template).eq(a%f(this,Gt).template.length).each((d,b)=>{p=$(b).height()||32});var m=t[h].length==0?p:f(this,Na).call(this,a,t[h],o[h])+12;f(this,Gt).matrix.setHeight(a,p?Math.max(m,p):m)}f(this,Gt).view.redraw(),H.j.querySelectorAll(f(this,Gt)).removeClass("loading")});else{var n=0;$(f(this,Gt).template).eq(C%f(this,Gt).template.length).each((i,u)=>{n=$(u).height()||32});var s=parseInt(C%f(this,Gt).template.length),e=t[s].length==0?n:f(this,Na).call(this,C,t[s],o[s])+12;f(this,Gt).matrix.setHeight(C,n?Math.max(e,n):e),f(this,Gt).view.redraw()}});Y(this,Na,(C,t,l)=>{var c=parseInt(C/f(this,Gt).template.length),o=0,r=f(this,Gt).data.getRow(c);return t.each((n,s)=>{const e=s.dataset.bind,i=f(this,Gt).fields.indexOf(e),u=String(r.v[i]);e&&u.includes(`
673
+ `,tt(this,ae,{container:f(this,Ze).shadowRoot.querySelector(".ng-container-body"),track:this.shadowRoot.querySelector(".ng-scroll-track"),thumb:this.shadowRoot.querySelector(".ng-scroll-thumb"),left:this.shadowRoot.querySelector(".ng-scroll-left"),right:this.shadowRoot.querySelector(".ng-scroll-right")}),f(this,ys),this.shiftX,f(this,tc).call(this)}}Ze=new WeakMap,ys=new WeakMap,ae=new WeakMap,Wr=new WeakMap,Xr=new WeakMap,Us=new WeakMap,tc=new WeakMap,Ca=new WeakMap,ec=new WeakMap,Ea=new WeakMap,rc=new WeakMap,Aa=new WeakMap,Ta=new WeakMap,En=new WeakMap,customElements.get("ng-hscrollbar")||customElements.define("ng-hscrollbar",Jd),customElements.get("ng-vscrollbar")||customElements.define("ng-vscrollbar",Zd);class Qd{constructor(C){Y(this,Xe);Y(this,as);it(this,"initialize",()=>{f(this,Ma).call(this),f(this,Ra).call(this)});Y(this,Ra,()=>{tt(this,as,[]),$(".ng-table thead",f(this,Xe).body).off("click","th,td",f(this,Ia)),$(".ng-table thead",f(this,Xe).body).on("click","th,td",f(this,Ia))});Y(this,Ma,()=>{f(this,Xe).data.sort((C,t)=>C.__ng._[H.ROW.ORIGIN_ORDER]-t.__ng._[H.ROW.ORIGIN_ORDER])});Y(this,Ia,C=>{if(C.target.tagName!="NG-CHECKBOX"&&(C.target=C.target.closest("th,td"),!(C.offsetX<=2)&&!(C.offsetX>=C.target.offsetWidth-2)&&C.target.closest("tr").sectionRowIndex+C.target.rowSpan==C.target.closest("thead").rows.length))switch(C.detail){case 1:H.j.querySelectorAll(f(this,Xe)).addClass("loading"),setTimeout(()=>{f(this,sc).call(this,C),H.j.querySelectorAll(f(this,Xe)).removeClass("loading")});break;case 2:console.log("double click action here");break;default:console.log("higher multi-click actions can be added as needed");break}});Y(this,sc,C=>{var t=C.target.closest("th,td"),l=t.dataset.col,c,o;$(f(this,Xe).template).find(`[data-col="${l}"]`).each((r,n)=>{if(n.dataset.bind)return o=n.dataset.bind,n.dataset.expr&&(c=f(this,Xe).exprFunction(n.dataset.expr)),!1}),o&&(!C.ctrlKey&&!C.shiftKey&&(H.j.querySelectorAll(`thead th:not([data-col="${l}"],thead td:not([data-col="${l}"])`,f(this,Xe).body).removeClass("asc").removeClass("desc"),f(this,as).splice(0,f(this,as).length)),H.removeIf(f(this,as),r=>r.colnm==o),!H.j.querySelectorAll(t).hasClass("asc")&&!H.j.querySelectorAll(t).hasClass("desc")?(H.j.querySelectorAll(t).removeClass("desc").addClass("asc"),f(this,as).push({colnm:o,asc:!0,"expr-func":c})):H.j.querySelectorAll(t).hasClass("asc")?(H.j.querySelectorAll(t).removeClass("asc").addClass("desc"),f(this,as).push({colnm:o,asc:!1,"expr-func":c})):H.j.querySelectorAll(t).removeClass("asc").removeClass("desc"),!H.j.querySelectorAll("thead th,thead td",f(this,Xe).body).hasClass("asc")&&!H.j.querySelectorAll("thead th,thead td",f(this,Xe).body).hasClass("desc")?f(this,Ma).call(this):f(this,Xe).data.sort((r,n)=>f(this,ic).call(this,r,n)),f(this,Xe).paging.type==H.PAGINGTYPE.CLIENT?f(this,Xe).paging.movePage(1):f(this,Xe).view.redraw())});Y(this,ic,(C,t)=>{for(var l of f(this,as))if(l["expr-func"]){const c=f(this,Xe).data.conv(C),o=f(this,Xe).data.conv(t);if(l["expr-func"](c,c.__ng._[H.ROW.INDEX])>l["expr-func"](o,o.__ng._[H.ROW.INDEX]))return l.asc?1:-1;if(l["expr-func"](c,c.__ng._[H.ROW.INDEX])<l["expr-func"](o,o.__ng._[H.ROW.INDEX]))return l.asc?-1:1}else{const c=f(this,Xe).fields.indexOf(l.colnm);if(C.v[c]>t.v[c])return l.asc?1:-1;if(C.v[c]<t.v[c])return l.asc?-1:1}return 0});tt(this,Xe,C),f(this,Ra).call(this)}}Xe=new WeakMap,as=new WeakMap,Ra=new WeakMap,Ma=new WeakMap,Ia=new WeakMap,sc=new WeakMap,ic=new WeakMap;class tf{constructor(C){Y(this,Gt);it(this,"getDisplayValue3",(C,t)=>{const l=parseInt(C/f(this,Gt).template.length),o=f(this,Gt).template[C%f(this,Gt).template.length].querySelector(`[data-col="${t}"]`);if(!o||!o.dataset)return"";if(o.dataset.expr)return f(this,Gt).exprFunction(o.dataset.expr).call(this,f(this,Gt).data.get(l),l);if(o.dataset.bind)return f(this,Gt).data.get(l,o.dataset.bind)});it(this,"getDisplayValue2",(C,t,l,c,o)=>{var r=f(this,Gt).data.get(C);return this.getDisplayValue(r,C,l,c,o)});it(this,"getDisplayValue",(C,t,l,c,o)=>{var r={code:0,value:""};if(c)r.value=c(C,t);else if(o==null)r.value=C[l];else switch(o.tagName){case"NG-COMBO":var n=o.getAttribute("multi")=="true",s=o.getAttribute("multi-separator")||",",e=o.getAttribute("key")||"key",i=o.getAttribute("value")||e,u=o.dataSource,a=[];if(n)C[l].split(s).forEach(p=>{var m=u.findIndex(d=>p==d[e]);m>=0?a.push(u[m][i]):r.code=-1});else{var h=u.findIndex(p=>C[l]==p[e]);h>=0?a.push(u[h][i]):r.code=-1}r.value=a.length>0?a.join(s):C[l];break;case"NG-CHECKBOX":r.value=C[l],r.value!=null&&r.value!=""&&(r.code=o.dataSource.map(p=>p.value).includes(r.value)?0:-1);break;case"NG-RADIO":r.value=C[l],r.value!=null&&r.value!=""&&!H.isNull(o.dataSource)&&(r.code=o.dataSource.map(p=>p[o.getAttribute("key")||"key"]).includes(r.value)?0:-1);break;default:r.value=C[l];break}return r});it(this,"setRowHeightFitAll",C=>{f(this,nc).call(this,null,C)});Y(this,nc,(C,t)=>{if(!t){t=[];for(var l=0;l<f(this,Gt).template.length;l++)t.push($("th,td",f(this,Gt).template.eq(l)))}for(var c=$(f(this,Gt)).css("font"),o=[],l=0;l<t.length;l++){var r=[];t[l].each((u,a)=>{r.push($(a).css("font")||c)}),o.push(r)}if(C==null)H.j.querySelectorAll(f(this,Gt)).addClass("loading"),setTimeout(()=>{for(var i=0;i<f(this,Gt).data.count();i++)for(var u=0;u<f(this,Gt).template.length;u++){var a=i*f(this,Gt).template.length+u,h=parseInt(a%f(this,Gt).template.length),p=0;$(f(this,Gt).template).eq(a%f(this,Gt).template.length).each((d,b)=>{p=$(b).height()||32});var m=t[h].length==0?p:f(this,Na).call(this,a,t[h],o[h])+12;f(this,Gt).matrix.setHeight(a,p?Math.max(m,p):m)}f(this,Gt).view.redraw(),H.j.querySelectorAll(f(this,Gt)).removeClass("loading")});else{var n=0;$(f(this,Gt).template).eq(C%f(this,Gt).template.length).each((i,u)=>{n=$(u).height()||32});var s=parseInt(C%f(this,Gt).template.length),e=t[s].length==0?n:f(this,Na).call(this,C,t[s],o[s])+12;f(this,Gt).matrix.setHeight(C,n?Math.max(e,n):e),f(this,Gt).view.redraw()}});Y(this,Na,(C,t,l)=>{var c=parseInt(C/f(this,Gt).template.length),o=0,r=f(this,Gt).data.getRow(c);return t.each((n,s)=>{const e=s.dataset.bind,i=f(this,Gt).fields.indexOf(e),u=String(r.v[i]);e&&u.includes(`
674
674
  `)&&(o=Math.max(o,H.measureTextSize(u,l[n]).height))}),o});Y(this,Oa,C=>{var t=0;return $(`[data-col=${C}]`,f(this,Gt).template).each((l,c)=>{var o=$(c).css("font");o||(o=$(f(this,Gt)).css("font"));var r=this.getExprFunc(C,c.dataset.bind),n=c.querySelector("ng-combo"),s=0;for(var e of f(this,Gt).data.getValidData()){n&&(n.owner=f(this,Gt));var i=this.getDisplayValue2(s++,C,c.dataset.bind,r,n).value;i&&(t=Math.max(t,H.measureTextSize(i,o).width))}}),t+=$(`[data-col=${C}] ng-combo`,f(this,Gt).template).length>0?40:0,t==0?0:t+8});tt(this,Gt,C),this.___init=()=>{for(var t in this)this[t]instanceof Function&&(f(this,Gt)[t]=this[t].bind(f(this,Gt)))},this.___getColumnInfos=t=>{var l=[];return $(`[data-col=${t}]`,f(this,Gt).template).each((c,o)=>{o.dataset&&o.dataset.bind&&l.push({colnm:o.dataset.bind,font:$(o).css("font")})}),l},this.___getBindCols=t=>{var l=[];return $(`[data-bind=${t}]`,f(this,Gt).template).each((c,o)=>{l.push(parseInt(o.dataset.col))}),l},this.getBand=t=>{const l=$(`.col-indicator[data-col=${t}]`,f(this,Gt).body);if(l.closest(".ng-container-body").length>0)return H.BAND.BODY;if(l.closest(".ng-container-left").length>0)return H.BAND.LEFT;if(l.closest(".ng-container-right").length>0)return H.BAND.RIGHT},this.setColumnWidth=(t,l)=>{l=parseInt(l);const c=this.getBand(t);if(f(this,Gt).body.querySelector(`colgroup [data-col="${t}"]:not(.cdummy)`).setAttribute("width",l),c!=H.BAND.BODY){var l=0;$(`.ng-container-${c} col`,f(this,Gt).body).each((r,n)=>{l+=parseInt(n.getAttribute("width"))}),$(`.ng-container-${c}`,f(this,Gt).body).css({width:l,"min-width":l})}},this.getExprFunc=(t,l)=>{const c=H.j.querySelectorAll(l?`[data-col="${t}"][data-bind="${l}"]`:`[data-col="${t}"]`,f(this,Gt).tmpl).elem(),o=c?c.getAttribute("data-expr"):null;return o?f(this,Gt).exprFunction(o):null},this.setColumnWidthFit=(t,l,c)=>{if(c==null&&(c=!0),c)H.j.querySelectorAll(f(this,Gt)).addClass("loading"),setTimeout(()=>{var r=f(this,Oa).call(this,t);this.setColumnWidth(t,l?Math.max(r,l):r),H.j.querySelectorAll(f(this,Gt)).removeClass("loading")});else{var o=f(this,Oa).call(this,t);this.setColumnWidth(t,l?Math.max(o,l):o)}},this.insertCol=(t,l,c)=>{if(!["string","number"].includes(typeof t))throw`invalid argument : "${t}"`;if(typeof t=="string"){var o=this.___getBindCols(t);if(o.length<=0)throw`invalid argument : "${t}"`;t=o[0]}var r=u=>{var a=$(`.col-indicator[data-col=${u}]`,f(this,Gt).body);if(a.length<=0)throw"missing col";return $(l).find("col").each((h,p)=>{var m=p.getAttribute("width")||100;const d=document.createElement("th");d.setAttribute("scope","col"),H.j.querySelectorAll(d).addClass("col-indicator"),$(d).html("<div></div>").insertBefore(a).css({width:m,"min-width":m})}),a},n=r(t),s=(u,a)=>{var h=$(l).find(`${u} tr`),p=$(`${u} tr`,n.closest("table")).not(".col-indicator-rowgroup").not(".nodata"),m=0;$("th,td",h.eq(0)).each((b,g)=>{m+=g.colSpan});var d=0;p.each((b,g)=>{var S=$(g).find(`[data-col=${a}]`);if(S.length>0)$(h).eq(d).find("th,td").each((E,I)=>{g.insertBefore(I,S[0])}),d++;else for(var b=a-1;b>=0;b--){var S=$(`[data-col=${b}]`,g);if(S.length>0){S[0].colSpan+=m;break}}})},e=(u,a)=>{var h=$(l).find(`${u} tr`),p=$(`${u} tr`,n.closest("table")).not(".col-indicator-rowgroup").not(".nodata"),m=0;$("th,td",h.eq(0)).each((d,b)=>{m+=b.colSpan}),p.each((d,b)=>{var g=$(b).find(`[data-col=${a}]`);if(g.length>0)$(h).eq(parseInt(b.sectionRowIndex%f(this,Gt).template.length)).find("th,td").each((S,E)=>{b.insertBefore($(E).clone()[0],g[0])});else for(var d=a-1;d>=0;d--){var g=$(`[data-col=${d}]`,b);if(g.length>0){g[0].colSpan+=m;break}}})},i=(u,a)=>{var h=$(l).find(`${u} tr`),p=f(this,Gt).template,m=0;$("th,td",h.eq(0)).each((b,g)=>{m+=g.colSpan});var d=0;p.each((b,g)=>{var S=$(g).find(`[data-col=${a}]`);if(S.length>0)$(h).eq(d).find("th,td").each((E,I)=>{g.insertBefore(I,S[0])}),d++;else for(var b=a-1;b>=0;b--){var S=$(`[data-col=${b}]`,g);if(S.length>0){S[0].colSpan+=m;break}}})};s("thead",t),s("tfoot",t),e("tbody",t),i("tbody",t),f(this,Gt).resetTemplate(),f(this,Gt).dataManager.viewRecords.touch()},this.___init()}}Gt=new WeakMap,nc=new WeakMap,Na=new WeakMap,Oa=new WeakMap;class ef{constructor(C){this.___owner=C,this.columns_BAK={getBindCol:(t,l)=>this.___getBindCol(t,l),insert:(t,l,c)=>this.___insertCol(t,l,c)},this.___getBindCol=(t,l)=>{l==null&&(l=!0);var c=[];return $(this.___owner.template).find("th,td").each((o,r)=>{r.dataset.bind==t&&c.push(parseInt(r.dataset.col))}),c.length>0?l?c[0]:c[c.length-1]:-1},this.___insertCol=(t,l,c)=>{if(!["string","number"].includes(typeof t))throw`invalid argument : "${t}"`;typeof t=="string"&&(t=this.___getBindCol(t));var o=s=>{var e=$(`.col-indicator[data-col=${s}]`,this.___owner.body);return e.length>0&&$(l).find("col").each((i,u)=>{var a=u.getAttribute("width")||100;const h=document.createElement("th");h.setAttribute("scope","col"),H.j.querySelectorAll(h).addClass("col-indicator"),$(h).html("<div></div>").insertBefore(e).css({width:a,"min-width":a})}),e},r=o(t);if(r.length<=0)throw"missing col";var n=(s,e)=>{r.closest("table").find(`${s} tr`).each((i,u)=>{if(s=="thead"&&u.rowIndex==0)return!0;var a=$(u).find(`th[data-col=${e}],td[data-col=${e}]`);if(a.length>0){var h=i%this.___owner.template.length;$(l).find(`${s} tr`).eq(h).find("th,td").each((m,d)=>{u.insertBefore(d,a[0])})}else for(var p=e-1;p>=0;p--){var a=$(u).find(`th[data-col=${p}],td[data-col=${p}]`);if(a.length>0){$(l).find(`${s} tr`).eq(0).find("th,td").each((d,b)=>{a[0].colSpan+=b.colSpan});break}}})};n("thead",t),n("tfoot",t),n("tbody.bindable",t),this.___owner.template.each((s,e)=>{var i=$(e).find(`th[data-col=${t}],td[data-col=${t}]`);if(i.length>0){var u=s%this.___owner.template.length;$(l).find("tbody.bindable tr").eq(u).find("th,td").each((h,p)=>{e.insertBefore(p,i[0])})}else for(var a=t-1;a>=0;a--){var i=$(e).find(`th[data-col=${a}],td[data-col=${a}]`);if(i.length>0){$(l).find("tbody.bindable tr").eq(0).find("th,td").each((p,m)=>{i[0].colSpan+=m.colSpan});break}}}),this.___owner.resetTemplate()},this.height=(t,l)=>{var c=$(".ng-table tbody.bindable tr",this.___owner.body);return c.each((o,r)=>{t==r.sectionRowIndex&&($("canvas.chart",r).css({height:l-4}),$(r).css({height:l}))}),l=0,c.each((o,r)=>{t==r.sectionRowIndex&&(l=Math.max($(r).height(),l))}),l=parseInt(l),c.each((o,r)=>{t==r.sectionRowIndex&&($(r).css({height:l}),$(r).height(l))}),l},this.getElement=(t,l,c)=>{var o;return $(`.ng-table ${t} th,.ng-table ${t} td`,this.___owner.body).each((r,n)=>{var s=$(n).offset();if(c>=s.left&&c<=s.left+$(n).width()&&l==n.closest("tr").sectionRowIndex)return o=n,!1}),o},this.getElements=(t,l)=>{var c=[];return $(`.ng-table ${t} th,.ng-table ${t} td`,this.___owner.body).each((o,r)=>{var n=$(r).offset();l>=n.left&&l<=n.left+$(r).width()&&c.push(r)}),c},this.mergeCell=(t,l,c,o)=>{t=Math.min(t,l),l=Math.max(t,l),c=Math.min(c,o),o=Math.max(c,o);for(var r=c;r<=o;r++)$(".ng-table tbody.bindable",this.___owner.body).rowspan(r,t,l);$(".ng-table tbody.bindable",this.___owner.body).colspan(t,c,o)},this.prev=t=>{var l=t.closest("tr");if(l){var c=l.closest("tbody")?"tbody.bindable":l.closest("thead")?"thead":"tfoot",o=$(t).prev(t.tagName);if(o.length<=0){var r=!!t.closest(".ng-container-right"),n=!!t.closest(".ng-container-body");n?o=$(".ng-container-left > table > "+c+" > tr",this.___owner.body).eq(l.sectionRowIndex).find("th:not(.dummy):last-child,td:not(.dummy):last-child"):r&&(o=$(".ng-container-body > table > "+c+" > tr",this.___owner.body).eq(l.sectionRowIndex).find("th:not(.dummy):last-child,td:not(.dummy):last-child"))}return o}},this.next=t=>{var l=t.closest("tr");if(l){var c=l.closest("tbody")?"tbody.bindable":l.closest("thead")?"thead":"tfoot",o=$(t).next(t.tagName);if(o.length<=0){var r=!!t.closest(".ng-container-left"),n=!!t.closest(".ng-container-body");n?o=$(".ng-container-right > table > "+c+" > tr",this.___owner.body).eq(l.sectionRowIndex).find("th:first-child,td:first-child"):r&&(o=$(".ng-container-body > table > "+c+" > tr",this.___owner.body).eq(l.sectionRowIndex).find("th:first-child,td:first-child"))}return o}},this.isFirst=t=>{var l=this.prev(t);return!l||l.length<=0},this.isLast=t=>{var l=this.next(t);return!l||l.length<=0}}get rows(){for(var C=this.___owner.body.querySelector(".ng-container-body .ng-table").rows,t=this.___owner.body.querySelector(".ng-container-left .ng-table").rows,l=this.___owner.body.querySelector(".ng-container-right .ng-table").rows,c=[],o=0;o<t.length;o++)c.push(t[o]);for(var o=0;o<C.length;o++)c.push(C[o]);for(var o=0;o<l.length;o++)c.push(l[o]);return c}}class rf extends ei{constructor(){super();Y(this,vs);it(this,"dataRefresh",t=>{$(f(this,vs)).val(this.value),t||this.reset()})}connectedCallback(){if(this.shadowRoot.innerHTML=`
675
675
  <style>
676
676
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngTextArea.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,ws,()=>{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(hs.log("1111111"),f(this,Ja))return;hs.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,ls);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,ls)[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,ws,()=>{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(Gr.log("1111111"),f(this,Ja))return;Gr.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,ls).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),hs.log("==============================="),hs.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,ws).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,Ys).call(this,t),n=f(this,Ys).call(this,c),s=f(this,Gs).call(this,l),e=f(this,Gs).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,Ys).call(this,t),o=H.isNull(oRow2)?c:f(this,Ys).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,Gs).call(this,t),o=H.isNull(l)?c:f(this,Gs).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,Ys).call(this,t),r=f(this,Gs).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,Ys,t=>{if(typeof t=="number")return t;if(typeof t=="function")return this.data.findIndex(t);throw`invalid ${t}`});Y(this,Gs,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,ws).call(this);break;case"auto-fit-col":f(this,_i)&&f(this,_i).autoFit(c=="true"),f(this,ws).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,ws).call(this);break;case"show-tfoot":$("tfoot",this.body).css({visibility:c=="true"?"unset":"collapse"}),f(this,ws).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,ws).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,ws=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,Ys=new WeakMap,Gs=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,xs);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,xs,{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,xs).x,top:t.pageY-f(this,xs).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,xs,{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,xs).x,top:t.changedTouches[0].pageY-f(this,xs).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,ls))$(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,ls)[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,ls)),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),Gr.log("==============================="),Gr.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,ws).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,hs,(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,hs).call(this,$(t),"thead"),f(this,hs).call(this,$(t),"tbody.bindable"),f(this,hs).call(this,$(t),"tbody.fixed"),f(this,hs).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,hs).call(this,t,"thead"),f(this,hs).call(this,t,"tbody"),f(this,hs).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,Ys).call(this,t),n=f(this,Ys).call(this,c),s=f(this,Gs).call(this,l),e=f(this,Gs).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,Ys).call(this,t),o=H.isNull(oRow2)?c:f(this,Ys).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,Gs).call(this,t),o=H.isNull(l)?c:f(this,Gs).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,Ys).call(this,t),r=f(this,Gs).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,Ys,t=>{if(typeof t=="number")return t;if(typeof t=="function")return this.data.findIndex(t);throw`invalid ${t}`});Y(this,Gs,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,ls,[]),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,ls)}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,ws).call(this);break;case"auto-fit-col":f(this,_i)&&f(this,_i).autoFit(c=="true"),f(this,ws).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,ws).call(this);break;case"show-tfoot":$("tfoot",this.body).css({visibility:c=="true"?"unset":"collapse"}),f(this,ws).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,ws).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,ls=new WeakMap,tl=new WeakMap,el=new WeakMap,xc=new WeakMap,ws=new WeakMap,_c=new WeakMap,rl=new WeakMap,Sc=new WeakMap,hs=new WeakMap,kc=new WeakMap,sl=new WeakMap,Cc=new WeakMap,il=new WeakMap,Ys=new WeakMap,Gs=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,xs);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,xs,{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,xs).x,top:t.pageY-f(this,xs).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,xs,{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,xs).x,top:t.changedTouches[0].pageY-f(this,xs).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")||""}