mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 处理 JSExpreesion 的 i18n 场景
This commit is contained in:
parent
75fc3c6539
commit
9b87407596
@ -13,6 +13,7 @@ import { Skeleton, SettingsPrimaryPane, registerDefaults } from '@ali/lowcode-ed
|
||||
|
||||
import { deepValueParser } from './deep-value-parser';
|
||||
import { liveEditingRule, liveEditingSaveHander } from './vc-live-editing';
|
||||
import { isVariable } from './utils';
|
||||
|
||||
export const editor = new Editor();
|
||||
globalContext.register(editor, Editor);
|
||||
@ -36,10 +37,6 @@ interface Variable {
|
||||
value: any;
|
||||
}
|
||||
|
||||
function isVariable(obj: any): obj is Variable {
|
||||
return obj && obj.type === 'variable';
|
||||
}
|
||||
|
||||
function upgradePropsReducer(props: any) {
|
||||
if (!props || !isPlainObject(props)) {
|
||||
return props;
|
||||
@ -123,9 +120,11 @@ designer.addPropsReducer((props, node) => {
|
||||
if (ov === undefined && v !== undefined) {
|
||||
newProps[item.name] = v;
|
||||
}
|
||||
// 兼容 props 中的属性为 i18n 类型,但是仅提供了一个值
|
||||
// 兼容 props 中的属性为 i18n 类型,但是仅提供了一个字符串值,非变量绑定
|
||||
if (isUseI18NSetter(node.componentMeta.prototype, item.name) &&
|
||||
!isI18NObject(ov) && !isVariable(ov)) {
|
||||
!isI18NObject(ov) &&
|
||||
!isJSExpression(ov) &&
|
||||
!isVariable(ov)) {
|
||||
newProps[item.name] = v;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -517,8 +517,7 @@ class ComponentCreator extends React.Component<{ schema: any; propsMap: any, com
|
||||
if (this.isModal) {
|
||||
return null;
|
||||
}
|
||||
const { schema, propsMap } = this.props;
|
||||
const componentsMap = this.props.componentsMap;
|
||||
const { schema, propsMap, componentsMap } = this.props;
|
||||
const ComponentClass = componentsMap[schema.componentName];
|
||||
if (!ComponentClass) {
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user