UNPKG

5.03 kBTypeScriptView Raw
1import { Message } from '@lumino/messaging';
2import { AccordionLayout } from './accordionlayout';
3import { SplitLayout } from './splitlayout';
4import { SplitPanel } from './splitpanel';
5import { Title } from './title';
6import { Widget } from './widget';
7/**
8 * A panel which arranges its widgets into resizable sections separated by a title widget.
9 *
10 * #### Notes
11 * This class provides a convenience wrapper around [[AccordionLayout]].
12 */
13export declare class AccordionPanel extends SplitPanel {
14 /**
15 * Construct a new accordion panel.
16 *
17 * @param options - The options for initializing the accordion panel.
18 */
19 constructor(options?: AccordionPanel.IOptions);
20 /**
21 * The renderer used by the accordion panel.
22 */
23 readonly renderer: AccordionPanel.IRenderer;
24 /**
25 * The section title space.
26 *
27 * This is the height if the panel is vertical and the width if it is
28 * horizontal.
29 */
30 titleSpace: number;
31 /**
32 * A read-only array of the section titles in the panel.
33 */
34 readonly titles: ReadonlyArray<HTMLElement>;
35 /**
36 * Add a widget to the end of the panel.
37 *
38 * @param widget - The widget to add to the panel.
39 *
40 * #### Notes
41 * If the widget is already contained in the panel, it will be moved.
42 */
43 addWidget(widget: Widget): void;
44 /**
45 * Insert a widget at the specified index.
46 *
47 * @param index - The index at which to insert the widget.
48 *
49 * @param widget - The widget to insert into to the panel.
50 *
51 * #### Notes
52 * If the widget is already contained in the panel, it will be moved.
53 */
54 insertWidget(index: number, widget: Widget): void;
55 /**
56 * Handle the DOM events for the accordion panel.
57 *
58 * @param event - The DOM event sent to the panel.
59 *
60 * #### Notes
61 * This method implements the DOM `EventListener` interface and is
62 * called in response to events on the panel's DOM node. It should
63 * not be called directly by user code.
64 */
65 handleEvent(event: Event): void;
66 /**
67 * A message handler invoked on a `'before-attach'` message.
68 */
69 protected onBeforeAttach(msg: Message): void;
70 /**
71 * A message handler invoked on an `'after-detach'` message.
72 */
73 protected onAfterDetach(msg: Message): void;
74 /**
75 * Handle the `changed` signal of a title object.
76 */
77 private _onTitleChanged;
78 /**
79 * Handle the `'click'` event for the accordion panel
80 */
81 private _evtClick;
82 /**
83 * Handle the `'keydown'` event for the accordion panel.
84 */
85 private _eventKeyDown;
86}
87/**
88 * The namespace for the `AccordionPanel` class statics.
89 */
90export declare namespace AccordionPanel {
91 /**
92 * A type alias for a accordion panel orientation.
93 */
94 type Orientation = SplitLayout.Orientation;
95 /**
96 * A type alias for a accordion panel alignment.
97 */
98 type Alignment = SplitLayout.Alignment;
99 /**
100 * A type alias for a accordion panel renderer.
101 */
102 type IRenderer = AccordionLayout.IRenderer;
103 /**
104 * An options object for initializing a accordion panel.
105 */
106 interface IOptions extends Partial<AccordionLayout.IOptions> {
107 /**
108 * The accordion layout to use for the accordion panel.
109 *
110 * If this is provided, the other options are ignored.
111 *
112 * The default is a new `AccordionLayout`.
113 */
114 layout?: AccordionLayout;
115 }
116 /**
117 * The default implementation of `IRenderer`.
118 */
119 class Renderer extends SplitPanel.Renderer implements IRenderer {
120 /**
121 * A selector which matches any title node in the accordion.
122 */
123 readonly titleClassName = "lm-AccordionPanel-title";
124 /**
125 * Render the collapse indicator for a section title.
126 *
127 * @param data - The data to use for rendering the section title.
128 *
129 * @returns A element representing the collapse indicator.
130 */
131 createCollapseIcon(data: Title<Widget>): HTMLElement;
132 /**
133 * Render the element for a section title.
134 *
135 * @param data - The data to use for rendering the section title.
136 *
137 * @returns A element representing the section title.
138 */
139 createSectionTitle(data: Title<Widget>): HTMLElement;
140 /**
141 * Create a unique render key for the title.
142 *
143 * @param data - The data to use for the title.
144 *
145 * @returns The unique render key for the title.
146 *
147 * #### Notes
148 * This method caches the key against the section title the first time
149 * the key is generated.
150 */
151 createTitleKey(data: Title<Widget>): string;
152 private _titleID;
153 private _titleKeys;
154 }
155 /**
156 * The default `Renderer` instance.
157 */
158 const defaultRenderer: Renderer;
159}
160//# sourceMappingURL=accordionpanel.d.ts.map
\No newline at end of file