feat: Build the edges of Switch by form data #1739 (#2022)

### What problem does this PR solve?

feat: Build the edges of Switch  by form data #1739

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-20 19:27:49 +08:00
committed by GitHub
parent 7927d80a84
commit 96438ca821
6 changed files with 128 additions and 37 deletions

View File

@@ -4,7 +4,11 @@ import { useEffect, useMemo, useState } from 'react';
import { useUpdateNodeInternals } from 'reactflow';
import { Operator } from '../../constant';
import { IPosition, NodeData } from '../../interface';
import { buildNewPositionMap, isKeysEqual } from '../../utils';
import {
buildNewPositionMap,
generateSwitchHandleText,
isKeysEqual,
} from '../../utils';
export const useBuildCategorizeHandlePositions = ({
data,
@@ -32,7 +36,7 @@ export const useBuildCategorizeHandlePositions = ({
const position = positionMap[x];
let text = x;
if (operatorName === Operator.Switch) {
text = `Item ${idx + 1}`;
text = generateSwitchHandleText(idx);
}
return { text, ...position };
})