mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 12:39:12 +08:00
feat: output item var type and filter condition triger
This commit is contained in:
parent
e7a6a0ab01
commit
dc919c2a6c
@ -51,6 +51,21 @@ const SubVariablePicker: FC<Props> = ({
|
||||
placeholder={t('workflow.nodes.listFilter.selectVariableKeyPlaceholder')!}
|
||||
optionClassName='pl-4 pr-5 py-0'
|
||||
renderOption={renderOption}
|
||||
renderTrigger={item => (
|
||||
<div className='group/sub-variable-picker flex items-center h-8 pl-1 rounded-lg bg-components-input-bg-normal hover:bg-state-base-hover-alt'>
|
||||
{item
|
||||
? <div className='flex justify-start cursor-pointer'>
|
||||
<div className='inline-flex max-w-full px-1.5 items-center h-6 rounded-md border-[0.5px] border-components-panel-border-subtle bg-components-badge-white-to-dark shadow-xs text-text-accent'>
|
||||
<Variable02 className='shrink-0 w-3.5 h-3.5 text-text-accent' />
|
||||
<div className='ml-0.5 truncate system-xs-medium'>{item?.name}</div>
|
||||
</div>
|
||||
</div>
|
||||
: <div className='pl-1 flex text-components-input-text-placeholder system-sm-regular group-hover/sub-variable-picker:text-text-tertiary'>
|
||||
<Variable02 className='mr-1 shrink-0 w-4 h-4' />
|
||||
<span>{t('common.placeholder.select')}</span>
|
||||
</div>}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
@ -26,6 +26,7 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
||||
readOnly,
|
||||
inputs,
|
||||
itemVarType,
|
||||
itemVarTypeShowName,
|
||||
hasSubVariable,
|
||||
handleVarChanges,
|
||||
filterVar,
|
||||
@ -103,29 +104,30 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
||||
)
|
||||
: null}
|
||||
</Field>
|
||||
|
||||
<Split />
|
||||
<LimitConfig
|
||||
config={inputs.limit}
|
||||
onChange={handleLimitChange}
|
||||
readonly={readOnly}
|
||||
/>
|
||||
</div>
|
||||
<Split />
|
||||
<div className='px-4 pt-4 pb-2'>
|
||||
<OutputVars>
|
||||
<>
|
||||
<VarItem
|
||||
name='result'
|
||||
type='Array[x]'
|
||||
type={`Array[${itemVarTypeShowName}]`}
|
||||
description={t(`${i18nPrefix}.outputVars.result`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='first_record'
|
||||
type='x'
|
||||
type={itemVarTypeShowName}
|
||||
description={t(`${i18nPrefix}.outputVars.first_record`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='last_record'
|
||||
type='x'
|
||||
type={itemVarTypeShowName}
|
||||
description={t(`${i18nPrefix}.outputVars.last_record`)}
|
||||
/>
|
||||
</>
|
||||
|
@ -63,6 +63,12 @@ const useConfig = (id: string, payload: ListFilterNodeType) => {
|
||||
|
||||
const { varType, itemVarType } = getType()
|
||||
|
||||
const itemVarTypeShowName = useMemo(() => {
|
||||
if (!inputs.variable)
|
||||
return '?'
|
||||
return [itemVarType.substring(0, 1).toUpperCase(), itemVarType.substring(1)].join('')
|
||||
}, [inputs.variable, itemVarType])
|
||||
|
||||
const hasSubVariable = [VarType.arrayFile].includes(varType)
|
||||
|
||||
const handleVarChanges = useCallback((variable: ValueSelector | string) => {
|
||||
@ -128,6 +134,7 @@ const useConfig = (id: string, payload: ListFilterNodeType) => {
|
||||
filterVar,
|
||||
varType,
|
||||
itemVarType,
|
||||
itemVarTypeShowName,
|
||||
hasSubVariable,
|
||||
handleVarChanges,
|
||||
handleFilterChange,
|
||||
|
Loading…
x
Reference in New Issue
Block a user