fix: polish PARALLEL swimlanes and color-code edge conditions

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
0264408
2026-09-20 09:53:01 +08:00
co-authored by Cursor
parent 2c2dd8d0d2
commit 18b62003d1
11 changed files with 229 additions and 81 deletions
+11 -3
View File
@@ -173,13 +173,18 @@ export const useDesignerStore = defineStore('designer', () => {
}
function syncStartFlags() {
const current = nodes.value.find((node) => node.id === startStepId.value)
if (current?.parentNode) {
startStepId.value = current.parentNode
}
nodes.value = nodes.value.map((node) => {
if (!node.data || node.data.kind === 'END') {
return node
}
const isStart = !node.parentNode && node.id === startStepId.value
return {
...node,
data: { ...node.data, isStart: node.id === startStepId.value },
data: { ...node.data, isStart },
}
})
}
@@ -694,7 +699,7 @@ export const useDesignerStore = defineStore('designer', () => {
edges.value = edges.value.filter((edge) => !drop.has(edge.source) && !drop.has(edge.target))
}
function addLaneStep(parallelId: string, lane: string) {
function addLaneStep(parallelId: string, lane: string, kind: 'approval' | 'action' = 'approval') {
const parent = nodes.value.find((node) => node.id === parallelId)
if (!parent || parent.data.kind !== 'PARALLEL' || !parent.data.lanes.includes(lane)) {
return
@@ -702,7 +707,10 @@ export const useDesignerStore = defineStore('designer', () => {
pushHistory()
const laneIndex = parent.data.lanes.indexOf(lane)
const stepIndex = nodes.value.filter((node) => node.parentNode === parallelId && laneOf(node.data) === lane).length
nodes.value = fitParallelFrames([...nodes.value, spawnLaneStep(parallelId, lane, laneIndex, stepIndex, nextId(lane))])
nodes.value = fitParallelFrames([
...nodes.value,
spawnLaneStep(parallelId, lane, laneIndex, stepIndex, nextId(lane), kind),
])
}
function renameLane(parallelId: string, from: string, to: string): boolean {