1 |
- import{e8 as B,Q as C,d as G,U as R,Y as b,ac as j,z as E,a3 as _,e9 as I,dD as x,b7 as L,h as v}from"./index-aa2e1a24.js";import{g as M}from"./get-slot-1efb97e5.js";const P=()=>B,T={name:"Space",self:P},A=T;let h;const D=()=>{if(!C)return!0;if(h===void 0){const 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);const a=e.scrollHeight===1;return document.body.removeChild(e),h=a}return h},O=Object.assign(Object.assign({},b.props),{align:String,justify:{type:String,default:"start"},inline:Boolean,vertical:Boolean,size:{type:[String,Number,Array],default:"medium"},wrapItem:{type:Boolean,default:!0},itemStyle:[String,Object],wrap:{type:Boolean,default:!0},internalUseGap:{type:Boolean,default:void 0}}),F=G({name:"Space",props:O,setup(e){const{mergedClsPrefixRef:a,mergedRtlRef:u}=R(e),n=b("Space","-space",void 0,A,e,a),g=j("Space",u,a);return{useGap:D(),rtlEnabled:g,mergedClsPrefix:a,margin:E(()=>{const{size:t}=e;if(Array.isArray(t))return{horizontal:t[0],vertical:t[1]};if(typeof t=="number")return{horizontal:t,vertical:t};const{self:{[_("gap",t)]:f}}=n.value,{row:l,col:p}=I(f);return{horizontal:x(p),vertical:x(l)}})}},render(){const{vertical:e,align:a,inline:u,justify:n,itemStyle:g,margin:t,wrap:f,mergedClsPrefix:l,rtlEnabled:p,useGap:o,wrapItem:w,internalUseGap:S}=this,c=L(M(this));if(!c.length)return null;const y=`${t.horizontal}px`,d=`${t.horizontal/2}px`,z=`${t.vertical}px`,i=`${t.vertical/2}px`,s=c.length-1,m=n.startsWith("space-");return v("div",{role:"none",class:[`${l}-space`,p&&`${l}-space--rtl`],style:{display:u?"inline-flex":"flex",flexDirection:e?"column":"row",justifyContent:["start","end"].includes(n)?"flex-"+n:n,flexWrap:!f||e?"nowrap":"wrap",marginTop:o||e?"":`-${i}`,marginBottom:o||e?"":`-${i}`,alignItems:a,gap:o?`${t.vertical}px ${t.horizontal}px`:""}},!w&&(o||S)?c:c.map(($,r)=>v("div",{role:"none",style:[g,{maxWidth:"100%"},o?"":e?{marginBottom:r!==s?z:""}:p?{marginLeft:m?n==="space-between"&&r===s?"":d:r!==s?y:"",marginRight:m?n==="space-between"&&r===0?"":d:"",paddingTop:i,paddingBottom:i}:{marginRight:m?n==="space-between"&&r===s?"":d:r!==s?y:"",marginLeft:m?n==="space-between"&&r===0?"":d:"",paddingTop:i,paddingBottom:i}]},$)))}});export{F as _};
|