42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type {NodeProps} from '@xyflow/react'
|
|
import React, {useCallback} from 'react'
|
|
import {generateAllIncomerOutputVariablesFormOptions} from '../Helper.tsx'
|
|
import {useContextStore} from '../store/ContextStore.ts'
|
|
import {useDataStore} from '../store/DataStore.ts'
|
|
import {useFlowStore} from '../store/FlowStore.ts'
|
|
import AmisNode, {EndNodeHandler, nodeClassName} from './AmisNode.tsx'
|
|
|
|
const OutputNode = (props: NodeProps) => {
|
|
const {getNodes, getEdges} = useFlowStore()
|
|
const {getData} = useDataStore()
|
|
const {getInputSchema} = useContextStore()
|
|
|
|
const columnsSchema = useCallback(
|
|
() => [
|
|
{
|
|
type: 'select',
|
|
name: 'output',
|
|
label: '输出变量',
|
|
required: true,
|
|
selectMode: 'group',
|
|
options: generateAllIncomerOutputVariablesFormOptions(
|
|
props.id,
|
|
getInputSchema(),
|
|
getNodes(),
|
|
getEdges(),
|
|
getData(),
|
|
),
|
|
},
|
|
], [props.id])
|
|
|
|
return (
|
|
<AmisNode
|
|
className={nodeClassName('output')}
|
|
nodeProps={props}
|
|
columnSchema={columnsSchema}
|
|
handler={<EndNodeHandler/>}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default React.memo(OutputNode) |