1 | import PerfectScrollbar from 'perfect-scrollbar';
|
2 | import { TabBar, Title, Widget } from '@phosphor/widgets';
|
3 | import { VirtualElement, ElementInlineStyle } from '@phosphor/virtualdom';
|
4 | import { DisposableCollection, MenuPath, SelectionService, CommandService } from '../../common';
|
5 | import { ContextMenuRenderer } from '../context-menu-renderer';
|
6 | import { Signal } from '@phosphor/signaling';
|
7 | import { Message } from '@phosphor/messaging';
|
8 | import { TabBarToolbarRegistry, TabBarToolbar } from './tab-bar-toolbar';
|
9 | import { WidgetDecoration } from '../widget-decoration';
|
10 | import { TabBarDecoratorService } from './tab-bar-decorator';
|
11 | import { IconThemeService } from '../icon-theme-service';
|
12 | import { BreadcrumbsRenderer, BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer';
|
13 | import { IDragEvent } from '@phosphor/dragdrop';
|
14 | import { CorePreferences } from '../core-preferences';
|
15 | import { HoverService } from '../hover-service';
|
16 |
|
17 | export declare const SHELL_TABBAR_CONTEXT_MENU: MenuPath;
|
18 | export declare const SHELL_TABBAR_CONTEXT_CLOSE: MenuPath;
|
19 | export declare const SHELL_TABBAR_CONTEXT_COPY: MenuPath;
|
20 | export declare const SHELL_TABBAR_CONTEXT_PIN: MenuPath;
|
21 | export declare const SHELL_TABBAR_CONTEXT_SPLIT: MenuPath;
|
22 | export declare const TabBarRendererFactory: unique symbol;
|
23 | export declare type TabBarRendererFactory = () => TabBarRenderer;
|
24 |
|
25 |
|
26 |
|
27 | export interface SizeData {
|
28 | width: number;
|
29 | height: number;
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 | export interface SideBarRenderData extends TabBar.IRenderData<Widget> {
|
35 | labelSize?: SizeData;
|
36 | iconSize?: SizeData;
|
37 | paddingTop?: number;
|
38 | paddingBottom?: number;
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | export declare class TabBarRenderer extends TabBar.Renderer {
|
48 | protected readonly contextMenuRenderer?: ContextMenuRenderer | undefined;
|
49 | protected readonly decoratorService?: TabBarDecoratorService | undefined;
|
50 | protected readonly iconThemeService?: IconThemeService | undefined;
|
51 | protected readonly selectionService?: SelectionService | undefined;
|
52 | protected readonly commandService?: CommandService | undefined;
|
53 | protected readonly corePreferences?: CorePreferences | undefined;
|
54 | protected readonly hoverService?: HoverService | undefined;
|
55 | |
56 |
|
57 |
|
58 | contextMenuPath?: MenuPath;
|
59 | protected readonly toDispose: DisposableCollection;
|
60 | constructor(contextMenuRenderer?: ContextMenuRenderer | undefined, decoratorService?: TabBarDecoratorService | undefined, iconThemeService?: IconThemeService | undefined, selectionService?: SelectionService | undefined, commandService?: CommandService | undefined, corePreferences?: CorePreferences | undefined, hoverService?: HoverService | undefined);
|
61 | dispose(): void;
|
62 | protected _tabBar?: TabBar<Widget>;
|
63 | protected readonly toDisposeOnTabBar: DisposableCollection;
|
64 | /**
|
65 | * A reference to the tab bar is required in order to activate it when a context menu
|
66 | * is requested.
|
67 | */
|
68 | set tabBar(tabBar: TabBar<Widget> | undefined);
|
69 | get tabBar(): TabBar<Widget> | undefined;
|
70 | /**
|
71 | * Render tabs with the default DOM structure, but additionally register a context menu listener.
|
72 | * @param {SideBarRenderData} data Data used to render the tab.
|
73 | * @param {boolean} isInSidePanel An optional check which determines if the tab is in the side-panel.
|
74 | * @param {boolean} isPartOfHiddenTabBar An optional check which determines if the tab is in the hidden horizontal tab bar.
|
75 | * @returns {VirtualElement} The virtual element of the rendered tab.
|
76 | */
|
77 | renderTab(data: SideBarRenderData, isInSidePanel?: boolean, isPartOfHiddenTabBar?: boolean): VirtualElement;
|
78 | |
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | createTabId(title: Title<Widget>, isPartOfHiddenTabBar?: boolean): string;
|
86 | |
87 |
|
88 |
|
89 |
|
90 | createTabStyle(data: SideBarRenderData): ElementInlineStyle;
|
91 | |
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | renderLabel(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement;
|
99 | renderBadge(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement;
|
100 | renderLock(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement;
|
101 | protected readonly decorations: Map<Title<Widget>, WidgetDecoration.Data[]>;
|
102 | protected resetDecorations(title?: Title<Widget>): void;
|
103 | |
104 |
|
105 |
|
106 |
|
107 | protected getDecorations(title: Title<Widget>): WidgetDecoration.Data[];
|
108 | |
109 |
|
110 |
|
111 |
|
112 |
|
113 | protected getDecorationData<K extends keyof WidgetDecoration.Data>(title: Title<Widget>, key: K): WidgetDecoration.Data[K][];
|
114 | |
115 |
|
116 |
|
117 |
|
118 |
|
119 | private getIconClass;
|
120 | |
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | findDuplicateLabels(titles: Title<Widget>[]): Map<string, string>;
|
131 | |
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | renderIcon(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement;
|
138 | protected handleMouseEnterEvent: (event: MouseEvent) => void;
|
139 | protected handleContextMenuEvent: (event: MouseEvent) => void;
|
140 | protected handleCloseClickEvent: (event: MouseEvent) => void;
|
141 | protected handleDblClickEvent: (event: MouseEvent) => void;
|
142 | }
|
143 |
|
144 |
|
145 |
|
146 | export declare class ScrollableTabBar extends TabBar<Widget> {
|
147 | protected scrollBar?: PerfectScrollbar;
|
148 | private scrollBarFactory;
|
149 | private pendingReveal?;
|
150 | protected readonly toDispose: DisposableCollection;
|
151 | constructor(options?: TabBar.IOptions<Widget> & PerfectScrollbar.Options);
|
152 | dispose(): void;
|
153 | protected onAfterAttach(msg: Message): void;
|
154 | protected onBeforeDetach(msg: Message): void;
|
155 | protected onUpdateRequest(msg: Message): void;
|
156 | protected onResize(msg: Widget.ResizeMessage): void;
|
157 | /**
|
158 | * Reveal the tab with the given index by moving the scroll bar if necessary.
|
159 | */
|
160 | revealTab(index: number): Promise<void>;
|
161 | protected get scrollbarHost(): HTMLElement;
|
162 | }
|
163 | /**
|
164 | * Specialized scrollable tab-bar which comes with toolbar support.
|
165 | * Instead of the following DOM structure.
|
166 | *
|
167 | * +-------------------------+
|
168 | * |[TAB_0][TAB_1][TAB_2][TAB|
|
169 | * +-------------Scrollable--+
|
170 | *
|
171 | * There is a dedicated HTML element for toolbar which does **not** contained in the scrollable element.
|
172 | *
|
173 | * +-------------------------+-----------------+
|
174 | * |[TAB_0][TAB_1][TAB_2][TAB| Toolbar |
|
175 | * +-------------Scrollable--+-Non-Scrollable-+
|
176 | *
|
177 | */
|
178 | export declare class ToolbarAwareTabBar extends ScrollableTabBar {
|
179 | protected readonly tabBarToolbarRegistry: TabBarToolbarRegistry;
|
180 | protected readonly tabBarToolbarFactory: () => TabBarToolbar;
|
181 | protected readonly breadcrumbsRendererFactory: BreadcrumbsRendererFactory;
|
182 | protected readonly options?: (TabBar.IOptions<Widget> & PerfectScrollbar.Options) | undefined;
|
183 | protected contentContainer: HTMLElement;
|
184 | protected toolbar: TabBarToolbar | undefined;
|
185 | protected breadcrumbsContainer: HTMLElement;
|
186 | protected readonly breadcrumbsRenderer: BreadcrumbsRenderer;
|
187 | protected topRow: HTMLElement;
|
188 | constructor(tabBarToolbarRegistry: TabBarToolbarRegistry, tabBarToolbarFactory: () => TabBarToolbar, breadcrumbsRendererFactory: BreadcrumbsRendererFactory, options?: (TabBar.IOptions<Widget> & PerfectScrollbar.Options) | undefined);
|
189 | /**
|
190 | * Overrides the `contentNode` property getter in PhosphorJS' TabBar.
|
191 | */
|
192 | get contentNode(): HTMLUListElement;
|
193 | /**
|
194 | * Overrides the scrollable host from the parent class.
|
195 | */
|
196 | protected get scrollbarHost(): HTMLElement;
|
197 | protected get tabBarContainer(): HTMLElement;
|
198 | protected updateBreadcrumbs(): Promise<void>;
|
199 | protected onAfterAttach(msg: Message): void;
|
200 | protected onBeforeDetach(msg: Message): void;
|
201 | protected onUpdateRequest(msg: Message): void;
|
202 | protected updateToolbar(): void;
|
203 | handleEvent(event: Event): void;
|
204 | /**
|
205 | * Restructures the DOM defined in PhosphorJS.
|
206 | *
|
207 | * By default the tabs (`li`) are contained in the `this.contentNode` (`ul`) which is wrapped in a `div` (`this.node`).
|
208 | * Instead of this structure, we add a container for the `this.contentNode` and for the toolbar.
|
209 | * The scrollbar will only work for the `ul` part but it does not affect the toolbar, so it can be on the right hand-side.
|
210 | */
|
211 | protected rewireDOM(): void;
|
212 | }
|
213 | export declare namespace ToolbarAwareTabBar {
|
214 | namespace Styles {
|
215 | const TAB_BAR_CONTENT = "p-TabBar-content";
|
216 | const TAB_BAR_CONTENT_CONTAINER = "p-TabBar-content-container";
|
217 | }
|
218 | }
|
219 |
|
220 |
|
221 |
|
222 | export declare class SideTabBar extends ScrollableTabBar {
|
223 | private static readonly DRAG_THRESHOLD;
|
224 | |
225 |
|
226 |
|
227 | readonly tabAdded: Signal<this, {
|
228 | title: Title<Widget>;
|
229 | }>;
|
230 | |
231 |
|
232 |
|
233 |
|
234 | readonly collapseRequested: Signal<this, Title<Widget>>;
|
235 | private mouseData?;
|
236 | constructor(options?: TabBar.IOptions<Widget> & PerfectScrollbar.Options);
|
237 | /**
|
238 | * Tab bars of the left and right side panel are arranged vertically by rotating their labels.
|
239 | * Rotation is realized with the CSS `transform` property, which disrupts the browser's ability
|
240 | * to arrange the involved elements automatically. Therefore the elements are arranged explicitly
|
241 | * by the TabBarRenderer using inline `height` and `top` styles. However, the size of labels
|
242 | * must still be computed by the browser, so the rendering is performed in two steps: first the
|
243 | * tab bar is rendered horizontally inside a _hidden content node_, then it is rendered again
|
244 | * vertically inside the proper content node. After the first step, size information is gathered
|
245 | * from all labels so it can be applied during the second step.
|
246 | */
|
247 | get hiddenContentNode(): HTMLUListElement;
|
248 | insertTab(index: number, value: Title<Widget> | Title.IOptions<Widget>): Title<Widget>;
|
249 | protected onAfterAttach(msg: Message): void;
|
250 | protected onAfterDetach(msg: Message): void;
|
251 | protected onUpdateRequest(msg: Message): void;
|
252 | /**
|
253 | * Render the tab bar in the _hidden content node_ (see `hiddenContentNode` for explanation),
|
254 | * then gather size information for labels and render it again in the proper content node.
|
255 | */
|
256 | protected renderTabBar(): void;
|
257 | /**
|
258 | * Render the tab bar using the given DOM element as host. The optional `renderData` is forwarded
|
259 | * to the TabBarRenderer.
|
260 | */
|
261 | protected renderTabs(host: HTMLElement, renderData?: Partial<SideBarRenderData>[]): void;
|
262 | /**
|
263 | * The following event processing is used to generate `collapseRequested` signals
|
264 | * when the mouse goes up on the currently selected tab without too much movement
|
265 | * between `mousedown` and `mouseup`. The movement threshold is the same that
|
266 | * is used by the superclass to detect a drag event. The `allowDeselect` option
|
267 | * of the TabBar constructor cannot be used here because it is triggered when the
|
268 | * mouse goes down, and thus collides with dragging.
|
269 | */
|
270 | handleEvent(event: Event): void;
|
271 | private onMouseDown;
|
272 | private onMouseUp;
|
273 | private onMouseMove;
|
274 | toCancelViewContainerDND: DisposableCollection;
|
275 | protected cancelViewContainerDND: () => void;
|
276 | /**
|
277 | * Handles `viewContainerPart` drag enter.
|
278 | */
|
279 | protected onDragEnter: (event: IDragEvent) => void;
|
280 | /**
|
281 | * Handle `viewContainerPart` drag over,
|
282 | * Defines the appropriate `dropAction` and opens the tab on which the mouse stands on for more than 800 ms.
|
283 | */
|
284 | protected onDragOver: (event: IDragEvent) => void;
|
285 | }
|
286 | //# sourceMappingURL=tab-bars.d.ts.map |
\ | No newline at end of file |