UNPKG

1.87 kBTypeScriptView Raw
1import { Message } from '@lumino/messaging';
2import { ISignal } from '@lumino/signaling';
3import { Widget } from '@lumino/widgets';
4/**
5 * A panel that supports a collapsible header made from the widget's title.
6 * Clicking on the title expands or contracts the widget.
7 */
8export declare class Collapser<T extends Widget = Widget> extends Widget {
9 constructor(options: Collapser.IOptions<T>);
10 /**
11 * The widget inside the collapse panel.
12 */
13 get widget(): T;
14 set widget(widget: T);
15 /**
16 * The collapsed state of the panel.
17 */
18 get collapsed(): boolean;
19 set collapsed(value: boolean);
20 /**
21 * A signal for when the widget collapse state changes.
22 */
23 get collapseChanged(): ISignal<Collapser, void>;
24 /**
25 * Toggle the collapse state of the panel.
26 */
27 toggle(): void;
28 /**
29 * Dispose the widget.
30 */
31 dispose(): void;
32 /**
33 * Handle the DOM events for the Collapser widget.
34 *
35 * @param event - The DOM event sent to the panel.
36 *
37 * #### Notes
38 * This method implements the DOM `EventListener` interface and is
39 * called in response to events on the panel's DOM node. It should
40 * not be called directly by user code.
41 */
42 handleEvent(event: Event): void;
43 protected onAfterAttach(msg: Message): void;
44 protected onBeforeDetach(msg: Message): void;
45 private _collapse;
46 private _uncollapse;
47 private _evtClick;
48 /**
49 * Handle the `changed` signal of a title object.
50 */
51 private _onTitleChanged;
52 private _setHeader;
53 private _collapseChanged;
54 private _collapsed;
55 private _content;
56 private _header;
57 private _widget;
58}
59export declare namespace Collapser {
60 interface IOptions<T extends Widget = Widget> extends Widget.IOptions {
61 widget: T;
62 collapsed?: boolean;
63 }
64}