lowcoder-comps 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +27 -0
  2. package/index.html +26 -0
  3. package/index.tsx +19 -0
  4. package/jest.config.js +6 -0
  5. package/package.json +4 -5
  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 +443 -0
  9. package/src/comps/calendarComp/calendarConstants.tsx +898 -0
  10. package/src/comps/chartComp/chartComp.tsx +356 -0
  11. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
  12. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
  13. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +9 -0
  14. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
  15. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
  16. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
  17. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
  18. package/src/comps/chartComp/chartConstants.tsx +288 -0
  19. package/src/comps/chartComp/chartPropertyView.tsx +218 -0
  20. package/src/comps/chartComp/chartUtils.ts +291 -0
  21. package/src/comps/chartComp/reactEcharts/core.tsx +194 -0
  22. package/src/comps/chartComp/reactEcharts/index.ts +21 -0
  23. package/src/comps/chartComp/reactEcharts/types.ts +76 -0
  24. package/src/comps/chartComp/seriesComp.tsx +119 -0
  25. package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
  26. package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
  27. package/src/comps/imageEditorComp/index.tsx +184 -0
  28. package/src/comps/mermaidComp/index.tsx +44 -0
  29. package/src/comps/mermaidComp/mermaid.tsx +29 -0
  30. package/src/global.ts +1 -0
  31. package/src/i18n/comps/index.tsx +29 -0
  32. package/src/i18n/comps/locales/en.ts +150 -0
  33. package/src/i18n/comps/locales/enObj.tsx +198 -0
  34. package/src/i18n/comps/locales/index.ts +7 -0
  35. package/src/i18n/comps/locales/types.tsx +10 -0
  36. package/src/i18n/comps/locales/zh.ts +145 -0
  37. package/src/i18n/comps/locales/zhObj.tsx +4 -0
  38. package/src/index.ts +11 -0
  39. package/tsconfig.json +22 -0
  40. package/vite.config.js +10 -0
  41. package/001f8b13.js +0 -326
  42. package/085bf0c2.js +0 -46688
  43. package/256b619e.js +0 -92
  44. package/29cba276.js +0 -91
  45. package/2e18581a.js +0 -451
  46. package/2ff2c7a6.js +0 -6
  47. package/340c33ea.js +0 -1602
  48. package/3ad55ad7.js +0 -607
  49. package/47b0b0ff.js +0 -70
  50. package/4a5b6fbe.js +0 -798
  51. package/4abe140e.js +0 -943
  52. package/4cf5b178.js +0 -34
  53. package/5cab7b96.js +0 -18619
  54. package/626b9013.js +0 -7
  55. package/6798500f.js +0 -793
  56. package/68b021d0.js +0 -2456
  57. package/6ab1612a.js +0 -24
  58. package/6e903063.js +0 -940
  59. package/72a7048f.js +0 -849
  60. package/7902f186.js +0 -823
  61. package/82c1c410.js +0 -86
  62. package/8517f7c1.js +0 -365
  63. package/9495ef3b.js +0 -1118
  64. package/9ea1ddd6.js +0 -447
  65. package/a01c9944.js +0 -212
  66. package/a4ce7e8a.js +0 -2827
  67. package/ad68bdd0.js +0 -236
  68. package/b499e5a9.js +0 -2103
  69. package/bdc7b18a.js +0 -1032
  70. package/be5b66cd.js +0 -832
  71. package/c4378831.js +0 -117175
  72. package/ca8f4e3f.js +0 -275
  73. package/de61c633.js +0 -2679
  74. package/e04788e2.js +0 -159
  75. package/f9637058.js +0 -16
  76. package/f9a47b7c.js +0 -985
  77. package/ff16c2ec.js +0 -1246
  78. package/index.js +0 -5
package/ca8f4e3f.js DELETED
@@ -1,275 +0,0 @@
1
- import { p as R, d as N, s as W } from "./f9a47b7c.js";
2
- import { c as t, h as H, l as b, i as v, j as L, D as U, x as C } from "./c4378831.js";
3
- import { G as A, l as F } from "./de61c633.js";
4
- import { l as $ } from "./4cf5b178.js";
5
- import "./2ff2c7a6.js";
6
- import "./256b619e.js";
7
- const O = (e) => e.append("circle").attr("class", "start-state").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit).attr("cy", t().state.padding + t().state.sizeUnit), X = (e) => e.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", t().state.textHeight).attr("class", "divider").attr("x2", t().state.textHeight * 2).attr("y1", 0).attr("y2", 0), J = (e, i) => {
8
- const o = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 2 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), c = o.node().getBBox();
9
- return e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", c.width + 2 * t().state.padding).attr("height", c.height + 2 * t().state.padding).attr("rx", t().state.radius), o;
10
- }, Y = (e, i) => {
11
- const o = function(d, m, f) {
12
- const S = d.append("tspan").attr("x", 2 * t().state.padding).text(m);
13
- f || S.attr("dy", t().state.textHeight);
14
- }, s = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 1.3 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.descriptions[0]).node().getBBox(), g = s.height, p = e.append("text").attr("x", t().state.padding).attr(
15
- "y",
16
- g + t().state.padding * 0.4 + t().state.dividerMargin + t().state.textHeight
17
- ).attr("class", "state-description");
18
- let a = !0, r = !0;
19
- i.descriptions.forEach(function(d) {
20
- a || (o(p, d, r), r = !1), a = !1;
21
- });
22
- const w = e.append("line").attr("x1", t().state.padding).attr("y1", t().state.padding + g + t().state.dividerMargin / 2).attr("y2", t().state.padding + g + t().state.dividerMargin / 2).attr("class", "descr-divider"), x = p.node().getBBox(), l = Math.max(x.width, s.width);
23
- return w.attr("x2", l + 3 * t().state.padding), e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", l + 2 * t().state.padding).attr("height", x.height + g + 2 * t().state.padding).attr("rx", t().state.radius), e;
24
- }, I = (e, i, o) => {
25
- const c = t().state.padding, s = 2 * t().state.padding, g = e.node().getBBox(), p = g.width, a = g.x, r = e.append("text").attr("x", 0).attr("y", t().state.titleShift).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), x = r.node().getBBox().width + s;
26
- let l = Math.max(x, p);
27
- l === p && (l = l + s);
28
- let d;
29
- const m = e.node().getBBox();
30
- i.doc, d = a - c, x > p && (d = (p - l) / 2 + c), Math.abs(a - m.x) < c && x > p && (d = a - (x - p) / 2);
31
- const f = 1 - t().state.textHeight;
32
- return e.insert("rect", ":first-child").attr("x", d).attr("y", f).attr("class", o ? "alt-composit" : "composit").attr("width", l).attr(
33
- "height",
34
- m.height + t().state.textHeight + t().state.titleShift + 1
35
- ).attr("rx", "0"), r.attr("x", d + c), x <= p && r.attr("x", a + (l - s) / 2 - x / 2 + c), e.insert("rect", ":first-child").attr("x", d).attr(
36
- "y",
37
- t().state.titleShift - t().state.textHeight - t().state.padding
38
- ).attr("width", l).attr("height", t().state.textHeight * 3).attr("rx", t().state.radius), e.insert("rect", ":first-child").attr("x", d).attr(
39
- "y",
40
- t().state.titleShift - t().state.textHeight - t().state.padding
41
- ).attr("width", l).attr("height", m.height + 3 + 2 * t().state.textHeight).attr("rx", t().state.radius), e;
42
- }, _ = (e) => (e.append("circle").attr("class", "end-state-outer").attr("r", t().state.sizeUnit + t().state.miniPadding).attr(
43
- "cx",
44
- t().state.padding + t().state.sizeUnit + t().state.miniPadding
45
- ).attr(
46
- "cy",
47
- t().state.padding + t().state.sizeUnit + t().state.miniPadding
48
- ), e.append("circle").attr("class", "end-state-inner").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit + 2).attr("cy", t().state.padding + t().state.sizeUnit + 2)), q = (e, i) => {
49
- let o = t().state.forkWidth, c = t().state.forkHeight;
50
- if (i.parentId) {
51
- let s = o;
52
- o = c, c = s;
53
- }
54
- return e.append("rect").style("stroke", "black").style("fill", "black").attr("width", o).attr("height", c).attr("x", t().state.padding).attr("y", t().state.padding);
55
- }, D = (e, i, o, c) => {
56
- let s = 0;
57
- const g = c.append("text");
58
- g.style("text-anchor", "start"), g.attr("class", "noteText");
59
- let p = e.replace(/\r\n/g, "<br/>");
60
- p = p.replace(/\n/g, "<br/>");
61
- const a = p.split(L.lineBreakRegex);
62
- let r = 1.25 * t().state.noteMargin;
63
- for (const w of a) {
64
- const x = w.trim();
65
- if (x.length > 0) {
66
- const l = g.append("tspan");
67
- if (l.text(x), r === 0) {
68
- const d = l.node().getBBox();
69
- r += d.height;
70
- }
71
- s += r, l.attr("x", i + t().state.noteMargin), l.attr("y", o + s + 1.25 * t().state.noteMargin);
72
- }
73
- }
74
- return { textWidth: g.node().getBBox().width, textHeight: s };
75
- }, Z = (e, i) => {
76
- i.attr("class", "state-note");
77
- const o = i.append("rect").attr("x", 0).attr("y", t().state.padding), c = i.append("g"), { textWidth: s, textHeight: g } = D(e, 0, 0, c);
78
- return o.attr("height", g + 2 * t().state.noteMargin), o.attr("width", s + t().state.noteMargin * 2), o;
79
- }, T = function(e, i) {
80
- const o = i.id, c = {
81
- id: o,
82
- label: i.id,
83
- width: 0,
84
- height: 0
85
- }, s = e.append("g").attr("id", o).attr("class", "stateGroup");
86
- i.type === "start" && O(s), i.type === "end" && _(s), (i.type === "fork" || i.type === "join") && q(s, i), i.type === "note" && Z(i.note.text, s), i.type === "divider" && X(s), i.type === "default" && i.descriptions.length === 0 && J(s, i), i.type === "default" && i.descriptions.length > 0 && Y(s, i);
87
- const g = s.node().getBBox();
88
- return c.width = g.width + 2 * t().state.padding, c.height = g.height + 2 * t().state.padding, c;
89
- };
90
- let G = 0;
91
- const j = function(e, i, o) {
92
- const c = function(r) {
93
- switch (r) {
94
- case N.relationType.AGGREGATION:
95
- return "aggregation";
96
- case N.relationType.EXTENSION:
97
- return "extension";
98
- case N.relationType.COMPOSITION:
99
- return "composition";
100
- case N.relationType.DEPENDENCY:
101
- return "dependency";
102
- }
103
- };
104
- i.points = i.points.filter((r) => !Number.isNaN(r.y));
105
- const s = i.points, g = $().x(function(r) {
106
- return r.x;
107
- }).y(function(r) {
108
- return r.y;
109
- }).curve(U), p = e.append("path").attr("d", g(s)).attr("id", "edge" + G).attr("class", "transition");
110
- let a = "";
111
- if (t().state.arrowMarkerAbsolute && (a = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, a = a.replace(/\(/g, "\\("), a = a.replace(/\)/g, "\\)")), p.attr(
112
- "marker-end",
113
- "url(" + a + "#" + c(N.relationType.DEPENDENCY) + "End)"
114
- ), o.title !== void 0) {
115
- const r = e.append("g").attr("class", "stateLabel"), { x: w, y: x } = C.calcLabelPosition(i.points), l = L.getRows(o.title);
116
- let d = 0;
117
- const m = [];
118
- let f = 0, S = 0;
119
- for (let u = 0; u <= l.length; u++) {
120
- const h = r.append("text").attr("text-anchor", "middle").text(l[u]).attr("x", w).attr("y", x + d), y = h.node().getBBox();
121
- f = Math.max(f, y.width), S = Math.min(S, y.x), b.info(y.x, w, x + d), d === 0 && (d = h.node().getBBox().height, b.info("Title height", d, x)), m.push(h);
122
- }
123
- let k = d * l.length;
124
- if (l.length > 1) {
125
- const u = (l.length - 1) * d * 0.5;
126
- m.forEach((h, y) => h.attr("y", x + y * d - u)), k = d * l.length;
127
- }
128
- const n = r.node().getBBox();
129
- r.insert("rect", ":first-child").attr("class", "box").attr("x", w - f / 2 - t().state.padding / 2).attr("y", x - k / 2 - t().state.padding / 2 - 3.5).attr("width", f + t().state.padding).attr("height", k + t().state.padding), b.info(n);
130
- }
131
- G++;
132
- };
133
- let B;
134
- const z = {}, K = function() {
135
- }, Q = function(e) {
136
- 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 19,7 L9,13 L14,7 L9,1 Z");
137
- }, V = function(e, i, o, c) {
138
- B = t().state;
139
- const s = t().securityLevel;
140
- let g;
141
- s === "sandbox" && (g = H("#i" + i));
142
- const p = s === "sandbox" ? H(g.nodes()[0].contentDocument.body) : H("body"), a = s === "sandbox" ? g.nodes()[0].contentDocument : document;
143
- b.debug("Rendering diagram " + e);
144
- const r = p.select(`[id='${i}']`);
145
- Q(r), new A({
146
- multigraph: !0,
147
- compound: !0,
148
- // acyclicer: 'greedy',
149
- rankdir: "RL"
150
- // ranksep: '20'
151
- }).setDefaultEdgeLabel(function() {
152
- return {};
153
- });
154
- const x = c.db.getRootDoc();
155
- P(x, r, void 0, !1, p, a, c);
156
- const l = B.padding, d = r.node().getBBox(), m = d.width + l * 2, f = d.height + l * 2, S = m * 1.75;
157
- v(r, f, S, B.useMaxWidth), r.attr(
158
- "viewBox",
159
- `${d.x - B.padding} ${d.y - B.padding} ` + m + " " + f
160
- );
161
- }, tt = (e) => e ? e.length * B.fontSizeFactor : 1, P = (e, i, o, c, s, g, p) => {
162
- const a = new A({
163
- compound: !0,
164
- multigraph: !0
165
- });
166
- let r, w = !0;
167
- for (r = 0; r < e.length; r++)
168
- if (e[r].stmt === "relation") {
169
- w = !1;
170
- break;
171
- }
172
- o ? a.setGraph({
173
- rankdir: "LR",
174
- multigraph: !0,
175
- compound: !0,
176
- // acyclicer: 'greedy',
177
- ranker: "tight-tree",
178
- ranksep: w ? 1 : B.edgeLengthFactor,
179
- nodeSep: w ? 1 : 50,
180
- isMultiGraph: !0
181
- // ranksep: 5,
182
- // nodesep: 1
183
- }) : a.setGraph({
184
- rankdir: "TB",
185
- multigraph: !0,
186
- compound: !0,
187
- // isCompound: true,
188
- // acyclicer: 'greedy',
189
- // ranker: 'longest-path'
190
- ranksep: w ? 1 : B.edgeLengthFactor,
191
- nodeSep: w ? 1 : 50,
192
- ranker: "tight-tree",
193
- // ranker: 'network-simplex'
194
- isMultiGraph: !0
195
- }), a.setDefaultEdgeLabel(function() {
196
- return {};
197
- }), p.db.extract(e);
198
- const x = p.db.getStates(), l = p.db.getRelations(), d = Object.keys(x);
199
- for (const n of d) {
200
- const u = x[n];
201
- o && (u.parentId = o);
202
- let h;
203
- if (u.doc) {
204
- let y = i.append("g").attr("id", u.id).attr("class", "stateGroup");
205
- h = P(u.doc, y, u.id, !c, s, g, p);
206
- {
207
- y = I(y, u, c);
208
- let E = y.node().getBBox();
209
- h.width = E.width, h.height = E.height + B.padding / 2, z[u.id] = { y: B.compositTitleSize };
210
- }
211
- } else
212
- h = T(i, u);
213
- if (u.note) {
214
- const y = {
215
- descriptions: [],
216
- id: u.id + "-note",
217
- note: u.note,
218
- type: "note"
219
- }, E = T(i, y);
220
- u.note.position === "left of" ? (a.setNode(h.id + "-note", E), a.setNode(h.id, h)) : (a.setNode(h.id, h), a.setNode(h.id + "-note", E)), a.setParent(h.id, h.id + "-group"), a.setParent(h.id + "-note", h.id + "-group");
221
- } else
222
- a.setNode(h.id, h);
223
- }
224
- b.debug("Count=", a.nodeCount(), a);
225
- let m = 0;
226
- l.forEach(function(n) {
227
- m++, b.debug("Setting edge", n), a.setEdge(
228
- n.id1,
229
- n.id2,
230
- {
231
- relation: n,
232
- width: tt(n.title),
233
- height: B.labelHeight * L.getRows(n.title).length,
234
- labelpos: "c"
235
- },
236
- "id" + m
237
- );
238
- }), F(a), b.debug("Graph after layout", a.nodes());
239
- const f = i.node();
240
- a.nodes().forEach(function(n) {
241
- n !== void 0 && a.node(n) !== void 0 ? (b.warn("Node " + n + ": " + JSON.stringify(a.node(n))), s.select("#" + f.id + " #" + n).attr(
242
- "transform",
243
- "translate(" + (a.node(n).x - a.node(n).width / 2) + "," + (a.node(n).y + (z[n] ? z[n].y : 0) - a.node(n).height / 2) + " )"
244
- ), s.select("#" + f.id + " #" + n).attr("data-x-shift", a.node(n).x - a.node(n).width / 2), g.querySelectorAll("#" + f.id + " #" + n + " .divider").forEach((h) => {
245
- const y = h.parentElement;
246
- let E = 0, M = 0;
247
- y && (y.parentElement && (E = y.parentElement.getBBox().width), M = parseInt(y.getAttribute("data-x-shift"), 10), Number.isNaN(M) && (M = 0)), h.setAttribute("x1", 0 - M + 8), h.setAttribute("x2", E - M - 8);
248
- })) : b.debug("No Node " + n + ": " + JSON.stringify(a.node(n)));
249
- });
250
- let S = f.getBBox();
251
- a.edges().forEach(function(n) {
252
- n !== void 0 && a.edge(n) !== void 0 && (b.debug("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(a.edge(n))), j(i, a.edge(n), a.edge(n).relation));
253
- }), S = f.getBBox();
254
- const k = {
255
- id: o || "root",
256
- label: o || "root",
257
- width: 0,
258
- height: 0
259
- };
260
- return k.width = S.width + 2 * B.padding, k.height = S.height + 2 * B.padding, b.debug("Doc rendered", k, a), k;
261
- }, et = {
262
- setConf: K,
263
- draw: V
264
- }, dt = {
265
- parser: R,
266
- db: N,
267
- renderer: et,
268
- styles: W,
269
- init: (e) => {
270
- e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, N.clear();
271
- }
272
- };
273
- export {
274
- dt as diagram
275
- };