qx-easy-process
Version:
easy-process流程设计器,基于vue3 + vite4实现,具备低代码、快速应用及扩展的特点。【工作流】【流程引擎】
1,075 lines (1,074 loc) • 33.6 kB
JavaScript
import { defineComponent as x, computed as D, openBlock as d, createElementBlock as _, normalizeClass as V, createElementVNode as r, useCssVars as Ve, unref as E, getCurrentInstance as S, onMounted as k, onUnmounted as Ce, resolveComponent as U, createBlock as F, Teleport as Me, createCommentVNode as m, toDisplayString as j, renderSlot as le, pushScopeId as re, popScopeId as ie, shallowRef as Ie, defineAsyncComponent as Te, ref as g, inject as ee, createVNode as N, isRef as ze, withCtx as q, resolveDynamicComponent as Ee, createTextVNode as ve, nextTick as M, Fragment as B, renderList as ae, watch as Fe, normalizeStyle as $e, withDirectives as Ge, vModelText as Ye, reactive as Xe, provide as de } from "vue";
let Oe = "#icon-";
const We = (o) => {
let { prefix: n } = o || {};
He(n);
}, He = (o) => {
o && (Oe = o);
}, Ke = () => Oe;
const qe = ["xlink:href", "fill"], Je = x({
name: "ep-svg-icon"
}), Qe = /* @__PURE__ */ Object.assign(Je, {
props: {
iconClass: {
type: String,
required: !0
},
className: {
type: String,
default: ""
},
color: {
type: String,
default: ""
}
},
setup(o) {
const n = o, e = D(() => Ke() + `${n.iconClass}`), t = D(() => n.className ? `svg-icon ${n.className}` : "svg-icon");
return (s, l) => (d(), _("svg", {
class: V(t.value),
"aria-hidden": "true"
}, [
r("use", {
"xlink:href": e.value,
fill: o.color
}, null, 8, qe)
], 2));
}
}), Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Qe
}, Symbol.toStringTag, { value: "Module" }));
let xe = 2e3, Q = null;
const eo = ({ initZIndexValue: o, bindZIndexFunction: n }) => {
if (n)
if (typeof n == "function")
Q = n;
else
throw new Error("zIndexFunction must be a function");
else
o && (xe = o);
}, fe = () => Q && typeof Q == "function" ? Q() : xe++;
const L = (o, n) => {
const e = o.__vccOpts || o;
for (const [t, s] of n)
e[t] = s;
return e;
}, oo = (o) => (re("data-v-fc7872f8"), o = o(), ie(), o), no = { class: "drawer" }, to = {
key: 0,
class: "drawer-header"
}, so = { class: "drawer-header-title" }, co = { class: "drawer-body" }, lo = { class: "drawer-footer" }, ao = /* @__PURE__ */ oo(() => /* @__PURE__ */ r("div", { class: "drawer-overlay" }, null, -1)), ro = x({
name: "ep-drawer"
}), io = /* @__PURE__ */ Object.assign(ro, {
props: {
modelValue: {
type: Boolean,
default: !1
},
title: {
type: String,
default: null
},
icon: {
type: String,
default: "ep-setting"
},
"hide-header": {
// 控制是否显示 header 栏, 默认为 false
type: Boolean,
default: !1
},
"hide-close-btn": {
// 控制是否显示 关闭按钮, 默认为 false
type: Boolean,
default: !1
},
width: {
type: String,
default: "500px"
}
},
emits: ["update:modelValue", "close"],
setup(o, { emit: n }) {
const e = o;
Ve((v) => ({
"625a3d27": e.width,
"891cc3ec": E(s),
"009f7b52": E(t)
})), S();
let t = fe(), s = fe();
k(() => {
window.addEventListener("keydown", l);
}), Ce(() => {
window.removeEventListener("keydown", l);
});
const l = (v) => {
v.keyCode === 27 && c();
}, c = () => {
n("update:modelValue", !1), n("close");
};
return (v, i) => {
const h = U("ep-svg-icon");
return e.modelValue ? (d(), F(Me, {
key: 0,
to: "body"
}, [
r("div", no, [
e.hideHeader ? m("", !0) : (d(), _("div", to, [
e.icon ? (d(), F(h, {
key: 0,
"icon-class": e.icon,
class: "drawer-header-icon",
color: "#5a5e66"
}, null, 8, ["icon-class"])) : m("", !0),
r("div", so, j(e.title), 1),
e.hideCloseBtn ? m("", !0) : (d(), F(h, {
key: 1,
"icon-class": "ep-close",
class: "drawer-header-close",
color: "#5a5e66",
onClick: c
}))
])),
r("div", co, [
le(v.$slots, "default", {}, void 0, !0)
]),
r("div", lo, [
le(v.$slots, "footer", {}, void 0, !0)
])
]),
ao
])) : m("", !0);
};
}
}), uo = /* @__PURE__ */ L(io, [["__scopeId", "data-v-fc7872f8"]]);
const po = x({
name: "ep-button"
}), _o = /* @__PURE__ */ Object.assign(po, {
props: {
type: {
type: String,
default: "default"
}
},
setup(o) {
const n = o;
return S(), (e, t) => (d(), _("div", {
class: V(["button", n.type])
}, [
le(e.$slots, "default", {}, void 0, !0)
], 2));
}
}), me = /* @__PURE__ */ L(_o, [["__scopeId", "data-v-7214d94b"]]), z = "gateway", G = "condition", oe = "start", ge = "task", ne = "terminate";
let J;
const vo = new Uint8Array(16);
function fo() {
if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return J(vo);
}
const C = [];
for (let o = 0; o < 256; ++o)
C.push((o + 256).toString(16).slice(1));
function mo(o, n = 0) {
return (C[o[n + 0]] + C[o[n + 1]] + C[o[n + 2]] + C[o[n + 3]] + "-" + C[o[n + 4]] + C[o[n + 5]] + "-" + C[o[n + 6]] + C[o[n + 7]] + "-" + C[o[n + 8]] + C[o[n + 9]] + "-" + C[o[n + 10]] + C[o[n + 11]] + C[o[n + 12]] + C[o[n + 13]] + C[o[n + 14]] + C[o[n + 15]]).toLowerCase();
}
const go = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ye = {
randomUUID: go
};
function yo(o, n, e) {
if (ye.randomUUID && !n && !o)
return ye.randomUUID();
o = o || {};
const t = o.random || (o.rng || fo)();
if (t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, n) {
e = e || 0;
for (let s = 0; s < 16; ++s)
n[e + s] = t[s];
return n;
}
return mo(t);
}
const ho = () => yo(), P = (o) => {
if (o) {
const n = JSON.stringify(o);
return JSON.parse(n);
}
return null;
}, T = {};
T[z] = {
nodeType: z,
nodeName: "网关",
// 节点标题
enable: !0,
// 节点是否可用
canAdd: !0,
// 节点是否可以增加
hasDrawer: !1,
// 节点是否可以进行配置
icon: {
// 图标
name: "ep-gateway",
// 图标名
color: "#3CB371"
// 颜色
},
branchList: []
};
T[G] = {
nodeType: G,
nodeName: "条件",
// 节点标题
color: "#FFFFFF",
// 节点标题颜色
bgColor: "#3CB371",
// 节点标题背景颜色
enable: !0,
// 节点是否可用
canAdd: !1,
// 节点是否可以增加
canRemoved: !0,
// 节点是否能够移除
hasDrawer: !0,
// 节点是否可以进行配置
icon: {
// 图标
name: "ep-condition",
// 图标名
color: "#3CB371"
// 颜色
}
};
T[oe] = {
nodeType: oe,
nodeName: "开始",
// 节点标题
color: "#FFFFFF",
// 节点标题颜色
bgColor: "#1e83e9",
// 节点标题背景颜色
enable: !0,
// 节点是否可用
canAdd: !1,
// 节点是否可以增加
canRemoved: !1,
// 节点是否能够移除
hasDrawer: !0,
// 节点是否可以进行配置
icon: {
// 图标
name: "ep-start",
// 图标名
color: "#1e83e9"
// 颜色
}
};
T[ge] = {
nodeType: ge,
nodeName: "任务",
// 节点标题
color: "#FFFFFF",
// 节点标题颜色
bgColor: "#FF8C00",
// 节点标题背景颜色
enable: !0,
// 节点是否可用
canAdd: !0,
// 节点是否可以增加
canRemoved: !0,
// 节点是否能够移除
hasDrawer: !0,
// 节点是否可以进行配置
icon: {
// 图标
name: "ep-task",
// 图标名
color: "#FF8C00"
// 颜色
}
};
T[ne] = {
nodeType: ne,
nodeName: "终止",
// 节点标题
color: "#FFFFFF",
// 节点标题颜色
bgColor: "#F56C6C",
// 节点标题背景颜色
enable: !0,
// 节点是否可用
canAdd: !0,
// 节点是否可以增加
canRemoved: !0,
// 节点是否能够移除
hasDrawer: !0,
// 节点是否可以进行配置
icon: {
// 图标
name: "ep-terminate",
// 图标名
color: "#F56C6C"
// 颜色
}
};
const No = (o) => {
o && o.length > 0 && o.forEach((n) => {
if (!n.nodeType)
throw new Error("加载自定义配置:nodeType节点类型不能为空");
if (!T[n.nodeType] && !n.nodeName)
throw new Error("加载自定义配置:nodeName节点类型不能为空");
let e = T[n.nodeType] || P(bo);
T[n.nodeType] = { ...e, ...n };
});
}, bo = {
enable: !0,
// 节点是否可用
color: "#FFFFFF",
// 节点标题颜色
bgColor: "#8225e4",
// 节点标题背景颜色
canAdd: !0,
// 节点是否可以增加
canRemoved: !0,
// 节点是否能够移除
hasDrawer: !0,
// 节点是否可以进行配置
icon: {
// 图标
name: "task",
// 图标名
color: "#8225e4"
// 颜色
}
}, Re = Ie({}), Se = Ie({}), wo = /([^/]+)-node\.vue$/i, Co = /([^/]+)-drawer\.vue$/i, Io = (o) => {
he(/* @__PURE__ */ Object.assign({ "../node/base/add-node.vue": () => Promise.resolve().then(() => Go), "../node/base/base-drawer.vue": () => Promise.resolve().then(() => Po), "../node/base/base-node.vue": () => Promise.resolve().then(() => on), "../node/end/end-node.vue": () => Promise.resolve().then(() => Fn), "../node/gateway/gateway-node.vue": () => Promise.resolve().then(() => yn) })), o && he(o);
}, he = (o) => {
Object.keys(o).forEach((n) => {
To(o, n), Eo(o, n);
});
}, To = (o, n) => {
let e = De(wo, n);
if (e) {
let t = o[n];
Re.value[e] = Te(t);
}
}, Eo = (o, n) => {
let e = De(Co, n);
if (e) {
let t = o[n];
Se.value[e] = Te(t);
}
}, De = (o, n) => {
let e = o.exec(n);
return e !== null ? e[1] : null;
}, se = "processCtrl", Le = "validator", Fo = "processData", $o = "on_designer_mounted", Oo = "on_pre_add_node", xo = "on_after_add_node", Ro = "on_pre_remove_node", So = "on_after_remove_node", Do = "on_pre_update_node_config", Lo = "on_after_update_node_config";
const ko = {
key: 0,
class: "ep-node-drawer-container"
}, Ao = x({
name: "base-drawer"
}), jo = /* @__PURE__ */ Object.assign(Ao, {
props: {},
emits: ["updateConfig", "cancelUpdateConfig"],
setup(o, { expose: n, emit: e }) {
const { proxy: t } = S();
let s = g(null);
const l = g(null);
let c = g(!1);
const v = ee(se), i = (a) => {
s.value = P(a), l.value = T[s.value.nodeType], c.value = !0;
}, h = () => {
let a = t.$refs.drawerImplRef.preUpdateHandle;
if (a && typeof a == "function" && !v.eventReturnIsTrue(a()))
return;
let u = v.triggerEvent(Do, {
tmpNodeId: s.value.tmpNodeId,
config: s.value.config
});
v.eventReturnIsTrue(u) && (c.value = !1, e("updateConfig", P(s.value.config)), M(() => {
v.triggerEvent(Lo, {
tmpNodeId: s.value.tmpNodeId
});
}));
}, f = () => {
c.value = !1, e("cancelUpdateConfig");
};
return n({
show: i
}), (a, u) => E(s) ? (d(), _("div", ko, [
N(uo, {
modelValue: E(c),
"onUpdate:modelValue": u[0] || (u[0] = (b) => ze(c) ? c.value = b : c = b),
title: "设置",
width: "600px"
}, {
default: q(() => [
(d(), F(Ee(E(Se)[E(s).nodeType]), {
ref: "drawerImplRef",
config: E(s).config
}, null, 8, ["config"]))
]),
footer: q(() => [
N(me, { onClick: f }, {
default: q(() => [
ve("取消")
]),
_: 1
}),
N(me, {
type: "primary",
onClick: h
}, {
default: q(() => [
ve("确定")
]),
_: 1
})
]),
_: 1
}, 8, ["modelValue"])
])) : m("", !0);
}
}), ke = /* @__PURE__ */ L(jo, [["__scopeId", "data-v-7423183a"]]), Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: ke
}, Symbol.toStringTag, { value: "Module" })), ue = (o = oe) => {
let n = T[o], e = ce(n);
if (o === z) {
let t = T[G];
e.branchList = [ce(t), ce(t)];
}
return e;
}, ce = (o) => ({
// 生成临时节点ID
tmpNodeId: ho(),
nodeName: o.nodeName,
nodeType: o.nodeType,
config: o.config || {},
childNode: null
});
const Uo = { class: "ep-node-add" }, Bo = ["onClick"], Vo = { class: "ep-node-add-select-item-title" }, Mo = x({
name: "add-node"
}), zo = /* @__PURE__ */ Object.assign(Mo, {
props: {
node: {
// 传入的流程节点数据
type: Object,
default: {}
}
},
setup(o) {
const n = o, { proxy: e } = S();
g(T[n.node.nodeType]);
const t = g(!1), s = g(null), l = g([]), c = ee(se);
Object.keys(T).forEach((f) => {
let a = T[f];
a.enable && a.canAdd && l.value.push({
nodeName: a.nodeName,
type: f,
icon: a.icon,
isSelected: !1
});
}), k(async () => {
});
const v = D(() => n.node.nodeType !== ne), i = (f) => {
t.value = f, f && e.$nextTick(() => {
let u = e.$refs.nodeAddSelect.getBoundingClientRect().width, R = e.$refs.nodeAddBtn.getBoundingClientRect().right;
const A = window.innerWidth;
R + u > A ? s.value = 1 : s.value = 2;
});
}, h = (f) => {
let a = c.triggerEvent(Oo, {
currentTmpNodeId: n.node.tmpNodeId,
addNodeType: f
});
if (!c.eventReturnIsTrue(a))
return;
let u = ue(f);
u && (f !== ne && (u.childNode = P(n.node.childNode)), n.node.childNode = u), i(!1), M(() => {
c.triggerEvent(xo, {
currentTmpNodeId: n.node.tmpNodeId,
addTmpNodeId: u.tmpNodeId
});
});
};
return (f, a) => {
const u = U("ep-svg-icon");
return d(), _("div", Uo, [
v.value ? (d(), _("div", {
key: 0,
ref: "nodeAddBtn",
class: "ep-node-add-btn",
onMouseenter: a[0] || (a[0] = (b) => i(!0)),
onMouseleave: a[1] || (a[1] = (b) => i(!1))
}, [
N(u, {
"icon-class": "ep-plus",
class: "ep-node-add-btn-icon",
color: "#FFFFFF"
}),
t.value ? (d(), _("div", {
key: 0,
ref: "nodeAddSelect",
class: V(["ep-node-add-select-box", s.value == 1 ? "ep-node-add-left" : "ep-node-add-right"])
}, [
(d(!0), _(B, null, ae(l.value, (b) => (d(), _("div", {
class: "ep-node-add-select-item",
onClick: (R) => h(b.type)
}, [
N(u, {
"icon-class": b.icon.name,
class: "ep-node-add-select-item-icon",
color: b.selected ? "#FFFFFF" : b.icon.color
}, null, 8, ["icon-class", "color"]),
r("div", Vo, j(b.nodeName), 1)
], 8, Bo))), 256))
], 2)) : m("", !0)
], 544)) : m("", !0)
]);
};
}
}), pe = /* @__PURE__ */ L(zo, [["__scopeId", "data-v-9de0a394"]]), Go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: pe
}, Symbol.toStringTag, { value: "Module" }));
const Yo = { class: "ep-node-header-title" }, Xo = {
key: 0,
class: "ep-node-header-title-text"
}, Wo = {
key: 1,
class: "ep-node-header-title-input"
}, Ho = {
key: 0,
class: "ep-node-move ep-node-move-left"
}, Ko = {
key: 1,
class: "ep-node-move ep-node-move-right"
}, qo = {
key: 2,
class: "ep-node-error-msg"
}, Jo = { class: "ep-node-error-msg-box" }, Qo = {
key: 0,
class: "ep-node-error-tips"
}, Zo = x({
name: "base-node"
}), en = /* @__PURE__ */ Object.assign(Zo, {
props: {
node: {
// 传入的流程节点数据
type: Object,
default: {}
},
branchList: {
// 条件集合,当节点类型为condition时有效
type: Array,
default: []
},
conditionIndex: {
// 当前条件节点的顺序,当节点类型为condition时有效
type: Number,
default: 0
}
},
emits: ["removeNode"],
setup(o, { emit: n }) {
const e = o, { proxy: t } = S(), s = g(T[e.node.nodeType]);
if (!s.value)
throw `未定义的节点类型: ${e.node.nodeType}`;
const l = g(!1), c = g(null), v = ee(se), i = ee(Le), h = g(null);
Fe(() => e.node, (p) => {
s.value = T[e.node.nodeType], i.validate();
}), k(async () => {
v.addNode(e.node.tmpNodeId, e.node);
}), Ce(async () => {
v.removeNode(e.node.tmpNodeId), i.remove(e.node.tmpNodeId), i.validate();
});
const f = D(() => e.node.nodeType === oe), a = D(() => {
let p = i.getResult(e.node.tmpNodeId);
return p ? (h.value = p.message, !p.valid) : (h.value = null, !1);
}), u = D(() => s.value.canRemoved), b = () => {
s.value.hasDrawer && t.$refs.nodeDrawer.show(e.node);
}, R = () => e.node.nodeType === G, A = () => !!(R() && e.conditionIndex === e.branchList.length - 1), X = () => {
let p = v.triggerEvent(Ro, {
tmpNodeId: e.node.tmpNodeId
});
v.eventReturnIsTrue(p) && (n("removeNode"), M(() => {
v.triggerEvent(So, {
tmpNodeId: e.node.tmpNodeId
});
}));
}, W = (p) => {
let y = e.conditionIndex, I = e.branchList[y], $;
p === 1 ? y > 0 ? ($ = y - 1, e.branchList[y] = e.branchList[$], e.branchList[$] = I) : (e.branchList.splice(0, 1), e.branchList.push(I)) : y < e.branchList.length - 1 ? ($ = y + 1, e.branchList[y] = e.branchList[$], e.branchList[$] = I) : (e.branchList.splice(e.branchList.length - 1, 1), e.branchList.splice(0, 0, I));
}, H = (p) => {
e.node.config = p, i.validate();
}, K = () => {
i.validate();
}, _e = () => {
l.value = !0, M(() => {
c.value.focus();
});
}, w = () => {
l.value = !1, (e.node.nodeName == null || e.node.nodeName.trim() === "") && (e.node.nodeName = s.value.nodeName);
};
return (p, y) => {
const I = U("ep-svg-icon");
return d(), _("div", {
class: V({ "ep-node": !0, "ep-node-arrows": !f.value })
}, [
r("div", {
class: V({ "ep-node-content": !0, "ep-node-error": a.value })
}, [
r("div", {
class: "ep-node-header",
style: $e({ color: s.value.color, "background-color": s.value.bgColor })
}, [
N(I, {
"icon-class": s.value.icon.name,
class: "ep-node-icon",
color: "#FFFFFF"
}, null, 8, ["icon-class"]),
r("div", Yo, [
l.value ? m("", !0) : (d(), _("div", Xo, j(e.node.nodeName), 1)),
l.value ? (d(), _("div", Wo, [
Ge(r("input", {
ref_key: "nodeNameRef",
ref: c,
"onUpdate:modelValue": y[0] || (y[0] = ($) => e.node.nodeName = $),
onBlur: w
}, null, 544), [
[Ye, e.node.nodeName]
])
])) : m("", !0),
l.value ? m("", !0) : (d(), F(I, {
key: 2,
class: "ep-node-header-title-edit",
"icon-class": "ep-edit",
color: "#FFFFFF",
onClick: _e
}))
]),
u.value ? (d(), F(I, {
key: 0,
"icon-class": "ep-close",
class: "ep-node-close",
color: "#FFFFFF",
onClick: X
})) : m("", !0)
], 4),
r("div", {
class: "ep-node-body",
onClick: b
}, [
(d(), F(Ee(E(Re)[e.node.nodeType]), {
ref: "node",
node: e.node,
isLastCondition: A()
}, null, 8, ["node", "isLastCondition"]))
]),
R() ? (d(), _("div", Ho, [
N(I, {
"icon-class": "ep-left",
class: "ep-node-move-icon",
onClick: y[1] || (y[1] = ($) => W(1))
})
])) : m("", !0),
R() ? (d(), _("div", Ko, [
N(I, {
"icon-class": "ep-right",
class: "ep-node-move-icon",
onClick: y[2] || (y[2] = ($) => W(2))
})
])) : m("", !0),
a.value ? (d(), _("div", qo, [
r("div", Jo, [
N(I, {
"icon-class": "ep-tips",
class: "ep-node-error-icon",
color: "red"
}),
h.value ? (d(), _("div", Qo, j(h.value), 1)) : m("", !0)
])
])) : m("", !0)
], 2),
N(pe, {
node: e.node
}, null, 8, ["node"]),
N(ke, {
ref: "nodeDrawer",
onUpdateConfig: H,
onCancelUpdateConfig: K
}, null, 512)
], 2);
};
}
}), Ae = /* @__PURE__ */ L(en, [["__scopeId", "data-v-5678d639"]]), on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Ae
}, Symbol.toStringTag, { value: "Module" })), Ne = "exclusive", be = "parallel", O = {};
O[Ne] = {
type: Ne,
name: "排他网关",
enable: !0,
// 是否启用
icon: "ep-exclusive-gateway",
desc: "按照分支顺序(从左向右)进行计算,选择第一个条件计算为true的分支继续流程,未设置条件时默认通过。"
};
O[be] = {
type: be,
name: "并行网关",
enable: !0,
// 是否启用
icon: "ep-parallel-gateway",
desc: "计算所有分支条件,符合条件的分支可并列执行,未设置条件时默认通过。"
};
let Z = null;
const nn = (o) => {
if (o && o.length > 0 && o.forEach((n) => {
if (!n.type)
throw new Error("加载网关类型配置:type网关类型不能为空");
if (!O[n.type])
throw new Error("加载网关类型配置:不存在网关类型:" + n.type);
O[n.type] = { ...O[n.type], ...n }, n.isDefault && n.isDefault === !0 && (Z = n.type);
}), Z == null) {
let n = Object.keys(O);
for (let e = 0; e < n.length; e++)
if (O[n[e]].enable) {
Z = n[e];
break;
}
}
};
const Y = (o) => (re("data-v-251cc8a6"), o = o(), ie(), o), tn = { class: "ep-node-gateway" }, sn = { class: "ep-node-gateway-body" }, dn = { class: "select-type-box" }, cn = /* @__PURE__ */ Y(() => /* @__PURE__ */ r("div", { class: "type-item-title" }, "添加分支", -1)), ln = ["onClick"], an = { class: "type-item-title" }, rn = { class: "ep-node-gateway-box" }, un = { class: "ep-node-gateway-col" }, pn = /* @__PURE__ */ Y(() => /* @__PURE__ */ r("div", { class: "cover-line top-left-cover-line" }, null, -1)), _n = /* @__PURE__ */ Y(() => /* @__PURE__ */ r("div", { class: "cover-line bottom-left-cover-line" }, null, -1)), vn = /* @__PURE__ */ Y(() => /* @__PURE__ */ r("div", { class: "cover-line top-right-cover-line" }, null, -1)), fn = /* @__PURE__ */ Y(() => /* @__PURE__ */ r("div", { class: "cover-line bottom-right-cover-line" }, null, -1)), mn = x({
name: "router-node"
}), gn = /* @__PURE__ */ Object.assign(mn, {
props: {
node: {
// 传入的流程配置数据
type: Object,
default: {}
}
},
emits: ["removeNode"],
setup(o, { emit: n }) {
const e = o;
S();
const t = D(() => O[e.node.gatewayType]), s = D(() => {
let i = [];
return Object.keys(O).forEach((h) => {
let f = O[h];
f.enable && i.push(f);
}), i;
});
k(async () => {
(!e.node.gatewayType || !t) && (e.node.gatewayType = Z);
});
const l = (i) => {
e.node.gatewayType = i;
}, c = (i) => {
e.node.branchList.length > 2 ? e.node.branchList.splice(i, 1) : (e.node.branchList.splice(i, 1), n("removeNode"));
}, v = () => {
let i = ue(G);
e.node.branchList.push(i);
};
return (i, h) => {
const f = U("ep-svg-icon");
return d(), _("div", tn, [
r("div", sn, [
t.value ? (d(), F(f, {
key: 0,
"icon-class": t.value.icon,
class: "icon"
}, null, 8, ["icon-class"])) : m("", !0),
r("div", dn, [
r("div", {
class: "type-item",
onClick: v
}, [
N(f, {
"icon-class": "ep-gateway",
class: "type-item-icon"
}),
cn
]),
s.value && s.value.length > 1 ? (d(!0), _(B, { key: 0 }, ae(s.value, (a) => (d(), _("div", {
class: "type-item",
onClick: (u) => l(a.type)
}, [
N(f, {
"icon-class": a.icon,
class: "type-item-icon"
}, null, 8, ["icon-class"]),
r("div", an, j(a.name), 1)
], 8, ln))), 256)) : m("", !0)
])
]),
r("div", rn, [
(d(!0), _(B, null, ae(e.node.branchList, (a, u) => (d(), _("div", un, [
N(Pe, {
node: a,
branchList: e.node.branchList,
conditionIndex: u,
onRemoveNode: (b) => c(u)
}, null, 8, ["node", "branchList", "conditionIndex", "onRemoveNode"]),
u === 0 ? (d(), _(B, { key: 0 }, [
pn,
_n
], 64)) : m("", !0),
u === e.node.branchList.length - 1 ? (d(), _(B, { key: 1 }, [
vn,
fn
], 64)) : m("", !0)
]))), 256))
]),
N(pe, {
node: e.node
}, null, 8, ["node"])
]);
};
}
}), je = /* @__PURE__ */ L(gn, [["__scopeId", "data-v-251cc8a6"]]), yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: je
}, Symbol.toStringTag, { value: "Module" })), hn = {
key: 0,
class: "ep-node-wrap"
}, Nn = x({
name: "NodeWrap"
}), Pe = /* @__PURE__ */ Object.assign(Nn, {
props: {
node: {
// 当前流程节点数据
type: Object,
default: {}
},
branchList: {
// 条件集合,当节点类型为condition时有效
type: Array,
default: []
},
conditionIndex: {
// 当前条件节点的顺序,当节点类型为condition时有效
type: Number,
default: 0
},
canRemoved: {
// 当前节点是否可以移除
type: Boolean,
default: !0
}
},
emits: ["removeNode"],
setup(o, { emit: n }) {
const e = o;
S(), g({}), k(async () => {
});
const t = () => {
n("removeNode");
}, s = () => {
if (e.node.childNode.nodeType === z) {
let l = e.node.childNode.branchList[0].childNode;
l ? l.childNode = e.node.childNode.childNode : l = e.node.childNode.childNode, e.node.childNode = l || null;
} else
e.node.childNode = e.node.childNode.childNode;
};
return (l, c) => {
const v = U("node-wrap", !0);
return e.node ? (d(), _("div", hn, [
e.node.nodeType === E(z) ? (d(), F(je, {
node: e.node,
onRemoveNode: t,
key: e.node.tmpNodeId
}, null, 8, ["node"])) : (d(), F(Ae, {
node: e.node,
branchList: e.branchList,
conditionIndex: e.conditionIndex,
onRemoveNode: t,
key: e.node.tmpNodeId
}, null, 8, ["node", "branchList", "conditionIndex"])),
e.node.childNode && e.node.childNode.nodeType ? (d(), F(v, {
key: 2,
node: e.node.childNode,
onRemoveNode: s
}, null, 8, ["node"])) : m("", !0)
])) : m("", !0);
};
}
});
const Ue = (o) => (re("data-v-68e175f7"), o = o(), ie(), o), bn = { class: "ep-node-end" }, wn = /* @__PURE__ */ Ue(() => /* @__PURE__ */ r("div", { class: "ep-node-end-icon" }, null, -1)), Cn = /* @__PURE__ */ Ue(() => /* @__PURE__ */ r("div", { class: "ep-node-end-text" }, "流程结束", -1)), In = [
wn,
Cn
], Tn = x({
name: "end-node"
}), En = /* @__PURE__ */ Object.assign(Tn, {
props: {
node: {
// 传入的流程配置数据
type: Object,
default: {}
}
},
setup(o) {
return S(), g({}), k(async () => {
}), (n, e) => (d(), _("div", bn, In));
}
}), Be = /* @__PURE__ */ L(En, [["__scopeId", "data-v-68e175f7"]]), Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Be
}, Symbol.toStringTag, { value: "Module" })), $n = () => {
let o = {};
return o.nodes = /* @__PURE__ */ new Map(), o.events = /* @__PURE__ */ new Map(), o.addNode = (n, e) => {
o.nodes.set(n, e);
}, o.getNode = (n) => o.nodes.get(n), o.removeNode = (n) => {
o.nodes.delete(n);
}, o.bindEvent = (n, e) => {
n && e && typeof e == "function" && o.events.set(n, e);
}, o.unbindEvent = (n) => {
o.events.delete(n);
}, o.getBindEvent = (n) => o.events.get(n), o.triggerEvent = (n, e) => {
let t = o.getBindEvent(n);
return t ? t(e) : null;
}, o.eventReturnIsTrue = (n) => typeof n == "boolean" ? n : !0, o;
}, On = () => {
let o = {};
return o.nodeRules = /* @__PURE__ */ new Map(), o.results = Xe(/* @__PURE__ */ new Map()), o.register = (n, e) => {
e && e instanceof Function && o.nodeRules.set(n, e);
}, o.remove = (n) => {
o.nodeRules.delete(n), o.results.delete(n);
}, o.validate = () => {
let n = !0, e = [];
return o.nodeRules.forEach((t, s) => {
let l = t;
if (l && l instanceof Function) {
let c = l();
c.valid ? o.results.delete(s) : (n = !1, o.results.set(s, c), e.push(c.message));
}
}), { valid: n, messages: e };
}, o.getResult = (n) => {
let e = o.results.get(n);
if (e)
return e;
}, o;
};
const xn = { class: "ep-zoom" }, Rn = x({
name: "ep-designer"
}), Sn = /* @__PURE__ */ Object.assign(Rn, {
props: {
data: {
// 传入的流程节点数据
type: Object,
default: {}
}
},
setup(o, { expose: n }) {
const e = o;
S();
let t = g(100), s = $n();
de(se, s);
let l = On();
de(Le, l);
let c = g({});
de(Fo, c), Fe(
() => e.data,
(w) => {
i();
}
), k(async () => {
i();
});
const v = (w) => {
if (w === 1) {
if (t.value === 40)
return;
t.value -= 10;
} else {
if (t.value === 150)
return;
t.value += 10;
}
}, i = () => {
e.data.nodeConfig ? c.value = P(e.data) : c.value.nodeConfig = ue(), M(() => {
h(), s.triggerEvent($o);
});
}, h = (w) => {
let p = l.validate();
w && typeof w == "function" && w(p.valid, p.messages);
}, f = () => P(c.value), a = () => s, u = g(!1), b = g(0), R = g(0), A = g(0), X = g(0), W = (w) => {
u.value = !0, b.value = w.clientX, R.value = w.clientY;
const p = document.getElementById("ep-container");
A.value = p.scrollLeft, X.value = p.scrollTop, document.addEventListener("mousemove", H), document.addEventListener("mouseup", K);
}, H = (w) => {
if (u.value) {
let p = w.clientX - b.value, y = w.clientY - R.value;
const I = document.getElementById("ep-container");
I.scrollLeft = A.value - p, I.scrollTop = X.value - y;
}
}, K = () => {
u.value = !1, document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", K);
};
return n({
validate: h,
getResult: f,
getProcessCtrl: a,
bindEvent: (w, p) => {
s.bindEvent(w, p);
}
}), (w, p) => {
const y = U("ep-svg-icon");
return d(), _("div", {
id: "ep-container",
class: "ep-container",
onMousedown: W
}, [
r("div", {
class: "ep-process",
style: $e(`transform: scale(${E(t) / 100});`)
}, [
E(c) && E(c).nodeConfig ? (d(), F(Pe, {
key: 0,
node: E(c).nodeConfig
}, null, 8, ["node"])) : m("", !0),
N(Be)
], 4),
r("div", xn, [
N(y, {
"icon-class": "ep-subtract",
class: "ep-zoom-icon",
color: "#ffffff",
onClick: p[0] || (p[0] = (I) => v(1))
}),
r("span", null, j(E(t)) + "%", 1),
N(y, {
"icon-class": "ep-plus",
class: "ep-zoom-icon",
color: "#ffffff",
onClick: p[1] || (p[1] = (I) => v(2))
})
])
], 32);
};
}
}), Dn = /* @__PURE__ */ L(Sn, [["__scopeId", "data-v-c7eedae4"]]), Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Dn
}, Symbol.toStringTag, { value: "Module" })), we = /* @__PURE__ */ Object.assign({
"./components/svg-icon/ep-svg-icon.vue": Ze,
"./ep-designer.vue": Ln
}), te = (o, n) => {
console.log("run install"), !te.installed && (te.installed, An(o, n), kn(o));
}, kn = (o, n) => {
Object.keys(we).forEach((e) => {
const t = we[e], s = t.default.name;
o.component(s, t.default || t);
});
}, An = (o, n) => {
let { nodeImplPath: e, nodeConfig: t, gatewayTypeConfig: s, zIndexConfig: l, iconConfig: c } = n;
Io(e), No(t), nn(s), eo(l), We(c);
};
typeof window < "u" && window.Vue && te(window.Vue);
const Pn = {
install: te
};
export {
Pn as default
};