Merge branch 'main' into feat/grouping-branching

# Conflicts:
#	web/app/components/workflow/block-icon.tsx
#	web/app/components/workflow/hooks/use-nodes-interactions.ts
#	web/app/components/workflow/index.tsx
#	web/app/components/workflow/nodes/components.ts
#	web/app/components/workflow/selection-contextmenu.tsx
#	web/app/components/workflow/utils/workflow-init.ts
This commit is contained in:
zhsama
2025-12-23 23:55:21 +08:00
3419 changed files with 86772 additions and 82082 deletions

View File

@ -1,11 +1,10 @@
import { memo, useMemo } from 'react'
import { RiArrowRightSLine } from '@remixicon/react'
import BlockIcon from '@/app/components/workflow/block-icon'
import { NodeSourceHandle } from '../_base/components/node-handle'
import type { NodeProps } from '@/app/components/workflow/types'
import type { GroupHandler, GroupMember, GroupNodeData } from './types'
import type { BlockEnum } from '@/app/components/workflow/types'
import type { BlockEnum, NodeProps } from '@/app/components/workflow/types'
import { RiArrowRightSLine } from '@remixicon/react'
import { memo, useMemo } from 'react'
import BlockIcon from '@/app/components/workflow/block-icon'
import { cn } from '@/utils/classnames'
import { NodeSourceHandle } from '../_base/components/node-handle'
const MAX_MEMBER_ICONS = 12
@ -18,10 +17,10 @@ const GroupNode = (props: NodeProps<GroupNodeData>) => {
? data.members
: data._children?.length
? data._children.map(child => ({
id: child.nodeId,
type: child.nodeType as BlockEnum,
label: child.nodeType,
}))
id: child.nodeId,
type: child.nodeType as BlockEnum,
label: child.nodeType,
}))
: []
), [data._children, data.members])
@ -31,40 +30,41 @@ const GroupNode = (props: NodeProps<GroupNodeData>) => {
? data.handlers
: members.length
? members.map(member => ({
id: member.id,
label: member.label || member.id,
}))
id: member.id,
label: member.label || member.id,
}))
: []
), [data.handlers, members])
return (
<div className='space-y-2 px-3 pb-3'>
<div className="space-y-2 px-3 pb-3">
{members.length > 0 && (
<div className='flex items-center gap-1 overflow-hidden'>
<div className='flex flex-wrap items-center gap-1 overflow-hidden'>
<div className="flex items-center gap-1 overflow-hidden">
<div className="flex flex-wrap items-center gap-1 overflow-hidden">
{members.slice(0, MAX_MEMBER_ICONS).map(member => (
<div
key={member.id}
className='flex h-7 items-center rounded-full bg-components-input-bg-normal px-1.5 shadow-xs'
className="flex h-7 items-center rounded-full bg-components-input-bg-normal px-1.5 shadow-xs"
>
<BlockIcon
type={member.type}
size='xs'
className='!shadow-none'
size="xs"
className="!shadow-none"
/>
</div>
))}
{members.length > MAX_MEMBER_ICONS && (
<div className='system-xs-medium rounded-full bg-components-input-bg-normal px-2 py-1 text-text-tertiary'>
+{members.length - MAX_MEMBER_ICONS}
<div className="system-xs-medium rounded-full bg-components-input-bg-normal px-2 py-1 text-text-tertiary">
+
{members.length - MAX_MEMBER_ICONS}
</div>
)}
</div>
<RiArrowRightSLine className='ml-auto h-4 w-4 shrink-0 text-text-tertiary' />
<RiArrowRightSLine className="ml-auto h-4 w-4 shrink-0 text-text-tertiary" />
</div>
)}
{handlers.length > 0 && (
<div className='space-y-1'>
<div className="space-y-1">
{handlers.map(handler => (
<div
key={handler.id}
@ -78,7 +78,7 @@ const GroupNode = (props: NodeProps<GroupNodeData>) => {
<NodeSourceHandle
{...props}
handleId={handler.id}
handleClassName='!top-1/2 !-translate-y-1/2 !-right-[21px]'
handleClassName="!top-1/2 !-translate-y-1/2 !-right-[21px]"
/>
</div>
))}