| 1 |
- var Ve=Object.defineProperty,Ee=Object.defineProperties;var He=Object.getOwnPropertyDescriptors;var ge=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var $e=(w,p,r)=>p in w?Ve(w,p,{enumerable:!0,configurable:!0,writable:!0,value:r}):w[p]=r,V=(w,p)=>{for(var r in p||(p={}))Oe.call(p,r)&&$e(w,r,p[r]);if(ge)for(var r of ge(p))qe.call(p,r)&&$e(w,r,p[r]);return w},E=(w,p)=>Ee(w,He(p));var _e=(w,p,r)=>new Promise((_,x)=>{var l=g=>{try{S(r.next(g))}catch(t){x(t)}},c=g=>{try{S(r.throw(g))}catch(t){x(t)}},S=g=>g.done?_(g.value):Promise.resolve(g.value).then(l,c);S((r=r.apply(w,p)).next())});import{m as fe,a as U,c as Z,aa as me,aq as Ae,b as oe,d as le,ad as ne,ag as xe,e as H,an as te,r as P,a6 as K,w as j,f as C,o as y,g as s,J as ae,j as ie,n as k,a4 as T,k as se,b8 as he,b9 as ve,q as ce,ao as M,ba as be,ai as Ne,N as ke,h as n,S as ze,F as B,t as ye,au as De,aj as ee,bb as Le,aM as Pe,as as Ge,a5 as We,af as Fe,bc as Se,B as Xe,D as je,C as Ke,G as re,H as de,I as ue,bd as Ye,aZ as Ie,P as Je,L as G,M as W,_ as Ce,be as Te}from"./index-q8TQmcfk.js";import{u as Qe}from"./useTouch.BnlusLLU.js";const Be=Symbol("wd-tabs"),Ue=E(V({},oe),{modelValue:Ae(0),slidableNum:U(6),mapNum:U(10),mapTitle:String,sticky:Z(!1),offsetTop:U(0),swipeable:Z(!1),autoLineWidth:Z(!1),lineWidth:me,lineHeight:me,color:fe(""),inactiveColor:fe(""),animated:Z(!1),duration:U(300),slidable:fe("auto")}),Ze=E(V({},oe),{name:me,title:String,disabled:Z(!1),lazy:Z(!0),badgeProps:Object}),et={name:"wd-tab",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}},tt=le(E(V({},et),{props:Ze,setup(w){const p=w,{proxy:r}=ne(),{parent:_,index:x}=xe(Be),l=H(()=>te(_)?_.state.activeIndex===x.value:!1),c=P(l.value),S=H(()=>{const i={};return!l.value&&(!te(_)||!_.props.animated)&&(i.display="none"),K(i)}),g=H(()=>!p.lazy||c.value||l.value);j(l,i=>{i&&(c.value=!0)}),j(()=>p.name,i=>{te(i)&&!he(i)&&!ve(i)||_&&t(r)},{deep:!0,immediate:!0});function t(i){const{name:L}=p;L==null||L===""||_&&_.children.forEach(I=>{I.$.uid!==i.$.uid&&I.name})}return(i,L)=>{const I=ie;return y(),C(I,{class:T(`wd-tab ${i.customClass}`),style:k(i.customStyle)},{default:s(()=>[g.value?(y(),C(I,{key:0,class:T(["wd-tab__body",{"wd-tab__body--inactive":!l.value}]),style:k(S.value)},{default:s(()=>[se(i.$slots,"default",{},void 0,!0)]),_:3},8,["class","style"])):ae("",!0)]),_:3},8,["class","style"])}}})),vt=ce(tt,[["__scopeId","data-v-79c06c35"]]),st=E(V({},oe),{customContainerClass:fe("")}),at={name:"wd-resize",options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}},ot=le(E(V({},at),{props:st,emits:["resize"],setup(w,{emit:p}){const r=w,_=p,x=P(0),l=P(0),c=P(0),S=P(0),g=P(0),t=P(0),i=P(0),L=H(()=>{const h={width:M(t.value),height:M(g.value)};return`${K(h)}${r.customStyle}`});let I=()=>{};const{proxy:d}=ne(),u=P(`resize${be()}`);Ne(()=>{ke().in(d).select(`#${u.value}`).boundingClientRect().exec(([v])=>{let o=v.height,f=v.width;g.value=o,t.value=f,I=()=>{ke().in(d).select(`#${u.value}`).boundingClientRect().exec(([Y])=>{if(i.value++===0){const A={};["bottom","top","left","right","height","width"].forEach(R=>{A[R]=Y[R]}),_("resize",A)}if(i.value<3)return;const J=Y.height,q=Y.width;g.value=J,t.value=q;const Q=[];if(J!==o&&(o=J,Q.push(1)),q!==f&&(f=q,Q.push(1)),Q.length!==0){const A={};["bottom","top","left","right","height","width"].forEach(R=>{A[R]=Y[R]}),_("resize",A)}m({lastWidth:f,lastHeight:o})})},m({lastWidth:f,lastHeight:o})})});function m({lastWidth:h,lastHeight:v}){x.value=1e5+v,l.value=3*g.value+v,c.value=1e5+h,S.value=3*t.value+h}return(h,v)=>{const o=ie,f=ze;return y(),C(o,{class:T(`wd-resize ${h.customClass}`),style:k(L.value)},{default:s(()=>[n(o,{id:u.value,class:T(`wd-resize__container ${h.customContainerClass}`)},{default:s(()=>[se(h.$slots,"default",{},void 0,!0),n(f,{class:"wd-resize__wrapper","scroll-y":!0,"scroll-top":x.value,"scroll-x":!0,"scroll-left":c.value,onScroll:B(I)},{default:s(()=>[n(o,{class:"wd-resize__wrapper--placeholder",style:{height:"100000px",width:"100000px"}})]),_:1},8,["scroll-top","scroll-left","onScroll"]),n(f,{class:"wd-resize__wrapper","scroll-y":!0,"scroll-top":l.value,"scroll-x":!0,"scroll-left":S.value,onScroll:B(I)},{default:s(()=>[n(o,{class:"wd-resize__wrapper--placeholder",style:{height:"250%",width:"250%"}})]),_:1},8,["scroll-top","scroll-left","onScroll"])]),_:3},8,["id","class"])]),_:3},8,["class","style"])}}})),Me=ce(ot,[["__scopeId","data-v-62bdf40e"]]),lt=E(V({},oe),{zIndex:U(1),offsetTop:U(0)}),Re=Symbol("wd-sticky-box"),nt={name:"wd-sticky",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}},it=le(E(V({},nt),{props:lt,setup(w,{expose:p}){const r=w,_=P(`wd-sticky${be()}`),x=P([]),l=ye({position:"absolute",boxLeaved:!1,top:0,height:0,width:0,state:""}),{parent:c}=xe(Re),{proxy:S}=ne(),g=H(()=>{const o={"z-index":r.zIndex,height:M(l.height),width:M(l.width)};return l.boxLeaved||(o.position="relative"),`${K(o)}${r.customStyle}`}),t=H(()=>{const o={"z-index":r.zIndex,height:M(l.height),width:M(l.width)};return l.boxLeaved||(o.position="relative"),`${K(o)}`}),i=H(()=>{const o={position:l.position,top:M(l.top)};return K(o)}),L=H(()=>{let o=0;return o=44,o+r.offsetTop});function I(){for(;x.value.length!==0;)x.value.pop().disconnect()}function d(){const o=Le(S,{thresholds:[0,.5]});return x.value.push(o),o}function u(o){return _e(this,null,function*(){l.width=o.width,l.height=o.height,yield De(),m(),!(!c||!c.observerForChild)&&c.observerForChild(S)})}function m(){if(l.height===0&&l.width===0)return;const o=L.value+l.height;I(),d().relativeToViewport({top:-o}).observe(`#${_.value}`,f=>{h(f)}),ee(`#${_.value}`,!1,S).then(f=>{f.bottom=Number(f.bottom)+44,Number(f.bottom)<=o&&h({boundingClientRect:f})})}function h({boundingClientRect:o}){if(c&&c.boxStyle&&l.height>=c.boxStyle.height){l.position="absolute",l.top=0;return}let f=o.top<=L.value;f=o.top<L.value,f?(l.state="sticky",l.boxLeaved=!1,l.position="fixed",l.top=L.value):(l.state="normal",l.boxLeaved=!1,l.position="absolute",l.top=0)}function v(o,f,O){l.boxLeaved=o,l.position=f,l.top=O}return p({setPosition:v,stickyState:l,offsetTop:r.offsetTop}),(o,f)=>{const O=ie;return y(),C(O,{style:k(`${g.value};display: inline-block;`)},{default:s(()=>[n(O,{class:T(`wd-sticky ${o.customClass}`),style:k(t.value),id:_.value},{default:s(()=>[n(O,{class:"wd-sticky__container",style:k(i.value)},{default:s(()=>[n(Me,{onResize:u,"custom-style":"display: inline-block;"},{default:s(()=>[se(o.$slots,"default",{},void 0,!0)]),_:3})]),_:3},8,["style"])]),_:3},8,["class","style","id"])]),_:3},8,["style"])}}})),ct=ce(it,[["__scopeId","data-v-8d1fe2cc"]]),rt={name:"wd-sticky-box",options:{addGlobalClass:!0,styleIsolation:"shared"}},dt=le(E(V({},rt),{props:oe,setup(w){const p=w,r=P(`wd-sticky-box${be()}`),_=P(new Map),x=ye({height:0,width:0}),{proxy:l}=ne(),{children:c,linkChildren:S}=Pe(Re);S({boxStyle:x,observerForChild:L}),Ge(()=>{_.value=new Map});function g(d){x.width=d.width,x.height=d.height;const u=_.value;_.value=new Map;for(const[m]of u){const h=c.find(v=>v.$.uid===m);L(h)}u.forEach(m=>{m.disconnect()}),u.clear()}function t(d){const u=_.value.get(d.$.uid);u&&(u.disconnect(),_.value.delete(d.$.uid))}function i(d){const u=Le(l,{thresholds:[0,.5]});return _.value.set(d.$.uid,u),u}function L(d){t(d);const u=i(d),m=d.$.exposed;let h=m.stickyState.height+m.offsetTop;h=h+44,x.height<=m.stickyState.height&&m.setPosition(!1,"absolute",0),u.relativeToViewport({top:-h}).observe(`#${r.value}`,v=>{I(m,v)}),ee(`#${r.value}`,!1,l).then(v=>{v.bottom=Number(v.bottom)+44,Number(v.bottom)<=h&&I(m,{boundingClientRect:v})}).catch(v=>{})}function I(d,{boundingClientRect:u}){let m=d.offsetTop;m=m+44;const h=d.stickyState.height+m;let v=u.bottom<=h;if(v=u.bottom<h,v)d.setPosition(!0,"absolute",u.height-d.stickyState.height);else if(u.top<=h&&!v){if(d.stickyState.state==="normal")return;d.setPosition(!1,"fixed",m)}}return(d,u)=>{const m=ie;return y(),C(m,{style:{position:"relative"}},{default:s(()=>[n(m,{class:T(`wd-sticky-box ${p.customClass}`),style:k(d.customStyle),id:r.value},{default:s(()=>[n(Me,{onResize:g},{default:s(()=>[se(d.$slots,"default",{},void 0,!0)]),_:3})]),_:3},8,["class","style","id"])]),_:3})}}})),ut=ce(dt,[["__scopeId","data-v-19ffe98b"]]),ft={name:"wd-tabs",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}},pt=le(E(V({},ft),{props:Ue,emits:["change","disabled","click","update:modelValue"],setup(w,{expose:p,emit:r}){const _=".wd-tabs__nav-item",x=".wd-tabs__nav-item-text",l=".wd-tabs__nav-container",c=w,S=r,{translate:g}=We("tabs"),t=ye({activeIndex:0,lineStyle:"display:none;",useInnerLine:!1,inited:!1,animating:!1,mapShow:!1,scrollLeft:0}),{children:i,linkChildren:L}=Pe(Be);L({state:t,props:c});const{proxy:I}=ne(),d=Qe(),u=H(()=>c.slidable==="always"||i.length>c.slidableNum),m=H(()=>c.animated?K({left:-100*t.activeIndex+"%","transition-duration":c.duration+"ms","-webkit-transition-duration":c.duration+"ms"}):""),h=(e,N)=>te(e.name)?e.name:N,v=(e=0,N=!1,z=!0)=>{i.length!==0&&(e=we(e),!i[e].disabled&&(t.activeIndex=e,z&&(O(N===!1),J()),Y()))},o=Fe(v,100,{leading:!0});j(()=>c.modelValue,e=>{!he(e)&&ve(e)},{immediate:!0,deep:!0}),j(()=>c.modelValue,e=>{const N=we(e);o(e,!1,N!==t.activeIndex)},{immediate:!1,deep:!0}),j(()=>i.length,()=>{t.inited&&Se(()=>{o(c.modelValue)})}),j(()=>c.slidableNum,e=>{Te(e,"slidableNum")}),j(()=>c.mapNum,e=>{Te(e,"mapNum")}),Ne(()=>{t.inited=!0,Se(()=>{v(c.modelValue,!0),t.useInnerLine=!0})});function f(){t.mapShow?(t.animating=!1,setTimeout(()=>{t.mapShow=!1},300)):(t.mapShow=!0,setTimeout(()=>{t.animating=!0},100))}function O(e=!0){return _e(this,null,function*(){if(!t.inited)return;const{autoLineWidth:N,lineWidth:z,lineHeight:D}=c;try{const a={};if(te(z))a.width=M(z);else if(N){const X=yield ee(x,!0,I),pe=Number(X[t.activeIndex].width);a.width=M(pe)}te(D)&&(a.height=M(D),a.borderRadius=`calc(${M(D)} / 2)`);const F=yield ee(_,!0,I),$=F[t.activeIndex];let b=F.slice(0,t.activeIndex).reduce((X,pe)=>X+Number(pe.width),0)+Number($.width)/2;b&&(a.transform=`translateX(${b}px) translateX(-50%)`,e&&(a.transition="width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);"),t.useInnerLine=!1,t.lineStyle=K(a))}catch(a){}})}function Y(){if(!t.inited)return;const e=h(i[t.activeIndex],t.activeIndex);e!==c.modelValue&&(S("change",{index:t.activeIndex,name:e}),S("update:modelValue",e))}function J(){t.inited&&Promise.all([ee(_,!0,I),ee(l,!1,I)]).then(([e,N])=>{const z=e[t.activeIndex],a=e.slice(0,t.activeIndex).reduce((F,$)=>F+$.width,0)-(N.width-Number(z.width))/2;a===t.scrollLeft?t.scrollLeft=a+Math.random()/1e4:t.scrollLeft=a})}function q(e){if(e===void 0)return;const{disabled:N}=i[e],z=h(i[e],e);if(N){S("disabled",{index:e,name:z});return}t.mapShow&&f(),o(e),S("click",{index:e,name:z})}function Q(e){c.swipeable&&d.touchStart(e)}function A(e){c.swipeable&&d.touchMove(e)}function R(){if(!c.swipeable)return;const{direction:e,deltaX:N,offsetX:z}=d;e.value==="horizontal"&&z.value>=50&&(N.value>0&&t.activeIndex!==0?o(t.activeIndex-1):N.value<0&&t.activeIndex!==i.length-1&&o(t.activeIndex+1))}function we(e){if(he(e)&&e>=i.length&&(e=0),ve(e)){const N=i.findIndex(z=>z.name===e);e=N===-1?0:N}return e}return p({setActive:o,scrollIntoView:J,updateLineStyle:O}),(e,N)=>{const z=Je,D=Xe(je("wd-badge"),Ke),a=ie,F=ze;return e.sticky?(y(),C(ut,{key:0},{default:s(()=>[n(a,{class:T(`wd-tabs ${e.customClass} ${u.value?"is-slide":""} ${e.mapNum<B(i).length&&e.mapNum!==0?"is-map":""}`),style:k(e.customStyle)},{default:s(()=>[n(ct,{"offset-top":e.offsetTop},{default:s(()=>[n(a,{class:"wd-tabs__nav wd-tabs__nav--sticky"},{default:s(()=>[n(a,{class:"wd-tabs__nav--wrap"},{default:s(()=>[n(F,{"scroll-x":u.value,"scroll-with-animation":"","scroll-left":t.scrollLeft},{default:s(()=>[n(a,{class:"wd-tabs__nav-container"},{default:s(()=>[(y(!0),re(de,null,ue(B(i),($,b)=>(y(),C(a,{onClick:X=>q(b),key:b,class:T(`wd-tabs__nav-item ${t.activeIndex===b?"is-active":""} ${$.disabled?"is-disabled":""}`),style:k(t.activeIndex===b?e.color?"color:"+e.color:"":e.inactiveColor?"color:"+e.inactiveColor:"")},{default:s(()=>[$.badgeProps?(y(),C(D,Ye(Ie({key:0},$.badgeProps)),{default:s(()=>[n(z,{class:"wd-tabs__nav-item-text"},{default:s(()=>[G(W($.title),1)]),_:2},1024)]),_:2},1040)):(y(),C(z,{key:1,class:"wd-tabs__nav-item-text"},{default:s(()=>[G(W($.title),1)]),_:2},1024)),t.activeIndex===b&&t.useInnerLine?(y(),C(a,{key:2,class:"wd-tabs__line wd-tabs__line--inner"})):ae("",!0)]),_:2},1032,["onClick","class","style"]))),128)),n(a,{class:"wd-tabs__line",style:k(t.lineStyle)},null,8,["style"])]),_:1})]),_:1},8,["scroll-x","scroll-left"])]),_:1}),e.mapNum<B(i).length&&e.mapNum!==0?(y(),C(a,{key:0,class:"wd-tabs__map"},{default:s(()=>[n(a,{class:T(`wd-tabs__map-btn ${t.animating?"is-open":""}`),onClick:f},{default:s(()=>[n(a,{class:T(`wd-tabs__map-arrow ${t.animating?"is-open":""}`)},{default:s(()=>[n(Ce,{name:"arrow-down"})]),_:1},8,["class"])]),_:1},8,["class"]),n(a,{class:"wd-tabs__map-header",style:k(`${t.mapShow?"":"display:none;"} ${t.animating?"opacity:1;":""}`)},{default:s(()=>[G(W(e.mapTitle||B(g)("all")),1)]),_:1},8,["style"]),n(a,{class:T(`wd-tabs__map-body ${t.animating?"is-open":""}`),style:k(t.mapShow?"":"display:none")},{default:s(()=>[(y(!0),re(de,null,ue(B(i),($,b)=>(y(),C(a,{class:"wd-tabs__map-nav-item",key:b,onClick:X=>q(b)},{default:s(()=>[n(a,{class:T(`wd-tabs__map-nav-btn ${t.activeIndex===b?"is-active":""} ${$.disabled?"is-disabled":""}`),style:k(t.activeIndex===b?e.color?"color:"+e.color+";border-color:"+e.color:"":e.inactiveColor?"color:"+e.inactiveColor:"")},{default:s(()=>[G(W($.title),1)]),_:2},1032,["class","style"])]),_:2},1032,["onClick"]))),128))]),_:1},8,["class","style"])]),_:1})):ae("",!0)]),_:1})]),_:1},8,["offset-top"]),n(a,{class:"wd-tabs__container",onTouchstart:Q,onTouchmove:A,onTouchend:R,onTouchcancel:R},{default:s(()=>[n(a,{class:T(["wd-tabs__body",e.animated?"is-animated":""]),style:k(m.value)},{default:s(()=>[se(e.$slots,"default",{},void 0,!0)]),_:3},8,["class","style"])]),_:3}),n(a,{class:"wd-tabs__mask",style:k(`${t.mapShow?"":"display:none;"} ${t.animating?"opacity:1;":""}`),onClick:f},null,8,["style"])]),_:3},8,["class","style"])]),_:3})):(y(),C(a,{key:1,class:T(`wd-tabs ${e.customClass} ${u.value?"is-slide":""} ${e.mapNum<B(i).length&&e.mapNum!==0?"is-map":""}`)},{default:s(()=>[n(a,{class:"wd-tabs__nav"},{default:s(()=>[n(a,{class:"wd-tabs__nav--wrap"},{default:s(()=>[n(F,{"scroll-x":u.value,"scroll-with-animation":"","scroll-left":t.scrollLeft},{default:s(()=>[n(a,{class:"wd-tabs__nav-container"},{default:s(()=>[(y(!0),re(de,null,ue(B(i),($,b)=>(y(),C(a,{onClick:X=>q(b),key:b,class:T(`wd-tabs__nav-item ${t.activeIndex===b?"is-active":""} ${$.disabled?"is-disabled":""}`),style:k(t.activeIndex===b?e.color?"color:"+e.color:"":e.inactiveColor?"color:"+e.inactiveColor:"")},{default:s(()=>[$.badgeProps?(y(),C(D,Ie({key:0,"custom-class":"wd-tabs__nav-item-badge"},$.badgeProps),{default:s(()=>[n(z,{class:"wd-tabs__nav-item-text"},{default:s(()=>[G(W($.title),1)]),_:2},1024)]),_:2},1040)):(y(),C(z,{key:1,class:"wd-tabs__nav-item-text"},{default:s(()=>[G(W($.title),1)]),_:2},1024)),t.activeIndex===b&&t.useInnerLine?(y(),C(a,{key:2,class:"wd-tabs__line wd-tabs__line--inner"})):ae("",!0)]),_:2},1032,["onClick","class","style"]))),128)),n(a,{class:"wd-tabs__line",style:k(t.lineStyle)},null,8,["style"])]),_:1})]),_:1},8,["scroll-x","scroll-left"])]),_:1}),e.mapNum<B(i).length&&e.mapNum!==0?(y(),C(a,{key:0,class:"wd-tabs__map"},{default:s(()=>[n(a,{class:"wd-tabs__map-btn",onClick:f},{default:s(()=>[n(a,{class:T(`wd-tabs__map-arrow ${t.animating?"is-open":""}`)},{default:s(()=>[n(Ce,{name:"arrow-down"})]),_:1},8,["class"])]),_:1}),n(a,{class:"wd-tabs__map-header",style:k(`${t.mapShow?"":"display:none;"} ${t.animating?"opacity:1;":""}`)},{default:s(()=>[G(W(e.mapTitle||B(g)("all")),1)]),_:1},8,["style"]),n(a,{class:T(`wd-tabs__map-body ${t.animating?"is-open":""}`),style:k(t.mapShow?"":"display:none")},{default:s(()=>[(y(!0),re(de,null,ue(B(i),($,b)=>(y(),C(a,{class:"wd-tabs__map-nav-item",key:b,onClick:X=>q(b)},{default:s(()=>[n(a,{class:T(`wd-tabs__map-nav-btn ${t.activeIndex===b?"is-active":""} ${$.disabled?"is-disabled":""}`)},{default:s(()=>[G(W($.title),1)]),_:2},1032,["class"])]),_:2},1032,["onClick"]))),128))]),_:1},8,["class","style"])]),_:1})):ae("",!0)]),_:1}),n(a,{class:"wd-tabs__container",onTouchstart:Q,onTouchmove:A,onTouchend:R,onTouchcancel:R},{default:s(()=>[n(a,{class:T(["wd-tabs__body",e.animated?"is-animated":""]),style:k(m.value)},{default:s(()=>[se(e.$slots,"default",{},void 0,!0)]),_:3},8,["class","style"])]),_:3}),n(a,{class:"wd-tabs__mask",style:k(`${t.mapShow?"":"display:none;"} ${t.animating?"opacity:1":""}`),onClick:f},null,8,["style"])]),_:3},8,["class"]))}}})),bt=ce(pt,[["__scopeId","data-v-c86d9020"]]);export{vt as _,bt as a,ct as b};
|