"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("element-plus"),v=require("./index.vue.js"),C=require("./types.js"),y={class:"footer-slot__inner"},V=e.defineComponent({__name:"modal-form",props:C.wetModalFormProps,setup(i){const o=i,l=e.shallowRef(!1),c=e.shallowRef(),u=e.useSlots(),a=s.useNamespace("modal-form"),d=e.computed(()=>{const t=u.trigger&&u.trigger();return()=>t==null?void 0:t.map(n=>e.cloneVNode(n,{onClick:()=>{l.value=!0}}))}),m=async()=>{const t=await o.onCancel();l.value=!t},f=async()=>{var t;if(o.onFinish){const n=await((t=c.value)==null?void 0:t.submit()),r=await o.onFinish(n);l.value=!r}},p=async()=>{const t=await o.onCancel();l.value=!t};return(t,n)=>{var r;return e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value))),e.createVNode(e.unref(s.ElDialog),e.mergeProps({"before-close":p},o.modalProps,{"destroy-on-close":o.destroyOnClose,title:o.title||((r=o.modalProps)==null?void 0:r.title),modelValue:l.value,"onUpdate:modelValue":n[0]||(n[0]=_=>l.value=_),class:[e.unref(a).b()]}),{footer:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(a).e("footer")])},[e.createElementVNode("div",y,[e.renderSlot(t.$slots,"footer")]),e.createElementVNode("div",null,[e.createVNode(e.unref(s.ElButton),{onClick:m},{default:e.withCtx(()=>[e.createTextVNode("取消")]),_:1}),e.createVNode(e.unref(s.ElButton),{onClick:f,type:"primary"},{default:e.withCtx(()=>[e.createTextVNode("确认")]),_:1})])],2)]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(a).e("body")])},[e.createVNode(v.default,e.mergeProps({ref_key:"formInstance",ref:c},o),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)],2)]),_:3},16,["destroy-on-close","title","modelValue","class"])],64)}}});exports.default=V;
