@itwin/presentation-hierarchies 2.0.0-alpha.12 → 2.0.0-alpha.13
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 +268 -16
- package/README.md +2 -2
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +13 -11
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js +18 -0
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts +2 -0
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +23 -6
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +5 -4
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +3 -3
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchySearch.d.ts +184 -78
- package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchySearch.js +305 -113
- package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts +3 -3
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +9 -4
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +25 -16
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +4 -4
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +12 -9
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +3 -3
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js +31 -55
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts +2 -2
- package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +2 -1
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.d.ts +13 -11
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js +18 -0
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +2 -0
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js +23 -6
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts +5 -4
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +3 -3
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/HierarchySearch.d.ts +184 -78
- package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchySearch.js +304 -111
- package/lib/esm/hierarchies/HierarchySearch.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +3 -3
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +9 -4
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +26 -17
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts +4 -4
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +13 -10
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +3 -3
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js +32 -56
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js +2 -2
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
- package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts +2 -2
- package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/esm/presentation-hierarchies.d.ts +1 -1
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +1 -1
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchySearch.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HierarchySearch.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAIvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,KAAK,EAAE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AC;YAC3C,WAAW,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,OAAO,CAAC;SAC/D,GAAG,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,SAAS;gBAClC;YACnC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAAC;YAC3C,gBAAgB,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;SACvF,GAAG,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,SAAS;;EA+DvJ"}
|
|
@@ -4,41 +4,13 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.HierarchySearchPath = void 0;
|
|
7
|
+
exports.HierarchySearchTree = exports.HierarchySearchPath = void 0;
|
|
8
8
|
exports.createHierarchySearchHelper = createHierarchySearchHelper;
|
|
9
|
-
|
|
9
|
+
const rxjs_1 = require("rxjs");
|
|
10
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
11
|
const HierarchyNodeIdentifier_js_1 = require("./HierarchyNodeIdentifier.js");
|
|
11
12
|
const HierarchyNodeKey_js_1 = require("./HierarchyNodeKey.js");
|
|
12
|
-
|
|
13
|
-
(function (HierarchySearchPathOptions) {
|
|
14
|
-
function mergeRevealOptions(lhs, rhs) {
|
|
15
|
-
if (rhs === true || lhs === true) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
if (!rhs || !lhs) {
|
|
19
|
-
return !!rhs ? rhs : lhs;
|
|
20
|
-
}
|
|
21
|
-
const lhsDepth = "depthInPath" in lhs ? lhs.depthInPath : lhs.depthInHierarchy;
|
|
22
|
-
const rhsDepth = "depthInPath" in rhs ? rhs.depthInPath : rhs.depthInHierarchy;
|
|
23
|
-
const isLhsDepthBasedOnPath = "depthInPath" in lhs;
|
|
24
|
-
const isRhsDepthBasedOnPath = "depthInPath" in rhs;
|
|
25
|
-
if (isLhsDepthBasedOnPath) {
|
|
26
|
-
if (isRhsDepthBasedOnPath) {
|
|
27
|
-
return lhsDepth > rhsDepth ? lhs : rhs;
|
|
28
|
-
}
|
|
29
|
-
return lhs;
|
|
30
|
-
}
|
|
31
|
-
if (isRhsDepthBasedOnPath) {
|
|
32
|
-
return rhs;
|
|
33
|
-
}
|
|
34
|
-
return lhsDepth > rhsDepth ? lhs : rhs;
|
|
35
|
-
}
|
|
36
|
-
HierarchySearchPathOptions.mergeRevealOptions = mergeRevealOptions;
|
|
37
|
-
function mergeAutoExpandOption(lhs, rhs) {
|
|
38
|
-
return lhs || rhs ? true : undefined;
|
|
39
|
-
}
|
|
40
|
-
HierarchySearchPathOptions.mergeAutoExpandOption = mergeAutoExpandOption;
|
|
41
|
-
})(HierarchySearchPathOptions || (HierarchySearchPathOptions = {}));
|
|
13
|
+
const ReleaseMainThread_js_1 = require("./internal/operators/ReleaseMainThread.js");
|
|
42
14
|
/** @public */
|
|
43
15
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
44
16
|
var HierarchySearchPath;
|
|
@@ -62,14 +34,14 @@ var HierarchySearchPath;
|
|
|
62
34
|
* - else if only one of the inputs is an object, return it,
|
|
63
35
|
* - else if both inputs are falsy, return `false` or `undefined`,
|
|
64
36
|
* - else:
|
|
65
|
-
* - if only one of the inputs has `
|
|
66
|
-
* - else
|
|
37
|
+
* - if only one of the inputs has `groupingLevel` set, return that one,
|
|
38
|
+
* - else compare by matching reveal type (`groupingLevel` or `depthInPath`) and return the deeper one.
|
|
67
39
|
*
|
|
68
40
|
* @public
|
|
69
41
|
*/
|
|
70
42
|
function mergeOptions(lhs, rhs) {
|
|
71
|
-
const reveal =
|
|
72
|
-
const autoExpand =
|
|
43
|
+
const reveal = mergeRevealOptions(lhs?.reveal, rhs?.reveal);
|
|
44
|
+
const autoExpand = mergeAutoExpandOption(lhs?.autoExpand, rhs?.autoExpand);
|
|
73
45
|
return reveal || autoExpand
|
|
74
46
|
? {
|
|
75
47
|
...(reveal !== undefined ? { reveal } : undefined),
|
|
@@ -78,7 +50,254 @@ var HierarchySearchPath;
|
|
|
78
50
|
: undefined;
|
|
79
51
|
}
|
|
80
52
|
HierarchySearchPath.mergeOptions = mergeOptions;
|
|
53
|
+
function mergeRevealOptions(lhs, rhs) {
|
|
54
|
+
if (rhs === true || lhs === true) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
if (!rhs || !lhs) {
|
|
58
|
+
return !!rhs ? rhs : lhs;
|
|
59
|
+
}
|
|
60
|
+
if ("groupingLevel" in lhs) {
|
|
61
|
+
if ("groupingLevel" in rhs) {
|
|
62
|
+
return lhs.groupingLevel > rhs.groupingLevel ? lhs : rhs;
|
|
63
|
+
}
|
|
64
|
+
return lhs;
|
|
65
|
+
}
|
|
66
|
+
else if ("groupingLevel" in rhs) {
|
|
67
|
+
return rhs;
|
|
68
|
+
}
|
|
69
|
+
return lhs.depthInPath > rhs.depthInPath ? lhs : rhs;
|
|
70
|
+
}
|
|
71
|
+
function mergeAutoExpandOption(lhs, rhs) {
|
|
72
|
+
return lhs || rhs ? true : undefined;
|
|
73
|
+
}
|
|
81
74
|
})(HierarchySearchPath || (exports.HierarchySearchPath = HierarchySearchPath = {}));
|
|
75
|
+
/** @public */
|
|
76
|
+
var HierarchySearchTree;
|
|
77
|
+
(function (HierarchySearchTree) {
|
|
78
|
+
/**
|
|
79
|
+
* Create a `HierarchySearchTree` builder utility that accepts hierarchy search paths or search trees one by one and builds
|
|
80
|
+
* a `HierarchySearchTree` structure based on them.
|
|
81
|
+
*
|
|
82
|
+
* Usage example:
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* const builder = HierarchySearchTree.createBuilder();
|
|
86
|
+
* for (const path of searchPaths) {
|
|
87
|
+
* builder.accept({ path });
|
|
88
|
+
* }
|
|
89
|
+
* const searchTree = builder.getTree();
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
function createBuilder() {
|
|
95
|
+
var _a;
|
|
96
|
+
return new (class Impl {
|
|
97
|
+
#rootsDictionary = new core_bentley_1.Dictionary(HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.compare);
|
|
98
|
+
static #mapDictionaryToTree(dictionary) {
|
|
99
|
+
const list = [];
|
|
100
|
+
for (const { children, extras: _, ...entry } of dictionary.values()) {
|
|
101
|
+
list.push({ ...entry, ...(children ? { children: Impl.#mapDictionaryToTree(children) } : undefined) });
|
|
102
|
+
}
|
|
103
|
+
return list;
|
|
104
|
+
}
|
|
105
|
+
static #assignAutoExpandOptionsBasedOnReveal(treePath, revealOption) {
|
|
106
|
+
if (revealOption === true) {
|
|
107
|
+
Impl.#assignOptionsOnTreePath({
|
|
108
|
+
treePath,
|
|
109
|
+
targetEntryIndex: treePath.length - 1,
|
|
110
|
+
getEntryOptions: (index, targetEntryIndex) => {
|
|
111
|
+
if (index === targetEntryIndex) {
|
|
112
|
+
// auto-expand all grouping nodes of the revealed node
|
|
113
|
+
return { autoExpand: { groupingLevel: Number.MAX_SAFE_INTEGER } };
|
|
114
|
+
}
|
|
115
|
+
// auto-expand all parent nodes
|
|
116
|
+
return { autoExpand: true };
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else if (revealOption && "groupingLevel" in revealOption) {
|
|
121
|
+
Impl.#assignOptionsOnTreePath({
|
|
122
|
+
treePath,
|
|
123
|
+
targetEntryIndex: treePath.length - 1,
|
|
124
|
+
getEntryOptions: (index, targetEntryIndex) => {
|
|
125
|
+
if (index === targetEntryIndex) {
|
|
126
|
+
// the last entry should have `autoExpand` with `groupingLevel` set to the value based on `reveal.groupingLevel`
|
|
127
|
+
return { autoExpand: { groupingLevel: Math.max(revealOption.groupingLevel - 1, 0) } };
|
|
128
|
+
}
|
|
129
|
+
// auto-expand all parent nodes
|
|
130
|
+
return { autoExpand: true };
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else if (revealOption && "depthInPath" in revealOption) {
|
|
135
|
+
Impl.#assignOptionsOnTreePath({
|
|
136
|
+
treePath,
|
|
137
|
+
targetEntryIndex: Math.min(revealOption.depthInPath, treePath.length - 1),
|
|
138
|
+
getEntryOptions: (index, targetEntryIndex) => {
|
|
139
|
+
if (index === targetEntryIndex) {
|
|
140
|
+
// auto-expand all grouping nodes of the revealed node
|
|
141
|
+
return { autoExpand: { groupingLevel: Number.MAX_SAFE_INTEGER } };
|
|
142
|
+
}
|
|
143
|
+
// auto-expand all parent nodes
|
|
144
|
+
return { autoExpand: true };
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
static #assignOptionsOnTreePath({ treePath, targetEntryIndex, getEntryOptions, }) {
|
|
150
|
+
// set all parent entries to auto-expand
|
|
151
|
+
for (let i = 0; i <= targetEntryIndex; i++) {
|
|
152
|
+
const options = mergeOptions(treePath[i].options, getEntryOptions(i, targetEntryIndex));
|
|
153
|
+
if (options) {
|
|
154
|
+
treePath[i].options = options;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
#acceptNode({ parentEntries, level, node, handler, }) {
|
|
159
|
+
let entry = level.get(node.identifier);
|
|
160
|
+
if (!entry) {
|
|
161
|
+
if (handler?.onNewEntry && !handler.onNewEntry({ parentEntries, inputEntry: node })) {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
entry = {
|
|
165
|
+
identifier: node.identifier,
|
|
166
|
+
children: node.hasChildren ? new core_bentley_1.Dictionary(HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.compare) : undefined,
|
|
167
|
+
extras: {},
|
|
168
|
+
};
|
|
169
|
+
level.set(node.identifier, entry);
|
|
170
|
+
}
|
|
171
|
+
const isNodeSearchTarget = node.isTarget || !node.hasChildren;
|
|
172
|
+
if (isNodeSearchTarget && entry.children) {
|
|
173
|
+
entry.isTarget = true;
|
|
174
|
+
}
|
|
175
|
+
if (!entry.children && node.hasChildren) {
|
|
176
|
+
// Existing leaf nodes are implied targets. Preserve that status when adding children.
|
|
177
|
+
entry.isTarget = true;
|
|
178
|
+
entry.children = new core_bentley_1.Dictionary(HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.compare);
|
|
179
|
+
}
|
|
180
|
+
handler?.onEntryHandled?.({ parentEntries, treeEntry: entry, inputEntry: node });
|
|
181
|
+
return entry;
|
|
182
|
+
}
|
|
183
|
+
#acceptPath({ path, handler }) {
|
|
184
|
+
const normalized = HierarchySearchPath.normalize(path);
|
|
185
|
+
const treePath = [];
|
|
186
|
+
let currentLevel = this.#rootsDictionary;
|
|
187
|
+
for (let i = 0; i < normalized.path.length; i++) {
|
|
188
|
+
const identifier = normalized.path[i];
|
|
189
|
+
const acceptedNode = this.#acceptNode({
|
|
190
|
+
parentEntries: treePath,
|
|
191
|
+
node: { identifier, hasChildren: i < normalized.path.length - 1 },
|
|
192
|
+
level: currentLevel,
|
|
193
|
+
handler,
|
|
194
|
+
});
|
|
195
|
+
if (!acceptedNode) {
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
treePath.push(acceptedNode);
|
|
199
|
+
if (!acceptedNode.children) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
currentLevel = acceptedNode.children;
|
|
203
|
+
}
|
|
204
|
+
if (treePath.length === 0) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// handle auto-expand
|
|
208
|
+
const lastNode = treePath[treePath.length - 1];
|
|
209
|
+
if (normalized.options?.autoExpand) {
|
|
210
|
+
(lastNode.options ??= {}).autoExpand = true;
|
|
211
|
+
}
|
|
212
|
+
// handle auto-reveal
|
|
213
|
+
Impl.#assignAutoExpandOptionsBasedOnReveal(treePath, normalized.options?.reveal);
|
|
214
|
+
}
|
|
215
|
+
#acceptTree({ tree, handler }) {
|
|
216
|
+
const acceptTreeNode = (parentEntries, parentInputs, level, node) => {
|
|
217
|
+
const acceptedNode = this.#acceptNode({
|
|
218
|
+
parentEntries,
|
|
219
|
+
node: { ...node, hasChildren: node.children !== undefined },
|
|
220
|
+
level,
|
|
221
|
+
handler,
|
|
222
|
+
});
|
|
223
|
+
if (!acceptedNode) {
|
|
224
|
+
// It was decided to reject this node and its children, if any
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const treePath = [...parentEntries, acceptedNode];
|
|
228
|
+
const inputsPath = [...parentInputs, node];
|
|
229
|
+
if (!node.children || node.isTarget) {
|
|
230
|
+
// Found an effective search target - merge options from its path
|
|
231
|
+
Impl.#assignOptionsOnTreePath({
|
|
232
|
+
treePath,
|
|
233
|
+
targetEntryIndex: treePath.length - 1,
|
|
234
|
+
getEntryOptions: (index) => inputsPath[index].options,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
const currentLevel = acceptedNode.children;
|
|
238
|
+
if (currentLevel) {
|
|
239
|
+
node.children?.forEach((child) => acceptTreeNode(treePath, inputsPath, currentLevel, child));
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
acceptTreeNode([], [], this.#rootsDictionary, tree);
|
|
243
|
+
}
|
|
244
|
+
accept(props) {
|
|
245
|
+
if ("path" in props) {
|
|
246
|
+
this.#acceptPath(props);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this.#acceptTree(props);
|
|
250
|
+
}
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
getTree() {
|
|
254
|
+
return Impl.#mapDictionaryToTree(this.#rootsDictionary);
|
|
255
|
+
}
|
|
256
|
+
})();
|
|
257
|
+
}
|
|
258
|
+
HierarchySearchTree.createBuilder = createBuilder;
|
|
259
|
+
/**
|
|
260
|
+
* Builds a list of `HierarchySearchTree` nodes from an iterable of search paths. Shared
|
|
261
|
+
* path prefixes are merged so that each unique hierarchy node identifier appears only once
|
|
262
|
+
* per level. The resulting trees carry `isTarget`, `options`, and `children` attributes
|
|
263
|
+
* derived from the paths and their options (`autoExpand`, `reveal`).
|
|
264
|
+
*
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
async function createFromPathsList(paths) {
|
|
268
|
+
return (0, rxjs_1.firstValueFrom)((0, rxjs_1.from)(paths).pipe((0, ReleaseMainThread_js_1.releaseMainThreadOnItemsCount)(1000), (0, rxjs_1.reduce)((builder, path) => builder.accept({ path }), createBuilder()), (0, rxjs_1.map)((builder) => builder.getTree())));
|
|
269
|
+
}
|
|
270
|
+
HierarchySearchTree.createFromPathsList = createFromPathsList;
|
|
271
|
+
/**
|
|
272
|
+
* Merges two `HierarchySearchTree` option objects. For the `autoExpand` attribute,
|
|
273
|
+
* `true` takes precedence over `{ groupingLevel }`, and when both sides are
|
|
274
|
+
* `{ groupingLevel }` objects the larger value wins.
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
function mergeOptions(lhs, rhs) {
|
|
278
|
+
if (!lhs) {
|
|
279
|
+
return rhs;
|
|
280
|
+
}
|
|
281
|
+
if (!rhs) {
|
|
282
|
+
return lhs;
|
|
283
|
+
}
|
|
284
|
+
const autoExpand = mergeSearchTreeAutoExpandOption(lhs.autoExpand, rhs.autoExpand);
|
|
285
|
+
const options = {
|
|
286
|
+
...(autoExpand ? { autoExpand } : undefined),
|
|
287
|
+
};
|
|
288
|
+
return Object.keys(options).length > 0 ? options : undefined;
|
|
289
|
+
}
|
|
290
|
+
HierarchySearchTree.mergeOptions = mergeOptions;
|
|
291
|
+
function mergeSearchTreeAutoExpandOption(lhs, rhs) {
|
|
292
|
+
if (!lhs) {
|
|
293
|
+
return rhs;
|
|
294
|
+
}
|
|
295
|
+
if (!rhs) {
|
|
296
|
+
return lhs;
|
|
297
|
+
}
|
|
298
|
+
return lhs === true || rhs === true ? true : { groupingLevel: Math.max(lhs.groupingLevel, rhs.groupingLevel) };
|
|
299
|
+
}
|
|
300
|
+
})(HierarchySearchTree || (exports.HierarchySearchTree = HierarchySearchTree = {}));
|
|
82
301
|
function extractSearchPropsInternal(rootLevelSearchProps, parentNode) {
|
|
83
302
|
if (!parentNode) {
|
|
84
303
|
return rootLevelSearchProps ? { childrenTargetPaths: rootLevelSearchProps, hasSearchTargetAncestor: false } : undefined;
|
|
@@ -99,41 +318,37 @@ function createHierarchySearchHelper(rootLevelSearchProps, parentNode) {
|
|
|
99
318
|
const searchProps = extractSearchPropsInternal(rootLevelSearchProps, parentNode);
|
|
100
319
|
const hasSearch = !!searchProps;
|
|
101
320
|
function saveSearchPropsFromPathsIntoReducer(extractionProps) {
|
|
102
|
-
// Passes down matching
|
|
103
|
-
// It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier`
|
|
321
|
+
// Passes down matching hierarchy search trees to the reducer.
|
|
322
|
+
// It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier` in the search tree item's identifier matches the node
|
|
104
323
|
// and if it does, the path is passed down to the reducer.
|
|
105
|
-
// This function returns a promise only if asyncPathMatcher returns a promise.
|
|
324
|
+
// This function returns a promise only if `asyncPathMatcher` returns a promise.
|
|
106
325
|
if (!searchProps?.childrenTargetPaths) {
|
|
107
326
|
return;
|
|
108
327
|
}
|
|
109
|
-
const
|
|
110
|
-
for (const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
(HierarchyNodeKey_js_1.HierarchyNodeKey.isInstances(extractionProps.nodeKey) &&
|
|
119
|
-
extractionProps.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik)))) {
|
|
120
|
-
extractionProps.pathsReducer.accept(normalizedPath);
|
|
328
|
+
const matchedTreePromises = new Array();
|
|
329
|
+
for (const childrenSearchTree of searchProps.childrenTargetPaths) {
|
|
330
|
+
if ("asyncPathMatcher" in extractionProps) {
|
|
331
|
+
const matchesPossiblyPromise = extractionProps.asyncPathMatcher(childrenSearchTree.identifier);
|
|
332
|
+
if (matchesPossiblyPromise instanceof Promise) {
|
|
333
|
+
matchedTreePromises.push(matchesPossiblyPromise.then((matches) => (matches ? childrenSearchTree : undefined)));
|
|
334
|
+
}
|
|
335
|
+
else if (matchesPossiblyPromise) {
|
|
336
|
+
extractionProps.pathsReducer.accept(childrenSearchTree);
|
|
121
337
|
}
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
const matchesPossiblyPromise = "pathMatcher" in extractionProps ? extractionProps.pathMatcher(normalizedPath.path[0]) : extractionProps.asyncPathMatcher(normalizedPath.path[0]);
|
|
125
|
-
if (matchesPossiblyPromise instanceof Promise) {
|
|
126
|
-
matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));
|
|
127
|
-
continue;
|
|
128
338
|
}
|
|
129
|
-
|
|
130
|
-
extractionProps
|
|
339
|
+
else {
|
|
340
|
+
const matches = "pathMatcher" in extractionProps
|
|
341
|
+
? extractionProps.pathMatcher(childrenSearchTree.identifier)
|
|
342
|
+
: nodeKeyMatchesIdentifier(extractionProps.nodeKey, childrenSearchTree.identifier);
|
|
343
|
+
if (matches) {
|
|
344
|
+
extractionProps.pathsReducer.accept(childrenSearchTree);
|
|
345
|
+
}
|
|
131
346
|
}
|
|
132
347
|
}
|
|
133
|
-
if (
|
|
348
|
+
if (matchedTreePromises.length === 0) {
|
|
134
349
|
return;
|
|
135
350
|
}
|
|
136
|
-
return Promise.all(
|
|
351
|
+
return Promise.all(matchedTreePromises).then((matchedTrees) => matchedTrees.forEach((matchedTree) => matchedTree && extractionProps.pathsReducer.accept(matchedTree)));
|
|
137
352
|
}
|
|
138
353
|
function createChildNodeProps(props) {
|
|
139
354
|
if (!hasSearch) {
|
|
@@ -141,15 +356,15 @@ function createHierarchySearchHelper(rootLevelSearchProps, parentNode) {
|
|
|
141
356
|
}
|
|
142
357
|
const reducer = new MatchingSearchPathsReducer(searchProps.hasSearchTargetAncestor);
|
|
143
358
|
if ("asyncPathMatcher" in props) {
|
|
144
|
-
const extractResult = saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, asyncPathMatcher: props.asyncPathMatcher });
|
|
359
|
+
const extractResult = saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, nodeKey: props.nodeKey, asyncPathMatcher: props.asyncPathMatcher });
|
|
145
360
|
if (extractResult instanceof Promise) {
|
|
146
|
-
return extractResult.then(() => reducer.
|
|
361
|
+
return extractResult.then(() => reducer.aggregatedOptions);
|
|
147
362
|
}
|
|
148
363
|
}
|
|
149
364
|
else {
|
|
150
|
-
saveSearchPropsFromPathsIntoReducer({
|
|
365
|
+
saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, ...props });
|
|
151
366
|
}
|
|
152
|
-
return reducer.
|
|
367
|
+
return reducer.aggregatedOptions;
|
|
153
368
|
}
|
|
154
369
|
return {
|
|
155
370
|
/** Returns a flag indicating if the hierarchy level is filtered. */
|
|
@@ -169,10 +384,7 @@ function createHierarchySearchHelper(rootLevelSearchProps, parentNode) {
|
|
|
169
384
|
if (!searchProps?.childrenTargetPaths) {
|
|
170
385
|
return undefined;
|
|
171
386
|
}
|
|
172
|
-
return searchProps.childrenTargetPaths
|
|
173
|
-
.map(HierarchySearchPath.normalize)
|
|
174
|
-
.filter(({ path }) => path.length > 0)
|
|
175
|
-
.map(({ path }) => path[0]);
|
|
387
|
+
return searchProps.childrenTargetPaths.map(({ identifier }) => identifier);
|
|
176
388
|
},
|
|
177
389
|
/**
|
|
178
390
|
* When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`
|
|
@@ -184,13 +396,16 @@ function createHierarchySearchHelper(rootLevelSearchProps, parentNode) {
|
|
|
184
396
|
* `nodeKey` prop can be used to check the whole identifier.
|
|
185
397
|
*
|
|
186
398
|
* There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:
|
|
187
|
-
* - `
|
|
188
|
-
* - `
|
|
189
|
-
* - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
|
|
399
|
+
* - `asyncPathMatcher` is provided - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a `Promise`.
|
|
400
|
+
* - `pathMatcher` or only `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;
|
|
190
401
|
*/
|
|
191
402
|
createChildNodeProps,
|
|
192
403
|
};
|
|
193
404
|
}
|
|
405
|
+
function nodeKeyMatchesIdentifier(nodeKey, identifier) {
|
|
406
|
+
return ((HierarchyNodeKey_js_1.HierarchyNodeKey.isGeneric(nodeKey) && HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(identifier, nodeKey)) ||
|
|
407
|
+
(HierarchyNodeKey_js_1.HierarchyNodeKey.isInstances(nodeKey) && nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(identifier, ik))));
|
|
408
|
+
}
|
|
194
409
|
/**
|
|
195
410
|
* Extracts information from search paths and later returns `search` and `autoExpand` values from `HierarchyNode`.
|
|
196
411
|
*
|
|
@@ -204,56 +419,33 @@ class MatchingSearchPathsReducer {
|
|
|
204
419
|
_hasSearchTargetAncestor;
|
|
205
420
|
_childrenTargetPaths = new Array();
|
|
206
421
|
_isSearchTarget = false;
|
|
207
|
-
|
|
208
|
-
_revealOption = false;
|
|
422
|
+
_options = undefined;
|
|
209
423
|
constructor(_hasSearchTargetAncestor) {
|
|
210
424
|
this._hasSearchTargetAncestor = _hasSearchTargetAncestor;
|
|
211
425
|
}
|
|
212
|
-
accept(
|
|
213
|
-
|
|
214
|
-
if (path.length === 1) {
|
|
426
|
+
accept(tree) {
|
|
427
|
+
if (tree.isTarget || tree.children === undefined) {
|
|
215
428
|
this._isSearchTarget = true;
|
|
216
|
-
this._searchTargetOptions = HierarchySearchPath.mergeOptions(this._searchTargetOptions, options);
|
|
217
429
|
}
|
|
218
|
-
|
|
219
|
-
this._childrenTargetPaths.push(
|
|
220
|
-
this._revealOption = HierarchySearchPathOptions.mergeRevealOptions(options?.reveal, this._revealOption);
|
|
430
|
+
if (tree.children && tree.children.length > 0) {
|
|
431
|
+
this._childrenTargetPaths.push(...tree.children);
|
|
221
432
|
}
|
|
433
|
+
this._options = HierarchySearchTree.mergeOptions(this._options, tree.options);
|
|
222
434
|
}
|
|
223
|
-
|
|
435
|
+
get aggregatedOptions() {
|
|
436
|
+
const search = this._hasSearchTargetAncestor || this._isSearchTarget || this._childrenTargetPaths.length > 0 || this._options
|
|
437
|
+
? {
|
|
438
|
+
...(this._hasSearchTargetAncestor ? { hasSearchTargetAncestor: true } : undefined),
|
|
439
|
+
...(this._isSearchTarget ? { isSearchTarget: true } : undefined),
|
|
440
|
+
...(this._childrenTargetPaths.length > 0 ? { childrenTargetPaths: this._childrenTargetPaths } : undefined),
|
|
441
|
+
...(this._options ? { options: this._options } : undefined),
|
|
442
|
+
}
|
|
443
|
+
: undefined;
|
|
444
|
+
const autoExpand = this._options?.autoExpand === true;
|
|
224
445
|
return {
|
|
225
|
-
...(
|
|
226
|
-
|
|
227
|
-
search: {
|
|
228
|
-
...(this._hasSearchTargetAncestor ? { hasSearchTargetAncestor: true } : undefined),
|
|
229
|
-
...(this._isSearchTarget ? { isSearchTarget: true, searchTargetOptions: this._searchTargetOptions } : undefined),
|
|
230
|
-
...(this._childrenTargetPaths.length > 0 ? { childrenTargetPaths: this._childrenTargetPaths } : undefined),
|
|
231
|
-
},
|
|
232
|
-
}
|
|
233
|
-
: undefined),
|
|
234
|
-
...(parentKeys &&
|
|
235
|
-
(shouldAutoExpandBasedOnReveal({
|
|
236
|
-
reveal: this._revealOption,
|
|
237
|
-
nodePositionInHierarchy: parentKeys.length,
|
|
238
|
-
nodePositionInPath: parentKeys.filter((key) => !HierarchyNodeKey_js_1.HierarchyNodeKey.isGrouping(key)).length,
|
|
239
|
-
}) ||
|
|
240
|
-
!!this._searchTargetOptions?.autoExpand)
|
|
241
|
-
? { autoExpand: true }
|
|
242
|
-
: undefined),
|
|
446
|
+
...(search ? { search } : undefined),
|
|
447
|
+
...(autoExpand ? { autoExpand } : undefined),
|
|
243
448
|
};
|
|
244
449
|
}
|
|
245
450
|
}
|
|
246
|
-
/** @internal */
|
|
247
|
-
function shouldAutoExpandBasedOnReveal({ reveal, nodePositionInPath, nodePositionInHierarchy, }) {
|
|
248
|
-
if (!reveal) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
if (reveal === true) {
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
if ("depthInHierarchy" in reveal) {
|
|
255
|
-
return nodePositionInHierarchy < reveal.depthInHierarchy;
|
|
256
|
-
}
|
|
257
|
-
return nodePositionInPath < reveal.depthInPath;
|
|
258
|
-
}
|
|
259
451
|
//# sourceMappingURL=HierarchySearch.js.map
|