1 | import { Message } from '@lumino/messaging';
|
2 | import { ISignal } from '@lumino/signaling';
|
3 | import { DockLayout } from './docklayout';
|
4 | import { TabBar } from './tabbar';
|
5 | import { Widget } from './widget';
|
6 |
|
7 |
|
8 |
|
9 | export declare class DockPanel extends Widget {
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 | constructor(options?: DockPanel.IOptions);
|
16 | /**
|
17 | * Dispose of the resources held by the panel.
|
18 | */
|
19 | dispose(): void;
|
20 | /**
|
21 | * The method for hiding widgets.
|
22 | */
|
23 | get hiddenMode(): Widget.HiddenMode;
|
24 | /**
|
25 | * Set the method for hiding widgets.
|
26 | */
|
27 | set hiddenMode(v: Widget.HiddenMode);
|
28 | /**
|
29 | * A signal emitted when the layout configuration is modified.
|
30 | *
|
31 | * #### Notes
|
32 | * This signal is emitted whenever the current layout configuration
|
33 | * may have changed.
|
34 | *
|
35 | * This signal is emitted asynchronously in a collapsed fashion, so
|
36 | * that multiple synchronous modifications results in only a single
|
37 | * emit of the signal.
|
38 | */
|
39 | get layoutModified(): ISignal<this, void>;
|
40 | /**
|
41 | * A signal emitted when the add button on a tab bar is clicked.
|
42 | *
|
43 | */
|
44 | get addRequested(): ISignal<this, TabBar<Widget>>;
|
45 | /**
|
46 | * The overlay used by the dock panel.
|
47 | */
|
48 | readonly overlay: DockPanel.IOverlay;
|
49 | /**
|
50 | * The renderer used by the dock panel.
|
51 | */
|
52 | get renderer(): DockPanel.IRenderer;
|
53 | /**
|
54 | * Get the spacing between the widgets.
|
55 | */
|
56 | get spacing(): number;
|
57 | /**
|
58 | * Set the spacing between the widgets.
|
59 | */
|
60 | set spacing(value: number);
|
61 | /**
|
62 | * Get the mode for the dock panel.
|
63 | */
|
64 | get mode(): DockPanel.Mode;
|
65 | /**
|
66 | * Set the mode for the dock panel.
|
67 | *
|
68 | * #### Notes
|
69 | * Changing the mode is a destructive operation with respect to the
|
70 | * panel's layout configuration. If layout state must be preserved,
|
71 | * save the current layout config before changing the mode.
|
72 | */
|
73 | set mode(value: DockPanel.Mode);
|
74 | /**
|
75 | * Whether the tabs can be dragged / moved at runtime.
|
76 | */
|
77 | get tabsMovable(): boolean;
|
78 | /**
|
79 | * Enable / Disable draggable / movable tabs.
|
80 | */
|
81 | set tabsMovable(value: boolean);
|
82 | /**
|
83 | * Whether the tabs are constrained to their source dock panel
|
84 | */
|
85 | get tabsConstrained(): boolean;
|
86 | /**
|
87 | * Constrain/Allow tabs to be dragged outside of this dock panel
|
88 | */
|
89 | set tabsConstrained(value: boolean);
|
90 | /**
|
91 | * Whether the add buttons for each tab bar are enabled.
|
92 | */
|
93 | get addButtonEnabled(): boolean;
|
94 | /**
|
95 | * Set whether the add buttons for each tab bar are enabled.
|
96 | */
|
97 | set addButtonEnabled(value: boolean);
|
98 | /**
|
99 | * Whether the dock panel is empty.
|
100 | */
|
101 | get isEmpty(): boolean;
|
102 | /**
|
103 | * Create an iterator over the user widgets in the panel.
|
104 | *
|
105 | * @returns A new iterator over the user widgets in the panel.
|
106 | *
|
107 | * #### Notes
|
108 | * This iterator does not include the generated tab bars.
|
109 | */
|
110 | widgets(): IterableIterator<Widget>;
|
111 | /**
|
112 | * Create an iterator over the selected widgets in the panel.
|
113 | *
|
114 | * @returns A new iterator over the selected user widgets.
|
115 | *
|
116 | * #### Notes
|
117 | * This iterator yields the widgets corresponding to the current tab
|
118 | * of each tab bar in the panel.
|
119 | */
|
120 | selectedWidgets(): IterableIterator<Widget>;
|
121 | /**
|
122 | * Create an iterator over the tab bars in the panel.
|
123 | *
|
124 | * @returns A new iterator over the tab bars in the panel.
|
125 | *
|
126 | * #### Notes
|
127 | * This iterator does not include the user widgets.
|
128 | */
|
129 | tabBars(): IterableIterator<TabBar<Widget>>;
|
130 | /**
|
131 | * Create an iterator over the handles in the panel.
|
132 | *
|
133 | * @returns A new iterator over the handles in the panel.
|
134 | */
|
135 | handles(): IterableIterator<HTMLDivElement>;
|
136 | /**
|
137 | * Select a specific widget in the dock panel.
|
138 | *
|
139 | * @param widget - The widget of interest.
|
140 | *
|
141 | * #### Notes
|
142 | * This will make the widget the current widget in its tab area.
|
143 | */
|
144 | selectWidget(widget: Widget): void;
|
145 | /**
|
146 | * Activate a specified widget in the dock panel.
|
147 | *
|
148 | * @param widget - The widget of interest.
|
149 | *
|
150 | * #### Notes
|
151 | * This will select and activate the given widget.
|
152 | */
|
153 | activateWidget(widget: Widget): void;
|
154 | /**
|
155 | * Save the current layout configuration of the dock panel.
|
156 | *
|
157 | * @returns A new config object for the current layout state.
|
158 | *
|
159 | * #### Notes
|
160 | * The return value can be provided to the `restoreLayout` method
|
161 | * in order to restore the layout to its current configuration.
|
162 | */
|
163 | saveLayout(): DockPanel.ILayoutConfig;
|
164 | /**
|
165 | * Restore the layout to a previously saved configuration.
|
166 | *
|
167 | * @param config - The layout configuration to restore.
|
168 | *
|
169 | * #### Notes
|
170 | * Widgets which currently belong to the layout but which are not
|
171 | * contained in the config will be unparented.
|
172 | *
|
173 | * The dock panel automatically reverts to `'multiple-document'`
|
174 | * mode when a layout config is restored.
|
175 | */
|
176 | restoreLayout(config: DockPanel.ILayoutConfig): void;
|
177 | /**
|
178 | * Add a widget to the dock panel.
|
179 | *
|
180 | * @param widget - The widget to add to the dock panel.
|
181 | *
|
182 | * @param options - The additional options for adding the widget.
|
183 | *
|
184 | * #### Notes
|
185 | * If the panel is in single document mode, the options are ignored
|
186 | * and the widget is always added as tab in the hidden tab bar.
|
187 | */
|
188 | addWidget(widget: Widget, options?: DockPanel.IAddOptions): void;
|
189 | /**
|
190 | * Process a message sent to the widget.
|
191 | *
|
192 | * @param msg - The message sent to the widget.
|
193 | */
|
194 | processMessage(msg: Message): void;
|
195 | /**
|
196 | * Handle the DOM events for the dock panel.
|
197 | *
|
198 | * @param event - The DOM event sent to the panel.
|
199 | *
|
200 | * #### Notes
|
201 | * This method implements the DOM `EventListener` interface and is
|
202 | * called in response to events on the panel's DOM node. It should
|
203 | * not be called directly by user code.
|
204 | */
|
205 | handleEvent(event: Event): void;
|
206 | /**
|
207 | * A message handler invoked on a `'before-attach'` message.
|
208 | */
|
209 | protected onBeforeAttach(msg: Message): void;
|
210 | /**
|
211 | * A message handler invoked on an `'after-detach'` message.
|
212 | */
|
213 | protected onAfterDetach(msg: Message): void;
|
214 | /**
|
215 | * A message handler invoked on a `'child-added'` message.
|
216 | */
|
217 | protected onChildAdded(msg: Widget.ChildMessage): void;
|
218 | /**
|
219 | * A message handler invoked on a `'child-removed'` message.
|
220 | */
|
221 | protected onChildRemoved(msg: Widget.ChildMessage): void;
|
222 | /**
|
223 | * Handle the `'lm-dragenter'` event for the dock panel.
|
224 | */
|
225 | private _evtDragEnter;
|
226 | /**
|
227 | * Handle the `'lm-dragleave'` event for the dock panel.
|
228 | */
|
229 | private _evtDragLeave;
|
230 | /**
|
231 | * Handle the `'lm-dragover'` event for the dock panel.
|
232 | */
|
233 | private _evtDragOver;
|
234 | /**
|
235 | * Handle the `'lm-drop'` event for the dock panel.
|
236 | */
|
237 | private _evtDrop;
|
238 | /**
|
239 | * Handle the `'keydown'` event for the dock panel.
|
240 | */
|
241 | private _evtKeyDown;
|
242 | /**
|
243 | * Handle the `'pointerdown'` event for the dock panel.
|
244 | */
|
245 | private _evtPointerDown;
|
246 | /**
|
247 | * Handle the `'pointermove'` event for the dock panel.
|
248 | */
|
249 | private _evtPointerMove;
|
250 | /**
|
251 | * Handle the `'pointerup'` event for the dock panel.
|
252 | */
|
253 | private _evtPointerUp;
|
254 | /**
|
255 | * Release the mouse grab for the dock panel.
|
256 | */
|
257 | private _releaseMouse;
|
258 | /**
|
259 | * Show the overlay indicator at the given client position.
|
260 | *
|
261 | * Returns the drop zone at the specified client position.
|
262 | *
|
263 | * #### Notes
|
264 | * If the position is not over a valid zone, the overlay is hidden.
|
265 | */
|
266 | private _showOverlay;
|
267 | /**
|
268 | * Create a new tab bar for use by the panel.
|
269 | */
|
270 | private _createTabBar;
|
271 | /**
|
272 | * Create a new handle for use by the panel.
|
273 | */
|
274 | private _createHandle;
|
275 | /**
|
276 | * Handle the `tabMoved` signal from a tab bar.
|
277 | */
|
278 | private _onTabMoved;
|
279 | /**
|
280 | * Handle the `currentChanged` signal from a tab bar.
|
281 | */
|
282 | private _onCurrentChanged;
|
283 | /**
|
284 | * Handle the `addRequested` signal from a tab bar.
|
285 | */
|
286 | private _onTabAddRequested;
|
287 | /**
|
288 | * Handle the `tabActivateRequested` signal from a tab bar.
|
289 | */
|
290 | private _onTabActivateRequested;
|
291 | /**
|
292 | * Handle the `tabCloseRequested` signal from a tab bar.
|
293 | */
|
294 | private _onTabCloseRequested;
|
295 | /**
|
296 | * Handle the `tabDetachRequested` signal from a tab bar.
|
297 | */
|
298 | private _onTabDetachRequested;
|
299 | private _edges;
|
300 | private _document;
|
301 | private _mode;
|
302 | private _drag;
|
303 | private _renderer;
|
304 | private _tabsMovable;
|
305 | private _tabsConstrained;
|
306 | private _addButtonEnabled;
|
307 | private _pressData;
|
308 | private _layoutModified;
|
309 | private _addRequested;
|
310 | }
|
311 | /**
|
312 | * The namespace for the `DockPanel` class statics.
|
313 | */
|
314 | export declare namespace DockPanel {
|
315 | |
316 |
|
317 |
|
318 | interface IOptions {
|
319 | |
320 |
|
321 |
|
322 |
|
323 |
|
324 | document?: Document | ShadowRoot;
|
325 | |
326 |
|
327 |
|
328 |
|
329 |
|
330 | overlay?: IOverlay;
|
331 | |
332 |
|
333 |
|
334 |
|
335 |
|
336 | renderer?: IRenderer;
|
337 | |
338 |
|
339 |
|
340 |
|
341 |
|
342 | spacing?: number;
|
343 | |
344 |
|
345 |
|
346 |
|
347 |
|
348 | mode?: DockPanel.Mode;
|
349 | |
350 |
|
351 |
|
352 |
|
353 | edges?: IEdges;
|
354 | |
355 |
|
356 |
|
357 |
|
358 |
|
359 | hiddenMode?: Widget.HiddenMode;
|
360 | |
361 |
|
362 |
|
363 |
|
364 |
|
365 | tabsMovable?: boolean;
|
366 | |
367 |
|
368 |
|
369 |
|
370 |
|
371 | tabsConstrained?: boolean;
|
372 | |
373 |
|
374 |
|
375 |
|
376 |
|
377 | addButtonEnabled?: boolean;
|
378 | }
|
379 | |
380 |
|
381 |
|
382 | interface IEdges {
|
383 | |
384 |
|
385 |
|
386 | top: number;
|
387 | |
388 |
|
389 |
|
390 | right: number;
|
391 | |
392 |
|
393 |
|
394 | bottom: number;
|
395 | |
396 |
|
397 |
|
398 | left: number;
|
399 | }
|
400 | |
401 |
|
402 |
|
403 | type Mode = |
404 |
|
405 |
|
406 |
|
407 |
|
408 | 'single-document'
|
409 | |
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 | | 'multiple-document';
|
416 | |
417 |
|
418 |
|
419 | type ILayoutConfig = DockLayout.ILayoutConfig;
|
420 | |
421 |
|
422 |
|
423 | type InsertMode = DockLayout.InsertMode;
|
424 | |
425 |
|
426 |
|
427 | type IAddOptions = DockLayout.IAddOptions;
|
428 | |
429 |
|
430 |
|
431 | interface IOverlayGeometry {
|
432 | |
433 |
|
434 |
|
435 | top: number;
|
436 | |
437 |
|
438 |
|
439 | left: number;
|
440 | |
441 |
|
442 |
|
443 | right: number;
|
444 | |
445 |
|
446 |
|
447 | bottom: number;
|
448 | }
|
449 | |
450 |
|
451 |
|
452 | interface IOverlay {
|
453 | |
454 |
|
455 |
|
456 | readonly node: HTMLDivElement;
|
457 | |
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 | show(geo: IOverlayGeometry): void;
|
470 | |
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 | hide(delay: number): void;
|
480 | }
|
481 | |
482 |
|
483 |
|
484 |
|
485 |
|
486 | class Overlay implements IOverlay {
|
487 | |
488 |
|
489 |
|
490 | constructor();
|
491 | /**
|
492 | * The DOM node for the overlay.
|
493 | */
|
494 | readonly node: HTMLDivElement;
|
495 | /**
|
496 | * Show the overlay using the given overlay geometry.
|
497 | *
|
498 | * @param geo - The desired geometry for the overlay.
|
499 | */
|
500 | show(geo: IOverlayGeometry): void;
|
501 | /**
|
502 | * Hide the overlay node.
|
503 | *
|
504 | * @param delay - The delay (in ms) before hiding the overlay.
|
505 | * A delay value <= 0 will hide the overlay immediately.
|
506 | */
|
507 | hide(delay: number): void;
|
508 | private _timer;
|
509 | private _hidden;
|
510 | }
|
511 | /**
|
512 | * A type alias for a dock panel renderer;
|
513 | */
|
514 | type IRenderer = DockLayout.IRenderer;
|
515 | /**
|
516 | * The default implementation of `IRenderer`.
|
517 | */
|
518 | class Renderer implements IRenderer {
|
519 | |
520 |
|
521 |
|
522 |
|
523 |
|
524 | createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;
|
525 | |
526 |
|
527 |
|
528 |
|
529 |
|
530 | createHandle(): HTMLDivElement;
|
531 | }
|
532 | |
533 |
|
534 |
|
535 | const defaultRenderer: Renderer;
|
536 | }
|