UNPKG

tdesign-pro-component

Version:

ProComponents tdesign-vue-next + Vue3 + TS

81 lines (80 loc) 2.14 kB
import "lodash-es"; import { g as p, w as q } from "./utils-CIySOLoe.js"; import { defineComponent as D, ref as F, useTemplateRef as V, watch as b, createVNode as i, Fragment as S, mergeProps as h } from "vue"; import { Drawer as j } from "tdesign-vue-next"; import { P as B } from "./ProForm-zJW4qA6n.js"; /* empty css */ const T = /* @__PURE__ */ D((t, { emit: o, slots: a, expose: w }) => { var m, f, d, c; const n = F(!1), r = V("proFormRef"), l = F(void 0), u = p("title", a, t)(), s = p("footer", a, t)(); function g() { l.value = t.request, setTimeout(() => { var e; (e = r.value) == null || e.resetRequest(); }); } function C() { var e; (e = r.value) == null || e.validate().then((O) => { var v; O === !0 && o("confirm", (v = r.value) == null ? void 0 : v.getFormValue()); }); } function P() { var e; (e = r.value) == null || e.reset(), o("cancel"); } function R() { var e; (e = r.value) == null || e.reset(), o("close"); } return b(() => t.visible, (e) => { n.value = e; }), b(n, (e) => { o("update:visible", e); }), w({ reset: (m = r.value) == null ? void 0 : m.reset, submit: (f = r.value) == null ? void 0 : f.submit, validate: (d = r.value) == null ? void 0 : d.validate, getFormValue: (c = r.value) == null ? void 0 : c.getFormValue }), () => i(S, null, [i(j, h({ size: t.width, onConfirm: C, onCancel: P, onClose: R, onBeforeOpen: g, visible: n.value, "onUpdate:visible": (e) => n.value = e }, t.drawerProps), { //@ts-ignore default: () => i(B, h(t.formProps, { ref: "proFormRef", gap: 24, options: t.options || [], request: l.value, hideFooter: !0 }), null), header: u ? () => u : void 0, footer: s ? () => s : void 0, ...a })]); }, { name: "DrawerForm", emits: ["update:visible", "confirm"], props: { title: String, visible: Boolean, options: Array, request: Function, formProps: Object, drawerProps: Object, width: [String, Object] } }), N = q(T); export { N as D };