index-legacy-6d06cf7c.js 3.3 KB

1
  1. System.register(["./index-legacy-a314c7dd.js"],(function(t,e){"use strict";var a,n,s,i,l,o,u,r,d,c,h,m,g,p,f,v,_,x;return{setters:[t=>{a=t.c,n=t.b,s=t.n,i=t.d,l=t.r,o=t.bC,u=t.x,r=t.u,d=t.w,c=t._,h=t.a,m=t.L,g=t.z,p=t.bI,f=t.p,v=t.k,_=t.F,x=t.A}],execute:function(){var e=document.createElement("style");e.textContent="._animateWrap_1kuq9_1{width:1.46667rem!important;height:1.46667rem!important}._loading_1kuq9_5{height:1.46667rem!important}._loading_1kuq9_5 img{height:.8rem;width:3.2rem;margin-top:.53333rem}._pullRefresh_1kuq9_13 .van-pull-refresh__track{min-height:inherit}.lottie-animation-container{width:var(--lottie-animation-container-width);height:var(--lottie-animation-container-height);background-color:var(--lottie-animation-container-background-color);overflow:hidden;margin:0 auto}\n",document.head.appendChild(e);const[S,T,V]=a("pull-refresh"),k=["pulling","loosing","success"],D={disabled:Boolean,modelValue:Boolean,headHeight:n(50),successText:String,pullingText:String,loosingText:String,loadingText:String,pullDistance:s,successDuration:n(500),animationDuration:n(300)};var b=i({name:S,props:D,emits:["change","refresh","update:modelValue"],setup(t,{emit:e,slots:a}){let n;const s=l(),i=l(),v=o(s),_=u({status:"normal",distance:0,duration:0}),x=r(),S=()=>{if(50!==t.headHeight)return{height:`${t.headHeight}px`}},D=()=>"loading"!==_.status&&"success"!==_.status&&!t.disabled,b=(a,n)=>{const s=+(t.pullDistance||t.headHeight);_.distance=a,_.status=n?"loading":0===a?"normal":a<s?"pulling":"loosing",e("change",{status:_.status,distance:a})},H=()=>{const{status:e}=_;return"normal"===e?"":t[`${e}Text`]||V(e)},w=()=>{const{status:t,distance:e}=_;if(a[t])return a[t]({distance:e});const n=[];return k.includes(t)&&n.push(h("div",{class:T("text")},[H()])),"loading"===t&&n.push(h(m,{class:T("loading")},{default:H})),n},y=t=>{n=0===p(v.value),n&&(_.duration=0,x.start(t))},q=t=>{D()&&y(t)},$=()=>{n&&x.deltaY.value&&D()&&(_.duration=+t.animationDuration,"loosing"===_.status?(b(+t.headHeight,!0),e("update:modelValue",!0),g((()=>e("refresh")))):b(0))};return d((()=>t.modelValue),(e=>{_.duration=+t.animationDuration,e?b(+t.headHeight,!0):a.success||t.successText?(_.status="success",setTimeout((()=>{b(0)}),+t.successDuration)):b(0,!1)})),c("touchmove",(e=>{if(D()){n||y(e);const{deltaY:a}=x;x.move(e),n&&a.value>=0&&x.isVertical()&&(f(e),b((e=>{const a=+(t.pullDistance||t.headHeight);return e>a&&(e=e<2*a?a+(e-a)/2:1.5*a+(e-2*a)/4),Math.round(e)})(a.value)))}}),{target:i}),()=>{var t;const e={transitionDuration:`${_.duration}ms`,transform:_.distance?`translate3d(0,${_.distance}px, 0)`:""};return h("div",{ref:s,class:T()},[h("div",{ref:i,class:T("track"),style:e,onTouchstartPassive:q,onTouchend:$,onTouchcancel:$},[h("div",{class:T("head"),style:S()},[w()]),null==(t=a.default)?void 0:t.call(a)])])}}});const H=v(b),w="_pullRefresh_1kuq9_13";t("M",i({name:"m-full-refresh",props:{title:String,modelValue:{type:Boolean,default:!1}},emits:["refresh","update:modelValue"],setup(t,{emit:e,slots:a}){const n=u({fullState:!1});return d((()=>t.modelValue),(t=>{n.fullState=t})),d((()=>n.fullState),(t=>{e("update:modelValue",t)})),()=>h(H,{modelValue:n.fullState,"onUpdate:modelValue":t=>n.fullState=t,onRefresh:()=>e("refresh"),loadingText:" ",class:w},{default:()=>h(_,null,[x(" "),a.default&&a.default()])})}}))}}}));