UNPKG

@deephaven/golden-layout

Version:

A multi-screen javascript Layout manager

108 lines 3.18 kB
import type { AbstractContentItem } from '../items'; import type Header from './Header'; /** * Represents an individual tab within a Stack's header * * @param header * @param contentItem */ export default class Tab { /** * The tab's html template */ private static _template; header: Header; contentItem: AbstractContentItem; element: JQuery<HTMLElement>; titleElement: JQuery<HTMLElement>; closeElement: JQuery<HTMLElement>; isActive: boolean; private _layoutManager; private _dragListener?; constructor(header: Header, contentItem: AbstractContentItem); /** * Sets the tab's title to the provided string and sets * its title attribute to a pure text representation (without * html tags) of the same string. * @param title can contain html */ setTitle(title?: string): void; /** * Updates the content item this tab is associated with. * Properly transfers event listeners from the old content item to the new one. * @param newContentItem The new content item */ setContentItem(newContentItem: AbstractContentItem): void; /** * Sets this tab's active state. To programmatically * switch tabs, use header.setActiveContentItem( item ) instead. * @param isActive */ setActive(isActive: boolean): void; /** * Destroys the tab * * @private * @returns {void} */ _$destroy(): void; /** * Callback for the DragListener * * @param x The tabs absolute x position * @param y The tabs absolute y position */ _onDragStart(x: number, y: number): void; /** * Callback when the contentItem is focused in */ _onTabContentFocusIn(event?: JQuery.TriggeredEvent): void; /** * Callback when the contentItem is focused out * * @param {jQuery DOM event} event * * @private * @returns {void} */ _onTabContentFocusOut(): void; /** * Callback when the tab is clicked * * @param event */ _onTabClick(event?: JQuery.TriggeredEvent): void; /** * Callback when the tab's close button is * clicked * * @param event */ _onCloseClick(event: JQuery.TriggeredEvent): void; /** * Callback to prevent paste into active input on Linux * when closing a tab via middle click. * @param event */ _onMouseUp(event: JQuery.TriggeredEvent): void; /** * Callback to capture tab close button mousedown * to prevent tab from activating. * * @param event */ _onCloseMousedown(event: Event): void; /** * Returns true if the given element is inside this content item's * container but within a nested LayoutManager (i.e. a dashboard * embedded inside this tab's component). Such focus belongs to the * nested layout's tab, not this outer one. */ private _isInNestedLayout; /** * Returns true if the document's active element is inside this tab's * container directly (not inside a nested LayoutManager). */ private _isFocusDirectlyInContainer; } //# sourceMappingURL=Tab.d.ts.map