index-0840b1a0.js 1.8 KB

1
  1. import{j as v,v as b,t as m,ao as N,d as x,ac as _,g as i,G as f,aJ as q,D as p,A as D,aK as E,ae as O,aL as T,E as P,aM as $,m as z,K,I as V}from"./index-1d4a9afa.js";const[S,j]=v("grid"),L={square:Boolean,center:b,border:b,gutter:m,reverse:Boolean,iconSize:m,direction:String,clickable:Boolean,columnNum:N(4)},h=Symbol(S);var w=x({name:S,props:L,setup(e,{slots:t}){const{linkChildren:a}=_(h);return a({props:e}),()=>{var c;return i("div",{style:{paddingLeft:f(e.gutter)},class:[j(),{[q]:e.border&&!e.gutter}]},[(c=t.default)==null?void 0:c.call(t)])}}});const Y=p(w),[A,l]=v("grid-item"),J=D({},E,{dot:Boolean,text:String,icon:String,badge:m,iconColor:String,iconPrefix:String,badgeProps:Object});var M=x({name:A,props:J,setup(e,{slots:t}){const{parent:a,index:c}=O(h),B=T();if(!a)return;const y=P(()=>{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=f(n);o.paddingRight=u,c.value>=+r&&(o.marginTop=u)}return o}),C=P(()=>{const{square:s,gutter:n}=a.props;if(s&&n){const r=f(n);return{right:r,bottom:r,height:"auto"}}}),I=()=>{if(t.icon)return i(K,z({dot:e.dot,content:e.badge},e.badgeProps),{default:t.icon});if(e.icon)return i(V,{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)},R=()=>{if(t.text)return t.text();if(e.text)return i("span",{class:l("text")},[e.text])},k=()=>t.default?t.default():[I(),R()];return()=>{const{center:s,border:n,square:r,gutter:d,reverse:o,direction:u,clickable:g}=a.props,G=[l("content",[u,{center:s,square:r,reverse:o,clickable:g,surround:n&&d}]),{[$]:n}];return i("div",{class:[l({square:r})],style:y.value},[i("div",{role:g?"button":void 0,class:G,style:C.value,tabindex:g?0:void 0,onClick:B},[k()])])}}});const F=p(M);export{Y as G,F as a};