import { n as e } from "./chunk-TYymryXo.mjs";
import { t } from "./dist-BWeVpZNn.mjs";
import { createBlock as n, createCommentVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, isRef as s, openBlock as c, ref as l, unref as u, withCtx as d } from "vue";
import { Button as f, Drawer as p, Form as m, FormItem as h, Input as g, Select as _, SelectOption as v, Space as y } from "ant-design-vue/es";
//#region src/pages/flow-create/flow-model/createComponents/flow/right-panel/components/drawer/two-level/drawerField.vue?vue&type=script&setup=true&lang.ts
var b = /* @__PURE__ */ o({
	name: "DrawerExpand",
	__name: "drawerField",
	emits: ["submit"],
	setup(e, { expose: o, emit: b }) {
		let x = b, S = {
			name: [{
				required: !0,
				message: "请输入字段名称",
				trigger: ["blur", "change"]
			}],
			type: [{
				required: !0,
				message: "请选择字段类型",
				trigger: ["blur", "change"]
			}]
		}, [C, w] = t(!1), T = l(), E = l({});
		async function D(e, t, n) {
			w(!0), e === "add" ? E.value = {} : e === "edit" && t && (E.value = { ...t }, E.value.index = n);
		}
		let [O, k] = t(!1);
		function A() {
			T.value?.validate().then(() => {
				k(!0), x("submit", { ...E.value }), k(!1), w(!1);
			});
		}
		function j() {
			w(!1);
		}
		return o({ open: D }), (e, t) => {
			let o = g, l = h, b = v, x = _, w = m, D = f, k = y, M = p;
			return c(), n(M, {
				open: u(C),
				"onUpdate:open": t[5] ||= (e) => s(C) ? C.value = e : null,
				title: "字段配置",
				placement: "right",
				width: 420,
				"destroy-on-close": "",
				"footer-style": { textAlign: "right" },
				onClose: j
			}, {
				footer: d(() => [a(k, null, {
					default: d(() => [a(D, { onClick: j }, {
						default: d(() => [...t[8] ||= [i(" 取消 ", -1)]]),
						_: 1
					}), a(D, {
						type: "primary",
						loading: u(O),
						onClick: t[4] ||= (e) => A()
					}, {
						default: d(() => [...t[9] ||= [i(" 提交 ", -1)]]),
						_: 1
					}, 8, ["loading"])]),
					_: 1
				})]),
				default: d(() => [a(w, {
					ref_key: "formRef",
					ref: T,
					model: u(E),
					rules: S,
					"label-col": { span: 5 }
				}, {
					default: d(() => [
						a(l, {
							label: "字段名称",
							name: "name"
						}, {
							default: d(() => [a(o, {
								value: u(E).name,
								"onUpdate:value": t[0] ||= (e) => u(E).name = e,
								maxlength: 60
							}, null, 8, ["value"])]),
							_: 1
						}),
						a(l, {
							label: "字段类型",
							name: "type"
						}, {
							default: d(() => [a(x, {
								value: u(E).type,
								"onUpdate:value": t[1] ||= (e) => u(E).type = e,
								placeholder: "请选择字段类型"
							}, {
								default: d(() => [a(b, { value: "字符串" }, {
									default: d(() => [...t[6] ||= [i(" 字符串 ", -1)]]),
									_: 1
								}), a(b, { value: "表达式" }, {
									default: d(() => [...t[7] ||= [i(" 表达式 ", -1)]]),
									_: 1
								})]),
								_: 1
							}, 8, ["value"])]),
							_: 1
						}),
						u(E).type === "字符串" ? (c(), n(l, {
							key: 0,
							label: "字段值",
							name: "value",
							rules: [{
								required: !0,
								message: "请输入字段值",
								trigger: ["blur", "change"]
							}]
						}, {
							default: d(() => [a(o, {
								value: u(E).value,
								"onUpdate:value": t[2] ||= (e) => u(E).value = e,
								maxlength: 1e3
							}, null, 8, ["value"])]),
							_: 1
						})) : r("", !0),
						u(E).type === "表达式" ? (c(), n(l, {
							key: 1,
							label: "表达式",
							name: "value",
							rules: [{
								required: !0,
								message: "请输入表达式",
								trigger: ["blur", "change"]
							}]
						}, {
							default: d(() => [a(o, {
								value: u(E).value,
								"onUpdate:value": t[3] ||= (e) => u(E).value = e,
								maxlength: 1e3
							}, null, 8, ["value"])]),
							_: 1
						})) : r("", !0)
					]),
					_: 1
				}, 8, ["model"])]),
				_: 1
			}, 8, ["open"]);
		};
	}
}), x = /* @__PURE__ */ e({ default: () => S }), S = b;
//#endregion
export { x as n, S as t };
