@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
package/CHANGELOG.md CHANGED
@@ -1,11 +1,155 @@
1
1
  # @itwin/presentation-hierarchies
2
2
 
3
+ ## 2.0.0-alpha.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1180](https://github.com/iTwin/presentation/pull/1180): Version bump
8
+ - Updated dependencies:
9
+ - @itwin/presentation-shared@2.0.0-alpha.6
10
+
11
+ ## 2.0.0-alpha.9
12
+
13
+ ### Major Changes
14
+
15
+ - [#1150](https://github.com/iTwin/presentation/pull/1150): Support creating ECSQL query definitions based on instance filters, containing schema items that don't exist in the _current_ iModel.
16
+
17
+ To support that, the `NodesQueryClauseFactory` created by `createNodesQueryClauseFactory` returns a query-disabling result when it encounters such schema items. To ensure that's possible,
18
+ the `createNodesQueryClauseFactory` function should be called with `imodelAccess` that is passed to `HierarchyDefinition.defineHierarchyLevel`.
19
+
20
+ **Breaking changes:**
21
+ - `DefineHierarchyLevelProps.imodelKey` was replaced with `imodelAccess`. If needed, the key can be accessed using `imodelAccess.imodelKey`. This affects the following APIs:
22
+ - `HierarchyDefinition.defineHierarchyLevel` (function that uses these props),
23
+ - `DefineRootHierarchyLevelProps` (extends the props type),
24
+ - `DefineInstanceNodeChildHierarchyLevelProps` (extends the props type).
25
+
26
+ ## 2.0.0-alpha.8
27
+
28
+ ### Minor Changes
29
+
30
+ - [#1137](https://github.com/iTwin/presentation/pull/1137): Fix hierarchy search only handling a single (latest) iModel results when searching multi-iModel hierarchies.
31
+
32
+ Notable API changes:
33
+ - **BREAKING:** `NodeParser` (type of `HierarchyDefinition.parseNode` function) now gets a single props argument instead of multiple arguments. In addition, the props object now also contains an imodel key argument.
34
+
35
+ ```ts
36
+ // old:
37
+ function myParser(row: [columnName: string]: any, parentNode?: HierarchyDefinitionParentNode) {
38
+ // implementation...
39
+ }
40
+ // new:
41
+ function myParser(props: { row: [columnName: string]: any; parentNode?: HierarchyDefinitionParentNode; imodelKey: string; }) {
42
+ // implementation...
43
+ }
44
+ ```
45
+
46
+ - Exposed `IModelInstanceKey` type, which extends `InstanceKey` with an optional `imodelKey` prop. This type is used in iModel-based instance nodes and is useful outside of this package, too.
47
+ - Props for `HierarchyDefinition.defineHierarchyLevel` now include an `imodelKey` prop, identifying the iModel for which the hierarchy level is being requested. This change extends into `createPredicateBasedHierarchyDefinition` - it's props for defining root and child nodes also get the new prop.
48
+
49
+ ### Patch Changes
50
+
51
+ - [#1137](https://github.com/iTwin/presentation/pull/1137): Add and use a more robust way to check full class names for equality - `compareFullClassNames` function.
52
+
53
+ The function compares full class names in case-insensitive way, ignoring different supported schema-class name separators (`:` or `.`).
54
+
55
+ - Updated dependencies:
56
+ - @itwin/presentation-shared@2.0.0-alpha.5
57
+
58
+ ## 2.0.0-alpha.7
59
+
60
+ ### Minor Changes
61
+
62
+ - [#1011](https://github.com/iTwin/presentation/pull/1011): Rename full‑hierarchy "filtering" to "search" across the package.
63
+
64
+ Properties and APIs were renamed accordingly to clarify the distinction and avoid confusion between hierarchy‑wide search and per-hierarchy‑level filtering.
65
+
66
+ **Breaking changes:**
67
+ - Removed deprecated `extractFilteringProps`.
68
+ - Removed deprecated `HierarchyNodeFilteringProps.create`.
69
+ - Renamed `createHierarchyFilteringHelper` to `createHierarchySearchHelper`. It's return type was also adjusted for the rename:
70
+ - `hasFilter` renamed to `hasSearch`,
71
+ - `hasFilterTargetAncestor` renamed to `hasSearchTargetAncestor`,
72
+ - `getChildNodeFilteringIdentifiers` renamed to `getChildNodeSearchIdentifiers`.
73
+ - Renamed `HierarchyChangedEventArgs.filterChange` to `searchChange`.
74
+ - Renamed `HierarchyProvider.setHierarchyFilter` to `setHierarchySearch`.
75
+ - Renamed `createMergedIModelHierarchyProvider` prop `filtering` to `search.
76
+ - Renamed `HierarchyFilteringPath` to `HierarchySearchPath`.
77
+ - Renamed `HierarchyFilteringPathOptions` to `HierarchySearchPathOptions`.
78
+ - Renamed `NonGroupingHierarchyNode.filtering` to `search`. It's type was also adjusted for the rename:
79
+ - `hasFilterTargetAncestor` renamed to `hasSearchTargetAncestor`,
80
+ - `filteredChildrenIdentifierPaths` renamed to `childrenTargetPaths`,
81
+ - `isFilterTarget` renamed to `isSearchTarget`,
82
+ - `filterTargetOptions` renamed to `searchTargetOptions`.
83
+
84
+ ## 2.0.0-alpha.6
85
+
86
+ ### Major Changes
87
+
88
+ - 6a00754233e6d1b8956a5fc7680829562156d659: Fixed a bug causing `HierarchyNode.autoExpand` flag to be set on non-grouping nodes, when `HierarchyFilteringPathOptions.autoExpand.depthInHierarchy` points to a grouping node whose child non-grouping node is not a filter target.
89
+
90
+ **Breaking changes:**
91
+ - `GroupingHierarchyNode` no longer contains `filtering` attribute. This was always the case, but now the types have been updated to match it.
92
+ - Changed return type of `createHierarchyFilteringHelper`:
93
+ - Removed `createChildNodePropsAsync` - it became an overload of `createChildNodeProps`, whose path matching is done through `asyncPathMatcher` callback.
94
+ - `createChildNodeProps` now has multiple overloads and returns different types based on provided props. `autoExpand` flag is only returned when `parentKeys` are provided.
95
+ - Renamed `HierarchyFilteringPathOptions.autoExpand` -> `HierarchyFilteringPathOptions.reveal` to match intent.
96
+ - Changed `HierarchyFilteringPathOptions.reveal.depthInHierarchy` and `depthInPath` to use 0-based indexing instead of 1-based indexing.
97
+ - Changed `HierarchyFilteringPathOptions.reveal.depthInHierarchy` to not set `autoExpand` flag on the node that is at the `depthInHierarchy` position.
98
+
99
+ - e9ef80880c776522ce3b2632c8c3c461e62d6444: The hierarchy provider returned by `mergeProviders` doesn't have the deprecated `dispose` method anymore. Use `[Symbol.dispose]` instead.
100
+
101
+ ### Minor Changes
102
+
103
+ - e9e42c3a513cb7d594351ee2244c7efe67cc4385: Added `HierarchyFilteringPathOptions.autoExpand` option to enable auto-expanding of filter target nodes.
104
+ - e9ef80880c776522ce3b2632c8c3c461e62d6444: Add an experimental (`@alpha`) function `createMergedIModelHierarchyProvider` for creating a hierarchy from multiple versions of the same iModel.
105
+
106
+ ### Patch Changes
107
+
108
+ - e9ef80880c776522ce3b2632c8c3c461e62d6444: Fix `HierarchyNodeKey` methods `equals` and `compare` not handling different schema-class separators and casing.
109
+ - Updated dependencies:
110
+ - @itwin/presentation-shared@2.0.0-alpha.4
111
+
112
+ ## 2.0.0-alpha.5
113
+
114
+ ### Patch Changes
115
+
116
+ - [#1112](https://github.com/iTwin/presentation/pull/1112): Version bump
117
+ - Updated dependencies:
118
+ - @itwin/presentation-shared@2.0.0-alpha.3
119
+
120
+ ## 2.0.0-alpha.4
121
+
122
+ ### Patch Changes
123
+
124
+ - [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
125
+ - Updated dependencies:
126
+ - @itwin/presentation-shared@2.0.0-alpha.2
127
+
128
+ ## 2.0.0-alpha.3
129
+
130
+ ### Patch Changes
131
+
132
+ - [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
133
+
134
+ ## 2.0.0-alpha.2
135
+
136
+ ### Patch Changes
137
+
138
+ - [#1005](https://github.com/iTwin/presentation/pull/1005): Removed deprecated `FilterTargetGroupingNodeInfo` interface.
139
+
140
+ ## 2.0.0-alpha.1
141
+
142
+ ### Patch Changes
143
+
144
+ - [#985](https://github.com/iTwin/presentation/pull/985): Add support for `itwinjs-core@5`
145
+ - Updated dependencies:
146
+ - @itwin/presentation-shared@2.0.0-alpha.1
147
+
3
148
  ## 2.0.0-alpha.0
4
149
 
5
150
  ### Major Changes
6
151
 
7
152
  - [#954](https://github.com/iTwin/presentation/pull/954): Add additional requirements for types in `EC` metadata namespace, whose objects are returned by `ECSchemaProvider`.
8
-
9
153
  - `EC.Schema`, `EC.Class` and `EC.Property` now all have an async `getCustomAttributes()` method that returns an `EC.CustomAttributeSet`, allowing consumers to access custom attributes of these schema items.
10
154
  - `EC.Class` now additionally has these members:
11
155
  - `baseClass: Promise<Class | undefined>`
@@ -24,6 +168,167 @@
24
168
  - Updated dependencies:
25
169
  - @itwin/presentation-shared@2.0.0-alpha.0
26
170
 
171
+ ## 1.7.8
172
+
173
+ ### Patch Changes
174
+
175
+ - [#1168](https://github.com/iTwin/presentation/pull/1168): Bump dependencies.
176
+ - [#1161](https://github.com/iTwin/presentation/pull/1161): Bump iTwin.js dependencies to `^5.5.0`.
177
+ - Updated dependencies:
178
+ - @itwin/presentation-shared@1.2.7
179
+
180
+ ## 1.7.7
181
+
182
+ ### Patch Changes
183
+
184
+ - [#1152](https://github.com/iTwin/presentation/pull/1152): Bump dependencies.
185
+ - Updated dependencies:
186
+ - @itwin/presentation-shared@1.2.6
187
+
188
+ ## 1.7.6
189
+
190
+ ### Patch Changes
191
+
192
+ - [#1139](https://github.com/iTwin/presentation/pull/1139): Bump dependencies.
193
+ - Updated dependencies:
194
+ - @itwin/presentation-shared@1.2.5
195
+
196
+ ## 1.7.5
197
+
198
+ ### Patch Changes
199
+
200
+ - [#1124](https://github.com/iTwin/presentation/pull/1124): Bump dependencies.
201
+ - Updated dependencies:
202
+ - @itwin/presentation-shared@1.2.4
203
+
204
+ ## 1.7.4
205
+
206
+ ### Patch Changes
207
+
208
+ - [#1088](https://github.com/iTwin/presentation/pull/1088): Fix restart tokens not being unique when they need to, causing queries to be cancelled.
209
+
210
+ ## 1.7.3
211
+
212
+ ### Patch Changes
213
+
214
+ - [#1083](https://github.com/iTwin/presentation/pull/1083): Add unique guid to existing restart tokens, and add restart tokens to executed queries.
215
+
216
+ ## 1.7.2
217
+
218
+ ### Patch Changes
219
+
220
+ - [#1039](https://github.com/iTwin/presentation/pull/1039): Bump iTwin.js core dependencies to `^5.1.1`.
221
+ - Updated dependencies:
222
+ - @itwin/presentation-shared@1.2.3
223
+
224
+ ## 1.7.1
225
+
226
+ ### Patch Changes
227
+
228
+ - [#1024](https://github.com/iTwin/presentation/pull/1024): Update `depthInPath` documentation. Clarified that it does not set auto-expand for node that is at `depthInPath` position.
229
+
230
+ ## 1.7.0
231
+
232
+ ### Minor Changes
233
+
234
+ - 8f7d200926b93e862276e1f978f6c891691e0dae: Refactored specifying the depth / level to which filtering path should be auto-expanded.
235
+ - Deprecated `FilteringPathAutoExpandOption` and `FilterTargetGroupingNodeInfo`.
236
+ - Added `FilteringPathAutoExpandDepthInPath` and `FilteringPathAutoExpandDepthInHierarchy` which should be used instead.
237
+
238
+ Migration:
239
+
240
+ ```ts
241
+ const pathExpandedToInstanceInPath: HierarchyFilteringPath = {
242
+ path: [instanceKey1, instanceKey2, instanceKey3],
243
+ options: {
244
+ // deprecated:
245
+ autoExpand: { depth: 1 },
246
+ // do this instead:
247
+ autoExpand: { depthInPath: 1 },
248
+ },
249
+ };
250
+
251
+ const pathExpandedToGroupingNode: HierarchyFilteringPath = {
252
+ path: [instanceKey1, instanceKey2, instanceKey3],
253
+ options: {
254
+ // deprecated:
255
+ autoExpand: { depth: 1, key: groupingNodeKey },
256
+ // also deprecated:
257
+ autoExpand: { depth: 1, includeGroupingNodes: true },
258
+ // do this instead:
259
+ autoExpand: { depthInHierarchy: 1 },
260
+ },
261
+ };
262
+ ```
263
+
264
+ ## 1.6.1
265
+
266
+ ### Patch Changes
267
+
268
+ - [#1010](https://github.com/iTwin/presentation/pull/1010): Fixed `HierarchyFilteringPathOptions.autoExpand` depth option not working properly with grouping nodes. Added `includeGroupingNodes` attribute to `FilteringPathAutoExpandOption`, which allows auto-expanding only desired gouping nodes, when set together with `depth` value.
269
+
270
+ ## 1.6.0
271
+
272
+ ### Minor Changes
273
+
274
+ - 69a2db67917f84e99d532e8e9aabbc02ec262d91: `HierarchyFilteringPathOptions.autoExpand` is now of type:
275
+
276
+ ```ts
277
+ autoExpand?: { depth: number } | boolean;
278
+ ```
279
+
280
+ When `depth` is set, only nodes up to specified `depth` in `HierarchyFilteringPath` will have `autoExpand` option set.
281
+
282
+ ## 1.5.1
283
+
284
+ ### Patch Changes
285
+
286
+ - [#982](https://github.com/iTwin/presentation/pull/982): Update itwinjs-core dependencies to v5.0.0
287
+ - Updated dependencies:
288
+ - @itwin/presentation-shared@1.2.2
289
+
290
+ ## 1.5.0
291
+
292
+ ### Minor Changes
293
+
294
+ - [#962](https://github.com/iTwin/presentation/pull/962): `createChildNodePropsAsync` function, returned by `createHierarchyFilteringHelper`, may now return either a Promise, or the value synchronously. Either way, the result may be awaited, but for cases when the `createChildNodePropsAsync` function is called many times, not having to await on it provides performance improvement.
295
+
296
+ **Before:**
297
+
298
+ ```ts
299
+ const childNodeProps = await createHierarchyFilteringHelper(undefined, undefined).createChildNodePropsAsync({
300
+ pathMatcher: (identifier): boolean | Promise<boolean> => {
301
+ return false;
302
+ },
303
+ });
304
+ ```
305
+
306
+ **After:**
307
+ - **Option A:** check if it's a Promise before awaiting:
308
+
309
+ Use this when you want to get slightly better performance by avoiding unnecessary `await`.
310
+
311
+ ```ts
312
+ const childNodePropsPossiblyPromise = createHierarchyFilteringHelper(undefined, undefined).createChildNodePropsAsync({
313
+ pathMatcher: (identifier): boolean | Promise<boolean> => {
314
+ return false;
315
+ },
316
+ });
317
+ const childNodeProps = childNodePropsPossiblyPromise instanceOf Promise ? await childNodePropsPossiblyPromise : childNodePropsPossiblyPromise;
318
+ ```
319
+
320
+ - **Option B:** always await
321
+
322
+ Use this if pathMatcher always returns a Promise or you prefer a simpler pattern.
323
+
324
+ ```ts
325
+ const childNodeProps = await createHierarchyFilteringHelper(undefined, undefined).createChildNodePropsAsync({
326
+ pathMatcher: async (identifier): Promise<boolean> => {
327
+ return false;
328
+ },
329
+ });
330
+ ```
331
+
27
332
  ## 1.4.2
28
333
 
29
334
  ### Patch Changes
@@ -83,7 +388,6 @@
83
388
  - [#783](https://github.com/iTwin/presentation/pull/783): Added hierarchy filtering helper to make hierarchy filtering easier to implement.
84
389
 
85
390
  The helper can be created using the `createHierarchyFilteringHelper` function and supplying it the root level filtering paths and parent node. From there, filtering information for specific hierarchy level is determined and an object with the following attributes is returned:
86
-
87
391
  - `hasFilter` tells if the hierarchy level has a filter applied.
88
392
  - `hasFilterTargetAncestor` tells if there's a filter target ancestor node up in the hierarchy.
89
393
  - `getChildNodeFilteringIdentifiers()` returns an array of hierarchy node identifiers that apply specifically for this hierarchy level.
@@ -92,7 +396,6 @@
92
396
  See the [Implementing hierarchy filtering support](./learning/CustomHierarchyProviders.md#implementing-hierarchy-filtering-support) learning page for a usage example.
93
397
 
94
398
  In addition, deprecated a few APIs that are replaced by filtering helper:
95
-
96
399
  - `extractFilteringProps` function,
97
400
  - `HierarchyNodeFilteringProps.create` function.
98
401
 
@@ -138,7 +441,6 @@
138
441
  | 50k | not tested | 13.45 s |
139
442
 
140
443
  In addition, changed `NodeParser` (return type of `HierarchyDefinition.parseNode`):
141
-
142
444
  - It now can return a promise, so instead of just `SourceInstanceHierarchyNode` it can now also return `Promise<SourceInstanceHierarchyNode>`.
143
445
  - Additionally, it now accepts an optional `parentNode` argument of `HierarchyDefinitionParentNode` type.
144
446
 
@@ -170,7 +472,6 @@
170
472
  ### Minor Changes
171
473
 
172
474
  - [#708](https://github.com/iTwin/presentation/pull/708): **BREAKING:** Added support for creating hierarchies from multiple data sources.
173
-
174
475
  - `InstancesNodeKey.instanceKeys` array items now have an optional `imodelKey` attribute to allow for the identification of the iModel that the instance belongs to. This is useful when working with sets of instance keys representing instances from different iModels. In addition, the same `imodelKey` attribute is also available on `HierarchyNodeIdentifier` to allow for filtering nodes based on the iModel they belong to.
175
476
  - `HierarchyNode` terminology and related changes:
176
477
  - "Standard" nodes were renamed to "IModel" nodes to signify the fact that they're based on iModel data:
@@ -198,7 +499,6 @@
198
499
  - The returned provider now has a `dispose` method to clean up resources - make sure to call it when the provider is no longer needed.
199
500
  - Added `mergeProviders` function, which, given a number of hierarchy providers, creates a new provider that merges the hierarchies of the input providers. The returned provider has a `dispose` method that needs to be called when the provider is no longer needed.
200
501
  - Renamed `createClassBasedHierarchyDefinition` to `createPredicateBasedHierarchyDefinition` to signify its props changes:
201
-
202
502
  - When specifying `childNodes` definition for instances parent node, the `parentNodeClassName` attribute was changed to `parentInstancesNodePredicate`. In addition to accepting a full class name, identifying the class of parent instances to return children for, it now also accepts an async function predicate.
203
503
  - When specifying `childNodes` definition for generic parent node, the `customParentNodeKey` attribute was changed to `parentGenericNodePredicate`. The type changed from `string`, identifying the key of the parent node, to an async function predicate.
204
504
 
@@ -251,7 +551,6 @@
251
551
  ```
252
552
 
253
553
  - [#708](https://github.com/iTwin/presentation/pull/708): Added utilities for custom hierarchy filtering handling:
254
-
255
554
  - `extractFilteringProps` function, given root level hierarchy filtering paths and a parent node, returns props required to filter particular hierarchy level.
256
555
  - `HierarchyFilteringPath` interface is now public and there's also a similarly-named namespace with the following utilities:
257
556
  - `mergeOptions` merges filtering options of two paths. This is useful for cases when there are multiple paths targeting the same node, but with different options.
package/README.md CHANGED
@@ -50,15 +50,15 @@ Below is a list of learning material related to building hierarchies:
50
50
  - General topics:
51
51
  - [Formatting](./learning/Formatting.md)
52
52
  - [Logging](./learning/Logging.md)
53
- - [Hierarchy filtering](./learning/HierarchyFiltering.md)
54
- - [Hierarchy level filtering](./learning/HierarchyFiltering.md)
53
+ - [Hierarchy search](./learning/HierarchySearch.md)
54
+ - [Hierarchy level filtering](./learning/HierarchyLevelFiltering.md)
55
55
  - [Merged hierarchies](./learning/MergedHierarchies.md)
56
56
  - [Custom hierarchy providers](./learning/CustomHierarchyProviders.md)
57
57
  - iModel-based hierarchies:
58
58
  - [Hierarchy provider](./learning/imodel/HierarchyProvider.md)
59
59
  - [Hierarchy definition](./learning/imodel/HierarchyDefinition.md)
60
60
  - [Hierarchy node labels](./learning/imodel/HierarchyNodeLabels.md)
61
- - [Hierarchy filtering](./learning/imodel/HierarchyFiltering.md)
61
+ - [Hierarchy search](./learning/imodel/HierarchySearch.md)
62
62
  - [Hierarchy level filtering](./learning/imodel/HierarchyLevelFiltering.md)
63
63
  - [Grouping](./learning/imodel/Grouping.md)
64
64
  - [Localization](./learning/imodel/Localization.md)
@@ -75,8 +75,6 @@ Here's a simple example of how to create a hierarchy provider and build a hierar
75
75
 
76
76
  ```ts
77
77
  import { IModelConnection } from "@itwin/core-frontend";
78
- import { SchemaContext } from "@itwin/ecschema-metadata";
79
- import { ECSchemaRpcLocater } from "@itwin/ecschema-rpcinterface-common";
80
78
  import { createECSchemaProvider, createECSqlQueryExecutor, createIModelKey } from "@itwin/presentation-core-interop";
81
79
  import { createLimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
82
80
  import { createCachingECClassHierarchyInspector, Props } from "@itwin/presentation-shared";
@@ -91,24 +89,8 @@ import {
91
89
  } from "@itwin/presentation-hierarchies";
92
90
  import { createBisInstanceLabelSelectClauseFactory, ECSqlBinding } from "@itwin/presentation-shared";
93
91
 
94
- // Not really part of the package, but we need SchemaContext to create a hierarchy provider. It's
95
- // recommended to cache the schema context and reuse it across different application's components to
96
- // avoid loading and storing same schemas multiple times.
97
- const imodelSchemaContextsCache = new Map<string, SchemaContext>();
98
- function getIModelSchemaContext(imodel: IModelConnection) {
99
- const imodelKey = createIModelKey(imodel);
100
- let context = imodelSchemaContextsCache.get(imodelKey);
101
- if (!context) {
102
- context = new SchemaContext();
103
- context.addLocater(new ECSchemaRpcLocater(imodel.getRpcProps()));
104
- imodelSchemaContextsCache.set(imodelKey, context);
105
- imodel.onClose.addListener(() => imodelSchemaContextsCache.delete(imodelKey));
106
- }
107
- return context;
108
- }
109
-
110
92
  function createIModelAccess(imodel: IModelConnection) {
111
- const schemaProvider = createECSchemaProvider(getIModelSchemaContext(imodel));
93
+ const schemaProvider = createECSchemaProvider(imodel.schemaContext);
112
94
  return {
113
95
  // The key of the iModel we're accessing
114
96
  imodelKey: createIModelKey(imodel),
@@ -0,0 +1,19 @@
1
+ import "./internal/DisposePolyfill.js";
2
+ import { HierarchyProvider } from "./HierarchyProvider.js";
3
+ /**
4
+ * Props for `mergeProviders` function.
5
+ * @public
6
+ */
7
+ interface MergeHierarchyProvidersProps {
8
+ /** List of providers to merge. */
9
+ providers: HierarchyProvider[];
10
+ }
11
+ /**
12
+ * Creates a single, merged, hierarchy provider from multiple given providers.
13
+ * @public
14
+ */
15
+ export declare function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & {
16
+ [Symbol.dispose]: () => void;
17
+ };
18
+ export {};
19
+ //# sourceMappingURL=HierarchyMerge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HierarchyMerge.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyMerge.ts"],"names":[],"mappings":"AAKA,OAAO,+BAA+B,CAAC;AAIvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAK3D;;;GAGG;AACH,UAAU,4BAA4B;IACpC,kCAAkC;IAClC,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,EAAE,4BAA4B,GAAG,iBAAiB,GAAG;IAC/F,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B,CAyCA"}
@@ -0,0 +1,43 @@
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.mergeProviders = mergeProviders;
8
+ require("./internal/DisposePolyfill.js");
9
+ const rxjs_1 = require("rxjs");
10
+ const core_bentley_1 = require("@itwin/core-bentley");
11
+ const Common_js_1 = require("./internal/Common.js");
12
+ const EachValueFrom_js_1 = require("./internal/EachValueFrom.js");
13
+ const Sorting_js_1 = require("./internal/operators/Sorting.js");
14
+ /**
15
+ * Creates a single, merged, hierarchy provider from multiple given providers.
16
+ * @public
17
+ */
18
+ function mergeProviders({ providers }) {
19
+ const hierarchyChanged = new core_bentley_1.BeEvent();
20
+ providers.forEach((p) => {
21
+ p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());
22
+ });
23
+ const dispose = () => {
24
+ hierarchyChanged.clear();
25
+ providers.forEach((p) => (0, Common_js_1.safeDispose)(p));
26
+ };
27
+ return {
28
+ hierarchyChanged,
29
+ getNodes: (props) => (0, EachValueFrom_js_1.eachValueFrom)((0, rxjs_1.from)(providers).pipe((0, rxjs_1.mergeMap)((provider) => (0, rxjs_1.from)(provider.getNodes(props)).pipe((0, rxjs_1.mergeMap)((node) => {
30
+ if (node.children) {
31
+ return (0, rxjs_1.of)(node);
32
+ }
33
+ // each provider only considers its own data when determining node's children - in case it says
34
+ // the node has no children, we have to check against the other providers too
35
+ return (0, rxjs_1.from)(providers).pipe((0, rxjs_1.filter)((p) => p !== provider), (0, rxjs_1.mergeMap)((p) => p.getNodes({ parentNode: node })), (0, rxjs_1.map)(() => true), (0, rxjs_1.first)(undefined, false), (0, rxjs_1.map)((hasChildren) => ({ ...node, children: hasChildren })));
36
+ }))), Sorting_js_1.sortNodesByLabelOperator)),
37
+ getNodeInstanceKeys: (props) => (0, EachValueFrom_js_1.eachValueFrom)((0, rxjs_1.from)(providers).pipe((0, rxjs_1.mergeMap)((p) => p.getNodeInstanceKeys(props)))),
38
+ setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),
39
+ setHierarchySearch: (props) => providers.forEach((p) => p.setHierarchySearch(props)),
40
+ [Symbol.dispose]: dispose,
41
+ };
42
+ }
43
+ //# sourceMappingURL=HierarchyMerge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HierarchyMerge.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyMerge.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwBhG,wCA2CC;AAjED,yCAAuC;AAEvC,+BAA8D;AAC9D,sDAA8C;AAE9C,oDAAmD;AACnD,kEAA4D;AAC5D,gEAA2E;AAW3E;;;GAGG;AACH,SAAgB,cAAc,CAAC,EAAE,SAAS,EAAgC;IAGxE,MAAM,gBAAgB,GAAG,IAAI,sBAAO,EAAc,CAAC;IACnD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACtB,CAAC,CAAC,gBAAgB,CA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AC;QACJ,CAAC,CAAC,CACH,CACF,EACD,qCAAwB,CACzB,CACF;QACH,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,gCAAa,EAAC,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClH,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChF,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACpF,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;KAC1B,CAAC;AACJ,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 \"./internal/DisposePolyfill.js\";\n\nimport { filter, first, from, map, mergeMap, of } from \"rxjs\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyProvider } from \"./HierarchyProvider.js\";\nimport { safeDispose } from \"./internal/Common.js\";\nimport { eachValueFrom } from \"./internal/EachValueFrom.js\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting.js\";\n\n/**\n * Props for `mergeProviders` function.\n * @public\n */\ninterface MergeHierarchyProvidersProps {\n /** List of providers to merge. */\n providers: HierarchyProvider[];\n}\n\n/**\n * Creates a single, merged, hierarchy provider from multiple given providers.\n * @public\n */\nexport function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & {\n [Symbol.dispose]: () => void;\n} {\n const hierarchyChanged = new BeEvent<() => void>();\n providers.forEach((p) => {\n p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());\n });\n const dispose = () => {\n hierarchyChanged.clear();\n providers.forEach((p) => safeDispose(p));\n };\n\n return {\n hierarchyChanged,\n getNodes: (props) =>\n eachValueFrom(\n from(providers).pipe(\n mergeMap((provider) =>\n from(provider.getNodes(props)).pipe(\n mergeMap((node) => {\n if (node.children) {\n return of(node);\n }\n // each provider only considers its own data when determining node's children - in case it says\n // the node has no children, we have to check against the other providers too\n return from(providers).pipe(\n filter((p) => p !== provider),\n mergeMap((p) => p.getNodes({ parentNode: node })),\n map(() => true),\n first(undefined, false),\n map((hasChildren) => ({ ...node, children: hasChildren })),\n );\n }),\n ),\n ),\n sortNodesByLabelOperator,\n ),\n ),\n getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),\n setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),\n setHierarchySearch: (props) => providers.forEach((p) => p.setHierarchySearch(props)),\n [Symbol.dispose]: dispose,\n };\n}\n"]}
@@ -1,31 +1,21 @@
1
1
  import { OmitOverUnion } from "@itwin/presentation-shared";
2
- import { HierarchyFilteringPath, HierarchyFilteringPathOptions } from "./HierarchyFiltering.js";
3
2
  import { ClassGroupingNodeKey, GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, IModelHierarchyNodeKey, IModelInstanceKey, InstancesNodeKey, LabelGroupingNodeKey, PropertyGroupingNodeKey, PropertyOtherValuesGroupingNodeKey, PropertyValueGroupingNodeKey, PropertyValueRangeGroupingNodeKey } from "./HierarchyNodeKey.js";
3
+ import { HierarchySearchPath, HierarchySearchPathOptions } from "./HierarchySearch.js";
4
4
  /** @public */
5
- export type HierarchyNodeFilteringProps = {
6
- /** If set to true, then one of the ancestor nodes in the hierarchy is the filter target. */
7
- hasFilterTargetAncestor?: boolean;
8
- /** Paths to node's children that are filter targets. */
9
- filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];
5
+ export type HierarchyNodeSearchProps = {
6
+ /** If set to true, then one of the ancestor nodes in the hierarchy is the search target. */
7
+ hasSearchTargetAncestor?: boolean;
8
+ /** Paths to node's children that are search targets. */
9
+ childrenTargetPaths?: HierarchySearchPath[];
10
10
  } & ({
11
- /** Whether or not this node is a filter target. */
12
- isFilterTarget?: false;
11
+ /** Whether or not this node is a search target. */
12
+ isSearchTarget?: false;
13
13
  } | {
14
- /** Whether or not this node is a filter target. */
15
- isFilterTarget: true;
16
- /** Options that were used to filter the node. */
17
- filterTargetOptions?: HierarchyFilteringPathOptions;
14
+ /** Whether or not this node is a search target. */
15
+ isSearchTarget: true;
16
+ /** Options that were used to search the node. */
17
+ searchTargetOptions?: HierarchySearchPathOptions;
18
18
  });
19
- /** @public */
20
- export declare namespace HierarchyNodeFilteringProps {
21
- /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
22
- function create(props: {
23
- hasFilterTargetAncestor?: boolean;
24
- filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];
25
- isFilterTarget?: boolean;
26
- filterTargetOptions?: HierarchyFilteringPathOptions;
27
- }): HierarchyNodeFilteringProps | undefined;
28
- }
29
19
  /**
30
20
  * A data structure that defines attributes that are common to all types of hierarchy nodes.
31
21
  * @public
@@ -43,8 +33,6 @@ interface BaseHierarchyNode {
43
33
  extendedData?: {
44
34
  [key: string]: any;
45
35
  };
46
- /** Data that may be assigned to the node if filtering is enabled */
47
- filtering?: HierarchyNodeFilteringProps;
48
36
  }
49
37
  /**
50
38
  * A data structure that represents a single non-grouping hierarchy node.
@@ -58,6 +46,8 @@ export interface NonGroupingHierarchyNode extends BaseHierarchyNode {
58
46
  * filter when requesting child hierarchy level will have no effect.
59
47
  */
60
48
  supportsFiltering?: boolean;
49
+ /** Data that is assigned to the node if hierarchy search is enabled */
50
+ search?: HierarchyNodeSearchProps;
61
51
  }
62
52
  /**
63
53
  * A data structure that represents a grouping node that groups other nodes.
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchyNode.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,4BAA4B,EAC5B,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAE/B,cAAc;AACd,MAAM,MAAM,2BAA2B,GAAG;IACxC,4FAA4F;IAC5F,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,wDAAwD;IACxD,+BAA+B,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAC5D,GAAG,CACA;IACE,mDAAmD;IACnD,cAAc,CAAC,EAAE,KAAK,CAAC;CACxB,GACD;IACE,mDAAmD;IACnD,cAAc,EAAE,IAAI,CAAC;IACrB,iDAAiD;IACjD,mBAAmB,CAAC,EAAE,6BAA6B,CAAC;CACrD,CACJ,CAAC;AACF,cAAc;AAEd,yBAAiB,2BAA2B,CAAC;IAC3C,4IAA4I;IAE5I,SAAgB,MAAM,CAAC,KAAK,EAAE;QAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAClC,+BAA+B,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,mBAAmB,CAAC,EAAE,6BAA6B,CAAC;KACrD,GAAG,2BAA2B,GAAG,SAAS,CAU1C;CAEF;AAED;;;GAGG;AACH,UAAU,iBAAiB;IACzB,0FAA0F;IAC1F,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,4BAA4B;IAC5B,KAAK,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AAE,KAAK,GACV,IAAI,IAAI,KAAK,GAAG;QAAE,GAAG,EAAE,kCAAkC,CAAC;QAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,qBAAqB,CAEpH;IACD,sEAAsE;IACtE,SAAgB,2BAA2B,CAAC,KAAK,SAAS;QAAE,GAAG,EAAE,gBAAgB,CAAA;KAAE,EACjF,IAAI,EAAE,KAAK,GACV,IAAI,IAAI,KAAK,GAAG;QAAE,GAAG,EAAE,4BAA4B,CAAC;QAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,qBAAqB,CAE9G;IACD,4EAA4E;IAC5E,SAAgB,gCAAgC,CAAC,KAAK,SAAS;QAAE,GAAG,EAAE,gBAAgB,CAAA;KAAE,EACtF,IAAI,EAAE,KAAK,GACV,IAAI,IAAI,KAAK,GAAG;QAAE,GAAG,EAAE,iCAAiC,CAAC;QAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,qBAAqB,CAEnH;IACD,gEAAgE;IAChE,SAAgB,sBAAsB,CAAC,KAAK,SAAS;QAAE,GAAG,EAAE,gBAAgB,CAAA;KAAE,EAC5E,IAAI,EAAE,KAAK,GACV,IAAI,IAAI,KAAK,GAAG;QAAE,GAAG,EAAE,uBAAuB,CAAC;QAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,qBAAqB,CAEzG;CACF;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,aAAa,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC"}
@@ -4,30 +4,10 @@
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.HierarchyNode = exports.HierarchyNodeFilteringProps = void 0;
7
+ exports.HierarchyNode = void 0;
8
8
  const HierarchyNodeKey_js_1 = require("./HierarchyNodeKey.js");
9
9
  /** @public */
10
10
  // eslint-disable-next-line @typescript-eslint/no-redeclare
11
- var HierarchyNodeFilteringProps;
12
- (function (HierarchyNodeFilteringProps) {
13
- /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
14
- /* c8 ignore start */
15
- function create(props) {
16
- const { hasFilterTargetAncestor, filteredChildrenIdentifierPaths, isFilterTarget, filterTargetOptions } = props;
17
- if (isFilterTarget || hasFilterTargetAncestor || filteredChildrenIdentifierPaths?.length) {
18
- return {
19
- ...(isFilterTarget ? { isFilterTarget, filterTargetOptions } : undefined),
20
- ...(hasFilterTargetAncestor ? { hasFilterTargetAncestor } : undefined),
21
- ...(!!filteredChildrenIdentifierPaths?.length ? { filteredChildrenIdentifierPaths } : undefined),
22
- };
23
- }
24
- return undefined;
25
- }
26
- HierarchyNodeFilteringProps.create = create;
27
- /* c8 ignore end */
28
- })(HierarchyNodeFilteringProps || (exports.HierarchyNodeFilteringProps = HierarchyNodeFilteringProps = {}));
29
- /** @public */
30
- // eslint-disable-next-line @typescript-eslint/no-redeclare
31
11
  var HierarchyNode;
32
12
  (function (HierarchyNode) {
33
13
  /** Checks whether the given node is a generic node */