1 | import { ISignal } from '@lumino/signaling';
|
2 | import { StackedPanel } from './stackedpanel';
|
3 | import { TabBar } from './tabbar';
|
4 | import { Widget } from './widget';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export declare class TabPanel extends Widget {
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 | constructor(options?: TabPanel.IOptions);
|
23 | /**
|
24 | * A signal emitted when the current tab is changed.
|
25 | *
|
26 | * #### Notes
|
27 | * This signal is emitted when the currently selected tab is changed
|
28 | * either through user or programmatic interaction.
|
29 | *
|
30 | * Notably, this signal is not emitted when the index of the current
|
31 | * tab changes due to tabs being inserted, removed, or moved. It is
|
32 | * only emitted when the actual current tab node is changed.
|
33 | */
|
34 | readonly currentChanged: ISignal<this, TabPanel.ICurrentChangedArgs>;
|
35 | /**
|
36 | * Get the index of the currently selected tab.
|
37 | *
|
38 | * #### Notes
|
39 | * This will be `-1` if no tab is selected.
|
40 | */
|
41 | /**
|
42 | * Set the index of the currently selected tab.
|
43 | *
|
44 | * #### Notes
|
45 | * If the index is out of range, it will be set to `-1`.
|
46 | */
|
47 | currentIndex: number;
|
48 | /**
|
49 | * Get the currently selected widget.
|
50 | *
|
51 | * #### Notes
|
52 | * This will be `null` if there is no selected tab.
|
53 | */
|
54 | /**
|
55 | * Set the currently selected widget.
|
56 | *
|
57 | * #### Notes
|
58 | * If the widget is not in the panel, it will be set to `null`.
|
59 | */
|
60 | currentWidget: Widget | null;
|
61 | /**
|
62 | * Get the whether the tabs are movable by the user.
|
63 | *
|
64 | * #### Notes
|
65 | * Tabs can always be moved programmatically.
|
66 | */
|
67 | /**
|
68 | * Set the whether the tabs are movable by the user.
|
69 | *
|
70 | * #### Notes
|
71 | * Tabs can always be moved programmatically.
|
72 | */
|
73 | tabsMovable: boolean;
|
74 | /**
|
75 | * Get the whether the add button is enabled.
|
76 | *
|
77 | */
|
78 | /**
|
79 | * Set the whether the add button is enabled.
|
80 | *
|
81 | */
|
82 | addButtonEnabled: boolean;
|
83 | /**
|
84 | * Get the tab placement for the tab panel.
|
85 | *
|
86 | * #### Notes
|
87 | * This controls the position of the tab bar relative to the content.
|
88 | */
|
89 | /**
|
90 | * Set the tab placement for the tab panel.
|
91 | *
|
92 | * #### Notes
|
93 | * This controls the position of the tab bar relative to the content.
|
94 | */
|
95 | tabPlacement: TabPanel.TabPlacement;
|
96 | /**
|
97 | * A signal emitted when the add button on a tab bar is clicked.
|
98 | *
|
99 | */
|
100 | readonly addRequested: ISignal<this, TabBar<Widget>>;
|
101 | /**
|
102 | * The tab bar used by the tab panel.
|
103 | *
|
104 | * #### Notes
|
105 | * Modifying the tab bar directly can lead to undefined behavior.
|
106 | */
|
107 | readonly tabBar: TabBar<Widget>;
|
108 | /**
|
109 | * The stacked panel used by the tab panel.
|
110 | *
|
111 | * #### Notes
|
112 | * Modifying the panel directly can lead to undefined behavior.
|
113 | */
|
114 | readonly stackedPanel: StackedPanel;
|
115 | /**
|
116 | * A read-only array of the widgets in the panel.
|
117 | */
|
118 | readonly widgets: ReadonlyArray<Widget>;
|
119 | /**
|
120 | * Add a widget to the end of the tab panel.
|
121 | *
|
122 | * @param widget - The widget to add to the tab panel.
|
123 | *
|
124 | * #### Notes
|
125 | * If the widget is already contained in the panel, it will be moved.
|
126 | *
|
127 | * The widget's `title` is used to populate the tab.
|
128 | */
|
129 | addWidget(widget: Widget): void;
|
130 | /**
|
131 | * Insert a widget into the tab panel at a specified index.
|
132 | *
|
133 | * @param index - The index at which to insert the widget.
|
134 | *
|
135 | * @param widget - The widget to insert into to the tab panel.
|
136 | *
|
137 | * #### Notes
|
138 | * If the widget is already contained in the panel, it will be moved.
|
139 | *
|
140 | * The widget's `title` is used to populate the tab.
|
141 | */
|
142 | insertWidget(index: number, widget: Widget): void;
|
143 | /**
|
144 | * Handle the `currentChanged` signal from the tab bar.
|
145 | */
|
146 | private _onCurrentChanged;
|
147 | /**
|
148 | * Handle the `tabAddRequested` signal from the tab bar.
|
149 | */
|
150 | private _onTabAddRequested;
|
151 | /**
|
152 | * Handle the `tabActivateRequested` signal from the tab bar.
|
153 | */
|
154 | private _onTabActivateRequested;
|
155 | /**
|
156 | * Handle the `tabCloseRequested` signal from the tab bar.
|
157 | */
|
158 | private _onTabCloseRequested;
|
159 | /**
|
160 | * Handle the `tabMoved` signal from the tab bar.
|
161 | */
|
162 | private _onTabMoved;
|
163 | /**
|
164 | * Handle the `widgetRemoved` signal from the stacked panel.
|
165 | */
|
166 | private _onWidgetRemoved;
|
167 | private _tabPlacement;
|
168 | private _currentChanged;
|
169 | private _addRequested;
|
170 | }
|
171 | /**
|
172 | * The namespace for the `TabPanel` class statics.
|
173 | */
|
174 | export declare namespace TabPanel {
|
175 | |
176 |
|
177 |
|
178 | type TabPlacement = |
179 |
|
180 | 'top'
|
181 | |
182 |
|
183 |
|
184 | | 'left'
|
185 | |
186 |
|
187 |
|
188 | | 'right'
|
189 | |
190 |
|
191 |
|
192 | | 'bottom';
|
193 | |
194 |
|
195 |
|
196 | interface IOptions {
|
197 | |
198 |
|
199 |
|
200 |
|
201 |
|
202 | document?: Document | ShadowRoot;
|
203 | |
204 |
|
205 |
|
206 |
|
207 |
|
208 | tabsMovable?: boolean;
|
209 | |
210 |
|
211 |
|
212 |
|
213 |
|
214 | addButtonEnabled?: boolean;
|
215 | |
216 |
|
217 |
|
218 |
|
219 |
|
220 | tabPlacement?: TabPlacement;
|
221 | |
222 |
|
223 |
|
224 |
|
225 |
|
226 | renderer?: TabBar.IRenderer<Widget>;
|
227 | }
|
228 | |
229 |
|
230 |
|
231 | interface ICurrentChangedArgs {
|
232 | |
233 |
|
234 |
|
235 | previousIndex: number;
|
236 | |
237 |
|
238 |
|
239 | previousWidget: Widget | null;
|
240 | |
241 |
|
242 |
|
243 | currentIndex: number;
|
244 | |
245 |
|
246 |
|
247 | currentWidget: Widget | null;
|
248 | }
|
249 | }
|
250 |
|
\ | No newline at end of file |