import{defineComponent as j,computed as m,createVNode as v}from"vue";import C from"../_util/classNames.mjs";import O from"../config-provider/hooks/useConfigInject.mjs";import{useInjectRow as w}from"./context.mjs";import{useColStyle as G}from"./style/index.mjs";function I(r){return typeof r=="number"?`${r} ${r} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(r)?`0 0 ${r}`:r}const R=()=>({span:[String,Number],order:[String,Number],offset:[String,Number],push:[String,Number],pull:[String,Number],xs:{type:[String,Number,Object],default:void 0},sm:{type:[String,Number,Object],default:void 0},md:{type:[String,Number,Object],default:void 0},lg:{type:[String,Number,Object],default:void 0},xl:{type:[String,Number,Object],default:void 0},xxl:{type:[String,Number,Object],default:void 0},prefixCls:String,flex:[String,Number]}),A=["xs","sm","md","lg","xl","xxl"],B=j({compatConfig:{MODE:3},name:"ACol",inheritAttrs:!1,props:R(),setup(r,{slots:c,attrs:p}){const{gutter:$,supportFlexGap:g,wrap:b}=w(),{prefixCls:d,direction:S}=O("col",r),[h,x]=G(d),y=m(()=>{const{span:l,order:u,offset:n,push:o,pull:a}=r,t=d.value;let f={};return A.forEach(s=>{let e={};const i=r[s];typeof i=="number"?e.span=i:typeof i=="object"&&(e=i||{}),f={...f,[`${t}-${s}-${e.span}`]:e.span!==void 0,[`${t}-${s}-order-${e.order}`]:e.order||e.order===0,[`${t}-${s}-offset-${e.offset}`]:e.offset||e.offset===0,[`${t}-${s}-push-${e.push}`]:e.push||e.push===0,[`${t}-${s}-pull-${e.pull}`]:e.pull||e.pull===0,[`${t}-rtl`]:S.value==="rtl"}}),C(t,{[`${t}-${l}`]:l!==void 0,[`${t}-order-${u}`]:u,[`${t}-offset-${n}`]:n,[`${t}-push-${o}`]:o,[`${t}-pull-${a}`]:a},f,p.class,x.value)}),N=m(()=>{const{flex:l}=r,u=$.value,n={};if(u&&u[0]>0){const o=`${u[0]/2}px`;n.paddingLeft=o,n.paddingRight=o}if(u&&u[1]>0&&!g.value){const o=`${u[1]/2}px`;n.paddingTop=o,n.paddingBottom=o}return l&&(n.flex=I(l),b.value===!1&&!n.minWidth&&(n.minWidth=0)),n});return()=>h(v("div",{...p,class:y.value,style:[N.value,p.style]},[c.default?.()]))}});export{R as colProps,B as default};
