mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-17 19:23:41 +00:00
fix: 修改 renderer 需等待 document 才开始渲染
This commit is contained in:
parent
62fb4cff3b
commit
e7cc9bc7d8
@ -1309,6 +1309,26 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
|
|
||||||
return nearBy;
|
return nearBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_innerWaitForCurrentDocument(): Promise<any> {
|
||||||
|
const timeGap = 200;
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.project.currentDocument) {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}, timeGap);
|
||||||
|
}).catch(() => {
|
||||||
|
return this.waitForCurrentDocument();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForCurrentDocument(): Promise<any> {
|
||||||
|
if (this.project.currentDocument) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return this._innerWaitForCurrentDocument();
|
||||||
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -203,13 +203,13 @@ function compatiableReducer(props: any) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
||||||
// if (isJSExpression(props) && !props.events) {
|
if (isJSExpression(props) && !props.events) {
|
||||||
// return {
|
return {
|
||||||
// type: 'variable',
|
type: 'variable',
|
||||||
// value: props.mock,
|
value: props.mock,
|
||||||
// variable: props.value,
|
variable: props.value,
|
||||||
// }
|
};
|
||||||
// }
|
}
|
||||||
const newProps: any = {};
|
const newProps: any = {};
|
||||||
Object.entries<any>(props).forEach(([key, val]) => {
|
Object.entries<any>(props).forEach(([key, val]) => {
|
||||||
newProps[key] = compatiableReducer(val);
|
newProps[key] = compatiableReducer(val);
|
||||||
|
|||||||
@ -80,7 +80,7 @@ export interface ObjectOf {
|
|||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
}
|
}
|
||||||
export interface Shape {
|
export interface Shape {
|
||||||
type: 'shape';
|
type: "shape";
|
||||||
value: {
|
value: {
|
||||||
name?: string;
|
name?: string;
|
||||||
propType?: PropType;
|
propType?: PropType;
|
||||||
@ -89,7 +89,7 @@ export interface Shape {
|
|||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
}
|
}
|
||||||
export interface Exact {
|
export interface Exact {
|
||||||
type: 'exact';
|
type: "exact";
|
||||||
value: {
|
value: {
|
||||||
name?: string;
|
name?: string;
|
||||||
propType?: PropType;
|
propType?: PropType;
|
||||||
|
|||||||
@ -54,5 +54,5 @@
|
|||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "http://registry.npm.alibaba-inc.com"
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -177,7 +177,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.dispose = host.connect(this, () => {
|
this.dispose = host.connect(this, async () => {
|
||||||
|
await host.waitForCurrentDocument();
|
||||||
// sync layout config
|
// sync layout config
|
||||||
this._layout = host.project.get('config').layout;
|
this._layout = host.project.get('config').layout;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
export function isObject(value: any): value is Record<string, unknown> {
|
export function isObject(value: any): value is Record<string, unknown> {
|
||||||
return value !== null && typeof value === 'object';
|
return value !== null && typeof value === 'object';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isI18NObject(value: any): boolean {
|
||||||
|
return isObject(value) && value.type === 'i18n';
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user