index-f7d0f5db.js 1.8 KB

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