lowcoder-comps 0.0.18 → 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 +3 -4
- 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/0d763a87.js +0 -798
- package/1813144f.js +0 -940
- package/2039ece8.js +0 -91
- package/256b619e.js +0 -92
- package/2ff2c7a6.js +0 -6
- package/372dc2a7.js +0 -365
- package/3b12eb0e.js +0 -2103
- package/3c0b160f.js +0 -236
- package/401f73a2.js +0 -1602
- package/4137766d.js +0 -86
- package/4728777d.js +0 -447
- package/4881ced8.js +0 -943
- package/50cdd04e.js +0 -823
- package/5a46ac81.js +0 -1118
- package/6737b605.js +0 -985
- package/6a3117df.js +0 -159
- package/6add348f.js +0 -2456
- package/7aa956be.js +0 -326
- package/80fe4e54.js +0 -24
- package/847d7b9d.js +0 -7
- package/8c3bb161.js +0 -18619
- package/8edfc14c.js +0 -1246
- package/a96f93b1.js +0 -1032
- package/b680d6c7.js +0 -70
- package/babb4d5d.js +0 -832
- package/bfa09fb0.js +0 -607
- package/c1008714.js +0 -275
- package/ca536ab8.js +0 -117238
- package/cb157d73.js +0 -849
- package/ce50b2ed.js +0 -2679
- package/d4fa84c2.js +0 -212
- package/d7fee54a.js +0 -451
- package/e1a22e9d.js +0 -34
- package/e1cbc8ec.js +0 -46688
- package/f9637058.js +0 -16
- package/fbeabd79.js +0 -793
- package/fc3693cc.js +0 -2827
- package/index.js +0 -5
package/2039ece8.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { p as N, d as M, s as W } from "./a96f93b1.js";
|
|
2
|
-
import { c as S, l as d, h as u, i as H } from "./ca536ab8.js";
|
|
3
|
-
import { G as X, l as Y } from "./ce50b2ed.js";
|
|
4
|
-
import { s as l } from "./6a3117df.js";
|
|
5
|
-
import "./e1a22e9d.js";
|
|
6
|
-
import "./2ff2c7a6.js";
|
|
7
|
-
import "./256b619e.js";
|
|
8
|
-
let h = {};
|
|
9
|
-
const g = 20, p = function(e) {
|
|
10
|
-
const s = Object.entries(h).find((k) => k[1].label === e);
|
|
11
|
-
if (s)
|
|
12
|
-
return s[0];
|
|
13
|
-
}, Z = function(e) {
|
|
14
|
-
e.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), e.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
|
|
15
|
-
}, D = function(e, s, k, a) {
|
|
16
|
-
const c = S().class;
|
|
17
|
-
h = {}, d.info("Rendering diagram " + e);
|
|
18
|
-
const L = S().securityLevel;
|
|
19
|
-
let y;
|
|
20
|
-
L === "sandbox" && (y = u("#i" + s));
|
|
21
|
-
const x = L === "sandbox" ? u(y.nodes()[0].contentDocument.body) : u("body"), n = x.select(`[id='${s}']`);
|
|
22
|
-
Z(n);
|
|
23
|
-
const r = new X({
|
|
24
|
-
multigraph: !0
|
|
25
|
-
});
|
|
26
|
-
r.setGraph({
|
|
27
|
-
isMultiGraph: !0
|
|
28
|
-
}), r.setDefaultEdgeLabel(function() {
|
|
29
|
-
return {};
|
|
30
|
-
});
|
|
31
|
-
const m = a.db.getClasses(), $ = Object.keys(m);
|
|
32
|
-
for (const t of $) {
|
|
33
|
-
const o = m[t], i = l.drawClass(n, o, c, a);
|
|
34
|
-
h[i.id] = i, r.setNode(i.id, i), d.info("Org height: " + i.height);
|
|
35
|
-
}
|
|
36
|
-
a.db.getRelations().forEach(function(t) {
|
|
37
|
-
d.info(
|
|
38
|
-
"tjoho" + p(t.id1) + p(t.id2) + JSON.stringify(t)
|
|
39
|
-
), r.setEdge(
|
|
40
|
-
p(t.id1),
|
|
41
|
-
p(t.id2),
|
|
42
|
-
{
|
|
43
|
-
relation: t
|
|
44
|
-
},
|
|
45
|
-
t.title || "DEFAULT"
|
|
46
|
-
);
|
|
47
|
-
}), a.db.getNotes().forEach(function(t) {
|
|
48
|
-
d.debug(`Adding note: ${JSON.stringify(t)}`);
|
|
49
|
-
const o = l.drawNote(n, t, c, a);
|
|
50
|
-
h[o.id] = o, r.setNode(o.id, o), t.class && t.class in m && r.setEdge(
|
|
51
|
-
t.id,
|
|
52
|
-
p(t.class),
|
|
53
|
-
{
|
|
54
|
-
relation: {
|
|
55
|
-
id1: t.id,
|
|
56
|
-
id2: t.class,
|
|
57
|
-
relation: {
|
|
58
|
-
type1: "none",
|
|
59
|
-
type2: "none",
|
|
60
|
-
lineType: 10
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"DEFAULT"
|
|
65
|
-
);
|
|
66
|
-
}), Y(r), r.nodes().forEach(function(t) {
|
|
67
|
-
t !== void 0 && r.node(t) !== void 0 && (d.debug("Node " + t + ": " + JSON.stringify(r.node(t))), x.select("#" + (a.db.lookUpDomId(t) || t)).attr(
|
|
68
|
-
"transform",
|
|
69
|
-
"translate(" + (r.node(t).x - r.node(t).width / 2) + "," + (r.node(t).y - r.node(t).height / 2) + " )"
|
|
70
|
-
));
|
|
71
|
-
}), r.edges().forEach(function(t) {
|
|
72
|
-
t !== void 0 && r.edge(t) !== void 0 && (d.debug("Edge " + t.v + " -> " + t.w + ": " + JSON.stringify(r.edge(t))), l.drawEdge(n, r.edge(t), r.edge(t).relation, c, a));
|
|
73
|
-
});
|
|
74
|
-
const f = n.node().getBBox(), E = f.width + g * 2, b = f.height + g * 2;
|
|
75
|
-
H(n, b, E, c.useMaxWidth);
|
|
76
|
-
const w = `${f.x - g} ${f.y - g} ${E} ${b}`;
|
|
77
|
-
d.debug(`viewBox ${w}`), n.attr("viewBox", w);
|
|
78
|
-
}, B = {
|
|
79
|
-
draw: D
|
|
80
|
-
}, R = {
|
|
81
|
-
parser: N,
|
|
82
|
-
db: M,
|
|
83
|
-
renderer: B,
|
|
84
|
-
styles: W,
|
|
85
|
-
init: (e) => {
|
|
86
|
-
e.class || (e.class = {}), e.class.arrowMarkerAbsolute = e.arrowMarkerAbsolute, M.clear();
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
R as diagram
|
|
91
|
-
};
|
package/256b619e.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
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 = // start of current subpath
|
|
24
|
-
this._x1 = this._y1 = null, this._ = "", this._append = t == null ? T : L(t);
|
|
25
|
-
}
|
|
26
|
-
moveTo(t, h) {
|
|
27
|
-
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +h}`;
|
|
28
|
-
}
|
|
29
|
-
closePath() {
|
|
30
|
-
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
|
|
31
|
-
}
|
|
32
|
-
lineTo(t, h) {
|
|
33
|
-
this._append`L${this._x1 = +t},${this._y1 = +h}`;
|
|
34
|
-
}
|
|
35
|
-
quadraticCurveTo(t, h, i, s) {
|
|
36
|
-
this._append`Q${+t},${+h},${this._x1 = +i},${this._y1 = +s}`;
|
|
37
|
-
}
|
|
38
|
-
bezierCurveTo(t, h, i, s, n, $) {
|
|
39
|
-
this._append`C${+t},${+h},${+i},${+s},${this._x1 = +n},${this._y1 = +$}`;
|
|
40
|
-
}
|
|
41
|
-
arcTo(t, h, i, s, n) {
|
|
42
|
-
if (t = +t, h = +h, i = +i, s = +s, n = +n, n < 0)
|
|
43
|
-
throw new Error(`negative radius: ${n}`);
|
|
44
|
-
let $ = this._x1, r = this._y1, p = i - t, l = s - h, _ = $ - t, o = r - h, a = _ * _ + o * o;
|
|
45
|
-
if (this._x1 === null)
|
|
46
|
-
this._append`M${this._x1 = t},${this._y1 = h}`;
|
|
47
|
-
else if (a > u)
|
|
48
|
-
if (!(Math.abs(o * p - l * _) > u) || !n)
|
|
49
|
-
this._append`L${this._x1 = t},${this._y1 = h}`;
|
|
50
|
-
else {
|
|
51
|
-
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;
|
|
52
|
-
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}`;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
arc(t, h, i, s, n, $) {
|
|
56
|
-
if (t = +t, h = +h, i = +i, $ = !!$, i < 0)
|
|
57
|
-
throw new Error(`negative radius: ${i}`);
|
|
58
|
-
let r = i * Math.cos(s), p = i * Math.sin(s), l = t + r, _ = h + p, o = 1 ^ $, a = $ ? s - n : n - s;
|
|
59
|
-
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)}`);
|
|
60
|
-
}
|
|
61
|
-
rect(t, h, i, s) {
|
|
62
|
-
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +h}h${i = +i}v${+s}h${-i}Z`;
|
|
63
|
-
}
|
|
64
|
-
toString() {
|
|
65
|
-
return this._;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function C(e) {
|
|
69
|
-
return function() {
|
|
70
|
-
return e;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function R(e) {
|
|
74
|
-
let t = 3;
|
|
75
|
-
return e.digits = function(h) {
|
|
76
|
-
if (!arguments.length)
|
|
77
|
-
return t;
|
|
78
|
-
if (h == null)
|
|
79
|
-
t = null;
|
|
80
|
-
else {
|
|
81
|
-
const i = Math.floor(h);
|
|
82
|
-
if (!(i >= 0))
|
|
83
|
-
throw new RangeError(`invalid digits: ${h}`);
|
|
84
|
-
t = i;
|
|
85
|
-
}
|
|
86
|
-
return e;
|
|
87
|
-
}, () => new P(t);
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
C as c,
|
|
91
|
-
R as w
|
|
92
|
-
};
|
package/2ff2c7a6.js
DELETED
package/372dc2a7.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 "./ce50b2ed.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 "./cb157d73.js";
|
|
19
|
-
import { l as i, q as E, c as S, h as T } from "./ca536ab8.js";
|
|
20
|
-
import { c as K } from "./fc3693cc.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
|
-
};
|