fix: 兼容 listSetter 内部变量,修复回退 fieldId 重置问题

This commit is contained in:
mario.gk 2020-08-04 19:29:49 +08:00
parent 87c2e0b386
commit c95e618121
2 changed files with 9 additions and 1 deletions

View File

@ -3,11 +3,19 @@ import { isJSSlot, isI18nData, isJSExpression } from '@ali/lowcode-types';
import { isPlainObject } from '@ali/lowcode-utils'; import { isPlainObject } from '@ali/lowcode-utils';
import i18nUtil from './i18n-util'; import i18nUtil from './i18n-util';
function isVariable(obj: any) {
return obj && obj.type === 'variable';
}
// FIXME: 表达式使用 mock 值未来live 模式直接使用原始值 // FIXME: 表达式使用 mock 值未来live 模式直接使用原始值
export function deepValueParser(obj?: any): any { export function deepValueParser(obj?: any): any {
if (isJSExpression(obj)) { if (isJSExpression(obj)) {
obj = obj.mock; obj = obj.mock;
} }
// 兼容 ListSetter 中的变量结构
if (isVariable(obj)) {
obj = obj.value;
}
if (!obj) { if (!obj) {
return obj; return obj;
} }

View File

@ -100,7 +100,7 @@ designer.addPropsReducer((props, node) => {
// FIXME! item.name could be 'xxx.xxx' // FIXME! item.name could be 'xxx.xxx'
const ov = props[item.name]; const ov = props[item.name];
const v = item.initial(node as any, getRealValue(ov)); const v = item.initial(node as any, getRealValue(ov));
if (v !== undefined) { if (!ov && v !== undefined) {
if (isVariable(ov)) { if (isVariable(ov)) {
newProps[item.name] = { newProps[item.name] = {
...ov, ...ov,