@blueking/flow-canvas 0.0.5 → 0.0.6
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/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +129 -129
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as q, computed as j, onScopeDispose as Je, defineComponent as fe, h as Re, watch as pe, onBeforeUnmount as Me, createElementBlock as R, openBlock as D, normalizeStyle as we, createElementVNode as U, createVNode as et, createCommentVNode as Y, normalizeClass as se, Transition as tt, withCtx as He, withModifiers as rt, createTextVNode as Le, renderSlot as
|
|
1
|
+
import { ref as q, computed as j, onScopeDispose as Je, defineComponent as fe, h as Re, watch as pe, onBeforeUnmount as Me, createElementBlock as R, openBlock as D, normalizeStyle as we, createElementVNode as U, createVNode as et, createCommentVNode as Y, normalizeClass as se, Transition as tt, withCtx as He, withModifiers as rt, createTextVNode as Le, renderSlot as xe, onMounted as ot, createBlock as be, Fragment as me, renderList as Ie, toDisplayString as ge, unref as le, reactive as at, resolveDynamicComponent as lt, Teleport as dt, nextTick as Oe, inject as ct, createApp as ut } from "vue";
|
|
2
2
|
import { Graph as ft } from "@antv/x6";
|
|
3
3
|
import { register as gt } from "@antv/x6-vue-shape";
|
|
4
4
|
import { Selection as pt } from "@antv/x6-plugin-selection";
|
|
@@ -47,9 +47,9 @@ function $e(s, e) {
|
|
|
47
47
|
case "node.update":
|
|
48
48
|
return bt(s, e.nodeId, e.patch);
|
|
49
49
|
case "node.set-payload":
|
|
50
|
-
return xt(s, e.nodeId, e.path, e.value);
|
|
51
|
-
case "node.set-extensions":
|
|
52
50
|
return Et(s, e.nodeId, e.path, e.value);
|
|
51
|
+
case "node.set-extensions":
|
|
52
|
+
return xt(s, e.nodeId, e.path, e.value);
|
|
53
53
|
case "edge.add":
|
|
54
54
|
return It(s, e.edge);
|
|
55
55
|
case "edge.remove":
|
|
@@ -78,7 +78,7 @@ function ke(s, e) {
|
|
|
78
78
|
if (!t) throw new ue(`Edge "${e}" does not exist`);
|
|
79
79
|
return t;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Ee(s, e, t) {
|
|
82
82
|
const o = s.nodes[e.nodeId];
|
|
83
83
|
if (!o)
|
|
84
84
|
throw new ue(`${t} node "${e.nodeId}" does not exist`);
|
|
@@ -111,18 +111,18 @@ function bt(s, e, t) {
|
|
|
111
111
|
const o = Ce(s, e);
|
|
112
112
|
return _e(s, e, { ...o, ...t, id: o.id });
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Et(s, e, t, o) {
|
|
115
115
|
const n = Ce(s, e), i = Ne(n.payload, t, o);
|
|
116
116
|
return _e(s, e, { ...n, payload: i });
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function xt(s, e, t, o) {
|
|
119
119
|
const n = Ce(s, e), i = Ne(n.extensions, t, o);
|
|
120
120
|
return _e(s, e, { ...n, extensions: i });
|
|
121
121
|
}
|
|
122
122
|
function It(s, e) {
|
|
123
123
|
if (s.edges[e.id])
|
|
124
124
|
throw new ue(`Edge id "${e.id}" already exists`);
|
|
125
|
-
if (
|
|
125
|
+
if (Ee(s, e.source, "Source"), Ee(s, e.target, "Target"), e.labels) {
|
|
126
126
|
const t = /* @__PURE__ */ new Set();
|
|
127
127
|
for (const o of e.labels) {
|
|
128
128
|
if (t.has(o.id))
|
|
@@ -139,11 +139,11 @@ function Ct(s, e) {
|
|
|
139
139
|
}
|
|
140
140
|
function kt(s, e, t, o) {
|
|
141
141
|
const n = ke(s, e), i = t ?? n.source, r = o ?? n.target;
|
|
142
|
-
return
|
|
142
|
+
return Ee(s, i, "Source"), Ee(s, r, "Target"), De(s, e, { ...n, source: i, target: r });
|
|
143
143
|
}
|
|
144
144
|
function St(s, e, t) {
|
|
145
145
|
const o = ke(s, e), n = { ...o, ...t, id: o.id };
|
|
146
|
-
return t.source &&
|
|
146
|
+
return t.source && Ee(s, n.source, "Source"), t.target && Ee(s, n.target, "Target"), De(s, e, n);
|
|
147
147
|
}
|
|
148
148
|
function Mt(s, e, t, o) {
|
|
149
149
|
const n = ke(s, e), i = Ne(n.payload, t, o);
|
|
@@ -191,7 +191,7 @@ function Dt(s, e) {
|
|
|
191
191
|
function p() {
|
|
192
192
|
n.length = 0, i.length = 0, a();
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function E() {
|
|
195
195
|
return o.value;
|
|
196
196
|
}
|
|
197
197
|
function m(k) {
|
|
@@ -211,7 +211,7 @@ function Dt(s, e) {
|
|
|
211
211
|
return i.map((k) => k.envelope);
|
|
212
212
|
},
|
|
213
213
|
clear: p,
|
|
214
|
-
createSnapshot:
|
|
214
|
+
createSnapshot: E,
|
|
215
215
|
replaceFlowModel: m
|
|
216
216
|
};
|
|
217
217
|
}
|
|
@@ -390,7 +390,7 @@ function te() {
|
|
|
390
390
|
const Ge = () => te();
|
|
391
391
|
function gn(s) {
|
|
392
392
|
const { schema: e, plugins: t = [], historyOptions: o } = s, n = s.idGenerator ?? Ge, i = { version: "1.0", ...s.initialFlowModel }, r = Dt(i, o), l = q(s.mode ?? "edit"), a = q(!1), h = q(null), u = q([]), g = {}, p = new Pt();
|
|
393
|
-
function
|
|
393
|
+
function E(T, P, G, K = "user:toolbar") {
|
|
394
394
|
const O = {
|
|
395
395
|
id: `history-${Date.now()}`,
|
|
396
396
|
source: K,
|
|
@@ -413,11 +413,11 @@ function gn(s) {
|
|
|
413
413
|
execute: r.execute,
|
|
414
414
|
undo() {
|
|
415
415
|
const T = r.currentFlowModel.value, P = r.undo();
|
|
416
|
-
return P &&
|
|
416
|
+
return P && E("撤销", T, P), P;
|
|
417
417
|
},
|
|
418
418
|
redo() {
|
|
419
419
|
const T = r.currentFlowModel.value, P = r.redo();
|
|
420
|
-
return P &&
|
|
420
|
+
return P && E("重做", T, P), P;
|
|
421
421
|
},
|
|
422
422
|
get canUndo() {
|
|
423
423
|
return r.canUndo;
|
|
@@ -435,7 +435,7 @@ function gn(s) {
|
|
|
435
435
|
createSnapshot: r.createSnapshot,
|
|
436
436
|
replaceFlowModel(T) {
|
|
437
437
|
const P = r.currentFlowModel.value;
|
|
438
|
-
r.replaceFlowModel(T),
|
|
438
|
+
r.replaceFlowModel(T), E("替换 FlowModel", P, T, "system:replace");
|
|
439
439
|
}
|
|
440
440
|
}, k = {
|
|
441
441
|
flowModel: j(() => r.currentFlowModel.value),
|
|
@@ -898,8 +898,8 @@ class $t {
|
|
|
898
898
|
const m = this.graph.isSelected?.(e) ?? !1, k = this.hoveredEdgeId === e.id, S = o.style(t, { selected: m, highlighted: n, hovered: k });
|
|
899
899
|
l = S.stroke, a = S.strokeWidth, h = S.strokeDasharray;
|
|
900
900
|
}
|
|
901
|
-
const u = !o?.style && n ? "#3a84ff" : void 0, g = i?.strokeColor, p = g ?? l ?? u,
|
|
902
|
-
p ? this.setEdgeAttrIfChanged(e, "line/stroke", p) :
|
|
901
|
+
const u = !o?.style && n ? "#3a84ff" : void 0, g = i?.strokeColor, p = g ?? l ?? u, E = !!o?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
|
|
902
|
+
p ? this.setEdgeAttrIfChanged(e, "line/stroke", p) : E && this.restoreEdgeAttr(e, "line/stroke", "stroke"), o?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), h ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", h) : this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray")) : this.prevEdgeStyleIds.has(e.id) && (this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray"), this.prevEdgeStyleIds.delete(e.id)), g ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), u ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
class Bt {
|
|
@@ -1105,7 +1105,7 @@ function zt({
|
|
|
1105
1105
|
resolveNodeShape: u
|
|
1106
1106
|
}) {
|
|
1107
1107
|
const g = r ?? Ge;
|
|
1108
|
-
let p = [],
|
|
1108
|
+
let p = [], E = [], m = null, k = !1, S = null;
|
|
1109
1109
|
async function T() {
|
|
1110
1110
|
if (k) return m;
|
|
1111
1111
|
k = !0;
|
|
@@ -1133,7 +1133,7 @@ function zt({
|
|
|
1133
1133
|
S = null;
|
|
1134
1134
|
const c = f.getPosition();
|
|
1135
1135
|
s.removeNode(f.id);
|
|
1136
|
-
const { _dndSessionId: v, ...b } = d,
|
|
1136
|
+
const { _dndSessionId: v, ...b } = d, x = b.id || g("node");
|
|
1137
1137
|
t({
|
|
1138
1138
|
id: te(),
|
|
1139
1139
|
source: "user:drag",
|
|
@@ -1142,7 +1142,7 @@ function zt({
|
|
|
1142
1142
|
commands: [
|
|
1143
1143
|
{
|
|
1144
1144
|
type: "node.add",
|
|
1145
|
-
node: { ...b, id:
|
|
1145
|
+
node: { ...b, id: x, position: { x: c.x, y: c.y } }
|
|
1146
1146
|
}
|
|
1147
1147
|
]
|
|
1148
1148
|
});
|
|
@@ -1263,13 +1263,13 @@ function zt({
|
|
|
1263
1263
|
const c = async (v) => {
|
|
1264
1264
|
const b = await T();
|
|
1265
1265
|
if (!b) return;
|
|
1266
|
-
const
|
|
1267
|
-
S =
|
|
1266
|
+
const x = te();
|
|
1267
|
+
S = x;
|
|
1268
1268
|
const B = d(), X = u?.(B.type), C = s.createNode({
|
|
1269
1269
|
width: X?.width ?? 154,
|
|
1270
1270
|
height: X?.height ?? 54,
|
|
1271
1271
|
shape: X?.shapeName ?? "rect",
|
|
1272
|
-
data: { ...B, _dndSessionId:
|
|
1272
|
+
data: { ...B, _dndSessionId: x }
|
|
1273
1273
|
});
|
|
1274
1274
|
b.start(C, v);
|
|
1275
1275
|
};
|
|
@@ -1286,9 +1286,9 @@ function zt({
|
|
|
1286
1286
|
if (!c?.isNode()) return;
|
|
1287
1287
|
const v = c, b = s.findViewByCell(v);
|
|
1288
1288
|
if (!b) return;
|
|
1289
|
-
const
|
|
1290
|
-
if (!
|
|
1291
|
-
const X = (
|
|
1289
|
+
const x = b.findPortElem(d, "circle") ?? b.findPortElem(d);
|
|
1290
|
+
if (!x) return;
|
|
1291
|
+
const X = (x.matches?.("[magnet]") ? x : x.querySelector?.("[magnet]")) ?? x, C = X.getBoundingClientRect(), L = C.left + C.width / 2, w = C.top + C.height / 2, A = new MouseEvent("mousedown", {
|
|
1292
1292
|
clientX: L,
|
|
1293
1293
|
clientY: w,
|
|
1294
1294
|
button: 0,
|
|
@@ -1299,10 +1299,10 @@ function zt({
|
|
|
1299
1299
|
X.dispatchEvent(A);
|
|
1300
1300
|
},
|
|
1301
1301
|
async exportAsImage(f) {
|
|
1302
|
-
const { domToBlob: d } = await import("modern-screenshot"), c = f?.padding ?? 20, v = f?.backgroundColor ?? s.options.background?.color ?? "#ffffff", b = s.zoom(),
|
|
1302
|
+
const { domToBlob: d } = await import("modern-screenshot"), c = f?.padding ?? 20, v = f?.backgroundColor ?? s.options.background?.color ?? "#ffffff", b = s.zoom(), x = s.translate(), B = s.getContentBBox(), X = B.width / b, C = B.height / b;
|
|
1303
1303
|
if (X === 0 || C === 0)
|
|
1304
1304
|
return new Blob();
|
|
1305
|
-
const L = (B.x -
|
|
1305
|
+
const L = (B.x - x.tx) / b, w = (B.y - x.ty) / b, A = Math.ceil(X + c * 2), H = Math.ceil(C + c * 2), Z = document.createElement("div");
|
|
1306
1306
|
Z.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
|
|
1307
1307
|
const V = s.container.cloneNode(!0);
|
|
1308
1308
|
V.style.width = `${A}px`, V.style.height = `${H}px`, V.style.overflow = "visible";
|
|
@@ -1330,13 +1330,13 @@ function zt({
|
|
|
1330
1330
|
}
|
|
1331
1331
|
},
|
|
1332
1332
|
highlightNodes(f) {
|
|
1333
|
-
p = f, h?.(p,
|
|
1333
|
+
p = f, h?.(p, E);
|
|
1334
1334
|
},
|
|
1335
1335
|
highlightEdges(f) {
|
|
1336
|
-
|
|
1336
|
+
E = f, h?.(p, E);
|
|
1337
1337
|
},
|
|
1338
1338
|
clearHighlight() {
|
|
1339
|
-
p = [],
|
|
1339
|
+
p = [], E = [], h?.([], []);
|
|
1340
1340
|
},
|
|
1341
1341
|
overlay: e,
|
|
1342
1342
|
getContextMenuItems(f) {
|
|
@@ -1350,10 +1350,10 @@ function zt({
|
|
|
1350
1350
|
envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
|
|
1351
1351
|
error: { code: "constraint_violated", reason: `Source node "${f}" not found`, source: "api" }
|
|
1352
1352
|
};
|
|
1353
|
-
const
|
|
1353
|
+
const x = c?.gap ?? l ?? Ut, B = c?.direction ?? "right", X = o.nodeTypes[b.type], C = o.nodeTypes[d.type], L = X?.getSize(b) ?? { width: 154, height: 54 }, w = C?.getSize({ ...d, position: { x: 0, y: 0 } }) ?? {
|
|
1354
1354
|
width: 154,
|
|
1355
1355
|
height: 54
|
|
1356
|
-
}, A = W(B, b, L, w,
|
|
1356
|
+
}, A = W(B, b, L, w, x), H = d.id || g("node"), Z = { ...d, id: H, position: A }, V = [{ type: "node.add", node: Z }], ee = z(B, w, x), Q = { x: A.x, y: A.y, width: w.width, height: w.height };
|
|
1357
1357
|
for (const [ie, ne] of Object.entries(v.nodes)) {
|
|
1358
1358
|
if (ie === f || ie === H) continue;
|
|
1359
1359
|
const I = o.nodeTypes[ne.type]?.getSize(ne) ?? { width: 154, height: 54 }, _ = Q.x < ne.position.x + I.width && Q.x + Q.width > ne.position.x, F = Q.y < ne.position.y + I.height && Q.y + Q.height > ne.position.y;
|
|
@@ -1448,13 +1448,13 @@ function je(s, e) {
|
|
|
1448
1448
|
const i = 50, r = t / i;
|
|
1449
1449
|
let l = 0;
|
|
1450
1450
|
for (let g = 0; g <= i; g++) {
|
|
1451
|
-
const p = g * r,
|
|
1452
|
-
m < n && (n = m, o =
|
|
1451
|
+
const p = g * r, E = s.getPointAtLength(p), m = (E.x - e.x) ** 2 + (E.y - e.y) ** 2;
|
|
1452
|
+
m < n && (n = m, o = E, l = p);
|
|
1453
1453
|
}
|
|
1454
1454
|
const a = Math.max(0, l - r), h = Math.min(t, l + r), u = (h - a) / 20;
|
|
1455
1455
|
for (let g = a; g <= h; g += u) {
|
|
1456
|
-
const p = s.getPointAtLength(g),
|
|
1457
|
-
|
|
1456
|
+
const p = s.getPointAtLength(g), E = (p.x - e.x) ** 2 + (p.y - e.y) ** 2;
|
|
1457
|
+
E < n && (n = E, o = p, l = g);
|
|
1458
1458
|
}
|
|
1459
1459
|
return { x: o.x, y: o.y, length: l, totalLength: t };
|
|
1460
1460
|
}
|
|
@@ -1488,7 +1488,7 @@ function Wt(s) {
|
|
|
1488
1488
|
if (!g) return;
|
|
1489
1489
|
const p = g.container.querySelector("path");
|
|
1490
1490
|
if (!p) return;
|
|
1491
|
-
const
|
|
1491
|
+
const E = s.clientToLocal(a.clientX, a.clientY), m = je(p, E);
|
|
1492
1492
|
if (We(m.length, m.totalLength) || Ve(g.container, a.clientX, a.clientY)) return;
|
|
1493
1493
|
const k = Xe();
|
|
1494
1494
|
k.setAttribute("transform", `translate(${m.x}, ${m.y})`), g.container.appendChild(k), e = k;
|
|
@@ -1505,14 +1505,14 @@ function Wt(s) {
|
|
|
1505
1505
|
if (!u) return;
|
|
1506
1506
|
const g = u.container.querySelector("path");
|
|
1507
1507
|
if (!g) return;
|
|
1508
|
-
const p = s.clientToLocal(l.clientX, l.clientY),
|
|
1509
|
-
if (We(
|
|
1508
|
+
const p = s.clientToLocal(l.clientX, l.clientY), E = je(g, p);
|
|
1509
|
+
if (We(E.length, E.totalLength) || Ve(u.container, l.clientX, l.clientY))
|
|
1510
1510
|
e && e.setAttribute("display", "none");
|
|
1511
1511
|
else if (e)
|
|
1512
|
-
e.removeAttribute("display"), e.setAttribute("transform", `translate(${
|
|
1512
|
+
e.removeAttribute("display"), e.setAttribute("transform", `translate(${E.x}, ${E.y})`);
|
|
1513
1513
|
else {
|
|
1514
1514
|
const m = Xe();
|
|
1515
|
-
m.setAttribute("transform", `translate(${
|
|
1515
|
+
m.setAttribute("transform", `translate(${E.x}, ${E.y})`), u.container.appendChild(m), e = m;
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
function i() {
|
|
@@ -1528,8 +1528,8 @@ function Vt(s) {
|
|
|
1528
1528
|
function o(u) {
|
|
1529
1529
|
const g = u ? "visible" : "hidden";
|
|
1530
1530
|
for (const p of s.getNodes())
|
|
1531
|
-
for (const
|
|
1532
|
-
p.setPortProp(
|
|
1531
|
+
for (const E of p.getPorts())
|
|
1532
|
+
p.setPortProp(E.id, "attrs/circle/visibility", g);
|
|
1533
1533
|
}
|
|
1534
1534
|
function n(u) {
|
|
1535
1535
|
if (!e)
|
|
@@ -1545,9 +1545,9 @@ function Vt(s) {
|
|
|
1545
1545
|
if (!u.getTargetCell())
|
|
1546
1546
|
if (e = u.id, g?.size)
|
|
1547
1547
|
for (const p of s.getNodes()) {
|
|
1548
|
-
const
|
|
1548
|
+
const E = g.has(p.id) ? "hidden" : "visible";
|
|
1549
1549
|
for (const m of p.getPorts())
|
|
1550
|
-
p.setPortProp(m.id, "attrs/circle/visibility",
|
|
1550
|
+
p.setPortProp(m.id, "attrs/circle/visibility", E);
|
|
1551
1551
|
}
|
|
1552
1552
|
else
|
|
1553
1553
|
o(!0);
|
|
@@ -1576,7 +1576,7 @@ function Ye(s) {
|
|
|
1576
1576
|
function Xt(s) {
|
|
1577
1577
|
const { editor: e, nodeHover: t, isSelectionModeActive: o, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = q(null), h = q(!1);
|
|
1578
1578
|
let u = null, g = null, p = null;
|
|
1579
|
-
const
|
|
1579
|
+
const E = j(() => ({
|
|
1580
1580
|
enabled: !0,
|
|
1581
1581
|
portGroup: "right",
|
|
1582
1582
|
...s.quickAddProp.value
|
|
@@ -1603,7 +1603,7 @@ function Xt(s) {
|
|
|
1603
1603
|
return qe(C, L?.getPorts);
|
|
1604
1604
|
}
|
|
1605
1605
|
function K(C, L) {
|
|
1606
|
-
const w =
|
|
1606
|
+
const w = E.value.getPort?.(C, L);
|
|
1607
1607
|
if (!w) return null;
|
|
1608
1608
|
const A = typeof w == "string" ? w : w.id;
|
|
1609
1609
|
return L.find((H) => H.id === A) ?? null;
|
|
@@ -1640,27 +1640,27 @@ function Xt(s) {
|
|
|
1640
1640
|
return O(C, w);
|
|
1641
1641
|
}
|
|
1642
1642
|
function z(C) {
|
|
1643
|
-
const L = G(C), w = K(C, L) ?? L.find((H) => H.group ===
|
|
1643
|
+
const L = G(C), w = K(C, L) ?? L.find((H) => H.group === E.value.portGroup) ?? null;
|
|
1644
1644
|
if (!w) return null;
|
|
1645
1645
|
const A = W(C.id, w.id, w.group);
|
|
1646
1646
|
return A ? { portId: w.id, portGroup: w.group, portPosition: A } : null;
|
|
1647
1647
|
}
|
|
1648
1648
|
function M(C) {
|
|
1649
|
-
const L = z(C), w =
|
|
1649
|
+
const L = z(C), w = E.value.insertDirection;
|
|
1650
1650
|
if (typeof w == "function") {
|
|
1651
1651
|
const A = w(C, L ? { id: L.portId, group: L.portGroup } : null);
|
|
1652
1652
|
if (A) return A;
|
|
1653
1653
|
} else if (w)
|
|
1654
1654
|
return w;
|
|
1655
|
-
return L && Ye(L.portGroup) ? L.portGroup : Ye(
|
|
1655
|
+
return L && Ye(L.portGroup) ? L.portGroup : Ye(E.value.portGroup) ? E.value.portGroup : "right";
|
|
1656
1656
|
}
|
|
1657
1657
|
function y(C) {
|
|
1658
|
-
if (!
|
|
1658
|
+
if (!E.value.enabled || e.mode.value !== "edit") return !1;
|
|
1659
1659
|
const w = e.flowModel.value.nodes[C];
|
|
1660
1660
|
return !w || i(w).quickAddEnabled === !1 ? !1 : !!z(w);
|
|
1661
1661
|
}
|
|
1662
1662
|
const f = j(() => {
|
|
1663
|
-
if (n.value, !
|
|
1663
|
+
if (n.value, !E.value.enabled) return null;
|
|
1664
1664
|
const C = a.value;
|
|
1665
1665
|
if (!C || l.value || !e.api.value || e.mode.value !== "edit" || o.value)
|
|
1666
1666
|
return null;
|
|
@@ -1698,7 +1698,7 @@ function Xt(s) {
|
|
|
1698
1698
|
label: "快捷插入节点"
|
|
1699
1699
|
}).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: C, newNodeId: A }), s.closePopover();
|
|
1700
1700
|
}
|
|
1701
|
-
function
|
|
1701
|
+
function x(C) {
|
|
1702
1702
|
if (!g) return;
|
|
1703
1703
|
const L = g.getCellById(C);
|
|
1704
1704
|
if (!L?.isNode()) return;
|
|
@@ -1721,7 +1721,7 @@ function Xt(s) {
|
|
|
1721
1721
|
const H = C.getCellById(A);
|
|
1722
1722
|
H?.isNode() && L(H);
|
|
1723
1723
|
}
|
|
1724
|
-
w &&
|
|
1724
|
+
w && x(w);
|
|
1725
1725
|
},
|
|
1726
1726
|
{ flush: "sync" }
|
|
1727
1727
|
);
|
|
@@ -1735,7 +1735,7 @@ function Xt(s) {
|
|
|
1735
1735
|
return {
|
|
1736
1736
|
quickAddNodeId: a,
|
|
1737
1737
|
quickAddPopoverOpen: h,
|
|
1738
|
-
mergedConfig:
|
|
1738
|
+
mergedConfig: E,
|
|
1739
1739
|
data: f,
|
|
1740
1740
|
enter: S,
|
|
1741
1741
|
leave: k,
|
|
@@ -1747,7 +1747,7 @@ function Xt(s) {
|
|
|
1747
1747
|
handleStartDrag: v,
|
|
1748
1748
|
handleInsert: b,
|
|
1749
1749
|
isActiveForNode: y,
|
|
1750
|
-
syncNodePorts:
|
|
1750
|
+
syncNodePorts: x,
|
|
1751
1751
|
attachRuntime: B,
|
|
1752
1752
|
cleanup: X
|
|
1753
1753
|
};
|
|
@@ -1799,7 +1799,7 @@ function Zt(s) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
return d;
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function E(y) {
|
|
1803
1803
|
const f = y.getTotalLength();
|
|
1804
1804
|
if (f === 0) return [];
|
|
1805
1805
|
const d = [];
|
|
@@ -1819,7 +1819,7 @@ function Zt(s) {
|
|
|
1819
1819
|
height: Math.max(0, y.height - v * 2)
|
|
1820
1820
|
};
|
|
1821
1821
|
if (b.width <= 0 || b.height <= 0) return null;
|
|
1822
|
-
const
|
|
1822
|
+
const x = b.x + b.width, B = b.y + b.height;
|
|
1823
1823
|
let X = null;
|
|
1824
1824
|
const C = y.x + y.width / 2, L = y.y + y.height / 2;
|
|
1825
1825
|
for (const w of t.getEdges()) {
|
|
@@ -1829,11 +1829,11 @@ function Zt(s) {
|
|
|
1829
1829
|
if (!H) continue;
|
|
1830
1830
|
const Z = H.findOne?.("path");
|
|
1831
1831
|
if (!Z || typeof Z.getTotalLength != "function") continue;
|
|
1832
|
-
const V =
|
|
1832
|
+
const V = E(Z);
|
|
1833
1833
|
if (!V.length) continue;
|
|
1834
1834
|
let ee = !1, Q = 1 / 0;
|
|
1835
1835
|
for (const oe of V)
|
|
1836
|
-
if (oe.x >= b.x && oe.x <=
|
|
1836
|
+
if (oe.x >= b.x && oe.x <= x && oe.y >= b.y && oe.y <= B) {
|
|
1837
1837
|
const ie = oe.x - C, ne = oe.y - L, N = ie * ie + ne * ne;
|
|
1838
1838
|
N < Q && (Q = N), ee = !0;
|
|
1839
1839
|
}
|
|
@@ -1902,12 +1902,12 @@ function Zt(s) {
|
|
|
1902
1902
|
if (!c) return y;
|
|
1903
1903
|
const v = y.commands.find((H) => H.type === "node.add" || H.type === "node.move");
|
|
1904
1904
|
if (!v) return y;
|
|
1905
|
-
const b = v.type === "node.add" ? v.node.id : v.nodeId,
|
|
1906
|
-
if (!
|
|
1905
|
+
const b = v.type === "node.add" ? v.node.id : v.nodeId, x = v.type === "node.add" ? v.node : d.nodes[v.nodeId];
|
|
1906
|
+
if (!x) return y;
|
|
1907
1907
|
const B = a.value;
|
|
1908
|
-
if (B.isNodeInsertable && !B.isNodeInsertable(
|
|
1908
|
+
if (B.isNodeInsertable && !B.isNodeInsertable(x, d))
|
|
1909
1909
|
return y;
|
|
1910
|
-
const X = p(b,
|
|
1910
|
+
const X = p(b, x, B.incomingPortGroup), C = p(b, x, B.outgoingPortGroup), L = e.idGenerator("edge"), w = e.idGenerator("edge"), A = [
|
|
1911
1911
|
{ type: "edge.remove", edgeId: f },
|
|
1912
1912
|
{
|
|
1913
1913
|
type: "edge.add",
|
|
@@ -2083,11 +2083,11 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2083
2083
|
emits: ["action"],
|
|
2084
2084
|
setup(s, { emit: e }) {
|
|
2085
2085
|
const t = s, o = j(() => {
|
|
2086
|
-
const g = t.actionsOffset?.x ?? 0, p = t.actionsOffset?.y ?? 0,
|
|
2086
|
+
const g = t.actionsOffset?.x ?? 0, p = t.actionsOffset?.y ?? 0, E = g !== 0 || p !== 0;
|
|
2087
2087
|
return {
|
|
2088
2088
|
left: `${t.position.x}px`,
|
|
2089
2089
|
top: `${t.position.y}px`,
|
|
2090
|
-
transform:
|
|
2090
|
+
transform: E ? `translate(${g}px, ${p}px)` : "translateX(-100%)"
|
|
2091
2091
|
};
|
|
2092
2092
|
}), n = e, i = j(() => ({
|
|
2093
2093
|
debug: {
|
|
@@ -2130,12 +2130,12 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2130
2130
|
i.value.debug.visible ? (D(), R("i", {
|
|
2131
2131
|
key: 0,
|
|
2132
2132
|
class: se(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": i.value.debug.disabled }]),
|
|
2133
|
-
onClick: p[0] || (p[0] = (
|
|
2133
|
+
onClick: p[0] || (p[0] = (E) => !i.value.debug.disabled && n("action", "debug", s.node.id))
|
|
2134
2134
|
}, null, 2)) : Y("", !0),
|
|
2135
2135
|
i.value.delete.visible ? (D(), R("i", {
|
|
2136
2136
|
key: 1,
|
|
2137
2137
|
class: se(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": i.value.delete.disabled }]),
|
|
2138
|
-
onClick: p[1] || (p[1] = (
|
|
2138
|
+
onClick: p[1] || (p[1] = (E) => !i.value.delete.disabled && n("action", "delete", s.node.id))
|
|
2139
2139
|
}, null, 2)) : Y("", !0),
|
|
2140
2140
|
r.value ? (D(), R("div", {
|
|
2141
2141
|
key: 2,
|
|
@@ -2157,7 +2157,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2157
2157
|
i.value.copy.visible ? (D(), R("div", {
|
|
2158
2158
|
key: 0,
|
|
2159
2159
|
class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copy.disabled }]),
|
|
2160
|
-
onClick: p[2] || (p[2] = (
|
|
2160
|
+
onClick: p[2] || (p[2] = (E) => !i.value.copy.disabled && n("action", "copy", s.node.id))
|
|
2161
2161
|
}, [...p[6] || (p[6] = [
|
|
2162
2162
|
U("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
|
|
2163
2163
|
U("span", null, "复制", -1)
|
|
@@ -2165,7 +2165,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2165
2165
|
i.value.copyInsert.visible ? (D(), R("div", {
|
|
2166
2166
|
key: 1,
|
|
2167
2167
|
class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copyInsert.disabled }]),
|
|
2168
|
-
onClick: p[3] || (p[3] = (
|
|
2168
|
+
onClick: p[3] || (p[3] = (E) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
|
|
2169
2169
|
}, [...p[7] || (p[7] = [
|
|
2170
2170
|
U("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
|
|
2171
2171
|
U("span", null, "复制并插入", -1)
|
|
@@ -2173,7 +2173,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2173
2173
|
i.value.disconnect.visible ? (D(), R("div", {
|
|
2174
2174
|
key: 2,
|
|
2175
2175
|
class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.disconnect.disabled }]),
|
|
2176
|
-
onClick: p[4] || (p[4] = (
|
|
2176
|
+
onClick: p[4] || (p[4] = (E) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
|
|
2177
2177
|
}, [...p[8] || (p[8] = [
|
|
2178
2178
|
U("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
|
|
2179
2179
|
U("span", null, "断开连线", -1)
|
|
@@ -2203,9 +2203,9 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2203
2203
|
const o = s, n = t, i = q(), r = q(), l = q(!1), a = q(!1);
|
|
2204
2204
|
let h = null, u = !1, g = null;
|
|
2205
2205
|
function p(z) {
|
|
2206
|
-
z.preventDefault(), z.stopPropagation(), h = { x: z.clientX, y: z.clientY }, u = !1, document.addEventListener("mousemove",
|
|
2206
|
+
z.preventDefault(), z.stopPropagation(), h = { x: z.clientX, y: z.clientY }, u = !1, document.addEventListener("mousemove", E), document.addEventListener("mouseup", m);
|
|
2207
2207
|
}
|
|
2208
|
-
function
|
|
2208
|
+
function E(z) {
|
|
2209
2209
|
if (!h) return;
|
|
2210
2210
|
const M = z.clientX - h.x, y = z.clientY - h.y;
|
|
2211
2211
|
Math.sqrt(M * M + y * y) >= io && (u = !0, k(), n("start-drag", o.node.id));
|
|
@@ -2214,7 +2214,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2214
2214
|
k(), u || S(), h = null, u = !1;
|
|
2215
2215
|
}
|
|
2216
2216
|
function k() {
|
|
2217
|
-
document.removeEventListener("mousemove",
|
|
2217
|
+
document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", m);
|
|
2218
2218
|
}
|
|
2219
2219
|
function S() {
|
|
2220
2220
|
a.value ? P() : T();
|
|
@@ -2282,7 +2282,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2282
2282
|
onMouseenter: O,
|
|
2283
2283
|
onMouseleave: W
|
|
2284
2284
|
}, [
|
|
2285
|
-
|
|
2285
|
+
xe(z.$slots, "default", {}, () => [
|
|
2286
2286
|
M[6] || (M[6] = U("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
|
|
2287
2287
|
], !0)
|
|
2288
2288
|
], 544)) : Y("", !0)
|
|
@@ -2329,7 +2329,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2329
2329
|
emits: ["ui-event"],
|
|
2330
2330
|
setup(s, { emit: e }) {
|
|
2331
2331
|
const t = s, o = e, n = q(), i = q();
|
|
2332
|
-
let r, l, a, h, u = null, g = null, p = null,
|
|
2332
|
+
let r, l, a, h, u = null, g = null, p = null, E = null;
|
|
2333
2333
|
const m = jt(), { hoveredNodeId: k, isDraggingNode: S } = m, T = m.enterOverlay, P = () => m.leaveOverlay(), G = q(0), K = q({ nodeIds: [], edgeIds: [] });
|
|
2334
2334
|
function O(N) {
|
|
2335
2335
|
const I = t.editor.api.value;
|
|
@@ -2401,7 +2401,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2401
2401
|
getNodeBehavior: O,
|
|
2402
2402
|
getInsertGap: () => z.value.insertGap,
|
|
2403
2403
|
closePopover: () => d.value?.closePopover()
|
|
2404
|
-
}), v = c.data, b = c.handleOpen,
|
|
2404
|
+
}), v = c.data, b = c.handleOpen, x = c.handleClose, B = c.handleStartDrag, X = c.handleOverlayEnter, C = c.handleOverlayLeave, L = c.handleInsert, w = Zt({
|
|
2405
2405
|
editor: t.editor,
|
|
2406
2406
|
edgeDropProp: j(() => t.edgeDrop)
|
|
2407
2407
|
}), A = Qt(t.editor);
|
|
@@ -2490,9 +2490,9 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2490
2490
|
return;
|
|
2491
2491
|
}
|
|
2492
2492
|
m.leave(180), c.quickAddPopoverOpen.value || c.leave();
|
|
2493
|
-
}, n.value?.addEventListener("mousemove", p),
|
|
2493
|
+
}, n.value?.addEventListener("mousemove", p), E = () => {
|
|
2494
2494
|
m.reset(), c.quickAddPopoverOpen.value || (c.quickAddNodeId.value = null);
|
|
2495
|
-
}, n.value?.addEventListener("mouseleave",
|
|
2495
|
+
}, n.value?.addEventListener("mouseleave", E), n.value?.addEventListener("keydown", V);
|
|
2496
2496
|
}
|
|
2497
2497
|
function ne() {
|
|
2498
2498
|
pe(
|
|
@@ -2563,7 +2563,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2563
2563
|
const _ = Gt(r), F = zt({
|
|
2564
2564
|
graph: r,
|
|
2565
2565
|
overlayManager: _,
|
|
2566
|
-
executeCommand: ($) => t.editor.executeCommand($),
|
|
2566
|
+
executeCommand: ($) => t.editor.executeCommand(w.tryExpandForEdgeDrop($)),
|
|
2567
2567
|
schema: t.editor.schema,
|
|
2568
2568
|
flowModel: t.editor.flowModel,
|
|
2569
2569
|
getNodeBehavior: O,
|
|
@@ -2645,7 +2645,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2645
2645
|
};
|
|
2646
2646
|
r.on("translate", Pe), r.on("scale", Pe), r.on("resize", Pe), ie(), l.syncFlowModel(t.editor.flowModel.value), ne();
|
|
2647
2647
|
}), Me(() => {
|
|
2648
|
-
m.cleanup(), c.cleanup(), w.cleanup(), u?.remove(), g && r?.container?.removeEventListener("mousemove", g), p && n.value?.removeEventListener("mousemove", p),
|
|
2648
|
+
m.cleanup(), c.cleanup(), w.cleanup(), u?.remove(), g && r?.container?.removeEventListener("mousemove", g), p && n.value?.removeEventListener("mousemove", p), E && n.value?.removeEventListener("mouseleave", E), n.value?.removeEventListener("keydown", V), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
|
|
2649
2649
|
for (const N of Object.keys(t.editor.extendedApi))
|
|
2650
2650
|
delete t.editor.extendedApi[N];
|
|
2651
2651
|
h?.dispose(), l?.dispose(), a?.dispose(), r?.dispose();
|
|
@@ -2673,13 +2673,13 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2673
2673
|
node: le(v).node,
|
|
2674
2674
|
"port-position": le(v).portPosition,
|
|
2675
2675
|
onOpen: le(b),
|
|
2676
|
-
onClose: le(
|
|
2676
|
+
onClose: le(x),
|
|
2677
2677
|
onStartDrag: le(B),
|
|
2678
2678
|
onMouseenter: le(X),
|
|
2679
2679
|
onMouseleave: le(C)
|
|
2680
2680
|
}, {
|
|
2681
2681
|
default: He(() => [
|
|
2682
|
-
|
|
2682
|
+
xe(N.$slots, "quick-add-panel", {
|
|
2683
2683
|
node: le(v).node,
|
|
2684
2684
|
api: s.editor.api.value,
|
|
2685
2685
|
insertNodeToRight: (_) => le(L)(le(v).node.id, _),
|
|
@@ -2708,7 +2708,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2708
2708
|
])
|
|
2709
2709
|
], 2));
|
|
2710
2710
|
}
|
|
2711
|
-
}), pn = /* @__PURE__ */ he(go, [["__scopeId", "data-v-
|
|
2711
|
+
}), pn = /* @__PURE__ */ he(go, [["__scopeId", "data-v-5a3959fd"]]), po = { class: "flow-canvas-node-palette" }, ho = ["data-node-type"], vo = { class: "flow-canvas-node-palette__item-label" }, yo = /* @__PURE__ */ fe({
|
|
2712
2712
|
__name: "canvas-node-palette",
|
|
2713
2713
|
props: {
|
|
2714
2714
|
editor: {},
|
|
@@ -2760,7 +2760,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2760
2760
|
], 512)
|
|
2761
2761
|
]));
|
|
2762
2762
|
}
|
|
2763
|
-
}), mo = /* @__PURE__ */ he(yo, [["__scopeId", "data-v-300314b7"]]), wo = { class: "flow-canvas-layout" }, bo = { class: "flow-canvas-layout__main" },
|
|
2763
|
+
}), mo = /* @__PURE__ */ he(yo, [["__scopeId", "data-v-300314b7"]]), wo = { class: "flow-canvas-layout" }, bo = { class: "flow-canvas-layout__main" }, Eo = { class: "flow-canvas-layout__content" }, xo = {
|
|
2764
2764
|
key: 0,
|
|
2765
2765
|
class: "flow-canvas-layout__footer"
|
|
2766
2766
|
}, Io = /* @__PURE__ */ fe({
|
|
@@ -2781,7 +2781,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2781
2781
|
class: se(["flow-canvas-layout__sidebar", { "is-collapsed": s.sidebarCollapsed }]),
|
|
2782
2782
|
style: we({ width: s.sidebarCollapsed ? "0px" : `${s.sidebarWidth}px` })
|
|
2783
2783
|
}, [
|
|
2784
|
-
|
|
2784
|
+
xe(e.$slots, "sidebar", {}, () => [
|
|
2785
2785
|
s.editor ? (D(), be(mo, {
|
|
2786
2786
|
key: 0,
|
|
2787
2787
|
editor: s.editor,
|
|
@@ -2790,11 +2790,11 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
|
|
|
2790
2790
|
], !0)
|
|
2791
2791
|
], 6)) : Y("", !0),
|
|
2792
2792
|
U("div", bo, [
|
|
2793
|
-
U("div",
|
|
2794
|
-
|
|
2793
|
+
U("div", Eo, [
|
|
2794
|
+
xe(e.$slots, "default", {}, void 0, !0)
|
|
2795
2795
|
]),
|
|
2796
|
-
!s.hideFooter && e.$slots.footer ? (D(), R("div",
|
|
2797
|
-
|
|
2796
|
+
!s.hideFooter && e.$slots.footer ? (D(), R("div", xo, [
|
|
2797
|
+
xe(e.$slots, "footer", {}, void 0, !0)
|
|
2798
2798
|
])) : Y("", !0)
|
|
2799
2799
|
])
|
|
2800
2800
|
]));
|
|
@@ -2907,13 +2907,13 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
|
|
|
2907
2907
|
const i = s, r = j(() => {
|
|
2908
2908
|
if (i.items) return i.items;
|
|
2909
2909
|
const d = ko(), c = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), b = /* @__PURE__ */ new Map();
|
|
2910
|
-
for (const
|
|
2911
|
-
b.set(
|
|
2912
|
-
for (const
|
|
2913
|
-
const B = b.get(
|
|
2914
|
-
B ? b.set(
|
|
2910
|
+
for (const x of d)
|
|
2911
|
+
b.set(x.id, x);
|
|
2912
|
+
for (const x of c) {
|
|
2913
|
+
const B = b.get(x.id);
|
|
2914
|
+
B ? b.set(x.id, { ...B, ...x, order: B.order, group: B.group }) : o(x) && b.set(x.id, x);
|
|
2915
2915
|
}
|
|
2916
|
-
return [...b.values()].filter((
|
|
2916
|
+
return [...b.values()].filter((x) => x.type === "custom" || !e.has(x.type) ? !0 : !v.has(x.type)).sort((x, B) => (x.order ?? 0) - (B.order ?? 0));
|
|
2917
2917
|
}), l = q(1), a = q(null), h = q(null), u = q(!1);
|
|
2918
2918
|
let g = null;
|
|
2919
2919
|
pe(
|
|
@@ -2926,12 +2926,12 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
|
|
|
2926
2926
|
{ immediate: !0 }
|
|
2927
2927
|
);
|
|
2928
2928
|
const p = at({ visible: !1, text: "", x: 0, y: 0 });
|
|
2929
|
-
function
|
|
2929
|
+
function E(d, c) {
|
|
2930
2930
|
if (!c.description) return;
|
|
2931
2931
|
const b = d.currentTarget.getBoundingClientRect();
|
|
2932
2932
|
p.text = c.description, p.visible = !0, Oe(() => {
|
|
2933
|
-
const
|
|
2934
|
-
p.x = b.left + b.width / 2 -
|
|
2933
|
+
const x = a.value?.offsetWidth ?? 0, B = a.value?.offsetHeight ?? 0;
|
|
2934
|
+
p.x = b.left + b.width / 2 - x / 2, p.y = b.top - B - 6;
|
|
2935
2935
|
});
|
|
2936
2936
|
}
|
|
2937
2937
|
function m() {
|
|
@@ -3009,8 +3009,8 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
|
|
|
3009
3009
|
case "export":
|
|
3010
3010
|
if (u.value) break;
|
|
3011
3011
|
u.value = !0, c.exportAsImage().then((v) => {
|
|
3012
|
-
const b = URL.createObjectURL(v),
|
|
3013
|
-
|
|
3012
|
+
const b = URL.createObjectURL(v), x = document.createElement("a");
|
|
3013
|
+
x.href = b, x.download = "canvas-export.png", x.click(), URL.revokeObjectURL(b);
|
|
3014
3014
|
}).catch((v) => {
|
|
3015
3015
|
console.warn("[flow-canvas] Export failed:", v);
|
|
3016
3016
|
}).finally(() => {
|
|
@@ -3046,31 +3046,31 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
|
|
|
3046
3046
|
}, [
|
|
3047
3047
|
b > 0 ? (D(), R("div", Mo)) : Y("", !0),
|
|
3048
3048
|
U("div", No, [
|
|
3049
|
-
(D(!0), R(me, null, Ie(v.items, (
|
|
3050
|
-
key:
|
|
3049
|
+
(D(!0), R(me, null, Ie(v.items, (x) => (D(), R(me, {
|
|
3050
|
+
key: x.id
|
|
3051
3051
|
}, [
|
|
3052
|
-
|
|
3052
|
+
x.type === "zoom-display" ? (D(), R("span", _o, ge(k.value), 1)) : (D(), R("button", {
|
|
3053
3053
|
key: 1,
|
|
3054
3054
|
type: "button",
|
|
3055
3055
|
class: se(["flow-canvas-toolbar__btn", {
|
|
3056
|
-
"is-disabled": O(
|
|
3057
|
-
"is-active": K(
|
|
3058
|
-
"is-exporting":
|
|
3056
|
+
"is-disabled": O(x),
|
|
3057
|
+
"is-active": K(x),
|
|
3058
|
+
"is-exporting": x.type === "export" && u.value
|
|
3059
3059
|
}]),
|
|
3060
|
-
"data-toolbar-id":
|
|
3061
|
-
"data-toolbar-type":
|
|
3062
|
-
disabled: O(
|
|
3063
|
-
onClick: (B) => M(
|
|
3064
|
-
onMouseenter: (B) =>
|
|
3060
|
+
"data-toolbar-id": x.id,
|
|
3061
|
+
"data-toolbar-type": x.type,
|
|
3062
|
+
disabled: O(x),
|
|
3063
|
+
onClick: (B) => M(x),
|
|
3064
|
+
onMouseenter: (B) => E(B, x),
|
|
3065
3065
|
onMouseleave: m
|
|
3066
3066
|
}, [
|
|
3067
|
-
|
|
3067
|
+
x.component ? (D(), be(lt(x.component), { key: 0 })) : x.icon ? (D(), R("i", {
|
|
3068
3068
|
key: 1,
|
|
3069
|
-
class: se(
|
|
3069
|
+
class: se(x.icon)
|
|
3070
3070
|
}, null, 2)) : (D(), R("span", {
|
|
3071
3071
|
key: 2,
|
|
3072
3072
|
class: "flow-canvas-toolbar__text",
|
|
3073
|
-
textContent: ge(
|
|
3073
|
+
textContent: ge(x.text ?? x.description ?? x.id)
|
|
3074
3074
|
}, null, 8, Ao))
|
|
3075
3075
|
], 42, Do))
|
|
3076
3076
|
], 64))), 128))
|
|
@@ -3212,13 +3212,13 @@ function mn(s) {
|
|
|
3212
3212
|
if (!l || !a) continue;
|
|
3213
3213
|
const h = r.nodes[l], u = r.nodes[a];
|
|
3214
3214
|
if (!h || !u) continue;
|
|
3215
|
-
const g = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, p = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId,
|
|
3215
|
+
const g = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, p = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, E = g ? h.ports?.find((P) => P.id === g) : void 0, m = p ? u.ports?.find((P) => P.id === p) : void 0, k = i.type === "edge.reconnect" ? i.edgeId : void 0, S = Object.values(r.edges).filter(
|
|
3216
3216
|
(P) => P.id !== k && !n.has(P.id)
|
|
3217
3217
|
), T = s({
|
|
3218
3218
|
flowModel: r,
|
|
3219
3219
|
sourceNode: h,
|
|
3220
3220
|
targetNode: u,
|
|
3221
|
-
sourcePort:
|
|
3221
|
+
sourcePort: E,
|
|
3222
3222
|
targetPort: m,
|
|
3223
3223
|
existingEdges: S
|
|
3224
3224
|
});
|
|
@@ -3351,15 +3351,15 @@ const Go = { class: "flow-canvas-search-popover__input" }, qo = ["value", "place
|
|
|
3351
3351
|
}
|
|
3352
3352
|
m.key === "Enter" && (m.preventDefault(), g());
|
|
3353
3353
|
}
|
|
3354
|
-
function
|
|
3354
|
+
function E(m) {
|
|
3355
3355
|
if (!t.open) return;
|
|
3356
3356
|
const k = m.target;
|
|
3357
3357
|
k && i.value?.contains(k) || t.isAnchorTarget?.(m.target) || o("close");
|
|
3358
3358
|
}
|
|
3359
3359
|
return ot(() => {
|
|
3360
|
-
document.addEventListener("mousedown",
|
|
3360
|
+
document.addEventListener("mousedown", E);
|
|
3361
3361
|
}), Me(() => {
|
|
3362
|
-
document.removeEventListener("mousedown",
|
|
3362
|
+
document.removeEventListener("mousedown", E);
|
|
3363
3363
|
}), (m, k) => s.open ? (D(), R("div", {
|
|
3364
3364
|
key: 0,
|
|
3365
3365
|
ref_key: "panelRef",
|
|
@@ -3431,7 +3431,7 @@ function tn(s, e) {
|
|
|
3431
3431
|
keywords: i
|
|
3432
3432
|
} : null;
|
|
3433
3433
|
}
|
|
3434
|
-
function
|
|
3434
|
+
function En(s) {
|
|
3435
3435
|
let e = null, t = null, o = null, n = null, i = null, r = [];
|
|
3436
3436
|
const l = q(!1), a = q(""), h = q({ x: 0, y: 0, width: Qe }), u = j(() => e ? Object.values(e.flowModel.value.nodes).map((M) => tn(M, s)).filter(Qo) : []), g = j(() => {
|
|
3437
3437
|
const M = a.value.trim().toLowerCase(), y = Math.max(1, s?.maxResults ?? Yo);
|
|
@@ -3440,11 +3440,11 @@ function xn(s) {
|
|
|
3440
3440
|
function p() {
|
|
3441
3441
|
return o?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="search"]');
|
|
3442
3442
|
}
|
|
3443
|
-
function
|
|
3443
|
+
function E() {
|
|
3444
3444
|
return p()?.closest(".flow-canvas-toolbar");
|
|
3445
3445
|
}
|
|
3446
3446
|
function m() {
|
|
3447
|
-
const M =
|
|
3447
|
+
const M = E(), y = o?.getBoundingClientRect(), f = M?.getBoundingClientRect() ?? y;
|
|
3448
3448
|
if (!f) return;
|
|
3449
3449
|
const d = Math.max(Qe, Math.round(f.width));
|
|
3450
3450
|
h.value = {
|
|
@@ -3553,8 +3553,8 @@ function rn(s) {
|
|
|
3553
3553
|
let o = null, n = s.defaultOpen ?? !1, i = null;
|
|
3554
3554
|
function r() {
|
|
3555
3555
|
!s.onClickOutside || i || (i = (p) => {
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3556
|
+
const E = p.target;
|
|
3557
|
+
E && e.contains(E) || p.target?.closest('[data-toolbar-type="minimap"]') || s.onClickOutside();
|
|
3558
3558
|
}, document.addEventListener("mousedown", i));
|
|
3559
3559
|
}
|
|
3560
3560
|
function l() {
|
|
@@ -3589,7 +3589,7 @@ function rn(s) {
|
|
|
3589
3589
|
destroy: g
|
|
3590
3590
|
};
|
|
3591
3591
|
}
|
|
3592
|
-
function
|
|
3592
|
+
function xn(s) {
|
|
3593
3593
|
let e = null;
|
|
3594
3594
|
const t = q(!1);
|
|
3595
3595
|
function o(i) {
|
|
@@ -3714,8 +3714,8 @@ export {
|
|
|
3714
3714
|
ko as createDefaultToolbarItems,
|
|
3715
3715
|
fn as createEmptyFlowModel,
|
|
3716
3716
|
te as generateId,
|
|
3717
|
-
|
|
3718
|
-
|
|
3717
|
+
xn as minimapPlugin,
|
|
3718
|
+
En as searchPlugin,
|
|
3719
3719
|
wn as selectionPlugin,
|
|
3720
3720
|
bn as snaplinePlugin,
|
|
3721
3721
|
gn as useCanvasEditor
|