lowcoder-comps 0.0.7 → 0.0.8
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/icons/icon-chart.svg +15 -0
- package/icons/icon-comp-calendar.svg +22 -0
- package/index.html +26 -0
- package/index.tsx +19 -0
- package/jest.config.js +5 -0
- package/package/012a06bb.js +34 -0
- package/package/06481cb7.js +1060 -0
- package/package/0c8b29d5.js +6 -0
- package/package/114884df.js +805 -0
- package/package/1264ddb2.js +194 -0
- package/package/1cee31ec.js +1095 -0
- package/package/269c3ba3.js +46662 -0
- package/package/2a2c2e55.js +799 -0
- package/package/2b3ab1e4.js +98763 -0
- package/package/37590a81.js +967 -0
- package/package/3cd7980e.js +184 -0
- package/package/40112498.js +424 -0
- package/package/4b6e1d6f.js +24 -0
- package/package/4bc1082b.js +86 -0
- package/package/53e49f9b.js +1600 -0
- package/package/55bd5c26.js +266 -0
- package/package/591684c8.js +2071 -0
- package/package/6c000872.js +16 -0
- package/package/756addec.js +775 -0
- package/package/7668124e.js +8 -0
- package/package/79e8eeeb.js +949 -0
- package/package/926fbfec.js +91 -0
- package/package/945eefb3.js +2665 -0
- package/package/a35f148e.js +1228 -0
- package/package/a4d12a43.js +175 -0
- package/package/a60de5d1.js +804 -0
- package/package/a8dde1ea.js +589 -0
- package/package/b4148642.js +7 -0
- package/package/b7dd22a2.js +847 -0
- package/package/d4f3a2c4.js +18046 -0
- package/package/e0f479f3.js +91 -0
- package/package/eaa160c9.js +341 -0
- package/package/f1bfd8b5.js +311 -0
- package/package/f1f9ba79.js +900 -0
- package/package/fba61f63.js +2868 -0
- package/package/icons/icon-chart.svg +15 -0
- package/package/icons/icon-comp-calendar.svg +22 -0
- package/package/index.js +5 -0
- package/package/package.json +73 -0
- package/package.json +1 -4
- package/src/__test__/allComp.test.tsx +61 -0
- package/src/app-env.d.ts +3 -0
- package/src/comps/calendarComp/calendarComp.tsx +442 -0
- package/src/comps/calendarComp/calendarConstants.tsx +897 -0
- package/src/comps/chartComp/chartComp.tsx +249 -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 +6 -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 +243 -0
- package/src/comps/chartComp/chartPropertyView.tsx +161 -0
- package/src/comps/chartComp/chartUtils.ts +240 -0
- package/src/comps/chartComp/reactEcharts/core.tsx +187 -0
- package/src/comps/chartComp/reactEcharts/index.ts +20 -0
- package/src/comps/chartComp/reactEcharts/types.ts +70 -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 +142 -0
- package/src/i18n/comps/locales/enObj.tsx +120 -0
- package/src/i18n/comps/locales/index.ts +7 -0
- package/src/i18n/comps/locales/types.tsx +9 -0
- package/src/i18n/comps/locales/zh.ts +4 -0
- package/src/i18n/comps/locales/zhObj.tsx +4 -0
- package/src/index.ts +11 -0
- package/vite.config.js +10 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var E = Math.pow;
|
|
2
|
+
const c = Math.PI, x = 2 * c, u = 1e-6, A = x - u;
|
|
3
|
+
function T(e) {
|
|
4
|
+
this._ += e[0];
|
|
5
|
+
for (let t = 1, h = e.length; t < h; ++t)
|
|
6
|
+
this._ += arguments[t] + e[t];
|
|
7
|
+
}
|
|
8
|
+
function L(e) {
|
|
9
|
+
let t = Math.floor(e);
|
|
10
|
+
if (!(t >= 0))
|
|
11
|
+
throw new Error(`invalid digits: ${e}`);
|
|
12
|
+
if (t > 15)
|
|
13
|
+
return T;
|
|
14
|
+
const h = E(10, t);
|
|
15
|
+
return function(i) {
|
|
16
|
+
this._ += i[0];
|
|
17
|
+
for (let s = 1, n = i.length; s < n; ++s)
|
|
18
|
+
this._ += Math.round(arguments[s] * h) / h + i[s];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
class P {
|
|
22
|
+
constructor(t) {
|
|
23
|
+
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "", this._append = t == null ? T : L(t);
|
|
24
|
+
}
|
|
25
|
+
moveTo(t, h) {
|
|
26
|
+
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +h}`;
|
|
27
|
+
}
|
|
28
|
+
closePath() {
|
|
29
|
+
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
|
|
30
|
+
}
|
|
31
|
+
lineTo(t, h) {
|
|
32
|
+
this._append`L${this._x1 = +t},${this._y1 = +h}`;
|
|
33
|
+
}
|
|
34
|
+
quadraticCurveTo(t, h, i, s) {
|
|
35
|
+
this._append`Q${+t},${+h},${this._x1 = +i},${this._y1 = +s}`;
|
|
36
|
+
}
|
|
37
|
+
bezierCurveTo(t, h, i, s, n, $) {
|
|
38
|
+
this._append`C${+t},${+h},${+i},${+s},${this._x1 = +n},${this._y1 = +$}`;
|
|
39
|
+
}
|
|
40
|
+
arcTo(t, h, i, s, n) {
|
|
41
|
+
if (t = +t, h = +h, i = +i, s = +s, n = +n, n < 0)
|
|
42
|
+
throw new Error(`negative radius: ${n}`);
|
|
43
|
+
let $ = this._x1, r = this._y1, p = i - t, l = s - h, _ = $ - t, o = r - h, a = _ * _ + o * o;
|
|
44
|
+
if (this._x1 === null)
|
|
45
|
+
this._append`M${this._x1 = t},${this._y1 = h}`;
|
|
46
|
+
else if (a > u)
|
|
47
|
+
if (!(Math.abs(o * p - l * _) > u) || !n)
|
|
48
|
+
this._append`L${this._x1 = t},${this._y1 = h}`;
|
|
49
|
+
else {
|
|
50
|
+
let d = i - $, f = s - r, y = p * p + l * l, m = d * d + f * f, g = Math.sqrt(y), v = Math.sqrt(a), w = n * Math.tan((c - Math.acos((y + a - m) / (2 * g * v))) / 2), M = w / v, b = w / g;
|
|
51
|
+
Math.abs(M - 1) > u && this._append`L${t + M * _},${h + M * o}`, this._append`A${n},${n},0,0,${+(o * d > _ * f)},${this._x1 = t + b * p},${this._y1 = h + b * l}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
arc(t, h, i, s, n, $) {
|
|
55
|
+
if (t = +t, h = +h, i = +i, $ = !!$, i < 0)
|
|
56
|
+
throw new Error(`negative radius: ${i}`);
|
|
57
|
+
let r = i * Math.cos(s), p = i * Math.sin(s), l = t + r, _ = h + p, o = 1 ^ $, a = $ ? s - n : n - s;
|
|
58
|
+
this._x1 === null ? this._append`M${l},${_}` : (Math.abs(this._x1 - l) > u || Math.abs(this._y1 - _) > u) && this._append`L${l},${_}`, i && (a < 0 && (a = a % x + x), a > A ? this._append`A${i},${i},0,1,${o},${t - r},${h - p}A${i},${i},0,1,${o},${this._x1 = l},${this._y1 = _}` : a > u && this._append`A${i},${i},0,${+(a >= c)},${o},${this._x1 = t + i * Math.cos(n)},${this._y1 = h + i * Math.sin(n)}`);
|
|
59
|
+
}
|
|
60
|
+
rect(t, h, i, s) {
|
|
61
|
+
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +h}h${i = +i}v${+s}h${-i}Z`;
|
|
62
|
+
}
|
|
63
|
+
toString() {
|
|
64
|
+
return this._;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function C(e) {
|
|
68
|
+
return function() {
|
|
69
|
+
return e;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function R(e) {
|
|
73
|
+
let t = 3;
|
|
74
|
+
return e.digits = function(h) {
|
|
75
|
+
if (!arguments.length)
|
|
76
|
+
return t;
|
|
77
|
+
if (h == null)
|
|
78
|
+
t = null;
|
|
79
|
+
else {
|
|
80
|
+
const i = Math.floor(h);
|
|
81
|
+
if (!(i >= 0))
|
|
82
|
+
throw new RangeError(`invalid digits: ${h}`);
|
|
83
|
+
t = i;
|
|
84
|
+
}
|
|
85
|
+
return e;
|
|
86
|
+
}, () => new P(t);
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
C as c,
|
|
90
|
+
R as w
|
|
91
|
+
};
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { b as $, a as y, m as D, G, l as j } from "./945eefb3.js";
|
|
2
|
+
import { i as A, u as M, s as _, a as H, b as V, p as B, c as q, d as U, e as W, f as Y, g as O, h as X } from "./a60de5d1.js";
|
|
3
|
+
import { l as i, q as N, c as E, h as L } from "./2b3ab1e4.js";
|
|
4
|
+
import { c as z } from "./06481cb7.js";
|
|
5
|
+
var K = 4;
|
|
6
|
+
function Q(e) {
|
|
7
|
+
return $(e, K);
|
|
8
|
+
}
|
|
9
|
+
function v(e) {
|
|
10
|
+
var t = {
|
|
11
|
+
options: {
|
|
12
|
+
directed: e.isDirected(),
|
|
13
|
+
multigraph: e.isMultigraph(),
|
|
14
|
+
compound: e.isCompound()
|
|
15
|
+
},
|
|
16
|
+
nodes: Z(e),
|
|
17
|
+
edges: I(e)
|
|
18
|
+
};
|
|
19
|
+
return y(e.graph()) || (t.value = Q(e.graph())), t;
|
|
20
|
+
}
|
|
21
|
+
function Z(e) {
|
|
22
|
+
return D(e.nodes(), function(t) {
|
|
23
|
+
var n = e.node(t), r = e.parent(t), s = { v: t };
|
|
24
|
+
return y(n) || (s.value = n), y(r) || (s.parent = r), s;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function I(e) {
|
|
28
|
+
return D(e.edges(), function(t) {
|
|
29
|
+
var n = e.edge(t), r = { v: t.v, w: t.w };
|
|
30
|
+
return y(t.name) || (r.name = t.name), y(n) || (r.value = n), r;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
let f = {}, x = {}, T = {};
|
|
34
|
+
const tt = () => {
|
|
35
|
+
x = {}, T = {}, f = {};
|
|
36
|
+
}, S = (e, t) => (i.trace("In isDecendant", t, " ", e, " = ", x[t].includes(e)), !!x[t].includes(e)), et = (e, t) => (i.info("Decendants of ", t, " is ", x[t]), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : x[t] ? x[t].includes(e.v) || S(e.v, t) || S(e.w, t) || x[t].includes(e.w) : (i.debug("Tilt, ", t, ",not in decendants"), !1)), J = (e, t, n, r) => {
|
|
37
|
+
i.warn(
|
|
38
|
+
"Copying children of ",
|
|
39
|
+
e,
|
|
40
|
+
"root",
|
|
41
|
+
r,
|
|
42
|
+
"data",
|
|
43
|
+
t.node(e),
|
|
44
|
+
r
|
|
45
|
+
);
|
|
46
|
+
const s = t.children(e) || [];
|
|
47
|
+
e !== r && s.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", s), s.forEach((a) => {
|
|
48
|
+
if (t.children(a).length > 0)
|
|
49
|
+
J(a, t, n, r);
|
|
50
|
+
else {
|
|
51
|
+
const h = t.node(a);
|
|
52
|
+
i.info("cp ", a, " to ", r, " with parent ", e), n.setNode(a, h), r !== t.parent(a) && (i.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== r && a !== e ? (i.debug("Setting parent", a, e), n.setParent(a, e)) : (i.info("In copy ", e, "root", r, "data", t.node(e), r), i.debug(
|
|
53
|
+
"Not Setting parent for node=",
|
|
54
|
+
a,
|
|
55
|
+
"cluster!==rootId",
|
|
56
|
+
e !== r,
|
|
57
|
+
"node!==clusterId",
|
|
58
|
+
a !== e
|
|
59
|
+
));
|
|
60
|
+
const l = t.edges(a);
|
|
61
|
+
i.debug("Copying Edges", l), l.forEach((d) => {
|
|
62
|
+
i.info("Edge", d);
|
|
63
|
+
const w = t.edge(d.v, d.w, d.name);
|
|
64
|
+
i.info("Edge data", w, r);
|
|
65
|
+
try {
|
|
66
|
+
et(d, r) ? (i.info("Copying as ", d.v, d.w, w, d.name), n.setEdge(d.v, d.w, w, d.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
|
|
67
|
+
"Skipping copy of edge ",
|
|
68
|
+
d.v,
|
|
69
|
+
"-->",
|
|
70
|
+
d.w,
|
|
71
|
+
" rootId: ",
|
|
72
|
+
r,
|
|
73
|
+
" clusterId:",
|
|
74
|
+
e
|
|
75
|
+
);
|
|
76
|
+
} catch (g) {
|
|
77
|
+
i.error(g);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
i.debug("Removing node", a), t.removeNode(a);
|
|
82
|
+
});
|
|
83
|
+
}, R = (e, t) => {
|
|
84
|
+
const n = t.children(e);
|
|
85
|
+
let r = [...n];
|
|
86
|
+
for (const s of n)
|
|
87
|
+
T[s] = e, r = [...r, ...R(s, t)];
|
|
88
|
+
return r;
|
|
89
|
+
}, b = (e, t) => {
|
|
90
|
+
i.trace("Searching", e);
|
|
91
|
+
const n = t.children(e);
|
|
92
|
+
if (i.trace("Searching children of id ", e, n), n.length < 1)
|
|
93
|
+
return i.trace("This is a valid node", e), e;
|
|
94
|
+
for (const r of n) {
|
|
95
|
+
const s = b(r, t);
|
|
96
|
+
if (s)
|
|
97
|
+
return i.trace("Found replacement for", e, " => ", s), s;
|
|
98
|
+
}
|
|
99
|
+
}, m = (e) => !f[e] || !f[e].externalConnections ? e : f[e] ? f[e].id : e, nt = (e, t) => {
|
|
100
|
+
if (!e || t > 10) {
|
|
101
|
+
i.debug("Opting out, no graph ");
|
|
102
|
+
return;
|
|
103
|
+
} else
|
|
104
|
+
i.debug("Opting in, graph ");
|
|
105
|
+
e.nodes().forEach(function(n) {
|
|
106
|
+
e.children(n).length > 0 && (i.warn(
|
|
107
|
+
"Cluster identified",
|
|
108
|
+
n,
|
|
109
|
+
" Replacement id in edges: ",
|
|
110
|
+
b(n, e)
|
|
111
|
+
), x[n] = R(n, e), f[n] = { id: b(n, e), clusterData: e.node(n) });
|
|
112
|
+
}), e.nodes().forEach(function(n) {
|
|
113
|
+
const r = e.children(n), s = e.edges();
|
|
114
|
+
r.length > 0 ? (i.debug("Cluster identified", n, x), s.forEach((a) => {
|
|
115
|
+
if (a.v !== n && a.w !== n) {
|
|
116
|
+
const h = S(a.v, n), l = S(a.w, n);
|
|
117
|
+
h ^ l && (i.warn("Edge: ", a, " leaves cluster ", n), i.warn("Decendants of XXX ", n, ": ", x[n]), f[n].externalConnections = !0);
|
|
118
|
+
}
|
|
119
|
+
})) : i.debug("Not a cluster ", n, x);
|
|
120
|
+
}), e.edges().forEach(function(n) {
|
|
121
|
+
const r = e.edge(n);
|
|
122
|
+
i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
|
|
123
|
+
let s = n.v, a = n.w;
|
|
124
|
+
if (i.warn(
|
|
125
|
+
"Fix XXX",
|
|
126
|
+
f,
|
|
127
|
+
"ids:",
|
|
128
|
+
n.v,
|
|
129
|
+
n.w,
|
|
130
|
+
"Translating: ",
|
|
131
|
+
f[n.v],
|
|
132
|
+
" --- ",
|
|
133
|
+
f[n.w]
|
|
134
|
+
), f[n.v] && f[n.w] && f[n.v] === f[n.w]) {
|
|
135
|
+
i.warn("Fixing and trixing link to self - removing XXX", n.v, n.w, n.name), i.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), s = m(n.v), a = m(n.w), e.removeEdge(n.v, n.w, n.name);
|
|
136
|
+
const h = n.w + "---" + n.v;
|
|
137
|
+
e.setNode(h, {
|
|
138
|
+
domId: h,
|
|
139
|
+
id: h,
|
|
140
|
+
labelStyle: "",
|
|
141
|
+
labelText: r.label,
|
|
142
|
+
padding: 0,
|
|
143
|
+
shape: "labelRect",
|
|
144
|
+
style: ""
|
|
145
|
+
});
|
|
146
|
+
const l = JSON.parse(JSON.stringify(r)), d = JSON.parse(JSON.stringify(r));
|
|
147
|
+
l.label = "", l.arrowTypeEnd = "none", d.label = "", l.fromCluster = n.v, d.toCluster = n.v, e.setEdge(s, h, l, n.name + "-cyclic-special"), e.setEdge(h, a, d, n.name + "-cyclic-special");
|
|
148
|
+
} else
|
|
149
|
+
(f[n.v] || f[n.w]) && (i.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), s = m(n.v), a = m(n.w), e.removeEdge(n.v, n.w, n.name), s !== n.v && (r.fromCluster = n.v), a !== n.w && (r.toCluster = n.w), i.warn("Fix Replacing with XXX", s, a, n.name), e.setEdge(s, a, r, n.name));
|
|
150
|
+
}), i.warn("Adjusted Graph", v(e)), p(e, 0), i.trace(f);
|
|
151
|
+
}, p = (e, t) => {
|
|
152
|
+
if (i.warn("extractor - ", t, v(e), e.children("D")), t > 10) {
|
|
153
|
+
i.error("Bailing out");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
let n = e.nodes(), r = !1;
|
|
157
|
+
for (const s of n) {
|
|
158
|
+
const a = e.children(s);
|
|
159
|
+
r = r || a.length > 0;
|
|
160
|
+
}
|
|
161
|
+
if (!r) {
|
|
162
|
+
i.debug("Done, no node has children", e.nodes());
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
i.debug("Nodes = ", n, t);
|
|
166
|
+
for (const s of n)
|
|
167
|
+
if (i.debug(
|
|
168
|
+
"Extracting node",
|
|
169
|
+
s,
|
|
170
|
+
f,
|
|
171
|
+
f[s] && !f[s].externalConnections,
|
|
172
|
+
!e.parent(s),
|
|
173
|
+
e.node(s),
|
|
174
|
+
e.children("D"),
|
|
175
|
+
" Depth ",
|
|
176
|
+
t
|
|
177
|
+
), !f[s])
|
|
178
|
+
i.debug("Not a cluster", s, t);
|
|
179
|
+
else if (!f[s].externalConnections && e.children(s) && e.children(s).length > 0) {
|
|
180
|
+
i.warn(
|
|
181
|
+
"Cluster without external connections, without a parent and with children",
|
|
182
|
+
s,
|
|
183
|
+
t
|
|
184
|
+
);
|
|
185
|
+
let h = e.graph().rankdir === "TB" ? "LR" : "TB";
|
|
186
|
+
f[s] && f[s].clusterData && f[s].clusterData.dir && (h = f[s].clusterData.dir, i.warn("Fixing dir", f[s].clusterData.dir, h));
|
|
187
|
+
const l = new G({
|
|
188
|
+
multigraph: !0,
|
|
189
|
+
compound: !0
|
|
190
|
+
}).setGraph({
|
|
191
|
+
rankdir: h,
|
|
192
|
+
nodesep: 50,
|
|
193
|
+
ranksep: 50,
|
|
194
|
+
marginx: 8,
|
|
195
|
+
marginy: 8
|
|
196
|
+
}).setDefaultEdgeLabel(function() {
|
|
197
|
+
return {};
|
|
198
|
+
});
|
|
199
|
+
i.warn("Old graph before copy", v(e)), J(s, e, l, s), e.setNode(s, {
|
|
200
|
+
clusterNode: !0,
|
|
201
|
+
id: s,
|
|
202
|
+
clusterData: f[s].clusterData,
|
|
203
|
+
labelText: f[s].labelText,
|
|
204
|
+
graph: l
|
|
205
|
+
}), i.warn("New graph after copy node: (", s, ")", v(l)), i.debug("Old graph after copy", v(e));
|
|
206
|
+
} else
|
|
207
|
+
i.warn(
|
|
208
|
+
"Cluster ** ",
|
|
209
|
+
s,
|
|
210
|
+
" **not meeting the criteria !externalConnections:",
|
|
211
|
+
!f[s].externalConnections,
|
|
212
|
+
" no parent: ",
|
|
213
|
+
!e.parent(s),
|
|
214
|
+
" children ",
|
|
215
|
+
e.children(s) && e.children(s).length > 0,
|
|
216
|
+
e.children("D"),
|
|
217
|
+
t
|
|
218
|
+
), i.debug(f);
|
|
219
|
+
n = e.nodes(), i.warn("New list of nodes", n);
|
|
220
|
+
for (const s of n) {
|
|
221
|
+
const a = e.node(s);
|
|
222
|
+
i.warn(" Now next level", s, a), a.clusterNode && p(a.graph, t + 1);
|
|
223
|
+
}
|
|
224
|
+
}, P = (e, t) => {
|
|
225
|
+
if (t.length === 0)
|
|
226
|
+
return [];
|
|
227
|
+
let n = Object.assign(t);
|
|
228
|
+
return t.forEach((r) => {
|
|
229
|
+
const s = e.children(r), a = P(e, s);
|
|
230
|
+
n = [...n, ...a];
|
|
231
|
+
}), n;
|
|
232
|
+
}, it = (e) => P(e, e.children()), st = (e, t) => {
|
|
233
|
+
i.info("Creating subgraph rect for ", t.id, t);
|
|
234
|
+
const n = e.insert("g").attr("class", "cluster" + (t.class ? " " + t.class : "")).attr("id", t.id), r = n.insert("rect", ":first-child"), s = N(E().flowchart.htmlLabels), a = n.insert("g").attr("class", "cluster-label"), h = t.labelType === "markdown" ? z(a, t.labelText, { style: t.labelStyle, useHtmlLabels: s }) : a.node().appendChild(O(t.labelText, t.labelStyle, void 0, !0));
|
|
235
|
+
let l = h.getBBox();
|
|
236
|
+
if (N(E().flowchart.htmlLabels)) {
|
|
237
|
+
const o = h.children[0], u = L(h);
|
|
238
|
+
l = o.getBoundingClientRect(), u.attr("width", l.width), u.attr("height", l.height);
|
|
239
|
+
}
|
|
240
|
+
const d = 0 * t.padding, w = d / 2, g = t.width <= l.width + d ? l.width + d : t.width;
|
|
241
|
+
t.width <= l.width + d ? 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 - w).attr("width", g).attr("height", t.height + d), s ? a.attr(
|
|
242
|
+
"transform",
|
|
243
|
+
"translate(" + (t.x - l.width / 2) + ", " + (t.y - t.height / 2) + ")"
|
|
244
|
+
) : a.attr(
|
|
245
|
+
"transform",
|
|
246
|
+
"translate(" + t.x + ", " + (t.y - t.height / 2) + ")"
|
|
247
|
+
);
|
|
248
|
+
const c = r.node().getBBox();
|
|
249
|
+
return t.width = c.width, t.height = c.height, t.intersect = function(o) {
|
|
250
|
+
return X(t, o);
|
|
251
|
+
}, n;
|
|
252
|
+
}, rt = (e, t) => {
|
|
253
|
+
const n = e.insert("g").attr("class", "note-cluster").attr("id", t.id), r = n.insert("rect", ":first-child"), s = 0 * t.padding, a = s / 2;
|
|
254
|
+
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");
|
|
255
|
+
const h = r.node().getBBox();
|
|
256
|
+
return t.width = h.width, t.height = h.height, t.intersect = function(l) {
|
|
257
|
+
return X(t, l);
|
|
258
|
+
}, n;
|
|
259
|
+
}, at = (e, t) => {
|
|
260
|
+
const n = e.insert("g").attr("class", t.classes).attr("id", t.id), r = n.insert("rect", ":first-child"), s = n.insert("g").attr("class", "cluster-label"), a = n.append("rect"), h = s.node().appendChild(O(t.labelText, t.labelStyle, void 0, !0));
|
|
261
|
+
let l = h.getBBox();
|
|
262
|
+
if (N(E().flowchart.htmlLabels)) {
|
|
263
|
+
const o = h.children[0], u = L(h);
|
|
264
|
+
l = o.getBoundingClientRect(), u.attr("width", l.width), u.attr("height", l.height);
|
|
265
|
+
}
|
|
266
|
+
l = h.getBBox();
|
|
267
|
+
const d = 0 * t.padding, w = d / 2, g = t.width <= l.width + t.padding ? l.width + t.padding : t.width;
|
|
268
|
+
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 - w).attr("y", t.y - t.height / 2 - w).attr("width", g + d).attr("height", t.height + d), a.attr("class", "inner").attr("x", t.x - g / 2 - w).attr("y", t.y - t.height / 2 - w + l.height - 1).attr("width", g + d).attr("height", t.height + d - l.height - 3), s.attr(
|
|
269
|
+
"transform",
|
|
270
|
+
"translate(" + (t.x - l.width / 2) + ", " + (t.y - t.height / 2 - t.padding / 3 + (N(E().flowchart.htmlLabels) ? 5 : 3)) + ")"
|
|
271
|
+
);
|
|
272
|
+
const c = r.node().getBBox();
|
|
273
|
+
return t.height = c.height, t.intersect = function(o) {
|
|
274
|
+
return X(t, o);
|
|
275
|
+
}, n;
|
|
276
|
+
}, ct = (e, t) => {
|
|
277
|
+
const n = e.insert("g").attr("class", t.classes).attr("id", t.id), r = n.insert("rect", ":first-child"), s = 0 * t.padding, a = s / 2;
|
|
278
|
+
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);
|
|
279
|
+
const h = r.node().getBBox();
|
|
280
|
+
return t.width = h.width, t.height = h.height, t.diff = -t.padding / 2, t.intersect = function(l) {
|
|
281
|
+
return X(t, l);
|
|
282
|
+
}, n;
|
|
283
|
+
}, ot = { rect: st, roundedWithTitle: at, noteGroup: rt, divider: ct };
|
|
284
|
+
let F = {};
|
|
285
|
+
const lt = (e, t) => {
|
|
286
|
+
i.trace("Inserting cluster");
|
|
287
|
+
const n = t.shape || "rect";
|
|
288
|
+
F[t.id] = ot[n](e, t);
|
|
289
|
+
}, ft = () => {
|
|
290
|
+
F = {};
|
|
291
|
+
}, k = (e, t, n, r) => {
|
|
292
|
+
i.info("Graph in recursive render: XXX", v(t), r);
|
|
293
|
+
const s = t.graph().rankdir;
|
|
294
|
+
i.trace("Dir in recursive render - dir:", s);
|
|
295
|
+
const a = e.insert("g").attr("class", "root");
|
|
296
|
+
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]));
|
|
297
|
+
const h = a.insert("g").attr("class", "clusters"), l = a.insert("g").attr("class", "edgePaths"), d = a.insert("g").attr("class", "edgeLabels"), w = a.insert("g").attr("class", "nodes");
|
|
298
|
+
t.nodes().forEach(function(c) {
|
|
299
|
+
const o = t.node(c);
|
|
300
|
+
if (r !== void 0) {
|
|
301
|
+
const u = JSON.parse(JSON.stringify(r.clusterData));
|
|
302
|
+
i.info("Setting data for cluster XXX (", c, ") ", u, r), t.setNode(r.id, u), t.parent(c) || (i.trace("Setting parent", c, r.id), t.setParent(c, r.id, u));
|
|
303
|
+
}
|
|
304
|
+
if (i.info("(Insert) Node XXX" + c + ": " + JSON.stringify(t.node(c))), o && o.clusterNode) {
|
|
305
|
+
i.info("Cluster identified", c, o.width, t.node(c));
|
|
306
|
+
const u = k(w, o.graph, n, t.node(c)), C = u.elem;
|
|
307
|
+
M(o, C), o.diff = u.diff || 0, i.info("Node bounds (abc123)", c, o, o.width, o.x, o.y), _(C, o), i.warn("Recursive render complete ", C, o);
|
|
308
|
+
} else
|
|
309
|
+
t.children(c).length > 0 ? (i.info("Cluster - the non recursive path XXX", c, o.id, o, t), i.info(b(o.id, t)), f[o.id] = { id: b(o.id, t), node: o }) : (i.info("Node - the non recursive path", c, o.id, o), H(w, t.node(c), s));
|
|
310
|
+
}), t.edges().forEach(function(c) {
|
|
311
|
+
const o = t.edge(c.v, c.w, c.name);
|
|
312
|
+
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", f, "ids:", c.v, c.w, "Translateing: ", f[c.v], f[c.w]), V(d, o);
|
|
313
|
+
}), t.edges().forEach(function(c) {
|
|
314
|
+
i.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c));
|
|
315
|
+
}), i.info("#############################################"), i.info("### Layout ###"), i.info("#############################################"), i.info(t), j(t), i.info("Graph after layout:", v(t));
|
|
316
|
+
let g = 0;
|
|
317
|
+
return it(t).forEach(function(c) {
|
|
318
|
+
const o = t.node(c);
|
|
319
|
+
i.info("Position " + c + ": " + JSON.stringify(t.node(c))), i.info(
|
|
320
|
+
"Position " + c + ": (" + o.x,
|
|
321
|
+
"," + o.y,
|
|
322
|
+
") width: ",
|
|
323
|
+
o.width,
|
|
324
|
+
" height: ",
|
|
325
|
+
o.height
|
|
326
|
+
), o && o.clusterNode ? B(o) : t.children(c).length > 0 ? (lt(h, o), f[o.id].node = o) : B(o);
|
|
327
|
+
}), t.edges().forEach(function(c) {
|
|
328
|
+
const o = t.edge(c);
|
|
329
|
+
i.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(o), o);
|
|
330
|
+
const u = q(l, c, o, f, n, t);
|
|
331
|
+
U(o, u);
|
|
332
|
+
}), t.nodes().forEach(function(c) {
|
|
333
|
+
const o = t.node(c);
|
|
334
|
+
i.info(c, o.type, o.diff), o.type === "group" && (g = o.diff);
|
|
335
|
+
}), { elem: a, diff: g };
|
|
336
|
+
}, gt = (e, t, n, r, s) => {
|
|
337
|
+
A(e, n, r, s), W(), Y(), ft(), tt(), i.warn("Graph at first:", v(t)), nt(t), i.warn("Graph after:", v(t)), k(e, t, r);
|
|
338
|
+
};
|
|
339
|
+
export {
|
|
340
|
+
gt as r
|
|
341
|
+
};
|