更新图钉 API 文档及代码
This commit is contained in:
67
src/managers/component-tree-drawer-manager.ts
Normal file
67
src/managers/component-tree-drawer-manager.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { ComponentTreeDrawer } from '../components/component-tree-drawer';
|
||||
import type { ComponentTreeDrawerTabApi, ComponentTreeDrawerTabId } from '../components/component-tree-drawer/types';
|
||||
import { BaseManager } from '../core/base-manager';
|
||||
import { ManagerRegistry } from '../core/manager-registry';
|
||||
|
||||
export class ComponentTreeDrawerManager extends BaseManager {
|
||||
private drawer: ComponentTreeDrawer | null = null;
|
||||
|
||||
constructor(registry: ManagerRegistry) {
|
||||
super(registry);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public init(): void {
|
||||
if (this.drawer || !this.registry.wrapper) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.drawer = new ComponentTreeDrawer({
|
||||
container: this.registry.wrapper,
|
||||
registry: this.registry
|
||||
});
|
||||
this.drawer.init();
|
||||
}
|
||||
|
||||
public open(tabId?: ComponentTreeDrawerTabId): void {
|
||||
this.drawer?.openDrawer(tabId);
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
this.drawer?.close();
|
||||
}
|
||||
|
||||
public toggle(tabId?: ComponentTreeDrawerTabId): void {
|
||||
this.drawer?.toggle(tabId);
|
||||
}
|
||||
|
||||
public switchTab(tabId: ComponentTreeDrawerTabId): void {
|
||||
this.drawer?.switchTab(tabId);
|
||||
}
|
||||
|
||||
public isOpen(): boolean {
|
||||
return this.drawer?.isOpen() ?? false;
|
||||
}
|
||||
|
||||
public getActiveTab(): ComponentTreeDrawerTabId {
|
||||
return this.drawer?.getActiveTab() ?? 'construct-tree';
|
||||
}
|
||||
|
||||
public getViewTabApi(): ComponentTreeDrawerTabApi | null {
|
||||
return this.drawer?.getViewTabApi() ?? null;
|
||||
}
|
||||
|
||||
public getPinTabApi(): ComponentTreeDrawerTabApi | null {
|
||||
return this.drawer?.getPinTabApi() ?? null;
|
||||
}
|
||||
|
||||
public getConstructTreeTabApi(): ComponentTreeDrawerTabApi | null {
|
||||
return this.drawer?.getConstructTreeTabApi() ?? null;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
this.drawer?.destroy();
|
||||
this.drawer = null;
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user