generated from VLADIMIR/template_frontend
1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
import{M as e,b as t,k as n,m as r}from"./client-DoYgjHB1.js";import{N as i,Z as a,o,r as s}from"./light-DZR0fP_1.js";import{n as c,t as l}from"./css-DEmdllcC.js";import{a as u}from"./Button-Cvs9km7Z.js";import{t as d}from"./flatten-C4-fSVx4.js";import{t as f}from"./get-slot-6kXJmSMP.js";import{d as p}from"./index-Di0MkZ8q.js";function m(){return p}var h={name:`Space`,self:m},g;function _(){if(!u)return!0;if(g===void 0){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.rowGap=`1px`,e.appendChild(document.createElement(`div`)),e.appendChild(document.createElement(`div`)),document.body.appendChild(e);let t=e.scrollHeight===1;return document.body.removeChild(e),g=t}return g}var v=n({name:`Space`,props:Object.assign(Object.assign({},s.props),{align:String,justify:{type:String,default:`start`},inline:Boolean,vertical:Boolean,reverse:Boolean,size:[String,Number,Array],wrapItem:{type:Boolean,default:!0},itemClass:String,itemStyle:[String,Object],wrap:{type:Boolean,default:!0},internalUseGap:{type:Boolean,default:void 0}}),setup(e){let{mergedClsPrefixRef:n,mergedRtlRef:r,mergedComponentPropsRef:u}=i(e),d=t(()=>e.size||u?.value?.Space?.size||`medium`),f=s(`Space`,`-space`,void 0,h,e,n),p=o(`Space`,r,n);return{useGap:_(),rtlEnabled:p,mergedClsPrefix:n,margin:t(()=>{let e=d.value;if(Array.isArray(e))return{horizontal:e[0],vertical:e[1]};if(typeof e==`number`)return{horizontal:e,vertical:e};let{self:{[a(`gap`,e)]:t}}=f.value,{row:n,col:r}=c(t);return{horizontal:l(r),vertical:l(n)}})}},render(){let{vertical:t,reverse:n,align:i,inline:a,justify:o,itemClass:s,itemStyle:c,margin:l,wrap:u,mergedClsPrefix:p,rtlEnabled:m,useGap:h,wrapItem:g,internalUseGap:_}=this,v=d(f(this),!1);if(!v.length)return null;let y=`${l.horizontal}px`,b=`${l.horizontal/2}px`,x=`${l.vertical}px`,S=`${l.vertical/2}px`,C=v.length-1,w=o.startsWith(`space-`);return e(`div`,{role:`none`,class:[`${p}-space`,m&&`${p}-space--rtl`],style:{display:a?`inline-flex`:`flex`,flexDirection:t&&!n?`column`:t&&n?`column-reverse`:!t&&n?`row-reverse`:`row`,justifyContent:[`start`,`end`].includes(o)?`flex-${o}`:o,flexWrap:!u||t?`nowrap`:`wrap`,marginTop:h||t?``:`-${S}`,marginBottom:h||t?``:`-${S}`,alignItems:i,gap:h?`${l.vertical}px ${l.horizontal}px`:``}},!g&&(h||_)?v:v.map((n,i)=>n.type===r?n:e(`div`,{role:`none`,class:s,style:[c,{maxWidth:`100%`},h?``:t?{marginBottom:i===C?``:x}:m?{marginLeft:w?o===`space-between`&&i===C?``:b:i===C?``:y,marginRight:w?o===`space-between`&&i===0?``:b:``,paddingTop:S,paddingBottom:S}:{marginRight:w?o===`space-between`&&i===C?``:b:i===C?``:y,marginLeft:w?o===`space-between`&&i===0?``:b:``,paddingTop:S,paddingBottom:S}]},n)))}});export{v as t}; |