import { n as e } from "./chunk-TYymryXo.mjs";
import { n as t, t as n } from "./selectedInfo-CT8ehCR8.mjs";
import { t as r } from "./drawerListener-BOOLKJXk.mjs";
import { t as i } from "./drawerListenerTable-hfm05iif.mjs";
import { computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, inject as p, openBlock as m, ref as h, unref as g, watch as _, withCtx as v } from "vue";
import { Button as y, Space as b, Table as x } from "ant-design-vue/es";
//#region src/pages/flow-create/flow-model/createComponents/flow/right-panel/components/executionListener.vue?vue&type=script&setup=true&lang.ts
var S = ["onClick"], C = ["onClick"], w = /* @__PURE__ */ f({
	name: "ExecutionListener",
	__name: "executionListener",
	setup(e) {
		let f = p("lf"), w = t(), T = n(), E = a(() => w.getElementById(T.selectId) || {}), D = h([]);
		_(E, (e) => {
			D.value = e.executionListener || [];
		}, { immediate: !0 });
		let O = h(), k = h(), A = [
			{
				title: "序号",
				key: "index",
				customRender: (e) => `${e.index + 1}`
			},
			{
				title: "事件类型",
				dataIndex: "event",
				key: "event"
			},
			{
				title: "监听器类型",
				dataIndex: "lType",
				key: "lType",
				customRender: (e) => e.text === "class" ? "Java类" : e.text === "expression" ? "表达式" : e.text === "delegateExpression" ? "代理表达式" : e.text === "scriptFormat" ? "脚本" : e.text
			},
			{
				title: "操作",
				key: "action",
				width: 90
			}
		];
		function j(e, t, n) {
			e === "add" ? O.value?.open("execution", "add") : e === "edit" ? O.value?.open("execution", "edit", t, n) : e === "delete" && n !== void 0 && n >= 0 && D.value.splice(n, 1);
		}
		function M(e) {
			let t = e.index === void 0 ? -1 : e.index;
			t < 0 ? D.value.push({ ...e }) : D.value[t] = { ...e };
		}
		function N(e) {
			let t = {
				event: e.event,
				lType: e.valueType,
				value: e.value,
				field: []
			};
			D.value.push(t);
		}
		return _(() => D.value, (e) => {
			w.updateElement(T.selectId, { executionListener: e }), f.value.setProperties(T.selectId, { executionListener: e });
		}, { deep: !0 }), (e, t) => {
			let n = y, a = b, f = x;
			return m(), c("div", null, [
				d(a, { "mb-10px": "" }, {
					default: v(() => [d(n, {
						size: "small",
						type: "primary",
						onClick: t[0] ||= (e) => j("add")
					}, {
						default: v(() => [...t[2] ||= [u(" 添加监听器 ", -1)]]),
						_: 1
					}), d(n, {
						size: "small",
						type: "primary",
						onClick: t[1] ||= (e) => g(k)?.open("execution")
					}, {
						default: v(() => [...t[3] ||= [u(" 选择监听器 ", -1)]]),
						_: 1
					})]),
					_: 1
				}),
				d(f, {
					size: "small",
					columns: A,
					"data-source": g(D),
					pagination: !1,
					"row-key": "key"
				}, {
					bodyCell: v(({ column: e, record: t, index: n }) => [e.key === "action" ? (m(), o(a, { key: 0 }, {
						default: v(() => [l("a", { onClick: (e) => j("edit", t, n) }, "编辑", 8, S), l("a", {
							style: {
								"margin-left": "8px",
								color: "red"
							},
							onClick: (e) => j("delete", t, n)
						}, "删除", 8, C)]),
						_: 2
					}, 1024)) : s("", !0)]),
					_: 1
				}, 8, ["data-source"]),
				d(r, {
					ref_key: "drawerListenerRef",
					ref: O,
					onSubmit: M
				}, null, 512),
				d(i, {
					ref_key: "drawerListenerTableRef",
					ref: k,
					onSubmit: N
				}, null, 512)
			]);
		};
	}
}), T = /* @__PURE__ */ e({ default: () => E }), E = w;
//#endregion
export { T as n, E as t };
