test_lgq/niucloud/public/web/_nuxt/el-carousel.7303e930.js

2 lines
8.0 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
import{ai as re,aG as ke,p as le,ab as _e,N as ie,r as N,s as O,u as e,aj as D,b as ue,aH as Ne,aI as Ee,v as Se,aA as Me,a as J,q as ce,o as $,e as L,j as K,c as te,w as U,a0 as G,y as B,al as j,f as W,E as ae,an as Te,a1 as q,as as se,k as R,i as Ae,x as ve,z as fe,F as $e,G as Be,t as Le,B as de,O as Oe,D as Pe,aJ as He,aK as Ve,C as ze,Q as De}from"./entry.539d3b49.js";import{f as je}from"./vnode.48eda29e.js";import{t as oe}from"./throttle.4fc9319f.js";const Re=(r,I,l)=>je(r.subTree).filter(c=>{var t;return ke(c)&&((t=c.type)==null?void 0:t.name)===I&&!!c.component}).map(c=>c.component.uid).map(c=>l[c]).filter(c=>!!c),Fe=(r,I)=>{const l={},s=re([]);return{children:s,addChild:t=>{l[t.uid]=t,s.value=Re(r,I,l)},removeChild:t=>{delete l[t],s.value=s.value.filter(p=>p.uid!==t)}}},Ke=le({initialIndex:{type:Number,default:0},height:{type:String,default:""},trigger:{type:String,values:["hover","click"],default:"hover"},autoplay:{type:Boolean,default:!0},interval:{type:Number,default:3e3},indicatorPosition:{type:String,values:["","none","outside"],default:""},arrow:{type:String,values:["always","hover","never"],default:"hover"},type:{type:String,values:["","card"],default:""},loop:{type:Boolean,default:!0},direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},pauseOnHover:{type:Boolean,default:!0}}),Ue={change:(r,I)=>[r,I].every(_e)},me=Symbol("carouselContextKey"),ne=300,We=(r,I,l)=>{const{children:s,addChild:g,removeChild:c}=Fe(ie(),"ElCarouselItem"),t=N(-1),p=N(null),y=N(!1),h=N(),b=O(()=>r.arrow!=="never"&&!e(k)),E=O(()=>s.value.some(a=>a.props.label.toString().length>0)),C=O(()=>r.type==="card"),k=O(()=>r.direction==="vertical"),S=oe(a=>{o(a)},ne,{trailing:!0}),_=oe(a=>{P(a)},ne);function w(){p.value&&(clearInterval(p.value),p.value=null)}function M(){r.interval<=0||!r.autoplay||p.value||(p.value=setInterval(()=>H(),r.interval))}const H=()=>{t.value<s.value.length-1?t.value=t.value+1:r.loop&&(t.value=0)};function o(a){if(Me(a)){const V=s.value.filter(F=>F.props.name===a);V.length>0&&(a=s.value.indexOf(V[0]))}if(a=Number(a),Number.isNaN(a)||a!==Math.floor(a))return;const m=s.value.length,A=t.value;a<0?t.value=r.loop?m-1:0:a>=m?t.value=r.loop?0:m-1:t.value=a,A===t.value&&i(A),Y()}function i(a){s.value.forEach((m,A)=>{m.translateItem(A,t.value,a)})}function n(a,m){var A,V,F,Z;const z=e(s),x=z.length;if(x===0||!a.states.inStage)return!1;const Ce=m+1,ye=m-1,ee=x-1,Ie=z[ee].states.active,ge=z[0].states.active,we=(V=(A=z[Ce])==null?void 0:A.states)==null?void 0:V.active,be=(Z=(F=z[ye])==null?void 0:F.states)==null?void 0:Z.active;return m===ee&&ge||we?"left":m===0&&Ie||be?"right":!1}function f(){y.value=!0,r.pauseOnHover&&w()}function T(){y.value=!1,M()}function v(a){e(k)||s.value.forEach((m,A)=>{a===n(m,A)&&(m.states.hover=!0)})}function u(){e(k)||s.value.forEach(a=>{a.states.hover=!1})}function d(a){t.value=a}function P(a){r.trigger==="hover"&&a!==t.value&&(t.value=a)}function Q(){o(t.value-1)}function he(){o(t.value+1)}function Y(){w(),M()}D(()=>t.value,(a,m)=>{i(m),m>-1&&I("change",a,m)}),D(()=>r.autoplay,a=>{a?M():w()}),D(()=>r.loop,()=>{o(t.value)}),D(()=>r.interval,()=>{Y()}),D(()=>s.value,()=>{s.value.length>0&&o(r.initialIndex)});const X=re();return ue(()=>{X.value=Ne(h.value,()=>{i()}),M()}),Ee(()=>{w(),h.value&&X.value&&X.value.stop()}),Se(me,{root:h,isCardType:C,isVertical:k,items:s,loop:r.loop,addItem:g,removeItem:c,setActiveItem:o}),{root:h,activeIndex:t,arrowDisplay:b,hasLabel:E,hover:y,isCardType:C,items:s,handleButtonEnter:v,handleButtonLeave:u,handleIndicatorClick:d,handleMouseEnter:f,handleMouseLeave:T,setActiveItem:o,prev:Q,next:he,throttledArrowClick:S,throttledIndicatorHover:_}},Ge=["onMouseenter","onClick"],qe={key:0},Je="ElCarousel",Qe=J({name:Je}),Xe=J({...Qe,props:Ke,emits:Ue,setup(r,{expose:I,emit:l}){const s=r,{root:g,activeIndex:c,arrowDisplay:t,hasLabel:p,hover:y,isCardType:h,items:b,handleButtonEnter:E,handleButtonLeave:C,handleIndicatorClick:k,handleMouseEnter:S,handleMouseLeave:_,setActiveItem:w,prev:M,next:H,throttledArrowClick:o,throttledIndicatorHover:i}=We(s,l),n=ce(