/
FrameworkContent.ts
196 lines (162 loc) · 6.19 KB
/
FrameworkContent.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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module ContentView
*/
import type { ContentLayoutProps } from "@itwin/appui-abstract";
import { UiEvent } from "@itwin/appui-abstract";
import type { ContentControl } from "../content/ContentControl";
import type { ContentGroup, ContentGroupProps } from "../content/ContentGroup";
import type { ContentLayoutDef } from "../content/ContentLayout";
import { DialogChangedEvent } from "../dialog/DialogManagerBase";
import type { FrameworkStackedDialog } from "./FrameworkDialogs";
/** [[MouseDownChangedEvent]] Args interface.
* @public
*/
export interface MouseDownChangedEventArgs {
/** Indicates whether the mouse is down */
mouseDown: boolean;
}
/** Mouse Down Changed Event class.
* @public
*/
// eslint-disable-next-line deprecation/deprecation
export class MouseDownChangedEvent extends UiEvent<MouseDownChangedEventArgs> {}
/** [[ActiveContentChangedEvent]] Args interface.
* @public
*/
export interface ActiveContentChangedEventArgs {
/** React node of the old content */
oldContent?: React.ReactNode;
/** React node of the newly active content */
activeContent?: React.ReactNode;
}
/** Active Content Changed Event class.
* @public
*/
// eslint-disable-next-line deprecation/deprecation
export class ActiveContentChangedEvent extends UiEvent<ActiveContentChangedEventArgs> {}
/** Content Dialog Changed Event class.
* @public
*/
export class ContentDialogChangedEvent extends DialogChangedEvent {}
/** @public */
export interface ContentDialogInfo {
reactNode: React.ReactNode;
zIndex: number;
parentDocument: Document;
}
/**
* [[UiFramework.content]] interface
* @public
*/
export interface FrameworkContent {
/** Gets the [[MouseDownChangedEvent]] */
readonly onMouseDownChangedEvent: MouseDownChangedEvent;
/** Determines if the mouse is down in a content view */
readonly isMouseDown: boolean;
/** Sets the mouse down status for a content view */
setMouseDown(mouseDown: boolean): void;
/** Gets the [[ActiveContentChangedEvent]] */
readonly onActiveContentChangedEvent: ActiveContentChangedEvent;
/** Fires when floating contents are added or removed */
// eslint-disable-next-line deprecation/deprecation
readonly onAvailableContentChangedEvent: UiEvent<{ contentId: string }>;
/** Gets the active content as a React.ReactNode. */
getActive(): React.ReactNode | undefined;
/** Return the active ContentControl. */
getActiveContentControl(): ContentControl | undefined;
addFloatingContentControl(contentControl?: ContentControl): void;
dropFloatingContentControl(contentControl?: ContentControl): void;
/** Sets the active [[ContentControl]] */
setActive(
activeContent?: React.ReactNode,
forceEventProcessing?: boolean
): void;
/** Refreshes the active [[ContentControl]] */
refreshActive(activeContent: React.ReactNode): void;
/**
* Determines if content displays a Sheet view.
* @param content ContentControl to check
*/
isContentSheetView(content: ContentControl | undefined): boolean;
/**
* Determines if content displays a Drawing view.
* @param content ContentControl to check
*/
isContentDrawingView(content: ContentControl | undefined): boolean;
/**
* Determines if content displays a Spatial view.
* @param content ContentControl to check
*/
isContentSpatialView(content: ContentControl | undefined): boolean;
/**
* Determines if content displays a Orthographic view.
* @param content ContentControl to check
*/
isContentOrthographicView(content: ContentControl | undefined): boolean;
/**
* Determines if content displays a 3d view.
* @param content ContentControl to check
*/
isContent3dView(content: ContentControl | undefined): boolean;
/**
* Determines if viewport supports use of a camera.
* @param content ContentControl to check
*/
contentSupportsCamera(content: ContentControl | undefined): boolean;
/**
* Manage content layouts.
* @public
*/
readonly layouts: {
/** build a layout key that is unique for group layout combination */
getKey(props: { contentGroupId: string; layoutId: string }): string;
/** Return a LayoutDef that is specific to a content group.
* @returns the [[ContentLayoutDef]] if found, or undefined otherwise
*/
getForGroup(
contentGroupProps: ContentGroupProps | ContentGroup,
overrideContentLayout?: ContentLayoutProps
): ContentLayoutDef;
/** Finds a Content Layout with a given id.
* @param layoutKey group specific layout id, see `getLayoutKey`
* @returns the [[ContentLayoutDef]] if found, or undefined otherwise
*/
find(layoutKey: string): ContentLayoutDef | undefined;
/** Adds a Content Layout.
* @param layoutId the id of the Content Layout to add
* @param layoutDef the Content Layout definition to add
*/
add(layoutId: string, layoutDef: ContentLayoutDef): void;
/** Gets the active Content Layout */
readonly activeLayout: ContentLayoutDef | undefined;
/** Gets the active Content Group */
readonly activeContentGroup: ContentGroup | undefined;
/** Sets the active Content Layout, Content Group and Content Control.
* @param contentLayoutDef Content layout to make active
* @param contentGroup Content Group to make active
*/
setActive(
contentLayoutDef: ContentLayoutDef,
contentGroup: ContentGroup
): Promise<void>;
/** Sets the active Content Group.
* @param contentGroup Content Group to make active
*/
setActiveContentGroup(contentGroup: ContentGroup): Promise<void>;
/** Refreshes the active layout and content group.
*/
refreshActive(): void;
};
/**
* Manage dialogs displaying managed content.
* @beta
*/
readonly dialogs: FrameworkStackedDialog<ContentDialogInfo> & {
/** Content Dialog Changed Event */
readonly onContentDialogChangedEvent: ContentDialogChangedEvent;
};
}