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