mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 21:01:56 +00:00
refactor: 兼容 type: group 为 i18n 时的场景, 比如 CascadeDateField
fix: 乐高回滚异常
This commit is contained in:
parent
a5a5407a9f
commit
9775087310
@ -274,7 +274,7 @@ export class DocumentModel {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
this.internalRemoveAndPurgeNode(node);
|
||||
this.internalRemoveAndPurgeNode(node, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -110,6 +110,7 @@ export class Project {
|
||||
return;
|
||||
}
|
||||
this.documents.splice(index, 1);
|
||||
this.documentsMap.delete(doc.id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,8 +160,10 @@ export class Project {
|
||||
|
||||
|
||||
private documentsMap = new Map<string, DocumentModel>();
|
||||
|
||||
getDocument(id: string): DocumentModel | null {
|
||||
return this.documentsMap.get(id) || null;
|
||||
// 此处不能使用 this.documentsMap.get(id),因为在乐高 rollback 场景,document.id 会被改成其他值
|
||||
return this.documents.find(doc => doc.id === id) || null;
|
||||
}
|
||||
|
||||
createDocument(data?: RootSchema): DocumentModel {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { isJSBlock, isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
import { isPlainObject, hasOwnProperty, cloneDeep, isI18NObject, isUseI18NSetter, convertToI18NObject } from '@ali/lowcode-utils';
|
||||
import { isPlainObject, hasOwnProperty, cloneDeep, isI18NObject, isUseI18NSetter, convertToI18NObject, isString } from '@ali/lowcode-utils';
|
||||
import { globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import { Designer, LiveEditing, TransformStage, Node, getConvertedExtraKey } from '@ali/lowcode-designer';
|
||||
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
|
||||
@ -126,7 +126,8 @@ designer.addPropsReducer((props, node) => {
|
||||
!isJSExpression(ov) &&
|
||||
!isJSBlock(ov) &&
|
||||
!isJSSlot(ov) &&
|
||||
!isVariable(ov)) {
|
||||
!isVariable(ov) &&
|
||||
isString(v)) {
|
||||
newProps[item.name] = convertToI18NObject(v);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -53,6 +53,5 @@
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "http://registry.npm.alibaba-inc.com"
|
||||
},
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@0.13.1-2/build/index.html"
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,3 +15,7 @@ export function convertToI18NObject(v: string | object, locale: string = 'zh_CN'
|
||||
if (isI18NObject(v)) return v;
|
||||
return { type: 'i18n', use: locale, [locale]: v };
|
||||
}
|
||||
|
||||
export function isString(v: any): v is string {
|
||||
return typeof v === 'string';
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user