@itwin/presentation-frontend 5.0.0-dev.1 → 5.0.0-dev.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -1
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +3 -3
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +11 -9
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-frontend/IModelConnectionInitialization.d.ts +13 -0
- package/lib/cjs/presentation-frontend/IModelConnectionInitialization.d.ts.map +1 -0
- package/lib/cjs/presentation-frontend/IModelConnectionInitialization.js +22 -0
- package/lib/cjs/presentation-frontend/IModelConnectionInitialization.js.map +1 -0
- package/lib/cjs/presentation-frontend/InternalSymbols.d.ts +6 -0
- package/lib/cjs/presentation-frontend/InternalSymbols.d.ts.map +1 -0
- package/lib/cjs/presentation-frontend/InternalSymbols.js +17 -0
- package/lib/cjs/presentation-frontend/InternalSymbols.js.map +1 -0
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +7 -7
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.js +7 -6
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts +15 -14
- package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js +31 -45
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +12 -23
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +81 -78
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.js +2 -4
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +2 -4
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +6 -4
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js +1 -0
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +9 -19
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +163 -153
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +4 -5
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +27 -29
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -0
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +10 -4
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +2 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +1 -0
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +5 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -0
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +8 -5
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +35 -13
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +2 -0
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +3 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +31 -15
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +218 -120
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +11 -9
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +6 -11
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.d.ts +15 -15
- package/lib/cjs/presentation-frontend.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend.js +30 -29
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +3 -3
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +11 -9
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-frontend/IModelConnectionInitialization.d.ts +13 -0
- package/lib/esm/presentation-frontend/IModelConnectionInitialization.d.ts.map +1 -0
- package/lib/esm/presentation-frontend/IModelConnectionInitialization.js +17 -0
- package/lib/esm/presentation-frontend/IModelConnectionInitialization.js.map +1 -0
- package/lib/esm/presentation-frontend/InternalSymbols.d.ts +6 -0
- package/lib/esm/presentation-frontend/InternalSymbols.d.ts.map +1 -0
- package/lib/esm/presentation-frontend/InternalSymbols.js +14 -0
- package/lib/esm/presentation-frontend/InternalSymbols.js.map +1 -0
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +8 -8
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -2
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts +15 -14
- package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.js +24 -38
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +12 -23
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +67 -64
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.js +2 -4
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +2 -4
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js +6 -4
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.js +1 -0
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +9 -19
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +164 -154
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +4 -5
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +27 -29
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -0
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +9 -3
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +2 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +1 -0
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +5 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -0
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +8 -5
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +35 -13
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +2 -0
- package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +3 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +31 -15
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +204 -106
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +11 -9
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +7 -11
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.d.ts +15 -15
- package/lib/esm/presentation-frontend.d.ts.map +1 -1
- package/lib/esm/presentation-frontend.js +12 -15
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +43 -43
|
@@ -11,12 +11,15 @@ exports.PresentationManager = void 0;
|
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
12
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
13
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
14
|
+
const internal_1 = require("@itwin/presentation-common/internal");
|
|
15
|
+
const unified_selection_1 = require("@itwin/unified-selection");
|
|
16
|
+
const IpcRequestsHandler_js_1 = require("./IpcRequestsHandler.js");
|
|
17
|
+
const LocalizationHelper_js_1 = require("./LocalizationHelper.js");
|
|
18
|
+
const RulesetManager_js_1 = require("./RulesetManager.js");
|
|
19
|
+
const RulesetVariablesManager_js_1 = require("./RulesetVariablesManager.js");
|
|
20
|
+
const StreamedResponseGenerator_js_1 = require("./StreamedResponseGenerator.js");
|
|
21
|
+
const IModelConnectionInitialization_js_1 = require("./IModelConnectionInitialization.js");
|
|
22
|
+
const InternalSymbols_js_1 = require("./InternalSymbols.js");
|
|
20
23
|
/**
|
|
21
24
|
* Frontend Presentation manager which basically just forwards all calls to
|
|
22
25
|
* the backend implementation.
|
|
@@ -24,6 +27,23 @@ const StreamedResponseGenerator_1 = require("./StreamedResponseGenerator");
|
|
|
24
27
|
* @public
|
|
25
28
|
*/
|
|
26
29
|
class PresentationManager {
|
|
30
|
+
_requestsHandler;
|
|
31
|
+
_rulesets;
|
|
32
|
+
_localizationHelper;
|
|
33
|
+
_explicitActiveUnitSystem;
|
|
34
|
+
_rulesetVars;
|
|
35
|
+
_clearEventListener;
|
|
36
|
+
_schemaContextProvider;
|
|
37
|
+
_defaultFormats;
|
|
38
|
+
_ipcRequestsHandler;
|
|
39
|
+
/**
|
|
40
|
+
* An event raised when hierarchies created using specific ruleset change
|
|
41
|
+
*/
|
|
42
|
+
onIModelHierarchyChanged = new core_bentley_1.BeEvent();
|
|
43
|
+
/**
|
|
44
|
+
* An event raised when content created using specific ruleset changes
|
|
45
|
+
*/
|
|
46
|
+
onIModelContentChanged = new core_bentley_1.BeEvent();
|
|
27
47
|
/**
|
|
28
48
|
* Get / set active unit system used to format property values with units.
|
|
29
49
|
*
|
|
@@ -38,33 +58,22 @@ class PresentationManager {
|
|
|
38
58
|
this._explicitActiveUnitSystem = value;
|
|
39
59
|
}
|
|
40
60
|
constructor(props) {
|
|
41
|
-
/**
|
|
42
|
-
* An event raised when hierarchies created using specific ruleset change
|
|
43
|
-
*/
|
|
44
|
-
this.onIModelHierarchyChanged = new core_bentley_1.BeEvent();
|
|
45
|
-
/**
|
|
46
|
-
* An event raised when content created using specific ruleset changes
|
|
47
|
-
*/
|
|
48
|
-
this.onIModelContentChanged = new core_bentley_1.BeEvent();
|
|
49
|
-
this.onUpdate = (_evt, report) => {
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
51
|
-
this.handleUpdateAsync(report);
|
|
52
|
-
};
|
|
53
61
|
if (props) {
|
|
54
62
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
55
63
|
this._explicitActiveUnitSystem = props.activeUnitSystem;
|
|
56
64
|
}
|
|
57
65
|
this._requestsHandler =
|
|
58
|
-
props?.rpcRequestsHandler ??
|
|
66
|
+
props?.rpcRequestsHandler ??
|
|
67
|
+
new internal_1.RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);
|
|
59
68
|
this._rulesetVars = new Map();
|
|
60
|
-
this._rulesets =
|
|
61
|
-
this._localizationHelper = new
|
|
69
|
+
this._rulesets = RulesetManager_js_1.RulesetManagerImpl.create();
|
|
70
|
+
this._localizationHelper = new LocalizationHelper_js_1.FrontendLocalizationHelper(props?.activeLocale);
|
|
62
71
|
this._schemaContextProvider = props?.schemaContextProvider;
|
|
63
72
|
this._defaultFormats = props?.defaultFormats;
|
|
64
73
|
if (core_frontend_1.IpcApp.isValid) {
|
|
65
74
|
// Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.
|
|
66
|
-
this._clearEventListener = core_frontend_1.IpcApp.addListener(
|
|
67
|
-
this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new
|
|
75
|
+
this._clearEventListener = core_frontend_1.IpcApp.addListener(internal_1.PresentationIpcEvents.Update, this.onUpdate);
|
|
76
|
+
this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler_js_1.IpcRequestsHandler(this._requestsHandler.clientId);
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
/** Get / set active locale used for localizing presentation data */
|
|
@@ -74,22 +83,31 @@ class PresentationManager {
|
|
|
74
83
|
set activeLocale(locale) {
|
|
75
84
|
this._localizationHelper.locale = locale;
|
|
76
85
|
}
|
|
77
|
-
dispose() {
|
|
86
|
+
[Symbol.dispose]() {
|
|
78
87
|
if (this._clearEventListener) {
|
|
79
88
|
this._clearEventListener();
|
|
80
89
|
this._clearEventListener = undefined;
|
|
81
90
|
}
|
|
82
91
|
}
|
|
92
|
+
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
93
|
+
/* c8 ignore next 3 */
|
|
94
|
+
dispose() {
|
|
95
|
+
this[Symbol.dispose]();
|
|
96
|
+
}
|
|
97
|
+
onUpdate = (_evt, report) => {
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
99
|
+
this.handleUpdateAsync(report);
|
|
100
|
+
};
|
|
83
101
|
/** @note This is only called in native apps after changes in iModels */
|
|
84
102
|
async handleUpdateAsync(report) {
|
|
85
103
|
for (const imodelKey in report) {
|
|
86
|
-
|
|
104
|
+
/* c8 ignore next 3 */
|
|
87
105
|
if (!report.hasOwnProperty(imodelKey)) {
|
|
88
106
|
continue;
|
|
89
107
|
}
|
|
90
108
|
const imodelReport = report[imodelKey];
|
|
91
109
|
for (const rulesetId in imodelReport) {
|
|
92
|
-
|
|
110
|
+
/* c8 ignore next 3 */
|
|
93
111
|
if (!imodelReport.hasOwnProperty(rulesetId)) {
|
|
94
112
|
continue;
|
|
95
113
|
}
|
|
@@ -103,17 +121,6 @@ class PresentationManager {
|
|
|
103
121
|
}
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Function that is called when a new IModelConnection is used to retrieve data.
|
|
108
|
-
* @internal
|
|
109
|
-
*/
|
|
110
|
-
startIModelInitialization(_) { }
|
|
111
|
-
/**
|
|
112
|
-
* Function that should be called to finish initialization that was started at [[PresentationManager.startIModelInitialization]].
|
|
113
|
-
* Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.
|
|
114
|
-
* @internal
|
|
115
|
-
*/
|
|
116
|
-
async ensureIModelInitialized(_) { }
|
|
117
124
|
/**
|
|
118
125
|
* Create a new PresentationManager instance
|
|
119
126
|
* @param props Optional properties used to configure the manager
|
|
@@ -122,11 +129,11 @@ class PresentationManager {
|
|
|
122
129
|
return new PresentationManager(props);
|
|
123
130
|
}
|
|
124
131
|
/** @internal */
|
|
125
|
-
get
|
|
132
|
+
get [InternalSymbols_js_1._presentation_manager_rpcRequestsHandler]() {
|
|
126
133
|
return this._requestsHandler;
|
|
127
134
|
}
|
|
128
135
|
/** @internal */
|
|
129
|
-
get
|
|
136
|
+
get [InternalSymbols_js_1._presentation_manager_ipcRequestsHandler]() {
|
|
130
137
|
return this._ipcRequestsHandler;
|
|
131
138
|
}
|
|
132
139
|
/**
|
|
@@ -141,7 +148,7 @@ class PresentationManager {
|
|
|
141
148
|
*/
|
|
142
149
|
vars(rulesetId) {
|
|
143
150
|
if (!this._rulesetVars.has(rulesetId)) {
|
|
144
|
-
const varsManager = new
|
|
151
|
+
const varsManager = new RulesetVariablesManager_js_1.RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);
|
|
145
152
|
this._rulesetVars.set(rulesetId, varsManager);
|
|
146
153
|
}
|
|
147
154
|
return this._rulesetVars.get(rulesetId);
|
|
@@ -192,17 +199,16 @@ class PresentationManager {
|
|
|
192
199
|
}
|
|
193
200
|
/** Returns an iterator that polls nodes asynchronously. */
|
|
194
201
|
async getNodesIterator(requestOptions) {
|
|
195
|
-
|
|
202
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
196
203
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
197
204
|
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
198
|
-
const generator = new
|
|
205
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
199
206
|
...requestOptions,
|
|
200
207
|
getBatch: async (paging) => {
|
|
201
208
|
const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });
|
|
202
209
|
return {
|
|
203
210
|
total: result.total,
|
|
204
|
-
|
|
205
|
-
items: this._localizationHelper.getLocalizedNodes(result.items.map(presentation_common_1.Node.fromJSON)),
|
|
211
|
+
items: this._localizationHelper.getLocalizedNodes(result.items),
|
|
206
212
|
};
|
|
207
213
|
},
|
|
208
214
|
});
|
|
@@ -218,7 +224,7 @@ class PresentationManager {
|
|
|
218
224
|
}
|
|
219
225
|
/** Retrieves nodes count. */
|
|
220
226
|
async getNodesCount(requestOptions) {
|
|
221
|
-
|
|
227
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
222
228
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
223
229
|
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
224
230
|
return this._requestsHandler.getNodesCount(rpcOptions);
|
|
@@ -239,7 +245,7 @@ class PresentationManager {
|
|
|
239
245
|
* @public
|
|
240
246
|
*/
|
|
241
247
|
async getNodesDescriptor(requestOptions) {
|
|
242
|
-
|
|
248
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
243
249
|
try {
|
|
244
250
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
245
251
|
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
@@ -248,25 +254,23 @@ class PresentationManager {
|
|
|
248
254
|
return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
|
|
249
255
|
}
|
|
250
256
|
finally {
|
|
251
|
-
await
|
|
257
|
+
await (0, IModelConnectionInitialization_js_1.ensureIModelInitialized)(requestOptions.imodel);
|
|
252
258
|
}
|
|
253
259
|
}
|
|
254
260
|
/** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
|
|
255
261
|
async getNodePaths(requestOptions) {
|
|
256
|
-
|
|
262
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
257
263
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
258
264
|
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
259
265
|
const result = await this._requestsHandler.getNodePaths(rpcOptions);
|
|
260
|
-
|
|
261
|
-
return result.map(presentation_common_1.NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
|
|
266
|
+
return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
|
|
262
267
|
}
|
|
263
268
|
/** Retrieves paths from root nodes to nodes containing filter text in their label. */
|
|
264
269
|
async getFilteredNodePaths(requestOptions) {
|
|
265
|
-
|
|
270
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
266
271
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
267
272
|
const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));
|
|
268
|
-
|
|
269
|
-
return result.map(presentation_common_1.NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
|
|
273
|
+
return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
|
|
270
274
|
}
|
|
271
275
|
/**
|
|
272
276
|
* Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
|
|
@@ -274,14 +278,14 @@ class PresentationManager {
|
|
|
274
278
|
* @public
|
|
275
279
|
*/
|
|
276
280
|
async getContentSources(requestOptions) {
|
|
277
|
-
|
|
281
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
278
282
|
const rpcOptions = this.toRpcTokenOptions(requestOptions);
|
|
279
283
|
const result = await this._requestsHandler.getContentSources(rpcOptions);
|
|
280
|
-
return presentation_common_1.SelectClassInfo.
|
|
284
|
+
return result.sources.map((sourceJson) => presentation_common_1.SelectClassInfo.fromCompressedJSON(sourceJson, result.classesMap));
|
|
281
285
|
}
|
|
282
286
|
/** Retrieves the content descriptor which describes the content and can be used to customize it. */
|
|
283
287
|
async getContentDescriptor(requestOptions) {
|
|
284
|
-
|
|
288
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
285
289
|
try {
|
|
286
290
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
287
291
|
const rpcOptions = this.toRpcTokenOptions({
|
|
@@ -293,12 +297,12 @@ class PresentationManager {
|
|
|
293
297
|
return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
|
|
294
298
|
}
|
|
295
299
|
finally {
|
|
296
|
-
await
|
|
300
|
+
await (0, IModelConnectionInitialization_js_1.ensureIModelInitialized)(requestOptions.imodel);
|
|
297
301
|
}
|
|
298
302
|
}
|
|
299
303
|
/** Retrieves overall content set size. */
|
|
300
304
|
async getContentSetSize(requestOptions) {
|
|
301
|
-
|
|
305
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
302
306
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
303
307
|
const rpcOptions = this.toRpcTokenOptions({
|
|
304
308
|
...options,
|
|
@@ -320,7 +324,7 @@ class PresentationManager {
|
|
|
320
324
|
let contentFormatter;
|
|
321
325
|
if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {
|
|
322
326
|
const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);
|
|
323
|
-
contentFormatter = new
|
|
327
|
+
contentFormatter = new internal_1.ContentFormatter(new internal_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? core_frontend_1.IModelApp.quantityFormatter.activeUnitSystem);
|
|
324
328
|
}
|
|
325
329
|
let descriptor = requestOptions.descriptor instanceof presentation_common_1.Descriptor ? requestOptions.descriptor : undefined;
|
|
326
330
|
let firstPage;
|
|
@@ -332,7 +336,7 @@ class PresentationManager {
|
|
|
332
336
|
descriptor = presentation_common_1.Descriptor.fromJSON(firstPageResponse?.descriptor);
|
|
333
337
|
firstPage = firstPageResponse?.contentSet;
|
|
334
338
|
}
|
|
335
|
-
|
|
339
|
+
/* c8 ignore next 3 */
|
|
336
340
|
if (!descriptor) {
|
|
337
341
|
return undefined;
|
|
338
342
|
}
|
|
@@ -350,7 +354,7 @@ class PresentationManager {
|
|
|
350
354
|
items,
|
|
351
355
|
};
|
|
352
356
|
};
|
|
353
|
-
const generator = new
|
|
357
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
354
358
|
...requestOptions,
|
|
355
359
|
getBatch: getPage,
|
|
356
360
|
});
|
|
@@ -361,12 +365,12 @@ class PresentationManager {
|
|
|
361
365
|
}
|
|
362
366
|
/** Retrieves a content descriptor, item count and async generator for the items themselves. */
|
|
363
367
|
async getContentIterator(requestOptions) {
|
|
364
|
-
|
|
368
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
365
369
|
const response = await this.getContentIteratorInternal(requestOptions);
|
|
366
370
|
if (!response) {
|
|
367
371
|
return undefined;
|
|
368
372
|
}
|
|
369
|
-
await
|
|
373
|
+
await (0, IModelConnectionInitialization_js_1.ensureIModelInitialized)(requestOptions.imodel);
|
|
370
374
|
return response;
|
|
371
375
|
}
|
|
372
376
|
/**
|
|
@@ -395,21 +399,20 @@ class PresentationManager {
|
|
|
395
399
|
}
|
|
396
400
|
/** Returns an iterator that asynchronously polls distinct values of specific field from the content. */
|
|
397
401
|
async getDistinctValuesIterator(requestOptions) {
|
|
398
|
-
|
|
402
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
399
403
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
400
404
|
const rpcOptions = {
|
|
401
405
|
...this.toRpcTokenOptions(options),
|
|
402
406
|
descriptor: getDescriptorOverrides(options.descriptor),
|
|
403
407
|
keys: stripTransientElementKeys(options.keys).toJSON(),
|
|
404
408
|
};
|
|
405
|
-
const generator = new
|
|
409
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
406
410
|
...requestOptions,
|
|
407
411
|
getBatch: async (paging) => {
|
|
408
412
|
const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });
|
|
409
413
|
return {
|
|
410
414
|
total: response.total,
|
|
411
|
-
|
|
412
|
-
items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(presentation_common_1.DisplayValueGroup.fromJSON(x))),
|
|
415
|
+
items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(x)),
|
|
413
416
|
};
|
|
414
417
|
},
|
|
415
418
|
});
|
|
@@ -431,9 +434,9 @@ class PresentationManager {
|
|
|
431
434
|
* @public
|
|
432
435
|
*/
|
|
433
436
|
async getElementProperties(requestOptions) {
|
|
434
|
-
|
|
437
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
435
438
|
const { elementId, contentParser, ...optionsNoElementId } = requestOptions;
|
|
436
|
-
const parser = contentParser ??
|
|
439
|
+
const parser = contentParser ?? internal_1.buildElementProperties;
|
|
437
440
|
const iter = await this.getContentIterator({
|
|
438
441
|
...optionsNoElementId,
|
|
439
442
|
descriptor: {
|
|
@@ -453,13 +456,13 @@ class PresentationManager {
|
|
|
453
456
|
* @public
|
|
454
457
|
*/
|
|
455
458
|
async getContentInstanceKeys(requestOptions) {
|
|
456
|
-
|
|
459
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
457
460
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
458
461
|
const rpcOptions = {
|
|
459
462
|
...this.toRpcTokenOptions(options),
|
|
460
463
|
keys: stripTransientElementKeys(options.keys).toJSON(),
|
|
461
464
|
};
|
|
462
|
-
const generator = new
|
|
465
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
463
466
|
...requestOptions,
|
|
464
467
|
getBatch: async (page) => {
|
|
465
468
|
const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });
|
|
@@ -484,16 +487,16 @@ class PresentationManager {
|
|
|
484
487
|
}
|
|
485
488
|
/** Retrieves display label definition of specific item. */
|
|
486
489
|
async getDisplayLabelDefinition(requestOptions) {
|
|
487
|
-
|
|
490
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
488
491
|
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
489
492
|
const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);
|
|
490
493
|
return this._localizationHelper.getLocalizedLabelDefinition(result);
|
|
491
494
|
}
|
|
492
495
|
/** Retrieves display label definition of specific items. */
|
|
493
496
|
async getDisplayLabelDefinitionsIterator(requestOptions) {
|
|
494
|
-
|
|
497
|
+
(0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
|
|
495
498
|
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
496
|
-
const generator = new
|
|
499
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
497
500
|
...requestOptions,
|
|
498
501
|
getBatch: async (page) => {
|
|
499
502
|
const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);
|
|
@@ -521,16 +524,16 @@ const getDescriptorOverrides = (descriptorOrOverrides) => {
|
|
|
521
524
|
return descriptorOrOverrides;
|
|
522
525
|
};
|
|
523
526
|
const stripTransientElementKeys = (keys) => {
|
|
524
|
-
if (!keys.some((key) => presentation_common_1.Key.isInstanceKey(key) && key.className ===
|
|
527
|
+
if (!keys.some((key) => presentation_common_1.Key.isInstanceKey(key) && key.className === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME)) {
|
|
525
528
|
return keys;
|
|
526
529
|
}
|
|
527
530
|
const copy = new presentation_common_1.KeySet();
|
|
528
531
|
copy.add(keys, (key) => {
|
|
529
532
|
// the callback is not going to be called with EntityProps as KeySet converts them
|
|
530
533
|
// to InstanceKeys, but we want to keep the EntityProps case for correctness
|
|
531
|
-
|
|
532
|
-
const isTransient = (presentation_common_1.Key.isInstanceKey(key) && key.className ===
|
|
533
|
-
(presentation_common_1.Key.isEntityProps(key) && key.classFullName ===
|
|
534
|
+
/* c8 ignore next 3 */
|
|
535
|
+
const isTransient = (presentation_common_1.Key.isInstanceKey(key) && key.className === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME) ||
|
|
536
|
+
(presentation_common_1.Key.isEntityProps(key) && key.classFullName === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME);
|
|
534
537
|
return !isTransient;
|
|
535
538
|
});
|
|
536
539
|
return copy;
|