"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),o=require("element-plus"),q=require("./types.js"),$=require("./symbol.js"),v=require("../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.js"),p=require("../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.js"),h=require("../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.js"),z=e.defineComponent({name:"ProForm",__name:"index",props:q.wetProFormProps,emits:["change","update:modelValue"],setup(C,{expose:b,emit:g}){const r=o.useNamespace("pro-form"),w=g,n=e.shallowRef(),s=C,V=e.computed(()=>({span:s.span,...s.colProps})),a=e.ref({}),i=e.ref({}),F=t=>{const l=t.join(".");i.value[l]=t},u=t=>{const l=s.valueEmptyModel==="filter"?void 0:null;if(t){const c=(Array.isArray(t),t);return p.default(a.value,c,l)}else{const c={};return Object.values(i.value).forEach(m=>{const N=p.default(a.value,m,l);h.default(c,m,N)}),c}},d=(t,l)=>{h.default(a.value,t,l)},y=t=>{w("change",t,u())},E=t=>{var l;(l=n.value)==null||l.validateField(t)},f=t=>{var l;(l=n.value)==null||l.clearValidate(t)},P=t=>{var l;(l=n.value)==null||l.scrollToField(t)},k=async()=>{var t;return await((t=n.value)==null?void 0:t.validate()),u()},_=(t=!1)=>(t?a.value={}:a.value=v.default(s.initialValues||{}),setTimeout(()=>f(),200),u());e.watch(()=>s.initialValues,t=>{t?a.value=v.default(t):a.value={}},{immediate:!0,deep:!0});const S=e.computed(()=>s.labelWidth||"100px");return e.provide($.SymbolState,{registerFiledsPaths:i,formState:a,setFormStateValue:F,registerChangeEmit:y,globalColProps:V,labelWidth:S,clearable:e.computed(()=>s.clearable),setFieldsValue:d,getFieldsValue:u}),b({submit:k,reset:_,validateField:E,clearValidate:f,getFieldsValue:u,setFieldsValue:d,scrollToField:P}),(t,l)=>s.isFormItem?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(r).b()])},[e.createVNode(e.unref(o.ElRow),{gutter:s.gutter,class:e.normalizeClass([e.unref(r).e("row")])},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default"),e.createVNode(e.unref(o.ElCol),{class:e.normalizeClass([e.unref(r).e("actions")])},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElFormItem),null,{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(r).e("actions-slot")])},[e.renderSlot(t.$slots,"actions")],2)]),_:3})]),_:3},8,["class"])]),_:3},8,["gutter","class"])],2)):(e.openBlock(),e.createBlock(e.unref(o.ElForm),e.mergeProps({key:1,ref_key:"formIns",ref:n,class:[e.unref(r).b()],model:a.value,"scroll-into-view-options":{behavior:"smooth",block:"center"},disabled:s.disabled},t.$attrs),{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElRow),{gutter:s.gutter,class:e.normalizeClass([e.unref(r).e("row")])},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default"),t.$slots.actions?(e.openBlock(),e.createBlock(e.unref(o.ElCol),{key:0,class:e.normalizeClass([e.unref(r).e("actions")])},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ElFormItem),null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"actions")]),_:3})]),_:3},8,["class"])):e.createCommentVNode("",!0)]),_:3},8,["gutter","class"])]),_:3},16,["class","model","disabled"]))}});exports.default=z;
