1 | import { interfaces } from 'inversify';
|
2 | import { IIterator } from '@phosphor/algorithm';
|
3 | import { Widget, Message, SplitPanel, BaseWidget, SplitLayout, LayoutItem, PanelLayout, DockPanel } from './widgets';
|
4 | import { Event as CommonEvent, Emitter } from '../common/event';
|
5 | import { Disposable, DisposableCollection } from '../common/disposable';
|
6 | import { CommandRegistry } from '../common/command';
|
7 | import { MenuModelRegistry, MenuPath } from '../common/menu';
|
8 | import { ApplicationShell, StatefulWidget, SplitPositionHandler } from './shell';
|
9 | import { FrontendApplicationStateService } from './frontend-application-state';
|
10 | import { ContextMenuRenderer, Anchor } from './context-menu-renderer';
|
11 | import { TabBarToolbarRegistry, TabBarToolbarFactory, TabBarToolbar, TabBarDelegator, TabBarToolbarItem } from './shell/tab-bar-toolbar';
|
12 | import { WidgetManager } from './widget-manager';
|
13 | import { ProgressBarFactory } from './progress-bar-factory';
|
14 | import { IDragEvent } from '@phosphor/dragdrop';
|
15 | import { TabBarDecoratorService } from './shell/tab-bar-decorator';
|
16 | export interface ViewContainerTitleOptions {
|
17 | label: string;
|
18 | caption?: string;
|
19 | iconClass?: string;
|
20 | closeable?: boolean;
|
21 | }
|
22 | export declare class ViewContainerIdentifier {
|
23 | id: string;
|
24 | progressLocationId?: string;
|
25 | }
|
26 | export interface DescriptionWidget {
|
27 | description: string;
|
28 | onDidChangeDescription: CommonEvent<void>;
|
29 | }
|
30 | export interface BadgeWidget {
|
31 | badge?: number;
|
32 | onDidChangeBadge: CommonEvent<void>;
|
33 | }
|
34 | export declare namespace DescriptionWidget {
|
35 | function is(arg: unknown): arg is DescriptionWidget;
|
36 | }
|
37 | export declare namespace BadgeWidget {
|
38 | function is(arg: unknown): arg is BadgeWidget;
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | export declare class ViewContainer extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider, TabBarDelegator {
|
46 | protected panel: SplitPanel;
|
47 | protected currentPart: ViewContainerPart | undefined;
|
48 | |
49 |
|
50 |
|
51 | disableDNDBetweenContainers: boolean;
|
52 | protected readonly applicationStateService: FrontendApplicationStateService;
|
53 | protected readonly contextMenuRenderer: ContextMenuRenderer;
|
54 | protected readonly commandRegistry: CommandRegistry;
|
55 | protected readonly menuRegistry: MenuModelRegistry;
|
56 | protected readonly widgetManager: WidgetManager;
|
57 | protected readonly splitPositionHandler: SplitPositionHandler;
|
58 | readonly options: ViewContainerIdentifier;
|
59 | protected readonly toolbarRegistry: TabBarToolbarRegistry;
|
60 | protected readonly toolbarFactory: TabBarToolbarFactory;
|
61 | protected readonly onDidChangeTrackableWidgetsEmitter: Emitter<Widget[]>;
|
62 | readonly onDidChangeTrackableWidgets: CommonEvent<Widget[]>;
|
63 | protected readonly progressBarFactory: ProgressBarFactory;
|
64 | protected readonly shell: ApplicationShell;
|
65 | protected readonly decoratorService: TabBarDecoratorService;
|
66 | protected init(): void;
|
67 | protected configureLayout(layout: PanelLayout): void;
|
68 | protected readonly toDisposeOnCurrentPart: DisposableCollection;
|
69 | protected updateCurrentPart(part?: ViewContainerPart): void;
|
70 | protected updateSplitterVisibility(): void;
|
71 | protected titleOptions: ViewContainerTitleOptions | undefined;
|
72 | setTitleOptions(titleOptions: ViewContainerTitleOptions | undefined): void;
|
73 | protected readonly toDisposeOnUpdateTitle: DisposableCollection;
|
74 | protected _tabBarDelegate: Widget;
|
75 | updateTabBarDelegate(): void;
|
76 | getTabBarDelegate(): Widget | undefined;
|
77 | protected updateTitle(): void;
|
78 | protected updateToolbarItems(allParts: ViewContainerPart[]): void;
|
79 | protected getToggleVisibilityGroupLabel(): string;
|
80 | protected registerToolbarItem(commandId: string, options?: Partial<Omit<TabBarToolbarItem, 'id' | 'command'>>): void;
|
81 | protected findOriginalPart(): ViewContainerPart | undefined;
|
82 | protected isCurrentTitle(titleOptions: ViewContainerTitleOptions | undefined): boolean;
|
83 | protected findPartForAnchor(anchor: Anchor): ViewContainerPart | undefined;
|
84 | protected readonly toRemoveWidgets: Map<string, DisposableCollection>;
|
85 | protected createPartId(widget: Widget): string;
|
86 | addWidget(widget: Widget, options?: ViewContainer.Factory.WidgetOptions, originalContainerId?: string, originalContainerTitle?: ViewContainerTitleOptions): Disposable;
|
87 | protected attachNewPart(newPart: ViewContainerPart, insertIndex?: number): Disposable;
|
88 | protected createPart(widget: Widget, partId: string, originalContainerId: string, originalContainerTitle?: ViewContainerTitleOptions, options?: ViewContainer.Factory.WidgetOptions): ViewContainerPart;
|
89 | removeWidget(widget: Widget): boolean;
|
90 | getParts(): ViewContainerPart[];
|
91 | protected getPartIndex(partId: string | undefined): number;
|
92 | getPartFor(widget: Widget): ViewContainerPart | undefined;
|
93 | get containerLayout(): ViewContainerLayout;
|
94 | protected get orientation(): SplitLayout.Orientation;
|
95 | protected get enableAnimation(): boolean;
|
96 | protected lastVisibleState: ViewContainer.State | undefined;
|
97 | storeState(): ViewContainer.State;
|
98 | protected doStoreState(): ViewContainer.State;
|
99 | restoreState(state: ViewContainer.State): void;
|
100 | protected doRestoreState(state: ViewContainer.State): void;
|
101 | |
102 |
|
103 |
|
104 | protected registerPart(toRegister: ViewContainerPart): void;
|
105 | |
106 |
|
107 |
|
108 |
|
109 | protected refreshMenu(part: ViewContainerPart): void;
|
110 | protected unregisterPart(part: ViewContainerPart): void;
|
111 | protected get contextMenuPath(): MenuPath;
|
112 | protected toggleVisibilityCommandId(part: ViewContainerPart): string;
|
113 | protected get globalHideCommandId(): string;
|
114 | protected moveBefore(toMovedId: string, moveBeforeThisId: string): void;
|
115 | getTrackableWidgets(): Widget[];
|
116 | protected fireDidChangeTrackableWidgets(): void;
|
117 | activateWidget(id: string): Widget | undefined;
|
118 | revealWidget(id: string): Widget | undefined;
|
119 | protected revealPart(id: string): ViewContainerPart | undefined;
|
120 | protected onActivateRequest(msg: Message): void;
|
121 | protected onAfterAttach(msg: Message): void;
|
122 | protected onBeforeHide(msg: Message): void;
|
123 | protected onAfterShow(msg: Message): void;
|
124 | protected onBeforeAttach(msg: Message): void;
|
125 | protected onAfterDetach(msg: Message): void;
|
126 | handleEvent(event: Event): void;
|
127 | handleDragEnter(event: IDragEvent): void;
|
128 | toDisposeOnDragEnd: DisposableCollection;
|
129 | handleDragOver(event: IDragEvent): void;
|
130 | handleDragLeave(event: IDragEvent): void;
|
131 | handleDrop(event: IDragEvent): void;
|
132 | protected registerDND(part: ViewContainerPart): Disposable;
|
133 | protected getDockPanel(): DockPanel | undefined;
|
134 | protected isSideDockPanel(widget: Widget): boolean;
|
135 | }
|
136 | export declare namespace ViewContainer {
|
137 | const Factory: unique symbol;
|
138 | interface Factory {
|
139 | (options: ViewContainerIdentifier): ViewContainer;
|
140 | }
|
141 | namespace Factory {
|
142 | interface WidgetOptions {
|
143 | readonly order?: number;
|
144 | readonly weight?: number;
|
145 | readonly initiallyCollapsed?: boolean;
|
146 | readonly canHide?: boolean;
|
147 | readonly initiallyHidden?: boolean;
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 | readonly disableDraggingToOtherContainers?: boolean;
|
154 | }
|
155 | interface WidgetDescriptor {
|
156 | readonly widget: Widget | interfaces.ServiceIdentifier<Widget>;
|
157 | readonly options?: WidgetOptions;
|
158 | }
|
159 | }
|
160 | interface State {
|
161 | title?: ViewContainerTitleOptions;
|
162 | parts: ViewContainerPart.State[];
|
163 | }
|
164 | function getOrientation(node: HTMLElement): 'horizontal' | 'vertical';
|
165 | }
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | export declare class ViewContainerPart extends BaseWidget {
|
171 | readonly wrapped: Widget;
|
172 | readonly partId: string;
|
173 | protected currentContainerId: string;
|
174 | readonly originalContainerId: string;
|
175 | readonly originalContainerTitle: ViewContainerTitleOptions | undefined;
|
176 | protected readonly toolbarRegistry: TabBarToolbarRegistry;
|
177 | protected readonly toolbarFactory: TabBarToolbarFactory;
|
178 | readonly options: ViewContainer.Factory.WidgetOptions;
|
179 | protected readonly header: HTMLElement;
|
180 | protected readonly body: HTMLElement;
|
181 | protected readonly collapsedEmitter: Emitter<boolean>;
|
182 | protected readonly contextMenuEmitter: Emitter<MouseEvent>;
|
183 | protected readonly onTitleChangedEmitter: Emitter<void>;
|
184 | readonly onTitleChanged: CommonEvent<void>;
|
185 | protected readonly onDidFocusEmitter: Emitter<this>;
|
186 | readonly onDidFocus: CommonEvent<this>;
|
187 | protected readonly onPartMovedEmitter: Emitter<ViewContainer>;
|
188 | readonly onDidMove: CommonEvent<ViewContainer>;
|
189 | protected readonly onDidChangeDescriptionEmitter: Emitter<void>;
|
190 | readonly onDidChangeDescription: CommonEvent<void>;
|
191 | protected readonly onDidChangeBadgeEmitter: Emitter<void>;
|
192 | readonly onDidChangeBadge: CommonEvent<void>;
|
193 | protected readonly toolbar: TabBarToolbar;
|
194 | protected _collapsed: boolean;
|
195 | uncollapsedSize: number | undefined;
|
196 | animatedSize: number | undefined;
|
197 | protected readonly toNoDisposeWrapped: Disposable;
|
198 | constructor(wrapped: Widget, partId: string, currentContainerId: string, originalContainerId: string, originalContainerTitle: ViewContainerTitleOptions | undefined, toolbarRegistry: TabBarToolbarRegistry, toolbarFactory: TabBarToolbarFactory, options?: ViewContainer.Factory.WidgetOptions);
|
199 | get viewContainer(): ViewContainer | undefined;
|
200 | get currentViewContainerId(): string;
|
201 | get headerElement(): HTMLElement;
|
202 | get collapsed(): boolean;
|
203 | set collapsed(collapsed: boolean);
|
204 | onPartMoved(newContainer: ViewContainer): void;
|
205 | setHidden(hidden: boolean): void;
|
206 | get canHide(): boolean;
|
207 | get onCollapsed(): CommonEvent<boolean>;
|
208 | get onContextMenu(): CommonEvent<MouseEvent>;
|
209 | get minSize(): number;
|
210 | protected readonly toShowHeader: DisposableCollection;
|
211 | showTitle(): void;
|
212 | hideTitle(): void;
|
213 | get titleHidden(): boolean;
|
214 | protected getScrollContainer(): HTMLElement;
|
215 | protected registerContextMenu(): Disposable;
|
216 | protected createContent(): {
|
217 | header: HTMLElement;
|
218 | body: HTMLElement;
|
219 | disposable: Disposable;
|
220 | };
|
221 | protected createHeader(): {
|
222 | header: HTMLElement;
|
223 | disposable: Disposable;
|
224 | };
|
225 | protected onResize(msg: Widget.ResizeMessage): void;
|
226 | protected onUpdateRequest(msg: Message): void;
|
227 | protected onAfterAttach(msg: Message): void;
|
228 | protected onBeforeDetach(msg: Message): void;
|
229 | protected onBeforeShow(msg: Message): void;
|
230 | protected onAfterShow(msg: Message): void;
|
231 | protected onBeforeHide(msg: Message): void;
|
232 | protected onAfterHide(msg: Message): void;
|
233 | protected onChildRemoved(msg: Widget.ChildMessage): void;
|
234 | protected onActivateRequest(msg: Message): void;
|
235 | }
|
236 | export declare namespace ViewContainerPart {
|
237 | |
238 |
|
239 |
|
240 | const HEADER_HEIGHT = 22;
|
241 | interface State {
|
242 | widget?: Widget;
|
243 | partId: string;
|
244 | collapsed: boolean;
|
245 | hidden: boolean;
|
246 | relativeSize?: number;
|
247 | description?: string;
|
248 |
|
249 | originalContainerId: string;
|
250 | originalContainerTitle?: ViewContainerTitleOptions;
|
251 | }
|
252 | function closestPart(element: Element | EventTarget | null, selector?: string): Element | undefined;
|
253 | }
|
254 | export declare class ViewContainerLayout extends SplitLayout {
|
255 | protected options: ViewContainerLayout.Options;
|
256 | protected readonly splitPositionHandler: SplitPositionHandler;
|
257 | constructor(options: ViewContainerLayout.Options, splitPositionHandler: SplitPositionHandler);
|
258 | protected get items(): ReadonlyArray<LayoutItem & ViewContainerLayout.Item>;
|
259 | iter(): IIterator<ViewContainerPart>;
|
260 | get widgets(): ViewContainerPart[];
|
261 | attachWidget(index: number, widget: ViewContainerPart): void;
|
262 | getPartSize(part: ViewContainerPart): number | undefined;
|
263 | /**
|
264 | * Set the sizes of the view container parts according to the given weights
|
265 | * by moving the split handles. This is similar to `setRelativeSizes` defined
|
266 | * in `SplitLayout`, but here we properly consider the collapsed / expanded state.
|
267 | */
|
268 | setPartSizes(weights: (number | undefined)[]): void;
|
269 | /**
|
270 | * Determine the size of the split panel area that is available for widget content,
|
271 | * i.e. excluding part headers and split handles.
|
272 | */
|
273 | getAvailableSize(): number;
|
274 | /**
|
275 | * Update a view container part that has been collapsed or expanded. The transition
|
276 | * to the new state is animated.
|
277 | */
|
278 | updateCollapsed(part: ViewContainerPart, enableAnimation: boolean): void;
|
279 | updateSashes(): void;
|
280 | protected getFirstUncollapsedWidgetIndex(): number | undefined;
|
281 | protected getLastUncollapsedWidgetIndex(): number | undefined;
|
282 | protected onFitRequest(msg: Message): void;
|
283 | /**
|
284 | * Sinusoidal tween function for smooth animation.
|
285 | */
|
286 | protected tween(t: number): number;
|
287 | setHandlePosition(index: number, position: number): Promise<void>;
|
288 | }
|
289 | export declare namespace ViewContainerLayout {
|
290 | interface Options extends SplitLayout.IOptions {
|
291 | headerSize: number;
|
292 | animationDuration: number;
|
293 | }
|
294 | interface Item {
|
295 | readonly widget: ViewContainerPart;
|
296 | }
|
297 | }
|
298 |
|
\ | No newline at end of file |