diff --git a/packages/designer/src/builtin-simulator/host.ts b/packages/designer/src/builtin-simulator/host.ts index a18e1e367..50daf3d3d 100644 --- a/packages/designer/src/builtin-simulator/host.ts +++ b/packages/designer/src/builtin-simulator/host.ts @@ -1309,6 +1309,26 @@ export class BuiltinSimulatorHost implements ISimulatorHost { + const timeGap = 200; + return new Promise((resolve) => { + setTimeout(() => { + if (this.project.currentDocument) { + resolve(); + } + }, timeGap); + }).catch(() => { + return this.waitForCurrentDocument(); + }); + } + + waitForCurrentDocument(): Promise { + if (this.project.currentDocument) { + return Promise.resolve(); + } + return this._innerWaitForCurrentDocument(); + } // #endregion } diff --git a/packages/editor-preset-vision/src/editor.ts b/packages/editor-preset-vision/src/editor.ts index 75c43e4e9..fb8b9f865 100644 --- a/packages/editor-preset-vision/src/editor.ts +++ b/packages/editor-preset-vision/src/editor.ts @@ -203,13 +203,13 @@ function compatiableReducer(props: any) { }; } // 为了能降级到老版本,建议在后期版本去掉以下代码 - // if (isJSExpression(props) && !props.events) { - // return { - // type: 'variable', - // value: props.mock, - // variable: props.value, - // } - // } + if (isJSExpression(props) && !props.events) { + return { + type: 'variable', + value: props.mock, + variable: props.value, + }; + } const newProps: any = {}; Object.entries(props).forEach(([key, val]) => { newProps[key] = compatiableReducer(val); diff --git a/packages/material-parser/src/core/schema/types.ts b/packages/material-parser/src/core/schema/types.ts index ec082c28d..97a6d5f52 100644 --- a/packages/material-parser/src/core/schema/types.ts +++ b/packages/material-parser/src/core/schema/types.ts @@ -80,7 +80,7 @@ export interface ObjectOf { [k: string]: any; } export interface Shape { - type: 'shape'; + type: "shape"; value: { name?: string; propType?: PropType; @@ -89,7 +89,7 @@ export interface Shape { [k: string]: any; } export interface Exact { - type: 'exact'; + type: "exact"; value: { name?: string; propType?: PropType; diff --git a/packages/react-renderer/package.json b/packages/react-renderer/package.json index 0912df5c5..bd9f67641 100644 --- a/packages/react-renderer/package.json +++ b/packages/react-renderer/package.json @@ -54,5 +54,5 @@ "publishConfig": { "registry": "http://registry.npm.alibaba-inc.com" }, - "homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@1.0.9-2/build/index.html" + "homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@1.0.9-5/build/index.html" } diff --git a/packages/react-simulator-renderer/src/renderer.ts b/packages/react-simulator-renderer/src/renderer.ts index f6f357fe6..73df54a95 100644 --- a/packages/react-simulator-renderer/src/renderer.ts +++ b/packages/react-simulator-renderer/src/renderer.ts @@ -177,7 +177,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { } constructor() { - this.dispose = host.connect(this, () => { + this.dispose = host.connect(this, async () => { + await host.waitForCurrentDocument(); // sync layout config this._layout = host.project.get('config').layout; diff --git a/packages/utils/src/is-object.ts b/packages/utils/src/is-object.ts index 4693388e4..1d1646108 100644 --- a/packages/utils/src/is-object.ts +++ b/packages/utils/src/is-object.ts @@ -1,3 +1,7 @@ export function isObject(value: any): value is Record { return value !== null && typeof value === 'object'; } + +export function isI18NObject(value: any): boolean { + return isObject(value) && value.type === 'i18n'; +} \ No newline at end of file