Skip to content

Commit 414f614

Browse files
Merge pull request #38 from oracle/issues-25+
Issues 25+
2 parents 82e89ab + cce8578 commit 414f614

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+13248
-2718
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ are encouraged to be replaced with
1919
let errors = qsql.getErrors();
2020
```
2121

22+
## [1.2.1] - 2024-2-8
23+
24+
Issues up to #51
25+
26+
Further Json to QSQL parsing progress
27+
28+
Performance optimization: from 12 sec down to 6 sec for 1000 line QSQL schema definition
29+
in test/profile.js. Faster regression test as well.

dist/quick-erd.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ function ne() {
249249
return !0;
250250
};
251251
}
252-
function q(n, e, s, l) {
252+
function S(n, e, s, l) {
253253
var o = this;
254254
o.x = n, o.y = e, o.width = s, o.height = l, o.union = function(i) {
255255
var d = Math.min(this.x, i.x), T = Math.min(this.y, i.y), L = Math.max(this.x + this.width, i.x + i.width), R = Math.max(this.y + this.height, i.y + i.height);
256-
return new q(d, T, L - d, R - T);
256+
return new S(d, T, L - d, R - T);
257257
};
258258
}
259259
function P(n, e) {
@@ -269,10 +269,10 @@ function ie(n, e) {
269269
function oe(n, e) {
270270
return n.referredBy_count < e.referredBy_count ? 1 : n.referredBy_count > e.referredBy_count ? -1 : n.refer_count < e.refer_count ? 1 : n.refer_count > e.refer_count ? -1 : 0;
271271
}
272-
function J(n, e) {
272+
function Q(n, e) {
273273
return n.refer_count < e.refer_count ? 1 : n.refer_count > e.refer_count ? -1 : n.referredBy_count < e.referredBy_count ? 1 : n.referredBy_count > e.referredBy_count ? -1 : 0;
274274
}
275-
function Q(n, e) {
275+
function J(n, e) {
276276
return n.init_dim.height > e.init_dim.height ? 1 : n.init_dim.height < e.init_dim.height ? -1 : 0;
277277
}
278278
function le(n, e) {
@@ -292,10 +292,10 @@ function se(n) {
292292
O = [];
293293
for (var a = [], t = e.buildTH_Map(v, u), B = [], _ = t.length, c = 0; c < _; c++) {
294294
var f = t[c];
295-
f.refer_count === 0 && f.referredBy_count === 0 ? g.push(f) : (p.push(f), f.refer.length > 0 && (r == 1 ? f.refer.sort(Y) : r == 2 ? f.refer.sort(ie) : f.refer.sort(oe)), f.referredBy_count == 0 && !f.usedInStar && O.push(f), f.referredBy.length > 0 && f.referredBy.sort(J));
295+
f.refer_count === 0 && f.referredBy_count === 0 ? g.push(f) : (p.push(f), f.refer.length > 0 && (r == 1 ? f.refer.sort(Y) : r == 2 ? f.refer.sort(ie) : f.refer.sort(oe)), f.referredBy_count == 0 && !f.usedInStar && O.push(f), f.referredBy.length > 0 && f.referredBy.sort(Q));
296296
}
297297
if (p.length > 0) {
298-
O.length == 0 && e.findRoots(p, O), O = O.concat(B), O.sort(J);
298+
O.length == 0 && e.findRoots(p, O), O = O.concat(B), O.sort(Q);
299299
for (var y = Z, m = ee, x = 0; x < O.length; x++) {
300300
var f = O[x];
301301
if (!f.arranged && !f.usedInStar) {
@@ -336,7 +336,7 @@ function se(n) {
336336
}
337337
} while (u.length === 0);
338338
}, e.arrangeStar = function(r, u, h) {
339-
var v = new q(u, h, 1, 1);
339+
var v = new S(u, h, 1, 1);
340340
r.nodes.push(r);
341341
for (var g = [], p = r.referredBy.length, a = 0; a < p; a++) {
342342
var t = r.referredBy[a];
@@ -346,20 +346,20 @@ function se(n) {
346346
var t = r.refer[_];
347347
!g.indexOf(t) >= 0 && g.push(t);
348348
}
349-
g.sort(Q);
349+
g.sort(J);
350350
for (var c = 0, f = g.length, y = 0; y < f; y++) {
351351
var t = g[y];
352352
c = c + t.init_dim.width + E;
353353
}
354354
for (var m = u, x = h, A = u + c / 2, C = 0, k = 0, N = u, a = g.length - 1; a >= 0 && m < A; a--) {
355355
C = a;
356356
var t = g[a];
357-
k = Math.max(k, t.init_dim.height), N = m + t.init_dim.width, r.nodes.push(t), t.nodes.push(t), t.location = new P(m, x), t.rect = new q(t.location.x, t.location.y, t.init_dim.width, t.init_dim.height), m = m + E + t.init_dim.width, v = v.union(t.rect), t.arranged = !0;
357+
k = Math.max(k, t.init_dim.height), N = m + t.init_dim.width, r.nodes.push(t), t.nodes.push(t), t.location = new P(m, x), t.rect = new S(t.location.x, t.location.y, t.init_dim.width, t.init_dim.height), m = m + E + t.init_dim.width, v = v.union(t.rect), t.arranged = !0;
358358
}
359-
x = x + k + 2 * D, m = u + (N - u) / 2, r.location = new P(m, x), r.rect = new q(r.location.x, r.location.y, r.init_dim.width, r.init_dim.height), v = v.union(r.rect), r.arranged = !0, x = x + r.init_dim.height + 2 * D, m = u;
359+
x = x + k + 2 * D, m = u + (N - u) / 2, r.location = new P(m, x), r.rect = new S(r.location.x, r.location.y, r.init_dim.width, r.init_dim.height), v = v.union(r.rect), r.arranged = !0, x = x + r.init_dim.height + 2 * D, m = u;
360360
for (var a = C - 1; a >= 0; a--) {
361361
var t = g[a];
362-
r.nodes.push(t), t.nodes.push(t), t.location = new P(m, x), t.rect = new q(t.location.x, t.location.y, t.init_dim.width, t.init_dim.height), m = m + E + t.init_dim.width, v = v.union(t.rect), t.arranged = !0;
362+
r.nodes.push(t), t.nodes.push(t), t.location = new P(m, x), t.rect = new S(t.location.x, t.location.y, t.init_dim.width, t.init_dim.height), m = m + E + t.init_dim.width, v = v.union(t.rect), t.arranged = !0;
363363
}
364364
return r.rect = v, v;
365365
}, e.setLevel2 = function(r, u) {
@@ -397,7 +397,7 @@ function se(n) {
397397
}, e.arrange = function(r, u, h, v, g, p) {
398398
if (!r.arranged) {
399399
var a = v;
400-
r.location = new P(u, h), r.nodes.push(r), a === null ? a = new q(r.location.x, r.location.y, r.init_dim.width, r.init_dim.height) : a = a.union(new q(r.location.x, r.location.y, r.init_dim.width, r.init_dim.height)), r.arranged = !0;
400+
r.location = new P(u, h), r.nodes.push(r), a === null ? a = new S(r.location.x, r.location.y, r.init_dim.width, r.init_dim.height) : a = a.union(new S(r.location.x, r.location.y, r.init_dim.width, r.init_dim.height)), r.arranged = !0;
401401
var t, B = e.getNotArranged(r.refer), _ = e.getNotArranged(r.referredBy), c = [];
402402
if (!b && e.canGoLeft(g, u, h + r.init_dim.height + D, _))
403403
for (var f = _.length, y = 0; y < f; y++) {
@@ -413,16 +413,16 @@ function se(n) {
413413
c.length = 0;
414414
}
415415
if (B.length > 0)
416-
b || !x ? (_ = _.concat(B), t = e.orderDown(r, _, u, h + r.init_dim.height + D, [], r.nodes, g), a = a.union(t)) : _.length > 0 ? (t = e.orderLeft(r, _, u, h + r.init_dim.height + D, c, r.nodes, g), g == null ? g = new q(t.x, t.y, t.width, t.height) : g = g.union(t), a = a.union(t), t = e.orderDown(r, B, Math.max(u, t.x + t.width), h + r.init_dim.height + D, c, r.nodes, g), a = a.union(t)) : (t = e.orderDown(r, B, u, h + r.init_dim.height + D, c, r.nodes, g), a = a.union(t));
416+
b || !x ? (_ = _.concat(B), t = e.orderDown(r, _, u, h + r.init_dim.height + D, [], r.nodes, g), a = a.union(t)) : _.length > 0 ? (t = e.orderLeft(r, _, u, h + r.init_dim.height + D, c, r.nodes, g), g == null ? g = new S(t.x, t.y, t.width, t.height) : g = g.union(t), a = a.union(t), t = e.orderDown(r, B, Math.max(u, t.x + t.width), h + r.init_dim.height + D, c, r.nodes, g), a = a.union(t)) : (t = e.orderDown(r, B, u, h + r.init_dim.height + D, c, r.nodes, g), a = a.union(t));
417417
else if (_.length > 0)
418418
if (b || !e.canGoLeft(g, u, h + r.init_dim.height + D, _))
419419
_ = _.concat(B), t = e.orderDown(r, _, u, h + r.init_dim.height + D, [], r.nodes, g), a = a.union(t);
420420
else {
421421
var N = _[_.length - 1];
422422
t = e.orderLeftCenter(r, _, u + N.init_dim.width + E, h + r.init_dim.height + D, c, r.nodes, g), a = a.union(t);
423423
}
424-
if (r.rect = new q(a.x, a.y, a.width, a.height), p != null)
425-
for (var S = r.nodes.length, V = 0; V < S; V++) {
424+
if (r.rect = new S(a.x, a.y, a.width, a.height), p != null)
425+
for (var q = r.nodes.length, V = 0; V < q; V++) {
426426
var N = r.nodes[V];
427427
p.indexOf(N) >= 0 || p.push(N);
428428
}
@@ -448,15 +448,15 @@ function se(n) {
448448
var c = u[_];
449449
!c.arranged && !c.booked && !(g.indexOf(c) >= 0) && !c.isConnectedToBetterLevel(r, r.level) && (c.booked = !0, t.push(c));
450450
}
451-
var f = h, y = v, m = new q(h, v, 1, 1), x;
452-
a === null ? x = null : x = new q(a.x, a.y, a.width, a.height);
451+
var f = h, y = v, m = new S(h, v, 1, 1), x;
452+
a === null ? x = null : x = new S(a.x, a.y, a.width, a.height);
453453
var A = [], C = t.length;
454454
if (C > 1) {
455455
var k = e.getReferOnly(t, r);
456456
if (k.length > 0) {
457-
k.length > 1 && k.sort(Q);
458-
for (var U = r.location.y, j = D / 3, N = U + r.init_dim.height + j, S = 0; S < k.length; S++) {
459-
var c = k[S], V = U + c.init_dim.height;
457+
k.length > 1 && k.sort(J);
458+
for (var U = r.location.y, j = D / 3, N = U + r.init_dim.height + j, q = 0; q < k.length; q++) {
459+
var c = k[q], V = U + c.init_dim.height;
460460
if (V <= N) {
461461
A.push(c);
462462
var H = t.indexOf(c);
@@ -470,9 +470,9 @@ function se(n) {
470470
}
471471
}
472472
C = t.length;
473-
for (var S = 0; S < C; S++) {
474-
var c = t[S];
475-
if (C > 1 && S === C - 1 && A.length === 0)
473+
for (var q = 0; q < C; q++) {
474+
var c = t[q];
475+
if (C > 1 && q === C - 1 && A.length === 0)
476476
if (A.length === 0 && c.referOnlyAndArranged(r)) {
477477
var F = r.location.x + E + r.init_dim.width, M = e.arrange(c, F, r.location.y, null, x, p);
478478
m = m.union(M);
@@ -481,11 +481,11 @@ function se(n) {
481481
m = m.union(M);
482482
}
483483
var re = f, M = e.arrange(c, re, y, null, x, p);
484-
x == null ? x = new q(M.x, M.y, M.width, M.height) : x = x.union(M), f = Math.max(f, M.x + M.width) + E, m = m.union(M);
484+
x == null ? x = new S(M.x, M.y, M.width, M.height) : x = x.union(M), f = Math.max(f, M.x + M.width) + E, m = m.union(M);
485485
}
486-
for (var U = r.location.y, j = D / 3, F = r.location.x + E + r.init_dim.width, S = 0; S < A.length; S++) {
487-
var c = A[S];
488-
c.nodes.push(c), p != null && p.push(c), c.location = new P(F, U), c.arranged = !0, c.booked = !1, c.rect = new q(c.location.x, c.location.y, c.init_dim.width, c.init_dim.height), m = m.union(c.rect), U = U + c.init_dim.height + j;
486+
for (var U = r.location.y, j = D / 3, F = r.location.x + E + r.init_dim.width, q = 0; q < A.length; q++) {
487+
var c = A[q];
488+
c.nodes.push(c), p != null && p.push(c), c.location = new P(F, U), c.arranged = !0, c.booked = !1, c.rect = new S(c.location.x, c.location.y, c.init_dim.width, c.init_dim.height), m = m.union(c.rect), U = U + c.init_dim.height + j;
489489
}
490490
return m;
491491
}, e.getReferOnly = function(r, u) {
@@ -495,7 +495,7 @@ function se(n) {
495495
}
496496
return v;
497497
}, e.orderLeft = function(r, u, h, v, g, p, a) {
498-
for (var t = h - E, B = v, _ = new q(h, v, 1, 1), c = u.length - 1; c >= 0; c--) {
498+
for (var t = h - E, B = v, _ = new S(h, v, 1, 1), c = u.length - 1; c >= 0; c--) {
499499
var f = u[c];
500500
if (!f.arranged && !f.isConnectedToBetterLevel(r, r.level) && (!f.booked || g.indexOf(f) >= 0)) {
501501
var y = t - f.init_dim.width, m = e.arrange(f, y, B, null, a, p);
@@ -504,7 +504,7 @@ function se(n) {
504504
}
505505
return _;
506506
}, e.orderLeftCenter = function(r, u, h, v, g, p, a) {
507-
for (var t = h - E, B = v, _ = [], c = new q(h, v, 1, 1), f = u.length - 1; f >= 0; f--) {
507+
for (var t = h - E, B = v, _ = [], c = new S(h, v, 1, 1), f = u.length - 1; f >= 0; f--) {
508508
var y = u[f];
509509
!y.arranged && !y.isConnectedToBetterLevel(r, r.level) && (!y.booked || g.indexOf(y) >= 0) && _.unshift(y);
510510
}
@@ -608,7 +608,7 @@ class de {
608608
I(this, "exportAsSVG", () => {
609609
const e = this.graph.getBBox().inflate(50);
610610
this.paper.toSVG((s) => {
611-
var l = "quicksqlDiagram-";
611+
var l = "QuickSqlDiagram-";
612612
this.saveDiagram(l, s);
613613
}, {
614614
area: e,
@@ -739,7 +739,7 @@ class de {
739739
e.rearrangeDiagram(3, !1), this.paperScroller.centerContent();
740740
}
741741
}
742-
const ue = "1.2.0", fe = {
742+
const ue = "1.2.1", fe = {
743743
Diagram: de,
744744
version: ue
745745
};

dist/quick-erd.umd.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)