feat(web): 完成分支节点动态改变handle
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type {NodeProps} from '@xyflow/react'
|
||||
import {Tag} from 'antd'
|
||||
import React, {useCallback} from 'react'
|
||||
import React, {useMemo} from 'react'
|
||||
import {useContextStore} from '../store/ContextStore.ts'
|
||||
import {useDataStore} from '../store/DataStore.ts'
|
||||
import {useFlowStore} from '../store/FlowStore.ts'
|
||||
@@ -19,7 +19,7 @@ const CodeNode = (props: NodeProps) => {
|
||||
|
||||
const nodeData = getDataById(props.id)
|
||||
|
||||
const columnsSchema = useCallback(() => [
|
||||
const columnsSchema = useMemo(() => [
|
||||
...inputsFormColumns(props.id, getInputSchema(), getNodes(), getEdges(), getData()),
|
||||
{
|
||||
type: 'divider',
|
||||
@@ -47,18 +47,21 @@ const CodeNode = (props: NodeProps) => {
|
||||
},
|
||||
...outputsFormColumns(true, true),
|
||||
], [props.id])
|
||||
|
||||
const extraNodeDescription = useMemo(() => {
|
||||
return nodeData?.type
|
||||
? <div className="mt-2 flex justify-between">
|
||||
<span>代码类型</span>
|
||||
<Tag className="m-0" color="blue">{languageMap[nodeData.type]}</Tag>
|
||||
</div>
|
||||
: <></>
|
||||
}, [nodeData])
|
||||
|
||||
return (
|
||||
<AmisNode
|
||||
className={nodeClassName('code')}
|
||||
nodeProps={props}
|
||||
extraNodeDescription={
|
||||
nodeData?.type
|
||||
? <div className="mt-2 flex justify-between">
|
||||
<span>代码类型</span>
|
||||
<Tag className="m-0" color="blue">{languageMap[nodeData.type]}</Tag>
|
||||
</div>
|
||||
: <></>
|
||||
}
|
||||
extraNodeDescription={extraNodeDescription}
|
||||
columnSchema={columnsSchema}
|
||||
handler={<NormalNodeHandler/>}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user