@notmrabhi/flowforge 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GatewayBranchEdge-4XMPBHne.js → GatewayBranchEdge-BdUVHQJc.js} +57 -49
- package/dist/GatewayBranchEdge-DK6kuCK2.js +1 -0
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.js +2 -2
- package/dist/defaultUi.cjs +1 -1
- package/dist/defaultUi.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{templateSkeletons-D8-v6BFH.js → templateSkeletons--Ol7Sg7H.js} +1 -1
- package/dist/{templateSkeletons-CQec51xm.js → templateSkeletons-DcvDac7_.js} +190 -189
- package/package.json +1 -1
- package/dist/GatewayBranchEdge-mRo5aZ3f.js +0 -1
|
@@ -2,7 +2,7 @@ import { jsxs as v, jsx as f, Fragment as ye } from "react/jsx-runtime";
|
|
|
2
2
|
import G, { useRef as vt, useEffect as re, useState as M, useCallback as $, useMemo as Y } from "react";
|
|
3
3
|
import In, { useStore as On, useReactFlow as Mn, Background as jn, Controls as Fn, MiniMap as zn } from "reactflow";
|
|
4
4
|
import "reactflow/dist/style.css";
|
|
5
|
-
import { e as Ln, G as An, E as Dn, P as Rn, L as Pn, d as Bn, f as Wn } from "./GatewayBranchEdge-
|
|
5
|
+
import { e as Ln, G as An, E as Dn, P as Rn, L as Pn, d as Bn, f as Wn } from "./GatewayBranchEdge-BdUVHQJc.js";
|
|
6
6
|
import { Dialog as Gn, Box as Q, Drawer as $n, IconButton as Et, Button as Ne, CircularProgress as Yn } from "@mui/material";
|
|
7
7
|
import Kn from "react-select";
|
|
8
8
|
import { MdClose as Un, MdCalendarToday as Vn, MdBolt as Hn, MdArrowBack as Wt, MdChevronRight as Gt, MdAddCircleOutline as qn, MdApps as Xn, MdErrorOutline as Jn, MdAccountTree as Zn, MdAdd as Qn, MdSearch as er, MdCategory as tr, MdCancel as $t, MdError as Yt, MdCheckCircle as Kt, MdPlayArrow as Ut, MdHourglassEmpty as nr, MdSchedule as kt, MdPerson as rr, MdExpandLess as or, MdExpandMore as ir } from "react-icons/md";
|
|
@@ -261,8 +261,8 @@ function Tr(e, t, n, r) {
|
|
|
261
261
|
}, a = function() {
|
|
262
262
|
l.forEach(function(u) {
|
|
263
263
|
r(u).forEach(function(h) {
|
|
264
|
-
let g = h.v === u ? h.v : h.w,
|
|
265
|
-
d({ v: g, w:
|
|
264
|
+
let g = h.v === u ? h.v : h.w, b = g === h.v ? h.w : h.v;
|
|
265
|
+
d({ v: g, w: b });
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
268
|
};
|
|
@@ -950,7 +950,7 @@ function pn(e, t, n, r, o, i, s) {
|
|
|
950
950
|
e.setParent(a, s), u.borderTop = a, e.setParent(c, s), u.borderBottom = c, d.forEach((h) => {
|
|
951
951
|
var g;
|
|
952
952
|
pn(e, t, n, r, o, i, h);
|
|
953
|
-
let
|
|
953
|
+
let b = e.node(h), E = b.borderTop ? b.borderTop : h, y = b.borderBottom ? b.borderBottom : h, x = b.borderTop ? r : 2 * r, N = E !== y ? 1 : o - ((g = i[s]) != null ? g : 0) + 1;
|
|
954
954
|
e.setEdge(a, E, { weight: x, minlen: N, nestingEdge: !0 }), e.setEdge(y, c, { weight: x, minlen: N, nestingEdge: !0 });
|
|
955
955
|
}), e.parent(s) || e.setEdge(t, a, { weight: 0, minlen: o + ((l = i[s]) != null ? l : 0) });
|
|
956
956
|
}
|
|
@@ -1138,7 +1138,7 @@ function yn(e, t, n, r) {
|
|
|
1138
1138
|
u.vs = [s, u.vs, l].flat(1);
|
|
1139
1139
|
let h = e.predecessors(s);
|
|
1140
1140
|
if (h && h.length) {
|
|
1141
|
-
let g = e.node(h[0]),
|
|
1141
|
+
let g = e.node(h[0]), b = e.predecessors(l), E = e.node(b[0]);
|
|
1142
1142
|
Object.hasOwn(u, "barycenter") || (u.barycenter = 0, u.weight = 0), u.barycenter = (u.barycenter * u.weight + g.order + E.order) / (u.weight + 2), u.weight += 2;
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
@@ -1229,11 +1229,11 @@ function Zo(e, t) {
|
|
|
1229
1229
|
let s = 0, l = 0, d = o.length, a = i[i.length - 1];
|
|
1230
1230
|
return i.forEach((c, u) => {
|
|
1231
1231
|
let h = ei(e, c), g = h ? e.node(h).order : d;
|
|
1232
|
-
(h || c === a) && (i.slice(l, u + 1).forEach((
|
|
1233
|
-
let E = e.predecessors(
|
|
1232
|
+
(h || c === a) && (i.slice(l, u + 1).forEach((b) => {
|
|
1233
|
+
let E = e.predecessors(b);
|
|
1234
1234
|
E && E.forEach((y) => {
|
|
1235
1235
|
let x = e.node(y), N = x.order;
|
|
1236
|
-
(N < s || g < N) && !(x.dummy && e.node(
|
|
1236
|
+
(N < s || g < N) && !(x.dummy && e.node(b).dummy) && wn(n, y, b);
|
|
1237
1237
|
});
|
|
1238
1238
|
}), l = u + 1, s = g);
|
|
1239
1239
|
}), i;
|
|
@@ -1249,8 +1249,8 @@ function Qo(e, t) {
|
|
|
1249
1249
|
let h = e.predecessors(u);
|
|
1250
1250
|
h && h.forEach((g) => {
|
|
1251
1251
|
if (g === void 0) return;
|
|
1252
|
-
let
|
|
1253
|
-
|
|
1252
|
+
let b = e.node(g);
|
|
1253
|
+
b.dummy && (b.order < d || b.order > a) && wn(n, g, u);
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
});
|
|
@@ -1304,11 +1304,11 @@ function ni(e, t, n, r) {
|
|
|
1304
1304
|
l.forEach((a) => {
|
|
1305
1305
|
let c = r(a);
|
|
1306
1306
|
if (c && c.length) {
|
|
1307
|
-
let u = c.sort((g,
|
|
1308
|
-
let E = s[g], y = s[
|
|
1307
|
+
let u = c.sort((g, b) => {
|
|
1308
|
+
let E = s[g], y = s[b];
|
|
1309
1309
|
return (E !== void 0 ? E : 0) - (y !== void 0 ? y : 0);
|
|
1310
1310
|
}), h = (u.length - 1) / 2;
|
|
1311
|
-
for (let g = Math.floor(h),
|
|
1311
|
+
for (let g = Math.floor(h), b = Math.ceil(h); g <= b; ++g) {
|
|
1312
1312
|
let E = u[g];
|
|
1313
1313
|
if (E === void 0) continue;
|
|
1314
1314
|
let y = s[E];
|
|
@@ -1323,28 +1323,28 @@ function ni(e, t, n, r) {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
function ri(e, t, n, r, o = !1) {
|
|
1325
1325
|
let i = {}, s = oi(e, t, n, o), l = o ? "borderLeft" : "borderRight";
|
|
1326
|
-
function d(g,
|
|
1326
|
+
function d(g, b) {
|
|
1327
1327
|
let E = s.nodes().slice(), y = {}, x = E.pop();
|
|
1328
1328
|
for (; x; ) {
|
|
1329
1329
|
if (y[x]) g(x);
|
|
1330
1330
|
else {
|
|
1331
1331
|
y[x] = !0, E.push(x);
|
|
1332
|
-
for (let N of
|
|
1332
|
+
for (let N of b(x)) E.push(N);
|
|
1333
1333
|
}
|
|
1334
1334
|
x = E.pop();
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
1337
|
function a(g) {
|
|
1338
|
-
let
|
|
1339
|
-
|
|
1338
|
+
let b = s.inEdges(g);
|
|
1339
|
+
b ? i[g] = b.reduce((E, y) => {
|
|
1340
1340
|
var x;
|
|
1341
1341
|
let N = (x = i[y.v]) != null ? x : 0, O = s.edge(y);
|
|
1342
1342
|
return Math.max(E, N + (O !== void 0 ? O : 0));
|
|
1343
1343
|
}, 0) : i[g] = 0;
|
|
1344
1344
|
}
|
|
1345
1345
|
function c(g) {
|
|
1346
|
-
let
|
|
1347
|
-
|
|
1346
|
+
let b = s.outEdges(g), E = Number.POSITIVE_INFINITY;
|
|
1347
|
+
b && (E = b.reduce((x, N) => {
|
|
1348
1348
|
let O = i[N.w], F = s.edge(N);
|
|
1349
1349
|
return Math.min(x, (O !== void 0 ? O : 0) - (F !== void 0 ? F : 0));
|
|
1350
1350
|
}, Number.POSITIVE_INFINITY));
|
|
@@ -1358,9 +1358,9 @@ function ri(e, t, n, r, o = !1) {
|
|
|
1358
1358
|
return s.successors(g) || [];
|
|
1359
1359
|
}
|
|
1360
1360
|
return d(a, u), d(c, h), Object.keys(r).forEach((g) => {
|
|
1361
|
-
var
|
|
1361
|
+
var b;
|
|
1362
1362
|
let E = n[g];
|
|
1363
|
-
E !== void 0 && (i[g] = (
|
|
1363
|
+
E !== void 0 && (i[g] = (b = i[E]) != null ? b : 0);
|
|
1364
1364
|
}), i;
|
|
1365
1365
|
}
|
|
1366
1366
|
function oi(e, t, n, r) {
|
|
@@ -1707,7 +1707,7 @@ const Ri = (e) => {
|
|
|
1707
1707
|
onClose: o,
|
|
1708
1708
|
loadTriggerSources: i
|
|
1709
1709
|
}) => {
|
|
1710
|
-
const [s, l] = M("trigger"), [d, a] = M(null), [c, u] = M([]), [h, g] = M([]), [
|
|
1710
|
+
const [s, l] = M("trigger"), [d, a] = M(null), [c, u] = M([]), [h, g] = M([]), [b, E] = M(!1), [y, x] = M(null);
|
|
1711
1711
|
re(() => {
|
|
1712
1712
|
e || (l("trigger"), a(null), u([]), g([]), E(!1), x(null));
|
|
1713
1713
|
}, [e]);
|
|
@@ -1764,15 +1764,15 @@ const Ri = (e) => {
|
|
|
1764
1764
|
"div",
|
|
1765
1765
|
{
|
|
1766
1766
|
className: "ff-p-3 ff-rounded ff-border ff-d-flex ff-align-items-start ff-gap-3",
|
|
1767
|
-
style: { cursor:
|
|
1768
|
-
onClick: () => !
|
|
1767
|
+
style: { cursor: b ? "wait" : "pointer", transition: "background 0.15s", opacity: b ? 0.6 : 1 },
|
|
1768
|
+
onClick: () => !b && N(z),
|
|
1769
1769
|
role: "button",
|
|
1770
1770
|
tabIndex: 0,
|
|
1771
1771
|
onKeyDown: (R) => {
|
|
1772
|
-
R.key === "Enter" && !
|
|
1772
|
+
R.key === "Enter" && !b && N(z);
|
|
1773
1773
|
},
|
|
1774
1774
|
onMouseEnter: (R) => {
|
|
1775
|
-
|
|
1775
|
+
b || (R.currentTarget.style.background = "#f5f5f5");
|
|
1776
1776
|
},
|
|
1777
1777
|
onMouseLeave: (R) => {
|
|
1778
1778
|
R.currentTarget.style.background = "";
|
|
@@ -1789,7 +1789,7 @@ const Ri = (e) => {
|
|
|
1789
1789
|
)),
|
|
1790
1790
|
t.length === 0 && /* @__PURE__ */ f("p", { className: "ff-text-muted ff-text-center", style: { fontSize: 13 }, children: n.noTriggers })
|
|
1791
1791
|
] }),
|
|
1792
|
-
|
|
1792
|
+
b && /* @__PURE__ */ v(Q, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 2, fontSize: 12, color: "#64748b" }, children: [
|
|
1793
1793
|
/* @__PURE__ */ f(Yn, { size: 14 }),
|
|
1794
1794
|
/* @__PURE__ */ f("span", { children: "Loading sources for the selected trigger…" })
|
|
1795
1795
|
] }),
|
|
@@ -1843,8 +1843,8 @@ const Ri = (e) => {
|
|
|
1843
1843
|
const u = /* @__PURE__ */ new Map(), h = [];
|
|
1844
1844
|
for (const g of t)
|
|
1845
1845
|
if (g.app) {
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1846
|
+
const b = u.get(g.app.key);
|
|
1847
|
+
b ? b.descriptors.push(g) : u.set(g.app.key, {
|
|
1848
1848
|
key: g.app.key,
|
|
1849
1849
|
label: g.app.label,
|
|
1850
1850
|
icon: g.app.icon,
|
|
@@ -1973,9 +1973,9 @@ const Ri = (e) => {
|
|
|
1973
1973
|
}
|
|
1974
1974
|
);
|
|
1975
1975
|
}, Dt = "_conditionConfig", Gi = ({ open: e, nodeId: t, descriptor: n, initialValues: r, messages: o, onSave: i, onClose: s }) => {
|
|
1976
|
-
const [l, d] = M([]), [a, c] = M(!1), [u, h] = M(null), [g,
|
|
1976
|
+
const [l, d] = M([]), [a, c] = M(!1), [u, h] = M(null), [g, b] = M({});
|
|
1977
1977
|
re(() => {
|
|
1978
|
-
|
|
1978
|
+
b((r == null ? void 0 : r[Dt]) ?? {});
|
|
1979
1979
|
}, [r, t]), re(() => {
|
|
1980
1980
|
let N = !1;
|
|
1981
1981
|
if (h(null), !n || !t) {
|
|
@@ -2015,7 +2015,7 @@ const Ri = (e) => {
|
|
|
2015
2015
|
initialValues: r ?? {},
|
|
2016
2016
|
formId: E,
|
|
2017
2017
|
conditionConfig: g,
|
|
2018
|
-
onConditionConfigChange:
|
|
2018
|
+
onConditionConfigChange: b,
|
|
2019
2019
|
onSubmit: (N) => {
|
|
2020
2020
|
if (!t) return;
|
|
2021
2021
|
const O = Object.keys(g).length > 0;
|
|
@@ -2130,9 +2130,9 @@ function Vi(e, t, n, r) {
|
|
|
2130
2130
|
}, g = (y, x, N) => {
|
|
2131
2131
|
let O = N;
|
|
2132
2132
|
for (const F of y)
|
|
2133
|
-
O = h(F.id, x, O) + s, ae(F.kind) && t[F.id] && (O =
|
|
2133
|
+
O = h(F.id, x, O) + s, ae(F.kind) && t[F.id] && (O = b(F.id, x, O));
|
|
2134
2134
|
return O;
|
|
2135
|
-
},
|
|
2135
|
+
}, b = (y, x, N) => {
|
|
2136
2136
|
const O = x + 180, F = t[y], j = Object.keys(F), W = u.get(y), z = (W == null ? void 0 : W.branchLabels) ?? { pass: "Pass", fail: "Fail" }, R = a[y], B = r[y] ?? { height: 80 }, Ee = R.y + B.height, ke = [];
|
|
2137
2137
|
let te = N;
|
|
2138
2138
|
return j.forEach((ce, pe) => {
|
|
@@ -2150,7 +2150,7 @@ function Vi(e, t, n, r) {
|
|
|
2150
2150
|
};
|
|
2151
2151
|
let E = Ve;
|
|
2152
2152
|
for (const y of e)
|
|
2153
|
-
E = h(y.id, 400, E) + s, ae(y.kind) && t[y.id] && (E =
|
|
2153
|
+
E = h(y.id, 400, E) + s, ae(y.kind) && t[y.id] && (E = b(y.id, 400, E));
|
|
2154
2154
|
return {
|
|
2155
2155
|
nodes: n.map((y) => a[y.id] ? { ...y, position: a[y.id] } : y),
|
|
2156
2156
|
railSpecs: c
|
|
@@ -2181,21 +2181,21 @@ function Hi(e, t, n, r, o) {
|
|
|
2181
2181
|
};
|
|
2182
2182
|
}
|
|
2183
2183
|
function qi(e, t, n, r, o = {}, i = "TB", s = "horizontal") {
|
|
2184
|
-
const l = o.edgeColor ?? "#b0bec5", d = [], a = [], c = (
|
|
2185
|
-
const y = t[
|
|
2184
|
+
const l = o.edgeColor ?? "#b0bec5", d = [], a = [], c = (b, E) => {
|
|
2185
|
+
const y = t[b];
|
|
2186
2186
|
if (!y) return;
|
|
2187
2187
|
const N = E ?? { pass: "Pass", fail: "Fail" }, O = Object.keys(y), F = (j, W, z, R) => {
|
|
2188
2188
|
if (j.length !== 0) {
|
|
2189
2189
|
j.forEach((B) => d.push(Pt(B))), a.push({
|
|
2190
|
-
id: `e-${
|
|
2191
|
-
source:
|
|
2190
|
+
id: `e-${b}-${W}-start`,
|
|
2191
|
+
source: b,
|
|
2192
2192
|
target: j[0].id,
|
|
2193
2193
|
type: "gatewayBranchEdge",
|
|
2194
2194
|
style: { stroke: l },
|
|
2195
|
-
data: { branch: W, filterId:
|
|
2195
|
+
data: { branch: W, filterId: b, label: z, isFirst: R === 0, onAddStepClick: n, verticalRouting: s === "vertical" }
|
|
2196
2196
|
});
|
|
2197
2197
|
for (let B = 1; B < j.length; B++)
|
|
2198
|
-
ae(j[B - 1].kind) || a.push(Hi(j[B - 1], j[B], l, n, { filterId:
|
|
2198
|
+
ae(j[B - 1].kind) || a.push(Hi(j[B - 1], j[B], l, n, { filterId: b, branch: W }));
|
|
2199
2199
|
for (const B of j)
|
|
2200
2200
|
ae(B.kind) && t[B.id] && c(B.id, B.branchLabels);
|
|
2201
2201
|
}
|
|
@@ -2204,10 +2204,10 @@ function qi(e, t, n, r, o = {}, i = "TB", s = "horizontal") {
|
|
|
2204
2204
|
F(y[j], j, N[j] ?? j, W);
|
|
2205
2205
|
});
|
|
2206
2206
|
};
|
|
2207
|
-
for (let
|
|
2208
|
-
const E = e[
|
|
2209
|
-
if (d.push(Pt(E)),
|
|
2210
|
-
const y = e[
|
|
2207
|
+
for (let b = 0; b < e.length; b++) {
|
|
2208
|
+
const E = e[b];
|
|
2209
|
+
if (d.push(Pt(E)), b > 0) {
|
|
2210
|
+
const y = e[b - 1], x = y.kind === "start" || y.kind === "addTrigger";
|
|
2211
2211
|
if (y.kind === "filter" || y.kind === "approval") continue;
|
|
2212
2212
|
a.push({
|
|
2213
2213
|
id: `e-${y.id}-${E.id}`,
|
|
@@ -2224,10 +2224,10 @@ function qi(e, t, n, r, o = {}, i = "TB", s = "horizontal") {
|
|
|
2224
2224
|
(E.kind === "filter" || E.kind === "approval") && t[E.id] && c(E.id, E.branchLabels);
|
|
2225
2225
|
}
|
|
2226
2226
|
const u = {};
|
|
2227
|
-
if (d.forEach((
|
|
2228
|
-
u[
|
|
2227
|
+
if (d.forEach((b) => {
|
|
2228
|
+
u[b.id] = {
|
|
2229
2229
|
width: we,
|
|
2230
|
-
height: r[
|
|
2230
|
+
height: r[b.id] ?? He[b.type ?? ""] ?? 80
|
|
2231
2231
|
};
|
|
2232
2232
|
}), !(Object.keys(t).length > 0)) {
|
|
2233
2233
|
if (i === "LR") {
|
|
@@ -2237,16 +2237,16 @@ function qi(e, t, n, r, o = {}, i = "TB", s = "horizontal") {
|
|
|
2237
2237
|
return N += j + Ue, z;
|
|
2238
2238
|
}), edges: a };
|
|
2239
2239
|
}
|
|
2240
|
-
const
|
|
2240
|
+
const b = 400;
|
|
2241
2241
|
let E = Ve;
|
|
2242
2242
|
return { nodes: d.map((x) => {
|
|
2243
|
-
const N = u[x.id].height, O = { ...x, position: { x:
|
|
2243
|
+
const N = u[x.id].height, O = { ...x, position: { x: b - we / 2, y: E } };
|
|
2244
2244
|
return E += N + Ue, O;
|
|
2245
2245
|
}), edges: a };
|
|
2246
2246
|
}
|
|
2247
2247
|
if (s === "vertical") {
|
|
2248
|
-
const { nodes:
|
|
2249
|
-
return { nodes:
|
|
2248
|
+
const { nodes: b, railSpecs: E } = Vi(e, t, d, u);
|
|
2249
|
+
return { nodes: b.map(
|
|
2250
2250
|
(x) => E[x.id] ? { ...x, data: { ...x.data, _branchRail: E[x.id] } } : x
|
|
2251
2251
|
), edges: a };
|
|
2252
2252
|
}
|
|
@@ -2267,7 +2267,7 @@ const Bt = ({
|
|
|
2267
2267
|
loadTriggerSources: u,
|
|
2268
2268
|
renderNodePicker: h,
|
|
2269
2269
|
renderNodeConfig: g,
|
|
2270
|
-
onNodeClick:
|
|
2270
|
+
onNodeClick: b,
|
|
2271
2271
|
maxNodes: E,
|
|
2272
2272
|
layoutDirection: y = "TB",
|
|
2273
2273
|
executionRecord: x,
|
|
@@ -2287,90 +2287,91 @@ const Bt = ({
|
|
|
2287
2287
|
branchLayout: ce = "horizontal",
|
|
2288
2288
|
nodeBody: pe = "full"
|
|
2289
2289
|
} = a, oe = Y(() => ur(d), [d]), [A, ie] = M(() => (n == null ? void 0 : n.slots) ?? Rt()), [U, J] = M(() => (n == null ? void 0 : n.branches) ?? {}), [ue, V] = M(null), [Fe, tt] = M(null), [H, xe] = M(null), [se, nt] = M(null), [Te, rt] = M(null), [q, ot] = M(() => {
|
|
2290
|
-
const
|
|
2291
|
-
return
|
|
2292
|
-
}), [it, En] = M({}), kn = $((
|
|
2293
|
-
En(
|
|
2290
|
+
const p = n == null ? void 0 : n.slots.find((_) => _.kind === "triggerFixed"), w = p != null && p.id.startsWith("trigger-") ? p.id.slice(8) : void 0;
|
|
2291
|
+
return w ? t.lookup(w) ?? null : null;
|
|
2292
|
+
}), [it, En] = M({}), kn = $((p) => {
|
|
2293
|
+
En(p);
|
|
2294
2294
|
}, []), xn = Y(() => ({ ...Ln, ...r }), [r]), Tn = Y(() => ({ ...Ki, ...o }), [o]), _n = Y(() => {
|
|
2295
|
-
const
|
|
2296
|
-
return
|
|
2297
|
-
}, [A, U]), st = E ?? (q == null ? void 0 : q.maxTasks), lt = st !== void 0 && _n >= st, le = $((
|
|
2298
|
-
const
|
|
2299
|
-
if (
|
|
2295
|
+
const p = A.filter((_) => _.kind === "userTask").length, w = Object.values(U).flatMap((_) => Object.values(_).flat()).filter((_) => _.kind === "userTask").length;
|
|
2296
|
+
return p + w;
|
|
2297
|
+
}, [A, U]), st = E ?? (q == null ? void 0 : q.maxTasks), lt = st !== void 0 && _n >= st, le = $((p) => {
|
|
2298
|
+
const w = A.find((_) => _.id === p);
|
|
2299
|
+
if (w) return w;
|
|
2300
2300
|
for (const _ of Object.values(U)) {
|
|
2301
|
-
const k = Object.values(_).flat().find((
|
|
2301
|
+
const k = Object.values(_).flat().find((I) => I.id === p);
|
|
2302
2302
|
if (k) return k;
|
|
2303
2303
|
}
|
|
2304
2304
|
return null;
|
|
2305
|
-
}, [A, U]), ze = $((
|
|
2306
|
-
s || (tt(
|
|
2307
|
-
}, [s]), at = $((
|
|
2305
|
+
}, [A, U]), ze = $((p) => {
|
|
2306
|
+
s || (tt(p), V("nodeConfig"));
|
|
2307
|
+
}, [s]), at = $((p) => {
|
|
2308
2308
|
if (!s) {
|
|
2309
|
-
if (A.some((
|
|
2310
|
-
const
|
|
2311
|
-
if ((
|
|
2309
|
+
if (A.some((w) => w.id === p)) {
|
|
2310
|
+
const w = A.find((_) => _.id === p);
|
|
2311
|
+
if ((w == null ? void 0 : w.kind) === "triggerFixed") {
|
|
2312
2312
|
ie(Rt()), J({}), ot(null);
|
|
2313
2313
|
return;
|
|
2314
2314
|
}
|
|
2315
2315
|
ie((_) => {
|
|
2316
|
-
const k = _.filter((
|
|
2317
|
-
return ae((
|
|
2316
|
+
const k = _.filter((I) => I.id !== p);
|
|
2317
|
+
return ae((w == null ? void 0 : w.kind) ?? "") && !k.some((I) => I.kind === "end") ? [...k, { id: "end", kind: "end", reactFlowType: "endNode" }] : k;
|
|
2318
2318
|
}), J((_) => {
|
|
2319
|
-
const k = { ..._ },
|
|
2320
|
-
k[
|
|
2319
|
+
const k = { ..._ }, I = (m) => {
|
|
2320
|
+
k[m] && (Object.values(k[m]).flat().filter((T) => ae(T.kind)).forEach((T) => I(T.id)), delete k[m]);
|
|
2321
2321
|
};
|
|
2322
|
-
return
|
|
2322
|
+
return I(p), k;
|
|
2323
2323
|
});
|
|
2324
2324
|
return;
|
|
2325
2325
|
}
|
|
2326
|
-
J((
|
|
2327
|
-
const _ = (
|
|
2326
|
+
J((w) => {
|
|
2327
|
+
const _ = (I, m) => {
|
|
2328
2328
|
const T = [];
|
|
2329
|
-
for (const
|
|
2330
|
-
ae(
|
|
2329
|
+
for (const S of I)
|
|
2330
|
+
ae(S.kind) && m[S.id] && (T.push(S.id), Object.values(m[S.id]).forEach((C) => T.push(..._(C, m))));
|
|
2331
2331
|
return T;
|
|
2332
|
-
}, k = { ...
|
|
2333
|
-
for (const
|
|
2334
|
-
for (const
|
|
2335
|
-
const T = k[
|
|
2336
|
-
if (
|
|
2337
|
-
const
|
|
2338
|
-
let L = T.filter((D) => D.id !==
|
|
2339
|
-
return
|
|
2332
|
+
}, k = { ...w };
|
|
2333
|
+
for (const I of Object.keys(k))
|
|
2334
|
+
for (const m of Object.keys(k[I])) {
|
|
2335
|
+
const T = k[I][m], S = T.findIndex((D) => D.id === p);
|
|
2336
|
+
if (S === -1 || T[S].kind === "end") continue;
|
|
2337
|
+
const C = T[S];
|
|
2338
|
+
let L = T.filter((D) => D.id !== p);
|
|
2339
|
+
return C.kind === "filter" && ((C.id in k ? _([C], k) : []).forEach((P) => delete k[P]), delete k[C.id], L.some((P) => P.kind === "end") || (L = [...L, { id: `end-${I}-${m}`, kind: "end", reactFlowType: "endNode" }])), k[I] = { ...k[I], [m]: L }, k;
|
|
2340
2340
|
}
|
|
2341
2341
|
return k;
|
|
2342
2342
|
});
|
|
2343
2343
|
}
|
|
2344
2344
|
}, [s, A]), Le = $(() => {
|
|
2345
2345
|
s || V("triggerSelect");
|
|
2346
|
-
}, [s]), dt = $((
|
|
2347
|
-
s || lt || (xe(
|
|
2348
|
-
}, [s, lt]), ct = $((
|
|
2349
|
-
if (ot(
|
|
2350
|
-
const k = (
|
|
2351
|
-
...
|
|
2346
|
+
}, [s]), dt = $((p, w) => {
|
|
2347
|
+
s || lt || (xe(p), nt(w.filterId && w.branch ? { filterId: w.filterId, branch: w.branch } : null), V("nodePicker"));
|
|
2348
|
+
}, [s, lt]), ct = $((p, w) => {
|
|
2349
|
+
if (ot(p), V(null), p.skeletonState) {
|
|
2350
|
+
const k = Array.isArray(w) && w.length > 0, I = (p.skeletonState.slots ?? []).map((m) => m.kind !== "triggerFixed" ? m : {
|
|
2351
|
+
...m,
|
|
2352
2352
|
nodeData: {
|
|
2353
|
-
|
|
2354
|
-
|
|
2353
|
+
label: p.label,
|
|
2354
|
+
...m.nodeData ?? {},
|
|
2355
|
+
...k && { sources: w }
|
|
2355
2356
|
}
|
|
2356
|
-
}
|
|
2357
|
-
J(
|
|
2357
|
+
});
|
|
2358
|
+
J(p.skeletonState.branches ?? {}), ie(I);
|
|
2358
2359
|
return;
|
|
2359
2360
|
}
|
|
2360
2361
|
J({});
|
|
2361
|
-
const _ = Array.isArray(
|
|
2362
|
+
const _ = Array.isArray(w) && w.length > 0;
|
|
2362
2363
|
ie([
|
|
2363
2364
|
{ id: "start", kind: "start", reactFlowType: "startNode" },
|
|
2364
2365
|
{
|
|
2365
|
-
id: `trigger-${
|
|
2366
|
+
id: `trigger-${p.triggerKey}`,
|
|
2366
2367
|
kind: "triggerFixed",
|
|
2367
2368
|
reactFlowType: "triggerNode",
|
|
2368
2369
|
nodeData: {
|
|
2369
|
-
label:
|
|
2370
|
-
source:
|
|
2371
|
-
eventType:
|
|
2372
|
-
type:
|
|
2373
|
-
..._ && { sources:
|
|
2370
|
+
label: p.label,
|
|
2371
|
+
source: p.source,
|
|
2372
|
+
eventType: p.triggerKey,
|
|
2373
|
+
type: p.triggerCategory === "scheduler" ? "scheduler" : "event",
|
|
2374
|
+
..._ && { sources: w }
|
|
2374
2375
|
},
|
|
2375
2376
|
deletable: !1
|
|
2376
2377
|
},
|
|
@@ -2378,74 +2379,74 @@ const Bt = ({
|
|
|
2378
2379
|
]);
|
|
2379
2380
|
}, []), ut = $(() => {
|
|
2380
2381
|
var _;
|
|
2381
|
-
const
|
|
2382
|
+
const p = {
|
|
2382
2383
|
insertAfterSlot: null,
|
|
2383
2384
|
upstreamSlots: [],
|
|
2384
2385
|
downstreamSlots: [],
|
|
2385
2386
|
branch: se,
|
|
2386
2387
|
template: q
|
|
2387
2388
|
};
|
|
2388
|
-
if (!H) return
|
|
2389
|
+
if (!H) return p;
|
|
2389
2390
|
if (se) {
|
|
2390
|
-
const { filterId: k, branch:
|
|
2391
|
-
return
|
|
2391
|
+
const { filterId: k, branch: I } = se, m = A.findIndex((D) => D.id === k), T = m >= 0 ? A.slice(0, m + 1) : [], S = ((_ = U[k]) == null ? void 0 : _[I]) ?? [], C = S.findIndex((D) => D.id === H), L = C >= 0 ? S.slice(0, C + 1) : [];
|
|
2392
|
+
return p.upstreamSlots = [...T, ...L], p.downstreamSlots = C >= 0 ? S.slice(C + 1) : S, p.insertAfterSlot = L[L.length - 1] ?? null, p;
|
|
2392
2393
|
}
|
|
2393
|
-
const
|
|
2394
|
-
return
|
|
2395
|
-
}, [A, U, H, se, q]), ft = (
|
|
2396
|
-
const
|
|
2397
|
-
return
|
|
2398
|
-
(
|
|
2394
|
+
const w = A.findIndex((k) => k.id === H);
|
|
2395
|
+
return p.upstreamSlots = w >= 0 ? A.slice(0, w + 1) : [], p.downstreamSlots = w >= 0 ? A.slice(w + 1) : [], p.insertAfterSlot = p.upstreamSlots[p.upstreamSlots.length - 1] ?? null, p;
|
|
2396
|
+
}, [A, U, H, se, q]), ft = (p, w) => p.descriptorType === w || p.id === w || p.kind === w, ht = $(() => {
|
|
2397
|
+
const p = e.list(), w = q != null && q.availableTasks ? p.filter((k) => q.availableTasks.includes(k.type)) : p, _ = ut();
|
|
2398
|
+
return w.filter((k) => k.maxPerWorkflow !== void 0 && A.filter((m) => m.descriptorType === k.type).length + Object.values(U).flatMap((m) => Object.values(m).flat()).filter((m) => m.descriptorType === k.type).length >= k.maxPerWorkflow ? !1 : k.canInsert ? k.canInsert(_) : !(k.insertAfter && k.insertAfter.length > 0 && !_.upstreamSlots.some(
|
|
2399
|
+
(m) => k.insertAfter.some((T) => ft(m, T))
|
|
2399
2400
|
) || k.insertBefore && k.insertBefore.length > 0 && !_.downstreamSlots.some(
|
|
2400
|
-
(
|
|
2401
|
+
(m) => k.insertBefore.some((T) => ft(m, T))
|
|
2401
2402
|
)));
|
|
2402
|
-
}, [e, q, A, U, ut]), gt = $((
|
|
2403
|
+
}, [e, q, A, U, ut]), gt = $((p) => {
|
|
2403
2404
|
if (!H) return;
|
|
2404
|
-
const
|
|
2405
|
-
id:
|
|
2406
|
-
kind: _ ?
|
|
2407
|
-
reactFlowType:
|
|
2408
|
-
descriptorType:
|
|
2405
|
+
const w = `${p.type}-${Date.now()}`, _ = p.reactFlowType === "filterNode" || p.reactFlowType === "approvalNode" || p.reactFlowType === "conditionBranchNode", k = p.branchLabels ?? { pass: "Pass", fail: "Fail" }, I = {
|
|
2406
|
+
id: w,
|
|
2407
|
+
kind: _ ? p.reactFlowType === "approvalNode" ? "approval" : "filter" : "userTask",
|
|
2408
|
+
reactFlowType: p.reactFlowType,
|
|
2409
|
+
descriptorType: p.type,
|
|
2409
2410
|
formData: {},
|
|
2410
|
-
nodeData: { title:
|
|
2411
|
+
nodeData: { title: p.label },
|
|
2411
2412
|
deletable: !0,
|
|
2412
2413
|
branchLabels: k
|
|
2413
2414
|
};
|
|
2414
2415
|
if (se) {
|
|
2415
|
-
const { filterId:
|
|
2416
|
-
J((
|
|
2417
|
-
const
|
|
2416
|
+
const { filterId: m, branch: T } = se;
|
|
2417
|
+
J((S) => {
|
|
2418
|
+
const C = [...S[m][T]];
|
|
2418
2419
|
if (_) {
|
|
2419
|
-
const ne =
|
|
2420
|
-
return ne.splice(Cn, 0,
|
|
2421
|
-
...
|
|
2422
|
-
[
|
|
2423
|
-
[
|
|
2424
|
-
Object.keys(k).map((fe) => [fe, [{ id: `end-${
|
|
2420
|
+
const ne = C.filter((fe) => fe.kind !== "end"), wt = ne.findIndex((fe) => fe.id === H), Cn = wt === -1 ? ne.length : wt + 1;
|
|
2421
|
+
return ne.splice(Cn, 0, I), {
|
|
2422
|
+
...S,
|
|
2423
|
+
[m]: { ...S[m], [T]: ne },
|
|
2424
|
+
[w]: Object.fromEntries(
|
|
2425
|
+
Object.keys(k).map((fe) => [fe, [{ id: `end-${w}-${fe}`, kind: "end", reactFlowType: "endNode" }]])
|
|
2425
2426
|
)
|
|
2426
2427
|
};
|
|
2427
2428
|
}
|
|
2428
|
-
const L =
|
|
2429
|
-
return
|
|
2429
|
+
const L = C.findIndex((ne) => ne.id === H), D = C.findIndex((ne) => ne.kind === "end"), P = L === -1 ? D === -1 ? C.length : D : L + 1;
|
|
2430
|
+
return C.splice(P, 0, I), { ...S, [m]: { ...S[m], [T]: C } };
|
|
2430
2431
|
});
|
|
2431
2432
|
} else
|
|
2432
|
-
_ ? (ie((
|
|
2433
|
-
const T =
|
|
2434
|
-
return [...
|
|
2435
|
-
}), J((
|
|
2436
|
-
...
|
|
2437
|
-
[
|
|
2438
|
-
Object.keys(k).map((T) => [T, [{ id: `end-${
|
|
2433
|
+
_ ? (ie((m) => {
|
|
2434
|
+
const T = m.findIndex((C) => C.id === H);
|
|
2435
|
+
return [...m.filter((C) => C.kind !== "end").slice(0, T + 1), I];
|
|
2436
|
+
}), J((m) => ({
|
|
2437
|
+
...m,
|
|
2438
|
+
[w]: Object.fromEntries(
|
|
2439
|
+
Object.keys(k).map((T) => [T, [{ id: `end-${w}-${T}`, kind: "end", reactFlowType: "endNode" }]])
|
|
2439
2440
|
)
|
|
2440
|
-
}))) : ie((
|
|
2441
|
-
const T =
|
|
2442
|
-
return T === -1 ?
|
|
2441
|
+
}))) : ie((m) => {
|
|
2442
|
+
const T = m.findIndex((S) => S.id === H);
|
|
2443
|
+
return T === -1 ? m : [...m.slice(0, T + 1), I, ...m.slice(T + 1)];
|
|
2443
2444
|
});
|
|
2444
|
-
xe(null), nt(null), tt(
|
|
2445
|
-
}, [H, se]), pt = $((
|
|
2446
|
-
const _ = (
|
|
2447
|
-
const T =
|
|
2448
|
-
switch (
|
|
2445
|
+
xe(null), nt(null), tt(w), V("nodeConfig");
|
|
2446
|
+
}, [H, se]), pt = $((p, w) => {
|
|
2447
|
+
const _ = (m) => {
|
|
2448
|
+
const T = m.label || m.key;
|
|
2449
|
+
switch (m.kind) {
|
|
2449
2450
|
case "if":
|
|
2450
2451
|
return `IF · ${T}`;
|
|
2451
2452
|
case "elseif":
|
|
@@ -2455,58 +2456,58 @@ const Bt = ({
|
|
|
2455
2456
|
default:
|
|
2456
2457
|
return T;
|
|
2457
2458
|
}
|
|
2458
|
-
}, k = (
|
|
2459
|
-
const T = le(
|
|
2460
|
-
if ((T == null ? void 0 : T.descriptorType) !== "conditionBranch") return
|
|
2461
|
-
const
|
|
2462
|
-
if (
|
|
2463
|
-
const L =
|
|
2464
|
-
return
|
|
2465
|
-
D[P] = L[P] ?? [{ id: `end-${
|
|
2466
|
-
}), { ...
|
|
2467
|
-
},
|
|
2468
|
-
if (
|
|
2469
|
-
const
|
|
2470
|
-
return
|
|
2471
|
-
L.key && (
|
|
2472
|
-
}), { ...
|
|
2459
|
+
}, k = (m) => {
|
|
2460
|
+
const T = le(p);
|
|
2461
|
+
if ((T == null ? void 0 : T.descriptorType) !== "conditionBranch") return m;
|
|
2462
|
+
const C = (w.branchConfigs ?? []).map((P) => P.key).filter(Boolean);
|
|
2463
|
+
if (C.length === 0) return m;
|
|
2464
|
+
const L = m[p] ?? {}, D = {};
|
|
2465
|
+
return C.forEach((P) => {
|
|
2466
|
+
D[P] = L[P] ?? [{ id: `end-${p}-${P}`, kind: "end", reactFlowType: "endNode" }];
|
|
2467
|
+
}), { ...m, [p]: D };
|
|
2468
|
+
}, I = (m, T) => {
|
|
2469
|
+
if (m.descriptorType !== "conditionBranch") return { ...m, formData: T };
|
|
2470
|
+
const S = T.branchConfigs ?? [], C = {};
|
|
2471
|
+
return S.forEach((L) => {
|
|
2472
|
+
L.key && (C[L.key] = _(L));
|
|
2473
|
+
}), { ...m, formData: T, branchLabels: C };
|
|
2473
2474
|
};
|
|
2474
|
-
if (A.some((
|
|
2475
|
-
J((
|
|
2476
|
-
const T = k(
|
|
2477
|
-
return ie((
|
|
2478
|
-
const
|
|
2479
|
-
return i == null || i({ slots:
|
|
2475
|
+
if (A.some((m) => m.id === p)) {
|
|
2476
|
+
J((m) => {
|
|
2477
|
+
const T = k(m);
|
|
2478
|
+
return ie((S) => {
|
|
2479
|
+
const C = S.map((L) => L.id === p ? I(L, w) : L);
|
|
2480
|
+
return i == null || i({ slots: C, branches: T }), C;
|
|
2480
2481
|
}), T;
|
|
2481
2482
|
});
|
|
2482
2483
|
return;
|
|
2483
2484
|
}
|
|
2484
|
-
J((
|
|
2485
|
-
const
|
|
2486
|
-
for (const
|
|
2487
|
-
const L = (D) => D.map((P) => P.id ===
|
|
2488
|
-
for (const D of Object.keys(C
|
|
2489
|
-
if (C
|
|
2490
|
-
return C
|
|
2485
|
+
J((m) => {
|
|
2486
|
+
const S = { ...k(m) };
|
|
2487
|
+
for (const C of Object.keys(S)) {
|
|
2488
|
+
const L = (D) => D.map((P) => P.id === p ? I(P, w) : P);
|
|
2489
|
+
for (const D of Object.keys(S[C]))
|
|
2490
|
+
if (S[C][D].some((P) => P.id === p))
|
|
2491
|
+
return S[C] = { ...S[C], [D]: L(S[C][D]) }, i == null || i({ slots: A, branches: S }), S;
|
|
2491
2492
|
}
|
|
2492
|
-
return
|
|
2493
|
+
return S;
|
|
2493
2494
|
});
|
|
2494
2495
|
}, [A, U, le, i]), Z = Y(() => le(Fe ?? ""), [le, Fe]), bt = Y(() => Z != null && Z.descriptorType ? e.forType(Z.descriptorType) ?? null : null, [Z, e]), { nodes: yt, edges: Nn } = Y(
|
|
2495
2496
|
() => qi(A, U, s ? null : dt, it, l, y, ce),
|
|
2496
2497
|
[A, U, s, dt, it, l, y, ce]
|
|
2497
2498
|
), mt = Y(() => {
|
|
2498
|
-
const
|
|
2499
|
-
return yt.map((
|
|
2499
|
+
const p = x ? new Map(x.steps.map((w) => [w.nodeId, w])) : null;
|
|
2500
|
+
return yt.map((w) => {
|
|
2500
2501
|
let _ = {};
|
|
2501
|
-
if (
|
|
2502
|
-
const k =
|
|
2502
|
+
if (p) {
|
|
2503
|
+
const k = p.get(w.id);
|
|
2503
2504
|
k && (_ = { _executionStatus: k.status, _executionError: k.error });
|
|
2504
2505
|
}
|
|
2505
|
-
return
|
|
2506
|
-
var
|
|
2507
|
-
const
|
|
2508
|
-
rt({ workflowId: k, workflowLabel: ((
|
|
2509
|
-
}), Object.keys(_).length > 0 ? { ...
|
|
2506
|
+
return w.type === "subWorkflowNode" && N && (_.onPreview = (k) => {
|
|
2507
|
+
var m;
|
|
2508
|
+
const I = le(w.id);
|
|
2509
|
+
rt({ workflowId: k, workflowLabel: ((m = I == null ? void 0 : I.formData) == null ? void 0 : m.workflowLabel) ?? void 0 });
|
|
2510
|
+
}), Object.keys(_).length > 0 ? { ...w, data: { ...w.data, ..._ } } : w;
|
|
2510
2511
|
});
|
|
2511
2512
|
}, [yt, x, N, le]), Sn = Y(() => ({ onEditNode: ze, onDeleteNode: at, onAddStep: () => {
|
|
2512
2513
|
}, onClickAddTrigger: Le, messages: oe, nodeRegistry: e, nodeBody: pe }), [ze, at, Le, oe, e, pe]);
|
|
@@ -2548,9 +2549,9 @@ const Bt = ({
|
|
|
2548
2549
|
snapToGrid: ke,
|
|
2549
2550
|
snapGrid: te,
|
|
2550
2551
|
proOptions: { hideAttribution: !0 },
|
|
2551
|
-
onNodeClick: (
|
|
2552
|
-
const _ = le(
|
|
2553
|
-
_ && (
|
|
2552
|
+
onNodeClick: (p, w) => {
|
|
2553
|
+
const _ = le(w.id);
|
|
2554
|
+
_ && (b != null && b(_) || (_.kind === "addTrigger" || _.kind === "triggerFixed" ? Le() : (_.kind === "userTask" || _.kind === "filter" || _.kind === "approval") && ze(w.id)));
|
|
2554
2555
|
},
|
|
2555
2556
|
children: [
|
|
2556
2557
|
l.background !== "none" && /* @__PURE__ */ f(
|
|
@@ -2664,7 +2665,7 @@ const gs = ({
|
|
|
2664
2665
|
a = a.filter(
|
|
2665
2666
|
(u) => {
|
|
2666
2667
|
var h, g;
|
|
2667
|
-
return u.label.toLowerCase().includes(c) || ((h = u.description) == null ? void 0 : h.toLowerCase().includes(c)) || ((g = u.tags) == null ? void 0 : g.some((
|
|
2668
|
+
return u.label.toLowerCase().includes(c) || ((h = u.description) == null ? void 0 : h.toLowerCase().includes(c)) || ((g = u.tags) == null ? void 0 : g.some((b) => b.toLowerCase().includes(c)));
|
|
2668
2669
|
}
|
|
2669
2670
|
);
|
|
2670
2671
|
}
|