Merge remote-tracking branch 'origin/main' into feat/trigger

This commit is contained in:
lyzno1
2025-09-27 21:32:38 +08:00
38 changed files with 242 additions and 274 deletions

View File

@ -24,18 +24,6 @@ import ManageInputField from './manage-input-field'
import { VariableIconWithColor } from '@/app/components/workflow/nodes/_base/components/variable/variable-label'
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
type ObjectChildrenProps = {
nodeId: string
title: string
data: Var[]
objPath: string[]
onChange: (value: ValueSelector, item: Var) => void
onHovering?: (value: boolean) => void
itemWidth?: number
isSupportFileVar?: boolean
preferSchemaType?: boolean
}
type ItemProps = {
nodeId: string
title: string
@ -54,8 +42,6 @@ type ItemProps = {
preferSchemaType?: boolean
}
const objVarTypes = [VarType.object, VarType.file]
const Item: FC<ItemProps> = ({
nodeId,
title,
@ -240,68 +226,6 @@ const Item: FC<ItemProps> = ({
)
}
const ObjectChildren: FC<ObjectChildrenProps> = ({
title,
nodeId,
objPath,
data,
onChange,
onHovering,
itemWidth,
isSupportFileVar,
preferSchemaType,
}) => {
const currObjPath = objPath
const itemRef = useRef<HTMLDivElement>(null)
const [isItemHovering, setIsItemHovering] = useState(false)
useHover(itemRef, {
onChange: (hovering) => {
if (hovering) {
setIsItemHovering(true)
}
else {
setTimeout(() => {
setIsItemHovering(false)
}, 100)
}
},
})
const [isChildrenHovering, setIsChildrenHovering] = useState(false)
const isHovering = isItemHovering || isChildrenHovering
useEffect(() => {
onHovering && onHovering(isHovering)
}, [isHovering])
useEffect(() => {
onHovering && onHovering(isItemHovering)
}, [isItemHovering])
// absolute top-[-2px]
return (
<div ref={itemRef} className=' space-y-1 rounded-lg border border-gray-200 bg-white shadow-lg' style={{
right: itemWidth ? itemWidth - 10 : 215,
minWidth: 252,
}}>
<div className='flex h-[22px] items-center px-3 text-xs font-normal text-gray-700'><span className='text-gray-500'>{title}.</span>{currObjPath.join('.')}</div>
{
(data && data.length > 0)
&& data.map((v, i) => (
<Item
key={i}
nodeId={nodeId}
title={title}
objPath={objPath}
itemData={v}
onChange={onChange}
onHovering={setIsChildrenHovering}
isSupportFileVar={isSupportFileVar}
isException={v.isException}
preferSchemaType={preferSchemaType}
/>
))
}
</div>
)
}
type Props = {
hideSearch?: boolean
searchBoxClassName?: string

View File

@ -2,6 +2,7 @@ import type { FC } from 'react'
import {
memo,
useEffect,
useState,
} from 'react'
import {
Background,
@ -27,19 +28,20 @@ const Node: FC<NodeProps<IterationNodeType>> = ({
const nodesInitialized = useNodesInitialized()
const { handleNodeIterationRerender } = useNodeIterationInteractions()
const { t } = useTranslation()
const [showTips, setShowTips] = useState(data._isShowTips)
useEffect(() => {
if (nodesInitialized)
handleNodeIterationRerender(id)
if (data.is_parallel && data._isShowTips) {
if (data.is_parallel && showTips) {
Toast.notify({
type: 'warning',
message: t(`${i18nPrefix}.answerNodeWarningDesc`),
duration: 5000,
})
data._isShowTips = false
setShowTips(false)
}
}, [nodesInitialized, id, handleNodeIterationRerender, data, t])
}, [nodesInitialized, id, handleNodeIterationRerender, data.is_parallel, showTips, t])
return (
<div className={cn(