mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 01:15:53 +08:00
chore: list filter operate ui
This commit is contained in:
parent
61d989f413
commit
e7a6a0ab01
@ -17,6 +17,7 @@ import cn from '@/utils/classnames'
|
|||||||
const i18nPrefix = 'workflow.nodes.ifElse'
|
const i18nPrefix = 'workflow.nodes.ifElse'
|
||||||
|
|
||||||
type ConditionOperatorProps = {
|
type ConditionOperatorProps = {
|
||||||
|
className?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
varType: VarType
|
varType: VarType
|
||||||
file?: { key: string }
|
file?: { key: string }
|
||||||
@ -24,6 +25,7 @@ type ConditionOperatorProps = {
|
|||||||
onSelect: (value: ComparisonOperator) => void
|
onSelect: (value: ComparisonOperator) => void
|
||||||
}
|
}
|
||||||
const ConditionOperator = ({
|
const ConditionOperator = ({
|
||||||
|
className,
|
||||||
disabled,
|
disabled,
|
||||||
varType,
|
varType,
|
||||||
file,
|
file,
|
||||||
@ -55,7 +57,7 @@ const ConditionOperator = ({
|
|||||||
>
|
>
|
||||||
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
|
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
|
||||||
<Button
|
<Button
|
||||||
className={cn('shrink-0', !selectedOption && 'opacity-50')}
|
className={cn('shrink-0', !selectedOption && 'opacity-50', className)}
|
||||||
size='small'
|
size='small'
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
@ -18,6 +18,7 @@ type Props = {
|
|||||||
onChange: (condition: Condition) => void
|
onChange: (condition: Condition) => void
|
||||||
varType: VarType
|
varType: VarType
|
||||||
hasSubVariable: boolean
|
hasSubVariable: boolean
|
||||||
|
readOnly: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilterCondition: FC<Props> = ({
|
const FilterCondition: FC<Props> = ({
|
||||||
@ -25,6 +26,7 @@ const FilterCondition: FC<Props> = ({
|
|||||||
varType,
|
varType,
|
||||||
onChange,
|
onChange,
|
||||||
hasSubVariable,
|
hasSubVariable,
|
||||||
|
readOnly,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const isSelect = [ComparisonOperator.in, ComparisonOperator.notIn, ComparisonOperator.allOf].includes(condition.comparison_operator)
|
const isSelect = [ComparisonOperator.in, ComparisonOperator.notIn, ComparisonOperator.allOf].includes(condition.comparison_operator)
|
||||||
@ -74,10 +76,12 @@ const FilterCondition: FC<Props> = ({
|
|||||||
)}
|
)}
|
||||||
<div className='flex space-x-1'>
|
<div className='flex space-x-1'>
|
||||||
<ConditionOperator
|
<ConditionOperator
|
||||||
|
className='h-8 bg-components-input-bg-normal'
|
||||||
varType={varType}
|
varType={varType}
|
||||||
value={condition.comparison_operator}
|
value={condition.comparison_operator}
|
||||||
onSelect={handleChange('comparison_operator')}
|
onSelect={handleChange('comparison_operator')}
|
||||||
file={hasSubVariable ? { key: condition.key } : undefined}
|
file={hasSubVariable ? { key: condition.key } : undefined}
|
||||||
|
disabled={readOnly}
|
||||||
/>
|
/>
|
||||||
{!comparisonOperatorNotRequireValue(condition.comparison_operator) && (
|
{!comparisonOperatorNotRequireValue(condition.comparison_operator) && (
|
||||||
<>
|
<>
|
||||||
@ -87,7 +91,7 @@ const FilterCondition: FC<Props> = ({
|
|||||||
defaultValue={condition.value}
|
defaultValue={condition.value}
|
||||||
onSelect={item => handleChange('value')(item.value)}
|
onSelect={item => handleChange('value')(item.value)}
|
||||||
className='!text-[13px]'
|
className='!text-[13px]'
|
||||||
wrapperClassName='grow'
|
wrapperClassName='grow h-8'
|
||||||
placeholder='Select value'
|
placeholder='Select value'
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -61,6 +61,7 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
|||||||
onChange={handleFilterChange}
|
onChange={handleFilterChange}
|
||||||
varType={itemVarType}
|
varType={itemVarType}
|
||||||
hasSubVariable={hasSubVariable}
|
hasSubVariable={hasSubVariable}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Split />
|
<Split />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user