feat(workspace): add workspace.skeleton api

This commit is contained in:
liujuping 2023-09-13 11:02:15 +08:00 committed by 林熠
parent 6b14986e8f
commit 1072ff36fb
4 changed files with 19 additions and 1 deletions

View File

@ -37,6 +37,16 @@ get plugins(): IPublicApiPlugins
关联模型 [IPublicApiPlugins](./plugins)
### skeleton
应用级别的面板管理
```typescript
get skeleton(): IPublicApiSkeleton
```
关联模型 [IPublicApiSkeleton](./skeleton)
### windows
当前设计器的编辑窗口

View File

@ -108,7 +108,7 @@ export interface ISkeleton extends Omit<IPublicApiSkeleton,
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined;
}
export class Skeleton {
export class Skeleton implements ISkeleton {
private panels = new Map<string, Panel>();
private containers = new Map<string, WidgetContainer<any>>();

View File

@ -3,6 +3,7 @@ import { IWorkspace } from '@alilc/lowcode-workspace';
import { resourceSymbol, workspaceSymbol } from '../symbols';
import { Resource as ShellResource, Window as ShellWindow } from '../model';
import { Plugins } from './plugins';
import { Skeleton } from './skeleton';
export class Workspace implements IPublicApiWorkspace {
readonly [workspaceSymbol]: IWorkspace;
@ -92,6 +93,10 @@ export class Workspace implements IPublicApiWorkspace {
return new Plugins(this[workspaceSymbol].plugins, true);
}
get skeleton() {
return new Skeleton(this[workspaceSymbol].skeleton, 'workspace', true);
}
get windows() {
return this[workspaceSymbol].windows.map((d) => new ShellWindow(d));
}

View File

@ -6,6 +6,7 @@ import { EditorWindow, WINDOW_STATE } from './window';
import type { IEditorWindow } from './window';
import { IResource, Resource } from './resource';
import { IResourceType, ResourceType } from './resource-type';
import { ISkeleton } from '@alilc/lowcode-editor-skeleton';
enum EVENT {
CHANGE_WINDOW = 'change_window',
@ -33,6 +34,8 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace<
plugins: ILowCodePluginManager;
skeleton: ISkeleton;
resourceTypeMap: Map<string, ResourceType>;
getResourceList(): IResource[];