MCPcopy
hub / github.com/alibaba/lowcode-engine / Project

Class Project

packages/designer/src/project/project.ts:93–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93export class Project implements IProject {
94 private emitter: IEventBus = createModuleEventBus('Project');
95
96 @obx.shallow readonly documents: IDocumentModel[] = [];
97
98 private data: IPublicTypeProjectSchema = {
99 version: '1.0.0',
100 componentsMap: [],
101 componentsTree: [],
102 i18n: {},
103 };
104
105 private _simulator?: ISimulatorHost;
106
107 private isRendererReady: boolean = false;
108
109 /**
110 * 模拟器
111 */
112 get simulator(): ISimulatorHost | null {
113 return this._simulator || null;
114 }
115
116 @computed get currentDocument(): IDocumentModel | null | undefined {
117 return this.documents.find((doc) => doc.active);
118 }
119
120 @obx private _config: any = {};
121 @computed get config(): any {
122 // TODO: parse layout Component
123 return this._config;
124 }
125 set config(value: any) {
126 this._config = value;
127 }
128
129 @obx.ref private _i18n: any = {};
130 @computed get i18n(): any {
131 return this._i18n;
132 }
133 set i18n(value: any) {
134 this._i18n = value || {};
135 }
136
137 private documentsMap = new Map<string, DocumentModel>();
138
139 constructor(readonly designer: IDesigner, schema?: IPublicTypeProjectSchema, readonly viewName = 'global') {
140 makeObservable(this);
141 this.load(schema);
142 }
143
144 private getComponentsMap(): IPublicTypeComponentsMap {
145 return this.documents.reduce<IPublicTypeComponentsMap>((
146 componentsMap: IPublicTypeComponentsMap,
147 curDoc: IDocumentModel,
148 ): IPublicTypeComponentsMap => {
149 const curComponentsMap = curDoc.getComponentsMap();
150 if (Array.isArray(curComponentsMap)) {

Callers

nothing calls this directly

Calls 1

createModuleEventBusFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…