import * as GoldenLayout from "golden-layout";
import { ComponentConstructor, ItemConfigType } from "./types";
import { Workbench } from "./workbench";
/**
* Builder class with a fluid API that enables the user to build a
* perspective of an existing workbench.
*/
export declare class PerspectiveBuilder {
/**
* The content of the perspective being built.
*/
private _content;
/**
* The stack of content objects being manipulated by the builder.
*/
private _contentStack;
/**
* When undefined, it means that the perspective is not finalized yet and
* new panels may be added. When not undefined, it contains a GoldenLayout
* configuration object with the finalized set of panels. After finalization,
* no new panels may be added to the perspective; only filtering and
* transformation is allowed.
*
* The first call to `filter()` or `map()` will implicitly finalize the
* perspective and prevents the addition of any further panels.
*/
private _finalizedConfiguration;
/**
* The workbench being manipulated by this builder; undefined
* if the builder has already built a perspective.
*/
private _workbench;
/**
* Constructor.
*
* Creates a new perspective builder that builds a new perspective
* belonging to a given workbench.
*
* @param workbench the workbench that the perspective builder will
* manipulate when it registers new components
*/
constructor(workbench: Workbench);
/**
* Adds a new component to be shown in the current subdivision.
*/
add(nameOrComponent: string | React.ComponentType, { eager, title, props, state }?: {
props?: TProps;
state?: any;
title?: string;
eager?: boolean;
}, id?: string): this;
/**
* Builds the perspective based on the set of configuration methods called
* earlier in this call chain.
*/
build(): GoldenLayout.ItemConfigType[];
/**
* Iterates over each content item currently added to the perspective,
* including containers, and removes those for which the given filter
* predicate returns false.
*
* @param pred the filter predicate
*/
filter(pred: (item: ItemConfigType) => boolean): this;
/**
* Iterates over each container currently added to the perspective,
* not including panels, and removes those for which the given filter
* predicate returns false.
*
* @param pred the filter predicate
*/
filterContainers(pred: (item: ItemConfigType) => boolean): this;
/**
* Iterates over each panel currently added to the perspective,
* not including containers, and removes those for which the given filter
* predicate returns false.
*
* @param pred the filter predicate
*/
filterPanels(pred: (item: ItemConfigType) => boolean): this;
/**
* Declares that the current subdivision (row, column or stack) being built
* is finished and moves back to the parent element.
*/
finish(): this;
/**
* Subdivides the current panel in the workbench into multiple columns.
* Subsequent calls to add() will add new columns to the workbench
* within the subdivision.
*/
makeColumns(): this;
/**
* Subdivides the current panel in the workbench into multiple rows.
* Subsequent calls to add() will add new rows to the workbench
* within the subdivision.
*/
makeRows(): this;
/**
* Subdivides the current panel in the workbench into multiple stacked items.
* Subsequent calls to add() will add new items to the workbench
* within the current stack.
*/
makeStack(): this;
/**
* Iterates over each content item currently added to the perspective,
* including containers, and transforms them via a mapping function.
*
* @param func the mapping function
*/
map(func: (item: ItemConfigType) => ItemConfigType): this;
/**
* Iterates over each container currently added to the perspective,
* not including panels, and transforms them via a mapping function.
*
* @param func the mapping function
*/
mapContainers(func: (item: ItemConfigType) => ItemConfigType): this;
/**
* Iterates over each panel currently added to the perspective,
* not including containers, and transforms them via a mapping function.
*
* @param func the mapping function
*/
mapPanels(func: (item: ItemConfigType) => ItemConfigType): this;
/**
* Prevents the reordering of the component that was added to the
* workbench most recently.
*/
preventReorder(): this;
/**
* Sets the identifier of the component that was added to the workbench
* most recently.
*/
setId(value: string | string[]): this;
/**
* Sets whether the component that was added to the workbench most recently
* is closable or not.
*/
setClosable(value?: boolean): this;
/**
* Sets the relative height of the component that was added to the workbench
* most recently, in percentage, compared to its siblings in the same panel.
*/
setRelativeHeight(value: number): this;
/**
* Sets the relative width of the component that was added to the workbench
* most recently, in percentage, compared to its siblings in the same panel.
*/
setRelativeWidth(value: number): this;
/**
* Sets whether the component that was added to the workbench most recently
* can be rearranged on the workbench by dragging it around.
*/
setReorderEnabled(value?: boolean): this;
/**
* Sets the title of the component that was added to the workbench
* most recently.
*/
setTitle(value: string): this;
/**
* Sets multiple properties of the last component that was added to the
* workbench.
*/
setProperties(props: Partial): this;
private _assertNotFinalized;
private _assertHasWorkbench;
private get _currentPanel();
private get _currentPanelContent();
private _finalize;
private get _lastAddedComponent();
private _makeNewPanel;
}
/**
* Builder class with a fluid API that enables the user to build a complete
* workbench object and its initial layout from scratch.
*/
export declare class WorkbenchBuilder {
/**
* The workbench being built by this builder; undefined if the
* builder has already built one.
*/
private _workbench;
/**
* The wrapped perspective builder that the workbench builder uses.
*/
private _builder;
/**
* The global settings of the workbench being built.
*/
private _settings;
/**
* Constructor.
*
* Creates a new workbench builder that can build new Workbench instances.
*
* @param factory a factory function that returns a new Workbench instance
* when invoked with no arguments. When omitted, it defaults to simply
* calling new Workbench().
*/
constructor(factory?: () => Workbench);
/**
* Adds a new component to be shown in the current subdivision.
*/
add(nameOrComponent: string | React.ComponentType, options?: {
props?: TProps;
state?: any;
title?: string;
}, id?: string): this;
/**
* Builds the workbench based on the set of configuration methods called
* earlier in this call chain.
*/
build(): Workbench;
/**
* Iterates over each content item currently added to the perspective,
* including containers, and removes those for which the given filter
* predicate returns false.
*
* @param pred the filter predicate
*/
filter(pred: (item: ItemConfigType) => boolean): this;
/**
* Iterates over each container currently added to the perspective,
* not including panels, and removes those for which the given filter
* predicate returns false.
*
* @param pred the filter predicate
*/
filterContainers(pred: (item: ItemConfigType) => boolean): this;
/**
* Iterates over each panel currently added to the perspective,
* not including containers, and removes those for which the given filter
* predicate returns false.
*
* @param pred the filter predicate
*/
filterPanels(pred: (item: ItemConfigType) => boolean): this;
/**
* Declares that the current subdivision (row, column or stack) being built
* is finished and moves back to the parent element.
*/
finish(): this;
/**
* Specifies that panel headers should *not* be shown in the workbench.
*/
hideHeaders(): this;
/**
* Subdivides the current panel in the workbench into multiple columns.
* Subsequent calls to add() will add new columns to the workbench
* within the subdivision.
*/
makeColumns(): this;
/**
* Subdivides the current panel in the workbench into multiple rows.
* Subsequent calls to add() will add new rows to the workbench
* within the subdivision.
*/
makeRows(): this;
/**
* Subdivides the current panel in the workbench into multiple stacked items.
* Subsequent calls to add() will add new items to the workbench
* within the current stack.
*/
makeStack(): this;
/**
* Iterates over each content item currently added to the workbench,
* including containers, and transforms them via a mapping function.
*
* @param func the mapping function
*/
map(func: (item: ItemConfigType) => ItemConfigType): this;
/**
* Iterates over each container currently added to the workbench,
* not including panels, and transforms them via a mapping function.
*
* @param func the mapping function
*/
mapContainers(func: (item: ItemConfigType) => ItemConfigType): this;
/**
* Iterates over each panel currently added to the workbench,
* not including containers, and transforms them via a mapping function.
*
* @param func the mapping function
*/
mapPanels(func: (item: ItemConfigType) => ItemConfigType): this;
/**
* Prevents the reordering of the component that was added to the
* workbench most recently.
*/
preventReorder(): this;
/**
* Sets the identifier of the component that was added to the workbench
* most recently.
*/
setId(value: string | string[]): this;
/**
* Sets whether the component that was added to the workbench most recently
* is closable or not.
*/
setClosable(value?: boolean): this;
/**
* Sets the relative height of the component that was added to the workbench
* most recently, in percentage, compared to its siblings in the same panel.
*/
setRelativeHeight(value: number): this;
/**
* Sets the relative width of the component that was added to the workbench
* most recently, in percentage, compared to its siblings in the same panel.
*/
setRelativeWidth(value: number): this;
/**
* Sets whether the component that was added to the workbench most recently
* can be rearranged on the workbench by dragging it around.
*/
setReorderEnabled(value?: boolean): this;
/**
* Sets the title of the component that was added to the workbench
* most recently.
*/
setTitle(value: string): this;
/**
* Sets multiple properties of the last component that was added to the
* workbench.
*/
setProperties(props: Partial): this;
/**
* Specifies whether panel headers should be shown in the workbench.
*/
showHeaders(value?: boolean): this;
/**
* Specifies whether maximise icons should be shown in the workbench.
*/
showMaximiseIcon(value?: boolean): this;
register(factory: ComponentConstructor): this;
register(name: string, factory: ComponentConstructor): this;
registerComponent(component: React.ComponentType): this;
registerComponent(name: string, component: React.ComponentType): this;
private _assertHasWorkbench;
}