UNPKG

@deephaven/golden-layout

Version:

A multi-screen javascript Layout manager

148 lines 5.23 kB
import { StackItemHeaderConfig } from '../config'; import type { AbstractContentItem, Stack } from '../items'; import type LayoutManager from '../LayoutManager'; import { EventEmitter } from '../utils'; import HeaderButton from './HeaderButton'; import Tab from './Tab'; /** * This class represents a header above a Stack ContentItem. * * @param layoutManager * @param parent */ export default class Header extends EventEmitter { private static _template; private static _previousButtonTemplate; private static _nextButtonTemplate; layoutManager: LayoutManager; element: JQuery<HTMLElement>; tabsContainer: JQuery<HTMLElement>; tabDropdownContainer: JQuery<HTMLElement>; tabDropdownSearch: JQuery<HTMLElement>; tabDropdownList: JQuery<HTMLElement> | null; controlsContainer: JQuery<HTMLElement>; parent: Stack; tabs: Tab[]; activeContentItem: AbstractContentItem | null; closeButton: HeaderButton | null; tabDropdownButton: HeaderButton | null; tabNextButton: JQuery<HTMLElement>; tabPreviousButton: JQuery<HTMLElement>; holdTimer: number | null; rAF: number | null; CLICK_TIMEOUT: number; START_SPEED: number; ACCELERATION: number; PADDING: 10; SCROLL_LEFT: "left"; SCROLL_RIGHT: "right"; isDraggingTab: boolean; isOverflowing: boolean; isDropdownShown: boolean; dropdownKeyIndex: number; private _lastVisibleTabIndex; private _tabControlOffset?; constructor(layoutManager: LayoutManager, parent: Stack); /** * Creates a new tab and associates it with a contentItem * * @param contentItem * @param index The position of the tab */ createTab(contentItem: AbstractContentItem, index?: number): void; /** * Finds a tab based on the contentItem its associated with and removes it. * * @param contentItem */ removeTab(contentItem: AbstractContentItem): void; /** * The programmatical equivalent of clicking a Tab. * * @param contentItem */ setActiveContentItem(contentItem: AbstractContentItem): void; /** * Programmatically operate with header position. * * @param position one of ('top','left','right','bottom') to set or empty to get it. * * @returns previous header position */ position(position?: 'top' | 'left' | 'right' | 'bottom'): boolean | "top" | "left" | "right" | "bottom" | undefined; _attachWheelListener(): void; _detachWheelListener(): void; _handleWheelEvent(event: WheelEvent): void; _handleScrollEvent(): void; _handleItemPickedUp(): void; _handleItemDropped(): void; _handleNextMouseEnter(): void; _handlePreviousMouseEnter(): void; _handleNextMouseLeave(): void; _handlePreviousMouseLeave(): void; _handleNextButtonMouseDown(): void; _handlePreviousButtonMouseDown(): void; _handleScrollButtonMouseDown(direction: 'right' | 'left'): void; _handleScrollButtonMouseUp(): void; _checkScrollArrows(): void; _handleScrollRepeat(direction: 'left' | 'right', startX: number, deltaX?: number, prevTimestamp?: number): void; /** * Programmatically set closability. * @param isClosable Whether to enable/disable closability. * @returns Whether the action was successful */ _$setClosable(isClosable: boolean): boolean; /** * Destroys the entire header */ _$destroy(): void; /** * get settings from header * * @returns when exists */ _getHeaderSetting<N extends 'show' | 'popout' | 'maximise' | 'close' | 'minimise'>(name: N): StackItemHeaderConfig[N]; /** * Creates the popout, maximise and close buttons in the header's top right corner */ _createControls(): void; /** * Shows drop down for additional tabs when there are too many to display. * * @returns {void} */ _showAdditionalTabsDropdown(): void; _handleFilterKeydown(e: JQuery.TriggeredEvent): void; _handleFilterInput(event: JQuery.TriggeredEvent): void; /** * Hides drop down for additional tabs when needed. It is called via mousedown * event on document when list is open, or programmatically when drag starts, * or active tab changes etc. */ _hideAdditionalTabsDropdown(event?: JQuery.UIEventBase): void; /** * Ensures additional tab drop down which is absolutely positioned in the root * doesn't overflow the screen, and instead becomes scrollable. Positions the * floating menu in the correct location relative to the dropdown button. */ _updateAdditionalTabsDropdown(): void; /** * Checks whether the header is closable based on the parent config and * the global config. * * @returns Whether the header is closable. */ _isClosable(): boolean; _onPopoutClick(): void; /** * Invoked when the header's background is clicked (not it's tabs or controls) * * @param event */ _onHeaderClick(event: JQuery.UIEventBase): void; /** * Pushes the tabs to the tab dropdown if the available space is not sufficient */ _updateTabSizes(): void; } //# sourceMappingURL=Header.d.ts.map