dockview-core
Version:
Zero dependency layout manager supporting tabs, groups, grids and splitviews for vanilla TypeScript
110 lines (109 loc) • 4.64 kB
TypeScript
import { Position } from '../dnd/droptarget';
import { DockviewComponent } from '../dockview/dockviewComponent';
import { Box } from '../types';
import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
import { DockviewGroupActivePanelChangeEvent, DockviewGroupLocation, DockviewGroupPanelLocked } from '../dockview/dockviewGroupPanelModel';
import { DockviewHeaderPosition } from '../dockview/options';
import { Emitter, Event } from '../events';
import { GridviewPanelApi, GridviewPanelApiImpl, SizeEvent } from './gridviewPanelApi';
export interface DockviewGroupMoveParams {
group?: DockviewGroupPanel;
position?: Position;
/**
* The index to place the panel within a group, only applicable if the placement is within an existing group
*/
index?: number;
/**
* Whether to skip setting the group as active after moving
*/
skipSetActive?: boolean;
}
export interface DockviewGroupPanelCollapsedChangeEvent {
readonly isCollapsed: boolean;
}
export interface DockviewGroupPanelApi extends GridviewPanelApi {
readonly onDidLocationChange: Event<DockviewGroupPanelLocationChangeEvent>;
/**
* Fires when the active panel *within this group* changes. Scoped to the
* group, in contrast to the component-level
* `DockviewApi.onDidActivePanelChange` (which tracks the active panel across
* the whole dockview). Both carry an {@link DockviewOrigin} reporting
* whether the change came from a user gesture or an API call.
*/
readonly onDidActivePanelChange: Event<DockviewGroupActivePanelChangeEvent>;
/**
* Fired when an edge group's collapsed state changes.
* Never fires for non-edge groups.
*/
readonly onDidCollapsedChange: Event<DockviewGroupPanelCollapsedChangeEvent>;
readonly location: DockviewGroupLocation;
/**
* Whether this group is locked against drop interactions.
* - `true`: panels cannot be dropped into the group (center / tabs),
* but the group can still be split from its edges.
* - `'no-drop-target'`: all drop zones are disabled for this group.
*/
locked: DockviewGroupPanelLocked;
/**
* If you require the Window object
*/
getWindow(): Window;
moveTo(options: DockviewGroupMoveParams): void;
setHeaderPosition(position: DockviewHeaderPosition): void;
getHeaderPosition(): DockviewHeaderPosition;
maximize(): void;
isMaximized(): boolean;
exitMaximized(): void;
close(): void;
/**
* Collapse this group (edge groups only). No-op for non-edge groups.
*/
collapse(): void;
/**
* Expand this group (edge groups only). No-op for non-edge groups.
*/
expand(): void;
/**
* Returns true if this edge group is currently collapsed.
* Always returns false for non-edge groups.
*/
isCollapsed(): boolean;
}
export interface DockviewGroupPanelLocationChangeEvent {
readonly location: DockviewGroupLocation;
}
export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
private readonly accessor;
private _group;
private _pendingSize;
readonly _onDidLocationChange: Emitter<DockviewGroupPanelLocationChangeEvent>;
readonly onDidLocationChange: Event<DockviewGroupPanelLocationChangeEvent>;
readonly _onDidActivePanelChange: Emitter<DockviewGroupActivePanelChangeEvent>;
readonly onDidActivePanelChange: Event<DockviewGroupActivePanelChangeEvent>;
readonly _onDidCollapsedChange: Emitter<DockviewGroupPanelCollapsedChangeEvent>;
readonly onDidCollapsedChange: Event<DockviewGroupPanelCollapsedChangeEvent>;
get location(): DockviewGroupLocation;
/**
* The group's bounding box relative to the top-left of the dockview root,
* in pixels. Covers grid and floating groups; returns `undefined` for a
* popout group (it lives in a separate window). Reflects the live rendered
* geometry, so it is only meaningful once the layout has been sized.
*/
get boundingBox(): Box | undefined;
get locked(): DockviewGroupPanelLocked;
set locked(value: DockviewGroupPanelLocked);
constructor(id: string, accessor: DockviewComponent);
setSize(event: SizeEvent): void;
close(): void;
getWindow(): Window;
setHeaderPosition(position: DockviewHeaderPosition): void;
getHeaderPosition(): DockviewHeaderPosition;
moveTo(options: DockviewGroupMoveParams): void;
maximize(): void;
isMaximized(): boolean;
exitMaximized(): void;
collapse(): void;
expand(): void;
isCollapsed(): boolean;
initialize(group: DockviewGroupPanel): void;
}