@itwin/presentation-frontend 5.0.0-dev.90 → 5.0.0-dev.93
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/lib/cjs/package.json +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 +6 -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 +6 -6
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts +3 -3
- package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js +14 -14
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +5 -4
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +25 -24
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +2 -2
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +24 -25
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +2 -2
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +7 -11
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +4 -2
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +4 -4
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +27 -27
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +2 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- 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/IpcRequestsHandler.d.ts +12 -3
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +6 -7
- 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 +2 -2
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts +3 -3
- package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.js +7 -7
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +5 -4
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +13 -12
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +2 -2
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +24 -25
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +2 -2
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +6 -10
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +4 -2
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +4 -4
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +11 -11
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +2 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- 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 +35 -34
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commojs" }
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { RulesetVariable
|
|
1
|
+
import { RulesetVariable } from "@itwin/presentation-common";
|
|
2
|
+
interface SetRulesetVariableParams {
|
|
3
|
+
rulesetId: string;
|
|
4
|
+
variable: RulesetVariable;
|
|
5
|
+
}
|
|
6
|
+
interface UnsetRulesetVariableParams {
|
|
7
|
+
rulesetId: string;
|
|
8
|
+
variableId: string;
|
|
9
|
+
}
|
|
2
10
|
/** @internal */
|
|
3
11
|
export declare class IpcRequestsHandler {
|
|
4
12
|
private _ipcProxy;
|
|
5
13
|
readonly clientId: string;
|
|
6
14
|
constructor(clientId: string);
|
|
7
|
-
setRulesetVariable(params:
|
|
8
|
-
unsetRulesetVariable(params:
|
|
15
|
+
setRulesetVariable(params: SetRulesetVariableParams): Promise<void>;
|
|
16
|
+
unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;
|
|
9
17
|
}
|
|
18
|
+
export {};
|
|
10
19
|
//# sourceMappingURL=IpcRequestsHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,UAAU,wBAAwB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,UAAU,0BAA0B;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAgF;IACjG,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM;IAIf,kBAAkB,CAAC,MAAM,EAAE,wBAAwB;IAQnD,oBAAoB,CAAC,MAAM,EAAE,0BAA0B;CAMrE"}
|
|
@@ -7,27 +7,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.IpcRequestsHandler = void 0;
|
|
8
8
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
9
9
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
10
|
+
const internal_1 = require("@itwin/presentation-common/internal");
|
|
10
11
|
/** @internal */
|
|
11
12
|
class IpcRequestsHandler {
|
|
12
|
-
_ipcProxy = core_frontend_1.IpcApp.makeIpcProxy(
|
|
13
|
+
_ipcProxy = core_frontend_1.IpcApp.makeIpcProxy(internal_1.PRESENTATION_IPC_CHANNEL_NAME);
|
|
13
14
|
clientId;
|
|
14
15
|
constructor(clientId) {
|
|
15
16
|
this.clientId = clientId;
|
|
16
17
|
}
|
|
17
18
|
async setRulesetVariable(params) {
|
|
18
|
-
|
|
19
|
+
return this._ipcProxy.setRulesetVariable({
|
|
19
20
|
...params,
|
|
20
21
|
clientId: this.clientId,
|
|
21
22
|
variable: presentation_common_1.RulesetVariable.toJSON(params.variable),
|
|
22
|
-
};
|
|
23
|
-
return this._ipcProxy.setRulesetVariable(jsonParams);
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
25
|
async unsetRulesetVariable(params) {
|
|
26
|
-
|
|
26
|
+
return this._ipcProxy.unsetRulesetVariable({
|
|
27
27
|
...params,
|
|
28
28
|
clientId: this.clientId,
|
|
29
|
-
};
|
|
30
|
-
return this._ipcProxy.unsetRulesetVariable(jsonParams);
|
|
29
|
+
});
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
exports.IpcRequestsHandler = IpcRequestsHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,wDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,wDAA8C;AAC9C,oEAA6D;AAC7D,kEAA8G;AAY9G,gBAAgB;AAChB,MAAa,kBAAkB;IACrB,SAAS,GAAG,sBAAM,CAAC,YAAY,CAA2B,wCAA6B,CAAC,CAAC;IACjF,QAAQ,CAAS;IAEjC,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAgC;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;YACvC,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,qCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAkC;QAClE,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YACzC,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;CACF;AAtBD,gDAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IpcApp } from \"@itwin/core-frontend\";\nimport { RulesetVariable } from \"@itwin/presentation-common\";\nimport { PRESENTATION_IPC_CHANNEL_NAME, PresentationIpcInterface } from \"@itwin/presentation-common/internal\";\n\ninterface SetRulesetVariableParams {\n rulesetId: string;\n variable: RulesetVariable;\n}\n\ninterface UnsetRulesetVariableParams {\n rulesetId: string;\n variableId: string;\n}\n\n/** @internal */\nexport class IpcRequestsHandler {\n private _ipcProxy = IpcApp.makeIpcProxy<PresentationIpcInterface>(PRESENTATION_IPC_CHANNEL_NAME);\n public readonly clientId: string;\n\n constructor(clientId: string) {\n this.clientId = clientId;\n }\n\n public async setRulesetVariable(params: SetRulesetVariableParams) {\n return this._ipcProxy.setRulesetVariable({\n ...params,\n clientId: this.clientId,\n variable: RulesetVariable.toJSON(params.variable),\n });\n }\n\n public async unsetRulesetVariable(params: UnsetRulesetVariableParams) {\n return this._ipcProxy.unsetRulesetVariable({\n ...params,\n clientId: this.clientId,\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAKzE,gBAAgB;AAChB,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,OAAO,CAAC,KAAK,CAAqB;gBACtB,IAAI,CAAC,EAAE,MAAM;IAKzB,IAAW,MAAM,IAGS,MAAM,GAAG,SAAS,CAD3C;IACD,IAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAE3C;WAEmB,kBAAkB;WAKxB,oBAAoB;CAGnC"}
|
|
@@ -5,14 +5,14 @@ exports.FrontendLocalizationHelper = void 0;
|
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
7
|
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const internal_1 = require("@itwin/presentation-common/internal");
|
|
9
|
+
const Presentation_js_1 = require("./Presentation.js");
|
|
10
10
|
const NAMESPACES = ["Presentation"];
|
|
11
11
|
/** @internal */
|
|
12
|
-
class FrontendLocalizationHelper extends
|
|
12
|
+
class FrontendLocalizationHelper extends internal_1.LocalizationHelper {
|
|
13
13
|
_lang;
|
|
14
14
|
constructor(lang) {
|
|
15
|
-
super({ getLocalizedString: (key) =>
|
|
15
|
+
super({ getLocalizedString: (key) => Presentation_js_1.Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });
|
|
16
16
|
this._lang = lang;
|
|
17
17
|
}
|
|
18
18
|
get locale() {
|
|
@@ -22,11 +22,11 @@ class FrontendLocalizationHelper extends presentation_common_1.LocalizationHelpe
|
|
|
22
22
|
this._lang = locale;
|
|
23
23
|
}
|
|
24
24
|
static async registerNamespaces() {
|
|
25
|
-
const localizationPromises = NAMESPACES.map(async (namespace) =>
|
|
25
|
+
const localizationPromises = NAMESPACES.map(async (namespace) => Presentation_js_1.Presentation.localization.registerNamespace(namespace));
|
|
26
26
|
await Promise.all(localizationPromises);
|
|
27
27
|
}
|
|
28
28
|
static unregisterNamespaces() {
|
|
29
|
-
NAMESPACES.map((namespace) =>
|
|
29
|
+
NAMESPACES.map((namespace) => Presentation_js_1.Presentation.localization.unregisterNamespace(namespace));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.FrontendLocalizationHelper = FrontendLocalizationHelper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,
|
|
1
|
+
{"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-frontend/LocalizationHelper.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,kEAAyE;AACzE,uDAAiD;AAEjD,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC,CAAC;AAEpC,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,6BAAkB;IACxD,KAAK,CAAqB;IAClC,YAAY,IAAa;QACvB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,8BAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAClI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM,CAAC,MAA0B;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,oBAAoB,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,8BAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACzH,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,8BAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAtBD,gEAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { LocalizationHelper } from \"@itwin/presentation-common/internal\";\nimport { Presentation } from \"./Presentation.js\";\n\nconst NAMESPACES = [\"Presentation\"];\n\n/** @internal */\nexport class FrontendLocalizationHelper extends LocalizationHelper {\n private _lang: string | undefined;\n constructor(lang?: string) {\n super({ getLocalizedString: (key) => Presentation.localization.getLocalizedString(key, { defaultValue: key, lng: this._lang }) });\n this._lang = lang;\n }\n\n public get locale() {\n return this._lang;\n }\n public set locale(locale: string | undefined) {\n this._lang = locale;\n }\n\n public static async registerNamespaces() {\n const localizationPromises = NAMESPACES.map(async (namespace) => Presentation.localization.registerNamespace(namespace));\n await Promise.all(localizationPromises);\n }\n\n public static unregisterNamespaces() {\n NAMESPACES.map((namespace) => Presentation.localization.unregisterNamespace(namespace));\n }\n}\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @module Core
|
|
3
3
|
*/
|
|
4
4
|
import { Localization } from "@itwin/core-common";
|
|
5
|
-
import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager";
|
|
6
|
-
import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
|
|
7
|
-
import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager";
|
|
5
|
+
import { FavoritePropertiesManager, FavoritePropertiesManagerProps } from "./favorite-properties/FavoritePropertiesManager.js";
|
|
6
|
+
import { PresentationManager, PresentationManagerProps } from "./PresentationManager.js";
|
|
7
|
+
import { SelectionManager, SelectionManagerProps } from "./selection/SelectionManager.js";
|
|
8
8
|
/**
|
|
9
9
|
* Props for initializing [[Presentation]].
|
|
10
10
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAG/H,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAU1F;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IAExC;;;;;OAKG;IAEH,SAAS,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAE3C,+CAA+C;IAC/C,SAAS,CAAC,EAAE,8BAA8B,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,qBAAa,YAAY;IAEvB,OAAO;IAEP;;;;;;;;;OASG;WACiB,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8CxE;;;OAGG;WACW,SAAS,IAAI,IAAI;IAyB/B;;;OAGG;WACW,6BAA6B,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI;IAIrF,4CAA4C;IAC5C,WAAkB,YAAY,IAAI,mBAAmB,CAKpD;IAED,gBAAgB;WACF,sBAAsB,CAAC,KAAK,EAAE,mBAAmB;IAO/D;;;;;OAKG;IAEH,WAAkB,SAAS,IAAI,gBAAgB,CAK9C;IAED,gBAAgB;WAEF,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;IAIzD;;;OAGG;IACH,WAAkB,kBAAkB,IAAI,yBAAyB,CAKhE;IAED,gBAAgB;WACF,4BAA4B,CAAC,KAAK,EAAE,yBAAyB;IAO3E;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAK7C;IAED,gBAAgB;WACF,eAAe,CAAC,KAAK,EAAE,YAAY;CAGlD"}
|
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.Presentation = void 0;
|
|
11
11
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
12
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
13
|
+
const FavoritePropertiesManager_js_1 = require("./favorite-properties/FavoritePropertiesManager.js");
|
|
14
|
+
const FavoritePropertiesStorage_js_1 = require("./favorite-properties/FavoritePropertiesStorage.js");
|
|
15
|
+
const LocalizationHelper_js_1 = require("./LocalizationHelper.js");
|
|
16
|
+
const PresentationManager_js_1 = require("./PresentationManager.js");
|
|
17
|
+
const SelectionManager_js_1 = require("./selection/SelectionManager.js");
|
|
18
|
+
const SelectionScopesManager_js_1 = require("./selection/SelectionScopesManager.js");
|
|
19
19
|
let localization;
|
|
20
20
|
let presentationManager;
|
|
21
21
|
let selectionManager; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
@@ -32,7 +32,7 @@ const terminationHandlers = [];
|
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
34
|
class Presentation {
|
|
35
|
-
/*
|
|
35
|
+
/* c8 ignore next */
|
|
36
36
|
constructor() { }
|
|
37
37
|
/**
|
|
38
38
|
* Initializes Presentation library for the frontend.
|
|
@@ -57,14 +57,14 @@ class Presentation {
|
|
|
57
57
|
const languages = Presentation.localization.getLanguageList();
|
|
58
58
|
managerProps.activeLocale = languages.length ? languages[0] : undefined;
|
|
59
59
|
}
|
|
60
|
-
presentationManager =
|
|
60
|
+
presentationManager = PresentationManager_js_1.PresentationManager.create(managerProps);
|
|
61
61
|
}
|
|
62
62
|
if (!selectionManager) {
|
|
63
63
|
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
64
|
-
selectionManager = new
|
|
64
|
+
selectionManager = new SelectionManager_js_1.SelectionManager({
|
|
65
65
|
...props?.selection,
|
|
66
66
|
scopes: props?.selection?.scopes ??
|
|
67
|
-
new
|
|
67
|
+
new SelectionScopesManager_js_1.SelectionScopesManager({
|
|
68
68
|
rpcRequestsHandler: presentationManager.rpcRequestsHandler,
|
|
69
69
|
localeProvider: () => this.presentation.activeLocale,
|
|
70
70
|
}),
|
|
@@ -72,13 +72,13 @@ class Presentation {
|
|
|
72
72
|
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
73
73
|
}
|
|
74
74
|
if (!favoritePropertiesManager) {
|
|
75
|
-
favoritePropertiesManager = new
|
|
76
|
-
storage: props?.favorites ? props.favorites.storage : (0,
|
|
75
|
+
favoritePropertiesManager = new FavoritePropertiesManager_js_1.FavoritePropertiesManager({
|
|
76
|
+
storage: props?.favorites ? props.favorites.storage : (0, FavoritePropertiesStorage_js_1.createFavoritePropertiesStorage)(FavoritePropertiesStorage_js_1.DefaultFavoritePropertiesStorageTypes.Noop),
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);
|
|
80
80
|
presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);
|
|
81
|
-
await
|
|
81
|
+
await LocalizationHelper_js_1.FrontendLocalizationHelper.registerNamespaces();
|
|
82
82
|
for (const handler of initializationHandlers) {
|
|
83
83
|
const cleanup = await handler();
|
|
84
84
|
if (cleanup) {
|
|
@@ -94,7 +94,7 @@ class Presentation {
|
|
|
94
94
|
terminationHandlers.forEach((handler) => handler());
|
|
95
95
|
terminationHandlers.length = 0;
|
|
96
96
|
if (localization) {
|
|
97
|
-
|
|
97
|
+
LocalizationHelper_js_1.FrontendLocalizationHelper.unregisterNamespaces();
|
|
98
98
|
}
|
|
99
99
|
if (presentationManager) {
|
|
100
100
|
presentationManager[Symbol.dispose]();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-frontend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wDAAiD;AAEjD,oEAAmF;AACnF,+FAA4H;AAC5H,+FAAyI;AACzI,6DAAkE;AAClE,+DAAsF;AACtF,mEAAuF;AACvF,+EAA4E;AAE5E,IAAI,YAAsC,CAAC;AAC3C,IAAI,mBAAoD,CAAC;AACzD,IAAI,gBAA8C,CAAC,CAAC,uDAAuD;AAC3G,IAAI,yBAAgE,CAAC;AACrE,MAAM,sBAAsB,GAA8C,EAAE,CAAC;AAC7E,MAAM,mBAAmB,GAAsB,EAAE,CAAC;AAuBlD;;;;;;;;GAQG;AACH,MAAa,YAAY;IACvB,0BAA0B;IAC1B,gBAAuB,CAAC;IAExB;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAyB;QACtD,IAAI,CAAC,yBAAS,CAAC,WAAW,EAAE,CAAC;YAC3B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,yEAAyE,CAAC,CAAC;QAC5I,CAAC;QACD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,YAAY,GAAG,yBAAS,CAAC,YAAY,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,MAAM,YAAY,GAAG,KAAK,EAAE,YAAY,IAAI,EAAE,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBAC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E,CAAC;YACxB,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,CAAC;QACD,mBAAmB,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,4DAA4D;IACrD,MAAM,KAAK,SAAS;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,gBAAgB;IAChB,4DAA4D;IACrD,MAAM,CAAC,mBAAmB,CAAC,KAAuB;QACvD,gBAAgB,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,kBAAkB;QAClC,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB,EAAE,CAAC;YAC9B,yBAAyB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,CAAC;QACD,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AAtKD,oCAsKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Localization } from \"@itwin/core-common\";\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager\";\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager\";\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager\";\n\nlet localization: Localization | undefined;\nlet presentationManager: PresentationManager | undefined;\nlet selectionManager: SelectionManager | undefined; // eslint-disable-line @typescript-eslint/no-deprecated\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\nconst terminationHandlers: Array<() => void> = [];\n\n/**\n * Props for initializing [[Presentation]].\n * @public\n */\nexport interface PresentationProps {\n /** Props for [[PresentationManager]]. */\n presentation?: PresentationManagerProps;\n\n /**\n * Props for [[SelectionManager]].\n *\n * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new\n * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n selection?: Partial<SelectionManagerProps>;\n\n /** Props for [[FavoritePropertiesManager]]. */\n favorites?: FavoritePropertiesManagerProps;\n}\n\n/**\n * Static class used to statically set up Presentation library for the frontend.\n * Basically what it does is:\n * - Create a singleton [[PresentationManager]] instance\n * - Create a singleton [[SelectionManager]] instance\n * - Create a singleton [[FavoritePropertiesManager]]] instance\n *\n * @public\n */\nexport class Presentation {\n /* istanbul ignore next */\n private constructor() {}\n\n /**\n * Initializes Presentation library for the frontend.\n *\n * Example:\n * ``` ts\n * [[include:Presentation.Frontend.Initialization]]\n * ```\n *\n * The method should be called after a call to [IModelApp.startup]($core-frontend).\n */\n public static async initialize(props?: PresentationProps): Promise<void> {\n if (!IModelApp.initialized) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"IModelApp.startup must be called before calling Presentation.initialize\");\n }\n if (!localization) {\n localization = IModelApp.localization;\n }\n if (!presentationManager) {\n const managerProps = props?.presentation ?? {};\n if (!managerProps.activeLocale) {\n const languages = Presentation.localization.getLanguageList();\n managerProps.activeLocale = languages.length ? languages[0] : undefined;\n }\n presentationManager = PresentationManager.create(managerProps);\n }\n if (!selectionManager) {\n /* eslint-disable @typescript-eslint/no-deprecated */\n selectionManager = new SelectionManager({\n ...props?.selection,\n scopes:\n props?.selection?.scopes ??\n new SelectionScopesManager({\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\n localeProvider: () => this.presentation.activeLocale,\n }),\n });\n /* eslint-enable @typescript-eslint/no-deprecated */\n }\n if (!favoritePropertiesManager) {\n favoritePropertiesManager = new FavoritePropertiesManager({\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\n });\n }\n\n presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);\n presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);\n\n await FrontendLocalizationHelper.registerNamespaces();\n for (const handler of initializationHandlers) {\n const cleanup = await handler();\n if (cleanup) {\n terminationHandlers.push(cleanup);\n }\n }\n }\n\n /**\n * Terminates Presentation library frontend. This method should be called\n * before a call to [IModelApp.shutdown]($core-frontend)\n */\n public static terminate(): void {\n terminationHandlers.forEach((handler) => handler());\n terminationHandlers.length = 0;\n\n if (localization) {\n FrontendLocalizationHelper.unregisterNamespaces();\n }\n\n if (presentationManager) {\n presentationManager[Symbol.dispose]();\n }\n presentationManager = undefined;\n\n if (favoritePropertiesManager) {\n favoritePropertiesManager[Symbol.dispose]();\n }\n favoritePropertiesManager = undefined;\n\n if (selectionManager) {\n selectionManager[Symbol.dispose]();\n }\n selectionManager = undefined;\n localization = undefined;\n }\n\n /**\n * Registers an additional handler which will be invoked during Presentation library frontend\n * initialization.\n */\n public static registerInitializationHandler(handler: () => Promise<() => void>): void {\n initializationHandlers.push(handler);\n }\n\n /** The singleton [[PresentationManager]] */\n public static get presentation(): PresentationManager {\n if (!presentationManager) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return presentationManager;\n }\n\n /** @internal */\n public static setPresentationManager(value: PresentationManager) {\n if (presentationManager) {\n presentationManager[Symbol.dispose]();\n }\n presentationManager = value;\n }\n\n /**\n * The singleton [[SelectionManager]].\n *\n * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new\n * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static get selection(): SelectionManager {\n if (!selectionManager) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return selectionManager;\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static setSelectionManager(value: SelectionManager) {\n selectionManager = value;\n }\n\n /**\n * The singleton [[FavoritePropertiesManager]]\n * @public\n */\n public static get favoriteProperties(): FavoritePropertiesManager {\n if (!favoritePropertiesManager) {\n throw new Error(\"Favorite Properties must be first initialized by calling Presentation.initialize\");\n }\n return favoritePropertiesManager;\n }\n\n /** @internal */\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\n if (favoritePropertiesManager) {\n favoritePropertiesManager[Symbol.dispose]();\n }\n favoritePropertiesManager = value;\n }\n\n /**\n * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.\n */\n public static get localization(): Localization {\n if (!localization) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return localization;\n }\n\n /** @internal */\n public static setLocalization(value: Localization) {\n localization = value;\n }\n}\n"]}
|
|
1
|
+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CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,gBAAgB;IAChB,4DAA4D;IACrD,MAAM,CAAC,mBAAmB,CAAC,KAAuB;QACvD,gBAAgB,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,kBAAkB;QAClC,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,4BAA4B,CAAC,KAAgC;QACzE,IAAI,yBAAyB,EAAE,CAAC;YAC9B,yBAAyB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,CAAC;QACD,yBAAyB,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,eAAe,CAAC,KAAmB;QAC/C,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;CACF;AAtKD,oCAsKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Localization } from \"@itwin/core-common\";\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\nimport { FavoritePropertiesManager, FavoritePropertiesManagerProps } from \"./favorite-properties/FavoritePropertiesManager.js\";\nimport { createFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes } from \"./favorite-properties/FavoritePropertiesStorage.js\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper.js\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager.js\";\nimport { SelectionManager, SelectionManagerProps } from \"./selection/SelectionManager.js\";\nimport { SelectionScopesManager } from \"./selection/SelectionScopesManager.js\";\n\nlet localization: Localization | undefined;\nlet presentationManager: PresentationManager | undefined;\nlet selectionManager: SelectionManager | undefined; // eslint-disable-line @typescript-eslint/no-deprecated\nlet favoritePropertiesManager: FavoritePropertiesManager | undefined;\nconst initializationHandlers: Array<() => Promise<(() => void) | void>> = [];\nconst terminationHandlers: Array<() => void> = [];\n\n/**\n * Props for initializing [[Presentation]].\n * @public\n */\nexport interface PresentationProps {\n /** Props for [[PresentationManager]]. */\n presentation?: PresentationManagerProps;\n\n /**\n * Props for [[SelectionManager]].\n *\n * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new\n * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n selection?: Partial<SelectionManagerProps>;\n\n /** Props for [[FavoritePropertiesManager]]. */\n favorites?: FavoritePropertiesManagerProps;\n}\n\n/**\n * Static class used to statically set up Presentation library for the frontend.\n * Basically what it does is:\n * - Create a singleton [[PresentationManager]] instance\n * - Create a singleton [[SelectionManager]] instance\n * - Create a singleton [[FavoritePropertiesManager]]] instance\n *\n * @public\n */\nexport class Presentation {\n /* c8 ignore next */\n private constructor() {}\n\n /**\n * Initializes Presentation library for the frontend.\n *\n * Example:\n * ``` ts\n * [[include:Presentation.Frontend.Initialization]]\n * ```\n *\n * The method should be called after a call to [IModelApp.startup]($core-frontend).\n */\n public static async initialize(props?: PresentationProps): Promise<void> {\n if (!IModelApp.initialized) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"IModelApp.startup must be called before calling Presentation.initialize\");\n }\n if (!localization) {\n localization = IModelApp.localization;\n }\n if (!presentationManager) {\n const managerProps = props?.presentation ?? {};\n if (!managerProps.activeLocale) {\n const languages = Presentation.localization.getLanguageList();\n managerProps.activeLocale = languages.length ? languages[0] : undefined;\n }\n presentationManager = PresentationManager.create(managerProps);\n }\n if (!selectionManager) {\n /* eslint-disable @typescript-eslint/no-deprecated */\n selectionManager = new SelectionManager({\n ...props?.selection,\n scopes:\n props?.selection?.scopes ??\n new SelectionScopesManager({\n rpcRequestsHandler: presentationManager.rpcRequestsHandler,\n localeProvider: () => this.presentation.activeLocale,\n }),\n });\n /* eslint-enable @typescript-eslint/no-deprecated */\n }\n if (!favoritePropertiesManager) {\n favoritePropertiesManager = new FavoritePropertiesManager({\n storage: props?.favorites ? props.favorites.storage : createFavoritePropertiesStorage(DefaultFavoritePropertiesStorageTypes.Noop),\n });\n }\n\n presentationManager.startIModelInitialization = (imodel) => favoritePropertiesManager?.startConnectionInitialization(imodel);\n presentationManager.ensureIModelInitialized = async (imodel) => favoritePropertiesManager?.ensureInitialized(imodel);\n\n await FrontendLocalizationHelper.registerNamespaces();\n for (const handler of initializationHandlers) {\n const cleanup = await handler();\n if (cleanup) {\n terminationHandlers.push(cleanup);\n }\n }\n }\n\n /**\n * Terminates Presentation library frontend. This method should be called\n * before a call to [IModelApp.shutdown]($core-frontend)\n */\n public static terminate(): void {\n terminationHandlers.forEach((handler) => handler());\n terminationHandlers.length = 0;\n\n if (localization) {\n FrontendLocalizationHelper.unregisterNamespaces();\n }\n\n if (presentationManager) {\n presentationManager[Symbol.dispose]();\n }\n presentationManager = undefined;\n\n if (favoritePropertiesManager) {\n favoritePropertiesManager[Symbol.dispose]();\n }\n favoritePropertiesManager = undefined;\n\n if (selectionManager) {\n selectionManager[Symbol.dispose]();\n }\n selectionManager = undefined;\n localization = undefined;\n }\n\n /**\n * Registers an additional handler which will be invoked during Presentation library frontend\n * initialization.\n */\n public static registerInitializationHandler(handler: () => Promise<() => void>): void {\n initializationHandlers.push(handler);\n }\n\n /** The singleton [[PresentationManager]] */\n public static get presentation(): PresentationManager {\n if (!presentationManager) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return presentationManager;\n }\n\n /** @internal */\n public static setPresentationManager(value: PresentationManager) {\n if (presentationManager) {\n presentationManager[Symbol.dispose]();\n }\n presentationManager = value;\n }\n\n /**\n * The singleton [[SelectionManager]].\n *\n * @deprecated in 5.0. The whole unified selection system in this package is deprecated in favor of the new\n * [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static get selection(): SelectionManager {\n if (!selectionManager) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return selectionManager;\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static setSelectionManager(value: SelectionManager) {\n selectionManager = value;\n }\n\n /**\n * The singleton [[FavoritePropertiesManager]]\n * @public\n */\n public static get favoriteProperties(): FavoritePropertiesManager {\n if (!favoritePropertiesManager) {\n throw new Error(\"Favorite Properties must be first initialized by calling Presentation.initialize\");\n }\n return favoritePropertiesManager;\n }\n\n /** @internal */\n public static setFavoritePropertiesManager(value: FavoritePropertiesManager) {\n if (favoritePropertiesManager) {\n favoritePropertiesManager[Symbol.dispose]();\n }\n favoritePropertiesManager = value;\n }\n\n /**\n * The localization manager used by Presentation frontend. Returns the result of `IModelApp.i18n`.\n */\n public static get localization(): Localization {\n if (!localization) {\n throw new Error(\"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return localization;\n }\n\n /** @internal */\n public static setLocalization(value: Localization) {\n localization = value;\n }\n}\n"]}
|
|
@@ -5,10 +5,11 @@ import { BeEvent } from "@itwin/core-bentley";
|
|
|
5
5
|
import { IModelConnection } from "@itwin/core-frontend";
|
|
6
6
|
import { UnitSystemKey } from "@itwin/core-quantity";
|
|
7
7
|
import { SchemaContext } from "@itwin/ecschema-metadata";
|
|
8
|
-
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
9
|
+
import { RpcRequestsHandler } from "@itwin/presentation-common/internal";
|
|
10
|
+
import { IpcRequestsHandler } from "./IpcRequestsHandler.js";
|
|
11
|
+
import { RulesetManager } from "./RulesetManager.js";
|
|
12
|
+
import { RulesetVariablesManager } from "./RulesetVariablesManager.js";
|
|
12
13
|
/**
|
|
13
14
|
* Data structure that describes IModel hierarchy change event arguments.
|
|
14
15
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAA0C,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAa,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAA0C,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAa,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EACL,0BAA0B,EAC1B,OAAO,EACP,+BAA+B,EAE/B,iCAAiC,EACjC,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EAEjB,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,iBAAiB,EACjB,4CAA4C,EAC5C,mCAAmC,EACnC,UAAU,EACV,sCAAsC,EACtC,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,IAAI,EAGJ,MAAM,EAEN,eAAe,EACf,IAAI,EACJ,OAAO,EACP,eAAe,EACf,KAAK,EACL,aAAa,EAGb,eAAe,EACf,eAAe,EACf,qCAAqC,EAGtC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKL,kBAAkB,EACnB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAsB,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAA+B,MAAM,8BAA8B,CAAC;AAGpG;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;I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AE,cAAc,CAAC,GAAG,0BAA0B,GACnH,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAoBtC;;;OAGG;IACU,sBAAsB,CACjC,cAAc,EAAE,iCAAiC,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,CAAC,GAAG,0BAA0B,GAAG,4BAA4B,GACvJ,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,cAAc,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;IAiCvE,2DAA2D;IAC9C,yBAAyB,CACpC,cAAc,EAAE,0BAA0B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GACrG,OAAO,CAAC,eAAe,CAAC;IAO3B,4DAA4D;IAC/C,kCAAkC,CAC7C,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GAAG,4BAA4B,GACrI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAA;KAAE,CAAC;IAgB5E;;;OAGG;IACU,0BAA0B,CACrC,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GAAG,4BAA4B,GACrI,OAAO,CAAC,eAAe,EAAE,CAAC;CAI9B"}
|
|
@@ -11,12 +11,13 @@ 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 LocalizationHelper_1 = require("./LocalizationHelper");
|
|
16
|
-
const RulesetManager_1 = require("./RulesetManager");
|
|
17
|
-
const RulesetVariablesManager_1 = require("./RulesetVariablesManager");
|
|
18
|
-
const StreamedResponseGenerator_1 = require("./StreamedResponseGenerator");
|
|
14
|
+
const internal_1 = require("@itwin/presentation-common/internal");
|
|
19
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");
|
|
20
21
|
/**
|
|
21
22
|
* Frontend Presentation manager which basically just forwards all calls to
|
|
22
23
|
* the backend implementation.
|
|
@@ -60,16 +61,16 @@ class PresentationManager {
|
|
|
60
61
|
this._explicitActiveUnitSystem = props.activeUnitSystem;
|
|
61
62
|
}
|
|
62
63
|
this._requestsHandler =
|
|
63
|
-
props?.rpcRequestsHandler ?? new
|
|
64
|
+
props?.rpcRequestsHandler ?? new internal_1.RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);
|
|
64
65
|
this._rulesetVars = new Map();
|
|
65
|
-
this._rulesets =
|
|
66
|
-
this._localizationHelper = new
|
|
66
|
+
this._rulesets = RulesetManager_js_1.RulesetManagerImpl.create();
|
|
67
|
+
this._localizationHelper = new LocalizationHelper_js_1.FrontendLocalizationHelper(props?.activeLocale);
|
|
67
68
|
this._schemaContextProvider = props?.schemaContextProvider;
|
|
68
69
|
this._defaultFormats = props?.defaultFormats;
|
|
69
70
|
if (core_frontend_1.IpcApp.isValid) {
|
|
70
71
|
// Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.
|
|
71
|
-
this._clearEventListener = core_frontend_1.IpcApp.addListener(
|
|
72
|
-
this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new
|
|
72
|
+
this._clearEventListener = core_frontend_1.IpcApp.addListener(internal_1.PresentationIpcEvents.Update, this.onUpdate);
|
|
73
|
+
this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler_js_1.IpcRequestsHandler(this._requestsHandler.clientId);
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
/** Get / set active locale used for localizing presentation data */
|
|
@@ -86,7 +87,7 @@ class PresentationManager {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
89
|
-
|
|
90
|
+
/* c8 ignore next 3 */
|
|
90
91
|
dispose() {
|
|
91
92
|
this[Symbol.dispose]();
|
|
92
93
|
}
|
|
@@ -97,13 +98,13 @@ class PresentationManager {
|
|
|
97
98
|
/** @note This is only called in native apps after changes in iModels */
|
|
98
99
|
async handleUpdateAsync(report) {
|
|
99
100
|
for (const imodelKey in report) {
|
|
100
|
-
|
|
101
|
+
/* c8 ignore next 3 */
|
|
101
102
|
if (!report.hasOwnProperty(imodelKey)) {
|
|
102
103
|
continue;
|
|
103
104
|
}
|
|
104
105
|
const imodelReport = report[imodelKey];
|
|
105
106
|
for (const rulesetId in imodelReport) {
|
|
106
|
-
|
|
107
|
+
/* c8 ignore next 3 */
|
|
107
108
|
if (!imodelReport.hasOwnProperty(rulesetId)) {
|
|
108
109
|
continue;
|
|
109
110
|
}
|
|
@@ -155,7 +156,7 @@ class PresentationManager {
|
|
|
155
156
|
*/
|
|
156
157
|
vars(rulesetId) {
|
|
157
158
|
if (!this._rulesetVars.has(rulesetId)) {
|
|
158
|
-
const varsManager = new
|
|
159
|
+
const varsManager = new RulesetVariablesManager_js_1.RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);
|
|
159
160
|
this._rulesetVars.set(rulesetId, varsManager);
|
|
160
161
|
}
|
|
161
162
|
return this._rulesetVars.get(rulesetId);
|
|
@@ -209,7 +210,7 @@ class PresentationManager {
|
|
|
209
210
|
this.startIModelInitialization(requestOptions.imodel);
|
|
210
211
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
211
212
|
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
212
|
-
const generator = new
|
|
213
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
213
214
|
...requestOptions,
|
|
214
215
|
getBatch: async (paging) => {
|
|
215
216
|
const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });
|
|
@@ -288,7 +289,7 @@ class PresentationManager {
|
|
|
288
289
|
this.startIModelInitialization(requestOptions.imodel);
|
|
289
290
|
const rpcOptions = this.toRpcTokenOptions(requestOptions);
|
|
290
291
|
const result = await this._requestsHandler.getContentSources(rpcOptions);
|
|
291
|
-
return presentation_common_1.SelectClassInfo.
|
|
292
|
+
return result.sources.map((sourceJson) => presentation_common_1.SelectClassInfo.fromCompressedJSON(sourceJson, result.classesMap));
|
|
292
293
|
}
|
|
293
294
|
/** Retrieves the content descriptor which describes the content and can be used to customize it. */
|
|
294
295
|
async getContentDescriptor(requestOptions) {
|
|
@@ -331,7 +332,7 @@ class PresentationManager {
|
|
|
331
332
|
let contentFormatter;
|
|
332
333
|
if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {
|
|
333
334
|
const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);
|
|
334
|
-
contentFormatter = new
|
|
335
|
+
contentFormatter = new internal_1.ContentFormatter(new internal_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? core_frontend_1.IModelApp.quantityFormatter.activeUnitSystem);
|
|
335
336
|
}
|
|
336
337
|
let descriptor = requestOptions.descriptor instanceof presentation_common_1.Descriptor ? requestOptions.descriptor : undefined;
|
|
337
338
|
let firstPage;
|
|
@@ -343,7 +344,7 @@ class PresentationManager {
|
|
|
343
344
|
descriptor = presentation_common_1.Descriptor.fromJSON(firstPageResponse?.descriptor);
|
|
344
345
|
firstPage = firstPageResponse?.contentSet;
|
|
345
346
|
}
|
|
346
|
-
|
|
347
|
+
/* c8 ignore next 3 */
|
|
347
348
|
if (!descriptor) {
|
|
348
349
|
return undefined;
|
|
349
350
|
}
|
|
@@ -361,7 +362,7 @@ class PresentationManager {
|
|
|
361
362
|
items,
|
|
362
363
|
};
|
|
363
364
|
};
|
|
364
|
-
const generator = new
|
|
365
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
365
366
|
...requestOptions,
|
|
366
367
|
getBatch: getPage,
|
|
367
368
|
});
|
|
@@ -413,7 +414,7 @@ class PresentationManager {
|
|
|
413
414
|
descriptor: getDescriptorOverrides(options.descriptor),
|
|
414
415
|
keys: stripTransientElementKeys(options.keys).toJSON(),
|
|
415
416
|
};
|
|
416
|
-
const generator = new
|
|
417
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
417
418
|
...requestOptions,
|
|
418
419
|
getBatch: async (paging) => {
|
|
419
420
|
const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });
|
|
@@ -443,7 +444,7 @@ class PresentationManager {
|
|
|
443
444
|
async getElementProperties(requestOptions) {
|
|
444
445
|
this.startIModelInitialization(requestOptions.imodel);
|
|
445
446
|
const { elementId, contentParser, ...optionsNoElementId } = requestOptions;
|
|
446
|
-
const parser = contentParser ??
|
|
447
|
+
const parser = contentParser ?? internal_1.buildElementProperties;
|
|
447
448
|
const iter = await this.getContentIterator({
|
|
448
449
|
...optionsNoElementId,
|
|
449
450
|
descriptor: {
|
|
@@ -469,7 +470,7 @@ class PresentationManager {
|
|
|
469
470
|
...this.toRpcTokenOptions(options),
|
|
470
471
|
keys: stripTransientElementKeys(options.keys).toJSON(),
|
|
471
472
|
};
|
|
472
|
-
const generator = new
|
|
473
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
473
474
|
...requestOptions,
|
|
474
475
|
getBatch: async (page) => {
|
|
475
476
|
const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });
|
|
@@ -503,7 +504,7 @@ class PresentationManager {
|
|
|
503
504
|
async getDisplayLabelDefinitionsIterator(requestOptions) {
|
|
504
505
|
this.startIModelInitialization(requestOptions.imodel);
|
|
505
506
|
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
506
|
-
const generator = new
|
|
507
|
+
const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
|
|
507
508
|
...requestOptions,
|
|
508
509
|
getBatch: async (page) => {
|
|
509
510
|
const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);
|
|
@@ -538,7 +539,7 @@ const stripTransientElementKeys = (keys) => {
|
|
|
538
539
|
copy.add(keys, (key) => {
|
|
539
540
|
// the callback is not going to be called with EntityProps as KeySet converts them
|
|
540
541
|
// to InstanceKeys, but we want to keep the EntityProps case for correctness
|
|
541
|
-
|
|
542
|
+
/* c8 ignore next 3 */
|
|
542
543
|
const isTransient = (presentation_common_1.Key.isInstanceKey(key) && key.className === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME) ||
|
|
543
544
|
(presentation_common_1.Key.isEntityProps(key) && key.classFullName === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME);
|
|
544
545
|
return !isTransient;
|