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,804 @@
|
|
|
1
|
+
import { q as R, c as w, d as z, _ as D, h as L, l as y, y as U, a2 as Q } from "./2b3ab1e4.js";
|
|
2
|
+
import { c as P } from "./06481cb7.js";
|
|
3
|
+
import { p as V } from "./a4d12a43.js";
|
|
4
|
+
import { l as et } from "./012a06bb.js";
|
|
5
|
+
const st = (r, t, e, l) => {
|
|
6
|
+
t.forEach((a) => {
|
|
7
|
+
bt[a](r, e, l);
|
|
8
|
+
});
|
|
9
|
+
}, it = (r, t, e) => {
|
|
10
|
+
y.trace("Making markers for ", e), r.append("defs").append("marker").attr("id", t + "-extensionStart").attr("class", "marker extension " + t).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"), r.append("defs").append("marker").attr("id", t + "-extensionEnd").attr("class", "marker extension " + t).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");
|
|
11
|
+
}, lt = (r, t) => {
|
|
12
|
+
r.append("defs").append("marker").attr("id", t + "-compositionStart").attr("class", "marker composition " + t).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"), r.append("defs").append("marker").attr("id", t + "-compositionEnd").attr("class", "marker composition " + t).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");
|
|
13
|
+
}, nt = (r, t) => {
|
|
14
|
+
r.append("defs").append("marker").attr("id", t + "-aggregationStart").attr("class", "marker aggregation " + t).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"), r.append("defs").append("marker").attr("id", t + "-aggregationEnd").attr("class", "marker aggregation " + t).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");
|
|
15
|
+
}, ct = (r, t) => {
|
|
16
|
+
r.append("defs").append("marker").attr("id", t + "-dependencyStart").attr("class", "marker dependency " + t).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"), r.append("defs").append("marker").attr("id", t + "-dependencyEnd").attr("class", "marker dependency " + t).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");
|
|
17
|
+
}, ht = (r, t) => {
|
|
18
|
+
r.append("defs").append("marker").attr("id", t + "-lollipopStart").attr("class", "marker lollipop " + t).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "white").attr("cx", 6).attr("cy", 7).attr("r", 6);
|
|
19
|
+
}, ot = (r, t) => {
|
|
20
|
+
r.append("marker").attr("id", t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 12 20").attr("refX", 10).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), r.append("marker").attr("id", t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 0).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
|
21
|
+
}, ft = (r, t) => {
|
|
22
|
+
r.append("marker").attr("id", t + "-circleEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), r.append("marker").attr("id", t + "-circleStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
|
23
|
+
}, pt = (r, t) => {
|
|
24
|
+
r.append("marker").attr("id", t + "-crossEnd").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), r.append("marker").attr("id", t + "-crossStart").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
|
|
25
|
+
}, dt = (r, t) => {
|
|
26
|
+
r.append("defs").append("marker").attr("id", t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
|
|
27
|
+
}, bt = {
|
|
28
|
+
extension: it,
|
|
29
|
+
composition: lt,
|
|
30
|
+
aggregation: nt,
|
|
31
|
+
dependency: ct,
|
|
32
|
+
lollipop: ht,
|
|
33
|
+
point: ot,
|
|
34
|
+
circle: ft,
|
|
35
|
+
cross: pt,
|
|
36
|
+
barb: dt
|
|
37
|
+
}, Kt = st;
|
|
38
|
+
function xt(r, t) {
|
|
39
|
+
t && r.attr("style", t);
|
|
40
|
+
}
|
|
41
|
+
function yt(r) {
|
|
42
|
+
const t = L(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), e = t.append("xhtml:div"), l = r.label, a = r.isNode ? "nodeLabel" : "edgeLabel";
|
|
43
|
+
return e.html(
|
|
44
|
+
'<span class="' + a + '" ' + (r.labelStyle ? 'style="' + r.labelStyle + '"' : "") + ">" + l + "</span>"
|
|
45
|
+
), xt(e, r.labelStyle), e.style("display", "inline-block"), e.style("white-space", "nowrap"), e.attr("xmlns", "http://www.w3.org/1999/xhtml"), t.node();
|
|
46
|
+
}
|
|
47
|
+
const gt = (r, t, e, l) => {
|
|
48
|
+
let a = r || "";
|
|
49
|
+
if (typeof a == "object" && (a = a[0]), R(w().flowchart.htmlLabels)) {
|
|
50
|
+
a = a.replace(/\\n|\n/g, "<br />"), y.info("vertexText" + a);
|
|
51
|
+
const s = {
|
|
52
|
+
isNode: l,
|
|
53
|
+
label: D(a).replace(
|
|
54
|
+
/fa[blrs]?:fa-[\w-]+/g,
|
|
55
|
+
(n) => `<i class='${n.replace(":", " ")}'></i>`
|
|
56
|
+
),
|
|
57
|
+
labelStyle: t.replace("fill:", "color:")
|
|
58
|
+
};
|
|
59
|
+
return yt(s);
|
|
60
|
+
} else {
|
|
61
|
+
const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
62
|
+
s.setAttribute("style", t.replace("color:", "fill:"));
|
|
63
|
+
let i = [];
|
|
64
|
+
typeof a == "string" ? i = a.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(a) ? i = a : i = [];
|
|
65
|
+
for (const n of i) {
|
|
66
|
+
const c = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
67
|
+
c.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), c.setAttribute("dy", "1em"), c.setAttribute("x", "0"), e ? c.setAttribute("class", "title-row") : c.setAttribute("class", "row"), c.textContent = n.trim(), s.appendChild(c);
|
|
68
|
+
}
|
|
69
|
+
return s;
|
|
70
|
+
}
|
|
71
|
+
}, T = gt, S = (r, t, e, l) => {
|
|
72
|
+
let a;
|
|
73
|
+
const s = t.useHtmlLabels || R(w().flowchart.htmlLabels);
|
|
74
|
+
e ? a = e : a = "node default";
|
|
75
|
+
const i = r.insert("g").attr("class", a).attr("id", t.domId || t.id), n = i.insert("g").attr("class", "label").attr("style", t.labelStyle);
|
|
76
|
+
let c;
|
|
77
|
+
t.labelText === void 0 ? c = "" : c = typeof t.labelText == "string" ? t.labelText : t.labelText[0];
|
|
78
|
+
const o = n.node();
|
|
79
|
+
let h;
|
|
80
|
+
t.labelType === "markdown" ? h = P(n, z(D(c), w()), {
|
|
81
|
+
useHtmlLabels: s,
|
|
82
|
+
width: t.width || w().flowchart.wrappingWidth,
|
|
83
|
+
classes: "markdown-node-label"
|
|
84
|
+
}) : h = o.appendChild(
|
|
85
|
+
T(
|
|
86
|
+
z(D(c), w()),
|
|
87
|
+
t.labelStyle,
|
|
88
|
+
!1,
|
|
89
|
+
l
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
let f = h.getBBox();
|
|
93
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
94
|
+
const p = h.children[0], d = L(h);
|
|
95
|
+
f = p.getBoundingClientRect(), d.attr("width", f.width), d.attr("height", f.height);
|
|
96
|
+
}
|
|
97
|
+
const b = t.padding / 2;
|
|
98
|
+
return s ? n.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")") : n.attr("transform", "translate(" + 0 + ", " + -f.height / 2 + ")"), t.centerLabel && n.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), n.insert("rect", ":first-child"), { shapeSvg: i, bbox: f, halfPadding: b, label: n };
|
|
99
|
+
}, m = (r, t) => {
|
|
100
|
+
const e = t.node().getBBox();
|
|
101
|
+
r.width = e.width, r.height = e.height;
|
|
102
|
+
};
|
|
103
|
+
function I(r, t, e, l) {
|
|
104
|
+
return r.insert("polygon", ":first-child").attr(
|
|
105
|
+
"points",
|
|
106
|
+
l.map(function(a) {
|
|
107
|
+
return a.x + "," + a.y;
|
|
108
|
+
}).join(" ")
|
|
109
|
+
).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + e / 2 + ")");
|
|
110
|
+
}
|
|
111
|
+
function ut(r, t) {
|
|
112
|
+
return r.intersect(t);
|
|
113
|
+
}
|
|
114
|
+
function tt(r, t, e, l) {
|
|
115
|
+
var a = r.x, s = r.y, i = a - l.x, n = s - l.y, c = Math.sqrt(t * t * n * n + e * e * i * i), o = Math.abs(t * e * i / c);
|
|
116
|
+
l.x < a && (o = -o);
|
|
117
|
+
var h = Math.abs(t * e * n / c);
|
|
118
|
+
return l.y < s && (h = -h), { x: a + o, y: s + h };
|
|
119
|
+
}
|
|
120
|
+
function wt(r, t, e) {
|
|
121
|
+
return tt(r, t, t, e);
|
|
122
|
+
}
|
|
123
|
+
function mt(r, t, e, l) {
|
|
124
|
+
var a, s, i, n, c, o, h, f, b, p, d, x, g, k, H;
|
|
125
|
+
if (a = t.y - r.y, i = r.x - t.x, c = t.x * r.y - r.x * t.y, b = a * e.x + i * e.y + c, p = a * l.x + i * l.y + c, !(b !== 0 && p !== 0 && q(b, p)) && (s = l.y - e.y, n = e.x - l.x, o = l.x * e.y - e.x * l.y, h = s * r.x + n * r.y + o, f = s * t.x + n * t.y + o, !(h !== 0 && f !== 0 && q(h, f)) && (d = a * n - s * i, d !== 0)))
|
|
126
|
+
return x = Math.abs(d / 2), g = i * o - n * c, k = g < 0 ? (g - x) / d : (g + x) / d, g = s * c - a * o, H = g < 0 ? (g - x) / d : (g + x) / d, { x: k, y: H };
|
|
127
|
+
}
|
|
128
|
+
function q(r, t) {
|
|
129
|
+
return r * t > 0;
|
|
130
|
+
}
|
|
131
|
+
function kt(r, t, e) {
|
|
132
|
+
var l = r.x, a = r.y, s = [], i = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY;
|
|
133
|
+
typeof t.forEach == "function" ? t.forEach(function(d) {
|
|
134
|
+
i = Math.min(i, d.x), n = Math.min(n, d.y);
|
|
135
|
+
}) : (i = Math.min(i, t.x), n = Math.min(n, t.y));
|
|
136
|
+
for (var c = l - r.width / 2 - i, o = a - r.height / 2 - n, h = 0; h < t.length; h++) {
|
|
137
|
+
var f = t[h], b = t[h < t.length - 1 ? h + 1 : 0], p = mt(
|
|
138
|
+
r,
|
|
139
|
+
e,
|
|
140
|
+
{ x: c + f.x, y: o + f.y },
|
|
141
|
+
{ x: c + b.x, y: o + b.y }
|
|
142
|
+
);
|
|
143
|
+
p && s.push(p);
|
|
144
|
+
}
|
|
145
|
+
return s.length ? (s.length > 1 && s.sort(function(d, x) {
|
|
146
|
+
var g = d.x - e.x, k = d.y - e.y, H = Math.sqrt(g * g + k * k), N = x.x - e.x, B = x.y - e.y, X = Math.sqrt(N * N + B * B);
|
|
147
|
+
return H < X ? -1 : H === X ? 0 : 1;
|
|
148
|
+
}), s[0]) : r;
|
|
149
|
+
}
|
|
150
|
+
const vt = (r, t) => {
|
|
151
|
+
var e = r.x, l = r.y, a = t.x - e, s = t.y - l, i = r.width / 2, n = r.height / 2, c, o;
|
|
152
|
+
return Math.abs(s) * i > Math.abs(a) * n ? (s < 0 && (n = -n), c = s === 0 ? 0 : n * a / s, o = n) : (a < 0 && (i = -i), c = i, o = a === 0 ? 0 : i * s / a), { x: e + c, y: l + o };
|
|
153
|
+
}, Lt = vt, u = {
|
|
154
|
+
node: ut,
|
|
155
|
+
circle: wt,
|
|
156
|
+
ellipse: tt,
|
|
157
|
+
polygon: kt,
|
|
158
|
+
rect: Lt
|
|
159
|
+
}, St = (r, t) => {
|
|
160
|
+
t.useHtmlLabels || w().flowchart.htmlLabels || (t.centerLabel = !0);
|
|
161
|
+
const { shapeSvg: l, bbox: a, halfPadding: s } = S(r, t, "node " + t.classes, !0);
|
|
162
|
+
y.info("Classes = ", t.classes);
|
|
163
|
+
const i = l.insert("rect", ":first-child");
|
|
164
|
+
return i.attr("rx", t.rx).attr("ry", t.ry).attr("x", -a.width / 2 - s).attr("y", -a.height / 2 - s).attr("width", a.width + t.padding).attr("height", a.height + t.padding), m(t, i), t.intersect = function(n) {
|
|
165
|
+
return u.rect(t, n);
|
|
166
|
+
}, l;
|
|
167
|
+
}, Et = St, J = (r, t) => {
|
|
168
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = a + s, n = [
|
|
169
|
+
{ x: i / 2, y: 0 },
|
|
170
|
+
{ x: i, y: -i / 2 },
|
|
171
|
+
{ x: i / 2, y: -i },
|
|
172
|
+
{ x: 0, y: -i / 2 }
|
|
173
|
+
];
|
|
174
|
+
y.info("Question main (Circle)");
|
|
175
|
+
const c = I(e, i, i, n);
|
|
176
|
+
return c.attr("style", t.style), m(t, c), t.intersect = function(o) {
|
|
177
|
+
return y.warn("Intersect called"), u.polygon(t, n, o);
|
|
178
|
+
}, e;
|
|
179
|
+
}, Bt = (r, t) => {
|
|
180
|
+
const e = r.insert("g").attr("class", "node default").attr("id", t.domId || t.id), l = 28, a = [
|
|
181
|
+
{ x: 0, y: l / 2 },
|
|
182
|
+
{ x: l / 2, y: 0 },
|
|
183
|
+
{ x: 0, y: -l / 2 },
|
|
184
|
+
{ x: -l / 2, y: 0 }
|
|
185
|
+
];
|
|
186
|
+
return e.insert("polygon", ":first-child").attr(
|
|
187
|
+
"points",
|
|
188
|
+
a.map(function(i) {
|
|
189
|
+
return i.x + "," + i.y;
|
|
190
|
+
}).join(" ")
|
|
191
|
+
).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(i) {
|
|
192
|
+
return u.circle(t, 14, i);
|
|
193
|
+
}, e;
|
|
194
|
+
}, Mt = (r, t) => {
|
|
195
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = 4, s = l.height + t.padding, i = s / a, n = l.width + 2 * i + t.padding, c = [
|
|
196
|
+
{ x: i, y: 0 },
|
|
197
|
+
{ x: n - i, y: 0 },
|
|
198
|
+
{ x: n, y: -s / 2 },
|
|
199
|
+
{ x: n - i, y: -s },
|
|
200
|
+
{ x: i, y: -s },
|
|
201
|
+
{ x: 0, y: -s / 2 }
|
|
202
|
+
], o = I(e, n, s, c);
|
|
203
|
+
return o.attr("style", t.style), m(t, o), t.intersect = function(h) {
|
|
204
|
+
return u.polygon(t, c, h);
|
|
205
|
+
}, e;
|
|
206
|
+
}, Ct = (r, t) => {
|
|
207
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
208
|
+
{ x: -s / 2, y: 0 },
|
|
209
|
+
{ x: a, y: 0 },
|
|
210
|
+
{ x: a, y: -s },
|
|
211
|
+
{ x: -s / 2, y: -s },
|
|
212
|
+
{ x: 0, y: -s / 2 }
|
|
213
|
+
];
|
|
214
|
+
return I(e, a, s, i).attr("style", t.style), t.width = a + s, t.height = s, t.intersect = function(c) {
|
|
215
|
+
return u.polygon(t, i, c);
|
|
216
|
+
}, e;
|
|
217
|
+
}, Tt = (r, t) => {
|
|
218
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
219
|
+
{ x: -2 * s / 6, y: 0 },
|
|
220
|
+
{ x: a - s / 6, y: 0 },
|
|
221
|
+
{ x: a + 2 * s / 6, y: -s },
|
|
222
|
+
{ x: s / 6, y: -s }
|
|
223
|
+
], n = I(e, a, s, i);
|
|
224
|
+
return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
|
|
225
|
+
return u.polygon(t, i, c);
|
|
226
|
+
}, e;
|
|
227
|
+
}, Rt = (r, t) => {
|
|
228
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
229
|
+
{ x: 2 * s / 6, y: 0 },
|
|
230
|
+
{ x: a + s / 6, y: 0 },
|
|
231
|
+
{ x: a - 2 * s / 6, y: -s },
|
|
232
|
+
{ x: -s / 6, y: -s }
|
|
233
|
+
], n = I(e, a, s, i);
|
|
234
|
+
return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
|
|
235
|
+
return u.polygon(t, i, c);
|
|
236
|
+
}, e;
|
|
237
|
+
}, Ht = (r, t) => {
|
|
238
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
239
|
+
{ x: -2 * s / 6, y: 0 },
|
|
240
|
+
{ x: a + 2 * s / 6, y: 0 },
|
|
241
|
+
{ x: a - s / 6, y: -s },
|
|
242
|
+
{ x: s / 6, y: -s }
|
|
243
|
+
], n = I(e, a, s, i);
|
|
244
|
+
return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
|
|
245
|
+
return u.polygon(t, i, c);
|
|
246
|
+
}, e;
|
|
247
|
+
}, _t = (r, t) => {
|
|
248
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
249
|
+
{ x: s / 6, y: 0 },
|
|
250
|
+
{ x: a - s / 6, y: 0 },
|
|
251
|
+
{ x: a + 2 * s / 6, y: -s },
|
|
252
|
+
{ x: -2 * s / 6, y: -s }
|
|
253
|
+
], n = I(e, a, s, i);
|
|
254
|
+
return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
|
|
255
|
+
return u.polygon(t, i, c);
|
|
256
|
+
}, e;
|
|
257
|
+
}, It = (r, t) => {
|
|
258
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
259
|
+
{ x: 0, y: 0 },
|
|
260
|
+
{ x: a + s / 2, y: 0 },
|
|
261
|
+
{ x: a, y: -s / 2 },
|
|
262
|
+
{ x: a + s / 2, y: -s },
|
|
263
|
+
{ x: 0, y: -s }
|
|
264
|
+
], n = I(e, a, s, i);
|
|
265
|
+
return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
|
|
266
|
+
return u.polygon(t, i, c);
|
|
267
|
+
}, e;
|
|
268
|
+
}, Nt = (r, t) => {
|
|
269
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = a / 2, i = s / (2.5 + a / 50), n = l.height + i + t.padding, c = "M 0," + i + " a " + s + "," + i + " 0,0,0 " + a + " 0 a " + s + "," + i + " 0,0,0 " + -a + " 0 l 0," + n + " a " + s + "," + i + " 0,0,0 " + a + " 0 l 0," + -n, o = e.attr("label-offset-y", i).insert("path", ":first-child").attr("style", t.style).attr("d", c).attr("transform", "translate(" + -a / 2 + "," + -(n / 2 + i) + ")");
|
|
270
|
+
return m(t, o), t.intersect = function(h) {
|
|
271
|
+
const f = u.rect(t, h), b = f.x - t.x;
|
|
272
|
+
if (s != 0 && (Math.abs(b) < t.width / 2 || Math.abs(b) == t.width / 2 && Math.abs(f.y - t.y) > t.height / 2 - i)) {
|
|
273
|
+
let p = i * i * (1 - b * b / (s * s));
|
|
274
|
+
p != 0 && (p = Math.sqrt(p)), p = i - p, h.y - t.y > 0 && (p = -p), f.y += p;
|
|
275
|
+
}
|
|
276
|
+
return f;
|
|
277
|
+
}, e;
|
|
278
|
+
}, $t = (r, t) => {
|
|
279
|
+
const { shapeSvg: e, bbox: l, halfPadding: a } = S(r, t, "node " + t.classes, !0), s = e.insert("rect", ":first-child"), i = l.width + t.padding, n = l.height + t.padding;
|
|
280
|
+
if (s.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", -l.width / 2 - a).attr("y", -l.height / 2 - a).attr("width", i).attr("height", n), t.props) {
|
|
281
|
+
const c = new Set(Object.keys(t.props));
|
|
282
|
+
t.props.borders && (rt(s, t.props.borders, i, n), c.delete("borders")), c.forEach((o) => {
|
|
283
|
+
y.warn(`Unknown node property ${o}`);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return m(t, s), t.intersect = function(c) {
|
|
287
|
+
return u.rect(t, c);
|
|
288
|
+
}, e;
|
|
289
|
+
}, Wt = (r, t) => {
|
|
290
|
+
const { shapeSvg: e } = S(r, t, "label", !0);
|
|
291
|
+
y.trace("Classes = ", t.classes);
|
|
292
|
+
const l = e.insert("rect", ":first-child"), a = 0, s = 0;
|
|
293
|
+
if (l.attr("width", a).attr("height", s), e.attr("class", "label edgeLabel"), t.props) {
|
|
294
|
+
const i = new Set(Object.keys(t.props));
|
|
295
|
+
t.props.borders && (rt(l, t.props.borders, a, s), i.delete("borders")), i.forEach((n) => {
|
|
296
|
+
y.warn(`Unknown node property ${n}`);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
return m(t, l), t.intersect = function(i) {
|
|
300
|
+
return u.rect(t, i);
|
|
301
|
+
}, e;
|
|
302
|
+
};
|
|
303
|
+
function rt(r, t, e, l) {
|
|
304
|
+
const a = [], s = (n) => {
|
|
305
|
+
a.push(n, 0);
|
|
306
|
+
}, i = (n) => {
|
|
307
|
+
a.push(0, n);
|
|
308
|
+
};
|
|
309
|
+
t.includes("t") ? (y.debug("add top border"), s(e)) : i(e), t.includes("r") ? (y.debug("add right border"), s(l)) : i(l), t.includes("b") ? (y.debug("add bottom border"), s(e)) : i(e), t.includes("l") ? (y.debug("add left border"), s(l)) : i(l), r.attr("stroke-dasharray", a.join(" "));
|
|
310
|
+
}
|
|
311
|
+
const Xt = (r, t) => {
|
|
312
|
+
let e;
|
|
313
|
+
t.classes ? e = "node " + t.classes : e = "node default";
|
|
314
|
+
const l = r.insert("g").attr("class", e).attr("id", t.domId || t.id), a = l.insert("rect", ":first-child"), s = l.insert("line"), i = l.insert("g").attr("class", "label"), n = t.labelText.flat ? t.labelText.flat() : t.labelText;
|
|
315
|
+
let c = "";
|
|
316
|
+
typeof n == "object" ? c = n[0] : c = n, y.info("Label text abc79", c, n, typeof n == "object");
|
|
317
|
+
const o = i.node().appendChild(T(c, t.labelStyle, !0, !0));
|
|
318
|
+
let h = { width: 0, height: 0 };
|
|
319
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
320
|
+
const x = o.children[0], g = L(o);
|
|
321
|
+
h = x.getBoundingClientRect(), g.attr("width", h.width), g.attr("height", h.height);
|
|
322
|
+
}
|
|
323
|
+
y.info("Text 2", n);
|
|
324
|
+
const f = n.slice(1, n.length);
|
|
325
|
+
let b = o.getBBox();
|
|
326
|
+
const p = i.node().appendChild(
|
|
327
|
+
T(f.join ? f.join("<br/>") : f, t.labelStyle, !0, !0)
|
|
328
|
+
);
|
|
329
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
330
|
+
const x = p.children[0], g = L(p);
|
|
331
|
+
h = x.getBoundingClientRect(), g.attr("width", h.width), g.attr("height", h.height);
|
|
332
|
+
}
|
|
333
|
+
const d = t.padding / 2;
|
|
334
|
+
return L(p).attr(
|
|
335
|
+
"transform",
|
|
336
|
+
"translate( " + (h.width > b.width ? 0 : (b.width - h.width) / 2) + ", " + (b.height + d + 5) + ")"
|
|
337
|
+
), L(o).attr(
|
|
338
|
+
"transform",
|
|
339
|
+
"translate( " + (h.width < b.width ? 0 : -(b.width - h.width) / 2) + ", " + 0 + ")"
|
|
340
|
+
), h = i.node().getBBox(), i.attr(
|
|
341
|
+
"transform",
|
|
342
|
+
"translate(" + -h.width / 2 + ", " + (-h.height / 2 - d + 3) + ")"
|
|
343
|
+
), a.attr("class", "outer title-state").attr("x", -h.width / 2 - d).attr("y", -h.height / 2 - d).attr("width", h.width + t.padding).attr("height", h.height + t.padding), s.attr("class", "divider").attr("x1", -h.width / 2 - d).attr("x2", h.width / 2 + d).attr("y1", -h.height / 2 - d + b.height + d).attr("y2", -h.height / 2 - d + b.height + d), m(t, a), t.intersect = function(x) {
|
|
344
|
+
return u.rect(t, x);
|
|
345
|
+
}, l;
|
|
346
|
+
}, Yt = (r, t) => {
|
|
347
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.height + t.padding, s = l.width + a / 4 + t.padding, i = e.insert("rect", ":first-child").attr("style", t.style).attr("rx", a / 2).attr("ry", a / 2).attr("x", -s / 2).attr("y", -a / 2).attr("width", s).attr("height", a);
|
|
348
|
+
return m(t, i), t.intersect = function(n) {
|
|
349
|
+
return u.rect(t, n);
|
|
350
|
+
}, e;
|
|
351
|
+
}, Ut = (r, t) => {
|
|
352
|
+
const { shapeSvg: e, bbox: l, halfPadding: a } = S(r, t, void 0, !0), s = e.insert("circle", ":first-child");
|
|
353
|
+
return s.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", l.width / 2 + a).attr("width", l.width + t.padding).attr("height", l.height + t.padding), y.info("Circle main"), m(t, s), t.intersect = function(i) {
|
|
354
|
+
return y.info("Circle intersect", t, l.width / 2 + a, i), u.circle(t, l.width / 2 + a, i);
|
|
355
|
+
}, e;
|
|
356
|
+
}, At = (r, t) => {
|
|
357
|
+
const { shapeSvg: e, bbox: l, halfPadding: a } = S(r, t, void 0, !0), s = 5, i = e.insert("g", ":first-child"), n = i.insert("circle"), c = i.insert("circle");
|
|
358
|
+
return n.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", l.width / 2 + a + s).attr("width", l.width + t.padding + s * 2).attr("height", l.height + t.padding + s * 2), c.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", l.width / 2 + a).attr("width", l.width + t.padding).attr("height", l.height + t.padding), y.info("DoubleCircle main"), m(t, n), t.intersect = function(o) {
|
|
359
|
+
return y.info("DoubleCircle intersect", t, l.width / 2 + a + s, o), u.circle(t, l.width / 2 + a + s, o);
|
|
360
|
+
}, e;
|
|
361
|
+
}, Ot = (r, t) => {
|
|
362
|
+
const { shapeSvg: e, bbox: l } = S(r, t, void 0, !0), a = l.width + t.padding, s = l.height + t.padding, i = [
|
|
363
|
+
{ x: 0, y: 0 },
|
|
364
|
+
{ x: a, y: 0 },
|
|
365
|
+
{ x: a, y: -s },
|
|
366
|
+
{ x: 0, y: -s },
|
|
367
|
+
{ x: 0, y: 0 },
|
|
368
|
+
{ x: -8, y: 0 },
|
|
369
|
+
{ x: a + 8, y: 0 },
|
|
370
|
+
{ x: a + 8, y: -s },
|
|
371
|
+
{ x: -8, y: -s },
|
|
372
|
+
{ x: -8, y: 0 }
|
|
373
|
+
], n = I(e, a, s, i);
|
|
374
|
+
return n.attr("style", t.style), m(t, n), t.intersect = function(c) {
|
|
375
|
+
return u.polygon(t, i, c);
|
|
376
|
+
}, e;
|
|
377
|
+
}, jt = (r, t) => {
|
|
378
|
+
const e = r.insert("g").attr("class", "node default").attr("id", t.domId || t.id), l = e.insert("circle", ":first-child");
|
|
379
|
+
return l.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), m(t, l), t.intersect = function(a) {
|
|
380
|
+
return u.circle(t, 7, a);
|
|
381
|
+
}, e;
|
|
382
|
+
}, F = (r, t, e) => {
|
|
383
|
+
const l = r.insert("g").attr("class", "node default").attr("id", t.domId || t.id);
|
|
384
|
+
let a = 70, s = 10;
|
|
385
|
+
e === "LR" && (a = 10, s = 70);
|
|
386
|
+
const i = l.append("rect").attr("x", -1 * a / 2).attr("y", -1 * s / 2).attr("width", a).attr("height", s).attr("class", "fork-join");
|
|
387
|
+
return m(t, i), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(n) {
|
|
388
|
+
return u.rect(t, n);
|
|
389
|
+
}, l;
|
|
390
|
+
}, Dt = (r, t) => {
|
|
391
|
+
const e = r.insert("g").attr("class", "node default").attr("id", t.domId || t.id), l = e.insert("circle", ":first-child"), a = e.insert("circle", ":first-child");
|
|
392
|
+
return a.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), l.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), m(t, a), t.intersect = function(s) {
|
|
393
|
+
return u.circle(t, 7, s);
|
|
394
|
+
}, e;
|
|
395
|
+
}, Zt = (r, t) => {
|
|
396
|
+
const e = t.padding / 2, l = 4, a = 8;
|
|
397
|
+
let s;
|
|
398
|
+
t.classes ? s = "node " + t.classes : s = "node default";
|
|
399
|
+
const i = r.insert("g").attr("class", s).attr("id", t.domId || t.id), n = i.insert("rect", ":first-child"), c = i.insert("line"), o = i.insert("line");
|
|
400
|
+
let h = 0, f = l;
|
|
401
|
+
const b = i.insert("g").attr("class", "label");
|
|
402
|
+
let p = 0;
|
|
403
|
+
const d = t.classData.annotations && t.classData.annotations[0], x = t.classData.annotations[0] ? "\xAB" + t.classData.annotations[0] + "\xBB" : "", g = b.node().appendChild(T(x, t.labelStyle, !0, !0));
|
|
404
|
+
let k = g.getBBox();
|
|
405
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
406
|
+
const E = g.children[0], M = L(g);
|
|
407
|
+
k = E.getBoundingClientRect(), M.attr("width", k.width), M.attr("height", k.height);
|
|
408
|
+
}
|
|
409
|
+
t.classData.annotations[0] && (f += k.height + l, h += k.width);
|
|
410
|
+
let H = t.classData.label;
|
|
411
|
+
t.classData.type !== void 0 && t.classData.type !== "" && (w().flowchart.htmlLabels ? H += "<" + t.classData.type + ">" : H += "<" + t.classData.type + ">");
|
|
412
|
+
const N = b.node().appendChild(T(H, t.labelStyle, !0, !0));
|
|
413
|
+
L(N).attr("class", "classTitle");
|
|
414
|
+
let B = N.getBBox();
|
|
415
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
416
|
+
const E = N.children[0], M = L(N);
|
|
417
|
+
B = E.getBoundingClientRect(), M.attr("width", B.width), M.attr("height", B.height);
|
|
418
|
+
}
|
|
419
|
+
f += B.height + l, B.width > h && (h = B.width);
|
|
420
|
+
const X = [];
|
|
421
|
+
t.classData.members.forEach((E) => {
|
|
422
|
+
const M = V(E);
|
|
423
|
+
let $ = M.displayText;
|
|
424
|
+
w().flowchart.htmlLabels && ($ = $.replace(/</g, "<").replace(/>/g, ">"));
|
|
425
|
+
const _ = b.node().appendChild(
|
|
426
|
+
T(
|
|
427
|
+
$,
|
|
428
|
+
M.cssStyle ? M.cssStyle : t.labelStyle,
|
|
429
|
+
!0,
|
|
430
|
+
!0
|
|
431
|
+
)
|
|
432
|
+
);
|
|
433
|
+
let C = _.getBBox();
|
|
434
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
435
|
+
const j = _.children[0], Y = L(_);
|
|
436
|
+
C = j.getBoundingClientRect(), Y.attr("width", C.width), Y.attr("height", C.height);
|
|
437
|
+
}
|
|
438
|
+
C.width > h && (h = C.width), f += C.height + l, X.push(_);
|
|
439
|
+
}), f += a;
|
|
440
|
+
const Z = [];
|
|
441
|
+
if (t.classData.methods.forEach((E) => {
|
|
442
|
+
const M = V(E);
|
|
443
|
+
let $ = M.displayText;
|
|
444
|
+
w().flowchart.htmlLabels && ($ = $.replace(/</g, "<").replace(/>/g, ">"));
|
|
445
|
+
const _ = b.node().appendChild(
|
|
446
|
+
T(
|
|
447
|
+
$,
|
|
448
|
+
M.cssStyle ? M.cssStyle : t.labelStyle,
|
|
449
|
+
!0,
|
|
450
|
+
!0
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
let C = _.getBBox();
|
|
454
|
+
if (R(w().flowchart.htmlLabels)) {
|
|
455
|
+
const j = _.children[0], Y = L(_);
|
|
456
|
+
C = j.getBoundingClientRect(), Y.attr("width", C.width), Y.attr("height", C.height);
|
|
457
|
+
}
|
|
458
|
+
C.width > h && (h = C.width), f += C.height + l, Z.push(_);
|
|
459
|
+
}), f += a, d) {
|
|
460
|
+
let E = (h - k.width) / 2;
|
|
461
|
+
L(g).attr(
|
|
462
|
+
"transform",
|
|
463
|
+
"translate( " + (-1 * h / 2 + E) + ", " + -1 * f / 2 + ")"
|
|
464
|
+
), p = k.height + l;
|
|
465
|
+
}
|
|
466
|
+
let at = (h - B.width) / 2;
|
|
467
|
+
return L(N).attr(
|
|
468
|
+
"transform",
|
|
469
|
+
"translate( " + (-1 * h / 2 + at) + ", " + (-1 * f / 2 + p) + ")"
|
|
470
|
+
), p += B.height + l, c.attr("class", "divider").attr("x1", -h / 2 - e).attr("x2", h / 2 + e).attr("y1", -f / 2 - e + a + p).attr("y2", -f / 2 - e + a + p), p += a, X.forEach((E) => {
|
|
471
|
+
L(E).attr(
|
|
472
|
+
"transform",
|
|
473
|
+
"translate( " + -h / 2 + ", " + (-1 * f / 2 + p + a / 2) + ")"
|
|
474
|
+
), p += B.height + l;
|
|
475
|
+
}), p += a, o.attr("class", "divider").attr("x1", -h / 2 - e).attr("x2", h / 2 + e).attr("y1", -f / 2 - e + a + p).attr("y2", -f / 2 - e + a + p), p += a, Z.forEach((E) => {
|
|
476
|
+
L(E).attr(
|
|
477
|
+
"transform",
|
|
478
|
+
"translate( " + -h / 2 + ", " + (-1 * f / 2 + p) + ")"
|
|
479
|
+
), p += B.height + l;
|
|
480
|
+
}), n.attr("class", "outer title-state").attr("x", -h / 2 - e).attr("y", -(f / 2) - e).attr("width", h + t.padding).attr("height", f + t.padding), m(t, n), t.intersect = function(E) {
|
|
481
|
+
return u.rect(t, E);
|
|
482
|
+
}, i;
|
|
483
|
+
}, K = {
|
|
484
|
+
rhombus: J,
|
|
485
|
+
question: J,
|
|
486
|
+
rect: $t,
|
|
487
|
+
labelRect: Wt,
|
|
488
|
+
rectWithTitle: Xt,
|
|
489
|
+
choice: Bt,
|
|
490
|
+
circle: Ut,
|
|
491
|
+
doublecircle: At,
|
|
492
|
+
stadium: Yt,
|
|
493
|
+
hexagon: Mt,
|
|
494
|
+
rect_left_inv_arrow: Ct,
|
|
495
|
+
lean_right: Tt,
|
|
496
|
+
lean_left: Rt,
|
|
497
|
+
trapezoid: Ht,
|
|
498
|
+
inv_trapezoid: _t,
|
|
499
|
+
rect_right_inv_arrow: It,
|
|
500
|
+
cylinder: Nt,
|
|
501
|
+
start: jt,
|
|
502
|
+
end: Dt,
|
|
503
|
+
note: Et,
|
|
504
|
+
subroutine: Ot,
|
|
505
|
+
fork: F,
|
|
506
|
+
join: F,
|
|
507
|
+
class_box: Zt
|
|
508
|
+
};
|
|
509
|
+
let W = {};
|
|
510
|
+
const Gt = (r, t, e) => {
|
|
511
|
+
let l, a;
|
|
512
|
+
if (t.link) {
|
|
513
|
+
let s;
|
|
514
|
+
w().securityLevel === "sandbox" ? s = "_top" : t.linkTarget && (s = t.linkTarget || "_blank"), l = r.insert("svg:a").attr("xlink:href", t.link).attr("target", s), a = K[t.shape](l, t, e);
|
|
515
|
+
} else
|
|
516
|
+
a = K[t.shape](r, t, e), l = a;
|
|
517
|
+
return t.tooltip && a.attr("title", t.tooltip), t.class && a.attr("class", "node default " + t.class), W[t.id] = l, t.haveCallback && W[t.id].attr("class", W[t.id].attr("class") + " clickable"), l;
|
|
518
|
+
}, Pt = (r, t) => {
|
|
519
|
+
W[t.id] = r;
|
|
520
|
+
}, tr = () => {
|
|
521
|
+
W = {};
|
|
522
|
+
}, rr = (r) => {
|
|
523
|
+
const t = W[r.id];
|
|
524
|
+
y.trace(
|
|
525
|
+
"Transforming node",
|
|
526
|
+
r.diff,
|
|
527
|
+
r,
|
|
528
|
+
"translate(" + (r.x - r.width / 2 - 5) + ", " + r.width / 2 + ")"
|
|
529
|
+
);
|
|
530
|
+
const e = 8, l = r.diff || 0;
|
|
531
|
+
return r.clusterNode ? t.attr(
|
|
532
|
+
"transform",
|
|
533
|
+
"translate(" + (r.x + l - r.width / 2) + ", " + (r.y - r.height / 2 - e) + ")"
|
|
534
|
+
) : t.attr("transform", "translate(" + r.x + ", " + r.y + ")"), l;
|
|
535
|
+
};
|
|
536
|
+
let O = {}, v = {};
|
|
537
|
+
const ar = () => {
|
|
538
|
+
O = {}, v = {};
|
|
539
|
+
}, er = (r, t) => {
|
|
540
|
+
const e = R(w().flowchart.htmlLabels), l = t.labelType === "markdown" ? P(r, t.label, {
|
|
541
|
+
style: t.labelStyle,
|
|
542
|
+
useHtmlLabels: e,
|
|
543
|
+
addSvgBackground: !0
|
|
544
|
+
}) : T(t.label, t.labelStyle);
|
|
545
|
+
y.info("abc82", t, t.labelType);
|
|
546
|
+
const a = r.insert("g").attr("class", "edgeLabel"), s = a.insert("g").attr("class", "label");
|
|
547
|
+
s.node().appendChild(l);
|
|
548
|
+
let i = l.getBBox();
|
|
549
|
+
if (e) {
|
|
550
|
+
const c = l.children[0], o = L(l);
|
|
551
|
+
i = c.getBoundingClientRect(), o.attr("width", i.width), o.attr("height", i.height);
|
|
552
|
+
}
|
|
553
|
+
s.attr("transform", "translate(" + -i.width / 2 + ", " + -i.height / 2 + ")"), O[t.id] = a, t.width = i.width, t.height = i.height;
|
|
554
|
+
let n;
|
|
555
|
+
if (t.startLabelLeft) {
|
|
556
|
+
const c = T(t.startLabelLeft, t.labelStyle), o = r.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
|
|
557
|
+
n = h.node().appendChild(c);
|
|
558
|
+
const f = c.getBBox();
|
|
559
|
+
h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), v[t.id] || (v[t.id] = {}), v[t.id].startLeft = o, A(n, t.startLabelLeft);
|
|
560
|
+
}
|
|
561
|
+
if (t.startLabelRight) {
|
|
562
|
+
const c = T(t.startLabelRight, t.labelStyle), o = r.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
|
|
563
|
+
n = o.node().appendChild(c), h.node().appendChild(c);
|
|
564
|
+
const f = c.getBBox();
|
|
565
|
+
h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), v[t.id] || (v[t.id] = {}), v[t.id].startRight = o, A(n, t.startLabelRight);
|
|
566
|
+
}
|
|
567
|
+
if (t.endLabelLeft) {
|
|
568
|
+
const c = T(t.endLabelLeft, t.labelStyle), o = r.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
|
|
569
|
+
n = h.node().appendChild(c);
|
|
570
|
+
const f = c.getBBox();
|
|
571
|
+
h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), o.node().appendChild(c), v[t.id] || (v[t.id] = {}), v[t.id].endLeft = o, A(n, t.endLabelLeft);
|
|
572
|
+
}
|
|
573
|
+
if (t.endLabelRight) {
|
|
574
|
+
const c = T(t.endLabelRight, t.labelStyle), o = r.insert("g").attr("class", "edgeTerminals"), h = o.insert("g").attr("class", "inner");
|
|
575
|
+
n = h.node().appendChild(c);
|
|
576
|
+
const f = c.getBBox();
|
|
577
|
+
h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), o.node().appendChild(c), v[t.id] || (v[t.id] = {}), v[t.id].endRight = o, A(n, t.endLabelRight);
|
|
578
|
+
}
|
|
579
|
+
return l;
|
|
580
|
+
};
|
|
581
|
+
function A(r, t) {
|
|
582
|
+
w().flowchart.htmlLabels && r && (r.style.width = t.length * 9 + "px", r.style.height = "12px");
|
|
583
|
+
}
|
|
584
|
+
const sr = (r, t) => {
|
|
585
|
+
y.info("Moving label abc78 ", r.id, r.label, O[r.id]);
|
|
586
|
+
let e = t.updatedPath ? t.updatedPath : t.originalPath;
|
|
587
|
+
if (r.label) {
|
|
588
|
+
const l = O[r.id];
|
|
589
|
+
let a = r.x, s = r.y;
|
|
590
|
+
if (e) {
|
|
591
|
+
const i = U.calcLabelPosition(e);
|
|
592
|
+
y.info(
|
|
593
|
+
"Moving label " + r.label + " from (",
|
|
594
|
+
a,
|
|
595
|
+
",",
|
|
596
|
+
s,
|
|
597
|
+
") to (",
|
|
598
|
+
i.x,
|
|
599
|
+
",",
|
|
600
|
+
i.y,
|
|
601
|
+
") abc78"
|
|
602
|
+
), t.updatedPath && (a = i.x, s = i.y);
|
|
603
|
+
}
|
|
604
|
+
l.attr("transform", "translate(" + a + ", " + s + ")");
|
|
605
|
+
}
|
|
606
|
+
if (r.startLabelLeft) {
|
|
607
|
+
const l = v[r.id].startLeft;
|
|
608
|
+
let a = r.x, s = r.y;
|
|
609
|
+
if (e) {
|
|
610
|
+
const i = U.calcTerminalLabelPosition(r.arrowTypeStart ? 10 : 0, "start_left", e);
|
|
611
|
+
a = i.x, s = i.y;
|
|
612
|
+
}
|
|
613
|
+
l.attr("transform", "translate(" + a + ", " + s + ")");
|
|
614
|
+
}
|
|
615
|
+
if (r.startLabelRight) {
|
|
616
|
+
const l = v[r.id].startRight;
|
|
617
|
+
let a = r.x, s = r.y;
|
|
618
|
+
if (e) {
|
|
619
|
+
const i = U.calcTerminalLabelPosition(
|
|
620
|
+
r.arrowTypeStart ? 10 : 0,
|
|
621
|
+
"start_right",
|
|
622
|
+
e
|
|
623
|
+
);
|
|
624
|
+
a = i.x, s = i.y;
|
|
625
|
+
}
|
|
626
|
+
l.attr("transform", "translate(" + a + ", " + s + ")");
|
|
627
|
+
}
|
|
628
|
+
if (r.endLabelLeft) {
|
|
629
|
+
const l = v[r.id].endLeft;
|
|
630
|
+
let a = r.x, s = r.y;
|
|
631
|
+
if (e) {
|
|
632
|
+
const i = U.calcTerminalLabelPosition(r.arrowTypeEnd ? 10 : 0, "end_left", e);
|
|
633
|
+
a = i.x, s = i.y;
|
|
634
|
+
}
|
|
635
|
+
l.attr("transform", "translate(" + a + ", " + s + ")");
|
|
636
|
+
}
|
|
637
|
+
if (r.endLabelRight) {
|
|
638
|
+
const l = v[r.id].endRight;
|
|
639
|
+
let a = r.x, s = r.y;
|
|
640
|
+
if (e) {
|
|
641
|
+
const i = U.calcTerminalLabelPosition(r.arrowTypeEnd ? 10 : 0, "end_right", e);
|
|
642
|
+
a = i.x, s = i.y;
|
|
643
|
+
}
|
|
644
|
+
l.attr("transform", "translate(" + a + ", " + s + ")");
|
|
645
|
+
}
|
|
646
|
+
}, zt = (r, t) => {
|
|
647
|
+
const e = r.x, l = r.y, a = Math.abs(t.x - e), s = Math.abs(t.y - l), i = r.width / 2, n = r.height / 2;
|
|
648
|
+
return a >= i || s >= n;
|
|
649
|
+
}, Qt = (r, t, e) => {
|
|
650
|
+
y.warn(`intersection calc abc89:
|
|
651
|
+
outsidePoint: ${JSON.stringify(t)}
|
|
652
|
+
insidePoint : ${JSON.stringify(e)}
|
|
653
|
+
node : x:${r.x} y:${r.y} w:${r.width} h:${r.height}`);
|
|
654
|
+
const l = r.x, a = r.y, s = Math.abs(l - e.x), i = r.width / 2;
|
|
655
|
+
let n = e.x < t.x ? i - s : i + s;
|
|
656
|
+
const c = r.height / 2, o = Math.abs(t.y - e.y), h = Math.abs(t.x - e.x);
|
|
657
|
+
if (Math.abs(a - t.y) * i > Math.abs(l - t.x) * c) {
|
|
658
|
+
let f = e.y < t.y ? t.y - c - a : a - c - t.y;
|
|
659
|
+
n = h * f / o;
|
|
660
|
+
const b = {
|
|
661
|
+
x: e.x < t.x ? e.x + n : e.x - h + n,
|
|
662
|
+
y: e.y < t.y ? e.y + o - f : e.y - o + f
|
|
663
|
+
};
|
|
664
|
+
return n === 0 && (b.x = t.x, b.y = t.y), h === 0 && (b.x = t.x), o === 0 && (b.y = t.y), y.warn(`abc89 topp/bott calc, Q ${o}, q ${f}, R ${h}, r ${n}`, b), b;
|
|
665
|
+
} else {
|
|
666
|
+
e.x < t.x ? n = t.x - i - l : n = l - i - t.x;
|
|
667
|
+
let f = o * n / h, b = e.x < t.x ? e.x + h - n : e.x - h + n, p = e.y < t.y ? e.y + f : e.y - f;
|
|
668
|
+
return y.warn(`sides calc abc89, Q ${o}, q ${f}, R ${h}, r ${n}`, { _x: b, _y: p }), n === 0 && (b = t.x, p = t.y), h === 0 && (b = t.x), o === 0 && (p = t.y), { x: b, y: p };
|
|
669
|
+
}
|
|
670
|
+
}, G = (r, t) => {
|
|
671
|
+
y.warn("abc88 cutPathAtIntersect", r, t);
|
|
672
|
+
let e = [], l = r[0], a = !1;
|
|
673
|
+
return r.forEach((s) => {
|
|
674
|
+
if (y.info("abc88 checking point", s, t), !zt(t, s) && !a) {
|
|
675
|
+
const i = Qt(t, l, s);
|
|
676
|
+
y.warn("abc88 inside", s, l, i), y.warn("abc88 intersection", i);
|
|
677
|
+
let n = !1;
|
|
678
|
+
e.forEach((c) => {
|
|
679
|
+
n = n || c.x === i.x && c.y === i.y;
|
|
680
|
+
}), e.some((c) => c.x === i.x && c.y === i.y) ? y.warn("abc88 no intersect", i, e) : e.push(i), a = !0;
|
|
681
|
+
} else
|
|
682
|
+
y.warn("abc88 outside", s, l), l = s, a || e.push(s);
|
|
683
|
+
}), y.warn("abc88 returning points", e), e;
|
|
684
|
+
}, ir = function(r, t, e, l, a, s) {
|
|
685
|
+
let i = e.points, n = !1;
|
|
686
|
+
const c = s.node(t.v);
|
|
687
|
+
var o = s.node(t.w);
|
|
688
|
+
y.info("abc88 InsertEdge: ", e), o.intersect && c.intersect && (i = i.slice(1, e.points.length - 1), i.unshift(c.intersect(i[0])), y.info(
|
|
689
|
+
"Last point",
|
|
690
|
+
i[i.length - 1],
|
|
691
|
+
o,
|
|
692
|
+
o.intersect(i[i.length - 1])
|
|
693
|
+
), i.push(o.intersect(i[i.length - 1]))), e.toCluster && (y.info("to cluster abc88", l[e.toCluster]), i = G(e.points, l[e.toCluster].node), n = !0), e.fromCluster && (y.info("from cluster abc88", l[e.fromCluster]), i = G(i.reverse(), l[e.fromCluster].node).reverse(), n = !0);
|
|
694
|
+
const h = i.filter((k) => !Number.isNaN(k.y));
|
|
695
|
+
let f;
|
|
696
|
+
a === "graph" || a === "flowchart" ? f = e.curve || Q : f = Q;
|
|
697
|
+
const b = et().x(function(k) {
|
|
698
|
+
return k.x;
|
|
699
|
+
}).y(function(k) {
|
|
700
|
+
return k.y;
|
|
701
|
+
}).curve(f);
|
|
702
|
+
let p;
|
|
703
|
+
switch (e.thickness) {
|
|
704
|
+
case "normal":
|
|
705
|
+
p = "edge-thickness-normal";
|
|
706
|
+
break;
|
|
707
|
+
case "thick":
|
|
708
|
+
p = "edge-thickness-thick";
|
|
709
|
+
break;
|
|
710
|
+
case "invisible":
|
|
711
|
+
p = "edge-thickness-thick";
|
|
712
|
+
break;
|
|
713
|
+
default:
|
|
714
|
+
p = "";
|
|
715
|
+
}
|
|
716
|
+
switch (e.pattern) {
|
|
717
|
+
case "solid":
|
|
718
|
+
p += " edge-pattern-solid";
|
|
719
|
+
break;
|
|
720
|
+
case "dotted":
|
|
721
|
+
p += " edge-pattern-dotted";
|
|
722
|
+
break;
|
|
723
|
+
case "dashed":
|
|
724
|
+
p += " edge-pattern-dashed";
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
const d = r.append("path").attr("d", b(h)).attr("id", e.id).attr("class", " " + p + (e.classes ? " " + e.classes : "")).attr("style", e.style);
|
|
728
|
+
let x = "";
|
|
729
|
+
switch ((w().flowchart.arrowMarkerAbsolute || w().state.arrowMarkerAbsolute) && (x = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, x = x.replace(/\(/g, "\\("), x = x.replace(/\)/g, "\\)")), y.info("arrowTypeStart", e.arrowTypeStart), y.info("arrowTypeEnd", e.arrowTypeEnd), e.arrowTypeStart) {
|
|
730
|
+
case "arrow_cross":
|
|
731
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-crossStart)");
|
|
732
|
+
break;
|
|
733
|
+
case "arrow_point":
|
|
734
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-pointStart)");
|
|
735
|
+
break;
|
|
736
|
+
case "arrow_barb":
|
|
737
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-barbStart)");
|
|
738
|
+
break;
|
|
739
|
+
case "arrow_circle":
|
|
740
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-circleStart)");
|
|
741
|
+
break;
|
|
742
|
+
case "aggregation":
|
|
743
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-aggregationStart)");
|
|
744
|
+
break;
|
|
745
|
+
case "extension":
|
|
746
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-extensionStart)");
|
|
747
|
+
break;
|
|
748
|
+
case "composition":
|
|
749
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-compositionStart)");
|
|
750
|
+
break;
|
|
751
|
+
case "dependency":
|
|
752
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-dependencyStart)");
|
|
753
|
+
break;
|
|
754
|
+
case "lollipop":
|
|
755
|
+
d.attr("marker-start", "url(" + x + "#" + a + "-lollipopStart)");
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
switch (e.arrowTypeEnd) {
|
|
759
|
+
case "arrow_cross":
|
|
760
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-crossEnd)");
|
|
761
|
+
break;
|
|
762
|
+
case "arrow_point":
|
|
763
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-pointEnd)");
|
|
764
|
+
break;
|
|
765
|
+
case "arrow_barb":
|
|
766
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-barbEnd)");
|
|
767
|
+
break;
|
|
768
|
+
case "arrow_circle":
|
|
769
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-circleEnd)");
|
|
770
|
+
break;
|
|
771
|
+
case "aggregation":
|
|
772
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-aggregationEnd)");
|
|
773
|
+
break;
|
|
774
|
+
case "extension":
|
|
775
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-extensionEnd)");
|
|
776
|
+
break;
|
|
777
|
+
case "composition":
|
|
778
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-compositionEnd)");
|
|
779
|
+
break;
|
|
780
|
+
case "dependency":
|
|
781
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-dependencyEnd)");
|
|
782
|
+
break;
|
|
783
|
+
case "lollipop":
|
|
784
|
+
d.attr("marker-end", "url(" + x + "#" + a + "-lollipopEnd)");
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
787
|
+
let g = {};
|
|
788
|
+
return n && (g.updatedPath = i), g.originalPath = e.points, g;
|
|
789
|
+
};
|
|
790
|
+
export {
|
|
791
|
+
Gt as a,
|
|
792
|
+
er as b,
|
|
793
|
+
ir as c,
|
|
794
|
+
sr as d,
|
|
795
|
+
tr as e,
|
|
796
|
+
ar as f,
|
|
797
|
+
T as g,
|
|
798
|
+
Lt as h,
|
|
799
|
+
Kt as i,
|
|
800
|
+
S as l,
|
|
801
|
+
rr as p,
|
|
802
|
+
Pt as s,
|
|
803
|
+
m as u
|
|
804
|
+
};
|