diff --git a/docs/docs/api/workspace.md b/docs/docs/api/workspace.md index 3c13b00aa..9911dc93a 100644 --- a/docs/docs/api/workspace.md +++ b/docs/docs/api/workspace.md @@ -37,6 +37,16 @@ get plugins(): IPublicApiPlugins 关联模型 [IPublicApiPlugins](./plugins) +### skeleton + +应用级别的面板管理 + +```typescript +get skeleton(): IPublicApiSkeleton +``` + +关联模型 [IPublicApiSkeleton](./skeleton) + ### windows 当前设计器的编辑窗口 diff --git a/packages/editor-skeleton/src/skeleton.ts b/packages/editor-skeleton/src/skeleton.ts index 883643404..89bffc4cf 100644 --- a/packages/editor-skeleton/src/skeleton.ts +++ b/packages/editor-skeleton/src/skeleton.ts @@ -108,7 +108,7 @@ export interface ISkeleton extends Omit): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined; } -export class Skeleton { +export class Skeleton implements ISkeleton { private panels = new Map(); private containers = new Map>(); diff --git a/packages/shell/src/api/workspace.ts b/packages/shell/src/api/workspace.ts index 8737e37bd..fd3e82fa9 100644 --- a/packages/shell/src/api/workspace.ts +++ b/packages/shell/src/api/workspace.ts @@ -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)); } diff --git a/packages/workspace/src/workspace.ts b/packages/workspace/src/workspace.ts index 22eb9ede2..59b9e866b 100644 --- a/packages/workspace/src/workspace.ts +++ b/packages/workspace/src/workspace.ts @@ -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; getResourceList(): IResource[];