@itwin/presentation-backend 4.0.0-dev.8 → 4.0.0-dev.81
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 +47 -1
- package/lib/cjs/assets/primary-presentation-rules/ElementProperties.PresentationRuleSet.json +14 -14
- package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +726 -762
- package/lib/cjs/assets/supplemental-presentation-rules/Functional.PresentationRuleSet.json +139 -139
- package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
- package/lib/cjs/presentation-backend/Constants.js +40 -36
- package/lib/cjs/presentation-backend/Constants.js.map +1 -1
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +272 -274
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -87
- package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.js +147 -140
- package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
- package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.js +148 -150
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +11 -12
- package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationIpcHandler.js +30 -41
- package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +463 -445
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +317 -311
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -61
- package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js +442 -430
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -62
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -388
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -102
- package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.js +287 -282
- package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
- package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
- package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -28
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js +226 -229
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
- package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
- package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
- package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
- package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
- package/lib/cjs/presentation-backend/UpdatesTracker.js.map +1 -1
- package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
- package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js +107 -106
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +55 -51
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
- package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
- package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
- package/lib/cjs/presentation-backend.d.ts +19 -19
- package/lib/cjs/presentation-backend.js +39 -35
- package/lib/cjs/presentation-backend.js.map +1 -1
- package/package.json +20 -18
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Core
|
|
3
|
-
*/
|
|
4
|
-
import { Id64String } from "@itwin/core-bentley";
|
|
5
|
-
import { VariableValue, VariableValueTypes } from "@itwin/presentation-common";
|
|
6
|
-
import { NativePlatformDefinition } from "./NativePlatform";
|
|
7
|
-
/**
|
|
8
|
-
* Presentation ruleset variables registry.
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export interface RulesetVariablesManager {
|
|
12
|
-
/** Gets a value of the specified type and ID */
|
|
13
|
-
getValue(variableId: string, type: VariableValueTypes): VariableValue;
|
|
14
|
-
/** Sets a value of the specified type */
|
|
15
|
-
setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
16
|
-
/** Unsets variable with given id. */
|
|
17
|
-
unset(variableId: string): void;
|
|
18
|
-
/**
|
|
19
|
-
* Retrieves `string` variable value.
|
|
20
|
-
* Returns empty string if variable does not exist or does not convert to string.
|
|
21
|
-
*/
|
|
22
|
-
getString(variableId: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Sets `string` variable value
|
|
25
|
-
*/
|
|
26
|
-
setString(variableId: string, value: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves `boolean` variable value.
|
|
29
|
-
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
30
|
-
*/
|
|
31
|
-
getBool(variableId: string): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Sets `boolean` variable value
|
|
34
|
-
*/
|
|
35
|
-
setBool(variableId: string, value: boolean): void;
|
|
36
|
-
/**
|
|
37
|
-
* Retrieves `number` variable value.
|
|
38
|
-
* Returns `0` if variable does not exist or does not convert to integer.
|
|
39
|
-
*/
|
|
40
|
-
getInt(variableId: string): number;
|
|
41
|
-
/**
|
|
42
|
-
* Sets `number` variable value
|
|
43
|
-
*/
|
|
44
|
-
setInt(variableId: string, value: number): void;
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves `number[]` variable value.
|
|
47
|
-
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
48
|
-
*/
|
|
49
|
-
getInts(variableId: string): number[];
|
|
50
|
-
/**
|
|
51
|
-
* Sets `number[]` variable value
|
|
52
|
-
*/
|
|
53
|
-
setInts(variableId: string, value: number[]): void;
|
|
54
|
-
/**
|
|
55
|
-
* Retrieves `Id64String` variable value.
|
|
56
|
-
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
57
|
-
*/
|
|
58
|
-
getId64(variableId: string): Id64String;
|
|
59
|
-
/**
|
|
60
|
-
* Sets `Id64String` variable value
|
|
61
|
-
*/
|
|
62
|
-
setId64(variableId: string, value: Id64String): void;
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves `Id64String[]` variable value.
|
|
65
|
-
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
66
|
-
*/
|
|
67
|
-
getId64s(variableId: string): Id64String[];
|
|
68
|
-
/**
|
|
69
|
-
* Sets `Id64String[]` variable value
|
|
70
|
-
*/
|
|
71
|
-
setId64s(variableId: string, value: Id64String[]): void;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Presentation ruleset variables registry implementation.
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
export declare class RulesetVariablesManagerImpl implements RulesetVariablesManager {
|
|
78
|
-
private _getNativePlatform;
|
|
79
|
-
private _rulesetId;
|
|
80
|
-
constructor(getNativeAddon: () => NativePlatformDefinition, rulesetId: string);
|
|
81
|
-
setValueInternal(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
82
|
-
getValueInternal(variableId: string, type: VariableValueTypes): VariableValue;
|
|
83
|
-
setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
84
|
-
unset(variableId: string): void;
|
|
85
|
-
getValue(variableId: string, type: VariableValueTypes): VariableValue;
|
|
86
|
-
/**
|
|
87
|
-
* Retrieves `string` variable value.
|
|
88
|
-
* Returns empty string if variable does not exist or does not convert to string.
|
|
89
|
-
*/
|
|
90
|
-
getString(variableId: string): string;
|
|
91
|
-
/**
|
|
92
|
-
* Sets `string` variable value
|
|
93
|
-
*/
|
|
94
|
-
setString(variableId: string, value: string): void;
|
|
95
|
-
/**
|
|
96
|
-
* Retrieves `boolean` variable value.
|
|
97
|
-
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
98
|
-
*/
|
|
99
|
-
getBool(variableId: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Sets `boolean` variable value
|
|
102
|
-
*/
|
|
103
|
-
setBool(variableId: string, value: boolean): void;
|
|
104
|
-
/**
|
|
105
|
-
* Retrieves `number` variable value.
|
|
106
|
-
* Returns `0` if variable does not exist or does not convert to integer.
|
|
107
|
-
*/
|
|
108
|
-
getInt(variableId: string): number;
|
|
109
|
-
/**
|
|
110
|
-
* Sets `number` variable value
|
|
111
|
-
*/
|
|
112
|
-
setInt(variableId: string, value: number): void;
|
|
113
|
-
/**
|
|
114
|
-
* Retrieves `number[]` variable value.
|
|
115
|
-
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
116
|
-
*/
|
|
117
|
-
getInts(variableId: string): number[];
|
|
118
|
-
/**
|
|
119
|
-
* Sets `number[]` variable value
|
|
120
|
-
*/
|
|
121
|
-
setInts(variableId: string, value: number[]): void;
|
|
122
|
-
/**
|
|
123
|
-
* Retrieves `Id64String` variable value.
|
|
124
|
-
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
125
|
-
*/
|
|
126
|
-
getId64(variableId: string): Id64String;
|
|
127
|
-
/**
|
|
128
|
-
* Sets `Id64String` variable value
|
|
129
|
-
*/
|
|
130
|
-
setId64(variableId: string, value: Id64String): void;
|
|
131
|
-
/**
|
|
132
|
-
* Retrieves `Id64String[]` variable value.
|
|
133
|
-
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
134
|
-
*/
|
|
135
|
-
getId64s(variableId: string): Id64String[];
|
|
136
|
-
/**
|
|
137
|
-
* Sets `Id64String[]` variable value
|
|
138
|
-
*/
|
|
139
|
-
setId64s(variableId: string, value: Id64String[]): void;
|
|
140
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Core
|
|
3
|
+
*/
|
|
4
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
5
|
+
import { VariableValue, VariableValueTypes } from "@itwin/presentation-common";
|
|
6
|
+
import { NativePlatformDefinition } from "./NativePlatform";
|
|
7
|
+
/**
|
|
8
|
+
* Presentation ruleset variables registry.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface RulesetVariablesManager {
|
|
12
|
+
/** Gets a value of the specified type and ID */
|
|
13
|
+
getValue(variableId: string, type: VariableValueTypes): VariableValue;
|
|
14
|
+
/** Sets a value of the specified type */
|
|
15
|
+
setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
16
|
+
/** Unsets variable with given id. */
|
|
17
|
+
unset(variableId: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves `string` variable value.
|
|
20
|
+
* Returns empty string if variable does not exist or does not convert to string.
|
|
21
|
+
*/
|
|
22
|
+
getString(variableId: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Sets `string` variable value
|
|
25
|
+
*/
|
|
26
|
+
setString(variableId: string, value: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves `boolean` variable value.
|
|
29
|
+
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
30
|
+
*/
|
|
31
|
+
getBool(variableId: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Sets `boolean` variable value
|
|
34
|
+
*/
|
|
35
|
+
setBool(variableId: string, value: boolean): void;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves `number` variable value.
|
|
38
|
+
* Returns `0` if variable does not exist or does not convert to integer.
|
|
39
|
+
*/
|
|
40
|
+
getInt(variableId: string): number;
|
|
41
|
+
/**
|
|
42
|
+
* Sets `number` variable value
|
|
43
|
+
*/
|
|
44
|
+
setInt(variableId: string, value: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves `number[]` variable value.
|
|
47
|
+
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
48
|
+
*/
|
|
49
|
+
getInts(variableId: string): number[];
|
|
50
|
+
/**
|
|
51
|
+
* Sets `number[]` variable value
|
|
52
|
+
*/
|
|
53
|
+
setInts(variableId: string, value: number[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves `Id64String` variable value.
|
|
56
|
+
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
57
|
+
*/
|
|
58
|
+
getId64(variableId: string): Id64String;
|
|
59
|
+
/**
|
|
60
|
+
* Sets `Id64String` variable value
|
|
61
|
+
*/
|
|
62
|
+
setId64(variableId: string, value: Id64String): void;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves `Id64String[]` variable value.
|
|
65
|
+
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
66
|
+
*/
|
|
67
|
+
getId64s(variableId: string): Id64String[];
|
|
68
|
+
/**
|
|
69
|
+
* Sets `Id64String[]` variable value
|
|
70
|
+
*/
|
|
71
|
+
setId64s(variableId: string, value: Id64String[]): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Presentation ruleset variables registry implementation.
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export declare class RulesetVariablesManagerImpl implements RulesetVariablesManager {
|
|
78
|
+
private _getNativePlatform;
|
|
79
|
+
private _rulesetId;
|
|
80
|
+
constructor(getNativeAddon: () => NativePlatformDefinition, rulesetId: string);
|
|
81
|
+
setValueInternal(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
82
|
+
getValueInternal(variableId: string, type: VariableValueTypes): VariableValue;
|
|
83
|
+
setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
84
|
+
unset(variableId: string): void;
|
|
85
|
+
getValue(variableId: string, type: VariableValueTypes): VariableValue;
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves `string` variable value.
|
|
88
|
+
* Returns empty string if variable does not exist or does not convert to string.
|
|
89
|
+
*/
|
|
90
|
+
getString(variableId: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Sets `string` variable value
|
|
93
|
+
*/
|
|
94
|
+
setString(variableId: string, value: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves `boolean` variable value.
|
|
97
|
+
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
98
|
+
*/
|
|
99
|
+
getBool(variableId: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Sets `boolean` variable value
|
|
102
|
+
*/
|
|
103
|
+
setBool(variableId: string, value: boolean): void;
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves `number` variable value.
|
|
106
|
+
* Returns `0` if variable does not exist or does not convert to integer.
|
|
107
|
+
*/
|
|
108
|
+
getInt(variableId: string): number;
|
|
109
|
+
/**
|
|
110
|
+
* Sets `number` variable value
|
|
111
|
+
*/
|
|
112
|
+
setInt(variableId: string, value: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves `number[]` variable value.
|
|
115
|
+
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
116
|
+
*/
|
|
117
|
+
getInts(variableId: string): number[];
|
|
118
|
+
/**
|
|
119
|
+
* Sets `number[]` variable value
|
|
120
|
+
*/
|
|
121
|
+
setInts(variableId: string, value: number[]): void;
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves `Id64String` variable value.
|
|
124
|
+
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
125
|
+
*/
|
|
126
|
+
getId64(variableId: string): Id64String;
|
|
127
|
+
/**
|
|
128
|
+
* Sets `Id64String` variable value
|
|
129
|
+
*/
|
|
130
|
+
setId64(variableId: string, value: Id64String): void;
|
|
131
|
+
/**
|
|
132
|
+
* Retrieves `Id64String[]` variable value.
|
|
133
|
+
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
134
|
+
*/
|
|
135
|
+
getId64s(variableId: string): Id64String[];
|
|
136
|
+
/**
|
|
137
|
+
* Sets `Id64String[]` variable value
|
|
138
|
+
*/
|
|
139
|
+
setId64s(variableId: string, value: Id64String[]): void;
|
|
140
|
+
}
|
|
141
141
|
//# sourceMappingURL=RulesetVariablesManager.d.ts.map
|
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Core
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.RulesetVariablesManagerImpl = void 0;
|
|
11
|
-
const presentation_common_1 = require("@itwin/presentation-common");
|
|
12
|
-
/**
|
|
13
|
-
* Presentation ruleset variables registry implementation.
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
class RulesetVariablesManagerImpl {
|
|
17
|
-
constructor(getNativeAddon, rulesetId) {
|
|
18
|
-
this._getNativePlatform = getNativeAddon;
|
|
19
|
-
this._rulesetId = rulesetId;
|
|
20
|
-
}
|
|
21
|
-
setValueInternal(variableId, type, value) {
|
|
22
|
-
this._getNativePlatform().setRulesetVariableValue(this._rulesetId, variableId, type, value);
|
|
23
|
-
}
|
|
24
|
-
getValueInternal(variableId, type) {
|
|
25
|
-
return this._getNativePlatform().getRulesetVariableValue(this._rulesetId, variableId, type).result;
|
|
26
|
-
}
|
|
27
|
-
setValue(variableId, type, value) {
|
|
28
|
-
switch (type) {
|
|
29
|
-
case presentation_common_1.VariableValueTypes.Bool: return this.setBool(variableId, value);
|
|
30
|
-
case presentation_common_1.VariableValueTypes.Id64: return this.setId64(variableId, value);
|
|
31
|
-
case presentation_common_1.VariableValueTypes.Id64Array: return this.setId64s(variableId, value);
|
|
32
|
-
case presentation_common_1.VariableValueTypes.Int: return this.setInt(variableId, value);
|
|
33
|
-
case presentation_common_1.VariableValueTypes.IntArray: return this.setInts(variableId, value);
|
|
34
|
-
case presentation_common_1.VariableValueTypes.String: return this.setString(variableId, value);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
unset(variableId) {
|
|
38
|
-
this._getNativePlatform().unsetRulesetVariableValue(this._rulesetId, variableId);
|
|
39
|
-
}
|
|
40
|
-
getValue(variableId, type) {
|
|
41
|
-
switch (type) {
|
|
42
|
-
case presentation_common_1.VariableValueTypes.Bool: return this.getBool(variableId);
|
|
43
|
-
case presentation_common_1.VariableValueTypes.Id64: return this.getId64(variableId);
|
|
44
|
-
case presentation_common_1.VariableValueTypes.Id64Array: return this.getId64s(variableId);
|
|
45
|
-
case presentation_common_1.VariableValueTypes.Int: return this.getInt(variableId);
|
|
46
|
-
case presentation_common_1.VariableValueTypes.IntArray: return this.getInts(variableId);
|
|
47
|
-
case presentation_common_1.VariableValueTypes.String: return this.getString(variableId);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Retrieves `string` variable value.
|
|
52
|
-
* Returns empty string if variable does not exist or does not convert to string.
|
|
53
|
-
*/
|
|
54
|
-
getString(variableId) {
|
|
55
|
-
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.String));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sets `string` variable value
|
|
59
|
-
*/
|
|
60
|
-
setString(variableId, value) {
|
|
61
|
-
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.String, value);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves `boolean` variable value.
|
|
65
|
-
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
66
|
-
*/
|
|
67
|
-
getBool(variableId) {
|
|
68
|
-
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Bool));
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Sets `boolean` variable value
|
|
72
|
-
*/
|
|
73
|
-
setBool(variableId, value) {
|
|
74
|
-
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Bool, value);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Retrieves `number` variable value.
|
|
78
|
-
* Returns `0` if variable does not exist or does not convert to integer.
|
|
79
|
-
*/
|
|
80
|
-
getInt(variableId) {
|
|
81
|
-
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Int));
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Sets `number` variable value
|
|
85
|
-
*/
|
|
86
|
-
setInt(variableId, value) {
|
|
87
|
-
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Int, value);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Retrieves `number[]` variable value.
|
|
91
|
-
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
92
|
-
*/
|
|
93
|
-
getInts(variableId) {
|
|
94
|
-
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.IntArray));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Sets `number[]` variable value
|
|
98
|
-
*/
|
|
99
|
-
setInts(variableId, value) {
|
|
100
|
-
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.IntArray, value);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Retrieves `Id64String` variable value.
|
|
104
|
-
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
105
|
-
*/
|
|
106
|
-
getId64(variableId) {
|
|
107
|
-
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64));
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Sets `Id64String` variable value
|
|
111
|
-
*/
|
|
112
|
-
setId64(variableId, value) {
|
|
113
|
-
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64, value);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Retrieves `Id64String[]` variable value.
|
|
117
|
-
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
118
|
-
*/
|
|
119
|
-
getId64s(variableId) {
|
|
120
|
-
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64Array));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Sets `Id64String[]` variable value
|
|
124
|
-
*/
|
|
125
|
-
setId64s(variableId, value) {
|
|
126
|
-
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64Array, value);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.RulesetVariablesManagerImpl = RulesetVariablesManagerImpl;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Core
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RulesetVariablesManagerImpl = void 0;
|
|
11
|
+
const presentation_common_1 = require("@itwin/presentation-common");
|
|
12
|
+
/**
|
|
13
|
+
* Presentation ruleset variables registry implementation.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
class RulesetVariablesManagerImpl {
|
|
17
|
+
constructor(getNativeAddon, rulesetId) {
|
|
18
|
+
this._getNativePlatform = getNativeAddon;
|
|
19
|
+
this._rulesetId = rulesetId;
|
|
20
|
+
}
|
|
21
|
+
setValueInternal(variableId, type, value) {
|
|
22
|
+
this._getNativePlatform().setRulesetVariableValue(this._rulesetId, variableId, type, value);
|
|
23
|
+
}
|
|
24
|
+
getValueInternal(variableId, type) {
|
|
25
|
+
return this._getNativePlatform().getRulesetVariableValue(this._rulesetId, variableId, type).result;
|
|
26
|
+
}
|
|
27
|
+
setValue(variableId, type, value) {
|
|
28
|
+
switch (type) {
|
|
29
|
+
case presentation_common_1.VariableValueTypes.Bool: return this.setBool(variableId, value);
|
|
30
|
+
case presentation_common_1.VariableValueTypes.Id64: return this.setId64(variableId, value);
|
|
31
|
+
case presentation_common_1.VariableValueTypes.Id64Array: return this.setId64s(variableId, value);
|
|
32
|
+
case presentation_common_1.VariableValueTypes.Int: return this.setInt(variableId, value);
|
|
33
|
+
case presentation_common_1.VariableValueTypes.IntArray: return this.setInts(variableId, value);
|
|
34
|
+
case presentation_common_1.VariableValueTypes.String: return this.setString(variableId, value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
unset(variableId) {
|
|
38
|
+
this._getNativePlatform().unsetRulesetVariableValue(this._rulesetId, variableId);
|
|
39
|
+
}
|
|
40
|
+
getValue(variableId, type) {
|
|
41
|
+
switch (type) {
|
|
42
|
+
case presentation_common_1.VariableValueTypes.Bool: return this.getBool(variableId);
|
|
43
|
+
case presentation_common_1.VariableValueTypes.Id64: return this.getId64(variableId);
|
|
44
|
+
case presentation_common_1.VariableValueTypes.Id64Array: return this.getId64s(variableId);
|
|
45
|
+
case presentation_common_1.VariableValueTypes.Int: return this.getInt(variableId);
|
|
46
|
+
case presentation_common_1.VariableValueTypes.IntArray: return this.getInts(variableId);
|
|
47
|
+
case presentation_common_1.VariableValueTypes.String: return this.getString(variableId);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves `string` variable value.
|
|
52
|
+
* Returns empty string if variable does not exist or does not convert to string.
|
|
53
|
+
*/
|
|
54
|
+
getString(variableId) {
|
|
55
|
+
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.String));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets `string` variable value
|
|
59
|
+
*/
|
|
60
|
+
setString(variableId, value) {
|
|
61
|
+
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.String, value);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves `boolean` variable value.
|
|
65
|
+
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
66
|
+
*/
|
|
67
|
+
getBool(variableId) {
|
|
68
|
+
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Bool));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sets `boolean` variable value
|
|
72
|
+
*/
|
|
73
|
+
setBool(variableId, value) {
|
|
74
|
+
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Bool, value);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves `number` variable value.
|
|
78
|
+
* Returns `0` if variable does not exist or does not convert to integer.
|
|
79
|
+
*/
|
|
80
|
+
getInt(variableId) {
|
|
81
|
+
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Int));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sets `number` variable value
|
|
85
|
+
*/
|
|
86
|
+
setInt(variableId, value) {
|
|
87
|
+
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Int, value);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves `number[]` variable value.
|
|
91
|
+
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
92
|
+
*/
|
|
93
|
+
getInts(variableId) {
|
|
94
|
+
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.IntArray));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Sets `number[]` variable value
|
|
98
|
+
*/
|
|
99
|
+
setInts(variableId, value) {
|
|
100
|
+
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.IntArray, value);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves `Id64String` variable value.
|
|
104
|
+
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
105
|
+
*/
|
|
106
|
+
getId64(variableId) {
|
|
107
|
+
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Sets `Id64String` variable value
|
|
111
|
+
*/
|
|
112
|
+
setId64(variableId, value) {
|
|
113
|
+
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64, value);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves `Id64String[]` variable value.
|
|
117
|
+
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
118
|
+
*/
|
|
119
|
+
getId64s(variableId) {
|
|
120
|
+
return (this.getValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64Array));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sets `Id64String[]` variable value
|
|
124
|
+
*/
|
|
125
|
+
setId64s(variableId, value) {
|
|
126
|
+
this.setValueInternal(variableId, presentation_common_1.VariableValueTypes.Id64Array, value);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.RulesetVariablesManagerImpl = RulesetVariablesManagerImpl;
|
|
130
130
|
//# sourceMappingURL=RulesetVariablesManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetVariablesManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetVariablesManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oEAA+E;AA4E/E;;;GAGG;AACH,MAAa,2BAA2B;IAItC,YAAY,cAA8C,EAAE,SAAiB;QAC3E,IAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEM,gBAAgB,CAAC,UAAkB,EAAE,IAAwB,EAAE,KAAoB;QACxF,IAAI,CAAC,kBAAkB,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAEM,gBAAgB,CAAC,UAAkB,EAAE,IAAwB;QAClE,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC;IACrG,CAAC;IAEM,QAAQ,CAAC,UAAkB,EAAE,IAAwB,EAAE,KAAoB;QAChF,QAAQ,IAAI,EAAE;YACZ,KAAK,wCAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAgB,CAAC,CAAC;YAChF,KAAK,wCAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAmB,CAAC,CAAC;YACnF,KAAK,wCAAkB,CAAC,SAAS,CAAC,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAqB,CAAC,CAAC;YAC3F,KAAK,wCAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,KAAe,CAAC,CAAC;YAC7E,KAAK,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ACpE,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,UAAkB;QAChC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,SAAS,CAAC,CAAiB,CAAC;IAC3F,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,UAAkB,EAAE,KAAmB;QACrD,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;CACF;AApID,kEAoIC","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 Core\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { VariableValue, VariableValueTypes } from \"@itwin/presentation-common\";\r\nimport { NativePlatformDefinition } from \"./NativePlatform\";\r\n\r\n/**\r\n * Presentation ruleset variables registry.\r\n * @public\r\n */\r\nexport interface RulesetVariablesManager {\r\n /** Gets a value of the specified type and ID */\r\n getValue(variableId: string, type: VariableValueTypes): VariableValue;\r\n /** Sets a value of the specified type */\r\n setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;\r\n /** Unsets variable with given id. */\r\n unset(variableId: string): void;\r\n\r\n /**\r\n * Retrieves `string` variable value.\r\n * Returns empty string if variable does not exist or does not convert to string.\r\n */\r\n getString(variableId: string): string;\r\n /**\r\n * Sets `string` variable value\r\n */\r\n setString(variableId: string, value: string): void;\r\n\r\n /**\r\n * Retrieves `boolean` variable value.\r\n * Returns `false` if variable does not exist or does not convert to boolean.\r\n */\r\n getBool(variableId: string): boolean;\r\n /**\r\n * Sets `boolean` variable value\r\n */\r\n setBool(variableId: string, value: boolean): void;\r\n\r\n /**\r\n * Retrieves `number` variable value.\r\n * Returns `0` if variable does not exist or does not convert to integer.\r\n */\r\n getInt(variableId: string): number;\r\n /**\r\n * Sets `number` variable value\r\n */\r\n setInt(variableId: string, value: number): void;\r\n\r\n /**\r\n * Retrieves `number[]` variable value.\r\n * Returns empty array if variable does not exist or does not convert to integer array.\r\n */\r\n getInts(variableId: string): number[];\r\n /**\r\n * Sets `number[]` variable value\r\n */\r\n setInts(variableId: string, value: number[]): void;\r\n\r\n /**\r\n * Retrieves `Id64String` variable value.\r\n * Returns invalid Id64String if variable does not exist or does not convert to Id64String.\r\n */\r\n getId64(variableId: string): Id64String;\r\n /**\r\n * Sets `Id64String` variable value\r\n */\r\n setId64(variableId: string, value: Id64String): void;\r\n\r\n /**\r\n * Retrieves `Id64String[]` variable value.\r\n * Returns empty array if variable does not exist or does not convert to Id64String array.\r\n */\r\n getId64s(variableId: string): Id64String[];\r\n /**\r\n * Sets `Id64String[]` variable value\r\n */\r\n setId64s(variableId: string, value: Id64String[]): void;\r\n}\r\n\r\n/**\r\n * Presentation ruleset variables registry implementation.\r\n * @internal\r\n */\r\nexport class RulesetVariablesManagerImpl implements RulesetVariablesManager {\r\n private _getNativePlatform: () => NativePlatformDefinition;\r\n private _rulesetId: string;\r\n\r\n constructor(getNativeAddon: () => NativePlatformDefinition, rulesetId: string) {\r\n this._getNativePlatform = getNativeAddon;\r\n this._rulesetId = rulesetId;\r\n }\r\n\r\n public setValueInternal(variableId: string, type: VariableValueTypes, value: VariableValue): void {\r\n this._getNativePlatform().setRulesetVariableValue(this._rulesetId, variableId, type, value);\r\n }\r\n\r\n public getValueInternal(variableId: string, type: VariableValueTypes): VariableValue {\r\n return this._getNativePlatform().getRulesetVariableValue(this._rulesetId, variableId, type).result;\r\n }\r\n\r\n public setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void {\r\n switch (type) {\r\n case VariableValueTypes.Bool: return this.setBool(variableId, value as boolean);\r\n case VariableValueTypes.Id64: return this.setId64(variableId, value as Id64String);\r\n case VariableValueTypes.Id64Array: return this.setId64s(variableId, value as Id64String[]);\r\n case VariableValueTypes.Int: return this.setInt(variableId, value as number);\r\n case VariableValueTypes.IntArray: return this.setInts(variableId, value as number[]);\r\n case VariableValueTypes.String: return this.setString(variableId, value as string);\r\n }\r\n }\r\n\r\n public unset(variableId: string): void {\r\n this._getNativePlatform().unsetRulesetVariableValue(this._rulesetId, variableId);\r\n }\r\n\r\n public getValue(variableId: string, type: VariableValueTypes): VariableValue {\r\n switch (type) {\r\n case VariableValueTypes.Bool: return this.getBool(variableId);\r\n case VariableValueTypes.Id64: return this.getId64(variableId);\r\n case VariableValueTypes.Id64Array: return this.getId64s(variableId);\r\n case VariableValueTypes.Int: return this.getInt(variableId);\r\n case VariableValueTypes.IntArray: return this.getInts(variableId);\r\n case VariableValueTypes.String: return this.getString(variableId);\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves `string` variable value.\r\n * Returns empty string if variable does not exist or does not convert to string.\r\n */\r\n public getString(variableId: string): string {\r\n return (this.getValueInternal(variableId, VariableValueTypes.String)) as string;\r\n }\r\n\r\n /**\r\n * Sets `string` variable value\r\n */\r\n public setString(variableId: string, value: string): void {\r\n this.setValueInternal(variableId, VariableValueTypes.String, value);\r\n }\r\n\r\n /**\r\n * Retrieves `boolean` variable value.\r\n * Returns `false` if variable does not exist or does not convert to boolean.\r\n */\r\n public getBool(variableId: string): boolean {\r\n return (this.getValueInternal(variableId, VariableValueTypes.Bool)) as boolean;\r\n }\r\n\r\n /**\r\n * Sets `boolean` variable value\r\n */\r\n public setBool(variableId: string, value: boolean): void {\r\n this.setValueInternal(variableId, VariableValueTypes.Bool, value);\r\n }\r\n\r\n /**\r\n * Retrieves `number` variable value.\r\n * Returns `0` if variable does not exist or does not convert to integer.\r\n */\r\n public getInt(variableId: string): number {\r\n return (this.getValueInternal(variableId, VariableValueTypes.Int)) as number;\r\n }\r\n\r\n /**\r\n * Sets `number` variable value\r\n */\r\n public setInt(variableId: string, value: number): void {\r\n this.setValueInternal(variableId, VariableValueTypes.Int, value);\r\n }\r\n\r\n /**\r\n * Retrieves `number[]` variable value.\r\n * Returns empty array if variable does not exist or does not convert to integer array.\r\n */\r\n public getInts(variableId: string): number[] {\r\n return (this.getValueInternal(variableId, VariableValueTypes.IntArray)) as number[];\r\n }\r\n\r\n /**\r\n * Sets `number[]` variable value\r\n */\r\n public setInts(variableId: string, value: number[]): void {\r\n this.setValueInternal(variableId, VariableValueTypes.IntArray, value);\r\n }\r\n\r\n /**\r\n * Retrieves `Id64String` variable value.\r\n * Returns invalid Id64String if variable does not exist or does not convert to Id64String.\r\n */\r\n public getId64(variableId: string): Id64String {\r\n return (this.getValueInternal(variableId, VariableValueTypes.Id64)) as Id64String;\r\n }\r\n\r\n /**\r\n * Sets `Id64String` variable value\r\n */\r\n public setId64(variableId: string, value: Id64String): void {\r\n this.setValueInternal(variableId, VariableValueTypes.Id64, value);\r\n }\r\n\r\n /**\r\n * Retrieves `Id64String[]` variable value.\r\n * Returns empty array if variable does not exist or does not convert to Id64String array.\r\n */\r\n public getId64s(variableId: string): Id64String[] {\r\n return (this.getValueInternal(variableId, VariableValueTypes.Id64Array)) as Id64String[];\r\n }\r\n\r\n /**\r\n * Sets `Id64String[]` variable value\r\n */\r\n public setId64s(variableId: string, value: Id64String[]): void {\r\n this.setValueInternal(variableId, VariableValueTypes.Id64Array, value);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RulesetVariablesManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetVariablesManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oEAA+E;AA4E/E;;;GAGG;AACH,MAAa,2BAA2B;IAItC,YAAY,cAA8C,EAAE,SAAiB;QAC3E,IAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEM,gBAAgB,CAAC,UAAkB,EAAE,IAAwB,EAAE,KAAoB;QACxF,IAAI,CAAC,kBAAkB,EAAE,CAAC,uBAAuB,CAAC,IAAI,CA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,CAAC,CAAW,CAAC;IAC/E,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,UAAkB,EAAE,KAAa;QAC7C,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,UAAkB;QAC/B,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,QAAQ,CAAC,CAAa,CAAC;IACtF,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,UAAkB,EAAE,KAAe;QAChD,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,UAAkB;QAC/B,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,IAAI,CAAC,CAAe,CAAC;IACpF,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,UAAkB,EAAE,KAAiB;QAClD,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,UAAkB;QAChC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,SAAS,CAAC,CAAiB,CAAC;IAC3F,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,UAAkB,EAAE,KAAmB;QACrD,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,wCAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;CACF;AApID,kEAoIC","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 { Id64String } from \"@itwin/core-bentley\";\nimport { VariableValue, VariableValueTypes } from \"@itwin/presentation-common\";\nimport { NativePlatformDefinition } from \"./NativePlatform\";\n\n/**\n * Presentation ruleset variables registry.\n * @public\n */\nexport interface RulesetVariablesManager {\n /** Gets a value of the specified type and ID */\n getValue(variableId: string, type: VariableValueTypes): VariableValue;\n /** Sets a value of the specified type */\n setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;\n /** Unsets variable with given id. */\n unset(variableId: string): void;\n\n /**\n * Retrieves `string` variable value.\n * Returns empty string if variable does not exist or does not convert to string.\n */\n getString(variableId: string): string;\n /**\n * Sets `string` variable value\n */\n setString(variableId: string, value: string): void;\n\n /**\n * Retrieves `boolean` variable value.\n * Returns `false` if variable does not exist or does not convert to boolean.\n */\n getBool(variableId: string): boolean;\n /**\n * Sets `boolean` variable value\n */\n setBool(variableId: string, value: boolean): void;\n\n /**\n * Retrieves `number` variable value.\n * Returns `0` if variable does not exist or does not convert to integer.\n */\n getInt(variableId: string): number;\n /**\n * Sets `number` variable value\n */\n setInt(variableId: string, value: number): void;\n\n /**\n * Retrieves `number[]` variable value.\n * Returns empty array if variable does not exist or does not convert to integer array.\n */\n getInts(variableId: string): number[];\n /**\n * Sets `number[]` variable value\n */\n setInts(variableId: string, value: number[]): void;\n\n /**\n * Retrieves `Id64String` variable value.\n * Returns invalid Id64String if variable does not exist or does not convert to Id64String.\n */\n getId64(variableId: string): Id64String;\n /**\n * Sets `Id64String` variable value\n */\n setId64(variableId: string, value: Id64String): void;\n\n /**\n * Retrieves `Id64String[]` variable value.\n * Returns empty array if variable does not exist or does not convert to Id64String array.\n */\n getId64s(variableId: string): Id64String[];\n /**\n * Sets `Id64String[]` variable value\n */\n setId64s(variableId: string, value: Id64String[]): void;\n}\n\n/**\n * Presentation ruleset variables registry implementation.\n * @internal\n */\nexport class RulesetVariablesManagerImpl implements RulesetVariablesManager {\n private _getNativePlatform: () => NativePlatformDefinition;\n private _rulesetId: string;\n\n constructor(getNativeAddon: () => NativePlatformDefinition, rulesetId: string) {\n this._getNativePlatform = getNativeAddon;\n this._rulesetId = rulesetId;\n }\n\n public setValueInternal(variableId: string, type: VariableValueTypes, value: VariableValue): void {\n this._getNativePlatform().setRulesetVariableValue(this._rulesetId, variableId, type, value);\n }\n\n public getValueInternal(variableId: string, type: VariableValueTypes): VariableValue {\n return this._getNativePlatform().getRulesetVariableValue(this._rulesetId, variableId, type).result;\n }\n\n public setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void {\n switch (type) {\n case VariableValueTypes.Bool: return this.setBool(variableId, value as boolean);\n case VariableValueTypes.Id64: return this.setId64(variableId, value as Id64String);\n case VariableValueTypes.Id64Array: return this.setId64s(variableId, value as Id64String[]);\n case VariableValueTypes.Int: return this.setInt(variableId, value as number);\n case VariableValueTypes.IntArray: return this.setInts(variableId, value as number[]);\n case VariableValueTypes.String: return this.setString(variableId, value as string);\n }\n }\n\n public unset(variableId: string): void {\n this._getNativePlatform().unsetRulesetVariableValue(this._rulesetId, variableId);\n }\n\n public getValue(variableId: string, type: VariableValueTypes): VariableValue {\n switch (type) {\n case VariableValueTypes.Bool: return this.getBool(variableId);\n case VariableValueTypes.Id64: return this.getId64(variableId);\n case VariableValueTypes.Id64Array: return this.getId64s(variableId);\n case VariableValueTypes.Int: return this.getInt(variableId);\n case VariableValueTypes.IntArray: return this.getInts(variableId);\n case VariableValueTypes.String: return this.getString(variableId);\n }\n }\n\n /**\n * Retrieves `string` variable value.\n * Returns empty string if variable does not exist or does not convert to string.\n */\n public getString(variableId: string): string {\n return (this.getValueInternal(variableId, VariableValueTypes.String)) as string;\n }\n\n /**\n * Sets `string` variable value\n */\n public setString(variableId: string, value: string): void {\n this.setValueInternal(variableId, VariableValueTypes.String, value);\n }\n\n /**\n * Retrieves `boolean` variable value.\n * Returns `false` if variable does not exist or does not convert to boolean.\n */\n public getBool(variableId: string): boolean {\n return (this.getValueInternal(variableId, VariableValueTypes.Bool)) as boolean;\n }\n\n /**\n * Sets `boolean` variable value\n */\n public setBool(variableId: string, value: boolean): void {\n this.setValueInternal(variableId, VariableValueTypes.Bool, value);\n }\n\n /**\n * Retrieves `number` variable value.\n * Returns `0` if variable does not exist or does not convert to integer.\n */\n public getInt(variableId: string): number {\n return (this.getValueInternal(variableId, VariableValueTypes.Int)) as number;\n }\n\n /**\n * Sets `number` variable value\n */\n public setInt(variableId: string, value: number): void {\n this.setValueInternal(variableId, VariableValueTypes.Int, value);\n }\n\n /**\n * Retrieves `number[]` variable value.\n * Returns empty array if variable does not exist or does not convert to integer array.\n */\n public getInts(variableId: string): number[] {\n return (this.getValueInternal(variableId, VariableValueTypes.IntArray)) as number[];\n }\n\n /**\n * Sets `number[]` variable value\n */\n public setInts(variableId: string, value: number[]): void {\n this.setValueInternal(variableId, VariableValueTypes.IntArray, value);\n }\n\n /**\n * Retrieves `Id64String` variable value.\n * Returns invalid Id64String if variable does not exist or does not convert to Id64String.\n */\n public getId64(variableId: string): Id64String {\n return (this.getValueInternal(variableId, VariableValueTypes.Id64)) as Id64String;\n }\n\n /**\n * Sets `Id64String` variable value\n */\n public setId64(variableId: string, value: Id64String): void {\n this.setValueInternal(variableId, VariableValueTypes.Id64, value);\n }\n\n /**\n * Retrieves `Id64String[]` variable value.\n * Returns empty array if variable does not exist or does not convert to Id64String array.\n */\n public getId64s(variableId: string): Id64String[] {\n return (this.getValueInternal(variableId, VariableValueTypes.Id64Array)) as Id64String[];\n }\n\n /**\n * Sets `Id64String[]` variable value\n */\n public setId64s(variableId: string, value: Id64String[]): void {\n this.setValueInternal(variableId, VariableValueTypes.Id64Array, value);\n }\n}\n"]}
|