@ninebone/table 0.0.400 → 0.0.401

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.
@@ -60,7 +60,7 @@
60
60
  <button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
61
61
  <div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
62
62
  <button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
63
- `;const e=a(()=>{const s=t(this,_).querySelector(".ng-container-body");if(!s){setTimeout(e,10);return}g(this,x,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),s.addEventListener("scroll",()=>{t(this,D)||this.refresh()}),t(this,Tt).call(this),t(this,At).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,j)&&t(this,j).disconnect()}};_=new WeakMap,D=new WeakMap,x=new WeakMap,U=new WeakMap,X=new WeakMap,j=new WeakMap,At=new WeakMap,F=new WeakMap,Tt=new WeakMap,a(le,"NineTableHScrollBar");let z=le;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",z);const ae=class ae extends HTMLElement{constructor(){super();c(this,B);c(this,tt);c(this,N,!1);c(this,R);c(this,dt,0);c(this,ft,0);S(this,"refresh",a(()=>{if(!t(this,B)||!t(this,R)||t(this,N))return;const e=t(this,R).container,s=t(this,R).track,o=t(this,R).thumb,r=e.clientHeight,l=(t(this,B).data.get()||[]).length,d=t(this,tt).getRowHeight(),h=l*d;if(v.log(h,r),h<=r){o.style.display="none",t(this,R).top.disabled=!0,t(this,R).bottom.disabled=!0;return}else o.style.display="block";const f=s.clientHeight;if(v.log(s,f,this,this.clientHeight),f<=0)return;const u=Math.max(Math.min(f*(r/h),f),20);o.style.height=`${u}px`;const b=e.scrollTop,y=Math.max(h-r,1);let w=0;y>0&&(w=b/y*(f-u));const q=f-u;w<0&&(w=0),w>q&&(w=q),o.style.top=`${w}px`,v.log(w),t(this,R).top.disabled=b<=0,t(this,R).bottom.disabled=b>=y-1},"refresh"));c(this,qt,a(()=>{const e=t(this,R).container,s=a(()=>{const r=(t(this,B).data.get()||[]).length,n=t(this,tt).getRowHeight();return r*n},"getContentHeight");e.addEventListener("scroll",()=>{t(this,N)||this.refresh()}),t(this,R).thumb.addEventListener("mousedown",o=>{if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),g(this,N,!0),g(this,dt,o.clientY),g(this,ft,e.scrollTop);const r=a(l=>{if(!t(this,N))return;const d=t(this,R).track.getBoundingClientRect(),h=t(this,R).thumb.clientHeight,u=d.height-h,b=l.clientY-t(this,dt),y=e.clientHeight,w=s(),q=Math.max(w-y,1);if(u>0&&q>0){const ct=b/u*q;let Et=t(this,ft)+ct;const ye=Math.max(0,w-y);Et<0&&(Et=0),Et>ye&&(Et=ye),e.scrollTop=Et}this.refresh()},"onMouseMove"),n=a(()=>{g(this,N,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",n),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",n)}),t(this,R).track.addEventListener("mousedown",o=>{if(o.button!==0||o.target===t(this,R).thumb)return;const r=t(this,R).track.getBoundingClientRect(),n=t(this,R).thumb.clientHeight,l=o.clientY-r.top-n/2,h=r.height-n,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(h>0&&b>0){const y=Math.max(0,Math.min(1,l/h));e.scrollTop=y*b}this.refresh()}),t(this,R).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,R).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){g(this,B,this.getRootNode().host),g(this,tt,this.closest("nine-table-sheet")),this.innerHTML=`
63
+ `;const e=a(()=>{const s=t(this,_).querySelector(".ng-container-body");if(!s){setTimeout(e,10);return}g(this,x,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),s.addEventListener("scroll",()=>{t(this,D)||this.refresh()}),t(this,Tt).call(this),t(this,At).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,j)&&t(this,j).disconnect()}};_=new WeakMap,D=new WeakMap,x=new WeakMap,U=new WeakMap,X=new WeakMap,j=new WeakMap,At=new WeakMap,F=new WeakMap,Tt=new WeakMap,a(le,"NineTableHScrollBar");let z=le;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",z);const ae=class ae extends HTMLElement{constructor(){super();c(this,B);c(this,tt);c(this,N,!1);c(this,R);c(this,dt,0);c(this,ft,0);S(this,"refresh",a(()=>{if(!t(this,B)||!t(this,R)||t(this,N))return;const e=t(this,R).container,s=t(this,R).track,o=t(this,R).thumb,r=e.clientHeight,l=(t(this,B).data.get()||[]).length,d=t(this,tt).getRowHeight(),h=l*d;if(v.log(h,r),h<=r){o.style.display="none",t(this,R).top.disabled=!0,t(this,R).bottom.disabled=!0;return}else o.style.display="block";const f=s.clientHeight;if(v.log(s,f,this,this.clientHeight),f<=0)return;const u=Math.max(Math.min(f*(r/h),f),20);o.style.height=`${u}px`;const b=e.scrollTop,y=Math.max(h-r,1);let w=0;y>0&&(w=b/y*(f-u));const q=f-u;w<0&&(w=0),w>q&&(w=q),o.style.top=`${w}px`,v.log(w),t(this,R).top.disabled=b<=0,t(this,R).bottom.disabled=b>=y-1},"refresh"));c(this,qt,a(()=>{const e=t(this,R).container,s=a(()=>{const r=(t(this,B).data.get()||[]).length,n=t(this,tt).getRowHeight();return r*n},"getContentHeight");e.addEventListener("scroll",()=>{t(this,N)||this.refresh()}),t(this,R).thumb.addEventListener("mousedown",o=>{if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),g(this,N,!0),g(this,dt,o.clientY),g(this,ft,e.scrollTop);const r=a(l=>{if(!t(this,N))return;const d=t(this,R).track.getBoundingClientRect(),h=t(this,R).thumb.clientHeight,u=d.height-h,b=l.clientY-t(this,dt),y=e.clientHeight;v.log(":::",this.clientHeight);const w=s(),q=Math.max(w-y,1);if(u>0&&q>0){const ct=b/u*q;let Et=t(this,ft)+ct;const ye=Math.max(0,w-y);Et<0&&(Et=0),Et>ye&&(Et=ye),e.scrollTop=Et}this.refresh()},"onMouseMove"),n=a(()=>{g(this,N,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",n),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",n)}),t(this,R).track.addEventListener("mousedown",o=>{if(o.button!==0||o.target===t(this,R).thumb)return;const r=t(this,R).track.getBoundingClientRect(),n=t(this,R).thumb.clientHeight,l=o.clientY-r.top-n/2,h=r.height-n,f=e.clientHeight,u=s(),b=Math.max(u-f,1);if(h>0&&b>0){const y=Math.max(0,Math.min(1,l/h));e.scrollTop=y*b}this.refresh()}),t(this,R).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,R).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){g(this,B,this.getRootNode().host),g(this,tt,this.closest("nine-table-sheet")),this.innerHTML=`
64
64
  <style>
65
65
  nine-table-vscrollbar {
66
66
  display: flex;