var z=Object.defineProperty,G=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var S=(e,t,s)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,o=(e,t)=>{for(var s in t||(t={}))R.call(t,s)&&S(e,s,t[s]);if(w)for(var s of w(t))q.call(t,s)&&S(e,s,t[s]);return e},D=(e,t)=>G(e,L(t));import{C as F,a5 as H,l as _,a3 as J,G as K,w as Q}from"./index-Cy4uayzW.js";import{d as T,f as x,e as m,u as n,k as p,i as U,ag as X,g as Y}from"./vue-vendor-CxLCUzY4.js";import{aC as Z,N as E}from"./antd-vue-vendor-CahNzUUa.js";import{C as ee}from"./index-CYoRlduV.js";function te(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!U(e)}const ne={useCollapse:{type:Boolean,default:!0},title:{type:String,default:""},size:{type:String,validator:e=>["small","default","middle",void 0].includes(e),default:"small"},bordered:{type:Boolean,default:!0},column:{type:[Number,Object],default:()=>({xxl:4,xl:3,lg:3,md:3,sm:2,xs:1})},collapseOptions:{type:Object,default:null},schema:{type:Array,default:()=>[]},data:{type:Object}},se=T({name:"Description",props:ne,emits:["register"],setup(e,{slots:t,emit:s}){const d=x(null),{prefixCls:b}=F("description"),l=H(),i=m(()=>o(o({},e),n(d))),g=m(()=>D(o({},n(i)),{title:void 0})),I=m(()=>!!n(i).title),M=m(()=>o({canExpand:!1},n(g).collapseOptions)),N=m(()=>o(o({},n(l)),n(g)));function W(r){d.value=o(o({},n(d)),r)}function $({label:r,labelMinWidth:c,labelStyle:a}){if(!a&&!c)return r;const u=D(o({},a),{minWidth:`${c}px `});return p("div",{style:u},[r])}function k(){const{schema:r,data:c}=n(g);return n(r).map(a=>{const{render:u,field:P,span:B,show:C,contentMinWidth:O}=a;if(C&&_(C)&&!C(c))return null;const v=()=>{var j;const f=(j=n(g))==null?void 0:j.data;if(!f)return null;const y=Z(f,P);return _(u)?u(y,f):y!=null?y:""},V=O;return p(E.Item,{label:$(a),key:P,span:B},{default:()=>{if(!O)return v();const f={minWidth:`${V}px`};return p("div",{style:f},[v()])}})}).filter(a=>!!a)}const h=()=>{let r;return p(E,X({class:`${b}`},n(N)),te(r=k())?r:{default:()=>[r]})},A=()=>{const r=e.useCollapse?h():p("div",null,[h()]);if(!e.useCollapse)return r;const{canExpand:c,helpMessage:a}=n(M),{title:u}=n(i);return p(ee,{title:u,canExpan:c,helpMessage:a},{default:()=>r,action:()=>J(t,"action")})};return s("register",{setDescProps:W}),()=>n(I)?A():h()}});function ue(e){if(!Y())throw new Error("useDescription() can only be used inside setup() or functional components!");const t=x(null),s=x(!1);function d(l){n(s)&&K()||(t.value=l,e&&l.setDescProps(e),s.value=!0)}return[d,{setDescProps:l=>{var i;(i=n(t))==null||i.setDescProps(l)}}]}const pe=Q(se);export{pe as D,ue as u};
