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/taskListener.vue?vue&type=script&setup=true&lang.ts
var S = ["onClick"], C = ["onClick"], w = /* @__PURE__ */ f({
	name: "TaskListener",
	__name: "taskListener",
	setup(e) {
		let f = p("lf"), w = t(), T = n(), E = h([]);
		_(a(() => w.getElementById(T.selectId) || {}), (e) => {
			E.value = e.taskListener || [];
		}, { immediate: !0 });
		let D = h(), O = h(), k = [
			{
				label: "创建",
				value: "create"
			},
			{
				label: "指派",
				value: "assignment"
			},
			{
				label: "完成",
				value: "complete"
			},
			{
				label: "删除",
				value: "delete"
			},
			{
				label: "更新",
				value: "update"
			},
			{
				label: "超时",
				value: "timeout"
			}
		], A = [
			{
				title: "序号",
				key: "index",
				customRender: (e) => `${e.index + 1}`
			},
			{
				title: "事件类型",
				dataIndex: "event",
				key: "event",
				customRender: (e) => k.find((t) => t.value === e.text)?.label || e.text
			},
			{
				title: "事件ID",
				dataIndex: "id",
				key: "id"
			},
			{
				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" ? D.value?.open("task", "add") : e === "edit" ? D.value?.open("task", "edit", t, n) : e === "delete" && n !== void 0 && n >= 0 && E.value.splice(n, 1);
		}
		function M(e) {
			let t = e.index === void 0 ? -1 : e.index;
			t < 0 ? E.value.push({ ...e }) : E.value[t] = { ...e };
		}
		function N(e) {
			let t = {
				event: e.event,
				lType: e.valueType,
				value: e.value,
				field: []
			};
			E.value.push(t);
		}
		return _(() => E.value, (e) => {
			w.updateElement(T.selectId, { taskListener: e }), f.value.setProperties(T.selectId, { taskListener: 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(O)?.open("task")
					}, {
						default: v(() => [...t[3] ||= [u(" 选择监听器 ", -1)]]),
						_: 1
					})]),
					_: 1
				}),
				d(f, {
					size: "small",
					columns: A,
					"data-source": g(E),
					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: D,
					onSubmit: M
				}, null, 512),
				d(i, {
					ref_key: "drawerListenerTableRef",
					ref: O,
					onSubmit: N
				}, null, 512)
			]);
		};
	}
}), T = /* @__PURE__ */ e({ default: () => E }), E = w;
//#endregion
export { T as n, E as t };
