index-legacy.8d528f30.js 3.8 KB

1
  1. System.register(["./index-legacy.eb062188.js","./index-legacy.918b8c74.js"],(function(e){"use strict";var o,t,l,a,n,s,r,i,d,p,u,c,v,m,w,h,f,y,g,b,C,x,O,k,P,z,S,V,I,W,$,T;return{setters:[function(e){o=e.t,t=e.v,l=e.z,a=e.w,n=e.u,s=e.d,r=e.Q,i=e.R,d=e.x,p=e.ap,u=e.y,c=e.a1,v=e.W,m=e.as,w=e.a0,h=e.c,f=e.an,y=e.at,g=e.au,b=e.av,C=e.O,x=e.r,O=e.C,k=e.aw,P=e.ax,z=e.ac,S=e.ay,V=e.P,I=e.E,W=e.a5,$=e.D},function(e){T=e.C}],execute:function(){const[D,R]=o("dropdown-menu"),j={overlay:t,zIndex:l,duration:a(.2),direction:n("down"),activeColor:String,closeOnClickOutside:t,closeOnClickOverlay:t,swipeThreshold:l},E=Symbol(D);var A=s({name:D,props:j,setup(e,{slots:o}){const t=r(),l=i(),a=i(),n=i(0),{children:s,linkChildren:b}=d(E),C=p(l),x=u((()=>s.some((e=>e.state.showWrapper)))),O=u((()=>e.swipeThreshold&&s.length>+e.swipeThreshold)),k=u((()=>{if(x.value&&c(e.zIndex))return{zIndex:+e.zIndex+1}})),P=()=>{s.forEach((e=>{e.toggle(!1)}))},z=()=>{if(a.value){const o=f(a);"down"===e.direction?n.value=o.bottom:n.value=y.value-o.top}},S=(o,l)=>{const{showPopup:a}=o.state,{disabled:n,titleClass:r}=o;return h("div",{id:`${t}-${l}`,role:"button",tabindex:n?void 0:0,class:[R("item",{disabled:n,grow:O.value}),{[g]:!n}],onClick:()=>{var e;n||(e=l,s.forEach(((o,t)=>{t===e?o.toggle():o.state.showPopup&&o.toggle(!1,{immediate:!0})})))}},[h("span",{class:[R("title",{down:a===("down"===e.direction),active:a}),r],style:{color:a?e.activeColor:""}},[h("div",{class:"van-ellipsis"},[o.renderTitle()])])])};return v({close:P}),b({id:t,props:e,offset:n,updateOffset:z}),m(l,(()=>{e.closeOnClickOutside&&P()})),w("scroll",(()=>{x.value&&z()}),{target:C,passive:!0}),()=>{var e;return h("div",{ref:l,class:R()},[h("div",{ref:a,style:k.value,class:R("bar",{opened:x.value,scrollable:O.value})},[s.map(S)]),null==(e=o.default)?void 0:e.call(o)])}}});const[B,M]=o("dropdown-item"),Q={title:String,options:b(),disabled:Boolean,teleport:[String,Object],lazyRender:t,modelValue:C,titleClass:C};var U=s({name:B,inheritAttrs:!1,props:Q,emits:["open","opened","close","closed","change","update:modelValue"],setup(e,{emit:o,slots:t,attrs:l}){const a=x({showPopup:!1,transition:!0,showWrapper:!1}),{parent:n,index:s}=O(E);if(!n)return void console.error("[Vant] <DropdownItem> must be a child component of <DropdownMenu>.");const r=e=>()=>o(e),i=r("open"),d=r("close"),p=r("opened"),u=()=>{a.showWrapper=!1,o("closed")},c=o=>{e.teleport&&o.stopPropagation()},m=t=>{const{activeColor:l}=n.props,s=t.value===e.modelValue;return h(T,{role:"menuitem",key:String(t.value),icon:t.icon,title:t.text,class:M("option",{active:s}),style:{color:s?l:""},tabindex:s?0:-1,clickable:!0,onClick:()=>{a.showPopup=!1,t.value!==e.modelValue&&(o("update:modelValue",t.value),o("change",t.value))}},{value:()=>{if(s)return h(W,{class:M("icon"),color:l,name:"success"},null)}})},w=()=>{const{offset:o}=n,{zIndex:r,overlay:v,duration:w,direction:f,closeOnClickOverlay:y}=n.props,g=P(r);return"down"===f?g.top=`${o.value}px`:g.bottom=`${o.value}px`,z(h("div",I({style:g,class:M([f]),onClick:c},l),[h(V,{show:a.showPopup,"onUpdate:show":e=>a.showPopup=e,role:"menu",class:M("content"),overlay:v,position:"down"===f?"top":"bottom",duration:a.transition?w:0,lazyRender:e.lazyRender,overlayStyle:{position:"absolute"},"aria-labelledby":`${n.id}-${s.value}`,closeOnClickOverlay:y,onOpen:i,onClose:d,onOpened:p,onClosed:u},{default:()=>{var o;return[e.options.map(m),null==(o=t.default)?void 0:o.call(t)]}})]),[[S,a.showWrapper]])};return v({state:a,toggle:(e=!a.showPopup,o={})=>{e!==a.showPopup&&(a.showPopup=e,a.transition=!o.immediate,e&&(n.updateOffset(),a.showWrapper=!0))},renderTitle:()=>{if(t.title)return t.title();if(e.title)return e.title;const o=e.options.find((o=>o.value===e.modelValue));return o?o.text:""}}),()=>e.teleport?h(k,{to:e.teleport},{default:()=>[w()]}):w()}});e("a",$(U)),e("D",$(A))}}}));