@itwin/presentation-frontend 3.6.0-dev.8 → 4.0.0-dev.2
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 +26 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +0 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +11 -5
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +30 -13
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts +5 -2
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/StateTracker.d.ts +18 -3
- package/lib/cjs/presentation-frontend/StateTracker.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/StateTracker.js +104 -49
- package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +1 -2
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +11 -5
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +31 -14
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.d.ts +5 -2
- package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/StateTracker.d.ts +18 -3
- package/lib/esm/presentation-frontend/StateTracker.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/StateTracker.js +103 -48
- package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/package.json +14 -14
|
@@ -8,68 +8,123 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StateTracker = void 0;
|
|
11
|
-
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
/**
|
|
13
|
+
* The tracker stores up-to-date UI state of the hierarchies on the frontend and reports
|
|
14
|
+
* just the state changes to the backend as soon as component sends in a new hierarchy state.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
12
18
|
class StateTracker {
|
|
13
19
|
constructor(ipcRequestsHandler) {
|
|
14
20
|
this._ipcRequestsHandler = ipcRequestsHandler;
|
|
15
|
-
this.
|
|
21
|
+
this._hierarchyStates = new Map();
|
|
16
22
|
}
|
|
17
|
-
async updateHierarchyStateIfNeeded(imodelKey, rulesetId,
|
|
18
|
-
if (
|
|
23
|
+
async updateHierarchyStateIfNeeded(imodelKey, rulesetId, stateChanges) {
|
|
24
|
+
if (stateChanges.length === 0)
|
|
19
25
|
return;
|
|
20
|
-
await this._ipcRequestsHandler.updateHierarchyState({ imodelKey, rulesetId,
|
|
26
|
+
await this._ipcRequestsHandler.updateHierarchyState({ imodelKey, rulesetId, stateChanges });
|
|
21
27
|
}
|
|
22
28
|
async onHierarchyClosed(imodel, rulesetId, sourceId) {
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
29
|
+
const hierarchyState = this._hierarchyStates.get(rulesetId);
|
|
30
|
+
if (!hierarchyState)
|
|
25
31
|
return;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, "nodesCollapsed", removedKeys);
|
|
32
|
+
const stateChanges = [];
|
|
33
|
+
hierarchyState.forEach((entry) => {
|
|
34
|
+
if (!entry.states.has(sourceId)) {
|
|
35
|
+
// the node has no state for this source - nothing to do
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
(0, core_bentley_1.using)(new MergedNodeStateChangeReporter(entry, stateChanges), (_) => {
|
|
39
|
+
entry.states.delete(sourceId);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, stateChanges);
|
|
38
43
|
}
|
|
39
|
-
async
|
|
40
|
-
let
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.
|
|
44
|
+
async onHierarchyStateChanged(imodel, rulesetId, sourceId, newHierarchyState) {
|
|
45
|
+
let hierarchyState = this._hierarchyStates.get(rulesetId);
|
|
46
|
+
if (!hierarchyState) {
|
|
47
|
+
if (newHierarchyState.length === 0)
|
|
48
|
+
return;
|
|
49
|
+
hierarchyState = new Map();
|
|
50
|
+
this._hierarchyStates.set(rulesetId, hierarchyState);
|
|
46
51
|
}
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const handledNodeIds = new Set();
|
|
53
|
+
const stateChanges = [];
|
|
54
|
+
// step 1: walk over new state and report all changes
|
|
55
|
+
newHierarchyState.forEach(({ node, state }) => {
|
|
56
|
+
const nodeId = node === null || node === void 0 ? void 0 : node.id;
|
|
57
|
+
const nodeKey = node === null || node === void 0 ? void 0 : node.key;
|
|
58
|
+
const existingNodeEntry = hierarchyState.get(nodeId);
|
|
59
|
+
if (existingNodeEntry) {
|
|
60
|
+
(0, core_bentley_1.using)(new MergedNodeStateChangeReporter(existingNodeEntry, stateChanges), (_) => {
|
|
61
|
+
existingNodeEntry.states.set(sourceId, state);
|
|
62
|
+
});
|
|
54
63
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
else {
|
|
65
|
+
hierarchyState.set(nodeId, { key: nodeKey, states: new Map([[sourceId, state]]) });
|
|
66
|
+
stateChanges.push({ ...calculateMergedNodeState([state].values()), nodeKey });
|
|
67
|
+
}
|
|
68
|
+
handledNodeIds.add(nodeId);
|
|
69
|
+
});
|
|
70
|
+
// step 2: walk over old state and remove all state that's not in the new state
|
|
71
|
+
const erasedNodeIds = new Set();
|
|
72
|
+
hierarchyState.forEach((entry, nodeId) => {
|
|
73
|
+
if (handledNodeIds.has(nodeId)) {
|
|
74
|
+
// the node was handled with the new state - nothing to do here
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!entry.states.has(sourceId)) {
|
|
78
|
+
// the node had no state for this source, so it's not affected by this report
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
(0, core_bentley_1.using)(new MergedNodeStateChangeReporter(entry, stateChanges), (_) => {
|
|
82
|
+
entry.states.delete(sourceId);
|
|
83
|
+
});
|
|
84
|
+
// istanbul ignore next
|
|
85
|
+
if (entry.states.size === 0) {
|
|
86
|
+
// there are no more components holding state for this node
|
|
87
|
+
erasedNodeIds.add(nodeId);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
// step 3: cleanup erased node ids and possibly the whole hierarchy state
|
|
91
|
+
for (const nodeId of erasedNodeIds) {
|
|
92
|
+
hierarchyState.delete(nodeId);
|
|
69
93
|
}
|
|
70
|
-
|
|
71
|
-
|
|
94
|
+
if (hierarchyState.size === 0)
|
|
95
|
+
this._hierarchyStates.delete(rulesetId);
|
|
96
|
+
// finally, report
|
|
97
|
+
await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, stateChanges);
|
|
72
98
|
}
|
|
73
99
|
}
|
|
74
100
|
exports.StateTracker = StateTracker;
|
|
101
|
+
function calculateMergedNodeState(perComponentStates) {
|
|
102
|
+
const merged = {};
|
|
103
|
+
for (const state of perComponentStates) {
|
|
104
|
+
if (state.isExpanded)
|
|
105
|
+
merged.isExpanded = true;
|
|
106
|
+
if (state.instanceFilter) {
|
|
107
|
+
if (!merged.instanceFilters)
|
|
108
|
+
merged.instanceFilters = [state.instanceFilter];
|
|
109
|
+
else if (!merged.instanceFilters.includes(state.instanceFilter))
|
|
110
|
+
merged.instanceFilters.push(state.instanceFilter);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return merged;
|
|
114
|
+
}
|
|
115
|
+
class MergedNodeStateChangeReporter {
|
|
116
|
+
constructor(entry, outStateChanges) {
|
|
117
|
+
this._entry = entry;
|
|
118
|
+
this._stateBefore = calculateMergedNodeState(this._entry.states.values());
|
|
119
|
+
this._outStateChanges = outStateChanges;
|
|
120
|
+
}
|
|
121
|
+
dispose() {
|
|
122
|
+
var _a, _b, _c, _d;
|
|
123
|
+
const stateAfter = calculateMergedNodeState(this._entry.states.values());
|
|
124
|
+
const expandedFlagsDiffer = !!stateAfter.isExpanded !== !!this._stateBefore.isExpanded;
|
|
125
|
+
const instanceFiltersDiffer = ((_b = (_a = stateAfter.instanceFilters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) !== ((_d = (_c = this._stateBefore.instanceFilters) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0);
|
|
126
|
+
if (expandedFlagsDiffer || instanceFiltersDiffer)
|
|
127
|
+
this._outStateChanges.push({ ...stateAfter, nodeKey: this._entry.key });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
75
130
|
//# sourceMappingURL=StateTracker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTracker.js","sourceRoot":"","sources":["../../../src/presentation-frontend/StateTracker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA2BH,gBAAgB;AAChB,MAAa,YAAY;IAIvB,YAAY,kBAAsC;QAChD,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAC9C,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,EAA6B,CAAC;IACnE,CAAC;IAEO,KAAK,CAAC,4BAA4B,CAAC,SAAiB,EAAE,SAAiB,EAAE,UAA8C,EAAE,QAAmB;QAClJ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YACvB,OAAO;QACT,MAAM,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtG,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,MAAwB,EAAE,SAAiB,EAAE,QAAgB;QAC1F,MAAM,SAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS;YACZ,OAAO;QAET,MAAM,WAAW,GAAc,EAAE,CAAC;QAClC,KAAK,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,SAAS,EAAE;YAC9C,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACzC,oEAAoE;YACpE,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC;gBACpC,SAAS;YAEX,SAAS,CAAC,MAAM,CAAC,MAAM,CA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nC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACvB;QAED,sEAAsE;QACtE,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;YACxC,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACpD,IAAI,YAAY;gBACd,SAAS;YAEX,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,GAAG,CAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;YACnG,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;SAClC;QAED,MAAM,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC;QAC9F,MAAM,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;IAC7F,CAAC;CACF;AA7ED,oCA6EC","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 { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { NodeKey } from \"@itwin/presentation-common\";\r\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\r\n\r\n/**\r\n * Data structure that describes information used by [[StateTracker]] to identify node.\r\n * @internal\r\n */\r\nexport interface NodeIdentifier {\r\n id: string;\r\n key: NodeKey;\r\n}\r\n\r\n/**\r\n * Data structure that describes expanded node.\r\n */\r\ninterface ExpandedNode {\r\n key: NodeKey;\r\n /** Set of source ids in which this node is expanded. */\r\n expandedIn: Set<string>;\r\n}\r\n\r\n/** Maps node ids to expanded nodes. */\r\ntype ExpandedHierarchy = Map<string, ExpandedNode>;\r\n\r\n/** @internal */\r\nexport class StateTracker {\r\n private _expandedHierarchies: Map<string, ExpandedHierarchy>;\r\n private _ipcRequestsHandler: IpcRequestsHandler;\r\n\r\n constructor(ipcRequestsHandler: IpcRequestsHandler) {\r\n this._ipcRequestsHandler = ipcRequestsHandler;\r\n this._expandedHierarchies = new Map<string, ExpandedHierarchy>();\r\n }\r\n\r\n private async updateHierarchyStateIfNeeded(imodelKey: string, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", nodeKeys: NodeKey[]) {\r\n if (nodeKeys.length === 0)\r\n return;\r\n await this._ipcRequestsHandler.updateHierarchyState({ imodelKey, rulesetId, changeType, nodeKeys });\r\n }\r\n\r\n public async onHierarchyClosed(imodel: IModelConnection, rulesetId: string, sourceId: string) {\r\n const hierarchy = this._expandedHierarchies.get(rulesetId);\r\n if (!hierarchy)\r\n return;\r\n\r\n const removedKeys: NodeKey[] = [];\r\n for (const [nodeId, expandedNode] of hierarchy) {\r\n expandedNode.expandedIn.delete(sourceId);\r\n // if there are other sources that have this node expanded leave it.\r\n if (expandedNode.expandedIn.size !== 0)\r\n continue;\r\n\r\n hierarchy.delete(nodeId);\r\n removedKeys.push(expandedNode.key);\r\n }\r\n\r\n if (hierarchy.size === 0)\r\n this._expandedHierarchies.delete(rulesetId);\r\n\r\n await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, \"nodesCollapsed\", removedKeys);\r\n }\r\n\r\n public async onExpandedNodesChanged(imodel: IModelConnection, rulesetId: string, sourceId: string, expandedNodes: NodeIdentifier[]) {\r\n let hierarchy = this._expandedHierarchies.get(rulesetId);\r\n if (expandedNodes.length === 0 && !hierarchy)\r\n return;\r\n if (!hierarchy) {\r\n hierarchy = new Map<string, ExpandedNode>();\r\n this._expandedHierarchies.set(rulesetId, hierarchy);\r\n }\r\n\r\n const removedKeys: NodeKey[] = [];\r\n const addedKeys: NodeKey[] = [];\r\n for (const [key, existingNode] of hierarchy) {\r\n // existing node is in new expanded nodes list. Add current source\r\n if (expandedNodes.find((expandedNode) => expandedNode.id === key)) {\r\n existingNode.expandedIn.add(sourceId);\r\n continue;\r\n }\r\n\r\n // node was not found in expanded nodes list. Remove current source\r\n existingNode.expandedIn.delete(sourceId);\r\n if (existingNode.expandedIn.size !== 0)\r\n continue;\r\n\r\n removedKeys.push(existingNode.key);\r\n hierarchy.delete(key);\r\n }\r\n\r\n // add any new nodes that were not in expanded nodes hierarchy already\r\n for (const expandedNode of expandedNodes) {\r\n const existingNode = hierarchy.get(expandedNode.id);\r\n if (existingNode)\r\n continue;\r\n\r\n hierarchy.set(expandedNode.id, { key: expandedNode.key, expandedIn: new Set<string>([sourceId]) });\r\n addedKeys.push(expandedNode.key);\r\n }\r\n\r\n await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, \"nodesCollapsed\", removedKeys);\r\n await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, \"nodesExpanded\", addedKeys);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"StateTracker.js","sourceRoot":"","sources":["../../../src/presentation-frontend/StateTracker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AAoCzD;;;;;GAKG;AACH,MAAa,YAAY;IAKvB,YAAY,kBAAsC;QAChD,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAC9C,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;IACpC,CAAC;IAEO,KAAK,CAAC,4BAA4B,CAAC,SAAiB,EAAE,SAAiB,EAAE,YAAiC;QAChH,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;YAC3B,OAAO;QACT,MAAM,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9F,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC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eAAoC;QAC7E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1E,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;IAC1C,CAAC;IACM,OAAO;;QACZ,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACzE,MAAM,mBAAmB,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;QACvF,MAAM,qBAAqB,GAAG,CAAC,MAAA,MAAA,UAAU,CAAC,eAAe,0CAAE,MAAM,mCAAI,CAAC,CAAC,KAAK,CAAC,MAAA,MAAA,IAAI,CAAC,YAAY,CAAC,eAAe,0CAAE,MAAM,mCAAI,CAAC,CAAC,CAAC;QAC7H,IAAI,mBAAmB,IAAI,qBAAqB;YAC9C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF","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 { IDisposable, using } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { NodeKey } from \"@itwin/presentation-common\";\r\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\r\n\r\n/**\r\n * Data structure that describes information used by [[StateTracker]] to identify node.\r\n * @internal\r\n */\r\nexport interface NodeIdentifier {\r\n id: string;\r\n key: NodeKey;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface NodeState {\r\n isExpanded?: boolean;\r\n instanceFilter?: string;\r\n}\r\n\r\ninterface MergedNodeState {\r\n isExpanded?: boolean;\r\n instanceFilters?: string[];\r\n}\r\n\r\ninterface ReportedNodeState extends MergedNodeState {\r\n nodeKey: NodeKey | undefined;\r\n}\r\n\r\ninterface NodeStatesEntry {\r\n key: NodeKey | undefined;\r\n states: Map<string, NodeState>; // per-component node state\r\n}\r\n\r\n/**\r\n * The tracker stores up-to-date UI state of the hierarchies on the frontend and reports\r\n * just the state changes to the backend as soon as component sends in a new hierarchy state.\r\n *\r\n * @internal\r\n */\r\nexport class StateTracker {\r\n // Ruleset ID => Node ID => Node state info\r\n private _hierarchyStates: Map<string, Map<string | undefined, NodeStatesEntry>>;\r\n private _ipcRequestsHandler: IpcRequestsHandler;\r\n\r\n constructor(ipcRequestsHandler: IpcRequestsHandler) {\r\n this._ipcRequestsHandler = ipcRequestsHandler;\r\n this._hierarchyStates = new Map();\r\n }\r\n\r\n private async updateHierarchyStateIfNeeded(imodelKey: string, rulesetId: string, stateChanges: ReportedNodeState[]) {\r\n if (stateChanges.length === 0)\r\n return;\r\n await this._ipcRequestsHandler.updateHierarchyState({ imodelKey, rulesetId, stateChanges });\r\n }\r\n\r\n public async onHierarchyClosed(imodel: IModelConnection, rulesetId: string, sourceId: string) {\r\n const hierarchyState = this._hierarchyStates.get(rulesetId);\r\n if (!hierarchyState)\r\n return;\r\n\r\n const stateChanges: ReportedNodeState[] = [];\r\n hierarchyState.forEach((entry) => {\r\n if (!entry.states.has(sourceId)) {\r\n // the node has no state for this source - nothing to do\r\n return;\r\n }\r\n using(new MergedNodeStateChangeReporter(entry, stateChanges), (_) => {\r\n entry.states.delete(sourceId);\r\n });\r\n });\r\n\r\n await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, stateChanges);\r\n }\r\n\r\n public async onHierarchyStateChanged(imodel: IModelConnection, rulesetId: string, sourceId: string, newHierarchyState: Array<{ node: NodeIdentifier | undefined, state: NodeState }>) {\r\n let hierarchyState = this._hierarchyStates.get(rulesetId);\r\n if (!hierarchyState) {\r\n if (newHierarchyState.length === 0)\r\n return;\r\n\r\n hierarchyState = new Map();\r\n this._hierarchyStates.set(rulesetId, hierarchyState);\r\n }\r\n\r\n const handledNodeIds = new Set<string | undefined>();\r\n const stateChanges: ReportedNodeState[] = [];\r\n\r\n // step 1: walk over new state and report all changes\r\n newHierarchyState.forEach(({ node, state }) => {\r\n const nodeId = node?.id;\r\n const nodeKey = node?.key;\r\n const existingNodeEntry = hierarchyState!.get(nodeId);\r\n if (existingNodeEntry) {\r\n using(new MergedNodeStateChangeReporter(existingNodeEntry, stateChanges), (_) => {\r\n existingNodeEntry.states.set(sourceId, state);\r\n });\r\n } else {\r\n hierarchyState!.set(nodeId, { key: nodeKey, states: new Map([[sourceId, state]]) });\r\n stateChanges.push({ ...calculateMergedNodeState([state].values()), nodeKey });\r\n }\r\n handledNodeIds.add(nodeId);\r\n });\r\n\r\n // step 2: walk over old state and remove all state that's not in the new state\r\n const erasedNodeIds = new Set<string | undefined>();\r\n hierarchyState.forEach((entry, nodeId) => {\r\n if (handledNodeIds.has(nodeId)) {\r\n // the node was handled with the new state - nothing to do here\r\n return;\r\n }\r\n\r\n if (!entry.states.has(sourceId)) {\r\n // the node had no state for this source, so it's not affected by this report\r\n return;\r\n }\r\n\r\n using(new MergedNodeStateChangeReporter(entry, stateChanges), (_) => {\r\n entry.states.delete(sourceId);\r\n });\r\n\r\n // istanbul ignore next\r\n if (entry.states.size === 0) {\r\n // there are no more components holding state for this node\r\n erasedNodeIds.add(nodeId);\r\n }\r\n });\r\n\r\n // step 3: cleanup erased node ids and possibly the whole hierarchy state\r\n for (const nodeId of erasedNodeIds) {\r\n hierarchyState.delete(nodeId);\r\n }\r\n if (hierarchyState.size === 0)\r\n this._hierarchyStates.delete(rulesetId);\r\n\r\n // finally, report\r\n await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, stateChanges);\r\n }\r\n}\r\n\r\nfunction calculateMergedNodeState(perComponentStates: IterableIterator<NodeState>): MergedNodeState {\r\n const merged: MergedNodeState = {};\r\n for (const state of perComponentStates) {\r\n if (state.isExpanded)\r\n merged.isExpanded = true;\r\n if (state.instanceFilter) {\r\n if (!merged.instanceFilters)\r\n merged.instanceFilters = [state.instanceFilter];\r\n else if (!merged.instanceFilters.includes(state.instanceFilter))\r\n merged.instanceFilters.push(state.instanceFilter);\r\n }\r\n }\r\n return merged;\r\n}\r\n\r\nclass MergedNodeStateChangeReporter implements IDisposable {\r\n private _entry: NodeStatesEntry;\r\n private _stateBefore: MergedNodeState;\r\n private _outStateChanges: ReportedNodeState[];\r\n public constructor(entry: NodeStatesEntry, outStateChanges: ReportedNodeState[]) {\r\n this._entry = entry;\r\n this._stateBefore = calculateMergedNodeState(this._entry.states.values());\r\n this._outStateChanges = outStateChanges;\r\n }\r\n public dispose() {\r\n const stateAfter = calculateMergedNodeState(this._entry.states.values());\r\n const expandedFlagsDiffer = !!stateAfter.isExpanded !== !!this._stateBefore.isExpanded;\r\n const instanceFiltersDiffer = (stateAfter.instanceFilters?.length ?? 0) !== (this._stateBefore.instanceFilters?.length ?? 0);\r\n if (expandedFlagsDiffer || instanceFiltersDiffer)\r\n this._outStateChanges.push({ ...stateAfter, nodeKey: this._entry.key });\r\n }\r\n}\r\n"]}
|
|
@@ -54,7 +54,7 @@ export declare function createSelectionScopeProps(scope: SelectionScopeProps | S
|
|
|
54
54
|
* Determines the scope id
|
|
55
55
|
* @param scope Selection scope
|
|
56
56
|
* @public
|
|
57
|
-
* @deprecated This is an internal utility that should've never become public.
|
|
57
|
+
* @deprecated in 3.x. This is an internal utility that should've never become public.
|
|
58
58
|
*/
|
|
59
59
|
export declare function getScopeId(scope: SelectionScope | string | undefined): string;
|
|
60
60
|
//# sourceMappingURL=SelectionScopesManager.d.ts.map
|
|
@@ -82,7 +82,7 @@ exports.createSelectionScopeProps = createSelectionScopeProps;
|
|
|
82
82
|
* Determines the scope id
|
|
83
83
|
* @param scope Selection scope
|
|
84
84
|
* @public
|
|
85
|
-
* @deprecated This is an internal utility that should've never become public.
|
|
85
|
+
* @deprecated in 3.x. This is an internal utility that should've never become public.
|
|
86
86
|
*/
|
|
87
87
|
// istanbul ignore next
|
|
88
88
|
function getScopeId(scope) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,oEAAsI;AActI;;;;;GAKG;AACH,MAAa,sBAAsB;IAMjC,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAEvD,2CAA2C;IAC3C,IAAW,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACtD,IAAW,WAAW,CAAC,KAAgE,IAAI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC;IAEvH;;;;OAIG;IACI,KAAK,CAAC,kBAAkB,CAAC,MAAwB,EAAE,MAAe;QACvE,IAAI,CAAC,MAAM;YACT,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,gBAAgB,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AO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,4BAAM,CAAC,QAAQ,CAAC,CAAC;QAC7E,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1DD,wDA0DC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK;QACR,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,OAAO,KAAK,CAAC;AACf,CAAC;AAND,8DAMC;AAED;;;;;GAKG;AACH,uBAAuB;AACvB,SAAgB,UAAU,CAAC,KAA0C;IACnE,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAC7C,CAAC;AAFD,gCAEC","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 UnifiedSelection\r\n */\r\n\r\nimport { Id64Arg } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Properties for creating [[SelectionScopesManager]].\r\n * @public\r\n */\r\nexport interface SelectionScopesManagerProps {\r\n /** RPC handler to use for requesting selection scopes */\r\n rpcRequestsHandler: RpcRequestsHandler;\r\n\r\n /** Provider of active locale to use for localizing scopes */\r\n localeProvider?: () => string | undefined;\r\n}\r\n\r\n/**\r\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\r\n * and can compute logical selection based on element IDs and selection scope.\r\n *\r\n * @public\r\n */\r\nexport class SelectionScopesManager {\r\n\r\n private _rpcRequestsHandler: RpcRequestsHandler;\r\n private _getLocale: () => string | undefined;\r\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\r\n\r\n public constructor(props: SelectionScopesManagerProps) {\r\n this._rpcRequestsHandler = props.rpcRequestsHandler;\r\n this._getLocale = props.localeProvider ? props.localeProvider : (() => undefined);\r\n }\r\n\r\n /** Get active locale */\r\n public get activeLocale() { return this._getLocale(); }\r\n\r\n /** The active selection scope or its id */\r\n public get activeScope() { return this._activeScope; }\r\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) { this._activeScope = scope; }\r\n\r\n /**\r\n * Get available selection scopes.\r\n * @param imodel The iModel to get selection scopes for\r\n * @param locale Optional locale to use when localizing scopes' label and description\r\n */\r\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\r\n if (!locale)\r\n locale = this._getLocale();\r\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\r\n }\r\n\r\n /**\r\n * Computes keys that need to be added to logical selection based on provided selection scope.\r\n * @param ids Element IDs to compute selection for\r\n * @param scope Selection scope to apply\r\n */\r\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\r\n const scopeProps = createSelectionScopeProps(scope);\r\n\r\n // convert ids input to array\r\n if (typeof ids === \"string\")\r\n ids = [ids];\r\n else if (ids instanceof Set)\r\n ids = [...ids];\r\n\r\n // compute selection in batches to avoid HTTP 413\r\n const keys = new KeySet();\r\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\r\n const batchesCount = Math.ceil(ids.length / batchSize);\r\n const batchKeyPromises = [];\r\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\r\n const batchStart = batchSize * batchIndex;\r\n const batchEnd = (batchStart + batchSize > ids.length) ? ids.length : (batchStart + batchSize);\r\n const batchIds = (0 === batchIndex && ids.length <= batchEnd) ? ids : ids.slice(batchStart, batchEnd);\r\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\r\n }\r\n const batchKeys = (await Promise.all(batchKeyPromises)).map(KeySet.fromJSON);\r\n batchKeys.forEach((bk) => keys.add(bk));\r\n return keys;\r\n }\r\n}\r\n\r\n/**\r\n * Normalizes given scope options and returns [[ComputeSelectionScopeProps]] that can be used for\r\n * calculating selection with scope.\r\n *\r\n * @internal\r\n */\r\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\r\n if (!scope)\r\n return { id: \"element\" };\r\n if (typeof scope === \"string\")\r\n return { id: scope };\r\n return scope;\r\n}\r\n\r\n/**\r\n * Determines the scope id\r\n * @param scope Selection scope\r\n * @public\r\n * @deprecated This is an internal utility that should've never become public.\r\n */\r\n// istanbul ignore next\r\nexport function getScopeId(scope: SelectionScope | string | undefined): string {\r\n return createSelectionScopeProps(scope).id;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,oEAAsI;AActI;;;;;GAKG;AACH,MAAa,sBAAsB;IAMjC,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC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C,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;YAC/F,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,UAAU,IAAI,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACtG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;SAC7I;QACD,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,4BAAM,CAAC,QAAQ,CAAC,CAAC;QAC7E,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA1DD,wDA0DC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK;QACR,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,OAAO,KAAK,CAAC;AACf,CAAC;AAND,8DAMC;AAED;;;;;GAKG;AACH,uBAAuB;AACvB,SAAgB,UAAU,CAAC,KAA0C;IACnE,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAC7C,CAAC;AAFD,gCAEC","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 UnifiedSelection\r\n */\r\n\r\nimport { Id64Arg } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Properties for creating [[SelectionScopesManager]].\r\n * @public\r\n */\r\nexport interface SelectionScopesManagerProps {\r\n /** RPC handler to use for requesting selection scopes */\r\n rpcRequestsHandler: RpcRequestsHandler;\r\n\r\n /** Provider of active locale to use for localizing scopes */\r\n localeProvider?: () => string | undefined;\r\n}\r\n\r\n/**\r\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\r\n * and can compute logical selection based on element IDs and selection scope.\r\n *\r\n * @public\r\n */\r\nexport class SelectionScopesManager {\r\n\r\n private _rpcRequestsHandler: RpcRequestsHandler;\r\n private _getLocale: () => string | undefined;\r\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\r\n\r\n public constructor(props: SelectionScopesManagerProps) {\r\n this._rpcRequestsHandler = props.rpcRequestsHandler;\r\n this._getLocale = props.localeProvider ? props.localeProvider : (() => undefined);\r\n }\r\n\r\n /** Get active locale */\r\n public get activeLocale() { return this._getLocale(); }\r\n\r\n /** The active selection scope or its id */\r\n public get activeScope() { return this._activeScope; }\r\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) { this._activeScope = scope; }\r\n\r\n /**\r\n * Get available selection scopes.\r\n * @param imodel The iModel to get selection scopes for\r\n * @param locale Optional locale to use when localizing scopes' label and description\r\n */\r\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\r\n if (!locale)\r\n locale = this._getLocale();\r\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\r\n }\r\n\r\n /**\r\n * Computes keys that need to be added to logical selection based on provided selection scope.\r\n * @param ids Element IDs to compute selection for\r\n * @param scope Selection scope to apply\r\n */\r\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\r\n const scopeProps = createSelectionScopeProps(scope);\r\n\r\n // convert ids input to array\r\n if (typeof ids === \"string\")\r\n ids = [ids];\r\n else if (ids instanceof Set)\r\n ids = [...ids];\r\n\r\n // compute selection in batches to avoid HTTP 413\r\n const keys = new KeySet();\r\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\r\n const batchesCount = Math.ceil(ids.length / batchSize);\r\n const batchKeyPromises = [];\r\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\r\n const batchStart = batchSize * batchIndex;\r\n const batchEnd = (batchStart + batchSize > ids.length) ? ids.length : (batchStart + batchSize);\r\n const batchIds = (0 === batchIndex && ids.length <= batchEnd) ? ids : ids.slice(batchStart, batchEnd);\r\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\r\n }\r\n const batchKeys = (await Promise.all(batchKeyPromises)).map(KeySet.fromJSON);\r\n batchKeys.forEach((bk) => keys.add(bk));\r\n return keys;\r\n }\r\n}\r\n\r\n/**\r\n * Normalizes given scope options and returns [[ComputeSelectionScopeProps]] that can be used for\r\n * calculating selection with scope.\r\n *\r\n * @internal\r\n */\r\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\r\n if (!scope)\r\n return { id: \"element\" };\r\n if (typeof scope === \"string\")\r\n return { id: scope };\r\n return scope;\r\n}\r\n\r\n/**\r\n * Determines the scope id\r\n * @param scope Selection scope\r\n * @public\r\n * @deprecated in 3.x. This is an internal utility that should've never become public.\r\n */\r\n// istanbul ignore next\r\nexport function getScopeId(scope: SelectionScope | string | undefined): string {\r\n return createSelectionScopeProps(scope).id;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,EAA2D,eAAe,EAAuB,wBAAwB,EAChI,0BAA0B,EAAE,0BAA0B,EACvD,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM;YAId,IAAI;IAIL,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC;IAStF,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC;IAQzE,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;CAOhG"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { IpcApp } from "@itwin/core-frontend";
|
|
6
|
-
import {
|
|
6
|
+
import { PRESENTATION_IPC_CHANNEL_NAME, RulesetVariable, } from "@itwin/presentation-common";
|
|
7
7
|
/** @internal */
|
|
8
8
|
export class IpcRequestsHandler {
|
|
9
9
|
constructor(clientId) {
|
|
@@ -31,7 +31,6 @@ export class IpcRequestsHandler {
|
|
|
31
31
|
const jsonParams = {
|
|
32
32
|
...params,
|
|
33
33
|
clientId: this.clientId,
|
|
34
|
-
nodeKeys: params.nodeKeys.map(NodeKey.toJSON),
|
|
35
34
|
};
|
|
36
35
|
return this.call("updateHierarchyState", jsonParams);
|
|
37
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAG/F,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAG/F,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACI,6BAA6B,EAA4B,eAAe,GAElF,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,MAAM,OAAO,kBAAkB;IAG7B,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,IAAI,CAAqD,UAAa,EAAE,GAAG,IAA6C;QACpI,OAAO,MAAM,CAAC,cAAc,CAAC,6BAA6B,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC;IACnF,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAmE;QACjG,MAAM,UAAU,GAAkD;YAChE,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAoD;QACpF,MAAM,UAAU,GAA+B;YAC7C,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAA6D;QAC7F,MAAM,UAAU,GAAwC;YACtD,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;CACF","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\r\nimport { AsyncMethodsOf, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport { IpcApp } from \"@itwin/core-frontend\";\r\nimport {\r\n NodeKey, PRESENTATION_IPC_CHANNEL_NAME, PresentationIpcInterface, RulesetVariable, RulesetVariableJSON, SetRulesetVariableParams,\r\n UnsetRulesetVariableParams, UpdateHierarchyStateParams,\r\n} from \"@itwin/presentation-common\";\r\n\r\n/** @internal */\r\nexport class IpcRequestsHandler {\r\n public readonly clientId: string;\r\n\r\n constructor(clientId: string) {\r\n this.clientId = clientId;\r\n }\r\n\r\n private async call<T extends AsyncMethodsOf<PresentationIpcInterface>>(methodName: T, ...args: Parameters<PresentationIpcInterface[T]>): Promise<PromiseReturnType<PresentationIpcInterface[T]>> {\r\n return IpcApp.callIpcChannel(PRESENTATION_IPC_CHANNEL_NAME, methodName, ...args);\r\n }\r\n\r\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\r\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\r\n ...params,\r\n clientId: this.clientId,\r\n variable: RulesetVariable.toJSON(params.variable),\r\n };\r\n return this.call(\"setRulesetVariable\", jsonParams);\r\n }\r\n\r\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\r\n const jsonParams: UnsetRulesetVariableParams = {\r\n ...params,\r\n clientId: this.clientId,\r\n };\r\n return this.call(\"unsetRulesetVariable\", jsonParams);\r\n }\r\n\r\n public async updateHierarchyState(params: Omit<UpdateHierarchyStateParams<NodeKey>, \"clientId\">) {\r\n const jsonParams: UpdateHierarchyStateParams<NodeKey> = {\r\n ...params,\r\n clientId: this.clientId,\r\n };\r\n return this.call(\"updateHierarchyState\", jsonParams);\r\n }\r\n}\r\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { BeEvent, IDisposable } from "@itwin/core-bentley";
|
|
5
5
|
import { IModelConnection } from "@itwin/core-frontend";
|
|
6
6
|
import { UnitSystemKey } from "@itwin/core-quantity";
|
|
7
|
-
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, PageOptions, RpcRequestsHandler, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
7
|
+
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, PageOptions, RpcRequestsHandler, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
8
8
|
import { IpcRequestsHandler } from "./IpcRequestsHandler";
|
|
9
9
|
import { RulesetManager } from "./RulesetManager";
|
|
10
10
|
import { RulesetVariablesManager } from "./RulesetVariablesManager";
|
|
@@ -136,13 +136,19 @@ export declare class PresentationManager implements IDisposable {
|
|
|
136
136
|
count: number;
|
|
137
137
|
nodes: Node[];
|
|
138
138
|
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Retrieves hierarchy level descriptor.
|
|
141
|
+
* @beta
|
|
142
|
+
*/
|
|
143
|
+
getNodesDescriptor(requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined>;
|
|
139
144
|
/** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
|
|
140
145
|
getNodePaths(requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>;
|
|
141
146
|
/** Retrieves paths from root nodes to nodes containing filter text in their label. */
|
|
142
147
|
getFilteredNodePaths(requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>;
|
|
143
148
|
/**
|
|
144
|
-
* Get
|
|
145
|
-
*
|
|
149
|
+
* Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
|
|
150
|
+
* its related instances for loading related and navigation properties.
|
|
151
|
+
* @public
|
|
146
152
|
*/
|
|
147
153
|
getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]>;
|
|
148
154
|
/** Retrieves the content descriptor which describes the content and can be used to customize it. */
|
|
@@ -160,12 +166,12 @@ export declare class PresentationManager implements IDisposable {
|
|
|
160
166
|
getPagedDistinctValues(requestOptions: DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>>;
|
|
161
167
|
/**
|
|
162
168
|
* Retrieves property data in a simplified format for a single element specified by ID.
|
|
163
|
-
* @
|
|
169
|
+
* @public
|
|
164
170
|
*/
|
|
165
171
|
getElementProperties(requestOptions: SingleElementPropertiesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<ElementProperties | undefined>;
|
|
166
172
|
/**
|
|
167
173
|
* Retrieves content item instance keys.
|
|
168
|
-
* @
|
|
174
|
+
* @public
|
|
169
175
|
*/
|
|
170
176
|
getContentInstanceKeys(requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<{
|
|
171
177
|
total: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAAE,OAAO,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,qBAAqB,EAC9H,4BAA4B,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,2BAA2B,EACzI,iBAAiB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,4CAA4C,EAChH,mCAAmC,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,gBA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M,EAAE,eAAe,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,cAAc,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;IA0BpO,2DAA2D;IAC9C,yBAAyB,CAAC,cAAc,EAAE,0BAA0B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC,eAAe,CAAC;IAOxK,4DAA4D;IAC/C,0BAA0B,CAAC,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAU7K;AA+CD,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,yBAAgC,WAAW,GAAG,SAAS,iBAAiB,SAAS,WAAW,CAAC,gBAAgB,MAAM,oEAYtJ,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { BeEvent, CompressedId64Set, OrderedId64Iterable } from "@itwin/core-bentley";
|
|
9
9
|
import { IpcApp } from "@itwin/core-frontend";
|
|
10
|
-
import { Content, Descriptor, DisplayValueGroup,
|
|
10
|
+
import { Content, Descriptor, DisplayValueGroup, Item, Key, KeySet, Node, NodePathElement, PresentationIpcEvents, RpcRequestsHandler, RulesetVariable, SelectClassInfo, UpdateInfo, VariableValueTypes, } from "@itwin/presentation-common";
|
|
11
11
|
import { IpcRequestsHandler } from "./IpcRequestsHandler";
|
|
12
12
|
import { FrontendLocalizationHelper } from "./LocalizationHelper";
|
|
13
13
|
import { RulesetManagerImpl } from "./RulesetManager";
|
|
@@ -172,34 +172,48 @@ export class PresentationManager {
|
|
|
172
172
|
async getNodes(requestOptions) {
|
|
173
173
|
await this.onConnection(requestOptions.imodel);
|
|
174
174
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
175
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
175
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
176
176
|
const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));
|
|
177
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
177
178
|
return this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON));
|
|
178
179
|
}
|
|
179
180
|
/** Retrieves nodes count. */
|
|
180
181
|
async getNodesCount(requestOptions) {
|
|
181
182
|
await this.onConnection(requestOptions.imodel);
|
|
182
183
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
183
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
184
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
184
185
|
return this._requestsHandler.getNodesCount(rpcOptions);
|
|
185
186
|
}
|
|
186
187
|
/** Retrieves total nodes count and a single page of nodes. */
|
|
187
188
|
async getNodesAndCount(requestOptions) {
|
|
188
189
|
await this.onConnection(requestOptions.imodel);
|
|
189
190
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
190
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
191
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
191
192
|
const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));
|
|
192
193
|
return {
|
|
193
194
|
count: result.total,
|
|
195
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
194
196
|
nodes: this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON)),
|
|
195
197
|
};
|
|
196
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Retrieves hierarchy level descriptor.
|
|
201
|
+
* @beta
|
|
202
|
+
*/
|
|
203
|
+
async getNodesDescriptor(requestOptions) {
|
|
204
|
+
await this.onConnection(requestOptions.imodel);
|
|
205
|
+
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
206
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
207
|
+
const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);
|
|
208
|
+
return Descriptor.fromJSON(result);
|
|
209
|
+
}
|
|
197
210
|
/** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
|
|
198
211
|
async getNodePaths(requestOptions) {
|
|
199
212
|
await this.onConnection(requestOptions.imodel);
|
|
200
213
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
201
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
214
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
202
215
|
const result = await this._requestsHandler.getNodePaths(rpcOptions);
|
|
216
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
203
217
|
return result.map(NodePathElement.fromJSON);
|
|
204
218
|
}
|
|
205
219
|
/** Retrieves paths from root nodes to nodes containing filter text in their label. */
|
|
@@ -207,11 +221,13 @@ export class PresentationManager {
|
|
|
207
221
|
await this.onConnection(requestOptions.imodel);
|
|
208
222
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
209
223
|
const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));
|
|
224
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
210
225
|
return result.map(NodePathElement.fromJSON);
|
|
211
226
|
}
|
|
212
227
|
/**
|
|
213
|
-
* Get
|
|
214
|
-
*
|
|
228
|
+
* Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
|
|
229
|
+
* its related instances for loading related and navigation properties.
|
|
230
|
+
* @public
|
|
215
231
|
*/
|
|
216
232
|
async getContentSources(requestOptions) {
|
|
217
233
|
await this.onConnection(requestOptions.imodel);
|
|
@@ -287,12 +303,13 @@ export class PresentationManager {
|
|
|
287
303
|
const result = await buildPagedArrayResponse(requestOptions.paging, async (partialPageOptions) => this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging: partialPageOptions }));
|
|
288
304
|
return {
|
|
289
305
|
...result,
|
|
306
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
290
307
|
items: result.items.map(DisplayValueGroup.fromJSON),
|
|
291
308
|
};
|
|
292
309
|
}
|
|
293
310
|
/**
|
|
294
311
|
* Retrieves property data in a simplified format for a single element specified by ID.
|
|
295
|
-
* @
|
|
312
|
+
* @public
|
|
296
313
|
*/
|
|
297
314
|
async getElementProperties(requestOptions) {
|
|
298
315
|
await this.onConnection(requestOptions.imodel);
|
|
@@ -304,7 +321,7 @@ export class PresentationManager {
|
|
|
304
321
|
}
|
|
305
322
|
/**
|
|
306
323
|
* Retrieves content item instance keys.
|
|
307
|
-
* @
|
|
324
|
+
* @public
|
|
308
325
|
*/
|
|
309
326
|
async getContentInstanceKeys(requestOptions) {
|
|
310
327
|
await this.onConnection(requestOptions.imodel);
|
|
@@ -333,19 +350,19 @@ export class PresentationManager {
|
|
|
333
350
|
/** Retrieves display label definition of specific item. */
|
|
334
351
|
async getDisplayLabelDefinition(requestOptions) {
|
|
335
352
|
await this.onConnection(requestOptions.imodel);
|
|
336
|
-
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions
|
|
353
|
+
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
337
354
|
const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);
|
|
338
|
-
return this._localizationHelper.getLocalizedLabelDefinition(
|
|
355
|
+
return this._localizationHelper.getLocalizedLabelDefinition(result);
|
|
339
356
|
}
|
|
340
357
|
/** Retrieves display label definition of specific items. */
|
|
341
358
|
async getDisplayLabelDefinitions(requestOptions) {
|
|
342
359
|
await this.onConnection(requestOptions.imodel);
|
|
343
|
-
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions
|
|
360
|
+
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
344
361
|
const result = await buildPagedArrayResponse(undefined, async (partialPageOptions) => {
|
|
345
362
|
const partialKeys = (!partialPageOptions.start) ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);
|
|
346
363
|
return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });
|
|
347
364
|
});
|
|
348
|
-
return this._localizationHelper.getLocalizedLabelDefinitions(result.items
|
|
365
|
+
return this._localizationHelper.getLocalizedLabelDefinitions(result.items);
|
|
349
366
|
}
|
|
350
367
|
}
|
|
351
368
|
const getDescriptorOverrides = (descriptorOrOverrides) => {
|
|
@@ -353,7 +370,6 @@ const getDescriptorOverrides = (descriptorOrOverrides) => {
|
|
|
353
370
|
return descriptorOrOverrides.createDescriptorOverrides();
|
|
354
371
|
return descriptorOrOverrides;
|
|
355
372
|
};
|
|
356
|
-
const optionalNodeKeyToJson = (key) => key ? NodeKey.toJSON(key) : undefined;
|
|
357
373
|
async function createPagedGeneratorResponse(props) {
|
|
358
374
|
var _a, _b, _c, _d;
|
|
359
375
|
let pageStart = (_b = (_a = props.page) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -395,6 +411,7 @@ export const buildPagedArrayResponse = async (requestedPage, getter) => {
|
|
|
395
411
|
return { total: gen.total, items };
|
|
396
412
|
}
|
|
397
413
|
catch {
|
|
414
|
+
// FIXME: we should propagate the error...
|
|
398
415
|
return { total: 0, items: [] };
|
|
399
416
|
}
|
|
400
417
|
};
|