lowcoder-comps 0.0.29 → 0.0.31

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.
Files changed (86) hide show
  1. package/README.md +120 -0
  2. package/index.html +26 -0
  3. package/index.tsx +21 -0
  4. package/jest.config.js +6 -0
  5. package/package.json +3 -4
  6. package/src/__test__/allComp.test.tsx +61 -0
  7. package/src/app-env.d.ts +3 -0
  8. package/src/comps/calendarComp/calendarComp.tsx +633 -0
  9. package/src/comps/calendarComp/calendarConstants.tsx +1048 -0
  10. package/src/comps/calendarComp/errorBoundary.tsx +30 -0
  11. package/src/comps/chartComp/chartComp.tsx +442 -0
  12. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
  13. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
  14. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +9 -0
  15. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
  16. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
  17. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
  18. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
  19. package/src/comps/chartComp/chartConstants.tsx +299 -0
  20. package/src/comps/chartComp/chartPropertyView.tsx +235 -0
  21. package/src/comps/chartComp/chartUtils.ts +291 -0
  22. package/src/comps/chartComp/reactEcharts/core.tsx +194 -0
  23. package/src/comps/chartComp/reactEcharts/index.ts +21 -0
  24. package/src/comps/chartComp/reactEcharts/types.ts +76 -0
  25. package/src/comps/chartComp/seriesComp.tsx +119 -0
  26. package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
  27. package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
  28. package/src/comps/imageEditorComp/index.tsx +184 -0
  29. package/src/comps/mermaidComp/index.tsx +44 -0
  30. package/src/comps/mermaidComp/mermaid.tsx +29 -0
  31. package/src/global.ts +1 -0
  32. package/src/i18n/comps/index.tsx +29 -0
  33. package/src/i18n/comps/locales/en.ts +163 -0
  34. package/src/i18n/comps/locales/enObj.tsx +198 -0
  35. package/src/i18n/comps/locales/index.ts +7 -0
  36. package/src/i18n/comps/locales/types.tsx +10 -0
  37. package/src/i18n/comps/locales/zh.ts +156 -0
  38. package/src/i18n/comps/locales/zhObj.tsx +4 -0
  39. package/src/index.ts +11 -0
  40. package/tsconfig.json +22 -0
  41. package/vite.config.js +10 -0
  42. package/2085da13.js +0 -960
  43. package/250691b5.js +0 -5
  44. package/256b619e.js +0 -92
  45. package/274f545c.js +0 -881
  46. package/289305a1.js +0 -208
  47. package/2eae45c2.js +0 -34
  48. package/2ff2c7a6.js +0 -6
  49. package/2ff7471d.js +0 -9
  50. package/335b22a2.js +0 -220
  51. package/38c826fe.js +0 -1127
  52. package/44011c1d.js +0 -818
  53. package/4fc06812.js +0 -64
  54. package/56a787cf.js +0 -915
  55. package/590941ff.js +0 -86
  56. package/6341867f.js +0 -804
  57. package/657fd065.js +0 -8
  58. package/78a5e50d.js +0 -1579
  59. package/820c3641.js +0 -25
  60. package/88b4e75a.js +0 -2967
  61. package/8d999722.js +0 -1102
  62. package/92e85b65.js +0 -65
  63. package/989caea2.js +0 -505
  64. package/99b984d1.js +0 -237
  65. package/9e5f02d6.js +0 -19104
  66. package/a40faea7.js +0 -11624
  67. package/abac9104.js +0 -1536
  68. package/af2f19b3.js +0 -819
  69. package/af5ee3de.js +0 -268
  70. package/b24707c2.js +0 -48428
  71. package/b68f8b69.js +0 -1276
  72. package/ba68ba65.js +0 -391
  73. package/bafb8599.js +0 -319
  74. package/bba60c35.js +0 -2501
  75. package/bd7c2a8e.js +0 -1089
  76. package/c71dadea.js +0 -455
  77. package/d05c1762.js +0 -933
  78. package/d073ab24.js +0 -134353
  79. package/d838cd10.js +0 -769
  80. package/dc36a6eb.js +0 -796
  81. package/ed143450.js +0 -1284
  82. package/ee8ec8f2.js +0 -2284
  83. package/f6755210.js +0 -1269
  84. package/f9637058.js +0 -16
  85. package/fba4c8e4.js +0 -447
  86. package/index.js +0 -5
package/289305a1.js DELETED
@@ -1,208 +0,0 @@
1
- var B = (e, n, t) => new Promise((i, c) => {
2
- var r = (l) => {
3
- try {
4
- a(t.next(l));
5
- } catch (s) {
6
- c(s);
7
- }
8
- }, o = (l) => {
9
- try {
10
- a(t.throw(l));
11
- } catch (s) {
12
- c(s);
13
- }
14
- }, a = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, o);
15
- a((t = t.apply(e, n)).next());
16
- });
17
- import { p as Q, d as M, s as X, D as U, a as Z, S as F, b as I, c as tt } from "./2085da13.js";
18
- import { G as et } from "./274f545c.js";
19
- import { l as T, c as g, h as x, A as ot, i as st, j as w } from "./d073ab24.js";
20
- import { r as nt } from "./ba68ba65.js";
21
- import "./abac9104.js";
22
- import "./657fd065.js";
23
- import "./8d999722.js";
24
- import "./88b4e75a.js";
25
- import "./2eae45c2.js";
26
- import "./2ff2c7a6.js";
27
- import "./256b619e.js";
28
- const h = "rect", C = "rectWithTitle", it = "start", ct = "end", rt = "divider", lt = "roundedWithTitle", at = "note", dt = "noteGroup", u = "statediagram", Et = "state", St = `${u}-${Et}`, V = "transition", Tt = "note", pt = "note-edge", _t = `${V} ${pt}`, ut = `${u}-${Tt}`, Dt = "cluster", bt = `${u}-${Dt}`, ft = "cluster-alt", At = `${u}-${ft}`, Y = "parent", W = "note", ht = "state", N = "----", yt = `${N}${W}`, H = `${N}${Y}`, m = "fill:none", z = "fill: #333", j = "c", q = "text", K = "normal";
29
- let y = {}, S = 0;
30
- const gt = function(e) {
31
- const n = Object.keys(e);
32
- for (const t of n)
33
- e[t];
34
- }, $t = function(e, n) {
35
- return n.db.extract(n.db.getRootDocV2()), n.db.getClasses();
36
- };
37
- function xt(e) {
38
- return e == null ? "" : e.classes ? e.classes.join(" ") : "";
39
- }
40
- function R(e = "", n = 0, t = "", i = N) {
41
- const c = t !== null && t.length > 0 ? `${i}${t}` : "";
42
- return `${ht}-${e}${c}-${n}`;
43
- }
44
- const A = (e, n, t, i, c, r) => {
45
- const o = t.id, a = xt(i[o]);
46
- if (o !== "root") {
47
- let l = h;
48
- t.start === !0 && (l = it), t.start === !1 && (l = ct), t.type !== U && (l = t.type), y[o] || (y[o] = {
49
- id: o,
50
- shape: l,
51
- description: w.sanitizeText(o, g()),
52
- classes: `${a} ${St}`
53
- });
54
- const s = y[o];
55
- t.description && (Array.isArray(s.description) ? (s.shape = C, s.description.push(t.description)) : s.description.length > 0 ? (s.shape = C, s.description === o ? s.description = [t.description] : s.description = [s.description, t.description]) : (s.shape = h, s.description = t.description), s.description = w.sanitizeTextOrArray(s.description, g())), s.description.length === 1 && s.shape === C && (s.shape = h), !s.type && t.doc && (T.info("Setting cluster for ", o, G(t)), s.type = "group", s.dir = G(t), s.shape = t.type === Z ? rt : lt, s.classes = s.classes + " " + bt + " " + (r ? At : ""));
56
- const _ = {
57
- labelStyle: "",
58
- shape: s.shape,
59
- labelText: s.description,
60
- // typeof newNode.description === 'object'
61
- // ? newNode.description[0]
62
- // : newNode.description,
63
- classes: s.classes,
64
- style: "",
65
- //styles.style,
66
- id: o,
67
- dir: s.dir,
68
- domId: R(o, S),
69
- type: s.type,
70
- padding: 15
71
- //getConfig().flowchart.padding
72
- };
73
- if (_.centerLabel = !0, t.note) {
74
- const d = {
75
- labelStyle: "",
76
- shape: at,
77
- labelText: t.note.text,
78
- classes: ut,
79
- // useHtmlLabels: false,
80
- style: "",
81
- // styles.style,
82
- id: o + yt + "-" + S,
83
- domId: R(o, S, W),
84
- type: s.type,
85
- padding: 15
86
- //getConfig().flowchart.padding
87
- }, E = {
88
- labelStyle: "",
89
- shape: dt,
90
- labelText: t.note.text,
91
- classes: s.classes,
92
- style: "",
93
- // styles.style,
94
- id: o + H,
95
- domId: R(o, S, Y),
96
- type: "group",
97
- padding: 0
98
- //getConfig().flowchart.padding
99
- };
100
- S++;
101
- const D = o + H;
102
- e.setNode(D, E), e.setNode(d.id, d), e.setNode(o, _), e.setParent(o, D), e.setParent(d.id, D);
103
- let p = o, b = d.id;
104
- t.note.position === "left of" && (p = d.id, b = o), e.setEdge(p, b, {
105
- arrowhead: "none",
106
- arrowType: "",
107
- style: m,
108
- labelStyle: "",
109
- classes: _t,
110
- arrowheadStyle: z,
111
- labelpos: j,
112
- labelType: q,
113
- thickness: K
114
- });
115
- } else
116
- e.setNode(o, _);
117
- }
118
- n && n.id !== "root" && (T.trace("Setting node ", o, " to be child of its parent ", n.id), e.setParent(o, n.id)), t.doc && (T.trace("Adding nodes children "), Ct(e, t, t.doc, i, c, !r));
119
- }, Ct = (e, n, t, i, c, r) => {
120
- T.trace("items", t), t.forEach((o) => {
121
- switch (o.stmt) {
122
- case I:
123
- A(e, n, o, i, c, r);
124
- break;
125
- case U:
126
- A(e, n, o, i, c, r);
127
- break;
128
- case F:
129
- {
130
- A(e, n, o.state1, i, c, r), A(e, n, o.state2, i, c, r);
131
- const a = {
132
- id: "edge" + S,
133
- arrowhead: "normal",
134
- arrowTypeEnd: "arrow_barb",
135
- style: m,
136
- labelStyle: "",
137
- label: w.sanitizeText(o.description, g()),
138
- arrowheadStyle: z,
139
- labelpos: j,
140
- labelType: q,
141
- thickness: K,
142
- classes: V
143
- };
144
- e.setEdge(o.state1.id, o.state2.id, a, S), S++;
145
- }
146
- break;
147
- }
148
- });
149
- }, G = (e, n = tt) => {
150
- let t = n;
151
- if (e.doc)
152
- for (let i = 0; i < e.doc.length; i++) {
153
- const c = e.doc[i];
154
- c.stmt === "dir" && (t = c.value);
155
- }
156
- return t;
157
- }, Rt = function(e, n, t, i) {
158
- return B(this, null, function* () {
159
- T.info("Drawing state diagram (v2)", n), y = {}, i.db.getDirection();
160
- const { securityLevel: c, state: r } = g(), o = r.nodeSpacing || 50, a = r.rankSpacing || 50;
161
- T.info(i.db.getRootDocV2()), i.db.extract(i.db.getRootDocV2()), T.info(i.db.getRootDocV2());
162
- const l = i.db.getStates(), s = new et({
163
- multigraph: !0,
164
- compound: !0
165
- }).setGraph({
166
- rankdir: G(i.db.getRootDocV2()),
167
- nodesep: o,
168
- ranksep: a,
169
- marginx: 8,
170
- marginy: 8
171
- }).setDefaultEdgeLabel(function() {
172
- return {};
173
- });
174
- A(s, void 0, i.db.getRootDocV2(), l, i.db, !0);
175
- let _;
176
- c === "sandbox" && (_ = x("#i" + n));
177
- const d = c === "sandbox" ? x(_.nodes()[0].contentDocument.body) : x("body"), E = d.select(`[id="${n}"]`), D = d.select("#" + n + " g");
178
- yield nt(D, s, ["barb"], u, n);
179
- const p = 8;
180
- ot.insertTitle(E, "statediagramTitleText", r.titleTopMargin, i.db.getDiagramTitle());
181
- const b = E.node().getBBox(), L = b.width + p * 2, P = b.height + p * 2;
182
- E.attr("class", u);
183
- const O = E.node().getBBox();
184
- st(E, P, L, r.useMaxWidth);
185
- const k = `${O.x - p} ${O.y - p} ${L} ${P}`;
186
- T.debug(`viewBox ${k}`), E.attr("viewBox", k);
187
- const J = document.querySelectorAll('[id="' + n + '"] .edgeLabel .label');
188
- for (const $ of J) {
189
- const v = $.getBBox(), f = document.createElementNS("http://www.w3.org/2000/svg", h);
190
- f.setAttribute("rx", 0), f.setAttribute("ry", 0), f.setAttribute("width", v.width), f.setAttribute("height", v.height), $.insertBefore(f, $.firstChild);
191
- }
192
- });
193
- }, wt = {
194
- setConf: gt,
195
- getClasses: $t,
196
- draw: Rt
197
- }, Yt = {
198
- parser: Q,
199
- db: M,
200
- renderer: wt,
201
- styles: X,
202
- init: (e) => {
203
- e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, M.clear();
204
- }
205
- };
206
- export {
207
- Yt as diagram
208
- };
package/2eae45c2.js DELETED
@@ -1,34 +0,0 @@
1
- import { a as h } from "./2ff2c7a6.js";
2
- import { w as d, c as o } from "./256b619e.js";
3
- import { n as v } from "./d073ab24.js";
4
- function w(t) {
5
- return t[0];
6
- }
7
- function b(t) {
8
- return t[1];
9
- }
10
- function P(t, u) {
11
- var s = o(!0), i = null, l = v, r = null, m = d(e);
12
- t = typeof t == "function" ? t : t === void 0 ? w : o(t), u = typeof u == "function" ? u : u === void 0 ? b : o(u);
13
- function e(n) {
14
- var f, g = (n = h(n)).length, p, c = !1, a;
15
- for (i == null && (r = l(a = m())), f = 0; f <= g; ++f)
16
- !(f < g && s(p = n[f], f, n)) === c && ((c = !c) ? r.lineStart() : r.lineEnd()), c && r.point(+t(p, f, n), +u(p, f, n));
17
- if (a)
18
- return r = null, a + "" || null;
19
- }
20
- return e.x = function(n) {
21
- return arguments.length ? (t = typeof n == "function" ? n : o(+n), e) : t;
22
- }, e.y = function(n) {
23
- return arguments.length ? (u = typeof n == "function" ? n : o(+n), e) : u;
24
- }, e.defined = function(n) {
25
- return arguments.length ? (s = typeof n == "function" ? n : o(!!n), e) : s;
26
- }, e.curve = function(n) {
27
- return arguments.length ? (l = n, i != null && (r = l(i)), e) : l;
28
- }, e.context = function(n) {
29
- return arguments.length ? (n == null ? i = r = null : r = l(i = n), e) : i;
30
- }, e;
31
- }
32
- export {
33
- P as l
34
- };
package/2ff2c7a6.js DELETED
@@ -1,6 +0,0 @@
1
- function t(r) {
2
- return typeof r == "object" && "length" in r ? r : Array.from(r);
3
- }
4
- export {
5
- t as a
6
- };
package/2ff7471d.js DELETED
@@ -1,9 +0,0 @@
1
- function o(e) {
2
- for (var c = e.length / 6 | 0, n = new Array(c), a = 0; a < c; )
3
- n[a] = "#" + e.slice(a * 6, ++a * 6);
4
- return n;
5
- }
6
- const r = o("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
7
- export {
8
- r as s
9
- };
package/335b22a2.js DELETED
@@ -1,220 +0,0 @@
1
- import { p as A, d as S, s as G } from "./bd7c2a8e.js";
2
- import { c as v, l as y, h as B, i as W, F as $, A as M, G as I } from "./d073ab24.js";
3
- import { G as O } from "./274f545c.js";
4
- import { l as P } from "./abac9104.js";
5
- import { l as X } from "./2eae45c2.js";
6
- import "./2ff2c7a6.js";
7
- import "./256b619e.js";
8
- let H = 0;
9
- const Y = function(i, a, t, o, p) {
10
- const g = function(e) {
11
- switch (e) {
12
- case p.db.relationType.AGGREGATION:
13
- return "aggregation";
14
- case p.db.relationType.EXTENSION:
15
- return "extension";
16
- case p.db.relationType.COMPOSITION:
17
- return "composition";
18
- case p.db.relationType.DEPENDENCY:
19
- return "dependency";
20
- case p.db.relationType.LOLLIPOP:
21
- return "lollipop";
22
- }
23
- };
24
- a.points = a.points.filter((e) => !Number.isNaN(e.y));
25
- const s = a.points, c = X().x(function(e) {
26
- return e.x;
27
- }).y(function(e) {
28
- return e.y;
29
- }).curve($), n = i.append("path").attr("d", c(s)).attr("id", "edge" + H).attr("class", "relation");
30
- let r = "";
31
- o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
32
- "marker-start",
33
- "url(" + r + "#" + g(t.relation.type1) + "Start)"
34
- ), t.relation.type2 !== "none" && n.attr(
35
- "marker-end",
36
- "url(" + r + "#" + g(t.relation.type2) + "End)"
37
- );
38
- let f, h;
39
- const x = a.points.length;
40
- let b = M.calcLabelPosition(a.points);
41
- f = b.x, h = b.y;
42
- let u, m, w, k;
43
- if (x % 2 !== 0 && x > 1) {
44
- let e = M.calcCardinalityPosition(
45
- t.relation.type1 !== "none",
46
- a.points,
47
- a.points[0]
48
- ), d = M.calcCardinalityPosition(
49
- t.relation.type2 !== "none",
50
- a.points,
51
- a.points[x - 1]
52
- );
53
- y.debug("cardinality_1_point " + JSON.stringify(e)), y.debug("cardinality_2_point " + JSON.stringify(d)), u = e.x, m = e.y, w = d.x, k = d.y;
54
- }
55
- if (t.title !== void 0) {
56
- const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
57
- window.label = d;
58
- const l = d.node().getBBox();
59
- e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
60
- }
61
- y.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", u).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", k).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), H++;
62
- }, J = function(i, a, t, o) {
63
- y.debug("Rendering class ", a, t);
64
- const p = a.id, g = {
65
- id: p,
66
- label: a.id,
67
- width: 0,
68
- height: 0
69
- }, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
70
- let c;
71
- a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
72
- let n = !0;
73
- a.annotations.forEach(function(d) {
74
- const l = c.append("tspan").text("«" + d + "»");
75
- n || l.attr("dy", t.textHeight), n = !1;
76
- });
77
- let r = C(a);
78
- const f = c.append("tspan").text(r).attr("class", "title");
79
- n || f.attr("dy", t.textHeight);
80
- const h = c.node().getBBox().height;
81
- let x, b, u;
82
- if (a.members.length > 0) {
83
- x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
84
- const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
85
- n = !0, a.members.forEach(function(l) {
86
- _(d, l, n, t), n = !1;
87
- }), b = d.node().getBBox();
88
- }
89
- if (a.methods.length > 0) {
90
- u = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + b.height).attr("y2", t.padding + h + t.dividerMargin + b.height);
91
- const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + b.height + t.textHeight).attr("fill", "white").attr("class", "classText");
92
- n = !0, a.methods.forEach(function(l) {
93
- _(d, l, n, t), n = !1;
94
- });
95
- }
96
- const m = s.node().getBBox();
97
- var w = " ";
98
- a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
99
- const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
100
- return c.node().childNodes.forEach(function(d) {
101
- d.setAttribute("x", (e - d.getBBox().width) / 2);
102
- }), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), u && u.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
103
- }, C = function(i) {
104
- let a = i.id;
105
- return i.type && (a += "<" + I(i.type) + ">"), a;
106
- }, Z = function(i, a, t, o) {
107
- y.debug("Rendering note ", a, t);
108
- const p = a.id, g = {
109
- id: p,
110
- text: a.text,
111
- width: 0,
112
- height: 0
113
- }, s = i.append("g").attr("id", p).attr("class", "classGroup");
114
- let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
115
- const n = JSON.parse(`"${a.text}"`).split(`
116
- `);
117
- n.forEach(function(x) {
118
- y.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
119
- });
120
- const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
121
- "height",
122
- r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
123
- ).node().getBBox().width;
124
- return c.node().childNodes.forEach(function(x) {
125
- x.setAttribute("x", (h - x.getBBox().width) / 2);
126
- }), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
127
- }, _ = function(i, a, t, o) {
128
- const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
129
- g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
130
- }, N = {
131
- getClassTitleString: C,
132
- drawClass: J,
133
- drawEdge: Y,
134
- drawNote: Z
135
- };
136
- let T = {};
137
- const E = 20, L = function(i) {
138
- const a = Object.entries(T).find((t) => t[1].label === i);
139
- if (a)
140
- return a[0];
141
- }, R = function(i) {
142
- i.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"), i.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"), i.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"), i.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"), i.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"), i.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"), i.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"), i.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");
143
- }, F = function(i, a, t, o) {
144
- const p = v().class;
145
- T = {}, y.info("Rendering diagram " + i);
146
- const g = v().securityLevel;
147
- let s;
148
- g === "sandbox" && (s = B("#i" + a));
149
- const c = g === "sandbox" ? B(s.nodes()[0].contentDocument.body) : B("body"), n = c.select(`[id='${a}']`);
150
- R(n);
151
- const r = new O({
152
- multigraph: !0
153
- });
154
- r.setGraph({
155
- isMultiGraph: !0
156
- }), r.setDefaultEdgeLabel(function() {
157
- return {};
158
- });
159
- const f = o.db.getClasses(), h = Object.keys(f);
160
- for (const e of h) {
161
- const d = f[e], l = N.drawClass(n, d, p, o);
162
- T[l.id] = l, r.setNode(l.id, l), y.info("Org height: " + l.height);
163
- }
164
- o.db.getRelations().forEach(function(e) {
165
- y.info(
166
- // cspell:ignore tjoho
167
- "tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
168
- ), r.setEdge(
169
- L(e.id1),
170
- L(e.id2),
171
- {
172
- relation: e
173
- },
174
- e.title || "DEFAULT"
175
- );
176
- }), o.db.getNotes().forEach(function(e) {
177
- y.debug(`Adding note: ${JSON.stringify(e)}`);
178
- const d = N.drawNote(n, e, p, o);
179
- T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
180
- e.id,
181
- L(e.class),
182
- {
183
- relation: {
184
- id1: e.id,
185
- id2: e.class,
186
- relation: {
187
- type1: "none",
188
- type2: "none",
189
- lineType: 10
190
- }
191
- }
192
- },
193
- "DEFAULT"
194
- );
195
- }), P(r), r.nodes().forEach(function(e) {
196
- e !== void 0 && r.node(e) !== void 0 && (y.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
197
- "transform",
198
- "translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
199
- ));
200
- }), r.edges().forEach(function(e) {
201
- e !== void 0 && r.edge(e) !== void 0 && (y.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
202
- });
203
- const u = n.node().getBBox(), m = u.width + E * 2, w = u.height + E * 2;
204
- W(n, w, m, p.useMaxWidth);
205
- const k = `${u.x - E} ${u.y - E} ${m} ${w}`;
206
- y.debug(`viewBox ${k}`), n.attr("viewBox", k);
207
- }, U = {
208
- draw: F
209
- }, tt = {
210
- parser: A,
211
- db: S,
212
- renderer: U,
213
- styles: G,
214
- init: (i) => {
215
- i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
216
- }
217
- };
218
- export {
219
- tt as diagram
220
- };