@mx-sose-front/mx-sose-graph 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +721 -454
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +7 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ContextMenu/ContextMenu.vue +18 -4
- package/src/components/InteractionLayer.vue +408 -414
- package/src/components/NameEditor.vue +212 -0
- package/src/components/SelectionBox.vue +189 -0
- package/src/constants/index.ts +2 -0
- package/src/utils/contextMenuUtils.ts +63 -6
- package/src/utils/diagram.ts +19 -15
- package/src/utils/keyboardUtils.ts +28 -0
- package/src/utils/nameEditUtils.ts +6 -1
- package/src/utils/packgeMap.ts +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { toRaw, computed, isRef, isReactive, toRef, hasInjectionContext, inject, getCurrentInstance, ref, watch, reactive, markRaw, effectScope, nextTick, getCurrentScope, onScopeDispose, toRefs, shallowReactive, defineComponent, openBlock, createElementBlock, createElementVNode,
|
|
7
|
+
import { toRaw, computed, isRef, isReactive, toRef, hasInjectionContext, inject, getCurrentInstance, ref, watch, reactive, markRaw, effectScope, nextTick, getCurrentScope, onScopeDispose, toRefs, shallowReactive, defineComponent, openBlock, createElementBlock, normalizeStyle, withDirectives, createElementVNode, Fragment, renderList, unref, normalizeClass, withModifiers, vShow, createCommentVNode, withKeys, vModelText, onMounted, onUnmounted, resolveComponent, createBlock, Teleport as Teleport$1, createVNode, withCtx, shallowRef, watchEffect, readonly, customRef, warn, provide, renderSlot, mergeProps, useSlots, Transition, resolveDynamicComponent, createTextVNode, toDisplayString, useAttrs as useAttrs$1, onBeforeUnmount, onActivated, onUpdated, cloneVNode, Comment, Text as Text$1, onBeforeMount, onDeactivated, createSlots, normalizeProps, guardReactiveProps, isVNode, h as h$1, triggerRef, vModelCheckbox, vModelRadio, onBeforeUpdate, toHandlers, TransitionGroup, resolveDirective, toHandlerKey, render, createApp, useCssVars } from "vue";
|
|
8
8
|
var v = false, o, f, s, u, d, N$1, l, p, m, w, D, x, E$1, M, F;
|
|
9
9
|
function a() {
|
|
10
10
|
if (!v) {
|
|
@@ -97,7 +97,6 @@ var Y = T;
|
|
|
97
97
|
* @internal
|
|
98
98
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
99
99
|
*/
|
|
100
|
-
const _imports_0$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAACbSURBVGiB7dfRCYAwDEXRVhxIcRJncC5ncBLRjXQCaSRS9eWeb4VeAqFNCQAAoJLs+fmYxuO5o/jleSn2NHWO8h0EqyNYnWtLe1xteMum9Qg3YYLVEayOYHXhglvLR10/FJ+B+7a+dom5I9yECVZHsDqC1YULNl08/nKpsAg3YYLVEayO56E6gtURrI5gdeGCeR6qCxcMAABQzQn/mxU1UF28jAAAAABJRU5ErkJggg==";
|
|
101
100
|
const InteractionLayerEmits = [
|
|
102
101
|
"propertyPanel",
|
|
103
102
|
"editName",
|
|
@@ -8796,12 +8795,14 @@ const nameInputStyle = (shape) => {
|
|
|
8796
8795
|
};
|
|
8797
8796
|
const nameEditorContainerStyle = (shape) => {
|
|
8798
8797
|
var _a2;
|
|
8799
|
-
const
|
|
8800
|
-
const
|
|
8801
|
-
const
|
|
8802
|
-
|
|
8798
|
+
const graphStore = useGraphStore();
|
|
8799
|
+
const latestShape = graphStore.shapes.find((s2) => s2.id === shape.id) || shape;
|
|
8800
|
+
const b2 = latestShape.bounds ?? {};
|
|
8801
|
+
const nb = latestShape.nameBounds ?? {};
|
|
8802
|
+
const ns = latestShape.nameStyle ?? {};
|
|
8803
|
+
if (latestShape.shapeType === "pin" && nb.x != null && nb.y != null) {
|
|
8803
8804
|
const fontSize = Number(ns.fontSize || nb.height || 12);
|
|
8804
|
-
const textLen = ((_a2 =
|
|
8805
|
+
const textLen = ((_a2 = latestShape.name) == null ? void 0 : _a2.length) || 0;
|
|
8805
8806
|
const textWidth = Math.max(10, textLen * fontSize * 0.6);
|
|
8806
8807
|
const boxW = Math.min(300, Math.max(40, textWidth + 14));
|
|
8807
8808
|
const boxH = Math.max(22, fontSize + 10);
|
|
@@ -8833,8 +8834,8 @@ const nameEditorContainerStyle = (shape) => {
|
|
|
8833
8834
|
zIndex: "1001"
|
|
8834
8835
|
};
|
|
8835
8836
|
}
|
|
8836
|
-
const shapeBounds =
|
|
8837
|
-
const nameBounds =
|
|
8837
|
+
const shapeBounds = latestShape.bounds ?? {};
|
|
8838
|
+
const nameBounds = latestShape.nameBounds ?? {};
|
|
8838
8839
|
const absoluteY = (shapeBounds.y ?? 0) + (nameBounds.y ?? 0);
|
|
8839
8840
|
return {
|
|
8840
8841
|
position: "absolute",
|
|
@@ -9791,6 +9792,7 @@ const useGraphStore = /* @__PURE__ */ defineStore(
|
|
|
9791
9792
|
}
|
|
9792
9793
|
}
|
|
9793
9794
|
);
|
|
9795
|
+
const _imports_0$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAACbSURBVGiB7dfRCYAwDEXRVhxIcRJncC5ncBLRjXQCaSRS9eWeb4VeAqFNCQAAoJLs+fmYxuO5o/jleSn2NHWO8h0EqyNYnWtLe1xteMum9Qg3YYLVEayOYHXhglvLR10/FJ+B+7a+dom5I9yECVZHsDqC1YULNl08/nKpsAg3YYLVEayO56E6gtURrI5gdeGCeR6qCxcMAABQzQn/mxU1UF28jAAAAABJRU5ErkJggg==";
|
|
9794
9796
|
const BlockKeyMap = {
|
|
9795
9797
|
"ArchitecturalDescription": "Package",
|
|
9796
9798
|
//体系架构
|
|
@@ -10215,8 +10217,12 @@ const BlockKeyMap = {
|
|
|
10215
10217
|
//定向关系
|
|
10216
10218
|
"OperationalControlFlow": "Edge",
|
|
10217
10219
|
//业务控制流
|
|
10220
|
+
"OperationalObjectFlow": "Edge",
|
|
10221
|
+
//业务对象流
|
|
10218
10222
|
"FunctionControlFlow": "Edge",
|
|
10219
10223
|
//功能控制流
|
|
10224
|
+
"FunctionObjectFlow": "Edge",
|
|
10225
|
+
// 功能对象流
|
|
10220
10226
|
"ServiceConnector": "Edge",
|
|
10221
10227
|
//服务连接器
|
|
10222
10228
|
"ServiceControlFlow": "Edge",
|
|
@@ -10622,111 +10628,6 @@ const PinKeyMap = {
|
|
|
10622
10628
|
//输入引脚
|
|
10623
10629
|
"OperationalPort": "Port"
|
|
10624
10630
|
};
|
|
10625
|
-
const withDrag = (onMove, onUp) => {
|
|
10626
|
-
const move = (e) => onMove(e);
|
|
10627
|
-
const up = (e) => {
|
|
10628
|
-
try {
|
|
10629
|
-
onUp(e);
|
|
10630
|
-
} finally {
|
|
10631
|
-
window.removeEventListener("mousemove", move);
|
|
10632
|
-
window.removeEventListener("mouseup", up);
|
|
10633
|
-
}
|
|
10634
|
-
};
|
|
10635
|
-
window.addEventListener("mousemove", move);
|
|
10636
|
-
window.addEventListener("mouseup", up);
|
|
10637
|
-
return () => {
|
|
10638
|
-
window.removeEventListener("mousemove", move);
|
|
10639
|
-
window.removeEventListener("mouseup", up);
|
|
10640
|
-
};
|
|
10641
|
-
};
|
|
10642
|
-
let registry = {};
|
|
10643
|
-
function registerShapes(map2) {
|
|
10644
|
-
registry = { ...registry, ...map2 };
|
|
10645
|
-
}
|
|
10646
|
-
function getShapeComponentByKey(key) {
|
|
10647
|
-
if (!key)
|
|
10648
|
-
return null;
|
|
10649
|
-
return registry[key] ?? null;
|
|
10650
|
-
}
|
|
10651
|
-
function getComponentByShapeKey(shapeKey) {
|
|
10652
|
-
const componentName2 = BlockKeyMap[shapeKey] || shapeKey;
|
|
10653
|
-
return getShapeComponentByKey(componentName2) || componentName2;
|
|
10654
|
-
}
|
|
10655
|
-
function getComponentByPinKey(shapeKey) {
|
|
10656
|
-
const componentName2 = PinKeyMap[shapeKey] || shapeKey;
|
|
10657
|
-
return getShapeComponentByKey(componentName2) || componentName2;
|
|
10658
|
-
}
|
|
10659
|
-
function getComponentByDiagramKey(shapeKey) {
|
|
10660
|
-
const componentName2 = DiagramKeyMap[shapeKey] || shapeKey;
|
|
10661
|
-
return getShapeComponentByKey(componentName2) || componentName2;
|
|
10662
|
-
}
|
|
10663
|
-
const getShapeComponent = (shape) => {
|
|
10664
|
-
const { shapeType, shapeKey } = shape;
|
|
10665
|
-
switch (shapeType) {
|
|
10666
|
-
case "pin":
|
|
10667
|
-
return getComponentByPinKey(shapeKey);
|
|
10668
|
-
case "shape":
|
|
10669
|
-
return getComponentByShapeKey(shapeKey);
|
|
10670
|
-
case "diagram":
|
|
10671
|
-
return getComponentByDiagramKey(shapeKey);
|
|
10672
|
-
case "edge":
|
|
10673
|
-
return getComponentByShapeKey(shapeKey);
|
|
10674
|
-
default:
|
|
10675
|
-
return "ShapeComponent";
|
|
10676
|
-
}
|
|
10677
|
-
};
|
|
10678
|
-
const getShapeStyle = (shape) => {
|
|
10679
|
-
const { bounds, shapeType } = shape;
|
|
10680
|
-
if (shapeType === "edge") {
|
|
10681
|
-
let waypoints = [];
|
|
10682
|
-
if (shape.waypointId) {
|
|
10683
|
-
if (typeof shape.waypointId === "string") {
|
|
10684
|
-
try {
|
|
10685
|
-
waypoints = JSON.parse(shape.waypointId);
|
|
10686
|
-
} catch (error) {
|
|
10687
|
-
console.error("解析waypointId失败:", error);
|
|
10688
|
-
waypoints = [];
|
|
10689
|
-
}
|
|
10690
|
-
} else if (Array.isArray(shape.waypointId)) {
|
|
10691
|
-
waypoints = shape.waypointId;
|
|
10692
|
-
}
|
|
10693
|
-
}
|
|
10694
|
-
if (waypoints.length === 0) {
|
|
10695
|
-
return {
|
|
10696
|
-
position: "absolute",
|
|
10697
|
-
left: "0px",
|
|
10698
|
-
top: "0px",
|
|
10699
|
-
width: "100px",
|
|
10700
|
-
height: "50px",
|
|
10701
|
-
opacity: 0
|
|
10702
|
-
// 初始时隐藏
|
|
10703
|
-
};
|
|
10704
|
-
}
|
|
10705
|
-
const xs = waypoints.map((wp) => wp.x);
|
|
10706
|
-
const ys = waypoints.map((wp) => wp.y);
|
|
10707
|
-
const minX = Math.min(...xs);
|
|
10708
|
-
const maxX = Math.max(...xs);
|
|
10709
|
-
const minY = Math.min(...ys);
|
|
10710
|
-
const maxY = Math.max(...ys);
|
|
10711
|
-
const padding2 = 10;
|
|
10712
|
-
const width = Math.max(maxX - minX + padding2 * 2, 20);
|
|
10713
|
-
const height = maxY - minY + padding2 * 2;
|
|
10714
|
-
return {
|
|
10715
|
-
position: "absolute",
|
|
10716
|
-
left: `${minX - padding2}px`,
|
|
10717
|
-
top: `${minY - padding2}px`,
|
|
10718
|
-
width: `${width}px`,
|
|
10719
|
-
height: `${height}px`
|
|
10720
|
-
};
|
|
10721
|
-
}
|
|
10722
|
-
return {
|
|
10723
|
-
position: "absolute",
|
|
10724
|
-
left: `${(bounds == null ? void 0 : bounds.x) || 0}px`,
|
|
10725
|
-
top: `${(bounds == null ? void 0 : bounds.y) || 0}px`,
|
|
10726
|
-
width: `${(bounds == null ? void 0 : bounds.width) || 100}px`,
|
|
10727
|
-
height: `${(bounds == null ? void 0 : bounds.height) || 50}px`
|
|
10728
|
-
};
|
|
10729
|
-
};
|
|
10730
10631
|
const __vite_glob_3_0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAZ9SURBVHic7ZtPTNtWHMd/79lp0rWjoWVbp6rANFZNmkRSytB6AA6NtFsrZXcqbcdJHJg0VdOUrhGquJQDEschlXsjsTM7pGjaWtGWcGKFaQHRdX9ol3VdG7D9fjvENi8h9nvPo5Cs/pxix89+/vr3+76fn22CiBqEeEL3uwONTiiQgFAgAaFAAkKBBIQCCdCDNkyn0/H19V/Om4x17m6XdheNkNLJkyemc7lcKUj7wAIV19YzyNhw0PZ7hVnpawIAPgnSPnCKIWPng7bda5CxC0HbkiCVdDqdjv9cXNtwd0JpNmgHXiR2hMcBAI4djb89Ozu7qrqPQCn24MFvCec3ASjcnb/dkAL19Lw/iICDAABPnvyTBABlgQKlGGOmKxBQuhBkH3sCJQXnp8mshP/GHrsI0shCdA+mke1ONBo61fLuAqtEkiqBBELG3IPpB6N5/633Dy0WKTq/EXBvIiidTscBwKl9St/fvNmwEWT3zal/4mcHBpRFUhaoxqCVTW+vIbBtAVbZUC5qlUexGoOWTq9kdnnIRLyAgHEAgIMRbWT+iy6p6Ou9upIoG2yqskQWKIH868esb2Y/fVdcHVNScPzHZNYgAMzI9hmCCGQh5z8SI1hydPmCYeK17bQkAADw3LDGAeCczDHLBssggn1hMGEhXHz4By0mR5c/W/jyHd8T1qmWN5yKn6n7kHKKIXeQaMth3wjqvnI/Y5h4g/MsF41o0leSkrqR2mmYeKP7yv2MX9uWlkPuRQxi1EqVdE0FXbp3d77Na9tkdnnIYDjFrSoSAtNRDfOtrViQSg+O/rG1jr/NzaRpYQIR3AoZACCik4/8Iul0T++Gs33s8CtnVAYWpRRbX3/ophdvfrWkJpfiBqPj7rYECq3RWHruUntgU7fbrgLATP/Y2vU/N8s5J+0ME6+lJpfyXqITIAWnoraNWlogpRSzTc5u6S3Q74/oEHeFS/9VnFrmLrWvtkZjaQBw6pzOjUea980zJW6KVp2DBIoehB3OLz+DthDdu2dCYGI3xXGYu9S+GqHEvQc0kF302lan2vbFVDRqpRRDrlz3NWgkrpCxCN3hDd3ZlWGLsQzvIwJKGqXZxUzXBL9S10nB2MIdx6ylpeXQwqPHlexTNWrpCOpPpTr4tJnznzpwR634EXPHdqxytWXFAQCIW3Um52rqKM8i0J7mcNJRqaKWFmjzyVMpg7ZxzbL0l77jylJCr8se10EjMF27rvfqCn+ixdr/eQgNVlFLp5jJWNJd8DHoSm+wAEgq1auJidpRw06VCc/2kmyZXLoQFPgcKQBUvFGlopY3ac7cqqYR6hDhIsRgmOkfW/P0h6CkJpfiFkO3SCRA/PukRfipj91PMd7colx1Wo9XD0Tz/BD8ePP5VGpyScVzfOkfW+v4dYN+zc8qHG9jvhF54sQbbhSrGLVUJd2fSnU8fVz6yemMXwXtYI9U49yqokZh4oBO8/Ej5qpqJQ0AcGb0x0GDkYTFYJg3ZY3SkdoRrh6ne3pXnHayFbVUBFUZNPUPZYfFTNeERoCfq+60GIw/32J3Hv5BN5Kjy9JPGrqzK8PvfXXfLJvkW4vBeJU4BHYM/15UG/WWVBRJCVRl0OIRzGXx8qmsRukIP6q5+7RwSHY/jJtB4ChqlI4sXj6l8MCAn6Pmz8kbOQ+qNmilGcTFTNfEm6+xLo3CCCEwY9+0FmIR+UdFukambU8rAsF8hJKPj8Zi52QjxyGIUUt5EH83/FZne1vQx7j7Te3zvHt354VljjCC7KrTGYGKzSoOAEAulysRriaTqaiFAvFmRkQFYjNAiVtxyxi1UCDezLT6M3tNBX8OJqtr/lWITZrbCaV600dQ1TlIjGS+AqXT6TgCuLcJfDXarFRX1CBMMd9R7OzAQKL89Nkde3Ejouuf71ZH9xPTNK8iwHEAgAOR6Llbt77ztA7fYc54Vv6QW2wzTHPKZ/OmxH7O5ymQb4oxgNgL6VUDYSH63kSrTLkWSCO/6qIAVsxZqpKWFohQOtOoL0qp0tPbl0HGdu9m9WUmFEhAKJCAUCABoUACQoEEhAIJCAUSEAokIBRIQCiQgFAgAaFAAuSnOxgO9vT2+b5y2zQofNgiLRACDgb9YqaZ8U0xnVLft7b+D4jOUfjoua/vg6FG/7I5KDqlxdu3f9jxah9PoG9WXybCUUxAKJCAUCABoUACQoEEhAIJCAUSEAokIBRIwL9jGpoMstHI7QAAAABJRU5ErkJggg==";
|
|
10731
10632
|
const __vite_glob_3_1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAJhSURBVHic7ds9SgNBGIfxV9FCIRKwMjZWSSts0nsAI55CBY9gIR5CEE+xmAOYPllIq1UaP0pJoYVFLCQSP5JNnNlnh+z/V62w2YwPw/j6tTQcDocmmVvOewFFodAQhYYoNEShIQoNUWiIQkMUGqLQEIWGKDREoSEKDVFoiEJDFBqi0BCFhig0RKEhCg1RaIhCQ1Z8POSm1bLHx6d/v75S2bKDZtPHUn4JZW3OoW9aLTs/v3BeiJl5jx3S2pyPDpfdksVzsnimj+d4OTpG6lFkUT2a+f6km1g3SXwuYaK81+Y1dFSP7OT4aOb7r+waC5332jR1QLzuaBdJN7Eru/b+zFAEE7qbcOd1HnR0QILZ0fNOBbMgp5o0wYSedyqYBTnVpNHRAfG6o+edHMipIO+1OYculUpf1y6TQ6Wy5bqUX0Jam/PRcdDct1q16vSMWrVq9cjvF0ILbG1Lvv7P8Lbdtru7+7lfV6t9fiLju8+3ENbmLbRMp6kDotAQhYYoNKSwoePewOLeAHu/YH7WQYp7AzuLn78+PtzdyPw9C7mjH17e/7zOUiFD50GhIQoNUWiIQkMUGrKQc3TcG0wd2zr912/Xl+3Jz9our3qZsxcu9M9vRtJ0+m/W6b+l3ucaW0cHZOF29GjnpR0do13c2Fmzxs76xHt1dEyRFuaybWOh1+10bzPzNenogCg0RKEhCg1RaIhCQwoZeru8+ud1lhZyjk4zPmcTvy80/UkYp5BHRx4UGqLQEIWGKDREoSEKDVFoiEJDFBqi0BCFhig0RKEhCg1RaIhCQxQaotAQhYYoNOQDM128k0dpjyAAAAAASUVORK5CYII=";
|
|
10732
10633
|
const __vite_glob_3_2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAALxSURBVHic7Zsxb9NQEMf/Z4PERpDYKQyUZuHSZGIh3ZhoUT8AfIR2R01b2MM3oGVgQ2o3mFoWFqjykFCjMqCwAANSwwz2MSRN06rxOY6fVdD9Jr/o+d7LT362fL4HGIZhGIbxn0JFDcTMJSCsA8JFjXk2dAjQR+c+7Kbq7X9CAHOtDpLnAKaKGC8VhA3E0bJzrpvULfQ9D2aeAlELQMn3WGPCCMJLP75/e5PUyfsVxJXqDoB6v+kgsu17zEQCugbBo0Fbgopz792o7hcKmNLxPUeiB865TgFjJsJc64JkqdeK7wIYKSgoYD6DpXUe5PSIfx0fy5WknkUI+qcxQQomSMEEKZggBROkYIIUTJCCCVIwQQomSCHVyyozTyEImxDUs6YtoulFlO+/bJ14ec2Gk1g2209uPZswTirUK4i5ugAKWxAsZJXz+85jRNOLyEEOADAF1JxpfN7JIZZKoqBesgvNSZJd0Y17kKvlrKePhCD18kp7NffAp1CWWMhDadIOJKpoKcrTnFhWEq/tr89M9KfKK+1VUNAAAFAwD8CrJGWJDSXYRTbHldNnEGNSOWfE8P4BwJ5iCiZIwQQpmCAFE6RgghRMkIIJUjBBCiZIwQQpmCAFE6RgghRMkEIRggbFSXlkAE/FGFn4NApmLoHo4fEvlBjDf4WZxNugoJfYoqBRbhw08godfnrBXKnKBCE6QJQoyPsVtL8+syqgVCW340A/9xF+eT1JiC4Ey1rVWyH3oPbazTmJZTnLkjgDFx68wsV3T7Oe3wVhq5df39vSOhdRxAkA6H/HyuVb1vCycq09r5W69hRTMEEKJkjBBCmYIAUTpGCCFEyQgglSMEEKJkhBEUSHQ10ve59NCph5eN9rlnqlsVBeVoO3QNw7JFni2WoJsXz1PalEiOaHWnlkB5KH0zrwbK0JOdq+eM6Q6LrvXYz6PSj+swbChs9JZKADobkitnimzqUw1+qA3Nb2ePqHHBDtZqyXNAzDMAzDOOIvySvHLTagE98AAAAASUVORK5CYII=";
|
|
@@ -11352,6 +11253,322 @@ class IconLoader {
|
|
|
11352
11253
|
}
|
|
11353
11254
|
__publicField(IconLoader, "iconMaps", /* @__PURE__ */ new Map());
|
|
11354
11255
|
const getIcon = (iconPath, iconName) => IconLoader.getIcon(iconPath, iconName);
|
|
11256
|
+
const _hoisted_1$i = { class: "resize-handles" };
|
|
11257
|
+
const _hoisted_2$h = ["onMousedown"];
|
|
11258
|
+
const _hoisted_3$f = { class: "border-btn" };
|
|
11259
|
+
const _hoisted_4$e = ["onMousedown", "title"];
|
|
11260
|
+
const _hoisted_5$c = ["src"];
|
|
11261
|
+
const _sfc_main$2Q = /* @__PURE__ */ defineComponent({
|
|
11262
|
+
__name: "SelectionBox",
|
|
11263
|
+
props: {
|
|
11264
|
+
shape: {},
|
|
11265
|
+
isBusy: { type: Boolean },
|
|
11266
|
+
isMultiSelected: { type: Boolean }
|
|
11267
|
+
},
|
|
11268
|
+
emits: ["resize-start", "action-button-click", "model-type-property-id-click"],
|
|
11269
|
+
setup(__props, { emit: __emit }) {
|
|
11270
|
+
const props2 = __props;
|
|
11271
|
+
const shouldShowActionButtons = computed(() => {
|
|
11272
|
+
return !props2.isMultiSelected && props2.shape.scenarioMenus && props2.shape.scenarioMenus.length > 0 && props2.shape.shapeType != ShapeConfig.SHAPE_TYPE;
|
|
11273
|
+
});
|
|
11274
|
+
const emit = __emit;
|
|
11275
|
+
const getSelectionBoxStyle = (shape) => selectionBoxStyle(shape);
|
|
11276
|
+
const getHandleStyle = (h2, shape) => handleStyle(h2.position, shape);
|
|
11277
|
+
const onHandleMouseDown = (event, position) => {
|
|
11278
|
+
emit("resize-start", event, position, props2.shape);
|
|
11279
|
+
};
|
|
11280
|
+
const onActionButtonClick = (code) => {
|
|
11281
|
+
emit("action-button-click", code, props2.shape);
|
|
11282
|
+
};
|
|
11283
|
+
const onModelTypePropertyIdClick = () => {
|
|
11284
|
+
if (props2.shape.modelTypePropertyId) {
|
|
11285
|
+
emit(
|
|
11286
|
+
"model-type-property-id-click",
|
|
11287
|
+
props2.shape.modelTypePropertyId,
|
|
11288
|
+
props2.shape
|
|
11289
|
+
);
|
|
11290
|
+
}
|
|
11291
|
+
};
|
|
11292
|
+
return (_ctx, _cache) => {
|
|
11293
|
+
return openBlock(), createElementBlock("div", {
|
|
11294
|
+
class: "selection-box",
|
|
11295
|
+
style: normalizeStyle(getSelectionBoxStyle(_ctx.shape))
|
|
11296
|
+
}, [
|
|
11297
|
+
withDirectives(createElementVNode("div", _hoisted_1$i, [
|
|
11298
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(resizeHandles), (h2) => {
|
|
11299
|
+
return openBlock(), createElementBlock("div", {
|
|
11300
|
+
key: h2.position,
|
|
11301
|
+
class: normalizeClass(["resize-handle", [`resize-${h2.position}`, { "is-disabled": _ctx.isMultiSelected }]]),
|
|
11302
|
+
style: normalizeStyle(getHandleStyle(h2, _ctx.shape)),
|
|
11303
|
+
onMousedown: withModifiers(($event) => onHandleMouseDown($event, h2.position), ["stop", "prevent"])
|
|
11304
|
+
}, null, 46, _hoisted_2$h);
|
|
11305
|
+
}), 128))
|
|
11306
|
+
], 512), [
|
|
11307
|
+
[vShow, !_ctx.isBusy && _ctx.shape.shapeType !== "edge"]
|
|
11308
|
+
]),
|
|
11309
|
+
withDirectives(createElementVNode("div", {
|
|
11310
|
+
class: "action-buttons",
|
|
11311
|
+
style: normalizeStyle(unref(actionButtonsStyle)(_ctx.shape))
|
|
11312
|
+
}, [
|
|
11313
|
+
withDirectives(createElementVNode("div", _hoisted_3$f, [
|
|
11314
|
+
createElementVNode("button", {
|
|
11315
|
+
class: "action-btn edit-btn",
|
|
11316
|
+
onMousedown: withModifiers(onModelTypePropertyIdClick, ["stop", "prevent"]),
|
|
11317
|
+
title: "设置类型"
|
|
11318
|
+
}, [..._cache[1] || (_cache[1] = [
|
|
11319
|
+
createElementVNode("img", {
|
|
11320
|
+
src: _imports_0$1,
|
|
11321
|
+
alt: "设置类型"
|
|
11322
|
+
}, null, -1)
|
|
11323
|
+
])], 32)
|
|
11324
|
+
], 512), [
|
|
11325
|
+
[vShow, _ctx.shape.modelTypePropertyId]
|
|
11326
|
+
]),
|
|
11327
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shape.scenarioMenus, (value) => {
|
|
11328
|
+
return openBlock(), createElementBlock("button", {
|
|
11329
|
+
key: value.code,
|
|
11330
|
+
class: "action-btn edit-btn",
|
|
11331
|
+
onMousedown: withModifiers(($event) => onActionButtonClick(value.code), ["stop", "prevent"]),
|
|
11332
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
11333
|
+
}, ["stop", "prevent"])),
|
|
11334
|
+
title: value.name
|
|
11335
|
+
}, [
|
|
11336
|
+
createElementVNode("img", {
|
|
11337
|
+
src: unref(getIcon)("childIcons", value.icon || "")
|
|
11338
|
+
}, null, 8, _hoisted_5$c)
|
|
11339
|
+
], 40, _hoisted_4$e);
|
|
11340
|
+
}), 128))
|
|
11341
|
+
], 4), [
|
|
11342
|
+
[vShow, shouldShowActionButtons.value]
|
|
11343
|
+
])
|
|
11344
|
+
], 4);
|
|
11345
|
+
};
|
|
11346
|
+
}
|
|
11347
|
+
});
|
|
11348
|
+
const SelectionBox_vue_vue_type_style_index_0_scoped_1a892f84_lang = "";
|
|
11349
|
+
const _export_sfc$1 = (sfc, props2) => {
|
|
11350
|
+
const target = sfc.__vccOpts || sfc;
|
|
11351
|
+
for (const [key, val] of props2) {
|
|
11352
|
+
target[key] = val;
|
|
11353
|
+
}
|
|
11354
|
+
return target;
|
|
11355
|
+
};
|
|
11356
|
+
const SelectionBox = /* @__PURE__ */ _export_sfc$1(_sfc_main$2Q, [["__scopeId", "data-v-1a892f84"]]);
|
|
11357
|
+
const _sfc_main$2P = /* @__PURE__ */ defineComponent({
|
|
11358
|
+
__name: "NameEditor",
|
|
11359
|
+
props: {
|
|
11360
|
+
selectedShape: {},
|
|
11361
|
+
canEdit: { type: Boolean },
|
|
11362
|
+
isEditingName: { type: Boolean },
|
|
11363
|
+
editingName: {},
|
|
11364
|
+
nameEditManager: {}
|
|
11365
|
+
},
|
|
11366
|
+
emits: ["editName"],
|
|
11367
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
11368
|
+
const props2 = __props;
|
|
11369
|
+
const nameInput = ref(null);
|
|
11370
|
+
const localEditingName = ref(props2.editingName);
|
|
11371
|
+
watch(() => props2.editingName, (newValue) => {
|
|
11372
|
+
localEditingName.value = newValue;
|
|
11373
|
+
});
|
|
11374
|
+
watch(() => nameInput.value, (newValue) => {
|
|
11375
|
+
if (newValue) {
|
|
11376
|
+
props2.nameEditManager.setNameInput(newValue);
|
|
11377
|
+
}
|
|
11378
|
+
});
|
|
11379
|
+
watch(() => localEditingName.value, (newValue) => {
|
|
11380
|
+
props2.nameEditManager.editingName.value = newValue;
|
|
11381
|
+
});
|
|
11382
|
+
watch(() => props2.selectedShape, (newShape) => {
|
|
11383
|
+
var _a2;
|
|
11384
|
+
if (props2.isEditingName && (!newShape || newShape.id !== ((_a2 = props2.selectedShape) == null ? void 0 : _a2.id))) {
|
|
11385
|
+
props2.nameEditManager.cancelEdit();
|
|
11386
|
+
}
|
|
11387
|
+
});
|
|
11388
|
+
const computedNameTextBoxContainerStyle = computed(() => {
|
|
11389
|
+
if (!props2.selectedShape)
|
|
11390
|
+
return {};
|
|
11391
|
+
return nameTextBoxContainerStyle(props2.selectedShape.id);
|
|
11392
|
+
});
|
|
11393
|
+
const computedNameTextBoxStyle = computed(() => {
|
|
11394
|
+
if (!props2.selectedShape)
|
|
11395
|
+
return {};
|
|
11396
|
+
return nameTextBoxStyle(props2.selectedShape);
|
|
11397
|
+
});
|
|
11398
|
+
const computedNameEditorContainerStyle = computed(() => {
|
|
11399
|
+
if (!props2.selectedShape)
|
|
11400
|
+
return {};
|
|
11401
|
+
return nameEditorContainerStyle(props2.selectedShape);
|
|
11402
|
+
});
|
|
11403
|
+
const computedNameInputStyle = computed(() => {
|
|
11404
|
+
if (!props2.selectedShape)
|
|
11405
|
+
return {};
|
|
11406
|
+
return nameInputStyle(props2.selectedShape);
|
|
11407
|
+
});
|
|
11408
|
+
const handleNameTextBoxClick = () => {
|
|
11409
|
+
if (props2.canEdit && props2.nameEditManager.canEdit(props2.selectedShape)) {
|
|
11410
|
+
startEditName();
|
|
11411
|
+
}
|
|
11412
|
+
};
|
|
11413
|
+
const startEditName = async () => {
|
|
11414
|
+
await props2.nameEditManager.startEdit(props2.selectedShape);
|
|
11415
|
+
};
|
|
11416
|
+
const handleBlur = () => {
|
|
11417
|
+
props2.nameEditManager.handleBlur(props2.selectedShape);
|
|
11418
|
+
};
|
|
11419
|
+
const handleKeyUp = (event) => {
|
|
11420
|
+
props2.nameEditManager.handleKeyUp(event, props2.selectedShape);
|
|
11421
|
+
};
|
|
11422
|
+
__expose({
|
|
11423
|
+
startEditName,
|
|
11424
|
+
canEdit: (shape) => props2.nameEditManager.canEdit(shape),
|
|
11425
|
+
cancelEdit: () => props2.nameEditManager.cancelEdit()
|
|
11426
|
+
});
|
|
11427
|
+
return (_ctx, _cache) => {
|
|
11428
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
11429
|
+
_ctx.selectedShape && _ctx.selectedShape.nameBounds && !_ctx.isEditingName && _ctx.selectedShape.shapeKey !== "ConceptRole" ? (openBlock(), createElementBlock("div", {
|
|
11430
|
+
key: 0,
|
|
11431
|
+
class: "name-text-box-container",
|
|
11432
|
+
style: normalizeStyle(computedNameTextBoxContainerStyle.value)
|
|
11433
|
+
}, [
|
|
11434
|
+
createElementVNode("div", {
|
|
11435
|
+
class: "name-text-box",
|
|
11436
|
+
style: normalizeStyle(computedNameTextBoxStyle.value),
|
|
11437
|
+
title: "点击编辑名称",
|
|
11438
|
+
onClick: handleNameTextBoxClick
|
|
11439
|
+
}, null, 4)
|
|
11440
|
+
], 4)) : createCommentVNode("", true),
|
|
11441
|
+
_ctx.isEditingName && _ctx.selectedShape && _ctx.selectedShape.shapeKey !== "ConceptRole" ? (openBlock(), createElementBlock("div", {
|
|
11442
|
+
key: 1,
|
|
11443
|
+
class: "name-editor-container",
|
|
11444
|
+
style: normalizeStyle(computedNameEditorContainerStyle.value)
|
|
11445
|
+
}, [
|
|
11446
|
+
withDirectives(createElementVNode("input", {
|
|
11447
|
+
ref_key: "nameInput",
|
|
11448
|
+
ref: nameInput,
|
|
11449
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => localEditingName.value = $event),
|
|
11450
|
+
class: "name-input",
|
|
11451
|
+
style: normalizeStyle(computedNameInputStyle.value),
|
|
11452
|
+
onBlur: handleBlur,
|
|
11453
|
+
onKeyup: [
|
|
11454
|
+
_cache[1] || (_cache[1] = withKeys(($event) => handleKeyUp($event), ["enter"])),
|
|
11455
|
+
_cache[2] || (_cache[2] = withKeys(($event) => handleKeyUp($event), ["escape"]))
|
|
11456
|
+
]
|
|
11457
|
+
}, null, 36), [
|
|
11458
|
+
[vModelText, localEditingName.value]
|
|
11459
|
+
])
|
|
11460
|
+
], 4)) : createCommentVNode("", true)
|
|
11461
|
+
], 64);
|
|
11462
|
+
};
|
|
11463
|
+
}
|
|
11464
|
+
});
|
|
11465
|
+
const NameEditor_vue_vue_type_style_index_0_scoped_b5d95dd5_lang = "";
|
|
11466
|
+
const NameEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2P, [["__scopeId", "data-v-b5d95dd5"]]);
|
|
11467
|
+
const withDrag = (onMove, onUp) => {
|
|
11468
|
+
const move = (e) => onMove(e);
|
|
11469
|
+
const up = (e) => {
|
|
11470
|
+
try {
|
|
11471
|
+
onUp(e);
|
|
11472
|
+
} finally {
|
|
11473
|
+
window.removeEventListener("mousemove", move);
|
|
11474
|
+
window.removeEventListener("mouseup", up);
|
|
11475
|
+
}
|
|
11476
|
+
};
|
|
11477
|
+
window.addEventListener("mousemove", move);
|
|
11478
|
+
window.addEventListener("mouseup", up);
|
|
11479
|
+
return () => {
|
|
11480
|
+
window.removeEventListener("mousemove", move);
|
|
11481
|
+
window.removeEventListener("mouseup", up);
|
|
11482
|
+
};
|
|
11483
|
+
};
|
|
11484
|
+
let registry = {};
|
|
11485
|
+
function registerShapes(map2) {
|
|
11486
|
+
registry = { ...registry, ...map2 };
|
|
11487
|
+
}
|
|
11488
|
+
function getShapeComponentByKey(key) {
|
|
11489
|
+
if (!key)
|
|
11490
|
+
return null;
|
|
11491
|
+
return registry[key] ?? null;
|
|
11492
|
+
}
|
|
11493
|
+
function getComponentByShapeKey(shapeKey) {
|
|
11494
|
+
const componentName2 = BlockKeyMap[shapeKey] || shapeKey;
|
|
11495
|
+
return getShapeComponentByKey(componentName2) || componentName2;
|
|
11496
|
+
}
|
|
11497
|
+
function getComponentByPinKey(shapeKey) {
|
|
11498
|
+
const componentName2 = PinKeyMap[shapeKey] || shapeKey;
|
|
11499
|
+
return getShapeComponentByKey(componentName2) || componentName2;
|
|
11500
|
+
}
|
|
11501
|
+
function getComponentByDiagramKey(shapeKey) {
|
|
11502
|
+
const componentName2 = DiagramKeyMap[shapeKey] || shapeKey;
|
|
11503
|
+
return getShapeComponentByKey(componentName2) || componentName2;
|
|
11504
|
+
}
|
|
11505
|
+
const getShapeComponent = (shape) => {
|
|
11506
|
+
const { shapeType, shapeKey } = shape;
|
|
11507
|
+
switch (shapeType) {
|
|
11508
|
+
case "pin":
|
|
11509
|
+
return getComponentByPinKey(shapeKey);
|
|
11510
|
+
case "shape":
|
|
11511
|
+
return getComponentByShapeKey(shapeKey);
|
|
11512
|
+
case "diagram":
|
|
11513
|
+
return getComponentByDiagramKey(shapeKey);
|
|
11514
|
+
case "edge":
|
|
11515
|
+
return getComponentByShapeKey(shapeKey);
|
|
11516
|
+
default:
|
|
11517
|
+
return "ShapeComponent";
|
|
11518
|
+
}
|
|
11519
|
+
};
|
|
11520
|
+
const getShapeStyle = (shape) => {
|
|
11521
|
+
const { bounds, shapeType } = shape;
|
|
11522
|
+
if (shapeType === "edge") {
|
|
11523
|
+
let waypoints = [];
|
|
11524
|
+
if (shape.waypointId) {
|
|
11525
|
+
if (typeof shape.waypointId === "string") {
|
|
11526
|
+
try {
|
|
11527
|
+
waypoints = JSON.parse(shape.waypointId);
|
|
11528
|
+
} catch (error) {
|
|
11529
|
+
console.error("解析waypointId失败:", error);
|
|
11530
|
+
waypoints = [];
|
|
11531
|
+
}
|
|
11532
|
+
} else if (Array.isArray(shape.waypointId)) {
|
|
11533
|
+
waypoints = shape.waypointId;
|
|
11534
|
+
}
|
|
11535
|
+
}
|
|
11536
|
+
if (waypoints.length === 0) {
|
|
11537
|
+
return {
|
|
11538
|
+
position: "absolute",
|
|
11539
|
+
left: "0px",
|
|
11540
|
+
top: "0px",
|
|
11541
|
+
width: "100px",
|
|
11542
|
+
height: "50px",
|
|
11543
|
+
opacity: 0
|
|
11544
|
+
// 初始时隐藏
|
|
11545
|
+
};
|
|
11546
|
+
}
|
|
11547
|
+
const xs = waypoints.map((wp) => wp.x);
|
|
11548
|
+
const ys = waypoints.map((wp) => wp.y);
|
|
11549
|
+
const minX = Math.min(...xs);
|
|
11550
|
+
const maxX = Math.max(...xs);
|
|
11551
|
+
const minY = Math.min(...ys);
|
|
11552
|
+
const maxY = Math.max(...ys);
|
|
11553
|
+
const padding2 = 10;
|
|
11554
|
+
const width = Math.max(maxX - minX + padding2 * 2, 20);
|
|
11555
|
+
const height = maxY - minY + padding2 * 2;
|
|
11556
|
+
return {
|
|
11557
|
+
position: "absolute",
|
|
11558
|
+
left: `${minX - padding2}px`,
|
|
11559
|
+
top: `${minY - padding2}px`,
|
|
11560
|
+
width: `${width}px`,
|
|
11561
|
+
height: `${height}px`
|
|
11562
|
+
};
|
|
11563
|
+
}
|
|
11564
|
+
return {
|
|
11565
|
+
position: "absolute",
|
|
11566
|
+
left: `${(bounds == null ? void 0 : bounds.x) || 0}px`,
|
|
11567
|
+
top: `${(bounds == null ? void 0 : bounds.y) || 0}px`,
|
|
11568
|
+
width: `${(bounds == null ? void 0 : bounds.width) || 100}px`,
|
|
11569
|
+
height: `${(bounds == null ? void 0 : bounds.height) || 50}px`
|
|
11570
|
+
};
|
|
11571
|
+
};
|
|
11355
11572
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
11356
11573
|
var _sfc_main6 = /* @__PURE__ */ defineComponent({
|
|
11357
11574
|
name: "ArrowDown",
|
|
@@ -12007,12 +12224,172 @@ var _sfc_main293 = /* @__PURE__ */ defineComponent({
|
|
|
12007
12224
|
]));
|
|
12008
12225
|
}
|
|
12009
12226
|
}), zoom_out_default = _sfc_main293;
|
|
12010
|
-
const
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12227
|
+
const _ContextMenuUtils = class _ContextMenuUtils {
|
|
12228
|
+
/**
|
|
12229
|
+
* 处理右键菜单点击事件
|
|
12230
|
+
* @param event 鼠标事件
|
|
12231
|
+
* @param layerRef 图层引用
|
|
12232
|
+
* @param pickTarget 命中测试函数
|
|
12233
|
+
* @param shapes 图元列表
|
|
12234
|
+
* @param selectShape 选中图元函数
|
|
12235
|
+
* @param isDragging 是否正在拖拽
|
|
12236
|
+
* @param isResizing 是否正在缩放
|
|
12237
|
+
* @returns 命中的图元(如果有)
|
|
12238
|
+
*/
|
|
12239
|
+
static handleContextMenuClick(event, layerRef, pickTarget2, shapes, selectShape, isDragging2, isResizing) {
|
|
12240
|
+
if (isDragging2 || isResizing) {
|
|
12241
|
+
return null;
|
|
12242
|
+
}
|
|
12243
|
+
event.preventDefault();
|
|
12244
|
+
const point = _ContextMenuUtils.toLocalPoint(event, layerRef.value);
|
|
12245
|
+
const hit = pickTarget2(shapes, point);
|
|
12246
|
+
if ((hit.kind === "shape" || hit.kind === "pin") && hit.shape) {
|
|
12247
|
+
if (selectShape) {
|
|
12248
|
+
selectShape(hit.shape);
|
|
12249
|
+
}
|
|
12250
|
+
return hit.shape;
|
|
12251
|
+
}
|
|
12252
|
+
return null;
|
|
12253
|
+
}
|
|
12254
|
+
/**
|
|
12255
|
+
* 将鼠标事件坐标转换为本地坐标
|
|
12256
|
+
*/
|
|
12257
|
+
static toLocalPoint(event, layerRef) {
|
|
12258
|
+
if (!layerRef) {
|
|
12259
|
+
return { x: event.clientX, y: event.clientY };
|
|
12260
|
+
}
|
|
12261
|
+
const rect = layerRef.getBoundingClientRect();
|
|
12262
|
+
return {
|
|
12263
|
+
x: event.clientX - rect.left,
|
|
12264
|
+
y: event.clientY - rect.top
|
|
12265
|
+
};
|
|
12266
|
+
}
|
|
12267
|
+
/**
|
|
12268
|
+
* 检查点击是否在菜单外部
|
|
12269
|
+
*/
|
|
12270
|
+
static isClickOutsideMenu(event, menuSelector = ".context-menu") {
|
|
12271
|
+
const menuElement = document.querySelector(menuSelector);
|
|
12272
|
+
return !menuElement || !menuElement.contains(event.target);
|
|
12273
|
+
}
|
|
12274
|
+
/**
|
|
12275
|
+
* 计算菜单位置(避免超出屏幕边界)
|
|
12276
|
+
*/
|
|
12277
|
+
static calculateMenuPosition(x2, y, menuWidth = 180, menuHeight = 300, safeMargin = 10) {
|
|
12278
|
+
const viewportWidth = window.innerWidth;
|
|
12279
|
+
const viewportHeight = window.innerHeight;
|
|
12280
|
+
let left = x2;
|
|
12281
|
+
let top = y;
|
|
12282
|
+
if (left + menuWidth > viewportWidth) {
|
|
12283
|
+
left = viewportWidth - menuWidth - safeMargin;
|
|
12284
|
+
}
|
|
12285
|
+
left = Math.max(safeMargin, left);
|
|
12286
|
+
if (top + menuHeight > viewportHeight) {
|
|
12287
|
+
top = viewportHeight - menuHeight - safeMargin;
|
|
12288
|
+
}
|
|
12289
|
+
top = Math.max(safeMargin, top);
|
|
12290
|
+
return { x: left, y: top };
|
|
12291
|
+
}
|
|
12292
|
+
/**
|
|
12293
|
+
* 处理删除操作
|
|
12294
|
+
*/
|
|
12295
|
+
static handleDelete(target) {
|
|
12296
|
+
if (target) {
|
|
12297
|
+
eventBus.emit("shapes-delete", target);
|
|
12298
|
+
}
|
|
12299
|
+
}
|
|
12300
|
+
/**
|
|
12301
|
+
* 处理属性配置 (暂时不用)
|
|
12302
|
+
*/
|
|
12303
|
+
static handleShowPropertyPanel(target) {
|
|
12304
|
+
if (target) {
|
|
12305
|
+
eventBus.emit("show-property-panel", target);
|
|
12306
|
+
}
|
|
12307
|
+
}
|
|
12308
|
+
/**
|
|
12309
|
+
* 处理树上高亮
|
|
12310
|
+
*/
|
|
12311
|
+
static handleHighlight(target) {
|
|
12312
|
+
if (target) {
|
|
12313
|
+
eventBus.emit("highlight-shape", target);
|
|
12314
|
+
}
|
|
12315
|
+
}
|
|
12316
|
+
/**
|
|
12317
|
+
* 处理所在图表
|
|
12318
|
+
*/
|
|
12319
|
+
static handleLocateChart(target) {
|
|
12320
|
+
if (target) {
|
|
12321
|
+
eventBus.emit("locate-chart", target);
|
|
12322
|
+
}
|
|
12323
|
+
}
|
|
12324
|
+
/**
|
|
12325
|
+
* 设置复制的图元
|
|
12326
|
+
*/
|
|
12327
|
+
static setCopiedShapes(shapes) {
|
|
12328
|
+
this.copiedShapes = _.cloneDeep(shapes);
|
|
12329
|
+
console.log("已复制的图元:", this.copiedShapes);
|
|
12330
|
+
}
|
|
12331
|
+
/**
|
|
12332
|
+
* 获取复制的图元
|
|
12333
|
+
*/
|
|
12334
|
+
static getCopiedShapes() {
|
|
12335
|
+
return this.copiedShapes;
|
|
12336
|
+
}
|
|
12337
|
+
/**
|
|
12338
|
+
* 处理复制
|
|
12339
|
+
*/
|
|
12340
|
+
static handleCopy(target) {
|
|
12341
|
+
if (target) {
|
|
12342
|
+
this.setCopiedShapes([target]);
|
|
12343
|
+
eventBus.emit("copy-shape", target);
|
|
12344
|
+
}
|
|
12345
|
+
}
|
|
12346
|
+
/**
|
|
12347
|
+
* 处理粘贴
|
|
12348
|
+
*/
|
|
12349
|
+
static handlePaste(target) {
|
|
12350
|
+
if (this.copiedShapes.length === 0) {
|
|
12351
|
+
return;
|
|
12352
|
+
}
|
|
12353
|
+
const pasteX = 50;
|
|
12354
|
+
const pasteY = 50;
|
|
12355
|
+
const pastedShapes = [];
|
|
12356
|
+
this.copiedShapes.forEach((shape) => {
|
|
12357
|
+
const newShape = _.cloneDeep(shape);
|
|
12358
|
+
newShape.id = getUuid();
|
|
12359
|
+
if (newShape.bounds) {
|
|
12360
|
+
newShape.bounds.x = pasteX;
|
|
12361
|
+
newShape.bounds.y = pasteY;
|
|
12362
|
+
}
|
|
12363
|
+
pastedShapes.push(newShape);
|
|
12364
|
+
});
|
|
12365
|
+
eventBus.emit("paste-shapes", pastedShapes);
|
|
12366
|
+
eventBus.emit("select-shapes", pastedShapes.map((s2) => s2.id));
|
|
12367
|
+
console.log("已粘贴的图元:", pastedShapes);
|
|
12368
|
+
}
|
|
12369
|
+
/**
|
|
12370
|
+
* 处理剪切
|
|
12371
|
+
*/
|
|
12372
|
+
static handleCut(target) {
|
|
12373
|
+
if (target) {
|
|
12374
|
+
eventBus.emit("cut-shape", target);
|
|
12375
|
+
}
|
|
12376
|
+
}
|
|
12377
|
+
/**
|
|
12378
|
+
* 记录日志
|
|
12379
|
+
*/
|
|
12380
|
+
static logSelectedShape(target) {
|
|
12381
|
+
console.log("当前选中的图元:", target);
|
|
12382
|
+
}
|
|
12383
|
+
};
|
|
12384
|
+
// 用于存储复制的图元
|
|
12385
|
+
__publicField(_ContextMenuUtils, "copiedShapes", []);
|
|
12386
|
+
let ContextMenuUtils = _ContextMenuUtils;
|
|
12387
|
+
const _hoisted_1$h = { class: "flex items-center box-border border-b-[1px] border-solid border-[#DCDFE6]" };
|
|
12388
|
+
const _hoisted_2$g = ["src"];
|
|
12389
|
+
const _hoisted_3$e = { class: "flex items-center" };
|
|
12390
|
+
const _hoisted_4$d = ["src"];
|
|
12391
|
+
const _hoisted_5$b = { class: "flex items-center box-border border-b-[1px] border-solid border-[#DCDFE6]" };
|
|
12392
|
+
const _hoisted_6$a = ["src"];
|
|
12016
12393
|
const _hoisted_7$9 = { class: "flex items-center box-border border-b-[1px] border-solid border-[#DCDFE6]" };
|
|
12017
12394
|
const _hoisted_8$9 = ["src"];
|
|
12018
12395
|
const _hoisted_9$7 = { class: "flex items-center box-border border-b-[1px] border-solid border-[#DCDFE6]" };
|
|
@@ -12224,12 +12601,19 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12224
12601
|
};
|
|
12225
12602
|
const handleCopy = () => {
|
|
12226
12603
|
logSelectedShape();
|
|
12227
|
-
|
|
12604
|
+
const graphStore = useGraphStore();
|
|
12605
|
+
const selectedShapes = graphStore.selectedIds.map((id) => graphStore.shapes.find((s2) => s2.id === id)).filter(Boolean);
|
|
12606
|
+
if (selectedShapes.length === 0) {
|
|
12607
|
+
closeMenu();
|
|
12608
|
+
return;
|
|
12609
|
+
}
|
|
12610
|
+
ContextMenuUtils.setCopiedShapes(selectedShapes);
|
|
12228
12611
|
closeMenu();
|
|
12229
12612
|
};
|
|
12230
12613
|
const handlePaste = () => {
|
|
12231
12614
|
logSelectedShape();
|
|
12232
|
-
|
|
12615
|
+
const graphStore = useGraphStore();
|
|
12616
|
+
ContextMenuUtils.handlePaste(graphStore.selectedShape);
|
|
12233
12617
|
closeMenu();
|
|
12234
12618
|
};
|
|
12235
12619
|
const handleCut = () => {
|
|
@@ -12278,12 +12662,12 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12278
12662
|
class: "menu-item",
|
|
12279
12663
|
onClick: handleShowPropertyPanel
|
|
12280
12664
|
}, [
|
|
12281
|
-
createElementVNode("div", _hoisted_1$
|
|
12665
|
+
createElementVNode("div", _hoisted_1$h, [
|
|
12282
12666
|
createElementVNode("img", {
|
|
12283
12667
|
src: unref(getIcon)("createMenu", "config"),
|
|
12284
12668
|
class: "w-[18px] h-[18px] mr-[10px] ml-[2px]",
|
|
12285
12669
|
alt: "属性配置"
|
|
12286
|
-
}, null, 8, _hoisted_2$
|
|
12670
|
+
}, null, 8, _hoisted_2$g),
|
|
12287
12671
|
_cache[2] || (_cache[2] = createElementVNode("span", null, "属性配置", -1))
|
|
12288
12672
|
])
|
|
12289
12673
|
]),
|
|
@@ -12291,12 +12675,12 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12291
12675
|
class: "menu-item",
|
|
12292
12676
|
onClick: handleHighlight
|
|
12293
12677
|
}, [
|
|
12294
|
-
createElementVNode("div", _hoisted_3$
|
|
12678
|
+
createElementVNode("div", _hoisted_3$e, [
|
|
12295
12679
|
createElementVNode("img", {
|
|
12296
12680
|
src: unref(getIcon)("createMenu", "delete"),
|
|
12297
12681
|
class: "w-[18px] h-[18px] mr-[10px] ml-[2px]",
|
|
12298
12682
|
alt: "树上高亮"
|
|
12299
|
-
}, null, 8, _hoisted_4$
|
|
12683
|
+
}, null, 8, _hoisted_4$d),
|
|
12300
12684
|
_cache[3] || (_cache[3] = createElementVNode("span", null, "树上高亮", -1))
|
|
12301
12685
|
])
|
|
12302
12686
|
]),
|
|
@@ -12305,12 +12689,12 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12305
12689
|
class: normalizeClass(["menu-item", { "menu-disabled": false }]),
|
|
12306
12690
|
onClick: handleLocateChart
|
|
12307
12691
|
}, [
|
|
12308
|
-
createElementVNode("div", _hoisted_5$
|
|
12692
|
+
createElementVNode("div", _hoisted_5$b, [
|
|
12309
12693
|
createElementVNode("img", {
|
|
12310
12694
|
src: unref(getIcon)("createMenu", "locateChart"),
|
|
12311
12695
|
class: "w-[18px] h-[18px] mr-[10px] ml-[2px]",
|
|
12312
12696
|
alt: "所在图表"
|
|
12313
|
-
}, null, 8, _hoisted_6$
|
|
12697
|
+
}, null, 8, _hoisted_6$a),
|
|
12314
12698
|
_cache[4] || (_cache[4] = createElementVNode("div", { class: "flex-[1] flex justify-between items-center" }, [
|
|
12315
12699
|
createElementVNode("span", null, "所在图表")
|
|
12316
12700
|
], -1))
|
|
@@ -12353,7 +12737,7 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12353
12737
|
])
|
|
12354
12738
|
], 544),
|
|
12355
12739
|
createElementVNode("div", {
|
|
12356
|
-
class: normalizeClass(["menu-item", { "menu-disabled":
|
|
12740
|
+
class: normalizeClass(["menu-item", { "menu-disabled": false }]),
|
|
12357
12741
|
onClick: handleCopy
|
|
12358
12742
|
}, [
|
|
12359
12743
|
createElementVNode("div", _hoisted_12$3, [
|
|
@@ -12366,7 +12750,7 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12366
12750
|
])
|
|
12367
12751
|
]),
|
|
12368
12752
|
createElementVNode("div", {
|
|
12369
|
-
class: normalizeClass(["menu-item", { "menu-disabled":
|
|
12753
|
+
class: normalizeClass(["menu-item", { "menu-disabled": false }]),
|
|
12370
12754
|
onClick: handlePaste
|
|
12371
12755
|
}, [
|
|
12372
12756
|
createElementVNode("div", _hoisted_14$1, [
|
|
@@ -12444,15 +12828,8 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
12444
12828
|
};
|
|
12445
12829
|
}
|
|
12446
12830
|
});
|
|
12447
|
-
const
|
|
12448
|
-
const _export_sfc$1
|
|
12449
|
-
const target = sfc.__vccOpts || sfc;
|
|
12450
|
-
for (const [key, val] of props2) {
|
|
12451
|
-
target[key] = val;
|
|
12452
|
-
}
|
|
12453
|
-
return target;
|
|
12454
|
-
};
|
|
12455
|
-
const ContextMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$2O, [["__scopeId", "data-v-7371f77c"]]);
|
|
12831
|
+
const ContextMenu_vue_vue_type_style_index_0_scoped_b67bbdb9_lang = "";
|
|
12832
|
+
const ContextMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$2O, [["__scopeId", "data-v-b67bbdb9"]]);
|
|
12456
12833
|
const EDGE_TYPE = {
|
|
12457
12834
|
/** 定向聚合:带菱形起点和空心箭头终点 */
|
|
12458
12835
|
DIRECTED_AGGREGATION: "DirectedAggregation",
|
|
@@ -12503,12 +12880,12 @@ const DIAMOND_MARKER_SHAPES = [
|
|
|
12503
12880
|
const SPECIAL_END_POINT_SHAPES = [
|
|
12504
12881
|
EDGE_TYPE.GENERALIZATION
|
|
12505
12882
|
];
|
|
12506
|
-
const _hoisted_1$
|
|
12507
|
-
const _hoisted_2$
|
|
12508
|
-
const _hoisted_3$
|
|
12509
|
-
const _hoisted_4$
|
|
12510
|
-
const _hoisted_5$
|
|
12511
|
-
const _hoisted_6$
|
|
12883
|
+
const _hoisted_1$g = { key: 0 };
|
|
12884
|
+
const _hoisted_2$f = ["id"];
|
|
12885
|
+
const _hoisted_3$d = ["id"];
|
|
12886
|
+
const _hoisted_4$c = ["id"];
|
|
12887
|
+
const _hoisted_5$a = ["id"];
|
|
12888
|
+
const _hoisted_6$9 = ["id"];
|
|
12512
12889
|
const _hoisted_7$8 = ["id"];
|
|
12513
12890
|
const _hoisted_8$8 = ["id"];
|
|
12514
12891
|
const _hoisted_9$6 = ["id"];
|
|
@@ -12522,7 +12899,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12522
12899
|
const props2 = __props;
|
|
12523
12900
|
const shapeKey = computed(() => props2.shapeKey || EDGE_TYPE.ASSOCIATION);
|
|
12524
12901
|
return (_ctx, _cache) => {
|
|
12525
|
-
return shapeKey.value ? (openBlock(), createElementBlock("defs", _hoisted_1$
|
|
12902
|
+
return shapeKey.value ? (openBlock(), createElementBlock("defs", _hoisted_1$g, [
|
|
12526
12903
|
shapeKey.value === unref(EDGE_TYPE).DIRECTED_AGGREGATION ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
12527
12904
|
createElementVNode("marker", {
|
|
12528
12905
|
id: `arrowhead-${shapeKey.value}`,
|
|
@@ -12539,7 +12916,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12539
12916
|
"stroke-width": "1",
|
|
12540
12917
|
"stroke-linejoin": "round"
|
|
12541
12918
|
}, null, -1)
|
|
12542
|
-
])], 8, _hoisted_2$
|
|
12919
|
+
])], 8, _hoisted_2$f),
|
|
12543
12920
|
createElementVNode("marker", {
|
|
12544
12921
|
id: `diamond-${shapeKey.value}`,
|
|
12545
12922
|
markerWidth: "12",
|
|
@@ -12555,7 +12932,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12555
12932
|
stroke: "#5E5E5E",
|
|
12556
12933
|
"stroke-width": "1"
|
|
12557
12934
|
}, null, -1)
|
|
12558
|
-
])], 8, _hoisted_3$
|
|
12935
|
+
])], 8, _hoisted_3$d)
|
|
12559
12936
|
], 64)) : shapeKey.value === unref(EDGE_TYPE).AGGREGATION ? (openBlock(), createElementBlock("marker", {
|
|
12560
12937
|
key: 1,
|
|
12561
12938
|
id: `diamond-${shapeKey.value}`,
|
|
@@ -12572,7 +12949,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12572
12949
|
stroke: "#5E5E5E",
|
|
12573
12950
|
"stroke-width": "1"
|
|
12574
12951
|
}, null, -1)
|
|
12575
|
-
])], 8, _hoisted_4$
|
|
12952
|
+
])], 8, _hoisted_4$c)) : shapeKey.value === unref(EDGE_TYPE).GENERALIZATION ? (openBlock(), createElementBlock("marker", {
|
|
12576
12953
|
key: 2,
|
|
12577
12954
|
id: `diamond-${shapeKey.value}`,
|
|
12578
12955
|
markerWidth: "10",
|
|
@@ -12587,7 +12964,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12587
12964
|
stroke: "#5E5E5E",
|
|
12588
12965
|
"stroke-width": "1"
|
|
12589
12966
|
}, null, -1)
|
|
12590
|
-
])], 8, _hoisted_5$
|
|
12967
|
+
])], 8, _hoisted_5$a)) : shapeKey.value === unref(EDGE_TYPE).DIRECTED_COMPOSITION ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
12591
12968
|
createElementVNode("marker", {
|
|
12592
12969
|
id: `arrowhead-${shapeKey.value}`,
|
|
12593
12970
|
markerWidth: "7",
|
|
@@ -12603,7 +12980,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12603
12980
|
"stroke-width": "1",
|
|
12604
12981
|
"stroke-linejoin": "round"
|
|
12605
12982
|
}, null, -1)
|
|
12606
|
-
])], 8, _hoisted_6$
|
|
12983
|
+
])], 8, _hoisted_6$9),
|
|
12607
12984
|
createElementVNode("marker", {
|
|
12608
12985
|
id: `diamond-${shapeKey.value}`,
|
|
12609
12986
|
markerWidth: "12",
|
|
@@ -12673,7 +13050,7 @@ const _sfc_main$2N = /* @__PURE__ */ defineComponent({
|
|
|
12673
13050
|
};
|
|
12674
13051
|
}
|
|
12675
13052
|
});
|
|
12676
|
-
const _hoisted_1$
|
|
13053
|
+
const _hoisted_1$f = ["points", "fill", "stroke", "stroke-width", "stroke-linecap", "stroke-linejoin", "stroke-dasharray", "marker-start", "marker-end"];
|
|
12677
13054
|
const _sfc_main$2M = /* @__PURE__ */ defineComponent({
|
|
12678
13055
|
__name: "ConnectionLine",
|
|
12679
13056
|
props: {
|
|
@@ -12749,7 +13126,7 @@ const _sfc_main$2M = /* @__PURE__ */ defineComponent({
|
|
|
12749
13126
|
"stroke-dasharray": lineStyle.value.strokeDasharray,
|
|
12750
13127
|
"marker-start": getMarkerStart(),
|
|
12751
13128
|
"marker-end": getMarkerEnd()
|
|
12752
|
-
}, null, 8, _hoisted_1$
|
|
13129
|
+
}, null, 8, _hoisted_1$f)
|
|
12753
13130
|
], 4)) : createCommentVNode("", true);
|
|
12754
13131
|
};
|
|
12755
13132
|
}
|
|
@@ -12871,134 +13248,6 @@ class HighlightUtils {
|
|
|
12871
13248
|
this.originalShapeStyles.clear();
|
|
12872
13249
|
}
|
|
12873
13250
|
}
|
|
12874
|
-
class ContextMenuUtils {
|
|
12875
|
-
/**
|
|
12876
|
-
* 处理右键菜单点击事件
|
|
12877
|
-
* @param event 鼠标事件
|
|
12878
|
-
* @param layerRef 图层引用
|
|
12879
|
-
* @param pickTarget 命中测试函数
|
|
12880
|
-
* @param shapes 图元列表
|
|
12881
|
-
* @param selectShape 选中图元函数
|
|
12882
|
-
* @param isDragging 是否正在拖拽
|
|
12883
|
-
* @param isResizing 是否正在缩放
|
|
12884
|
-
* @returns 命中的图元(如果有)
|
|
12885
|
-
*/
|
|
12886
|
-
static handleContextMenuClick(event, layerRef, pickTarget2, shapes, selectShape, isDragging2, isResizing) {
|
|
12887
|
-
if (isDragging2 || isResizing) {
|
|
12888
|
-
return null;
|
|
12889
|
-
}
|
|
12890
|
-
event.preventDefault();
|
|
12891
|
-
const point = ContextMenuUtils.toLocalPoint(event, layerRef.value);
|
|
12892
|
-
const hit = pickTarget2(shapes, point);
|
|
12893
|
-
if (hit.kind === "shape" && hit.shape) {
|
|
12894
|
-
if (selectShape) {
|
|
12895
|
-
selectShape(hit.shape);
|
|
12896
|
-
}
|
|
12897
|
-
return hit.shape;
|
|
12898
|
-
}
|
|
12899
|
-
return null;
|
|
12900
|
-
}
|
|
12901
|
-
/**
|
|
12902
|
-
* 将鼠标事件坐标转换为本地坐标
|
|
12903
|
-
*/
|
|
12904
|
-
static toLocalPoint(event, layerRef) {
|
|
12905
|
-
if (!layerRef) {
|
|
12906
|
-
return { x: event.clientX, y: event.clientY };
|
|
12907
|
-
}
|
|
12908
|
-
const rect = layerRef.getBoundingClientRect();
|
|
12909
|
-
return {
|
|
12910
|
-
x: event.clientX - rect.left,
|
|
12911
|
-
y: event.clientY - rect.top
|
|
12912
|
-
};
|
|
12913
|
-
}
|
|
12914
|
-
/**
|
|
12915
|
-
* 检查点击是否在菜单外部
|
|
12916
|
-
*/
|
|
12917
|
-
static isClickOutsideMenu(event, menuSelector = ".context-menu") {
|
|
12918
|
-
const menuElement = document.querySelector(menuSelector);
|
|
12919
|
-
return !menuElement || !menuElement.contains(event.target);
|
|
12920
|
-
}
|
|
12921
|
-
/**
|
|
12922
|
-
* 计算菜单位置(避免超出屏幕边界)
|
|
12923
|
-
*/
|
|
12924
|
-
static calculateMenuPosition(x2, y, menuWidth = 180, menuHeight = 300, safeMargin = 10) {
|
|
12925
|
-
const viewportWidth = window.innerWidth;
|
|
12926
|
-
const viewportHeight = window.innerHeight;
|
|
12927
|
-
let left = x2;
|
|
12928
|
-
let top = y;
|
|
12929
|
-
if (left + menuWidth > viewportWidth) {
|
|
12930
|
-
left = viewportWidth - menuWidth - safeMargin;
|
|
12931
|
-
}
|
|
12932
|
-
left = Math.max(safeMargin, left);
|
|
12933
|
-
if (top + menuHeight > viewportHeight) {
|
|
12934
|
-
top = viewportHeight - menuHeight - safeMargin;
|
|
12935
|
-
}
|
|
12936
|
-
top = Math.max(safeMargin, top);
|
|
12937
|
-
return { x: left, y: top };
|
|
12938
|
-
}
|
|
12939
|
-
/**
|
|
12940
|
-
* 处理删除操作
|
|
12941
|
-
*/
|
|
12942
|
-
static handleDelete(target) {
|
|
12943
|
-
if (target) {
|
|
12944
|
-
eventBus.emit("shapes-delete", target);
|
|
12945
|
-
}
|
|
12946
|
-
}
|
|
12947
|
-
/**
|
|
12948
|
-
* 处理属性配置 (暂时不用)
|
|
12949
|
-
*/
|
|
12950
|
-
static handleShowPropertyPanel(target) {
|
|
12951
|
-
if (target) {
|
|
12952
|
-
eventBus.emit("show-property-panel", target);
|
|
12953
|
-
}
|
|
12954
|
-
}
|
|
12955
|
-
/**
|
|
12956
|
-
* 处理树上高亮
|
|
12957
|
-
*/
|
|
12958
|
-
static handleHighlight(target) {
|
|
12959
|
-
if (target) {
|
|
12960
|
-
eventBus.emit("highlight-shape", target);
|
|
12961
|
-
}
|
|
12962
|
-
}
|
|
12963
|
-
/**
|
|
12964
|
-
* 处理所在图表
|
|
12965
|
-
*/
|
|
12966
|
-
static handleLocateChart(target) {
|
|
12967
|
-
if (target) {
|
|
12968
|
-
eventBus.emit("locate-chart", target);
|
|
12969
|
-
}
|
|
12970
|
-
}
|
|
12971
|
-
/**
|
|
12972
|
-
* 处理复制
|
|
12973
|
-
*/
|
|
12974
|
-
static handleCopy(target) {
|
|
12975
|
-
if (target) {
|
|
12976
|
-
eventBus.emit("copy-shape", target);
|
|
12977
|
-
}
|
|
12978
|
-
}
|
|
12979
|
-
/**
|
|
12980
|
-
* 处理粘贴
|
|
12981
|
-
*/
|
|
12982
|
-
static handlePaste(target) {
|
|
12983
|
-
if (target) {
|
|
12984
|
-
eventBus.emit("paste-shape", target);
|
|
12985
|
-
}
|
|
12986
|
-
}
|
|
12987
|
-
/**
|
|
12988
|
-
* 处理剪切
|
|
12989
|
-
*/
|
|
12990
|
-
static handleCut(target) {
|
|
12991
|
-
if (target) {
|
|
12992
|
-
eventBus.emit("cut-shape", target);
|
|
12993
|
-
}
|
|
12994
|
-
}
|
|
12995
|
-
/**
|
|
12996
|
-
* 记录日志
|
|
12997
|
-
*/
|
|
12998
|
-
static logSelectedShape(target) {
|
|
12999
|
-
console.log("当前选中的图元:", target);
|
|
13000
|
-
}
|
|
13001
|
-
}
|
|
13002
13251
|
const version = "2.11.5";
|
|
13003
13252
|
const INSTALLED_KEY = Symbol("INSTALLED_KEY");
|
|
13004
13253
|
const configProviderContextKey = Symbol();
|
|
@@ -70561,6 +70810,24 @@ const createKeyboardHandler = (config) => {
|
|
|
70561
70810
|
}
|
|
70562
70811
|
}
|
|
70563
70812
|
}
|
|
70813
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "c" && graphStore.museInGraphView && !isInputElement) {
|
|
70814
|
+
if (config.isEditingName && config.isEditingName()) {
|
|
70815
|
+
return;
|
|
70816
|
+
}
|
|
70817
|
+
e.preventDefault();
|
|
70818
|
+
if (config.onCopy) {
|
|
70819
|
+
config.onCopy();
|
|
70820
|
+
}
|
|
70821
|
+
}
|
|
70822
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "v" && graphStore.museInGraphView && !isInputElement) {
|
|
70823
|
+
if (config.isEditingName && config.isEditingName()) {
|
|
70824
|
+
return;
|
|
70825
|
+
}
|
|
70826
|
+
e.preventDefault();
|
|
70827
|
+
if (config.onPaste) {
|
|
70828
|
+
config.onPaste();
|
|
70829
|
+
}
|
|
70830
|
+
}
|
|
70564
70831
|
if ((e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") && graphStore.museInGraphView && !isInputElement) {
|
|
70565
70832
|
if (config.isEditingName && config.isEditingName()) {
|
|
70566
70833
|
return;
|
|
@@ -70657,6 +70924,10 @@ class NameEditManager {
|
|
|
70657
70924
|
nameInput: this.nameInput
|
|
70658
70925
|
};
|
|
70659
70926
|
}
|
|
70927
|
+
// 设置名称输入框引用
|
|
70928
|
+
setNameInput(input) {
|
|
70929
|
+
this.nameInput.value = input;
|
|
70930
|
+
}
|
|
70660
70931
|
// 开始编辑名称
|
|
70661
70932
|
async startEdit(shape) {
|
|
70662
70933
|
var _a2, _b, _c, _d;
|
|
@@ -70945,15 +71216,6 @@ function createResizeUtils(layerRef, config, callbacks = {}) {
|
|
|
70945
71216
|
getMinDimensions
|
|
70946
71217
|
};
|
|
70947
71218
|
}
|
|
70948
|
-
const _hoisted_1$f = { class: "resize-handles" };
|
|
70949
|
-
const _hoisted_2$f = ["onMousedown"];
|
|
70950
|
-
const _hoisted_3$d = {
|
|
70951
|
-
key: 0,
|
|
70952
|
-
class: "border-btn"
|
|
70953
|
-
};
|
|
70954
|
-
const _hoisted_4$c = ["onMousedown"];
|
|
70955
|
-
const _hoisted_5$a = ["onMousedown", "title"];
|
|
70956
|
-
const _hoisted_6$9 = ["src"];
|
|
70957
71219
|
const DRAG_THRESHOLD = 4;
|
|
70958
71220
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
70959
71221
|
__name: "InteractionLayer",
|
|
@@ -70971,7 +71233,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
70971
71233
|
emits: InteractionLayerEmits,
|
|
70972
71234
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
70973
71235
|
useCssVars((_ctx) => ({
|
|
70974
|
-
"
|
|
71236
|
+
"798bf767": unref(graphStore).currentScale
|
|
70975
71237
|
}));
|
|
70976
71238
|
const props2 = __props;
|
|
70977
71239
|
const emit = __emit;
|
|
@@ -71033,26 +71295,32 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71033
71295
|
}
|
|
71034
71296
|
}
|
|
71035
71297
|
});
|
|
71036
|
-
const resizeUtils = createResizeUtils(
|
|
71037
|
-
|
|
71038
|
-
|
|
71039
|
-
|
|
71040
|
-
|
|
71041
|
-
|
|
71042
|
-
eventBus.emit("resize-start", { target });
|
|
71043
|
-
},
|
|
71044
|
-
onResizeEnd: (target) => {
|
|
71045
|
-
eventBus.emit("resize-end", { target });
|
|
71298
|
+
const resizeUtils = createResizeUtils(
|
|
71299
|
+
layerRef,
|
|
71300
|
+
{
|
|
71301
|
+
packages: props2.packages,
|
|
71302
|
+
diagram: props2.diagram,
|
|
71303
|
+
taggedValueLabels: props2.taggedValueLabels
|
|
71046
71304
|
},
|
|
71047
|
-
|
|
71048
|
-
|
|
71305
|
+
{
|
|
71306
|
+
onResizeStart: (target) => {
|
|
71307
|
+
eventBus.emit("resize-start", { target });
|
|
71308
|
+
},
|
|
71309
|
+
onResizeEnd: (target) => {
|
|
71310
|
+
eventBus.emit("resize-end", { target });
|
|
71311
|
+
},
|
|
71312
|
+
onShapeUpdate: (id, updates) => {
|
|
71313
|
+
graphStore.updateShape(id, updates);
|
|
71314
|
+
}
|
|
71315
|
+
}
|
|
71316
|
+
);
|
|
71317
|
+
const { isResizing, groupGhost, startResize } = resizeUtils;
|
|
71318
|
+
const nameInput = ref(null);
|
|
71319
|
+
watchEffect(() => {
|
|
71320
|
+
if (nameInput.value) {
|
|
71321
|
+
nameEditManager.setNameInput(nameInput.value);
|
|
71049
71322
|
}
|
|
71050
71323
|
});
|
|
71051
|
-
const {
|
|
71052
|
-
isResizing,
|
|
71053
|
-
groupGhost,
|
|
71054
|
-
startResize
|
|
71055
|
-
} = resizeUtils;
|
|
71056
71324
|
const { isEditingName, editingName } = nameEditManager.editingState;
|
|
71057
71325
|
const isMouseInside = ref(false);
|
|
71058
71326
|
let rafId = null;
|
|
@@ -71117,9 +71385,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71117
71385
|
const shouldCloseMenu = computed(() => {
|
|
71118
71386
|
return graphStore.isDragging || isResizing.value || isEditingName.value;
|
|
71119
71387
|
});
|
|
71120
|
-
const clickActionButton = (
|
|
71121
|
-
event.stopPropagation();
|
|
71122
|
-
event.preventDefault();
|
|
71388
|
+
const clickActionButton = (value, shape) => {
|
|
71123
71389
|
if (isEditingName.value) {
|
|
71124
71390
|
nameEditManager.handleBlur(graphStore.selectedShape);
|
|
71125
71391
|
}
|
|
@@ -71133,11 +71399,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71133
71399
|
}
|
|
71134
71400
|
emit("modelTypePropertyIdButtonClick", value, shape);
|
|
71135
71401
|
};
|
|
71136
|
-
const getSelectionBoxStyle = (shape) => selectionBoxStyle(shape);
|
|
71137
|
-
const getHandleStyle = (h2, shape) => handleStyle(h2.position, shape);
|
|
71138
|
-
const startEditName = async () => {
|
|
71139
|
-
await nameEditManager.startEdit(graphStore.selectedShape);
|
|
71140
|
-
};
|
|
71141
71402
|
const onLayerDblClick = (payload) => {
|
|
71142
71403
|
emit("propertyPanel", payload);
|
|
71143
71404
|
};
|
|
@@ -71152,9 +71413,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71152
71413
|
showContextMenu.value = false;
|
|
71153
71414
|
}
|
|
71154
71415
|
if (target.classList.contains("name-text-box")) {
|
|
71155
|
-
if (nameEditManager.canEdit(graphStore.selectedShape)) {
|
|
71156
|
-
startEditName();
|
|
71157
|
-
}
|
|
71158
71416
|
return;
|
|
71159
71417
|
}
|
|
71160
71418
|
if (isConnecting.value && props2.connectShapeData && props2.diagramBounds) {
|
|
@@ -71179,7 +71437,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71179
71437
|
const localPoint = toLocalPoint(evt, layerRef.value);
|
|
71180
71438
|
const clickX = localPoint.x;
|
|
71181
71439
|
const clickY = localPoint.y;
|
|
71182
|
-
const hasShapeAtPoint = EdgeUtils.isEndPointInShape(graphStore.shapes, {
|
|
71440
|
+
const hasShapeAtPoint = EdgeUtils.isEndPointInShape(graphStore.shapes, {
|
|
71441
|
+
x: clickX,
|
|
71442
|
+
y: clickY
|
|
71443
|
+
});
|
|
71183
71444
|
if (!hasShapeAtPoint) {
|
|
71184
71445
|
if (!!((_a2 = sourceShape.value) == null ? void 0 : _a2.parenShapeId)) {
|
|
71185
71446
|
isConnecting.value = false;
|
|
@@ -71213,7 +71474,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71213
71474
|
height: defaultHeight,
|
|
71214
71475
|
modelId: ""
|
|
71215
71476
|
};
|
|
71216
|
-
emit("actionButtonAdd", {
|
|
71477
|
+
emit("actionButtonAdd", {
|
|
71478
|
+
shapeKey: newShape.shapeKey,
|
|
71479
|
+
x: newShapeX,
|
|
71480
|
+
y: newShapeY,
|
|
71481
|
+
diagramId
|
|
71482
|
+
});
|
|
71217
71483
|
return;
|
|
71218
71484
|
} else {
|
|
71219
71485
|
handleConnectLayerClick(evt);
|
|
@@ -71272,7 +71538,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71272
71538
|
}
|
|
71273
71539
|
if (hit.kind === "shape" || hit.kind === "edge" || hit.kind === "pin") {
|
|
71274
71540
|
const { shape } = hit;
|
|
71275
|
-
console.log(
|
|
71541
|
+
console.log(
|
|
71542
|
+
"点击选中的" + (hit.kind === "edge" ? "线条" : hit.kind === "pin" ? "Pin" : "图元") + "数据信息:",
|
|
71543
|
+
shape
|
|
71544
|
+
);
|
|
71276
71545
|
const isMulti = graphStore.selectedIds.length > 1;
|
|
71277
71546
|
const clickedInSelection = graphStore.selectedIds.includes(shape.id);
|
|
71278
71547
|
if (isMulti && clickedInSelection)
|
|
@@ -71296,11 +71565,20 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71296
71565
|
if (started) {
|
|
71297
71566
|
let targetPt = curr;
|
|
71298
71567
|
if (ids.length === 1) {
|
|
71299
|
-
const draggedShape = graphStore.shapes.find(
|
|
71568
|
+
const draggedShape = graphStore.shapes.find(
|
|
71569
|
+
(x2) => x2.id === ids[0]
|
|
71570
|
+
);
|
|
71300
71571
|
if (draggedShape && draggedShape.shapeType === "pin" && draggedShape.parenShapeId) {
|
|
71301
|
-
const parentShape = graphStore.shapes.find(
|
|
71572
|
+
const parentShape = graphStore.shapes.find(
|
|
71573
|
+
(x2) => x2.id === draggedShape.parenShapeId
|
|
71574
|
+
);
|
|
71302
71575
|
if (parentShape) {
|
|
71303
|
-
targetPt = snapPinPointerOnMove(
|
|
71576
|
+
targetPt = snapPinPointerOnMove(
|
|
71577
|
+
curr,
|
|
71578
|
+
parentShape,
|
|
71579
|
+
draggedShape,
|
|
71580
|
+
graphStore.dragOffset || void 0
|
|
71581
|
+
);
|
|
71304
71582
|
}
|
|
71305
71583
|
}
|
|
71306
71584
|
}
|
|
@@ -71414,32 +71692,35 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71414
71692
|
closeMenu();
|
|
71415
71693
|
}
|
|
71416
71694
|
});
|
|
71417
|
-
watch(
|
|
71418
|
-
|
|
71419
|
-
|
|
71420
|
-
if (
|
|
71421
|
-
|
|
71422
|
-
|
|
71423
|
-
|
|
71424
|
-
|
|
71425
|
-
|
|
71426
|
-
|
|
71427
|
-
|
|
71428
|
-
|
|
71429
|
-
|
|
71430
|
-
|
|
71431
|
-
|
|
71432
|
-
|
|
71433
|
-
|
|
71434
|
-
|
|
71435
|
-
|
|
71436
|
-
highlightTimeout.value
|
|
71695
|
+
watch(
|
|
71696
|
+
() => props2.actionButtonShapeDataId,
|
|
71697
|
+
(newVal) => {
|
|
71698
|
+
if (newVal) {
|
|
71699
|
+
const foundShape = graphStore.shapes.find((x2) => x2.id === newVal);
|
|
71700
|
+
if (foundShape) {
|
|
71701
|
+
if (sourceShape.value) {
|
|
71702
|
+
const connectionData = EdgeUtils.completeConnection(
|
|
71703
|
+
sourceShape.value,
|
|
71704
|
+
foundShape,
|
|
71705
|
+
{ x: recordClickPoint.value.x, y: recordClickPoint.value.y },
|
|
71706
|
+
currentConnectPoint.value,
|
|
71707
|
+
graphStore.shapes
|
|
71708
|
+
);
|
|
71709
|
+
if (connectionData) {
|
|
71710
|
+
emit("connectEnd", connectionData);
|
|
71711
|
+
graphStore.setConnectMode("connect");
|
|
71712
|
+
isConnecting.value = false;
|
|
71713
|
+
highlightUtils.clearHighlightTimeout();
|
|
71714
|
+
if (highlightTimeout.value) {
|
|
71715
|
+
clearTimeout(highlightTimeout.value);
|
|
71716
|
+
highlightTimeout.value = null;
|
|
71717
|
+
}
|
|
71437
71718
|
}
|
|
71438
71719
|
}
|
|
71439
71720
|
}
|
|
71440
71721
|
}
|
|
71441
71722
|
}
|
|
71442
|
-
|
|
71723
|
+
);
|
|
71443
71724
|
const handleMouseMove = (event) => {
|
|
71444
71725
|
const { clientX, clientY } = event;
|
|
71445
71726
|
const localPoint = toLocalPoint(event, layerRef.value);
|
|
@@ -71486,11 +71767,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71486
71767
|
isAllowed = targetModels.includes(hoverShapeType);
|
|
71487
71768
|
}
|
|
71488
71769
|
if ((_f = props2.connectShapeData) == null ? void 0 : _f.sourceId) {
|
|
71489
|
-
const sourceShape2 = graphStore.shapes.find(
|
|
71490
|
-
|
|
71491
|
-
|
|
71492
|
-
|
|
71493
|
-
|
|
71770
|
+
const sourceShape2 = graphStore.shapes.find(
|
|
71771
|
+
(it2) => {
|
|
71772
|
+
var _a3;
|
|
71773
|
+
return it2.id === ((_a3 = props2.connectShapeData) == null ? void 0 : _a3.sourceId);
|
|
71774
|
+
}
|
|
71775
|
+
);
|
|
71776
|
+
if (sourceShape2 && sourceShape2.parenShapeId !== hoverShape.parenShapeId && hoverShape.shapeType !== "pin" && sourceShape2.shapeType !== "pin") {
|
|
71494
71777
|
isAllowed = false;
|
|
71495
71778
|
}
|
|
71496
71779
|
}
|
|
@@ -71573,7 +71856,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71573
71856
|
}
|
|
71574
71857
|
};
|
|
71575
71858
|
const completeConnection = (clickedShape, clickPoint) => {
|
|
71576
|
-
var _a2, _b;
|
|
71859
|
+
var _a2, _b, _c;
|
|
71577
71860
|
const sourceShape2 = graphStore.shapes.find(
|
|
71578
71861
|
(shape) => {
|
|
71579
71862
|
var _a3;
|
|
@@ -71588,7 +71871,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71588
71871
|
ElMessage.error("当前目标图元类型不符合连接要求");
|
|
71589
71872
|
return;
|
|
71590
71873
|
}
|
|
71591
|
-
if (sourceShape2 && clickedShape && sourceShape2.parenShapeId !== clickedShape.parenShapeId &&
|
|
71874
|
+
if (sourceShape2 && clickedShape && sourceShape2.parenShapeId !== clickedShape.parenShapeId && clickedShape.shapeType !== "pin" && sourceShape2.shapeType !== "pin") {
|
|
71592
71875
|
isConnecting.value = false;
|
|
71593
71876
|
highlightShape(null, false);
|
|
71594
71877
|
highlightUtils.clearHighlightTimeout();
|
|
@@ -71627,7 +71910,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71627
71910
|
graphStore.shapes
|
|
71628
71911
|
);
|
|
71629
71912
|
if (connectionData) {
|
|
71630
|
-
if (((_b = props2.connectShapeData) == null ? void 0 : _b.shapeKey)
|
|
71913
|
+
if (((_c = (_b = props2.connectShapeData) == null ? void 0 : _b.shapeKey) == null ? void 0 : _c.toLowerCase().includes("objectflow")) && sourceShape2 && connectionData.sourcePoint && connectionData.targetPoint) {
|
|
71631
71914
|
const result = EdgeUtils.handleServiceObjectFlowConnection(
|
|
71632
71915
|
sourceShape2,
|
|
71633
71916
|
clickedShape,
|
|
@@ -71783,7 +72066,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71783
72066
|
var _a2, _b;
|
|
71784
72067
|
externalCreateDragState.isDragging = true;
|
|
71785
72068
|
isExternalCreateDragging.value = true;
|
|
71786
|
-
const pt2 = clientToLocalPoint(
|
|
72069
|
+
const pt2 = clientToLocalPoint(
|
|
72070
|
+
payload.clientX,
|
|
72071
|
+
payload.clientY,
|
|
72072
|
+
layerRef.value
|
|
72073
|
+
);
|
|
71787
72074
|
if (payload.shapeData) {
|
|
71788
72075
|
const s22 = payload.shapeData;
|
|
71789
72076
|
const isCmp = isCompartment(s22);
|
|
@@ -71813,12 +72100,20 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71813
72100
|
if (!externalCreateDragState.creatingId)
|
|
71814
72101
|
return;
|
|
71815
72102
|
let targetPt = pt2;
|
|
71816
|
-
const s2 = graphStore.shapes.find(
|
|
72103
|
+
const s2 = graphStore.shapes.find(
|
|
72104
|
+
(x2) => x2.id === externalCreateDragState.creatingId
|
|
72105
|
+
);
|
|
71817
72106
|
if (s2 && s2.shapeType === "pin") {
|
|
71818
72107
|
if (graphStore.hoverContainerId && graphStore.hoverNestable !== false) {
|
|
71819
|
-
const parent2 = graphStore.shapes.find(
|
|
72108
|
+
const parent2 = graphStore.shapes.find(
|
|
72109
|
+
(x2) => x2.id === graphStore.hoverContainerId
|
|
72110
|
+
);
|
|
71820
72111
|
if (parent2) {
|
|
71821
|
-
const { x: adjustedX, y: adjustedY } = snapPinToParentEdge(
|
|
72112
|
+
const { x: adjustedX, y: adjustedY } = snapPinToParentEdge(
|
|
72113
|
+
pt2,
|
|
72114
|
+
parent2,
|
|
72115
|
+
s2
|
|
72116
|
+
);
|
|
71822
72117
|
targetPt = { x: adjustedX, y: adjustedY };
|
|
71823
72118
|
}
|
|
71824
72119
|
}
|
|
@@ -71829,11 +72124,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71829
72124
|
try {
|
|
71830
72125
|
if (!externalCreateDragState.creatingId)
|
|
71831
72126
|
return;
|
|
71832
|
-
const pt2 = clientToLocalPoint(
|
|
72127
|
+
const pt2 = clientToLocalPoint(
|
|
72128
|
+
payload.clientX,
|
|
72129
|
+
payload.clientY,
|
|
72130
|
+
layerRef.value
|
|
72131
|
+
);
|
|
71833
72132
|
if (isInsideCanvasClient(payload.clientX, payload.clientY, layerRef.value)) {
|
|
71834
72133
|
graphStore.moveDraggedShape(pt2);
|
|
71835
72134
|
await nextTick();
|
|
71836
|
-
const s2 = (graphStore.shapes || []).find(
|
|
72135
|
+
const s2 = (graphStore.shapes || []).find(
|
|
72136
|
+
(x2) => x2.id == externalCreateDragState.creatingId
|
|
72137
|
+
);
|
|
71837
72138
|
if (s2 && s2.shapeType == "shape" || s2.shapeType == "pin") {
|
|
71838
72139
|
const pure = _.omit(s2, ["inert"]);
|
|
71839
72140
|
pure.bounds = {
|
|
@@ -71849,14 +72150,22 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71849
72150
|
) || null;
|
|
71850
72151
|
}
|
|
71851
72152
|
if (pure.shapeType === "pin" && parent2) {
|
|
71852
|
-
const { x: adjustedX, y: adjustedY } = snapPinToParentEdge(
|
|
72153
|
+
const { x: adjustedX, y: adjustedY } = snapPinToParentEdge(
|
|
72154
|
+
pt2,
|
|
72155
|
+
parent2,
|
|
72156
|
+
pure
|
|
72157
|
+
);
|
|
71853
72158
|
pure.bounds.x = adjustedX;
|
|
71854
72159
|
pure.bounds.y = adjustedY;
|
|
71855
72160
|
pure.parenShapeId = parent2.id;
|
|
71856
72161
|
graphStore.moveDraggedShape({ x: adjustedX, y: adjustedY });
|
|
71857
72162
|
}
|
|
71858
72163
|
try {
|
|
71859
|
-
const { ok } = await checkNestViaFront(
|
|
72164
|
+
const { ok } = await checkNestViaFront(
|
|
72165
|
+
pure,
|
|
72166
|
+
parent2,
|
|
72167
|
+
graphStore.shapes[0]
|
|
72168
|
+
);
|
|
71860
72169
|
if (!ok) {
|
|
71861
72170
|
graphStore.setHoverState(null, false);
|
|
71862
72171
|
await cleanupInertShapes();
|
|
@@ -71880,7 +72189,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71880
72189
|
icon: s2.icon
|
|
71881
72190
|
};
|
|
71882
72191
|
if (pure.shapeType === "pin" && parent2) {
|
|
71883
|
-
const adjustedClientPt = localToClientPoint(
|
|
72192
|
+
const adjustedClientPt = localToClientPoint(
|
|
72193
|
+
pure.bounds.x,
|
|
72194
|
+
pure.bounds.y,
|
|
72195
|
+
layerRef.value
|
|
72196
|
+
);
|
|
71884
72197
|
payloadData.coordinate.clientX = adjustedClientPt.clientX;
|
|
71885
72198
|
payloadData.coordinate.clientY = adjustedClientPt.clientY;
|
|
71886
72199
|
}
|
|
@@ -71931,7 +72244,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71931
72244
|
},
|
|
71932
72245
|
onEditProperty: () => onLayerDblClick(true),
|
|
71933
72246
|
onCancelConnection: cancelConnection,
|
|
71934
|
-
isEditingName: () => isEditingName.value
|
|
72247
|
+
isEditingName: () => isEditingName.value,
|
|
72248
|
+
onCopy: () => {
|
|
72249
|
+
const selectedShapes = graphStore.selectedIds.map((id) => graphStore.shapes.find((s2) => s2.id === id)).filter(Boolean);
|
|
72250
|
+
if (selectedShapes.length === 0) {
|
|
72251
|
+
return;
|
|
72252
|
+
}
|
|
72253
|
+
ContextMenuUtils.setCopiedShapes(selectedShapes);
|
|
72254
|
+
},
|
|
72255
|
+
onPaste: () => {
|
|
72256
|
+
ContextMenuUtils.handlePaste(graphStore.selectedShape);
|
|
72257
|
+
}
|
|
71935
72258
|
});
|
|
71936
72259
|
onMounted(() => {
|
|
71937
72260
|
window.addEventListener("keydown", keyboardHandler);
|
|
@@ -71941,6 +72264,15 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71941
72264
|
initializeConnectPoint();
|
|
71942
72265
|
}
|
|
71943
72266
|
eventBus.on("shape-drag-end-updateScenarioMenu", actionButtonsStyle);
|
|
72267
|
+
eventBus.on("paste-shapes", (shapes) => {
|
|
72268
|
+
shapes.forEach((shape) => {
|
|
72269
|
+
graphStore.addShape(shape);
|
|
72270
|
+
});
|
|
72271
|
+
});
|
|
72272
|
+
eventBus.on("select-shapes", (ids) => {
|
|
72273
|
+
graphStore.clearSelection();
|
|
72274
|
+
graphStore.selectMany(ids);
|
|
72275
|
+
});
|
|
71944
72276
|
});
|
|
71945
72277
|
onUnmounted(() => {
|
|
71946
72278
|
offDrag == null ? void 0 : offDrag();
|
|
@@ -71964,7 +72296,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71964
72296
|
}
|
|
71965
72297
|
});
|
|
71966
72298
|
return (_ctx, _cache) => {
|
|
71967
|
-
var _a2;
|
|
72299
|
+
var _a2, _b;
|
|
71968
72300
|
return openBlock(), createElementBlock("div", {
|
|
71969
72301
|
onMouseenter: onMouseEnter,
|
|
71970
72302
|
onMouseleave: onMouseLeave,
|
|
@@ -71981,56 +72313,15 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
71981
72313
|
onContextmenu: withModifiers(handleContextMenu, ["prevent"])
|
|
71982
72314
|
}, [
|
|
71983
72315
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(graphStore).marqueeShapes, (s2) => {
|
|
71984
|
-
return openBlock(),
|
|
72316
|
+
return openBlock(), createBlock(SelectionBox, {
|
|
71985
72317
|
key: s2.id,
|
|
71986
|
-
|
|
71987
|
-
|
|
71988
|
-
|
|
71989
|
-
|
|
71990
|
-
|
|
71991
|
-
|
|
71992
|
-
|
|
71993
|
-
class: normalizeClass(["resize-handle", [`resize-${h2.position}`, { "is-disabled": isMultiSelected.value }]]),
|
|
71994
|
-
style: normalizeStyle(getHandleStyle(h2, s2)),
|
|
71995
|
-
onMousedown: withModifiers(($event) => unref(startResize)($event, h2.position, s2), ["stop", "prevent"])
|
|
71996
|
-
}, null, 46, _hoisted_2$f);
|
|
71997
|
-
}), 128))
|
|
71998
|
-
], 512), [
|
|
71999
|
-
[vShow, !isBusy.value && s2.shapeType !== "edge"]
|
|
72000
|
-
]),
|
|
72001
|
-
withDirectives(createElementVNode("div", {
|
|
72002
|
-
class: "action-buttons",
|
|
72003
|
-
style: normalizeStyle(unref(actionButtonsStyle)(s2))
|
|
72004
|
-
}, [
|
|
72005
|
-
s2.modelTypePropertyId ? (openBlock(), createElementBlock("div", _hoisted_3$d, [
|
|
72006
|
-
createElementVNode("button", {
|
|
72007
|
-
class: "action-btn edit-btn",
|
|
72008
|
-
onMousedown: withModifiers(($event) => clickModelTypePropertyIdButton(s2.modelTypePropertyId, s2), ["stop", "prevent"]),
|
|
72009
|
-
title: "设置类型"
|
|
72010
|
-
}, [..._cache[8] || (_cache[8] = [
|
|
72011
|
-
createElementVNode("img", {
|
|
72012
|
-
src: _imports_0$1,
|
|
72013
|
-
alt: "设置类型"
|
|
72014
|
-
}, null, -1)
|
|
72015
|
-
])], 40, _hoisted_4$c)
|
|
72016
|
-
])) : createCommentVNode("", true),
|
|
72017
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(s2.scenarioMenus, (value) => {
|
|
72018
|
-
return openBlock(), createElementBlock("button", {
|
|
72019
|
-
class: "action-btn edit-btn",
|
|
72020
|
-
onMousedown: withModifiers(($event) => clickActionButton($event, value.code, s2), ["stop", "prevent"]),
|
|
72021
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
72022
|
-
}, ["stop", "prevent"])),
|
|
72023
|
-
title: value.name
|
|
72024
|
-
}, [
|
|
72025
|
-
createElementVNode("img", {
|
|
72026
|
-
src: unref(getIcon)("childIcons", value.icon || "")
|
|
72027
|
-
}, null, 8, _hoisted_6$9)
|
|
72028
|
-
], 40, _hoisted_5$a);
|
|
72029
|
-
}), 256))
|
|
72030
|
-
], 4), [
|
|
72031
|
-
[vShow, !isMultiSelected.value && s2.scenarioMenus && s2.scenarioMenus.length > 0 && s2.shapeType != unref(ShapeConfig).SHAPE_TYPE]
|
|
72032
|
-
])
|
|
72033
|
-
], 4);
|
|
72318
|
+
shape: s2,
|
|
72319
|
+
"is-busy": isBusy.value,
|
|
72320
|
+
"is-multi-selected": isMultiSelected.value,
|
|
72321
|
+
onResizeStart: unref(startResize),
|
|
72322
|
+
onActionButtonClick: clickActionButton,
|
|
72323
|
+
onModelTypePropertyIdClick: clickModelTypePropertyIdButton
|
|
72324
|
+
}, null, 8, ["shape", "is-busy", "is-multi-selected", "onResizeStart"]);
|
|
72034
72325
|
}), 128)),
|
|
72035
72326
|
hoverRect.value ? (openBlock(), createElementBlock("div", {
|
|
72036
72327
|
key: 0,
|
|
@@ -72061,49 +72352,25 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
72061
72352
|
style: normalizeStyle(getGhostShapeStyle(g))
|
|
72062
72353
|
}, null, 8, ["shape", "style"]);
|
|
72063
72354
|
}), 128)),
|
|
72064
|
-
|
|
72065
|
-
|
|
72066
|
-
|
|
72067
|
-
|
|
72068
|
-
|
|
72069
|
-
|
|
72070
|
-
|
|
72071
|
-
|
|
72072
|
-
|
|
72073
|
-
}, null, 4)
|
|
72074
|
-
], 4)) : createCommentVNode("", true),
|
|
72075
|
-
unref(isEditingName) && unref(graphStore).selectedShape && unref(graphStore).selectedShape.shapeKey !== "ConceptRole" ? (openBlock(), createElementBlock("div", {
|
|
72076
|
-
key: 3,
|
|
72077
|
-
class: "name-editor-container",
|
|
72078
|
-
style: normalizeStyle(unref(nameEditorContainerStyle)(unref(graphStore).selectedShape))
|
|
72079
|
-
}, [
|
|
72080
|
-
withDirectives(createElementVNode("input", {
|
|
72081
|
-
ref: "nameInput",
|
|
72082
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(editingName) ? editingName.value = $event : null),
|
|
72083
|
-
class: "name-input",
|
|
72084
|
-
style: normalizeStyle(unref(nameInputStyle)(unref(graphStore).selectedShape)),
|
|
72085
|
-
onBlur: _cache[2] || (_cache[2] = ($event) => unref(nameEditManager).handleBlur(unref(graphStore).selectedShape)),
|
|
72086
|
-
onKeyup: [
|
|
72087
|
-
_cache[3] || (_cache[3] = withKeys(($event) => unref(nameEditManager).handleKeyUp($event, unref(graphStore).selectedShape), ["enter"])),
|
|
72088
|
-
_cache[4] || (_cache[4] = withKeys(($event) => unref(nameEditManager).cancelEdit(), ["escape"]))
|
|
72089
|
-
]
|
|
72090
|
-
}, null, 36), [
|
|
72091
|
-
[vModelText, unref(editingName)]
|
|
72092
|
-
])
|
|
72093
|
-
], 4)) : createCommentVNode("", true),
|
|
72355
|
+
createVNode(NameEditor, {
|
|
72356
|
+
"selected-shape": unref(graphStore).selectedShape,
|
|
72357
|
+
"can-edit": !unref(graphStore).pendingNestedIds.includes(
|
|
72358
|
+
((_a2 = unref(graphStore).selectedShape) == null ? void 0 : _a2.id) || ""
|
|
72359
|
+
),
|
|
72360
|
+
"is-editing-name": unref(isEditingName),
|
|
72361
|
+
"editing-name": unref(editingName),
|
|
72362
|
+
"name-edit-manager": unref(nameEditManager)
|
|
72363
|
+
}, null, 8, ["selected-shape", "can-edit", "is-editing-name", "editing-name", "name-edit-manager"]),
|
|
72094
72364
|
unref(selectedShape) && !isMultiSelected.value ? (openBlock(), createBlock(ContextMenu, {
|
|
72095
|
-
key:
|
|
72365
|
+
key: 2,
|
|
72096
72366
|
visible: showContextMenu.value,
|
|
72097
72367
|
"selected-shape": unref(selectedShape),
|
|
72098
72368
|
position: contextMenuPosition.value,
|
|
72099
|
-
"onUpdate:visible": _cache[
|
|
72100
|
-
|
|
72101
|
-
onShowPropertyPanel: _cache[7] || (_cache[7] = ($event) => {
|
|
72102
|
-
onLayerDblClick(true);
|
|
72103
|
-
})
|
|
72369
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => showContextMenu.value = $event),
|
|
72370
|
+
onShowPropertyPanel: _cache[1] || (_cache[1] = ($event) => onLayerDblClick(true))
|
|
72104
72371
|
}, null, 8, ["visible", "selected-shape", "position"])) : createCommentVNode("", true),
|
|
72105
72372
|
_ctx.connectShapeData && _ctx.diagramBounds ? (openBlock(), createElementBlock("div", {
|
|
72106
|
-
key:
|
|
72373
|
+
key: 3,
|
|
72107
72374
|
class: "connect-layer",
|
|
72108
72375
|
style: normalizeStyle(layerStyle.value)
|
|
72109
72376
|
}, [
|
|
@@ -72116,7 +72383,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
72116
72383
|
key: 1,
|
|
72117
72384
|
"show-line": showLine.value,
|
|
72118
72385
|
points: linePoints.value,
|
|
72119
|
-
"shape-key": (
|
|
72386
|
+
"shape-key": (_b = _ctx.connectShapeData) == null ? void 0 : _b.shapeKey,
|
|
72120
72387
|
style: normalizeStyle(svgStyle.value)
|
|
72121
72388
|
}, null, 8, ["show-line", "points", "shape-key", "style"])) : createCommentVNode("", true)
|
|
72122
72389
|
], 4)) : createCommentVNode("", true)
|
|
@@ -72124,8 +72391,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
72124
72391
|
};
|
|
72125
72392
|
}
|
|
72126
72393
|
});
|
|
72127
|
-
const
|
|
72128
|
-
const InteractionLayer = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__scopeId", "data-v-
|
|
72394
|
+
const InteractionLayer_vue_vue_type_style_index_0_scoped_62816583_lang = "";
|
|
72395
|
+
const InteractionLayer = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__scopeId", "data-v-62816583"]]);
|
|
72129
72396
|
const _hoisted_1$e = { class: "diagram-header" };
|
|
72130
72397
|
const _hoisted_2$e = { class: "diagram-title" };
|
|
72131
72398
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|