chore: list filter operate ui

This commit is contained in:
Joel 2024-08-30 14:44:16 +08:00
parent 61d989f413
commit e7a6a0ab01
3 changed files with 9 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import cn from '@/utils/classnames'
const i18nPrefix = 'workflow.nodes.ifElse'
type ConditionOperatorProps = {
className?: string
disabled?: boolean
varType: VarType
file?: { key: string }
@ -24,6 +25,7 @@ type ConditionOperatorProps = {
onSelect: (value: ComparisonOperator) => void
}
const ConditionOperator = ({
className,
disabled,
varType,
file,
@ -55,7 +57,7 @@ const ConditionOperator = ({
>
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
<Button
className={cn('shrink-0', !selectedOption && 'opacity-50')}
className={cn('shrink-0', !selectedOption && 'opacity-50', className)}
size='small'
variant='ghost'
disabled={disabled}

View File

@ -18,6 +18,7 @@ type Props = {
onChange: (condition: Condition) => void
varType: VarType
hasSubVariable: boolean
readOnly: boolean
}
const FilterCondition: FC<Props> = ({
@ -25,6 +26,7 @@ const FilterCondition: FC<Props> = ({
varType,
onChange,
hasSubVariable,
readOnly,
}) => {
const { t } = useTranslation()
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'>
<ConditionOperator
className='h-8 bg-components-input-bg-normal'
varType={varType}
value={condition.comparison_operator}
onSelect={handleChange('comparison_operator')}
file={hasSubVariable ? { key: condition.key } : undefined}
disabled={readOnly}
/>
{!comparisonOperatorNotRequireValue(condition.comparison_operator) && (
<>
@ -87,7 +91,7 @@ const FilterCondition: FC<Props> = ({
defaultValue={condition.value}
onSelect={item => handleChange('value')(item.value)}
className='!text-[13px]'
wrapperClassName='grow'
wrapperClassName='grow h-8'
placeholder='Select value'
/>
)}

View File

@ -61,6 +61,7 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
onChange={handleFilterChange}
varType={itemVarType}
hasSubVariable={hasSubVariable}
readOnly={readOnly}
/>
</Field>
<Split />