lowcoder-comps 0.0.17 → 0.0.19
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/README.md +27 -0
- package/index.html +26 -0
- package/index.tsx +19 -0
- package/jest.config.js +6 -0
- package/package.json +4 -5
- package/src/__test__/allComp.test.tsx +61 -0
- package/src/app-env.d.ts +3 -0
- package/src/comps/calendarComp/calendarComp.tsx +443 -0
- package/src/comps/calendarComp/calendarConstants.tsx +898 -0
- package/src/comps/chartComp/chartComp.tsx +356 -0
- package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
- package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
- package/src/comps/chartComp/chartConfigs/chartUrls.tsx +9 -0
- package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
- package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
- package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
- package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
- package/src/comps/chartComp/chartConstants.tsx +288 -0
- package/src/comps/chartComp/chartPropertyView.tsx +218 -0
- package/src/comps/chartComp/chartUtils.ts +291 -0
- package/src/comps/chartComp/reactEcharts/core.tsx +194 -0
- package/src/comps/chartComp/reactEcharts/index.ts +21 -0
- package/src/comps/chartComp/reactEcharts/types.ts +76 -0
- package/src/comps/chartComp/seriesComp.tsx +119 -0
- package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
- package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
- package/src/comps/imageEditorComp/index.tsx +184 -0
- package/src/comps/mermaidComp/index.tsx +44 -0
- package/src/comps/mermaidComp/mermaid.tsx +29 -0
- package/src/global.ts +1 -0
- package/src/i18n/comps/index.tsx +29 -0
- package/src/i18n/comps/locales/en.ts +150 -0
- package/src/i18n/comps/locales/enObj.tsx +198 -0
- package/src/i18n/comps/locales/index.ts +7 -0
- package/src/i18n/comps/locales/types.tsx +10 -0
- package/src/i18n/comps/locales/zh.ts +145 -0
- package/src/i18n/comps/locales/zhObj.tsx +4 -0
- package/src/index.ts +11 -0
- package/tsconfig.json +22 -0
- package/vite.config.js +10 -0
- package/001f8b13.js +0 -326
- package/085bf0c2.js +0 -46688
- package/256b619e.js +0 -92
- package/29cba276.js +0 -91
- package/2e18581a.js +0 -451
- package/2ff2c7a6.js +0 -6
- package/340c33ea.js +0 -1602
- package/3ad55ad7.js +0 -607
- package/47b0b0ff.js +0 -70
- package/4a5b6fbe.js +0 -798
- package/4abe140e.js +0 -943
- package/4cf5b178.js +0 -34
- package/5cab7b96.js +0 -18619
- package/626b9013.js +0 -7
- package/6798500f.js +0 -793
- package/68b021d0.js +0 -2456
- package/6ab1612a.js +0 -24
- package/6e903063.js +0 -940
- package/72a7048f.js +0 -849
- package/7902f186.js +0 -823
- package/82c1c410.js +0 -86
- package/8517f7c1.js +0 -365
- package/9495ef3b.js +0 -1118
- package/9ea1ddd6.js +0 -447
- package/a01c9944.js +0 -212
- package/a4ce7e8a.js +0 -2827
- package/ad68bdd0.js +0 -236
- package/b499e5a9.js +0 -2103
- package/bdc7b18a.js +0 -1032
- package/be5b66cd.js +0 -832
- package/c4378831.js +0 -117175
- package/ca8f4e3f.js +0 -275
- package/de61c633.js +0 -2679
- package/e04788e2.js +0 -159
- package/f9637058.js +0 -16
- package/f9a47b7c.js +0 -985
- package/ff16c2ec.js +0 -1246
- package/index.js +0 -5
package/82c1c410.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { w as ln, c as H } from "./256b619e.js";
|
|
2
|
-
import { aB as an, aC as M, aD as D, aE as rn, aF as y, Q as on, aG as S, aH as _, aI as un, aJ as t, aK as sn, aL as tn, aM as fn } from "./c4378831.js";
|
|
3
|
-
function cn(l) {
|
|
4
|
-
return l.innerRadius;
|
|
5
|
-
}
|
|
6
|
-
function yn(l) {
|
|
7
|
-
return l.outerRadius;
|
|
8
|
-
}
|
|
9
|
-
function gn(l) {
|
|
10
|
-
return l.startAngle;
|
|
11
|
-
}
|
|
12
|
-
function mn(l) {
|
|
13
|
-
return l.endAngle;
|
|
14
|
-
}
|
|
15
|
-
function pn(l) {
|
|
16
|
-
return l && l.padAngle;
|
|
17
|
-
}
|
|
18
|
-
function dn(l, h, q, E, v, A, J, a) {
|
|
19
|
-
var B = q - l, i = E - h, n = J - v, m = a - A, r = m * B - n * i;
|
|
20
|
-
if (!(r * r < y))
|
|
21
|
-
return r = (n * (h - A) - m * (l - v)) / r, [l + r * B, h + r * i];
|
|
22
|
-
}
|
|
23
|
-
function W(l, h, q, E, v, A, J) {
|
|
24
|
-
var a = l - q, B = h - E, i = (J ? A : -A) / S(a * a + B * B), n = i * B, m = -i * a, r = l + n, s = h + m, f = q + n, c = E + m, K = (r + f) / 2, o = (s + c) / 2, p = f - r, g = c - s, R = p * p + g * g, T = v - A, P = r * c - f * s, C = (g < 0 ? -1 : 1) * S(fn(0, T * T * R - P * P)), F = (P * g - p * C) / R, G = (-P * p - g * C) / R, w = (P * g + p * C) / R, d = (-P * p + g * C) / R, x = F - K, e = G - o, u = w - K, L = d - o;
|
|
25
|
-
return x * x + e * e > u * u + L * L && (F = w, G = d), {
|
|
26
|
-
cx: F,
|
|
27
|
-
cy: G,
|
|
28
|
-
x01: -n,
|
|
29
|
-
y01: -m,
|
|
30
|
-
x11: F * (v / T - 1),
|
|
31
|
-
y11: G * (v / T - 1)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function vn() {
|
|
35
|
-
var l = cn, h = yn, q = H(0), E = null, v = gn, A = mn, J = pn, a = null, B = ln(i);
|
|
36
|
-
function i() {
|
|
37
|
-
var n, m, r = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - rn, c = A.apply(this, arguments) - rn, K = un(c - f), o = c > f;
|
|
38
|
-
if (a || (a = n = B()), s < r && (m = s, s = r, r = m), !(s > y))
|
|
39
|
-
a.moveTo(0, 0);
|
|
40
|
-
else if (K > on - y)
|
|
41
|
-
a.moveTo(s * M(f), s * D(f)), a.arc(0, 0, s, f, c, !o), r > y && (a.moveTo(r * M(c), r * D(c)), a.arc(0, 0, r, c, f, o));
|
|
42
|
-
else {
|
|
43
|
-
var p = f, g = c, R = f, T = c, P = K, C = K, F = J.apply(this, arguments) / 2, G = F > y && (E ? +E.apply(this, arguments) : S(r * r + s * s)), w = _(un(s - r) / 2, +q.apply(this, arguments)), d = w, x = w, e, u;
|
|
44
|
-
if (G > y) {
|
|
45
|
-
var L = sn(G / r * D(F)), j = sn(G / s * D(F));
|
|
46
|
-
(P -= L * 2) > y ? (L *= o ? 1 : -1, R += L, T -= L) : (P = 0, R = T = (f + c) / 2), (C -= j * 2) > y ? (j *= o ? 1 : -1, p += j, g -= j) : (C = 0, p = g = (f + c) / 2);
|
|
47
|
-
}
|
|
48
|
-
var O = s * M(p), Q = s * D(p), z = r * M(T), N = r * D(T);
|
|
49
|
-
if (w > y) {
|
|
50
|
-
var U = s * M(g), V = s * D(g), X = r * M(R), Y = r * D(R), I;
|
|
51
|
-
if (K < an)
|
|
52
|
-
if (I = dn(O, Q, X, Y, U, V, z, N)) {
|
|
53
|
-
var Z = O - I[0], $ = Q - I[1], k = U - I[0], b = V - I[1], nn = 1 / D(tn((Z * k + $ * b) / (S(Z * Z + $ * $) * S(k * k + b * b))) / 2), en = S(I[0] * I[0] + I[1] * I[1]);
|
|
54
|
-
d = _(w, (r - en) / (nn - 1)), x = _(w, (s - en) / (nn + 1));
|
|
55
|
-
} else
|
|
56
|
-
d = x = 0;
|
|
57
|
-
}
|
|
58
|
-
C > y ? x > y ? (e = W(X, Y, O, Q, s, x, o), u = W(U, V, z, N, s, x, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < w ? a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, x, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(O, Q), a.arc(0, 0, s, p, g, !o)) : a.moveTo(O, Q), !(r > y) || !(P > y) ? a.lineTo(z, N) : d > y ? (e = W(z, N, U, V, r, -d, o), u = W(O, Q, X, Y, r, -d, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), d < w ? a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, d, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, r, T, R, o);
|
|
59
|
-
}
|
|
60
|
-
if (a.closePath(), n)
|
|
61
|
-
return a = null, n + "" || null;
|
|
62
|
-
}
|
|
63
|
-
return i.centroid = function() {
|
|
64
|
-
var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, m = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - an / 2;
|
|
65
|
-
return [M(m) * n, D(m) * n];
|
|
66
|
-
}, i.innerRadius = function(n) {
|
|
67
|
-
return arguments.length ? (l = typeof n == "function" ? n : H(+n), i) : l;
|
|
68
|
-
}, i.outerRadius = function(n) {
|
|
69
|
-
return arguments.length ? (h = typeof n == "function" ? n : H(+n), i) : h;
|
|
70
|
-
}, i.cornerRadius = function(n) {
|
|
71
|
-
return arguments.length ? (q = typeof n == "function" ? n : H(+n), i) : q;
|
|
72
|
-
}, i.padRadius = function(n) {
|
|
73
|
-
return arguments.length ? (E = n == null ? null : typeof n == "function" ? n : H(+n), i) : E;
|
|
74
|
-
}, i.startAngle = function(n) {
|
|
75
|
-
return arguments.length ? (v = typeof n == "function" ? n : H(+n), i) : v;
|
|
76
|
-
}, i.endAngle = function(n) {
|
|
77
|
-
return arguments.length ? (A = typeof n == "function" ? n : H(+n), i) : A;
|
|
78
|
-
}, i.padAngle = function(n) {
|
|
79
|
-
return arguments.length ? (J = typeof n == "function" ? n : H(+n), i) : J;
|
|
80
|
-
}, i.context = function(n) {
|
|
81
|
-
return arguments.length ? (a = n == null ? null : n, i) : a;
|
|
82
|
-
}, i;
|
|
83
|
-
}
|
|
84
|
-
export {
|
|
85
|
-
vn as a
|
|
86
|
-
};
|
package/8517f7c1.js
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
var b = (n, t, e) => new Promise((r, s) => {
|
|
2
|
-
var a = (f) => {
|
|
3
|
-
try {
|
|
4
|
-
l(e.next(f));
|
|
5
|
-
} catch (u) {
|
|
6
|
-
s(u);
|
|
7
|
-
}
|
|
8
|
-
}, h = (f) => {
|
|
9
|
-
try {
|
|
10
|
-
l(e.throw(f));
|
|
11
|
-
} catch (u) {
|
|
12
|
-
s(u);
|
|
13
|
-
}
|
|
14
|
-
}, l = (f) => f.done ? r(f.value) : Promise.resolve(f.value).then(a, h);
|
|
15
|
-
l((e = e.apply(n, t)).next());
|
|
16
|
-
});
|
|
17
|
-
import { b as G, a as v, m as O, G as j, l as A } from "./de61c633.js";
|
|
18
|
-
import { i as M, u as _, s as H, a as V, b as q, p as D, c as U, d as W, e as Y, f as z, g as L, h as C } from "./72a7048f.js";
|
|
19
|
-
import { l as i, q as E, c as S, h as T } from "./c4378831.js";
|
|
20
|
-
import { c as K } from "./a4ce7e8a.js";
|
|
21
|
-
var Q = 4;
|
|
22
|
-
function Z(n) {
|
|
23
|
-
return G(n, Q);
|
|
24
|
-
}
|
|
25
|
-
function y(n) {
|
|
26
|
-
var t = {
|
|
27
|
-
options: {
|
|
28
|
-
directed: n.isDirected(),
|
|
29
|
-
multigraph: n.isMultigraph(),
|
|
30
|
-
compound: n.isCompound()
|
|
31
|
-
},
|
|
32
|
-
nodes: I(n),
|
|
33
|
-
edges: tt(n)
|
|
34
|
-
};
|
|
35
|
-
return v(n.graph()) || (t.value = Z(n.graph())), t;
|
|
36
|
-
}
|
|
37
|
-
function I(n) {
|
|
38
|
-
return O(n.nodes(), function(t) {
|
|
39
|
-
var e = n.node(t), r = n.parent(t), s = { v: t };
|
|
40
|
-
return v(e) || (s.value = e), v(r) || (s.parent = r), s;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function tt(n) {
|
|
44
|
-
return O(n.edges(), function(t) {
|
|
45
|
-
var e = n.edge(t), r = { v: t.v, w: t.w };
|
|
46
|
-
return v(t.name) || (r.name = t.name), v(e) || (r.value = e), r;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
let d = {}, x = {}, J = {};
|
|
50
|
-
const et = () => {
|
|
51
|
-
x = {}, J = {}, d = {};
|
|
52
|
-
}, X = (n, t) => (i.trace("In isDecendant", t, " ", n, " = ", x[t].includes(n)), !!x[t].includes(n)), nt = (n, t) => (i.info("Decendants of ", t, " is ", x[t]), i.info("Edge is ", n), n.v === t || n.w === t ? !1 : x[t] ? x[t].includes(n.v) || X(n.v, t) || X(n.w, t) || x[t].includes(n.w) : (i.debug("Tilt, ", t, ",not in decendants"), !1)), p = (n, t, e, r) => {
|
|
53
|
-
i.warn(
|
|
54
|
-
"Copying children of ",
|
|
55
|
-
n,
|
|
56
|
-
"root",
|
|
57
|
-
r,
|
|
58
|
-
"data",
|
|
59
|
-
t.node(n),
|
|
60
|
-
r
|
|
61
|
-
);
|
|
62
|
-
const s = t.children(n) || [];
|
|
63
|
-
n !== r && s.push(n), i.warn("Copying (nodes) clusterId", n, "nodes", s), s.forEach((a) => {
|
|
64
|
-
if (t.children(a).length > 0)
|
|
65
|
-
p(a, t, e, r);
|
|
66
|
-
else {
|
|
67
|
-
const h = t.node(a);
|
|
68
|
-
i.info("cp ", a, " to ", r, " with parent ", n), e.setNode(a, h), r !== t.parent(a) && (i.warn("Setting parent", a, t.parent(a)), e.setParent(a, t.parent(a))), n !== r && a !== n ? (i.debug("Setting parent", a, n), e.setParent(a, n)) : (i.info("In copy ", n, "root", r, "data", t.node(n), r), i.debug(
|
|
69
|
-
"Not Setting parent for node=",
|
|
70
|
-
a,
|
|
71
|
-
"cluster!==rootId",
|
|
72
|
-
n !== r,
|
|
73
|
-
"node!==clusterId",
|
|
74
|
-
a !== n
|
|
75
|
-
));
|
|
76
|
-
const l = t.edges(a);
|
|
77
|
-
i.debug("Copying Edges", l), l.forEach((f) => {
|
|
78
|
-
i.info("Edge", f);
|
|
79
|
-
const u = t.edge(f.v, f.w, f.name);
|
|
80
|
-
i.info("Edge data", u, r);
|
|
81
|
-
try {
|
|
82
|
-
nt(f, r) ? (i.info("Copying as ", f.v, f.w, u, f.name), e.setEdge(f.v, f.w, u, f.name), i.info("newGraph edges ", e.edges(), e.edge(e.edges()[0]))) : i.info(
|
|
83
|
-
"Skipping copy of edge ",
|
|
84
|
-
f.v,
|
|
85
|
-
"-->",
|
|
86
|
-
f.w,
|
|
87
|
-
" rootId: ",
|
|
88
|
-
r,
|
|
89
|
-
" clusterId:",
|
|
90
|
-
n
|
|
91
|
-
);
|
|
92
|
-
} catch (g) {
|
|
93
|
-
i.error(g);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
i.debug("Removing node", a), t.removeNode(a);
|
|
98
|
-
});
|
|
99
|
-
}, R = (n, t) => {
|
|
100
|
-
const e = t.children(n);
|
|
101
|
-
let r = [...e];
|
|
102
|
-
for (const s of e)
|
|
103
|
-
J[s] = n, r = [...r, ...R(s, t)];
|
|
104
|
-
return r;
|
|
105
|
-
}, m = (n, t) => {
|
|
106
|
-
i.trace("Searching", n);
|
|
107
|
-
const e = t.children(n);
|
|
108
|
-
if (i.trace("Searching children of id ", n, e), e.length < 1)
|
|
109
|
-
return i.trace("This is a valid node", n), n;
|
|
110
|
-
for (const r of e) {
|
|
111
|
-
const s = m(r, t);
|
|
112
|
-
if (s)
|
|
113
|
-
return i.trace("Found replacement for", n, " => ", s), s;
|
|
114
|
-
}
|
|
115
|
-
}, N = (n) => !d[n] || !d[n].externalConnections ? n : d[n] ? d[n].id : n, it = (n, t) => {
|
|
116
|
-
if (!n || t > 10) {
|
|
117
|
-
i.debug("Opting out, no graph ");
|
|
118
|
-
return;
|
|
119
|
-
} else
|
|
120
|
-
i.debug("Opting in, graph ");
|
|
121
|
-
n.nodes().forEach(function(e) {
|
|
122
|
-
n.children(e).length > 0 && (i.warn(
|
|
123
|
-
"Cluster identified",
|
|
124
|
-
e,
|
|
125
|
-
" Replacement id in edges: ",
|
|
126
|
-
m(e, n)
|
|
127
|
-
), x[e] = R(e, n), d[e] = { id: m(e, n), clusterData: n.node(e) });
|
|
128
|
-
}), n.nodes().forEach(function(e) {
|
|
129
|
-
const r = n.children(e), s = n.edges();
|
|
130
|
-
r.length > 0 ? (i.debug("Cluster identified", e, x), s.forEach((a) => {
|
|
131
|
-
if (a.v !== e && a.w !== e) {
|
|
132
|
-
const h = X(a.v, e), l = X(a.w, e);
|
|
133
|
-
h ^ l && (i.warn("Edge: ", a, " leaves cluster ", e), i.warn("Decendants of XXX ", e, ": ", x[e]), d[e].externalConnections = !0);
|
|
134
|
-
}
|
|
135
|
-
})) : i.debug("Not a cluster ", e, x);
|
|
136
|
-
}), n.edges().forEach(function(e) {
|
|
137
|
-
const r = n.edge(e);
|
|
138
|
-
i.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e)), i.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(n.edge(e)));
|
|
139
|
-
let s = e.v, a = e.w;
|
|
140
|
-
if (i.warn(
|
|
141
|
-
"Fix XXX",
|
|
142
|
-
d,
|
|
143
|
-
"ids:",
|
|
144
|
-
e.v,
|
|
145
|
-
e.w,
|
|
146
|
-
"Translating: ",
|
|
147
|
-
d[e.v],
|
|
148
|
-
" --- ",
|
|
149
|
-
d[e.w]
|
|
150
|
-
), d[e.v] && d[e.w] && d[e.v] === d[e.w]) {
|
|
151
|
-
i.warn("Fixing and trixing link to self - removing XXX", e.v, e.w, e.name), i.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name), s = N(e.v), a = N(e.w), n.removeEdge(e.v, e.w, e.name);
|
|
152
|
-
const h = e.w + "---" + e.v;
|
|
153
|
-
n.setNode(h, {
|
|
154
|
-
domId: h,
|
|
155
|
-
id: h,
|
|
156
|
-
labelStyle: "",
|
|
157
|
-
labelText: r.label,
|
|
158
|
-
padding: 0,
|
|
159
|
-
shape: "labelRect",
|
|
160
|
-
style: ""
|
|
161
|
-
});
|
|
162
|
-
const l = JSON.parse(JSON.stringify(r)), f = JSON.parse(JSON.stringify(r));
|
|
163
|
-
l.label = "", l.arrowTypeEnd = "none", f.label = "", l.fromCluster = e.v, f.toCluster = e.v, n.setEdge(s, h, l, e.name + "-cyclic-special"), n.setEdge(h, a, f, e.name + "-cyclic-special");
|
|
164
|
-
} else
|
|
165
|
-
(d[e.v] || d[e.w]) && (i.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name), s = N(e.v), a = N(e.w), n.removeEdge(e.v, e.w, e.name), s !== e.v && (r.fromCluster = e.v), a !== e.w && (r.toCluster = e.w), i.warn("Fix Replacing with XXX", s, a, e.name), n.setEdge(s, a, r, e.name));
|
|
166
|
-
}), i.warn("Adjusted Graph", y(n)), P(n, 0), i.trace(d);
|
|
167
|
-
}, P = (n, t) => {
|
|
168
|
-
if (i.warn("extractor - ", t, y(n), n.children("D")), t > 10) {
|
|
169
|
-
i.error("Bailing out");
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
let e = n.nodes(), r = !1;
|
|
173
|
-
for (const s of e) {
|
|
174
|
-
const a = n.children(s);
|
|
175
|
-
r = r || a.length > 0;
|
|
176
|
-
}
|
|
177
|
-
if (!r) {
|
|
178
|
-
i.debug("Done, no node has children", n.nodes());
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
i.debug("Nodes = ", e, t);
|
|
182
|
-
for (const s of e)
|
|
183
|
-
if (i.debug(
|
|
184
|
-
"Extracting node",
|
|
185
|
-
s,
|
|
186
|
-
d,
|
|
187
|
-
d[s] && !d[s].externalConnections,
|
|
188
|
-
!n.parent(s),
|
|
189
|
-
n.node(s),
|
|
190
|
-
n.children("D"),
|
|
191
|
-
" Depth ",
|
|
192
|
-
t
|
|
193
|
-
), !d[s])
|
|
194
|
-
i.debug("Not a cluster", s, t);
|
|
195
|
-
else if (!d[s].externalConnections && // !graph.parent(node) &&
|
|
196
|
-
n.children(s) && n.children(s).length > 0) {
|
|
197
|
-
i.warn(
|
|
198
|
-
"Cluster without external connections, without a parent and with children",
|
|
199
|
-
s,
|
|
200
|
-
t
|
|
201
|
-
);
|
|
202
|
-
let h = n.graph().rankdir === "TB" ? "LR" : "TB";
|
|
203
|
-
d[s] && d[s].clusterData && d[s].clusterData.dir && (h = d[s].clusterData.dir, i.warn("Fixing dir", d[s].clusterData.dir, h));
|
|
204
|
-
const l = new j({
|
|
205
|
-
multigraph: !0,
|
|
206
|
-
compound: !0
|
|
207
|
-
}).setGraph({
|
|
208
|
-
rankdir: h,
|
|
209
|
-
// Todo: set proper spacing
|
|
210
|
-
nodesep: 50,
|
|
211
|
-
ranksep: 50,
|
|
212
|
-
marginx: 8,
|
|
213
|
-
marginy: 8
|
|
214
|
-
}).setDefaultEdgeLabel(function() {
|
|
215
|
-
return {};
|
|
216
|
-
});
|
|
217
|
-
i.warn("Old graph before copy", y(n)), p(s, n, l, s), n.setNode(s, {
|
|
218
|
-
clusterNode: !0,
|
|
219
|
-
id: s,
|
|
220
|
-
clusterData: d[s].clusterData,
|
|
221
|
-
labelText: d[s].labelText,
|
|
222
|
-
graph: l
|
|
223
|
-
}), i.warn("New graph after copy node: (", s, ")", y(l)), i.debug("Old graph after copy", y(n));
|
|
224
|
-
} else
|
|
225
|
-
i.warn(
|
|
226
|
-
"Cluster ** ",
|
|
227
|
-
s,
|
|
228
|
-
" **not meeting the criteria !externalConnections:",
|
|
229
|
-
!d[s].externalConnections,
|
|
230
|
-
" no parent: ",
|
|
231
|
-
!n.parent(s),
|
|
232
|
-
" children ",
|
|
233
|
-
n.children(s) && n.children(s).length > 0,
|
|
234
|
-
n.children("D"),
|
|
235
|
-
t
|
|
236
|
-
), i.debug(d);
|
|
237
|
-
e = n.nodes(), i.warn("New list of nodes", e);
|
|
238
|
-
for (const s of e) {
|
|
239
|
-
const a = n.node(s);
|
|
240
|
-
i.warn(" Now next level", s, a), a.clusterNode && P(a.graph, t + 1);
|
|
241
|
-
}
|
|
242
|
-
}, F = (n, t) => {
|
|
243
|
-
if (t.length === 0)
|
|
244
|
-
return [];
|
|
245
|
-
let e = Object.assign(t);
|
|
246
|
-
return t.forEach((r) => {
|
|
247
|
-
const s = n.children(r), a = F(n, s);
|
|
248
|
-
e = [...e, ...a];
|
|
249
|
-
}), e;
|
|
250
|
-
}, st = (n) => F(n, n.children()), rt = (n, t) => {
|
|
251
|
-
i.info("Creating subgraph rect for ", t.id, t);
|
|
252
|
-
const e = n.insert("g").attr("class", "cluster" + (t.class ? " " + t.class : "")).attr("id", t.id), r = e.insert("rect", ":first-child"), s = E(S().flowchart.htmlLabels), a = e.insert("g").attr("class", "cluster-label"), h = t.labelType === "markdown" ? K(a, t.labelText, { style: t.labelStyle, useHtmlLabels: s }) : a.node().appendChild(L(t.labelText, t.labelStyle, void 0, !0));
|
|
253
|
-
let l = h.getBBox();
|
|
254
|
-
if (E(S().flowchart.htmlLabels)) {
|
|
255
|
-
const o = h.children[0], w = T(h);
|
|
256
|
-
l = o.getBoundingClientRect(), w.attr("width", l.width), w.attr("height", l.height);
|
|
257
|
-
}
|
|
258
|
-
const f = 0 * t.padding, u = f / 2, g = t.width <= l.width + f ? l.width + f : t.width;
|
|
259
|
-
t.width <= l.width + f ? t.diff = (l.width - t.width) / 2 - t.padding / 2 : t.diff = -t.padding / 2, i.trace("Data ", t, JSON.stringify(t)), r.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - g / 2).attr("y", t.y - t.height / 2 - u).attr("width", g).attr("height", t.height + f), s ? a.attr(
|
|
260
|
-
"transform",
|
|
261
|
-
// This puts the labal on top of the box instead of inside it
|
|
262
|
-
"translate(" + (t.x - l.width / 2) + ", " + (t.y - t.height / 2) + ")"
|
|
263
|
-
) : a.attr(
|
|
264
|
-
"transform",
|
|
265
|
-
// This puts the labal on top of the box instead of inside it
|
|
266
|
-
"translate(" + t.x + ", " + (t.y - t.height / 2) + ")"
|
|
267
|
-
);
|
|
268
|
-
const c = r.node().getBBox();
|
|
269
|
-
return t.width = c.width, t.height = c.height, t.intersect = function(o) {
|
|
270
|
-
return C(t, o);
|
|
271
|
-
}, e;
|
|
272
|
-
}, at = (n, t) => {
|
|
273
|
-
const e = n.insert("g").attr("class", "note-cluster").attr("id", t.id), r = e.insert("rect", ":first-child"), s = 0 * t.padding, a = s / 2;
|
|
274
|
-
r.attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2 - a).attr("width", t.width + s).attr("height", t.height + s).attr("fill", "none");
|
|
275
|
-
const h = r.node().getBBox();
|
|
276
|
-
return t.width = h.width, t.height = h.height, t.intersect = function(l) {
|
|
277
|
-
return C(t, l);
|
|
278
|
-
}, e;
|
|
279
|
-
}, ct = (n, t) => {
|
|
280
|
-
const e = n.insert("g").attr("class", t.classes).attr("id", t.id), r = e.insert("rect", ":first-child"), s = e.insert("g").attr("class", "cluster-label"), a = e.append("rect"), h = s.node().appendChild(L(t.labelText, t.labelStyle, void 0, !0));
|
|
281
|
-
let l = h.getBBox();
|
|
282
|
-
if (E(S().flowchart.htmlLabels)) {
|
|
283
|
-
const o = h.children[0], w = T(h);
|
|
284
|
-
l = o.getBoundingClientRect(), w.attr("width", l.width), w.attr("height", l.height);
|
|
285
|
-
}
|
|
286
|
-
l = h.getBBox();
|
|
287
|
-
const f = 0 * t.padding, u = f / 2, g = t.width <= l.width + t.padding ? l.width + t.padding : t.width;
|
|
288
|
-
t.width <= l.width + t.padding ? t.diff = (l.width + t.padding * 0 - t.width) / 2 : t.diff = -t.padding / 2, r.attr("class", "outer").attr("x", t.x - g / 2 - u).attr("y", t.y - t.height / 2 - u).attr("width", g + f).attr("height", t.height + f), a.attr("class", "inner").attr("x", t.x - g / 2 - u).attr("y", t.y - t.height / 2 - u + l.height - 1).attr("width", g + f).attr("height", t.height + f - l.height - 3), s.attr(
|
|
289
|
-
"transform",
|
|
290
|
-
"translate(" + (t.x - l.width / 2) + ", " + (t.y - t.height / 2 - t.padding / 3 + (E(S().flowchart.htmlLabels) ? 5 : 3)) + ")"
|
|
291
|
-
);
|
|
292
|
-
const c = r.node().getBBox();
|
|
293
|
-
return t.height = c.height, t.intersect = function(o) {
|
|
294
|
-
return C(t, o);
|
|
295
|
-
}, e;
|
|
296
|
-
}, ot = (n, t) => {
|
|
297
|
-
const e = n.insert("g").attr("class", t.classes).attr("id", t.id), r = e.insert("rect", ":first-child"), s = 0 * t.padding, a = s / 2;
|
|
298
|
-
r.attr("class", "divider").attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2).attr("width", t.width + s).attr("height", t.height + s);
|
|
299
|
-
const h = r.node().getBBox();
|
|
300
|
-
return t.width = h.width, t.height = h.height, t.diff = -t.padding / 2, t.intersect = function(l) {
|
|
301
|
-
return C(t, l);
|
|
302
|
-
}, e;
|
|
303
|
-
}, lt = { rect: rt, roundedWithTitle: ct, noteGroup: at, divider: ot };
|
|
304
|
-
let $ = {};
|
|
305
|
-
const ft = (n, t) => {
|
|
306
|
-
i.trace("Inserting cluster");
|
|
307
|
-
const e = t.shape || "rect";
|
|
308
|
-
$[t.id] = lt[e](n, t);
|
|
309
|
-
}, dt = () => {
|
|
310
|
-
$ = {};
|
|
311
|
-
}, k = (n, t, e, r) => b(void 0, null, function* () {
|
|
312
|
-
i.info("Graph in recursive render: XXX", y(t), r);
|
|
313
|
-
const s = t.graph().rankdir;
|
|
314
|
-
i.trace("Dir in recursive render - dir:", s);
|
|
315
|
-
const a = n.insert("g").attr("class", "root");
|
|
316
|
-
t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.trace("Recursive edges", t.edge(t.edges()[0]));
|
|
317
|
-
const h = a.insert("g").attr("class", "clusters"), l = a.insert("g").attr("class", "edgePaths"), f = a.insert("g").attr("class", "edgeLabels"), u = a.insert("g").attr("class", "nodes");
|
|
318
|
-
yield Promise.all(
|
|
319
|
-
t.nodes().map(function(c) {
|
|
320
|
-
return b(this, null, function* () {
|
|
321
|
-
const o = t.node(c);
|
|
322
|
-
if (r !== void 0) {
|
|
323
|
-
const w = JSON.parse(JSON.stringify(r.clusterData));
|
|
324
|
-
i.info("Setting data for cluster XXX (", c, ") ", w, r), t.setNode(r.id, w), t.parent(c) || (i.trace("Setting parent", c, r.id), t.setParent(c, r.id, w));
|
|
325
|
-
}
|
|
326
|
-
if (i.info("(Insert) Node XXX" + c + ": " + JSON.stringify(t.node(c))), o && o.clusterNode) {
|
|
327
|
-
i.info("Cluster identified", c, o.width, t.node(c));
|
|
328
|
-
const w = yield k(u, o.graph, e, t.node(c)), B = w.elem;
|
|
329
|
-
_(o, B), o.diff = w.diff || 0, i.info("Node bounds (abc123)", c, o, o.width, o.x, o.y), H(B, o), i.warn("Recursive render complete ", B, o);
|
|
330
|
-
} else
|
|
331
|
-
t.children(c).length > 0 ? (i.info("Cluster - the non recursive path XXX", c, o.id, o, t), i.info(m(o.id, t)), d[o.id] = { id: m(o.id, t), node: o }) : (i.info("Node - the non recursive path", c, o.id, o), yield V(u, t.node(c), s));
|
|
332
|
-
});
|
|
333
|
-
})
|
|
334
|
-
), t.edges().forEach(function(c) {
|
|
335
|
-
const o = t.edge(c.v, c.w, c.name);
|
|
336
|
-
i.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c)), i.info("Edge " + c.v + " -> " + c.w + ": ", c, " ", JSON.stringify(t.edge(c))), i.info("Fix", d, "ids:", c.v, c.w, "Translateing: ", d[c.v], d[c.w]), q(f, o);
|
|
337
|
-
}), t.edges().forEach(function(c) {
|
|
338
|
-
i.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c));
|
|
339
|
-
}), i.info("#############################################"), i.info("### Layout ###"), i.info("#############################################"), i.info(t), A(t), i.info("Graph after layout:", y(t));
|
|
340
|
-
let g = 0;
|
|
341
|
-
return st(t).forEach(function(c) {
|
|
342
|
-
const o = t.node(c);
|
|
343
|
-
i.info("Position " + c + ": " + JSON.stringify(t.node(c))), i.info(
|
|
344
|
-
"Position " + c + ": (" + o.x,
|
|
345
|
-
"," + o.y,
|
|
346
|
-
") width: ",
|
|
347
|
-
o.width,
|
|
348
|
-
" height: ",
|
|
349
|
-
o.height
|
|
350
|
-
), o && o.clusterNode ? D(o) : t.children(c).length > 0 ? (ft(h, o), d[o.id].node = o) : D(o);
|
|
351
|
-
}), t.edges().forEach(function(c) {
|
|
352
|
-
const o = t.edge(c);
|
|
353
|
-
i.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(o), o);
|
|
354
|
-
const w = U(l, c, o, d, e, t);
|
|
355
|
-
W(o, w);
|
|
356
|
-
}), t.nodes().forEach(function(c) {
|
|
357
|
-
const o = t.node(c);
|
|
358
|
-
i.info(c, o.type, o.diff), o.type === "group" && (g = o.diff);
|
|
359
|
-
}), { elem: a, diff: g };
|
|
360
|
-
}), yt = (n, t, e, r, s) => b(void 0, null, function* () {
|
|
361
|
-
M(n, e, r, s), Y(), z(), dt(), et(), i.warn("Graph at first:", y(t)), it(t), i.warn("Graph after:", y(t)), yield k(n, t, r);
|
|
362
|
-
});
|
|
363
|
-
export {
|
|
364
|
-
yt as r
|
|
365
|
-
};
|