mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 04:40:32 +00:00
fix: 兼容 listSetter 内部变量,修复回退 fieldId 重置问题
This commit is contained in:
parent
87c2e0b386
commit
c95e618121
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user