"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),D=require("../_util/props-util/index.js"),m=require("../_util/responsiveObserve.js"),V=require("../_util/vnode.js"),f=require("../_util/vue-types/index.js"),A=require("../config-provider/hooks/useConfigInject.js"),M=require("./Row.js"),R=require("./style/index.js");f.default.any;const E=()=>({prefixCls:String,label:f.default.any,labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0},span:{type:Number,default:1}}),g=n.defineComponent({compatConfig:{MODE:3},name:"ADescriptionsItem",props:E(),setup(e,{slots:o}){return()=>o.default?.()}}),h={xxxl:3,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1};function P(e,o){if(typeof e=="number")return e;if(typeof e=="object")for(let r=0;r<m.responsiveArray.length;r++){const t=m.responsiveArray[r];if(o[t]&&e[t]!==void 0)return e[t]||h[t]}return 3}function S(e,o,r){let t=e;return(r===void 0||r>o)&&(t=V.cloneElement(e,{span:o})),t}function _(e,o){const r=D.flattenChildren(e),t=[];let l=[],s=o;return r.forEach((i,p)=>{const c=i.props?.span,u=c||1;if(p===r.length-1){l.push(S(i,s,c)),t.push(l);return}u<s?(s-=u,l.push(i)):(l.push(S(i,s,u)),t.push(l),s=o,l=[])}),t}const C=()=>({prefixCls:String,bordered:{type:Boolean,default:void 0},size:{type:String,default:"default"},title:f.default.any,extra:f.default.any,column:{type:[Number,Object],default:()=>h},layout:String,colon:{type:Boolean,default:void 0},labelStyle:{type:Object,default:void 0},contentStyle:{type:Object,default:void 0}}),N=Symbol("descriptionsContext"),a=n.defineComponent({compatConfig:{MODE:3},name:"ADescriptions",inheritAttrs:!1,props:C(),slots:Object,Item:g,setup(e,{slots:o,attrs:r}){const{prefixCls:t,direction:l}=A.default("descriptions",e);let s;const i=n.ref({}),[p,c]=R.default(t),u=m.default();n.onBeforeMount(()=>{s=u.value.subscribe(d=>{typeof e.column=="object"&&(i.value=d)})}),n.onBeforeUnmount(()=>{u.value.unsubscribe(s)}),n.provide(N,{labelStyle:n.toRef(e,"labelStyle"),contentStyle:n.toRef(e,"contentStyle")});const O=n.computed(()=>P(e.column,i.value));return()=>{const{size:d,bordered:y=!1,layout:$="horizontal",colon:j=!0,title:v=o.title?.(),extra:b=o.extra?.()}=e,I=o.default?.(),q=_(I,O.value);return p(n.createVNode("div",{...r,class:[t.value,{[`${t.value}-${d}`]:d!=="default",[`${t.value}-bordered`]:!!y,[`${t.value}-rtl`]:l.value==="rtl"},r.class,c.value]},[(v||b)&&n.createVNode("div",{class:`${t.value}-header`},[v&&n.createVNode("div",{class:`${t.value}-title`},[v]),b&&n.createVNode("div",{class:`${t.value}-extra`},[b])]),n.createVNode("div",{class:`${t.value}-view`},[n.createVNode("table",null,[n.createVNode("tbody",null,[q.map((w,x)=>n.createVNode(M.default,{key:x,index:x,colon:j,prefixCls:t.value,vertical:$==="vertical",bordered:y,row:w},null))])])])]))}}});a.install=function(e){return e.component(a.name,a),e.component(a.Item.name,a.Item),e};exports.DescriptionsItem=g;exports.default=a;exports.descriptionsContext=N;exports.descriptionsProps=C;
