Files
YG_FT/frontend/dist/assets/el-scrollbar-CF42LNzg.js

2 lines
7.2 KiB
JavaScript
Raw Normal View History

import{ak as C,b as I,R as Y,d as U,B as ae,a as le,C as re,H as ne,aS as D,a9 as q,o as B,e as K,w as oe,K as ie,q as j,aL as ce,n as P,f as N,al as $,L as ue,Z as fe,y as d,bt as ve,j as _,c as se,s as V,M as de,D as F,cQ as me,G as he,P as G,bz as pe,h as be,r as ge,g as ye,a3 as Se,aK as Q,am as Z,a7 as J,F as we,z as ze,l as Ee}from"./index-Ds9AETjS.js";import{u as xe}from"./index-BSbCLbaz.js";const He=I({distance:{type:Number,default:0},height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:Boolean,wrapStyle:{type:Y([String,Object,Array,Boolean]),default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:Y([String,Object,Array,Boolean]),default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20},tabindex:{type:[String,Number],default:void 0},id:String,role:String,...xe(["ariaLabel","ariaOrientation"])}),Te={"end-reached":l=>["left","right","top","bottom"].includes(l),scroll:({scrollTop:l,scrollLeft:u})=>[l,u].every(C)},_e={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},Le=({move:l,size:u,bar:r})=>({[r.size]:u,transform:`translate${r.axis}(${l}%)`}),ke=I({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),X=Symbol("scrollbarContextKey");function ee(l,u,r=.03){return l-u>r}const Ce=I({always:{type:Boolean,default:!0},minSize:{type:Number,required:!0}}),Ne="Thumb";var Be=U({__name:"thumb",props:ke,setup(l){const u=l,r=ae(X),o=le("scrollbar");r||re(Ne,"can not inject scrollbar context");const m=d(),f=d(),y=d({}),g=d(!1);let h=!1,i=!1,p=0,v=0,s=ve?document.onselectstart:null;const e=_(()=>_e[u.vertical?"vertical":"horizontal"]),t=_(()=>Le({size:u.size,move:u.move,bar:e.value})),w=_(()=>m.value[e.value.offset]**2/r.wrapElement[e.value.scrollSize]/u.ratio/f.value[e.value.offset]),S=c=>{var H;if(c.stopPropagation(),c.ctrlKey||[1,2].includes(c.button))return;(H=window.getSelection())==null||H.removeAllRanges(),x(c);const b=c.currentTarget;b&&(y.value[e.value.axis]=b[e.value.offset]-(c[e.value.client]-b.getBoundingClientRect()[e.value.direction]))},E=c=>{if(!f.value||!m.value||!r.wrapElement)return;const b=(Math.abs(c.target.getBoundingClientRect()[e.value.direction]-c[e.value.client])-f.value[e.value.offset]/2)*100*w.value/m.value[e.value.offset];r.wrapElement[e.value.scroll]=b*r.wrapElement[e.value.scrollSize]/100},x=c=>{c.stopImmediatePropagation(),h=!0,p=r.wrapElement.scrollHeight,v=r.wrapElement.scrollWidth,document.addEventListener("mousemove",R),document.addEventListener("mouseup",L),s=document.onselectstart,document.onselectstart=()=>!1},R=c=>{if(!m.value||!f.value||h===!1)return;const b=y.value[e.value.axis];if(!b)return;const H=((m.value.getBoundingClientRect()[e.value.direction]-c[e.value.client])*-1-(f.value[e.value.offset]-b))*100*w.value/m.value[e.value.offset];e.value.scroll==="scrollLeft"?r.wrapElement[e.value.scroll]=H*v/100:r.wrapElement[e.value.scroll]=H*p/100},L=()=>{h=!1,y.value[e.value.axis]=0,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",L),k(),i&&(g.value=!1)},A=()=>{i=!1,g.value=!!u.size},W=()=>{i=!0,g.value=h};ne(()=>{k(),document.removeEventListener("mouseup",L)});const k=()=>{document.onselectstart!==s&&(document.onselectstart=s)};return D(q(r,"scrollbarElement"),"mousemove",A),D(q(r,"scrollbarElement"),"mouseleave",W),(c,b)=>(B(),K(fe,{name:N(o).b("fade"),persisted:""},{default:oe(()=>[ie(j("div",{ref_key:"instance",ref:m,class:P([N(o).e("bar"),N(o).is(e.value.key)]),onMousedown:E,onClick:b[0]||(b[0]=ce(()=>{},["stop"]))},[j("div",{ref_key:"thumb",ref:f,class:P(N(o).e("thumb")),style:$(t.value),onMousedown:S},null,38)],34),[[ue,l.always||g.value]])]),_:1},8,["name"]))}}),te=Be,Pe=U({__name:"bar",props:Ce,setup(l,{expose:u}){const r=