1 |
- System.register(["./index-legacy-aa99982f.js","./use-tab-status-legacy-044df911.js","./index-legacy-5fc62422.js"],(function(e,t){"use strict";var l,n,o,i,a,r,s,d,c,u,v,f,p,b,h,g,m,x,y,w,k,I,B,C,S,T,$,R,z,A,L,W,Z,j,H,O,F,M,N,V,E,D,J,X,G,K,Y,_,q,P,Q,U,ee,te,le,ne,oe,ie,ae,re,se,de,ce;return{setters:[e=>{l=e.bG,n=e.aW,o=e.bA,i=e.bH,a=e.r,r=e.aM,s=e.aJ,d=e.aw,c=e.as,u=e.bI,v=e.c,f=e.n,p=e.m,b=e.b,h=e.d,g=e.bu,m=e.x,x=e.e,y=e.bx,w=e.ad,k=e.i,I=e.w,B=e._,C=e.bw,S=e.z,T=e.$,$=e.bD,R=e.bE,z=e.a,A=e.k,L=e.b8,W=e.y,Z=e.Z,j=e.t,H=e.bk,O=e.ab,F=e.av,M=e.bF,N=e.o,V=e.Y,E=e.aT,D=e.bi,J=e.bJ,X=e.a1,G=e.bK,K=e.b5,Y=e.b2,_=e.a5,q=e.ae,P=e.az,Q=e.bc,U=e.bL,ee=e.aE,te=e.aV,le=e.aB,ne=e.g,oe=e.v,ie=e.h,ae=e.af,re=e.ar},e=>{se=e.T},e=>{de=e.S,ce=e.a}],execute:function(){function t(e,t){if(!s||!window.IntersectionObserver)return;const l=new IntersectionObserver((e=>{t(e[0].intersectionRatio>0)}),{root:document.body}),n=()=>{e.value&&l.unobserve(e.value)};d(n),c(n),u((()=>{e.value&&l.observe(e.value)}))}const[ue,ve]=v("sticky"),fe={zIndex:f,position:p("top"),container:Object,offsetTop:b(0),offsetBottom:b(0)};var pe=h({name:ue,props:fe,emits:["scroll","change"],setup(e,{emit:l,slots:n}){const i=a(),r=g(i),s=m({fixed:!1,width:0,height:0,transform:0}),d=a(!1),c=x((()=>y("top"===e.position?e.offsetTop:e.offsetBottom))),u=x((()=>{if(d.value)return;const{fixed:e,height:t,width:l}=s;return e?{width:`${l}px`,height:`${t}px`}:void 0})),v=x((()=>{if(!s.fixed||d.value)return;const t=w(k(e.zIndex),{width:`${s.width}px`,height:`${s.height}px`,[e.position]:`${c.value}px`});return s.transform&&(t.transform=`translate3d(0, ${s.transform}px, 0)`),t})),f=()=>{if(!i.value||C(i))return;const{container:t,position:n}=e,a=T(i),r=o(window);if(s.width=a.width,s.height=a.height,"top"===n)if(t){const e=T(t),l=e.bottom-c.value-s.height;s.fixed=c.value>a.top&&e.bottom>0,s.transform=l<0?l:0}else s.fixed=c.value>a.top;else{const{clientHeight:e}=document.documentElement;if(t){const l=T(t),n=e-l.top-c.value-s.height;s.fixed=e-c.value<a.bottom&&e>l.top,s.transform=n<0?-n:0}else s.fixed=e-c.value<a.bottom}(e=>{l("scroll",{scrollTop:e,isFixed:s.fixed})})(r)};return I((()=>s.fixed),(e=>l("change",e))),B("scroll",f,{target:r,passive:!0}),t(i,f),I([$,R],(()=>{i.value&&!C(i)&&s.fixed&&(d.value=!0,S((()=>{const e=T(i);s.width=e.width,s.height=e.height,d.value=!1})))})),()=>{var e;return z("div",{ref:i,style:u.value},[z("div",{class:ve({fixed:s.fixed&&!d.value}),style:v.value},[null==(e=n.default)?void 0:e.call(n)])])}}});const be=A(pe),[he,ge]=v("tabs");var me=h({name:he,props:{count:L(Number),inited:Boolean,animated:Boolean,duration:L(f),swipeable:Boolean,lazyRender:Boolean,currentIndex:L(Number)},emits:["change"],setup(e,{emit:t,slots:l}){const n=a(),o=e=>t("change",e),i=()=>{var t;const i=null==(t=l.default)?void 0:t.call(l);return e.animated||e.swipeable?z(de,{ref:n,loop:!1,class:ge("track"),duration:1e3*+e.duration,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:o},{default:()=>[i]}):i},r=t=>{const l=n.value;l&&l.state.active!==t&&l.swipeTo(t,{immediate:!e.inited})};return I((()=>e.currentIndex),r),W((()=>{r(e.currentIndex)})),Z({swipeRef:n}),()=>z("div",{class:ge("content",{animated:e.animated||e.swipeable})},[i()])}});const[xe,ye]=v("tabs"),we={type:p("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:b(0),duration:b(.3),animated:Boolean,ellipsis:j,swipeable:Boolean,scrollspy:Boolean,offsetTop:b(0),background:String,lazyRender:j,lineWidth:f,lineHeight:f,beforeChange:Function,swipeThreshold:b(5),titleActiveColor:String,titleInactiveColor:String},ke=Symbol(xe);var Ie=h({name:xe,props:we,emits:["change","scroll","rendered","clickTab","update:active"],setup(e,{emit:s,slots:d}){let c,v,f,p,b;const h=a(),w=a(),k=a(),R=a(),A=H(),L=g(h),[W,j]=function(){const e=a([]),t=[];return r((()=>{e.value=[]})),[e,l=>(t[l]||(t[l]=t=>{e.value[l]=t}),t[l])]}(),{children:K,linkChildren:Y}=O(ke),_=m({inited:!1,position:"",lineStyle:{},currentIndex:-1}),q=x((()=>K.length>+e.swipeThreshold||!e.ellipsis||e.shrink)),P=x((()=>({borderColor:e.color,background:e.background}))),Q=(e,t)=>{var l;return null!=(l=e.name)?l:t},U=x((()=>{const e=K[_.currentIndex];if(e)return Q(e,_.currentIndex)})),ee=x((()=>y(e.offsetTop))),te=x((()=>e.sticky?ee.value+c:0)),le=t=>{const o=w.value,i=W.value;if(!(q.value&&o&&i&&i[_.currentIndex]))return;const a=i[_.currentIndex].$el,r=a.offsetLeft-(o.offsetWidth-a.offsetWidth)/2;p&&p(),p=function(e,t,o){let i,a=0;const r=e.scrollLeft,s=0===o?1:Math.round(1e3*o/16);return function l(){e.scrollLeft+=(t-r)/s,++a<s&&(i=n(l))}(),function(){l(i)}}(o,r,t?0:+e.duration)},ne=()=>{const t=_.inited;S((()=>{const l=W.value;if(!l||!l[_.currentIndex]||"line"!==e.type||C(h.value))return;const n=l[_.currentIndex].$el,{lineWidth:o,lineHeight:i}=e,a=n.offsetLeft+n.offsetWidth/2,r={width:N(o),backgroundColor:e.color,transform:`translateX(${a}px) translateX(-50%)`};if(t&&(r.transitionDuration=`${e.duration}s`),V(i)){const e=N(i);r.height=e,r.borderRadius=e}_.lineStyle=r}))},oe=(t,l)=>{const n=(e=>{const t=e<_.currentIndex?-1:1;for(;e>=0&&e<K.length;){if(!K[e].disabled)return e;e+=t}})(t);if(!V(n))return;const o=K[n],i=Q(o,n),a=null!==_.currentIndex;_.currentIndex!==n&&(_.currentIndex=n,l||le(),ne()),i!==e.active&&(s("update:active",i),a&&s("change",i,o.title)),f&&!e.scrollspy&&D(Math.ceil(J(h.value)-ee.value))},ie=(e,t)=>{const l=K.find(((t,l)=>Q(t,l)===e)),n=l?K.indexOf(l):0;oe(n,t)},ae=(t=!1)=>{if(e.scrollspy){const a=K[_.currentIndex].$el;if(a&&L.value){const r=J(a,L.value)-te.value;v=!0,b&&b(),b=function(e,t,a,r){let s,d=o(e);const c=d<t,u=0===a?1:Math.round(1e3*a/16),v=(t-d)/u;return function l(){d+=v,(c&&d>t||!c&&d<t)&&(d=t),i(e,d),c&&d<t||!c&&d>t?s=n(l):r&&(s=n(r))}(),function(){l(s)}}(L.value,r,t?0:+e.duration,(()=>{v=!1}))}}},re=(t,l,n)=>{const{title:o,disabled:i}=K[l],a=Q(K[l],l);i||(X(e.beforeChange,{args:[a],done:()=>{oe(l),ae()}}),G(t)),s("clickTab",{name:a,title:o,event:n,disabled:i})},se=e=>{f=e.isFixed,s("scroll",e)},de=()=>{if("line"===e.type&&K.length)return z("div",{class:ye("line"),style:_.lineStyle},null)},ce=()=>{var t,l,n;const{type:o,border:i,sticky:a}=e,r=[z("div",{ref:a?void 0:k,class:[ye("wrap"),{[E]:"line"===o&&i}]},[z("div",{ref:w,role:"tablist",class:ye("nav",[o,{shrink:e.shrink,complete:q.value}]),style:P.value,"aria-orientation":"horizontal"},[null==(t=d["nav-left"])?void 0:t.call(d),K.map((e=>e.renderTitle(re))),de(),null==(l=d["nav-right"])?void 0:l.call(d)])]),null==(n=d["nav-bottom"])?void 0:n.call(d)];return a?z("div",{ref:k},[r]):r},ue=()=>{ne(),S((()=>{var e,t;le(!0),null==(t=null==(e=R.value)?void 0:e.swipeRef.value)||t.resize()}))};return I((()=>[e.color,e.duration,e.lineWidth,e.lineHeight]),ne),I($,ue),I((()=>e.active),(e=>{e!==U.value&&ie(e)})),I((()=>K.length),(()=>{_.inited&&(ie(e.active),ne(),S((()=>{le(!0)})))})),Z({resize:ue,scrollTo:e=>{S((()=>{ie(e),ae(!0)}))}}),F(ne),M(ne),u((()=>{ie(e.active,!0),S((()=>{_.inited=!0,k.value&&(c=T(k.value).height),le(!0)}))})),t(h,ne),B("scroll",(()=>{if(e.scrollspy&&!v){const e=(()=>{for(let e=0;e<K.length;e++){const{top:t}=T(K[e].$el);if(t>te.value)return 0===e?0:e-1}return K.length-1})();oe(e)}}),{target:L,passive:!0}),Y({id:A,props:e,setLine:ne,scrollable:q,onRendered:(e,t)=>s("rendered",e,t),currentName:U,setTitleRefs:j,scrollIntoView:le}),()=>z("div",{ref:h,class:ye([e.type])},[e.sticky?z(be,{container:h.value,offsetTop:ee.value,onScroll:se},{default:()=>[ce()]}):ce(),z(me,{ref:R,count:K.length,inited:_.inited,animated:e.animated,duration:e.duration,swipeable:e.swipeable,lazyRender:e.lazyRender,currentIndex:_.currentIndex,onChange:oe},{default:()=>{var e;return[null==(e=d.default)?void 0:e.call(d)]}})])}});const[Be,Ce]=v("tab"),Se=h({name:Be,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:f,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:j},setup(e,{slots:t}){const l=x((()=>{const t={},{type:l,color:n,disabled:o,isActive:i,activeColor:a,inactiveColor:r}=e;n&&"card"===l&&(t.borderColor=n,o||(i?t.backgroundColor=n:t.color=n));const s=i?a:r;return s&&(t.color=s),t})),n=()=>{const l=z("span",{class:Ce("text",{ellipsis:!e.scrollable})},[t.title?t.title():e.title]);return e.dot||V(e.badge)&&""!==e.badge?z(K,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:()=>[l]}):l};return()=>z("div",{id:e.id,role:"tab",class:[Ce([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:l.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls},[n()])}}),[Te,$e]=v("tab"),Re=w({},Y,{dot:Boolean,name:f,badge:f,title:String,disabled:Boolean,titleClass:_,titleStyle:[String,Object],showZeroBadge:j});var ze=h({name:Te,props:Re,setup(e,{slots:t}){const l=H(),n=a(!1),o=re(),{parent:i,index:r}=q(ke);if(!i)return void console.error("[Vant] <Tab> must be a child component of <Tabs>.");const s=()=>{var t;return null!=(t=e.name)?t:r.value},d=x((()=>{const t=s()===i.currentName.value;return t&&!n.value&&(n.value=!0,i.props.lazyRender&&S((()=>{i.onRendered(s(),e.title)}))),t})),c=a(""),u=a("");P((()=>{const{titleClass:t,titleStyle:l}=e;c.value=t?Q(t):"",u.value=l&&"string"!=typeof l?U(ee(l)):l}));const v=a(!d.value);return I(d,(e=>{e?v.value=!1:te((()=>{v.value=!0}))})),I((()=>e.title),(()=>{i.setLine(),i.scrollIntoView()})),le(se,d),Z({id:l,renderTitle:n=>z(Se,ie({key:l,id:`${i.id}-${r.value}`,ref:i.setTitleRefs(r.value),style:u.value,class:c.value,isActive:d.value,controls:l,scrollable:i.scrollable.value,activeColor:i.props.titleActiveColor,inactiveColor:i.props.titleInactiveColor,onClick:e=>n(o.proxy,r.value,e)},ae(i.props,["type","color","shrink"]),ae(e,["dot","badge","title","disabled","showZeroBadge"])),{title:t.title})}),()=>{var e;const o=`${i.id}-${r.value}`,{animated:a,swipeable:s,scrollspy:c,lazyRender:u}=i.props;if(!t.default&&!a)return;const f=c||d.value;if(a||s)return z(ce,{id:l,role:"tabpanel",class:$e("panel-wrapper",{inactive:v.value}),tabindex:d.value?0:-1,"aria-hidden":!d.value,"aria-labelledby":o},{default:()=>{var e;return[z("div",{class:$e("panel")},[null==(e=t.default)?void 0:e.call(t)])]}});const p=n.value||c||!u?null==(e=t.default)?void 0:e.call(t):null;return ne(z("div",{id:l,role:"tabpanel",class:$e("panel"),tabindex:f?0:-1,"aria-labelledby":o},[p]),[[oe,f]])}}});e("a",A(ze)),e("T",A(Ie))}}}));
|