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