Fix: Fixed the issue of retrieval operator text overlapping #3221 (#8652)

### What problem does this PR solve?

Fix: Fixed the issue of retrieval operator text overlapping #3221

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-07-03 19:04:06 +08:00
committed by GitHub
parent 9771b521cd
commit 3234a15aae
11 changed files with 113 additions and 62 deletions

View File

@ -8,9 +8,7 @@ import { FormSchemaType } from './schema';
function convertToObject(list: FormSchemaType['arguments'] = []) {
return list.reduce<Record<string, string>>((pre, cur) => {
if (cur.name && cur.type) {
pre[cur.name] = cur.type;
}
pre[cur.name] = cur.type;
return pre;
}, {});

View File

@ -41,18 +41,21 @@ type ConditionCardsProps = {
parentLength: number;
} & IOperatorForm;
const OperatorIcon = function OperatorIcon({
export const LogicalOperatorIcon = function OperatorIcon({
icon,
value,
}: Omit<(typeof SwitchOperatorOptions)[0], 'label'>) {
return (
<IconFont
name={icon}
className={cn('size-4', {
'rotate-180': value === '>',
})}
></IconFont>
);
if (typeof icon === 'string') {
return (
<IconFont
name={icon}
className={cn('size-4', {
'rotate-180': value === '>',
})}
></IconFont>
);
}
return icon;
};
function useBuildSwitchOperatorOptions() {
@ -61,7 +64,12 @@ function useBuildSwitchOperatorOptions() {
const switchOperatorOptions = useMemo(() => {
return SwitchOperatorOptions.map((x) => ({
value: x.value,
icon: <OperatorIcon icon={x.icon} value={x.value}></OperatorIcon>,
icon: (
<LogicalOperatorIcon
icon={x.icon}
value={x.value}
></LogicalOperatorIcon>
),
label: t(`flow.switchOperatorOptions.${x.label}`),
}));
}, [t]);