@itwin/imodel-components-react 3.0.0-dev.93 → 3.0.0-dev.97
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/imodel-components-react/UiIModelComponents.d.ts +2 -7
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +19 -18
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +2 -7
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.js +20 -19
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/package.json +22 -22
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Common
|
|
3
3
|
*/
|
|
4
|
-
import { Localization } from "@itwin/core-common";
|
|
5
4
|
/**
|
|
6
5
|
* Manages the localization service for the imodel-components-react package.
|
|
7
6
|
* @public
|
|
8
7
|
*/
|
|
9
8
|
export declare class UiIModelComponents {
|
|
10
9
|
private static _initialized;
|
|
11
|
-
private static _localization?;
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param localization The internationalization service created by the application. Defaults to IModelApp.localization.
|
|
11
|
+
* initialize UiIModelComponents.
|
|
15
12
|
*/
|
|
16
|
-
static initialize(
|
|
13
|
+
static initialize(): Promise<void>;
|
|
17
14
|
/** Unregisters the UiIModelComponents localization namespace */
|
|
18
15
|
static terminate(): void;
|
|
19
16
|
/** Determines if UiIModelComponents has been initialized */
|
|
20
17
|
static get initialized(): boolean;
|
|
21
|
-
/** The internationalization service created by the application. */
|
|
22
|
-
static get localization(): Localization;
|
|
23
18
|
/** The internationalization service namespace. */
|
|
24
19
|
static get localizationNamespace(): string;
|
|
25
20
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiIModelComponents.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"UiIModelComponents.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AASH;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IAEpC;;OAEG;WACiB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB/C,gEAAgE;WAClD,SAAS;IAMvB,4DAA4D;IAC5D,WAAkB,WAAW,IAAI,OAAO,CAA4C;IAEpF,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAQvD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
|
|
@@ -13,42 +13,43 @@ const core_bentley_1 = require("@itwin/core-bentley");
|
|
|
13
13
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
14
14
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
15
15
|
const components_react_1 = require("@itwin/components-react");
|
|
16
|
+
const core_common_1 = require("@itwin/core-common");
|
|
16
17
|
/**
|
|
17
18
|
* Manages the localization service for the imodel-components-react package.
|
|
18
19
|
* @public
|
|
19
20
|
*/
|
|
20
21
|
class UiIModelComponents {
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @param localization The internationalization service created by the application. Defaults to IModelApp.localization.
|
|
23
|
+
* initialize UiIModelComponents.
|
|
24
24
|
*/
|
|
25
|
-
static async initialize(
|
|
25
|
+
static async initialize() {
|
|
26
|
+
var _a;
|
|
26
27
|
if (UiIModelComponents._initialized) {
|
|
27
28
|
core_bentley_1.Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
(0, immer_1.enablePatches)();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
await ((_a = core_frontend_1.IModelApp.localization) === null || _a === void 0 ? void 0 : _a.registerNamespace(UiIModelComponents.localizationNamespace));
|
|
33
|
+
if (!core_frontend_1.IModelApp.localization) {
|
|
34
|
+
// it should only get here in unit test where IModelApp is not setup
|
|
35
|
+
const localization = new core_common_1.EmptyLocalization();
|
|
36
|
+
await localization.initialize();
|
|
37
|
+
await components_react_1.UiComponents.initialize(localization);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
await components_react_1.UiComponents.initialize(core_frontend_1.IModelApp.localization);
|
|
41
|
+
}
|
|
34
42
|
UiIModelComponents._initialized = true;
|
|
35
43
|
}
|
|
36
44
|
/** Unregisters the UiIModelComponents localization namespace */
|
|
37
45
|
static terminate() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
UiIModelComponents._localization = undefined;
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = core_frontend_1.IModelApp.localization) === null || _a === void 0 ? void 0 : _a.unregisterNamespace(UiIModelComponents.localizationNamespace);
|
|
41
48
|
components_react_1.UiComponents.terminate();
|
|
42
49
|
UiIModelComponents._initialized = false;
|
|
43
50
|
}
|
|
44
51
|
/** Determines if UiIModelComponents has been initialized */
|
|
45
52
|
static get initialized() { return UiIModelComponents._initialized; }
|
|
46
|
-
/** The internationalization service created by the application. */
|
|
47
|
-
static get localization() {
|
|
48
|
-
if (!UiIModelComponents._localization)
|
|
49
|
-
throw new appui_abstract_1.UiError(UiIModelComponents.loggerCategory(this), "localization: UiIModelComponents.initialize has not been called. Unable to return Localization object.");
|
|
50
|
-
return UiIModelComponents._localization;
|
|
51
|
-
}
|
|
52
53
|
/** The internationalization service namespace. */
|
|
53
54
|
static get localizationNamespace() {
|
|
54
55
|
return "UiIModelComponents";
|
|
@@ -61,11 +62,11 @@ class UiIModelComponents {
|
|
|
61
62
|
* @internal
|
|
62
63
|
*/
|
|
63
64
|
static translate(key) {
|
|
64
|
-
if (!UiIModelComponents.initialized) {
|
|
65
|
-
core_bentley_1.Logger.logError(UiIModelComponents.loggerCategory(this), `translate:
|
|
65
|
+
if (!UiIModelComponents.initialized || /* istanbul ignore next */ !core_frontend_1.IModelApp.localization) {
|
|
66
|
+
core_bentley_1.Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);
|
|
66
67
|
return "";
|
|
67
68
|
}
|
|
68
|
-
return
|
|
69
|
+
return core_frontend_1.IModelApp.localization.getLocalizedStringWithNamespace(UiIModelComponents.localizationNamespace, key);
|
|
69
70
|
}
|
|
70
71
|
/** @internal */
|
|
71
72
|
static loggerCategory(obj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iCAAsC;AACtC,sDAA6C;AAC7C,wDAAiD;
|
|
1
|
+
{"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iCAAsC;AACtC,sDAA6C;AAC7C,wDAAiD;AACjD,0DAAqD;AACrD,8DAAuD;AACvD,oDAAuD;AAEvD;;;GAGG;AACH,MAAa,kBAAkB;IAG7B;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU;;QAC5B,IAAI,kBAAkB,CAAC,YAAY,EAAE;YACnC,qBAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,8CAA8C,CAAC,CAAC;YACtH,OAAO;SACR;QAED,IAA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CAAC,YAAY,CAAC,+BAA+B,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC/G,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA/DH,gDAiEC;AAhEgB,+BAAY,GAAG,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport { enablePatches } from \"immer\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { getClassName } from \"@itwin/appui-abstract\";\r\nimport { UiComponents } from \"@itwin/components-react\";\r\nimport { EmptyLocalization } from \"@itwin/core-common\";\r\n\r\n/**\r\n * Manages the localization service for the imodel-components-react package.\r\n * @public\r\n */\r\nexport class UiIModelComponents {\r\n private static _initialized = false;\r\n\r\n /**\r\n * initialize UiIModelComponents.\r\n */\r\n public static async initialize(): Promise<void> {\r\n if (UiIModelComponents._initialized) {\r\n Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);\r\n return;\r\n }\r\n\r\n enablePatches();\r\n await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);\r\n\r\n if (!IModelApp.localization) {\r\n // it should only get here in unit test where IModelApp is not setup\r\n const localization = new EmptyLocalization();\r\n await localization.initialize();\r\n await UiComponents.initialize(localization);\r\n } else {\r\n await UiComponents.initialize(IModelApp.localization);\r\n }\r\n\r\n UiIModelComponents._initialized = true;\r\n }\r\n\r\n /** Unregisters the UiIModelComponents localization namespace */\r\n public static terminate() {\r\n IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);\r\n UiComponents.terminate();\r\n UiIModelComponents._initialized = false;\r\n }\r\n\r\n /** Determines if UiIModelComponents has been initialized */\r\n public static get initialized(): boolean { return UiIModelComponents._initialized; }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return \"UiIModelComponents\";\r\n }\r\n\r\n /** @internal */\r\n public static get packageName(): string {\r\n return \"imodel-components-react\";\r\n }\r\n\r\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\r\n * @internal\r\n */\r\n public static translate(key: string | string[]): string {\r\n if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {\r\n Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);\r\n return \"\";\r\n }\r\n return IModelApp.localization.getLocalizedStringWithNamespace(UiIModelComponents.localizationNamespace, key);\r\n }\r\n\r\n /** @internal */\r\n public static loggerCategory(obj: any): string {\r\n const className = getClassName(obj);\r\n const category = UiIModelComponents.packageName + (className ? `.${className}` : \"\");\r\n return category;\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Common
|
|
3
3
|
*/
|
|
4
|
-
import { Localization } from "@itwin/core-common";
|
|
5
4
|
/**
|
|
6
5
|
* Manages the localization service for the imodel-components-react package.
|
|
7
6
|
* @public
|
|
8
7
|
*/
|
|
9
8
|
export declare class UiIModelComponents {
|
|
10
9
|
private static _initialized;
|
|
11
|
-
private static _localization?;
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param localization The internationalization service created by the application. Defaults to IModelApp.localization.
|
|
11
|
+
* initialize UiIModelComponents.
|
|
15
12
|
*/
|
|
16
|
-
static initialize(
|
|
13
|
+
static initialize(): Promise<void>;
|
|
17
14
|
/** Unregisters the UiIModelComponents localization namespace */
|
|
18
15
|
static terminate(): void;
|
|
19
16
|
/** Determines if UiIModelComponents has been initialized */
|
|
20
17
|
static get initialized(): boolean;
|
|
21
|
-
/** The internationalization service created by the application. */
|
|
22
|
-
static get localization(): Localization;
|
|
23
18
|
/** The internationalization service namespace. */
|
|
24
19
|
static get localizationNamespace(): string;
|
|
25
20
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiIModelComponents.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"UiIModelComponents.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AASH;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IAEpC;;OAEG;WACiB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB/C,gEAAgE;WAClD,SAAS;IAMvB,4DAA4D;IAC5D,WAAkB,WAAW,IAAI,OAAO,CAA4C;IAEpF,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAQvD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
|
|
@@ -8,44 +8,45 @@
|
|
|
8
8
|
import { enablePatches } from "immer";
|
|
9
9
|
import { Logger } from "@itwin/core-bentley";
|
|
10
10
|
import { IModelApp } from "@itwin/core-frontend";
|
|
11
|
-
import { getClassName
|
|
11
|
+
import { getClassName } from "@itwin/appui-abstract";
|
|
12
12
|
import { UiComponents } from "@itwin/components-react";
|
|
13
|
+
import { EmptyLocalization } from "@itwin/core-common";
|
|
13
14
|
/**
|
|
14
15
|
* Manages the localization service for the imodel-components-react package.
|
|
15
16
|
* @public
|
|
16
17
|
*/
|
|
17
18
|
export class UiIModelComponents {
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param localization The internationalization service created by the application. Defaults to IModelApp.localization.
|
|
20
|
+
* initialize UiIModelComponents.
|
|
21
21
|
*/
|
|
22
|
-
static async initialize(
|
|
22
|
+
static async initialize() {
|
|
23
|
+
var _a;
|
|
23
24
|
if (UiIModelComponents._initialized) {
|
|
24
25
|
Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
28
|
enablePatches();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
await ((_a = IModelApp.localization) === null || _a === void 0 ? void 0 : _a.registerNamespace(UiIModelComponents.localizationNamespace));
|
|
30
|
+
if (!IModelApp.localization) {
|
|
31
|
+
// it should only get here in unit test where IModelApp is not setup
|
|
32
|
+
const localization = new EmptyLocalization();
|
|
33
|
+
await localization.initialize();
|
|
34
|
+
await UiComponents.initialize(localization);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
await UiComponents.initialize(IModelApp.localization);
|
|
38
|
+
}
|
|
31
39
|
UiIModelComponents._initialized = true;
|
|
32
40
|
}
|
|
33
41
|
/** Unregisters the UiIModelComponents localization namespace */
|
|
34
42
|
static terminate() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
UiIModelComponents._localization = undefined;
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = IModelApp.localization) === null || _a === void 0 ? void 0 : _a.unregisterNamespace(UiIModelComponents.localizationNamespace);
|
|
38
45
|
UiComponents.terminate();
|
|
39
46
|
UiIModelComponents._initialized = false;
|
|
40
47
|
}
|
|
41
48
|
/** Determines if UiIModelComponents has been initialized */
|
|
42
49
|
static get initialized() { return UiIModelComponents._initialized; }
|
|
43
|
-
/** The internationalization service created by the application. */
|
|
44
|
-
static get localization() {
|
|
45
|
-
if (!UiIModelComponents._localization)
|
|
46
|
-
throw new UiError(UiIModelComponents.loggerCategory(this), "localization: UiIModelComponents.initialize has not been called. Unable to return Localization object.");
|
|
47
|
-
return UiIModelComponents._localization;
|
|
48
|
-
}
|
|
49
50
|
/** The internationalization service namespace. */
|
|
50
51
|
static get localizationNamespace() {
|
|
51
52
|
return "UiIModelComponents";
|
|
@@ -58,11 +59,11 @@ export class UiIModelComponents {
|
|
|
58
59
|
* @internal
|
|
59
60
|
*/
|
|
60
61
|
static translate(key) {
|
|
61
|
-
if (!UiIModelComponents.initialized) {
|
|
62
|
-
Logger.logError(UiIModelComponents.loggerCategory(this), `translate:
|
|
62
|
+
if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {
|
|
63
|
+
Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);
|
|
63
64
|
return "";
|
|
64
65
|
}
|
|
65
|
-
return
|
|
66
|
+
return IModelApp.localization.getLocalizedStringWithNamespace(UiIModelComponents.localizationNamespace, key);
|
|
66
67
|
}
|
|
67
68
|
/** @internal */
|
|
68
69
|
static loggerCategory(obj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModel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,CAAC;QACzB,kBAAkB,CAAC,YAAY,GAAG,KAAK,CAAC;IAC1C,CAAC;IAED,4DAA4D;IACrD,MAAM,KAAK,WAAW,KAAc,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC;IAEpF,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,WAAW,IAAI,0BAA0B,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE;YACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,+EAA+E,CAAC,CAAC;YAC1I,OAAO,EAAE,CAAC;SACX;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,+BAA+B,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;IAC/G,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA9Dc,+BAAY,GAAG,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport { enablePatches } from \"immer\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { getClassName } from \"@itwin/appui-abstract\";\r\nimport { UiComponents } from \"@itwin/components-react\";\r\nimport { EmptyLocalization } from \"@itwin/core-common\";\r\n\r\n/**\r\n * Manages the localization service for the imodel-components-react package.\r\n * @public\r\n */\r\nexport class UiIModelComponents {\r\n private static _initialized = false;\r\n\r\n /**\r\n * initialize UiIModelComponents.\r\n */\r\n public static async initialize(): Promise<void> {\r\n if (UiIModelComponents._initialized) {\r\n Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);\r\n return;\r\n }\r\n\r\n enablePatches();\r\n await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);\r\n\r\n if (!IModelApp.localization) {\r\n // it should only get here in unit test where IModelApp is not setup\r\n const localization = new EmptyLocalization();\r\n await localization.initialize();\r\n await UiComponents.initialize(localization);\r\n } else {\r\n await UiComponents.initialize(IModelApp.localization);\r\n }\r\n\r\n UiIModelComponents._initialized = true;\r\n }\r\n\r\n /** Unregisters the UiIModelComponents localization namespace */\r\n public static terminate() {\r\n IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);\r\n UiComponents.terminate();\r\n UiIModelComponents._initialized = false;\r\n }\r\n\r\n /** Determines if UiIModelComponents has been initialized */\r\n public static get initialized(): boolean { return UiIModelComponents._initialized; }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return \"UiIModelComponents\";\r\n }\r\n\r\n /** @internal */\r\n public static get packageName(): string {\r\n return \"imodel-components-react\";\r\n }\r\n\r\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\r\n * @internal\r\n */\r\n public static translate(key: string | string[]): string {\r\n if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {\r\n Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);\r\n return \"\";\r\n }\r\n return IModelApp.localization.getLocalizedStringWithNamespace(UiIModelComponents.localizationNamespace, key);\r\n }\r\n\r\n /** @internal */\r\n public static loggerCategory(obj: any): string {\r\n const className = getClassName(obj);\r\n const category = UiIModelComponents.packageName + (className ? `.${className}` : \"\");\r\n return category;\r\n }\r\n\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-components-react",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.97",
|
|
4
4
|
"description": "iModel.js UI IModel Components",
|
|
5
5
|
"main": "lib/cjs/imodel-components-react.js",
|
|
6
6
|
"module": "lib/esm/imodel-components-react.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/imodeljs/imodeljs/tree/master/ui/imodel-components"
|
|
12
|
+
"url": "https://github.com/imodeljs/imodeljs/tree/master/ui/imodel-components-react"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"Bentley",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"url": "http://www.bentley.com"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@itwin/core-bentley": "^3.0.0-dev.
|
|
25
|
-
"@itwin/core-geometry": "^3.0.0-dev.
|
|
26
|
-
"@itwin/core-common": "^3.0.0-dev.
|
|
27
|
-
"@itwin/core-frontend": "^3.0.0-dev.
|
|
28
|
-
"@itwin/core-i18n": "^3.0.0-dev.
|
|
29
|
-
"@itwin/core-quantity": "^3.0.0-dev.
|
|
30
|
-
"@itwin/appui-abstract": "^3.0.0-dev.
|
|
31
|
-
"@itwin/core-react": "^3.0.0-dev.
|
|
32
|
-
"@itwin/components-react": "^3.0.0-dev.
|
|
24
|
+
"@itwin/core-bentley": "^3.0.0-dev.97",
|
|
25
|
+
"@itwin/core-geometry": "^3.0.0-dev.97",
|
|
26
|
+
"@itwin/core-common": "^3.0.0-dev.97",
|
|
27
|
+
"@itwin/core-frontend": "^3.0.0-dev.97",
|
|
28
|
+
"@itwin/core-i18n": "^3.0.0-dev.97",
|
|
29
|
+
"@itwin/core-quantity": "^3.0.0-dev.97",
|
|
30
|
+
"@itwin/appui-abstract": "^3.0.0-dev.97",
|
|
31
|
+
"@itwin/core-react": "^3.0.0-dev.97",
|
|
32
|
+
"@itwin/components-react": "^3.0.0-dev.97",
|
|
33
33
|
"react": "^17.0.0",
|
|
34
34
|
"react-dom": "^17.0.0"
|
|
35
35
|
},
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@itwin/core-bentley": "3.0.0-dev.
|
|
42
|
-
"@itwin/build-tools": "3.0.0-dev.
|
|
43
|
-
"@itwin/eslint-plugin": "3.0.0-dev.
|
|
44
|
-
"@itwin/core-geometry": "3.0.0-dev.
|
|
45
|
-
"@itwin/core-common": "3.0.0-dev.
|
|
46
|
-
"@itwin/core-frontend": "3.0.0-dev.
|
|
47
|
-
"@itwin/core-i18n": "3.0.0-dev.
|
|
48
|
-
"@itwin/core-quantity": "3.0.0-dev.
|
|
49
|
-
"@itwin/appui-abstract": "3.0.0-dev.
|
|
50
|
-
"@itwin/core-react": "3.0.0-dev.
|
|
51
|
-
"@itwin/components-react": "3.0.0-dev.
|
|
41
|
+
"@itwin/core-bentley": "3.0.0-dev.97",
|
|
42
|
+
"@itwin/build-tools": "3.0.0-dev.97",
|
|
43
|
+
"@itwin/eslint-plugin": "3.0.0-dev.97",
|
|
44
|
+
"@itwin/core-geometry": "3.0.0-dev.97",
|
|
45
|
+
"@itwin/core-common": "3.0.0-dev.97",
|
|
46
|
+
"@itwin/core-frontend": "3.0.0-dev.97",
|
|
47
|
+
"@itwin/core-i18n": "3.0.0-dev.97",
|
|
48
|
+
"@itwin/core-quantity": "3.0.0-dev.97",
|
|
49
|
+
"@itwin/appui-abstract": "3.0.0-dev.97",
|
|
50
|
+
"@itwin/core-react": "3.0.0-dev.97",
|
|
51
|
+
"@itwin/components-react": "3.0.0-dev.97",
|
|
52
52
|
"@testing-library/react": "^12.0.0",
|
|
53
53
|
"@testing-library/react-hooks": "^3.2.1",
|
|
54
54
|
"@testing-library/user-event": "^13.2.1",
|