index-legacy.d64e5695.js 3.2 KB

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