UNPKG

3.9 kBTypeScriptView Raw
1import { SplitLayout } from './splitlayout';
2import { Title } from './title';
3import { Widget } from './widget';
4/**
5 * A layout which arranges its widgets into collapsible resizable sections.
6 */
7export declare class AccordionLayout extends SplitLayout {
8 /**
9 * Construct a new accordion layout.
10 *
11 * @param options - The options for initializing the layout.
12 *
13 * #### Notes
14 * The default orientation will be vertical.
15 *
16 * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css
17 */
18 constructor(options: AccordionLayout.IOptions);
19 /**
20 * The section title height or width depending on the orientation.
21 */
22 titleSpace: number;
23 /**
24 * A read-only array of the section titles in the panel.
25 */
26 readonly titles: ReadonlyArray<HTMLElement>;
27 /**
28 * Dispose of the resources held by the layout.
29 */
30 dispose(): void;
31 /**
32 * The renderer used by the accordion layout.
33 */
34 readonly renderer: AccordionLayout.IRenderer;
35 updateTitle(index: number, widget: Widget): void;
36 /**
37 * Attach a widget to the parent's DOM node.
38 *
39 * @param index - The current index of the widget in the layout.
40 *
41 * @param widget - The widget to attach to the parent.
42 */
43 protected attachWidget(index: number, widget: Widget): void;
44 /**
45 * Move a widget in the parent's DOM node.
46 *
47 * @param fromIndex - The previous index of the widget in the layout.
48 *
49 * @param toIndex - The current index of the widget in the layout.
50 *
51 * @param widget - The widget to move in the parent.
52 */
53 protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void;
54 /**
55 * Detach a widget from the parent's DOM node.
56 *
57 * @param index - The previous index of the widget in the layout.
58 *
59 * @param widget - The widget to detach from the parent.
60 *
61 * #### Notes
62 * This is a reimplementation of the superclass method.
63 */
64 protected detachWidget(index: number, widget: Widget): void;
65 /**
66 * Update the item position.
67 *
68 * @param i Item index
69 * @param isHorizontal Whether the layout is horizontal or not
70 * @param left Left position in pixels
71 * @param top Top position in pixels
72 * @param height Item height
73 * @param width Item width
74 * @param size Item size
75 */
76 protected updateItemPosition(i: number, isHorizontal: boolean, left: number, top: number, height: number, width: number, size: number): void;
77 private _titles;
78}
79export declare namespace AccordionLayout {
80 /**
81 * A type alias for a accordion layout orientation.
82 */
83 type Orientation = SplitLayout.Orientation;
84 /**
85 * A type alias for a accordion layout alignment.
86 */
87 type Alignment = SplitLayout.Alignment;
88 /**
89 * An options object for initializing a accordion layout.
90 */
91 interface IOptions extends SplitLayout.IOptions {
92 /**
93 * The renderer to use for the accordion layout.
94 */
95 renderer: IRenderer;
96 /**
97 * The section title height or width depending on the orientation.
98 *
99 * The default is `22`.
100 */
101 titleSpace?: number;
102 }
103 /**
104 * A renderer for use with an accordion layout.
105 */
106 interface IRenderer extends SplitLayout.IRenderer {
107 /**
108 * Common class name for all accordion titles.
109 */
110 readonly titleClassName: string;
111 /**
112 * Render the element for a section title.
113 *
114 * @param data - The data to use for rendering the section title.
115 *
116 * @returns A element representing the section title.
117 */
118 createSectionTitle(title: Title<Widget>): HTMLElement;
119 }
120}
121//# sourceMappingURL=accordionlayout.d.ts.map
\No newline at end of file