mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'preset-vision/0.9.0' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into preset-vision/0.9.0
This commit is contained in:
commit
ea5a5d63e8
@ -142,8 +142,19 @@ export default class MixedSetter extends Component<{
|
||||
// dirty fix vision variable setter logic
|
||||
private hasVariableSetter = this.setters.some((item) => item.name === 'VariableSetter');
|
||||
|
||||
private getDefaultValueWhenUseSetter(oldUsed?: string): any {
|
||||
if (this.used === 'I18nSetter') {
|
||||
return {
|
||||
type: 'i18n',
|
||||
zh_CN: '',
|
||||
en_US: '',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private useSetter = (name: string) => {
|
||||
const { field, onChange } = this.props;
|
||||
const oldUsed = this.used;
|
||||
if (name === 'VariableSetter') {
|
||||
const setterComponent = getSetter('VariableSetter')?.component as any;
|
||||
if (setterComponent && setterComponent.isPopup) {
|
||||
@ -156,7 +167,10 @@ export default class MixedSetter extends Component<{
|
||||
}
|
||||
const setter = this.setters.find((item) => item.name === name);
|
||||
this.used = name;
|
||||
if (setter) {
|
||||
const newValue = this.getDefaultValueWhenUseSetter(oldUsed);
|
||||
if (newValue !== undefined) {
|
||||
onChange && onChange(newValue);
|
||||
} else if (setter) {
|
||||
this.handleInitial(setter);
|
||||
}
|
||||
};
|
||||
|
||||
@ -369,7 +369,14 @@ export function upgradePropConfig(config: OldPropConfig, addInitial: AddIntial)
|
||||
},
|
||||
];
|
||||
if (allowTextInput !== false) {
|
||||
setters.unshift('I18nSetter');
|
||||
setters.unshift({
|
||||
componentName: 'I18nSetter',
|
||||
title: {
|
||||
'type': 'i18n',
|
||||
'zh-CN': '国际化输入',
|
||||
'en-US': 'Internationalized Input'
|
||||
},
|
||||
});
|
||||
}
|
||||
if (supportVariable) {
|
||||
setters.push('VariableSetter');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user