fix: polish PARALLEL swimlanes and color-code edge conditions
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+11
-3
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user