index.5416c7b0.js 1.9 KB

1
  1. import{E as v,H as f,G as m,ab as k,d as P,aj as O,j as i,a2 as b,ba as _,O as p,J as $,K as q,at as E,L as T,W as x,bb as V,a8 as j,aw as z,N as D}from"./ResizeObserver.es.39b48a47.js";const[S,w]=v("grid"),K={square:Boolean,center:f,border:f,gutter:m,reverse:Boolean,iconSize:m,direction:String,clickable:Boolean,columnNum:k(4)},h=Symbol(S);var L=P({name:S,props:K,setup(e,{slots:t}){const{linkChildren:a}=O(h);return a({props:e}),()=>{var c;return i("div",{style:{paddingLeft:b(e.gutter)},class:[w(),{[_]:e.border&&!e.gutter}]},[(c=t.default)==null?void 0:c.call(t)])}}});const Y=p(L),[H,l]=v("grid-item"),J=$({},q,{dot:Boolean,text:String,icon:String,badge:m,iconColor:String,iconPrefix:String,badgeProps:Object});var U=P({name:H,props:J,setup(e,{slots:t}){const{parent:a,index:c}=E(h),B=T();if(!a){console.error("[Vant] <GridItem> must be a child component of <Grid>.");return}const y=x(()=>{const{square:s,gutter:n,columnNum:r}=a.props,d=`${100/+r}%`,o={flexBasis:d};if(s)o.paddingTop=d;else if(n){const u=b(n);o.paddingRight=u,c.value>=r&&(o.marginTop=u)}return o}),C=x(()=>{const{square:s,gutter:n}=a.props;if(s&&n){const r=b(n);return{right:r,bottom:r,height:"auto"}}}),G=()=>{if(t.icon)return i(z,j({dot:e.dot,content:e.badge},e.badgeProps),{default:t.icon});if(e.icon)return i(D,{dot:e.dot,name:e.icon,size:a.props.iconSize,badge:e.badge,class:l("icon"),color:e.iconColor,badgeProps:e.badgeProps,classPrefix:e.iconPrefix},null)},I=()=>{if(t.text)return t.text();if(e.text)return i("span",{class:l("text")},[e.text])},R=()=>t.default?t.default():[G(),I()];return()=>{const{center:s,border:n,square:r,gutter:d,reverse:o,direction:u,clickable:g}=a.props,N=[l("content",[u,{center:s,square:r,reverse:o,clickable:g,surround:n&&d}]),{[V]:n}];return i("div",{class:[l({square:r})],style:y.value},[i("div",{role:g?"button":void 0,class:N,style:C.value,tabindex:g?0:void 0,onClick:B},[R()])])}}});const A=p(U);export{Y as G,A as a};