"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("element-plus"),B=require("../types.js"),E=require("../symbol.js");require("../../../confirm-button/index.js");require("../../../count-down-button/index.js");const _=require("../../../ellipsis/index.js");require("../../../rich-text-editor/index.js");require("../../../form-fileds/index.js");require("../../index.js");require("../../../pro-table/index.js");require("../../../pro-descriptions/index.js");require("../../../layout/index.js");require("../../../page/index.js");require("../../../guide/index.js");const P=require("../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.4.21/node_modules/@element-plus/icons-vue/dist/index.js"),g=require("../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isUndefined.js"),w=require("../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.js"),N={key:0,class:"prepend"},$={key:1,class:"append"},x={key:0,class:"prepend"},W={key:1,class:"append"},j=e.defineComponent({name:"WetProFormItem",__name:"item",props:B.wetProFormItemProps,setup(m){const s=n.useNamespace("pro-form-item"),a=e.useSlots(),t=m,{setFormStateValue:c,setFieldsValue:i,registerFiledsPaths:f,registerChangeEmit:v,formState:h,globalColProps:b,labelWidth:d,clearable:k}=e.inject(E.SymbolState),q=e.computed(()=>{const r={...b.value},u=Object.keys(n.colProps);return Object.keys(t).forEach(o=>{u.includes(o)&&t[o]&&(r[o]=t[o])}),r}),C=e.computed(()=>{const r={},u=Object.keys(n.formItemProps);return Object.keys(t).forEach(o=>{u.includes(o)&&(r[o]=t[o])}),r}),y=e.computed(()=>t.label?g.default(t.labelWidth)||t.labelWidth===""?d.value:t.labelWidth:0),l=e.computed(()=>Array.isArray(t.prop)?t.prop:t.prop?[t.prop]:[]),V=e.computed(()=>{const r=[...t.rules||[]];return t.required&&r.unshift({required:!0,message:`${t.label}是必填项`}),r}),S=e.computed(()=>w.default(h.value,l.value,void 0)),p=e.computed(()=>({modelValue:S.value,onChange(){v(t.prop||"")},"onUpdate:modelValue":r=>{l.value&&i(l.value,r)},clearable:k.value,style:{width:"100%",maxWidth:t.fixedWidth?"300px":""}}));return e.watch(l,r=>{r&&c(r)}),e.onMounted(()=>{l.value&&c(l.value)}),e.onUnmounted(()=>{l.value&&(i(l.value,void 0),delete f.value[l.value.join(".")])}),(r,u)=>(e.openBlock(),e.createBlock(e.unref(n.ElCol),e.mergeProps(q.value,{class:[e.unref(s).b()]}),{default:e.withCtx(()=>[t.noStyle?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([e.unref(s).e("form-iteminner")])},[e.unref(a).prepend?(e.openBlock(),e.createElementBlock("div",x,[e.renderSlot(r.$slots,"prepend")])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default",{modelValue:p.value}),e.unref(a).append?(e.openBlock(),e.createElementBlock("div",W,[e.renderSlot(r.$slots,"append")])):e.createCommentVNode("",!0)],2)):(e.openBlock(),e.createBlock(e.unref(n.ElFormItem),e.mergeProps({key:0},C.value,{prop:l.value,rules:V.value,"label-width":y.value}),e.createSlots({default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("form-iteminner")])},[e.unref(a).prepend?(e.openBlock(),e.createElementBlock("div",N,[e.renderSlot(r.$slots,"prepend")])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default",{modelValue:p.value}),e.unref(a).append?(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(r.$slots,"append")])):e.createCommentVNode("",!0)],2)]),_:2},[t.label?{name:"label",fn:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("label")]),style:e.normalizeStyle({color:t.labelColor})},[e.createVNode(e.unref(_.TextEllipsis),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1),e.withDirectives(e.createElementVNode("span",null,":",512),[[e.vShow,!1]])]),_:1}),t.description?(e.openBlock(),e.createBlock(e.unref(n.ElTooltip),{key:0,content:t.description,placement:"top",effect:"light"},{default:e.withCtx(()=>[e.createVNode(e.unref(n.ElIcon),{class:e.normalizeClass([e.unref(s).e("question")])},{default:e.withCtx(()=>[e.createVNode(e.unref(P.QuestionFilled))]),_:1},8,["class"])]),_:1},8,["content"])):e.createCommentVNode("",!0)],6)]),key:"0"}:void 0]),1040,["prop","rules","label-width"]))]),_:3},16,["class"]))}});exports.default=j;
