2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
import{p as d,d as f,q as n,k as m,bp as g,bq as h,F as x,A as z,ae as l}from"./index-7b3f5fdc.js";const b=d(f({name:"LaySpace",props:{align:{type:String},direction:{type:String,default:"horizontal"},fill:{type:Boolean,default:!1},size:{type:[Number,String,Array],default:"sm"},wrap:{type:Boolean,default:!1}},setup(e,{slots:o}){const p=n(()=>e.align??(e.direction==="horizontal"?"center":"")),y=n(()=>["layui-space",{[`layui-space-align-${p.value}`]:p.value,[`layui-space-${e.direction}`]:e.direction,"layui-space-wrap":e.wrap,"layui-space-fill":e.fill}]),u=n(()=>{const s={xs:"4px",sm:"8px",md:"16px",lg:"24px"};let a="";return Array.isArray(e.size)?a=e.size.map(r=>typeof r=="number"?`${r}px`:typeof r=="string"&&s[r]||r).join(" "):typeof e.size=="string"?a=s[e.size]||e.size:typeof e.size=="number"&&(a=`${e.size}px`),{gap:a}}),c=n(()=>[e.fill?{flexGrow:1,minWidth:"100%"}:{}]);return()=>{const s=(()=>{const a=[],r=m(o,"default").children,i=Array.isArray(r)?[...r]:[];for(;i.length;){const t=i.shift();t!==null&&(Array.isArray(t)&&i.unshift(...t),g(t)&&t.type!==h&&(t.type===x&&Array.isArray(t.children)?i.unshift(t.children):typeof t=="string"||typeof t=="number"?a.push(z(t)):a.push(t)))}return a})();return l("div",{class:y.value,style:u.value},s.map((a,r)=>l("div",{key:a.key??`item-${r}`,class:"layui-space-item",style:c.value},l(a))))}}}));export{b as w};
|