@itwin/presentation-hierarchies 2.0.0-alpha.0 → 2.0.0-alpha.10

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +306 -7
  2. package/README.md +4 -22
  3. package/lib/cjs/hierarchies/HierarchyMerge.d.ts +19 -0
  4. package/lib/cjs/hierarchies/HierarchyMerge.d.ts.map +1 -0
  5. package/lib/cjs/hierarchies/HierarchyMerge.js +43 -0
  6. package/lib/cjs/hierarchies/HierarchyMerge.js.map +1 -0
  7. package/lib/cjs/hierarchies/HierarchyNode.d.ts +14 -24
  8. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  9. package/lib/cjs/hierarchies/HierarchyNode.js +1 -21
  10. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  11. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  12. package/lib/cjs/hierarchies/HierarchyNodeKey.js +8 -8
  13. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
  14. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +11 -29
  15. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  16. package/lib/cjs/hierarchies/HierarchyProvider.js +0 -37
  17. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  18. package/lib/cjs/hierarchies/HierarchySearch.d.ts +167 -0
  19. package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -0
  20. package/lib/cjs/hierarchies/HierarchySearch.js +259 -0
  21. package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -0
  22. package/lib/cjs/hierarchies/imodel/HierarchyCache.js +3 -3
  23. package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -1
  24. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +15 -4
  25. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  26. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  27. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +46 -11
  28. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  29. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +192 -72
  30. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  31. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +2 -2
  32. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  33. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +99 -40
  34. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  35. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts +35 -0
  36. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
  37. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js +285 -0
  38. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
  39. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts +5 -7
  40. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  41. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +15 -8
  42. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  43. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  44. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js +1 -0
  45. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  46. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
  47. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +6 -5
  48. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  49. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  50. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -3
  51. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  52. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  53. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +21 -16
  54. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  55. package/lib/cjs/hierarchies/internal/Common.d.ts +3 -0
  56. package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
  57. package/lib/cjs/hierarchies/internal/Common.js +12 -1
  58. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  59. package/lib/cjs/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
  60. package/lib/cjs/hierarchies/internal/EachValueFrom.js +1 -0
  61. package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
  62. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts +68 -0
  63. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -0
  64. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js +26 -0
  65. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -0
  66. package/lib/cjs/presentation-hierarchies.d.ts +5 -4
  67. package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
  68. package/lib/cjs/presentation-hierarchies.js +7 -7
  69. package/lib/cjs/presentation-hierarchies.js.map +1 -1
  70. package/lib/esm/hierarchies/HierarchyMerge.d.ts +19 -0
  71. package/lib/esm/hierarchies/HierarchyMerge.d.ts.map +1 -0
  72. package/lib/esm/hierarchies/HierarchyMerge.js +40 -0
  73. package/lib/esm/hierarchies/HierarchyMerge.js.map +1 -0
  74. package/lib/esm/hierarchies/HierarchyNode.d.ts +14 -24
  75. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  76. package/lib/esm/hierarchies/HierarchyNode.js +0 -20
  77. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  78. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  79. package/lib/esm/hierarchies/HierarchyNodeKey.js +9 -9
  80. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
  81. package/lib/esm/hierarchies/HierarchyProvider.d.ts +11 -29
  82. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  83. package/lib/esm/hierarchies/HierarchyProvider.js +1 -36
  84. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  85. package/lib/esm/hierarchies/HierarchySearch.d.ts +167 -0
  86. package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -0
  87. package/lib/esm/hierarchies/HierarchySearch.js +254 -0
  88. package/lib/esm/hierarchies/HierarchySearch.js.map +1 -0
  89. package/lib/esm/hierarchies/imodel/HierarchyCache.js +3 -3
  90. package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -1
  91. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +15 -4
  92. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  93. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  94. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +46 -11
  95. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  96. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +194 -75
  97. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  98. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts +2 -2
  99. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  100. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +100 -41
  101. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  102. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts +35 -0
  103. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
  104. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js +279 -0
  105. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
  106. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts +5 -7
  107. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  108. package/lib/esm/hierarchies/imodel/TreeNodesReader.js +13 -7
  109. package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  110. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  111. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js +1 -0
  112. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  113. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
  114. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +7 -6
  115. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  116. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  117. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js +5 -4
  118. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  119. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  120. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +22 -17
  121. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  122. package/lib/esm/hierarchies/internal/Common.d.ts +3 -0
  123. package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
  124. package/lib/esm/hierarchies/internal/Common.js +11 -1
  125. package/lib/esm/hierarchies/internal/Common.js.map +1 -1
  126. package/lib/esm/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
  127. package/lib/esm/hierarchies/internal/EachValueFrom.js +1 -0
  128. package/lib/esm/hierarchies/internal/EachValueFrom.js.map +1 -1
  129. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts +68 -0
  130. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -0
  131. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js +23 -0
  132. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -0
  133. package/lib/esm/presentation-hierarchies.d.ts +5 -4
  134. package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
  135. package/lib/esm/presentation-hierarchies.js +3 -3
  136. package/lib/esm/presentation-hierarchies.js.map +1 -1
  137. package/package.json +19 -19
  138. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +0 -110
  139. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +0 -1
  140. package/lib/cjs/hierarchies/HierarchyFiltering.js +0 -210
  141. package/lib/cjs/hierarchies/HierarchyFiltering.js.map +0 -1
  142. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +0 -34
  143. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
  144. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +0 -270
  145. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
  146. package/lib/esm/hierarchies/HierarchyFiltering.d.ts +0 -110
  147. package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +0 -1
  148. package/lib/esm/hierarchies/HierarchyFiltering.js +0 -205
  149. package/lib/esm/hierarchies/HierarchyFiltering.js.map +0 -1
  150. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +0 -34
  151. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
  152. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +0 -264
  153. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
@@ -0,0 +1,259 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.HierarchySearchPath = void 0;
8
+ exports.createHierarchySearchHelper = createHierarchySearchHelper;
9
+ exports.shouldAutoExpandBasedOnReveal = shouldAutoExpandBasedOnReveal;
10
+ const HierarchyNodeIdentifier_js_1 = require("./HierarchyNodeIdentifier.js");
11
+ const HierarchyNodeKey_js_1 = require("./HierarchyNodeKey.js");
12
+ var HierarchySearchPathOptions;
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 = {}));
42
+ /** @public */
43
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
44
+ var HierarchySearchPath;
45
+ (function (HierarchySearchPath) {
46
+ /**
47
+ * Normalizes the hierarchy search path to the object form.
48
+ * @public
49
+ */
50
+ function normalize(source) {
51
+ if (Array.isArray(source)) {
52
+ return { path: source };
53
+ }
54
+ return source;
55
+ }
56
+ HierarchySearchPath.normalize = normalize;
57
+ /**
58
+ * Merges two given `HierarchySearchPathOptions` objects.
59
+ *
60
+ * For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:
61
+ * - if any one of the inputs is `true`, return `true`,
62
+ * - else if only one of the inputs is an object, return it,
63
+ * - else if both inputs are falsy, return `false` or `undefined`,
64
+ * - else:
65
+ * - if only one of the inputs has `depthInHierarchy` set, return the other one,
66
+ * - else return the one with greater `depthInPath` or `depthInHierarchy`.
67
+ *
68
+ * @public
69
+ */
70
+ function mergeOptions(lhs, rhs) {
71
+ const reveal = HierarchySearchPathOptions.mergeRevealOptions(lhs?.reveal, rhs?.reveal);
72
+ const autoExpand = HierarchySearchPathOptions.mergeAutoExpandOption(lhs?.autoExpand, rhs?.autoExpand);
73
+ return reveal || autoExpand
74
+ ? {
75
+ ...(reveal !== undefined ? { reveal } : undefined),
76
+ ...(autoExpand !== undefined ? { autoExpand } : undefined),
77
+ }
78
+ : undefined;
79
+ }
80
+ HierarchySearchPath.mergeOptions = mergeOptions;
81
+ })(HierarchySearchPath || (exports.HierarchySearchPath = HierarchySearchPath = {}));
82
+ function extractSearchPropsInternal(rootLevelSearchProps, parentNode) {
83
+ if (!parentNode) {
84
+ return rootLevelSearchProps ? { childrenTargetPaths: rootLevelSearchProps, hasSearchTargetAncestor: false } : undefined;
85
+ }
86
+ const searchProps = {
87
+ ...(parentNode.search?.childrenTargetPaths ? { childrenTargetPaths: parentNode.search.childrenTargetPaths } : undefined),
88
+ hasSearchTargetAncestor: !!parentNode.search?.hasSearchTargetAncestor || !!parentNode.search?.isSearchTarget,
89
+ };
90
+ return searchProps.childrenTargetPaths || searchProps.hasSearchTargetAncestor ? searchProps : undefined;
91
+ }
92
+ /**
93
+ * Creates a set of utilities for making it easier to search the given hierarchy
94
+ * level.
95
+ *
96
+ * @public
97
+ */
98
+ function createHierarchySearchHelper(rootLevelSearchProps, parentNode) {
99
+ const searchProps = extractSearchPropsInternal(rootLevelSearchProps, parentNode);
100
+ const hasSearch = !!searchProps;
101
+ function saveSearchPropsFromPathsIntoReducer(extractionProps) {
102
+ // Passes down matching normalized paths to the reducer.
103
+ // It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier` at the first position in search path matches the node
104
+ // and if it does, the path is passed down to the reducer.
105
+ // This function returns a promise only if asyncPathMatcher returns a promise.
106
+ if (!searchProps?.childrenTargetPaths) {
107
+ return;
108
+ }
109
+ const matchedPathPromises = new Array();
110
+ for (const childrenTargetPaths of searchProps.childrenTargetPaths) {
111
+ const normalizedPath = HierarchySearchPath.normalize(childrenTargetPaths);
112
+ /* c8 ignore next 3 */
113
+ if (normalizedPath.path.length === 0) {
114
+ continue;
115
+ }
116
+ if ("nodeKey" in extractionProps) {
117
+ if ((HierarchyNodeKey_js_1.HierarchyNodeKey.isGeneric(extractionProps.nodeKey) && HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(normalizedPath.path[0], extractionProps.nodeKey)) ||
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);
121
+ }
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
+ }
129
+ if (matchesPossiblyPromise) {
130
+ extractionProps.pathsReducer.accept(normalizedPath);
131
+ }
132
+ }
133
+ if (matchedPathPromises.length === 0) {
134
+ return;
135
+ }
136
+ return Promise.all(matchedPathPromises).then((matchedPath) => matchedPath.forEach((normalizedPath) => normalizedPath && extractionProps.pathsReducer.accept(normalizedPath)));
137
+ }
138
+ function createChildNodeProps(props) {
139
+ if (!hasSearch) {
140
+ return undefined;
141
+ }
142
+ const reducer = new MatchingSearchPathsReducer(searchProps.hasSearchTargetAncestor);
143
+ if ("asyncPathMatcher" in props) {
144
+ const extractResult = saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, asyncPathMatcher: props.asyncPathMatcher });
145
+ if (extractResult instanceof Promise) {
146
+ return extractResult.then(() => reducer.getNodeProps(props.parentKeys));
147
+ }
148
+ }
149
+ else {
150
+ saveSearchPropsFromPathsIntoReducer({ ...props, pathsReducer: reducer });
151
+ }
152
+ return reducer.getNodeProps(props.parentKeys);
153
+ }
154
+ return {
155
+ /** Returns a flag indicating if the hierarchy level is filtered. */
156
+ hasSearch,
157
+ /**
158
+ * Returns a flag indicating whether this hierarchy level has an ancestor node
159
+ * that is a search target. That generally means that this and all downstream hierarchy
160
+ * levels should be displayed without search being applied to them, even if search paths
161
+ * say otherwise.
162
+ */
163
+ hasSearchTargetAncestor: searchProps?.hasSearchTargetAncestor ?? false,
164
+ /**
165
+ * Returns a list of hierarchy node identifiers that apply specifically for this
166
+ * hierarchy level. Returns `undefined` if search is not applied to this level.
167
+ */
168
+ getChildNodeSearchIdentifiers: () => {
169
+ if (!searchProps?.childrenTargetPaths) {
170
+ return undefined;
171
+ }
172
+ return searchProps.childrenTargetPaths
173
+ .map(HierarchySearchPath.normalize)
174
+ .filter(({ path }) => path.length > 0)
175
+ .map(({ path }) => path[0]);
176
+ },
177
+ /**
178
+ * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`
179
+ * and `autoExpand`) to be set based on the search paths and search options. This function calculates
180
+ * these props for a child node based on its key or path matcher.
181
+ *
182
+ * When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
183
+ * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the
184
+ * `nodeKey` prop can be used to check the whole identifier.
185
+ *
186
+ * There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:
187
+ * - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;
188
+ * - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;
189
+ * - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
190
+ */
191
+ createChildNodeProps,
192
+ };
193
+ }
194
+ /**
195
+ * Extracts information from search paths and later returns `search` and `autoExpand` values from `HierarchyNode`.
196
+ *
197
+ * Saved values can be applied to a single `HierarchyNode` - this means that a new reducer should be created every time these props are requested for a `HierarchyNode`.
198
+ *
199
+ * Extracts information using `accept` function:
200
+ * - Determines if node is search target, and if it is saves the options as `searchTargetOptions`
201
+ * - Saves `HierarchySearchPathOptions` and `childrenTargetPaths`
202
+ */
203
+ class MatchingSearchPathsReducer {
204
+ _hasSearchTargetAncestor;
205
+ _childrenTargetPaths = new Array();
206
+ _isSearchTarget = false;
207
+ _searchTargetOptions = undefined;
208
+ _revealOption = false;
209
+ constructor(_hasSearchTargetAncestor) {
210
+ this._hasSearchTargetAncestor = _hasSearchTargetAncestor;
211
+ }
212
+ accept(normalizedPath) {
213
+ const { path, options } = normalizedPath;
214
+ if (path.length === 1) {
215
+ this._isSearchTarget = true;
216
+ this._searchTargetOptions = HierarchySearchPath.mergeOptions(this._searchTargetOptions, options);
217
+ }
218
+ else if (path.length > 1) {
219
+ this._childrenTargetPaths.push({ path: path.slice(1), options });
220
+ this._revealOption = HierarchySearchPathOptions.mergeRevealOptions(options?.reveal, this._revealOption);
221
+ }
222
+ }
223
+ getNodeProps(parentKeys) {
224
+ return {
225
+ ...(this._hasSearchTargetAncestor || this._isSearchTarget || this._childrenTargetPaths.length > 0
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),
243
+ };
244
+ }
245
+ }
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
+ //# sourceMappingURL=HierarchySearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HierarchySearch.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA0LhG,kEAyKC;AA2DD,sEAmBC;AA9aD,6EAAqG;AACrG,+DAA2F;AAsE3F,IAAU,0BAA0B,CAmCnC;AAnCD,WAAU,0BAA0B;IAClC,SAAgB,kBAAkB,CAChC,GAAyC,EACzC,GAAyC;QAEzC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,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C","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport interface SearchPathRevealDepthInPath {\n /**\n * Index of the node in search path should be revealed in hierarchy by auto-expanding its ancestors.\n *\n * Use when you want to expand up to specific instance node and don't care about grouping nodes.\n *\n * **Use case example:**\n *\n * All nodes up to `Element1` should be expanded in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n *\n * Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`\n *\n * **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.\n */\n depthInPath: number;\n}\n\n/** @public */\nexport interface SearchPathRevealDepthInHierarchy {\n /**\n * Considering the list of nodes from root to the target node, this is an index in that list, identifying the node that should be revealed in hierarchy by auto-expanding its ancestors.\n *\n * This should take into account the number of grouping nodes in hierarchy.\n *\n * **Use case example:**\n *\n * Only `Node1` and `GroupingNode1` should have `autoExpand` flag in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n *\n * Provide `{ path: [Node1, Element1], reveal: { depthInHierarchy: 2 } }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n *\n * **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** search targets.\n */\n depthInHierarchy: number;\n}\n\n/** @public */\nexport interface HierarchySearchPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the searched hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the search target will have `autoExpand` flag.\n * - If it's an instance of `SearchPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.\n * - If it's an instance of `SearchPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.\n */\n reveal?: boolean | SearchPathRevealDepthInHierarchy | SearchPathRevealDepthInPath;\n /**\n * This option specifies whether or not search target should be expanded.\n * - If it's `false` or `undefined`, search target won't have 'autoExpand' flag.\n * - If it's `true`, search target will have `autoExpand` flag.\n *\n * **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.\n */\n autoExpand?: boolean;\n}\n\nnamespace HierarchySearchPathOptions {\n export function mergeRevealOptions(\n lhs: HierarchySearchPathOptions[\"reveal\"],\n rhs: HierarchySearchPathOptions[\"reveal\"],\n ): HierarchySearchPathOptions[\"reveal\"] {\n if (rhs === true || lhs === true) {\n return true;\n }\n if (!rhs || !lhs) {\n return !!rhs ? rhs : lhs;\n }\n\n const lhsDepth = \"depthInPath\" in lhs ? lhs.depthInPath : lhs.depthInHierarchy;\n const rhsDepth = \"depthInPath\" in rhs ? rhs.depthInPath : rhs.depthInHierarchy;\n const isLhsDepthBasedOnPath = \"depthInPath\" in lhs;\n const isRhsDepthBasedOnPath = \"depthInPath\" in rhs;\n\n if (isLhsDepthBasedOnPath) {\n if (isRhsDepthBasedOnPath) {\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n return lhs;\n }\n if (isRhsDepthBasedOnPath) {\n return rhs;\n }\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n\n export function mergeAutoExpandOption(\n lhs: HierarchySearchPathOptions[\"autoExpand\"],\n rhs: HierarchySearchPathOptions[\"autoExpand\"],\n ): HierarchySearchPathOptions[\"autoExpand\"] {\n return lhs || rhs ? true : undefined;\n }\n}\n\n/**\n * A path of hierarchy node identifiers for search the hierarchy with additional options.\n * @public\n */\nexport type HierarchySearchPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options?: HierarchySearchPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchySearchPath {\n /**\n * Normalizes the hierarchy search path to the object form.\n * @public\n */\n export function normalize(source: HierarchySearchPath): Exclude<HierarchySearchPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchySearchPathOptions` objects.\n *\n * For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if only one of the inputs is an object, return it,\n * - else if both inputs are falsy, return `false` or `undefined`,\n * - else:\n * - if only one of the inputs has `depthInHierarchy` set, return the other one,\n * - else return the one with greater `depthInPath` or `depthInHierarchy`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchySearchPathOptions | undefined,\n rhs: HierarchySearchPathOptions | undefined,\n ): HierarchySearchPathOptions | undefined {\n const reveal = HierarchySearchPathOptions.mergeRevealOptions(lhs?.reveal, rhs?.reveal);\n const autoExpand = HierarchySearchPathOptions.mergeAutoExpandOption(lhs?.autoExpand, rhs?.autoExpand);\n return reveal || autoExpand\n ? {\n ...(reveal !== undefined ? { reveal } : undefined),\n ...(autoExpand !== undefined ? { autoExpand } : undefined),\n }\n : undefined;\n }\n}\n\nfunction extractSearchPropsInternal(\n rootLevelSearchProps: HierarchySearchPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"search\"> | undefined,\n):\n | {\n childrenTargetPaths?: HierarchySearchPath[];\n hasSearchTargetAncestor: boolean;\n }\n | undefined {\n if (!parentNode) {\n return rootLevelSearchProps ? { childrenTargetPaths: rootLevelSearchProps, hasSearchTargetAncestor: false } : undefined;\n }\n const searchProps: {\n childrenTargetPaths?: HierarchySearchPath[];\n hasSearchTargetAncestor: boolean;\n } = {\n ...(parentNode.search?.childrenTargetPaths ? { childrenTargetPaths: parentNode.search.childrenTargetPaths } : undefined),\n hasSearchTargetAncestor: !!parentNode.search?.hasSearchTargetAncestor || !!parentNode.search?.isSearchTarget,\n };\n return searchProps.childrenTargetPaths || searchProps.hasSearchTargetAncestor ? searchProps : undefined;\n}\n\n/**\n * Creates a set of utilities for making it easier to search the given hierarchy\n * level.\n *\n * @public\n */\nexport function createHierarchySearchHelper(\n rootLevelSearchProps: HierarchySearchPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"search\"> | undefined,\n) {\n const searchProps = extractSearchPropsInternal(rootLevelSearchProps, parentNode);\n const hasSearch = !!searchProps;\n\n function saveSearchPropsFromPathsIntoReducer(\n extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n } & (\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean }\n ),\n ): void;\n function saveSearchPropsFromPathsIntoReducer(extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): void | Promise<void>;\n function saveSearchPropsFromPathsIntoReducer(\n extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n } & (\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean }\n | { asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean> }\n ),\n ): void | Promise<void> {\n // Passes down matching normalized paths to the reducer.\n // It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier` at the first position in search path matches the node\n // and if it does, the path is passed down to the reducer.\n // This function returns a promise only if asyncPathMatcher returns a promise.\n if (!searchProps?.childrenTargetPaths) {\n return;\n }\n const matchedPathPromises = new Array<Promise<NormalizedSearchPath | undefined>>();\n for (const childrenTargetPaths of searchProps.childrenTargetPaths) {\n const normalizedPath = HierarchySearchPath.normalize(childrenTargetPaths);\n /* c8 ignore next 3 */\n if (normalizedPath.path.length === 0) {\n continue;\n }\n if (\"nodeKey\" in extractionProps) {\n if (\n (HierarchyNodeKey.isGeneric(extractionProps.nodeKey) && HierarchyNodeIdentifier.equal(normalizedPath.path[0], extractionProps.nodeKey)) ||\n (HierarchyNodeKey.isInstances(extractionProps.nodeKey) &&\n extractionProps.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik)))\n ) {\n extractionProps.pathsReducer.accept(normalizedPath);\n }\n continue;\n }\n\n const matchesPossiblyPromise =\n \"pathMatcher\" in extractionProps ? extractionProps.pathMatcher(normalizedPath.path[0]) : extractionProps.asyncPathMatcher(normalizedPath.path[0]);\n if (matchesPossiblyPromise instanceof Promise) {\n matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));\n continue;\n }\n if (matchesPossiblyPromise) {\n extractionProps.pathsReducer.accept(normalizedPath);\n }\n }\n if (matchedPathPromises.length === 0) {\n return;\n }\n return Promise.all(matchedPathPromises).then((matchedPath) =>\n matchedPath.forEach((normalizedPath) => normalizedPath && extractionProps.pathsReducer.accept(normalizedPath)),\n );\n }\n\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }): Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }): Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<NonGroupingHierarchyNode, \"search\"> | undefined> | Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }): Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }): Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined> | Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(\n props: { parentKeys?: HierarchyNodeKey[] } & (\n | {\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }\n | {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n ),\n ):\n | Promise<Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | Pick<NonGroupingHierarchyNode, \"search\"> | undefined>\n | Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\">\n | Pick<NonGroupingHierarchyNode, \"search\">\n | undefined {\n if (!hasSearch) {\n return undefined;\n }\n const reducer = new MatchingSearchPathsReducer(searchProps.hasSearchTargetAncestor);\n if (\"asyncPathMatcher\" in props) {\n const extractResult = saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, asyncPathMatcher: props.asyncPathMatcher });\n if (extractResult instanceof Promise) {\n return extractResult.then(() => reducer.getNodeProps(props.parentKeys));\n }\n } else {\n saveSearchPropsFromPathsIntoReducer({ ...props, pathsReducer: reducer });\n }\n return reducer.getNodeProps(props.parentKeys);\n }\n return {\n /** Returns a flag indicating if the hierarchy level is filtered. */\n hasSearch,\n /**\n * Returns a flag indicating whether this hierarchy level has an ancestor node\n * that is a search target. That generally means that this and all downstream hierarchy\n * levels should be displayed without search being applied to them, even if search paths\n * say otherwise.\n */\n hasSearchTargetAncestor: searchProps?.hasSearchTargetAncestor ?? false,\n /**\n * Returns a list of hierarchy node identifiers that apply specifically for this\n * hierarchy level. Returns `undefined` if search is not applied to this level.\n */\n getChildNodeSearchIdentifiers: () => {\n if (!searchProps?.childrenTargetPaths) {\n return undefined;\n }\n return searchProps.childrenTargetPaths\n .map(HierarchySearchPath.normalize)\n .filter(({ path }) => path.length > 0)\n .map(({ path }) => path[0]);\n },\n /**\n * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`\n * and `autoExpand`) to be set based on the search paths and search options. This function calculates\n * these props for a child node based on its key or path matcher.\n *\n * When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies\n * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the\n * `nodeKey` prop can be used to check the whole identifier.\n *\n * There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:\n * - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;\n * - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;\n * - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.\n */\n createChildNodeProps,\n };\n}\n\ntype NormalizedSearchPath = ReturnType<(typeof HierarchySearchPath)[\"normalize\"]>;\n\n/**\n * Extracts information from search paths and later returns `search` and `autoExpand` values from `HierarchyNode`.\n *\n * Saved values can be applied to a single `HierarchyNode` - this means that a new reducer should be created every time these props are requested for a `HierarchyNode`.\n *\n * Extracts information using `accept` function:\n * - Determines if node is search target, and if it is saves the options as `searchTargetOptions`\n * - Saves `HierarchySearchPathOptions` and `childrenTargetPaths`\n */\nclass MatchingSearchPathsReducer {\n private _childrenTargetPaths = new Array<NormalizedSearchPath>();\n private _isSearchTarget = false;\n private _searchTargetOptions: HierarchySearchPathOptions | undefined = undefined;\n private _revealOption: HierarchySearchPathOptions[\"reveal\"] = false;\n\n public constructor(private _hasSearchTargetAncestor: boolean) {}\n\n public accept(normalizedPath: NormalizedSearchPath): void {\n const { path, options } = normalizedPath;\n if (path.length === 1) {\n this._isSearchTarget = true;\n this._searchTargetOptions = HierarchySearchPath.mergeOptions(this._searchTargetOptions, options);\n } else if (path.length > 1) {\n this._childrenTargetPaths.push({ path: path.slice(1), options });\n this._revealOption = HierarchySearchPathOptions.mergeRevealOptions(options?.reveal, this._revealOption);\n }\n }\n\n public getNodeProps<T extends HierarchyNodeKey[] | undefined = undefined>(\n parentKeys?: T,\n ): T extends undefined ? Pick<NonGroupingHierarchyNode, \"search\"> : Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> {\n return {\n ...(this._hasSearchTargetAncestor || this._isSearchTarget || this._childrenTargetPaths.length > 0\n ? {\n search: {\n ...(this._hasSearchTargetAncestor ? { hasSearchTargetAncestor: true } : undefined),\n ...(this._isSearchTarget ? { isSearchTarget: true, searchTargetOptions: this._searchTargetOptions } : undefined),\n ...(this._childrenTargetPaths.length > 0 ? { childrenTargetPaths: this._childrenTargetPaths } : undefined),\n },\n }\n : undefined),\n ...(parentKeys &&\n (shouldAutoExpandBasedOnReveal({\n reveal: this._revealOption,\n nodePositionInHierarchy: parentKeys.length,\n nodePositionInPath: parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length,\n }) ||\n !!this._searchTargetOptions?.autoExpand)\n ? { autoExpand: true }\n : undefined),\n };\n }\n}\n\n/** @internal */\nexport function shouldAutoExpandBasedOnReveal({\n reveal,\n nodePositionInPath,\n nodePositionInHierarchy,\n}: {\n reveal: HierarchySearchPathOptions[\"reveal\"];\n nodePositionInPath: number;\n nodePositionInHierarchy: number;\n}): boolean {\n if (!reveal) {\n return false;\n }\n if (reveal === true) {\n return true;\n }\n if (\"depthInHierarchy\" in reveal) {\n return nodePositionInHierarchy < reveal.depthInHierarchy;\n }\n return nodePositionInPath < reveal.depthInPath;\n}\n"]}
@@ -17,11 +17,11 @@ class HierarchyCache {
17
17
  }
18
18
  createCacheKeys(props) {
19
19
  function createVariationKey() {
20
- const { instanceFilter, hierarchyLevelSizeLimit, filteredInstanceKeys } = props;
21
- if (instanceFilter === undefined && hierarchyLevelSizeLimit === undefined && filteredInstanceKeys === undefined) {
20
+ const { instanceFilter, hierarchyLevelSizeLimit, targetInstanceKeys } = props;
21
+ if (instanceFilter === undefined && hierarchyLevelSizeLimit === undefined && targetInstanceKeys === undefined) {
22
22
  return undefined;
23
23
  }
24
- return JSON.stringify({ instanceFilter, hierarchyLevelSizeLimit, filteredInstanceKeys });
24
+ return JSON.stringify({ instanceFilter, hierarchyLevelSizeLimit, targetInstanceKeys });
25
25
  }
26
26
  if (!props.parentNode) {
27
27
  return { primaryKey: [], variationKey: createVariationKey() };
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyCache.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/HierarchyCache.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAsE;AAEtE,gEAA0D;AAe1D,gBAAgB;AAChB,MAAa,cAAc;IACjB,IAAI,CAA4D;IAChE,MAAM,CAAiC;IAE/C,YAAmB,KAAqC;QACtD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,4BAAa,CAA6C,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;IAClH,CAAC;IAEO,eAAe,CACrB,KAGC;QAED,SAAS,kBAAkB;YACzB,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;YAChF,IAAI,cAAc,KAAK,SAAS,IAAI,uBAAuB,KAAK,SAAS,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;gBAChH,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC3F,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,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AC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;IAEM,GAAG,CAAC,YAAoC,EAAE,KAAQ;QACvD,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACxE,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;IAEM,GAAG,CAAC,YAAoC;QAC7C,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC;IAChE,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF;AAzED,wCAyEC;AAED,SAAS,wBAAwB,CAAC,GAAuB,EAAE,GAAuB;IAChF,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACjC,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACpC,MAAM,iBAAiB,GAAG,sCAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,iBAAiB,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { LRUCache, LRUDictionary, LRUMap } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey.js\";\nimport { GetHierarchyNodesProps } from \"../HierarchyProvider.js\";\n\ninterface HierarchyCacheEntry<T> {\n /** Stores observables for the default case - no instance filter or custom limit for the hierarchy level. */\n primary: T | undefined;\n /** Stores a limited number of variations with custom instance filter and/or custom limit for the hierarchy level. */\n variations: LRUCache<string, T>;\n}\n\ninterface ChildNodeObservablesCacheProps {\n size: number;\n variationsCount?: number;\n}\n\n/** @internal */\nexport class HierarchyCache<T> {\n private _map: LRUDictionary<HierarchyNodeKey[], HierarchyCacheEntry<T>>;\n private _props: ChildNodeObservablesCacheProps;\n\n public constructor(props: ChildNodeObservablesCacheProps) {\n this._props = props;\n this._map = new LRUDictionary<HierarchyNodeKey[], HierarchyCacheEntry<T>>(props.size, compareHierarchyNodeKeys);\n }\n\n private createCacheKeys(\n props: Omit<GetHierarchyNodesProps, \"parentNode\"> & {\n parentNode: { key: HierarchyNodeKey; parentKeys: HierarchyNodeKey[] } | undefined;\n filteredInstanceKeys?: InstanceKey[];\n },\n ) {\n function createVariationKey() {\n const { instanceFilter, hierarchyLevelSizeLimit, filteredInstanceKeys } = props;\n if (instanceFilter === undefined && hierarchyLevelSizeLimit === undefined && filteredInstanceKeys === undefined) {\n return undefined;\n }\n return JSON.stringify({ instanceFilter, hierarchyLevelSizeLimit, filteredInstanceKeys });\n }\n\n if (!props.parentNode) {\n return { primaryKey: [], variationKey: createVariationKey() };\n }\n\n const parentKeys = props.parentNode.parentKeys;\n\n return {\n primaryKey: [...parentKeys, props.parentNode.key],\n variationKey: createVariationKey(),\n };\n }\n\n private getCacheAccessors(primaryKey: HierarchyNodeKey[], variationKey?: string) {\n const getMapEntry = (create: boolean) => {\n let entry = this._map.get(primaryKey);\n if (!entry && create) {\n entry = { primary: undefined, variations: new LRUMap(this._props.variationsCount ?? 1) };\n this._map.set(primaryKey, entry);\n }\n return entry;\n };\n if (variationKey) {\n return {\n get: () => getMapEntry(false)?.variations.get(variationKey),\n set: (value: T) => {\n getMapEntry(true)!.variations.set(variationKey, value);\n },\n };\n }\n return {\n get: () => getMapEntry(false)?.primary,\n set: (value: T) => {\n getMapEntry(true)!.primary = value;\n },\n };\n }\n\n public set(requestProps: GetHierarchyNodesProps, value: T) {\n const { primaryKey, variationKey } = this.createCacheKeys(requestProps);\n this.getCacheAccessors(primaryKey, variationKey).set(value);\n }\n\n public get(requestProps: GetHierarchyNodesProps): T | undefined {\n const { primaryKey, variationKey } = this.createCacheKeys(requestProps);\n return this.getCacheAccessors(primaryKey, variationKey).get();\n }\n\n public clear() {\n this._map.clear();\n }\n}\n\nfunction compareHierarchyNodeKeys(lhs: HierarchyNodeKey[], rhs: HierarchyNodeKey[]) {\n if (lhs.length !== rhs.length) {\n return lhs.length - rhs.length;\n }\n for (let i = 0; i < lhs.length; ++i) {\n const keysCompareResult = HierarchyNodeKey.compare(lhs[i], rhs[i]);\n if (keysCompareResult !== 0) {\n return keysCompareResult;\n }\n }\n return 0;\n}\n"]}
1
+ {"version":3,"file":"HierarchyCache.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/HierarchyCache.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAsE;AAEtE,gEAA0D;AAe1D,gBAAgB;AAChB,MAAa,cAAc;IACjB,IAAI,CAA4D;IAChE,MAAM,CAAiC;IAE/C,YAAmB,KAAqC;QACtD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,4BAAa,CAA6C,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;IAClH,CAAC;IAEO,eAAe,CACrB,KAGC;QAED,SAAS,kBAAkB;YACzB,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;YAC9E,IAAI,cAA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AAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,iBAAiB,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { LRUCache, LRUDictionary, LRUMap } from \"@itwin/core-bentley\";\nimport { InstanceKey } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey.js\";\nimport { GetHierarchyNodesProps } from \"../HierarchyProvider.js\";\n\ninterface HierarchyCacheEntry<T> {\n /** Stores observables for the default case - no instance filter or custom limit for the hierarchy level. */\n primary: T | undefined;\n /** Stores a limited number of variations with custom instance filter and/or custom limit for the hierarchy level. */\n variations: LRUCache<string, T>;\n}\n\ninterface ChildNodeObservablesCacheProps {\n size: number;\n variationsCount?: number;\n}\n\n/** @internal */\nexport class HierarchyCache<T> {\n private _map: LRUDictionary<HierarchyNodeKey[], HierarchyCacheEntry<T>>;\n private _props: ChildNodeObservablesCacheProps;\n\n public constructor(props: ChildNodeObservablesCacheProps) {\n this._props = props;\n this._map = new LRUDictionary<HierarchyNodeKey[], HierarchyCacheEntry<T>>(props.size, compareHierarchyNodeKeys);\n }\n\n private createCacheKeys(\n props: Omit<GetHierarchyNodesProps, \"parentNode\"> & {\n parentNode: { key: HierarchyNodeKey; parentKeys: HierarchyNodeKey[] } | undefined;\n targetInstanceKeys?: InstanceKey[];\n },\n ) {\n function createVariationKey() {\n const { instanceFilter, hierarchyLevelSizeLimit, targetInstanceKeys } = props;\n if (instanceFilter === undefined && hierarchyLevelSizeLimit === undefined && targetInstanceKeys === undefined) {\n return undefined;\n }\n return JSON.stringify({ instanceFilter, hierarchyLevelSizeLimit, targetInstanceKeys });\n }\n\n if (!props.parentNode) {\n return { primaryKey: [], variationKey: createVariationKey() };\n }\n\n const parentKeys = props.parentNode.parentKeys;\n\n return {\n primaryKey: [...parentKeys, props.parentNode.key],\n variationKey: createVariationKey(),\n };\n }\n\n private getCacheAccessors(primaryKey: HierarchyNodeKey[], variationKey?: string) {\n const getMapEntry = (create: boolean) => {\n let entry = this._map.get(primaryKey);\n if (!entry && create) {\n entry = { primary: undefined, variations: new LRUMap(this._props.variationsCount ?? 1) };\n this._map.set(primaryKey, entry);\n }\n return entry;\n };\n if (variationKey) {\n return {\n get: () => getMapEntry(false)?.variations.get(variationKey),\n set: (value: T) => {\n getMapEntry(true)!.variations.set(variationKey, value);\n },\n };\n }\n return {\n get: () => getMapEntry(false)?.primary,\n set: (value: T) => {\n getMapEntry(true)!.primary = value;\n },\n };\n }\n\n public set(requestProps: GetHierarchyNodesProps, value: T) {\n const { primaryKey, variationKey } = this.createCacheKeys(requestProps);\n this.getCacheAccessors(primaryKey, variationKey).set(value);\n }\n\n public get(requestProps: GetHierarchyNodesProps): T | undefined {\n const { primaryKey, variationKey } = this.createCacheKeys(requestProps);\n return this.getCacheAccessors(primaryKey, variationKey).get();\n }\n\n public clear() {\n this._map.clear();\n }\n}\n\nfunction compareHierarchyNodeKeys(lhs: HierarchyNodeKey[], rhs: HierarchyNodeKey[]) {\n if (lhs.length !== rhs.length) {\n return lhs.length - rhs.length;\n }\n for (let i = 0; i < lhs.length; ++i) {\n const keysCompareResult = HierarchyNodeKey.compare(lhs[i], rhs[i]);\n if (keysCompareResult !== 0) {\n return keysCompareResult;\n }\n }\n return 0;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { GenericInstanceFilter } from "@itwin/core-common";
2
- import { ECSqlQueryDef } from "@itwin/presentation-shared";
2
+ import { ECClassHierarchyInspector, ECSchemaProvider, ECSqlQueryDef } from "@itwin/presentation-shared";
3
3
  import { NonGroupingHierarchyNode } from "../HierarchyNode.js";
4
4
  import { ProcessedGenericHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode, SourceGenericHierarchyNode, SourceInstanceHierarchyNode } from "./IModelHierarchyNode.js";
5
5
  /**
@@ -46,9 +46,16 @@ export type HierarchyLevelDefinition = HierarchyNodesDefinition[];
46
46
  * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.
47
47
  * @public
48
48
  */
49
- export type NodeParser = (row: {
50
- [columnName: string]: any;
51
- }, parentNode?: HierarchyDefinitionParentNode) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;
49
+ export type NodeParser = (props: {
50
+ /** The ECSQL row object to parse. Keys & value types depend on the executed query. */
51
+ row: {
52
+ [columnName: string]: any;
53
+ };
54
+ /** The parent node whose child node is being parsed. */
55
+ parentNode?: HierarchyDefinitionParentNode;
56
+ /** The key of iModel which is used to run the query. */
57
+ imodelKey: string;
58
+ }) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;
52
59
  /**
53
60
  * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,
54
61
  * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node
@@ -77,6 +84,10 @@ export type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, "chil
77
84
  * @public
78
85
  */
79
86
  export interface DefineHierarchyLevelProps {
87
+ /** The iModel for which the hierarchy definition is being requested for. */
88
+ imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & {
89
+ imodelKey: string;
90
+ };
80
91
  /** Parent node to get children for. Pass `undefined` to get root nodes. */
81
92
  parentNode: HierarchyDefinitionParentNode | undefined;
82
93
  /** Optional hierarchy level filter. */
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MA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AAC;AAElG;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,UAAU,EAAE,6BAA6B,GAAG,SAAS,CAAC;IAEtD,uCAAuC;IACvC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IAEvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC,+EAA+E;IAC/E,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3F"}
1
+ {"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAElC;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,oDAAoD;IACpD,IAAI,EAAE,0BAA0B,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,aAAa,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM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vC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IAEvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC,+EAA+E;IAC/E,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6ChG,cAAc;AACd,2DAA2D;AAC3D,IAAiB,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,sCAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,6CAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,wCAAxB,wBAAwB,QAOxC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { ECSqlQueryDef } from \"@itwin/presentation-shared\";\nimport { NonGroupingHierarchyNode } from \"../HierarchyNode.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\n */\nexport interface GenericHierarchyNodeDefinition {\n /** The node to be created in the hierarchy level */\n node: SourceGenericHierarchyNode;\n}\n\n/**\n * A nodes definition that returns an ECSQL query for selecting nodes from an iModel.\n * @public\n */\nexport interface InstanceNodesQueryDefinition {\n /**\n * Full name of the class whose instances are going to be returned. It's okay if the attribute\n * points to a base class of multiple different classes of instances returned by the query, however\n * the more specific this class is, the more efficient hierarchy building process is.\n */\n fullClassName: string;\n /**\n * An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected\n * to be built using `NodeSelectQueryFactory.createSelectClause`.\n */\n query: ECSqlQueryDef;\n}\n\n/**\n * A definition of nodes included in a hierarchy level.\n * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodesDefinition {\n export function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition {\n return !!(def as GenericHierarchyNodeDefinition).node;\n }\n export function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition {\n return !!(def as InstanceNodesQueryDefinition).query;\n }\n}\n\n/**\n * A definition of a hierarchy level, which may consist of multiple node definitions.\n * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (\n row: { [columnName: string]: any },\n parentNode?: HierarchyDefinitionParentNode,\n) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;\n\n/**\n * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node\n * from the hierarchy.\n *\n * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(node: TNode) => Promise<TNode | undefined>;\n\n/**\n * A type for a function that post-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one.\n *\n * @public\n */\nexport type NodePostProcessor = (node: ProcessedHierarchyNode) => Promise<ProcessedHierarchyNode>;\n\n/**\n * A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means\n * a `HierarchyNode` that:\n * - knows nothing about its children,\n * - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).\n * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\n */\nexport interface DefineHierarchyLevelProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: HierarchyDefinitionParentNode | undefined;\n\n /** Optional hierarchy level filter. */\n instanceFilter?: GenericInstanceFilter;\n}\n\n/**\n * An interface for a factory that knows how define a hierarchy based on a given parent node.\n * @public\n */\nexport interface HierarchyDefinition {\n /**\n * An optional function for parsing ECInstance node from ECSQL row.\n *\n * Should be used in situations when the `HierarchyDefinition` implementation\n * introduces additional ECSQL columns into the select clause and wants to assign additional\n * data to the nodes it produces.\n *\n * Defaults to a function that parses all `HierarchyNode` attributes from a query, whose SELECT\n * clause is created using `NodeSelectQueryFactory.createSelectClause`.\n */\n parseNode?: NodeParser;\n\n /**\n * An optional function for pre-processing nodes.\n *\n * Pre-processing happens immediately after the nodes are loaded based on `HierarchyLevelDefinition`\n * returned by this `HierarchyDefinition` and before their processing (hiding, grouping, sorting, etc.) starts.\n * The step allows assigning nodes additional data or excluding them from the hierarchy based on some attributes.\n */\n preProcessNode?: NodePreProcessor;\n\n /**\n * An optional function for post-processing nodes.\n *\n * Post-processing happens after the loaded nodes go through all the merging, hiding and grouping\n * steps, but before sorting them. This step allows `HierarchyDefinition` implementations to assign additional data\n * to nodes after they're processed. This is especially true for grouping nodes as they're only created during\n * processing.\n */\n postProcessNode?: NodePostProcessor;\n\n /** A function to create a hierarchy level definition for given parent node. */\n defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;\n}\n"]}
1
+ {"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6ChG,cAAc;AACd,2DAA2D;AAC3D,IAAiB,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,sCAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,6CAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,wCAAxB,wBAAwB,QAOxC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, ECSqlQueryDef } from \"@itwin/presentation-shared\";\nimport { NonGroupingHierarchyNode } from \"../HierarchyNode.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\n */\nexport interface GenericHierarchyNodeDefinition {\n /** The node to be created in the hierarchy level */\n node: SourceGenericHierarchyNode;\n}\n\n/**\n * A nodes definition that returns an ECSQL query for selecting nodes from an iModel.\n * @public\n */\nexport interface InstanceNodesQueryDefinition {\n /**\n * Full name of the class whose instances are going to be returned. It's okay if the attribute\n * points to a base class of multiple different classes of instances returned by the query, however\n * the more specific this class is, the more efficient hierarchy building process is.\n */\n fullClassName: string;\n /**\n * An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected\n * to be built using `NodeSelectQueryFactory.createSelectClause`.\n */\n query: ECSqlQueryDef;\n}\n\n/**\n * A definition of nodes included in a hierarchy level.\n * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodesDefinition {\n export function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition {\n return !!(def as GenericHierarchyNodeDefinition).node;\n }\n export function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition {\n return !!(def as InstanceNodesQueryDefinition).query;\n }\n}\n\n/**\n * A definition of a hierarchy level, which may consist of multiple node definitions.\n * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (props: {\n /** The ECSQL row object to parse. Keys & value types depend on the executed query. */\n row: { [columnName: string]: any };\n\n /** The parent node whose child node is being parsed. */\n parentNode?: HierarchyDefinitionParentNode;\n\n /** The key of iModel which is used to run the query. */\n imodelKey: string;\n}) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;\n\n/**\n * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node\n * from the hierarchy.\n *\n * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(node: TNode) => Promise<TNode | undefined>;\n\n/**\n * A type for a function that post-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one.\n *\n * @public\n */\nexport type NodePostProcessor = (node: ProcessedHierarchyNode) => Promise<ProcessedHierarchyNode>;\n\n/**\n * A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means\n * a `HierarchyNode` that:\n * - knows nothing about its children,\n * - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).\n * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\n */\nexport interface DefineHierarchyLevelProps {\n /** The iModel for which the hierarchy definition is being requested for. */\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & { imodelKey: string };\n\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: HierarchyDefinitionParentNode | undefined;\n\n /** Optional hierarchy level filter. */\n instanceFilter?: GenericInstanceFilter;\n}\n\n/**\n * An interface for a factory that knows how define a hierarchy based on a given parent node.\n * @public\n */\nexport interface HierarchyDefinition {\n /**\n * An optional function for parsing ECInstance node from ECSQL row.\n *\n * Should be used in situations when the `HierarchyDefinition` implementation\n * introduces additional ECSQL columns into the select clause and wants to assign additional\n * data to the nodes it produces.\n *\n * Defaults to a function that parses all `HierarchyNode` attributes from a query, whose SELECT\n * clause is created using `NodeSelectQueryFactory.createSelectClause`.\n */\n parseNode?: NodeParser;\n\n /**\n * An optional function for pre-processing nodes.\n *\n * Pre-processing happens immediately after the nodes are loaded based on `HierarchyLevelDefinition`\n * returned by this `HierarchyDefinition` and before their processing (hiding, grouping, sorting, etc.) starts.\n * The step allows assigning nodes additional data or excluding them from the hierarchy based on some attributes.\n */\n preProcessNode?: NodePreProcessor;\n\n /**\n * An optional function for post-processing nodes.\n *\n * Post-processing happens after the loaded nodes go through all the merging, hiding and grouping\n * steps, but before sorting them. This step allows `HierarchyDefinition` implementations to assign additional data\n * to nodes after they're processed. This is especially true for grouping nodes as they're only created during\n * processing.\n */\n postProcessNode?: NodePostProcessor;\n\n /** A function to create a hierarchy level definition for given parent node. */\n defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import "../internal/DisposePolyfill.js";
2
2
  import { ECClassHierarchyInspector, ECSchemaProvider, Event, IPrimitiveValueFormatter } from "@itwin/presentation-shared";
3
- import { HierarchyFilteringPath } from "../HierarchyFiltering.js";
4
3
  import { HierarchyProvider } from "../HierarchyProvider.js";
4
+ import { HierarchySearchPath } from "../HierarchySearch.js";
5
5
  import { HierarchyDefinition } from "./IModelHierarchyDefinition.js";
6
6
  import { LimitingECSqlQueryExecutor } from "./LimitingECSqlQueryExecutor.js";
7
7
  /**
@@ -37,7 +37,10 @@ interface IModelHierarchyProviderProps {
37
37
  * @see `ECClassHierarchyInspector`
38
38
  */
39
39
  imodelAccess: IModelAccess;
40
- /** An event that is raised when iModel data, that may affect the hierarchy, changes. */
40
+ /**
41
+ * An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider
42
+ * subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.
43
+ */
41
44
  imodelChanged?: Event<() => void>;
42
45
  /**
43
46
  * A function that returns a hierarchy definition, describing how the hierarchy that the provider should be create. The
@@ -59,22 +62,54 @@ interface IModelHierarchyProviderProps {
59
62
  * by calling `setFormatter` on the provider instance.
60
63
  */
61
64
  formatter?: IPrimitiveValueFormatter;
62
- /** Props for filtering the hierarchy. */
63
- filtering?: {
65
+ /** Props for search the hierarchy. */
66
+ search?: {
64
67
  /** A list of node identifiers from root to target node. */
65
- paths: HierarchyFilteringPath[];
68
+ paths: HierarchySearchPath[];
66
69
  };
67
70
  }
68
71
  /**
69
- * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given iModel and
72
+ * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given the iModel and
70
73
  * a hierarchy definition, which defines each hierarchy level through ECSQL queries.
71
74
  *
72
75
  * @public
73
76
  */
74
- export declare function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & {
75
- /** @deprecated in 1.4. Use `[Symbol.dispose]` instead. */
76
- dispose: () => void;
77
- [Symbol.dispose]: () => void;
78
- };
77
+ export declare function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & Disposable;
78
+ /**
79
+ * Props for `createMergedIModelHierarchyProvider`.
80
+ * @alpha
81
+ */
82
+ interface MergedIModelHierarchyProviderProps extends Omit<IModelHierarchyProviderProps, "imodelAccess" | "imodelChanged"> {
83
+ /**
84
+ * A list of iModels to create merged hierarchy for.
85
+ *
86
+ * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the
87
+ * latest version. Not obeying this rule may result in undefined behavior.
88
+ */
89
+ imodels: Array<{
90
+ /**
91
+ * An object that provides access to iModel's data and metadata.
92
+ *
93
+ * @see `ECSchemaProvider`
94
+ * @see `LimitingECSqlQueryExecutor`
95
+ * @see `ECClassHierarchyInspector`
96
+ */
97
+ imodelAccess: IModelAccess;
98
+ /**
99
+ * An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider
100
+ * subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.
101
+ */
102
+ imodelChanged?: Event<() => void>;
103
+ }>;
104
+ }
105
+ /**
106
+ * Creates an instance of `HierarchyProvider` that creates a hierarchy based on multiple version of **the same** iModel
107
+ * and a hierarchy definition, which defines each hierarchy level through ECSQL queries.
108
+ *
109
+ * **Warning:** This is an experimental API that **should not be used in production**.
110
+ *
111
+ * @alpha
112
+ */
113
+ export declare function createMergedIModelHierarchyProvider(props: MergedIModelHierarchyProviderProps): HierarchyProvider & Disposable;
79
114
  export {};
80
115
  //# sourceMappingURL=IModelHierarchyProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHierarchyProvider.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;AAuBxC,OAAO,EAGL,yBAAyB,EACzB,gBAAgB,EAGhB,KAAK,EAIL,wBAAwB,EAEzB,M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AC9B,CAEA"}
1
+ {"version":3,"file":"IModelHierarchyProvider.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;AA4BxC,OAAO,EAGL,yBAAyB,EACzB,gBAAgB,EAGhB,KAAK,EAIL,wBAAwB,EAEzB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAA0B,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,OAAO,EAGL,mBAAmB,EAGpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAgB7E;;;GAGG;AACH,UAAU,uCAAuC;IAC/C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,cAAc;AACd,KAAK,YAAY,GAAG,gBAAgB,GAAG,0BAA0B,GAAG,yBAAyB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtH;;;GAGG;AACH,UAAU,4BAA4B;IACpC;;;;;;OAMG;IACH,YAAY,EAAE,YAAY,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;IAElC;;;OAGG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;IAEzC,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAC,uCAAuC,CAAC,CAAC;IAEpE;;;;OAIG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAC;IAErC,sCAAsC;IACtC,MAAM,CAAC,EAAE;QACP,2DAA2D;QAC3D,KAAK,EAAE,mBAAmB,EAAE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