vant/v3/assets/index.b70c9b40.js
2024-04-20 08:49:23 +00:00

2 lines
2.2 KiB
JavaScript

import{c as l,h as s,i as x,j as B,k as C}from"./use-translate.d2900b8c.js";import{n as f,m as u,t as w,w as y}from"./with-install.19a35764.js";import{z as m,D as b,e as i,I as _,R as j,E,A as N}from"./vue-libs.b44bc779.js";const[O,h]=l("badge"),Z={dot:Boolean,max:f,tag:u("div"),color:String,offset:Array,content:f,showZero:w,position:u("top-right")},k=m({name:O,props:Z,setup(e,{slots:n}){const o=()=>{if(n.content)return!0;const{content:t,showZero:a}=e;return x(t)&&t!==""&&(a||t!==0&&t!=="0")},c=()=>{const{dot:t,max:a,content:r}=e;if(!t&&o())return n.content?n.content():x(a)&&B(r)&&+r>a?`${a}+`:r},g=b(()=>{const t={background:e.color};if(e.offset){const[a,r]=e.offset;n.default?(t.top=s(r),typeof a=="number"?t.right=s(-a):t.right=a.startsWith("-")?a.replace("-",""):`-${a}`):(t.marginTop=s(r),t.marginLeft=s(a))}return t}),d=()=>{if(o()||e.dot)return i("div",{class:h([e.position,{dot:e.dot,fixed:!!n.default}]),style:g.value},[c()])};return()=>{if(n.default){const{tag:t}=e;return i(t,{class:h("wrapper")},{default:()=>[n.default(),d()]})}return d()}}}),S=y(k),H=S;let V=2e3;const J=()=>++V,D=e=>{V=e},[$,G]=l("config-provider"),p=Symbol($),R={tag:u("div"),zIndex:Number,themeVars:Object,iconPrefix:String};function T(e){const n={};return Object.keys(e).forEach(o=>{n[`--van-${C(o)}`]=e[o]}),n}const M=m({name:$,props:R,setup(e,{slots:n}){const o=b(()=>{if(e.themeVars)return T(e.themeVars)});return _(p,e),j(()=>{e.zIndex!==void 0&&D(e.zIndex)}),()=>i(e.tag,{class:G(),style:o.value},{default:()=>{var c;return[(c=n.default)==null?void 0:c.call(n)]}})}}),[A,v]=l("icon"),F=e=>e==null?void 0:e.includes("/"),K={dot:Boolean,tag:u("i"),name:String,size:f,badge:f,color:String,badgeProps:Object,classPrefix:String},L=m({name:A,props:K,setup(e,{slots:n}){const o=E(p,null),c=b(()=>e.classPrefix||(o==null?void 0:o.iconPrefix)||v());return()=>{const{tag:g,dot:d,name:t,size:a,badge:r,color:z}=e,I=F(t);return i(S,N({dot:d,tag:g,class:[c.value,I?"":`${c.value}-${t}`],style:{color:z,fontSize:s(a)},content:r},e.badgeProps),{default:()=>{var P;return[(P=n.default)==null?void 0:P.call(n),I&&i("img",{class:v("image"),src:t},null)]}})}}}),U=y(L),Q=U;export{S as B,U as I,H as V,M as _,Q as a,J as u};