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/d05c1762.js DELETED
@@ -1,933 +0,0 @@
1
- import { c as Z, s as Et, g as mt, b as gt, a as kt, C as xt, D as Rt, l as V, E as Ot, h as rt, A as bt, i as Nt, F as Tt, G as At } from "./d073ab24.js";
2
- import { G as Mt } from "./274f545c.js";
3
- import { l as St } from "./abac9104.js";
4
- import { l as wt } from "./2eae45c2.js";
5
- import "./2ff2c7a6.js";
6
- import "./256b619e.js";
7
- const It = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
8
- function Dt(t) {
9
- return typeof t == "string" && It.test(t);
10
- }
11
- const A = [];
12
- for (let t = 0; t < 256; ++t)
13
- A.push((t + 256).toString(16).slice(1));
14
- function vt(t, e = 0) {
15
- return A[t[e + 0]] + A[t[e + 1]] + A[t[e + 2]] + A[t[e + 3]] + "-" + A[t[e + 4]] + A[t[e + 5]] + "-" + A[t[e + 6]] + A[t[e + 7]] + "-" + A[t[e + 8]] + A[t[e + 9]] + "-" + A[t[e + 10]] + A[t[e + 11]] + A[t[e + 12]] + A[t[e + 13]] + A[t[e + 14]] + A[t[e + 15]];
16
- }
17
- function Lt(t) {
18
- if (!Dt(t))
19
- throw TypeError("Invalid UUID");
20
- let e;
21
- const r = new Uint8Array(16);
22
- return r[0] = (e = parseInt(t.slice(0, 8), 16)) >>> 24, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = (e = parseInt(t.slice(9, 13), 16)) >>> 8, r[5] = e & 255, r[6] = (e = parseInt(t.slice(14, 18), 16)) >>> 8, r[7] = e & 255, r[8] = (e = parseInt(t.slice(19, 23), 16)) >>> 8, r[9] = e & 255, r[10] = (e = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, r[11] = e / 4294967296 & 255, r[12] = e >>> 24 & 255, r[13] = e >>> 16 & 255, r[14] = e >>> 8 & 255, r[15] = e & 255, r;
23
- }
24
- function Bt(t) {
25
- t = unescape(encodeURIComponent(t));
26
- const e = [];
27
- for (let r = 0; r < t.length; ++r)
28
- e.push(t.charCodeAt(r));
29
- return e;
30
- }
31
- const Ct = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", Pt = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
32
- function Yt(t, e, r) {
33
- function u(l, p, f, o) {
34
- var h;
35
- if (typeof l == "string" && (l = Bt(l)), typeof p == "string" && (p = Lt(p)), ((h = p) === null || h === void 0 ? void 0 : h.length) !== 16)
36
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
37
- let _ = new Uint8Array(16 + l.length);
38
- if (_.set(p), _.set(l, p.length), _ = r(_), _[6] = _[6] & 15 | e, _[8] = _[8] & 63 | 128, f) {
39
- o = o || 0;
40
- for (let m = 0; m < 16; ++m)
41
- f[o + m] = _[m];
42
- return f;
43
- }
44
- return vt(_);
45
- }
46
- try {
47
- u.name = t;
48
- } catch (l) {
49
- }
50
- return u.DNS = Ct, u.URL = Pt, u;
51
- }
52
- function Zt(t, e, r, u) {
53
- switch (t) {
54
- case 0:
55
- return e & r ^ ~e & u;
56
- case 1:
57
- return e ^ r ^ u;
58
- case 2:
59
- return e & r ^ e & u ^ r & u;
60
- case 3:
61
- return e ^ r ^ u;
62
- }
63
- }
64
- function it(t, e) {
65
- return t << e | t >>> 32 - e;
66
- }
67
- function Ft(t) {
68
- const e = [1518500249, 1859775393, 2400959708, 3395469782], r = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
69
- if (typeof t == "string") {
70
- const f = unescape(encodeURIComponent(t));
71
- t = [];
72
- for (let o = 0; o < f.length; ++o)
73
- t.push(f.charCodeAt(o));
74
- } else
75
- Array.isArray(t) || (t = Array.prototype.slice.call(t));
76
- t.push(128);
77
- const u = t.length / 4 + 2, l = Math.ceil(u / 16), p = new Array(l);
78
- for (let f = 0; f < l; ++f) {
79
- const o = new Uint32Array(16);
80
- for (let h = 0; h < 16; ++h)
81
- o[h] = t[f * 64 + h * 4] << 24 | t[f * 64 + h * 4 + 1] << 16 | t[f * 64 + h * 4 + 2] << 8 | t[f * 64 + h * 4 + 3];
82
- p[f] = o;
83
- }
84
- p[l - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), p[l - 1][14] = Math.floor(p[l - 1][14]), p[l - 1][15] = (t.length - 1) * 8 & 4294967295;
85
- for (let f = 0; f < l; ++f) {
86
- const o = new Uint32Array(80);
87
- for (let y = 0; y < 16; ++y)
88
- o[y] = p[f][y];
89
- for (let y = 16; y < 80; ++y)
90
- o[y] = it(o[y - 3] ^ o[y - 8] ^ o[y - 14] ^ o[y - 16], 1);
91
- let h = r[0], _ = r[1], m = r[2], g = r[3], R = r[4];
92
- for (let y = 0; y < 80; ++y) {
93
- const k = Math.floor(y / 20), I = it(h, 5) + Zt(k, _, m, g) + R + e[k] + o[y] >>> 0;
94
- R = g, g = m, m = it(_, 30) >>> 0, _ = h, h = I;
95
- }
96
- r[0] = r[0] + h >>> 0, r[1] = r[1] + _ >>> 0, r[2] = r[2] + m >>> 0, r[3] = r[3] + g >>> 0, r[4] = r[4] + R >>> 0;
97
- }
98
- return [r[0] >> 24 & 255, r[0] >> 16 & 255, r[0] >> 8 & 255, r[0] & 255, r[1] >> 24 & 255, r[1] >> 16 & 255, r[1] >> 8 & 255, r[1] & 255, r[2] >> 24 & 255, r[2] >> 16 & 255, r[2] >> 8 & 255, r[2] & 255, r[3] >> 24 & 255, r[3] >> 16 & 255, r[3] >> 8 & 255, r[3] & 255, r[4] >> 24 & 255, r[4] >> 16 & 255, r[4] >> 8 & 255, r[4] & 255];
99
- }
100
- const Wt = Yt("v5", 80, Ft), Ut = Wt;
101
- var at = function() {
102
- var t = function(S, a, n, c) {
103
- for (n = n || {}, c = S.length; c--; n[S[c]] = a)
104
- ;
105
- return n;
106
- }, e = [6, 8, 10, 20, 22, 24, 26, 27, 28], r = [1, 10], u = [1, 11], l = [1, 12], p = [1, 13], f = [1, 14], o = [1, 15], h = [1, 21], _ = [1, 22], m = [1, 23], g = [1, 24], R = [1, 25], y = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], k = [1, 34], I = [27, 28, 46, 47], F = [41, 42, 43, 44, 45], W = [17, 34], C = [1, 54], T = [1, 53], M = [17, 34, 36, 38], O = {
107
- trace: function() {
108
- },
109
- yy: {},
110
- symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, entityName: 11, relSpec: 12, ":": 13, role: 14, BLOCK_START: 15, attributes: 16, BLOCK_STOP: 17, SQS: 18, SQE: 19, title: 20, title_value: 21, acc_title: 22, acc_title_value: 23, acc_descr: 24, acc_descr_value: 25, acc_descr_multiline_value: 26, ALPHANUM: 27, ENTITY_NAME: 28, attribute: 29, attributeType: 30, attributeName: 31, attributeKeyTypeList: 32, attributeComment: 33, ATTRIBUTE_WORD: 34, attributeKeyType: 35, COMMA: 36, ATTRIBUTE_KEY: 37, COMMENT: 38, cardinality: 39, relType: 40, ZERO_OR_ONE: 41, ZERO_OR_MORE: 42, ONE_OR_MORE: 43, ONLY_ONE: 44, MD_PARENT: 45, NON_IDENTIFYING: 46, IDENTIFYING: 47, WORD: 48, $accept: 0, $end: 1 },
111
- terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
112
- productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
113
- performAction: function(a, n, c, d, E, i, K) {
114
- var s = i.length - 1;
115
- switch (E) {
116
- case 1:
117
- break;
118
- case 2:
119
- this.$ = [];
120
- break;
121
- case 3:
122
- i[s - 1].push(i[s]), this.$ = i[s - 1];
123
- break;
124
- case 4:
125
- case 5:
126
- this.$ = i[s];
127
- break;
128
- case 6:
129
- case 7:
130
- this.$ = [];
131
- break;
132
- case 8:
133
- d.addEntity(i[s - 4]), d.addEntity(i[s - 2]), d.addRelationship(i[s - 4], i[s], i[s - 2], i[s - 3]);
134
- break;
135
- case 9:
136
- d.addEntity(i[s - 3]), d.addAttributes(i[s - 3], i[s - 1]);
137
- break;
138
- case 10:
139
- d.addEntity(i[s - 2]);
140
- break;
141
- case 11:
142
- d.addEntity(i[s]);
143
- break;
144
- case 12:
145
- d.addEntity(i[s - 6], i[s - 4]), d.addAttributes(i[s - 6], i[s - 1]);
146
- break;
147
- case 13:
148
- d.addEntity(i[s - 5], i[s - 3]);
149
- break;
150
- case 14:
151
- d.addEntity(i[s - 3], i[s - 1]);
152
- break;
153
- case 15:
154
- case 16:
155
- this.$ = i[s].trim(), d.setAccTitle(this.$);
156
- break;
157
- case 17:
158
- case 18:
159
- this.$ = i[s].trim(), d.setAccDescription(this.$);
160
- break;
161
- case 19:
162
- case 43:
163
- this.$ = i[s];
164
- break;
165
- case 20:
166
- case 41:
167
- case 42:
168
- this.$ = i[s].replace(/"/g, "");
169
- break;
170
- case 21:
171
- case 29:
172
- this.$ = [i[s]];
173
- break;
174
- case 22:
175
- i[s].push(i[s - 1]), this.$ = i[s];
176
- break;
177
- case 23:
178
- this.$ = { attributeType: i[s - 1], attributeName: i[s] };
179
- break;
180
- case 24:
181
- this.$ = { attributeType: i[s - 2], attributeName: i[s - 1], attributeKeyTypeList: i[s] };
182
- break;
183
- case 25:
184
- this.$ = { attributeType: i[s - 2], attributeName: i[s - 1], attributeComment: i[s] };
185
- break;
186
- case 26:
187
- this.$ = { attributeType: i[s - 3], attributeName: i[s - 2], attributeKeyTypeList: i[s - 1], attributeComment: i[s] };
188
- break;
189
- case 27:
190
- case 28:
191
- case 31:
192
- this.$ = i[s];
193
- break;
194
- case 30:
195
- i[s - 2].push(i[s]), this.$ = i[s - 2];
196
- break;
197
- case 32:
198
- this.$ = i[s].replace(/"/g, "");
199
- break;
200
- case 33:
201
- this.$ = { cardA: i[s], relType: i[s - 1], cardB: i[s - 2] };
202
- break;
203
- case 34:
204
- this.$ = d.Cardinality.ZERO_OR_ONE;
205
- break;
206
- case 35:
207
- this.$ = d.Cardinality.ZERO_OR_MORE;
208
- break;
209
- case 36:
210
- this.$ = d.Cardinality.ONE_OR_MORE;
211
- break;
212
- case 37:
213
- this.$ = d.Cardinality.ONLY_ONE;
214
- break;
215
- case 38:
216
- this.$ = d.Cardinality.MD_PARENT;
217
- break;
218
- case 39:
219
- this.$ = d.Identification.NON_IDENTIFYING;
220
- break;
221
- case 40:
222
- this.$ = d.Identification.IDENTIFYING;
223
- break;
224
- }
225
- },
226
- table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: r, 22: u, 24: l, 26: p, 27: f, 28: o }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 16, 11: 9, 20: r, 22: u, 24: l, 26: p, 27: f, 28: o }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: h, 42: _, 43: m, 44: g, 45: R }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, t(e, [2, 18]), t(y, [2, 19]), t(y, [2, 20]), t(e, [2, 4]), { 11: 29, 27: f, 28: o }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: k }, { 11: 35, 27: f, 28: o }, { 40: 36, 46: [1, 37], 47: [1, 38] }, t(I, [2, 34]), t(I, [2, 35]), t(I, [2, 36]), t(I, [2, 37]), t(I, [2, 38]), t(e, [2, 15]), t(e, [2, 16]), t(e, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, t(e, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: k }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: h, 42: _, 43: m, 44: g, 45: R }, t(F, [2, 39]), t(F, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, t(e, [2, 9]), { 17: [2, 22] }, t(W, [2, 23], { 32: 50, 33: 51, 35: 52, 37: C, 38: T }), t([17, 34, 37, 38], [2, 28]), t(e, [2, 14], { 15: [1, 55] }), t([27, 28], [2, 33]), t(e, [2, 8]), t(e, [2, 41]), t(e, [2, 42]), t(e, [2, 43]), t(W, [2, 24], { 33: 56, 36: [1, 57], 38: T }), t(W, [2, 25]), t(M, [2, 29]), t(W, [2, 32]), t(M, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: k }, t(W, [2, 26]), { 35: 60, 37: C }, { 17: [1, 61] }, t(e, [2, 13]), t(M, [2, 30]), t(e, [2, 12])],
227
- defaultActions: { 34: [2, 27], 41: [2, 22] },
228
- parseError: function(a, n) {
229
- if (n.recoverable)
230
- this.trace(a);
231
- else {
232
- var c = new Error(a);
233
- throw c.hash = n, c;
234
- }
235
- },
236
- parse: function(a) {
237
- var n = this, c = [0], d = [], E = [null], i = [], K = this.table, s = "", Q = 0, st = 0, ft = 2, ot = 1, yt = i.slice.call(arguments, 1), N = Object.create(this.lexer), G = { yy: {} };
238
- for (var J in this.yy)
239
- Object.prototype.hasOwnProperty.call(this.yy, J) && (G.yy[J] = this.yy[J]);
240
- N.setInput(a, G.yy), G.yy.lexer = N, G.yy.parser = this, typeof N.yylloc == "undefined" && (N.yylloc = {});
241
- var $ = N.yylloc;
242
- i.push($);
243
- var pt = N.options && N.options.ranges;
244
- typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
245
- function _t() {
246
- var Y;
247
- return Y = d.pop() || N.lex() || ot, typeof Y != "number" && (Y instanceof Array && (d = Y, Y = d.pop()), Y = n.symbols_[Y] || Y), Y;
248
- }
249
- for (var w, H, D, tt, z = {}, j, P, lt, q; ; ) {
250
- if (H = c[c.length - 1], this.defaultActions[H] ? D = this.defaultActions[H] : ((w === null || typeof w == "undefined") && (w = _t()), D = K[H] && K[H][w]), typeof D == "undefined" || !D.length || !D[0]) {
251
- var et = "";
252
- q = [];
253
- for (j in K[H])
254
- this.terminals_[j] && j > ft && q.push("'" + this.terminals_[j] + "'");
255
- N.showPosition ? et = "Parse error on line " + (Q + 1) + `:
256
- ` + N.showPosition() + `
257
- Expecting ` + q.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : et = "Parse error on line " + (Q + 1) + ": Unexpected " + (w == ot ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(et, {
258
- text: N.match,
259
- token: this.terminals_[w] || w,
260
- line: N.yylineno,
261
- loc: $,
262
- expected: q
263
- });
264
- }
265
- if (D[0] instanceof Array && D.length > 1)
266
- throw new Error("Parse Error: multiple actions possible at state: " + H + ", token: " + w);
267
- switch (D[0]) {
268
- case 1:
269
- c.push(w), E.push(N.yytext), i.push(N.yylloc), c.push(D[1]), w = null, st = N.yyleng, s = N.yytext, Q = N.yylineno, $ = N.yylloc;
270
- break;
271
- case 2:
272
- if (P = this.productions_[D[1]][1], z.$ = E[E.length - P], z._$ = {
273
- first_line: i[i.length - (P || 1)].first_line,
274
- last_line: i[i.length - 1].last_line,
275
- first_column: i[i.length - (P || 1)].first_column,
276
- last_column: i[i.length - 1].last_column
277
- }, pt && (z._$.range = [
278
- i[i.length - (P || 1)].range[0],
279
- i[i.length - 1].range[1]
280
- ]), tt = this.performAction.apply(z, [
281
- s,
282
- st,
283
- Q,
284
- G.yy,
285
- D[1],
286
- E,
287
- i
288
- ].concat(yt)), typeof tt != "undefined")
289
- return tt;
290
- P && (c = c.slice(0, -1 * P * 2), E = E.slice(0, -1 * P), i = i.slice(0, -1 * P)), c.push(this.productions_[D[1]][0]), E.push(z.$), i.push(z._$), lt = K[c[c.length - 2]][c[c.length - 1]], c.push(lt);
291
- break;
292
- case 3:
293
- return !0;
294
- }
295
- }
296
- return !0;
297
- }
298
- }, b = function() {
299
- var S = {
300
- EOF: 1,
301
- parseError: function(n, c) {
302
- if (this.yy.parser)
303
- this.yy.parser.parseError(n, c);
304
- else
305
- throw new Error(n);
306
- },
307
- // resets the lexer, sets new input
308
- setInput: function(a, n) {
309
- return this.yy = n || this.yy || {}, this._input = a, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
310
- first_line: 1,
311
- first_column: 0,
312
- last_line: 1,
313
- last_column: 0
314
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
315
- },
316
- // consumes and returns one char from the input
317
- input: function() {
318
- var a = this._input[0];
319
- this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
320
- var n = a.match(/(?:\r\n?|\n).*/g);
321
- return n ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
322
- },
323
- // unshifts one char (or a string) into the input
324
- unput: function(a) {
325
- var n = a.length, c = a.split(/(?:\r\n?|\n)/g);
326
- this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - n), this.offset -= n;
327
- var d = this.match.split(/(?:\r\n?|\n)/g);
328
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1);
329
- var E = this.yylloc.range;
330
- return this.yylloc = {
331
- first_line: this.yylloc.first_line,
332
- last_line: this.yylineno + 1,
333
- first_column: this.yylloc.first_column,
334
- last_column: c ? (c.length === d.length ? this.yylloc.first_column : 0) + d[d.length - c.length].length - c[0].length : this.yylloc.first_column - n
335
- }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - n]), this.yyleng = this.yytext.length, this;
336
- },
337
- // When called from action, caches matched text and appends it on next action
338
- more: function() {
339
- return this._more = !0, this;
340
- },
341
- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
342
- reject: function() {
343
- if (this.options.backtrack_lexer)
344
- this._backtrack = !0;
345
- else
346
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
347
- ` + this.showPosition(), {
348
- text: "",
349
- token: null,
350
- line: this.yylineno
351
- });
352
- return this;
353
- },
354
- // retain first n characters of the match
355
- less: function(a) {
356
- this.unput(this.match.slice(a));
357
- },
358
- // displays already matched input, i.e. for error messages
359
- pastInput: function() {
360
- var a = this.matched.substr(0, this.matched.length - this.match.length);
361
- return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
362
- },
363
- // displays upcoming input, i.e. for error messages
364
- upcomingInput: function() {
365
- var a = this.match;
366
- return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
367
- },
368
- // displays the character position where the lexing error occurred, i.e. for error messages
369
- showPosition: function() {
370
- var a = this.pastInput(), n = new Array(a.length + 1).join("-");
371
- return a + this.upcomingInput() + `
372
- ` + n + "^";
373
- },
374
- // test the lexed token: return FALSE when not a match, otherwise return token
375
- test_match: function(a, n) {
376
- var c, d, E;
377
- if (this.options.backtrack_lexer && (E = {
378
- yylineno: this.yylineno,
379
- yylloc: {
380
- first_line: this.yylloc.first_line,
381
- last_line: this.last_line,
382
- first_column: this.yylloc.first_column,
383
- last_column: this.yylloc.last_column
384
- },
385
- yytext: this.yytext,
386
- match: this.match,
387
- matches: this.matches,
388
- matched: this.matched,
389
- yyleng: this.yyleng,
390
- offset: this.offset,
391
- _more: this._more,
392
- _input: this._input,
393
- yy: this.yy,
394
- conditionStack: this.conditionStack.slice(0),
395
- done: this.done
396
- }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), d = a[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
397
- first_line: this.yylloc.last_line,
398
- last_line: this.yylineno + 1,
399
- first_column: this.yylloc.last_column,
400
- last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + a[0].length
401
- }, this.yytext += a[0], this.match += a[0], this.matches = a, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(a[0].length), this.matched += a[0], c = this.performAction.call(this, this.yy, this, n, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c)
402
- return c;
403
- if (this._backtrack) {
404
- for (var i in E)
405
- this[i] = E[i];
406
- return !1;
407
- }
408
- return !1;
409
- },
410
- // return next match in input
411
- next: function() {
412
- if (this.done)
413
- return this.EOF;
414
- this._input || (this.done = !0);
415
- var a, n, c, d;
416
- this._more || (this.yytext = "", this.match = "");
417
- for (var E = this._currentRules(), i = 0; i < E.length; i++)
418
- if (c = this._input.match(this.rules[E[i]]), c && (!n || c[0].length > n[0].length)) {
419
- if (n = c, d = i, this.options.backtrack_lexer) {
420
- if (a = this.test_match(c, E[i]), a !== !1)
421
- return a;
422
- if (this._backtrack) {
423
- n = !1;
424
- continue;
425
- } else
426
- return !1;
427
- } else if (!this.options.flex)
428
- break;
429
- }
430
- return n ? (a = this.test_match(n, E[d]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
431
- ` + this.showPosition(), {
432
- text: "",
433
- token: null,
434
- line: this.yylineno
435
- });
436
- },
437
- // return next match that has a token
438
- lex: function() {
439
- var n = this.next();
440
- return n || this.lex();
441
- },
442
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
443
- begin: function(n) {
444
- this.conditionStack.push(n);
445
- },
446
- // pop the previously active lexer condition state off the condition stack
447
- popState: function() {
448
- var n = this.conditionStack.length - 1;
449
- return n > 0 ? this.conditionStack.pop() : this.conditionStack[0];
450
- },
451
- // produce the lexer rule set which is active for the currently active lexer condition state
452
- _currentRules: function() {
453
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
454
- },
455
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
456
- topState: function(n) {
457
- return n = this.conditionStack.length - 1 - Math.abs(n || 0), n >= 0 ? this.conditionStack[n] : "INITIAL";
458
- },
459
- // alias for begin(condition)
460
- pushState: function(n) {
461
- this.begin(n);
462
- },
463
- // return the number of states currently on the stack
464
- stateStackSize: function() {
465
- return this.conditionStack.length;
466
- },
467
- options: { "case-insensitive": !0 },
468
- performAction: function(n, c, d, E) {
469
- switch (d) {
470
- case 0:
471
- return this.begin("acc_title"), 22;
472
- case 1:
473
- return this.popState(), "acc_title_value";
474
- case 2:
475
- return this.begin("acc_descr"), 24;
476
- case 3:
477
- return this.popState(), "acc_descr_value";
478
- case 4:
479
- this.begin("acc_descr_multiline");
480
- break;
481
- case 5:
482
- this.popState();
483
- break;
484
- case 6:
485
- return "acc_descr_multiline_value";
486
- case 7:
487
- return 10;
488
- case 8:
489
- break;
490
- case 9:
491
- return 8;
492
- case 10:
493
- return 28;
494
- case 11:
495
- return 48;
496
- case 12:
497
- return 4;
498
- case 13:
499
- return this.begin("block"), 15;
500
- case 14:
501
- return 36;
502
- case 15:
503
- break;
504
- case 16:
505
- return 37;
506
- case 17:
507
- return 34;
508
- case 18:
509
- return 34;
510
- case 19:
511
- return 38;
512
- case 20:
513
- break;
514
- case 21:
515
- return this.popState(), 17;
516
- case 22:
517
- return c.yytext[0];
518
- case 23:
519
- return 18;
520
- case 24:
521
- return 19;
522
- case 25:
523
- return 41;
524
- case 26:
525
- return 43;
526
- case 27:
527
- return 43;
528
- case 28:
529
- return 43;
530
- case 29:
531
- return 41;
532
- case 30:
533
- return 41;
534
- case 31:
535
- return 42;
536
- case 32:
537
- return 42;
538
- case 33:
539
- return 42;
540
- case 34:
541
- return 42;
542
- case 35:
543
- return 42;
544
- case 36:
545
- return 43;
546
- case 37:
547
- return 42;
548
- case 38:
549
- return 43;
550
- case 39:
551
- return 44;
552
- case 40:
553
- return 44;
554
- case 41:
555
- return 44;
556
- case 42:
557
- return 44;
558
- case 43:
559
- return 41;
560
- case 44:
561
- return 42;
562
- case 45:
563
- return 43;
564
- case 46:
565
- return 45;
566
- case 47:
567
- return 46;
568
- case 48:
569
- return 47;
570
- case 49:
571
- return 47;
572
- case 50:
573
- return 46;
574
- case 51:
575
- return 46;
576
- case 52:
577
- return 46;
578
- case 53:
579
- return 27;
580
- case 54:
581
- return c.yytext[0];
582
- case 55:
583
- return 6;
584
- }
585
- },
586
- rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
587
- conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, block: { rules: [14, 15, 16, 17, 18, 19, 20, 21, 22], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], inclusive: !0 } }
588
- };
589
- return S;
590
- }();
591
- O.lexer = b;
592
- function v() {
593
- this.yy = {};
594
- }
595
- return v.prototype = O, O.Parser = v, new v();
596
- }();
597
- at.parser = at;
598
- const Gt = at;
599
- let U = {}, nt = [];
600
- const Ht = {
601
- ZERO_OR_ONE: "ZERO_OR_ONE",
602
- ZERO_OR_MORE: "ZERO_OR_MORE",
603
- ONE_OR_MORE: "ONE_OR_MORE",
604
- ONLY_ONE: "ONLY_ONE",
605
- MD_PARENT: "MD_PARENT"
606
- }, zt = {
607
- NON_IDENTIFYING: "NON_IDENTIFYING",
608
- IDENTIFYING: "IDENTIFYING"
609
- }, dt = function(t, e = void 0) {
610
- return U[t] === void 0 ? (U[t] = { attributes: [], alias: e }, V.info("Added new entity :", t)) : U[t] && !U[t].alias && e && (U[t].alias = e, V.info(`Add alias '${e}' to entity '${t}'`)), U[t];
611
- }, Kt = () => U, Vt = function(t, e) {
612
- let r = dt(t), u;
613
- for (u = e.length - 1; u >= 0; u--)
614
- r.attributes.push(e[u]), V.debug("Added attribute ", e[u].attributeName);
615
- }, Xt = function(t, e, r, u) {
616
- let l = {
617
- entityA: t,
618
- roleA: e,
619
- entityB: r,
620
- relSpec: u
621
- };
622
- nt.push(l), V.debug("Added new relationship :", l);
623
- }, Qt = () => nt, jt = function() {
624
- U = {}, nt = [], Ot();
625
- }, qt = {
626
- Cardinality: Ht,
627
- Identification: zt,
628
- getConfig: () => Z().er,
629
- addEntity: dt,
630
- addAttributes: Vt,
631
- getEntities: Kt,
632
- addRelationship: Xt,
633
- getRelationships: Qt,
634
- clear: jt,
635
- setAccTitle: Et,
636
- getAccTitle: mt,
637
- setAccDescription: gt,
638
- getAccDescription: kt,
639
- setDiagramTitle: xt,
640
- getDiagramTitle: Rt
641
- }, L = {
642
- ONLY_ONE_START: "ONLY_ONE_START",
643
- ONLY_ONE_END: "ONLY_ONE_END",
644
- ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
645
- ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
646
- ONE_OR_MORE_START: "ONE_OR_MORE_START",
647
- ONE_OR_MORE_END: "ONE_OR_MORE_END",
648
- ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
649
- ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
650
- MD_PARENT_END: "MD_PARENT_END",
651
- MD_PARENT_START: "MD_PARENT_START"
652
- }, Jt = function(t, e) {
653
- let r;
654
- t.append("defs").append("marker").attr("id", L.MD_PARENT_START).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"), t.append("defs").append("marker").attr("id", L.MD_PARENT_END).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"), t.append("defs").append("marker").attr("id", L.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", L.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,0 L21,18"), t.append("defs").append("marker").attr("id", L.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"), t.append("defs").append("marker").attr("id", L.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
655
- }, B = {
656
- ERMarkers: L,
657
- insertMarkers: Jt
658
- }, $t = /[^\dA-Za-z](\W)*/g;
659
- let x = {}, X = /* @__PURE__ */ new Map();
660
- const te = function(t) {
661
- const e = Object.keys(t);
662
- for (const r of e)
663
- x[r] = t[r];
664
- }, ee = (t, e, r) => {
665
- const u = x.entityPadding / 3, l = x.entityPadding / 3, p = x.fontSize * 0.85, f = e.node().getBBox(), o = [];
666
- let h = !1, _ = !1, m = 0, g = 0, R = 0, y = 0, k = f.height + u * 2, I = 1;
667
- r.forEach((T) => {
668
- T.attributeKeyTypeList !== void 0 && T.attributeKeyTypeList.length > 0 && (h = !0), T.attributeComment !== void 0 && (_ = !0);
669
- }), r.forEach((T) => {
670
- const M = `${e.node().id}-attr-${I}`;
671
- let O = 0;
672
- const b = At(T.attributeType), v = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(b), S = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(T.attributeName), a = {};
673
- a.tn = v, a.nn = S;
674
- const n = v.node().getBBox(), c = S.node().getBBox();
675
- if (m = Math.max(m, n.width), g = Math.max(g, c.width), O = Math.max(n.height, c.height), h) {
676
- const d = T.attributeKeyTypeList !== void 0 ? T.attributeKeyTypeList.join(",") : "", E = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(d);
677
- a.kn = E;
678
- const i = E.node().getBBox();
679
- R = Math.max(R, i.width), O = Math.max(O, i.height);
680
- }
681
- if (_) {
682
- const d = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(T.attributeComment || "");
683
- a.cn = d;
684
- const E = d.node().getBBox();
685
- y = Math.max(y, E.width), O = Math.max(O, E.height);
686
- }
687
- a.height = O, o.push(a), k += O + u * 2, I += 1;
688
- });
689
- let F = 4;
690
- h && (F += 2), _ && (F += 2);
691
- const W = m + g + R + y, C = {
692
- width: Math.max(
693
- x.minEntityWidth,
694
- Math.max(
695
- f.width + x.entityPadding * 2,
696
- W + l * F
697
- )
698
- ),
699
- height: r.length > 0 ? k : Math.max(x.minEntityHeight, f.height + x.entityPadding * 2)
700
- };
701
- if (r.length > 0) {
702
- const T = Math.max(
703
- 0,
704
- (C.width - W - l * F) / (F / 2)
705
- );
706
- e.attr(
707
- "transform",
708
- "translate(" + C.width / 2 + "," + (u + f.height / 2) + ")"
709
- );
710
- let M = f.height + u * 2, O = "attributeBoxOdd";
711
- o.forEach((b) => {
712
- const v = M + u + b.height / 2;
713
- b.tn.attr("transform", "translate(" + l + "," + v + ")");
714
- const S = t.insert("rect", "#" + b.tn.node().id).classed(`er ${O}`, !0).attr("x", 0).attr("y", M).attr("width", m + l * 2 + T).attr("height", b.height + u * 2), a = parseFloat(S.attr("x")) + parseFloat(S.attr("width"));
715
- b.nn.attr(
716
- "transform",
717
- "translate(" + (a + l) + "," + v + ")"
718
- );
719
- const n = t.insert("rect", "#" + b.nn.node().id).classed(`er ${O}`, !0).attr("x", a).attr("y", M).attr("width", g + l * 2 + T).attr("height", b.height + u * 2);
720
- let c = parseFloat(n.attr("x")) + parseFloat(n.attr("width"));
721
- if (h) {
722
- b.kn.attr(
723
- "transform",
724
- "translate(" + (c + l) + "," + v + ")"
725
- );
726
- const d = t.insert("rect", "#" + b.kn.node().id).classed(`er ${O}`, !0).attr("x", c).attr("y", M).attr("width", R + l * 2 + T).attr("height", b.height + u * 2);
727
- c = parseFloat(d.attr("x")) + parseFloat(d.attr("width"));
728
- }
729
- _ && (b.cn.attr(
730
- "transform",
731
- "translate(" + (c + l) + "," + v + ")"
732
- ), t.insert("rect", "#" + b.cn.node().id).classed(`er ${O}`, "true").attr("x", c).attr("y", M).attr("width", y + l * 2 + T).attr("height", b.height + u * 2)), M += b.height + u * 2, O = O === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
733
- });
734
- } else
735
- C.height = Math.max(x.minEntityHeight, k), e.attr("transform", "translate(" + C.width / 2 + "," + C.height / 2 + ")");
736
- return C;
737
- }, re = function(t, e, r) {
738
- const u = Object.keys(e);
739
- let l;
740
- return u.forEach(function(p) {
741
- var k;
742
- const f = le(p, "entity");
743
- X.set(p, f);
744
- const o = t.append("g").attr("id", f);
745
- l = l === void 0 ? f : l;
746
- const h = "text-" + f, _ = o.append("text").classed("er entityLabel", !0).attr("id", h).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", Z().fontFamily).style("font-size", x.fontSize + "px").text((k = e[p].alias) != null ? k : p), { width: m, height: g } = ee(
747
- o,
748
- _,
749
- e[p].attributes
750
- ), y = o.insert("rect", "#" + h).classed("er entityBox", !0).attr("x", 0).attr("y", 0).attr("width", m).attr("height", g).node().getBBox();
751
- r.setNode(f, {
752
- width: y.width,
753
- height: y.height,
754
- shape: "rect",
755
- id: f
756
- });
757
- }), l;
758
- }, ie = function(t, e) {
759
- e.nodes().forEach(function(r) {
760
- r !== void 0 && e.node(r) !== void 0 && t.select("#" + r).attr(
761
- "transform",
762
- "translate(" + (e.node(r).x - e.node(r).width / 2) + "," + (e.node(r).y - e.node(r).height / 2) + " )"
763
- );
764
- });
765
- }, ut = function(t) {
766
- return (t.entityA + t.roleA + t.entityB).replace(/\s/g, "");
767
- }, ae = function(t, e) {
768
- return t.forEach(function(r) {
769
- e.setEdge(
770
- X.get(r.entityA),
771
- X.get(r.entityB),
772
- { relationship: r },
773
- ut(r)
774
- );
775
- }), t;
776
- };
777
- let ct = 0;
778
- const ne = function(t, e, r, u, l) {
779
- ct++;
780
- const p = r.edge(
781
- X.get(e.entityA),
782
- X.get(e.entityB),
783
- ut(e)
784
- ), f = wt().x(function(k) {
785
- return k.x;
786
- }).y(function(k) {
787
- return k.y;
788
- }).curve(Tt), o = t.insert("path", "#" + u).classed("er relationshipLine", !0).attr("d", f(p.points)).style("stroke", x.stroke).style("fill", "none");
789
- e.relSpec.relType === l.db.Identification.NON_IDENTIFYING && o.attr("stroke-dasharray", "8,8");
790
- let h = "";
791
- switch (x.arrowMarkerAbsolute && (h = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, h = h.replace(/\(/g, "\\("), h = h.replace(/\)/g, "\\)")), e.relSpec.cardA) {
792
- case l.db.Cardinality.ZERO_OR_ONE:
793
- o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ZERO_OR_ONE_END + ")");
794
- break;
795
- case l.db.Cardinality.ZERO_OR_MORE:
796
- o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ZERO_OR_MORE_END + ")");
797
- break;
798
- case l.db.Cardinality.ONE_OR_MORE:
799
- o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ONE_OR_MORE_END + ")");
800
- break;
801
- case l.db.Cardinality.ONLY_ONE:
802
- o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ONLY_ONE_END + ")");
803
- break;
804
- case l.db.Cardinality.MD_PARENT:
805
- o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.MD_PARENT_END + ")");
806
- break;
807
- }
808
- switch (e.relSpec.cardB) {
809
- case l.db.Cardinality.ZERO_OR_ONE:
810
- o.attr(
811
- "marker-start",
812
- "url(" + h + "#" + B.ERMarkers.ZERO_OR_ONE_START + ")"
813
- );
814
- break;
815
- case l.db.Cardinality.ZERO_OR_MORE:
816
- o.attr(
817
- "marker-start",
818
- "url(" + h + "#" + B.ERMarkers.ZERO_OR_MORE_START + ")"
819
- );
820
- break;
821
- case l.db.Cardinality.ONE_OR_MORE:
822
- o.attr(
823
- "marker-start",
824
- "url(" + h + "#" + B.ERMarkers.ONE_OR_MORE_START + ")"
825
- );
826
- break;
827
- case l.db.Cardinality.ONLY_ONE:
828
- o.attr("marker-start", "url(" + h + "#" + B.ERMarkers.ONLY_ONE_START + ")");
829
- break;
830
- case l.db.Cardinality.MD_PARENT:
831
- o.attr("marker-start", "url(" + h + "#" + B.ERMarkers.MD_PARENT_START + ")");
832
- break;
833
- }
834
- const _ = o.node().getTotalLength(), m = o.node().getPointAtLength(_ * 0.5), g = "rel" + ct, y = t.append("text").classed("er relationshipLabel", !0).attr("id", g).attr("x", m.x).attr("y", m.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", Z().fontFamily).style("font-size", x.fontSize + "px").text(e.roleA).node().getBBox();
835
- t.insert("rect", "#" + g).classed("er relationshipLabelBox", !0).attr("x", m.x - y.width / 2).attr("y", m.y - y.height / 2).attr("width", y.width).attr("height", y.height);
836
- }, se = function(t, e, r, u) {
837
- x = Z().er, V.info("Drawing ER diagram");
838
- const l = Z().securityLevel;
839
- let p;
840
- l === "sandbox" && (p = rt("#i" + e));
841
- const o = (l === "sandbox" ? rt(p.nodes()[0].contentDocument.body) : rt("body")).select(`[id='${e}']`);
842
- B.insertMarkers(o, x);
843
- let h;
844
- h = new Mt({
845
- multigraph: !0,
846
- directed: !0,
847
- compound: !1
848
- }).setGraph({
849
- rankdir: x.layoutDirection,
850
- marginx: 20,
851
- marginy: 20,
852
- nodesep: 100,
853
- edgesep: 100,
854
- ranksep: 100
855
- }).setDefaultEdgeLabel(function() {
856
- return {};
857
- });
858
- const _ = re(o, u.db.getEntities(), h), m = ae(u.db.getRelationships(), h);
859
- St(h), ie(o, h), m.forEach(function(I) {
860
- ne(o, I, h, _, u);
861
- });
862
- const g = x.diagramPadding;
863
- bt.insertTitle(o, "entityTitleText", x.titleTopMargin, u.db.getDiagramTitle());
864
- const R = o.node().getBBox(), y = R.width + g * 2, k = R.height + g * 2;
865
- Nt(o, k, y, x.useMaxWidth), o.attr("viewBox", `${R.x - g} ${R.y - g} ${y} ${k}`);
866
- }, oe = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
867
- function le(t = "", e = "") {
868
- const r = t.replace($t, "");
869
- return `${ht(e)}${ht(r)}${Ut(
870
- t,
871
- oe
872
- )}`;
873
- }
874
- function ht(t = "") {
875
- return t.length > 0 ? `${t}-` : "";
876
- }
877
- const ce = {
878
- setConf: te,
879
- draw: se
880
- }, he = (t) => `
881
- .entityBox {
882
- fill: ${t.mainBkg};
883
- stroke: ${t.nodeBorder};
884
- }
885
-
886
- .attributeBoxOdd {
887
- fill: ${t.attributeBackgroundColorOdd};
888
- stroke: ${t.nodeBorder};
889
- }
890
-
891
- .attributeBoxEven {
892
- fill: ${t.attributeBackgroundColorEven};
893
- stroke: ${t.nodeBorder};
894
- }
895
-
896
- .relationshipLabelBox {
897
- fill: ${t.tertiaryColor};
898
- opacity: 0.7;
899
- background-color: ${t.tertiaryColor};
900
- rect {
901
- opacity: 0.5;
902
- }
903
- }
904
-
905
- .relationshipLine {
906
- stroke: ${t.lineColor};
907
- }
908
-
909
- .entityTitleText {
910
- text-anchor: middle;
911
- font-size: 18px;
912
- fill: ${t.textColor};
913
- }
914
- #MD_PARENT_START {
915
- fill: #f5f5f5 !important;
916
- stroke: ${t.lineColor} !important;
917
- stroke-width: 1;
918
- }
919
- #MD_PARENT_END {
920
- fill: #f5f5f5 !important;
921
- stroke: ${t.lineColor} !important;
922
- stroke-width: 1;
923
- }
924
-
925
- `, de = he, me = {
926
- parser: Gt,
927
- db: qt,
928
- renderer: ce,
929
- styles: de
930
- };
931
- export {
932
- me as diagram
933
- };