Skip to content

Commit 0ea76a7

Browse files
liujupingLeoYuan
authored andcommitted
fix: project.exportSchema api lack stage param & setAssets should be a async fn
1 parent 1026763 commit 0ea76a7

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

packages/designer/src/project/project.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { EventEmitter } from 'events';
22
import { obx, computed, makeObservable, action } from '@alilc/lowcode-editor-core';
33
import { Designer } from '../designer';
44
import { DocumentModel, isDocumentModel, isPageSchema } from '../document';
5-
import { ProjectSchema, RootSchema } from '@alilc/lowcode-types';
5+
import { ProjectSchema, RootSchema, TransformStage } from '@alilc/lowcode-types';
66
import { ISimulatorHost } from '../simulator';
77

88
export class Project {
@@ -52,12 +52,12 @@ export class Project {
5252
/**
5353
* 获取项目整体 schema
5454
*/
55-
getSchema(): ProjectSchema {
55+
getSchema(stage: TransformStage = TransformStage.Render): ProjectSchema {
5656
return {
5757
...this.data,
5858
// TODO: future change this filter
5959
componentsMap: this.currentDocument?.getComponentsMap(),
60-
componentsTree: this.documents.filter((doc) => !doc.isBlank()).map((doc) => doc.schema),
60+
componentsTree: this.documents.filter((doc) => !doc.isBlank()).map((doc) => doc.export(stage)),
6161
i18n: this.i18n,
6262
};
6363
}

packages/renderer-core/src/hoc/leaf.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
238238
const {
239239
hidden = false,
240240
condition = true,
241-
} = this.leaf?.schema || {};
241+
} = this.leaf?.export(TransformStage.Render) || {};
242242
return {
243243
nodeChildren: null,
244244
childrenInState: false,

packages/shell/src/material.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export default class Material {
3434
* @param assets
3535
* @returns
3636
*/
37-
setAssets(assets: AssetsJson) {
38-
return this[editorSymbol].setAssets(assets);
37+
async setAssets(assets: AssetsJson) {
38+
return await this[editorSymbol].setAssets(assets);
3939
}
4040

4141
/**

packages/shell/src/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ export default class Project {
103103
* 导出 project
104104
* @returns
105105
*/
106-
exportSchema() {
107-
return this[projectSymbol].getSchema();
106+
exportSchema(stage: TransformStage = TransformStage.Render) {
107+
return this[projectSymbol].getSchema(stage);
108108
}
109109

110110
/**

0 commit comments

Comments
 (0)