fix(ui): prevent var icon hidden when only one var in list of start node (#22290)

This commit is contained in:
Minamiyama 2025-07-13 20:10:15 +08:00 committed by GitHub
parent aa6cad5f1d
commit 016ff0feae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -23,7 +23,8 @@ type Props = {
onRemove?: () => void onRemove?: () => void
rightContent?: React.JSX.Element rightContent?: React.JSX.Element
varKeys?: string[] varKeys?: string[]
showLegacyBadge?: boolean showLegacyBadge?: boolean,
canDrag?: boolean,
} }
const VarItem: FC<Props> = ({ const VarItem: FC<Props> = ({
@ -35,6 +36,7 @@ const VarItem: FC<Props> = ({
rightContent, rightContent,
varKeys = [], varKeys = [],
showLegacyBadge = false, showLegacyBadge = false,
canDrag,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
@ -52,7 +54,7 @@ const VarItem: FC<Props> = ({
return ( return (
<div ref={ref} className={cn('flex h-8 cursor-pointer items-center justify-between rounded-lg border border-components-panel-border-subtle bg-components-panel-on-panel-item-bg px-2.5 shadow-xs hover:shadow-md', className)}> <div ref={ref} className={cn('flex h-8 cursor-pointer items-center justify-between rounded-lg border border-components-panel-border-subtle bg-components-panel-on-panel-item-bg px-2.5 shadow-xs hover:shadow-md', className)}>
<div className='flex w-0 grow items-center space-x-1'> <div className='flex w-0 grow items-center space-x-1'>
<Variable02 className='h-3.5 w-3.5 text-text-accent group-hover:opacity-0' /> <Variable02 className={cn('h-3.5 w-3.5 text-text-accent', canDrag && 'group-hover:opacity-0')} />
<div title={payload.variable} className='max-w-[130px] shrink-0 truncate text-[13px] font-medium text-text-secondary'>{payload.variable}</div> <div title={payload.variable} className='max-w-[130px] shrink-0 truncate text-[13px] font-medium text-text-secondary'>{payload.variable}</div>
{payload.label && (<><div className='shrink-0 text-xs font-medium text-text-quaternary'>·</div> {payload.label && (<><div className='shrink-0 text-xs font-medium text-text-quaternary'>·</div>
<div title={payload.label as string} className='max-w-[130px] truncate text-[13px] font-medium text-text-tertiary'>{payload.label as string}</div> <div title={payload.label as string} className='max-w-[130px] truncate text-[13px] font-medium text-text-tertiary'>{payload.label as string}</div>

View File

@ -91,6 +91,7 @@ const VarList: FC<Props> = ({
onChange={handleVarChange(index)} onChange={handleVarChange(index)}
onRemove={handleVarRemove(index)} onRemove={handleVarRemove(index)}
varKeys={list.map(item => item.variable)} varKeys={list.map(item => item.variable)}
canDrag={canDrag}
/> />
{canDrag && <RiDraggable className={cn( {canDrag && <RiDraggable className={cn(
'handle absolute left-3 top-2.5 hidden h-3 w-3 cursor-pointer text-text-tertiary', 'handle absolute left-3 top-2.5 hidden h-3 w-3 cursor-pointer text-text-tertiary',