index.5a8ac45d.js 1.8 KB

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