golden-layout
Version:
A multi-screen javascript Layout manager
1,161 lines (1,117 loc) • 89.9 kB
TypeScript
/** @public */
export declare class ApiError extends ExternalError {
/* Excluded from this release type: __constructor */
}
/* Excluded from this release type: AreaLinkedRect */
/**
* Pops a content item out into a new browser window.
* This is achieved by
*
* - Creating a new configuration with the content item as root element
* - Serializing and minifying the configuration
* - Opening the current window's URL with the configuration as a GET parameter
* - GoldenLayout when opened in the new window will look for the GET parameter
* and use it instead of the provided configuration
* @public
*/
export declare class BrowserPopout extends EventEmitter {
/* Excluded from this release type: _config */
/* Excluded from this release type: _initialWindowSize */
/* Excluded from this release type: _layoutManager */
/* Excluded from this release type: _popoutWindow */
/* Excluded from this release type: _isInitialised */
/* Excluded from this release type: _checkReadyInterval */
/* Excluded from this release type: __constructor */
toConfig(): ResolvedPopoutLayoutConfig;
getGlInstance(): LayoutManager;
/* Excluded from this release type: getWindow */
close(): void;
/**
* Returns the popped out item to its original position. If the original
* parent isn't available anymore it falls back to the layout's topmost element
*/
popIn(): void;
/* Excluded from this release type: createWindow */
/* Excluded from this release type: checkReady */
/* Excluded from this release type: serializeWindowFeatures */
/* Excluded from this release type: createUrl */
/* Excluded from this release type: positionWindow */
/* Excluded from this release type: onInitialised */
/* Excluded from this release type: _onClose */
}
/** @public */
export declare class ComponentContainer extends EventEmitter {
/* Excluded from this release type: _config */
/* Excluded from this release type: _parent */
/* Excluded from this release type: _layoutManager */
/* Excluded from this release type: _element */
/* Excluded from this release type: _updateItemConfigEvent */
/* Excluded from this release type: _showEvent */
/* Excluded from this release type: _hideEvent */
/* Excluded from this release type: _focusEvent */
/* Excluded from this release type: _blurEvent */
/* Excluded from this release type: _componentType */
/* Excluded from this release type: _component */
/* Excluded from this release type: _width */
/* Excluded from this release type: _height */
/* Excluded from this release type: _isClosable */
/* Excluded from this release type: _initialState */
/* Excluded from this release type: _state */
/* Excluded from this release type: _isHidden */
/* Excluded from this release type: _isShownWithZeroDimensions */
/* Excluded from this release type: _tab */
stateRequestEvent: ComponentContainer.StateRequestEventHandler | undefined;
get width(): number | null;
get height(): number | null;
get parent(): ComponentItem;
/* Excluded from this release type: componentName */
get componentType(): JsonValue;
get component(): ComponentItem.Component;
get tab(): Tab;
get title(): string;
get layoutManager(): LayoutManager;
get isHidden(): boolean;
get state(): JsonValue | undefined;
/** Return the initial component state */
get initialState(): JsonValue | undefined;
/** The inner DOM element where the container's content is intended to live in */
get element(): HTMLElement;
/* Excluded from this release type: __constructor */
/* Excluded from this release type: destroy */
/** @deprecated use {@link (ComponentContainer:class).element } */
getElement(): HTMLElement;
/**
* Hides the container's component item (and hence, the container) if not already hidden.
* Emits hide event prior to hiding the container.
*/
hide(): void;
/* Excluded from this release type: checkEmitHide */
/**
* Shows the container's component item (and hence, the container) if not visible.
* Emits show event prior to hiding the container.
*/
show(): void;
/**
* Focus this component in Layout.
*/
focus(suppressEvent?: boolean): void;
/**
* Remove focus from this component in Layout.
*/
blur(suppressEvent?: boolean): void;
/* Excluded from this release type: checkEmitShow */
/**
* Set the size from within the container. Traverses up
* the item tree until it finds a row or column element
* and resizes its items accordingly.
*
* If this container isn't a descendant of a row or column
* it returns false
* @param width - The new width in pixel
* @param height - The new height in pixel
*
* @returns resizeSuccesful
*/
setSize(width: number, height: number): boolean;
/**
* Closes the container if it is closable. Can be called by
* both the component within at as well as the contentItem containing
* it. Emits a close event before the container itself is closed.
*/
close(): void;
/** Replaces component without affecting layout */
replaceComponent(itemConfig: ComponentItemConfig): void;
/**
* Returns the initial component state or the latest passed in setState()
* @returns state
* @deprecated Use {@link (ComponentContainer:class).initialState}
*/
getState(): JsonValue | undefined;
/**
* Merges the provided state into the current one
* @deprecated Use {@link (ComponentContainer:class).stateRequestEvent}
*/
extendState(state: Record<string, unknown>): void;
/**
* Sets the component state
* @deprecated Use {@link (ComponentContainer:class).stateRequestEvent}
*/
setState(state: JsonValue): void;
/**
* Set's the components title
*/
setTitle(title: string): void;
/* Excluded from this release type: setTab */
/* Excluded from this release type: setDragSize */
/* Excluded from this release type: setSizeToNodeSize */
/* Excluded from this release type: releaseComponent */
}
/** @public */
export declare namespace ComponentContainer {
export type StateRequestEventHandler = (this: void) => JsonValue | undefined;
/* Excluded from this release type: ShowEventHandler */
/* Excluded from this release type: HideEventHandler */
/* Excluded from this release type: FocusEventHandler */
/* Excluded from this release type: BlurEventHandler */
/* Excluded from this release type: UpdateItemConfigEventHandler */
}
/** @public */
export declare class ComponentItem extends ContentItem {
/* Excluded from this release type: _parentItem */
/* Excluded from this release type: _reorderEnabled */
/* Excluded from this release type: _headerConfig */
/* Excluded from this release type: _title */
/* Excluded from this release type: _initialWantMaximise */
/* Excluded from this release type: _container */
/* Excluded from this release type: _tab */
/* Excluded from this release type: _focused */
/* Excluded from this release type: componentName */
get componentType(): JsonValue;
get reorderEnabled(): boolean;
/* Excluded from this release type: initialWantMaximise */
get component(): ComponentItem.Component;
get container(): ComponentContainer;
get parentItem(): ComponentParentableItem;
get headerConfig(): ResolvedHeaderedItemConfig.Header | undefined;
get title(): string;
get tab(): Tab;
get focused(): boolean;
/* Excluded from this release type: __constructor */
/* Excluded from this release type: destroy */
applyUpdatableConfig(config: ResolvedComponentItemConfig): void;
toConfig(): ResolvedComponentItemConfig;
close(): void;
/* Excluded from this release type: setDragSize */
/* Excluded from this release type: updateSize */
/* Excluded from this release type: init */
/**
* Set this component's title
*
* @public
* @param title -
*/
setTitle(title: string): void;
setTab(tab: Tab): void;
/* Excluded from this release type: hide */
/* Excluded from this release type: show */
/**
* Focuses the item if it is not already focused
*/
focus(suppressEvent?: boolean): void;
/* Excluded from this release type: setFocused */
/**
* Blurs (defocuses) the item if it is focused
*/
blur(suppressEvent?: boolean): void;
/* Excluded from this release type: setBlurred */
/* Excluded from this release type: setParent */
/* Excluded from this release type: handleUpdateItemConfigEvent */
/* Excluded from this release type: updateNodeSize */
}
/** @public */
export declare namespace ComponentItem {
export type Component = unknown;
}
/** @public */
export declare interface ComponentItemConfig extends HeaderedItemConfig {
type: 'component';
readonly content?: [];
/**
* The type of the component.
* @deprecated use {@link (ComponentItemConfig:interface).componentType} instead
*/
componentName?: string;
/**
* The type of the component.
* `componentType` must be of type `string` if it is registered with any of the following functions:
* * {@link (LayoutManager:class).registerComponent} (deprecated)
* * {@link (LayoutManager:class).registerComponentConstructor}
* * {@link (LayoutManager:class).registerComponentFactoryFunction}
*/
componentType: JsonValue;
/**
* The state information with which a component will be initialised with.
* Will be passed to the component constructor function and will be the value returned by
* container.initialState.
*/
componentState?: JsonValue;
/**
* Default: true
*/
reorderEnabled?: boolean;
}
/** @public */
export declare namespace ComponentItemConfig {
export function resolve(itemConfig: ComponentItemConfig): ResolvedComponentItemConfig;
export function componentTypeToTitle(componentType: JsonValue): string;
}
declare abstract class ComponentParentableItem extends ContentItem {
/* Excluded from this release type: _focused */
get focused(): boolean;
/* Excluded from this release type: setFocusedValue */
abstract setActiveComponentItem(item: ComponentItem, focus: boolean, suppressFocusEvent: boolean): void;
}
/** @public @deprecated - use {@link (LayoutConfig:interface)} */
export declare type Config = LayoutConfig;
/** @public */
export declare class ConfigurationError extends ExternalError {
readonly node?: string | undefined;
/* Excluded from this release type: __constructor */
}
/**
* This is the baseclass that all content items inherit from.
* Most methods provide a subset of what the sub-classes do.
*
* It also provides a number of functions for tree traversal
* @public
*/
export declare abstract class ContentItem extends EventEmitter {
readonly layoutManager: LayoutManager;
/* Excluded from this release type: _parent */
/* Excluded from this release type: _element */
/* Excluded from this release type: _type */
/* Excluded from this release type: _id */
/* Excluded from this release type: _popInParentIds */
/* Excluded from this release type: _contentItems */
/* Excluded from this release type: _isClosable */
/* Excluded from this release type: _pendingEventPropagations */
/* Excluded from this release type: _throttledEvents */
/* Excluded from this release type: _isInitialised */
/* Excluded from this release type: width */
/* Excluded from this release type: minWidth */
/* Excluded from this release type: height */
/* Excluded from this release type: minHeight */
isGround: boolean;
isRow: boolean;
isColumn: boolean;
isStack: boolean;
isComponent: boolean;
get type(): ItemType;
get id(): string;
/* Excluded from this release type: popInParentIds */
get parent(): ContentItem | null;
get contentItems(): ContentItem[];
get isClosable(): boolean;
get element(): HTMLElement;
get isInitialised(): boolean;
static isStack(item: ContentItem): item is Stack;
static isComponentItem(item: ContentItem): item is ComponentItem;
static isComponentParentableItem(item: ContentItem): item is ComponentParentableItem;
/* Excluded from this release type: __constructor */
/* Excluded from this release type: updateSize */
/**
* Removes a child node (and its children) from the tree
*/
removeChild(contentItem: ContentItem, keepChild?: boolean): void;
/**
* Sets up the tree structure for the newly added child
* The responsibility for the actual DOM manipulations lies
* with the concrete item
*
* @param contentItem -
* @param index - If omitted item will be appended
* @param suspendResize - Used by descendent implementations
*/
addChild(contentItem: ContentItem, index?: number | null, suspendResize?: boolean): number;
/* Excluded from this release type: replaceChild */
/**
* Convenience method.
* Shorthand for this.parent.removeChild( this )
*/
remove(): void;
/**
* Removes the component from the layout and creates a new
* browser window with the component and its children inside
*/
popout(): BrowserPopout;
abstract toConfig(): ResolvedItemConfig;
/* Excluded from this release type: calculateConfigContent */
/* Excluded from this release type: highlightDropZone */
/* Excluded from this release type: onDrop */
/* Excluded from this release type: show */
/* Excluded from this release type: destroy */
/* Excluded from this release type: getElementArea */
/* Excluded from this release type: init */
/* Excluded from this release type: setParent */
/* Excluded from this release type: addPopInParentId */
/* Excluded from this release type: initContentItems */
/* Excluded from this release type: hide */
/* Excluded from this release type: updateContentItemsSize */
/* Excluded from this release type: createContentItems */
/* Excluded from this release type: propagateEvent */
tryBubbleEvent(name: string, args: unknown[]): void;
/* Excluded from this release type: scheduleEventPropagationToLayoutManager */
/* Excluded from this release type: propagateEventToLayoutManager */
}
/** @public */
export declare namespace ContentItem {
/* Excluded from this release type: Area */
}
/* Excluded from this release type: DragListener */
/**
* Allows for any DOM item to create a component on drag
* start to be dragged into the Layout
* @public
*/
export declare class DragSource {
/* Excluded from this release type: _layoutManager */
/* Excluded from this release type: _element */
/* Excluded from this release type: _extraAllowableChildTargets */
/* Excluded from this release type: _componentTypeOrFtn */
/* Excluded from this release type: _componentState */
/* Excluded from this release type: _title */
/* Excluded from this release type: _dragListener */
/* Excluded from this release type: _dummyGroundContainer */
/* Excluded from this release type: _dummyGroundContentItem */
/* Excluded from this release type: __constructor */
/* Excluded from this release type: destroy */
/* Excluded from this release type: createDragListener */
/* Excluded from this release type: onDragStart */
/* Excluded from this release type: onDragStop */
/* Excluded from this release type: removeDragListener */
}
/** @public */
export declare namespace DragSource {
export interface ComponentItemConfig {
type: JsonValue;
state?: JsonValue;
title?: string;
}
}
/* Excluded from this release type: DropTargetIndicator */
/**
* A generic and very fast EventEmitter implementation. On top of emitting the actual event it emits an
* {@link (EventEmitter:namespace).ALL_EVENT} event for every event triggered. This allows to hook into it and proxy events forwards
* @public
*/
export declare class EventEmitter {
/* Excluded from this release type: _allEventSubscriptions */
/* Excluded from this release type: _subscriptionsMap */
tryBubbleEvent(name: string, args: unknown[]): void;
/**
* Emit an event and notify listeners
*
* @param eventName - The name of the event
* @param args - Additional arguments that will be passed to the listener
*/
emit<K extends keyof EventEmitter.EventParamsMap>(eventName: K, ...args: EventEmitter.EventParamsMap[K]): void;
/* Excluded from this release type: emitUnknown */
emitBaseBubblingEvent<K extends keyof EventEmitter.EventParamsMap>(eventName: K): void;
/* Excluded from this release type: emitUnknownBubblingEvent */
/**
* Removes a listener for an event, or all listeners if no callback and context is provided.
* @param eventName - The name of the event
* @param callback - The previously registered callback method (optional)
*/
removeEventListener<K extends keyof EventEmitter.EventParamsMap>(eventName: K, callback: EventEmitter.Callback<K>): void;
off<K extends keyof EventEmitter.EventParamsMap>(eventName: K, callback: EventEmitter.Callback<K>): void;
/**
* Alias for off
*/
unbind: <K extends keyof EventEmitter.EventParamsMap>(eventName: K, callback: EventEmitter.Callback<K>) => void;
/**
* Alias for emit
*/
trigger: <K extends keyof EventEmitter.EventParamsMap>(eventName: K, ...args: EventEmitter.EventParamsMap[K]) => void;
/**
* Listen for events
*
* @param eventName - The name of the event to listen to
* @param callback - The callback to execute when the event occurs
*/
addEventListener<K extends keyof EventEmitter.EventParamsMap>(eventName: K, callback: EventEmitter.Callback<K>): void;
on<K extends keyof EventEmitter.EventParamsMap>(eventName: K, callback: EventEmitter.Callback<K>): void;
/* Excluded from this release type: addUnknownEventListener */
/* Excluded from this release type: removeUnknownEventListener */
/* Excluded from this release type: removeSubscription */
/* Excluded from this release type: emitAllEvent */
}
/** @public */
export declare namespace EventEmitter {
/**
* The name of the event that's triggered for every event
*/
const ALL_EVENT = "__all";
const headerClickEventName = "stackHeaderClick";
const headerTouchStartEventName = "stackHeaderTouchStart";
/* Excluded from this release type: UnknownCallback */
export type Callback<K extends keyof EventEmitter.EventParamsMap> = (this: void, ...args: EventParamsMap[K]) => void;
export interface EventParamsMap {
"__all": UnknownParams;
"activeContentItemChanged": UnknownParam;
"close": NoParams;
"closed": NoParams;
"destroy": NoParams;
"drag": DragParams;
"dragStart": DragStartParams;
"dragStop": DragStopParams;
"hide": NoParams;
"initialised": NoParams;
"itemDropped": UnknownParam;
"maximised": NoParams;
"minimised": NoParams;
"open": NoParams;
"popIn": NoParams;
"resize": NoParams;
"show": NoParams;
/** @deprecated - use show instead */
"shown": NoParams;
"stateChanged": NoParams;
"tab": UnknownParam;
"tabCreated": UnknownParam;
"titleChanged": StringParam;
"windowClosed": UnknownParam;
"windowOpened": UnknownParam;
"beforeComponentRelease": BeforeComponentReleaseParams;
"beforeItemDestroyed": BubblingEventParam;
"itemCreated": BubblingEventParam;
"itemDestroyed": BubblingEventParam;
"focus": BubblingEventParam;
"blur": BubblingEventParam;
"stackHeaderClick": ClickBubblingEventParam;
"stackHeaderTouchStart": TouchStartBubblingEventParam;
}
export type UnknownParams = unknown[];
export type NoParams = [];
export type UnknownParam = [unknown];
export type BubblingEventParam = [EventEmitter.BubblingEvent];
export type StringParam = [string];
export type DragStartParams = [originalX: number, originalY: number];
export type DragStopParams = [event: DragEvent];
export type DragParams = [offsetX: number, offsetY: number, event: DragEvent];
export type BeforeComponentReleaseParams = [component: unknown];
export type ClickBubblingEventParam = [ClickBubblingEvent];
export type TouchStartBubblingEventParam = [TouchStartBubblingEvent];
export class BubblingEvent {
/* Excluded from this release type: _name */
/* Excluded from this release type: _target */
/* Excluded from this release type: _isPropagationStopped */
get name(): string;
get target(): EventEmitter;
/** @deprecated Use {@link (EventEmitter:namespace).(BubblingEvent:class).target} instead */
get origin(): EventEmitter;
get isPropagationStopped(): boolean;
/* Excluded from this release type: __constructor */
stopPropagation(): void;
}
export class ClickBubblingEvent extends BubblingEvent {
/* Excluded from this release type: _mouseEvent */
get mouseEvent(): MouseEvent;
/* Excluded from this release type: __constructor */
}
export class TouchStartBubblingEvent extends BubblingEvent {
/* Excluded from this release type: _touchEvent */
get touchEvent(): TouchEvent;
/* Excluded from this release type: __constructor */
}
export interface DragEvent {
mouseEvent: MouseEvent | undefined;
touchEvent: TouchEvent | undefined;
pageX: number;
pageY: number;
}
}
/* Excluded from this release type: EventHub */
/** @public */
export declare abstract class ExternalError extends Error {
readonly type: string;
/* Excluded from this release type: __constructor */
}
/** @public */
export declare class GoldenLayout extends LayoutManager {
/* Excluded from this release type: _subWindowsCreated */
/* Excluded from this release type: _creationTimeoutPassed */
/**
* @param container - A Dom HTML element. Defaults to body
*/
constructor(container?: HTMLElement);
/** @deprecated specify layoutConfig in {@link (LayoutManager:class).loadLayout} */
constructor(config: LayoutConfig, container?: HTMLElement);
/**
* Creates the actual layout. Must be called after all initial components
* are registered. Recurses through the configuration and sets up
* the item tree.
*
* If called before the document is ready it adds itself as a listener
* to the document.ready event
* @deprecated LayoutConfig should not be loaded in {@link (LayoutManager:class)} constructor, but rather in a
* {@link (LayoutManager:class).loadLayout} call. If LayoutConfig is not specified in {@link (LayoutManager:class)} constructor,
* then init() will be automatically called internally and should not be called externally.
*/
init(): void;
/* Excluded from this release type: createSubWindows */
/* Excluded from this release type: adjustToWindowMode */
}
/** @public */
export declare namespace GoldenLayout {
/* Excluded from this release type: createConfig */
}
/* Excluded from this release type: GroundItem */
/**
* This class represents a header above a Stack ContentItem.
* @public
*/
export declare class Header extends EventEmitter {
/* Excluded from this release type: _layoutManager */
/* Excluded from this release type: _parent */
/* Excluded from this release type: _configClosable */
/* Excluded from this release type: _getActiveComponentItemEvent */
/* Excluded from this release type: _dockEvent */
/* Excluded from this release type: _popoutEvent */
/* Excluded from this release type: _maximiseToggleEvent */
/* Excluded from this release type: _clickEvent */
/* Excluded from this release type: _touchStartEvent */
/* Excluded from this release type: _componentRemoveEvent */
/* Excluded from this release type: _componentFocusEvent */
/* Excluded from this release type: _componentDragStartEvent */
/* Excluded from this release type: _tabsContainer */
/* Excluded from this release type: _element */
/* Excluded from this release type: _controlsContainerElement */
/* Excluded from this release type: _show */
/* Excluded from this release type: _popoutEnabled */
/* Excluded from this release type: _popoutLabel */
/* Excluded from this release type: _dockEnabled */
/* Excluded from this release type: _dockLabel */
/* Excluded from this release type: _maximiseEnabled */
/* Excluded from this release type: _maximiseLabel */
/* Excluded from this release type: _minimiseEnabled */
/* Excluded from this release type: _minimiseLabel */
/* Excluded from this release type: _closeEnabled */
/* Excluded from this release type: _closeLabel */
/* Excluded from this release type: _tabDropdownEnabled */
/* Excluded from this release type: _tabDropdownLabel */
/* Excluded from this release type: _tabControlOffset */
/* Excluded from this release type: _clickListener */
/* Excluded from this release type: _touchStartListener */
/* Excluded from this release type: _documentMouseUpListener */
/* Excluded from this release type: _rowColumnClosable */
/* Excluded from this release type: _canRemoveComponent */
/* Excluded from this release type: _side */
/* Excluded from this release type: _leftRightSided */
/* Excluded from this release type: _closeButton */
/* Excluded from this release type: _dockButton */
/* Excluded from this release type: _popoutButton */
/* Excluded from this release type: _tabDropdownButton */
/* Excluded from this release type: _maximiseButton */
/* Excluded from this release type: show */
/* Excluded from this release type: side */
/* Excluded from this release type: leftRightSided */
/* Excluded from this release type: dockEnabled */
get layoutManager(): LayoutManager;
get parent(): Stack;
get tabs(): Tab[];
/**
* @deprecated use {@link (Stack:class).getActiveComponentItem} */
get activeContentItem(): ContentItem | null;
get element(): HTMLElement;
/** @deprecated use {@link (Header:class).tabsContainerElement} */
get tabsContainer(): HTMLElement;
get tabsContainerElement(): HTMLElement;
get controlsContainerElement(): HTMLElement;
/** @deprecated use {@link (Header:class).controlsContainerElement} */
get controlsContainer(): HTMLElement;
/* Excluded from this release type: __constructor */
/* Excluded from this release type: destroy */
/* Excluded from this release type: createTab */
/* Excluded from this release type: removeTab */
/* Excluded from this release type: processActiveComponentChanged */
/* Excluded from this release type: setSide */
/* Excluded from this release type: setRowColumnClosable */
/* Excluded from this release type: updateClosability */
/* Excluded from this release type: setDockable */
/* Excluded from this release type: applyFocusedValue */
/* Excluded from this release type: processMaximised */
/* Excluded from this release type: processMinimised */
/* Excluded from this release type: updateTabSizes */
/* Excluded from this release type: handleTabInitiatedComponentRemoveEvent */
/* Excluded from this release type: handleTabInitiatedComponentFocusEvent */
/* Excluded from this release type: handleTabInitiatedDragStartEvent */
/* Excluded from this release type: processTabDropdownActiveChanged */
/* Excluded from this release type: handleButtonDockEvent */
/* Excluded from this release type: handleButtonPopoutEvent */
/* Excluded from this release type: handleButtonMaximiseToggleEvent */
/* Excluded from this release type: onClick */
/* Excluded from this release type: onTouchStart */
/* Excluded from this release type: notifyClick */
/* Excluded from this release type: notifyTouchStart */
}
/** @public */
export declare namespace Header {
/* Excluded from this release type: GetActiveComponentItemEvent */
/* Excluded from this release type: CloseEvent */
/* Excluded from this release type: DockEvent */
/* Excluded from this release type: PopoutEvent */
/* Excluded from this release type: MaximiseToggleEvent */
/* Excluded from this release type: ClickEvent */
/* Excluded from this release type: TouchStartEvent */
/* Excluded from this release type: ComponentRemoveEvent */
/* Excluded from this release type: ComponentFocusEvent */
/* Excluded from this release type: ComponentDragStartEvent */
/* Excluded from this release type: StateChangedEvent */
/* Excluded from this release type: Settings */
}
/** @public */
export declare interface HeaderedItemConfig extends ItemConfig {
/** @deprecated use {@link (HeaderedItemConfig:namespace).(Header:interface).show} instead */
hasHeaders?: boolean;
header?: HeaderedItemConfig.Header;
maximised?: boolean;
}
/** @public */
export declare namespace HeaderedItemConfig {
export interface Header {
show?: false | Side;
popout?: false | string;
dock?: false | string;
maximise?: false | string;
close?: string;
minimise?: string;
tabDropdown?: false | string;
}
export namespace Header {
export function resolve(header: Header | undefined, hasHeaders: boolean | undefined): ResolvedHeaderedItemConfig.Header | undefined;
}
export function resolveIdAndMaximised(config: HeaderedItemConfig): {
id: string;
maximised: boolean;
};
}
/** @public */
export declare const enum I18nStringId {
PopoutCannotBeCreatedWithGroundItemConfig = 0,
PleaseRegisterAConstructorFunction = 1,
ComponentIsAlreadyRegistered = 2,
ItemConfigIsNotTypeComponent = 3
}
/** @public */
export declare namespace I18nStrings {
const idCount: number;
export function checkInitialise(): void;
}
/** @public */
export declare const i18nStrings: string[];
/** @public */
export declare interface ItemConfig {
/**
* The type of the item. Possible values are 'row', 'column', 'stack', 'component'.
*/
type: ItemType;
/**
* An array of configurations for items that will be created as children of this item.
*/
content?: ItemConfig[];
/**
* The width of this item, relative to the other children of its parent in percent
*/
width?: number;
/**
* The minimum width of this item in pixels
* CAUTION - Not tested - do not use
*/
minWidth?: number;
/**
* The height of this item, relative to the other children of its parent in percent
*/
height?: number;
/**
* The minimum height of this item in pixels
* CAUTION - Not tested - do not use
*/
minHeight?: number;
/**
* A string that can be used to identify a ContentItem.
* Do NOT assign an array. This only exists for legacy purposes. If an array is assigned, the first element
* will become the id.
*/
id?: string;
/**
* Determines if the item is closable. If false, the x on the items tab will be hidden and container.close()
* will return false
* Default: true
*/
isClosable?: boolean;
/**
* The title of the item as displayed on its tab and on popout windows
* Default: componentType.toString() or ''
*/
title?: string;
}
/** @public */
export declare namespace ItemConfig {
export function resolve(itemConfig: ItemConfig): ResolvedItemConfig;
export function resolveContent(content: ItemConfig[] | undefined): ResolvedItemConfig[];
export function resolveId(id: string | string[] | undefined): string;
export function isGround(config: ItemConfig): config is ItemConfig;
export function isRow(config: ItemConfig): config is ItemConfig;
export function isColumn(config: ItemConfig): config is ItemConfig;
export function isStack(config: ItemConfig): config is ItemConfig;
export function isComponent(config: ItemConfig): config is ComponentItemConfig;
}
/** @public */
export declare type ItemType = 'ground' | 'row' | 'column' | 'stack' | 'component';
/** @public */
export declare namespace ItemType {
const ground = "ground";
const row = "row";
const column = "column";
const stack = "stack";
const component = "component";
}
/** @public */
export declare interface Json {
[name: string]: JsonValue;
}
/** @public */
export declare type JsonValue = string | number | boolean | null | Json | object | JsonValueArray;
/** @public */
export declare namespace JsonValue {
export function isJson(value: JsonValue): value is Json;
export function isJsonObject(value: JsonValue): value is Json | object;
}
/** @public */
export declare type JsonValueArray = Array<JsonValue>;
/** @public */
export declare interface LayoutConfig {
root: RootItemConfig;
/** @deprecated Use {@link (LayoutConfig:interface).root} */
content?: (RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig)[];
openPopouts?: PopoutLayoutConfig[];
dimensions?: LayoutConfig.Dimensions;
settings?: LayoutConfig.Settings;
/** @deprecated use {@link (LayoutConfig:interface).header} instead */
labels?: LayoutConfig.Labels;
header?: LayoutConfig.Header;
}
/** Use to specify LayoutConfig with defaults or deserialise a LayoutConfig.
* Deserialisation will handle backwards compatibility.
* Note that LayoutConfig should be used for serialisation (not LayoutConfig)
* @public
*/
export declare namespace LayoutConfig {
export interface Settings {
/**
* @deprecated use ${@link (LayoutConfig:namespace).(Header:interface).show} instead
*/
hasHeaders?: boolean;
/**
* Constrains the area in which items can be dragged to the layout's container. Will be set to false
* automatically when layout.createDragSource() is called.
* Default: true
*/
constrainDragToContainer?: boolean;
/**
* If true, the user can re-arrange the layout by dragging items by their tabs to the desired location.
* Can be overridden by ItemConfig.reorderEnabled for specific ItemConfigs
* Default: true
*/
reorderEnabled?: boolean;
/**
* Decides what will be opened in a new window if the user clicks the popout icon. If true the entire stack will
* be transferred to the new window, if false only the active component will be opened.
* Default: false
*/
popoutWholeStack?: boolean;
/**
* Specifies if an error is thrown when a popout is blocked by the browser (e.g. by opening it programmatically).
* If false, the popout call will fail silently.
* Default: true
*/
blockedPopoutsThrowError?: boolean;
/**
* Specifies if all popouts should be closed when the page that created them is closed. Popouts don't have a
* strong dependency on their parent and can exist on their own, but can be quite annoying to close by hand. In
* addition, any changes made to popouts won't be stored after the parent is closed.
* Default: true
*/
closePopoutsOnUnload?: boolean;
/**
* Specifies if the popout icon should be displayed in the header-bar.
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popout} instead
*/
showPopoutIcon?: boolean;
/**
* Specifies if the maximise icon should be displayed in the header-bar.
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).maximise} instead
*/
showMaximiseIcon?: boolean;
/**
* Specifies if the close icon should be displayed in the header-bar.
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).close} instead
*/
showCloseIcon?: boolean;
/**
* Specifies Responsive Mode (more info needed).
* Default: none
*/
responsiveMode?: ResponsiveMode;
/**
* Specifies Maximum pixel overlap per tab.
* Default: 0
*/
tabOverlapAllowance?: number;
/**
*
* Default: true
*/
reorderOnTabMenuClick?: boolean;
/**
* Default: 10
*/
tabControlOffset?: number;
/**
* Specifies whether to pop in elements when closing a popout window.
* Default: false
*/
popInOnClose?: boolean;
}
export namespace Settings {
export function resolve(settings: Settings | undefined): ResolvedLayoutConfig.Settings;
}
export interface Dimensions {
/**
* The width of the borders between the layout items in pixel. Please note: The actual draggable area is wider
* than the visible one, making it safe to set this to small values without affecting usability.
* Default: 5
*/
borderWidth?: number;
/**
* Default: 15
*/
borderGrabWidth?: number;
/**
* The minimum height an item can be resized to (in pixel).
* Default: 10
*/
minItemHeight?: number;
/**
* The minimum width an item can be resized to (in pixel).
* Default: 10
*/
minItemWidth?: number;
/**
* The height of the header elements in pixel. This can be changed, but your theme's header css needs to be
* adjusted accordingly.
* Default: 20
*/
headerHeight?: number;
/**
* The width of the element that appears when an item is dragged (in pixel).
* Default: 300
*/
dragProxyWidth?: number;
/**
* The height of the element that appears when an item is dragged (in pixel).
* Default: 200
*/
dragProxyHeight?: number;
}
export namespace Dimensions {
export function resolve(dimensions: Dimensions | undefined): ResolvedLayoutConfig.Dimensions;
}
export interface Labels {
/**
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).close} instead
*/
close?: string;
/**
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).maximise} instead
*/
maximise?: string;
/**
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).minimise} instead
*/
minimise?: string;
/**
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popin} instead
*/
popin?: string;
/**
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popout} instead
*/
popout?: string;
/**
* @deprecated use {@link (LayoutConfig:namespace).(Header:interface).tabDropdown} instead
*/
tabDropdown?: string;
}
export interface Header {
/**
* Specifies whether header should be displayed, and if so, on which side.
* If false, the layout will be displayed with splitters only.
* Default: 'top'
*/
show?: false | Side;
/**
* The tooltip text that appears when hovering over the popout icon or false if popout button not displayed.
* Default: 'open in new window'
*/
popout?: false | string;
/**
* The tooltip text that appears when hovering over the popin icon.
* Default: 'pop in'
*/
popin?: string;
/**
* The tooltip text that appears when hovering over the maximise icon or false if maximised button not displayed.
* Default: 'maximise'
*/
maximise?: false | string;
/**
* The tooltip text that appears when hovering over the close icon.
* Default: 'close'
*/
close?: false | string;
/**
* The tooltip text that appears when hovering over the minimise icon.
* Default: 'minimise'
*/
minimise?: string;
/**
*
* Default: 'additional tabs'
*/
tabDropdown?: string;
}
export namespace Header {
export function resolve(header: Header | undefined, settings: LayoutConfig.Settings | undefined, labels: LayoutConfig.Labels | undefined): ResolvedLayoutConfig.Header;
}
export function isPopout(config: LayoutConfig): config is PopoutLayoutConfig;
export function resolve(layoutConfig: LayoutConfig): ResolvedLayoutConfig;
export function fromResolved(config: ResolvedLayoutConfig): LayoutConfig;
export function isResolved(configOrResolvedConfig: ResolvedLayoutConfig | LayoutConfig): configOrResolvedConfig is ResolvedLayoutConfig;
export function resolveOpenPopouts(popoutConfigs: PopoutLayoutConfig[] | undefined): ResolvedPopoutLayoutConfig[];
}
/**
* The main class that will be exposed as GoldenLayout.
*/
/** @public */
export declare abstract class LayoutManager extends EventEmitter {
/* Excluded from this release type: _containerElement */
/* Excluded from this release type: _isFullPage */
/* Excluded from this release type: _isInitialised */
/* Excluded from this release type: _groundItem */
/* Excluded from this release type: _openPopouts */
/* Excluded from this release type: _dropTargetIndicator */
/* Excluded from this release type: _transitionIndicator */
/* Excluded from this release type: _resizeTimeoutId */
/* Excluded from this release type: _componentTypes */
/* Excluded from this release type: _itemAreas */
/* Excluded from this release type: _maximisedStack */
/* Excluded from this release type: _maximisePlaceholder */
/* Excluded from this release type: _tabDropPlaceholder */
/* Excluded from this release type: _dragSources */
/* Excluded from this release type: _updatingColumnsResponsive */
/* Excluded from this release type: _firstLoad */
/* Excluded from this release type: _eventHub */
/* Excluded from this release type: _width */
/* Excluded from this release type: _height */
/* Excluded from this release type: _focusedComponentItem */
/* Excluded from this release type: _getComponentConstructorFtn */
/* Excluded from this release type: _windowResizeListener */
/* Excluded from this release type: _windowUnloadListener */
/* Excluded from this release type: _maximisedStackBeforeDestroyedListener */
readonly isSubWindow: boolean;
layoutConfig: ResolvedLayoutConfig;
/**
* If a new component is required and:
* 1. a component type with corresponding name is not registered, and
* 2. a
* This callback should return a constructor for a component based on a config.
* This function will be called if a component type with the required name is not already registered.
* It is recommended that applications use the {@link (LayoutManager:class).getComponentEvent} and
* {@link (LayoutManager:class).releaseComponentEvent} instead of registering a constructor callback
*/
getComponentEvent: LayoutManager.GetComponentEventHandler | undefined;
releaseComponentEvent: LayoutManager.ReleaseComponentEventHandler | undefined;
get container(): HTMLElement;
get isInitialised(): boolean;
/* Excluded from this release type: groundItem */
/* Excluded from this release type: root */
get openPopouts(): BrowserPopout[];
/* Excluded from this release type: dropTargetIndicator */
/* Excluded from this release type: transitionIndicator */
get width(): number | null;
get height(): number | null;
/* Excluded from this release type: eventHub */
get rootItem(): ContentItem | undefined;
get focusedComponentItem(): ComponentItem | undefined;
/* Excluded from this release type: tabDropPlaceholder */
get maximisedStack(): Stack | undefined;
/* Excluded from this release type: __constructor */
/**
* Destroys the LayoutManager instance itself as well as every ContentItem
* within it. After this is called nothing should be left of the LayoutManager.
*/
destroy(): void;
/**
* Takes a GoldenLayout configuration object and
* replaces its keys and values recursively with
* one letter codes
* @deprecated use {@link (ResolvedLayoutConfig:namespace).minifyConfig} instead
*/
minifyConfig(config: ResolvedLayoutConfig): ResolvedLayoutConfig;
/**
* Takes a configuration Object that was previously minified
* using minifyConfig and returns its original version
* @deprecated use {@link (ResolvedLayoutConfig:namespace).unminifyConfig} instead
*/
unminifyConfig(config: ResolvedLayoutConfig): ResolvedLayoutConfig;
/**
* Register a new component type with the layout manager.
*
* @deprecated See {@link https://stackoverflow.com/questions/40922531/how-to-check-if-a-javascript-function-is-a-constructor}
* instead use {@link (LayoutManager:class).registerComponentConstructor}
* or {@link (LayoutManager:class).registerComponentFactoryFunction}
*/
registerComponent(name: string, componentConstructorOrFactoryFtn: LayoutManager.ComponentConstructor | LayoutManager.ComponentFactoryFunction): void;
/**
* Register a new component type with the layout manager.
*/
registerComponentConstructor(typeName: string, componentConstructor: LayoutManager.ComponentConstructor): void;
/**
* Register a new component with the layout manager.
*/
registerComponentFactoryFunction(typeName: string, componentFactoryFunction: LayoutManager.ComponentFactoryFunction): void;
/**
* Register a component function with the layout manager. This function should
* return a constructor for a component based on a config.
* This function will be called if a component type with the required name is not already registered.
* It is recommended that applications use the {@link (LayoutManager:class).getComponentEvent} and
* {@link (LayoutManager:class).releaseComponentEvent} instead of registering a constructor callback
* @deprecated use {@link (LayoutManager:class).registerGetComponentConstructorCallback}
*/
registerComponentFunction(callback: LayoutManager.GetComponentConstructorCallback): void;
/**
* Register a callback closure with the layout manager which supplies a Component Constructor.
* This callback should return a constructor for a component based on a config.
* This function will be called if a component type with the required name is not already registered.
* It is recommended that applications use the {@link (LayoutManager:class).getComponentEvent} and
* {@link (LayoutManager:class).releaseComponentEvent} instead of registering a constructor callback
*/
registerGetComponentConstructorCallback(callback: LayoutManager.GetComponentConstructorCallback): void;
getRegisteredComponentTypeNames(): string[];
/**
* Returns a previously registered component instantiator. Attempts to utilize registered
* component type by first, then falls back to the component constructor callback function (if registered).
* If neither gets an instantiator, then returns `undefined`.
* Note that `undefined` will return if config.componentType is not a string
*
* @param config - The item config
* @public
*/
getComponentInstantiator(config: ResolvedComponentItemConfig): LayoutManager.ComponentInstantiator | undefined;
/* Excluded from this release type: getComponent */
/* Excluded from this release type: releaseComponent */
/* Excluded from this release type: init */
/**
* Loads a new layout
* @param layoutConfig - New layout to be loaded
*/
loadLayout(layoutConfig: LayoutConfig): void;
/**
* Creates a layout configuration object based on the the current state
*
* @public
* @returns GoldenLayout configuration
*/
saveLayout(): ResolvedLayoutConfig;