"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),q=require("@aplus-frontend/antdv"),p=require("lodash-unified");require("../../config-provider/index.js");require("./help-message/index.vue.js");const s=require("./helper.js"),P=require("./style/index.js"),d=require("../../config-provider/hooks/use-global-config.js"),V=require("../../config-provider/hooks/use-namespace.js"),T=require("./help-message/index.vue2.js"),_=t.defineComponent({name:"ApDescriptions",__name:"ap-descriptions",props:{descriptionsProps:{},schemas:{},dataSource:{},style:{type:[Boolean,null,String,Object,Array]},className:{}},setup(o){const l=o,f=d.useGlobalConfig("apDescriptions"),y=d.useGlobalConfig("downloadCenterTriggerConfig"),{b,be:i}=V.useNamespace("ap-descriptions"),g=P.default("ap-descriptions"),v=t.useSlots(),S=(e={})=>{let n="";return l.descriptionsProps?.layout==="vertical"&&(n="start"),{justifyContent:n,...e}},a=e=>{const n=p.get(l.dataSource,e.field);if(e.customRender)return e.customRender(l.dataSource);e.valueType==="attachment"&&(e.extraProps=s.mixinsAttachmentExtraProps(e.extraProps,{fromConfig:f.value?.downloadFile,fromGlobal:y.value?.trigger}));const r=e.format?e.format(n,l.dataSource||{}):n;return s.transformValue({value:r,record:l.dataSource},e)},x=e=>e.valueType==="text"&&!!e.extraProps?.ellipsis,C=(e,n)=>{if(e.visible!=null){if(typeof e.visible=="boolean")return e.visible;if(typeof e.visible=="function")return e.visible({record:n||{},schema:e})}return!0},N=(e,n,r)=>e.valueType==="empty"?null:s.isEmptyWithType(p.get(r,e.field),e)?t.createVNode("span",null,[t.createTextVNode("--")]):e.contentSlotName?v?.[e.contentSlotName]?.({index:n,record:r,item:a(e)}):t.createVNode(t.Fragment,null,[e.prefix,a(e),e.suffix&&t.createVNode("span",{class:i("content","suffix")},[e.suffix])]),m=(e=[],n)=>e.filter(r=>C(r,n)).map((r,c)=>({label:r.label&&t.createVNode(T.default,{helpMessage:r.helpMessage,label:r.label},null),span:r.span,style:r.style,contentStyle:r.contentStyle,labelStyle:r.labelStyle,key:r.field?.toString()||"empty"+c,class:x(r)?i("item","ellipsis"):"",children:N(r,c,n)})),u=t.shallowRef([]);return t.watch([()=>l.schemas,()=>l.dataSource],()=>{u.value=m(l.schemas,l.dataSource)},{immediate:!0,deep:!0}),(e,n)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([o.className,t.unref(b)(),t.unref(g)]),style:t.normalizeStyle(o.style)},[t.createVNode(t.unref(q.Descriptions),t.mergeProps(o.descriptionsProps,{"label-style":S({...o.descriptionsProps?.labelStyle||{}}),items:u.value}),null,16,["label-style","items"])],6))}});exports.default=_;
