index-fd6c1051.js 1.3 KB

1
  1. import{j as g,n as d,v as C,ao as h,d as m,ac as E,E as p,g as v,t as N,ae as S,D as P}from"./index-1d4a9afa.js";const[$,_]=g("row"),w=Symbol($),j={tag:d("div"),wrap:C,align:String,gutter:h(0),justify:String};var R=m({name:$,props:j,setup(o,{slots:r}){const{children:l,linkChildren:u}=E(w),i=p(()=>{const e=[[]];let t=0;return l.forEach((a,s)=>{t+=Number(a.span),t>24?(e.push([s]),t-=24):e[e.length-1].push(s)}),e}),n=p(()=>{const e=Number(o.gutter),t=[];return e&&i.value.forEach(a=>{const s=e*(a.length-1)/a.length;a.forEach((c,y)=>{if(y===0)t.push({right:s});else{const f=e-t[c-1].right,b=s-f;t.push({left:f,right:b})}})}),t});return u({spaces:n}),()=>{const{tag:e,wrap:t,align:a,justify:s}=o;return v(e,{class:_({[`align-${a}`]:a,[`justify-${s}`]:s,nowrap:!t})},{default:()=>{var c;return[(c=r.default)==null?void 0:c.call(r)]}})}}});const[k,x]=g("col"),D={tag:d("div"),span:h(0),offset:N};var I=m({name:k,props:D,setup(o,{slots:r}){const{parent:l,index:u}=S(w),i=p(()=>{if(!l)return;const{spaces:n}=l;if(n&&n.value&&n.value[u.value]){const{left:e,right:t}=n.value[u.value];return{paddingLeft:e?`${e}px`:null,paddingRight:t?`${t}px`:null}}});return()=>{const{tag:n,span:e,offset:t}=o;return v(n,{style:i.value,class:x({[e]:e,[`offset-${t}`]:t})},{default:()=>{var a;return[(a=r.default)==null?void 0:a.call(r)]}})}}});const L=P(I),O=P(R);export{L as C,O as R};