@metadev/daga-react 5.0.5 → 5.1.0
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.
- package/Changelog.md +431 -0
- package/LICENSE.md +13 -0
- package/README.md +78 -0
- package/index.js +3 -3
- package/index.mjs +872 -723
- package/lib/palette/PaletteComponent.d.ts +4 -1
- package/lib/property-editor/PropertyEditor.d.ts +2 -1
- package/package.json +2 -2
package/index.mjs
CHANGED
|
@@ -43,19 +43,19 @@ var p = /* @__PURE__ */ function(e) {
|
|
|
43
43
|
return e.Straight = "straight", e.Bezier = "bezier", e.Square = "square", e;
|
|
44
44
|
}({}), te = /* @__PURE__ */ function(e) {
|
|
45
45
|
return e.Solid = "solid", e.Dashed = "dashed", e.GappedDashes = "gapped-dashes", e.Dotted = "dotted", e;
|
|
46
|
-
}({}),
|
|
46
|
+
}({}), O = 20, ne = (e, t, n, r, i) => {
|
|
47
47
|
if (typeof e == "function") return e(t, n, r, i);
|
|
48
48
|
if (t.length === 0) return "";
|
|
49
49
|
if (t.length === 1) return `M ${t[0][0]} ${t[0][1]}`;
|
|
50
50
|
{
|
|
51
|
-
i ||=
|
|
51
|
+
i ||= O;
|
|
52
52
|
let a = "", o, s;
|
|
53
53
|
switch (e) {
|
|
54
|
-
case
|
|
54
|
+
case "straight":
|
|
55
55
|
a += `M ${t[0][0]} ${t[0][1]}`;
|
|
56
56
|
for (let e = 1; e < t.length; ++e) a += ` L ${t[e][0]} ${t[e][1]}`;
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case "bezier":
|
|
59
59
|
o = n, a += `M ${t[0][0]} ${t[0][1]}`;
|
|
60
60
|
for (let e = 1; e < t.length; ++e) {
|
|
61
61
|
if (e + 1 >= t.length) switch (r) {
|
|
@@ -127,7 +127,7 @@ var p = /* @__PURE__ */ function(e) {
|
|
|
127
127
|
o = s;
|
|
128
128
|
}
|
|
129
129
|
break;
|
|
130
|
-
case
|
|
130
|
+
case "square":
|
|
131
131
|
o = n, a += `M ${t[0][0]} ${t[0][1]}`;
|
|
132
132
|
for (let e = 1; e < t.length; ++e) {
|
|
133
133
|
if (e + 1 >= t.length) switch (r) {
|
|
@@ -228,32 +228,31 @@ var p = /* @__PURE__ */ function(e) {
|
|
|
228
228
|
}
|
|
229
229
|
return a;
|
|
230
230
|
}
|
|
231
|
-
},
|
|
231
|
+
}, re = (e, t) => {
|
|
232
232
|
switch (e) {
|
|
233
|
-
case
|
|
234
|
-
case
|
|
235
|
-
case
|
|
236
|
-
case te.Solid:
|
|
233
|
+
case "dotted": return `${t}`;
|
|
234
|
+
case "dashed": return `${4 * t} ${t}`;
|
|
235
|
+
case "gapped-dashes": return `${4 * t} ${4 * t}`;
|
|
237
236
|
default: return "none";
|
|
238
237
|
}
|
|
239
|
-
},
|
|
238
|
+
}, k = (e, t) => {
|
|
240
239
|
let n = e.indexOf(t);
|
|
241
240
|
return n >= 0 && e.splice(n, 1), e;
|
|
242
|
-
},
|
|
241
|
+
}, ie = /* @__PURE__ */ function(e) {
|
|
243
242
|
return e.Ellipse = "ellipse", e.Empty = "empty", e.Folder = "folder", e.Hexagon = "hexagon", e.Octagon = "octagon", e.Pill = "pill", e.Rectangle = "rectangle", e.Rhombus = "rhombus", e.RoundedRectangle = "rounded-rectangle", e.StickyNote = "sticky-note", e;
|
|
244
243
|
}({}), ae = (e, t, n, r, i) => {
|
|
245
244
|
if (typeof e == "function") return e(t, n, r, i);
|
|
246
245
|
switch (e) {
|
|
247
|
-
case
|
|
248
|
-
case
|
|
249
|
-
case
|
|
250
|
-
case
|
|
251
|
-
case
|
|
252
|
-
case
|
|
253
|
-
case
|
|
254
|
-
case
|
|
255
|
-
case
|
|
256
|
-
case
|
|
246
|
+
case "ellipse": return oe(t, n, r, i);
|
|
247
|
+
case "empty": return se();
|
|
248
|
+
case "folder": return ce(t, n, r, i);
|
|
249
|
+
case "hexagon": return le(t, n, r, i);
|
|
250
|
+
case "octagon": return ue(t, n, r, i);
|
|
251
|
+
case "pill": return de(t, n, r, i);
|
|
252
|
+
case "rectangle": return fe(t, n, r, i);
|
|
253
|
+
case "rhombus": return pe(t, n, r, i);
|
|
254
|
+
case "rounded-rectangle": return me(t, n, r, i);
|
|
255
|
+
case "sticky-note": return he(t, n, r, i);
|
|
257
256
|
default: return fe(t, n, r, i);
|
|
258
257
|
}
|
|
259
258
|
}, oe = (e, t, n, r) => `M ${e + n / 2} ${t} A ${n / 2} ${r / 2} 0 0 0 ${e + n / 2} ${t + r} A ${n / 2} ${r / 2} 0 1 0 ${e + n / 2} ${t} Z`, se = () => "Z", ce = (e, t, n, r) => `M ${e} ${t} L ${e + n / 3} ${t} L ${e + n / 2} ${t + r / 6} L ${e + n} ${t + r / 6} L ${e + n} ${t + r} L ${e} ${t + r} Z`, le = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 2} L ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} L ${e} ${t + r / 2} Z`, ue = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 4} L ${e + n} ${t + 3 * r / 4} L ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} L ${e} ${t + 3 * r / 4} L ${e} ${t + r / 4} L ${e + n / 4} ${t} Z`, de = (e, t, n, r) => r < n ? `M ${e + r / 2} ${t} L ${e + n - r / 2} ${t} A ${r / 2} ${r / 2} 0 0 1 ${e + n} ${t + r / 2} A ${r / 2} ${r / 2} 0 0 1 ${e + n - r / 2} ${t + r} L ${e + r / 2} ${t + r} A ${r / 2} ${r / 2} 0 0 1 ${e} ${t + r / 2} A ${r / 2} ${r / 2} 0 0 1 ${e + r / 2} ${t} Z` : r > n ? `M ${e} ${t + n / 2} L ${e} ${t + r - n / 2} A ${n / 2} ${n / 2} 0 0 0 ${e + n / 2} ${t + r} A ${n / 2} ${n / 2} 0 0 0 ${e + n} ${t + r - n / 2} L ${e + n} ${t + n / 2} A ${n / 2} ${n / 2} 0 0 0 ${e + n / 2} ${t} A ${n / 2} ${n / 2} 0 0 0 ${e} ${t + n / 2} Z` : oe(e, t, n, r), fe = (e, t, n, r) => `M ${e} ${t} L ${e + n} ${t} L ${e + n} ${t + r} L ${e} ${t + r} Z`, pe = (e, t, n, r) => `M ${e + n / 2} ${t} L ${e + n} ${t + r / 2} L ${e + n / 2} ${t + r} L ${e} ${t + r / 2} Z`, me = (e, t, n, r) => `M ${e + n / 4} ${t} L ${e + 3 * n / 4} ${t} A ${n / 4} ${r / 4} 0 0 1 ${e + n} ${t + r / 4} L ${e + n} ${t + 3 * r / 4} A ${n / 4} ${r / 4} 0 0 1 ${e + 3 * n / 4} ${t + r} L ${e + n / 4} ${t + r} A ${n / 4} ${r / 4} 0 0 1 ${e} ${t + 3 * r / 4} L ${e} ${t + r / 4} A ${n / 4} ${r / 4} 0 0 1 ${e + n / 4} ${t} Z`, he = (e, t, n, r) => `M ${e} ${t} L ${e + 3 * n / 4} ${t} L ${e + 3 * n / 4} ${t + r / 4} L ${e + 3 * n / 4} ${t} L ${e + n} ${t + r / 4} L ${e + 3 * n / 4} ${t + r / 4} L ${e + n} ${t + r / 4} L ${e + n} ${t + r} L ${e} ${t + r} Z`, A = /* @__PURE__ */ function(e) {
|
|
@@ -348,7 +347,7 @@ var Ce = (e) => {
|
|
|
348
347
|
}
|
|
349
348
|
remove(e) {
|
|
350
349
|
let t = this.get(e);
|
|
351
|
-
t !== void 0 && (delete this.entityMap[e],
|
|
350
|
+
t !== void 0 && (delete this.entityMap[e], k(this.entities, t));
|
|
352
351
|
}
|
|
353
352
|
size() {
|
|
354
353
|
return this.entities.length;
|
|
@@ -396,7 +395,7 @@ var Ce = (e) => {
|
|
|
396
395
|
}
|
|
397
396
|
remove(e) {
|
|
398
397
|
let t = this.get(e, !0);
|
|
399
|
-
t !== void 0 && (delete this.entityMap[e],
|
|
398
|
+
t !== void 0 && (delete this.entityMap[e], k(this.entities, t));
|
|
400
399
|
}
|
|
401
400
|
size(e = !1) {
|
|
402
401
|
return e ? super.size() : super.filter((e) => !e.removed).length;
|
|
@@ -543,10 +542,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
543
542
|
return this.valueSets[e];
|
|
544
543
|
}
|
|
545
544
|
displayProperty(e) {
|
|
546
|
-
this.displayedProperties.includes(e) || (this.displayedProperties.push(e),
|
|
545
|
+
this.displayedProperties.includes(e) || (this.displayedProperties.push(e), k(this.hiddenProperties, e));
|
|
547
546
|
}
|
|
548
547
|
hideProperty(e) {
|
|
549
|
-
this.hiddenProperties.includes(e) || (this.hiddenProperties.push(e),
|
|
548
|
+
this.hiddenProperties.includes(e) || (this.hiddenProperties.push(e), k(this.displayedProperties, e));
|
|
550
549
|
}
|
|
551
550
|
}, F = {
|
|
552
551
|
name: "",
|
|
@@ -707,10 +706,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
707
706
|
this.select()?.raise(), this.start?.raise(!1), this.end?.raise(!1);
|
|
708
707
|
}
|
|
709
708
|
setStart(e) {
|
|
710
|
-
this.start === e ? (this.startDirection = e?.direction, this.startCoords = e?.connectionPoint || [0, 0]) : (this.start !== void 0 &&
|
|
709
|
+
this.start === e ? (this.startDirection = e?.direction, this.startCoords = e?.connectionPoint || [0, 0]) : (this.start !== void 0 && k(this.start.outgoingConnections, this), this.start = e, e !== void 0 && (e.outgoingConnections.push(this), this.startDirection = e?.direction, this.startCoords = e?.connectionPoint || [0, 0])), this.updateInView();
|
|
711
710
|
}
|
|
712
711
|
setEnd(e) {
|
|
713
|
-
this.end === e ? (this.endDirection = e?.direction, this.endCoords = e?.connectionPoint || [0, 0]) : (this.end !== void 0 &&
|
|
712
|
+
this.end === e ? (this.endDirection = e?.direction, this.endCoords = e?.connectionPoint || [0, 0]) : (this.end !== void 0 && k(this.end.incomingConnections, this), this.end = e, e !== void 0 && (e.incomingConnections.push(this), this.endDirection = e?.direction, this.endCoords = e?.connectionPoint || [0, 0])), this.updateInView();
|
|
714
713
|
}
|
|
715
714
|
tighten() {
|
|
716
715
|
let e = this.model.canvas?.allowConnectionLoops || !1, t = this.model.canvas?.allowSharingPorts !== !1, n = this.model.canvas?.allowSharingBothPorts || !1, r = this.model.canvas?.tightenConnectionsAcrossPortTypes || !1;
|
|
@@ -761,35 +760,43 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
761
760
|
}
|
|
762
761
|
remove(e) {
|
|
763
762
|
let t = this.get(e, !0);
|
|
764
|
-
t && (
|
|
763
|
+
t && (k(t.start?.outgoingConnections || [], t), k(t.end?.incomingConnections || [], t), super.remove(e), t.updateInView());
|
|
765
764
|
}
|
|
766
|
-
},
|
|
765
|
+
}, Ie = /* @__PURE__ */ function(e) {
|
|
766
|
+
return e[e.OnlyWhenSelected = 0] = "OnlyWhenSelected", e;
|
|
767
|
+
}({}), L = {
|
|
767
768
|
editable: !0,
|
|
768
|
-
fontSize: 0,
|
|
769
769
|
margin: 0,
|
|
770
770
|
padding: 0,
|
|
771
|
-
fontFamily: "'Wonder Unit Sans', sans-serif",
|
|
772
|
-
color: "#000000",
|
|
773
|
-
selectedColor: "#000000",
|
|
774
|
-
backgroundColor: "transparent",
|
|
775
771
|
horizontalAlign: h.Center,
|
|
776
772
|
verticalAlign: g.Center,
|
|
777
773
|
orientation: p.Top,
|
|
778
774
|
multiline: !1,
|
|
779
775
|
fit: !1,
|
|
780
|
-
shrink: !0
|
|
781
|
-
|
|
776
|
+
shrink: !0,
|
|
777
|
+
look: {
|
|
778
|
+
lookType: "field-look",
|
|
779
|
+
fillColor: "transparent",
|
|
780
|
+
fontColor: "#000000",
|
|
781
|
+
fontFamily: "'Wonder Unit Sans', sans-serif",
|
|
782
|
+
fontSize: 10,
|
|
783
|
+
fontWeight: 400
|
|
784
|
+
}
|
|
785
|
+
}, Le = class extends Te {
|
|
782
786
|
get text() {
|
|
783
787
|
return this._text;
|
|
784
788
|
}
|
|
785
789
|
set text(e) {
|
|
786
790
|
(e == null || e?.trim() === "") && (e = this.defaultText), this._text = e, this.updateInView(), this.fit && this.model.canvas?.fitFieldRootInView(this.id, this.shrink);
|
|
787
791
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
792
|
+
get look() {
|
|
793
|
+
return this.selected ? this.highlighted ? this.selectedAndHighlightedLook : this.selectedLook : this.highlighted ? this.highlightedLook : this.defaultLook;
|
|
794
|
+
}
|
|
795
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, m) {
|
|
796
|
+
let h = `${t?.id}_field`;
|
|
797
|
+
if (e.fields.get(h) !== void 0) throw Error("DiagramField for rootElement already exists");
|
|
798
|
+
if (super(e, h), this.textTimestamp = null, this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.horizontalAlign = a, this.verticalAlign = o, this.multiline = c, !isNaN(Number(s))) this.orientation = Number(s);
|
|
799
|
+
else switch (s) {
|
|
793
800
|
case p.Top:
|
|
794
801
|
this.orientation = 0;
|
|
795
802
|
break;
|
|
@@ -804,7 +811,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
804
811
|
break;
|
|
805
812
|
default: this.orientation = 0;
|
|
806
813
|
}
|
|
807
|
-
|
|
814
|
+
let g = M(l);
|
|
815
|
+
this.defaultLook = g.defaultLook, this.selectedLook = g.selectedLook, this.highlightedLook = g.highlightedLook, this.selectedAndHighlightedLook = g.selectedAndHighlightedLook, this.defaultText = u, this._text = u, this.editable = d, this.fit = f, this.shrink = m;
|
|
808
816
|
}
|
|
809
817
|
get removed() {
|
|
810
818
|
return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed;
|
|
@@ -821,21 +829,19 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
821
829
|
getPriority() {
|
|
822
830
|
return this.rootElement?.getPriority() || 0;
|
|
823
831
|
}
|
|
824
|
-
},
|
|
832
|
+
}, Re = class extends N {
|
|
825
833
|
constructor(e) {
|
|
826
834
|
super(), this.model = e;
|
|
827
835
|
}
|
|
828
|
-
new(e, t, n, r, i, a, o, s, c, l, u, d, f
|
|
829
|
-
let
|
|
830
|
-
return super.add(
|
|
836
|
+
new(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
837
|
+
let p = new Le(this.model, e, t, n, r, i, a, o, s, c, l, u, d, f);
|
|
838
|
+
return super.add(p), p.updateInView(), e !== void 0 && (e.label = p), p;
|
|
831
839
|
}
|
|
832
840
|
remove(e) {
|
|
833
841
|
let t = this.get(e, !0);
|
|
834
842
|
t && (t.rootElement?.label !== void 0 && t.rootElement.label === t && (t.rootElement.label = void 0), super.remove(e), t.updateInView());
|
|
835
843
|
}
|
|
836
|
-
}, R = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 || e.margin.length === 2 ? e.margin[0] : (e.margin.length, e.margin[2]), z = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 ? e.margin[0] : e.margin.length === 2 || e.margin.length === 3 ? e.margin[1] : e.margin[3], B = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 ? e.margin[0] : (e.margin.length === 2 || e.margin.length, e.margin[1]), V = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : (e.margin.length === 1 || e.margin.length === 2 || e.margin.length, e.margin[0]),
|
|
837
|
-
return e[e.OnlyWhenSelected = 0] = "OnlyWhenSelected", e;
|
|
838
|
-
}({}), Ue = class {
|
|
844
|
+
}, R = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 || e.margin.length === 2 ? e.margin[0] : (e.margin.length, e.margin[2]), z = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 ? e.margin[0] : e.margin.length === 2 || e.margin.length === 3 ? e.margin[1] : e.margin[3], B = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : e.margin.length === 1 ? e.margin[0] : (e.margin.length === 2 || e.margin.length, e.margin[1]), V = (e) => e?.margin === null || e?.margin === void 0 ? L.margin : typeof e.margin == "number" ? e.margin : e.margin.length === 0 ? L.margin : (e.margin.length === 1 || e.margin.length === 2 || e.margin.length, e.margin[0]), ze = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), Be = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], Ve = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), He = (e) => e?.padding === null || e?.padding === void 0 ? L.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? L.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), Ue = class {
|
|
839
845
|
constructor(e) {
|
|
840
846
|
this.margin = e.margin || 0, this.defaultWidths = e.defaultWidths || null, this.defaultHeights = e.defaultHeights || null, this.minWidths = e.minWidths || null, this.minHeights = e.minHeights || null, this.sections = [];
|
|
841
847
|
for (let t of e.sections) {
|
|
@@ -914,11 +920,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
914
920
|
}
|
|
915
921
|
getResizableX() {
|
|
916
922
|
let e = this.type;
|
|
917
|
-
return e?.resizableX === void 0 ? this.node?.getResizableX() || !1 : e.resizableX ===
|
|
923
|
+
return e?.resizableX === void 0 ? this.node?.getResizableX() || !1 : e.resizableX === Ie.OnlyWhenSelected ? this.selected : e.resizableX;
|
|
918
924
|
}
|
|
919
925
|
getResizableY() {
|
|
920
926
|
let e = this.type;
|
|
921
|
-
return e?.resizableY === void 0 ? this.node?.getResizableY() || !1 : e.resizableY ===
|
|
927
|
+
return e?.resizableY === void 0 ? this.node?.getResizableY() || !1 : e.resizableY === Ie.OnlyWhenSelected ? this.selected : e.resizableY;
|
|
922
928
|
}
|
|
923
929
|
getClosestPortToPoint(e) {
|
|
924
930
|
if (this.ports.length !== 0) {
|
|
@@ -1007,7 +1013,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1007
1013
|
let e = {
|
|
1008
1014
|
...L,
|
|
1009
1015
|
...n.type?.label
|
|
1010
|
-
}
|
|
1016
|
+
};
|
|
1017
|
+
e.look = {
|
|
1018
|
+
...L.look,
|
|
1019
|
+
...e.look
|
|
1020
|
+
};
|
|
1021
|
+
let t = 6 * (e.look.fontSize || L.look.fontSize) + Be(e) + Ve(e), r = (e.look.fontSize || L.look.fontSize) + He(e) + ze(e), i;
|
|
1011
1022
|
switch (n.direction) {
|
|
1012
1023
|
case p.Bottom:
|
|
1013
1024
|
case p.Left:
|
|
@@ -1019,7 +1030,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1019
1030
|
break;
|
|
1020
1031
|
default: i = n.coords;
|
|
1021
1032
|
}
|
|
1022
|
-
this.model.fields.new(n, i,
|
|
1033
|
+
this.model.fields.new(n, i, t, r, e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
|
|
1023
1034
|
}
|
|
1024
1035
|
}
|
|
1025
1036
|
let l = e.type.sectionGrid?.sections?.[n]?.[t]?.label;
|
|
@@ -1028,7 +1039,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1028
1039
|
...L,
|
|
1029
1040
|
...l
|
|
1030
1041
|
};
|
|
1031
|
-
|
|
1042
|
+
e.look = {
|
|
1043
|
+
...L.look,
|
|
1044
|
+
...e.look
|
|
1045
|
+
}, this.model.fields.new(s, [s.coords[0] + z(e), s.coords[1] + V(e)], s.width - z(e) - B(e), s.height - V(e) - R(e), e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
|
|
1032
1046
|
}
|
|
1033
1047
|
return s;
|
|
1034
1048
|
}
|
|
@@ -1036,12 +1050,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1036
1050
|
let t = this.get(e, !0);
|
|
1037
1051
|
if (t) {
|
|
1038
1052
|
for (; t.ports.length > 0;) this.model.ports.remove(t.ports[0].id);
|
|
1039
|
-
t.label && this.model.fields.remove(t.label.id), t.node &&
|
|
1053
|
+
t.label && this.model.fields.remove(t.label.id), t.node && k(t.node.sections, t), super.remove(e), t.updateInView();
|
|
1040
1054
|
}
|
|
1041
1055
|
}
|
|
1042
1056
|
}, Ke = {
|
|
1043
1057
|
lookType: "shaped-look",
|
|
1044
|
-
shape:
|
|
1058
|
+
shape: ie.Rectangle,
|
|
1045
1059
|
fillColor: "#FFFFFF",
|
|
1046
1060
|
borderColor: "#000000",
|
|
1047
1061
|
borderThickness: 1,
|
|
@@ -1158,11 +1172,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1158
1172
|
}
|
|
1159
1173
|
getResizableX() {
|
|
1160
1174
|
let e = this.type.resizableX;
|
|
1161
|
-
return e ===
|
|
1175
|
+
return e === Ie.OnlyWhenSelected ? this.selected : e;
|
|
1162
1176
|
}
|
|
1163
1177
|
getResizableY() {
|
|
1164
1178
|
let e = this.type.resizableY;
|
|
1165
|
-
return e ===
|
|
1179
|
+
return e === Ie.OnlyWhenSelected ? this.selected : e;
|
|
1166
1180
|
}
|
|
1167
1181
|
getClosestPortToPoint(e) {
|
|
1168
1182
|
if (this.ports.length !== 0) {
|
|
@@ -1242,7 +1256,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1242
1256
|
n || this.children.indexOf(e) >= 0 || (this.fitToChild(e), this.children.push(e), e.parent = this, e.raise());
|
|
1243
1257
|
}
|
|
1244
1258
|
removeChild(e) {
|
|
1245
|
-
|
|
1259
|
+
k(this.children, e), e.parent = void 0;
|
|
1246
1260
|
}
|
|
1247
1261
|
fitToChild(e) {
|
|
1248
1262
|
let t = Math.max(...this.sections.map((e) => e.indexXInNode)), n = Math.max(...this.sections.map((e) => e.indexYInNode)), r = this.coords[0] - e.coords[0] + this.type.leftPadding;
|
|
@@ -1408,7 +1422,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1408
1422
|
let e = {
|
|
1409
1423
|
...L,
|
|
1410
1424
|
...a.type?.label
|
|
1411
|
-
}
|
|
1425
|
+
};
|
|
1426
|
+
e.look = {
|
|
1427
|
+
...L.look,
|
|
1428
|
+
...e.look
|
|
1429
|
+
};
|
|
1430
|
+
let t = 6 * (e.look.fontSize || L.look.fontSize) + Be(e) + Ve(e), n = (e.look.fontSize || L.look.fontSize) + He(e) + ze(e), r;
|
|
1412
1431
|
switch (a.direction) {
|
|
1413
1432
|
case p.Bottom:
|
|
1414
1433
|
case p.Left:
|
|
@@ -1420,7 +1439,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1420
1439
|
break;
|
|
1421
1440
|
default: r = a.coords;
|
|
1422
1441
|
}
|
|
1423
|
-
this.model.fields.new(a, r,
|
|
1442
|
+
this.model.fields.new(a, r, t, n, e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
|
|
1424
1443
|
}
|
|
1425
1444
|
}
|
|
1426
1445
|
if (r.label) {
|
|
@@ -1428,18 +1447,21 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1428
1447
|
...L,
|
|
1429
1448
|
...r.label
|
|
1430
1449
|
};
|
|
1431
|
-
|
|
1450
|
+
e.look = {
|
|
1451
|
+
...L.look,
|
|
1452
|
+
...e.look
|
|
1453
|
+
}, this.model.fields.new(i, [i.coords[0] + z(e), i.coords[1] + V(e)], i.width - z(e) - B(e), i.height - V(e) - R(e), e.horizontalAlign, e.verticalAlign, e.orientation, e.multiline, e.look, "", e.editable, e.fit, e.shrink);
|
|
1432
1454
|
}
|
|
1433
1455
|
if (r.decorators.length > 0) for (let e = 0; e < r.decorators.length; ++e) {
|
|
1434
1456
|
let t = r.decorators[e];
|
|
1435
|
-
this.model.decorators.new(i, [i.coords[0] + t.coords[0], i.coords[1] + t.coords[1]], t.width, t.height, i.getPriority(), t.
|
|
1457
|
+
this.model.decorators.new(i, [i.coords[0] + t.coords[0], i.coords[1] + t.coords[1]], t.width, t.height, i.getPriority(), t.svg, `${i.id}_decorator_${e}`, t.anchorPointX || "floating", t.anchorPointY || "floating");
|
|
1436
1458
|
}
|
|
1437
1459
|
return i.valueSet.resetValues(), i.model.canvas?.fitNodeInView(i.id), i;
|
|
1438
1460
|
}
|
|
1439
1461
|
remove(e) {
|
|
1440
1462
|
let t = this.get(e, !0);
|
|
1441
1463
|
if (t) {
|
|
1442
|
-
for (t.parent &&
|
|
1464
|
+
for (t.parent && k(t.parent.children, t); t.children.length > 0;) this.model.nodes.remove(t.children[0].id);
|
|
1443
1465
|
for (; t.sections.length > 0;) this.model.sections.remove(t.sections[0].id);
|
|
1444
1466
|
for (; t.ports.length > 0;) this.model.ports.remove(t.ports[0].id);
|
|
1445
1467
|
for (; t.decorators.length > 0;) this.model.decorators.remove(t.decorators[0].id);
|
|
@@ -1454,32 +1476,98 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1454
1476
|
}, Ye = (e) => {
|
|
1455
1477
|
for (let t = 0; t < e.length; ++t) for (let n = 0; n < e.length; ++n) n !== t && e[n].isAncestorOf(e[t]) && (e.splice(n, 1), --n, t > n && --t);
|
|
1456
1478
|
return e;
|
|
1457
|
-
}, Xe = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), Ze = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], Qe = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), $e = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), et = {
|
|
1479
|
+
}, Xe = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 || e.padding.length === 2 ? e.padding[0] : (e.padding.length, e.padding[2]), Ze = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 ? e.padding[0] : e.padding.length === 2 || e.padding.length === 3 ? e.padding[1] : e.padding[3], Qe = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : e.padding.length === 1 ? e.padding[0] : (e.padding.length === 2 || e.padding.length, e.padding[1]), $e = (e) => e?.padding === null || e?.padding === void 0 ? U.padding : typeof e.padding == "number" ? e.padding : e.padding.length === 0 ? U.padding : (e.padding.length === 1 || e.padding.length === 2 || e.padding.length, e.padding[0]), et = class extends Te {
|
|
1480
|
+
constructor(e, t, n, r, i, a, o, s, c = "floating", l = "floating") {
|
|
1481
|
+
if (e.objects.get(s) !== void 0) throw Error(`DiagramDecorator with id "${s}" already exists`);
|
|
1482
|
+
if (!s) throw Error("DiagramDecorator cannot have an empty or null id");
|
|
1483
|
+
super(e, s), this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.priority = a, this.svg = o, this.anchorPointX = c, this.anchorPointY = l;
|
|
1484
|
+
}
|
|
1485
|
+
get removed() {
|
|
1486
|
+
return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed;
|
|
1487
|
+
}
|
|
1488
|
+
updateInView() {
|
|
1489
|
+
this.model.canvas?.updateDecoratorsInView(this.id);
|
|
1490
|
+
}
|
|
1491
|
+
raise() {
|
|
1492
|
+
this.select()?.raise();
|
|
1493
|
+
}
|
|
1494
|
+
move(e) {
|
|
1495
|
+
this.coords = e, this.updateInView();
|
|
1496
|
+
}
|
|
1497
|
+
getPriority() {
|
|
1498
|
+
return this.priority;
|
|
1499
|
+
}
|
|
1500
|
+
}, tt = class extends N {
|
|
1501
|
+
constructor(e) {
|
|
1502
|
+
super(), this.model = e;
|
|
1503
|
+
}
|
|
1504
|
+
new(e, t, n, r, i, a, o, s = "floating", c = "floating") {
|
|
1505
|
+
let l = new et(this.model, e, t, n, r, i, a, o, s, c);
|
|
1506
|
+
return super.add(l), l.updateInView(), e !== void 0 && e.decorators.push(l), l;
|
|
1507
|
+
}
|
|
1508
|
+
remove(e) {
|
|
1509
|
+
let t = this.get(e, !0);
|
|
1510
|
+
t && ((t.rootElement instanceof W || t.rootElement instanceof H) && k(t.rootElement.decorators, t), super.remove(e), t.updateInView());
|
|
1511
|
+
}
|
|
1512
|
+
}, nt = class extends Te {
|
|
1513
|
+
constructor(e, t, n, r, i, a, o) {
|
|
1514
|
+
if (e.objects.get(o) !== void 0) throw Error(`DiagramObject with id "${o}" already exists`);
|
|
1515
|
+
if (!o) throw Error("DiagramObject cannot have an empty or null id");
|
|
1516
|
+
super(e, o), this.coords = t, this.width = n, this.height = r, this.priority = i, this.svg = a;
|
|
1517
|
+
}
|
|
1518
|
+
get removed() {
|
|
1519
|
+
return this.selfRemoved;
|
|
1520
|
+
}
|
|
1521
|
+
updateInView() {
|
|
1522
|
+
this.model.canvas?.updateObjectsInView(this.id);
|
|
1523
|
+
}
|
|
1524
|
+
raise() {
|
|
1525
|
+
this.select()?.raise();
|
|
1526
|
+
}
|
|
1527
|
+
move(e) {
|
|
1528
|
+
this.coords = e, this.updateInView();
|
|
1529
|
+
}
|
|
1530
|
+
getPriority() {
|
|
1531
|
+
return this.priority;
|
|
1532
|
+
}
|
|
1533
|
+
}, rt = class extends N {
|
|
1534
|
+
constructor(e) {
|
|
1535
|
+
super(), this.model = e;
|
|
1536
|
+
}
|
|
1537
|
+
new(e, t, n, r, i, a) {
|
|
1538
|
+
let o = new nt(this.model, e, t, n, r, i, a);
|
|
1539
|
+
return super.add(o), o.updateInView(), o;
|
|
1540
|
+
}
|
|
1541
|
+
remove(e) {
|
|
1542
|
+
let t = this.get(e, !0);
|
|
1543
|
+
t && (super.remove(e), t.updateInView());
|
|
1544
|
+
}
|
|
1545
|
+
}, it = {
|
|
1458
1546
|
lookType: "shaped-look",
|
|
1459
|
-
shape:
|
|
1547
|
+
shape: ie.Ellipse,
|
|
1460
1548
|
fillColor: "transparent",
|
|
1461
1549
|
borderColor: "transparent",
|
|
1462
1550
|
borderThickness: 0,
|
|
1463
1551
|
selected: { fillColor: "rgba(255, 0, 255, 0.5)" },
|
|
1464
1552
|
highlighted: { fillColor: "rgba(0, 255, 255, 0.5)" }
|
|
1465
|
-
},
|
|
1553
|
+
}, at = M(it), ot = {
|
|
1466
1554
|
name: "",
|
|
1467
1555
|
label: null,
|
|
1468
1556
|
allowsOutgoing: !0,
|
|
1469
1557
|
allowsIncoming: !0,
|
|
1470
1558
|
width: 24,
|
|
1471
|
-
look:
|
|
1472
|
-
},
|
|
1559
|
+
look: it
|
|
1560
|
+
}, st = class {
|
|
1473
1561
|
constructor(e) {
|
|
1474
1562
|
let t = {
|
|
1475
|
-
...
|
|
1563
|
+
...ot,
|
|
1476
1564
|
...e
|
|
1477
1565
|
};
|
|
1478
1566
|
this.id = t.id, this.name = t.name, this.label = t.label, this.allowsOutgoing = t.allowsOutgoing, this.allowsIncoming = t.allowsIncoming, this.width = t.width;
|
|
1479
1567
|
let n = M(t.look);
|
|
1480
1568
|
this.defaultLook = n.defaultLook, this.selectedLook = n.selectedLook, this.highlightedLook = n.highlightedLook, this.selectedAndHighlightedLook = n.selectedAndHighlightedLook;
|
|
1481
1569
|
}
|
|
1482
|
-
},
|
|
1570
|
+
}, ct = class extends Te {
|
|
1483
1571
|
get type() {
|
|
1484
1572
|
return this._type;
|
|
1485
1573
|
}
|
|
@@ -1509,7 +1597,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1509
1597
|
this.label && (this.label.text = e);
|
|
1510
1598
|
}
|
|
1511
1599
|
get look() {
|
|
1512
|
-
return this.selected ? this.highlighted ? this._selectedAndHighlightedLook === void 0 ? (this.type ||
|
|
1600
|
+
return this.selected ? this.highlighted ? this._selectedAndHighlightedLook === void 0 ? (this.type || at)?.selectedAndHighlightedLook : this._selectedAndHighlightedLook : this._selectedLook === void 0 ? (this.type || at)?.selectedLook : this._selectedLook : this.highlighted ? this._highlightedLook === void 0 ? (this.type || at)?.highlightedLook : this._highlightedLook : this._defaultLook === void 0 ? (this.type || at)?.defaultLook : this._defaultLook;
|
|
1513
1601
|
}
|
|
1514
1602
|
set look(e) {
|
|
1515
1603
|
this.lookConfig = e;
|
|
@@ -1536,7 +1624,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1536
1624
|
} else this._defaultLook = e, this._selectedLook = e, this._highlightedLook = e, this._selectedAndHighlightedLook = e;
|
|
1537
1625
|
}
|
|
1538
1626
|
get width() {
|
|
1539
|
-
return this.type?.width ||
|
|
1627
|
+
return this.type?.width || ot.width;
|
|
1540
1628
|
}
|
|
1541
1629
|
get height() {
|
|
1542
1630
|
return this.width;
|
|
@@ -1581,12 +1669,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1581
1669
|
distanceTo(e) {
|
|
1582
1670
|
return x(this.coords, e);
|
|
1583
1671
|
}
|
|
1584
|
-
},
|
|
1672
|
+
}, lt = class extends N {
|
|
1585
1673
|
constructor(e) {
|
|
1586
1674
|
super(), this.types = new we(), this.model = e;
|
|
1587
1675
|
}
|
|
1588
1676
|
new(e, t, n, r, i, a, o = "floating", s = "floating") {
|
|
1589
|
-
let c = new
|
|
1677
|
+
let c = new ct(this.model, e, t, n, r, i, a, o, s);
|
|
1590
1678
|
return super.add(c), c.updateInView(), t !== void 0 && t.ports.push(c), c;
|
|
1591
1679
|
}
|
|
1592
1680
|
remove(e) {
|
|
@@ -1594,29 +1682,34 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1594
1682
|
if (t) {
|
|
1595
1683
|
for (; t.outgoingConnections.length > 0;) this.model.connections.remove(t.outgoingConnections[0].id);
|
|
1596
1684
|
for (; t.incomingConnections.length > 0;) this.model.connections.remove(t.incomingConnections[0].id);
|
|
1597
|
-
t.label && this.model.fields.remove(t.label.id), (t.rootElement instanceof W || t.rootElement instanceof H) &&
|
|
1685
|
+
t.label && this.model.fields.remove(t.label.id), (t.rootElement instanceof W || t.rootElement instanceof H) && k(t.rootElement.ports, t), super.remove(e), t.updateInView();
|
|
1598
1686
|
}
|
|
1599
1687
|
}
|
|
1600
|
-
},
|
|
1688
|
+
}, ut = class {
|
|
1601
1689
|
import(e, t) {
|
|
1602
1690
|
e.clear(), t.id && (e.id = t.id), e.name = t.name, e.description = t.description, e.type = t.type, e.createdAt = new Date(t.createdAt), e.updatedAt = new Date(t.updatedAt);
|
|
1603
1691
|
for (let n of t.nodes || []) this.importNode(e, n);
|
|
1604
1692
|
for (let n of t.connections || []) this.importConnection(e, n);
|
|
1693
|
+
for (let n of t.objects || []) {
|
|
1694
|
+
let t = new nt(e, n.coords, n.width, n.height, n.priority, n.svg, n.id);
|
|
1695
|
+
n.collabMeta && (t.selfRemoved = n.collabMeta.selfRemoved), e.objects.add(t), t.updateInView();
|
|
1696
|
+
}
|
|
1605
1697
|
return t.data && e.valueSet.setValues(t.data), t.collabMeta && (e.logicalClock = t.collabMeta.logicalClock, e.valueSet.setTimestamps(t.collabMeta.dataTimestamps)), e;
|
|
1606
1698
|
}
|
|
1607
1699
|
importNode(e, t) {
|
|
1608
1700
|
let n = e.nodes.types.get(t.type);
|
|
1609
1701
|
if (n) {
|
|
1610
1702
|
let r = new W(e, n, t.coords, t.id);
|
|
1611
|
-
if (e.nodes.add(r), r.width = t.width, r.height = t.height, n.
|
|
1612
|
-
let i = n.decorators[t];
|
|
1613
|
-
e.decorators.new(r, [r.coords[0] + i.coords[0], r.coords[1] + i.coords[1]], i.width, i.height, r.getPriority(), i.html, `${r.id}_decorator_${t}`);
|
|
1614
|
-
}
|
|
1615
|
-
if (n.label) {
|
|
1703
|
+
if (e.nodes.add(r), r.width = t.width, r.height = t.height, n.label) {
|
|
1616
1704
|
let i = {
|
|
1617
1705
|
...L,
|
|
1618
1706
|
...n.label
|
|
1619
|
-
}
|
|
1707
|
+
};
|
|
1708
|
+
i.look = {
|
|
1709
|
+
...L.look,
|
|
1710
|
+
...i.look
|
|
1711
|
+
};
|
|
1712
|
+
let a = new Le(e, r, [r.coords[0] + z(i), r.coords[1] + V(i)], r.width - z(i) - B(i), r.height - V(i) - R(i), i.horizontalAlign, i.verticalAlign, i.orientation, i.multiline, i.look, "", i.editable, i.fit, i.shrink);
|
|
1620
1713
|
a.text = t.label, r.label = a, e.fields.add(a), a.updateInView();
|
|
1621
1714
|
}
|
|
1622
1715
|
for (let n of t.children || []) {
|
|
@@ -1629,69 +1722,92 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1629
1722
|
let r = {
|
|
1630
1723
|
...L,
|
|
1631
1724
|
...n.sectionGrid?.sections?.[i.indexYInNode]?.[i.indexXInNode]?.label
|
|
1632
|
-
}
|
|
1725
|
+
};
|
|
1726
|
+
r.look = {
|
|
1727
|
+
...L.look,
|
|
1728
|
+
...r.look
|
|
1729
|
+
};
|
|
1730
|
+
let a = new Le(e, t, [t.coords[0] + z(r), t.coords[1] + V(r)], t.width - z(r) - B(r), t.height - V(r) - R(r), r.horizontalAlign, r.verticalAlign, r.orientation, r.multiline, r.look, "", r.editable, r.fit, r.shrink);
|
|
1633
1731
|
a.text = i.label, t.label = a, e.fields.add(a), a.updateInView();
|
|
1634
1732
|
}
|
|
1635
1733
|
let a = 0;
|
|
1636
1734
|
for (let r of i.ports || []) {
|
|
1637
|
-
let i = r.type === void 0 ? void 0 : e.ports.types.get(r.type), o = new
|
|
1735
|
+
let i = r.type === void 0 ? void 0 : e.ports.types.get(r.type), o = new ct(e, i, t, r.coords, r.connectionPoint || r.coords, r.direction, r.id);
|
|
1638
1736
|
if (t.ports.push(o), e.ports.add(o), r.label) {
|
|
1639
1737
|
if (n.ports.length > a && i?.label) {
|
|
1640
1738
|
let t = {
|
|
1641
1739
|
...L,
|
|
1642
1740
|
...i?.label
|
|
1643
|
-
}
|
|
1741
|
+
};
|
|
1742
|
+
t.look = {
|
|
1743
|
+
...L.look,
|
|
1744
|
+
...t.look
|
|
1745
|
+
};
|
|
1746
|
+
let n;
|
|
1644
1747
|
switch (o.direction) {
|
|
1645
1748
|
case p.Top:
|
|
1646
1749
|
case p.Left:
|
|
1647
|
-
n = [o.coords[0] - t.fontSize, o.coords[1] - t.fontSize];
|
|
1750
|
+
n = [o.coords[0] - (t.look.fontSize || L.look.fontSize), o.coords[1] - (t.look.fontSize || L.look.fontSize)];
|
|
1648
1751
|
break;
|
|
1649
1752
|
case p.Bottom:
|
|
1650
|
-
n = [o.coords[0] - t.fontSize, o.coords[1] + t.fontSize];
|
|
1753
|
+
n = [o.coords[0] - (t.look.fontSize || L.look.fontSize), o.coords[1] + (t.look.fontSize || L.look.fontSize)];
|
|
1651
1754
|
break;
|
|
1652
1755
|
case p.Right:
|
|
1653
|
-
n = [o.coords[0] + t.fontSize, o.coords[1] - t.fontSize];
|
|
1756
|
+
n = [o.coords[0] + (t.look.fontSize || L.look.fontSize), o.coords[1] - (t.look.fontSize || L.look.fontSize)];
|
|
1654
1757
|
break;
|
|
1655
1758
|
default: n = o.coords;
|
|
1656
1759
|
}
|
|
1657
|
-
let a = new
|
|
1760
|
+
let a = new Le(e, o, n, t.look.fontSize || L.look.fontSize, t.look.fontSize || L.look.fontSize, t.horizontalAlign, t.verticalAlign, t.orientation, t.multiline, t.look, "", t.editable, t.fit, t.shrink);
|
|
1658
1761
|
a.text = r.label, o.label = a, e.fields.add(a), a.updateInView();
|
|
1659
1762
|
}
|
|
1660
1763
|
++a;
|
|
1661
1764
|
}
|
|
1662
1765
|
r.collabMeta && (o.selfRemoved = r.collabMeta.selfRemoved, o.selfRemovedTimestamp = r.collabMeta.selfRemovedTimestamp, this.importLabelCollabMeta(o.label, r.collabMeta.label)), o.updateInView();
|
|
1663
1766
|
}
|
|
1767
|
+
for (let n of i.decorators || []) {
|
|
1768
|
+
let i = new et(e, t, n.coords, n.width, n.height, n.priority, n.svg, n.id, n.anchorPoints[0], n.anchorPoints[1]);
|
|
1769
|
+
n.collabMeta && (i.selfRemoved = n.collabMeta.selfRemoved), r.decorators.push(i), e.decorators.add(i), i.updateInView();
|
|
1770
|
+
}
|
|
1664
1771
|
i.collabMeta && (t.selfRemoved = i.collabMeta.selfRemoved, t.selfRemovedTimestamp = i.collabMeta.selfRemovedTimestamp, this.importLabelCollabMeta(t.label, i.collabMeta.label)), t.updateInView();
|
|
1665
1772
|
}
|
|
1666
1773
|
let i = 0;
|
|
1667
1774
|
for (let a of t.ports || []) {
|
|
1668
|
-
let t = a.type === void 0 ? void 0 : e.ports.types.get(a.type), o = new
|
|
1775
|
+
let t = a.type === void 0 ? void 0 : e.ports.types.get(a.type), o = new ct(e, t, r, a.coords, a.connectionPoint || a.coords, a.direction, a.id);
|
|
1669
1776
|
if (r.ports.push(o), e.ports.add(o), a.label) {
|
|
1670
1777
|
if (n.ports.length > i && t?.label) {
|
|
1671
1778
|
let n = {
|
|
1672
1779
|
...L,
|
|
1673
1780
|
...t?.label
|
|
1674
|
-
}
|
|
1781
|
+
};
|
|
1782
|
+
n.look = {
|
|
1783
|
+
...L.look,
|
|
1784
|
+
...n.look
|
|
1785
|
+
};
|
|
1786
|
+
let r;
|
|
1675
1787
|
switch (o.direction) {
|
|
1676
1788
|
case p.Top:
|
|
1677
1789
|
case p.Left:
|
|
1678
|
-
r = [o.coords[0] - n.fontSize, o.coords[1] - n.fontSize];
|
|
1790
|
+
r = [o.coords[0] - (n.look.fontSize || L.look.fontSize), o.coords[1] - (n.look.fontSize || L.look.fontSize)];
|
|
1679
1791
|
break;
|
|
1680
1792
|
case p.Bottom:
|
|
1681
|
-
r = [o.coords[0] - n.fontSize, o.coords[1] + n.fontSize];
|
|
1793
|
+
r = [o.coords[0] - (n.look.fontSize || L.look.fontSize), o.coords[1] + (n.look.fontSize || L.look.fontSize)];
|
|
1682
1794
|
break;
|
|
1683
1795
|
case p.Right:
|
|
1684
|
-
r = [o.coords[0] + n.fontSize, o.coords[1] - n.fontSize];
|
|
1796
|
+
r = [o.coords[0] + (n.look.fontSize || L.look.fontSize), o.coords[1] - (n.look.fontSize || L.look.fontSize)];
|
|
1685
1797
|
break;
|
|
1686
1798
|
default: r = o.coords;
|
|
1687
1799
|
}
|
|
1688
|
-
let i = new
|
|
1800
|
+
let i = new Le(e, o, r, n.look.fontSize || L.look.fontSize, n.look.fontSize || L.look.fontSize, n.horizontalAlign, n.verticalAlign, n.orientation, n.multiline, n.look, "", n.editable, n.fit, n.shrink);
|
|
1689
1801
|
i.text = a.label, o.label = i, e.fields.add(i), i.updateInView();
|
|
1690
1802
|
}
|
|
1691
1803
|
++i;
|
|
1692
1804
|
}
|
|
1693
1805
|
a.collabMeta && (o.selfRemoved = a.collabMeta.selfRemoved, o.selfRemovedTimestamp = a.collabMeta.selfRemovedTimestamp, this.importLabelCollabMeta(o.label, a.collabMeta.label)), o.updateInView();
|
|
1694
1806
|
}
|
|
1807
|
+
for (let n of t.decorators || []) {
|
|
1808
|
+
let t = new et(e, r, n.coords, n.width, n.height, n.priority, n.svg, n.id, n.anchorPoints[0], n.anchorPoints[1]);
|
|
1809
|
+
n.collabMeta && (t.selfRemoved = n.collabMeta.selfRemoved), r.decorators.push(t), e.decorators.add(t), t.updateInView();
|
|
1810
|
+
}
|
|
1695
1811
|
return t.data && r.valueSet.setValues(t.data), t.collabMeta && (r.selfRemoved = t.collabMeta.selfRemoved, r.selfRemovedTimestamp = t.collabMeta.selfRemovedTimestamp, r.geometryTimestamp = t.collabMeta.geometryTimestamp, this.importLabelCollabMeta(r.label, t.collabMeta.label), r.valueSet.setTimestamps(t.collabMeta.dataTimestamps)), r.updateInView(), r.raise(), r;
|
|
1696
1812
|
}
|
|
1697
1813
|
}
|
|
@@ -1705,7 +1821,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1705
1821
|
importLabelCollabMeta(e, t) {
|
|
1706
1822
|
e && t && (e.selfRemoved = t.selfRemoved, e.selfRemovedTimestamp = t.selfRemovedTimestamp, e.textTimestamp = t.textTimestamp);
|
|
1707
1823
|
}
|
|
1708
|
-
},
|
|
1824
|
+
}, dt = class e {
|
|
1709
1825
|
constructor(e, t, n, r, i, a, o) {
|
|
1710
1826
|
this.canvas = e, this.id = t, this.typeId = n, this.coords = r, this.parentId = i, this.label = a, this.values = o;
|
|
1711
1827
|
}
|
|
@@ -1730,7 +1846,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1730
1846
|
static deserialize(t, n) {
|
|
1731
1847
|
return new e(t, n.id, n.typeId, n.coords, n.parentId, n.label, n.values);
|
|
1732
1848
|
}
|
|
1733
|
-
},
|
|
1849
|
+
}, ft = class e {
|
|
1734
1850
|
constructor(e, t, n, r, i, a, o) {
|
|
1735
1851
|
this.canvas = e, this.nodeId = t, this.copyColumnIndex = n, this.copyRowIndex = r, this.removeColumnIndex = i, this.removeRowIndex = a, this.timestamp = o;
|
|
1736
1852
|
}
|
|
@@ -1752,7 +1868,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1752
1868
|
static deserialize(t, n) {
|
|
1753
1869
|
return new e(t, n.nodeId, n.copyColumnIndex, n.copyRowIndex, n.removeColumnIndex, n.removeRowIndex, n.timestamp);
|
|
1754
1870
|
}
|
|
1755
|
-
},
|
|
1871
|
+
}, pt = class e {
|
|
1756
1872
|
constructor(e, t, n) {
|
|
1757
1873
|
this.canvas = e, this.to = t, this.timestamp = n;
|
|
1758
1874
|
}
|
|
@@ -1775,7 +1891,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1775
1891
|
static deserialize(t, n) {
|
|
1776
1892
|
return new e(t, n.to, n.timestamp);
|
|
1777
1893
|
}
|
|
1778
|
-
},
|
|
1894
|
+
}, mt = class e {
|
|
1779
1895
|
constructor(e, t, n, r) {
|
|
1780
1896
|
this.canvas = e, this.nodeIds = t, this.delta = n, this.timestamp = r;
|
|
1781
1897
|
}
|
|
@@ -1819,7 +1935,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1819
1935
|
static deserialize(t, n) {
|
|
1820
1936
|
return new e(t, n.nodeId, n.to, n.timestamp);
|
|
1821
1937
|
}
|
|
1822
|
-
},
|
|
1938
|
+
}, ht = class e {
|
|
1823
1939
|
constructor(e, t, n, r, i) {
|
|
1824
1940
|
this.canvas = e, this.childId = t, this.parentId = n, this.childGeometry = r, this.timestamp = i;
|
|
1825
1941
|
}
|
|
@@ -1839,7 +1955,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1839
1955
|
static deserialize(t, n) {
|
|
1840
1956
|
return new e(t, n.childId, n.parentId, n.childGeometry, n.timestamp);
|
|
1841
1957
|
}
|
|
1842
|
-
},
|
|
1958
|
+
}, gt = class e {
|
|
1843
1959
|
constructor(e, t, n, r, i) {
|
|
1844
1960
|
this.canvas = e, this.id = t, this.typeId = n, this.startId = r, this.endId = i;
|
|
1845
1961
|
}
|
|
@@ -1859,7 +1975,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1859
1975
|
static deserialize(t, n) {
|
|
1860
1976
|
return new e(t, n.id, n.typeId, n.startId, n.endId);
|
|
1861
1977
|
}
|
|
1862
|
-
},
|
|
1978
|
+
}, _t = class e {
|
|
1863
1979
|
constructor(e, t, n, r) {
|
|
1864
1980
|
this.canvas = e, this.fieldId = t, this.to = n, this.timestamp = r;
|
|
1865
1981
|
}
|
|
@@ -1878,7 +1994,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1878
1994
|
static deserialize(t, n) {
|
|
1879
1995
|
return new e(t, n.fieldId, n.to, n.timestamp);
|
|
1880
1996
|
}
|
|
1881
|
-
},
|
|
1997
|
+
}, vt = class e {
|
|
1882
1998
|
constructor(e, t, n, r) {
|
|
1883
1999
|
this.canvas = e, this.id = t, this.to = n, this.timestamp = r;
|
|
1884
2000
|
}
|
|
@@ -1899,7 +2015,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1899
2015
|
static deserialize(t, n) {
|
|
1900
2016
|
return new e(t, n.id, n.to, n.timestamp);
|
|
1901
2017
|
}
|
|
1902
|
-
},
|
|
2018
|
+
}, yt = class e {
|
|
1903
2019
|
constructor(e, t, n, r, i, a, o, s) {
|
|
1904
2020
|
this.canvas = e, this.nodeIds = t, this.sectionIds = n, this.portIds = r, this.connectionIds = i, this.fieldIds = a, this.selfRemoved = o, this.timestamp = s;
|
|
1905
2021
|
}
|
|
@@ -1929,12 +2045,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1929
2045
|
static deserialize(t, n) {
|
|
1930
2046
|
return new e(t, n.nodeIds, n.sectionIds, n.portIds, n.connectionIds, n.fieldIds, n.removed, n.timestamp);
|
|
1931
2047
|
}
|
|
1932
|
-
},
|
|
2048
|
+
}, bt = class e {
|
|
1933
2049
|
constructor(e, t, n) {
|
|
1934
2050
|
this.canvas = e, this.nodes = t, this.connections = n;
|
|
1935
2051
|
}
|
|
1936
2052
|
do() {
|
|
1937
|
-
let e = new
|
|
2053
|
+
let e = new ut();
|
|
1938
2054
|
this.canvas.userSelection.clear();
|
|
1939
2055
|
for (let t of this.nodes) {
|
|
1940
2056
|
let n = e.importNode(this.canvas.model, t);
|
|
@@ -1955,7 +2071,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1955
2071
|
static deserialize(t, n) {
|
|
1956
2072
|
return new e(t, n.nodes, n.connections);
|
|
1957
2073
|
}
|
|
1958
|
-
},
|
|
2074
|
+
}, xt = class {
|
|
1959
2075
|
constructor(e) {
|
|
1960
2076
|
this.isInRoom = !1, this.canvas = e, this.replicaId = xe();
|
|
1961
2077
|
}
|
|
@@ -1974,49 +2090,49 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
1974
2090
|
receive(e) {
|
|
1975
2091
|
switch ("timestamp" in e && (this.canvas.model.logicalClock = Math.max(this.canvas.model.logicalClock, e.timestamp[0])), e.type) {
|
|
1976
2092
|
case "addNode":
|
|
1977
|
-
|
|
2093
|
+
dt.deserialize(this.canvas, e).do();
|
|
1978
2094
|
break;
|
|
1979
2095
|
case "addSection":
|
|
1980
|
-
|
|
2096
|
+
ft.deserialize(this.canvas, e).do();
|
|
1981
2097
|
break;
|
|
1982
2098
|
case "applyLayout":
|
|
1983
|
-
|
|
2099
|
+
pt.deserialize(this.canvas, e).do();
|
|
1984
2100
|
break;
|
|
1985
2101
|
case "move":
|
|
1986
|
-
|
|
2102
|
+
mt.deserialize(this.canvas, e).do();
|
|
1987
2103
|
break;
|
|
1988
2104
|
case "setGeometry":
|
|
1989
2105
|
G.deserialize(this.canvas, e).do();
|
|
1990
2106
|
break;
|
|
1991
2107
|
case "setParent":
|
|
1992
|
-
|
|
2108
|
+
ht.deserialize(this.canvas, e).do();
|
|
1993
2109
|
break;
|
|
1994
2110
|
case "addConnection":
|
|
1995
|
-
|
|
2111
|
+
gt.deserialize(this.canvas, e).do();
|
|
1996
2112
|
break;
|
|
1997
2113
|
case "editField":
|
|
1998
|
-
|
|
2114
|
+
_t.deserialize(this.canvas, e).do();
|
|
1999
2115
|
break;
|
|
2000
2116
|
case "updateValues":
|
|
2001
|
-
|
|
2117
|
+
vt.deserialize(this.canvas, e).do();
|
|
2002
2118
|
break;
|
|
2003
2119
|
case "setSelfRemoved":
|
|
2004
|
-
|
|
2120
|
+
yt.deserialize(this.canvas, e).do();
|
|
2005
2121
|
break;
|
|
2006
2122
|
case "paste":
|
|
2007
|
-
|
|
2123
|
+
bt.deserialize(this.canvas, e).do();
|
|
2008
2124
|
break;
|
|
2009
2125
|
default: console.error("Unknown CollabAction type, skipping:", e);
|
|
2010
2126
|
}
|
|
2011
2127
|
}
|
|
2012
|
-
},
|
|
2128
|
+
}, St = class {
|
|
2013
2129
|
constructor(e, t) {
|
|
2014
2130
|
this.canvas = e, this.maximum = t, this.history = [], this.index = 0;
|
|
2015
2131
|
}
|
|
2016
2132
|
add(e) {
|
|
2017
2133
|
this.index < this.history.length && (this.history = this.history.slice(0, this.index)), this.history.length >= this.maximum ? (this.history = this.history.slice(1, this.history.length), this.history.push(e)) : (this.history.push(e), ++this.index), this.canvas.diagramChange$.next({
|
|
2018
2134
|
action: e,
|
|
2019
|
-
method:
|
|
2135
|
+
method: 0
|
|
2020
2136
|
});
|
|
2021
2137
|
}
|
|
2022
2138
|
undo() {
|
|
@@ -2029,7 +2145,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2029
2145
|
}
|
|
2030
2146
|
this.canvas.diagramChange$.next({
|
|
2031
2147
|
action: e,
|
|
2032
|
-
method:
|
|
2148
|
+
method: 1
|
|
2033
2149
|
});
|
|
2034
2150
|
}
|
|
2035
2151
|
redo() {
|
|
@@ -2042,19 +2158,17 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2042
2158
|
}
|
|
2043
2159
|
this.canvas.diagramChange$.next({
|
|
2044
2160
|
action: e,
|
|
2045
|
-
method:
|
|
2161
|
+
method: 2
|
|
2046
2162
|
});
|
|
2047
2163
|
}
|
|
2048
|
-
},
|
|
2049
|
-
return e[e.Do = 0] = "Do", e[e.Undo = 1] = "Undo", e[e.Redo = 2] = "Redo", e;
|
|
2050
|
-
}({}), q = /* @__PURE__ */ function(e) {
|
|
2164
|
+
}, K = /* @__PURE__ */ function(e) {
|
|
2051
2165
|
return e.AddConnection = "add-connection", e.AddNode = "add-node", e.AddSectionAction = "add-section", e.ApplyLayout = "apply-layout", e.Clipboard = "clipboard", e.ContextMenu = "context-menu", e.EditField = "edit-field", e.MoveNode = "move-node", e.Paste = "paste", e.Remove = "remove", e.StretchNode = "stretch-node", e.StretchSection = "stretch-section", e.UpdateValues = "update-values", e.Zoom = "zoom", e;
|
|
2052
|
-
}({}),
|
|
2166
|
+
}({}), Ct = class {
|
|
2053
2167
|
constructor(e, t, n, r, i, a, o, s, c) {
|
|
2054
2168
|
this.canvas = e, this.type = t, this.coords = n, this.parentId = r, this.ancestorId = i, this.fromAncestorGeometry = a, this.toAncestorGeometry = o, this.label = s, this.values = c, this.id = this.canvas.collabEngine.freshId();
|
|
2055
2169
|
}
|
|
2056
2170
|
do() {
|
|
2057
|
-
let e = new
|
|
2171
|
+
let e = new dt(this.canvas, this.id, this.type.id, this.coords, this.parentId, this.label, this.values);
|
|
2058
2172
|
if (this.canvas.collabEngine.doCollaboratively(e), this.ancestorId !== void 0 && this.toAncestorGeometry !== void 0) {
|
|
2059
2173
|
let e = new G(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2060
2174
|
this.canvas.collabEngine.doCollaboratively(e);
|
|
@@ -2062,7 +2176,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2062
2176
|
return !0;
|
|
2063
2177
|
}
|
|
2064
2178
|
undo() {
|
|
2065
|
-
let e = this.canvas.model.nodes.get(this.id), t = new
|
|
2179
|
+
let e = this.canvas.model.nodes.get(this.id), t = new yt(this.canvas, [this.id], [], [], [], [], !0, this.canvas.collabEngine.freshTimestamp());
|
|
2066
2180
|
if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.fromAncestorGeometry !== void 0) {
|
|
2067
2181
|
let e = new G(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2068
2182
|
this.canvas.collabEngine.doCollaboratively(e);
|
|
@@ -2070,29 +2184,29 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2070
2184
|
return e !== void 0;
|
|
2071
2185
|
}
|
|
2072
2186
|
redo() {
|
|
2073
|
-
let e = this.canvas.model.nodes.get(this.id), t = new
|
|
2187
|
+
let e = this.canvas.model.nodes.get(this.id), t = new yt(this.canvas, [this.id], [], [], [], [], !1, this.canvas.collabEngine.freshTimestamp());
|
|
2074
2188
|
if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.toAncestorGeometry !== void 0) {
|
|
2075
2189
|
let e = new G(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2076
2190
|
this.canvas.collabEngine.doCollaboratively(e);
|
|
2077
2191
|
}
|
|
2078
2192
|
return e === void 0;
|
|
2079
2193
|
}
|
|
2080
|
-
},
|
|
2194
|
+
}, wt = class {
|
|
2081
2195
|
constructor(e, t, n) {
|
|
2082
2196
|
this.canvas = e, this.nodeIds = t, this.delta = n;
|
|
2083
2197
|
}
|
|
2084
2198
|
do() {
|
|
2085
|
-
let e = new
|
|
2199
|
+
let e = new mt(this.canvas, this.nodeIds, this.delta, this.canvas.collabEngine.freshTimestamp());
|
|
2086
2200
|
return this.canvas.collabEngine.doCollaboratively(e), this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) && (this.delta[0] !== 0 || this.delta[1] !== 0);
|
|
2087
2201
|
}
|
|
2088
2202
|
undo() {
|
|
2089
|
-
let e = new
|
|
2203
|
+
let e = new mt(this.canvas, this.nodeIds, [-this.delta[0], -this.delta[1]], this.canvas.collabEngine.freshTimestamp());
|
|
2090
2204
|
return this.canvas.collabEngine.doCollaboratively(e), this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) && (this.delta[0] !== 0 || this.delta[1] !== 0);
|
|
2091
2205
|
}
|
|
2092
2206
|
redo() {
|
|
2093
2207
|
return this.do();
|
|
2094
2208
|
}
|
|
2095
|
-
},
|
|
2209
|
+
}, q = class {
|
|
2096
2210
|
constructor(e, t, n, r, i, a, o, s) {
|
|
2097
2211
|
this.canvas = e, this.intent = t, this.nodeId = n, this.from = r, this.to = i, this.ancestorId = a, this.fromAncestorGeometry = o, this.toAncestorGeometry = s;
|
|
2098
2212
|
}
|
|
@@ -2128,12 +2242,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2128
2242
|
}
|
|
2129
2243
|
return e !== void 0;
|
|
2130
2244
|
}
|
|
2131
|
-
},
|
|
2245
|
+
}, Tt = class {
|
|
2132
2246
|
constructor(e, t, n, r, i, a, o, s, c) {
|
|
2133
2247
|
this.canvas = e, this.childId = t, this.fromParentId = n, this.toParentId = r, this.fromChildGeometry = i, this.toChildGeometry = a, this.ancestorId = o, this.fromAncestorGeometry = s, this.toAncestorGeometry = c;
|
|
2134
2248
|
}
|
|
2135
2249
|
do() {
|
|
2136
|
-
let e = this.canvas.model.nodes.get(this.childId), t = new
|
|
2250
|
+
let e = this.canvas.model.nodes.get(this.childId), t = new ht(this.canvas, this.childId, this.toParentId, this.toChildGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2137
2251
|
if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.toAncestorGeometry !== void 0) {
|
|
2138
2252
|
let e = new G(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2139
2253
|
this.canvas.collabEngine.doCollaboratively(e);
|
|
@@ -2141,7 +2255,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2141
2255
|
return e !== void 0;
|
|
2142
2256
|
}
|
|
2143
2257
|
undo() {
|
|
2144
|
-
let e = this.canvas.model.nodes.get(this.childId), t = new
|
|
2258
|
+
let e = this.canvas.model.nodes.get(this.childId), t = new ht(this.canvas, this.childId, this.fromParentId, this.fromChildGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2145
2259
|
if (this.canvas.collabEngine.doCollaboratively(t), this.ancestorId !== void 0 && this.fromAncestorGeometry !== void 0) {
|
|
2146
2260
|
let e = new G(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
2147
2261
|
this.canvas.collabEngine.doCollaboratively(e);
|
|
@@ -2151,35 +2265,35 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2151
2265
|
redo() {
|
|
2152
2266
|
return this.do();
|
|
2153
2267
|
}
|
|
2154
|
-
},
|
|
2268
|
+
}, Et = class {
|
|
2155
2269
|
constructor(e, t, n, r) {
|
|
2156
2270
|
this.canvas = e, this.type = t, this.startId = n, this.endId = r, this.id = this.canvas.collabEngine.freshId();
|
|
2157
2271
|
}
|
|
2158
2272
|
do() {
|
|
2159
|
-
let e = new
|
|
2273
|
+
let e = new gt(this.canvas, this.id, this.type.id, this.startId, this.endId);
|
|
2160
2274
|
return this.canvas.collabEngine.doCollaboratively(e), !0;
|
|
2161
2275
|
}
|
|
2162
2276
|
undo() {
|
|
2163
|
-
let e = this.canvas.model.connections.get(this.id), t = new
|
|
2277
|
+
let e = this.canvas.model.connections.get(this.id), t = new yt(this.canvas, [], [], [], [this.id], [], !0, this.canvas.collabEngine.freshTimestamp());
|
|
2164
2278
|
return this.canvas.collabEngine.doCollaboratively(t), e !== void 0;
|
|
2165
2279
|
}
|
|
2166
2280
|
redo() {
|
|
2167
|
-
let e = this.canvas.model.connections.get(this.id), t = new
|
|
2281
|
+
let e = this.canvas.model.connections.get(this.id), t = new yt(this.canvas, [], [], [], [this.id], [], !1, this.canvas.collabEngine.freshTimestamp());
|
|
2168
2282
|
return this.canvas.collabEngine.doCollaboratively(t), e === void 0;
|
|
2169
2283
|
}
|
|
2170
|
-
},
|
|
2284
|
+
}, Dt = class {
|
|
2171
2285
|
constructor(e, t, n, r) {
|
|
2172
2286
|
this.canvas = e, this.fieldId = t, this.from = n, this.to = r;
|
|
2173
2287
|
}
|
|
2174
2288
|
do() {
|
|
2175
|
-
let e = this.canvas.model.fields.get(this.fieldId), t = new
|
|
2289
|
+
let e = this.canvas.model.fields.get(this.fieldId), t = new _t(this.canvas, this.fieldId, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
2176
2290
|
return this.canvas.collabEngine.doCollaboratively(t), e !== void 0;
|
|
2177
2291
|
}
|
|
2178
2292
|
undo() {
|
|
2179
2293
|
let e = this.canvas.model.fields.get(this.fieldId);
|
|
2180
2294
|
if (e) {
|
|
2181
2295
|
this.to = e.text;
|
|
2182
|
-
let t = new
|
|
2296
|
+
let t = new _t(this.canvas, this.fieldId, this.from, this.canvas.collabEngine.freshTimestamp());
|
|
2183
2297
|
this.canvas.collabEngine.doCollaboratively(t);
|
|
2184
2298
|
}
|
|
2185
2299
|
return e !== void 0;
|
|
@@ -2188,47 +2302,47 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2188
2302
|
let e = this.canvas.model.fields.get(this.fieldId);
|
|
2189
2303
|
if (e) {
|
|
2190
2304
|
this.from = e.text;
|
|
2191
|
-
let t = new
|
|
2305
|
+
let t = new _t(this.canvas, this.fieldId, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
2192
2306
|
this.canvas.collabEngine.doCollaboratively(t);
|
|
2193
2307
|
}
|
|
2194
2308
|
return e !== void 0;
|
|
2195
2309
|
}
|
|
2196
|
-
},
|
|
2310
|
+
}, Ot = class {
|
|
2197
2311
|
constructor(e, t, n, r) {
|
|
2198
2312
|
this.canvas = e, this.id = t, this.from = n, this.to = r;
|
|
2199
2313
|
}
|
|
2200
2314
|
do() {
|
|
2201
|
-
let e = new
|
|
2315
|
+
let e = new vt(this.canvas, this.id, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
2202
2316
|
return this.canvas.collabEngine.doCollaboratively(e), !0;
|
|
2203
2317
|
}
|
|
2204
2318
|
undo() {
|
|
2205
|
-
let e = new
|
|
2319
|
+
let e = new vt(this.canvas, this.id, this.from, this.canvas.collabEngine.freshTimestamp()), t = e.getValueSet();
|
|
2206
2320
|
if (t) this.to = t.getValuesForKeys(this.to), this.canvas.collabEngine.doCollaboratively(e);
|
|
2207
2321
|
else return !1;
|
|
2208
2322
|
return !t.rootElement.removed;
|
|
2209
2323
|
}
|
|
2210
2324
|
redo() {
|
|
2211
|
-
let e = new
|
|
2325
|
+
let e = new vt(this.canvas, this.id, this.to, this.canvas.collabEngine.freshTimestamp()), t = e.getValueSet();
|
|
2212
2326
|
if (t) this.from = t.getValuesForKeys(this.from), this.canvas.collabEngine.doCollaboratively(e);
|
|
2213
2327
|
else return !1;
|
|
2214
2328
|
return !t.rootElement.removed;
|
|
2215
2329
|
}
|
|
2216
|
-
},
|
|
2330
|
+
}, kt = class {
|
|
2217
2331
|
constructor(e, t, n, r, i, a) {
|
|
2218
2332
|
this.canvas = e, this.nodeIds = t, this.sectionIds = n, this.portIds = r, this.connectionIds = i, this.fieldIds = a;
|
|
2219
2333
|
}
|
|
2220
2334
|
do() {
|
|
2221
|
-
let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) !== void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) !== void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) !== void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) !== void 0).includes(!0), t = new
|
|
2335
|
+
let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) !== void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) !== void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) !== void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) !== void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) !== void 0).includes(!0), t = new yt(this.canvas, this.nodeIds, this.sectionIds, this.portIds, this.connectionIds, this.fieldIds, !0, this.canvas.collabEngine.freshTimestamp());
|
|
2222
2336
|
return this.canvas.collabEngine.doCollaboratively(t), e;
|
|
2223
2337
|
}
|
|
2224
2338
|
undo() {
|
|
2225
|
-
let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) === void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) === void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) === void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) === void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) === void 0).includes(!0), t = new
|
|
2339
|
+
let e = this.nodeIds.map((e) => this.canvas.model.nodes.get(e) === void 0).includes(!0) || this.sectionIds.map((e) => this.canvas.model.sections.get(e) === void 0).includes(!0) || this.portIds.map((e) => this.canvas.model.ports.get(e) === void 0).includes(!0) || this.connectionIds.map((e) => this.canvas.model.connections.get(e) === void 0).includes(!0) || this.fieldIds.map((e) => this.canvas.model.fields.get(e) === void 0).includes(!0), t = new yt(this.canvas, this.nodeIds, this.sectionIds, this.portIds, this.connectionIds, this.fieldIds, !1, this.canvas.collabEngine.freshTimestamp());
|
|
2226
2340
|
return this.canvas.collabEngine.doCollaboratively(t), e;
|
|
2227
2341
|
}
|
|
2228
2342
|
redo() {
|
|
2229
2343
|
return this.do();
|
|
2230
2344
|
}
|
|
2231
|
-
},
|
|
2345
|
+
}, At = class {
|
|
2232
2346
|
constructor(e, t, n, r) {
|
|
2233
2347
|
this.canvas = e, this.nodes = t, this.connections = n, this.coords = r;
|
|
2234
2348
|
}
|
|
@@ -2254,233 +2368,201 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2254
2368
|
let r = this.canvas.collabEngine.freshId();
|
|
2255
2369
|
if (n[e.id] = r, e.id = r, e.start = n[e.start] || e.start, e.end = n[e.end] || e.end, t) for (let n = 0; n < e.points.length; ++n) e.points[n] = [e.points[n][0] + t[0], e.points[n][1] + t[1]];
|
|
2256
2370
|
}
|
|
2257
|
-
let r = new
|
|
2371
|
+
let r = new bt(this.canvas, this.nodes, this.connections);
|
|
2258
2372
|
return this.canvas.collabEngine.doCollaboratively(r), !0;
|
|
2259
2373
|
}
|
|
2260
2374
|
undo() {
|
|
2261
|
-
let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) !== void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) !== void 0).includes(!0), t = new
|
|
2375
|
+
let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) !== void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) !== void 0).includes(!0), t = new yt(this.canvas, this.nodes.map((e) => e.id), [], [], this.connections.map((e) => e.id), [], !0, this.canvas.collabEngine.freshTimestamp());
|
|
2262
2376
|
return this.canvas.collabEngine.doCollaboratively(t), e;
|
|
2263
2377
|
}
|
|
2264
2378
|
redo() {
|
|
2265
|
-
let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) === void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) === void 0).includes(!0), t = new
|
|
2379
|
+
let e = this.nodes.map((e) => this.canvas.model.nodes.get(e.id) === void 0).includes(!0) || this.connections.map((e) => this.canvas.model.connections.get(e.id) === void 0).includes(!0), t = new yt(this.canvas, this.nodes.map((e) => e.id), [], [], this.connections.map((e) => e.id), [], !1, this.canvas.collabEngine.freshTimestamp());
|
|
2266
2380
|
return this.canvas.collabEngine.doCollaboratively(t), e;
|
|
2267
2381
|
}
|
|
2268
|
-
},
|
|
2382
|
+
}, jt = class {
|
|
2269
2383
|
constructor(e) {
|
|
2270
2384
|
this.type = e, this.defaultPrevented = !1;
|
|
2271
2385
|
}
|
|
2272
2386
|
preventDefault() {
|
|
2273
2387
|
this.defaultPrevented = !0;
|
|
2274
2388
|
}
|
|
2275
|
-
},
|
|
2389
|
+
}, Mt = /* @__PURE__ */ function(e) {
|
|
2276
2390
|
return e[e.Zoom = 0] = "Zoom", e[e.DoubleClick = 1] = "DoubleClick", e[e.SecondaryClick = 2] = "SecondaryClick", e[e.Selection = 3] = "Selection", e[e.Highlight = 4] = "Highlight", e[e.DraggingNode = 5] = "DraggingNode", e;
|
|
2277
|
-
}({}),
|
|
2391
|
+
}({}), Nt = class extends jt {
|
|
2278
2392
|
constructor(e, t) {
|
|
2279
|
-
super(
|
|
2393
|
+
super(0), this.coords = e, this.zoom = t;
|
|
2280
2394
|
}
|
|
2281
|
-
},
|
|
2395
|
+
}, Pt = class extends jt {
|
|
2282
2396
|
constructor(e, t, n) {
|
|
2283
|
-
super(
|
|
2397
|
+
super(1), this.cause = e, this.target = t, this.coords = n;
|
|
2284
2398
|
}
|
|
2285
|
-
},
|
|
2399
|
+
}, Ft = class extends jt {
|
|
2286
2400
|
constructor(e, t, n) {
|
|
2287
|
-
super(
|
|
2401
|
+
super(2), this.cause = e, this.target = t, this.coords = n;
|
|
2288
2402
|
}
|
|
2289
|
-
},
|
|
2403
|
+
}, J = class extends jt {
|
|
2290
2404
|
constructor(e, t) {
|
|
2291
|
-
super(
|
|
2405
|
+
super(3), this.targets = e, this.selected = t;
|
|
2292
2406
|
}
|
|
2293
|
-
},
|
|
2407
|
+
}, Y = class extends jt {
|
|
2294
2408
|
constructor(e) {
|
|
2295
|
-
super(
|
|
2409
|
+
super(4), this.target = e;
|
|
2296
2410
|
}
|
|
2297
|
-
},
|
|
2411
|
+
}, It = class extends jt {
|
|
2298
2412
|
constructor(e) {
|
|
2299
|
-
super(
|
|
2300
|
-
}
|
|
2301
|
-
}, Nt = class extends Te {
|
|
2302
|
-
constructor(e, t, n, r, i, a, o, s, c = "floating", l = "floating") {
|
|
2303
|
-
if (e.objects.get(s) !== void 0) throw Error(`DiagramDecorator with id "${s}" already exists`);
|
|
2304
|
-
if (!s) throw Error("DiagramDecorator cannot have an empty or null id");
|
|
2305
|
-
super(e, s), this.rootElement = t, this.coords = n, this.width = r, this.height = i, this.priority = a, this.html = o, this.anchorPointX = c, this.anchorPointY = l;
|
|
2306
|
-
}
|
|
2307
|
-
get removed() {
|
|
2308
|
-
return this.selfRemoved || this.rootElement !== void 0 && this.rootElement.removed;
|
|
2309
|
-
}
|
|
2310
|
-
updateInView() {
|
|
2311
|
-
this.model.canvas?.updateDecoratorsInView(this.id);
|
|
2312
|
-
}
|
|
2313
|
-
raise() {
|
|
2314
|
-
this.select()?.raise();
|
|
2315
|
-
}
|
|
2316
|
-
move(e) {
|
|
2317
|
-
this.coords = e, this.updateInView();
|
|
2318
|
-
}
|
|
2319
|
-
getPriority() {
|
|
2320
|
-
return this.priority;
|
|
2321
|
-
}
|
|
2322
|
-
}, Pt = class extends N {
|
|
2323
|
-
constructor(e) {
|
|
2324
|
-
super(), this.model = e;
|
|
2325
|
-
}
|
|
2326
|
-
new(e, t, n, r, i, a, o, s = "floating", c = "floating") {
|
|
2327
|
-
let l = new Nt(this.model, e, t, n, r, i, a, o, s, c);
|
|
2328
|
-
return super.add(l), l.updateInView(), e !== void 0 && e.decorators.push(l), l;
|
|
2329
|
-
}
|
|
2330
|
-
remove(e) {
|
|
2331
|
-
let t = this.get(e, !0);
|
|
2332
|
-
t && ((t.rootElement instanceof W || t.rootElement instanceof H) && O(t.rootElement.decorators, t), super.remove(e), t.updateInView());
|
|
2333
|
-
}
|
|
2334
|
-
}, Ft = class extends Te {
|
|
2335
|
-
constructor(e, t, n, r, i, a, o) {
|
|
2336
|
-
if (e.objects.get(o) !== void 0) throw Error(`DiagramObject with id "${o}" already exists`);
|
|
2337
|
-
if (!o) throw Error("DiagramObject cannot have an empty or null id");
|
|
2338
|
-
super(e, o), this.coords = t, this.width = n, this.height = r, this.priority = i, this.html = a;
|
|
2339
|
-
}
|
|
2340
|
-
get removed() {
|
|
2341
|
-
return this.selfRemoved;
|
|
2342
|
-
}
|
|
2343
|
-
updateInView() {
|
|
2344
|
-
this.model.canvas?.updateObjectsInView(this.id);
|
|
2345
|
-
}
|
|
2346
|
-
raise() {
|
|
2347
|
-
this.select()?.raise();
|
|
2348
|
-
}
|
|
2349
|
-
move(e) {
|
|
2350
|
-
this.coords = e, this.updateInView();
|
|
2351
|
-
}
|
|
2352
|
-
getPriority() {
|
|
2353
|
-
return this.priority;
|
|
2354
|
-
}
|
|
2355
|
-
}, It = class extends N {
|
|
2356
|
-
constructor(e) {
|
|
2357
|
-
super(), this.model = e;
|
|
2358
|
-
}
|
|
2359
|
-
new(e, t, n, r, i, a) {
|
|
2360
|
-
let o = new Ft(this.model, e, t, n, r, i, a);
|
|
2361
|
-
return super.add(o), o.updateInView(), o;
|
|
2362
|
-
}
|
|
2363
|
-
remove(e) {
|
|
2364
|
-
let t = this.get(e, !0);
|
|
2365
|
-
t && (super.remove(e), t.updateInView());
|
|
2413
|
+
super(5), this.target = e;
|
|
2366
2414
|
}
|
|
2367
2415
|
}, Lt = class {
|
|
2368
2416
|
constructor(e, t, n, r, i, a = []) {
|
|
2369
|
-
this.nodes = new Je(this), this.sections = new Ge(this), this.ports = new
|
|
2417
|
+
this.nodes = new Je(this), this.sections = new Ge(this), this.ports = new lt(this), this.connections = new Fe(this), this.fields = new Re(this), this.objects = new rt(this), this.decorators = new tt(this), this.canvas = e, this.id = t, this.name = n, this.description = r, this.type = i, this.createdAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.logicalClock = 0, this.valueSet = new Ne(new De(a), this);
|
|
2370
2418
|
}
|
|
2371
2419
|
clear() {
|
|
2372
2420
|
this.canvas?.cancelAllUserActions(), this.id = void 0, this.name = "", this.description = void 0, this.createdAt = /* @__PURE__ */ new Date(), this.updatedAt = /* @__PURE__ */ new Date(), this.logicalClock = 0, this.nodes.clear(), this.sections.clear(), this.ports.clear(), this.connections.clear(), this.fields.clear(), this.objects.clear(), this.decorators.clear(), this.valueSet.resetValues(), this.canvas?.updateModelInView();
|
|
2373
2421
|
}
|
|
2374
|
-
}, Rt = (e) => !!e.button, zt = (e, t, n, r, i, a, o, s, c) =>
|
|
2422
|
+
}, Rt = (e) => !!e.button, zt = (e, t, n, r, i, a, o, s, c) => ne(e, [
|
|
2375
2423
|
t,
|
|
2376
2424
|
...a,
|
|
2377
2425
|
n
|
|
2378
|
-
], r, i, Math.max(10, s
|
|
2426
|
+
], r, i, Math.max(10, s ?? 0, c ?? 0) * o), X = (t) => {
|
|
2379
2427
|
t ? e.select("body").style("cursor", t) : e.select("body").style("cursor", A.Auto);
|
|
2380
|
-
},
|
|
2428
|
+
}, Bt = (e) => e instanceof W ? e : e instanceof H ? e.node ?? e : e.rootElement instanceof W || e.rootElement instanceof H || e.rootElement instanceof ct ? Bt(e.rootElement) : e, Vt = (e) => {
|
|
2381
2429
|
if (e instanceof W) return e.type.resizableX !== !1;
|
|
2382
2430
|
if (e instanceof H) {
|
|
2383
2431
|
if (e.type !== void 0) return e.type.resizableX !== !1;
|
|
2384
|
-
if (e.node !== void 0) return
|
|
2432
|
+
if (e.node !== void 0) return Vt(e.node);
|
|
2385
2433
|
}
|
|
2386
2434
|
return !1;
|
|
2387
|
-
},
|
|
2435
|
+
}, Ht = (e) => {
|
|
2388
2436
|
if (e instanceof W) return e.type.resizableY !== !1;
|
|
2389
2437
|
if (e instanceof H) {
|
|
2390
2438
|
if (e.type !== void 0) return e.type.resizableY !== !1;
|
|
2391
|
-
if (e.node !== void 0) return
|
|
2439
|
+
if (e.node !== void 0) return Ht(e.node);
|
|
2392
2440
|
}
|
|
2393
2441
|
return !1;
|
|
2394
|
-
},
|
|
2442
|
+
}, Ut = (e) => {
|
|
2395
2443
|
e.filter(".shaped-look").append("path"), e.filter(".image-look").append("image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "top-left-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "top-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "top-right-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "left-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "center-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "right-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "bottom-left-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "bottom-image").attr("preserveAspectRatio", "none"), e.filter(".stretchable-image-look").append("image").attr("class", "bottom-right-image").attr("preserveAspectRatio", "none");
|
|
2396
|
-
},
|
|
2444
|
+
}, Wt = {
|
|
2397
2445
|
fillColor: "#FFFFFF",
|
|
2398
2446
|
borderColor: "#000000",
|
|
2399
2447
|
borderThickness: 1,
|
|
2400
2448
|
borderStyle: te.Solid
|
|
2401
|
-
},
|
|
2402
|
-
e.filter(".shaped-look").select("path").attr("d", (e) => ae(e.look.shape
|
|
2403
|
-
},
|
|
2449
|
+
}, Gt = (e) => {
|
|
2450
|
+
e.filter(".shaped-look").select("path").attr("d", (e) => ae(e.look.shape ?? ie.Rectangle, 0, 0, e.width, e.height)).attr("fill", (e) => e.look.fillColor ?? Wt.fillColor).attr("stroke", (e) => e.look.borderColor ?? Wt.borderColor).attr("stroke-width", (e) => `${e.look.borderThickness ?? Wt.borderThickness}px`).attr("stroke-dasharray", (e) => re(e.look.borderStyle ?? Wt.borderStyle, e.type?.defaultLook?.borderThickness ?? e.look?.borderThickness ?? Wt.borderThickness)), e.filter(".image-look").select("image").attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("href", (e) => e.look.backgroundImage), e.filter(".stretchable-image-look").select("image.top-left-image").attr("x", 0).attr("y", 0).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTopLeft), e.filter(".stretchable-image-look").select("image.top-image").attr("x", (e) => e.look.leftMargin).attr("y", 0).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTop), e.filter(".stretchable-image-look").select("image.top-right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", 0).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.look.topMargin).attr("href", (e) => e.look.backgroundImageTopRight), e.filter(".stretchable-image-look").select("image.left-image").attr("x", 0).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageLeft), e.filter(".stretchable-image-look").select("image.center-image").attr("x", (e) => e.look.leftMargin).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageCenter), e.filter(".stretchable-image-look").select("image.right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", (e) => e.look.topMargin).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.height - e.look.bottomMargin - e.look.topMargin).attr("href", (e) => e.look.backgroundImageRight), e.filter(".stretchable-image-look").select("image.bottom-left-image").attr("x", 0).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.look.leftMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottomLeft), e.filter(".stretchable-image-look").select("image.bottom-image").attr("x", (e) => e.look.leftMargin).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.width - e.look.rightMargin - e.look.leftMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottom), e.filter(".stretchable-image-look").select("image.bottom-right-image").attr("x", (e) => e.width - e.look.rightMargin).attr("y", (e) => e.height - e.look.bottomMargin).attr("width", (e) => e.look.rightMargin).attr("height", (e) => e.look.bottomMargin).attr("href", (e) => e.look.backgroundImageBottomRight);
|
|
2451
|
+
}, Kt = {
|
|
2452
|
+
style: "solid",
|
|
2453
|
+
color: "#FFFFFF"
|
|
2454
|
+
}, qt = {
|
|
2404
2455
|
enabled: !0,
|
|
2456
|
+
style: "none",
|
|
2457
|
+
snap: !1,
|
|
2458
|
+
spacing: 1
|
|
2459
|
+
}, Jt = {
|
|
2460
|
+
...qt,
|
|
2405
2461
|
style: "dots",
|
|
2406
|
-
color: "rgba(0, 0, 0, 0.1)",
|
|
2407
2462
|
snap: !1,
|
|
2408
2463
|
spacing: 10,
|
|
2409
|
-
thickness: .05
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2464
|
+
thickness: .05,
|
|
2465
|
+
color: "rgba(0, 0, 0, 0.1)"
|
|
2466
|
+
}, Yt = (e, t, n) => {
|
|
2467
|
+
switch (n?.style ?? "") {
|
|
2468
|
+
case "image": return t.append("image").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("href", n.image).attr("preserveAspectRatio", "none");
|
|
2469
|
+
default: return t.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", n.color ?? "#FFFFFF").attr("stroke-width", "0");
|
|
2470
|
+
}
|
|
2471
|
+
}, Xt = (e) => {
|
|
2472
|
+
if (!e) return Jt;
|
|
2473
|
+
switch (e.style) {
|
|
2474
|
+
case "dots":
|
|
2475
|
+
case "lines": return {
|
|
2476
|
+
...Jt,
|
|
2477
|
+
...e
|
|
2478
|
+
};
|
|
2479
|
+
default: return {
|
|
2480
|
+
...qt,
|
|
2481
|
+
...e
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2484
|
+
}, Zt = (e, t, n, r, i) => {
|
|
2485
|
+
if (Z(i) !== 0 && Q(i) !== 0) {
|
|
2486
|
+
let e = n.append("pattern").attr("id", r).attr("x", -Z(i) / 2).attr("y", -Q(i) / 2).attr("width", Z(i)).attr("height", Q(i)).attr("patternUnits", "userSpaceOnUse");
|
|
2487
|
+
switch (e.append("rect").attr("x", 0).attr("y", 0).attr("width", Z(i)).attr("height", Q(i)).attr("fill", "transparent"), i.style) {
|
|
2415
2488
|
case "dots":
|
|
2416
|
-
|
|
2489
|
+
e.append("circle").attr("cx", Z(i) / 2).attr("cy", Q(i) / 2).attr("r", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("fill", i.color ?? "");
|
|
2417
2490
|
break;
|
|
2418
2491
|
case "lines":
|
|
2419
|
-
|
|
2492
|
+
e.append("line").attr("x1", Z(i) / 2).attr("x2", Z(i) / 2).attr("y1", 0).attr("y2", Q(i)).attr("stroke-width", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("stroke", i.color ?? ""), e.append("line").attr("x1", 0).attr("x2", (Z(i) - Z(i) * (i.thickness ?? 0)) / 2).attr("y1", Q(i) / 2).attr("y2", Q(i) / 2).attr("stroke-width", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("stroke", i.color ?? ""), e.append("line").attr("x1", (Z(i) + Z(i) * (i.thickness ?? 0)) / 2).attr("x2", Z(i)).attr("y1", Q(i) / 2).attr("y2", Q(i) / 2).attr("stroke-width", Math.min(Z(i), Q(i)) * (i.thickness ?? 0)).attr("stroke", i.color ?? "");
|
|
2493
|
+
break;
|
|
2494
|
+
case "image":
|
|
2495
|
+
e.append("image").attr("x", 0).attr("y", 0).attr("width", Z(i)).attr("height", Q(i)).attr("href", i.image).attr("preserveAspectRatio", "none");
|
|
2420
2496
|
break;
|
|
2421
2497
|
}
|
|
2422
|
-
t.
|
|
2423
|
-
}
|
|
2424
|
-
},
|
|
2498
|
+
return t.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", `url(#${r})`).attr("stroke-width", "0");
|
|
2499
|
+
}
|
|
2500
|
+
}, Z = (e) => {
|
|
2501
|
+
let t = 0;
|
|
2502
|
+
return typeof e.spacing == "number" ? t = e.spacing : Array.isArray(e.spacing) && typeof e.spacing[0] == "number" && (t = e.spacing[0]), isFinite(t) ? t : 0;
|
|
2503
|
+
}, Q = (e) => {
|
|
2504
|
+
let t = 0;
|
|
2505
|
+
return typeof e.spacing == "number" ? t = e.spacing : Array.isArray(e.spacing) && typeof e.spacing[1] == "number" && (t = e.spacing[1]), isFinite(t) ? t : 0;
|
|
2506
|
+
}, Qt = 96, $ = 32, $t = 128, en = Math.PI / 4, tn = 100, nn = { customButtons: [] }, rn = class {
|
|
2425
2507
|
constructor(e, t) {
|
|
2426
|
-
this.canvas = e, this.config = t ||
|
|
2508
|
+
this.canvas = e, this.config = t || nn;
|
|
2427
2509
|
}
|
|
2428
2510
|
open(t) {
|
|
2429
2511
|
this.close();
|
|
2430
|
-
let n = this.canvas.getPointerLocationRelativeToRoot(t), r = this.canvas.getPointerLocationRelativeToCanvas(t), i = this.canvas.selectSVGElement().append("foreignObject").attr("class", "daga-context-menu").attr("x", `${n[0] -
|
|
2431
|
-
this.canvas.canUserPerformAction(
|
|
2512
|
+
let n = this.canvas.getPointerLocationRelativeToRoot(t), r = this.canvas.getPointerLocationRelativeToCanvas(t), i = this.canvas.selectSVGElement().append("foreignObject").attr("class", "daga-context-menu").attr("x", `${n[0] - $t}px`).attr("y", `${n[1] - $t}px`).attr("width", `${2 * $t}px`).attr("height", `${2 * $t}px`).style("pointer-events", "none").on(S.ContextMenu, (e) => {
|
|
2513
|
+
this.canvas.canUserPerformAction(K.ContextMenu) && (t.preventDefault(), this.open(e));
|
|
2432
2514
|
}).on(S.Click, (e) => {
|
|
2433
2515
|
e.preventDefault(), this.close();
|
|
2434
2516
|
});
|
|
2435
2517
|
this.contextMenuContainer = i;
|
|
2436
2518
|
let a = [];
|
|
2437
|
-
this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(
|
|
2519
|
+
this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(K.Clipboard) && this.canvas.canUserPerformAction(K.Remove) && a.push({
|
|
2438
2520
|
name: "CUT",
|
|
2439
2521
|
imageClass: "daga-cut",
|
|
2440
2522
|
onPress: (e) => {
|
|
2441
2523
|
e.userSelection.cutToClipboard(), e.cancelAllUserActions();
|
|
2442
2524
|
}
|
|
2443
|
-
}), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(
|
|
2525
|
+
}), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(K.Clipboard) && a.push({
|
|
2444
2526
|
name: "COPY",
|
|
2445
2527
|
imageClass: "daga-copy",
|
|
2446
2528
|
onPress: (e) => {
|
|
2447
2529
|
e.userSelection.copyToClipboard(), e.cancelAllUserActions();
|
|
2448
2530
|
}
|
|
2449
|
-
}), this.canvas.canUserPerformAction(
|
|
2531
|
+
}), this.canvas.canUserPerformAction(K.Paste) && a.push({
|
|
2450
2532
|
name: "PASTE",
|
|
2451
2533
|
imageClass: "daga-paste",
|
|
2452
2534
|
onPress: (e) => {
|
|
2453
2535
|
e.userSelection.pasteFromClipboard(e.getClosestGridPoint(r)), e.cancelAllUserActions();
|
|
2454
2536
|
}
|
|
2455
|
-
}), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(
|
|
2537
|
+
}), this.canvas.userSelection.length !== 0 && this.canvas.canUserPerformAction(K.Remove) && a.push({
|
|
2456
2538
|
name: "DELETE",
|
|
2457
2539
|
imageClass: "daga-delete",
|
|
2458
2540
|
onPress: (e) => {
|
|
2459
2541
|
e.userSelection.removeFromModel(), e.cancelAllUserActions();
|
|
2460
2542
|
}
|
|
2461
2543
|
});
|
|
2462
|
-
for (let e of this.config.customButtons ||
|
|
2544
|
+
for (let e of this.config.customButtons || nn.customButtons) (e.condition === void 0 || e.condition(this.canvas)) && a.push(e);
|
|
2463
2545
|
a.length === 0 && a.push({
|
|
2464
2546
|
name: "NONE",
|
|
2465
2547
|
imageClass: "daga-cross",
|
|
2466
2548
|
onPress: void 0
|
|
2467
2549
|
});
|
|
2468
2550
|
for (let t = 0; t < a.length; ++t) {
|
|
2469
|
-
let n = a[t], r = n.onPress, o = (t + .5 - a.length / 2) *
|
|
2551
|
+
let n = a[t], r = n.onPress, o = (t + .5 - a.length / 2) * en, s = i.append("xhtml:div").attr("class", `daga-context-menu-button ${n.onPress === void 0 ? "" : " daga-clickable"}`).attr("tabindex", 0).style("position", "absolute").style("box-sizing", "border-box").style("width", `${2 * $}px`).style("height", `${2 * $}px`).style("border-radius", `${$}px`).style("pointer-events", "auto").on(S.Click, (e) => {
|
|
2470
2552
|
r && (e.preventDefault(), r(this.canvas));
|
|
2471
2553
|
}).on(S.KeyDown, (e) => {
|
|
2472
2554
|
r && e.key === C.Enter && (e.preventDefault(), r(this.canvas));
|
|
2473
2555
|
});
|
|
2474
|
-
n.imageClass === void 0 ? n.image !== void 0 && s.append("xhtml:img").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).attr("src", n.image) : s.append("xhtml:div").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).style("background-size", "contain").style("background-repeat", "no-repeat").attr("class", n.imageClass), s.append("xhtml:span").style("position", "absolute").style("left", `${.2 * $}px`).style("top", `${1.1 * $}px`).style("text-align", "center").style("width", `${1.6 * $}px`).style("height", `${.35 * $}px`).style("margin", "0").style("font-size", `${.35 * $}px`).style("font-weight", "700").style("user-select", "none").text(n.name), s.transition().ease(e.easeLinear).duration(
|
|
2556
|
+
n.imageClass === void 0 ? n.image !== void 0 && s.append("xhtml:img").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).attr("src", n.image) : s.append("xhtml:div").style("position", "absolute").style("left", `${.75 * $}px`).style("top", `${.5 * $}px`).style("width", `${.5 * $}px`).style("height", `${.5 * $}px`).style("background-size", "contain").style("background-repeat", "no-repeat").attr("class", n.imageClass), s.append("xhtml:span").style("position", "absolute").style("left", `${.2 * $}px`).style("top", `${1.1 * $}px`).style("text-align", "center").style("width", `${1.6 * $}px`).style("height", `${.35 * $}px`).style("margin", "0").style("font-size", `${.35 * $}px`).style("font-weight", "700").style("user-select", "none").text(n.name), s.transition().ease(e.easeLinear).duration(tn).tween("progress", () => (e) => {
|
|
2475
2557
|
let t = o * e;
|
|
2476
|
-
return s.style("left", `${Math.sin(t) *
|
|
2558
|
+
return s.style("left", `${Math.sin(t) * Qt - $ + $t}px`).style("top", `${-Math.cos(t) * Qt - $ + $t}px`);
|
|
2477
2559
|
});
|
|
2478
2560
|
}
|
|
2479
2561
|
}
|
|
2480
2562
|
close() {
|
|
2481
2563
|
this.contextMenuContainer?.remove(), this.contextMenuContainer = void 0;
|
|
2482
2564
|
}
|
|
2483
|
-
},
|
|
2565
|
+
}, an = class extends N {
|
|
2484
2566
|
constructor(e, t = !0) {
|
|
2485
2567
|
super(), this.focus = void 0, this.canvas = e, this.highlightSections = t;
|
|
2486
2568
|
}
|
|
@@ -2488,7 +2570,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2488
2570
|
return this.focus;
|
|
2489
2571
|
}
|
|
2490
2572
|
focusOn(e) {
|
|
2491
|
-
this.clear(), this.focus = e, (e instanceof
|
|
2573
|
+
this.clear(), this.focus = e, (e instanceof Le || e instanceof et) && e.rootElement ? this.focusOn(e.rootElement) : this.add(e);
|
|
2492
2574
|
}
|
|
2493
2575
|
add(e) {
|
|
2494
2576
|
if (super.add(e), e instanceof W) {
|
|
@@ -2504,7 +2586,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2504
2586
|
for (let t of e.ports) super.add(t), this.canvas.updatePortsInView(t.id);
|
|
2505
2587
|
e.label && (super.add(e.label), this.canvas.updateFieldsInView(e.label.id)), this.canvas.updateSectionsInView(e.id);
|
|
2506
2588
|
}
|
|
2507
|
-
else e instanceof
|
|
2589
|
+
else e instanceof ct ? (e.label && (super.add(e.label), this.canvas.updateFieldsInView(e.label.id)), this.canvas.updatePortsInView(e.id)) : e instanceof I && this.canvas.updateConnectionsInView(e.id);
|
|
2508
2590
|
}
|
|
2509
2591
|
clear() {
|
|
2510
2592
|
for (; this.entities.length > 0;) {
|
|
@@ -2513,7 +2595,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2513
2595
|
}
|
|
2514
2596
|
this.focus = void 0;
|
|
2515
2597
|
}
|
|
2516
|
-
},
|
|
2598
|
+
}, on = class {
|
|
2517
2599
|
export(e, t = !1) {
|
|
2518
2600
|
let n = {
|
|
2519
2601
|
name: e.name,
|
|
@@ -2523,6 +2605,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2523
2605
|
updatedAt: e.updatedAt,
|
|
2524
2606
|
nodes: [],
|
|
2525
2607
|
connections: [],
|
|
2608
|
+
objects: [],
|
|
2526
2609
|
data: e.valueSet.getValues(),
|
|
2527
2610
|
...t ? { collabMeta: {
|
|
2528
2611
|
logicalClock: e.logicalClock,
|
|
@@ -2532,6 +2615,18 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2532
2615
|
e.id && (n.id = e.id), e.description && (n.description = e.description);
|
|
2533
2616
|
for (let r of e.nodes.all(!0)) !t && r.removed || r.parent === void 0 && n.nodes.push(this.exportNode(r, t));
|
|
2534
2617
|
for (let r of e.connections.all(!0)) !t && r.removed || n.connections.push(this.exportConnection(r, t));
|
|
2618
|
+
for (let r of e.objects.all(!0)) n.objects?.push({
|
|
2619
|
+
id: r.id,
|
|
2620
|
+
coords: _(r.coords),
|
|
2621
|
+
width: r.width,
|
|
2622
|
+
height: r.height,
|
|
2623
|
+
priority: r.priority,
|
|
2624
|
+
svg: r.svg,
|
|
2625
|
+
...t ? { collabMeta: {
|
|
2626
|
+
removed: r.removed,
|
|
2627
|
+
selfRemoved: r.selfRemoved
|
|
2628
|
+
} } : {}
|
|
2629
|
+
});
|
|
2535
2630
|
return n;
|
|
2536
2631
|
}
|
|
2537
2632
|
exportNode(e, t = !1) {
|
|
@@ -2554,9 +2649,24 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2554
2649
|
...this.exportLabelCollabMeta(r)
|
|
2555
2650
|
} } : {}
|
|
2556
2651
|
});
|
|
2652
|
+
let i = [];
|
|
2653
|
+
for (let e of n.decorators) i.push({
|
|
2654
|
+
id: e.id,
|
|
2655
|
+
coords: _(e.coords),
|
|
2656
|
+
width: e.width,
|
|
2657
|
+
height: e.height,
|
|
2658
|
+
priority: e.priority,
|
|
2659
|
+
svg: e.svg,
|
|
2660
|
+
anchorPoints: [e.anchorPointX, e.anchorPointY],
|
|
2661
|
+
...t ? { collabMeta: {
|
|
2662
|
+
removed: e.removed,
|
|
2663
|
+
selfRemoved: e.selfRemoved
|
|
2664
|
+
} } : {}
|
|
2665
|
+
});
|
|
2557
2666
|
r.push({
|
|
2558
2667
|
id: n.id,
|
|
2559
2668
|
ports: e,
|
|
2669
|
+
decorators: i,
|
|
2560
2670
|
label: n.label?.text || "",
|
|
2561
2671
|
indexXInNode: n.indexXInNode,
|
|
2562
2672
|
indexYInNode: n.indexYInNode,
|
|
@@ -2586,12 +2696,27 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2586
2696
|
...this.exportLabelCollabMeta(n)
|
|
2587
2697
|
} } : {}
|
|
2588
2698
|
});
|
|
2699
|
+
let a = [];
|
|
2700
|
+
for (let n of e.decorators) a.push({
|
|
2701
|
+
id: n.id,
|
|
2702
|
+
coords: _(n.coords),
|
|
2703
|
+
width: n.width,
|
|
2704
|
+
height: n.height,
|
|
2705
|
+
priority: n.priority,
|
|
2706
|
+
svg: n.svg,
|
|
2707
|
+
anchorPoints: [n.anchorPointX, n.anchorPointY],
|
|
2708
|
+
...t ? { collabMeta: {
|
|
2709
|
+
removed: n.removed,
|
|
2710
|
+
selfRemoved: n.selfRemoved
|
|
2711
|
+
} } : {}
|
|
2712
|
+
});
|
|
2589
2713
|
return {
|
|
2590
2714
|
id: e.id,
|
|
2591
2715
|
type: e.type.id,
|
|
2592
2716
|
children: n,
|
|
2593
2717
|
sections: r,
|
|
2594
2718
|
ports: i,
|
|
2719
|
+
decorators: a,
|
|
2595
2720
|
label: e.label?.text || "",
|
|
2596
2721
|
coords: _(e.coords),
|
|
2597
2722
|
width: e.width,
|
|
@@ -2634,11 +2759,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2634
2759
|
textTimestamp: e.textTimestamp
|
|
2635
2760
|
} } : {};
|
|
2636
2761
|
}
|
|
2637
|
-
},
|
|
2762
|
+
}, sn = "Diagram properties", cn = class extends N {
|
|
2638
2763
|
constructor(e, t) {
|
|
2639
2764
|
super(), this.canvas = e, this.canvas.propertyEditorChanges$.pipe(n(2e3)).subscribe(() => {
|
|
2640
2765
|
this.makeUpdateValuesAction();
|
|
2641
|
-
}), this.diagramPropertiesText = t === void 0 ?
|
|
2766
|
+
}), this.diagramPropertiesText = t === void 0 ? sn : t;
|
|
2642
2767
|
}
|
|
2643
2768
|
add(e) {
|
|
2644
2769
|
if (!this.contains(e.id) && (this.length === 0 ? this.propertyEditorSelection === void 0 && (e instanceof W || e instanceof I) ? this.openInPropertyEditor(e) : this.propertyEditorSelection === void 0 && e instanceof H ? this.openInPropertyEditor(e.node) : this.openInPropertyEditor(void 0) : this.openInPropertyEditor(void 0), super.add(e), e.updateInView(), e instanceof W && e.sections)) for (let t of e.sections) super.add(t), t.updateInView();
|
|
@@ -2662,8 +2787,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2662
2787
|
removeFromModel() {
|
|
2663
2788
|
if (this.length > 0) {
|
|
2664
2789
|
let e = [], t = [], n = [], r = [], i = [];
|
|
2665
|
-
for (let a of this.all()) a instanceof W ? e.push(a.id) : a instanceof H ? t.push(a.id) : a instanceof
|
|
2666
|
-
let a = new
|
|
2790
|
+
for (let a of this.all()) a instanceof W ? e.push(a.id) : a instanceof H ? t.push(a.id) : a instanceof ct ? n.push(a.id) : a instanceof I ? r.push(a.id) : a instanceof Le && i.push(a.id);
|
|
2791
|
+
let a = new kt(this.canvas, e, t, n, r, i);
|
|
2667
2792
|
a.do(), this.canvas.actionStack.add(a);
|
|
2668
2793
|
}
|
|
2669
2794
|
}
|
|
@@ -2672,7 +2797,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2672
2797
|
type: "daga-user-selection",
|
|
2673
2798
|
nodes: [],
|
|
2674
2799
|
connections: []
|
|
2675
|
-
}, t = new
|
|
2800
|
+
}, t = new on();
|
|
2676
2801
|
for (let n of this.all()) n instanceof W && e.nodes.push(t.exportNode(n, !1)), n instanceof I && e.connections.push(t.exportConnection(n, !1));
|
|
2677
2802
|
navigator.clipboard.writeText(JSON.stringify(e));
|
|
2678
2803
|
}
|
|
@@ -2684,7 +2809,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2684
2809
|
try {
|
|
2685
2810
|
let n = JSON.parse(t);
|
|
2686
2811
|
if (n.type !== "daga-user-selection") return;
|
|
2687
|
-
let r = new
|
|
2812
|
+
let r = new At(this.canvas, n.nodes, n.connections, e);
|
|
2688
2813
|
this.canvas.actionStack.add(r), r.do();
|
|
2689
2814
|
} catch {
|
|
2690
2815
|
return;
|
|
@@ -2702,10 +2827,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2702
2827
|
if (this.propertyEditorSelection === void 0 || this.propertyEditorValues === void 0) return;
|
|
2703
2828
|
let e = this.propertyEditorSelection instanceof Lt ? void 0 : this.propertyEditorSelection.id;
|
|
2704
2829
|
if (Ae(this.propertyEditorValues, this.propertyEditorSelection?.valueSet.getValues())) return;
|
|
2705
|
-
let t = this.propertyEditorValues, n = Ce(this.propertyEditorSelection?.valueSet.getValues()), [r, i] = je(t, n, this.propertyEditorSelection?.valueSet), a = new
|
|
2830
|
+
let t = this.propertyEditorValues, n = Ce(this.propertyEditorSelection?.valueSet.getValues()), [r, i] = je(t, n, this.propertyEditorSelection?.valueSet), a = new Ot(this.canvas, e, r, i);
|
|
2706
2831
|
a.do(), this.canvas.actionStack.add(a), this.propertyEditorValues = n;
|
|
2707
2832
|
}
|
|
2708
|
-
},
|
|
2833
|
+
}, ln = "diagram-connection-unfinished", un = class n {
|
|
2709
2834
|
static {
|
|
2710
2835
|
this.canvasCount = 0;
|
|
2711
2836
|
}
|
|
@@ -2716,7 +2841,9 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2716
2841
|
this._connectionType = e, this.parentComponent?.palette?.refreshPalette();
|
|
2717
2842
|
}
|
|
2718
2843
|
constructor(r, i) {
|
|
2719
|
-
|
|
2844
|
+
this.gridPatternId = `daga-grid-pattern-id-${++n.canvasCount}`, this.ancillaryGridPatternIds = [], this.zoomTransform = e.zoomIdentity, this.draggingFrom = [0, 0], this.dragging = !1, this.secondaryButton = !1, this.validatorChange$ = new t(), this.diagramChange$ = new t(), this.diagramEvent$ = new t(), this.propertyEditorChanges$ = new t(), this.parentComponent = r, this.model = new Lt(this, void 0, i.name || "unnamed", "", i.type || "", i.properties || []), this.userSelection = new cn(this, i.components?.propertyEditor?.title), this.userHighlight = new an(this, i.canvas?.highlightSections !== !1), this.contextMenu = new rn(this, i.canvas?.contextMenu), this.backgroundConfig = i.canvas?.background ?? Kt, this.gridConfig = Xt(i.canvas?.grid), this.ancillaryGridsConfig = [];
|
|
2845
|
+
for (let e = 0; e < (i.canvas?.ancillaryGrids?.length || 0); ++e) this.ancillaryGridsConfig.push(Xt(i.canvas?.ancillaryGrids?.[e])), this.ancillaryGridPatternIds.push(`${this.gridPatternId}-ancillary-${e}`);
|
|
2846
|
+
if (this.zoomFactor = i.canvas?.zoomFactor || 2, this.panRate = i.canvas?.panRate || 100, this.inferConnectionType = i.connectionSettings?.inferConnectionType || !1, this.autoTightenConnections = i.connectionSettings?.autoTighten !== !1, this.tightenConnectionsAcrossPortTypes = i.connectionSettings?.tightenAcrossPortTypes || !1, this.allowConnectionLoops = i.connectionSettings?.allowLoops || !1, this.allowSharingPorts = i.connectionSettings?.sharePorts !== !1, this.allowSharingBothPorts = i.connectionSettings?.shareBothPorts || !1, this.portHighlightRadius = i.connectionSettings?.portHighlightRadius || 100, this.multipleSelectionOn = !1, this.priorityThresholds = i.canvas?.priorityThresholds || [], this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : void 0, this.layoutFormat = i.layoutFormat, this.userActions = i.userActions || {}, this.validators = [], this.actionStack = new St(this, 25), this.collabEngine = new xt(this), i.nodeTypes) for (let e of i.nodeTypes) {
|
|
2720
2847
|
let t = new qe({
|
|
2721
2848
|
...i.nodeTypeDefaults,
|
|
2722
2849
|
...e
|
|
@@ -2724,7 +2851,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2724
2851
|
this.model.nodes.types.add(t);
|
|
2725
2852
|
}
|
|
2726
2853
|
if (i.portTypes) for (let e of i.portTypes) {
|
|
2727
|
-
let t = new
|
|
2854
|
+
let t = new st({
|
|
2728
2855
|
...i.portTypeDefaults,
|
|
2729
2856
|
...e
|
|
2730
2857
|
});
|
|
@@ -2745,7 +2872,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2745
2872
|
this.validators.push(e), this.validatorChange$.next();
|
|
2746
2873
|
}
|
|
2747
2874
|
removeValidator(e) {
|
|
2748
|
-
|
|
2875
|
+
k(this.validators, e), this.validatorChange$.next();
|
|
2749
2876
|
}
|
|
2750
2877
|
getPriorityThresholdOptions() {
|
|
2751
2878
|
return this.priorityThresholds;
|
|
@@ -2760,73 +2887,81 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2760
2887
|
}
|
|
2761
2888
|
initView(t) {
|
|
2762
2889
|
let n = e.select(t);
|
|
2763
|
-
n.html(""), this.diagramRoot = n.append("div").node(),
|
|
2764
|
-
|
|
2890
|
+
n.html(""), this.diagramRoot = n.append("div").node(), this.selectRoot().attr("tabindex", 0).style("width", "100%").style("height", "100%").append("svg").style("width", "100%").style("height", "100%"), this.selectRoot().on(S.Click, () => {
|
|
2891
|
+
this.selectRoot().node()?.focus();
|
|
2765
2892
|
}).on(S.ContextMenu, (e) => {
|
|
2766
2893
|
if (this.dragging) {
|
|
2767
2894
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
2768
2895
|
return;
|
|
2769
2896
|
}
|
|
2770
|
-
let t = new
|
|
2771
|
-
this.diagramEvent$.next(t), !t.defaultPrevented && this.canUserPerformAction(
|
|
2897
|
+
let t = new Ft(e, null);
|
|
2898
|
+
this.diagramEvent$.next(t), !t.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.contextMenu.open(e));
|
|
2772
2899
|
}).on(S.DoubleClick, (e) => {
|
|
2773
|
-
let t = new
|
|
2900
|
+
let t = new Pt(e, null);
|
|
2774
2901
|
this.diagramEvent$.next(t);
|
|
2775
2902
|
}).on(S.KeyDown, (e) => {
|
|
2776
|
-
if (!e.ctrlKey && (e.key === C.Delete || e.key === C.Backspace) && this.canUserPerformAction(
|
|
2903
|
+
if (!e.ctrlKey && (e.key === C.Delete || e.key === C.Backspace) && this.canUserPerformAction(K.Remove) && (this.userSelection.removeFromModel(), this.cancelAllUserActions()), e.ctrlKey && e.key === "a") {
|
|
2777
2904
|
e.preventDefault();
|
|
2778
2905
|
for (let e of this.model.nodes) this.userSelection.add(e);
|
|
2779
2906
|
for (let e of this.model.connections) this.userSelection.add(e);
|
|
2780
|
-
this.diagramEvent$.next(new
|
|
2907
|
+
this.diagramEvent$.next(new J(this.userSelection.all(), !0));
|
|
2781
2908
|
}
|
|
2782
2909
|
if (e.ctrlKey && e.key === "i") {
|
|
2783
2910
|
e.preventDefault();
|
|
2784
2911
|
let t = [], n = [];
|
|
2785
2912
|
for (let e of this.model.nodes) this.userSelection.toggle(e), e.selected ? t.push(e) : n.push(e);
|
|
2786
2913
|
for (let e of this.model.connections) this.userSelection.toggle(e), e.selected ? t.push(e) : n.push(e);
|
|
2787
|
-
t.length > 0 && this.diagramEvent$.next(new
|
|
2914
|
+
t.length > 0 && this.diagramEvent$.next(new J(t, !0)), n.length > 0 && this.diagramEvent$.next(new J(n, !1));
|
|
2788
2915
|
}
|
|
2789
|
-
if (e.ctrlKey && e.key === "c" && this.canUserPerformAction(
|
|
2916
|
+
if (e.ctrlKey && e.key === "c" && this.canUserPerformAction(K.Clipboard) && (e.preventDefault(), this.userSelection.copyToClipboard(), this.cancelAllUserActions()), e.ctrlKey && e.key === "x" && this.canUserPerformAction(K.Clipboard) && this.canUserPerformAction(K.Remove) && (e.preventDefault(), this.userSelection.cutToClipboard(), this.cancelAllUserActions()), e.ctrlKey && e.key === "v" && this.canUserPerformAction(K.Paste)) {
|
|
2790
2917
|
e.preventDefault();
|
|
2791
2918
|
let t = this.getCoordinatesOnScreen();
|
|
2792
2919
|
this.userSelection.pasteFromClipboard(this.getClosestGridPoint([(t[0][0] + t[1][0]) / 2, (t[0][1] + t[1][1]) / 2])), this.cancelAllUserActions();
|
|
2793
2920
|
}
|
|
2794
|
-
e.ctrlKey && e.key === "y" && (e.preventDefault(), this.actionStack.redo()), e.ctrlKey && e.key === "z" && (e.preventDefault(), this.actionStack.undo()), e.key === "+" && this.canUserPerformAction(
|
|
2921
|
+
e.ctrlKey && e.key === "y" && (e.preventDefault(), this.actionStack.redo()), e.ctrlKey && e.key === "z" && (e.preventDefault(), this.actionStack.undo()), e.key === "+" && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.zoomBy(this.zoomFactor)), e.key === "-" && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.zoomBy(1 / this.zoomFactor)), e.key === C.ArrowLeft && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(this.panRate / this.zoomTransform.k, 0)), e.key === C.ArrowRight && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(-this.panRate / this.zoomTransform.k, 0)), e.key === C.ArrowDown && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(0, -this.panRate / this.zoomTransform.k)), e.key === C.ArrowUp && this.canUserPerformAction(K.Zoom) && (e.preventDefault(), this.translateBy(0, this.panRate / this.zoomTransform.k));
|
|
2795
2922
|
});
|
|
2796
2923
|
let r = this.selectSVGElement().append("g").attr("class", "daga-canvas-view").attr("width", "100%").attr("height", "100%");
|
|
2797
|
-
r.call(this.zoomBehavior = e.zoom().filter((e) => e.type !== S.DoubleClick).on(T.Zoom, (
|
|
2798
|
-
if (
|
|
2799
|
-
if (!this.canUserPerformAction(
|
|
2800
|
-
|
|
2924
|
+
r.call(this.zoomBehavior = e.zoom().filter((e) => e.type !== S.DoubleClick).on(T.Zoom, (e) => {
|
|
2925
|
+
if (e.sourceEvent) {
|
|
2926
|
+
if (!this.canUserPerformAction(K.Zoom)) {
|
|
2927
|
+
X(A.NotAllowed);
|
|
2801
2928
|
return;
|
|
2802
2929
|
}
|
|
2803
|
-
|
|
2930
|
+
e.sourceEvent.type === S.Wheel && e.sourceEvent.wheelDelta !== void 0 ? (e.sourceEvent.wheelDelta > 0 && X(A.ZoomIn), e.sourceEvent.wheelDelta < 0 && X(A.ZoomOut)) : e.sourceEvent.type === S.MouseMove && X(A.AllScroll);
|
|
2804
2931
|
}
|
|
2805
|
-
this.zoomTransform =
|
|
2806
|
-
let
|
|
2807
|
-
this.selectCanvasElements().attr("transform",
|
|
2932
|
+
this.zoomTransform = e.transform;
|
|
2933
|
+
let t = e.transform.toString();
|
|
2934
|
+
this.selectCanvasElements().attr("transform", t);
|
|
2935
|
+
for (let e of [this.gridPatternId, ...this.ancillaryGridPatternIds]) this.selectCanvasView().select(`#${e}`).attr("patternTransform", t);
|
|
2936
|
+
this.contextMenu.close(), this.diagramEvent$.next(new Nt([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
2808
2937
|
}).on(T.End, () => {
|
|
2809
|
-
|
|
2810
|
-
}))
|
|
2938
|
+
X();
|
|
2939
|
+
}));
|
|
2940
|
+
let i = r.append("defs"), a = [];
|
|
2941
|
+
a.push(Yt(this, r, this.backgroundConfig));
|
|
2942
|
+
for (let e = 0; e < this.ancillaryGridsConfig.length; ++e) a.push(Zt(this, r, i, this.ancillaryGridPatternIds[e], this.ancillaryGridsConfig[e]));
|
|
2943
|
+
a.push(Zt(this, r, i, this.gridPatternId, this.gridConfig));
|
|
2944
|
+
for (let t of a) t.on(S.MouseMove, (e) => {
|
|
2811
2945
|
if (this.unfinishedConnection !== void 0) {
|
|
2812
2946
|
let t = this.getPointerLocationRelativeToCanvas(e);
|
|
2813
2947
|
this.unfinishedConnection.endCoords = t;
|
|
2814
2948
|
}
|
|
2815
|
-
}).on(S.MouseOver, () => {
|
|
2816
|
-
this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new
|
|
2817
|
-
}).on(S.Click, () => {
|
|
2818
|
-
if (this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new
|
|
2949
|
+
}), t.on(S.MouseOver, () => {
|
|
2950
|
+
this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new Y(null)));
|
|
2951
|
+
}), t.on(S.Click, () => {
|
|
2952
|
+
if (this.userHighlight.size() > 0 && (this.userHighlight.clear(), this.diagramEvent$.next(new Y(null))), this.contextMenu.close(), this.userSelection.size() > 0) {
|
|
2819
2953
|
let e = this.userSelection.all();
|
|
2820
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
2954
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
2821
2955
|
}
|
|
2822
2956
|
this.userSelection.openInPropertyEditor(this.model);
|
|
2823
|
-
}).call(e.drag().filter((e) => this.multipleSelectionOn || Rt(e)).on(w.Start, (e) => {
|
|
2957
|
+
}), t.call(e.drag().filter((e) => this.multipleSelectionOn || Rt(e)).on(w.Start, (e) => {
|
|
2824
2958
|
this.startMultipleSelection(e);
|
|
2825
2959
|
}).on(w.Drag, (e) => {
|
|
2826
2960
|
this.continueMultipleSelection(e);
|
|
2827
2961
|
}).on(w.End, (e) => {
|
|
2828
2962
|
this.finishMultipleSelection(e);
|
|
2829
|
-
}))
|
|
2963
|
+
}));
|
|
2964
|
+
r.append("g").attr("class", "daga-canvas-elements");
|
|
2830
2965
|
}
|
|
2831
2966
|
getZoomLevel() {
|
|
2832
2967
|
return this.zoomTransform.k;
|
|
@@ -2875,7 +3010,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2875
3010
|
}
|
|
2876
3011
|
}
|
|
2877
3012
|
getClosestGridPoint(e) {
|
|
2878
|
-
|
|
3013
|
+
let t = e[0], n = Z(this.gridConfig);
|
|
3014
|
+
n !== 0 && (t = Math.round(t / n) * n);
|
|
3015
|
+
let r = e[1], i = Q(this.gridConfig);
|
|
3016
|
+
return i !== 0 && (r = Math.round(r / i) * i), [t, r];
|
|
2879
3017
|
}
|
|
2880
3018
|
getCoordinatesOnScreen() {
|
|
2881
3019
|
let e = this.selectSVGElement().node()?.getBoundingClientRect(), t = [e?.width || 0, e?.height || 0];
|
|
@@ -2905,26 +3043,26 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2905
3043
|
this.updateNodesInView(), this.updateSectionsInView(), this.updatePortsInView(), this.updateConnectionsInView(), this.updateFieldsInView(), this.updateObjectsInView(), this.updateDecoratorsInView();
|
|
2906
3044
|
}
|
|
2907
3045
|
updateNodesInView(...t) {
|
|
2908
|
-
let n = this.selectCanvasElements().selectAll("g.diagram-node").data(this.model.nodes.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-node${
|
|
3046
|
+
let n = this.selectCanvasElements().selectAll("g.diagram-node").data(this.model.nodes.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-node${Vt(e) ? " resizable-x" : ""}${Ht(e) ? " resizable-y" : ""} ${e.type.defaultLook.lookType}`);
|
|
2909
3047
|
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
|
|
2910
3048
|
let a = i.merge(n);
|
|
2911
3049
|
r.remove(), i.on(S.MouseOver, (e, t) => {
|
|
2912
|
-
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new
|
|
3050
|
+
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
|
|
2913
3051
|
}).on(S.Click, (e, t) => {
|
|
2914
3052
|
if (!e.ctrlKey && !e.shiftKey) {
|
|
2915
3053
|
let e = this.userSelection.all();
|
|
2916
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
3054
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
2917
3055
|
}
|
|
2918
|
-
this.userSelection.toggle(t), this.diagramEvent$.next(new
|
|
3056
|
+
this.userSelection.toggle(t), this.diagramEvent$.next(new J([t], t.selected));
|
|
2919
3057
|
}).on(S.ContextMenu, (e, t) => {
|
|
2920
3058
|
if (this.dragging) {
|
|
2921
3059
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
2922
3060
|
return;
|
|
2923
3061
|
}
|
|
2924
|
-
let n = new
|
|
2925
|
-
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3062
|
+
let n = new Ft(e, t);
|
|
3063
|
+
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)), this.userSelection.add(t), this.diagramEvent$.next(new J([t], !0)), this.contextMenu.open(e));
|
|
2926
3064
|
}).on(S.DoubleClick, (e, t) => {
|
|
2927
|
-
let n = new
|
|
3065
|
+
let n = new Pt(e, t);
|
|
2928
3066
|
this.diagramEvent$.next(n);
|
|
2929
3067
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
|
|
2930
3068
|
this.multipleSelectionOn || this.secondaryButton ? this.startMultipleSelection(e) : this.startMovingNode(e, t);
|
|
@@ -2932,226 +3070,226 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
2932
3070
|
this.multipleSelectionOn || this.secondaryButton ? this.continueMultipleSelection(e) : this.continueMovingNode(e, t);
|
|
2933
3071
|
}).on(w.End, (e, t) => {
|
|
2934
3072
|
this.multipleSelectionOn || this.secondaryButton ? this.finishMultipleSelection(e) : this.finishMovingNode(e, t), this.secondaryButton = !1;
|
|
2935
|
-
})),
|
|
2936
|
-
this.canUserPerformAction(
|
|
3073
|
+
})), Ut(i), i.filter(".resizable-x").append("line").attr("class", "left-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
3074
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X(A.EWResize);
|
|
2937
3075
|
}).on(S.MouseOut, (e, t) => {
|
|
2938
|
-
this.canUserPerformAction(
|
|
3076
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X();
|
|
2939
3077
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
2940
|
-
this.canUserPerformAction(
|
|
3078
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed ? (X(A.EWResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(A.NotAllowed);
|
|
2941
3079
|
}).on(w.Drag, (e, t) => {
|
|
2942
|
-
if (this.canUserPerformAction(
|
|
3080
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed) {
|
|
2943
3081
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2944
3082
|
t.stretch(p.Left, t.coords[0] - n[0]);
|
|
2945
3083
|
}
|
|
2946
3084
|
}).on(w.End, (e, t) => {
|
|
2947
|
-
if (this.canUserPerformAction(
|
|
3085
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
|
|
2948
3086
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2949
|
-
this.
|
|
3087
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Left, t.coords[0] - n[0]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
2950
3088
|
}
|
|
2951
|
-
|
|
3089
|
+
X();
|
|
2952
3090
|
})), i.filter(".resizable-y").append("line").attr("class", "top-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
2953
|
-
this.canUserPerformAction(
|
|
3091
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X(A.NSResize);
|
|
2954
3092
|
}).on(S.MouseOut, (e, t) => {
|
|
2955
|
-
this.canUserPerformAction(
|
|
3093
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X();
|
|
2956
3094
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
2957
|
-
this.canUserPerformAction(
|
|
3095
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed ? (X(A.NSResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(A.NotAllowed);
|
|
2958
3096
|
}).on(w.Drag, (e, t) => {
|
|
2959
|
-
if (this.canUserPerformAction(
|
|
3097
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed) {
|
|
2960
3098
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2961
3099
|
t.stretch(p.Top, t.coords[1] - n[1]);
|
|
2962
3100
|
}
|
|
2963
3101
|
}).on(w.End, (e, t) => {
|
|
2964
|
-
if (this.canUserPerformAction(
|
|
3102
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
|
|
2965
3103
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2966
|
-
this.
|
|
3104
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), t.stretch(p.Top, t.coords[1] - n[1]), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
2967
3105
|
}
|
|
2968
|
-
|
|
3106
|
+
X();
|
|
2969
3107
|
})), i.filter(".resizable-x").append("line").attr("class", "right-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
2970
|
-
this.canUserPerformAction(
|
|
3108
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X(A.EWResize);
|
|
2971
3109
|
}).on(S.MouseOut, (e, t) => {
|
|
2972
|
-
this.canUserPerformAction(
|
|
3110
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && X();
|
|
2973
3111
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
2974
|
-
this.canUserPerformAction(
|
|
3112
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed ? (X(A.EWResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(A.NotAllowed);
|
|
2975
3113
|
}).on(w.Drag, (e, t) => {
|
|
2976
|
-
if (this.canUserPerformAction(
|
|
3114
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed) {
|
|
2977
3115
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2978
3116
|
t.stretch(p.Right, n[0] - (t.coords[0] + t.width));
|
|
2979
3117
|
}
|
|
2980
3118
|
}).on(w.End, (e, t) => {
|
|
2981
|
-
if (this.canUserPerformAction(
|
|
3119
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
|
|
2982
3120
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2983
|
-
this.
|
|
3121
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[2], n[1] - t.type.snapToGridOffset[3]]), n[0] += t.type.snapToGridOffset[2], n[1] += t.type.snapToGridOffset[3]), t.stretch(p.Right, n[0] - (t.coords[0] + t.width)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
2984
3122
|
}
|
|
2985
|
-
|
|
3123
|
+
X();
|
|
2986
3124
|
})), i.filter(".resizable-y").append("line").attr("class", "bottom-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
2987
|
-
this.canUserPerformAction(
|
|
3125
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X(A.NSResize);
|
|
2988
3126
|
}).on(S.MouseOut, (e, t) => {
|
|
2989
|
-
this.canUserPerformAction(
|
|
3127
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && X();
|
|
2990
3128
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
2991
|
-
this.canUserPerformAction(
|
|
3129
|
+
this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed ? (X(A.NSResize), this.currentAction = new q(this, K.StretchNode, t.id, t.getGeometry(), t.getGeometry())) : X(A.NotAllowed);
|
|
2992
3130
|
}).on(w.Drag, (e, t) => {
|
|
2993
|
-
if (this.canUserPerformAction(
|
|
3131
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed) {
|
|
2994
3132
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
2995
3133
|
t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height));
|
|
2996
3134
|
}
|
|
2997
3135
|
}).on(w.End, (e, t) => {
|
|
2998
|
-
if (this.canUserPerformAction(
|
|
3136
|
+
if (this.canUserPerformAction(K.StretchNode) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchNode) {
|
|
2999
3137
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3000
|
-
this.
|
|
3138
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[2], n[1] - t.type.snapToGridOffset[3]]), n[0] += t.type.snapToGridOffset[2], n[1] += t.type.snapToGridOffset[3]), t.stretch(p.Bottom, n[1] - (t.coords[1] + t.height)), this.currentAction.to = t.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
3001
3139
|
}
|
|
3002
|
-
|
|
3003
|
-
})), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1),
|
|
3140
|
+
X();
|
|
3141
|
+
})), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1), Gt(a), a.filter(".resizable-x").select("line.left-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", 6 / 2).attr("x2", 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.top-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", 6 / 2).attr("y2", 6 / 2), a.filter(".resizable-x").select("line.right-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", (e) => e.width - 6 / 2).attr("x2", (e) => e.width - 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.bottom-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", (e) => e.height - 6 / 2).attr("y2", (e) => e.height - 6 / 2);
|
|
3004
3142
|
}
|
|
3005
3143
|
updateSectionsInView(...t) {
|
|
3006
|
-
let n = this.selectCanvasElements().selectAll("g.diagram-section").data(this.model.sections.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-section${
|
|
3144
|
+
let n = this.selectCanvasElements().selectAll("g.diagram-section").data(this.model.sections.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-section${Vt(e) ? " resizable-x" : ""}${Ht(e) ? " resizable-y" : ""} ${e.look?.lookType}`);
|
|
3007
3145
|
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
|
|
3008
3146
|
let a = i.merge(n);
|
|
3009
3147
|
r.remove(), i.on(S.MouseOver, (e, t) => {
|
|
3010
|
-
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new
|
|
3148
|
+
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
|
|
3011
3149
|
}).on(S.Click, (e, t) => {
|
|
3012
3150
|
if (!e.ctrlKey && !e.shiftKey) {
|
|
3013
3151
|
let e = this.userSelection.all();
|
|
3014
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
3152
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
3015
3153
|
}
|
|
3016
|
-
let n =
|
|
3017
|
-
this.userSelection.toggle(n), this.diagramEvent$.next(new
|
|
3154
|
+
let n = Bt(t);
|
|
3155
|
+
this.userSelection.toggle(n), this.diagramEvent$.next(new J([n], n.selected));
|
|
3018
3156
|
}).on(S.ContextMenu, (e, t) => {
|
|
3019
3157
|
if (this.dragging) {
|
|
3020
3158
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
3021
3159
|
return;
|
|
3022
3160
|
}
|
|
3023
|
-
let n = new
|
|
3024
|
-
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3161
|
+
let n = new Ft(e, t);
|
|
3162
|
+
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu)) {
|
|
3025
3163
|
e.preventDefault();
|
|
3026
|
-
let n =
|
|
3027
|
-
this.userHighlight.focusOn(n), this.diagramEvent$.next(new
|
|
3164
|
+
let n = Bt(t);
|
|
3165
|
+
this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
|
|
3028
3166
|
}
|
|
3029
3167
|
}).on(S.DoubleClick, (e, t) => {
|
|
3030
|
-
let n = new
|
|
3168
|
+
let n = new Pt(e, t);
|
|
3031
3169
|
this.diagramEvent$.next(n);
|
|
3032
3170
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
|
|
3033
3171
|
if (this.multipleSelectionOn || this.secondaryButton) this.startMultipleSelection(e);
|
|
3034
3172
|
else {
|
|
3035
3173
|
let n = t?.node;
|
|
3036
|
-
n ? this.startMovingNode(e, n) :
|
|
3174
|
+
n ? this.startMovingNode(e, n) : X(A.NotAllowed);
|
|
3037
3175
|
}
|
|
3038
3176
|
}).on(w.Drag, (e, t) => {
|
|
3039
3177
|
if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
|
|
3040
3178
|
else {
|
|
3041
3179
|
let n = t?.node;
|
|
3042
|
-
n ? this.continueMovingNode(e, n) :
|
|
3180
|
+
n ? this.continueMovingNode(e, n) : X(A.NotAllowed);
|
|
3043
3181
|
}
|
|
3044
3182
|
}).on(w.End, (e, t) => {
|
|
3045
3183
|
if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
|
|
3046
3184
|
else {
|
|
3047
3185
|
let n = t?.node;
|
|
3048
|
-
n ? this.finishMovingNode(e, n) :
|
|
3186
|
+
n ? this.finishMovingNode(e, n) : X();
|
|
3049
3187
|
}
|
|
3050
3188
|
this.secondaryButton = !1;
|
|
3051
|
-
})),
|
|
3052
|
-
this.canUserPerformAction(
|
|
3189
|
+
})), Ut(i), i.filter(".resizable-x").append("line").attr("class", "left-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
3190
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X(A.EWResize);
|
|
3053
3191
|
}).on(S.MouseOut, (e, t) => {
|
|
3054
|
-
this.canUserPerformAction(
|
|
3192
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X();
|
|
3055
3193
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
3056
|
-
this.canUserPerformAction(
|
|
3194
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node ? (X(A.EWResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(A.NotAllowed);
|
|
3057
3195
|
}).on(w.Drag, (e, t) => {
|
|
3058
|
-
if (this.canUserPerformAction(
|
|
3196
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node) {
|
|
3059
3197
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3060
3198
|
t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode);
|
|
3061
3199
|
}
|
|
3062
3200
|
}).on(w.End, (e, t) => {
|
|
3063
|
-
if (this.canUserPerformAction(
|
|
3201
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
|
|
3064
3202
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3065
|
-
this.
|
|
3203
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Left, t.coords[0] - n[0], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
3066
3204
|
}
|
|
3067
|
-
|
|
3205
|
+
X();
|
|
3068
3206
|
})), i.filter(".resizable-y").append("line").attr("class", "top-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
3069
|
-
this.canUserPerformAction(
|
|
3207
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X(A.NSResize);
|
|
3070
3208
|
}).on(S.MouseOut, (e, t) => {
|
|
3071
|
-
this.canUserPerformAction(
|
|
3209
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X();
|
|
3072
3210
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
3073
|
-
this.canUserPerformAction(
|
|
3211
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node ? (X(A.NSResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(A.NotAllowed);
|
|
3074
3212
|
}).on(w.Drag, (e, t) => {
|
|
3075
|
-
if (this.canUserPerformAction(
|
|
3213
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node) {
|
|
3076
3214
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3077
3215
|
t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode);
|
|
3078
3216
|
}
|
|
3079
3217
|
}).on(w.End, (e, t) => {
|
|
3080
|
-
if (this.canUserPerformAction(
|
|
3218
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
|
|
3081
3219
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3082
|
-
this.
|
|
3220
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Top, t.coords[1] - n[1], t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
3083
3221
|
}
|
|
3084
|
-
|
|
3222
|
+
X();
|
|
3085
3223
|
})), i.filter(".resizable-x").append("line").attr("class", "right-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
3086
|
-
this.canUserPerformAction(
|
|
3224
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X(A.EWResize);
|
|
3087
3225
|
}).on(S.MouseOut, (e, t) => {
|
|
3088
|
-
this.canUserPerformAction(
|
|
3226
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && X();
|
|
3089
3227
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
3090
|
-
this.canUserPerformAction(
|
|
3228
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node ? (X(A.EWResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(A.NotAllowed);
|
|
3091
3229
|
}).on(w.Drag, (e, t) => {
|
|
3092
|
-
if (this.canUserPerformAction(
|
|
3230
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && t.node) {
|
|
3093
3231
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3094
3232
|
t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode);
|
|
3095
3233
|
}
|
|
3096
3234
|
}).on(w.End, (e, t) => {
|
|
3097
|
-
if (this.canUserPerformAction(
|
|
3235
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableX() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
|
|
3098
3236
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3099
|
-
this.
|
|
3237
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Right, n[0] - (t.coords[0] + t.width), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
3100
3238
|
}
|
|
3101
|
-
|
|
3239
|
+
X();
|
|
3102
3240
|
})), i.filter(".resizable-y").append("line").attr("class", "bottom-resizer").attr("stroke", "transparent").attr("stroke-width", 6).on(S.MouseOver, (e, t) => {
|
|
3103
|
-
this.canUserPerformAction(
|
|
3241
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X(A.NSResize);
|
|
3104
3242
|
}).on(S.MouseOut, (e, t) => {
|
|
3105
|
-
this.canUserPerformAction(
|
|
3243
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && X();
|
|
3106
3244
|
}).call(e.drag().on(w.Start, (e, t) => {
|
|
3107
|
-
this.canUserPerformAction(
|
|
3245
|
+
this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node ? (X(A.NSResize), this.currentAction = new q(this, K.StretchSection, t.node.id, t.node.getGeometry(), t.node.getGeometry())) : X(A.NotAllowed);
|
|
3108
3246
|
}).on(w.Drag, (e, t) => {
|
|
3109
|
-
if (this.canUserPerformAction(
|
|
3247
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && t.node) {
|
|
3110
3248
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3111
3249
|
t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode);
|
|
3112
3250
|
}
|
|
3113
3251
|
}).on(w.End, (e, t) => {
|
|
3114
|
-
if (this.canUserPerformAction(
|
|
3252
|
+
if (this.canUserPerformAction(K.StretchSection) && t.getResizableY() && !t.removed && this.currentAction instanceof q && this.currentAction.intent === K.StretchSection && t.node) {
|
|
3115
3253
|
let n = this.getPointerLocationRelativeToCanvas(e);
|
|
3116
|
-
this.
|
|
3254
|
+
this.gridConfig.snap && (n = this.getClosestGridPoint(n)), t.node.stretchSections(p.Bottom, n[1] - (t.coords[1] + t.height), t.indexXInNode, t.indexYInNode), this.currentAction.to = t.node.getGeometry(), this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0;
|
|
3117
3255
|
}
|
|
3118
|
-
|
|
3119
|
-
})), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1),
|
|
3256
|
+
X();
|
|
3257
|
+
})), a.attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).attr("opacity", (e) => e.removed ? .5 : 1), Gt(a), a.filter(".resizable-x").select("line.left-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", 6 / 2).attr("x2", 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.top-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", 6 / 2).attr("y2", 6 / 2), a.filter(".resizable-x").select("line.right-resizer").style("pointer-events", (e) => e.getResizableX() ? "initial" : "none").attr("x1", (e) => e.width - 6 / 2).attr("x2", (e) => e.width - 6 / 2).attr("y1", 0).attr("y2", (e) => e.height), a.filter(".resizable-y").select("line.bottom-resizer").style("pointer-events", (e) => e.getResizableY() ? "initial" : "none").attr("x1", 0).attr("x2", (e) => e.width).attr("y1", (e) => e.height - 6 / 2).attr("y2", (e) => e.height - 6 / 2);
|
|
3120
3258
|
}
|
|
3121
3259
|
updatePortsInView(...t) {
|
|
3122
3260
|
let n = this.selectCanvasElements().selectAll("g.diagram-port").data(this.model.ports.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", (e) => `diagram-port ${e.look.lookType}`);
|
|
3123
3261
|
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
|
|
3124
3262
|
let a = i.merge(n);
|
|
3125
3263
|
r.remove(), i.on(S.MouseOver, (e, t) => {
|
|
3126
|
-
!this.unfinishedConnection && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new
|
|
3264
|
+
!this.unfinishedConnection && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t))), this.unfinishedConnection && (this.unfinishedConnection.type.canStartFromType(this.unfinishedConnection.start?.getNode()?.type?.id || "") && this.unfinishedConnection.start?.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(t.getNode()?.type?.id || "") && t.allowsIncoming || this.unfinishedConnection.type.canStartFromType(t.getNode()?.type?.id || "") && t.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(this.unfinishedConnection.start?.getNode()?.type?.id || "") && this.unfinishedConnection.start?.allowsIncoming || X(A.NoDrop));
|
|
3127
3265
|
}).on(S.MouseOut, () => {
|
|
3128
|
-
this.unfinishedConnection &&
|
|
3266
|
+
this.unfinishedConnection && X(A.Grabbing);
|
|
3129
3267
|
}).on(S.Click, (e, t) => {
|
|
3130
3268
|
if (!e.ctrlKey && !e.shiftKey) {
|
|
3131
3269
|
let e = this.userSelection.all();
|
|
3132
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
3270
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
3133
3271
|
}
|
|
3134
|
-
let n =
|
|
3135
|
-
this.userSelection.toggle(n), this.diagramEvent$.next(new
|
|
3272
|
+
let n = Bt(t);
|
|
3273
|
+
this.userSelection.toggle(n), this.diagramEvent$.next(new J([n], n.selected));
|
|
3136
3274
|
}).on(S.ContextMenu, (e, t) => {
|
|
3137
3275
|
if (this.dragging) {
|
|
3138
3276
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
3139
3277
|
return;
|
|
3140
3278
|
}
|
|
3141
|
-
let n = new
|
|
3142
|
-
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3279
|
+
let n = new Ft(e, t);
|
|
3280
|
+
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu)) {
|
|
3143
3281
|
e.preventDefault();
|
|
3144
|
-
let n =
|
|
3145
|
-
this.userHighlight.focusOn(n), this.diagramEvent$.next(new
|
|
3282
|
+
let n = Bt(t);
|
|
3283
|
+
this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
|
|
3146
3284
|
}
|
|
3147
3285
|
}).on(S.DoubleClick, (e, t) => {
|
|
3148
|
-
let n = new
|
|
3286
|
+
let n = new Pt(e, t);
|
|
3149
3287
|
this.diagramEvent$.next(n);
|
|
3150
3288
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
|
|
3151
|
-
this.multipleSelectionOn || this.secondaryButton ? this.startMultipleSelection(e) : this.canUserPerformAction(
|
|
3289
|
+
this.multipleSelectionOn || this.secondaryButton ? this.startMultipleSelection(e) : this.canUserPerformAction(K.AddConnection) && (this.allowSharingPorts || t.incomingConnections.filter((e) => !e.removed).length === 0 && t.outgoingConnections.filter((e) => !e.removed).length === 0) && !t.removed ? (X(A.Grabbing), this.startConnection(t), this.unfinishedConnection && (this.unfinishedConnectionTracer = this.selectCanvasElements().append("path").attr("stroke", "none").attr("fill", "none"))) : X(A.NotAllowed);
|
|
3152
3290
|
}).on(w.Drag, (e, t) => {
|
|
3153
3291
|
if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
|
|
3154
|
-
else if (this.canUserPerformAction(
|
|
3292
|
+
else if (this.canUserPerformAction(K.AddConnection) && !t.removed && this.unfinishedConnection !== void 0) {
|
|
3155
3293
|
let t = [e.x, e.y];
|
|
3156
3294
|
this.unfinishedConnectionTracer?.attr("d", zt(this.unfinishedConnection.look.shape || F.look.shape, this.unfinishedConnection.startCoords, t, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.points, this.unfinishedConnection.type.defaultLook.thickness || F.look.thickness, this.unfinishedConnection.type.defaultStartMarkerLook?.width, this.unfinishedConnection.type.defaultEndMarkerLook?.width));
|
|
3157
3295
|
let n = this.unfinishedConnectionTracer?.node();
|
|
@@ -3161,7 +3299,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3161
3299
|
let r = n.getPointAtLength(t - e);
|
|
3162
3300
|
this.unfinishedConnection.endCoords = [r.x, r.y];
|
|
3163
3301
|
} else this.unfinishedConnection.endCoords = t;
|
|
3164
|
-
if (this.updateConnectionsInView(
|
|
3302
|
+
if (this.updateConnectionsInView(ln), this.unfinishedConnectionPort?.raise(!1), this.model.ports.length > 0) {
|
|
3165
3303
|
let t = this.getPointerLocationRelativeToCanvas(e), n = Infinity, r;
|
|
3166
3304
|
for (let e of this.model.ports) {
|
|
3167
3305
|
let i = e.distanceTo(t);
|
|
@@ -3173,12 +3311,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3173
3311
|
}).on(w.End, (e, t) => {
|
|
3174
3312
|
if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
|
|
3175
3313
|
else {
|
|
3176
|
-
if (this.canUserPerformAction(
|
|
3314
|
+
if (this.canUserPerformAction(K.AddConnection) && !t.removed) {
|
|
3177
3315
|
this.unfinishedConnectionTracer?.remove();
|
|
3178
3316
|
let t = this.userHighlight.getFocus();
|
|
3179
|
-
if (t instanceof
|
|
3180
|
-
else if (t instanceof
|
|
3181
|
-
else if (t instanceof W || t instanceof H || t instanceof
|
|
3317
|
+
if (t instanceof ct) this.finishConnection(t);
|
|
3318
|
+
else if (t instanceof Le && t.rootElement instanceof ct) this.finishConnection(t.rootElement);
|
|
3319
|
+
else if (t instanceof W || t instanceof H || t instanceof Le) {
|
|
3182
3320
|
let n;
|
|
3183
3321
|
if (t instanceof W || t instanceof H) n = t;
|
|
3184
3322
|
else if (t.rootElement instanceof W || t.rootElement instanceof H) n = t.rootElement;
|
|
@@ -3190,10 +3328,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3190
3328
|
r === void 0 ? this.dropConnection() : this.finishConnection(r);
|
|
3191
3329
|
} else this.dropConnection();
|
|
3192
3330
|
}
|
|
3193
|
-
|
|
3331
|
+
X();
|
|
3194
3332
|
}
|
|
3195
3333
|
this.secondaryButton = !1;
|
|
3196
|
-
})), i.filter(".image-look").append("image"),
|
|
3334
|
+
})), i.filter(".image-look").append("image"), Ut(i), a.attr("transform", (e) => `translate(${e.coords[0] - e.width / 2},${e.coords[1] - e.width / 2})`).attr("opacity", (e) => e.removed ? .5 : 1), Gt(a);
|
|
3197
3335
|
}
|
|
3198
3336
|
updateConnectionsInView(...t) {
|
|
3199
3337
|
let n = this.model.connections.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold);
|
|
@@ -3202,22 +3340,22 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3202
3340
|
t && t.length > 0 && (r = r.filter((e) => t.includes(e.id)));
|
|
3203
3341
|
let o = a.merge(r);
|
|
3204
3342
|
i.remove(), a.on(S.MouseOver, (e, t) => {
|
|
3205
|
-
t.end !== void 0 && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new
|
|
3343
|
+
t.end !== void 0 && !this.dragging && (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
|
|
3206
3344
|
}).on(S.Click, (e, t) => {
|
|
3207
3345
|
if (!e.ctrlKey && !e.shiftKey) {
|
|
3208
3346
|
let e = this.userSelection.all();
|
|
3209
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
3347
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
3210
3348
|
}
|
|
3211
|
-
this.userSelection.toggle(t), this.diagramEvent$.next(new
|
|
3349
|
+
this.userSelection.toggle(t), this.diagramEvent$.next(new J([t], t.selected));
|
|
3212
3350
|
}).on(S.ContextMenu, (e, t) => {
|
|
3213
3351
|
if (this.dragging) {
|
|
3214
3352
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
3215
3353
|
return;
|
|
3216
3354
|
}
|
|
3217
|
-
let n = new
|
|
3218
|
-
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3355
|
+
let n = new Ft(e, t);
|
|
3356
|
+
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)), this.userSelection.add(t), this.diagramEvent$.next(new J([t], !0)), this.contextMenu.open(e));
|
|
3219
3357
|
}).on(S.DoubleClick, (e, t) => {
|
|
3220
|
-
let n = new
|
|
3358
|
+
let n = new Pt(e, t);
|
|
3221
3359
|
this.diagramEvent$.next(n);
|
|
3222
3360
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e) => {
|
|
3223
3361
|
this.startMultipleSelection(e);
|
|
@@ -3225,7 +3363,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3225
3363
|
this.continueMultipleSelection(e);
|
|
3226
3364
|
}).on(w.End, (e) => {
|
|
3227
3365
|
this.finishMultipleSelection(e);
|
|
3228
|
-
})), a.append("path").attr("class", "diagram-connection-path"), a.append("path").attr("class", "diagram-connection-path-box"), a.append("marker").attr("id", (e) => `${e.id}-start-marker`).attr("class", "diagram-connection-start-marker").append("image").attr("preserveAspectRatio", "none"), a.append("marker").attr("id", (e) => `${e.id}-end-marker`).attr("class", "diagram-connection-end-marker").append("image").attr("preserveAspectRatio", "none"), a.append("g").attr("class", "diagram-connection-start-label"), a.select("g.diagram-connection-start-label").append("path"), a.select("g.diagram-connection-start-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-middle-label"), a.select("g.diagram-connection-middle-label").append("path"), a.select("g.diagram-connection-middle-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-end-label"), a.select("g.diagram-connection-end-label").append("path"), a.select("g.diagram-connection-end-label").append("text").style("user-select", "none"), o.attr("opacity", (e) => e.removed ? .5 : 1).select("path.diagram-connection-path").attr("d", (e) => zt(e.look.shape || F.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || F.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("marker-start", (e) => `url(#${e.id}-start-marker)`).attr("marker-end", (e) => `url(#${e.id}-end-marker)`).attr("stroke", (e) => e.look.color || F.look.color).attr("stroke-width", (e) => e.look.thickness || F.look.thickness).attr("stroke-dasharray", (e) =>
|
|
3366
|
+
})), a.append("path").attr("class", "diagram-connection-path"), a.append("path").attr("class", "diagram-connection-path-box"), a.append("marker").attr("id", (e) => `${e.id}-start-marker`).attr("class", "diagram-connection-start-marker").append("image").attr("preserveAspectRatio", "none"), a.append("marker").attr("id", (e) => `${e.id}-end-marker`).attr("class", "diagram-connection-end-marker").append("image").attr("preserveAspectRatio", "none"), a.append("g").attr("class", "diagram-connection-start-label"), a.select("g.diagram-connection-start-label").append("path"), a.select("g.diagram-connection-start-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-middle-label"), a.select("g.diagram-connection-middle-label").append("path"), a.select("g.diagram-connection-middle-label").append("text").style("user-select", "none"), a.append("g").attr("class", "diagram-connection-end-label"), a.select("g.diagram-connection-end-label").append("path"), a.select("g.diagram-connection-end-label").append("text").style("user-select", "none"), o.attr("opacity", (e) => e.removed ? .5 : 1).select("path.diagram-connection-path").attr("d", (e) => zt(e.look.shape || F.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || F.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("marker-start", (e) => `url(#${e.id}-start-marker)`).attr("marker-end", (e) => `url(#${e.id}-end-marker)`).attr("stroke", (e) => e.look.color || F.look.color).attr("stroke-width", (e) => e.look.thickness || F.look.thickness).attr("stroke-dasharray", (e) => re(e.look.style || F.look.style, e.type.defaultLook.thickness || F.look.thickness)).attr("fill", "none"), o.select("path.diagram-connection-path-box").attr("d", (e) => zt(e.look.shape || F.look.shape, e.startCoords, e.endCoords, e.startDirection, e.endDirection, e.points, e.type.defaultLook.thickness || F.look.thickness, e.type.defaultStartMarkerLook?.width, e.type.defaultEndMarkerLook?.width)).attr("stroke", "transparent").attr("pointer-events", "stroke").attr("stroke-width", (e) => (e.look.thickness || F.look.thickness) + 12).attr("stroke-dasharray", (e) => re(e.look.style || F.look.style, e.type.defaultLook.thickness || F.look.thickness)).attr("fill", "none"), o.data().forEach((e) => {
|
|
3229
3367
|
this.updateConnectionLabelsInView(e), this.updateConnectionMarkersInView(e);
|
|
3230
3368
|
});
|
|
3231
3369
|
}
|
|
@@ -3234,62 +3372,62 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3234
3372
|
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id)));
|
|
3235
3373
|
let a = i.merge(n);
|
|
3236
3374
|
r.remove(), i.on(S.MouseOver, (e, t) => {
|
|
3237
|
-
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new
|
|
3375
|
+
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
|
|
3238
3376
|
}).on(S.Click, (e, t) => {
|
|
3239
3377
|
if (!e.ctrlKey && !e.shiftKey) {
|
|
3240
3378
|
let e = this.userSelection.all();
|
|
3241
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
3379
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
3242
3380
|
}
|
|
3243
|
-
let n =
|
|
3244
|
-
this.userSelection.toggle(n), this.diagramEvent$.next(new
|
|
3381
|
+
let n = Bt(t);
|
|
3382
|
+
this.userSelection.toggle(n), this.diagramEvent$.next(new J([n], n.selected));
|
|
3245
3383
|
}).on(S.ContextMenu, (e, t) => {
|
|
3246
3384
|
if (this.dragging) {
|
|
3247
3385
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
3248
3386
|
return;
|
|
3249
3387
|
}
|
|
3250
|
-
let n = new
|
|
3251
|
-
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3388
|
+
let n = new Ft(e, t);
|
|
3389
|
+
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu)) {
|
|
3252
3390
|
e.preventDefault();
|
|
3253
|
-
let n =
|
|
3254
|
-
this.userHighlight.focusOn(n), this.diagramEvent$.next(new
|
|
3391
|
+
let n = Bt(t);
|
|
3392
|
+
this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
|
|
3255
3393
|
}
|
|
3256
3394
|
}).on(S.DoubleClick, (e, t) => {
|
|
3257
|
-
let n = new
|
|
3258
|
-
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3395
|
+
let n = new Pt(e, t);
|
|
3396
|
+
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.EditField) && t.editable && !t.removed && (this.currentAction = new Dt(this, t.id, t.text, ""), this.openTextInput(t.id));
|
|
3259
3397
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
|
|
3260
3398
|
if (this.multipleSelectionOn || this.secondaryButton) this.startMultipleSelection(e);
|
|
3261
3399
|
else {
|
|
3262
3400
|
let n;
|
|
3263
|
-
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.startMovingNode(e, n) :
|
|
3401
|
+
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.startMovingNode(e, n) : X(A.NotAllowed);
|
|
3264
3402
|
}
|
|
3265
3403
|
}).on(w.Drag, (e, t) => {
|
|
3266
3404
|
if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
|
|
3267
3405
|
else {
|
|
3268
3406
|
let n;
|
|
3269
|
-
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) :
|
|
3407
|
+
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) : X(A.NotAllowed);
|
|
3270
3408
|
}
|
|
3271
3409
|
}).on(w.End, (e, t) => {
|
|
3272
3410
|
if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
|
|
3273
3411
|
else {
|
|
3274
3412
|
let n;
|
|
3275
|
-
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) :
|
|
3413
|
+
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) : X();
|
|
3276
3414
|
}
|
|
3277
3415
|
this.secondaryButton = !1;
|
|
3278
|
-
})), i.append("text"), i.append("rect"), a.attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]}) rotate(${e.orientation} ${e.width / 2} ${e.height / 2})`).attr("opacity", (e) => e.removed ? .5 : 1).select("text").attr("x", (e) => e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("text-anchor", (e) => e.horizontalAlign === h.Center ? "middle" : e.horizontalAlign === h.Right ? "end" : "start").attr("y", (e) => e.verticalAlign === g.Center ? e.height / 2 : e.verticalAlign === g.Bottom ? e.height : 0).attr("dominant-baseline", (e) => e.verticalAlign === g.Center ? "middle" : e.verticalAlign === g.Bottom ? "auto" : "hanging").attr("font-size", (e) => e.fontSize).attr("font-family", (e) => e.fontFamily || "'Wonder Unit Sans', sans-serif").attr("font-weight", (e) => e.
|
|
3416
|
+
})), i.append("text").style("user-select", "none").style("font-kerning", "none").style("white-space", "nowrap"), i.append("rect"), a.attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]}) rotate(${e.orientation} ${e.width / 2} ${e.height / 2})`).attr("opacity", (e) => e.removed ? .5 : 1).select("text").attr("x", (e) => e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("text-anchor", (e) => e.horizontalAlign === h.Center ? "middle" : e.horizontalAlign === h.Right ? "end" : "start").attr("y", (e) => e.verticalAlign === g.Center ? e.height / 2 : e.verticalAlign === g.Bottom ? e.height : 0).attr("dominant-baseline", (e) => e.verticalAlign === g.Center ? "middle" : e.verticalAlign === g.Bottom ? "auto" : "hanging").attr("font-size", (e) => e.look.fontSize || L.look.fontSize).attr("font-family", (e) => e.look.fontFamily || "'Wonder Unit Sans', sans-serif").attr("font-weight", (e) => e.look.fontWeight || L.look.fontWeight).attr("fill", (e) => e.look.fontColor || L.look.fontColor).style("font-kerning", "none").each((e) => {
|
|
3279
3417
|
this.setFieldTextAndWrap(e);
|
|
3280
3418
|
}), a.select("rect").attr("x", 0).attr("y", 0).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("fill", "transparent");
|
|
3281
3419
|
}
|
|
3282
3420
|
updateObjectsInView(...t) {
|
|
3283
3421
|
let n = this.selectCanvasElements().selectAll("g.diagram-object").data(this.model.objects.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", "diagram-object");
|
|
3284
|
-
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.
|
|
3422
|
+
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.svg), r.remove(), i.on(S.ContextMenu, (e, t) => {
|
|
3285
3423
|
if (this.dragging) {
|
|
3286
3424
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
3287
3425
|
return;
|
|
3288
3426
|
}
|
|
3289
|
-
let n = new
|
|
3290
|
-
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3427
|
+
let n = new Ft(e, t);
|
|
3428
|
+
this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && (e.preventDefault(), this.contextMenu.open(e));
|
|
3291
3429
|
}).on(S.DoubleClick, (e, t) => {
|
|
3292
|
-
let n = new
|
|
3430
|
+
let n = new Pt(e, t);
|
|
3293
3431
|
this.diagramEvent$.next(n);
|
|
3294
3432
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e) => {
|
|
3295
3433
|
(this.multipleSelectionOn || this.secondaryButton) && this.startMultipleSelection(e);
|
|
@@ -3301,48 +3439,48 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3301
3439
|
}
|
|
3302
3440
|
updateDecoratorsInView(...t) {
|
|
3303
3441
|
let n = this.selectCanvasElements().selectAll("g.diagram-decorator").data(this.model.decorators.filter((e) => this.priorityThreshold === void 0 ? !0 : e.getPriority() >= this.priorityThreshold), (e) => e.id), r = n.exit(), i = n.enter().append("g").attr("id", (e) => e.id).attr("class", "diagram-decorator");
|
|
3304
|
-
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.
|
|
3305
|
-
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new
|
|
3442
|
+
t && t.length > 0 && (n = n.filter((e) => t.includes(e.id))), i.merge(n).attr("width", (e) => e.width).attr("height", (e) => e.height).attr("transform", (e) => `translate(${e.coords[0]},${e.coords[1]})`).html((e) => e.svg), r.remove(), i.on(S.MouseOver, (e, t) => {
|
|
3443
|
+
this.dragging || (this.userHighlight.focusOn(t), this.diagramEvent$.next(new Y(t)));
|
|
3306
3444
|
}).on(S.Click, (e, t) => {
|
|
3307
3445
|
if (!e.ctrlKey && !e.shiftKey) {
|
|
3308
3446
|
let e = this.userSelection.all();
|
|
3309
|
-
this.userSelection.clear(), this.diagramEvent$.next(new
|
|
3447
|
+
this.userSelection.clear(), this.diagramEvent$.next(new J(e, !1));
|
|
3310
3448
|
}
|
|
3311
3449
|
if (t.rootElement) {
|
|
3312
|
-
let e =
|
|
3313
|
-
this.userSelection.toggle(e), this.diagramEvent$.next(new
|
|
3450
|
+
let e = Bt(t.rootElement);
|
|
3451
|
+
this.userSelection.toggle(e), this.diagramEvent$.next(new J([e], e.selected));
|
|
3314
3452
|
}
|
|
3315
3453
|
}).on(S.ContextMenu, (e, t) => {
|
|
3316
3454
|
if (this.dragging) {
|
|
3317
3455
|
e.preventDefault(), e.stopPropagation(), this.dragging = !1;
|
|
3318
3456
|
return;
|
|
3319
3457
|
}
|
|
3320
|
-
let n = new
|
|
3321
|
-
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(
|
|
3458
|
+
let n = new Ft(e, t);
|
|
3459
|
+
if (this.diagramEvent$.next(n), !n.defaultPrevented && this.canUserPerformAction(K.ContextMenu) && t.rootElement) {
|
|
3322
3460
|
e.preventDefault();
|
|
3323
|
-
let n =
|
|
3324
|
-
this.userHighlight.focusOn(n), this.diagramEvent$.next(new
|
|
3461
|
+
let n = Bt(t.rootElement);
|
|
3462
|
+
this.userHighlight.focusOn(n), this.diagramEvent$.next(new Y(n)), this.userSelection.add(n), this.diagramEvent$.next(new J([n], !0)), this.contextMenu.open(e);
|
|
3325
3463
|
}
|
|
3326
3464
|
}).on(S.DoubleClick, (e, t) => {
|
|
3327
|
-
let n = new
|
|
3465
|
+
let n = new Pt(e, t);
|
|
3328
3466
|
this.diagramEvent$.next(n);
|
|
3329
3467
|
}).call(e.drag().filter((e) => (this.secondaryButton = Rt(e), !0)).on(w.Start, (e, t) => {
|
|
3330
3468
|
if (this.multipleSelectionOn || this.secondaryButton) this.startMultipleSelection(e);
|
|
3331
3469
|
else {
|
|
3332
3470
|
let n;
|
|
3333
|
-
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.startMovingNode(e, n) :
|
|
3471
|
+
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.startMovingNode(e, n) : X(A.NotAllowed);
|
|
3334
3472
|
}
|
|
3335
3473
|
}).on(w.Drag, (e, t) => {
|
|
3336
3474
|
if (this.multipleSelectionOn || this.secondaryButton) this.continueMultipleSelection(e);
|
|
3337
3475
|
else {
|
|
3338
3476
|
let n;
|
|
3339
|
-
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) :
|
|
3477
|
+
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.continueMovingNode(e, n) : X(A.NotAllowed);
|
|
3340
3478
|
}
|
|
3341
3479
|
}).on(w.End, (e, t) => {
|
|
3342
3480
|
if (this.multipleSelectionOn || this.secondaryButton) this.finishMultipleSelection(e);
|
|
3343
3481
|
else {
|
|
3344
3482
|
let n;
|
|
3345
|
-
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) :
|
|
3483
|
+
t.rootElement instanceof W ? n = t.rootElement : t.rootElement instanceof H && (n = t.rootElement.node), n ? this.finishMovingNode(e, n) : X();
|
|
3346
3484
|
}
|
|
3347
3485
|
this.secondaryButton = !1;
|
|
3348
3486
|
}));
|
|
@@ -3352,9 +3490,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3352
3490
|
...L,
|
|
3353
3491
|
...e.type.label
|
|
3354
3492
|
};
|
|
3355
|
-
if (
|
|
3493
|
+
if (r.look = {
|
|
3494
|
+
...L.look,
|
|
3495
|
+
...r.look
|
|
3496
|
+
}, n) {
|
|
3356
3497
|
let i = n.getTotalLength(), a = 0, o = 0, s = 0, c = 0, l = 0, u = 0;
|
|
3357
|
-
if (r.
|
|
3498
|
+
if (r.look.fillColor === "transparent") {
|
|
3358
3499
|
let t = e.endCoords[0] - e.startCoords[0], n = e.endCoords[1] - e.startCoords[1];
|
|
3359
3500
|
switch (e.startDirection) {
|
|
3360
3501
|
case p.Top:
|
|
@@ -3388,10 +3529,10 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3388
3529
|
}
|
|
3389
3530
|
Math.abs(t) >= Math.abs(n) ? (s = t > 0 ? -.5 : .5, c = n > 0 ? .5 : -.5) : (s = t > 0 ? .5 : -.5, c = n > 0 ? -.5 : .5);
|
|
3390
3531
|
}
|
|
3391
|
-
t.select("g.diagram-connection-start-label text").attr("x", 0).attr("y", r.fontSize / 3).attr("text-anchor", "middle").attr("font-family", r.fontFamily).attr("font-size", r.fontSize).attr("fill",
|
|
3532
|
+
t.select("g.diagram-connection-start-label text").attr("x", 0).attr("y", (r.look.fontSize || L.look.fontSize) / 3).attr("text-anchor", "middle").attr("font-family", r.look.fontFamily || L.look.fontFamily).attr("font-size", r.look.fontSize || L.look.fontSize).attr("fill", r.look.fontColor || L.look.fontColor).text(e.startLabel);
|
|
3392
3533
|
let d = t.select("g.diagram-connection-start-label text").node()?.getBoundingClientRect();
|
|
3393
3534
|
if (d) {
|
|
3394
|
-
let i = e.startLabel ? d.width / this.zoomTransform.k +
|
|
3535
|
+
let i = e.startLabel ? d.width / this.zoomTransform.k + Be(r) + Ve(r) : 0, s = e.startLabel ? d.height / this.zoomTransform.k + He(r) + ze(r) : 0, c;
|
|
3395
3536
|
switch (e.startDirection) {
|
|
3396
3537
|
case p.Left:
|
|
3397
3538
|
c = n.getPointAtLength(B(r) + i / 2);
|
|
@@ -3407,18 +3548,18 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3407
3548
|
break;
|
|
3408
3549
|
default: c = n.getPointAtLength(Math.max(z(r) + i / 2, B(r) + i / 2, V(r) + s / 2, R(r) + s / 2));
|
|
3409
3550
|
}
|
|
3410
|
-
t.select("g.diagram-connection-start-label path").attr("d", de(-i / 2, -s / 2, i, s)).attr("fill", r.
|
|
3551
|
+
t.select("g.diagram-connection-start-label path").attr("d", de(-i / 2, -s / 2, i, s)).attr("fill", r.look.fillColor || L.look.fillColor).attr("stroke", "none"), t.select("g.diagram-connection-start-label").attr("transform", `translate(${c.x + a * i},${c.y + o * s})`);
|
|
3411
3552
|
}
|
|
3412
|
-
t.select("g.diagram-connection-middle-label text").attr("x", 0).attr("y", r.fontSize / 3).attr("text-anchor", "middle").attr("font-family", r.fontFamily).attr("font-size", r.fontSize).attr("fill",
|
|
3553
|
+
t.select("g.diagram-connection-middle-label text").attr("x", 0).attr("y", (r.look.fontSize || L.look.fontSize) / 3).attr("text-anchor", "middle").attr("font-family", r.look.fontFamily || L.look.fontFamily).attr("font-size", r.look.fontSize || L.look.fontSize).attr("fill", r.look.fontColor || L.look.fillColor).style("font-kerning", "none").text(e.middleLabel);
|
|
3413
3554
|
let f = t.select("g.diagram-connection-middle-label text").node()?.getBoundingClientRect();
|
|
3414
3555
|
if (f) {
|
|
3415
|
-
let a = e.middleLabel ? f.width / this.zoomTransform.k +
|
|
3416
|
-
t.select("g.diagram-connection-middle-label path").attr("d", de(-a / 2, -o / 2, a, o)).attr("fill", r.
|
|
3556
|
+
let a = e.middleLabel ? f.width / this.zoomTransform.k + Be(r) + Ve(r) : 0, o = e.middleLabel ? f.height / this.zoomTransform.k + He(r) + ze(r) : 0, l = n.getPointAtLength(i / 2);
|
|
3557
|
+
t.select("g.diagram-connection-middle-label path").attr("d", de(-a / 2, -o / 2, a, o)).attr("fill", r.look.fillColor || L.look.fillColor).attr("stroke", "none"), t.select("g.diagram-connection-middle-label").attr("transform", `translate(${l.x + s * a},${l.y + c * o})`);
|
|
3417
3558
|
}
|
|
3418
|
-
t.select("g.diagram-connection-end-label text").attr("x", 0).attr("y", r.fontSize / 3).attr("text-anchor", "middle").attr("font-family", r.fontFamily).attr("font-size", r.fontSize).attr("fill",
|
|
3559
|
+
t.select("g.diagram-connection-end-label text").attr("x", 0).attr("y", (r.look.fontSize || L.look.fontSize) / 3).attr("text-anchor", "middle").attr("font-family", r.look.fontFamily || L.look.fontFamily).attr("font-size", r.look.fontSize || L.look.fontSize).attr("fill", r.look.fontColor || L.look.fontColor).style("font-kerning", "none").text(e.endLabel);
|
|
3419
3560
|
let m = t.select("g.diagram-connection-end-label text").node()?.getBoundingClientRect();
|
|
3420
3561
|
if (m) {
|
|
3421
|
-
let a = e.endLabel ? m.width / this.zoomTransform.k +
|
|
3562
|
+
let a = e.endLabel ? m.width / this.zoomTransform.k + Be(r) + Ve(r) : 0, o = e.endLabel ? m.height / this.zoomTransform.k + He(r) + ze(r) : 0, s;
|
|
3422
3563
|
switch (e.endDirection) {
|
|
3423
3564
|
case p.Left:
|
|
3424
3565
|
s = n.getPointAtLength(i - (B(r) + a / 2));
|
|
@@ -3434,7 +3575,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3434
3575
|
break;
|
|
3435
3576
|
default: s = n.getPointAtLength(i - Math.max(z(r) + a / 2, B(r) + a / 2, V(r) + o / 2, R(r) + o / 2));
|
|
3436
3577
|
}
|
|
3437
|
-
t.select("g.diagram-connection-end-label path").attr("d", de(-a / 2, -o / 2, a, o)).attr("fill", r.
|
|
3578
|
+
t.select("g.diagram-connection-end-label path").attr("d", de(-a / 2, -o / 2, a, o)).attr("fill", r.look.fillColor || L.look.fillColor).attr("stroke", "none"), t.select("g.diagram-connection-end-label").attr("transform", `translate(${s.x + l * a},${s.y + u * o})`);
|
|
3438
3579
|
}
|
|
3439
3580
|
}
|
|
3440
3581
|
}
|
|
@@ -3455,15 +3596,15 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3455
3596
|
let n = this.model.fields.get(e);
|
|
3456
3597
|
if (n) {
|
|
3457
3598
|
if (n.rootElement instanceof W) {
|
|
3458
|
-
let e = this.minimumSizeOfField(n), r = e[0] + z(n.rootElement.type.label) + B(n.rootElement.type.label) - n.rootElement.width, i = e[1] + V(n.rootElement.type.label) + R(n.rootElement.type.label) - n.rootElement.height;
|
|
3459
|
-
this.
|
|
3599
|
+
let e = this.minimumSizeOfField(n), r = e[0] + z(n.rootElement.type.label) + B(n.rootElement.type.label) - n.rootElement.width, i = e[1] + V(n.rootElement.type.label) + R(n.rootElement.type.label) - n.rootElement.height, a = Z(this.gridConfig), o = Q(this.gridConfig);
|
|
3600
|
+
this.gridConfig.snap && a !== 0 && (r = Math.ceil(r / a) * a), this.gridConfig.snap && o !== 0 && (i = Math.ceil(i / o) * o), n.rootElement.width + r < n.rootElement.type.minWidth && (r = n.rootElement.type.minWidth - n.rootElement.width), n.rootElement.height + i < n.rootElement.type.minHeight && (i = n.rootElement.type.minHeight - n.rootElement.height), (t !== !1 || r > 0) && n.rootElement.stretch(p.Right, r), (t !== !1 || i > 0) && n.rootElement.stretch(p.Bottom, i);
|
|
3460
3601
|
}
|
|
3461
3602
|
if (n.rootElement instanceof H) {
|
|
3462
3603
|
let e = this.minimumSizeOfField(n), r = e[0], i = e[1];
|
|
3463
3604
|
for (let e of n.rootElement.node?.sections || []) e.label && (e.indexXInNode === n.rootElement.indexXInNode && e.indexYInNode !== n.rootElement.indexYInNode ? r = Math.max(r, this.minimumSizeOfField(e.label)[0]) : e.indexXInNode !== n.rootElement.indexXInNode && e.indexYInNode === n.rootElement.indexYInNode && (i = Math.max(i, this.minimumSizeOfField(e.label)[1])));
|
|
3464
3605
|
e[0] < r && (e[0] = r), e[1] < i && (e[1] = i);
|
|
3465
|
-
let a = n.rootElement.type, o = e[0] + z(a?.label) + B(a?.label) - n.rootElement.width, s = e[1] + V(a?.label) + R(a?.label) - n.rootElement.height;
|
|
3466
|
-
this.
|
|
3606
|
+
let a = n.rootElement.type, o = e[0] + z(a?.label) + B(a?.label) - n.rootElement.width, s = e[1] + V(a?.label) + R(a?.label) - n.rootElement.height, c = Z(this.gridConfig), l = Q(this.gridConfig);
|
|
3607
|
+
this.gridConfig.snap && c !== 0 && (o = Math.ceil(o / c) * c), this.gridConfig.snap && l !== 0 && (s = Math.ceil(s / l) * l), n.rootElement.width + o < (n.rootElement.getMinWidth() || 0) && (o = (n.rootElement.getMinWidth() || 0) - n.rootElement.width), n.rootElement.height + s < (n.rootElement.getMinHeight() || 0) && (s = (n.rootElement.getMinHeight() || 0) - n.rootElement.height), (t || o > 0) && n.rootElement.node?.stretchSections(p.Right, o, n.rootElement.indexXInNode, n.rootElement.indexYInNode), (t || s > 0) && n.rootElement.node?.stretchSections(p.Bottom, s, n.rootElement.indexXInNode, n.rootElement.indexYInNode);
|
|
3467
3608
|
}
|
|
3468
3609
|
}
|
|
3469
3610
|
}
|
|
@@ -3482,20 +3623,20 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3482
3623
|
return e.select(this.diagramRoot);
|
|
3483
3624
|
}
|
|
3484
3625
|
selectSVGElement() {
|
|
3485
|
-
return
|
|
3626
|
+
return this.selectRoot().select("svg");
|
|
3486
3627
|
}
|
|
3487
3628
|
selectCanvasView() {
|
|
3488
3629
|
return this.selectSVGElement().select(".daga-canvas-view");
|
|
3489
3630
|
}
|
|
3490
3631
|
selectCanvasElements() {
|
|
3491
|
-
return this.
|
|
3632
|
+
return this.selectCanvasView().select(".daga-canvas-elements");
|
|
3492
3633
|
}
|
|
3493
3634
|
startConnection(e) {
|
|
3494
3635
|
if (e.allowsOutgoing || e.allowsIncoming) {
|
|
3495
|
-
if (this.connectionType && (this.connectionType.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing || this.connectionType.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming)) this.unfinishedConnection = new I(this.model, this.connectionType, e, void 0,
|
|
3636
|
+
if (this.connectionType && (this.connectionType.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing || this.connectionType.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming)) this.unfinishedConnection = new I(this.model, this.connectionType, e, void 0, ln), this.unfinishedConnectionPort = e;
|
|
3496
3637
|
else if (this.inferConnectionType) {
|
|
3497
3638
|
let t = this.model.connections.types.all().find((t) => e.allowsOutgoing && t.canStartFromType(e.getNode()?.type?.id || ""));
|
|
3498
|
-
t === void 0 && (t = this.model.connections.types.all().find((t) => e.allowsIncoming && t.canFinishOnType(e.getNode()?.type?.id || ""))), t !== void 0 && (this.unfinishedConnection = new I(this.model, t, e, void 0,
|
|
3639
|
+
t === void 0 && (t = this.model.connections.types.all().find((t) => e.allowsIncoming && t.canFinishOnType(e.getNode()?.type?.id || ""))), t !== void 0 && (this.unfinishedConnection = new I(this.model, t, e, void 0, ln), this.unfinishedConnectionPort = e);
|
|
3499
3640
|
}
|
|
3500
3641
|
}
|
|
3501
3642
|
}
|
|
@@ -3514,15 +3655,15 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3514
3655
|
return;
|
|
3515
3656
|
}
|
|
3516
3657
|
if (this.unfinishedConnection.type.canStartFromType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsOutgoing && this.unfinishedConnection.type.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming) {
|
|
3517
|
-
let t = new
|
|
3658
|
+
let t = new Et(this, this.unfinishedConnection.type, this.unfinishedConnection.start?.id, e.id);
|
|
3518
3659
|
this.dropConnection(), t.do(), this.actionStack.add(t);
|
|
3519
3660
|
} else if (this.unfinishedConnection.type.canFinishOnType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsIncoming && this.unfinishedConnection.type.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing) {
|
|
3520
|
-
let t = new
|
|
3661
|
+
let t = new Et(this, this.unfinishedConnection.type, e.id, this.unfinishedConnection.start?.id);
|
|
3521
3662
|
this.dropConnection(), t.do(), this.actionStack.add(t);
|
|
3522
3663
|
} else if (this.inferConnectionType) {
|
|
3523
3664
|
let t = this.model.connections.types.all().find((t) => t.canStartFromType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsOutgoing && t.canFinishOnType(e.getNode()?.type?.id || "") && e.allowsIncoming), n = !1;
|
|
3524
3665
|
if (t === void 0 && (t = this.model.connections.types.all().find((t) => t.canFinishOnType(this.unfinishedConnection?.start?.getNode()?.type?.id || "") && this.unfinishedConnection?.start?.allowsIncoming && t.canStartFromType(e.getNode()?.type?.id || "") && e.allowsOutgoing), n = !0), t !== void 0) {
|
|
3525
|
-
let r = new
|
|
3666
|
+
let r = new Et(this, t, n ? e.id : this.unfinishedConnection.start?.id, n ? this.unfinishedConnection.start?.id : e.id);
|
|
3526
3667
|
this.dropConnection(), r.do(), this.actionStack.add(r);
|
|
3527
3668
|
} else this.dropConnection();
|
|
3528
3669
|
} else this.dropConnection();
|
|
@@ -3539,8 +3680,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3539
3680
|
}
|
|
3540
3681
|
openTextInput(e) {
|
|
3541
3682
|
let t = this.model.fields.get(e);
|
|
3542
|
-
t && this.createInputField(t.text, t.coords, t.width, t.height, t.fontSize, t.fontFamily || L.fontFamily, t.orientation, t.multiline, () => {}, (e) => {
|
|
3543
|
-
t.text = e, this.currentAction instanceof
|
|
3683
|
+
t && this.createInputField(t.text, t.coords, t.width, t.height, t.look.fontSize || L.look.fontSize, t.look.fontFamily || L.look.fontFamily, t.orientation, t.multiline, () => {}, (e) => {
|
|
3684
|
+
t.text = e, this.currentAction instanceof Dt && (this.currentAction.to = e, this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0);
|
|
3544
3685
|
});
|
|
3545
3686
|
}
|
|
3546
3687
|
createInputField(e, t, n, r, i, a, o, s, c, l) {
|
|
@@ -3555,11 +3696,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3555
3696
|
}
|
|
3556
3697
|
}).on(S.KeyUp, (e) => {
|
|
3557
3698
|
e.stopPropagation();
|
|
3558
|
-
}).on(S.Input, (
|
|
3559
|
-
let
|
|
3560
|
-
d.attr("cols", ge(
|
|
3561
|
-
let
|
|
3562
|
-
u?.attr("width", `${
|
|
3699
|
+
}).on(S.Input, () => {
|
|
3700
|
+
let e = d.property("value");
|
|
3701
|
+
d.attr("cols", ge(e) + 1), d.attr("rows", _e(e) + 1), d.style("width", ""), d.style("height", ""), f = d.property("scrollWidth") + 1, p = d.property("scrollHeight") + 1;
|
|
3702
|
+
let t = Math.max(f, n), i = Math.max(p, r);
|
|
3703
|
+
u?.attr("width", `${t}px`), d.style("width", `${t}px`), u?.attr("height", `${i}px`), d.style("height", `${i}px`), c && c(e);
|
|
3563
3704
|
}).on(S.Click, (e) => {
|
|
3564
3705
|
e.stopPropagation();
|
|
3565
3706
|
}).on(S.FocusOut, () => {
|
|
@@ -3593,33 +3734,33 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3593
3734
|
setFieldText(e, t, n) {
|
|
3594
3735
|
let r = n.split("\n");
|
|
3595
3736
|
t.html("");
|
|
3596
|
-
for (let n = 0; n < r.length; ++n) t.append("tspan").attr("x", e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("y", e.verticalAlign === g.Center ? (n + .5 - r.length / 2) * e.fontSize + e.height / 2 : e.verticalAlign === g.Bottom ? e.height - (r.length - n - 1) * e.fontSize : n * e.fontSize).text(r[n]);
|
|
3737
|
+
for (let n = 0; n < r.length; ++n) t.append("tspan").attr("x", e.horizontalAlign === h.Center ? e.width / 2 : e.horizontalAlign === h.Right ? e.width : 0).attr("y", e.verticalAlign === g.Center ? (n + .5 - r.length / 2) * (e.look.fontSize || L.look.fontSize) + e.height / 2 : e.verticalAlign === g.Bottom ? e.height - (r.length - n - 1) * (e.look.fontSize || L.look.fontSize) : n * (e.look.fontSize || L.look.fontSize)).text(r[n]);
|
|
3597
3738
|
}
|
|
3598
3739
|
startMovingNode(e, t) {
|
|
3599
|
-
if (this.canUserPerformAction(
|
|
3740
|
+
if (this.canUserPerformAction(K.MoveNode) && !t.removed) if (X(A.Grabbing), this.draggingFrom = [e.x, e.y], t.selected && this.userSelection.count((e) => e instanceof W) > 1) this.currentAction = new wt(this, this.userSelection.filter((e) => e instanceof W).map((e) => e.id), t.coords);
|
|
3600
3741
|
else {
|
|
3601
3742
|
let e = t.getLastAncestor();
|
|
3602
|
-
this.currentAction = new
|
|
3743
|
+
this.currentAction = new q(this, K.MoveNode, t.id, t.getGeometry(), t.getGeometry(), e?.id, e?.getGeometry(t.id), e?.getGeometry(t.id));
|
|
3603
3744
|
}
|
|
3604
|
-
else
|
|
3745
|
+
else X(A.NotAllowed);
|
|
3605
3746
|
}
|
|
3606
3747
|
continueMovingNode(e, t) {
|
|
3607
|
-
if (this.canUserPerformAction(
|
|
3748
|
+
if (this.canUserPerformAction(K.MoveNode) && (this.currentAction instanceof wt || this.currentAction instanceof q) && !t.removed) {
|
|
3608
3749
|
let n = [e.x - t.width / 2, e.y - t.height / 2];
|
|
3609
|
-
t.selected ? this.userSelection.move([n[0] - t.coords[0], n[1] - t.coords[1]]) : t.move(n), this.userHighlight.clear(), this.dragging = !0, this.diagramEvent$.next(new
|
|
3750
|
+
t.selected ? this.userSelection.move([n[0] - t.coords[0], n[1] - t.coords[1]]) : t.move(n), this.userHighlight.clear(), this.dragging = !0, this.diagramEvent$.next(new It(t));
|
|
3610
3751
|
}
|
|
3611
3752
|
}
|
|
3612
3753
|
finishMovingNode(e, t) {
|
|
3613
|
-
if (this.canUserPerformAction(
|
|
3754
|
+
if (this.canUserPerformAction(K.MoveNode) && !t.removed && (this.draggingFrom[0] !== e.x || this.draggingFrom[1] !== e.y)) {
|
|
3614
3755
|
let n = [e.x - t.width / 2, e.y - t.height / 2];
|
|
3615
|
-
if (this.
|
|
3756
|
+
if (this.gridConfig?.snap && (n = this.getClosestGridPoint([n[0] - t.type.snapToGridOffset[0], n[1] - t.type.snapToGridOffset[1]]), n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1]), this.currentAction instanceof wt) {
|
|
3616
3757
|
let e = this.currentAction.delta;
|
|
3617
3758
|
this.currentAction.delta = [n[0] - e[0], n[1] - e[1]], t.selected ? this.userSelection.move([e[0] - t.coords[0], e[1] - t.coords[1]]) : t.move(e);
|
|
3618
|
-
} else if (this.currentAction instanceof
|
|
3759
|
+
} else if (this.currentAction instanceof q) {
|
|
3619
3760
|
t.move(n);
|
|
3620
3761
|
let r = Ye(this.model.nodes.getAtCoordinates(e.x, e.y).filter((e) => e.id !== t.id && !e.isDescendantOf(t)).filter((e) => e.type.childrenTypes.includes(t.type.id))), i = r[r.length - 1];
|
|
3621
3762
|
if (i !== t.parent && (t.type.canBeParentless || i !== void 0)) {
|
|
3622
|
-
let e = i?.getLastAncestor(), n = this.currentAction.from, r = new
|
|
3763
|
+
let e = i?.getLastAncestor(), n = this.currentAction.from, r = new Tt(this, t.id, t.parent?.id, i?.id, n, t.getGeometry(), e?.id, e?.getGeometry(t.id), e?.getGeometry(t.id));
|
|
3623
3764
|
t.parent?.removeChild(t), i !== void 0 && i.addChild(t), r.toChildGeometry = t.getGeometry(t.id), r.toAncestorGeometry = e?.getGeometry(t.id), this.currentAction = r;
|
|
3624
3765
|
} else {
|
|
3625
3766
|
let e = t?.getLastAncestor();
|
|
@@ -3628,22 +3769,22 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3628
3769
|
}
|
|
3629
3770
|
this.currentAction !== void 0 && (this.currentAction.do(), this.actionStack.add(this.currentAction), this.currentAction = void 0);
|
|
3630
3771
|
}
|
|
3631
|
-
|
|
3772
|
+
X(), this.dragging = !1;
|
|
3632
3773
|
}
|
|
3633
3774
|
startMultipleSelection(e) {
|
|
3634
3775
|
this.draggingFrom = this.getPointerLocationRelativeToCanvas(e), this.multipleSelectionContainer = this.selectSVGElement().append("rect").attr("stroke", "#0E74B6").attr("fill", "rgba(14, 116, 182, 0.06)");
|
|
3635
3776
|
}
|
|
3636
3777
|
continueMultipleSelection(e) {
|
|
3637
3778
|
let t = this.getPointerLocationRelativeToCanvas(e);
|
|
3638
|
-
(this.draggingFrom[0] !== t[0] || this.draggingFrom[1] !== t[1]) && (
|
|
3779
|
+
(this.draggingFrom[0] !== t[0] || this.draggingFrom[1] !== t[1]) && (X(A.Crosshair), this.multipleSelectionContainer?.attr("x", Math.min(this.draggingFrom[0], t[0]) * this.zoomTransform.k + this.zoomTransform.x)?.attr("y", Math.min(this.draggingFrom[1], t[1]) * this.zoomTransform.k + this.zoomTransform.y)?.attr("width", Math.abs(this.draggingFrom[0] - t[0]) * this.zoomTransform.k)?.attr("height", Math.abs(this.draggingFrom[1] - t[1]) * this.zoomTransform.k), this.dragging = !0);
|
|
3639
3780
|
}
|
|
3640
3781
|
finishMultipleSelection(e) {
|
|
3641
3782
|
let t = this.getPointerLocationRelativeToCanvas(e);
|
|
3642
3783
|
this.multipleSelectionContainer?.remove(), this.multipleSelectionContainer = void 0, this.userSelection.clear();
|
|
3643
3784
|
for (let e of this.model.nodes) ee([e.coords, [e.coords[0] + e.width, e.coords[1] + e.height]], [this.draggingFrom, t]) && this.userSelection.add(e);
|
|
3644
|
-
this.multipleSelectionOn = !1, this.diagramEvent$.next(new
|
|
3785
|
+
this.multipleSelectionOn = !1, this.diagramEvent$.next(new J(this.userSelection.all(), !0)), X();
|
|
3645
3786
|
}
|
|
3646
|
-
},
|
|
3787
|
+
}, dn = class {
|
|
3647
3788
|
constructor() {
|
|
3648
3789
|
this.grid = [[void 0]], this.offsetX = 0, this.offsetY = 0;
|
|
3649
3790
|
}
|
|
@@ -3701,36 +3842,36 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3701
3842
|
for (let e = t[1]; e !== i[1] + r; e += r) if (t[1] = e, this.get(t) === void 0) return t;
|
|
3702
3843
|
}
|
|
3703
3844
|
}
|
|
3704
|
-
},
|
|
3845
|
+
}, fn = class {
|
|
3705
3846
|
constructor(e) {
|
|
3706
3847
|
this.gapSize = e;
|
|
3707
3848
|
}
|
|
3708
3849
|
apply(e) {
|
|
3709
3850
|
if (e.nodes.length === 0) return e;
|
|
3710
|
-
let t = new
|
|
3711
|
-
for (; n.length > 0;)
|
|
3712
|
-
let r = Math.max(...e.nodes.map((e) => e.width)), i = Math.max(...e.nodes.map((e) => e.height)), a = this.gapSize === void 0 ? (e.canvas?.
|
|
3851
|
+
let t = new dn(), n = e.nodes.filter((e) => !e.parent);
|
|
3852
|
+
for (; n.length > 0;) pn(n[0], t, [0, 0], n);
|
|
3853
|
+
let r = Math.max(...e.nodes.map((e) => e.width)), i = Math.max(...e.nodes.map((e) => e.height)), a = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, o = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize;
|
|
3713
3854
|
for (let e = t.minY(); e <= t.maxY(); ++e) for (let n = t.minX(); n <= t.maxX(); ++n) {
|
|
3714
|
-
let
|
|
3715
|
-
|
|
3855
|
+
let s = t.get([n, e]);
|
|
3856
|
+
s !== void 0 && s.move([n * (r + a), e * (i + o)]);
|
|
3716
3857
|
}
|
|
3717
3858
|
return e;
|
|
3718
3859
|
}
|
|
3719
|
-
},
|
|
3860
|
+
}, pn = (e, t, n, r) => {
|
|
3720
3861
|
let i = t.getClosestEmptyCoordinate(n);
|
|
3721
|
-
t.set(i, e),
|
|
3722
|
-
for (let n of e.getAdjacentNodes()) r.includes(n) &&
|
|
3723
|
-
},
|
|
3862
|
+
t.set(i, e), k(r, e);
|
|
3863
|
+
for (let n of e.getAdjacentNodes()) r.includes(n) && pn(n, t, i, r);
|
|
3864
|
+
}, mn = class {
|
|
3724
3865
|
constructor(e) {
|
|
3725
3866
|
this.gapSize = e;
|
|
3726
3867
|
}
|
|
3727
3868
|
apply(e) {
|
|
3728
3869
|
if (e.nodes.length === 0) return e;
|
|
3729
|
-
let t = new
|
|
3870
|
+
let t = new dn(), n = e.nodes.filter((e) => !e.parent), r = {}, i = n[0], a = [i];
|
|
3730
3871
|
for (r[i.id] = [0, 0]; n.length > 0;) {
|
|
3731
3872
|
let e = [];
|
|
3732
3873
|
for (let i of a) {
|
|
3733
|
-
t.set(t.getClosestEmptyCoordinate(r[i.id]), i),
|
|
3874
|
+
t.set(t.getClosestEmptyCoordinate(r[i.id]), i), k(n, i);
|
|
3734
3875
|
let a = i.getAdjacentNodes();
|
|
3735
3876
|
for (let t of a) n.includes(t) && (e.push(t), r[t.id] = r[i.id]);
|
|
3736
3877
|
}
|
|
@@ -3740,179 +3881,177 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3740
3881
|
a = [e], r[e.id] = t.getClosestEmptyCoordinate([0, 0]);
|
|
3741
3882
|
}
|
|
3742
3883
|
}
|
|
3743
|
-
let o = Math.max(...e.nodes.map((e) => e.width)), s = Math.max(...e.nodes.map((e) => e.height)), c = this.gapSize === void 0 ? (e.canvas?.
|
|
3884
|
+
let o = Math.max(...e.nodes.map((e) => e.width)), s = Math.max(...e.nodes.map((e) => e.height)), c = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, l = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize;
|
|
3744
3885
|
for (let e = t.minY(); e <= t.maxY(); ++e) for (let n = t.minX(); n <= t.maxX(); ++n) {
|
|
3745
3886
|
let r = t.get([n, e]);
|
|
3746
|
-
r !== void 0 && r.move([n * (o + c), e * (s +
|
|
3887
|
+
r !== void 0 && r.move([n * (o + c), e * (s + l)]);
|
|
3747
3888
|
}
|
|
3748
3889
|
return e;
|
|
3749
3890
|
}
|
|
3750
|
-
},
|
|
3891
|
+
}, hn = class {
|
|
3751
3892
|
constructor(e) {
|
|
3752
3893
|
this.gapSize = e;
|
|
3753
3894
|
}
|
|
3754
3895
|
apply(e) {
|
|
3755
3896
|
if (e.nodes.length === 0) return e;
|
|
3756
|
-
let t = this.gapSize === void 0 ? (e.canvas?.
|
|
3757
|
-
|
|
3758
|
-
let
|
|
3759
|
-
for (;
|
|
3760
|
-
let e =
|
|
3761
|
-
for (let
|
|
3762
|
-
let e =
|
|
3763
|
-
for (let
|
|
3897
|
+
let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = e.nodes.filter((e) => !e.parent), i = r[0];
|
|
3898
|
+
k(r, i);
|
|
3899
|
+
let a = [[i]];
|
|
3900
|
+
for (; r.length > 0;) {
|
|
3901
|
+
let e = a[a.length - 1], t = [];
|
|
3902
|
+
for (let n of e) {
|
|
3903
|
+
let e = n.getAdjacentNodes();
|
|
3904
|
+
for (let n of e) r.includes(n) && (k(r, n), t.push(n));
|
|
3764
3905
|
}
|
|
3765
|
-
t.length > 0 ?
|
|
3906
|
+
t.length > 0 ? a.push(t) : (a.push(r), r = []);
|
|
3766
3907
|
}
|
|
3767
|
-
let
|
|
3768
|
-
for (let e of
|
|
3769
|
-
let
|
|
3770
|
-
for (let
|
|
3771
|
-
let
|
|
3772
|
-
|
|
3908
|
+
let o = 0;
|
|
3909
|
+
for (let e of a) {
|
|
3910
|
+
let r = 0;
|
|
3911
|
+
for (let t of e) t.move([o, r]), r += n + t.height;
|
|
3912
|
+
let i = Math.max(...e.map((e) => e.width));
|
|
3913
|
+
o += t + i;
|
|
3773
3914
|
}
|
|
3774
3915
|
for (let t of e.connections) t.tighten();
|
|
3775
3916
|
return e;
|
|
3776
3917
|
}
|
|
3777
|
-
},
|
|
3918
|
+
}, gn = class {
|
|
3778
3919
|
constructor(e) {
|
|
3779
3920
|
this.gapSize = e;
|
|
3780
3921
|
}
|
|
3781
3922
|
apply(e) {
|
|
3782
3923
|
if (e.nodes.length === 0) return e;
|
|
3783
|
-
new
|
|
3784
|
-
let t = this.gapSize === void 0 ? (e.canvas?.
|
|
3785
|
-
for (;
|
|
3786
|
-
|
|
3787
|
-
let
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
for (let s of e.nodes) {
|
|
3793
|
-
let c = s.getAdjacentNodes();
|
|
3924
|
+
new hn(this.gapSize).apply(e);
|
|
3925
|
+
let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = Math.max(t, n), i = .1, a = .5, o = .002, s = 100;
|
|
3926
|
+
for (; s > 1;) {
|
|
3927
|
+
s *= .99;
|
|
3928
|
+
let t = [0, 0];
|
|
3929
|
+
for (let n of e.nodes) t[0] = t[0] + n.coords[0] + n.width / 2, t[1] = t[1] + n.coords[1] + n.width / 2;
|
|
3930
|
+
t[0] /= e.nodes.length, t[1] /= e.nodes.length;
|
|
3931
|
+
for (let n of e.nodes) {
|
|
3932
|
+
let c = n.getAdjacentNodes();
|
|
3794
3933
|
for (let l of e.nodes) {
|
|
3795
|
-
let e = [
|
|
3796
|
-
if (c.includes(l) && d > 0 && (d >
|
|
3934
|
+
let e = [n.coords[0] + n.width / 2, n.coords[1] + n.height / 2], u = [l.coords[0] + l.width / 2, l.coords[1] + l.height / 2], d = x(n.coords, l.coords), f = [l.coords[0], l.coords[1]];
|
|
3935
|
+
if (c.includes(l) && d > 0 && (d > r + (Math.max(n.width, n.height) + Math.max(l.width, l.height)) / 2 ? (f[0] -= (u[0] - e[0]) * i, f[1] -= (u[1] - e[1]) * i) : (f[0] += (u[0] - e[0]) * a, f[1] += (u[1] - e[1]) * a)), d > 0) {
|
|
3797
3936
|
let t = 2e5 / (d * d);
|
|
3798
3937
|
f[0] += t * (u[0] - e[0]) / d, f[1] += t * (u[1] - e[1]) / d;
|
|
3799
3938
|
} else f[0] += 1 * (Math.random() * 2 - 1), f[1] += 1 * (Math.random() * 2 - 1);
|
|
3800
|
-
|
|
3939
|
+
f[0] -= (u[0] - t[0]) * o, f[1] -= (u[1] - t[1]) * o, f[0] - l.coords[0] > s ? f[0] = l.coords[0] + s : f[0] - l.coords[0] < -s && (f[0] = l.coords[0] - s), f[1] - l.coords[1] > s ? f[1] = l.coords[1] + s : f[1] - l.coords[1] < -s && (f[1] = l.coords[1] - s), l.move(f);
|
|
3801
3940
|
}
|
|
3802
3941
|
}
|
|
3803
3942
|
}
|
|
3804
|
-
if (e.canvas && e.canvas.
|
|
3943
|
+
if (e.canvas && e.canvas.gridConfig.snap) for (let t of e.nodes) {
|
|
3805
3944
|
let n = e.canvas.getClosestGridPoint([t.coords[0] - t.type.snapToGridOffset[0], t.coords[1] - t.type.snapToGridOffset[1]]);
|
|
3806
3945
|
n[0] += t.type.snapToGridOffset[0], n[1] += t.type.snapToGridOffset[1], t.move(n);
|
|
3807
3946
|
}
|
|
3808
3947
|
for (let t of e.connections) t.tighten();
|
|
3809
3948
|
return e;
|
|
3810
3949
|
}
|
|
3811
|
-
},
|
|
3950
|
+
}, _n = class {
|
|
3812
3951
|
constructor(e) {
|
|
3813
3952
|
this.gapSize = e;
|
|
3814
3953
|
}
|
|
3815
3954
|
apply(e) {
|
|
3816
3955
|
if (e.nodes.length === 0) return e;
|
|
3817
|
-
let t = this.gapSize === void 0 ?
|
|
3956
|
+
let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = e.nodes.filter((e) => !e.parent);
|
|
3818
3957
|
n.sort((e, t) => t.type.priority - e.type.priority);
|
|
3819
3958
|
let r = 0;
|
|
3820
3959
|
for (let e of n) e.move([r, 0]), r += e.width + t;
|
|
3821
3960
|
return e;
|
|
3822
3961
|
}
|
|
3823
|
-
},
|
|
3962
|
+
}, vn = class {
|
|
3824
3963
|
constructor(e) {
|
|
3825
3964
|
this.gapSize = e;
|
|
3826
3965
|
}
|
|
3827
3966
|
apply(e) {
|
|
3828
3967
|
if (e.nodes.length === 0) return e;
|
|
3829
3968
|
let t = Math.max(...e.nodes.map((e) => e.getPriority()));
|
|
3830
|
-
if (t === Math.min(...e.nodes.map((e) => e.getPriority()))) return new
|
|
3831
|
-
let n = this.gapSize === void 0 ? (e.canvas?.
|
|
3832
|
-
if (
|
|
3833
|
-
let e =
|
|
3834
|
-
|
|
3969
|
+
if (t === Math.min(...e.nodes.map((e) => e.getPriority()))) return new hn(this.gapSize).apply(e), e;
|
|
3970
|
+
let n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, i = e.nodes.filter((e) => !e.parent), a = [], o = e.nodes.filter((e) => !e.parent).filter((e) => e.getPriority() >= t), s = [];
|
|
3971
|
+
if (o.length > 1) {
|
|
3972
|
+
let e = o[0];
|
|
3973
|
+
o.splice(0, 1), s.push(e);
|
|
3835
3974
|
let t = [e], n = [e];
|
|
3836
3975
|
for (; t.length > 0;) {
|
|
3837
3976
|
let e = t[0];
|
|
3838
|
-
t.splice(0, 1),
|
|
3977
|
+
t.splice(0, 1), o.includes(e) && (s.push(e), k(o, e));
|
|
3839
3978
|
let r = e.getAdjacentNodes();
|
|
3840
3979
|
for (let e of r) n.includes(e) || (t.push(e), n.push(e));
|
|
3841
3980
|
}
|
|
3842
|
-
for (let e of
|
|
3843
|
-
} else
|
|
3844
|
-
for (let e of
|
|
3845
|
-
for (
|
|
3846
|
-
let e =
|
|
3847
|
-
|
|
3848
|
-
let t = [e], n = [e],
|
|
3981
|
+
for (let e of o) s.push(e);
|
|
3982
|
+
} else s.push(o[0]);
|
|
3983
|
+
for (let e of s) k(i, e), a.push([e]);
|
|
3984
|
+
for (a.push([]), i.sort((e, t) => t.type.priority - e.type.priority); i.length > 0;) {
|
|
3985
|
+
let e = i[0];
|
|
3986
|
+
i.splice(0, 1);
|
|
3987
|
+
let t = [e], n = [e], r = !1;
|
|
3849
3988
|
for (; t.length > 0;) {
|
|
3850
|
-
let
|
|
3989
|
+
let i = t[0];
|
|
3851
3990
|
t.splice(0, 1);
|
|
3852
|
-
let
|
|
3853
|
-
if (
|
|
3854
|
-
|
|
3991
|
+
let o = s.indexOf(i);
|
|
3992
|
+
if (o >= 0) {
|
|
3993
|
+
a[o].push(e), r = !0;
|
|
3855
3994
|
break;
|
|
3856
3995
|
} else {
|
|
3857
|
-
let e =
|
|
3996
|
+
let e = i.getAdjacentNodes();
|
|
3858
3997
|
for (let r of e) n.includes(r) || (t.push(r), n.push(r));
|
|
3859
3998
|
}
|
|
3860
3999
|
}
|
|
3861
|
-
|
|
4000
|
+
r || a[a.length - 1].push(e);
|
|
3862
4001
|
}
|
|
3863
|
-
let
|
|
3864
|
-
for (let e = 0; e <
|
|
4002
|
+
let c = 0;
|
|
4003
|
+
for (let e = 0; e < a.length; ++e) {
|
|
3865
4004
|
let t = 0;
|
|
3866
|
-
for (let
|
|
3867
|
-
let
|
|
3868
|
-
|
|
4005
|
+
for (let n = 0; n < a[e].length; ++n) {
|
|
4006
|
+
let i = a[e][n];
|
|
4007
|
+
i.move([c, t]), t += r + i.height;
|
|
3869
4008
|
}
|
|
3870
|
-
let
|
|
3871
|
-
|
|
4009
|
+
let i = Math.max(...a[e].map((e) => e.width));
|
|
4010
|
+
c += n + i;
|
|
3872
4011
|
}
|
|
3873
4012
|
for (let t of e.connections) t.tighten();
|
|
3874
4013
|
return e;
|
|
3875
4014
|
}
|
|
3876
|
-
},
|
|
4015
|
+
}, yn = class {
|
|
3877
4016
|
constructor(e) {
|
|
3878
4017
|
this.gapSize = e;
|
|
3879
4018
|
}
|
|
3880
4019
|
apply(e) {
|
|
3881
4020
|
if (e.nodes.length === 0) return e;
|
|
3882
|
-
if (Math.max(...e.nodes.map((e) => e.getPriority())) === Math.min(...e.nodes.map((e) => e.getPriority()))) return new
|
|
3883
|
-
let t = this.gapSize === void 0 ? (e.canvas?.
|
|
3884
|
-
for (;
|
|
3885
|
-
let e =
|
|
3886
|
-
|
|
3887
|
-
let t = new
|
|
3888
|
-
|
|
4021
|
+
if (Math.max(...e.nodes.map((e) => e.getPriority())) === Math.min(...e.nodes.map((e) => e.getPriority()))) return new hn(this.gapSize).apply(e), e;
|
|
4022
|
+
let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Z(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, r = e.nodes.filter((e) => !e.parent).sort((e, t) => t.getPriority() - e.getPriority()), i = [];
|
|
4023
|
+
for (; r.length > 0;) {
|
|
4024
|
+
let e = r[0];
|
|
4025
|
+
r.splice(0, 1);
|
|
4026
|
+
let t = new Sn(void 0, e);
|
|
4027
|
+
bn(t, r), i.push(t);
|
|
3889
4028
|
}
|
|
3890
|
-
let
|
|
3891
|
-
for (let e of
|
|
3892
|
-
let
|
|
3893
|
-
for (let e = 0; e <
|
|
3894
|
-
let
|
|
3895
|
-
for (let
|
|
3896
|
-
let
|
|
3897
|
-
|
|
4029
|
+
let a = [];
|
|
4030
|
+
for (let e of i) a.push([e]), xn(e, a, a.length);
|
|
4031
|
+
let o = Math.max(...e.nodes.map((e) => e.height)), s = 0;
|
|
4032
|
+
for (let e = 0; e < a.length; ++e) {
|
|
4033
|
+
let r = 0;
|
|
4034
|
+
for (let t = 0; t < a[e].length; ++t) {
|
|
4035
|
+
let i = a[e][t];
|
|
4036
|
+
i.node.move([s, r]), r += (n + o) * i.countBranchHeight();
|
|
3898
4037
|
}
|
|
3899
|
-
let
|
|
3900
|
-
|
|
4038
|
+
let i = Math.max(...a[e].map((e) => e.node.width));
|
|
4039
|
+
s += t + i;
|
|
3901
4040
|
}
|
|
3902
4041
|
for (let t of e.connections) t.tighten();
|
|
3903
4042
|
return e;
|
|
3904
4043
|
}
|
|
3905
|
-
},
|
|
4044
|
+
}, bn = (e, t) => {
|
|
3906
4045
|
for (let n of e.node.getAdjacentNodes().sort((e, t) => t.getPriority() - e.getPriority())) {
|
|
3907
4046
|
let r = t.indexOf(n);
|
|
3908
|
-
r >= 0 && (t.splice(r, 1),
|
|
4047
|
+
r >= 0 && (t.splice(r, 1), bn(e.addBranch(n), t));
|
|
3909
4048
|
}
|
|
3910
|
-
},
|
|
4049
|
+
}, xn = (e, t, n) => {
|
|
3911
4050
|
if (e.branches.length > 0) {
|
|
3912
4051
|
for (; n >= t.length;) t.push([]);
|
|
3913
|
-
for (let r of e.branches) t[n].push(r),
|
|
4052
|
+
for (let r of e.branches) t[n].push(r), xn(r, t, n + 1);
|
|
3914
4053
|
}
|
|
3915
|
-
},
|
|
4054
|
+
}, Sn = class e {
|
|
3916
4055
|
constructor(e, t) {
|
|
3917
4056
|
this.parent = e, this.branches = [], this.depth = 0, this.node = t;
|
|
3918
4057
|
}
|
|
@@ -3928,28 +4067,28 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3928
4067
|
return e;
|
|
3929
4068
|
}
|
|
3930
4069
|
}
|
|
3931
|
-
},
|
|
4070
|
+
}, Cn = class {
|
|
3932
4071
|
constructor(e) {
|
|
3933
4072
|
this.gapSize = e;
|
|
3934
4073
|
}
|
|
3935
4074
|
apply(e) {
|
|
3936
4075
|
if (e.nodes.length === 0) return e;
|
|
3937
|
-
let t = this.gapSize === void 0 ?
|
|
4076
|
+
let t = this.gapSize === void 0 ? e.canvas?.gridConfig ? Q(e.canvas?.gridConfig) * 2 : 0 : this.gapSize, n = e.nodes.filter((e) => !e.parent);
|
|
3938
4077
|
n.sort((e, t) => t.type.priority - e.type.priority);
|
|
3939
4078
|
let r = 0;
|
|
3940
4079
|
for (let e of n) e.move([0, r]), r += e.height + t;
|
|
3941
4080
|
return e;
|
|
3942
4081
|
}
|
|
3943
|
-
},
|
|
3944
|
-
adjacency: new
|
|
3945
|
-
breadth: new
|
|
3946
|
-
"breadth-adjacency": new
|
|
3947
|
-
force: new
|
|
3948
|
-
horizontal: new
|
|
3949
|
-
priority: new
|
|
3950
|
-
tree: new
|
|
3951
|
-
vertical: new
|
|
3952
|
-
},
|
|
4082
|
+
}, wn = {
|
|
4083
|
+
adjacency: new fn(),
|
|
4084
|
+
breadth: new hn(),
|
|
4085
|
+
"breadth-adjacency": new mn(),
|
|
4086
|
+
force: new gn(),
|
|
4087
|
+
horizontal: new _n(),
|
|
4088
|
+
priority: new vn(),
|
|
4089
|
+
tree: new yn(),
|
|
4090
|
+
vertical: new Cn()
|
|
4091
|
+
}, Tn = a({}), En = a({}), Dn = class {
|
|
3953
4092
|
constructor(e, t) {
|
|
3954
4093
|
this.onTitleChange = e, this.onValueSetChange = t;
|
|
3955
4094
|
}
|
|
@@ -3966,35 +4105,38 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
3966
4105
|
this._valueSet = e, this.onValueSetChange(e);
|
|
3967
4106
|
}
|
|
3968
4107
|
highlightProperty(...e) {}
|
|
3969
|
-
},
|
|
3970
|
-
let [
|
|
3971
|
-
|
|
4108
|
+
}, On = ({ direction: t, collapsableSelector: n, collapsableAdditionalSelector: r, collapsed: i, disabled: a, rule: o, collapsedValue: c, visibleValue: u, onCollapse: f }) => {
|
|
4109
|
+
let [m, h] = l(i), g = (t) => {
|
|
4110
|
+
let i;
|
|
4111
|
+
if (typeof n == "string") i = e.select(n), r && (i = i.select(r));
|
|
4112
|
+
else {
|
|
4113
|
+
let t = n;
|
|
4114
|
+
if (!t) throw Error("collapsableSelector is not a valid ref");
|
|
4115
|
+
i = e.select(t.current), r && (i = i.select(r));
|
|
4116
|
+
}
|
|
4117
|
+
i.style(o, t ? c : u);
|
|
4118
|
+
};
|
|
4119
|
+
return s(() => {
|
|
4120
|
+
g(m);
|
|
4121
|
+
}, [g, m]), /* @__PURE__ */ d("daga-collapse-button", { children: /* @__PURE__ */ d("button", {
|
|
3972
4122
|
className: `daga-collapse-button daga-${t}`,
|
|
3973
4123
|
onClick: () => {
|
|
3974
4124
|
if (!a) {
|
|
3975
|
-
let
|
|
3976
|
-
|
|
3977
|
-
let i;
|
|
3978
|
-
if (typeof n == "string") i = e.select(n), r && (i = i.select(r));
|
|
3979
|
-
else {
|
|
3980
|
-
let t = n;
|
|
3981
|
-
if (!t) throw Error("collapsableSelector is not a valid ref");
|
|
3982
|
-
i = e.select(t.current), r && (i = i.select(r));
|
|
3983
|
-
}
|
|
3984
|
-
i.style(o, t ? s : c);
|
|
4125
|
+
let e = !m;
|
|
4126
|
+
h(e), f?.(e), g(e);
|
|
3985
4127
|
}
|
|
3986
4128
|
},
|
|
3987
4129
|
children: /* @__PURE__ */ d("div", { className: (() => {
|
|
3988
4130
|
switch (t) {
|
|
3989
|
-
case p.Right: return a ? "daga-horizontal-none" :
|
|
3990
|
-
case p.Bottom: return a ? "daga-vertical-none" :
|
|
3991
|
-
case p.Left: return a ? "daga-horizontal-none" :
|
|
3992
|
-
case p.Top: return a ? "daga-vertical-none" :
|
|
4131
|
+
case p.Right: return a ? "daga-horizontal-none" : m ? "daga-horizontal-right" : "daga-horizontal-left";
|
|
4132
|
+
case p.Bottom: return a ? "daga-vertical-none" : m ? "daga-vertical-down" : "daga-vertical-up";
|
|
4133
|
+
case p.Left: return a ? "daga-horizontal-none" : m ? "daga-horizontal-left" : "daga-horizontal-right";
|
|
4134
|
+
case p.Top: return a ? "daga-vertical-none" : m ? "daga-vertical-up" : "daga-vertical-down";
|
|
3993
4135
|
}
|
|
3994
4136
|
})() })
|
|
3995
4137
|
}) });
|
|
3996
|
-
},
|
|
3997
|
-
let e = o(
|
|
4138
|
+
}, kn = () => {
|
|
4139
|
+
let e = o(En), t = c(null), [n, a] = l([]);
|
|
3998
4140
|
i(e.validatorChange$, e.diagramChange$).pipe(r(() => s())).subscribe();
|
|
3999
4141
|
let s = () => {
|
|
4000
4142
|
a([]);
|
|
@@ -4021,7 +4163,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4021
4163
|
className: "daga-errors-summary daga-with-errors daga-prevent-user-select",
|
|
4022
4164
|
children: [/* @__PURE__ */ f("span", { children: [n.length, " errors found"] }), /* @__PURE__ */ d("div", {
|
|
4023
4165
|
className: "daga-collapse-button-container",
|
|
4024
|
-
children: /* @__PURE__ */ d(
|
|
4166
|
+
children: /* @__PURE__ */ d(On, {
|
|
4025
4167
|
collapsableSelector: t,
|
|
4026
4168
|
collapsableAdditionalSelector: ".daga-error-panel",
|
|
4027
4169
|
direction: p.Top,
|
|
@@ -4042,7 +4184,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4042
4184
|
})
|
|
4043
4185
|
]
|
|
4044
4186
|
}) });
|
|
4045
|
-
},
|
|
4187
|
+
}, An = 200, jn = (e) => (e || "").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""), Mn = ({ disabled: e, options: t, value: n, onChange: r }) => {
|
|
4046
4188
|
let i = c(null), [a, o] = l(""), [u, p] = l(void 0), [m, h] = l([]), [g, _] = l([]), [v, y] = l([]), [b, x] = l([]), [ee, S] = l(!1);
|
|
4047
4189
|
s(() => {
|
|
4048
4190
|
o(t.find((e) => Ae(e.key, n))?.label || "");
|
|
@@ -4050,31 +4192,31 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4050
4192
|
let w = (n) => {
|
|
4051
4193
|
if (!e) switch (n.key) {
|
|
4052
4194
|
case C.PageDown:
|
|
4053
|
-
u === void 0 ? (D(0),
|
|
4195
|
+
u === void 0 ? (D(0), O(0)) : (D(u + 5), O(u)), n.preventDefault();
|
|
4054
4196
|
break;
|
|
4055
4197
|
case C.ArrowDown:
|
|
4056
|
-
u === void 0 ? (D(0),
|
|
4198
|
+
u === void 0 ? (D(0), O(0)) : (D(u + 1), O(u)), n.preventDefault();
|
|
4057
4199
|
break;
|
|
4058
4200
|
case C.PageUp:
|
|
4059
|
-
u === void 0 ? (D(t.length - 1),
|
|
4201
|
+
u === void 0 ? (D(t.length - 1), O(t.length - 1)) : (D(u - 5), O(u)), n.preventDefault();
|
|
4060
4202
|
break;
|
|
4061
4203
|
case C.ArrowUp:
|
|
4062
|
-
u === void 0 ? (D(t.length - 1),
|
|
4204
|
+
u === void 0 ? (D(t.length - 1), O(t.length - 1)) : (D(u - 1), O(u)), n.preventDefault();
|
|
4063
4205
|
break;
|
|
4064
4206
|
case C.Escape:
|
|
4065
4207
|
E(), n.preventDefault();
|
|
4066
4208
|
break;
|
|
4067
4209
|
case C.Enter:
|
|
4068
|
-
|
|
4210
|
+
re(t[u || 0]), n.preventDefault();
|
|
4069
4211
|
break;
|
|
4070
4212
|
default: T();
|
|
4071
4213
|
}
|
|
4072
4214
|
}, T = () => {
|
|
4073
4215
|
if (!e) {
|
|
4074
|
-
let e =
|
|
4216
|
+
let e = jn(a.trim());
|
|
4075
4217
|
h([]), _([]), y([]), x([]);
|
|
4076
4218
|
for (let n of t) {
|
|
4077
|
-
let t =
|
|
4219
|
+
let t = jn(n.label).indexOf(e);
|
|
4078
4220
|
if (t >= 0) {
|
|
4079
4221
|
let r = n.label.substring(0, t), i = n.label.substring(t, t + e.length), a = n.label.substring(t + e.length);
|
|
4080
4222
|
h((e) => [...e, n]), _((e) => [...e, r]), y((e) => [...e, i]), x((e) => [...e, a]);
|
|
@@ -4096,13 +4238,13 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4096
4238
|
}, te = () => {
|
|
4097
4239
|
setTimeout(() => {
|
|
4098
4240
|
E();
|
|
4099
|
-
},
|
|
4100
|
-
},
|
|
4241
|
+
}, An);
|
|
4242
|
+
}, O = (e) => {
|
|
4101
4243
|
let t = i.current?.querySelectorAll("li")[e];
|
|
4102
4244
|
t && t.scrollIntoView({ block: "center" });
|
|
4103
|
-
},
|
|
4245
|
+
}, ne = () => {
|
|
4104
4246
|
e || (o(""), S(!1), p(void 0));
|
|
4105
|
-
},
|
|
4247
|
+
}, re = (t) => {
|
|
4106
4248
|
e || (o(t.label), S(!1), p(void 0), r(t.key));
|
|
4107
4249
|
};
|
|
4108
4250
|
return /* @__PURE__ */ f("div", {
|
|
@@ -4119,7 +4261,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4119
4261
|
onChange: (e) => o(e.target.value)
|
|
4120
4262
|
}), a !== "" && /* @__PURE__ */ d("button", {
|
|
4121
4263
|
className: "daga-clear",
|
|
4122
|
-
onClick:
|
|
4264
|
+
onClick: ne
|
|
4123
4265
|
})]
|
|
4124
4266
|
}), /* @__PURE__ */ d("div", {
|
|
4125
4267
|
className: "daga-autocomplete-options",
|
|
@@ -4131,7 +4273,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4131
4273
|
}), m.map((e, t) => /* @__PURE__ */ f("li", {
|
|
4132
4274
|
className: `daga-autocomplete-option ${t === u ? "daga-focused" : ""}`,
|
|
4133
4275
|
onMouseMove: () => D(t),
|
|
4134
|
-
onClick: () =>
|
|
4276
|
+
onClick: () => re(e),
|
|
4135
4277
|
children: [
|
|
4136
4278
|
/* @__PURE__ */ d("span", { children: g[t] }),
|
|
4137
4279
|
/* @__PURE__ */ d("span", {
|
|
@@ -4144,7 +4286,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4144
4286
|
})
|
|
4145
4287
|
})]
|
|
4146
4288
|
});
|
|
4147
|
-
},
|
|
4289
|
+
}, Nn = (e, t) => e.find((e) => e.key === t)?.label || `${t}`, Pn = ({ disabled: e, allowRepeats: t, options: n, value: r, onChange: i }) => {
|
|
4148
4290
|
let [a, o] = l(), [c, u] = l([]), [p, m] = l([]), h = (e) => {
|
|
4149
4291
|
for (let t of r) if (t === e) return !0;
|
|
4150
4292
|
return !1;
|
|
@@ -4157,7 +4299,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4157
4299
|
};
|
|
4158
4300
|
s(() => {
|
|
4159
4301
|
let e = r.length === 0;
|
|
4160
|
-
u(r.map((e) =>
|
|
4302
|
+
u(r.map((e) => Nn(n, e))), e && i(r), g();
|
|
4161
4303
|
}, [r, n]);
|
|
4162
4304
|
let _ = (e) => {
|
|
4163
4305
|
r.length > e && (r.splice(e, 1), u(c.filter((t, n) => n !== e)), i(r), g());
|
|
@@ -4180,7 +4322,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4180
4322
|
className: "daga-value-item-input",
|
|
4181
4323
|
children: [/* @__PURE__ */ d("div", {
|
|
4182
4324
|
className: "daga-input daga-relatively-positioned",
|
|
4183
|
-
children: /* @__PURE__ */ d(
|
|
4325
|
+
children: /* @__PURE__ */ d(Mn, {
|
|
4184
4326
|
disabled: e,
|
|
4185
4327
|
options: t ? n || [] : p || [],
|
|
4186
4328
|
value: a,
|
|
@@ -4192,7 +4334,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4192
4334
|
children: /* @__PURE__ */ d("div", { className: "daga-icon daga-add-icon" })
|
|
4193
4335
|
})]
|
|
4194
4336
|
})] });
|
|
4195
|
-
},
|
|
4337
|
+
}, Fn = ({ disabled: e, allowRepeats: t, value: n, onChange: r }) => {
|
|
4196
4338
|
let [i, a] = l(""), o = (e) => {
|
|
4197
4339
|
for (let t of e || []) if (t === e) return !0;
|
|
4198
4340
|
return !1;
|
|
@@ -4240,7 +4382,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4240
4382
|
children: /* @__PURE__ */ d("div", { className: "daga-icon daga-add-icon" })
|
|
4241
4383
|
})]
|
|
4242
4384
|
})] });
|
|
4243
|
-
},
|
|
4385
|
+
}, In = ({ disabled: e, value: t, onChange: n }) => {
|
|
4244
4386
|
let [r, i] = l(""), [a, o] = l(""), [s, c] = l({}), u = (e) => {
|
|
4245
4387
|
let r = {};
|
|
4246
4388
|
Object.keys(t).forEach((n) => {
|
|
@@ -4348,8 +4490,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4348
4490
|
})
|
|
4349
4491
|
]
|
|
4350
4492
|
})] });
|
|
4351
|
-
},
|
|
4352
|
-
let r = o(
|
|
4493
|
+
}, Ln = ({ valueSet: e, onValueChange: t, depth: n }) => {
|
|
4494
|
+
let r = o(En).canUserPerformAction(K.UpdateValues) && e?.rootElement?.removed !== !0, i = (e) => "daga-property-name-" + e.replace(/\s/g, ""), a = (e) => {
|
|
4353
4495
|
if (typeof e == "string") return e;
|
|
4354
4496
|
if (e == null || isNaN(e.valueOf())) return "";
|
|
4355
4497
|
let t = new Date(e), n = t.getTimezoneOffset();
|
|
@@ -4436,34 +4578,34 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4436
4578
|
}),
|
|
4437
4579
|
o.type === P.Option && /* @__PURE__ */ d("div", {
|
|
4438
4580
|
className: "daga-relatively-positioned",
|
|
4439
|
-
children: /* @__PURE__ */ d(
|
|
4581
|
+
children: /* @__PURE__ */ d(Mn, {
|
|
4440
4582
|
disabled: o.editable === !1 || !r,
|
|
4441
4583
|
options: o.options || [],
|
|
4442
4584
|
value: e?.getValue(o.name),
|
|
4443
4585
|
onChange: (n) => t(e, o, n)
|
|
4444
4586
|
})
|
|
4445
4587
|
}),
|
|
4446
|
-
(o.type === P.OptionList || o.type === P.OptionSet) && /* @__PURE__ */ d(
|
|
4588
|
+
(o.type === P.OptionList || o.type === P.OptionSet) && /* @__PURE__ */ d(Pn, {
|
|
4447
4589
|
disabled: o.editable === !1 || !r,
|
|
4448
4590
|
allowRepeats: o.type === P.OptionList,
|
|
4449
4591
|
options: o.options || [],
|
|
4450
4592
|
value: e?.getValue(o.name),
|
|
4451
4593
|
onChange: (n) => t(e, o, n)
|
|
4452
4594
|
}),
|
|
4453
|
-
(o.type === P.TextList || o.type === P.TextSet) && /* @__PURE__ */ d(
|
|
4595
|
+
(o.type === P.TextList || o.type === P.TextSet) && /* @__PURE__ */ d(Fn, {
|
|
4454
4596
|
disabled: o.editable === !1 || !r,
|
|
4455
4597
|
allowRepeats: o.type === P.TextList,
|
|
4456
4598
|
value: e?.getValue(o.name),
|
|
4457
4599
|
onChange: (n) => t(e, o, n)
|
|
4458
4600
|
}),
|
|
4459
|
-
o.type === P.TextMap && /* @__PURE__ */ d(
|
|
4601
|
+
o.type === P.TextMap && /* @__PURE__ */ d(In, {
|
|
4460
4602
|
disabled: o.editable === !1 || !r,
|
|
4461
4603
|
value: e?.getValue(o.name),
|
|
4462
4604
|
onChange: (n) => t(e, o, n)
|
|
4463
4605
|
}),
|
|
4464
4606
|
o.type === P.Object && /* @__PURE__ */ d("div", {
|
|
4465
4607
|
className: "daga-left-bar",
|
|
4466
|
-
children: /* @__PURE__ */ d(
|
|
4608
|
+
children: /* @__PURE__ */ d(Ln, {
|
|
4467
4609
|
valueSet: e.getSubValueSet(o.name),
|
|
4468
4610
|
onValueChange: t,
|
|
4469
4611
|
depth: n + 1
|
|
@@ -4471,22 +4613,22 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4471
4613
|
})
|
|
4472
4614
|
]
|
|
4473
4615
|
}, o.name)) });
|
|
4474
|
-
},
|
|
4475
|
-
let r = o(
|
|
4616
|
+
}, Rn = ({ valueSet: t, depth: n }) => {
|
|
4617
|
+
let r = o(En), i = c(null), a = (e) => "daga-property-name-" + e.replace(/\s/g, ""), s = () => {
|
|
4476
4618
|
for (let o of t?.displayedProperties || []) {
|
|
4477
4619
|
let s = 0, c = 0, u = 0, d = e.select(i.current).select(`.daga-property.${a(o.name)}.daga-depth-${n}`);
|
|
4478
4620
|
d.select("button.daga-move-button").call(e.drag().on(w.Start, (e) => {
|
|
4479
|
-
|
|
4621
|
+
X(A.Grabbing);
|
|
4480
4622
|
let t = r.getPointerLocationRelativeToScreen(e);
|
|
4481
4623
|
if (t.length < 2 || isNaN(t[0]) || isNaN(t[1])) return;
|
|
4482
4624
|
let n = d.node()?.getBoundingClientRect();
|
|
4483
4625
|
s = n?.width || 0, c = n?.height || 0, d.style("position", "fixed").style("left", `${t[0] - s / 2}px`).style("top", `${t[1] - c / 2}px`).style("width", `${s}px`).style("height", `${c}px`).style("z-index", 1);
|
|
4484
4626
|
}).on(w.Drag, (t) => {
|
|
4485
|
-
|
|
4627
|
+
X(A.Grabbing);
|
|
4486
4628
|
let a = r.getPointerLocationRelativeToScreen(t);
|
|
4487
4629
|
a.length < 2 || isNaN(a[0]) || isNaN(a[1]) || (d.style("position", "fixed").style("left", `${a[0] - s / 2}px`).style("top", `${a[1] - c / 2}px`).style("width", `${s}px`).style("height", `${c}px`).style("z-index", 1), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "hidden").style("height", 0), u = l(a), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "visible").style("height", "0.25rem"));
|
|
4488
4630
|
}).on(w.End, (a) => {
|
|
4489
|
-
|
|
4631
|
+
X(A.Auto), d.style("position", "relative").style("left", 0).style("top", 0).style("z-index", 0).style("width", "unset").style("height", "unset"), e.select(i.current).select(`.daga-dropbar.daga-index-${u}.daga-depth-${n}`).style("visibility", "hidden").style("height", 0);
|
|
4490
4632
|
let s = r.getPointerLocationRelativeToScreen(a);
|
|
4491
4633
|
s.length < 2 || isNaN(s[0]) || isNaN(s[1]) || (u = l(s), t?.displayedProperties?.splice(t.displayedProperties.indexOf(o), 1), t?.displayedProperties?.splice(u, 0, o));
|
|
4492
4634
|
}));
|
|
@@ -4530,9 +4672,9 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4530
4672
|
}),
|
|
4531
4673
|
e.type !== P.Object && /* @__PURE__ */ d("div", {
|
|
4532
4674
|
className: "daga-property-value",
|
|
4533
|
-
children:
|
|
4675
|
+
children: zn(t?.getValue(e.name))
|
|
4534
4676
|
}),
|
|
4535
|
-
e.type === P.Object && /* @__PURE__ */ d(
|
|
4677
|
+
e.type === P.Object && /* @__PURE__ */ d(Rn, {
|
|
4536
4678
|
valueSet: t?.getSubValueSet(e.name),
|
|
4537
4679
|
depth: n + 1
|
|
4538
4680
|
})
|
|
@@ -4540,61 +4682,61 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4540
4682
|
}), /* @__PURE__ */ d("div", { className: `daga-dropbar daga-index-${r + 1} daga-depth-${n}` })]
|
|
4541
4683
|
}, e.name))]
|
|
4542
4684
|
});
|
|
4543
|
-
},
|
|
4544
|
-
let
|
|
4685
|
+
}, zn = (e) => Array.isArray(e) ? e.join(", ") : Me(e) ? Object.entries(e).map((e) => e.map((e) => JSON.stringify(e)).join(": ")).join(", ") : e instanceof Date ? e.toLocaleString() : e == null ? "" : "" + e, Bn = ({ collapsed: t, location: n, direction: r, width: i, length: a, title: o, valueSet: u, onValueChange: m }) => {
|
|
4686
|
+
let h = c(null), [g, _] = l(t), [v, y] = l(!1), b = () => e.select(h.current);
|
|
4545
4687
|
return s(() => {
|
|
4546
|
-
if (
|
|
4688
|
+
if (h.current) switch (r) {
|
|
4547
4689
|
case p.Bottom:
|
|
4548
4690
|
case p.Top:
|
|
4549
|
-
|
|
4691
|
+
b().style("width", i).select(".daga-panel-content").style("height", a);
|
|
4550
4692
|
break;
|
|
4551
4693
|
case p.Left:
|
|
4552
4694
|
case p.Right:
|
|
4553
|
-
|
|
4695
|
+
b().style("height", i).select(".daga-panel-content").style("width", a);
|
|
4554
4696
|
break;
|
|
4555
4697
|
}
|
|
4556
4698
|
}, [
|
|
4557
|
-
r,
|
|
4558
4699
|
i,
|
|
4559
|
-
|
|
4700
|
+
a,
|
|
4701
|
+
r
|
|
4560
4702
|
]), /* @__PURE__ */ d("daga-property-editor", { children: /* @__PURE__ */ f("div", {
|
|
4561
|
-
ref:
|
|
4562
|
-
className: `daga-panel daga-bottom daga-${
|
|
4563
|
-
children: [/* @__PURE__ */ d(
|
|
4564
|
-
disabled: !
|
|
4565
|
-
collapsed:
|
|
4566
|
-
direction:
|
|
4567
|
-
collapsableSelector:
|
|
4703
|
+
ref: h,
|
|
4704
|
+
className: `daga-panel daga-bottom daga-${n} daga-${r}`,
|
|
4705
|
+
children: [/* @__PURE__ */ d(On, {
|
|
4706
|
+
disabled: !u || !u.propertySet || !u.propertySet.hasProperties(),
|
|
4707
|
+
collapsed: g,
|
|
4708
|
+
direction: r,
|
|
4709
|
+
collapsableSelector: h,
|
|
4568
4710
|
collapsableAdditionalSelector: ".daga-panel-content",
|
|
4569
4711
|
rule: "display",
|
|
4570
4712
|
collapsedValue: "none",
|
|
4571
4713
|
visibleValue: "block",
|
|
4572
|
-
onCollapse:
|
|
4714
|
+
onCollapse: _
|
|
4573
4715
|
}), /* @__PURE__ */ d("div", {
|
|
4574
4716
|
className: "daga-panel-content",
|
|
4575
|
-
children:
|
|
4576
|
-
|
|
4717
|
+
children: u && u.propertySet && u.propertySet.hasProperties() && !g && /* @__PURE__ */ f("div", { children: [
|
|
4718
|
+
o && /* @__PURE__ */ f("p", {
|
|
4577
4719
|
className: "daga-title",
|
|
4578
|
-
children: [
|
|
4720
|
+
children: [o, /* @__PURE__ */ d("button", {
|
|
4579
4721
|
className: "daga-property-button",
|
|
4580
|
-
onClick: () =>
|
|
4581
|
-
children: /* @__PURE__ */ d("div", { className: `daga-icon daga-settings-icon ${
|
|
4722
|
+
onClick: () => y(!v),
|
|
4723
|
+
children: /* @__PURE__ */ d("div", { className: `daga-icon daga-settings-icon ${v ? "daga-unrotate" : "daga-rotate"}` })
|
|
4582
4724
|
})]
|
|
4583
4725
|
}),
|
|
4584
|
-
!
|
|
4585
|
-
valueSet:
|
|
4586
|
-
onValueChange:
|
|
4726
|
+
!v && /* @__PURE__ */ d(Ln, {
|
|
4727
|
+
valueSet: u,
|
|
4728
|
+
onValueChange: m,
|
|
4587
4729
|
depth: 0
|
|
4588
4730
|
}),
|
|
4589
|
-
|
|
4590
|
-
valueSet:
|
|
4731
|
+
v && /* @__PURE__ */ d(Rn, {
|
|
4732
|
+
valueSet: u,
|
|
4591
4733
|
depth: 0
|
|
4592
4734
|
})
|
|
4593
4735
|
] })
|
|
4594
4736
|
})]
|
|
4595
4737
|
}) });
|
|
4596
|
-
},
|
|
4597
|
-
let n = o(
|
|
4738
|
+
}, Vn = 6, Hn = (t) => {
|
|
4739
|
+
let n = o(En), [r, i] = l(t.currentPalette || t.palettes[0]), [a, u] = l(0), [m, h] = l(void 0), g = c(null), _ = c(!1), v = (e) => {
|
|
4598
4740
|
if (i(e), y().selectAll("*").remove(), u(n.getPriorityThreshold() || 0), e.categories && b(e.categories), e.templates) for (let t of e.templates) x(t);
|
|
4599
4741
|
}, y = () => e.select(g.current).select(".daga-palette-view"), b = (e) => {
|
|
4600
4742
|
let t = y().append("select").style("width", "100%").style("height", "2rem").style("padding", "0.5rem").style("border-radius", "0.25rem").style("background-color", "#f7f8fc").style("border", "1px solid #e6e6e6");
|
|
@@ -4618,21 +4760,21 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4618
4760
|
}, ee = (t, r, i) => {
|
|
4619
4761
|
if (a !== void 0 && t.priority < a) return;
|
|
4620
4762
|
let o = t.defaultLook.lookType === "shaped-look" ? t.defaultLook.borderThickness || 1 : 0, s = t.defaultHeight + o, c = t.defaultWidth + o, l = r.height || s, u = r.width || c, d = y().append("div").attr("class", `daga-template-container ${i === void 0 ? "" : i}`).style("width", `${u}px`).style("height", `${l}px`).call(e.drag().on(w.Drag, (e) => {
|
|
4621
|
-
if (n.canUserPerformAction(
|
|
4763
|
+
if (n.canUserPerformAction(K.AddNode)) {
|
|
4622
4764
|
let t = n.getPointerLocationRelativeToScreen(e);
|
|
4623
4765
|
if (t.length < 2 || isNaN(t[0]) || isNaN(t[1])) return;
|
|
4624
4766
|
d.style("position", "fixed").style("left", `${t[0] - u / 2}px`).style("top", `${t[1] - l / 2}px`).style("z-index", 1);
|
|
4625
4767
|
}
|
|
4626
4768
|
}).on(w.Start, (e) => {
|
|
4627
|
-
if (n.canUserPerformAction(
|
|
4628
|
-
|
|
4769
|
+
if (n.canUserPerformAction(K.AddNode)) {
|
|
4770
|
+
X(A.Grabbing);
|
|
4629
4771
|
let r = n.getPointerLocationRelativeToScreen(e);
|
|
4630
4772
|
if (r.length < 2 || isNaN(r[0]) || isNaN(r[1])) return;
|
|
4631
|
-
d.style("position", "fixed").style("left", `${r[0] - u / 2}px`).style("top", `${r[1] - l / 2}px`).style("z-index", 1), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0 &&
|
|
4773
|
+
d.style("position", "fixed").style("left", `${r[0] - u / 2}px`).style("top", `${r[1] - l / 2}px`).style("z-index", 1), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0 && X(A.NotAllowed);
|
|
4632
4774
|
}
|
|
4633
4775
|
}).on(w.End, (e) => {
|
|
4634
|
-
if (n.canUserPerformAction(
|
|
4635
|
-
if (
|
|
4776
|
+
if (n.canUserPerformAction(K.AddNode)) {
|
|
4777
|
+
if (X(A.Auto), d.style("position", "relative").style("left", 0).style("top", 0).style("z-index", "auto"), t.isUnique && n.model.nodes.find((e) => !e.removed && e.type.id === t.id) !== void 0) return;
|
|
4636
4778
|
let i = n.getPointerLocationRelativeToScreen(e);
|
|
4637
4779
|
if (i.length < 2 || isNaN(i[0]) || isNaN(i[1])) return;
|
|
4638
4780
|
let a = document.elementFromPoint(i[0], i[1]);
|
|
@@ -4640,16 +4782,16 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4640
4782
|
let o = n.getPointerLocationRelativeToCanvas(e);
|
|
4641
4783
|
if (o.length < 2 || isNaN(o[0]) || isNaN(o[1])) return;
|
|
4642
4784
|
let s = [o[0] - t.defaultWidth / 2, o[1] - t.defaultHeight / 2];
|
|
4643
|
-
n.
|
|
4785
|
+
n.gridConfig.snap && (s = n.getClosestGridPoint([s[0] - t.snapToGridOffset[0], s[1] - t.snapToGridOffset[1]]), s[0] += t.snapToGridOffset[0], s[1] += t.snapToGridOffset[1]);
|
|
4644
4786
|
let c = Ye(n.model.nodes.getAtCoordinates(o[0], o[1]).filter((e) => e.type.childrenTypes.includes(t.id))), l = c[c.length - 1];
|
|
4645
4787
|
if (!t.canBeParentless && l === void 0) return;
|
|
4646
|
-
let u = l?.getLastAncestor(), f = new
|
|
4647
|
-
f.do(), n?.actionStack.add(f),
|
|
4788
|
+
let u = l?.getLastAncestor(), f = new Ct(n, t, s, l?.id, u?.id, u?.getGeometry(), void 0, r.label, r.values);
|
|
4789
|
+
f.do(), n?.actionStack.add(f), X();
|
|
4648
4790
|
}
|
|
4649
4791
|
})).append("svg").attr("class", `palette-node ${t.id}`).attr("viewBox", `0 0 ${c} ${s}`).attr("preserveAspectRatio", "none").style("position", "relative").style("left", 0).style("top", 0).style("width", `${u}px`).style("height", `${l}px`), f = r.look || t.defaultLook;
|
|
4650
4792
|
switch (f.lookType) {
|
|
4651
4793
|
case "shaped-look":
|
|
4652
|
-
d.append("path").attr("d", ae(f.shape ||
|
|
4794
|
+
d.append("path").attr("d", ae(f.shape || ie.Rectangle, (f.borderThickness || 1) / 2, (f.borderThickness || 1) / 2, t.defaultWidth, t.defaultHeight)).attr("fill", f.fillColor || "#FFFFFF").attr("stroke", f.borderColor || "#000000").attr("stroke-width", `${f.borderThickness}px`);
|
|
4653
4795
|
break;
|
|
4654
4796
|
case "image-look":
|
|
4655
4797
|
d.append("image").attr("x", 0).attr("y", 0).attr("width", t.defaultWidth).attr("height", t.defaultHeight).attr("href", f.backgroundImage).attr("preserveAspectRatio", "none");
|
|
@@ -4657,21 +4799,24 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4657
4799
|
case "stretchable-image-look": d.append("image").attr("x", 0).attr("y", 0).attr("width", f.leftMargin).attr("height", f.topMargin).attr("href", f.backgroundImageTopLeft).attr("preserveAspectRatio", "none"), d.append("image").attr("x", f.leftMargin).attr("y", 0).attr("width", t.defaultWidth - f.rightMargin - f.leftMargin).attr("height", f.topMargin).attr("href", f.backgroundImageTop).attr("preserveAspectRatio", "none"), d.append("image").attr("x", t.defaultWidth - f.rightMargin).attr("y", 0).attr("width", f.rightMargin).attr("height", f.topMargin).attr("href", f.backgroundImageTopRight).attr("preserveAspectRatio", "none"), d.append("image").attr("x", 0).attr("y", f.topMargin).attr("width", f.leftMargin).attr("height", t.defaultHeight - f.bottomMargin - f.topMargin).attr("href", f.backgroundImageLeft).attr("preserveAspectRatio", "none"), d.append("image").attr("x", f.leftMargin).attr("y", f.topMargin).attr("width", t.defaultWidth - f.rightMargin - f.leftMargin).attr("height", t.defaultHeight - f.bottomMargin - f.topMargin).attr("href", f.backgroundImageCenter).attr("preserveAspectRatio", "none"), d.append("image").attr("x", t.defaultWidth - f.rightMargin).attr("y", f.topMargin).attr("width", f.rightMargin).attr("height", t.defaultHeight - f.bottomMargin - f.topMargin).attr("href", f.backgroundImageRight).attr("preserveAspectRatio", "none"), d.append("image").attr("x", 0).attr("y", t.defaultHeight - f.bottomMargin).attr("width", f.leftMargin).attr("height", f.bottomMargin).attr("href", f.backgroundImageBottomLeft).attr("preserveAspectRatio", "none"), d.append("image").attr("x", f.leftMargin).attr("y", t.defaultHeight - f.bottomMargin).attr("width", t.defaultWidth - f.rightMargin - f.leftMargin).attr("height", f.bottomMargin).attr("href", f.backgroundImageBottom).attr("preserveAspectRatio", "none"), d.append("image").attr("x", t.defaultWidth - f.rightMargin).attr("y", t.defaultHeight - f.bottomMargin).attr("width", f.rightMargin).attr("height", f.bottomMargin).attr("href", f.backgroundImageBottomRight).attr("preserveAspectRatio", "none");
|
|
4658
4800
|
}
|
|
4659
4801
|
if (r.look === void 0) {
|
|
4660
|
-
if (t.decorators) for (let e of t.decorators) d.append("foreignObject").attr("width", `${e.width}px`).attr("height", `${e.height}px`).attr("transform", `translate(${e.coords[0]},${e.coords[1]})`).html(e.
|
|
4802
|
+
if (t.decorators) for (let e of t.decorators) d.append("foreignObject").attr("width", `${e.width}px`).attr("height", `${e.height}px`).attr("transform", `translate(${e.coords[0]},${e.coords[1]})`).html(e.svg);
|
|
4661
4803
|
if (r.label) {
|
|
4662
4804
|
let e = {
|
|
4663
4805
|
...L,
|
|
4664
4806
|
...t.label,
|
|
4665
4807
|
...r.labelLook
|
|
4666
4808
|
};
|
|
4667
|
-
|
|
4809
|
+
e.look = {
|
|
4810
|
+
...L.look,
|
|
4811
|
+
...e.look
|
|
4812
|
+
}, d.append("text").attr("transform", `translate(${(z(e) + t.defaultWidth) / 2},${(V(e) + t.defaultHeight) / 2})`).attr("x", 0).attr("y", 0).attr("font-size", `${e.look.fontSize}px`).attr("text-anchor", "middle").attr("font-family", e.look.fontFamily || L.look.fontFamily).attr("font-weight", e.look.fontWeight || L.look.fontWeight).attr("fill", e.look.fontColor || L.look.fontColor).attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(r.label);
|
|
4668
4813
|
}
|
|
4669
4814
|
}
|
|
4670
4815
|
}, C = (e, t, r) => {
|
|
4671
4816
|
let i = y().append("div").attr("class", `daga-template-container ${r === void 0 ? "" : r}`).style("width", `${t.width}px`).style("height", `${t.height}px`).append("svg").attr("class", `palette-button ${e.id}`).style("position", "relative").style("left", 0).style("top", 0).style("width", "100%").style("height", "100%").on("click", () => {
|
|
4672
4817
|
n.connectionType = e;
|
|
4673
4818
|
});
|
|
4674
|
-
i.append("path").attr("d", ae(
|
|
4819
|
+
i.append("path").attr("d", ae(ie.Rectangle, 0, 0, t.width, t.height)).attr("fill", t.backgroundColor).attr("stroke", "black").attr("stroke-width", "1px"), t.icon !== "" && i.append("image").attr("x", 0).attr("y", 0).attr("width", t.width).attr("height", t.height).attr("href", t.icon), t.label !== "" && i.append("text").attr("transform", `translate(${t.width / 2},${t.height / 2 + Vn})`).attr("x", 0).attr("y", 0).attr("font-size", "20px").attr("text-anchor", "middle").attr("font-family", "'Wonder Unit Sans', sans-serif").attr("font-weight", 400).attr("fill", "#000000").attr("stroke", "none").style("font-kerning", "none").style("user-select", "none").text(t.label);
|
|
4675
4820
|
};
|
|
4676
4821
|
return s(() => {
|
|
4677
4822
|
t.palettes.length > 0 && !_.current && (_.current = !0, v(t.palettes[0]));
|
|
@@ -4679,28 +4824,28 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4679
4824
|
if (g.current) switch (t.direction) {
|
|
4680
4825
|
case p.Bottom:
|
|
4681
4826
|
case p.Top:
|
|
4682
|
-
g.current.style.width = t.width,
|
|
4827
|
+
g.current.style.width = t.width, g.current.style.height = t.length;
|
|
4683
4828
|
break;
|
|
4684
4829
|
case p.Left:
|
|
4685
4830
|
case p.Right:
|
|
4686
|
-
g.current.style.height = t.width,
|
|
4831
|
+
g.current.style.height = t.width, g.current.style.width = t.length;
|
|
4687
4832
|
break;
|
|
4688
4833
|
}
|
|
4689
4834
|
}, [
|
|
4690
4835
|
t.direction,
|
|
4691
4836
|
t.width,
|
|
4692
|
-
t.
|
|
4837
|
+
t.length
|
|
4693
4838
|
]), /* @__PURE__ */ d("daga-palette", { children: /* @__PURE__ */ f("div", {
|
|
4694
4839
|
ref: g,
|
|
4695
4840
|
className: `daga-panel daga-${t.location} daga-${t.direction}`,
|
|
4696
|
-
children: [/* @__PURE__ */ d(
|
|
4841
|
+
children: [/* @__PURE__ */ d(On, {
|
|
4697
4842
|
direction: t.direction,
|
|
4698
4843
|
collapsableSelector: g,
|
|
4699
4844
|
collapsableAdditionalSelector: ".daga-panel-content",
|
|
4700
4845
|
rule: "display",
|
|
4701
4846
|
collapsedValue: "none",
|
|
4702
4847
|
visibleValue: "block",
|
|
4703
|
-
collapsed:
|
|
4848
|
+
collapsed: t.collapsed,
|
|
4704
4849
|
disabled: !1
|
|
4705
4850
|
}), /* @__PURE__ */ f("div", {
|
|
4706
4851
|
className: "daga-panel-content",
|
|
@@ -4714,7 +4859,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4714
4859
|
}), /* @__PURE__ */ d("div", { className: "daga-palette-view" })]
|
|
4715
4860
|
})]
|
|
4716
4861
|
}) });
|
|
4717
|
-
},
|
|
4862
|
+
}, Un = ({ location: t, direction: n, centerAnimationDuration: r, enableAction: i, enableFilter: a, enableLayout: l, enableSelection: u, enableZoom: m }) => {
|
|
4718
4863
|
let h = !1, g = !0, _ = !1, v, y, b, x;
|
|
4719
4864
|
switch (n) {
|
|
4720
4865
|
case p.Bottom:
|
|
@@ -4745,11 +4890,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4745
4890
|
} else g = !0, t.transition().duration(500).ease(e.easeLinear).style(v, "0rem").style("transform", `${y}(0)`), setTimeout(() => {
|
|
4746
4891
|
_ = !1;
|
|
4747
4892
|
}, 500);
|
|
4748
|
-
}, T = o(
|
|
4893
|
+
}, T = o(En);
|
|
4749
4894
|
return /* @__PURE__ */ d("daga-diagram-buttons", { children: /* @__PURE__ */ f("div", {
|
|
4750
4895
|
className: `daga-diagram-buttons daga-${t} daga-${n}`,
|
|
4751
4896
|
children: [
|
|
4752
|
-
m && T.canUserPerformAction(
|
|
4897
|
+
m && T.canUserPerformAction(K.Zoom) && /* @__PURE__ */ d("button", {
|
|
4753
4898
|
className: "daga-zoom-in",
|
|
4754
4899
|
onClick: () => {
|
|
4755
4900
|
T.zoomBy(T.zoomFactor);
|
|
@@ -4759,7 +4904,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4759
4904
|
children: "Zoom in"
|
|
4760
4905
|
})
|
|
4761
4906
|
}),
|
|
4762
|
-
m && T.canUserPerformAction(
|
|
4907
|
+
m && T.canUserPerformAction(K.Zoom) && /* @__PURE__ */ d("button", {
|
|
4763
4908
|
className: "daga-zoom-out",
|
|
4764
4909
|
onClick: () => {
|
|
4765
4910
|
T.zoomBy(1 / T.zoomFactor);
|
|
@@ -4773,7 +4918,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4773
4918
|
className: "daga-collapsable-buttons daga-collapsed",
|
|
4774
4919
|
ref: ee,
|
|
4775
4920
|
children: [
|
|
4776
|
-
m && T.canUserPerformAction(
|
|
4921
|
+
m && T.canUserPerformAction(K.Zoom) && /* @__PURE__ */ d("button", {
|
|
4777
4922
|
className: "daga-center",
|
|
4778
4923
|
onClick: () => {
|
|
4779
4924
|
T.center(void 0, 1, r);
|
|
@@ -4828,7 +4973,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4828
4973
|
onClick: () => {
|
|
4829
4974
|
T.multipleSelectionOn = !0, e.select(S.current).classed("daga-on", !0).classed("daga-off", !1);
|
|
4830
4975
|
let t = T.diagramEvent$.subscribe((n) => {
|
|
4831
|
-
n.type ===
|
|
4976
|
+
n.type === Mt.Selection && (e.select(S.current).classed("daga-on", !1).classed("daga-off", !0), t.unsubscribe());
|
|
4832
4977
|
});
|
|
4833
4978
|
},
|
|
4834
4979
|
ref: S,
|
|
@@ -4860,7 +5005,7 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4860
5005
|
l && T.layoutFormat && /* @__PURE__ */ d("button", {
|
|
4861
5006
|
className: "daga-layout",
|
|
4862
5007
|
onClick: () => {
|
|
4863
|
-
T.layoutFormat && T.layoutFormat in
|
|
5008
|
+
T.layoutFormat && T.layoutFormat in wn && wn[T.layoutFormat].apply(T.model);
|
|
4864
5009
|
},
|
|
4865
5010
|
children: /* @__PURE__ */ d("span", {
|
|
4866
5011
|
className: "daga-tooltip",
|
|
@@ -4895,8 +5040,8 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4895
5040
|
})
|
|
4896
5041
|
]
|
|
4897
5042
|
}) });
|
|
4898
|
-
},
|
|
4899
|
-
let a = new
|
|
5043
|
+
}, Wn = ({ config: e, model: t, onCanvasCreated: n, onDiagramEvent: r, onModelChange: i }) => {
|
|
5044
|
+
let a = new ut(), o = new on(), u = c(null), h = c(void 0), g = c(!1), _ = [], [v, y] = l(void 0), [b, x] = l(void 0), ee = {
|
|
4900
5045
|
zoomIn: () => {},
|
|
4901
5046
|
zoomOut: () => {},
|
|
4902
5047
|
center: () => {},
|
|
@@ -4904,12 +5049,12 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4904
5049
|
filter: () => {},
|
|
4905
5050
|
undo: () => {},
|
|
4906
5051
|
redo: () => {}
|
|
4907
|
-
}, S = { refreshPalette: () => {} }, C = new
|
|
5052
|
+
}, S = { refreshPalette: () => {} }, C = new Dn((e) => y(e), (e) => x(e)), w = {
|
|
4908
5053
|
diagramButtons: ee,
|
|
4909
5054
|
palette: S,
|
|
4910
5055
|
propertyEditor: C
|
|
4911
5056
|
}, T = (t = !1) => {
|
|
4912
|
-
if ((!h.current || t) && (_.forEach((e) => e.unsubscribe()), h.current = new
|
|
5057
|
+
if ((!h.current || t) && (_.forEach((e) => e.unsubscribe()), h.current = new un(w, e)), !h.current) throw Error("Canvas could not be created");
|
|
4913
5058
|
return h.current;
|
|
4914
5059
|
}, E = T(), D = (e) => {
|
|
4915
5060
|
E.initView(e), _.push(E.diagramEvent$.subscribe((e) => {
|
|
@@ -4925,17 +5070,17 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4925
5070
|
u.current && (T(!0), D(u.current), n?.(E));
|
|
4926
5071
|
}, [e]), s(() => {
|
|
4927
5072
|
t && a.import(E.model, t);
|
|
4928
|
-
}, [t]), /* @__PURE__ */ d("daga-diagram", { children: /* @__PURE__ */ d(
|
|
5073
|
+
}, [t]), /* @__PURE__ */ d("daga-diagram", { children: /* @__PURE__ */ d(Tn.Provider, {
|
|
4929
5074
|
value: e,
|
|
4930
|
-
children: /* @__PURE__ */ d(
|
|
5075
|
+
children: /* @__PURE__ */ d(En.Provider, {
|
|
4931
5076
|
value: E,
|
|
4932
5077
|
children: /* @__PURE__ */ f("daga-diagram-editor", { children: [/* @__PURE__ */ d("div", {
|
|
4933
5078
|
className: "daga-append-to",
|
|
4934
5079
|
ref: u
|
|
4935
|
-
}), /* @__PURE__ */ f(
|
|
5080
|
+
}), /* @__PURE__ */ f(En.Provider, {
|
|
4936
5081
|
value: E,
|
|
4937
5082
|
children: [
|
|
4938
|
-
e.components?.buttons !== void 0 && e.components?.buttons?.enabled !== !1 && /* @__PURE__ */ d(
|
|
5083
|
+
e.components?.buttons !== void 0 && e.components?.buttons?.enabled !== !1 && /* @__PURE__ */ d(Un, {
|
|
4939
5084
|
location: e.components?.buttons?.location || m.BottomRight,
|
|
4940
5085
|
direction: e.components?.buttons?.direction || p.Top,
|
|
4941
5086
|
centerAnimationDuration: e.components?.buttons?.centerAnimationDuration,
|
|
@@ -4945,18 +5090,22 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4945
5090
|
enableSelection: e.components?.buttons?.enableSelection !== !1,
|
|
4946
5091
|
enableZoom: e.components?.buttons?.enableZoom !== !1
|
|
4947
5092
|
}),
|
|
4948
|
-
e.components?.palette !== void 0 && e.components?.palette?.enabled !== !1 && e.components?.palette?.sections && (e.components?.palette?.sections?.length || 0) > 0 && /* @__PURE__ */ d(
|
|
5093
|
+
e.components?.palette !== void 0 && e.components?.palette?.enabled !== !1 && e.components?.palette?.sections && (e.components?.palette?.sections?.length || 0) > 0 && /* @__PURE__ */ d(Hn, {
|
|
5094
|
+
collapsed: e.components?.palette?.open === !1,
|
|
4949
5095
|
location: e.components?.palette?.location || m.TopLeft,
|
|
4950
5096
|
direction: e.components?.palette?.direction || p.Bottom,
|
|
4951
5097
|
width: e.components?.palette?.width || "12rem",
|
|
4952
|
-
|
|
5098
|
+
length: e.components?.palette?.length || "min-content",
|
|
5099
|
+
gap: e.components?.palette?.gap || "1rem",
|
|
5100
|
+
justifyContent: e.components?.palette?.justifyContent || "center",
|
|
4953
5101
|
palettes: e.components?.palette?.sections || []
|
|
4954
5102
|
}),
|
|
4955
|
-
e.components?.propertyEditor !== void 0 && e.components?.propertyEditor?.enabled !== !1 && /* @__PURE__ */ d(
|
|
5103
|
+
e.components?.propertyEditor !== void 0 && e.components?.propertyEditor?.enabled !== !1 && /* @__PURE__ */ d(Bn, {
|
|
5104
|
+
collapsed: e.components?.propertyEditor?.open === !1,
|
|
4956
5105
|
location: e.components?.propertyEditor?.location || m.TopRight,
|
|
4957
5106
|
direction: e.components?.propertyEditor?.direction || p.Bottom,
|
|
4958
5107
|
width: e.components?.propertyEditor?.width || "24rem",
|
|
4959
|
-
|
|
5108
|
+
length: e.components?.propertyEditor?.length || "min-content",
|
|
4960
5109
|
title: v,
|
|
4961
5110
|
valueSet: b,
|
|
4962
5111
|
onValueChange: (e, t, n) => {
|
|
@@ -4967,11 +5116,11 @@ var ke = (e) => e == null || e === "" || e instanceof Array && e.length === 0 ||
|
|
|
4967
5116
|
}
|
|
4968
5117
|
}
|
|
4969
5118
|
}),
|
|
4970
|
-
e.components?.errors !== void 0 && e.components?.errors?.enabled !== !1 && /* @__PURE__ */ d(
|
|
5119
|
+
e.components?.errors !== void 0 && e.components?.errors?.enabled !== !1 && /* @__PURE__ */ d(kn, {})
|
|
4971
5120
|
]
|
|
4972
5121
|
})] })
|
|
4973
5122
|
})
|
|
4974
5123
|
}) });
|
|
4975
5124
|
};
|
|
4976
5125
|
//#endregion
|
|
4977
|
-
export {
|
|
5126
|
+
export { Wn as DagaDiagram };
|