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