@ninebone/grid 0.0.119 → 0.0.121

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.
@@ -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,Ze,this.shadowRoot.querySelector("input")),f(this,Ze).addEventListener("keydown",f(this,Ph)),f(this,Ze).addEventListener("compositionstart",c=>{c.target.selectionStart==c.target.selectionEnd&&f(this,Wr)&&H.getByteLength(c.target.value)>=Number(f(this,Wr))&&(c.target.value=H.cut(c.target.value,Number(f(this,Wr))),this.value=c.target.value)}),f(this,Ze).addEventListener("compositionupdate",c=>{f(this,gs)=="number"&&(c.target.value=c.target.value.replace(c.data,""))}),f(this,Ze).addEventListener("compositionend",c=>{}),f(this,Ze).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)))})}}Ze=new WeakMap,gs=new WeakMap,Wr=new WeakMap,Bs=new WeakMap,bn=new WeakMap,es=new WeakMap,Ph=new WeakMap,customElements.get("ng-input")||customElements.define("ng-input",Dd);class Bd{constructor(E){Y(this,Oe);Y(this,di);Y(this,yn);Y(this,vn);Y(this,wn);it(this,"getTotalHeight",()=>{let E=0;const t=f(this,Oe).data.get();trace.log(t);for(var l=0;l<t.length;l++)for(var c=0;c<t[l].__ng.height.length;c++)trace.log(t[l].__ng.height[c]),E+=t[l].__ng.height[c];return E});it(this,"getHeight",E=>{const t=parseInt(E/f(this,Oe).template.length);if(t<0||t>=f(this,Oe).data.count())return 32;const l=f(this,Oe).data.__ng(t);return l?l.height[parseInt(E%f(this,Oe).template.length)]:32});it(this,"setHeight",(E,t)=>{f(this,Oe).data.get(parseInt(E/f(this,Oe).template.length)).__ng.height[parseInt(E%f(this,Oe).template.length)]=t});Y(this,fi,E=>typeof E=="object"&&E.tagName=="TR"?parseInt(E.getAttribute("data-row"))*f(this,Oe).template.length+E.sectionRowIndex%f(this,Oe).template.length:E);it(this,"attr",(E,t,l,c)=>{t=f(this,fi).call(this,t);var o=parseInt(t/f(this,Oe).template.length),r=f(this,Oe).data.get(o,"rowid"),n=t%f(this,Oe).template.length,s=H.decode(E,"head",f(this,yn),"foot",f(this,wn),f(this,vn)),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",(E,t,l)=>{var c=this.attr(E,t,"height",l);return c||(c=$(f(this,Oe).template[f(this,fi).call(this,t)%f(this,Oe).template.length]).height()),c});it(this,"attr2",(E,t,l,c,o)=>{l=f(this,fi).call(this,l);var r=parseInt(l/f(this,Oe).template.length),n=E&&E.hasOwnProperty("rowid")?E[r].rowid:null,s=l%f(this,Oe).template.length,e=H.decode(t,"head",f(this,yn),"foot",f(this,wn),f(this,vn)),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",(E,t,l,c)=>{var o=this.attr2(E,t,l,"height",c);return o||(o=$(f(this,Oe).template[f(this,fi).call(this,l)%f(this,Oe).template.length]).height()),o});tt(this,Oe,E),tt(this,di,-1),tt(this,yn,[]),tt(this,vn,[]),tt(this,wn,[]),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)}}get row(){return f(this,di)}set row(E){tt(this,di,parseInt(E)),f(this,Oe).selection.selectedStartRow==f(this,Oe).selection.selectedEndRow&&(f(this,Oe).selection.selectedStartRow=f(this,Oe).selection.selectedEndRow=f(this,Oe).selection.startRow=f(this,di))}}Oe=new WeakMap,di=new WeakMap,yn=new WeakMap,vn=new WeakMap,wn=new WeakMap,fi=new WeakMap;class Fd 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=`
502
+ `,super.connectedCallback(),tt(this,Ze,this.shadowRoot.querySelector("input")),f(this,Ze).addEventListener("keydown",f(this,Ph)),f(this,Ze).addEventListener("compositionstart",c=>{c.target.selectionStart==c.target.selectionEnd&&f(this,Wr)&&H.getByteLength(c.target.value)>=Number(f(this,Wr))&&(c.target.value=H.cut(c.target.value,Number(f(this,Wr))),this.value=c.target.value)}),f(this,Ze).addEventListener("compositionupdate",c=>{f(this,gs)=="number"&&(c.target.value=c.target.value.replace(c.data,""))}),f(this,Ze).addEventListener("compositionend",c=>{}),f(this,Ze).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)))})}}Ze=new WeakMap,gs=new WeakMap,Wr=new WeakMap,Bs=new WeakMap,bn=new WeakMap,es=new WeakMap,Ph=new WeakMap,customElements.get("ng-input")||customElements.define("ng-input",Dd);class Bd{constructor(E){Y(this,Oe);Y(this,di);Y(this,yn);Y(this,vn);Y(this,wn);it(this,"getTotalHeight",()=>f(this,Oe).data.get().reduce((E,t)=>E+t.__ng.height.reduce((l,c)=>l+c,0),0));it(this,"getHeight",E=>{const t=parseInt(E/f(this,Oe).template.length);if(t<0||t>=f(this,Oe).data.count())return 32;const l=f(this,Oe).data.__ng(t);return l?l.height[parseInt(E%f(this,Oe).template.length)]:32});it(this,"setHeight",(E,t)=>{f(this,Oe).data.get(parseInt(E/f(this,Oe).template.length)).__ng.height[parseInt(E%f(this,Oe).template.length)]=t});Y(this,fi,E=>typeof E=="object"&&E.tagName=="TR"?parseInt(E.getAttribute("data-row"))*f(this,Oe).template.length+E.sectionRowIndex%f(this,Oe).template.length:E);it(this,"attr",(E,t,l,c)=>{t=f(this,fi).call(this,t);var o=parseInt(t/f(this,Oe).template.length),r=f(this,Oe).data.get(o,"rowid"),n=t%f(this,Oe).template.length,s=H.decode(E,"head",f(this,yn),"foot",f(this,wn),f(this,vn)),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",(E,t,l)=>{var c=this.attr(E,t,"height",l);return c||(c=$(f(this,Oe).template[f(this,fi).call(this,t)%f(this,Oe).template.length]).height()),c});it(this,"attr2",(E,t,l,c,o)=>{l=f(this,fi).call(this,l);var r=parseInt(l/f(this,Oe).template.length),n=E&&E.hasOwnProperty("rowid")?E[r].rowid:null,s=l%f(this,Oe).template.length,e=H.decode(t,"head",f(this,yn),"foot",f(this,wn),f(this,vn)),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",(E,t,l,c)=>{var o=this.attr2(E,t,l,"height",c);return o||(o=$(f(this,Oe).template[f(this,fi).call(this,l)%f(this,Oe).template.length]).height()),o});tt(this,Oe,E),tt(this,di,-1),tt(this,yn,[]),tt(this,vn,[]),tt(this,wn,[]),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)}}get row(){return f(this,di)}set row(E){tt(this,di,parseInt(E)),f(this,Oe).selection.selectedStartRow==f(this,Oe).selection.selectedEndRow&&(f(this,Oe).selection.selectedStartRow=f(this,Oe).selection.selectedEndRow=f(this,Oe).selection.startRow=f(this,di))}}Oe=new WeakMap,di=new WeakMap,yn=new WeakMap,vn=new WeakMap,wn=new WeakMap,fi=new WeakMap;class Fd 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 {
@@ -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",tf);class ef extends HTMLElement{constructor(){super();Y(this,En);Y(this,Pt);Y(this,Xr);Y(this,ge);Y(this,yr);Y(this,vr);Y(this,kn);Y(this,os,0);Y(this,Dr,0);it(this,"refresh",()=>{if(!f(this,Pt))return;var t=$(".ng-container-body",f(this,Pt).body),l=$(".ng-scroll-thumb",this.shadowRoot),c=$("table > thead",t),o=f(this,Pt).dataManager.viewRecords.rawIndex,r=$(f(this,ge).track).height(),n=$(f(this,ge).thumb).height();Number(f(this,Pt).getAttribute("display-row-count")||0)>=f(this,Pt).dataManager.rawRecords.length||parseInt($(".ng-container .ng-table tr.nodata",f(this,Pt).body).height())>0&&(f(this,Pt).dataManager.rawRecords.length==0||f(this,Pt).dataManager.viewRecords.rawIndex==0)?$(this).hide():$(this).show();var e=Math.min(r*(t.height()-c.height())/(f(this,Pt).template.height()*f(this,Pt).template.length*f(this,Pt).data.count()),r);l[0].dataset.height=e,e<16&&(e=16);var i=r-f(this,vi).call(this);if(i!=0){e>=r?l.css({top:0,height:e-20}):l.css({height:e});var u;if(f(this,Pt).isFirstPage)u=0;else if(f(this,Pt).isLastPage)u=r-n-2;else{var a=parseInt($(".ng-container-body tbody.bindable tr",f(this,Pt).body).not(".nodata").length/f(this,Pt).template.length);u=parseInt(o*i/(f(this,Pt).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,Pt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,Pt).isLastPage,$(this).is(":visible")&&$("ng-hscrollbar",f(this,Pt).body).is(":visible")?$(".ng-scroll-edge",f(this,Pt).body).show():$(".ng-scroll-edge",f(this,Pt).body).hide()}});it(this,"refreshV2",()=>{if(f(this,Pt)){var t=$(".ng-scroll-thumb",this.shadowRoot),l=f(this,Pt).dataManager.viewRecords.rawIndex,c=this.trackHeight,o=this.thumbHeight,r=Math.min(c*(this.bodyHeight-this.theadHeight)/(this.templateHeight*f(this,Pt).template.length*f(this,Pt).data.count()),c);t[0].dataset.height=r,r<16&&(r=16);var n=c-f(this,vi).call(this),s;if(f(this,Pt).isFirstPage)s=0;else if(f(this,Pt).isLastPage)s=c-o-2;else{var e=parseInt($(".ng-container-body tbody.bindable tr",f(this,Pt).body).not(".nodata").length/f(this,Pt).template.length);s=parseInt(l*n/(f(this,Pt).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,Pt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,Pt).isLastPage}});it(this,"delayScroll",(t,l,c,o)=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Pt).scrollBy(t),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Pt).scrollBy(t)?o&&o.call():clearInterval(f(this,vr))},c))},l))});it(this,"stopScroll",()=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))});Y(this,Qh,()=>{var t=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Pt).scrollBy(l),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Pt).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,Sa)),$(f(this,ge).track).on("touchstart",f(this,tc)),$(f(this,ge).thumb).on("mousedown",f(this,Ca)),$(f(this,ge).thumb).on("touchstart",f(this,ec)),document.addEventListener("mouseup",l=>{f(this,Xr)&&tt(this,Xr,!1),document.removeEventListener("mousemove",f(this,Cn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,Xr,!1),document.removeEventListener("touchmove",f(this,ka)),typeof this.onDragStop=="function"&&this.onDragStop()})});Y(this,tc,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,Sa).call(this,t)});Y(this,Sa,t=>{if(!f(this,Xr)&&!(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,Pt).pageDown():f(this,Pt).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,Pt).pageDown():f(this,Pt).pageUp();o||clearInterval(f(this,vr))}},10))},500))}});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,Ca).call(this,t),document.addEventListener("touchmove",f(this,ka))});Y(this,ka,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,Cn).call(this,t)});Y(this,Ca,t=>{tt(this,os,t.clientY),Bl.log("::",t,t.clientY),tt(this,Xr,!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,Pt).body).height(),this.bodyHeight=$(".ng-container-body",f(this,Pt).body).height(),this.templateHeight=f(this,Pt).template.height(),this.theadHeight=$(".ng-container-body table > thead",f(this,Pt).body).height()||0,this.tfootHeight=$(".ng-container-body table > tfoot",f(this,Pt).body).height()||0,this.fixedHeight=$(".ng-container-body tbody.fixed",f(this,Pt).body).height(),this.tableHeight=$(".ng-container-body .ng-table",f(this,Pt).body).height(),tt(this,kn,!0),document.addEventListener("mousemove",f(this,Cn)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,Cn,t=>{if(!f(this,Xr))return;t.preventDefault();var l=t.clientY-f(this,os);f(this,kn)&&(H.j.querySelectorAll("th,td",f(this,Pt).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,kn,!1));var c=this.trackHeight;let o=f(this,vi).call(this);var r=t.clientY-this.shiftY;r<0&&(r=0),r+this.thumbHeight>c&&(r=parseInt(c-o));var n=parseInt($(".ng-container-body tbody.bindable tr",f(this,Pt).body).not(".nodata").length/f(this,Pt).template.length),s=parseInt(r*(f(this,Pt).data.count()+1-n)/parseInt(c-o));let e=f(this,Pt).matrix.getTotalHeight();Bl.log(e);let i=f(this,Pt).matrix.getHeight(f(this,Pt).dataManager.viewRecords.rawIndex),u=f(this,Pt).matrix.getHeight(s);Bl.log(f(this,Pt).dataManager.viewRecords.rawIndex,s,i,u),l>0&&l>i&&(l=i,tt(this,os,t.clientY)),l<0&&Math.abs(l)>i&&(l=-i,tt(this,os,t.clientY)),s===0&&(l=0),tt(this,Dr,-Math.abs(l)),Bl.log(t.clientY,f(this,os),f(this,Dr),l),Ue(this,En,ou).call(this,f(this,Dr)),f(this,Pt).dataManager.viewRecords.rawIndex!=s&&(f(this,Pt).scrollToV2(s),tt(this,Dr,0),Ue(this,En,ou).call(this,0))});Y(this,bu,t=>{if(f(this,Xr)){t.preventDefault();var l=t.clientY-f(this,os);tt(this,os,t.clientY);var c=this.trackHeight,o=f(this,vi).call(this),r=c-o,n=f(this,Pt).matrix.totalHeight-this.bodyHeight,s=r>0?n/r:0,e=l*s;tt(this,Dr,f(this,Dr)-e),tt(this,Dr,Math.max(-n,Math.min(0,f(this,Dr)))),Ue(this,En,ou).call(this,Math.abs(f(this,Dr)));var i=f(this,Pt).getRowIndexAt(Math.abs(f(this,Dr)));f(this,Pt).dataManager.viewRecords.rawIndex!=i&&f(this,Pt).scrollToV2(i)}});Y(this,vi,()=>parseInt(f(this,ge).thumb.dataset.height));this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Pt,this.getRootNode().host),f(this,Pt)&&(this.shadowRoot.innerHTML=`
655
+ `,super.connectedCallback(),this.cell.dataset.bind="rowState"}}customElements.get("ng-row-state")||customElements.define("ng-row-state",tf);class ef extends HTMLElement{constructor(){super();Y(this,En);Y(this,Pt);Y(this,Xr);Y(this,ge);Y(this,yr);Y(this,vr);Y(this,kn);Y(this,os,0);Y(this,Dr,0);it(this,"refresh",()=>{if(!f(this,Pt))return;var t=$(".ng-container-body",f(this,Pt).body),l=$(".ng-scroll-thumb",this.shadowRoot),c=$("table > thead",t),o=f(this,Pt).dataManager.viewRecords.rawIndex,r=$(f(this,ge).track).height(),n=$(f(this,ge).thumb).height();Number(f(this,Pt).getAttribute("display-row-count")||0)>=f(this,Pt).dataManager.rawRecords.length||parseInt($(".ng-container .ng-table tr.nodata",f(this,Pt).body).height())>0&&(f(this,Pt).dataManager.rawRecords.length==0||f(this,Pt).dataManager.viewRecords.rawIndex==0)?$(this).hide():$(this).show();var e=Math.min(r*(t.height()-c.height())/(f(this,Pt).template.height()*f(this,Pt).template.length*f(this,Pt).data.count()),r);l[0].dataset.height=e,e<16&&(e=16);var i=r-f(this,vi).call(this);if(i!=0){e>=r?l.css({top:0,height:e-20}):l.css({height:e});var u;if(f(this,Pt).isFirstPage)u=0;else if(f(this,Pt).isLastPage)u=r-n-2;else{var a=parseInt($(".ng-container-body tbody.bindable tr",f(this,Pt).body).not(".nodata").length/f(this,Pt).template.length);u=parseInt(o*i/(f(this,Pt).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,Pt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,Pt).isLastPage,$(this).is(":visible")&&$("ng-hscrollbar",f(this,Pt).body).is(":visible")?$(".ng-scroll-edge",f(this,Pt).body).show():$(".ng-scroll-edge",f(this,Pt).body).hide()}});it(this,"refreshV2",()=>{if(f(this,Pt)){var t=$(".ng-scroll-thumb",this.shadowRoot),l=f(this,Pt).dataManager.viewRecords.rawIndex,c=this.trackHeight,o=this.thumbHeight,r=Math.min(c*(this.bodyHeight-this.theadHeight)/(this.templateHeight*f(this,Pt).template.length*f(this,Pt).data.count()),c);t[0].dataset.height=r,r<16&&(r=16);var n=c-f(this,vi).call(this),s;if(f(this,Pt).isFirstPage)s=0;else if(f(this,Pt).isLastPage)s=c-o-2;else{var e=parseInt($(".ng-container-body tbody.bindable tr",f(this,Pt).body).not(".nodata").length/f(this,Pt).template.length);s=parseInt(l*n/(f(this,Pt).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,Pt).isFirstPage,f(this,ge).bottom.disabled=!!f(this,Pt).isLastPage}});it(this,"delayScroll",(t,l,c,o)=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Pt).scrollBy(t),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Pt).scrollBy(t)?o&&o.call():clearInterval(f(this,vr))},c))},l))});it(this,"stopScroll",()=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))});Y(this,Qh,()=>{var t=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Pt).scrollBy(l),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Pt).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,Sa)),$(f(this,ge).track).on("touchstart",f(this,tc)),$(f(this,ge).thumb).on("mousedown",f(this,Ca)),$(f(this,ge).thumb).on("touchstart",f(this,ec)),document.addEventListener("mouseup",l=>{f(this,Xr)&&tt(this,Xr,!1),document.removeEventListener("mousemove",f(this,Cn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,Xr,!1),document.removeEventListener("touchmove",f(this,ka)),typeof this.onDragStop=="function"&&this.onDragStop()})});Y(this,tc,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,Sa).call(this,t)});Y(this,Sa,t=>{if(!f(this,Xr)&&!(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,Pt).pageDown():f(this,Pt).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,Pt).pageDown():f(this,Pt).pageUp();o||clearInterval(f(this,vr))}},10))},500))}});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,Ca).call(this,t),document.addEventListener("touchmove",f(this,ka))});Y(this,ka,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,Cn).call(this,t)});Y(this,Ca,t=>{tt(this,os,t.clientY),Bl.log("::",t,t.clientY),tt(this,Xr,!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,Pt).body).height(),this.bodyHeight=$(".ng-container-body",f(this,Pt).body).height(),this.templateHeight=f(this,Pt).template.height(),this.theadHeight=$(".ng-container-body table > thead",f(this,Pt).body).height()||0,this.tfootHeight=$(".ng-container-body table > tfoot",f(this,Pt).body).height()||0,this.fixedHeight=$(".ng-container-body tbody.fixed",f(this,Pt).body).height(),this.tableHeight=$(".ng-container-body .ng-table",f(this,Pt).body).height(),tt(this,kn,!0),document.addEventListener("mousemove",f(this,Cn)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,Cn,t=>{if(!f(this,Xr))return;t.preventDefault();var l=t.clientY-f(this,os);f(this,kn)&&(H.j.querySelectorAll("th,td",f(this,Pt).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,kn,!1));var c=this.trackHeight;let o=f(this,vi).call(this);var r=t.clientY-this.shiftY;r<0&&(r=0),r+this.thumbHeight>c&&(r=parseInt(c-o));var n=parseInt($(".ng-container-body tbody.bindable tr",f(this,Pt).body).not(".nodata").length/f(this,Pt).template.length),s=parseInt(r*(f(this,Pt).data.count()+1-n)/parseInt(c-o)),e=f(this,Pt).matrix.getTotalHeight()-this.bodyHeight,i=c-o,u=i>0?e/i:0,a=l*u;Bl.log(e,i,u,a);let h=f(this,Pt).matrix.getHeight(f(this,Pt).dataManager.viewRecords.rawIndex),p=f(this,Pt).matrix.getHeight(s);Bl.log(f(this,Pt).dataManager.viewRecords.rawIndex,s,h,p),l>0&&l>h&&(l=h,tt(this,os,t.clientY)),l<0&&Math.abs(l)>h&&(l=-h,tt(this,os,t.clientY)),s===0&&(l=0),tt(this,Dr,-Math.abs(l)),Bl.log(t.clientY,f(this,os),f(this,Dr),l),Ue(this,En,ou).call(this,f(this,Dr)),f(this,Pt).dataManager.viewRecords.rawIndex!=s&&(f(this,Pt).scrollToV2(s),tt(this,Dr,0),Ue(this,En,ou).call(this,0))});Y(this,bu,t=>{if(f(this,Xr)){t.preventDefault();var l=t.clientY-f(this,os);tt(this,os,t.clientY);var c=this.trackHeight,o=f(this,vi).call(this),r=c-o,n=f(this,Pt).matrix.totalHeight-this.bodyHeight,s=r>0?n/r:0,e=l*s;tt(this,Dr,f(this,Dr)-e),tt(this,Dr,Math.max(-n,Math.min(0,f(this,Dr)))),Ue(this,En,ou).call(this,Math.abs(f(this,Dr)));var i=f(this,Pt).getRowIndexAt(Math.abs(f(this,Dr)));f(this,Pt).dataManager.viewRecords.rawIndex!=i&&f(this,Pt).scrollToV2(i)}});Y(this,vi,()=>parseInt(f(this,ge).thumb.dataset.height));this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Pt,this.getRootNode().host),f(this,Pt)&&(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")}