feat: add expression prop to TextAreaWithGlobalScope and update ConfigForm (#6221)

This commit is contained in:
Sheldon Guo 2025-02-22 07:10:56 +08:00 committed by GitHub
parent 5fbc7697c6
commit 8e9a2dbd85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -35,13 +35,14 @@ interface TextAreaWithGlobalScopeProps {
password?: boolean;
number?: boolean;
boolean?: boolean;
expression?: boolean;
value?: any;
scope?: string | object;
[key: string]: any;
}
export const TextAreaWithGlobalScope = connect((props: TextAreaWithGlobalScopeProps) => {
const { supportsLineBreak, password, number, boolean, ...others } = props;
const { supportsLineBreak, password, number, boolean, input, expression = true, ...others } = props;
const scope = useEnvironmentVariableOptions(props.scope);
const fieldNames = { value: 'name', label: 'title' };
@ -57,5 +58,13 @@ export const TextAreaWithGlobalScope = connect((props: TextAreaWithGlobalScopePr
if (boolean) {
return <Variable.Input {...props} scope={scope} fieldNames={fieldNames} />;
}
if (input) {
return <Variable.Input {...others} scope={scope} fieldNames={fieldNames} />;
}
if (expression) {
return <TextArea {...others} scope={scope} fieldNames={fieldNames} />;
}
return <Variable.Input {...others} scope={scope} fieldNames={fieldNames} />;
}, mapReadPretty(Input.ReadPretty));

View File

@ -174,8 +174,9 @@ export const ChannelConfigForm = () => {
'x-decorator': 'FormItem',
'x-component': 'TextAreaWithGlobalScope',
'x-component-props': {
// useTypedConstant: ['string'],
useTypedConstant: ['string'],
placeholder: `noreply <example@domain.com>`,
expression: false,
},
},
},