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/af5ee3de.js DELETED
@@ -1,268 +0,0 @@
1
- import { p as P, d as N, s as W } from "./2085da13.js";
2
- import { c as t, h as H, l as b, i as R, j as T, F as v, A as U } from "./d073ab24.js";
3
- import { G as C } from "./274f545c.js";
4
- import { l as F } from "./abac9104.js";
5
- import { l as $ } from "./2eae45c2.js";
6
- import "./2ff2c7a6.js";
7
- import "./256b619e.js";
8
- 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) => {
9
- 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();
10
- 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;
11
- }, Y = (e, i) => {
12
- const o = function(l, m, w) {
13
- const E = l.append("tspan").attr("x", 2 * t().state.padding).text(m);
14
- w || E.attr("dy", t().state.textHeight);
15
- }, 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(
16
- "y",
17
- g + t().state.padding * 0.4 + t().state.dividerMargin + t().state.textHeight
18
- ).attr("class", "state-description");
19
- let a = !0, r = !0;
20
- i.descriptions.forEach(function(l) {
21
- a || (o(p, l, r), r = !1), a = !1;
22
- });
23
- const y = 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(), d = Math.max(x.width, s.width);
24
- return y.attr("x2", d + 3 * t().state.padding), e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", d + 2 * t().state.padding).attr("height", x.height + g + 2 * t().state.padding).attr("rx", t().state.radius), e;
25
- }, I = (e, i, o) => {
26
- 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;
27
- let d = Math.max(x, p);
28
- d === p && (d = d + s);
29
- let l;
30
- const m = e.node().getBBox();
31
- i.doc, l = a - c, x > p && (l = (p - d) / 2 + c), Math.abs(a - m.x) < c && x > p && (l = a - (x - p) / 2);
32
- const w = 1 - t().state.textHeight;
33
- return e.insert("rect", ":first-child").attr("x", l).attr("y", w).attr("class", o ? "alt-composit" : "composit").attr("width", d).attr(
34
- "height",
35
- m.height + t().state.textHeight + t().state.titleShift + 1
36
- ).attr("rx", "0"), r.attr("x", l + c), x <= p && r.attr("x", a + (d - s) / 2 - x / 2 + c), e.insert("rect", ":first-child").attr("x", l).attr(
37
- "y",
38
- t().state.titleShift - t().state.textHeight - t().state.padding
39
- ).attr("width", d).attr("height", t().state.textHeight * 3).attr("rx", t().state.radius), e.insert("rect", ":first-child").attr("x", l).attr(
40
- "y",
41
- t().state.titleShift - t().state.textHeight - t().state.padding
42
- ).attr("width", d).attr("height", m.height + 3 + 2 * t().state.textHeight).attr("rx", t().state.radius), e;
43
- }, _ = (e) => (e.append("circle").attr("class", "end-state-outer").attr("r", t().state.sizeUnit + t().state.miniPadding).attr(
44
- "cx",
45
- t().state.padding + t().state.sizeUnit + t().state.miniPadding
46
- ).attr(
47
- "cy",
48
- t().state.padding + t().state.sizeUnit + t().state.miniPadding
49
- ), 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) => {
50
- let o = t().state.forkWidth, c = t().state.forkHeight;
51
- if (i.parentId) {
52
- let s = o;
53
- o = c, c = s;
54
- }
55
- 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);
56
- }, Z = (e, i, o, c) => {
57
- let s = 0;
58
- const g = c.append("text");
59
- g.style("text-anchor", "start"), g.attr("class", "noteText");
60
- let p = e.replace(/\r\n/g, "<br/>");
61
- p = p.replace(/\n/g, "<br/>");
62
- const a = p.split(T.lineBreakRegex);
63
- let r = 1.25 * t().state.noteMargin;
64
- for (const y of a) {
65
- const x = y.trim();
66
- if (x.length > 0) {
67
- const d = g.append("tspan");
68
- if (d.text(x), r === 0) {
69
- const l = d.node().getBBox();
70
- r += l.height;
71
- }
72
- s += r, d.attr("x", i + t().state.noteMargin), d.attr("y", o + s + 1.25 * t().state.noteMargin);
73
- }
74
- }
75
- return { textWidth: g.node().getBBox().width, textHeight: s };
76
- }, j = (e, i) => {
77
- i.attr("class", "state-note");
78
- const o = i.append("rect").attr("x", 0).attr("y", t().state.padding), c = i.append("g"), { textWidth: s, textHeight: g } = Z(e, 0, 0, c);
79
- return o.attr("height", g + 2 * t().state.noteMargin), o.attr("width", s + t().state.noteMargin * 2), o;
80
- }, L = function(e, i) {
81
- const o = i.id, c = {
82
- id: o,
83
- label: i.id,
84
- width: 0,
85
- height: 0
86
- }, s = e.append("g").attr("id", o).attr("class", "stateGroup");
87
- i.type === "start" && O(s), i.type === "end" && _(s), (i.type === "fork" || i.type === "join") && q(s, i), i.type === "note" && j(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);
88
- const g = s.node().getBBox();
89
- return c.width = g.width + 2 * t().state.padding, c.height = g.height + 2 * t().state.padding, c;
90
- };
91
- let A = 0;
92
- const K = function(e, i, o) {
93
- const c = function(r) {
94
- switch (r) {
95
- case N.relationType.AGGREGATION:
96
- return "aggregation";
97
- case N.relationType.EXTENSION:
98
- return "extension";
99
- case N.relationType.COMPOSITION:
100
- return "composition";
101
- case N.relationType.DEPENDENCY:
102
- return "dependency";
103
- }
104
- };
105
- i.points = i.points.filter((r) => !Number.isNaN(r.y));
106
- const s = i.points, g = $().x(function(r) {
107
- return r.x;
108
- }).y(function(r) {
109
- return r.y;
110
- }).curve(v), p = e.append("path").attr("d", g(s)).attr("id", "edge" + A).attr("class", "transition");
111
- let a = "";
112
- 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(
113
- "marker-end",
114
- "url(" + a + "#" + c(N.relationType.DEPENDENCY) + "End)"
115
- ), o.title !== void 0) {
116
- const r = e.append("g").attr("class", "stateLabel"), { x: y, y: x } = U.calcLabelPosition(i.points), d = T.getRows(o.title);
117
- let l = 0;
118
- const m = [];
119
- let w = 0, E = 0;
120
- for (let u = 0; u <= d.length; u++) {
121
- const h = r.append("text").attr("text-anchor", "middle").text(d[u]).attr("x", y).attr("y", x + l), f = h.node().getBBox();
122
- w = Math.max(w, f.width), E = Math.min(E, f.x), b.info(f.x, y, x + l), l === 0 && (l = h.node().getBBox().height, b.info("Title height", l, x)), m.push(h);
123
- }
124
- let k = l * d.length;
125
- if (d.length > 1) {
126
- const u = (d.length - 1) * l * 0.5;
127
- m.forEach((h, f) => h.attr("y", x + f * l - u)), k = l * d.length;
128
- }
129
- const n = r.node().getBBox();
130
- r.insert("rect", ":first-child").attr("class", "box").attr("x", y - w / 2 - t().state.padding / 2).attr("y", x - k / 2 - t().state.padding / 2 - 3.5).attr("width", w + t().state.padding).attr("height", k + t().state.padding), b.info(n);
131
- }
132
- A++;
133
- };
134
- let B;
135
- const z = {}, Q = function() {
136
- }, V = function(e) {
137
- 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");
138
- }, D = function(e, i, o, c) {
139
- B = t().state;
140
- const s = t().securityLevel;
141
- let g;
142
- s === "sandbox" && (g = H("#i" + i));
143
- const p = s === "sandbox" ? H(g.nodes()[0].contentDocument.body) : H("body"), a = s === "sandbox" ? g.nodes()[0].contentDocument : document;
144
- b.debug("Rendering diagram " + e);
145
- const r = p.select(`[id='${i}']`);
146
- V(r);
147
- const y = c.db.getRootDoc();
148
- G(y, r, void 0, !1, p, a, c);
149
- const x = B.padding, d = r.node().getBBox(), l = d.width + x * 2, m = d.height + x * 2, w = l * 1.75;
150
- R(r, m, w, B.useMaxWidth), r.attr(
151
- "viewBox",
152
- `${d.x - B.padding} ${d.y - B.padding} ` + l + " " + m
153
- );
154
- }, tt = (e) => e ? e.length * B.fontSizeFactor : 1, G = (e, i, o, c, s, g, p) => {
155
- const a = new C({
156
- compound: !0,
157
- multigraph: !0
158
- });
159
- let r, y = !0;
160
- for (r = 0; r < e.length; r++)
161
- if (e[r].stmt === "relation") {
162
- y = !1;
163
- break;
164
- }
165
- o ? a.setGraph({
166
- rankdir: "LR",
167
- multigraph: !0,
168
- compound: !0,
169
- // acyclicer: 'greedy',
170
- ranker: "tight-tree",
171
- ranksep: y ? 1 : B.edgeLengthFactor,
172
- nodeSep: y ? 1 : 50,
173
- isMultiGraph: !0
174
- // ranksep: 5,
175
- // nodesep: 1
176
- }) : a.setGraph({
177
- rankdir: "TB",
178
- multigraph: !0,
179
- compound: !0,
180
- // isCompound: true,
181
- // acyclicer: 'greedy',
182
- // ranker: 'longest-path'
183
- ranksep: y ? 1 : B.edgeLengthFactor,
184
- nodeSep: y ? 1 : 50,
185
- ranker: "tight-tree",
186
- // ranker: 'network-simplex'
187
- isMultiGraph: !0
188
- }), a.setDefaultEdgeLabel(function() {
189
- return {};
190
- }), p.db.extract(e);
191
- const x = p.db.getStates(), d = p.db.getRelations(), l = Object.keys(x);
192
- for (const n of l) {
193
- const u = x[n];
194
- o && (u.parentId = o);
195
- let h;
196
- if (u.doc) {
197
- let f = i.append("g").attr("id", u.id).attr("class", "stateGroup");
198
- h = G(u.doc, f, u.id, !c, s, g, p);
199
- {
200
- f = I(f, u, c);
201
- let S = f.node().getBBox();
202
- h.width = S.width, h.height = S.height + B.padding / 2, z[u.id] = { y: B.compositTitleSize };
203
- }
204
- } else
205
- h = L(i, u);
206
- if (u.note) {
207
- const f = {
208
- descriptions: [],
209
- id: u.id + "-note",
210
- note: u.note,
211
- type: "note"
212
- }, S = L(i, f);
213
- u.note.position === "left of" ? (a.setNode(h.id + "-note", S), a.setNode(h.id, h)) : (a.setNode(h.id, h), a.setNode(h.id + "-note", S)), a.setParent(h.id, h.id + "-group"), a.setParent(h.id + "-note", h.id + "-group");
214
- } else
215
- a.setNode(h.id, h);
216
- }
217
- b.debug("Count=", a.nodeCount(), a);
218
- let m = 0;
219
- d.forEach(function(n) {
220
- m++, b.debug("Setting edge", n), a.setEdge(
221
- n.id1,
222
- n.id2,
223
- {
224
- relation: n,
225
- width: tt(n.title),
226
- height: B.labelHeight * T.getRows(n.title).length,
227
- labelpos: "c"
228
- },
229
- "id" + m
230
- );
231
- }), F(a), b.debug("Graph after layout", a.nodes());
232
- const w = i.node();
233
- a.nodes().forEach(function(n) {
234
- n !== void 0 && a.node(n) !== void 0 ? (b.warn("Node " + n + ": " + JSON.stringify(a.node(n))), s.select("#" + w.id + " #" + n).attr(
235
- "transform",
236
- "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) + " )"
237
- ), s.select("#" + w.id + " #" + n).attr("data-x-shift", a.node(n).x - a.node(n).width / 2), g.querySelectorAll("#" + w.id + " #" + n + " .divider").forEach((h) => {
238
- const f = h.parentElement;
239
- let S = 0, M = 0;
240
- f && (f.parentElement && (S = f.parentElement.getBBox().width), M = parseInt(f.getAttribute("data-x-shift"), 10), Number.isNaN(M) && (M = 0)), h.setAttribute("x1", 0 - M + 8), h.setAttribute("x2", S - M - 8);
241
- })) : b.debug("No Node " + n + ": " + JSON.stringify(a.node(n)));
242
- });
243
- let E = w.getBBox();
244
- a.edges().forEach(function(n) {
245
- n !== void 0 && a.edge(n) !== void 0 && (b.debug("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(a.edge(n))), K(i, a.edge(n), a.edge(n).relation));
246
- }), E = w.getBBox();
247
- const k = {
248
- id: o || "root",
249
- label: o || "root",
250
- width: 0,
251
- height: 0
252
- };
253
- return k.width = E.width + 2 * B.padding, k.height = E.height + 2 * B.padding, b.debug("Doc rendered", k, a), k;
254
- }, et = {
255
- setConf: Q,
256
- draw: D
257
- }, ct = {
258
- parser: P,
259
- db: N,
260
- renderer: et,
261
- styles: W,
262
- init: (e) => {
263
- e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, N.clear();
264
- }
265
- };
266
- export {
267
- ct as diagram
268
- };