dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
89 lines (88 loc) • 3.67 kB
TypeScript
import { SerializedGridObject } from './gridview';
import { Position } from '../dnd/droptarget';
import { IPanelDeserializer } from '../dockview/deserializer';
import { GridviewComponentOptions } from './options';
import { BaseGrid, Direction, IBaseGrid, IGridPanelView } from './baseComponentGridview';
import { GridviewPanel, GridviewInitParameters, GridPanelViewState, IGridviewPanel } from './gridviewPanel';
import { BaseComponentOptions } from '../panel/types';
import { GridviewPanelApiImpl } from '../api/gridviewPanelApi';
import { Orientation, Sizing } from '../splitview/core/splitview';
interface PanelReference {
api: GridviewPanelApiImpl;
}
export interface SerializedGridview {
grid: {
height: number;
width: number;
orientation: Orientation;
root: SerializedGridObject<GridPanelViewState>;
};
activePanel?: string;
}
export interface AddComponentOptions extends BaseComponentOptions {
size?: number;
minimumWidth?: number;
maximumWidth?: number;
minimumHeight?: number;
maximumHeight?: number;
position?: {
direction: Direction;
reference: string;
};
location?: number[];
}
export interface IGridPanelComponentView extends IGridPanelView {
init: (params: GridviewInitParameters) => void;
}
export declare type GridviewComponentUpdateOptions = Pick<GridviewComponentOptions, 'orientation' | 'components' | 'frameworkComponents'>;
export interface IGridviewComponent extends IBaseGrid<GridviewPanel> {
readonly orientation: Orientation;
updateOptions(options: GridviewComponentUpdateOptions): void;
addPanel(options: AddComponentOptions): void;
removePanel(panel: IGridviewPanel, sizing?: Sizing): void;
toggleVisibility(panel: IGridviewPanel): void;
focus(): void;
fromJSON(serializedGridview: SerializedGridview, deferComponentLayout?: boolean): void;
toJSON(): SerializedGridview;
movePanel(panel: IGridviewPanel, options: {
direction: Direction;
reference: string;
size?: number;
}): void;
setVisible(panel: IGridviewPanel, visible: boolean): void;
setActive(panel: IGridviewPanel): void;
}
export declare class GridviewComponent extends BaseGrid<GridviewPanel> implements IGridviewComponent {
private _options;
private _deserializer;
get orientation(): Orientation;
set orientation(value: Orientation);
get options(): GridviewComponentOptions;
get deserializer(): IPanelDeserializer | undefined;
set deserializer(value: IPanelDeserializer | undefined);
constructor(element: HTMLElement, options: GridviewComponentOptions);
updateOptions(options: GridviewComponentUpdateOptions): void;
removePanel(panel: GridviewPanel): void;
/**
* Serialize the current state of the layout
*
* @returns A JSON respresentation of the layout
*/
toJSON(): SerializedGridview;
setVisible(panel: GridviewPanel, visible: boolean): void;
setActive(panel: GridviewPanel): void;
toggleVisibility(panel: GridviewPanel): void;
focus(): void;
fromJSON(serializedGridview: SerializedGridview, deferComponentLayout?: boolean): void;
movePanel(panel: GridviewPanel, options: {
direction: Direction;
reference: string;
size?: number;
}): void;
addPanel(options: AddComponentOptions): PanelReference;
private registerPanel;
moveGroup(referenceGroup: IGridPanelComponentView, groupId: string, target: Position): void;
removeGroup(group: GridviewPanel): void;
dispose(): void;
}
export {};