@ninebone/table 0.0.509 → 0.0.511
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.
- package/dist/nine-table.js +41 -39
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +1 -1
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.umd.js
CHANGED
|
@@ -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,z).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()}};z=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,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,tt,!1);d(this,T);d(this,xt,0);d(this,vt,0);R(this,"refresh",h(()=>{if(!t(this,Y)||!t(this,T))return;const e=t(this,T).container,s=t(this,T).track,n=t(this,T).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,c=t(this,lt).getRowHeight(),l=a*c;if(l<=r){n.style.display="none",t(this,T).top.disabled=!0,t(this,T).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 b=e.scrollTop,g=Math.max(l-r,1);let m=0;g>0&&(m=b/g*(f-u));const w=f-u;m<0&&(m=0),m>w&&(m=w),n.style.top=`${m}px`,t(this,T).top.disabled=b<=0,t(this,T).bottom.disabled=b>=g-1},"refresh"));d(this,Bt,h(()=>{const e=t(this,T).container,s=h(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,lt).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,tt)||this.refresh()}),t(this,T).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,xt,n.clientY),y(this,vt,e.scrollTop);const r=h(a=>{if(!t(this,tt))return;const c=t(this,T).track.getBoundingClientRect(),l=t(this,T).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,xt),g=e.clientHeight,m=s(),w=Math.max(m-g,1);if(u>0&&w>0){const q=b/u*w;let x=t(this,vt)+q;const N=Math.max(0,m-g);x<0&&(x=0),x>N&&(x=N),e.scrollTop=x}this.refresh()},"onMouseMove"),o=h(()=>{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,T).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,T).thumb)return;const r=t(this,T).track.getBoundingClientRect(),o=t(this,T).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.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,T).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,T).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,z).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()}};z=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,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,tt,!1);d(this,T);d(this,xt,0);d(this,vt,0);R(this,"refresh",h(()=>{if(!t(this,Y)||!t(this,T))return;k.log("nine-table-vscrollbar.refresh");const e=t(this,T).container,s=t(this,T).track,n=t(this,T).thumb,r=e.clientHeight,a=(t(this,Y).data.get()||[]).length,c=t(this,lt).getRowHeight(),l=a*c;if(l<=r){n.style.display="none",t(this,T).top.disabled=!0,t(this,T).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 b=e.scrollTop,g=Math.max(l-r,1);let m=0;g>0&&(m=b/g*(f-u));const w=f-u;m<0&&(m=0),m>w&&(m=w),n.style.top=`${m}px`,t(this,T).top.disabled=b<=0,t(this,T).bottom.disabled=b>=g-1},"refresh"));d(this,Bt,h(()=>{k.log("nine-table-vscrollbar.#init");const e=t(this,T).container,s=h(()=>{const r=(t(this,Y).data.get()||[]).length,o=t(this,lt).getRowHeight();return r*o},"getContentHeight");e.addEventListener("scroll",()=>{t(this,tt)||this.refresh()}),t(this,T).thumb.addEventListener("mousedown",n=>{if(n.button!==0)return;n.stopPropagation(),n.preventDefault(),y(this,tt,!0),y(this,xt,n.clientY),y(this,vt,e.scrollTop);const r=h(a=>{if(!t(this,tt))return;const c=t(this,T).track.getBoundingClientRect(),l=t(this,T).thumb.clientHeight,u=c.height-l,b=a.clientY-t(this,xt),g=e.clientHeight,m=s(),w=Math.max(m-g,1);if(u>0&&w>0){const q=b/u*w;let x=t(this,vt)+q;const N=Math.max(0,m-g);x<0&&(x=0),x>N&&(x=N),e.scrollTop=x}this.refresh()},"onMouseMove"),o=h(()=>{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,T).track.addEventListener("mousedown",n=>{if(n.button!==0||n.target===t(this,T).thumb)return;const r=t(this,T).track.getBoundingClientRect(),o=t(this,T).thumb.clientHeight,a=n.clientY-r.top-o/2,l=r.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,T).top.addEventListener("click",()=>{e.scrollTop-=40}),t(this,T).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;
|