@ninebone/table 0.0.690 → 0.0.691

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