feat(web): 增加循环节点的输出变量
This commit is contained in:
@@ -1,17 +1,37 @@
|
||||
import {Background, BackgroundVariant, type NodeProps} from '@xyflow/react'
|
||||
import {classnames} from 'amis'
|
||||
import React from 'react'
|
||||
import {flowBackgroundColor, flowDotColor} from '../types.ts'
|
||||
import AmisNode, {nodeClassName, NormalNodeHandler} from './AmisNode.tsx'
|
||||
import React, {useCallback, useEffect} from 'react'
|
||||
import AddNodeButton from '../component/AddNodeButton.tsx'
|
||||
import {useDataStore} from '../store/DataStore.ts'
|
||||
import {flowBackgroundColor, flowDotColor} from '../types.ts'
|
||||
import AmisNode, {nodeClassName, NormalNodeHandler, outputsFormColumns} from './AmisNode.tsx'
|
||||
|
||||
const LoopNode = (props: NodeProps) => {
|
||||
const {mergeDataById} = useDataStore()
|
||||
|
||||
useEffect(() => {
|
||||
mergeDataById(
|
||||
props.id,
|
||||
{
|
||||
outputs: {
|
||||
output: {
|
||||
type: 'array-object',
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
}, [props.id])
|
||||
|
||||
const columnsSchema = useCallback(() => [
|
||||
...outputsFormColumns(false, true),
|
||||
], [props.id])
|
||||
|
||||
return (
|
||||
<AmisNode
|
||||
className={classnames('w-full', 'h-full', nodeClassName('loop'))}
|
||||
style={{
|
||||
minWidth: '350px',
|
||||
minHeight: '290px'
|
||||
minHeight: '290px',
|
||||
}}
|
||||
nodeProps={props}
|
||||
extraNodeDescription={
|
||||
@@ -31,6 +51,7 @@ const LoopNode = (props: NodeProps) => {
|
||||
<AddNodeButton className="mt-2 ml-2" parent={props.id}/>
|
||||
</div>
|
||||
}
|
||||
columnSchema={columnsSchema}
|
||||
handler={<NormalNodeHandler/>}
|
||||
resize={{
|
||||
minWidth: 350,
|
||||
|
||||
Reference in New Issue
Block a user