feat: var reference support readonly

This commit is contained in:
Joel 2024-03-20 17:01:53 +08:00
parent 8f311b020a
commit 9ed2a99abf
2 changed files with 9 additions and 7 deletions

View File

@ -73,10 +73,12 @@ const VarList: FC<Props> = ({
filterVar={filterVar}
width={350}
/>
<RemoveButton
className='!p-2 !bg-gray-100 hover:!bg-gray-200'
onClick={handleVarRemove(index)}
/>
{!readonly && (
<RemoveButton
className='!p-2 !bg-gray-100 hover:!bg-gray-200'
onClick={handleVarRemove(index)}
/>
)}
</div>
))}
</div>

View File

@ -19,9 +19,9 @@ const Panel: FC<NodePanelProps<VariableAssignerNodeType>> = ({
data,
}) => {
const { t } = useTranslation()
const readOnly = false
const {
readOnly,
inputs,
handleOutputTypeChange,
handleVarListChange,
@ -51,7 +51,7 @@ const Panel: FC<NodePanelProps<VariableAssignerNodeType>> = ({
trigger={
<div className='flex items-center h-8 justify-between px-2.5 rounded-lg bg-gray-100 capitalize'>
<div className='text-[13px] font-normal text-gray-900'>{inputs.output_type}</div>
<ChevronDown className='w-3.5 h-3.5 text-gray-700' />
{!readOnly && <ChevronDown className='w-3.5 h-3.5 text-gray-700' />}
</div>
}
popupClassName='!top-[36px] !w-[387px]'
@ -61,7 +61,7 @@ const Panel: FC<NodePanelProps<VariableAssignerNodeType>> = ({
<Field
title={t(`${i18nPrefix}.title`)}
operations={
<AddButton onClick={handleAddVariable} />
!readOnly ? <AddButton onClick={handleAddVariable} /> : undefined
}
>
<VarList