-
Notifications
You must be signed in to change notification settings - Fork 2
/
FrameworkFrontstages.ts
393 lines (331 loc) · 14.4 KB
/
FrameworkFrontstages.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Frontstage
*/
import { UiEvent } from "@itwin/appui-abstract";
import type { IModelConnection, Tool } from "@itwin/core-frontend";
import type { ToolInformation } from "../toolsettings/ToolInformation";
import type { TimeTracker } from "../configurableui/TimeTracker";
import type { ContentControlActivatedEvent } from "../content/ContentControl";
import type { ContentLayoutActivatedEvent } from "../content/ContentLayout";
import type { FrontstageDef } from "../frontstage/FrontstageDef";
import type { FrontstageProvider } from "../frontstage/FrontstageProvider";
import type { NavigationAidActivatedEvent } from "../navigationaids/NavigationAidControl";
import type {
PanelPinnedChangedEventArgs,
PanelStateChangedEvent,
} from "../stagepanels/StagePanelDef";
import type { WidgetDef, WidgetStateChangedEvent } from "../widgets/WidgetDef";
import type { WidgetState } from "../widgets/WidgetState";
/** Frontstage Activated Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface FrontstageActivatedEventArgs {
deactivatedFrontstageDef?: FrontstageDef;
activatedFrontstageDef: FrontstageDef;
}
/** Frontstage Activated Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class FrontstageActivatedEvent extends UiEvent<FrontstageActivatedEventArgs> {}
/** Frontstage Deactivated Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface FrontstageDeactivatedEventArgs {
/** Frontstage being deactivated */
deactivatedFrontstageDef: FrontstageDef;
/** Frontstage being activated */
activatedFrontstageDef?: FrontstageDef;
/** Total time spent in frontstage */
totalTime: number;
/** Engagement time spent in frontstage */
engagementTime: number;
/** Idle time spent in frontstage */
idleTime: number;
}
/** Frontstage Deactivated Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class FrontstageDeactivatedEvent extends UiEvent<FrontstageDeactivatedEventArgs> {}
/** Frontstage Ready Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface FrontstageReadyEventArgs {
frontstageDef: FrontstageDef;
}
/** Frontstage Ready Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class FrontstageReadyEvent extends UiEvent<FrontstageReadyEventArgs> {}
/** Modal Frontstage Changed Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface ModalFrontstageChangedEventArgs {
modalFrontstageCount: number;
}
/** Modal Frontstage Stack Changed Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class ModalFrontstageChangedEvent extends UiEvent<ModalFrontstageChangedEventArgs> {}
/** Modal Frontstage Closed Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface ModalFrontstageClosedEventArgs {
/** Modal Frontstage being closed */
modalFrontstage: ModalFrontstageInfo;
/** Total time spent in frontstage */
totalTime: number;
/** Engagement time spent in frontstage */
engagementTime: number;
/** Idle time spent in frontstage */
idleTime: number;
}
/** Modal Frontstage Requested Close Event class. Notifies the modal stage that the close button was
* pressed and passes the function to actually close the modal stage. This allows stage to do any
* saving of unsaved data prior to closing the stage. If the ModalFrontstageInfo sets notifyCloseRequest
* to true it is up to the stage to register for this event and call the stageCloseFunc once it has saved
* any unsaved data.
* @alpha
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class ModalFrontstageRequestedCloseEvent extends UiEvent<ModalFrontstageRequestedCloseEventArgs> {}
/** Modal Frontstage RequestedClose Event Args interface.
* @alpha
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface ModalFrontstageRequestedCloseEventArgs {
/** Modal Frontstage that is to be closed */
modalFrontstage: ModalFrontstageInfo;
/** Function to call to close the stage */
stageCloseFunc: () => void;
}
/** Modal Frontstage Closed Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class ModalFrontstageClosedEvent extends UiEvent<ModalFrontstageClosedEventArgs> {}
/** Tool Activated Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface ToolActivatedEventArgs {
toolId: string;
}
/** Tool Activated Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class ToolActivatedEvent extends UiEvent<ToolActivatedEventArgs> {}
/** Tool Icon Changed Event Args interface.
* @public
* @deprecated in 4.13.x. Event args are inferred from a listener. If explicit type is needed use a type helper.
*/
export interface ToolIconChangedEventArgs {
iconSpec: string;
}
/** Tool Icon Changed Event class.
* @public
* @deprecated in 4.13.x. This class should not be used by applications to instantiate objects.
*/
// eslint-disable-next-line deprecation/deprecation
export class ToolIconChangedEvent extends UiEvent<ToolIconChangedEventArgs> {}
/** Modal Frontstage information interface.
* @public
*/
export interface ModalFrontstageInfo {
title: string;
content: React.ReactNode;
appBarRight?: React.ReactNode;
/** Set notifyCloseRequest to true on stages that register to listen for `onCloseModalFrontstageRequestedEvent` so
* that the stage can save unsaved data before closing. Used by the ModalSettingsStage.
* @alpha */
notifyCloseRequest?: boolean;
}
/** Modal Frontstage array item interface.
* @internal
*/
export interface ModalFrontstageItem {
modalFrontstage: ModalFrontstageInfo;
timeTracker: TimeTracker;
}
/**
* [[UiFramework.frontstages]] interface
* @public
*/
export interface FrameworkFrontstages {
/** Returns true if Frontstage is loading its controls. If false the Frontstage content and controls have been created. */
readonly isLoading: boolean;
/** Get Frontstage Deactivated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onFrontstageDeactivatedEvent: FrontstageDeactivatedEvent;
/** Get Frontstage Activated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onFrontstageActivatedEvent: FrontstageActivatedEvent;
/** Get Frontstage Activated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onFrontstageReadyEvent: FrontstageReadyEvent;
/** Get Modal Frontstage Changed event. */
// eslint-disable-next-line deprecation/deprecation
readonly onModalFrontstageChangedEvent: ModalFrontstageChangedEvent;
/** Get Modal Frontstage Closed event. */
// eslint-disable-next-line deprecation/deprecation
readonly onModalFrontstageClosedEvent: ModalFrontstageClosedEvent;
/** Get Modal Frontstage Requested Closed event.
* @alpha
*/
// eslint-disable-next-line deprecation/deprecation
readonly onCloseModalFrontstageRequestedEvent: ModalFrontstageRequestedCloseEvent;
/** Get Tool Activated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onToolActivatedEvent: ToolActivatedEvent;
/** Get ToolSetting Reload event. */
// eslint-disable-next-line deprecation/deprecation
readonly onToolSettingsReloadEvent: UiEvent<void>;
/** Get Tool Icon Changed event. */
// eslint-disable-next-line deprecation/deprecation
readonly onToolIconChangedEvent: ToolIconChangedEvent;
/** Get Content Layout Activated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onContentLayoutActivatedEvent: ContentLayoutActivatedEvent;
/** Get Content Control Activated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onContentControlActivatedEvent: ContentControlActivatedEvent;
/** Get Navigation Aid Activated event. */
// eslint-disable-next-line deprecation/deprecation
readonly onNavigationAidActivatedEvent: NavigationAidActivatedEvent;
/** Get Widget State Changed event. */
// eslint-disable-next-line deprecation/deprecation
readonly onWidgetStateChangedEvent: WidgetStateChangedEvent;
/** Get panel state changed event.
* @alpha
*/
// eslint-disable-next-line deprecation/deprecation
readonly onPanelStateChangedEvent: PanelStateChangedEvent;
/** Get panel pinned changed event.
* @alpha
*/
// eslint-disable-next-line deprecation/deprecation
readonly onPanelPinnedChangedEvent: UiEvent<PanelPinnedChangedEventArgs>;
/** Clears the Frontstage map.
*/
clearFrontstageDefs(): void;
/** Clears the Frontstage Providers and the defs that may have been created from them.
*/
clearFrontstageProviders(): void;
/** Add a Frontstage via a [[FrontstageProvider]].
* @param frontstageProvider FrontstageProvider representing the Frontstage to add
*/
addFrontstageProvider(frontstageProvider: FrontstageProvider): void;
/** Find a loaded Frontstage with a given id. If the id is not provided, the active Frontstage is returned. If
* no cached FrontstageDef is found but a FrontstageProvider is registered a FrontstageDef will be created, cached, and
* returned.
* @param id Id of the Frontstage to find
* @returns FrontstageDef with a given id if found, or undefined if not found.
*/
getFrontstageDef(id?: string): Promise<FrontstageDef | undefined>;
/** Gets the active FrontstageDef. If a Frontstage is not active, undefined is returned.
* @return Active FrontstageDef, or undefined if one is not active.
*/
readonly activeFrontstageDef: FrontstageDef | undefined;
/** Gets the Id of the active FrontstageDef. If a Frontstage is not active, blank is returned.
* @return Id of the active FrontstageDef, or blank if one is not active.
*/
readonly activeFrontstageId: string;
hasFrontstage(frontstageId: string): boolean;
/** Sets the active FrontstageDef give the stageId.
* @param frontstageId Id of the Frontstage to set active.
* @returns A Promise that is fulfilled when the Frontstage is ready.
*/
setActiveFrontstage(frontstageId: string): Promise<void>;
/** Sets the active FrontstageDef.
* @param frontstageDef FrontstageDef to set active.
* @returns A Promise that is fulfilled when the [[FrontstageDef]] is ready.
*/
setActiveFrontstageDef(
frontstageDef: FrontstageDef | undefined
): Promise<void>;
/** Deactivates the active FrontstageDef.
*/
deactivateFrontstageDef(): Promise<void>;
/** Gets the Id of the active tool. If a tool is not active, blank is returned.
* @return Id of the active tool, or blank if one is not active.
*/
readonly activeToolId: string;
/** Sets the active tool id */
setActiveToolId(toolId: string): void;
/** Sets the active tool */
setActiveTool(tool: Tool): void;
/** Gets the active tool's [[ToolInformation]] */
readonly activeToolInformation: ToolInformation | undefined;
/** Opens a modal Frontstage. Modal Frontstages can be stacked.
* @param modalFrontstage Information about the modal Frontstage
*/
openModalFrontstage(modalFrontstage: ModalFrontstageInfo): void;
/** Closes the top-most modal Frontstage.
*/
closeModalFrontstage(): void;
/** Updates the top-most modal Frontstage.
*/
updateModalFrontstage(): void;
/** Gets the top-most modal Frontstage.
* @returns Top-most modal Frontstage, or undefined if there is none.
*/
readonly activeModalFrontstage: ModalFrontstageInfo | undefined;
/** Gets the number of modal Frontstages.
* @returns Modal Frontstage count
*/
readonly modalFrontstageCount: number;
/** Sets the active Navigation Aid via its Id.
* @param navigationAidId Id of the Navigation Aid to set as active
* @param iModelConnection IModelConnection to query for view data
*/
setActiveNavigationAid(
navigationAidId: string,
iModelConnection: IModelConnection
): void;
/** Sets the state of the widget with the given id
* @param widgetId Id of the Widget for which to set the state
* @param state New state of the widget
* @returns true if the widget state was set successfully, or false if not.
*/
setWidgetState(widgetId: string, state: WidgetState): boolean;
/** Finds a widget with the given id in the active frontstage
* @param widgetId Id of the Widget to find
* @returns The WidgetDef with the given id, or undefined if not found.
*/
findWidget(widgetId: string): WidgetDef | undefined;
/** Opens a nested Frontstage. Nested Frontstages can be stacked.
* @param nestedFrontstage Information about the nested Frontstage
*/
openNestedFrontstage(nestedFrontstage: FrontstageDef): Promise<void>;
/** Closes the top-most nested Frontstage.
*/
closeNestedFrontstage(): Promise<void>;
/** Gets the top-most nested Frontstage.
* @returns Top-most nested Frontstage, or undefined if there is none.
*/
readonly activeNestedFrontstage: FrontstageDef | undefined;
/** Gets the number of nested Frontstages.
* @returns Nested Frontstage count
*/
readonly nestedFrontstageCount: number;
}