物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
2.6 KiB

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