2 lines
80 KiB
JavaScript
2 lines
80 KiB
JavaScript
|
|
import{f as w,c as $,a7 as de,j as Gn,k as it,a as me,a5 as Xe,aR as Te,aB as Ee,t as fe,U as le,a6 as vn,v as rt,aS as st,P as ve,p as P,aC as j,cZ as $t,Y as Fe,cF as Pt,aD as $e,_ as ne,L as hn,M as pn,e3 as gn,dJ as yn,bi as Xn,a8 as Ye,bz as Yn,au as Mt,m as It,b as _t,r as Ge,dV as Et,ab as ct,at as dt,u as Lt,g as Un,ay as Gt,Z as Wn,$ as qn,ae as Zn,Q as Qn,aH as Le,I as Ae,dE as Jn,aQ as eo,aw as to,a_ as Ot,a$ as pe,bm as He,b1 as et,o as no,d as oo}from"./index-CnBLdARH.js";import{R as lo,k as ao,l as io}from"./index-GiZ32IKV.js";function Xt(){const e=t=>{e.current=t};return e}const ut=(e,t)=>{let{height:n,offset:o,prefixCls:l,onInnerResize:a}=e,{slots:i}=t;var s;let u={},r={display:"flex",flexDirection:"column"};return o!==void 0&&(u={height:"".concat(n,"px"),position:"relative",overflow:"hidden"},r=w(w({},r),{transform:"translateY(".concat(o,"px)"),position:"absolute",left:0,right:0,top:0})),$("div",{style:u},[$(lo,{onResize:d=>{let{offsetHeight:c}=d;c&&a&&a()}},{default:()=>[$("div",{style:r,class:de({["".concat(l,"-holder-inner")]:l})},[(s=i.default)===null||s===void 0?void 0:s.call(i)])]})])};ut.displayName="Filter";ut.inheritAttrs=!1;ut.props={prefixCls:String,height:Number,offset:Number,onInnerResize:Function};const mn=(e,t)=>{let{setRef:n}=e,{slots:o}=t;var l;const a=Gn((l=o.default)===null||l===void 0?void 0:l.call(o));return a&&a.length?it(a[0],{ref:n}):a};mn.props={setRef:{type:Function,default:()=>{}}};const ro=20;function Yt(e){return"touches"in e?e.touches[0].pageY:e.pageY}const so=me({compatConfig:{MODE:3},name:"ScrollBar",inheritAttrs:!1,props:{prefixCls:String,scrollTop:Number,scrollHeight:Number,height:Number,count:Number,onScroll:{type:Function},onStartMove:{type:Function},onStopMove:{type:Function}},setup(){return{moveRaf:null,scrollbarRef:Xt(),thumbRef:Xt(),visibleTimeout:null,state:Xe({dragging:!1,pageY:null,startTop:null,visible:!1})}},watch:{scrollTop:{handler(){this.delayHidden()},flush:"post"}},mounted(){var e,t;(e=this.scrollbarRef.current)===null||e===void 0||e.addEventListener("touchstart",this.onScrollbarTouchStart,Te?{passive:!1}:!1),(t=this.thumbRef.current)===null||t===void 0||t.addEventListener("touchstart",this.onMouseDown,Te?{passive:!1}:!1)},beforeUnmount(){this.removeEvents(),clearTimeout(this.visibleTimeout)},methods:{delayHidden(){clearTimeout(this.visibleTimeout),this.state.visible=!0,this.visibleTimeout=setTimeout(()=>{this.state.visible=!1},2e3)},onScrollbarTouchStart(e){e.preventDefault()},onContainerMouseDown(e){e.stopPropagation(),e.preventDefault()},patchEvents(){window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onMouseUp),this.thumbRef.current.addEventListener("touchmove",this.onMouseMove,Te?{passive:!1}:!1),this.thumbRef.current.addEventListener("touchend",this.onMouseUp)},removeEvents(){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),this.scrollbarRef.current.removeEventListener("touchstart",this.onScrollbarTouchStart,Te?{passive:!1}:!1),this.thumbRef.current&&(this.thumbRef.current.removeEventListener("touchstart",this.onMouseDown,Te?{passive:!1}:!1),this.thumbRef.current.removeEventListener("touchmove",this.onMouseMove,Te?{passive:!1}:!1),this.thumbRef.current.removeEventListener("touchend",this.onMouseUp)),Ee.cancel(this.moveRaf)},onMouseDown(e){const{onStartMove:t}=this.$props;w(this.state,{dragging:!0,pageY:Yt(e),startTop:this.getTop()}),t(),this.patchEvents(),e.stopPropagation(),e.preventDefault()},onMouseMove(e){const{dragging:t,pageY:n,startTop:o}=this.state,{onScroll:l}=this.$props;if(Ee.cancel(this.moveRaf),t){const a=Yt(e)-n,i=o+a,s=this.getEnableScrollRange(),u=this.getEnableHeightRange(),r=u?i/u:0,d=Math.ceil(r*s);this.moveRaf=Ee(()=>{l(d)})}},onMouseUp(){const{onStopMove:e}=this.$props;this.state.dragging=!1,e(),this.removeEvents()},getSpinHeight(){const{height:e,scrollHeight:t}=this.$props;let n=e/t*100;return n=Math.max(n,ro),n=Math.min(n,e/2),Math.floor(n)},getEnableScrollRange(){const{scrollHeight:e,height:t}=this.$props;return e-t||0},get
|