feat: add delete menu to graph node #918 (#1133)

### What problem does this PR solve?
feat: add delete menu to graph node #918

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-12 17:38:41 +08:00
committed by GitHub
parent e05395d2a7
commit 3b7b6240c3
10 changed files with 149 additions and 97 deletions

View File

@ -18,6 +18,7 @@ import { Node, Position, ReactFlowInstance } from 'reactflow';
import { useDebounceEffect } from 'ahooks';
import { humanId } from 'human-id';
import { useParams } from 'umi';
import { Operator } from './constant';
import useGraphStore, { RFState } from './store';
import { buildDslComponentsByGraph } from './utils';
@ -79,7 +80,7 @@ export const useHandleDrop = () => {
});
const newNode = {
id: `${type}:${humanId()}`,
type: 'textUpdater',
type: 'ragNode',
position: position || {
x: 0,
y: 0,
@ -110,7 +111,9 @@ export const useShowDrawer = () => {
const handleShow = useCallback(
(node: Node) => {
setClickedNode(node);
showDrawer();
if (node.data.label !== Operator.Answer) {
showDrawer();
}
},
[showDrawer],
);