@ninebone/grid 0.0.157 → 0.0.158

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.
@@ -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",Qd);class tf extends HTMLElement{constructor(){super();Y(this,Ca);Y(this,Dt);Y(this,is);Y(this,me);Y(this,yr);Y(this,vr);Y(this,_n);Y(this,Sn,0);Y(this,bi,0);it(this,"refresh",()=>{if(!f(this,Dt))return;var t=$(".ng-container-body",f(this,Dt).body),l=$(".ng-scroll-thumb",this.shadowRoot),c=$("table > thead",t),o=f(this,Dt).dataManager.viewRecords.rawIndex,r=$(f(this,me).track).height(),n=$(f(this,me).thumb).height();Number(f(this,Dt).getAttribute("display-row-count")||0)>=f(this,Dt).dataManager.rawRecords.length||parseInt($(".ng-container .ng-table tr.nodata",f(this,Dt).body).height())>0&&(f(this,Dt).dataManager.rawRecords.length==0||f(this,Dt).dataManager.viewRecords.rawIndex==0)?$(this).hide():$(this).show();var e=Math.min(r*(t.height()-c.height())/(f(this,Dt).template.height()*f(this,Dt).template.length*f(this,Dt).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,Dt).isFirstPage)u=0;else if(f(this,Dt).isLastPage)u=r-n-2;else{var a=parseInt($(".ng-container-body tbody.bindable tr",f(this,Dt).body).not(".nodata").length/f(this,Dt).template.length);u=parseInt(o*i/(f(this,Dt).data.count()-a+1)),u>r-n-3&&(u=r-n-3)}f(this,me).thumb.style.top=u+"px",f(this,me).top.disabled=!!f(this,Dt).isFirstPage,f(this,me).bottom.disabled=!!f(this,Dt).isLastPage,$(this).is(":visible")&&$("ng-hscrollbar",f(this,Dt).body).is(":visible")?$(".ng-scroll-edge",f(this,Dt).body).show():$(".ng-scroll-edge",f(this,Dt).body).hide()}});it(this,"refreshV2",()=>{if(f(this,Dt)){var t=$(".ng-scroll-thumb",this.shadowRoot),l=f(this,Dt).dataManager.viewRecords.rawIndex,c=this.trackHeight,o=this.thumbHeight,r=Math.min(c*(this.bodyHeight-this.theadHeight)/(this.templateHeight*f(this,Dt).template.length*f(this,Dt).data.count()),c);t[0].dataset.height=r,r<16&&(r=16);var n=c-f(this,Cn).call(this),s;if(f(this,Dt).isFirstPage)s=0;else if(f(this,Dt).isLastPage)s=c-o-2;else{var e=parseInt($(".ng-container-body tbody.bindable tr",f(this,Dt).body).not(".nodata").length/f(this,Dt).template.length);s=parseInt(l*n/(f(this,Dt).data.count()-e+1)),s>c-o-3&&(s=c-o-3)}f(this,me).thumb.style.top=s+"px",f(this,me).top.disabled=!!f(this,Dt).isFirstPage,f(this,me).bottom.disabled=!!f(this,Dt).isLastPage}});it(this,"delayScroll",(t,l,c,o)=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Dt).scrollBy(t),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Dt).scrollBy(t)?o&&o.call():clearInterval(f(this,vr))},c))},l))});it(this,"stopScroll",()=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))});Y(this,Jh,()=>{var t=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Dt).scrollBy(l),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Dt).scrollBy(l)},10))},500))};$(f(this,me).top).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(-1)}),$(f(this,me).bottom).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(1)}),$(f(this,me).top).on("touchstart",l=>{t(-1)}),$(f(this,me).bottom).on("touchstart",l=>{t(1)}),f(this,me).top.ontouchend=f(this,me).bottom.ontouchend=f(this,me).track.ontouchend=f(this,me).top.onmouseup=f(this,me).top.onmouseleave=f(this,me).bottom.onmouseup=f(this,me).bottom.onmouseleave=f(this,me).track.onmouseup=f(this,me).track.onmouseleave=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))},$(f(this,me).track).on("mousedown",f(this,_a)),$(f(this,me).track).on("touchstart",f(this,Qh)),$(f(this,me).thumb).on("mousedown",f(this,ka)),$(f(this,me).thumb).on("touchstart",f(this,tc)),document.addEventListener("mouseup",l=>{f(this,is)&&tt(this,is,!1),document.removeEventListener("mousemove",f(this,kn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,is,!1),document.removeEventListener("touchmove",f(this,Sa)),typeof this.onDragStop=="function"&&this.onDragStop()})});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,_a).call(this,t)});Y(this,_a,t=>{if(!f(this,is)&&!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftKey)){t.preventDefault();var l=f(this,me).thumb.getBoundingClientRect();clearInterval(f(this,yr)),clearInterval(f(this,vr)),t.clientY>l.y?f(this,Dt).pageDown():f(this,Dt).pageUp(),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{var c=f(this,me).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,Dt).pageDown():f(this,Dt).pageUp();o||clearInterval(f(this,vr))}},10))},500))}});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,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,Sn,t.clientY),tt(this,is,!0),this.shiftY=t.offsetY+f(this,me).track.getBoundingClientRect().y,this.trackHeight=$(f(this,me).track).height(),this.thumbHeight=$(f(this,me).thumb).height(),this.nodataHeight=$(".ng-container .ng-table tr.nodata",f(this,Dt).body).height(),this.bodyHeight=$(".ng-container-body",f(this,Dt).body).height(),this.templateHeight=f(this,Dt).template.height(),this.theadHeight=$(".ng-container-body table > thead",f(this,Dt).body).height()||0,this.tfootHeight=$(".ng-container-body table > tfoot",f(this,Dt).body).height()||0,this.fixedHeight=$(".ng-container-body tbody.fixed",f(this,Dt).body).height(),this.tableHeight=$(".ng-container-body .ng-table",f(this,Dt).body).height(),tt(this,_n,!0),document.addEventListener("mousemove",f(this,kn)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,kn,t=>{if(!f(this,is))return;t.preventDefault();var l=t.clientY-f(this,Sn);f(this,_n)&&(H.j.querySelectorAll("th,td",f(this,Dt).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,_n,!1));var c=this.trackHeight;let o=f(this,Cn).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,Dt).body).not(".nodata").length/f(this,Dt).template.length),s=parseInt(r*(f(this,Dt).data.count()+1-n)/parseInt(c-o)),e=Math.max(0,c-o),i=Math.max(0,f(this,Dt).matrix.getTotalHeight()-this.bodyHeight),u=f(this,Dt).matrix.getHeight(s),a=i>0?u*(e/i):0;f(this,Dt).dataManager.viewRecords.rawIndex!=s?(f(this,Dt).scrollToV2(s),tt(this,Sn,t.clientY),tt(this,bi,0),Ye(this,Ca,vu).call(this,0)):(f(this,me).thumb.style.top=r+"px",f(this,Dt).matrix.getHeight(f(this,Dt).dataManager.viewRecords.rawIndex),id.log(u,a,l,s),l>0?tt(this,bi,-Math.abs(u*l/a)):tt(this,bi,-Math.abs(u*l/a)),Ye(this,Ca,vu).call(this,f(this,bi)))});Y(this,Cn,()=>parseInt(f(this,me).thumb.dataset.height));this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Dt,this.getRootNode().host),f(this,Dt)&&(this.shadowRoot.innerHTML=`
655
+ `,super.connectedCallback(),this.cell.dataset.bind="rowState"}}customElements.get("ng-row-state")||customElements.define("ng-row-state",Qd);class tf extends HTMLElement{constructor(){super();Y(this,Ca);Y(this,Dt);Y(this,is);Y(this,me);Y(this,yr);Y(this,vr);Y(this,_n);Y(this,Sn,0);Y(this,bi,0);it(this,"refresh",()=>{if(!f(this,Dt))return;var t=$(".ng-container-body",f(this,Dt).body),l=$(".ng-scroll-thumb",this.shadowRoot),c=$("table > thead",t),o=f(this,Dt).dataManager.viewRecords.rawIndex,r=$(f(this,me).track).height(),n=$(f(this,me).thumb).height();Number(f(this,Dt).getAttribute("display-row-count")||0)>=f(this,Dt).dataManager.rawRecords.length||parseInt($(".ng-container .ng-table tr.nodata",f(this,Dt).body).height())>0&&(f(this,Dt).dataManager.rawRecords.length==0||f(this,Dt).dataManager.viewRecords.rawIndex==0)?$(this).hide():$(this).show();var e=Math.min(r*(t.height()-c.height())/(f(this,Dt).template.height()*f(this,Dt).template.length*f(this,Dt).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,Dt).isFirstPage)u=0;else if(f(this,Dt).isLastPage)u=r-n-2;else{var a=parseInt($(".ng-container-body tbody.bindable tr",f(this,Dt).body).not(".nodata").length/f(this,Dt).template.length);u=parseInt(o*i/(f(this,Dt).data.count()-a+1)),u>r-n-3&&(u=r-n-3)}f(this,me).thumb.style.top=u+"px",f(this,me).top.disabled=!!f(this,Dt).isFirstPage,f(this,me).bottom.disabled=!!f(this,Dt).isLastPage,$(this).is(":visible")&&$("ng-hscrollbar",f(this,Dt).body).is(":visible")?$(".ng-scroll-edge",f(this,Dt).body).show():$(".ng-scroll-edge",f(this,Dt).body).hide()}});it(this,"refreshV2",()=>{if(f(this,Dt)){var t=$(".ng-scroll-thumb",this.shadowRoot),l=f(this,Dt).dataManager.viewRecords.rawIndex,c=this.trackHeight,o=this.thumbHeight,r=Math.min(c*(this.bodyHeight-this.theadHeight)/(this.templateHeight*f(this,Dt).template.length*f(this,Dt).data.count()),c);t[0].dataset.height=r,r<16&&(r=16);var n=c-f(this,Cn).call(this),s;if(f(this,Dt).isFirstPage)s=0;else if(f(this,Dt).isLastPage)s=c-o-2;else{var e=parseInt($(".ng-container-body tbody.bindable tr",f(this,Dt).body).not(".nodata").length/f(this,Dt).template.length);s=parseInt(l*n/(f(this,Dt).data.count()-e+1)),s>c-o-3&&(s=c-o-3)}f(this,me).thumb.style.top=s+"px",f(this,me).top.disabled=!!f(this,Dt).isFirstPage,f(this,me).bottom.disabled=!!f(this,Dt).isLastPage}});it(this,"delayScroll",(t,l,c,o)=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Dt).scrollBy(t),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Dt).scrollBy(t)?o&&o.call():clearInterval(f(this,vr))},c))},l))});it(this,"stopScroll",()=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))});Y(this,Jh,()=>{var t=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr)),f(this,Dt).scrollBy(l),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{f(this,Dt).scrollBy(l)},10))},500))};$(f(this,me).top).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(-1)}),$(f(this,me).bottom).on("mousedown",l=>{l.buttons!=1||l.altKey||l.ctrlKey||l.shiftKey||t(1)}),$(f(this,me).top).on("touchstart",l=>{t(-1)}),$(f(this,me).bottom).on("touchstart",l=>{t(1)}),f(this,me).top.ontouchend=f(this,me).bottom.ontouchend=f(this,me).track.ontouchend=f(this,me).top.onmouseup=f(this,me).top.onmouseleave=f(this,me).bottom.onmouseup=f(this,me).bottom.onmouseleave=f(this,me).track.onmouseup=f(this,me).track.onmouseleave=l=>{clearInterval(f(this,yr)),clearInterval(f(this,vr))},$(f(this,me).track).on("mousedown",f(this,_a)),$(f(this,me).track).on("touchstart",f(this,Qh)),$(f(this,me).thumb).on("mousedown",f(this,ka)),$(f(this,me).thumb).on("touchstart",f(this,tc)),document.addEventListener("mouseup",l=>{f(this,is)&&tt(this,is,!1),document.removeEventListener("mousemove",f(this,kn)),typeof this.onDragStop=="function"&&this.onDragStop()}),document.addEventListener("touchend",l=>{tt(this,is,!1),document.removeEventListener("touchmove",f(this,Sa)),typeof this.onDragStop=="function"&&this.onDragStop()})});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,_a).call(this,t)});Y(this,_a,t=>{if(!f(this,is)&&!(t.buttons!=1||t.altKey||t.ctrlKey||t.shiftKey)){t.preventDefault();var l=f(this,me).thumb.getBoundingClientRect();clearInterval(f(this,yr)),clearInterval(f(this,vr)),t.clientY>l.y?f(this,Dt).pageDown():f(this,Dt).pageUp(),tt(this,yr,setInterval(()=>{clearInterval(f(this,yr)),tt(this,vr,setInterval(()=>{var c=f(this,me).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,Dt).pageDown():f(this,Dt).pageUp();o||clearInterval(f(this,vr))}},10))},500))}});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,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,Sn,t.clientY),tt(this,is,!0),this.shiftY=t.offsetY+f(this,me).track.getBoundingClientRect().y,this.trackHeight=$(f(this,me).track).height(),this.thumbHeight=$(f(this,me).thumb).height(),this.nodataHeight=$(".ng-container .ng-table tr.nodata",f(this,Dt).body).height(),this.bodyHeight=$(".ng-container-body",f(this,Dt).body).height(),this.templateHeight=f(this,Dt).template.height(),this.theadHeight=$(".ng-container-body table > thead",f(this,Dt).body).height()||0,this.tfootHeight=$(".ng-container-body table > tfoot",f(this,Dt).body).height()||0,this.fixedHeight=$(".ng-container-body tbody.fixed",f(this,Dt).body).height(),this.tableHeight=$(".ng-container-body .ng-table",f(this,Dt).body).height(),tt(this,_n,!0),document.addEventListener("mousemove",f(this,kn)),typeof this.onDragStart=="function"&&this.onDragStart()});Y(this,kn,t=>{if(!f(this,is))return;t.preventDefault();var l=t.clientY-f(this,Sn);f(this,_n)&&(H.j.querySelectorAll("th,td",f(this,Dt).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,_n,!1));var c=this.trackHeight;let o=f(this,Cn).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,Dt).body).not(".nodata").length/f(this,Dt).template.length),s=parseInt(r*(f(this,Dt).data.count()+1-n)/parseInt(c-o)),e=Math.max(0,c-o),i=Math.max(0,f(this,Dt).matrix.getTotalHeight()-this.bodyHeight),u=f(this,Dt).matrix.getHeight(s),a=i>0?u*(e/i):0;f(this,Dt).dataManager.viewRecords.rawIndex!=s?(f(this,Dt).scrollToV2(s),tt(this,Sn,t.clientY),tt(this,bi,0),Ye(this,Ca,vu).call(this,0)):(f(this,me).thumb.style.top=r+"px",f(this,Dt).matrix.getHeight(f(this,Dt).dataManager.viewRecords.rawIndex),id.log(u,a,l,s,u*l/a),l>0?tt(this,bi,-Math.abs(u*l/a)):tt(this,bi,-Math.abs(u*l/a)),Ye(this,Ca,vu).call(this,f(this,bi)))});Y(this,Cn,()=>parseInt(f(this,me).thumb.dataset.height));this.attachShadow({mode:"open"})}connectedCallback(){tt(this,Dt,this.getRootNode().host),f(this,Dt)&&(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")}