import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import Field from '../_base/components/field' import RemoveEffectVarConfirm from '../_base/components/remove-effect-var-confirm' import useConfig from './use-config' import type { VariableAssignerNodeType } from './types' import VarGroupItem from './components/var-group-item' import cn from '@/utils/classnames' import { type NodePanelProps } from '@/app/components/workflow/types' import Split from '@/app/components/workflow/nodes/_base/components/split' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import Switch from '@/app/components/base/switch' import AddButton from '@/app/components/workflow/nodes/_base/components/add-button' const i18nPrefix = 'workflow.nodes.variableAssigner' const Panel: FC> = ({ id, data, }) => { const { t } = useTranslation() const { readOnly, inputs, handleListOrTypeChange, isEnableGroup, handleGroupEnabledChange, handleAddGroup, handleListOrTypeChangeInGroup, handleGroupRemoved, handleVarGroupNameChange, isShowRemoveVarConfirm, hideRemoveVarConfirm, onRemoveVarConfirm, getAvailableVars, filterVar, } = useConfig(id, data) return (
{!isEnableGroup ? ( ) : (
{inputs.advanced_settings?.groups.map((item, index) => (
1} onRemove={handleGroupRemoved(item.groupId)} onGroupNameChange={handleVarGroupNameChange(item.groupId)} availableVars={getAvailableVars(id, item.groupId, filterVar(item.output_type), true)} /> {index !== inputs.advanced_settings?.groups.length - 1 && }
))}
)}
} />
{isEnableGroup && ( <>
<> {inputs.advanced_settings?.groups.map((item, index) => ( ))}
)}
) } export default React.memo(Panel)