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