Feat: Customize the output variable name of the loop operator #3221 (#8514)

### What problem does this PR solve?

Feat: Customize the output variable name of the loop operator #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-06-26 16:43:06 +08:00
committed by GitHub
parent 42a570a64d
commit 32a7ad3cba
10 changed files with 202 additions and 38 deletions

View File

@ -14,19 +14,18 @@ import { useBuildQueryVariableOptions } from '../../hooks/use-get-begin-query';
type QueryVariableProps = { name?: string; type?: VariableType };
export function QueryVariable({
name = 'query',
type = VariableType.String,
}: QueryVariableProps) {
export function QueryVariable({ name = 'query', type }: QueryVariableProps) {
const { t } = useTranslation();
const form = useFormContext();
const nextOptions = useBuildQueryVariableOptions();
const finalOptions = useMemo(() => {
return nextOptions.map((x) => {
return { ...x, options: x.options.filter((y) => y.type === type) };
});
return type
? nextOptions.map((x) => {
return { ...x, options: x.options.filter((y) => y.type === type) };
})
: nextOptions;
}, [nextOptions, type]);
return (