forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindow.ts
More file actions
60 lines (47 loc) · 1.5 KB
/
window.ts
File metadata and controls
60 lines (47 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { windowSymbol } from '../symbols';
import { IPublicModelResource, IPublicModelWindow, IPublicTypeDisposable } from '@alilc/lowcode-types';
import { IEditorWindow } from '@alilc/lowcode-workspace';
import { Resource as ShellResource } from './resource';
import { EditorView } from './editor-view';
export class Window implements IPublicModelWindow {
private readonly [windowSymbol]: IEditorWindow;
get id() {
return this[windowSymbol]?.id;
}
get title() {
return this[windowSymbol].title;
}
get icon() {
return this[windowSymbol].icon;
}
get resource(): IPublicModelResource {
return new ShellResource(this[windowSymbol].resource);
}
constructor(editorWindow: IEditorWindow) {
this[windowSymbol] = editorWindow;
}
importSchema(schema: any): any {
this[windowSymbol].importSchema(schema);
}
changeViewType(viewName: string) {
this[windowSymbol].changeViewName(viewName, false);
}
onChangeViewType(fun: (viewName: string) => void): IPublicTypeDisposable {
return this[windowSymbol].onChangeViewType(fun);
}
async save() {
return await this[windowSymbol].save();
}
onSave(fn: () => void) {
return this[windowSymbol].onSave(fn);
}
get currentEditorView() {
if (this[windowSymbol].editorView) {
return new EditorView(this[windowSymbol].editorView).toProxy() as any;
}
return null;
}
get editorViews() {
return Array.from(this[windowSymbol].editorViews.values()).map(d => new EditorView(d).toProxy() as any);
}
}