@aplus-frontend/ui
Version:
75 lines (74 loc) • 2.13 kB
JavaScript
import { defineComponent as f, ref as u, createElementBlock as d, openBlock as y, createVNode as t, unref as e, withCtx as o, createTextVNode as i, toDisplayString as r } from "vue";
import { Flex as C, Button as m } from "@aplus-frontend/antdv";
import { ApForm as _ } from "../../../../ap-form/index.mjs";
import "../../../../config-provider/index.mjs";
import { useLocale as h } from "../../../../config-provider/hooks/use-locale.mjs";
import { ApFormItemText as b } from "../../../../ap-form/items/text/index.mjs";
const V = /* @__PURE__ */ f({
__name: "edit-form",
props: {
onConfirm: { type: Function },
onCancel: { type: Function },
initialValues: {}
},
setup(p) {
const s = p, { t: a } = h(), n = u();
async function c() {
const l = await n.value?.validateFields();
s.onConfirm(l?.label);
}
return (l, g) => (y(), d("div", null, [
t(e(_), {
ref_key: "formRef",
ref: n,
colon: !1,
"label-col": { span: 24 },
"initial-values": l.initialValues
}, {
default: o(() => [
t(e(b), {
rules: [
{
required: !0,
message: e(a)("ap.apTable.setting.templateNamePlaceholder")
}
],
name: "label",
label: e(a)("ap.apTable.setting.templateName")
}, null, 8, ["rules", "label"])
]),
_: 1
}, 8, ["initial-values"]),
t(e(C), {
justify: "end",
gap: 8
}, {
default: o(() => [
t(e(m), {
style: { height: "24px" },
onClick: l.onCancel
}, {
default: o(() => [
i(r(e(a)("ap.common.cancelText")), 1)
]),
_: 1
}, 8, ["onClick"]),
t(e(m), {
style: { height: "24px" },
type: "primary",
onClick: c
}, {
default: o(() => [
i(r(e(a)("ap.common.save")), 1)
]),
_: 1
})
]),
_: 1
})
]));
}
});
export {
V as default
};