Skip to content

Commit

Permalink
feat(workspace): add workspace.skeleton api
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping authored and JackLian committed Sep 13, 2023
1 parent 6b14986 commit 1072ff3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/docs/api/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ get plugins(): IPublicApiPlugins

关联模型 [IPublicApiPlugins](./plugins)

### skeleton

应用级别的面板管理

```typescript
get skeleton(): IPublicApiSkeleton
```

关联模型 [IPublicApiSkeleton](./skeleton)

### windows

当前设计器的编辑窗口
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-skeleton/src/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>>();
Expand Down
5 changes: 5 additions & 0 deletions packages/shell/src/api/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
Expand Down
3 changes: 3 additions & 0 deletions packages/workspace/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -33,6 +34,8 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace<

plugins: ILowCodePluginManager;

skeleton: ISkeleton;

resourceTypeMap: Map<string, ResourceType>;

getResourceList(): IResource[];
Expand Down

0 comments on commit 1072ff3

Please sign in to comment.