|
@@ -106,7 +106,7 @@
|
|
|
import {createVNode, getCurrentInstance, nextTick, onMounted, reactive, ref, render, watch} from "vue";
|
|
|
import {Graph, Path, Shape} from '@antv/x6'
|
|
|
import {getNodeDefault, lineActiveStyle, lineStyle} from "@/views/workflow/config";
|
|
|
-import nodeAdd from './node-add.vue'
|
|
|
+import nodePort from './node-port.vue'
|
|
|
import {register} from "@antv/x6-vue-shape";
|
|
|
import WorkflowNode from "./node-index.vue";
|
|
|
import {handleEdge, handleNode} from "@/views/workflow/handle";
|
|
@@ -127,8 +127,8 @@ Graph.registerPortLayout('start', (portsPositionArgs, elemBBox) => {
|
|
|
return portsPositionArgs.map((_, index) => {
|
|
|
return {
|
|
|
position: {
|
|
|
- x: 3,
|
|
|
- y: 25 + 7,
|
|
|
+ x: 0,
|
|
|
+ y: 25,
|
|
|
},
|
|
|
}
|
|
|
})
|
|
@@ -143,8 +143,8 @@ Graph.registerPortLayout('end', (portsPositionArgs, elemBBox) => {
|
|
|
return portsPositionArgs.map((_, index) => {
|
|
|
return {
|
|
|
position: {
|
|
|
- x: elemBBox.width + 11,
|
|
|
- y: 25 + 7,
|
|
|
+ x: elemBBox.width,
|
|
|
+ y: 25,
|
|
|
},
|
|
|
}
|
|
|
})
|
|
@@ -162,7 +162,7 @@ Graph.registerPortLayout('more', (portsPositionArgs, elemBBox) => {
|
|
|
})
|
|
|
return {
|
|
|
position: {
|
|
|
- x: elemBBox.width + 11,
|
|
|
+ x: elemBBox.width,
|
|
|
y: _.dy,
|
|
|
},
|
|
|
}
|
|
@@ -188,6 +188,26 @@ Graph.registerConnector(
|
|
|
)
|
|
|
Graph.registerNodeTool('contextmenu', ContextMenuTool, true)
|
|
|
Graph.registerEdgeTool('contextmenu', ContextMenuTool, true)
|
|
|
+Graph.registerHighlighter('port-highlight', {
|
|
|
+ highlight(cellView, magnet) {
|
|
|
+ const dom = magnet.getElementsByClassName('node-port')[0]
|
|
|
+ dom?.classList.add('highlight')
|
|
|
+ },
|
|
|
+ unhighlight(cellView, magnet) {
|
|
|
+ const dom = magnet.getElementsByClassName('node-port')[0]
|
|
|
+ dom?.classList.remove('highlight')
|
|
|
+ },
|
|
|
+}, true)
|
|
|
+Graph.registerHighlighter('port-select', {
|
|
|
+ highlight(cellView, magnet) {
|
|
|
+ const dom = magnet.getElementsByClassName('node-port')[0]
|
|
|
+ dom?.classList.add('select')
|
|
|
+ },
|
|
|
+ unhighlight(cellView, magnet) {
|
|
|
+ const dom = magnet.getElementsByClassName('node-port')[0]
|
|
|
+ dom?.classList.remove('select')
|
|
|
+ },
|
|
|
+}, true)
|
|
|
const WorkflowStore = useWorkflowStore()
|
|
|
const emits = defineEmits([])
|
|
|
const props = defineProps({
|
|
@@ -239,29 +259,11 @@ const initChart = () => {
|
|
|
highlighting: {
|
|
|
// 连接桩可以被连接时在连接桩外围围渲染一个包围框
|
|
|
magnetAvailable: {
|
|
|
- name: 'stroke',
|
|
|
- args: {
|
|
|
- rx: 100,
|
|
|
- ry: 100,
|
|
|
- attrs: {
|
|
|
- fill: '#fff',
|
|
|
- stroke: 'rgba(var(--czr-main-color-rgb), 0.5)',
|
|
|
- 'stroke-width': 3,
|
|
|
- },
|
|
|
- },
|
|
|
+ name: 'port-highlight',
|
|
|
},
|
|
|
// 连接桩吸附连线时在连接桩外围围渲染一个包围框
|
|
|
magnetAdsorbed: {
|
|
|
- name: 'stroke',
|
|
|
- args: {
|
|
|
- rx: 100,
|
|
|
- ry: 100,
|
|
|
- attrs: {
|
|
|
- fill: '#fff',
|
|
|
- stroke: 'rgba(var(--czr-main-color-rgb), 1)',
|
|
|
- 'stroke-width': 3,
|
|
|
- },
|
|
|
- },
|
|
|
+ name: 'port-select',
|
|
|
},
|
|
|
},
|
|
|
connecting: {
|
|
@@ -319,7 +321,7 @@ const initChart = () => {
|
|
|
const selectors = args.contentSelectors
|
|
|
const container = selectors && selectors.foContent
|
|
|
if (container) {
|
|
|
- render(createVNode(nodeAdd, {
|
|
|
+ render(createVNode(nodePort, {
|
|
|
port: args.port,
|
|
|
node: args.node,
|
|
|
graph: state.graph,
|
|
@@ -565,4 +567,12 @@ defineExpose({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+:deep(.port-start-high) {
|
|
|
+ background-color: red;
|
|
|
+ width: 10px;
|
|
|
+ height: 10px;
|
|
|
+ .port-start {
|
|
|
+ background-color: red !important;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|