@blueking/flow-canvas 0.0.11 → 0.0.13
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/README.md +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.esm.js +497 -479
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as H, computed as V, onScopeDispose as it, defineComponent as
|
|
1
|
+
import { ref as H, computed as V, onScopeDispose as it, defineComponent as pe, h as qe, watch as he, onBeforeUnmount as Te, createElementBlock as T, openBlock as A, normalizeStyle as Ee, createElementVNode as F, createVNode as at, createCommentVNode as K, normalizeClass as oe, Transition as lt, withCtx as He, withModifiers as ht, createTextVNode as je, renderSlot as Me, nextTick as Ge, onMounted as dt, createBlock as Ie, Fragment as ue, renderList as Ce, toDisplayString as fe, unref as le, reactive as vt, resolveDynamicComponent as mt, Teleport as yt, inject as wt, createApp as bt } from "vue";
|
|
2
2
|
import { Graph as Et } from "@antv/x6";
|
|
3
3
|
import { register as xt } from "@antv/x6-vue-shape";
|
|
4
4
|
import { Selection as It } from "@antv/x6-plugin-selection";
|
|
@@ -10,7 +10,7 @@ function Mn() {
|
|
|
10
10
|
edges: {}
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
class
|
|
13
|
+
class ge extends Error {
|
|
14
14
|
constructor(e) {
|
|
15
15
|
super(e), this.name = "CanvasConstraintError";
|
|
16
16
|
}
|
|
@@ -65,25 +65,25 @@ function ct(n, e) {
|
|
|
65
65
|
case "model.set-meta":
|
|
66
66
|
return Bt(n, e.path, e.value);
|
|
67
67
|
default:
|
|
68
|
-
throw new
|
|
68
|
+
throw new ge(`Unknown command type: ${e.type}`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
function Ne(n, e) {
|
|
72
72
|
const o = n.nodes[e];
|
|
73
|
-
if (!o) throw new
|
|
73
|
+
if (!o) throw new ge(`Node "${e}" does not exist`);
|
|
74
74
|
return o;
|
|
75
75
|
}
|
|
76
76
|
function De(n, e) {
|
|
77
77
|
const o = n.edges[e];
|
|
78
|
-
if (!o) throw new
|
|
78
|
+
if (!o) throw new ge(`Edge "${e}" does not exist`);
|
|
79
79
|
return o;
|
|
80
80
|
}
|
|
81
81
|
function ke(n, e, o) {
|
|
82
82
|
const t = n.nodes[e.nodeId];
|
|
83
83
|
if (!t)
|
|
84
|
-
throw new
|
|
84
|
+
throw new ge(`${o} node "${e.nodeId}" does not exist`);
|
|
85
85
|
if (e.portId && t.ports && !t.ports.some((r) => r.id === e.portId))
|
|
86
|
-
throw new
|
|
86
|
+
throw new ge(`${o} port "${e.portId}" not found on node "${e.nodeId}"`);
|
|
87
87
|
}
|
|
88
88
|
function Le(n, e, o) {
|
|
89
89
|
return { ...n, nodes: { ...n.nodes, [e]: o } };
|
|
@@ -93,7 +93,7 @@ function Oe(n, e, o) {
|
|
|
93
93
|
}
|
|
94
94
|
function St(n, e) {
|
|
95
95
|
if (n.nodes[e.id])
|
|
96
|
-
throw new
|
|
96
|
+
throw new ge(`Node id "${e.id}" already exists`);
|
|
97
97
|
return { ...n, nodes: { ...n.nodes, [e.id]: e } };
|
|
98
98
|
}
|
|
99
99
|
function Mt(n, e, o) {
|
|
@@ -121,12 +121,12 @@ function _t(n, e, o, t) {
|
|
|
121
121
|
}
|
|
122
122
|
function Pt(n, e) {
|
|
123
123
|
if (n.edges[e.id])
|
|
124
|
-
throw new
|
|
124
|
+
throw new ge(`Edge id "${e.id}" already exists`);
|
|
125
125
|
if (ke(n, e.source, "Source"), ke(n, e.target, "Target"), e.labels) {
|
|
126
126
|
const o = /* @__PURE__ */ new Set();
|
|
127
127
|
for (const t of e.labels) {
|
|
128
128
|
if (o.has(t.id))
|
|
129
|
-
throw new
|
|
129
|
+
throw new ge(`Duplicate label id "${t.id}" in edge "${e.id}"`);
|
|
130
130
|
o.add(t.id);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -152,10 +152,10 @@ function Ot(n, e, o, t) {
|
|
|
152
152
|
function $t(n, e, o, t) {
|
|
153
153
|
const s = De(n, e);
|
|
154
154
|
if (!s.labels)
|
|
155
|
-
throw new
|
|
155
|
+
throw new ge(`Edge "${e}" has no labels`);
|
|
156
156
|
const r = s.labels.findIndex((l) => l.id === o);
|
|
157
157
|
if (r === -1)
|
|
158
|
-
throw new
|
|
158
|
+
throw new ge(`Label "${o}" not found in edge "${e}"`);
|
|
159
159
|
const i = [...s.labels];
|
|
160
160
|
return i[r] = { ...i[r], ...t, id: o }, Oe(n, e, { ...s, labels: i });
|
|
161
161
|
}
|
|
@@ -168,7 +168,7 @@ function Ft(n, e) {
|
|
|
168
168
|
function a() {
|
|
169
169
|
i.value = s.length > 0, l.value = r.length > 0;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function h(b) {
|
|
172
172
|
const S = t.value;
|
|
173
173
|
let M = S;
|
|
174
174
|
for (const B of b.commands)
|
|
@@ -217,7 +217,7 @@ function Ft(n, e) {
|
|
|
217
217
|
}
|
|
218
218
|
return {
|
|
219
219
|
currentFlowModel: t,
|
|
220
|
-
execute:
|
|
220
|
+
execute: h,
|
|
221
221
|
undo: f,
|
|
222
222
|
redo: p,
|
|
223
223
|
canUndo: i,
|
|
@@ -402,13 +402,13 @@ class Ht {
|
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
let Gt = 0;
|
|
405
|
-
function
|
|
405
|
+
function ee() {
|
|
406
406
|
const n = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
|
|
407
407
|
return `${n}-${e}-${++Gt}`;
|
|
408
408
|
}
|
|
409
|
-
const ze = () =>
|
|
409
|
+
const ze = () => ee();
|
|
410
410
|
function Nn(n) {
|
|
411
|
-
const { schema: e, plugins: o = [], historyOptions: t } = n, s = n.idGenerator ?? ze, r = { version: "1.0", ...n.initialFlowModel }, i = Ft(r, t), l = H(n.mode ?? "edit"), a = H(!1),
|
|
411
|
+
const { schema: e, plugins: o = [], historyOptions: t } = n, s = n.idGenerator ?? ze, r = { version: "1.0", ...n.initialFlowModel }, i = Ft(r, t), l = H(n.mode ?? "edit"), a = H(!1), h = H(null), f = H([]), p = {}, u = new Ht();
|
|
412
412
|
function w(S, M, B, j = "user:toolbar") {
|
|
413
413
|
const k = {
|
|
414
414
|
id: `history-${Date.now()}`,
|
|
@@ -480,7 +480,7 @@ function Nn(n) {
|
|
|
480
480
|
setSelectionMode(S) {
|
|
481
481
|
a.value = S;
|
|
482
482
|
},
|
|
483
|
-
api:
|
|
483
|
+
api: h,
|
|
484
484
|
toolbarItems: f,
|
|
485
485
|
extendedApi: p,
|
|
486
486
|
_pluginManager: u,
|
|
@@ -522,7 +522,7 @@ function Nn(n) {
|
|
|
522
522
|
source: B.source
|
|
523
523
|
}), X;
|
|
524
524
|
} catch (k) {
|
|
525
|
-
if (k instanceof
|
|
525
|
+
if (k instanceof ge) {
|
|
526
526
|
const X = {
|
|
527
527
|
status: "invalid",
|
|
528
528
|
envelope: B,
|
|
@@ -714,8 +714,8 @@ class Wt {
|
|
|
714
714
|
}
|
|
715
715
|
const a = e.getPosition();
|
|
716
716
|
(a.x !== t.position.x || a.y !== t.position.y) && e.setPosition(t.position.x, t.position.y);
|
|
717
|
-
const
|
|
718
|
-
(
|
|
717
|
+
const h = e.getSize();
|
|
718
|
+
(h.width !== s.width || h.height !== s.height) && e.setSize(s.width, s.height, { silent: !0 }), this.syncNodePorts(e, r), e.setData({ ...t }), this.applyNodeBehavior(e, t, i), this.applyNodeHighlightAndDecoration(e, t);
|
|
719
719
|
}
|
|
720
720
|
syncNodePorts(e, o) {
|
|
721
721
|
const t = e.getPorts(), s = new Set(o.map((i) => i.id)), r = new Set(t.map((i) => i.id));
|
|
@@ -765,8 +765,8 @@ class Wt {
|
|
|
765
765
|
...l.x6CellConfig
|
|
766
766
|
};
|
|
767
767
|
this.graph.addNode(a), this.knownNodeIds.add(e), this.saveNodeDefaultAttrs(e, l);
|
|
768
|
-
const
|
|
769
|
-
|
|
768
|
+
const h = this.graph.getCellById(e);
|
|
769
|
+
h && (this.applyNodeBehavior(h, t, l), this.applyNodeHighlightAndDecoration(h, t), this.scheduleDecorationRetryIfNeeded(h));
|
|
770
770
|
}
|
|
771
771
|
/**
|
|
772
772
|
* Vue Shape 组件在 foreignObject 内异步挂载,addNewNode 同步调用
|
|
@@ -963,17 +963,17 @@ class Wt {
|
|
|
963
963
|
applyEdgeStyleAndDecoration(e, o, t) {
|
|
964
964
|
const s = this.highlightedEdgeIds.has(e.id), r = this.resolveEdgeDecoration?.(o), i = this.prevEdgeDecorationClasses.get(e.id);
|
|
965
965
|
i && (this.graph.findViewByCell(e)?.container?.classList.remove(i), this.prevEdgeDecorationClasses.delete(e.id)), r?.className && (this.graph.findViewByCell(e)?.container?.classList.add(r.className), this.prevEdgeDecorationClasses.set(e.id, r.className));
|
|
966
|
-
let l, a,
|
|
966
|
+
let l, a, h;
|
|
967
967
|
if (t?.style) {
|
|
968
968
|
const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, S = t.style(o, { selected: O, highlighted: s, hovered: b });
|
|
969
|
-
l = S.stroke, a = S.strokeWidth,
|
|
969
|
+
l = S.stroke, a = S.strokeWidth, h = S.strokeDasharray;
|
|
970
970
|
}
|
|
971
971
|
const f = !t?.style && s ? "#3a84ff" : void 0, p = r?.strokeColor, u = r?.targetMarkerColor, w = p ?? l ?? f, D = !!t?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
|
|
972
|
-
w ? this.setEdgeAttrIfChanged(e, "line/stroke", w) : D && this.restoreEdgeAttr(e, "line/stroke", "stroke"), this.applyEdgeMarkerDecoration(e, t, "targetMarker", u), t?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"),
|
|
972
|
+
w ? this.setEdgeAttrIfChanged(e, "line/stroke", w) : D && this.restoreEdgeAttr(e, "line/stroke", "stroke"), this.applyEdgeMarkerDecoration(e, t, "targetMarker", u), t?.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)), p ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), f ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
975
|
class Vt {
|
|
976
|
-
instanceId =
|
|
976
|
+
instanceId = ee();
|
|
977
977
|
registeredShapes = /* @__PURE__ */ new Map();
|
|
978
978
|
wrappedComponents = /* @__PURE__ */ new Map();
|
|
979
979
|
getShapeName(e) {
|
|
@@ -983,7 +983,7 @@ class Vt {
|
|
|
983
983
|
registerNodeType(e, o) {
|
|
984
984
|
const t = this.getShapeName(e);
|
|
985
985
|
let s = this.wrappedComponents.get(e);
|
|
986
|
-
return s || (s =
|
|
986
|
+
return s || (s = pe({
|
|
987
987
|
name: `FlowCanvasNodeShape${e.replace(/(^|[-_])(\w)/g, (r, i, l) => l.toUpperCase())}`,
|
|
988
988
|
setup() {
|
|
989
989
|
return () => qe("div", { class: "flow-canvas-node-surface" }, [qe(o)]);
|
|
@@ -1018,6 +1018,10 @@ class Xt {
|
|
|
1018
1018
|
this.onUiEvent({ type: "node.click", nodeId: e.id });
|
|
1019
1019
|
}), this.on("node:dblclick", ({ node: e }) => {
|
|
1020
1020
|
this.onUiEvent({ type: "node.dblclick", nodeId: e.id });
|
|
1021
|
+
}), this.on("node:mouseenter", ({ node: e }) => {
|
|
1022
|
+
this.onUiEvent({ type: "node.mouseenter", nodeId: e.id });
|
|
1023
|
+
}), this.on("node:mouseleave", ({ node: e }) => {
|
|
1024
|
+
this.onUiEvent({ type: "node.mouseleave", nodeId: e.id });
|
|
1021
1025
|
}), this.on("node:contextmenu", ({ node: e, e: o }) => {
|
|
1022
1026
|
this.onUiEvent({
|
|
1023
1027
|
type: "node.contextmenu",
|
|
@@ -1027,11 +1031,11 @@ class Xt {
|
|
|
1027
1031
|
}), this.on("edge:click", ({ edge: e, e: o }) => {
|
|
1028
1032
|
const s = o.target?.closest?.(".x6-edge-label");
|
|
1029
1033
|
if (s) {
|
|
1030
|
-
const i = e.getData?.()?.labels ?? [], l = s.parentElement?.querySelectorAll(".x6-edge-label"), a = l ? Array.from(l).indexOf(s) : 0,
|
|
1034
|
+
const i = e.getData?.()?.labels ?? [], l = s.parentElement?.querySelectorAll(".x6-edge-label"), a = l ? Array.from(l).indexOf(s) : 0, h = i[Math.max(0, a)];
|
|
1031
1035
|
this.onUiEvent({
|
|
1032
1036
|
type: "edge.label.click",
|
|
1033
1037
|
edgeId: e.id,
|
|
1034
|
-
labelId:
|
|
1038
|
+
labelId: h?.id ?? `label-${a}`
|
|
1035
1039
|
});
|
|
1036
1040
|
return;
|
|
1037
1041
|
}
|
|
@@ -1047,7 +1051,7 @@ class Xt {
|
|
|
1047
1051
|
}), this.on("node:moved", ({ node: e }) => {
|
|
1048
1052
|
const o = e.getPosition();
|
|
1049
1053
|
this.onCommand({
|
|
1050
|
-
id:
|
|
1054
|
+
id: ee(),
|
|
1051
1055
|
source: "user:drag",
|
|
1052
1056
|
label: "移动节点",
|
|
1053
1057
|
timestamp: Date.now(),
|
|
@@ -1058,7 +1062,7 @@ class Xt {
|
|
|
1058
1062
|
if (!t || !s) return;
|
|
1059
1063
|
const r = e.getSourcePortId(), i = e.getTargetPortId(), l = e.id in this.flowModelRef.value.edges;
|
|
1060
1064
|
o && !l ? (this.graph.removeCell(e), this.onCommand({
|
|
1061
|
-
id:
|
|
1065
|
+
id: ee(),
|
|
1062
1066
|
source: "user:drag",
|
|
1063
1067
|
label: "连线",
|
|
1064
1068
|
timestamp: Date.now(),
|
|
@@ -1073,7 +1077,7 @@ class Xt {
|
|
|
1073
1077
|
}
|
|
1074
1078
|
]
|
|
1075
1079
|
})) : this.onCommand({
|
|
1076
|
-
id:
|
|
1080
|
+
id: ee(),
|
|
1077
1081
|
source: "user:drag",
|
|
1078
1082
|
label: "重连",
|
|
1079
1083
|
timestamp: Date.now(),
|
|
@@ -1093,16 +1097,16 @@ class Xt {
|
|
|
1093
1097
|
for (let i = 0; i < Math.min(s.length, o.length); i++) {
|
|
1094
1098
|
const l = o[i], a = s[i];
|
|
1095
1099
|
if (!a?.id) continue;
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1100
|
+
const h = typeof l.position == "object" ? l.position?.distance : l.position;
|
|
1101
|
+
h != null && r.push({
|
|
1098
1102
|
type: "edge.label.update",
|
|
1099
1103
|
edgeId: e.id,
|
|
1100
1104
|
labelId: a.id,
|
|
1101
|
-
patch: { position:
|
|
1105
|
+
patch: { position: h }
|
|
1102
1106
|
});
|
|
1103
1107
|
}
|
|
1104
1108
|
r.length && this.onCommand({
|
|
1105
|
-
id:
|
|
1109
|
+
id: ee(),
|
|
1106
1110
|
source: "user:drag",
|
|
1107
1111
|
label: "拖动标签",
|
|
1108
1112
|
timestamp: Date.now(),
|
|
@@ -1115,14 +1119,23 @@ class Xt {
|
|
|
1115
1119
|
}
|
|
1116
1120
|
}
|
|
1117
1121
|
function Kt(n) {
|
|
1118
|
-
function e(
|
|
1119
|
-
const
|
|
1120
|
-
if (!
|
|
1121
|
-
const
|
|
1122
|
-
return new DOMRect(
|
|
1122
|
+
function e(t) {
|
|
1123
|
+
const s = n.getCellById(t);
|
|
1124
|
+
if (!s || !s.isNode()) return null;
|
|
1125
|
+
const r = s, i = r.getPosition(), l = r.getSize(), a = { x: i.x, y: i.y, width: l.width, height: l.height }, h = n.localToGraph(a);
|
|
1126
|
+
return new DOMRect(h.x, h.y, h.width, h.height);
|
|
1127
|
+
}
|
|
1128
|
+
function o(t) {
|
|
1129
|
+
const s = e(t);
|
|
1130
|
+
if (!s) return null;
|
|
1131
|
+
const r = n.container;
|
|
1132
|
+
if (!r || typeof r.getBoundingClientRect != "function") return s;
|
|
1133
|
+
const i = r.getBoundingClientRect();
|
|
1134
|
+
return new DOMRect(s.x + i.left, s.y + i.top, s.width, s.height);
|
|
1123
1135
|
}
|
|
1124
1136
|
return {
|
|
1125
|
-
getNodeScreenRect: e
|
|
1137
|
+
getNodeScreenRect: e,
|
|
1138
|
+
getNodeViewportRect: o
|
|
1126
1139
|
};
|
|
1127
1140
|
}
|
|
1128
1141
|
const Yt = Object.freeze({
|
|
@@ -1185,7 +1198,7 @@ function to({
|
|
|
1185
1198
|
idGenerator: i,
|
|
1186
1199
|
defaultInsertGap: l,
|
|
1187
1200
|
getContextMenuItems: a,
|
|
1188
|
-
onHighlightChange:
|
|
1201
|
+
onHighlightChange: h,
|
|
1189
1202
|
resolveNodeShape: f
|
|
1190
1203
|
}) {
|
|
1191
1204
|
const p = i ?? ze;
|
|
@@ -1217,16 +1230,16 @@ function to({
|
|
|
1217
1230
|
b = null;
|
|
1218
1231
|
const c = d.getPosition();
|
|
1219
1232
|
n.removeNode(d.id);
|
|
1220
|
-
const { _dndSessionId: g, ...
|
|
1233
|
+
const { _dndSessionId: g, ...v } = y, m = v.id || p("node");
|
|
1221
1234
|
o({
|
|
1222
|
-
id:
|
|
1235
|
+
id: ee(),
|
|
1223
1236
|
source: "user:drag",
|
|
1224
1237
|
label: "拖入节点",
|
|
1225
1238
|
timestamp: Date.now(),
|
|
1226
1239
|
commands: [
|
|
1227
1240
|
{
|
|
1228
1241
|
type: "node.add",
|
|
1229
|
-
node: { ...
|
|
1242
|
+
node: { ...v, id: m, position: { x: c.x, y: c.y } }
|
|
1230
1243
|
}
|
|
1231
1244
|
]
|
|
1232
1245
|
});
|
|
@@ -1239,26 +1252,26 @@ function to({
|
|
|
1239
1252
|
function k(d) {
|
|
1240
1253
|
return d ?? ft(n.getSelectedCells?.() ?? []);
|
|
1241
1254
|
}
|
|
1242
|
-
function X(d, y, c, g,
|
|
1255
|
+
function X(d, y, c, g, v) {
|
|
1243
1256
|
switch (d) {
|
|
1244
1257
|
case "left":
|
|
1245
1258
|
return {
|
|
1246
|
-
x: y.position.x -
|
|
1259
|
+
x: y.position.x - v - g.width,
|
|
1247
1260
|
y: y.position.y + (c.height - g.height) / 2
|
|
1248
1261
|
};
|
|
1249
1262
|
case "top":
|
|
1250
1263
|
return {
|
|
1251
1264
|
x: y.position.x + (c.width - g.width) / 2,
|
|
1252
|
-
y: y.position.y -
|
|
1265
|
+
y: y.position.y - v - g.height
|
|
1253
1266
|
};
|
|
1254
1267
|
case "bottom":
|
|
1255
1268
|
return {
|
|
1256
1269
|
x: y.position.x + (c.width - g.width) / 2,
|
|
1257
|
-
y: y.position.y + c.height +
|
|
1270
|
+
y: y.position.y + c.height + v
|
|
1258
1271
|
};
|
|
1259
1272
|
default:
|
|
1260
1273
|
return {
|
|
1261
|
-
x: y.position.x + c.width +
|
|
1274
|
+
x: y.position.x + c.width + v,
|
|
1262
1275
|
y: y.position.y + (c.height - g.height) / 2
|
|
1263
1276
|
};
|
|
1264
1277
|
}
|
|
@@ -1322,20 +1335,20 @@ function to({
|
|
|
1322
1335
|
deleteSelection(d) {
|
|
1323
1336
|
const y = k(d?.selection), c = gt(y, s.value, r ?? (() => ({}))), g = Jt(c);
|
|
1324
1337
|
if (g.length === 0) return null;
|
|
1325
|
-
const
|
|
1326
|
-
id:
|
|
1338
|
+
const v = o({
|
|
1339
|
+
id: ee(),
|
|
1327
1340
|
source: d?.source ?? "user:toolbar",
|
|
1328
1341
|
label: d?.label ?? "删除选中",
|
|
1329
1342
|
timestamp: Date.now(),
|
|
1330
1343
|
commands: g
|
|
1331
1344
|
});
|
|
1332
|
-
return
|
|
1345
|
+
return v.status === "applied" && d?.clearSelectionAfterApply !== !1 && G.clearSelection(), v;
|
|
1333
1346
|
},
|
|
1334
1347
|
registerDndSource(d, y) {
|
|
1335
1348
|
const c = async (g) => {
|
|
1336
|
-
const
|
|
1337
|
-
if (!
|
|
1338
|
-
const m =
|
|
1349
|
+
const v = await S();
|
|
1350
|
+
if (!v) return;
|
|
1351
|
+
const m = ee();
|
|
1339
1352
|
b = m;
|
|
1340
1353
|
const E = y(), L = f?.(E.type), z = n.createNode({
|
|
1341
1354
|
width: L?.width ?? 154,
|
|
@@ -1343,7 +1356,7 @@ function to({
|
|
|
1343
1356
|
shape: L?.shapeName ?? "rect",
|
|
1344
1357
|
data: { ...E, _dndSessionId: m }
|
|
1345
1358
|
});
|
|
1346
|
-
|
|
1359
|
+
v.start(z, g);
|
|
1347
1360
|
};
|
|
1348
1361
|
return d.addEventListener("mousedown", c), () => {
|
|
1349
1362
|
d.removeEventListener("mousedown", c);
|
|
@@ -1356,12 +1369,12 @@ function to({
|
|
|
1356
1369
|
startConnection(d, y) {
|
|
1357
1370
|
const c = n.getCellById(d);
|
|
1358
1371
|
if (!c?.isNode()) return;
|
|
1359
|
-
const g = c,
|
|
1360
|
-
if (!
|
|
1361
|
-
const m =
|
|
1372
|
+
const g = c, v = n.findViewByCell(g);
|
|
1373
|
+
if (!v) return;
|
|
1374
|
+
const m = v.findPortElem(y, "circle") ?? v.findPortElem(y);
|
|
1362
1375
|
if (!m) return;
|
|
1363
|
-
const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(),
|
|
1364
|
-
clientX:
|
|
1376
|
+
const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(), de = z.left + z.width / 2, N = z.top + z.height / 2, _ = new MouseEvent("mousedown", {
|
|
1377
|
+
clientX: de,
|
|
1365
1378
|
clientY: N,
|
|
1366
1379
|
button: 0,
|
|
1367
1380
|
buttons: 1,
|
|
@@ -1371,93 +1384,98 @@ function to({
|
|
|
1371
1384
|
L.dispatchEvent(_);
|
|
1372
1385
|
},
|
|
1373
1386
|
async exportAsImage(d) {
|
|
1374
|
-
const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? n.options.background?.color ?? "#ffffff",
|
|
1387
|
+
const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? n.options.background?.color ?? "#ffffff", v = n.zoom(), m = n.translate(), E = n.getContentBBox(), L = E.width / v, z = E.height / v;
|
|
1375
1388
|
if (L === 0 || z === 0)
|
|
1376
1389
|
return new Blob();
|
|
1377
|
-
const
|
|
1390
|
+
const de = (E.x - m.tx) / v, N = (E.y - m.ty) / v, _ = Math.ceil(L + c * 2), x = Math.ceil(z + c * 2), R = document.createElement("div");
|
|
1378
1391
|
R.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1392
|
+
const q = /* @__PURE__ */ new Set();
|
|
1393
|
+
let Y = n.container.parentElement;
|
|
1394
|
+
for (; Y && Y !== document.body && Y !== document.documentElement; )
|
|
1395
|
+
Y.classList.forEach((ne) => q.add(ne)), Y = Y.parentElement;
|
|
1396
|
+
q.size > 0 && (R.className = Array.from(q).join(" "));
|
|
1397
|
+
const J = n.container.cloneNode(!0);
|
|
1398
|
+
J.style.width = `${_}px`, J.style.height = `${x}px`, J.style.overflow = "visible";
|
|
1399
|
+
const Z = J.querySelector("svg");
|
|
1400
|
+
Z && (Z.setAttribute("width", String(_)), Z.setAttribute("height", String(x)), Z.style.width = `${_}px`, Z.style.height = `${x}px`), J.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-de + c},${-N + c})`), R.appendChild(J), document.body.appendChild(R);
|
|
1383
1401
|
try {
|
|
1384
|
-
return await M(), await y(
|
|
1402
|
+
return await M(), await y(J, {
|
|
1385
1403
|
width: _,
|
|
1386
1404
|
height: x,
|
|
1387
1405
|
backgroundColor: g,
|
|
1388
1406
|
scale: d?.scale ?? window.devicePixelRatio,
|
|
1389
|
-
filter: (
|
|
1390
|
-
if (
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1407
|
+
filter: (ne) => {
|
|
1408
|
+
if (ne instanceof Element) {
|
|
1409
|
+
const re = ne.getAttribute("class") ?? "";
|
|
1410
|
+
if (re.includes("x6-widget-selection") || re.includes("x6-widget-transform") || re.includes("x6-graph-grid") || re.includes("x6-graph-background"))
|
|
1393
1411
|
return !1;
|
|
1394
1412
|
}
|
|
1395
1413
|
return !0;
|
|
1396
1414
|
}
|
|
1397
1415
|
});
|
|
1398
|
-
} catch (
|
|
1399
|
-
return console.warn("[flow-canvas] Export failed:",
|
|
1416
|
+
} catch (ne) {
|
|
1417
|
+
return console.warn("[flow-canvas] Export failed:", ne), new Blob();
|
|
1400
1418
|
} finally {
|
|
1401
1419
|
R.remove();
|
|
1402
1420
|
}
|
|
1403
1421
|
},
|
|
1404
1422
|
highlightNodes(d) {
|
|
1405
|
-
u = d,
|
|
1423
|
+
u = d, h?.(u, w);
|
|
1406
1424
|
},
|
|
1407
1425
|
highlightEdges(d) {
|
|
1408
|
-
w = d,
|
|
1426
|
+
w = d, h?.(u, w);
|
|
1409
1427
|
},
|
|
1410
1428
|
clearHighlight() {
|
|
1411
|
-
u = [], w = [],
|
|
1429
|
+
u = [], w = [], h?.([], []);
|
|
1412
1430
|
},
|
|
1413
1431
|
overlay: e,
|
|
1414
1432
|
getContextMenuItems(d) {
|
|
1415
1433
|
return a?.(d) ?? [];
|
|
1416
1434
|
},
|
|
1417
1435
|
insertNodeToRight(d, y, c) {
|
|
1418
|
-
const g = s.value,
|
|
1419
|
-
if (!
|
|
1436
|
+
const g = s.value, v = g.nodes[d];
|
|
1437
|
+
if (!v)
|
|
1420
1438
|
return {
|
|
1421
1439
|
status: "invalid",
|
|
1422
1440
|
envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
|
|
1423
1441
|
error: { code: "constraint_violated", reason: `Source node "${d}" not found`, source: "api" }
|
|
1424
1442
|
};
|
|
1425
|
-
const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[
|
|
1443
|
+
const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[v.type], z = t.nodeTypes[y.type], de = L?.getSize(v) ?? { width: 154, height: 54 }, N = z?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
|
|
1426
1444
|
width: 154,
|
|
1427
1445
|
height: 54
|
|
1428
|
-
}, _ = X(E,
|
|
1446
|
+
}, _ = X(E, v, de, N, m), x = y.id || p("node"), R = { ...y, id: x, position: _ }, q = [{ type: "node.add", node: R }];
|
|
1429
1447
|
if (c?.autoWireEdges) {
|
|
1430
|
-
const
|
|
1431
|
-
(I) => I.source.nodeId === d && I.source.portId ===
|
|
1448
|
+
const J = j(v), Z = j(R), Q = E, ne = U(E), re = J.find((I) => I.group === Q), we = Z.find((I) => I.group === ne), $e = Z.find((I) => I.group === Q), Se = re ? Object.values(g.edges).find(
|
|
1449
|
+
(I) => I.source.nodeId === d && I.source.portId === re.id
|
|
1432
1450
|
) : Object.values(g.edges).find((I) => I.source.nodeId === d);
|
|
1433
1451
|
if (Se) {
|
|
1434
|
-
const I = Se.target, C = N.width + m, P = E === "right" ? C : E === "left" ? -C : 0, W = E === "bottom" ? C : E === "top" ? -C : 0,
|
|
1435
|
-
for (;
|
|
1436
|
-
const
|
|
1437
|
-
if (
|
|
1438
|
-
|
|
1439
|
-
const xe = g.nodes[
|
|
1452
|
+
const I = Se.target, C = N.width + m, P = E === "right" ? C : E === "left" ? -C : 0, W = E === "bottom" ? C : E === "top" ? -C : 0, te = /* @__PURE__ */ new Set(), ce = [I.nodeId];
|
|
1453
|
+
for (; ce.length > 0; ) {
|
|
1454
|
+
const se = ce.shift();
|
|
1455
|
+
if (te.has(se) || se === d) continue;
|
|
1456
|
+
te.add(se);
|
|
1457
|
+
const xe = g.nodes[se];
|
|
1440
1458
|
if (xe) {
|
|
1441
|
-
|
|
1459
|
+
q.push({
|
|
1442
1460
|
type: "node.move",
|
|
1443
|
-
nodeId:
|
|
1461
|
+
nodeId: se,
|
|
1444
1462
|
position: {
|
|
1445
1463
|
x: xe.position.x + P,
|
|
1446
1464
|
y: xe.position.y + W
|
|
1447
1465
|
}
|
|
1448
1466
|
});
|
|
1449
1467
|
for (const be of Object.values(g.edges))
|
|
1450
|
-
be.source.nodeId ===
|
|
1468
|
+
be.source.nodeId === se && !te.has(be.target.nodeId) && ce.push(be.target.nodeId);
|
|
1451
1469
|
}
|
|
1452
1470
|
}
|
|
1453
|
-
|
|
1471
|
+
q.push({ type: "edge.remove", edgeId: Se.id }), q.push({
|
|
1454
1472
|
type: "edge.add",
|
|
1455
1473
|
edge: {
|
|
1456
1474
|
id: p("edge"),
|
|
1457
|
-
source: { nodeId: d, portId:
|
|
1475
|
+
source: { nodeId: d, portId: re?.id },
|
|
1458
1476
|
target: { nodeId: x, portId: we?.id }
|
|
1459
1477
|
}
|
|
1460
|
-
}),
|
|
1478
|
+
}), q.push({
|
|
1461
1479
|
type: "edge.add",
|
|
1462
1480
|
edge: {
|
|
1463
1481
|
id: p("edge"),
|
|
@@ -1466,23 +1484,23 @@ function to({
|
|
|
1466
1484
|
}
|
|
1467
1485
|
});
|
|
1468
1486
|
} else
|
|
1469
|
-
|
|
1487
|
+
q.push({
|
|
1470
1488
|
type: "edge.add",
|
|
1471
1489
|
edge: {
|
|
1472
1490
|
id: p("edge"),
|
|
1473
|
-
source: { nodeId: d, portId:
|
|
1491
|
+
source: { nodeId: d, portId: re?.id },
|
|
1474
1492
|
target: { nodeId: x, portId: we?.id }
|
|
1475
1493
|
}
|
|
1476
1494
|
});
|
|
1477
1495
|
}
|
|
1478
|
-
const
|
|
1479
|
-
id:
|
|
1496
|
+
const Y = {
|
|
1497
|
+
id: ee(),
|
|
1480
1498
|
source: c?.source ?? "user:toolbar",
|
|
1481
1499
|
label: c?.label ?? "插入节点",
|
|
1482
1500
|
timestamp: Date.now(),
|
|
1483
|
-
commands:
|
|
1501
|
+
commands: q
|
|
1484
1502
|
};
|
|
1485
|
-
return o(
|
|
1503
|
+
return o(Y);
|
|
1486
1504
|
},
|
|
1487
1505
|
onGraphEvent(d, y) {
|
|
1488
1506
|
return n.on(d, y), () => n.off(d, y);
|
|
@@ -1513,13 +1531,13 @@ function oo() {
|
|
|
1513
1531
|
function a() {
|
|
1514
1532
|
o && (clearTimeout(o), o = null);
|
|
1515
1533
|
}
|
|
1516
|
-
function
|
|
1534
|
+
function h() {
|
|
1517
1535
|
a(), t = !1, n.value = null;
|
|
1518
1536
|
}
|
|
1519
1537
|
function f() {
|
|
1520
1538
|
o && clearTimeout(o);
|
|
1521
1539
|
}
|
|
1522
|
-
return { hoveredNodeId: n, isDraggingNode: e, enter: s, leave: r, enterOverlay: i, leaveOverlay: l, cancelLeave: a, reset:
|
|
1540
|
+
return { hoveredNodeId: n, isDraggingNode: e, enter: s, leave: r, enterOverlay: i, leaveOverlay: l, cancelLeave: a, reset: h, cleanup: f };
|
|
1523
1541
|
}
|
|
1524
1542
|
const Xe = 10, Ae = 12;
|
|
1525
1543
|
function Ke(n, e) {
|
|
@@ -1532,8 +1550,8 @@ function Ke(n, e) {
|
|
|
1532
1550
|
const u = p * i, w = n.getPointAtLength(u), D = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
|
|
1533
1551
|
D < s && (s = D, t = w, l = u);
|
|
1534
1552
|
}
|
|
1535
|
-
const a = Math.max(0, l - i),
|
|
1536
|
-
for (let p = a; p <=
|
|
1553
|
+
const a = Math.max(0, l - i), h = Math.min(o, l + i), f = (h - a) / 20;
|
|
1554
|
+
for (let p = a; p <= h; p += f) {
|
|
1537
1555
|
const u = n.getPointAtLength(p), w = (u.x - e.x) ** 2 + (u.y - e.y) ** 2;
|
|
1538
1556
|
w < s && (s = w, t = u, l = p);
|
|
1539
1557
|
}
|
|
@@ -1580,9 +1598,9 @@ function no(n) {
|
|
|
1580
1598
|
e && e.setAttribute("display", "none");
|
|
1581
1599
|
return;
|
|
1582
1600
|
}
|
|
1583
|
-
const
|
|
1584
|
-
if (!
|
|
1585
|
-
const f = n.findViewByCell(
|
|
1601
|
+
const h = n.getCellById(o);
|
|
1602
|
+
if (!h?.isEdge()) return;
|
|
1603
|
+
const f = n.findViewByCell(h);
|
|
1586
1604
|
if (!f) return;
|
|
1587
1605
|
const p = f.container.querySelector("path");
|
|
1588
1606
|
if (!p) return;
|
|
@@ -1639,7 +1657,7 @@ function so(n) {
|
|
|
1639
1657
|
function a(f) {
|
|
1640
1658
|
f === e && (e = null, t(!1));
|
|
1641
1659
|
}
|
|
1642
|
-
function
|
|
1660
|
+
function h() {
|
|
1643
1661
|
return !e && Date.now() >= o;
|
|
1644
1662
|
}
|
|
1645
1663
|
return {
|
|
@@ -1648,14 +1666,14 @@ function so(n) {
|
|
|
1648
1666
|
handleEdgeAdded: i,
|
|
1649
1667
|
handleEdgeConnected: l,
|
|
1650
1668
|
handleEdgeRemoved: a,
|
|
1651
|
-
canShowEdgeTool:
|
|
1669
|
+
canShowEdgeTool: h
|
|
1652
1670
|
};
|
|
1653
1671
|
}
|
|
1654
1672
|
function Je(n) {
|
|
1655
1673
|
return n === "top" || n === "right" || n === "bottom" || n === "left";
|
|
1656
1674
|
}
|
|
1657
1675
|
function ro(n) {
|
|
1658
|
-
const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: s, getNodeBehavior: r, getInsertGap: i } = n, { isDraggingNode: l } = n, a = H(null),
|
|
1676
|
+
const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: s, getNodeBehavior: r, getInsertGap: i } = n, { isDraggingNode: l } = n, a = H(null), h = H(!1);
|
|
1659
1677
|
let f = null, p = null, u = null;
|
|
1660
1678
|
const w = V(() => ({
|
|
1661
1679
|
enabled: !0,
|
|
@@ -1673,7 +1691,7 @@ function ro(n) {
|
|
|
1673
1691
|
}, 150);
|
|
1674
1692
|
}
|
|
1675
1693
|
function b(N) {
|
|
1676
|
-
return
|
|
1694
|
+
return h.value ? !0 : (D(), d(N) ? (a.value = N, !0) : (a.value = null, !1));
|
|
1677
1695
|
}
|
|
1678
1696
|
function S() {
|
|
1679
1697
|
D(), o.enterOverlay();
|
|
@@ -1689,7 +1707,7 @@ function ro(n) {
|
|
|
1689
1707
|
const x = w.value.getPort?.(N, _);
|
|
1690
1708
|
if (!x) return null;
|
|
1691
1709
|
const R = typeof x == "string" ? x : x.id;
|
|
1692
|
-
return _.find((
|
|
1710
|
+
return _.find((q) => q.id === R) ?? null;
|
|
1693
1711
|
}
|
|
1694
1712
|
function k(N, _) {
|
|
1695
1713
|
const x = e.api.value?.overlay.getNodeScreenRect(N);
|
|
@@ -1711,19 +1729,19 @@ function ro(n) {
|
|
|
1711
1729
|
if (!p) return k(N, x);
|
|
1712
1730
|
const R = p.getCellById(N);
|
|
1713
1731
|
if (R?.isNode()) {
|
|
1714
|
-
const
|
|
1715
|
-
if (
|
|
1716
|
-
const
|
|
1732
|
+
const q = R, Y = p.findViewByCell(q), J = Y?.findPortElem(_, "circle") ?? Y?.findPortElem(_);
|
|
1733
|
+
if (J) {
|
|
1734
|
+
const Z = p.container.getBoundingClientRect(), Q = J.getBoundingClientRect();
|
|
1717
1735
|
return {
|
|
1718
|
-
x:
|
|
1719
|
-
y:
|
|
1736
|
+
x: Q.left - Z.left + Q.width / 2,
|
|
1737
|
+
y: Q.top - Z.top + Q.height / 2
|
|
1720
1738
|
};
|
|
1721
1739
|
}
|
|
1722
1740
|
}
|
|
1723
1741
|
return k(N, x);
|
|
1724
1742
|
}
|
|
1725
1743
|
function U(N) {
|
|
1726
|
-
const _ = B(N), x = j(N, _) ?? _.find((
|
|
1744
|
+
const _ = B(N), x = j(N, _) ?? _.find((q) => q.group === w.value.portGroup) ?? null;
|
|
1727
1745
|
if (!x) return null;
|
|
1728
1746
|
const R = X(N.id, x.id, x.group);
|
|
1729
1747
|
return R ? { portId: x.id, portGroup: x.group, portPosition: R } : null;
|
|
@@ -1751,16 +1769,16 @@ function ro(n) {
|
|
|
1751
1769
|
if (!x) return null;
|
|
1752
1770
|
const R = r(x);
|
|
1753
1771
|
if (R.quickAddEnabled === !1) return null;
|
|
1754
|
-
const
|
|
1755
|
-
return
|
|
1772
|
+
const q = U(x);
|
|
1773
|
+
return q ? { node: x, ...q, behavior: R } : null;
|
|
1756
1774
|
});
|
|
1757
1775
|
function c(N) {
|
|
1758
|
-
|
|
1776
|
+
h.value = !0, y.value && e._emitUiEvent({ type: "node.quick-add", nodeId: N, position: y.value.portPosition });
|
|
1759
1777
|
}
|
|
1760
1778
|
function g() {
|
|
1761
|
-
|
|
1779
|
+
h.value = !1;
|
|
1762
1780
|
}
|
|
1763
|
-
function
|
|
1781
|
+
function v(N) {
|
|
1764
1782
|
const _ = e.api.value;
|
|
1765
1783
|
if (!_) return;
|
|
1766
1784
|
const x = e.flowModel.value.nodes[N];
|
|
@@ -1776,11 +1794,11 @@ function ro(n) {
|
|
|
1776
1794
|
function E(N, _) {
|
|
1777
1795
|
const x = e.api.value;
|
|
1778
1796
|
if (!x) return;
|
|
1779
|
-
const R = _.id || e.idGenerator("node"),
|
|
1780
|
-
if (!
|
|
1781
|
-
x.insertNodeToRight(N,
|
|
1797
|
+
const R = _.id || e.idGenerator("node"), q = { ..._, id: R }, Y = e.flowModel.value.nodes[N];
|
|
1798
|
+
if (!Y) return;
|
|
1799
|
+
x.insertNodeToRight(N, q, {
|
|
1782
1800
|
autoWireEdges: !0,
|
|
1783
|
-
direction: G(
|
|
1801
|
+
direction: G(Y),
|
|
1784
1802
|
gap: i(),
|
|
1785
1803
|
source: "user:quick-add",
|
|
1786
1804
|
label: "快捷插入节点"
|
|
@@ -1792,37 +1810,37 @@ function ro(n) {
|
|
|
1792
1810
|
if (!_?.isNode()) return;
|
|
1793
1811
|
const x = _, R = e.flowModel.value.nodes[N];
|
|
1794
1812
|
if (!R) return;
|
|
1795
|
-
const
|
|
1796
|
-
let
|
|
1797
|
-
r(R).hidePortForQuickAdd === !1 && (
|
|
1798
|
-
const
|
|
1799
|
-
for (const
|
|
1800
|
-
const
|
|
1801
|
-
x.setPortProp(
|
|
1813
|
+
const q = U(R);
|
|
1814
|
+
let Y = !0;
|
|
1815
|
+
r(R).hidePortForQuickAdd === !1 && (Y = !1);
|
|
1816
|
+
const Z = Y && !l.value && !!q && d(N);
|
|
1817
|
+
for (const Q of x.getPorts()) {
|
|
1818
|
+
const ne = Z && Q.id === q?.portId ? "hidden" : "visible";
|
|
1819
|
+
x.setPortProp(Q.id, "attrs/circle/visibility", ne);
|
|
1802
1820
|
}
|
|
1803
1821
|
}
|
|
1804
1822
|
function z(N, _) {
|
|
1805
|
-
u?.(), p = N, u =
|
|
1823
|
+
u?.(), p = N, u = he(
|
|
1806
1824
|
[a, l],
|
|
1807
1825
|
([x], [R]) => {
|
|
1808
1826
|
if (R && R !== x) {
|
|
1809
|
-
const
|
|
1810
|
-
|
|
1827
|
+
const q = N.getCellById(R);
|
|
1828
|
+
q?.isNode() && _(q);
|
|
1811
1829
|
}
|
|
1812
1830
|
x && L(x);
|
|
1813
1831
|
},
|
|
1814
1832
|
{ flush: "sync" }
|
|
1815
1833
|
);
|
|
1816
1834
|
}
|
|
1817
|
-
|
|
1818
|
-
N || (
|
|
1835
|
+
he(y, (N) => {
|
|
1836
|
+
N || (h.value = !1);
|
|
1819
1837
|
});
|
|
1820
|
-
function
|
|
1838
|
+
function de() {
|
|
1821
1839
|
f && clearTimeout(f), u?.(), u = null, p = null;
|
|
1822
1840
|
}
|
|
1823
1841
|
return {
|
|
1824
1842
|
quickAddNodeId: a,
|
|
1825
|
-
quickAddPopoverOpen:
|
|
1843
|
+
quickAddPopoverOpen: h,
|
|
1826
1844
|
mergedConfig: w,
|
|
1827
1845
|
data: y,
|
|
1828
1846
|
enter: b,
|
|
@@ -1832,13 +1850,13 @@ function ro(n) {
|
|
|
1832
1850
|
handleOverlayLeave: M,
|
|
1833
1851
|
handleOpen: c,
|
|
1834
1852
|
handleClose: g,
|
|
1835
|
-
handleStartDrag:
|
|
1853
|
+
handleStartDrag: v,
|
|
1836
1854
|
handlePopoverViewportOverflow: m,
|
|
1837
1855
|
handleInsert: E,
|
|
1838
1856
|
isActiveForNode: d,
|
|
1839
1857
|
syncNodePorts: L,
|
|
1840
1858
|
attachRuntime: z,
|
|
1841
|
-
cleanup:
|
|
1859
|
+
cleanup: de
|
|
1842
1860
|
};
|
|
1843
1861
|
}
|
|
1844
1862
|
const io = 15, ao = 10;
|
|
@@ -1854,36 +1872,36 @@ function lo(n) {
|
|
|
1854
1872
|
outgoingPortGroup: "right",
|
|
1855
1873
|
...n.edgeDropProp.value
|
|
1856
1874
|
}));
|
|
1857
|
-
function
|
|
1875
|
+
function h(d) {
|
|
1858
1876
|
if (!o) return null;
|
|
1859
1877
|
const y = o.getCellById(d);
|
|
1860
1878
|
if (!y?.isEdge()) return null;
|
|
1861
1879
|
const c = o.findViewByCell(y)?.container;
|
|
1862
1880
|
if (!c) return null;
|
|
1863
1881
|
const g = c.querySelectorAll("path");
|
|
1864
|
-
for (const
|
|
1865
|
-
if (
|
|
1882
|
+
for (const v of g)
|
|
1883
|
+
if (v.getAttribute("stroke") !== "transparent") return v;
|
|
1866
1884
|
return null;
|
|
1867
1885
|
}
|
|
1868
1886
|
function f(d) {
|
|
1869
|
-
const y =
|
|
1887
|
+
const y = h(d);
|
|
1870
1888
|
y && (y.style.stroke = "#3a84ff", r = d);
|
|
1871
1889
|
}
|
|
1872
1890
|
function p() {
|
|
1873
1891
|
if (!r) return;
|
|
1874
|
-
const d =
|
|
1892
|
+
const d = h(r);
|
|
1875
1893
|
d && (d.style.stroke = ""), r = null;
|
|
1876
1894
|
}
|
|
1877
1895
|
function u(d, y, c) {
|
|
1878
1896
|
if (o) {
|
|
1879
1897
|
const g = o.getCellById(d);
|
|
1880
1898
|
if (g?.isNode()) {
|
|
1881
|
-
const
|
|
1882
|
-
if (
|
|
1899
|
+
const v = g.getPorts().find((m) => m.group === c);
|
|
1900
|
+
if (v?.id) return v.id;
|
|
1883
1901
|
}
|
|
1884
1902
|
}
|
|
1885
1903
|
if (y.ports?.length) {
|
|
1886
|
-
const g = y.ports.find((
|
|
1904
|
+
const g = y.ports.find((v) => v.group === c);
|
|
1887
1905
|
if (g) return g.id;
|
|
1888
1906
|
}
|
|
1889
1907
|
return c;
|
|
@@ -1892,8 +1910,8 @@ function lo(n) {
|
|
|
1892
1910
|
const y = d.getTotalLength();
|
|
1893
1911
|
if (y === 0) return [];
|
|
1894
1912
|
const c = [];
|
|
1895
|
-
for (let
|
|
1896
|
-
const m = d.getPointAtLength(
|
|
1913
|
+
for (let v = 0; v <= y; v += ao) {
|
|
1914
|
+
const m = d.getPointAtLength(v);
|
|
1897
1915
|
c.push({ x: m.x, y: m.y });
|
|
1898
1916
|
}
|
|
1899
1917
|
const g = d.getPointAtLength(y);
|
|
@@ -1901,39 +1919,39 @@ function lo(n) {
|
|
|
1901
1919
|
}
|
|
1902
1920
|
function D(d, y, c) {
|
|
1903
1921
|
if (!o) return null;
|
|
1904
|
-
const g = a.value,
|
|
1905
|
-
x: d.x +
|
|
1906
|
-
y: d.y +
|
|
1907
|
-
width: Math.max(0, d.width -
|
|
1908
|
-
height: Math.max(0, d.height -
|
|
1922
|
+
const g = a.value, v = g.bufferMargin, m = {
|
|
1923
|
+
x: d.x + v,
|
|
1924
|
+
y: d.y + v,
|
|
1925
|
+
width: Math.max(0, d.width - v * 2),
|
|
1926
|
+
height: Math.max(0, d.height - v * 2)
|
|
1909
1927
|
};
|
|
1910
1928
|
if (m.width <= 0 || m.height <= 0) return null;
|
|
1911
1929
|
const E = m.x + m.width, L = m.y + m.height;
|
|
1912
1930
|
let z = null;
|
|
1913
|
-
const
|
|
1931
|
+
const de = d.x + d.width / 2, N = d.y + d.height / 2;
|
|
1914
1932
|
for (const _ of o.getEdges()) {
|
|
1915
1933
|
const x = y.edges[_.id];
|
|
1916
1934
|
if (!x || c && (x.source.nodeId === c || x.target.nodeId === c) || g.isEdgeDropTarget && !g.isEdgeDropTarget(x, y)) continue;
|
|
1917
1935
|
const R = o.findViewByCell(_);
|
|
1918
1936
|
if (!R) continue;
|
|
1919
|
-
const
|
|
1920
|
-
if (!
|
|
1921
|
-
const
|
|
1922
|
-
if (!
|
|
1923
|
-
let
|
|
1924
|
-
for (const
|
|
1925
|
-
if (
|
|
1926
|
-
const
|
|
1927
|
-
we <
|
|
1937
|
+
const q = R.findOne?.("path");
|
|
1938
|
+
if (!q || typeof q.getTotalLength != "function") continue;
|
|
1939
|
+
const Y = w(q);
|
|
1940
|
+
if (!Y.length) continue;
|
|
1941
|
+
let J = !1, Z = 1 / 0;
|
|
1942
|
+
for (const Q of Y)
|
|
1943
|
+
if (Q.x >= m.x && Q.x <= E && Q.y >= m.y && Q.y <= L) {
|
|
1944
|
+
const ne = Q.x - de, re = Q.y - N, we = ne * ne + re * re;
|
|
1945
|
+
we < Z && (Z = we), J = !0;
|
|
1928
1946
|
}
|
|
1929
|
-
|
|
1947
|
+
J && (!z || Z < z.distSq) && (z = { edgeId: _.id, edge: x, distSq: Z });
|
|
1930
1948
|
}
|
|
1931
1949
|
return z ? { edgeId: z.edgeId, edge: z.edge } : null;
|
|
1932
1950
|
}
|
|
1933
1951
|
function O(d, y) {
|
|
1934
1952
|
if (!a.value.enabled) return;
|
|
1935
|
-
const g = e.flowModel.value,
|
|
1936
|
-
|
|
1953
|
+
const g = e.flowModel.value, v = D(d, g, y);
|
|
1954
|
+
v ? t !== v.edgeId && (p(), t = v.edgeId, f(v.edgeId)) : t && (p(), t = null);
|
|
1937
1955
|
}
|
|
1938
1956
|
let b = !0;
|
|
1939
1957
|
function S({ node: d }) {
|
|
@@ -1968,11 +1986,11 @@ function lo(n) {
|
|
|
1968
1986
|
}
|
|
1969
1987
|
d = !0, s === null && (s = requestAnimationFrame(() => {
|
|
1970
1988
|
if (s = null, !o) return;
|
|
1971
|
-
const c = y.getBoundingClientRect(), g = o.clientToLocal(c.left, c.top),
|
|
1989
|
+
const c = y.getBoundingClientRect(), g = o.clientToLocal(c.left, c.top), v = o.clientToLocal(c.right, c.bottom), m = {
|
|
1972
1990
|
x: g.x,
|
|
1973
1991
|
y: g.y,
|
|
1974
|
-
width:
|
|
1975
|
-
height:
|
|
1992
|
+
width: v.x - g.x,
|
|
1993
|
+
height: v.y - g.y
|
|
1976
1994
|
};
|
|
1977
1995
|
O(m);
|
|
1978
1996
|
}));
|
|
@@ -1989,14 +2007,14 @@ function lo(n) {
|
|
|
1989
2007
|
t = null, p();
|
|
1990
2008
|
const c = e.flowModel.value, g = c.edges[y];
|
|
1991
2009
|
if (!g) return d;
|
|
1992
|
-
const
|
|
1993
|
-
if (!
|
|
1994
|
-
const m =
|
|
2010
|
+
const v = d.commands.find((R) => R.type === "node.add" || R.type === "node.move");
|
|
2011
|
+
if (!v) return d;
|
|
2012
|
+
const m = v.type === "node.add" ? v.node.id : v.nodeId, E = v.type === "node.add" ? v.node : c.nodes[v.nodeId];
|
|
1995
2013
|
if (!E) return d;
|
|
1996
2014
|
const L = a.value;
|
|
1997
2015
|
if (L.isNodeInsertable && !L.isNodeInsertable(E, c))
|
|
1998
2016
|
return d;
|
|
1999
|
-
const z = u(m, E, L.incomingPortGroup),
|
|
2017
|
+
const z = u(m, E, L.incomingPortGroup), de = u(m, E, L.outgoingPortGroup), N = e.idGenerator("edge"), _ = e.idGenerator("edge"), x = [
|
|
2000
2018
|
{ type: "edge.remove", edgeId: y },
|
|
2001
2019
|
{
|
|
2002
2020
|
type: "edge.add",
|
|
@@ -2012,7 +2030,7 @@ function lo(n) {
|
|
|
2012
2030
|
edge: {
|
|
2013
2031
|
id: _,
|
|
2014
2032
|
type: g.type,
|
|
2015
|
-
source: { nodeId: m, portId:
|
|
2033
|
+
source: { nodeId: m, portId: de },
|
|
2016
2034
|
target: { nodeId: g.target.nodeId, portId: g.target.portId }
|
|
2017
2035
|
}
|
|
2018
2036
|
}
|
|
@@ -2057,7 +2075,7 @@ function co(n) {
|
|
|
2057
2075
|
switch (s) {
|
|
2058
2076
|
case "delete":
|
|
2059
2077
|
return n.executeCommand({
|
|
2060
|
-
id:
|
|
2078
|
+
id: ee(),
|
|
2061
2079
|
source: "user:toolbar",
|
|
2062
2080
|
label: "删除节点",
|
|
2063
2081
|
timestamp: Date.now(),
|
|
@@ -2067,9 +2085,9 @@ function co(n) {
|
|
|
2067
2085
|
if (!l) break;
|
|
2068
2086
|
const a = n.flowModel.value.nodes[r];
|
|
2069
2087
|
if (!a) break;
|
|
2070
|
-
const
|
|
2088
|
+
const h = e(a), f = 50;
|
|
2071
2089
|
n.executeCommand({
|
|
2072
|
-
id:
|
|
2090
|
+
id: ee(),
|
|
2073
2091
|
source: "user:toolbar",
|
|
2074
2092
|
label: "复制节点",
|
|
2075
2093
|
timestamp: Date.now(),
|
|
@@ -2077,7 +2095,7 @@ function co(n) {
|
|
|
2077
2095
|
{
|
|
2078
2096
|
type: "node.add",
|
|
2079
2097
|
node: {
|
|
2080
|
-
...
|
|
2098
|
+
...h,
|
|
2081
2099
|
position: {
|
|
2082
2100
|
x: a.position.x + f,
|
|
2083
2101
|
y: a.position.y + f
|
|
@@ -2085,34 +2103,34 @@ function co(n) {
|
|
|
2085
2103
|
}
|
|
2086
2104
|
}
|
|
2087
2105
|
]
|
|
2088
|
-
}), l.selectNodes([
|
|
2106
|
+
}), l.selectNodes([h.id]), n._emitUiEvent({ type: "node.action.copy", sourceNodeId: r, newNodeId: h.id });
|
|
2089
2107
|
break;
|
|
2090
2108
|
}
|
|
2091
2109
|
case "copy-insert": {
|
|
2092
2110
|
if (!l) break;
|
|
2093
2111
|
const a = n.flowModel.value.nodes[r];
|
|
2094
2112
|
if (!a) break;
|
|
2095
|
-
const
|
|
2096
|
-
l.insertNodeToRight(r,
|
|
2113
|
+
const h = e(a);
|
|
2114
|
+
l.insertNodeToRight(r, h, {
|
|
2097
2115
|
autoWireEdges: !0,
|
|
2098
2116
|
gap: i,
|
|
2099
2117
|
label: "复制并插入节点"
|
|
2100
|
-
}), l.selectNodes([
|
|
2118
|
+
}), l.selectNodes([h.id]), n._emitUiEvent({ type: "node.action.copy-insert", sourceNodeId: r, newNodeId: h.id });
|
|
2101
2119
|
break;
|
|
2102
2120
|
}
|
|
2103
2121
|
case "disconnect": {
|
|
2104
|
-
const a = n.flowModel.value,
|
|
2122
|
+
const a = n.flowModel.value, h = Object.entries(a.edges).filter(([, f]) => {
|
|
2105
2123
|
const p = f;
|
|
2106
2124
|
return p.source.nodeId === r || p.target.nodeId === r;
|
|
2107
2125
|
}).map(([f]) => f);
|
|
2108
|
-
if (
|
|
2126
|
+
if (h.length === 0) break;
|
|
2109
2127
|
n.executeCommand({
|
|
2110
|
-
id:
|
|
2128
|
+
id: ee(),
|
|
2111
2129
|
source: "user:toolbar",
|
|
2112
2130
|
label: "断开连线",
|
|
2113
2131
|
timestamp: Date.now(),
|
|
2114
|
-
commands:
|
|
2115
|
-
}), n._emitUiEvent({ type: "node.action.disconnect", nodeId: r, edgeIds:
|
|
2132
|
+
commands: h.map((f) => ({ type: "edge.remove", edgeId: f }))
|
|
2133
|
+
}), n._emitUiEvent({ type: "node.action.disconnect", nodeId: r, edgeIds: h });
|
|
2116
2134
|
break;
|
|
2117
2135
|
}
|
|
2118
2136
|
case "debug": {
|
|
@@ -2191,11 +2209,11 @@ function mo(n, e, o) {
|
|
|
2191
2209
|
for (const i of r) {
|
|
2192
2210
|
const l = n.getCellById(i);
|
|
2193
2211
|
if (!l?.isNode()) continue;
|
|
2194
|
-
const a = s.has(i),
|
|
2195
|
-
|
|
2212
|
+
const a = s.has(i), h = l.getData() ?? {};
|
|
2213
|
+
h._selected !== a && l.setData({ ...h, _selected: a });
|
|
2196
2214
|
}
|
|
2197
2215
|
}
|
|
2198
|
-
const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */
|
|
2216
|
+
const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ pe({
|
|
2199
2217
|
__name: "node-actions-toolbar",
|
|
2200
2218
|
props: {
|
|
2201
2219
|
node: {},
|
|
@@ -2236,7 +2254,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2236
2254
|
}
|
|
2237
2255
|
})), i = V(() => r.value.copy.visible || r.value.copyInsert.visible || r.value.disconnect.visible), l = H(!1);
|
|
2238
2256
|
let a = null;
|
|
2239
|
-
function
|
|
2257
|
+
function h() {
|
|
2240
2258
|
a && (clearTimeout(a), a = null), l.value = !0;
|
|
2241
2259
|
}
|
|
2242
2260
|
function f() {
|
|
@@ -2250,73 +2268,73 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2250
2268
|
class: "flow-canvas-node-actions",
|
|
2251
2269
|
style: Ee(t.value)
|
|
2252
2270
|
}, [
|
|
2253
|
-
|
|
2271
|
+
F("div", yo, [
|
|
2254
2272
|
r.value.debug.visible ? (A(), T("i", {
|
|
2255
2273
|
key: 0,
|
|
2256
|
-
class:
|
|
2274
|
+
class: oe(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": r.value.debug.disabled }]),
|
|
2257
2275
|
onClick: u[0] || (u[0] = (w) => !r.value.debug.disabled && s("action", "debug", n.node.id))
|
|
2258
|
-
}, null, 2)) :
|
|
2276
|
+
}, null, 2)) : K("", !0),
|
|
2259
2277
|
r.value.delete.visible ? (A(), T("i", {
|
|
2260
2278
|
key: 1,
|
|
2261
|
-
class:
|
|
2279
|
+
class: oe(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": r.value.delete.disabled }]),
|
|
2262
2280
|
onClick: u[1] || (u[1] = (w) => !r.value.delete.disabled && s("action", "delete", n.node.id))
|
|
2263
|
-
}, null, 2)) :
|
|
2281
|
+
}, null, 2)) : K("", !0),
|
|
2264
2282
|
i.value ? (A(), T("div", {
|
|
2265
2283
|
key: 2,
|
|
2266
2284
|
class: "flow-canvas-node-actions__more-wrapper",
|
|
2267
|
-
onMouseenter:
|
|
2285
|
+
onMouseenter: h,
|
|
2268
2286
|
onMouseleave: f
|
|
2269
2287
|
}, [...u[5] || (u[5] = [
|
|
2270
|
-
|
|
2271
|
-
])], 32)) :
|
|
2288
|
+
F("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
|
|
2289
|
+
])], 32)) : K("", !0)
|
|
2272
2290
|
]),
|
|
2273
2291
|
at(lt, { name: "flow-canvas-fade" }, {
|
|
2274
2292
|
default: He(() => [
|
|
2275
2293
|
l.value && i.value ? (A(), T("div", {
|
|
2276
2294
|
key: 0,
|
|
2277
2295
|
class: "flow-canvas-node-actions__dropdown",
|
|
2278
|
-
onMouseenter:
|
|
2296
|
+
onMouseenter: h,
|
|
2279
2297
|
onMouseleave: f
|
|
2280
2298
|
}, [
|
|
2281
2299
|
r.value.copy.visible ? (A(), T("div", {
|
|
2282
2300
|
key: 0,
|
|
2283
|
-
class:
|
|
2301
|
+
class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copy.disabled }]),
|
|
2284
2302
|
onClick: u[2] || (u[2] = (w) => !r.value.copy.disabled && s("action", "copy", n.node.id))
|
|
2285
2303
|
}, [...u[6] || (u[6] = [
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
])], 2)) :
|
|
2304
|
+
F("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
|
|
2305
|
+
F("span", null, "复制", -1)
|
|
2306
|
+
])], 2)) : K("", !0),
|
|
2289
2307
|
r.value.copyInsert.visible ? (A(), T("div", {
|
|
2290
2308
|
key: 1,
|
|
2291
|
-
class:
|
|
2309
|
+
class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copyInsert.disabled }]),
|
|
2292
2310
|
onClick: u[3] || (u[3] = (w) => !r.value.copyInsert.disabled && s("action", "copy-insert", n.node.id))
|
|
2293
2311
|
}, [...u[7] || (u[7] = [
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
])], 2)) :
|
|
2312
|
+
F("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
|
|
2313
|
+
F("span", null, "复制并插入", -1)
|
|
2314
|
+
])], 2)) : K("", !0),
|
|
2297
2315
|
r.value.disconnect.visible ? (A(), T("div", {
|
|
2298
2316
|
key: 2,
|
|
2299
|
-
class:
|
|
2317
|
+
class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.disconnect.disabled }]),
|
|
2300
2318
|
onClick: u[4] || (u[4] = (w) => !r.value.disconnect.disabled && s("action", "disconnect", n.node.id))
|
|
2301
2319
|
}, [...u[8] || (u[8] = [
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
])], 2)) :
|
|
2305
|
-
], 32)) :
|
|
2320
|
+
F("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
|
|
2321
|
+
F("span", null, "断开连线", -1)
|
|
2322
|
+
])], 2)) : K("", !0)
|
|
2323
|
+
], 32)) : K("", !0)
|
|
2306
2324
|
]),
|
|
2307
2325
|
_: 1
|
|
2308
2326
|
})
|
|
2309
2327
|
], 4));
|
|
2310
2328
|
}
|
|
2311
|
-
}),
|
|
2329
|
+
}), me = (n, e) => {
|
|
2312
2330
|
const o = n.__vccOpts || n;
|
|
2313
2331
|
for (const [t, s] of e)
|
|
2314
2332
|
o[t] = s;
|
|
2315
2333
|
return o;
|
|
2316
|
-
}, bo = /* @__PURE__ */
|
|
2334
|
+
}, bo = /* @__PURE__ */ me(wo, [["__scopeId", "data-v-3b39dab5"]]), Eo = {
|
|
2317
2335
|
key: 0,
|
|
2318
2336
|
class: "flow-canvas-quick-add__tooltip"
|
|
2319
|
-
}, xo = 5, Io = /* @__PURE__ */
|
|
2337
|
+
}, xo = 5, Io = /* @__PURE__ */ pe({
|
|
2320
2338
|
__name: "node-quick-add-popover",
|
|
2321
2339
|
props: {
|
|
2322
2340
|
node: {},
|
|
@@ -2327,17 +2345,17 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2327
2345
|
emits: ["open", "close", "start-drag", "viewport-overflow-right", "mouseenter", "mouseleave"],
|
|
2328
2346
|
setup(n, { expose: e, emit: o }) {
|
|
2329
2347
|
const t = n, s = o, r = H(), i = H(), l = H(!1), a = H(!1);
|
|
2330
|
-
let
|
|
2348
|
+
let h = null, f = !1, p = null;
|
|
2331
2349
|
function u(G) {
|
|
2332
|
-
G.preventDefault(), G.stopPropagation(),
|
|
2350
|
+
G.preventDefault(), G.stopPropagation(), h = { x: G.clientX, y: G.clientY }, f = !1, document.addEventListener("mousemove", w), document.addEventListener("mouseup", D);
|
|
2333
2351
|
}
|
|
2334
2352
|
function w(G) {
|
|
2335
|
-
if (!
|
|
2336
|
-
const d = G.clientX -
|
|
2353
|
+
if (!h) return;
|
|
2354
|
+
const d = G.clientX - h.x, y = G.clientY - h.y;
|
|
2337
2355
|
Math.sqrt(d * d + y * y) >= xo && (f = !0, O(), s("start-drag", t.node.id));
|
|
2338
2356
|
}
|
|
2339
2357
|
function D() {
|
|
2340
|
-
O(), f || b(),
|
|
2358
|
+
O(), f || b(), h = null, f = !1;
|
|
2341
2359
|
}
|
|
2342
2360
|
function O() {
|
|
2343
2361
|
document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", D);
|
|
@@ -2389,26 +2407,26 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2389
2407
|
onClick: d[3] || (d[3] = ht(() => {
|
|
2390
2408
|
}, ["stop"]))
|
|
2391
2409
|
}, [
|
|
2392
|
-
|
|
2410
|
+
F("div", {
|
|
2393
2411
|
ref_key: "btnRef",
|
|
2394
2412
|
ref: r,
|
|
2395
|
-
class:
|
|
2413
|
+
class: oe(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
|
|
2396
2414
|
onMouseenter: d[0] || (d[0] = (y) => l.value = !0),
|
|
2397
2415
|
onMouseleave: d[1] || (d[1] = (y) => l.value = !1),
|
|
2398
2416
|
onMousedown: u
|
|
2399
2417
|
}, [...d[4] || (d[4] = [
|
|
2400
|
-
|
|
2418
|
+
F("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
|
|
2401
2419
|
])], 34),
|
|
2402
2420
|
l.value && !a.value ? (A(), T("div", Eo, [...d[5] || (d[5] = [
|
|
2403
|
-
|
|
2404
|
-
|
|
2421
|
+
F("div", null, [
|
|
2422
|
+
F("b", null, "点击"),
|
|
2405
2423
|
je(" 添加节点")
|
|
2406
2424
|
], -1),
|
|
2407
|
-
|
|
2408
|
-
|
|
2425
|
+
F("div", null, [
|
|
2426
|
+
F("b", null, "拖拽"),
|
|
2409
2427
|
je(" 连接节点")
|
|
2410
2428
|
], -1)
|
|
2411
|
-
])])) :
|
|
2429
|
+
])])) : K("", !0),
|
|
2412
2430
|
at(lt, { name: "flow-canvas-fade" }, {
|
|
2413
2431
|
default: He(() => [
|
|
2414
2432
|
a.value ? (A(), T("div", {
|
|
@@ -2420,15 +2438,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2420
2438
|
onMouseleave: U
|
|
2421
2439
|
}, [
|
|
2422
2440
|
Me(G.$slots, "default", {}, () => [
|
|
2423
|
-
d[6] || (d[6] =
|
|
2441
|
+
d[6] || (d[6] = F("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
|
|
2424
2442
|
], !0)
|
|
2425
|
-
], 544)) :
|
|
2443
|
+
], 544)) : K("", !0)
|
|
2426
2444
|
]),
|
|
2427
2445
|
_: 3
|
|
2428
2446
|
})
|
|
2429
2447
|
], 36));
|
|
2430
2448
|
}
|
|
2431
|
-
}), Co = /* @__PURE__ */
|
|
2449
|
+
}), Co = /* @__PURE__ */ me(Io, [["__scopeId", "data-v-255b3d8c"]]), ko = { class: "flow-canvas-selection-actions__bar" }, So = /* @__PURE__ */ pe({
|
|
2432
2450
|
__name: "selection-actions-toolbar",
|
|
2433
2451
|
props: {
|
|
2434
2452
|
position: {},
|
|
@@ -2445,15 +2463,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2445
2463
|
class: "flow-canvas-selection-actions",
|
|
2446
2464
|
style: Ee(s.value)
|
|
2447
2465
|
}, [
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
class:
|
|
2466
|
+
F("div", ko, [
|
|
2467
|
+
F("i", {
|
|
2468
|
+
class: oe(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !n.canDelete }]),
|
|
2451
2469
|
onClick: i[0] || (i[0] = (l) => n.canDelete && t("action", "delete"))
|
|
2452
2470
|
}, null, 2)
|
|
2453
2471
|
])
|
|
2454
2472
|
], 4));
|
|
2455
2473
|
}
|
|
2456
|
-
}), Mo = /* @__PURE__ */
|
|
2474
|
+
}), Mo = /* @__PURE__ */ me(So, [["__scopeId", "data-v-25eb8b79"]]), No = { class: "flow-canvas-runtime-core__overlay" }, Do = /* @__PURE__ */ pe({
|
|
2457
2475
|
__name: "canvas-runtime-core",
|
|
2458
2476
|
props: {
|
|
2459
2477
|
editor: {},
|
|
@@ -2467,7 +2485,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2467
2485
|
emits: ["ui-event"],
|
|
2468
2486
|
setup(n, { expose: e, emit: o }) {
|
|
2469
2487
|
const t = n, s = o, r = H(), i = H();
|
|
2470
|
-
let l, a,
|
|
2488
|
+
let l, a, h, f, p = null, u = null, w = null, D = null, O = null;
|
|
2471
2489
|
const b = oo(), { hoveredNodeId: S, isDraggingNode: M } = b, B = b.enterOverlay, j = () => b.leaveOverlay(), k = H(0), X = H({ nodeIds: [], edgeIds: [] });
|
|
2472
2490
|
function U(I) {
|
|
2473
2491
|
const C = t.editor.api.value;
|
|
@@ -2490,15 +2508,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2490
2508
|
() => {
|
|
2491
2509
|
if (k.value, !t.editor.api.value) return [];
|
|
2492
2510
|
const I = t.editor.flowModel.value, C = t.editor.api.value.overlay, P = [];
|
|
2493
|
-
for (const [W,
|
|
2494
|
-
const
|
|
2495
|
-
if (!
|
|
2496
|
-
const
|
|
2497
|
-
|
|
2511
|
+
for (const [W, te] of Object.entries(I.nodes)) {
|
|
2512
|
+
const ce = t.editor._pluginManager.collectNodeDecorations(te);
|
|
2513
|
+
if (!ce?.badge) continue;
|
|
2514
|
+
const se = C.getNodeScreenRect(W);
|
|
2515
|
+
se && P.push({
|
|
2498
2516
|
nodeId: W,
|
|
2499
|
-
x:
|
|
2500
|
-
y:
|
|
2501
|
-
badge:
|
|
2517
|
+
x: se.x + se.width - 4,
|
|
2518
|
+
y: se.y - 8,
|
|
2519
|
+
badge: ce.badge
|
|
2502
2520
|
});
|
|
2503
2521
|
}
|
|
2504
2522
|
return P;
|
|
@@ -2512,11 +2530,11 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2512
2530
|
if (!P) return null;
|
|
2513
2531
|
const W = t.editor.api.value.overlay.getNodeScreenRect(I);
|
|
2514
2532
|
if (!W) return null;
|
|
2515
|
-
const
|
|
2516
|
-
return
|
|
2533
|
+
const te = U(P);
|
|
2534
|
+
return te.showActions === !1 ? null : {
|
|
2517
2535
|
node: P,
|
|
2518
2536
|
position: { x: W.x + W.width, y: W.y + W.height + 4 },
|
|
2519
|
-
behavior:
|
|
2537
|
+
behavior: te
|
|
2520
2538
|
};
|
|
2521
2539
|
}), g = V(() => {
|
|
2522
2540
|
if (k.value, !t.editor.api.value || t.editor.mode.value !== "edit") return null;
|
|
@@ -2529,7 +2547,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2529
2547
|
position: { x: C.x + C.width, y: C.y + C.height + 4 },
|
|
2530
2548
|
canDelete: P.nodeIds.length > 0 || P.edgeIds.length > 0
|
|
2531
2549
|
};
|
|
2532
|
-
}),
|
|
2550
|
+
}), v = H(), m = ro({
|
|
2533
2551
|
editor: t.editor,
|
|
2534
2552
|
quickAddProp: V(() => t.quickAdd),
|
|
2535
2553
|
isDraggingNode: M,
|
|
@@ -2538,22 +2556,22 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2538
2556
|
viewportVersion: k,
|
|
2539
2557
|
getNodeBehavior: U,
|
|
2540
2558
|
getInsertGap: () => d.value.insertGap,
|
|
2541
|
-
closePopover: () =>
|
|
2559
|
+
closePopover: () => v.value?.closePopover()
|
|
2542
2560
|
}), E = m.data, L = m.handleOpen, z = m.handleStartDrag;
|
|
2543
|
-
function
|
|
2561
|
+
function de() {
|
|
2544
2562
|
m.handleClose(), b.leaveOverlay(200), m.leave();
|
|
2545
2563
|
}
|
|
2546
2564
|
const N = m.handleOverlayEnter, _ = m.handleOverlayLeave, x = m.handleInsert, R = lo({
|
|
2547
2565
|
editor: t.editor,
|
|
2548
2566
|
edgeDropProp: V(() => t.edgeDrop)
|
|
2549
|
-
}),
|
|
2550
|
-
function
|
|
2551
|
-
|
|
2567
|
+
}), q = co(t.editor);
|
|
2568
|
+
function Y(I, C) {
|
|
2569
|
+
q.handleNodeAction(I, C, d.value.insertGap) && (S.value = null);
|
|
2552
2570
|
}
|
|
2553
|
-
function
|
|
2554
|
-
I === "delete" &&
|
|
2571
|
+
function J(I) {
|
|
2572
|
+
I === "delete" && q.deleteSelection(X.value);
|
|
2555
2573
|
}
|
|
2556
|
-
function
|
|
2574
|
+
function Z(I) {
|
|
2557
2575
|
if (t.editor.mode.value !== "edit") return;
|
|
2558
2576
|
if ((I.metaKey || I.ctrlKey) && (I.key === "z" || I.key === "Z")) {
|
|
2559
2577
|
if (I.shiftKey) {
|
|
@@ -2568,14 +2586,14 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2568
2586
|
}
|
|
2569
2587
|
t.editor._pluginManager.dispatchKeyboardShortcut(I) && (I.preventDefault(), I.stopPropagation());
|
|
2570
2588
|
}
|
|
2571
|
-
function
|
|
2572
|
-
const P = l, W = (
|
|
2573
|
-
const
|
|
2574
|
-
|
|
2589
|
+
function Q(I, C) {
|
|
2590
|
+
const P = l, W = (te) => {
|
|
2591
|
+
const ce = P.isRubberbandEnabled?.() ?? !1;
|
|
2592
|
+
ce && P.disableRubberband?.(), te ? l.enablePanning() : l.disablePanning(), ce && P.enableRubberband?.();
|
|
2575
2593
|
};
|
|
2576
2594
|
I && C ? (P.enableSelection?.(), b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1, p?.remove(), W(!1), P.enableRubberband?.()) : (P.disableRubberband?.(), W(!0), P.disableSelection?.(), P.cleanSelection?.());
|
|
2577
2595
|
}
|
|
2578
|
-
function
|
|
2596
|
+
function ne(I) {
|
|
2579
2597
|
l.on("node:move", ({ node: C }) => {
|
|
2580
2598
|
M.value = !0;
|
|
2581
2599
|
const P = t.editor.flowModel.value.nodes[C.id];
|
|
@@ -2604,14 +2622,14 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2604
2622
|
P && U(P).actionsOffset && (W = 300), b.leave(W), m.mergedConfig.value.enabled ? m.quickAddNodeId.value === C.id && !m.quickAddPopoverOpen.value ? m.leave() : m.quickAddNodeId.value !== C.id && I.hideNodePorts(C) : I.hideNodePorts(C);
|
|
2605
2623
|
});
|
|
2606
2624
|
}
|
|
2607
|
-
function
|
|
2625
|
+
function re(I) {
|
|
2608
2626
|
l.on("edge:added", ({ edge: C }) => {
|
|
2609
2627
|
let P;
|
|
2610
2628
|
if (t.getConnectionExcludedNodeIds && !C.getTargetCell()) {
|
|
2611
2629
|
const W = C.getSourceCell();
|
|
2612
2630
|
if (W) {
|
|
2613
|
-
const
|
|
2614
|
-
P =
|
|
2631
|
+
const te = t.getConnectionExcludedNodeIds(W.id);
|
|
2632
|
+
P = te instanceof Set ? te : new Set(te);
|
|
2615
2633
|
}
|
|
2616
2634
|
}
|
|
2617
2635
|
I.handleEdgeAdded(C, P);
|
|
@@ -2626,7 +2644,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2626
2644
|
a.setHoveredEdge(null), a.refreshSingleEdgeStyle(C.id), p.remove();
|
|
2627
2645
|
}), l.on("edge:click", ({ edge: C, e: P }) => {
|
|
2628
2646
|
P.target?.closest?.(".flow-canvas-edge-delete-tool") && t.editor.mode.value === "edit" && (p.remove(), t.editor.executeCommand({
|
|
2629
|
-
id:
|
|
2647
|
+
id: ee(),
|
|
2630
2648
|
source: "user:toolbar",
|
|
2631
2649
|
label: "删除连线",
|
|
2632
2650
|
timestamp: Date.now(),
|
|
@@ -2645,16 +2663,16 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2645
2663
|
b.leave(180), m.quickAddPopoverOpen.value || m.leave();
|
|
2646
2664
|
}, r.value?.addEventListener("mousemove", w), D = () => {
|
|
2647
2665
|
b.reset(), m.quickAddPopoverOpen.value || (m.quickAddNodeId.value = null);
|
|
2648
|
-
}, r.value?.addEventListener("mouseleave", D), r.value?.addEventListener("keydown",
|
|
2666
|
+
}, r.value?.addEventListener("mouseleave", D), r.value?.addEventListener("keydown", Z);
|
|
2649
2667
|
}
|
|
2650
2668
|
function $e() {
|
|
2651
|
-
|
|
2669
|
+
he(
|
|
2652
2670
|
() => t.editor.flowModel.value,
|
|
2653
2671
|
(I) => a.syncFlowModel(I)
|
|
2654
|
-
),
|
|
2672
|
+
), he(
|
|
2655
2673
|
[() => t.editor.mode.value, () => t.editor.selectionMode.value],
|
|
2656
2674
|
([I, C]) => {
|
|
2657
|
-
|
|
2675
|
+
Q(I === "edit", C);
|
|
2658
2676
|
},
|
|
2659
2677
|
{ immediate: !0 }
|
|
2660
2678
|
);
|
|
@@ -2663,12 +2681,12 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2663
2681
|
if (!i.value) return;
|
|
2664
2682
|
const I = /* @__PURE__ */ new Set(["model", "container"]), C = {};
|
|
2665
2683
|
if (t.graphOptions)
|
|
2666
|
-
for (const [$,
|
|
2684
|
+
for (const [$, ie] of Object.entries(t.graphOptions)) {
|
|
2667
2685
|
if (I.has($)) {
|
|
2668
2686
|
console.warn(`[flow-canvas] graphOptions.${$} is managed by the engine and will be ignored`);
|
|
2669
2687
|
continue;
|
|
2670
2688
|
}
|
|
2671
|
-
C[$] =
|
|
2689
|
+
C[$] = ie;
|
|
2672
2690
|
}
|
|
2673
2691
|
l = new Et({
|
|
2674
2692
|
container: i.value,
|
|
@@ -2708,10 +2726,10 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2708
2726
|
}
|
|
2709
2727
|
},
|
|
2710
2728
|
...C
|
|
2711
|
-
}),
|
|
2729
|
+
}), h = new Vt(), a = new Wt(
|
|
2712
2730
|
l,
|
|
2713
2731
|
t.editor.schema,
|
|
2714
|
-
|
|
2732
|
+
h,
|
|
2715
2733
|
($) => t.editor._pluginManager.collectNodeDecorations($),
|
|
2716
2734
|
($) => t.editor._pluginManager.collectEdgeDecorations($),
|
|
2717
2735
|
() => t.editor.api.value ? {
|
|
@@ -2731,25 +2749,25 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2731
2749
|
idGenerator: t.editor.idGenerator,
|
|
2732
2750
|
defaultInsertGap: t.nodeActions?.insertGap,
|
|
2733
2751
|
getContextMenuItems: ($) => t.editor._pluginManager.collectContextMenuItems($),
|
|
2734
|
-
onHighlightChange: ($,
|
|
2752
|
+
onHighlightChange: ($, ie) => {
|
|
2735
2753
|
a.setHighlightedNodes($);
|
|
2736
|
-
const
|
|
2754
|
+
const ve = a.setHighlightedEdges(ie);
|
|
2737
2755
|
a.refreshNodeHighlights();
|
|
2738
|
-
const
|
|
2739
|
-
for (const ye of
|
|
2740
|
-
|
|
2741
|
-
for (const ye of
|
|
2742
|
-
|
|
2756
|
+
const ae = new Set(ie);
|
|
2757
|
+
for (const ye of ve)
|
|
2758
|
+
ae.has(ye) || a.refreshSingleEdgeStyle(ye);
|
|
2759
|
+
for (const ye of ae)
|
|
2760
|
+
ve.has(ye) || a.refreshSingleEdgeStyle(ye);
|
|
2743
2761
|
},
|
|
2744
2762
|
resolveNodeShape: ($) => {
|
|
2745
|
-
const
|
|
2746
|
-
if (!
|
|
2747
|
-
const
|
|
2748
|
-
return { shapeName:
|
|
2763
|
+
const ie = t.editor.schema.nodeTypes[$];
|
|
2764
|
+
if (!ie) return null;
|
|
2765
|
+
const ve = h.registerNodeType($, ie.component), ae = ie.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
|
|
2766
|
+
return { shapeName: ve, width: ae.width, height: ae.height };
|
|
2749
2767
|
}
|
|
2750
2768
|
});
|
|
2751
2769
|
t.editor.api.value = W;
|
|
2752
|
-
const
|
|
2770
|
+
const te = {
|
|
2753
2771
|
flowModel: t.editor.flowModel,
|
|
2754
2772
|
history: t.editor.history,
|
|
2755
2773
|
schema: t.editor.schema,
|
|
@@ -2761,9 +2779,9 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2761
2779
|
overlay: P,
|
|
2762
2780
|
graph: l
|
|
2763
2781
|
};
|
|
2764
|
-
t.editor._pluginManager.attachRuntime(
|
|
2765
|
-
const
|
|
2766
|
-
Object.assign(t.editor.extendedApi,
|
|
2782
|
+
t.editor._pluginManager.attachRuntime(te);
|
|
2783
|
+
const ce = t.editor._pluginManager.collectExtendedApi();
|
|
2784
|
+
Object.assign(t.editor.extendedApi, ce), t.editor._emitUiEvent = ($) => {
|
|
2767
2785
|
t.editor._pluginManager.dispatchUiEvent($), s("ui-event", $);
|
|
2768
2786
|
}, f = new Xt(
|
|
2769
2787
|
l,
|
|
@@ -2772,11 +2790,11 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2772
2790
|
},
|
|
2773
2791
|
($) => {
|
|
2774
2792
|
if (a.isSyncing) return;
|
|
2775
|
-
const
|
|
2776
|
-
if (t.editor.executeCommand(
|
|
2777
|
-
for (const
|
|
2778
|
-
if (
|
|
2779
|
-
const ye = l.getCellById(
|
|
2793
|
+
const ie = R.tryExpandForEdgeDrop($);
|
|
2794
|
+
if (t.editor.executeCommand(ie).status !== "applied") {
|
|
2795
|
+
for (const ae of ie.commands)
|
|
2796
|
+
if (ae.type === "edge.add") {
|
|
2797
|
+
const ye = l.getCellById(ae.edge.id);
|
|
2780
2798
|
ye && l.removeCell(ye);
|
|
2781
2799
|
}
|
|
2782
2800
|
}
|
|
@@ -2784,22 +2802,22 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2784
2802
|
t.editor.flowModel,
|
|
2785
2803
|
t.editor.idGenerator
|
|
2786
2804
|
), p = no(l);
|
|
2787
|
-
const
|
|
2788
|
-
m.attachRuntime(l, ($) =>
|
|
2805
|
+
const se = so(l);
|
|
2806
|
+
m.attachRuntime(l, ($) => se.hideNodePorts($)), R.attachRuntime(l), ne(se), re(se), O = vo(l.container);
|
|
2789
2807
|
let xe = /* @__PURE__ */ new Set(), be = /* @__PURE__ */ new Set();
|
|
2790
2808
|
l.on("selection:changed", () => {
|
|
2791
|
-
const $ = ft(l.getSelectedCells?.() ?? []),
|
|
2792
|
-
mo(l, xe,
|
|
2809
|
+
const $ = ft(l.getSelectedCells?.() ?? []), ie = new Set($.nodeIds);
|
|
2810
|
+
mo(l, xe, ie), xe = ie, X.value = $, t.editor._pluginManager.dispatchSelectionChange($), s("ui-event", {
|
|
2793
2811
|
type: "selection.change",
|
|
2794
2812
|
nodeIds: $.nodeIds,
|
|
2795
2813
|
edgeIds: $.edgeIds
|
|
2796
2814
|
}), a.refreshNodeHighlights();
|
|
2797
|
-
const
|
|
2798
|
-
for (const
|
|
2799
|
-
|
|
2800
|
-
for (const
|
|
2801
|
-
be.has(
|
|
2802
|
-
be =
|
|
2815
|
+
const ve = new Set($.edgeIds);
|
|
2816
|
+
for (const ae of be)
|
|
2817
|
+
ve.has(ae) || a.refreshSingleEdgeStyle(ae);
|
|
2818
|
+
for (const ae of ve)
|
|
2819
|
+
be.has(ae) || a.refreshSingleEdgeStyle(ae);
|
|
2820
|
+
be = ve;
|
|
2803
2821
|
});
|
|
2804
2822
|
const Be = () => {
|
|
2805
2823
|
k.value++;
|
|
@@ -2810,52 +2828,52 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2810
2828
|
b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1;
|
|
2811
2829
|
}
|
|
2812
2830
|
return e({ resetHoverState: Se }), Te(() => {
|
|
2813
|
-
b.cleanup(), m.cleanup(), R.cleanup(), p?.remove(), u && l?.container?.removeEventListener("mousemove", u), w && r.value?.removeEventListener("mousemove", w), D && r.value?.removeEventListener("mouseleave", D), O?.(), r.value?.removeEventListener("keydown",
|
|
2831
|
+
b.cleanup(), m.cleanup(), R.cleanup(), p?.remove(), u && l?.container?.removeEventListener("mousemove", u), w && r.value?.removeEventListener("mousemove", w), D && r.value?.removeEventListener("mouseleave", D), O?.(), r.value?.removeEventListener("keydown", Z), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
|
|
2814
2832
|
for (const I of Object.keys(t.editor.extendedApi))
|
|
2815
2833
|
delete t.editor.extendedApi[I];
|
|
2816
|
-
f?.dispose(), a?.dispose(),
|
|
2834
|
+
f?.dispose(), a?.dispose(), h?.dispose(), l?.dispose();
|
|
2817
2835
|
}), (I, C) => (A(), T("div", {
|
|
2818
2836
|
ref_key: "rootRef",
|
|
2819
2837
|
ref: r,
|
|
2820
|
-
class:
|
|
2838
|
+
class: oe(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": G.value }]),
|
|
2821
2839
|
tabindex: "0"
|
|
2822
2840
|
}, [
|
|
2823
|
-
|
|
2841
|
+
F("div", {
|
|
2824
2842
|
ref_key: "containerRef",
|
|
2825
2843
|
ref: i,
|
|
2826
2844
|
class: "flow-canvas-runtime-core__graph"
|
|
2827
2845
|
}, null, 512),
|
|
2828
|
-
|
|
2829
|
-
(A(!0), T(
|
|
2846
|
+
F("div", No, [
|
|
2847
|
+
(A(!0), T(ue, null, Ce(y.value, (P) => (A(), T("div", {
|
|
2830
2848
|
key: `badge-${P.nodeId}`,
|
|
2831
2849
|
class: "flow-canvas-runtime-core__badge",
|
|
2832
2850
|
style: Ee({ left: `${P.x}px`, top: `${P.y}px`, backgroundColor: P.badge.color })
|
|
2833
|
-
},
|
|
2834
|
-
|
|
2851
|
+
}, fe(P.badge.text), 5))), 128)),
|
|
2852
|
+
le(E) ? (A(), Ie(Co, {
|
|
2835
2853
|
key: 0,
|
|
2836
2854
|
ref_key: "quickAddPopoverRef",
|
|
2837
|
-
ref:
|
|
2838
|
-
node:
|
|
2839
|
-
"port-position":
|
|
2840
|
-
"auto-pan-on-open":
|
|
2841
|
-
"auto-pan-padding":
|
|
2842
|
-
onOpen:
|
|
2843
|
-
onClose:
|
|
2844
|
-
onStartDrag:
|
|
2845
|
-
onViewportOverflowRight:
|
|
2846
|
-
onMouseenter:
|
|
2847
|
-
onMouseleave:
|
|
2855
|
+
ref: v,
|
|
2856
|
+
node: le(E).node,
|
|
2857
|
+
"port-position": le(E).portPosition,
|
|
2858
|
+
"auto-pan-on-open": le(m).mergedConfig.value.autoPanOnOpen,
|
|
2859
|
+
"auto-pan-padding": le(m).mergedConfig.value.autoPanPadding,
|
|
2860
|
+
onOpen: le(L),
|
|
2861
|
+
onClose: de,
|
|
2862
|
+
onStartDrag: le(z),
|
|
2863
|
+
onViewportOverflowRight: le(m).handlePopoverViewportOverflow,
|
|
2864
|
+
onMouseenter: le(N),
|
|
2865
|
+
onMouseleave: le(_)
|
|
2848
2866
|
}, {
|
|
2849
2867
|
default: He(() => [
|
|
2850
2868
|
Me(I.$slots, "quick-add-panel", {
|
|
2851
|
-
node:
|
|
2869
|
+
node: le(E).node,
|
|
2852
2870
|
api: n.editor.api.value,
|
|
2853
|
-
insertNodeToRight: (P) =>
|
|
2854
|
-
closePopover: () =>
|
|
2871
|
+
insertNodeToRight: (P) => le(x)(le(E).node.id, P),
|
|
2872
|
+
closePopover: () => v.value?.closePopover()
|
|
2855
2873
|
}, void 0, !0)
|
|
2856
2874
|
]),
|
|
2857
2875
|
_: 3
|
|
2858
|
-
}, 8, ["node", "port-position", "auto-pan-on-open", "auto-pan-padding", "onOpen", "onStartDrag", "onViewportOverflowRight", "onMouseenter", "onMouseleave"])) :
|
|
2876
|
+
}, 8, ["node", "port-position", "auto-pan-on-open", "auto-pan-padding", "onOpen", "onStartDrag", "onViewportOverflowRight", "onMouseenter", "onMouseleave"])) : K("", !0),
|
|
2859
2877
|
c.value ? (A(), Ie(bo, {
|
|
2860
2878
|
key: 1,
|
|
2861
2879
|
node: c.value.node,
|
|
@@ -2863,20 +2881,20 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2863
2881
|
config: d.value,
|
|
2864
2882
|
behavior: c.value.behavior,
|
|
2865
2883
|
"actions-offset": c.value.behavior.actionsOffset,
|
|
2866
|
-
onAction:
|
|
2867
|
-
onMouseenter:
|
|
2884
|
+
onAction: Y,
|
|
2885
|
+
onMouseenter: le(B),
|
|
2868
2886
|
onMouseleave: j
|
|
2869
|
-
}, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) :
|
|
2887
|
+
}, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : K("", !0),
|
|
2870
2888
|
g.value ? (A(), Ie(Mo, {
|
|
2871
2889
|
key: 2,
|
|
2872
2890
|
position: g.value.position,
|
|
2873
2891
|
"can-delete": g.value.canDelete,
|
|
2874
|
-
onAction:
|
|
2875
|
-
}, null, 8, ["position", "can-delete"])) :
|
|
2892
|
+
onAction: J
|
|
2893
|
+
}, null, 8, ["position", "can-delete"])) : K("", !0)
|
|
2876
2894
|
])
|
|
2877
2895
|
], 2));
|
|
2878
2896
|
}
|
|
2879
|
-
}), Dn = /* @__PURE__ */
|
|
2897
|
+
}), Dn = /* @__PURE__ */ me(Do, [["__scopeId", "data-v-84584822"]]), Ao = { class: "flow-canvas-node-palette" }, _o = ["data-node-type"], Po = { class: "flow-canvas-node-palette__item-label" }, To = /* @__PURE__ */ pe({
|
|
2880
2898
|
__name: "canvas-node-palette",
|
|
2881
2899
|
props: {
|
|
2882
2900
|
editor: {},
|
|
@@ -2887,51 +2905,51 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2887
2905
|
type: s,
|
|
2888
2906
|
label: s.charAt(0).toUpperCase() + s.slice(1)
|
|
2889
2907
|
})));
|
|
2890
|
-
return
|
|
2908
|
+
return he(
|
|
2891
2909
|
[() => e.editor.api.value, t, o],
|
|
2892
2910
|
([s, r, i], l, a) => {
|
|
2893
2911
|
if (!s || !i) return;
|
|
2894
|
-
const
|
|
2912
|
+
const h = [];
|
|
2895
2913
|
for (const f of r) {
|
|
2896
2914
|
const p = i.querySelector(`[data-node-type="${f.type}"]`);
|
|
2897
2915
|
if (!p) continue;
|
|
2898
2916
|
const u = s.registerDndSource(p, () => ({
|
|
2899
|
-
id:
|
|
2917
|
+
id: ee(),
|
|
2900
2918
|
type: f.type,
|
|
2901
2919
|
label: f.label,
|
|
2902
2920
|
position: { x: 0, y: 0 }
|
|
2903
2921
|
}));
|
|
2904
|
-
|
|
2922
|
+
h.push(u);
|
|
2905
2923
|
}
|
|
2906
2924
|
a(() => {
|
|
2907
|
-
for (const f of
|
|
2925
|
+
for (const f of h) f();
|
|
2908
2926
|
});
|
|
2909
2927
|
},
|
|
2910
2928
|
{ flush: "post" }
|
|
2911
2929
|
), (s, r) => (A(), T("div", Ao, [
|
|
2912
|
-
|
|
2930
|
+
F("div", {
|
|
2913
2931
|
ref_key: "listRef",
|
|
2914
2932
|
ref: o,
|
|
2915
2933
|
class: "flow-canvas-node-palette__list"
|
|
2916
2934
|
}, [
|
|
2917
|
-
(A(!0), T(
|
|
2935
|
+
(A(!0), T(ue, null, Ce(t.value, (i) => (A(), T("div", {
|
|
2918
2936
|
key: i.type,
|
|
2919
2937
|
class: "flow-canvas-node-palette__item",
|
|
2920
2938
|
"data-node-type": i.type
|
|
2921
2939
|
}, [
|
|
2922
2940
|
i.icon ? (A(), T("i", {
|
|
2923
2941
|
key: 0,
|
|
2924
|
-
class:
|
|
2925
|
-
}, null, 2)) :
|
|
2926
|
-
|
|
2942
|
+
class: oe([i.icon, "flow-canvas-node-palette__item-icon"])
|
|
2943
|
+
}, null, 2)) : K("", !0),
|
|
2944
|
+
F("span", Po, fe(i.label), 1)
|
|
2927
2945
|
], 8, _o))), 128))
|
|
2928
2946
|
], 512)
|
|
2929
2947
|
]));
|
|
2930
2948
|
}
|
|
2931
|
-
}), Ro = /* @__PURE__ */
|
|
2949
|
+
}), Ro = /* @__PURE__ */ me(To, [["__scopeId", "data-v-300314b7"]]), Lo = { class: "flow-canvas-layout" }, Oo = { class: "flow-canvas-layout__main" }, $o = { class: "flow-canvas-layout__content" }, Bo = {
|
|
2932
2950
|
key: 0,
|
|
2933
2951
|
class: "flow-canvas-layout__footer"
|
|
2934
|
-
}, Fo = /* @__PURE__ */
|
|
2952
|
+
}, Fo = /* @__PURE__ */ pe({
|
|
2935
2953
|
__name: "canvas-layout",
|
|
2936
2954
|
props: {
|
|
2937
2955
|
sidebarCollapsed: { type: Boolean, default: !1 },
|
|
@@ -2946,7 +2964,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2946
2964
|
return (e, o) => (A(), T("div", Lo, [
|
|
2947
2965
|
!n.hideSidebar && (e.$slots.sidebar || n.editor) ? (A(), T("aside", {
|
|
2948
2966
|
key: 0,
|
|
2949
|
-
class:
|
|
2967
|
+
class: oe(["flow-canvas-layout__sidebar", { "is-collapsed": n.sidebarCollapsed }]),
|
|
2950
2968
|
style: Ee({ width: n.sidebarCollapsed ? "0px" : `${n.sidebarWidth}px` })
|
|
2951
2969
|
}, [
|
|
2952
2970
|
Me(e.$slots, "sidebar", {}, () => [
|
|
@@ -2954,20 +2972,20 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
|
|
|
2954
2972
|
key: 0,
|
|
2955
2973
|
editor: n.editor,
|
|
2956
2974
|
items: n.paletteItems
|
|
2957
|
-
}, null, 8, ["editor", "items"])) :
|
|
2975
|
+
}, null, 8, ["editor", "items"])) : K("", !0)
|
|
2958
2976
|
], !0)
|
|
2959
|
-
], 6)) :
|
|
2960
|
-
|
|
2961
|
-
|
|
2977
|
+
], 6)) : K("", !0),
|
|
2978
|
+
F("div", Oo, [
|
|
2979
|
+
F("div", $o, [
|
|
2962
2980
|
Me(e.$slots, "default", {}, void 0, !0)
|
|
2963
2981
|
]),
|
|
2964
2982
|
!n.hideFooter && e.$slots.footer ? (A(), T("div", Bo, [
|
|
2965
2983
|
Me(e.$slots, "footer", {}, void 0, !0)
|
|
2966
|
-
])) :
|
|
2984
|
+
])) : K("", !0)
|
|
2967
2985
|
])
|
|
2968
2986
|
]));
|
|
2969
2987
|
}
|
|
2970
|
-
}), An = /* @__PURE__ */
|
|
2988
|
+
}), An = /* @__PURE__ */ me(Fo, [["__scopeId", "data-v-26f35b6b"]]), et = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), qo = ["undo", "redo"];
|
|
2971
2989
|
function Ho(n) {
|
|
2972
2990
|
const e = new Set(n?.include), o = new Set(qo.filter((a) => !e.has(a))), t = [
|
|
2973
2991
|
{
|
|
@@ -3054,7 +3072,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3054
3072
|
}, Wo = ["data-toolbar-id", "data-toolbar-type", "disabled", "onClick", "onMouseenter"], Vo = ["textContent"], Xo = {
|
|
3055
3073
|
key: 0,
|
|
3056
3074
|
class: "flow-canvas-toolbar-tooltip__kbd"
|
|
3057
|
-
}, Ko = /* @__PURE__ */
|
|
3075
|
+
}, Ko = /* @__PURE__ */ pe({
|
|
3058
3076
|
__name: "canvas-toolbar",
|
|
3059
3077
|
props: {
|
|
3060
3078
|
items: {},
|
|
@@ -3080,17 +3098,17 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3080
3098
|
}
|
|
3081
3099
|
const r = n, i = V(() => {
|
|
3082
3100
|
if (r.items) return r.items;
|
|
3083
|
-
const c = Ho({ include: r.include }), g = r.editor.toolbarItems.value,
|
|
3101
|
+
const c = Ho({ include: r.include }), g = r.editor.toolbarItems.value, v = new Set(r.exclude ?? []), m = /* @__PURE__ */ new Map();
|
|
3084
3102
|
for (const E of c)
|
|
3085
3103
|
m.set(E.id, E);
|
|
3086
3104
|
for (const E of g) {
|
|
3087
3105
|
const L = m.get(E.id);
|
|
3088
3106
|
L ? m.set(E.id, { ...L, ...E, order: L.order, group: L.group }) : t(E) && m.set(E.id, E);
|
|
3089
3107
|
}
|
|
3090
|
-
return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !
|
|
3091
|
-
}), l = H(1), a = H(null),
|
|
3108
|
+
return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !v.has(E.type)).sort((E, L) => (E.order ?? 0) - (L.order ?? 0));
|
|
3109
|
+
}), l = H(1), a = H(null), h = H(null), f = H(!1);
|
|
3092
3110
|
let p = null;
|
|
3093
|
-
|
|
3111
|
+
he(
|
|
3094
3112
|
() => r.editor.api.value,
|
|
3095
3113
|
(c) => {
|
|
3096
3114
|
p?.(), p = null, c && (l.value = c.getZoom(), p = c.onGraphEvent("scale", () => {
|
|
@@ -3128,11 +3146,11 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3128
3146
|
}
|
|
3129
3147
|
const B = V(() => {
|
|
3130
3148
|
const c = d.value.filter(
|
|
3131
|
-
(
|
|
3149
|
+
(v) => s(v.type) && M(v)
|
|
3132
3150
|
);
|
|
3133
3151
|
if (c.length === 0) return null;
|
|
3134
|
-
const g =
|
|
3135
|
-
return g && c.some((
|
|
3152
|
+
const g = h.value;
|
|
3153
|
+
return g && c.some((v) => v.type === g) ? g : c[0]?.type ?? null;
|
|
3136
3154
|
});
|
|
3137
3155
|
function j(c) {
|
|
3138
3156
|
return s(c.type) ? B.value === c.type : M(c);
|
|
@@ -3156,7 +3174,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3156
3174
|
}
|
|
3157
3175
|
function G(c) {
|
|
3158
3176
|
if (!b.value || k(c)) return;
|
|
3159
|
-
if (s(c.type) && (
|
|
3177
|
+
if (s(c.type) && (h.value = c.type, U(c)), c.onClick) {
|
|
3160
3178
|
c.onClick(b.value);
|
|
3161
3179
|
return;
|
|
3162
3180
|
}
|
|
@@ -3182,11 +3200,11 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3182
3200
|
break;
|
|
3183
3201
|
case "export":
|
|
3184
3202
|
if (f.value) break;
|
|
3185
|
-
f.value = !0, g.exportAsImage().then((
|
|
3186
|
-
const m = URL.createObjectURL(
|
|
3203
|
+
f.value = !0, g.exportAsImage().then((v) => {
|
|
3204
|
+
const m = URL.createObjectURL(v), E = document.createElement("a");
|
|
3187
3205
|
E.href = m, E.download = "canvas-export.png", E.click(), URL.revokeObjectURL(m);
|
|
3188
|
-
}).catch((
|
|
3189
|
-
console.warn("[flow-canvas] Export failed:",
|
|
3206
|
+
}).catch((v) => {
|
|
3207
|
+
console.warn("[flow-canvas] Export failed:", v);
|
|
3190
3208
|
}).finally(() => {
|
|
3191
3209
|
f.value = !1;
|
|
3192
3210
|
});
|
|
@@ -3208,25 +3226,25 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3208
3226
|
}
|
|
3209
3227
|
const d = V(() => i.value.filter(S)), y = V(() => {
|
|
3210
3228
|
const c = /* @__PURE__ */ new Map(), g = [];
|
|
3211
|
-
for (const
|
|
3212
|
-
const m =
|
|
3213
|
-
c.has(m) || (c.set(m, []), g.push(m)), c.get(m).push(
|
|
3229
|
+
for (const v of d.value) {
|
|
3230
|
+
const m = v.group ?? "default";
|
|
3231
|
+
c.has(m) || (c.set(m, []), g.push(m)), c.get(m).push(v);
|
|
3214
3232
|
}
|
|
3215
|
-
return g.map((
|
|
3233
|
+
return g.map((v) => ({ name: v, items: c.get(v) })).filter((v) => v.items.length > 0);
|
|
3216
3234
|
});
|
|
3217
3235
|
return (c, g) => (A(), T("div", Go, [
|
|
3218
|
-
(A(!0), T(
|
|
3219
|
-
key:
|
|
3236
|
+
(A(!0), T(ue, null, Ce(y.value, (v, m) => (A(), T(ue, {
|
|
3237
|
+
key: v.name
|
|
3220
3238
|
}, [
|
|
3221
|
-
m > 0 ? (A(), T("div", zo)) :
|
|
3222
|
-
|
|
3223
|
-
(A(!0), T(
|
|
3239
|
+
m > 0 ? (A(), T("div", zo)) : K("", !0),
|
|
3240
|
+
F("div", Uo, [
|
|
3241
|
+
(A(!0), T(ue, null, Ce(v.items, (E) => (A(), T(ue, {
|
|
3224
3242
|
key: E.id
|
|
3225
3243
|
}, [
|
|
3226
|
-
E.type === "zoom-display" ? (A(), T("span", jo,
|
|
3244
|
+
E.type === "zoom-display" ? (A(), T("span", jo, fe(O.value), 1)) : (A(), T("button", {
|
|
3227
3245
|
key: 1,
|
|
3228
3246
|
type: "button",
|
|
3229
|
-
class:
|
|
3247
|
+
class: oe(["flow-canvas-toolbar__btn", {
|
|
3230
3248
|
"is-disabled": k(E),
|
|
3231
3249
|
"is-active": j(E),
|
|
3232
3250
|
"is-exporting": E.type === "export" && f.value
|
|
@@ -3240,11 +3258,11 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3240
3258
|
}, [
|
|
3241
3259
|
E.component ? (A(), Ie(mt(E.component), { key: 0 })) : E.icon ? (A(), T("i", {
|
|
3242
3260
|
key: 1,
|
|
3243
|
-
class:
|
|
3261
|
+
class: oe(E.icon)
|
|
3244
3262
|
}, null, 2)) : (A(), T("span", {
|
|
3245
3263
|
key: 2,
|
|
3246
3264
|
class: "flow-canvas-toolbar__text",
|
|
3247
|
-
textContent:
|
|
3265
|
+
textContent: fe(E.text ?? E.description ?? E.id)
|
|
3248
3266
|
}, null, 8, Vo))
|
|
3249
3267
|
], 42, Wo))
|
|
3250
3268
|
], 64))), 128))
|
|
@@ -3258,22 +3276,22 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3258
3276
|
class: "flow-canvas-toolbar-tooltip",
|
|
3259
3277
|
style: Ee({ left: `${u.x}px`, top: `${u.y}px` })
|
|
3260
3278
|
}, [
|
|
3261
|
-
|
|
3279
|
+
F("span", null, fe(u.text), 1),
|
|
3262
3280
|
u.shortcut.length ? (A(), T("kbd", Xo, [
|
|
3263
|
-
(A(!0), T(
|
|
3264
|
-
])) :
|
|
3265
|
-
g[0] || (g[0] =
|
|
3266
|
-
], 4)) :
|
|
3281
|
+
(A(!0), T(ue, null, Ce(u.shortcut, (v, m) => (A(), T("span", { key: m }, fe(v), 1))), 128))
|
|
3282
|
+
])) : K("", !0),
|
|
3283
|
+
g[0] || (g[0] = F("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
|
|
3284
|
+
], 4)) : K("", !0)
|
|
3267
3285
|
]))
|
|
3268
3286
|
]));
|
|
3269
3287
|
}
|
|
3270
|
-
}), _n = /* @__PURE__ */
|
|
3288
|
+
}), _n = /* @__PURE__ */ me(Ko, [["__scopeId", "data-v-904248f4"]]), Yo = { class: "flow-canvas-default-node__ep-label" }, Zo = {
|
|
3271
3289
|
key: 1,
|
|
3272
3290
|
class: "flow-canvas-default-node__diamond flow-canvas-highlight-target"
|
|
3273
3291
|
}, Qo = {
|
|
3274
3292
|
key: 2,
|
|
3275
3293
|
class: "flow-canvas-default-node__task-label"
|
|
3276
|
-
}, Jo = /* @__PURE__ */
|
|
3294
|
+
}, Jo = /* @__PURE__ */ pe({
|
|
3277
3295
|
__name: "default-node",
|
|
3278
3296
|
setup(n) {
|
|
3279
3297
|
const o = wt("getNode")?.(), t = V(() => o?.getData?.() ?? null), s = V(() => t.value?.label || t.value?.type || ""), r = {
|
|
@@ -3291,25 +3309,25 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
|
|
|
3291
3309
|
]), a = V(() => {
|
|
3292
3310
|
const f = t.value?.type ?? "";
|
|
3293
3311
|
return i.has(f) ? "endpoint" : l.has(f) ? "gateway" : "task";
|
|
3294
|
-
}),
|
|
3312
|
+
}), h = V(() => r[t.value?.type ?? ""] ?? "");
|
|
3295
3313
|
return (f, p) => (A(), T("div", {
|
|
3296
|
-
class:
|
|
3314
|
+
class: oe(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
|
|
3297
3315
|
}, [
|
|
3298
|
-
a.value === "endpoint" ? (A(), T(
|
|
3299
|
-
|
|
3316
|
+
a.value === "endpoint" ? (A(), T(ue, { key: 0 }, [
|
|
3317
|
+
h.value ? (A(), T("i", {
|
|
3300
3318
|
key: 0,
|
|
3301
|
-
class:
|
|
3302
|
-
}, null, 2)) :
|
|
3303
|
-
|
|
3319
|
+
class: oe([["flow-canvas-icon", h.value], "flow-canvas-default-node__ep-icon"])
|
|
3320
|
+
}, null, 2)) : K("", !0),
|
|
3321
|
+
F("span", Yo, fe(s.value), 1)
|
|
3304
3322
|
], 64)) : a.value === "gateway" ? (A(), T("div", Zo, [
|
|
3305
|
-
|
|
3323
|
+
h.value ? (A(), T("i", {
|
|
3306
3324
|
key: 0,
|
|
3307
|
-
class:
|
|
3308
|
-
}, null, 2)) :
|
|
3309
|
-
])) : (A(), T("span", Qo,
|
|
3325
|
+
class: oe([["flow-canvas-icon", h.value], "flow-canvas-default-node__gw-icon"])
|
|
3326
|
+
}, null, 2)) : K("", !0)
|
|
3327
|
+
])) : (A(), T("span", Qo, fe(s.value), 1))
|
|
3310
3328
|
], 2));
|
|
3311
3329
|
}
|
|
3312
|
-
}), en = /* @__PURE__ */
|
|
3330
|
+
}), en = /* @__PURE__ */ me(Jo, [["__scopeId", "data-v-f0e24a9f"]]), tn = {
|
|
3313
3331
|
start: { label: "开始", icon: "flow-canvas-icon canvas-kaishi", width: 88, height: 40 },
|
|
3314
3332
|
end: { label: "结束", icon: "flow-canvas-icon canvas-stop", width: 88, height: 40 },
|
|
3315
3333
|
empty: { label: "空节点", icon: "flow-canvas-icon canvas-jiedi", width: 240, height: 48 },
|
|
@@ -3355,10 +3373,10 @@ function on() {
|
|
|
3355
3373
|
function Pn(n) {
|
|
3356
3374
|
const e = n?.nodeTypes ?? tn, o = {}, t = [];
|
|
3357
3375
|
for (const [i, l] of Object.entries(e)) {
|
|
3358
|
-
const a = l.width ?? 150,
|
|
3376
|
+
const a = l.width ?? 150, h = l.height ?? 50;
|
|
3359
3377
|
o[i] = {
|
|
3360
3378
|
component: en,
|
|
3361
|
-
getSize: () => ({ width: a, height:
|
|
3379
|
+
getSize: () => ({ width: a, height: h }),
|
|
3362
3380
|
getPorts: () => ut()
|
|
3363
3381
|
}, t.push({
|
|
3364
3382
|
type: i,
|
|
@@ -3387,13 +3405,13 @@ function Tn(n) {
|
|
|
3387
3405
|
if (r.type !== "edge.add" && r.type !== "edge.reconnect") continue;
|
|
3388
3406
|
const i = t.flowModel.value, l = r.type === "edge.add" ? r.edge.source.nodeId : r.source?.nodeId, a = r.type === "edge.add" ? r.edge.target.nodeId : r.target?.nodeId;
|
|
3389
3407
|
if (!l || !a) continue;
|
|
3390
|
-
const
|
|
3391
|
-
if (!
|
|
3392
|
-
const p = r.type === "edge.add" ? r.edge.source.portId : r.source?.portId, u = r.type === "edge.add" ? r.edge.target.portId : r.target?.portId, w = p ?
|
|
3408
|
+
const h = i.nodes[l], f = i.nodes[a];
|
|
3409
|
+
if (!h || !f) continue;
|
|
3410
|
+
const p = r.type === "edge.add" ? r.edge.source.portId : r.source?.portId, u = r.type === "edge.add" ? r.edge.target.portId : r.target?.portId, w = p ? h.ports?.find((M) => M.id === p) : void 0, D = u ? f.ports?.find((M) => M.id === u) : void 0, O = r.type === "edge.reconnect" ? r.edgeId : void 0, b = Object.values(i.edges).filter(
|
|
3393
3411
|
(M) => M.id !== O && !s.has(M.id)
|
|
3394
3412
|
), S = n({
|
|
3395
3413
|
flowModel: i,
|
|
3396
|
-
sourceNode:
|
|
3414
|
+
sourceNode: h,
|
|
3397
3415
|
targetNode: f,
|
|
3398
3416
|
sourcePort: w,
|
|
3399
3417
|
targetPort: D,
|
|
@@ -3454,7 +3472,7 @@ function Ln(n) {
|
|
|
3454
3472
|
const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "placeholder"], rn = {
|
|
3455
3473
|
key: 0,
|
|
3456
3474
|
class: "flow-canvas-search-popover__no-result"
|
|
3457
|
-
}, an = { class: "flow-canvas-search-popover__counter" }, ln = ["onMouseenter", "onClick"], dn = { class: "flow-canvas-search-popover__item-label" }, cn = /* @__PURE__ */
|
|
3475
|
+
}, an = { class: "flow-canvas-search-popover__counter" }, ln = ["onMouseenter", "onClick"], dn = { class: "flow-canvas-search-popover__item-label" }, cn = /* @__PURE__ */ pe({
|
|
3458
3476
|
__name: "search-popover",
|
|
3459
3477
|
props: {
|
|
3460
3478
|
open: { type: Boolean },
|
|
@@ -3468,19 +3486,19 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
|
|
|
3468
3486
|
emits: ["update:query", "select", "nextMatch", "prevMatch", "close"],
|
|
3469
3487
|
setup(n, { emit: e }) {
|
|
3470
3488
|
const o = n, t = e, s = H(null), r = H(null), i = H(-1);
|
|
3471
|
-
|
|
3489
|
+
he(
|
|
3472
3490
|
() => o.open,
|
|
3473
3491
|
(u) => {
|
|
3474
3492
|
u && (i.value = -1, Ge(() => {
|
|
3475
3493
|
s.value?.focus(), s.value?.select();
|
|
3476
3494
|
}));
|
|
3477
3495
|
}
|
|
3478
|
-
),
|
|
3496
|
+
), he(
|
|
3479
3497
|
() => o.query,
|
|
3480
3498
|
() => {
|
|
3481
3499
|
i.value = -1;
|
|
3482
3500
|
}
|
|
3483
|
-
),
|
|
3501
|
+
), he(
|
|
3484
3502
|
() => o.results.length,
|
|
3485
3503
|
(u) => {
|
|
3486
3504
|
if (!u) {
|
|
@@ -3496,7 +3514,7 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
|
|
|
3496
3514
|
function a(u) {
|
|
3497
3515
|
i.value = u;
|
|
3498
3516
|
}
|
|
3499
|
-
function
|
|
3517
|
+
function h() {
|
|
3500
3518
|
i.value = -1;
|
|
3501
3519
|
}
|
|
3502
3520
|
function f(u) {
|
|
@@ -3539,8 +3557,8 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
|
|
|
3539
3557
|
class: "flow-canvas-search-popover",
|
|
3540
3558
|
style: Ee({ left: `${n.position.x}px`, top: `${n.position.y}px`, width: `${n.position.width}px` })
|
|
3541
3559
|
}, [
|
|
3542
|
-
|
|
3543
|
-
|
|
3560
|
+
F("div", nn, [
|
|
3561
|
+
F("input", {
|
|
3544
3562
|
ref_key: "inputRef",
|
|
3545
3563
|
ref: s,
|
|
3546
3564
|
value: n.query,
|
|
@@ -3548,20 +3566,20 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
|
|
|
3548
3566
|
onInput: l,
|
|
3549
3567
|
onKeydown: f
|
|
3550
3568
|
}, null, 40, sn),
|
|
3551
|
-
n.query ? (A(), T(
|
|
3552
|
-
n.results.length ? (A(), T(
|
|
3553
|
-
|
|
3569
|
+
n.query ? (A(), T(ue, { key: 0 }, [
|
|
3570
|
+
n.results.length ? (A(), T(ue, { key: 1 }, [
|
|
3571
|
+
F("button", {
|
|
3554
3572
|
type: "button",
|
|
3555
3573
|
class: "flow-canvas-search-popover__nav-btn",
|
|
3556
3574
|
"aria-label": "上一个",
|
|
3557
3575
|
onClick: w[0] || (w[0] = (D) => t("prevMatch"))
|
|
3558
3576
|
}, [...w[2] || (w[2] = [
|
|
3559
|
-
|
|
3577
|
+
F("svg", {
|
|
3560
3578
|
viewBox: "0 0 16 16",
|
|
3561
3579
|
width: "12",
|
|
3562
3580
|
height: "12"
|
|
3563
3581
|
}, [
|
|
3564
|
-
|
|
3582
|
+
F("path", {
|
|
3565
3583
|
d: "M10.3 12.3 6 8l4.3-4.3",
|
|
3566
3584
|
fill: "none",
|
|
3567
3585
|
stroke: "currentColor",
|
|
@@ -3571,19 +3589,19 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
|
|
|
3571
3589
|
})
|
|
3572
3590
|
], -1)
|
|
3573
3591
|
])]),
|
|
3574
|
-
|
|
3575
|
-
|
|
3592
|
+
F("span", an, fe(n.matchIndex >= 0 ? n.matchIndex + 1 : 0) + " / " + fe(n.results.length), 1),
|
|
3593
|
+
F("button", {
|
|
3576
3594
|
type: "button",
|
|
3577
3595
|
class: "flow-canvas-search-popover__nav-btn",
|
|
3578
3596
|
"aria-label": "下一个",
|
|
3579
3597
|
onClick: w[1] || (w[1] = (D) => t("nextMatch"))
|
|
3580
3598
|
}, [...w[3] || (w[3] = [
|
|
3581
|
-
|
|
3599
|
+
F("svg", {
|
|
3582
3600
|
viewBox: "0 0 16 16",
|
|
3583
3601
|
width: "12",
|
|
3584
3602
|
height: "12"
|
|
3585
3603
|
}, [
|
|
3586
|
-
|
|
3604
|
+
F("path", {
|
|
3587
3605
|
d: "M5.7 3.7 10 8l-4.3 4.3",
|
|
3588
3606
|
fill: "none",
|
|
3589
3607
|
stroke: "currentColor",
|
|
@@ -3594,27 +3612,27 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
|
|
|
3594
3612
|
], -1)
|
|
3595
3613
|
])])
|
|
3596
3614
|
], 64)) : (A(), T("span", rn, "无结果"))
|
|
3597
|
-
], 64)) :
|
|
3598
|
-
w[4] || (w[4] =
|
|
3615
|
+
], 64)) : K("", !0),
|
|
3616
|
+
w[4] || (w[4] = F("i", { class: "flow-canvas-icon canvas-search flow-canvas-search-popover__search-icon" }, null, -1))
|
|
3599
3617
|
]),
|
|
3600
3618
|
n.query && n.results.length ? (A(), T("div", {
|
|
3601
3619
|
key: 0,
|
|
3602
3620
|
class: "flow-canvas-search-popover__list-box",
|
|
3603
|
-
onMouseleave:
|
|
3621
|
+
onMouseleave: h
|
|
3604
3622
|
}, [
|
|
3605
|
-
(A(!0), T(
|
|
3623
|
+
(A(!0), T(ue, null, Ce(n.results, (D, O) => (A(), T("button", {
|
|
3606
3624
|
key: D.id,
|
|
3607
3625
|
type: "button",
|
|
3608
|
-
class:
|
|
3626
|
+
class: oe(["flow-canvas-search-popover__item", { "is-active": O === i.value, "is-matched": O === n.matchIndex }]),
|
|
3609
3627
|
onMouseenter: (b) => a(O),
|
|
3610
3628
|
onClick: (b) => t("select", D.id)
|
|
3611
3629
|
}, [
|
|
3612
|
-
|
|
3630
|
+
F("span", dn, fe(D.label), 1)
|
|
3613
3631
|
], 42, ln))), 128))
|
|
3614
|
-
], 32)) :
|
|
3615
|
-
], 4)) :
|
|
3632
|
+
], 32)) : K("", !0)
|
|
3633
|
+
], 4)) : K("", !0);
|
|
3616
3634
|
}
|
|
3617
|
-
}), un = /* @__PURE__ */
|
|
3635
|
+
}), un = /* @__PURE__ */ me(cn, [["__scopeId", "data-v-aca2b1c1"]]), nt = 282, fn = 4, gn = 300, _e = "flow-canvas-node-ring-target--search-match", Pe = "flow-canvas-node-ring-target--search-current", pn = "flow-canvas-node-ring-target";
|
|
3618
3636
|
function hn(n) {
|
|
3619
3637
|
return n !== null;
|
|
3620
3638
|
}
|
|
@@ -3642,9 +3660,9 @@ function yn(n, e) {
|
|
|
3642
3660
|
}
|
|
3643
3661
|
function On(n) {
|
|
3644
3662
|
let e = null, o = null, t = null, s = null, r = null, i = null;
|
|
3645
|
-
const l = H(!1), a = H(""),
|
|
3646
|
-
const g = a.value.trim().toLowerCase(),
|
|
3647
|
-
return g ? p.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0,
|
|
3663
|
+
const l = H(!1), a = H(""), h = H({ x: 0, y: 0, width: nt }), f = H(-1), p = V(() => e ? Object.values(e.flowModel.value.nodes).map((g) => yn(g, n)).filter(hn) : []), u = V(() => {
|
|
3664
|
+
const g = a.value.trim().toLowerCase(), v = Math.max(1, n?.maxResults ?? gn);
|
|
3665
|
+
return g ? p.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0, v) : p.value.slice(0, v);
|
|
3648
3666
|
});
|
|
3649
3667
|
function w() {
|
|
3650
3668
|
return t?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="search"]');
|
|
@@ -3653,10 +3671,10 @@ function On(n) {
|
|
|
3653
3671
|
return w()?.closest(".flow-canvas-toolbar");
|
|
3654
3672
|
}
|
|
3655
3673
|
function O() {
|
|
3656
|
-
const g = D(),
|
|
3674
|
+
const g = D(), v = t?.getBoundingClientRect(), m = g?.getBoundingClientRect() ?? v;
|
|
3657
3675
|
if (!m) return;
|
|
3658
3676
|
const E = Math.max(nt, Math.round(m.width));
|
|
3659
|
-
|
|
3677
|
+
h.value = {
|
|
3660
3678
|
x: mn(m.left, E),
|
|
3661
3679
|
y: m.bottom + fn,
|
|
3662
3680
|
width: E
|
|
@@ -3664,16 +3682,16 @@ function On(n) {
|
|
|
3664
3682
|
}
|
|
3665
3683
|
function b(g) {
|
|
3666
3684
|
if (!o) return null;
|
|
3667
|
-
const
|
|
3668
|
-
if (!
|
|
3669
|
-
const m = o.graph.findViewByCell(
|
|
3685
|
+
const v = o.graph.getCellById(g);
|
|
3686
|
+
if (!v?.isNode()) return null;
|
|
3687
|
+
const m = o.graph.findViewByCell(v)?.container;
|
|
3670
3688
|
return m ? m.querySelector(".flow-canvas-highlight-target") ?? m.querySelector(".flow-canvas-node-surface > :first-child") : null;
|
|
3671
3689
|
}
|
|
3672
3690
|
function S() {
|
|
3673
3691
|
if (!o) return;
|
|
3674
3692
|
const g = o.graph.getNodes();
|
|
3675
|
-
for (const
|
|
3676
|
-
const m = b(
|
|
3693
|
+
for (const v of g) {
|
|
3694
|
+
const m = b(v.id);
|
|
3677
3695
|
m && m.classList.remove(_e, Pe);
|
|
3678
3696
|
}
|
|
3679
3697
|
}
|
|
@@ -3684,28 +3702,28 @@ function On(n) {
|
|
|
3684
3702
|
S();
|
|
3685
3703
|
return;
|
|
3686
3704
|
}
|
|
3687
|
-
const
|
|
3705
|
+
const v = new Set(u.value.map((L) => L.id)), m = f.value >= 0 ? u.value[f.value]?.id : null, E = o.graph.getNodes();
|
|
3688
3706
|
for (const L of E) {
|
|
3689
3707
|
const z = b(L.id);
|
|
3690
|
-
z && (z.classList.add(pn), L.id === m ? (z.classList.remove(_e), z.classList.add(Pe)) :
|
|
3708
|
+
z && (z.classList.add(pn), L.id === m ? (z.classList.remove(_e), z.classList.add(Pe)) : v.has(L.id) ? (z.classList.remove(Pe), z.classList.add(_e)) : z.classList.remove(_e, Pe));
|
|
3691
3709
|
}
|
|
3692
3710
|
}
|
|
3693
3711
|
function B(g) {
|
|
3694
3712
|
if (!o) return;
|
|
3695
|
-
const
|
|
3696
|
-
|
|
3713
|
+
const v = u.value.findIndex((m) => m.id === g);
|
|
3714
|
+
v >= 0 && (f.value = v), o.api.scrollToNode(g), M();
|
|
3697
3715
|
}
|
|
3698
3716
|
function j() {
|
|
3699
3717
|
const g = u.value;
|
|
3700
3718
|
if (g.length === 0) return;
|
|
3701
|
-
const
|
|
3702
|
-
f.value =
|
|
3719
|
+
const v = f.value < g.length - 1 ? f.value + 1 : 0;
|
|
3720
|
+
f.value = v, B(g[v].id);
|
|
3703
3721
|
}
|
|
3704
3722
|
function k() {
|
|
3705
3723
|
const g = u.value;
|
|
3706
3724
|
if (g.length === 0) return;
|
|
3707
|
-
const
|
|
3708
|
-
f.value =
|
|
3725
|
+
const v = f.value > 0 ? f.value - 1 : g.length - 1;
|
|
3726
|
+
f.value = v, B(g[v].id);
|
|
3709
3727
|
}
|
|
3710
3728
|
function X() {
|
|
3711
3729
|
o && (l.value = !0, O(), requestAnimationFrame(() => O()));
|
|
@@ -3721,18 +3739,18 @@ function On(n) {
|
|
|
3721
3739
|
X();
|
|
3722
3740
|
}
|
|
3723
3741
|
function d(g) {
|
|
3724
|
-
const
|
|
3725
|
-
return !!(
|
|
3742
|
+
const v = w();
|
|
3743
|
+
return !!(v && g instanceof Node && v.contains(g));
|
|
3726
3744
|
}
|
|
3727
3745
|
function y() {
|
|
3728
3746
|
l.value && O();
|
|
3729
3747
|
}
|
|
3730
|
-
const c =
|
|
3748
|
+
const c = pe({
|
|
3731
3749
|
name: "FlowCanvasSearchHost",
|
|
3732
3750
|
setup() {
|
|
3733
3751
|
return () => qe(un, {
|
|
3734
3752
|
open: l.value,
|
|
3735
|
-
position:
|
|
3753
|
+
position: h.value,
|
|
3736
3754
|
query: a.value,
|
|
3737
3755
|
results: u.value,
|
|
3738
3756
|
matchIndex: f.value,
|
|
@@ -3755,7 +3773,7 @@ function On(n) {
|
|
|
3755
3773
|
e = g;
|
|
3756
3774
|
},
|
|
3757
3775
|
attachRuntime(g) {
|
|
3758
|
-
o = g, t = g.graph.container.closest(".flow-canvas-layout__content") ?? g.graph.container.parentElement, s = document.createElement("div"), s.className = "flow-canvas-search-host", document.body.append(s), r = bt(c), r.mount(s), i =
|
|
3776
|
+
o = g, t = g.graph.container.closest(".flow-canvas-layout__content") ?? g.graph.container.parentElement, s = document.createElement("div"), s.className = "flow-canvas-search-host", document.body.append(s), r = bt(c), r.mount(s), i = he(
|
|
3759
3777
|
() => [a.value, u.value.length],
|
|
3760
3778
|
() => {
|
|
3761
3779
|
f.value = -1, M();
|
|
@@ -3810,7 +3828,7 @@ function En(n) {
|
|
|
3810
3828
|
top: `${st}px`,
|
|
3811
3829
|
left: `${rt}px`
|
|
3812
3830
|
});
|
|
3813
|
-
let t = null, s = n.defaultOpen ?? !1, r = null, i = null, l = null, a = null,
|
|
3831
|
+
let t = null, s = n.defaultOpen ?? !1, r = null, i = null, l = null, a = null, h = {
|
|
3814
3832
|
width: n.width,
|
|
3815
3833
|
height: n.height
|
|
3816
3834
|
};
|
|
@@ -3830,7 +3848,7 @@ function En(n) {
|
|
|
3830
3848
|
height: n.height,
|
|
3831
3849
|
offset: n.panelOffset ?? pt
|
|
3832
3850
|
});
|
|
3833
|
-
|
|
3851
|
+
h = {
|
|
3834
3852
|
width: k.width,
|
|
3835
3853
|
height: k.height
|
|
3836
3854
|
}, Object.assign(e.style, {
|
|
@@ -3867,8 +3885,8 @@ function En(n) {
|
|
|
3867
3885
|
function S() {
|
|
3868
3886
|
t || (t = new Ct({
|
|
3869
3887
|
container: o,
|
|
3870
|
-
width:
|
|
3871
|
-
height:
|
|
3888
|
+
width: h.width,
|
|
3889
|
+
height: h.height,
|
|
3872
3890
|
padding: n.contentPadding ?? wn,
|
|
3873
3891
|
scalable: !1
|
|
3874
3892
|
}), n.sourceGraph.use(t));
|
|
@@ -3914,8 +3932,8 @@ function $n(n) {
|
|
|
3914
3932
|
name: "minimap",
|
|
3915
3933
|
priority: 90,
|
|
3916
3934
|
attachRuntime(a) {
|
|
3917
|
-
const
|
|
3918
|
-
o =
|
|
3935
|
+
const h = a, f = n?.width ?? 334, p = n?.height ?? 180;
|
|
3936
|
+
o = h.graph.container.closest(".flow-canvas-layout__content") ?? h.graph.container.parentElement;
|
|
3919
3937
|
const u = n?.container ?? o;
|
|
3920
3938
|
u && (e = En({
|
|
3921
3939
|
sourceGraph: a.graph,
|
|
@@ -3959,22 +3977,22 @@ function Bn() {
|
|
|
3959
3977
|
if (!r.length) return !1;
|
|
3960
3978
|
const i = t.flowModel.value, l = new Set(r.filter((f) => f.isNode()).map((f) => f.id)), a = [...l].map((f) => i.nodes[f]).filter(Boolean);
|
|
3961
3979
|
if (!a.length) return !1;
|
|
3962
|
-
const
|
|
3980
|
+
const h = Object.values(i.edges).filter(
|
|
3963
3981
|
(f) => l.has(f.source.nodeId) && l.has(f.target.nodeId)
|
|
3964
3982
|
);
|
|
3965
|
-
return n = { nodes: a, edges:
|
|
3983
|
+
return n = { nodes: a, edges: h }, e = 0, !0;
|
|
3966
3984
|
}
|
|
3967
3985
|
if (s && o.key === "v") {
|
|
3968
3986
|
if (!n?.nodes.length) return !1;
|
|
3969
3987
|
e++;
|
|
3970
3988
|
const r = e * 30, i = /* @__PURE__ */ new Map(), l = [];
|
|
3971
3989
|
for (const a of n.nodes) {
|
|
3972
|
-
const
|
|
3973
|
-
i.set(a.id,
|
|
3990
|
+
const h = `${a.id}_cp${ee().slice(0, 6)}`;
|
|
3991
|
+
i.set(a.id, h), l.push({
|
|
3974
3992
|
type: "node.add",
|
|
3975
3993
|
node: {
|
|
3976
3994
|
...a,
|
|
3977
|
-
id:
|
|
3995
|
+
id: h,
|
|
3978
3996
|
position: {
|
|
3979
3997
|
x: a.position.x + r,
|
|
3980
3998
|
y: a.position.y + r
|
|
@@ -3985,21 +4003,21 @@ function Bn() {
|
|
|
3985
4003
|
});
|
|
3986
4004
|
}
|
|
3987
4005
|
for (const a of n.edges) {
|
|
3988
|
-
const
|
|
3989
|
-
!
|
|
4006
|
+
const h = i.get(a.source.nodeId), f = i.get(a.target.nodeId);
|
|
4007
|
+
!h || !f || l.push({
|
|
3990
4008
|
type: "edge.add",
|
|
3991
4009
|
edge: {
|
|
3992
4010
|
...a,
|
|
3993
|
-
id: `${a.id}_cp${
|
|
3994
|
-
source: { ...a.source, nodeId:
|
|
4011
|
+
id: `${a.id}_cp${ee().slice(0, 6)}`,
|
|
4012
|
+
source: { ...a.source, nodeId: h },
|
|
3995
4013
|
target: { ...a.target, nodeId: f },
|
|
3996
|
-
labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${
|
|
4014
|
+
labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${ee().slice(0, 6)}` })),
|
|
3997
4015
|
payload: a.payload ? { ...a.payload } : {}
|
|
3998
4016
|
}
|
|
3999
4017
|
});
|
|
4000
4018
|
}
|
|
4001
4019
|
return l.length && t.executeCommand({
|
|
4002
|
-
id:
|
|
4020
|
+
id: ee(),
|
|
4003
4021
|
source: "user:keyboard",
|
|
4004
4022
|
label: "粘贴",
|
|
4005
4023
|
timestamp: Date.now(),
|
|
@@ -4011,7 +4029,7 @@ function Bn() {
|
|
|
4011
4029
|
};
|
|
4012
4030
|
}
|
|
4013
4031
|
export {
|
|
4014
|
-
|
|
4032
|
+
ge as CanvasConstraintError,
|
|
4015
4033
|
An as CanvasLayout,
|
|
4016
4034
|
Ro as CanvasNodePalette,
|
|
4017
4035
|
Dn as CanvasRuntime,
|
|
@@ -4028,7 +4046,7 @@ export {
|
|
|
4028
4046
|
Pn as createDefaultSchema,
|
|
4029
4047
|
Ho as createDefaultToolbarItems,
|
|
4030
4048
|
Mn as createEmptyFlowModel,
|
|
4031
|
-
|
|
4049
|
+
ee as generateId,
|
|
4032
4050
|
$n as minimapPlugin,
|
|
4033
4051
|
On as searchPlugin,
|
|
4034
4052
|
Rn as selectionPlugin,
|