1 |
- !function(){function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var r,a,i=[],l=!0,o=!1;try{for(t=t.call(e);!(l=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);l=!0);}catch(u){o=!0,a=u}finally{try{l||null==t.return||t.return()}finally{if(o)throw a}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}System.register(["./index-legacy.5f9666b4.js","./use-tab-status-legacy.feb57916.js","./index-legacy.8f20f3d1.js","./index-legacy.42a30b51.js"],(function(n){"use strict";var t,r,a,i,l,o,u,c,d,s,f,v,b,p,h,y,g,m,x,w,S,I,k,C,B,A,R,T,z,j,O,W,$,L,Z,N,M,V,X,F,H,U,D,E,P,Q,q,G,_,J,K,Y,ee;return{setters:[function(e){t=e.aI,r=e.aq,a=e.aF,i=e.R,l=e.aO,o=e.t,u=e.d,c=e.E,d=e.u,s=e.D,f=e.c,v=e.a1,b=e.aP,p=e.aB,h=e.Z,y=e.$,g=e.W,m=e.y,x=e.z,w=e.Q,S=e.ao,I=e.C,k=e.r,C=e.aQ,B=e.aR,A=e._,R=e.aS,T=e.aT,z=e.aH,j=e.a0,O=e.aA,W=e.U,$=e.w,L=e.I,Z=e.aU,N=e.at,M=e.v,V=e.am,X=e.aV,F=e.aW,H=e.N,U=e.ae,D=e.O,E=e.G,P=e.aX,Q=e.X,q=e.ac,G=e.ay,_=e.x},function(e){J=e.T},function(e){K=e.S,Y=e.a},function(e){ee=e.S}],execute:function(){function ne(e,n,i,l){var o=r(e),u=o<n,c=0===i?1:Math.round(1e3*i/16),d=(n-o)/c;!function r(){o+=d,(u&&o>n||!u&&o<n)&&(o=n),a(e,o),u&&o<n||!u&&o>n?t(r):l&&t(l)}()}function te(){var e=i([]),n=[];l((function(){e.value=[]}));return[e,function(t){return n[t]||(n[t]=function(n){e.value[t]=n}),n[t]}]}n("u",te);var re=e(o("tab"),2),ae=re[0],ie=re[1],le=u({name:ae,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:c,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:d},setup:function(e,n){var t=n.slots,r=s((function(){var n={},t=e.type,r=e.color,a=e.disabled,i=e.isActive,l=e.activeColor,o=e.inactiveColor;r&&"card"===t&&(n.borderColor=r,a||(i?n.backgroundColor=r:n.color=r));var u=i?l:o;return u&&(n.color=u),n}));return function(){return f("div",{id:e.id,role:"tab",class:[ie([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:r.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=f("span",{class:ie("text",{ellipsis:!e.scrollable})},[t.title?t.title():e.title]),e.dot||v(e.badge)&&""!==e.badge?f(b,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:function(){return[n]}}):n)]);var n}}}),oe=e(o("tabs"),2),ue=oe[0],ce=oe[1],de=u({name:ue,props:{count:p(Number),inited:Boolean,animated:Boolean,duration:p(c),swipeable:Boolean,lazyRender:Boolean,currentIndex:p(Number)},emits:["change"],setup:function(e,n){var t=n.emit,r=n.slots,a=i(),l=function(e){return t("change",e)},o=function(n){var t=a.value;t&&t.state.active!==n&&t.swipeTo(n,{immediate:!e.inited})};return h((function(){return e.currentIndex}),o),y((function(){o(e.currentIndex)})),g({swipeRef:a}),function(){return f("div",{class:ce("content",{animated:e.animated||e.swipeable})},[(t=null==(n=r.default)?void 0:n.call(r),e.animated||e.swipeable?f(K,{ref:a,loop:!1,class:ce("track"),duration:1e3*+e.duration,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:l},{default:function(){return[t]}}):t)]);var n,t}}}),se=e(o("tabs"),2),fe=se[0],ve=se[1],be={type:m("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:x(0),duration:x(.3),animated:Boolean,ellipsis:d,swipeable:Boolean,scrollspy:Boolean,offsetTop:x(0),background:String,lazyRender:d,lineWidth:c,lineHeight:c,beforeChange:Function,swipeThreshold:x(5),titleActiveColor:String,titleInactiveColor:String},pe=Symbol(fe),he=u({name:fe,props:be,emits:["change","scroll","rendered","clickTab","update:active"],setup:function(n,r){var a,l,o,u=r.emit,c=r.slots,d=i(),b=i(),p=i(),y=i(),m=w(),x=S(d),H=e(te(),2),U=H[0],D=H[1],E=I(pe),P=E.children,Q=E.linkChildren,q=k({inited:!1,position:"",lineStyle:{},currentIndex:-1}),G=s((function(){return P.length>n.swipeThreshold||!n.ellipsis||n.shrink})),_=s((function(){return{borderColor:n.color,background:n.background}})),J=function(e,n){var t;return null!=(t=e.name)?t:n},K=s((function(){var e=P[q.currentIndex];if(e)return J(e,q.currentIndex)})),Y=s((function(){return C(n.offsetTop)})),re=s((function(){return n.sticky?Y.value+a:0})),ae=function(e){var r=b.value,a=U.value;if(G.value&&r&&a&&a[q.currentIndex]){var i=a[q.currentIndex].$el;!function(e,n,r){var a=0,i=e.scrollLeft,l=0===r?1:Math.round(1e3*r/16);!function r(){e.scrollLeft+=(n-i)/l,++a<l&&t(r)}()}(r,i.offsetLeft-(r.offsetWidth-i.offsetWidth)/2,e?0:+n.duration)}},ie=function(){var e=q.inited;A((function(){var t=U.value;if(t&&t[q.currentIndex]&&"line"===n.type&&!O(d.value)){var r=t[q.currentIndex].$el,a=n.lineWidth,i=n.lineHeight,l=r.offsetLeft+r.offsetWidth/2,o={width:W(a),backgroundColor:n.color,transform:"translateX(".concat(l,"px) translateX(-50%)")};if(e&&(o.transitionDuration="".concat(n.duration,"s")),v(i)){var u=W(i);o.height=u,o.borderRadius=u}q.lineStyle=o}}))},oe=function(e,t){var r=function(e){for(var n=e<q.currentIndex?-1:1;e>=0&&e<P.length;){if(!P[e].disabled)return e;e+=n}}(e);if(v(r)){var a=P[r],i=J(a,r),l=null!==q.currentIndex;q.currentIndex!==r&&(q.currentIndex=r,t||ae(),ie()),i!==n.active&&(u("update:active",i),l&&u("change",i,a.title)),o&&!n.scrollspy&&L(Math.ceil(Z(d.value)-Y.value))}},ue=function(e,n){var t=P.find((function(n,t){return J(n,t)===e})),r=t?P.indexOf(t):0;oe(r,n)},ce=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(n.scrollspy){var t=P[q.currentIndex].$el;if(t&&x.value){var r=Z(t,x.value)-re.value;l=!0,ne(x.value,r,e?0:+n.duration,(function(){l=!1}))}}},se=function(e){o=e.isFixed,u("scroll",e)},fe=function(){return P.map((function(e,t){return f(le,M({key:e.id,id:"".concat(m,"-").concat(t),ref:D(t),type:n.type,color:n.color,style:e.titleStyle,class:e.titleClass,shrink:n.shrink,isActive:t===q.currentIndex,controls:e.id,scrollable:G.value,activeColor:n.titleActiveColor,inactiveColor:n.titleInactiveColor,onClick:function(r){return function(e,t,r){var a=P[t],i=a.title,l=a.disabled,o=J(P[t],t);l||(X(n.beforeChange,{args:[o],done:function(){oe(t),ce()}}),F(e)),u("clickTab",{name:o,title:i,event:r,disabled:l})}(e,t,r)}},V(e,["dot","badge","title","disabled","showZeroBadge"])),{title:e.$slots.title})}))},be=function(){if("line"===n.type&&P.length)return f("div",{class:ve("line"),style:q.lineStyle},null)},he=function(){var e,t,r,a,i,l,o=n.type,u=n.border,d=n.sticky,s=[f("div",{ref:d?void 0:p,class:[ve("wrap"),(a={},i=$,l="line"===o&&u,i in a?Object.defineProperty(a,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):a[i]=l,a)]},[f("div",{ref:b,role:"tablist",class:ve("nav",[o,{shrink:n.shrink,complete:G.value}]),style:_.value,"aria-orientation":"horizontal"},[null==(e=c["nav-left"])?void 0:e.call(c),fe(),be(),null==(t=c["nav-right"])?void 0:t.call(c)])]),null==(r=c["nav-bottom"])?void 0:r.call(c)];return d?f("div",{ref:p},[s]):s};h([function(){return n.color},B],ie),h((function(){return n.active}),(function(e){e!==K.value&&ue(e)})),h((function(){return P.length}),(function(){q.inited&&(ue(n.active),ie(),A((function(){ae(!0)})))}));return g({resize:function(){ie(),A((function(){var e,n;return null==(n=null==(e=y.value)?void 0:e.swipeRef.value)?void 0:n.resize()}))},scrollTo:function(e){A((function(){ue(e),ce(!0)}))}}),R(ie),T(ie),z((function(){ue(n.active,!0),A((function(){q.inited=!0,p.value&&(a=N(p.value).height),ae(!0)}))})),j("scroll",(function(){if(n.scrollspy&&!l){var e=function(){for(var e=0;e<P.length;e++)if(N(P[e].$el).top>re.value)return 0===e?0:e-1;return P.length-1}();oe(e)}}),{target:x,passive:!0}),Q({id:m,props:n,setLine:ie,onRendered:function(e,n){return u("rendered",e,n)},currentName:K,scrollIntoView:ae}),function(){return f("div",{ref:d,class:ve([n.type])},[n.sticky?f(ee,{container:d.value,offsetTop:Y.value,onScroll:se},{default:function(){return[he()]}}):he(),f(de,{ref:y,count:P.length,inited:q.inited,animated:n.animated,duration:n.duration,swipeable:n.swipeable,lazyRender:n.lazyRender,currentIndex:q.currentIndex,onChange:oe},{default:function(){var e;return[null==(e=c.default)?void 0:e.call(c)]}})])}}}),ye=e(o("tab"),2),ge=ye[0],me=ye[1],xe=H({},U,{dot:Boolean,name:c,badge:c,title:String,disabled:Boolean,titleClass:D,titleStyle:[String,Object],showZeroBadge:d}),we=u({name:ge,props:xe,setup:function(e,n){var t=n.slots,r=w(),a=i(!1),l=E(pe),o=l.parent,u=l.index;if(o){var c=function(){var n;return null!=(n=e.name)?n:u.value},d=s((function(){var n=c()===o.currentName.value;return n&&!a.value&&(a.value=!0,o.props.lazyRender&&A((function(){o.onRendered(c(),e.title)}))),n})),v=i(!d.value);return h(d,(function(e){e?v.value=!1:P((function(){v.value=!0}))})),h((function(){return e.title}),(function(){o.setLine(),o.scrollIntoView()})),Q(J,d),function(){var e,n="".concat(o.id,"-").concat(u.value),i=o.props,l=i.animated,c=i.swipeable,s=i.scrollspy,b=i.lazyRender;if(t.default||l){var p=s||d.value;if(l||c)return f(Y,{id:r,role:"tabpanel",class:me("panel-wrapper",{inactive:v.value}),tabindex:d.value?0:-1,"aria-hidden":!d.value,"aria-labelledby":n},{default:function(){var e;return[f("div",{class:me("panel")},[null==(e=t.default)?void 0:e.call(t)])]}});var h=a.value||s||!b?null==(e=t.default)?void 0:e.call(t):null;return g({id:r}),q(f("div",{id:r,role:"tabpanel",class:me("panel"),tabindex:p?0:-1,"aria-labelledby":n},[h]),[[G,p]])}}}console.error("[Vant] <Tab> must be a child component of <Tabs>.")}});n("a",_(we)),n("T",_(he))}}}))}();
|