@ninebone/table 0.0.613 → 0.0.614

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=c(()=>{const s=t(this,B).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,E,{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,V)||this.refresh()}),t(this,Ot).call(this),t(this,Wt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};B=new WeakMap,V=new WeakMap,E=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Wt=new WeakMap,Q=new WeakMap,Ot=new WeakMap,c(Ae,"NineTableHScrollBar");let F=Ae;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ee=class Ee extends HTMLElement{constructor(){super();d(this,Y);d(this,ct);d(this,tt,!1);d(this,k);d(this,vt,0);d(this,xt,0);T(this,"refresh",c(()=>{if(!t(this,Y)||!t(this,k))return;const e=t(this,k).container,s=t(this,k).track,n=t(this,k).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,h=t(this,ct).getRowHeight(),l=a*h;if(l<=r){n.style.display="none",t(this,k).top.disabled=!0,t(this,k).bottom.disabled=!0;return}else n.style.display="block";const f=s.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/l),f),20);n.style.height=`${u}px`;const g=e.scrollTop,b=Math.max(l-r,1);let m=0;b>0&&(m=g/b*(f-u));const w=f-u;m<0&&(m=0),m>w&&(m=w),n.style.top=`${m}px`,t(this,k).top.disabled=g<=0,t(this,k).bottom.disabled=g>=b-1},"refresh"));d(this,zt,c(()=>{A.log("nine-table-vscrollbar.#init");const e=t(this,k).container,s=c(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,ct).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,tt)||this.refresh()}),t(this,k).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,vt,n.clientY),y(this,xt,e.scrollTop);const r=c(a=>{if(!t(this,tt))return;const h=t(this,k).track.getBoundingClientRect(),l=t(this,k).thumb.clientHeight,u=h.height-l,g=a.clientY-t(this,vt),b=e.clientHeight,m=s(),w=Math.max(m-b,1);if(u>0&&w>0){const R=g/u*w;let v=t(this,xt)+R;const W=Math.max(0,m-b);v<0&&(v=0),v>W&&(v=W),e.scrollTop=v}this.refresh()},"onMouseMove"),o=c(()=>{y(this,tt,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,k).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,k).thumb)return;const r=t(this,k).track.getBoundingClientRect(),o=t(this,k).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.height-o,f=e.clientHeight,u=s(),g=Math.max(u-f,1);if(l>0&&g>0){const b=Math.max(0,Math.min(1,a/l));e.scrollTop=b*g}this.refresh()}),t(this,k).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,k).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,Y,this.getRootNode().host),y(this,ct,this.closest("nine-table-sheet")),this.innerHTML=`
63
+ `;const e=c(()=>{const s=t(this,B).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}y(this,E,{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,V)||this.refresh()}),t(this,Ot).call(this),t(this,Wt).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,J)&&t(this,J).disconnect()}};B=new WeakMap,V=new WeakMap,E=new WeakMap,Z=new WeakMap,G=new WeakMap,J=new WeakMap,Wt=new WeakMap,Q=new WeakMap,Ot=new WeakMap,c(Ae,"NineTableHScrollBar");let F=Ae;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",F);const Ee=class Ee extends HTMLElement{constructor(){super();d(this,Y);d(this,ct);d(this,tt,!1);d(this,k);d(this,vt,0);d(this,xt,0);T(this,"refresh",c(()=>{if(!t(this,Y)||!t(this,k))return;const e=t(this,k).container,s=t(this,k).track,n=t(this,k).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,h=t(this,ct).getRowHeight(),l=a*h;if(l<=r||a===0){this.style.display="none";return}else this.style.display="flex";const f=s.clientHeight;if(f<=0)return;const u=Math.max(Math.min(f*(r/l),f),20);n.style.height=`${u}px`;const g=e.scrollTop,b=Math.max(l-r,1);let m=0;b>0&&(m=g/b*(f-u));const w=f-u;m<0&&(m=0),m>w&&(m=w),n.style.top=`${m}px`,t(this,k).top.disabled=g<=0,t(this,k).bottom.disabled=g>=b-1},"refresh"));d(this,zt,c(()=>{A.log("nine-table-vscrollbar.#init");const e=t(this,k).container,s=c(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,ct).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,tt)||this.refresh()}),t(this,k).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,vt,n.clientY),y(this,xt,e.scrollTop);const r=c(a=>{if(!t(this,tt))return;const h=t(this,k).track.getBoundingClientRect(),l=t(this,k).thumb.clientHeight,u=h.height-l,g=a.clientY-t(this,vt),b=e.clientHeight,m=s(),w=Math.max(m-b,1);if(u>0&&w>0){const R=g/u*w;let v=t(this,xt)+R;const W=Math.max(0,m-b);v<0&&(v=0),v>W&&(v=W),e.scrollTop=v}this.refresh()},"onMouseMove"),o=c(()=>{y(this,tt,!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)}),t(this,k).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,k).thumb)return;const r=t(this,k).track.getBoundingClientRect(),o=t(this,k).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.height-o,f=e.clientHeight,u=s(),g=Math.max(u-f,1);if(l>0&&g>0){const b=Math.max(0,Math.min(1,a/l));e.scrollTop=b*g}this.refresh()}),t(this,k).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,k).bottom.addEventListener("click",()=>{e.scrollTop+=40})},"#init"))}connectedCallback(){y(this,Y,this.getRootNode().host),y(this,ct,this.closest("nine-table-sheet")),this.innerHTML=`
64
64
  <style>
65
65
  nine-table-vscrollbar {
66
66
  display: flex;