@ninebone/grid 0.0.5 → 0.0.7

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.
@@ -717,7 +717,7 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
717
717
  <div></div>
718
718
  <span class="text">${this.displayValue}</span>
719
719
  </div>
720
- `,super.connectedCallback(),tt(this,$a,this.shadowRoot.querySelector("div.ng-pad")),tt(this,La,this.shadowRoot.querySelector("span"))}get prevLevel(){var t=parseInt(this.closest("tr").sectionRowIndex/this.owner.template.length);if(!this.owner.dataManager.viewRecords)return-1;if(t!=0){var l=this.owner.data.getNF(t-1);return l[this.cell.dataset.bind]}else for(var c=parseInt(this.cell.dataset.row)-1;c>=0;c--){var o=this.owner.data.get(c);if(!o.__ng._[H.ROW.EXPAND])return o[this.cell.dataset.bind]}return-1}}$a=new WeakMap,La=new WeakMap,Pa=new WeakMap,yi=new WeakSet,Ol=function(){return this.data.__ng._[H.ROW.EXPAND]},sc=new WeakMap,ic=new WeakMap,nc=new WeakMap,oc=new WeakMap,uu=new WeakMap,Da=new WeakMap,Ba=new WeakMap,ac=new WeakMap,lc=new WeakMap,hc=new WeakMap,customElements.get("ng-tree-item")||customElements.define("ng-tree-item",ef);class rf{constructor(C){Y(this,yt);Y(this,Ge);Y(this,wr);Y(this,vi);Y(this,wi,[]);it(this,"init",()=>{tt(this,wr,{body:$(".ng-container-body",f(this,yt).body).height()||0,thead:$(".ng-container-body thead",f(this,yt).body).height()||0,tfoot:$(".ng-container-body tfoot",f(this,yt).body).height()||0}),!f(this,vi)&&($(".ng-container tbody.bindable tr.nodata",f(this,yt).body).height(f(this,wr).body),tt(this,vi,!0))});it(this,"redraw",()=>{f(this,yt).touchEvent.scrollTop(),this.init(),f(this,yt).dataManager&&(tt(this,Ge,f(this,yt).dataManager.viewRecords.rawIndex||0),f(this,cc).call(this),f(this,kn).call(this),f(this,yt).body.querySelector("ng-vscrollbar").refresh())});it(this,"redrawV2",()=>{f(this,yt).touchEvent.scrollTop(),this.init(),tt(this,Ge,f(this,yt).dataManager.viewRecords.rawIndex||0),f(this,uc).call(this),f(this,kn).call(this),f(this,yt).body.querySelector("ng-vscrollbar").refreshV2()});it(this,"redrawV3",()=>{this.init(),tt(this,Ge,f(this,yt).dataManager.viewRecords.rawIndex||0),f(this,kn).call(this)});Y(this,Fa,()=>{var C=0;return $(".ng-container-body tbody.fixed tr",f(this,yt).body).each((t,l)=>{l.data&&l.data.__ng&&(C+=f(this,yt).matrix.getHeight(l.data.__ng.height[parseInt(t%f(this,yt).template.length)]))}),C});Y(this,qa,()=>{var C=f(this,Fa).call(this);const t=parseInt(f(this,Ge)*f(this,yt).template.length);return $(".ng-container-body tbody.bindable tr:not(.nodata)",f(this,yt).body).each((l,c)=>{C+=f(this,yt).matrix.getHeight(t+l)}),C});Y(this,Ha,()=>{const C=parseInt(f(this,yt).getAttribute("display-row-count"));if(f(this,yt).closest("dialog")&&H.j.querySelectorAll(f(this,yt)).hasClass("simple"))return 1;if([H.PAGINGTYPE.CLIENT,H.PAGINGTYPE.SERVER].includes(f(this,yt).paging.type))return f(this,yt).paging.linesPerPage;if(!isNaN(C))return f(this,Ge)+C>f(this,yt).data.count()&&(tt(this,Ge,C>=f(this,yt).data.count()?0:f(this,yt).data.count()-C),f(this,yt).dataManager.viewRecords.rawIndex=f(this,Ge)),C;const t=f(this,wr).body-f(this,wr).thead-f(this,wr).tfoot-f(this,Fa).call(this);for(var l=0,c=0;c<t;)c+=this.getRowHeight(f(this,Ge)+l++);if(f(this,Ge)+l>f(this,yt).data.count()){l=0,c=0;for(var o=f(this,yt).data.count()-1;o>=0&&c<t;o--)c+=this.getRowHeight(o),l++;c>t&&l--,tt(this,Ge,f(this,yt).data.count()-l),f(this,yt).dataManager.viewRecords.rawIndex=f(this,Ge)}return l});Y(this,za,()=>{var C=f(this,Ha).call(this),t=$(".ng-container-body tbody.bindable tr",f(this,yt).body).not("tr.nodata").length/(f(this,yt).template.length||1);const l=f(this,yt).template.clone(),c=l.clone(),o=l.clone();l.find("th,td").not("[fixed=left]").remove(),c.find("th,td").not("[fixed=right]").remove(),o.find("th[fixed=left],td[fixed=left],th[fixed=right],td[fixed=right]").remove();const r=$("tr.nodata",f(this,yt).body.querySelector(".ng-container-left")),n=$("tr.nodata",f(this,yt).body.querySelector(".ng-container-right")),s=$("tr.nodata",f(this,yt).body.querySelector(".ng-container-body"));for(var e=t;e<C;e++)l.each((u,a)=>{r.before(a.outerHTML)}),c.each((u,a)=>{n.before(a.outerHTML)}),o.each((u,a)=>{s.before(a.outerHTML)});return;var i;if(i.length>0)var t});Y(this,Ua,()=>{var C=Math.min(f(this,Ha).call(this),f(this,yt).data.count());$(".ng-container tbody.bindable tr:not(.nodata)",f(this,yt).body).each((t,l)=>{parseInt(l.sectionRowIndex/f(this,yt).template.length)>=C&&$(l).remove()}),f(this,yt).body.querySelectorAll(".ng-container tbody.bindable tr:not(.nodata)").forEach(t=>{f(this,Ge)+parseInt(t.sectionRowIndex/f(this,yt).template.length)>=f(this,yt).data.count()&&$(t).remove()})});Y(this,cc,()=>{f(this,za).call(this),f(this,Ua).call(this);var C=f(this,wr).body-f(this,wr).thead-f(this,wr).tfoot-f(this,qa).call(this);if(f(this,yt).getAttribute("display-row-count")&&f(this,yt).data.count()>=Number(f(this,yt).getAttribute("display-row-count")||0)&&(C=0),$(".ng-container tbody.bindable tr.nodata",f(this,yt).body).height(C),f(this,yt).closest("dialog")&&H.j.querySelectorAll(f(this,yt)).hasClass("simple")){$("tr.nodata",f(this,yt).body).height(0);var C=47;$(".ng-container-body tbody.bindable tr",f(this,yt).body).not(".nodata").each((l,c)=>{C+=$(c).height()}),$(f(this,yt).closest("dialog")).height(C)}});Y(this,uc,()=>{f(this,za).call(this),f(this,Ua).call(this),f(this,yt).isLastPage});Y(this,dc,()=>{for(const C of f(this,wi))clearTimeout(C);tt(this,wi,[]),f(this,wi).push(setTimeout(()=>{tt(this,vi,!1);var C=$(".ng-container-body tbody.bindable tr",f(this,yt).body).not(".nodata"),t=$(".ng-container-left tbody.bindable tr",f(this,yt).body).not(".nodata"),l=$(".ng-container-right tbody.bindable tr",f(this,yt).body).not(".nodata");if(C.length>0){var c=parseInt(C[0].dataset.row*f(this,yt).template.length);C.each((r,n)=>{var s=f(this,yt).matrix.getHeight(c+r);$("canvas.chart",n).css({height:s-4}),$("canvas.chart",t.eq(r)).css({height:s-4}),$("canvas.chart",l.eq(r)).css({height:s-4}),$(n).css({height:s}).height(s),t.eq(r).css({height:s}).height(s),l.eq(r).css({height:s}).height(s)})}f(this,yt).cell.refresh(),$("ng-row-indicator",f(this,yt).body).each((r,n)=>{n.refresh()});var o=f(this,wr).body-f(this,wr).thead-f(this,wr).tfoot-f(this,qa).call(this);f(this,yt).getAttribute("display-row-count")&&f(this,yt).data.count()>=Number(f(this,yt).getAttribute("display-row-count")||0)&&(o=0),$(".ng-container tbody.bindable tr.nodata",f(this,yt).body).height(o),f(this,yt).refreshBindRows(),f(this,yt).refreshData(),f(this,yt).paging.totalCount=f(this,yt).data.countNF(),f(this,yt).body.querySelector("ng-vscrollbar").refresh(),H.j.querySelectorAll(".ng-table tbody tr",f(this,yt).body).removeClass("hover"),H.j.querySelectorAll(f(this,yt)).removeClass("loading"),H.j.querySelectorAll("ng-filter-panel").removeClass("loading")},300)),f(this,wi).push(setTimeout(()=>{f(this,yt).refreshDataV2()}))});Y(this,kn,()=>{var C=[];f(this,yt).body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)").forEach(t=>{C.push(f(this,Ge)+parseInt(t.sectionRowIndex/f(this,yt).template.length))}),C=[...new Set(C)],f(this,yt).body.querySelectorAll(".ng-container tbody.bindable tr:not(.nodata)").forEach(t=>{const l=parseInt(t.sectionRowIndex/f(this,yt).template.length);t.dataset.row=C[l],t.dataset.matrixRow=parseInt(C[l]*f(this,yt).template.length)+parseInt(t.sectionRowIndex%f(this,yt).template.length);for(const c of t.cells)c.dataset.row=t.dataset.row,c.dataset.matrixRow=t.dataset.matrixRow}),C.forEach(t=>{const l=f(this,yt).data.get(t);f(this,yt).body.querySelectorAll(`.ng-container tbody.bindable tr[data-row="${t}"]`).forEach(c=>{c.data=l})}),tt(this,Ge,parseInt(f(this,yt).body.querySelector(".ng-container-body tbody.bindable tr:first-of-type").getAttribute("data-row"))),f(this,yt).dataManager.viewRecords.rawIndex=f(this,Ge),f(this,dc).call(this),f(this,yt).isFirstPage=f(this,Ge)==0,f(this,yt).isLastPage=C[C.length-1]==f(this,yt).data.count()-1});it(this,"getVisibleFirstRow",()=>{var C=f(this,yt).body.querySelector(".ng-container-body tbody.bindable tr:first-child");return parseInt(C.dataset.row)});it(this,"getVisibleLastRow",()=>{var C=f(this,yt).body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)");return C.length>0?parseInt(C[C.length-1].dataset.row):-1});it(this,"getRowHeight",C=>{let t=0;for(var l=0;l<f(this,yt).template.length;l++)t+=f(this,yt).matrix.getHeight(parseInt(C*f(this,yt).template.length+l));return t});it(this,"getTranslateY",()=>{const C=f(this,yt).body.querySelector(".ng-container-body tbody.bindable");return!C||!C.style||!C.style.transform?0:parseFloat(C.style.transform.replace("translateY(","").replace(")",""))});it(this,"getTotalSpace",()=>$(f(this,yt).body.querySelector(".ng-container-body")).height()-($(f(this,yt).body.querySelector(".ng-container-body thead")).height()||0)-($(f(this,yt).body.querySelector(".ng-container-body tfoot")).height()||0)-($(f(this,yt).body.querySelector(".ng-container-body tbody.fixed")).height()||0));it(this,"fitPage",()=>{const C=this.getVisibleLastRow(),t=this.getTotalSpace();if(C==f(this,yt).data.count()-1){for(var l=0,c=C;c>=0;c--)if(l+=this.getRowHeight(c),l>t){f(this,yt).scrollTo(c+1);break}}});it(this,"selectArea",(C,t,l,c)=>{const o=f(this,Us).call(this,C),r=f(this,Us).call(this,l),n=f(this,Vs).call(this,t),s=f(this,Vs).call(this,c),e=parseInt(o*f(this,yt).template.length),i=parseInt(r*f(this,yt).template.length)+f(this,yt).template.length-1;f(this,yt).row.at=o,o>=0&&r>=0?f(this,yt).selection.selectArea(e,n,i,s):this.clearSelection()});it(this,"selectRow",(C,t)=>{const l=f(this,Us).call(this,C),c=H.isNull(t)?l:f(this,Us).call(this,t),o=parseInt(l*f(this,yt).template.length),r=parseInt(c*f(this,yt).template.length)+f(this,yt).template.length-1;f(this,yt).row.at=l,l>=0&&c>=0?f(this,yt).selection.selectArea(o,f(this,yt).firstCol,r,f(this,yt).lastCol):this.clearSelection()});it(this,"selectCol",(C,t)=>{const l=f(this,Vs).call(this,C),c=H.isNull(t)?l:f(this,Vs).call(this,t),o=0,r=parseInt(f(this,yt).data.count()*f(this,yt).template.length-1);l>=0&&c>=0?f(this,yt).selection.selectArea(o,l,r,c):this.clearSelection()});it(this,"selectCell",(C,t,l)=>{const c=f(this,Us).call(this,C),o=f(this,Vs).call(this,t),r=parseInt(c*f(this,yt).template.length)+H.nvl(l,0);f(this,yt).row.at=c,c>=0?f(this,yt).selection.selectArea(r,o,r,o):this.clearSelection()});Y(this,Us,C=>{if(typeof C=="number")return C;if(typeof C=="function")return f(this,yt).data.findIndex(C);throw`invalid ${C}`});Y(this,Vs,C=>{if(typeof C=="number")return C;if(typeof C=="string"&&f(this,yt).fields.includes(C))return parseInt($(`[data-bind="${C}"]`,f(this,yt).template)[0].dataset.col);throw`invalid ${C}`});it(this,"moveTo",C=>{f(this,yt).scrollTo(C)});tt(this,yt,C),tt(this,vi,!1),this.init()}}yt=new WeakMap,Ge=new WeakMap,wr=new WeakMap,vi=new WeakMap,wi=new WeakMap,Fa=new WeakMap,qa=new WeakMap,Ha=new WeakMap,za=new WeakMap,Ua=new WeakMap,cc=new WeakMap,uc=new WeakMap,dc=new WeakMap,kn=new WeakMap,Us=new WeakMap,Vs=new WeakMap;class sf{constructor(C){Y(this,Je);Y(this,Ws);it(this,"initialize",()=>{tt(this,Ws,!1),f(this,Je).data.clearFilter()});it(this,"isFiltering",()=>f(this,Ws));it(this,"on",C=>{tt(this,Ws,!0);const t=f(this,fc).call(this);f(this,Je).body.querySelectorAll(".ng-table thead th, .ng-table thead td").forEach(l=>{var o,r;const c=(o=l.closest("tr"))==null?void 0:o.sectionRowIndex;if(c!==void 0&&c+l.rowSpan-1===t){const n=Array.from(f(this,Je).activeTmpl.querySelectorAll(`[data-col="${l.dataset.col}"]`)).map(s=>s.dataset.bind?{colnm:s.dataset.bind,data:[]}:null).filter(Boolean);if(n.length>0){(r=l.querySelector("ng-filter-button"))==null||r.remove();const s=document.createElement("ng-filter-button");l.appendChild(s),s.filterOptions=n}}})});it(this,"off",()=>{tt(this,Ws,!1),f(this,Je).body.querySelectorAll(".ng-table ng-filter-button").forEach(C=>{C.remove()})});it(this,"set",C=>{this.on();let t=Array.isArray(C)?Object.fromEntries(Object.keys(C[0]).map(l=>[l,[...new Set(C.map(c=>c[l]))]])):C;f(this,Je).data.clearFilter(),Object.entries(t).forEach(([l,c])=>{const o=f(this,Je).fields.indexOf(l);f(this,Je).data.getValidData().some(r=>typeof r.v[o]=="number")&&(c=c.map(Number)),f(this,Je).data.getValidData().filter(r=>c.nineBinarySearch(r.v[o]||"")<0).forEach(r=>{r.__ng.filtered=!0})}),f(this,Je).data.refreshFilter(),f(this,Je).shadowRoot.querySelectorAll("ng-filter-button").forEach(l=>{l.filterOptions.forEach(c=>{c.data=[]})}),Object.entries(t).forEach(([l,c])=>{f(this,Je).shadowRoot.querySelectorAll("ng-filter-button").forEach(o=>{let r=o.filterOptions;r.forEach(n=>{n.colnm===l&&(n.data=c)}),o.filterOptions=r})}),f(this,Je).scrollTo_V1(0),f(this,Je).paging.reset()});Y(this,fc,(C="thead")=>[...f(this,Je).body.querySelectorAll(`.ng-table ${C}`)].reduce((t,l)=>Math.max(l.rows.length-1,t),0));tt(this,Je,C),tt(this,Ws,!1);const t=document.createElement("ng-filter-panel");t.style.display="none",f(this,Je).shadowRoot.appendChild(t)}}Je=new WeakMap,Ws=new WeakMap,fc=new WeakMap;class nf extends HTMLElement{constructor(){super();Y(this,Va);Y(this,Cn);Y(this,Wa,t=>{var o;t.preventDefault(),t.stopPropagation();const l=f(this,Va).shadowRoot.querySelector("ng-filter-panel"),c=(o=this.closest("th,td"))==null?void 0:o.dataset.col;l.col===c?l.close():l.open(this)})}connectedCallback(){tt(this,Va,this.getRootNode().host),this.removeEventListener("click",f(this,Wa)),this.addEventListener("click",f(this,Wa))}get filterOptions(){return f(this,Cn)}set filterOptions(t){tt(this,Cn,t),this.classList.toggle("filtered",f(this,Cn).some(l=>l.data.length>0))}}Va=new WeakMap,Cn=new WeakMap,Wa=new WeakMap;class of extends HTMLElement{constructor(){super();Y(this,Mr);Y(this,Xa);Y(this,Ya);Y(this,pc,t=>{const l=this.shadowRoot.querySelector("nine-grid");this.classList.add("loading"),setTimeout(()=>{const[c,o,r,n]=["LVL","CHK","COLNM","DATA"].map(u=>l.fields.indexOf(u)),s=l.data.getValidDataNF().filter(u=>u.v[c]===2&&u.v[o]==="Y"),e=s.length>0?[...new Set(s.map(u=>u.v[r]))].map(u=>({colnm:u,data:[...new Set(l.data.getValidData().filter(a=>a.v[o]==="Y"&&a.v[r]===u).map(a=>a.v[n]||""))].sort()})):[];f(this,Xa).filterOptions=e;const i=Object.fromEntries([...f(this,Mr).body.querySelectorAll("ng-filter-button")].flatMap(u=>u.filterOptions).filter(u=>u.data.length>0).map(u=>[u.colnm,u.data]));f(this,Mr).filtering.set(i),this.classList.remove("loading"),this.style.display="none"})});Y(this,mc,t=>{this.style.display="none"});Y(this,gc,t=>{const l=this.shadowRoot.querySelector("nine-grid"),c=l.fields.indexOf("CHK"),o=t.target.checked;l.data.getValidData().forEach(r=>{r.v[c]=o?"Y":"N"}),l.refreshData()});Y(this,bc,t=>{const l=this.shadowRoot.querySelector("nine-grid");l.classList.add("loading");const c=l.dataManager.rawRecords;c.forEach(s=>{s.__ng.filtered=!1});const o=t.target.value.toLowerCase(),[r,n]=["LVL","DATA"].map(s=>l.fields.indexOf(s));c.forEach(s=>{s.__ng.filtered=s.v[r]===2&&!String(s.v[n]||"").toLowerCase().includes(o)}),l.data.resetRecords(),clearTimeout(f(this,Ya)),tt(this,Ya,setTimeout(()=>{l.dataManager.viewRecords.reset(),l.dataManager.viewRecords.touch()},200))});it(this,"close",()=>{this.col=null,this.style.display="none"});it(this,"open",t=>{const l=t.closest("th,td"),{left:c}=t.getBoundingClientRect(),{left:o,width:r,top:n}=f(this,Mr).getBoundingClientRect(),{top:s,height:e}=l.getBoundingClientRect(),{width:i}=this.getBoundingClientRect();let u=Math.max(0,c-o);u=Math.min(u,r-i-5);const a=s+e-n;Object.assign(this.style,{left:`${u}px`,top:`${a}px`,display:"flex"}),this.classList.add("loading"),this.shadowRoot.querySelector("input[type=text]").value="",setTimeout(()=>{const h=f(this,Mr).data.getValidDataNF(),p=l.dataset.col;this.col=p,tt(this,Xa,t);const m=t.filterOptions.map((g,S)=>{const E=`<span class="group">${l.textContent}${t.filterOptions.length>1?` #${S+1} (${g.colnm})`:""}</span>`,I=f(this,Mr).activeTmpl.querySelector(`[data-col="${p}"][data-bind="${g.colnm}"]`),D=I==null?void 0:I.getAttribute("data-expr"),z=D?f(this,Mr).exprFunction(D):null,P=h.map(B=>{const F=f(this,Mr).fields.indexOf(g.colnm);return D?{v:B.v[F],v2:z(f(this,Mr).data.conv(B),B.__ng.rowidx,f(this,Mr).data)}:{v:B.v[F],v2:B.v[F]}});return[{LVL:1,CHK:"N",DATA2:E},...[...new Set(P.map(JSON.stringify))].map(JSON.parse).sort((B,F)=>(B.v2||"")>(F.v2||"")?1:(B.v2||"")<(F.v2||"")?-1:0).map(B=>({LVL:2,DATA:B.v,DATA2:B.v2||` <span class="empty">(empty)</span> ${B.v}`,COLNM:g.colnm,CHK:g.data.length===0||g.data.nineBinarySearch(B.v||"")>=0?"Y":"N"}))]}).flat(),d=this.shadowRoot.querySelector("nine-grid");d.fields.add(["DATA","DATA2","COLNM"]),d.data.set(m);const b=this.shadowRoot.querySelector("input[type=checkbox]");b.checked=d.data.getValidData().every(g=>!(g.LVL===2&&g.CHK!=="Y")),this.shadowRoot.querySelector("input").focus(),this.classList.remove("loading")})});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Mr,this.getRootNode().host);const t=this.getRootNode().host.closest("nine-grid").getAttribute("css-path")||"",l=nine.cssPath?`@import "${nine.cssPath}/ninegrid/ngFilterPanel.css";`:"";console.log("==========="),console.log(nine.cssPath),this.shadowRoot.innerHTML=`
720
+ `,super.connectedCallback(),tt(this,$a,this.shadowRoot.querySelector("div.ng-pad")),tt(this,La,this.shadowRoot.querySelector("span"))}get prevLevel(){var t=parseInt(this.closest("tr").sectionRowIndex/this.owner.template.length);if(!this.owner.dataManager.viewRecords)return-1;if(t!=0){var l=this.owner.data.getNF(t-1);return l[this.cell.dataset.bind]}else for(var c=parseInt(this.cell.dataset.row)-1;c>=0;c--){var o=this.owner.data.get(c);if(!o.__ng._[H.ROW.EXPAND])return o[this.cell.dataset.bind]}return-1}}$a=new WeakMap,La=new WeakMap,Pa=new WeakMap,yi=new WeakSet,Ol=function(){return this.data.__ng._[H.ROW.EXPAND]},sc=new WeakMap,ic=new WeakMap,nc=new WeakMap,oc=new WeakMap,uu=new WeakMap,Da=new WeakMap,Ba=new WeakMap,ac=new WeakMap,lc=new WeakMap,hc=new WeakMap,customElements.get("ng-tree-item")||customElements.define("ng-tree-item",ef);class rf{constructor(C){Y(this,yt);Y(this,Ge);Y(this,wr);Y(this,vi);Y(this,wi,[]);it(this,"init",()=>{tt(this,wr,{body:$(".ng-container-body",f(this,yt).body).height()||0,thead:$(".ng-container-body thead",f(this,yt).body).height()||0,tfoot:$(".ng-container-body tfoot",f(this,yt).body).height()||0}),!f(this,vi)&&($(".ng-container tbody.bindable tr.nodata",f(this,yt).body).height(f(this,wr).body),tt(this,vi,!0))});it(this,"redraw",()=>{f(this,yt).touchEvent.scrollTop(),this.init(),f(this,yt).dataManager&&(tt(this,Ge,f(this,yt).dataManager.viewRecords.rawIndex||0),f(this,cc).call(this),f(this,kn).call(this),f(this,yt).body.querySelector("ng-vscrollbar").refresh())});it(this,"redrawV2",()=>{f(this,yt).touchEvent.scrollTop(),this.init(),tt(this,Ge,f(this,yt).dataManager.viewRecords.rawIndex||0),f(this,uc).call(this),f(this,kn).call(this),f(this,yt).body.querySelector("ng-vscrollbar").refreshV2()});it(this,"redrawV3",()=>{this.init(),tt(this,Ge,f(this,yt).dataManager.viewRecords.rawIndex||0),f(this,kn).call(this)});Y(this,Fa,()=>{var C=0;return $(".ng-container-body tbody.fixed tr",f(this,yt).body).each((t,l)=>{l.data&&l.data.__ng&&(C+=f(this,yt).matrix.getHeight(l.data.__ng.height[parseInt(t%f(this,yt).template.length)]))}),C});Y(this,qa,()=>{var C=f(this,Fa).call(this);const t=parseInt(f(this,Ge)*f(this,yt).template.length);return $(".ng-container-body tbody.bindable tr:not(.nodata)",f(this,yt).body).each((l,c)=>{C+=f(this,yt).matrix.getHeight(t+l)}),C});Y(this,Ha,()=>{const C=parseInt(f(this,yt).getAttribute("display-row-count"));if(f(this,yt).closest("dialog")&&H.j.querySelectorAll(f(this,yt)).hasClass("simple"))return 1;if([H.PAGINGTYPE.CLIENT,H.PAGINGTYPE.SERVER].includes(f(this,yt).paging.type))return f(this,yt).paging.linesPerPage;if(!isNaN(C))return f(this,Ge)+C>f(this,yt).data.count()&&(tt(this,Ge,C>=f(this,yt).data.count()?0:f(this,yt).data.count()-C),f(this,yt).dataManager.viewRecords.rawIndex=f(this,Ge)),C;const t=f(this,wr).body-f(this,wr).thead-f(this,wr).tfoot-f(this,Fa).call(this);for(var l=0,c=0;c<t;)c+=this.getRowHeight(f(this,Ge)+l++);if(f(this,Ge)+l>f(this,yt).data.count()){l=0,c=0;for(var o=f(this,yt).data.count()-1;o>=0&&c<t;o--)c+=this.getRowHeight(o),l++;c>t&&l--,tt(this,Ge,f(this,yt).data.count()-l),f(this,yt).dataManager.viewRecords.rawIndex=f(this,Ge)}return l});Y(this,za,()=>{var C=f(this,Ha).call(this),t=$(".ng-container-body tbody.bindable tr",f(this,yt).body).not("tr.nodata").length/(f(this,yt).template.length||1);const l=f(this,yt).template.clone(),c=l.clone(),o=l.clone();l.find("th,td").not("[fixed=left]").remove(),c.find("th,td").not("[fixed=right]").remove(),o.find("th[fixed=left],td[fixed=left],th[fixed=right],td[fixed=right]").remove();const r=$("tr.nodata",f(this,yt).body.querySelector(".ng-container-left")),n=$("tr.nodata",f(this,yt).body.querySelector(".ng-container-right")),s=$("tr.nodata",f(this,yt).body.querySelector(".ng-container-body"));for(var e=t;e<C;e++)l.each((u,a)=>{r.before(a.outerHTML)}),c.each((u,a)=>{n.before(a.outerHTML)}),o.each((u,a)=>{s.before(a.outerHTML)});return;var i;if(i.length>0)var t});Y(this,Ua,()=>{var C=Math.min(f(this,Ha).call(this),f(this,yt).data.count());$(".ng-container tbody.bindable tr:not(.nodata)",f(this,yt).body).each((t,l)=>{parseInt(l.sectionRowIndex/f(this,yt).template.length)>=C&&$(l).remove()}),f(this,yt).body.querySelectorAll(".ng-container tbody.bindable tr:not(.nodata)").forEach(t=>{f(this,Ge)+parseInt(t.sectionRowIndex/f(this,yt).template.length)>=f(this,yt).data.count()&&$(t).remove()})});Y(this,cc,()=>{f(this,za).call(this),f(this,Ua).call(this);var C=f(this,wr).body-f(this,wr).thead-f(this,wr).tfoot-f(this,qa).call(this);if(f(this,yt).getAttribute("display-row-count")&&f(this,yt).data.count()>=Number(f(this,yt).getAttribute("display-row-count")||0)&&(C=0),$(".ng-container tbody.bindable tr.nodata",f(this,yt).body).height(C),f(this,yt).closest("dialog")&&H.j.querySelectorAll(f(this,yt)).hasClass("simple")){$("tr.nodata",f(this,yt).body).height(0);var C=47;$(".ng-container-body tbody.bindable tr",f(this,yt).body).not(".nodata").each((l,c)=>{C+=$(c).height()}),$(f(this,yt).closest("dialog")).height(C)}});Y(this,uc,()=>{f(this,za).call(this),f(this,Ua).call(this),f(this,yt).isLastPage});Y(this,dc,()=>{for(const C of f(this,wi))clearTimeout(C);tt(this,wi,[]),f(this,wi).push(setTimeout(()=>{tt(this,vi,!1);var C=$(".ng-container-body tbody.bindable tr",f(this,yt).body).not(".nodata"),t=$(".ng-container-left tbody.bindable tr",f(this,yt).body).not(".nodata"),l=$(".ng-container-right tbody.bindable tr",f(this,yt).body).not(".nodata");if(C.length>0){var c=parseInt(C[0].dataset.row*f(this,yt).template.length);C.each((r,n)=>{var s=f(this,yt).matrix.getHeight(c+r);$("canvas.chart",n).css({height:s-4}),$("canvas.chart",t.eq(r)).css({height:s-4}),$("canvas.chart",l.eq(r)).css({height:s-4}),$(n).css({height:s}).height(s),t.eq(r).css({height:s}).height(s),l.eq(r).css({height:s}).height(s)})}f(this,yt).cell.refresh(),$("ng-row-indicator",f(this,yt).body).each((r,n)=>{n.refresh()});var o=f(this,wr).body-f(this,wr).thead-f(this,wr).tfoot-f(this,qa).call(this);f(this,yt).getAttribute("display-row-count")&&f(this,yt).data.count()>=Number(f(this,yt).getAttribute("display-row-count")||0)&&(o=0),$(".ng-container tbody.bindable tr.nodata",f(this,yt).body).height(o),f(this,yt).refreshBindRows(),f(this,yt).refreshData(),f(this,yt).paging.totalCount=f(this,yt).data.countNF(),f(this,yt).body.querySelector("ng-vscrollbar").refresh(),H.j.querySelectorAll(".ng-table tbody tr",f(this,yt).body).removeClass("hover"),H.j.querySelectorAll(f(this,yt)).removeClass("loading"),H.j.querySelectorAll("ng-filter-panel").removeClass("loading")},300)),f(this,wi).push(setTimeout(()=>{f(this,yt).refreshDataV2()}))});Y(this,kn,()=>{var C=[];f(this,yt).body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)").forEach(t=>{C.push(f(this,Ge)+parseInt(t.sectionRowIndex/f(this,yt).template.length))}),C=[...new Set(C)],f(this,yt).body.querySelectorAll(".ng-container tbody.bindable tr:not(.nodata)").forEach(t=>{const l=parseInt(t.sectionRowIndex/f(this,yt).template.length);t.dataset.row=C[l],t.dataset.matrixRow=parseInt(C[l]*f(this,yt).template.length)+parseInt(t.sectionRowIndex%f(this,yt).template.length);for(const c of t.cells)c.dataset.row=t.dataset.row,c.dataset.matrixRow=t.dataset.matrixRow}),C.forEach(t=>{const l=f(this,yt).data.get(t);f(this,yt).body.querySelectorAll(`.ng-container tbody.bindable tr[data-row="${t}"]`).forEach(c=>{c.data=l})}),tt(this,Ge,parseInt(f(this,yt).body.querySelector(".ng-container-body tbody.bindable tr:first-of-type").getAttribute("data-row"))),f(this,yt).dataManager.viewRecords.rawIndex=f(this,Ge),f(this,dc).call(this),f(this,yt).isFirstPage=f(this,Ge)==0,f(this,yt).isLastPage=C[C.length-1]==f(this,yt).data.count()-1});it(this,"getVisibleFirstRow",()=>{var C=f(this,yt).body.querySelector(".ng-container-body tbody.bindable tr:first-child");return parseInt(C.dataset.row)});it(this,"getVisibleLastRow",()=>{var C=f(this,yt).body.querySelectorAll(".ng-container-body tbody.bindable tr:not(.nodata)");return C.length>0?parseInt(C[C.length-1].dataset.row):-1});it(this,"getRowHeight",C=>{let t=0;for(var l=0;l<f(this,yt).template.length;l++)t+=f(this,yt).matrix.getHeight(parseInt(C*f(this,yt).template.length+l));return t});it(this,"getTranslateY",()=>{const C=f(this,yt).body.querySelector(".ng-container-body tbody.bindable");return!C||!C.style||!C.style.transform?0:parseFloat(C.style.transform.replace("translateY(","").replace(")",""))});it(this,"getTotalSpace",()=>$(f(this,yt).body.querySelector(".ng-container-body")).height()-($(f(this,yt).body.querySelector(".ng-container-body thead")).height()||0)-($(f(this,yt).body.querySelector(".ng-container-body tfoot")).height()||0)-($(f(this,yt).body.querySelector(".ng-container-body tbody.fixed")).height()||0));it(this,"fitPage",()=>{const C=this.getVisibleLastRow(),t=this.getTotalSpace();if(C==f(this,yt).data.count()-1){for(var l=0,c=C;c>=0;c--)if(l+=this.getRowHeight(c),l>t){f(this,yt).scrollTo(c+1);break}}});it(this,"selectArea",(C,t,l,c)=>{const o=f(this,Us).call(this,C),r=f(this,Us).call(this,l),n=f(this,Vs).call(this,t),s=f(this,Vs).call(this,c),e=parseInt(o*f(this,yt).template.length),i=parseInt(r*f(this,yt).template.length)+f(this,yt).template.length-1;f(this,yt).row.at=o,o>=0&&r>=0?f(this,yt).selection.selectArea(e,n,i,s):this.clearSelection()});it(this,"selectRow",(C,t)=>{const l=f(this,Us).call(this,C),c=H.isNull(t)?l:f(this,Us).call(this,t),o=parseInt(l*f(this,yt).template.length),r=parseInt(c*f(this,yt).template.length)+f(this,yt).template.length-1;f(this,yt).row.at=l,l>=0&&c>=0?f(this,yt).selection.selectArea(o,f(this,yt).firstCol,r,f(this,yt).lastCol):this.clearSelection()});it(this,"selectCol",(C,t)=>{const l=f(this,Vs).call(this,C),c=H.isNull(t)?l:f(this,Vs).call(this,t),o=0,r=parseInt(f(this,yt).data.count()*f(this,yt).template.length-1);l>=0&&c>=0?f(this,yt).selection.selectArea(o,l,r,c):this.clearSelection()});it(this,"selectCell",(C,t,l)=>{const c=f(this,Us).call(this,C),o=f(this,Vs).call(this,t),r=parseInt(c*f(this,yt).template.length)+H.nvl(l,0);f(this,yt).row.at=c,c>=0?f(this,yt).selection.selectArea(r,o,r,o):this.clearSelection()});Y(this,Us,C=>{if(typeof C=="number")return C;if(typeof C=="function")return f(this,yt).data.findIndex(C);throw`invalid ${C}`});Y(this,Vs,C=>{if(typeof C=="number")return C;if(typeof C=="string"&&f(this,yt).fields.includes(C))return parseInt($(`[data-bind="${C}"]`,f(this,yt).template)[0].dataset.col);throw`invalid ${C}`});it(this,"moveTo",C=>{f(this,yt).scrollTo(C)});tt(this,yt,C),tt(this,vi,!1),this.init()}}yt=new WeakMap,Ge=new WeakMap,wr=new WeakMap,vi=new WeakMap,wi=new WeakMap,Fa=new WeakMap,qa=new WeakMap,Ha=new WeakMap,za=new WeakMap,Ua=new WeakMap,cc=new WeakMap,uc=new WeakMap,dc=new WeakMap,kn=new WeakMap,Us=new WeakMap,Vs=new WeakMap;class sf{constructor(C){Y(this,Je);Y(this,Ws);it(this,"initialize",()=>{tt(this,Ws,!1),f(this,Je).data.clearFilter()});it(this,"isFiltering",()=>f(this,Ws));it(this,"on",C=>{tt(this,Ws,!0);const t=f(this,fc).call(this);f(this,Je).body.querySelectorAll(".ng-table thead th, .ng-table thead td").forEach(l=>{var o,r;const c=(o=l.closest("tr"))==null?void 0:o.sectionRowIndex;if(c!==void 0&&c+l.rowSpan-1===t){const n=Array.from(f(this,Je).activeTmpl.querySelectorAll(`[data-col="${l.dataset.col}"]`)).map(s=>s.dataset.bind?{colnm:s.dataset.bind,data:[]}:null).filter(Boolean);if(n.length>0){(r=l.querySelector("ng-filter-button"))==null||r.remove();const s=document.createElement("ng-filter-button");l.appendChild(s),s.filterOptions=n}}})});it(this,"off",()=>{tt(this,Ws,!1),f(this,Je).body.querySelectorAll(".ng-table ng-filter-button").forEach(C=>{C.remove()})});it(this,"set",C=>{this.on();let t=Array.isArray(C)?Object.fromEntries(Object.keys(C[0]).map(l=>[l,[...new Set(C.map(c=>c[l]))]])):C;f(this,Je).data.clearFilter(),Object.entries(t).forEach(([l,c])=>{const o=f(this,Je).fields.indexOf(l);f(this,Je).data.getValidData().some(r=>typeof r.v[o]=="number")&&(c=c.map(Number)),f(this,Je).data.getValidData().filter(r=>c.nineBinarySearch(r.v[o]||"")<0).forEach(r=>{r.__ng.filtered=!0})}),f(this,Je).data.refreshFilter(),f(this,Je).shadowRoot.querySelectorAll("ng-filter-button").forEach(l=>{l.filterOptions.forEach(c=>{c.data=[]})}),Object.entries(t).forEach(([l,c])=>{f(this,Je).shadowRoot.querySelectorAll("ng-filter-button").forEach(o=>{let r=o.filterOptions;r.forEach(n=>{n.colnm===l&&(n.data=c)}),o.filterOptions=r})}),f(this,Je).scrollTo_V1(0),f(this,Je).paging.reset()});Y(this,fc,(C="thead")=>[...f(this,Je).body.querySelectorAll(`.ng-table ${C}`)].reduce((t,l)=>Math.max(l.rows.length-1,t),0));tt(this,Je,C),tt(this,Ws,!1);const t=document.createElement("ng-filter-panel");t.style.display="none",f(this,Je).shadowRoot.appendChild(t)}}Je=new WeakMap,Ws=new WeakMap,fc=new WeakMap;class nf extends HTMLElement{constructor(){super();Y(this,Va);Y(this,Cn);Y(this,Wa,t=>{var o;t.preventDefault(),t.stopPropagation();const l=f(this,Va).shadowRoot.querySelector("ng-filter-panel"),c=(o=this.closest("th,td"))==null?void 0:o.dataset.col;l.col===c?l.close():l.open(this)})}connectedCallback(){tt(this,Va,this.getRootNode().host),this.removeEventListener("click",f(this,Wa)),this.addEventListener("click",f(this,Wa))}get filterOptions(){return f(this,Cn)}set filterOptions(t){tt(this,Cn,t),this.classList.toggle("filtered",f(this,Cn).some(l=>l.data.length>0))}}Va=new WeakMap,Cn=new WeakMap,Wa=new WeakMap;class of extends HTMLElement{constructor(){super();Y(this,Mr);Y(this,Xa);Y(this,Ya);Y(this,pc,t=>{const l=this.shadowRoot.querySelector("nine-grid");this.classList.add("loading"),setTimeout(()=>{const[c,o,r,n]=["LVL","CHK","COLNM","DATA"].map(u=>l.fields.indexOf(u)),s=l.data.getValidDataNF().filter(u=>u.v[c]===2&&u.v[o]==="Y"),e=s.length>0?[...new Set(s.map(u=>u.v[r]))].map(u=>({colnm:u,data:[...new Set(l.data.getValidData().filter(a=>a.v[o]==="Y"&&a.v[r]===u).map(a=>a.v[n]||""))].sort()})):[];f(this,Xa).filterOptions=e;const i=Object.fromEntries([...f(this,Mr).body.querySelectorAll("ng-filter-button")].flatMap(u=>u.filterOptions).filter(u=>u.data.length>0).map(u=>[u.colnm,u.data]));f(this,Mr).filtering.set(i),this.classList.remove("loading"),this.style.display="none"})});Y(this,mc,t=>{this.style.display="none"});Y(this,gc,t=>{const l=this.shadowRoot.querySelector("nine-grid"),c=l.fields.indexOf("CHK"),o=t.target.checked;l.data.getValidData().forEach(r=>{r.v[c]=o?"Y":"N"}),l.refreshData()});Y(this,bc,t=>{const l=this.shadowRoot.querySelector("nine-grid");l.classList.add("loading");const c=l.dataManager.rawRecords;c.forEach(s=>{s.__ng.filtered=!1});const o=t.target.value.toLowerCase(),[r,n]=["LVL","DATA"].map(s=>l.fields.indexOf(s));c.forEach(s=>{s.__ng.filtered=s.v[r]===2&&!String(s.v[n]||"").toLowerCase().includes(o)}),l.data.resetRecords(),clearTimeout(f(this,Ya)),tt(this,Ya,setTimeout(()=>{l.dataManager.viewRecords.reset(),l.dataManager.viewRecords.touch()},200))});it(this,"close",()=>{this.col=null,this.style.display="none"});it(this,"open",t=>{const l=t.closest("th,td"),{left:c}=t.getBoundingClientRect(),{left:o,width:r,top:n}=f(this,Mr).getBoundingClientRect(),{top:s,height:e}=l.getBoundingClientRect(),{width:i}=this.getBoundingClientRect();let u=Math.max(0,c-o);u=Math.min(u,r-i-5);const a=s+e-n;Object.assign(this.style,{left:`${u}px`,top:`${a}px`,display:"flex"}),this.classList.add("loading"),this.shadowRoot.querySelector("input[type=text]").value="",setTimeout(()=>{const h=f(this,Mr).data.getValidDataNF(),p=l.dataset.col;this.col=p,tt(this,Xa,t);const m=t.filterOptions.map((g,S)=>{const E=`<span class="group">${l.textContent}${t.filterOptions.length>1?` #${S+1} (${g.colnm})`:""}</span>`,I=f(this,Mr).activeTmpl.querySelector(`[data-col="${p}"][data-bind="${g.colnm}"]`),D=I==null?void 0:I.getAttribute("data-expr"),z=D?f(this,Mr).exprFunction(D):null,P=h.map(B=>{const F=f(this,Mr).fields.indexOf(g.colnm);return D?{v:B.v[F],v2:z(f(this,Mr).data.conv(B),B.__ng.rowidx,f(this,Mr).data)}:{v:B.v[F],v2:B.v[F]}});return[{LVL:1,CHK:"N",DATA2:E},...[...new Set(P.map(JSON.stringify))].map(JSON.parse).sort((B,F)=>(B.v2||"")>(F.v2||"")?1:(B.v2||"")<(F.v2||"")?-1:0).map(B=>({LVL:2,DATA:B.v,DATA2:B.v2||` <span class="empty">(empty)</span> ${B.v}`,COLNM:g.colnm,CHK:g.data.length===0||g.data.nineBinarySearch(B.v||"")>=0?"Y":"N"}))]}).flat(),d=this.shadowRoot.querySelector("nine-grid");d.fields.add(["DATA","DATA2","COLNM"]),d.data.set(m);const b=this.shadowRoot.querySelector("input[type=checkbox]");b.checked=d.data.getValidData().every(g=>!(g.LVL===2&&g.CHK!=="Y")),this.shadowRoot.querySelector("input").focus(),this.classList.remove("loading")})});this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Mr,this.getRootNode().host);const t=this.getRootNode().host.closest("nine-grid").getAttribute("css-path")||"",l=nine.cssPath?`@import "${nine.cssPath}/ninegrid/ngFilterPanel.css";`:"";this.shadowRoot.innerHTML=`
721
721
  <style>
722
722
  @import "https://cdn.jsdelivr.net/npm/ninegrid2@${H.version}/dist/css/ngFilterPanel.css";
723
723
  ${l}
@@ -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,bc)),this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change",f(this,gc)),this.shadowRoot.querySelector("#btnOk").addEventListener("click",f(this,pc)),this.shadowRoot.querySelector("#btnCancel").addEventListener("click",f(this,mc))}}Mr=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,pc=new WeakMap,mc=new WeakMap,gc=new WeakMap,bc=new WeakMap,customElements.get("ng-filter-button")||customElements.define("ng-filter-button",nf),customElements.get("ng-filter-panel")||customElements.define("ng-filter-panel",of);class Yn extends HTMLElement{constructor(){super();Y(this,Ga,!1);Y(this,xi);Y(this,Ka);Y(this,En);Y(this,os);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,Za,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,os)[t]),f(this,tl).call(this),this.createTemplate(),f(this,Ja).call(this),this.resetTemplate(),f(this,Qa).call(this),this.cell.resetEvent(),this.touchEvent.resetEvent(),f(this,xi).resetEvent(),f(this,Ka).resetEvent(),f(this,En)&&f(this,En).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,Ja,()=>{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,yc,()=>{if(!this.template)return 0;var t=0;return this.template.each((l,c)=>{t+=$(c).height()}),t});Y(this,vs,()=>{const t=parseInt(this.getAttribute("display-row-count"));if(isNaN(t))return;const l=this.shadowRoot.querySelector("ng-head");l&&setTimeout(()=>{const c=parseInt(window.getComputedStyle(l).getPropertyValue("padding-bottom"),10);var o=($(l).height()||0)+($("ng-foot",this.shadowRoot).height()||0)+($(".ng-container-body thead",this.shadowRoot).height()||0)+($(".ng-container-body tfoot:visible",this.shadowRoot).height()||0)+($(".ng-container-bottom:visible",this.shadowRoot).height()||0)+c+(f(this,yc).call(this)||0)*t+3;$(this).height(o)})});Y(this,vc,()=>{if(f(this,Ga))return;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,os).push(n),H.j.querySelectorAll(this).hasClass("simple")||f(this,_c).call(this,n)});const t=`
753
+ `,this.shadowRoot.querySelector("input[type=text]").addEventListener("input",f(this,bc)),this.shadowRoot.querySelector("input[type=checkbox]").addEventListener("change",f(this,gc)),this.shadowRoot.querySelector("#btnOk").addEventListener("click",f(this,pc)),this.shadowRoot.querySelector("#btnCancel").addEventListener("click",f(this,mc))}}Mr=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,pc=new WeakMap,mc=new WeakMap,gc=new WeakMap,bc=new WeakMap,customElements.get("ng-filter-button")||customElements.define("ng-filter-button",nf),customElements.get("ng-filter-panel")||customElements.define("ng-filter-panel",of);class Yn extends HTMLElement{constructor(){console.log("==========="),console.log(nine.cssPath);super();Y(this,Ga,!1);Y(this,xi);Y(this,Ka);Y(this,En);Y(this,os);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,Za,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,os)[t]),f(this,tl).call(this),this.createTemplate(),f(this,Ja).call(this),this.resetTemplate(),f(this,Qa).call(this),this.cell.resetEvent(),this.touchEvent.resetEvent(),f(this,xi).resetEvent(),f(this,Ka).resetEvent(),f(this,En)&&f(this,En).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,Ja,()=>{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,yc,()=>{if(!this.template)return 0;var t=0;return this.template.each((l,c)=>{t+=$(c).height()}),t});Y(this,vs,()=>{const t=parseInt(this.getAttribute("display-row-count"));if(isNaN(t))return;const l=this.shadowRoot.querySelector("ng-head");l&&setTimeout(()=>{const c=parseInt(window.getComputedStyle(l).getPropertyValue("padding-bottom"),10);var o=($(l).height()||0)+($("ng-foot",this.shadowRoot).height()||0)+($(".ng-container-body thead",this.shadowRoot).height()||0)+($(".ng-container-body tfoot:visible",this.shadowRoot).height()||0)+($(".ng-container-bottom:visible",this.shadowRoot).height()||0)+c+(f(this,yc).call(this)||0)*t+3;$(this).height(o)})});Y(this,vc,()=>{if(f(this,Ga))return;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,os).push(n),H.j.querySelectorAll(this).hasClass("simple")||f(this,_c).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")}
@@ -1380,5 +1380,5 @@ Do you want to save it?`,"SAVE",{class:"rgb","true-text":"Yes","false-text":"No"
1380
1380
  </div>
1381
1381
  </div>
1382
1382
  </dialog>
1383
- `;const o=this.querySelector(".title");o&&t&&(o.textContent=t),f(this,Xc).call(this)}}Ss=new WeakMap,Xc=new WeakMap,Tl=new WeakMap,Hn=new WeakMap,Rl=new WeakMap,Ml=new WeakMap,zn=new WeakMap,Il=new WeakMap,customElements.get("nx-modal")||customElements.define("nx-modal",Of),window.jQuery=window.$=Se;function jf(){customElements.get("nine-grid")||customElements.define("nine-grid",Yn)}fe.NineGridContainer=Yn,fe.default=H,fe.defineCustomElements=jf,Object.defineProperties(fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1383
+ `;const o=this.querySelector(".title");o&&t&&(o.textContent=t),f(this,Xc).call(this)}}Ss=new WeakMap,Xc=new WeakMap,Tl=new WeakMap,Hn=new WeakMap,Rl=new WeakMap,Ml=new WeakMap,zn=new WeakMap,Il=new WeakMap,customElements.get("nx-modal")||customElements.define("nx-modal",Of),window.jQuery=window.$=Se;function jf(){customElements.get("nine-grid2")||customElements.define("nine-grid2",Yn)}fe.NineGridContainer=Yn,fe.default=H,fe.defineCustomElements=jf,Object.defineProperties(fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1384
1384
  //# sourceMappingURL=nine-grid.umd.js.map