mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
fix: project.exportSchema api lack stage param & setAssets should be a async fn
This commit is contained in:
parent
1026763dc5
commit
0ea76a746f
@ -2,7 +2,7 @@ import { EventEmitter } from 'events';
|
|||||||
import { obx, computed, makeObservable, action } from '@alilc/lowcode-editor-core';
|
import { obx, computed, makeObservable, action } from '@alilc/lowcode-editor-core';
|
||||||
import { Designer } from '../designer';
|
import { Designer } from '../designer';
|
||||||
import { DocumentModel, isDocumentModel, isPageSchema } from '../document';
|
import { DocumentModel, isDocumentModel, isPageSchema } from '../document';
|
||||||
import { ProjectSchema, RootSchema } from '@alilc/lowcode-types';
|
import { ProjectSchema, RootSchema, TransformStage } from '@alilc/lowcode-types';
|
||||||
import { ISimulatorHost } from '../simulator';
|
import { ISimulatorHost } from '../simulator';
|
||||||
|
|
||||||
export class Project {
|
export class Project {
|
||||||
@ -52,12 +52,12 @@ export class Project {
|
|||||||
/**
|
/**
|
||||||
* 获取项目整体 schema
|
* 获取项目整体 schema
|
||||||
*/
|
*/
|
||||||
getSchema(): ProjectSchema {
|
getSchema(stage: TransformStage = TransformStage.Render): ProjectSchema {
|
||||||
return {
|
return {
|
||||||
...this.data,
|
...this.data,
|
||||||
// TODO: future change this filter
|
// TODO: future change this filter
|
||||||
componentsMap: this.currentDocument?.getComponentsMap(),
|
componentsMap: this.currentDocument?.getComponentsMap(),
|
||||||
componentsTree: this.documents.filter((doc) => !doc.isBlank()).map((doc) => doc.schema),
|
componentsTree: this.documents.filter((doc) => !doc.isBlank()).map((doc) => doc.export(stage)),
|
||||||
i18n: this.i18n,
|
i18n: this.i18n,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -238,7 +238,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
|||||||
const {
|
const {
|
||||||
hidden = false,
|
hidden = false,
|
||||||
condition = true,
|
condition = true,
|
||||||
} = this.leaf?.schema || {};
|
} = this.leaf?.export(TransformStage.Render) || {};
|
||||||
return {
|
return {
|
||||||
nodeChildren: null,
|
nodeChildren: null,
|
||||||
childrenInState: false,
|
childrenInState: false,
|
||||||
|
|||||||
@ -34,8 +34,8 @@ export default class Material {
|
|||||||
* @param assets
|
* @param assets
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
setAssets(assets: AssetsJson) {
|
async setAssets(assets: AssetsJson) {
|
||||||
return this[editorSymbol].setAssets(assets);
|
return await this[editorSymbol].setAssets(assets);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -103,8 +103,8 @@ export default class Project {
|
|||||||
* 导出 project
|
* 导出 project
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
exportSchema() {
|
exportSchema(stage: TransformStage = TransformStage.Render) {
|
||||||
return this[projectSymbol].getSchema();
|
return this[projectSymbol].getSchema(stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user