golden-layout
Version:
A multi-screen javascript Layout manager
1,125 lines (1,080 loc) • 105 kB
TypeScript
/** @public */
export declare class ApiError extends ExternalError {
/* Excluded from this release type: __constructor */
}
/* Excluded from this release type: AreaLinkedRect */
/** @public */
export declare class BindError extends ExternalError {
/* Excluded from this release type: __constructor */
}
/**
* 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;
/**
* Retrieves the native BrowserWindow backing this popout.
* Might throw an UnexpectedNullError exception when the window is not initialized yet.
* @public
*/
getWindow(): Window;
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: _boundComponent */
/* 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: _visible */
/* Excluded from this release type: _isShownWithZeroDimensions */
/* Excluded from this release type: _tab */
/* Excluded from this release type: _stackMaximised */
/* Excluded from this release type: _logicalZIndex */
stateRequestEvent: ComponentContainer.StateRequestEventHandler | undefined;
virtualRectingRequiredEvent: ComponentContainer.VirtualRectingRequiredEvent | undefined;
virtualVisibilityChangeRequiredEvent: ComponentContainer.VirtualVisibilityChangeRequiredEvent | undefined;
virtualZIndexChangeRequiredEvent: ComponentContainer.VirtualZIndexChangeRequiredEvent | undefined;
get width(): number;
get height(): number;
get parent(): ComponentItem;
/* Excluded from this release type: componentName */
get componentType(): JsonValue;
get virtual(): boolean;
get component(): ComponentContainer.Component;
get tab(): Tab;
get title(): string;
get layoutManager(): LayoutManager;
get isHidden(): boolean;
get visible(): 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;
/**
* 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: setSize */
/**
* 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: setVisibility */
setBaseLogicalZIndex(): void;
setLogicalZIndex(logicalZIndex: LogicalZIndex): void;
/* Excluded from this release type: enterDragMode */
/* Excluded from this release type: exitDragMode */
/* Excluded from this release type: enterStackMaximised */
/* Excluded from this release type: exitStackMaximised */
/* Excluded from this release type: drag */
/* Excluded from this release type: setSizeToNodeSize */
/* Excluded from this release type: notifyVirtualRectingRequired */
/* Excluded from this release type: notifyVirtualZIndexChangeRequired */
/* Excluded from this release type: updateElementPositionPropertyFromBoundComponent */
/* Excluded from this release type: addVirtualSizedContainerToLayoutManager */
/* Excluded from this release type: checkShownFromZeroDimensions */
/* Excluded from this release type: emitShow */
/* Excluded from this release type: emitHide */
/* Excluded from this release type: releaseComponent */
}
/** @public */
export declare namespace ComponentContainer {
export type Component = unknown;
export interface BindableComponent {
component: Component;
virtual: boolean;
}
export type StateRequestEventHandler = (this: void) => JsonValue | undefined;
export type VirtualRectingRequiredEvent = (this: void, container: ComponentContainer, width: number, height: number) => void;
export type VirtualVisibilityChangeRequiredEvent = (this: void, container: ComponentContainer, visible: boolean) => void;
export type VirtualZIndexChangeRequiredEvent = (this: void, container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) => void;
/* 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(): ComponentContainer.Component | undefined;
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: enterDragMode */
/* Excluded from this release type: exitDragMode */
/* Excluded from this release type: enterStackMaximised */
/* Excluded from this release type: exitStackMaximised */
/* Excluded from this release type: drag */
/* 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 = ComponentContainer.Component;
}
/** @public */
export declare interface ComponentItemConfig extends HeaderedItemConfig {
type: 'component';
readonly content?: [];
/**
* The title of the item as displayed on its tab and on popout windows
* Default: componentType.toString() or ''
*/
title?: string;
/**
* 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 (GoldenLayout:class).registerComponent} (deprecated)
* * {@link (GoldenLayout:class).registerComponentConstructor}
* * {@link (GoldenLayout: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 {
/* Excluded from this release type: resolve */
/* Excluded from this release type: fromResolved */
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: size */
/* Excluded from this release type: sizeUnit */
/* Excluded from this release type: minSize */
/* Excluded from this release type: minSizeUnit */
isGround: boolean;
isRow: boolean;
isColumn: boolean;
isStack: boolean;
isComponent: boolean;
get type(): ItemType;
get id(): string;
set id(value: 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
* @param contentItem - The child item to remove
* @param keepChild - Whether to destroy the removed item
*/
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: _id */
/* 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 {
/** @deprecated use Config {@link (ComponentItemConfig:interface)} */
export interface ComponentItemConfig {
type: JsonValue;
state?: JsonValue;
title?: string;
}
/** @deprecated remove in version 3 */
export function isDragSourceComponentItemConfig(config: DragSource.ComponentItemConfig | ComponentItemConfig): config is DragSource.ComponentItemConfig;
}
/* 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.
* @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": ComponentItemParam;
"close": NoParams;
"closed": NoParams;
"destroy": NoParams;
"drag": DragParams;
"dragStart": DragStartParams;
"dragStop": DragStopParams;
"hide": NoParams;
"initialised": NoParams;
"itemDropped": ComponentItemParam;
"maximised": NoParams;
"minimised": NoParams;
"open": NoParams;
"popIn": NoParams;
"resize": NoParams;
"show": NoParams;
/** @deprecated - use show instead */
"shown": NoParams;
"stateChanged": NoParams;
"tab": TabParam;
"tabCreated": TabParam;
"titleChanged": StringParam;
"windowClosed": PopoutParam;
"windowOpened": PopoutParam;
"beforeComponentRelease": BeforeComponentReleaseParams;
"beforeItemDestroyed": BubblingEventParam;
"itemCreated": BubblingEventParam;
"itemDestroyed": BubblingEventParam;
"focus": BubblingEventParam;
"blur": BubblingEventParam;
"stackHeaderClick": ClickBubblingEventParam;
"stackHeaderTouchStart": TouchStartBubblingEventParam;
"userBroadcast": UnknownParams;
}
export type UnknownParams = unknown[];
export type NoParams = [];
export type UnknownParam = [unknown];
export type PopoutParam = [BrowserPopout];
export type ComponentItemParam = [ComponentItem];
export type TabParam = [Tab];
export type BubblingEventParam = [EventEmitter.BubblingEvent];
export type StringParam = [string];
export type DragStartParams = [originalX: number, originalY: number];
export type DragStopParams = [event: PointerEvent | undefined];
export type DragParams = [offsetX: number, offsetY: number, event: PointerEvent];
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 */
}
}
/**
* An EventEmitter singleton that propagates events
* across multiple windows. This is a little bit trickier since
* windows are allowed to open childWindows in their own right.
*
* This means that we deal with a tree of windows. Therefore, we do the event propagation in two phases:
*
* - Propagate events from this layout to the parent layout
* - Repeat until the event arrived at the root layout
* - Propagate events to this layout and to all children
* - Repeat until all layouts got the event
*
* **WARNING**: Only userBroadcast events are propagated between windows.
* This means the you have to take care of propagating state changes between windows yourself.
*
* @public
*/
export declare class EventHub extends EventEmitter {
/* Excluded from this release type: _layoutManager */
/* Excluded from this release type: _childEventListener */
/* Excluded from this release type: __constructor */
/**
* Emit an event and notify listeners
*
* @param eventName - The name of the event
* @param args - Additional arguments that will be passed to the listener
* @public
*/
emit<K extends keyof EventEmitter.EventParamsMap>(eventName: K, ...args: EventEmitter.EventParamsMap[K]): void;
/**
* Broadcasts a message to all other currently opened windows.
* @public
*/
emitUserBroadcast(...args: EventEmitter.UnknownParams): void;
/* Excluded from this release type: destroy */
/* Excluded from this release type: handleUserBroadcastEvent */
/* Excluded from this release type: onEventFromChild */
/* Excluded from this release type: propagateToParent */
/* Excluded from this release type: propagateToThisAndSubtree */
}
/** @public */
export declare namespace EventHub {
/* Excluded from this release type: ChildEventName */
/* Excluded from this release type: ChildEventDetail */
/* Excluded from this release type: ChildEventInit */
}
/** @public */
export declare abstract class ExternalError extends Error {
readonly type: string;
/* Excluded from this release type: __constructor */
}
/* Excluded from this release type: formatSize */
/* Excluded from this release type: formatUndefinableSize */
/** @public */
export declare class GoldenLayout extends VirtualLayout {
/* Excluded from this release type: _componentTypesMap */
/* Excluded from this release type: _getComponentConstructorFtn */
/* Excluded from this release type: _registeredComponentMap */
/* Excluded from this release type: _virtuableComponentMap */
/* Excluded from this release type: _goldenLayoutBoundingClientRect */
/* Excluded from this release type: _containerVirtualRectingRequiredEventListener */
/* Excluded from this release type: _containerVirtualVisibilityChangeRequiredEventListener */
/* Excluded from this release type: _containerVirtualZIndexChangeRequiredEventListener */
/**
* @param container - A Dom HTML element. Defaults to body
* @param bindComponentEventHandler - Event handler to bind components
* @param bindComponentEventHandler - Event handler to unbind components
* If bindComponentEventHandler is defined, then constructor will be determinate. It will always call the init()
* function and the init() function will always complete. This means that the bindComponentEventHandler will be called
* if constructor is for a popout window. Make sure bindComponentEventHandler is ready for events.
*/
constructor(container?: HTMLElement, bindComponentEventHandler?: VirtualLayout.BindComponentEventHandler, unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler);
/** @deprecated specify layoutConfig in {@link (LayoutManager:class).loadLayout} */
constructor(config: LayoutConfig, container?: HTMLElement);
/**
* 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 (GoldenLayout:class).registerComponentConstructor}
* or {@link (GoldenLayout:class).registerComponentFactoryFunction}
*/
registerComponent(name: string, componentConstructorOrFactoryFtn: GoldenLayout.ComponentConstructor | GoldenLayout.ComponentFactoryFunction, virtual?: boolean): void;
/**
* Register a new component type with the layout manager.
*/
registerComponentConstructor(typeName: string, componentConstructor: GoldenLayout.ComponentConstructor, virtual?: boolean): void;
/**
* Register a new component with the layout manager.
*/
registerComponentFactoryFunction(typeName: string, componentFactoryFunction: GoldenLayout.ComponentFactoryFunction, virtual?: boolean): 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 (VirtualLayout:class).getComponentEvent} and
* {@link (VirtualLayout:class).releaseComponentEvent} instead of registering a constructor callback
* @deprecated use {@link (GoldenLayout:class).registerGetComponentConstructorCallback}
*/
registerComponentFunction(callback: GoldenLayout.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 (VirtualLayout:class).getComponentEvent} and
* {@link (VirtualLayout:class).releaseComponentEvent} instead of registering a constructor callback
*/
registerGetComponentConstructorCallback(callback: GoldenLayout.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): GoldenLayout.ComponentInstantiator | undefined;
/* Excluded from this release type: bindComponent */
/* Excluded from this release type: unbindComponent */
fireBeforeVirtualRectingEvent(count: number): void;
/* Excluded from this release type: handleContainerVirtualRectingRequiredEvent */
/* Excluded from this release type: handleContainerVirtualVisibilityChangeRequiredEvent */
/* Excluded from this release type: handleContainerVirtualZIndexChangeRequiredEvent */
}
/** @public */
export declare namespace GoldenLayout {
export interface VirtuableComponent {
rootHtmlElement: HTMLElement;
}
export type ComponentConstructor = new (container: ComponentContainer, state: JsonValue | undefined, virtual: boolean) => ComponentContainer.Component;
export type ComponentFactoryFunction = (container: ComponentContainer, state: JsonValue | undefined, virtual: boolean) => ComponentContainer.Component | undefined;
export type GetComponentConstructorCallback = (this: void, config: ResolvedComponentItemConfig) => ComponentConstructor;
export interface ComponentInstantiator {
constructor: ComponentConstructor | undefined;
factoryFunction: ComponentFactoryFunction | undefined;
virtual: boolean;
}
}
/* 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: _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: _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: _popoutButton */
/* Excluded from this release type: _tabDropdownButton */
/* Excluded from this release type: _maximiseButton */
get show(): boolean;
get side(): Side;
get leftRightSided(): boolean;
get layoutManager(): LayoutManager;
get parent(): Stack;
get tabs(): Tab[];
get lastVisibleTabIndex(): number;
get element(): HTMLElement;
get tabsContainerElement(): HTMLElement;
get controlsContainerElement(): 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: 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: 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: 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;
}
/* Excluded from this release type: resolveIdAndMaximised */
}
/** @public */
export declare const enum I18nStringId {
PopoutCannotBeCreatedWithGroundItemConfig = 0,
PleaseRegisterAConstructorFunction = 1,
ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned = 2,
ComponentIsAlreadyRegistered = 3,
ComponentIsNotVirtuable = 4,
VirtualComponentDoesNotHaveRootHtmlElement = 5,
ItemConfigIsNotTypeComponent = 6,
InvalidNumberPartInSizeString = 7,
UnknownUnitInSizeString = 8,
UnsupportedUnitInSizeString = 9
}
/** @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
* @deprecated use {@link (ItemConfig:interface).size} instead
*/
width?: number;
/**
* The minimum width of this item in pixels
* CAUTION - Not tested - do not use
* @deprecated use {@link (ItemConfig:interface).minSize} instead
*/
minWidth?: number;
/**
* The height of this item, relative to the other children of its parent in percent
* @deprecated use {@link (ItemConfig:interface).size} instead
*/
height?: number;
/**
* The minimum height of this item in pixels
* CAUTION - Not tested - do not use
* @deprecated use {@link (ItemConfig:interface).minSize} instead
*/
minHeight?: number;
/**
* The size of this item.
* For rows, it specifies height. For columns, it specifies width.
* Has format \<number\>\<{@link SizeUnit}\>. Currently only supports units `fr` and `%`.
*
* Space is first proportionally allocated to items with sizeUnit `%`.
* If there is any space left over (less than 100% allocated), then the
* remainder is allocated to the items with unit `fr` according to the fractional size.
* If more than 100% is allocated, then an extra 50% is allocated to items with unit `fr` and
* is allocated to each item according to its fractional size. All item sizes are then adjusted
* to bring the total back to 100%
*/
size?: string;
/**
* The size of this item.
* For rows, it specifies height. For columns, it specifies width.
* Has format <number><sizeUnit>. Currently only supports units `px`
*/
minSize?: string;
/**
* 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 ''
* @deprecated only Component has a title
*/
title?: string;
}
/** @public */
export declare namespace ItemConfig {
/* Excluded from this release type: SizeWidthHeightSpecificationType */
/* Excluded from this release type: resolve */
/* Excluded from this release type: resolveContent */
/* Excluded from this release type: resolveId */
/* Excluded from this release type: resolveSize */
/* Excluded from this release type: resolveMinSize */
/* Excluded from this release type: calculateSizeWidthHeightSpecificationType */
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 | undefined;
/** @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
* @deprecated Will be removed in version 3.
*/
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).
* @deprecated use {@link (LayoutConfig:namespace).(Dimensions:interface).defaultMinItemHeight} instead
*/
minItemHeight?: number;
/**
* The minimum height an item can be resized to.
* Default: 0
*/
defaultMinItemHeight?: string;
/**
* The minimum width an item can be resized to (in pixel).
* @deprecated use {@link (LayoutConfig:namespace).(Dimensions:interface).defaultMinItemWidth} instead
*/
minItemWidth?: number;
/**
* The minimum width an item can be resized to.
* Default: 10px
*/
defaultMinItemWidth?: string;
/**
* 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 {
/* Exclude