@itwin/presentation-hierarchies 0.6.0 → 0.7.0

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 (305) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +44 -47
  3. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +64 -0
  4. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -0
  5. package/lib/cjs/hierarchies/HierarchyFiltering.js +80 -0
  6. package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -0
  7. package/lib/cjs/hierarchies/HierarchyNode.d.ts +29 -233
  8. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  9. package/lib/cjs/hierarchies/HierarchyNode.js +25 -8
  10. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  11. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts +7 -11
  12. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
  13. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +9 -8
  14. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
  15. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +31 -6
  16. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  17. package/lib/cjs/hierarchies/HierarchyNodeKey.js +26 -23
  18. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
  19. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +24 -89
  20. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  21. package/lib/cjs/hierarchies/HierarchyProvider.js +24 -381
  22. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  23. package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts +9 -9
  24. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -0
  25. package/lib/cjs/hierarchies/{internal → imodel}/FilteringHierarchyDefinition.js +35 -73
  26. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -0
  27. package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts +18 -0
  28. package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
  29. package/lib/cjs/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js} +4 -4
  30. package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -0
  31. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +121 -0
  32. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
  33. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js +21 -0
  34. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
  35. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts +234 -0
  36. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
  37. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js +29 -0
  38. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
  39. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +77 -0
  40. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
  41. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +428 -0
  42. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
  43. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
  44. package/lib/cjs/hierarchies/{LimitingECSqlQueryExecutor.js → imodel/LimitingECSqlQueryExecutor.js} +3 -3
  45. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
  46. package/lib/{esm/hierarchies → cjs/hierarchies/imodel}/NodeSelectQueryFactory.d.ts +1 -1
  47. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
  48. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
  49. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +140 -0
  50. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
  51. package/lib/cjs/hierarchies/{HierarchyDefinition.js → imodel/PredicateBasedHierarchyDefinition.js} +26 -36
  52. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
  53. package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/TreeNodesReader.d.ts +6 -6
  54. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
  55. package/lib/cjs/hierarchies/{internal → imodel}/TreeNodesReader.js +2 -2
  56. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -0
  57. package/lib/cjs/hierarchies/imodel/Utils.d.ts +4 -0
  58. package/lib/cjs/hierarchies/imodel/Utils.d.ts.map +1 -0
  59. package/lib/cjs/hierarchies/imodel/Utils.js +59 -0
  60. package/lib/cjs/hierarchies/imodel/Utils.js.map +1 -0
  61. package/lib/cjs/hierarchies/{internal → imodel}/operators/DetermineChildren.d.ts +1 -1
  62. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
  63. package/lib/cjs/hierarchies/{internal → imodel}/operators/DetermineChildren.js +3 -3
  64. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
  65. package/lib/cjs/hierarchies/{internal → imodel}/operators/Grouping.d.ts +2 -1
  66. package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
  67. package/lib/cjs/hierarchies/{internal → imodel}/operators/Grouping.js +5 -5
  68. package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -0
  69. package/lib/cjs/hierarchies/{internal → imodel}/operators/HideIfNoChildren.d.ts +1 -1
  70. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
  71. package/lib/cjs/hierarchies/{internal → imodel}/operators/HideIfNoChildren.js +5 -5
  72. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
  73. package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/HideNodesInHierarchy.d.ts +1 -1
  74. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
  75. package/lib/cjs/hierarchies/{internal → imodel}/operators/HideNodesInHierarchy.js +22 -9
  76. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
  77. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
  78. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
  79. package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/BaseClassGrouping.d.ts +2 -1
  80. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
  81. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
  82. package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/ClassGrouping.d.ts +2 -1
  83. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
  84. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
  85. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
  86. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
  87. package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.d.ts +1 -1
  88. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
  89. package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.js +2 -2
  90. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
  91. package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/PropertiesGrouping.d.ts +2 -1
  92. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
  93. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
  94. package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/Shared.d.ts +1 -1
  95. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
  96. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
  97. package/lib/cjs/hierarchies/internal/Common.d.ts +7 -4
  98. package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
  99. package/lib/cjs/hierarchies/internal/Common.js +0 -66
  100. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  101. package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts +3 -2
  102. package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
  103. package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
  104. package/lib/cjs/presentation-hierarchies.d.ts +10 -6
  105. package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
  106. package/lib/cjs/presentation-hierarchies.js +18 -10
  107. package/lib/cjs/presentation-hierarchies.js.map +1 -1
  108. package/lib/esm/hierarchies/HierarchyFiltering.d.ts +64 -0
  109. package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -0
  110. package/lib/esm/hierarchies/HierarchyFiltering.js +76 -0
  111. package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -0
  112. package/lib/esm/hierarchies/HierarchyNode.d.ts +29 -233
  113. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  114. package/lib/esm/hierarchies/HierarchyNode.js +24 -7
  115. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  116. package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +7 -11
  117. package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
  118. package/lib/esm/hierarchies/HierarchyNodeIdentifier.js +9 -8
  119. package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
  120. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts +31 -6
  121. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  122. package/lib/esm/hierarchies/HierarchyNodeKey.js +26 -23
  123. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
  124. package/lib/esm/hierarchies/HierarchyProvider.d.ts +24 -89
  125. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  126. package/lib/esm/hierarchies/HierarchyProvider.js +25 -382
  127. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  128. package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts +9 -9
  129. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -0
  130. package/lib/esm/hierarchies/{internal → imodel}/FilteringHierarchyDefinition.js +36 -74
  131. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -0
  132. package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts +18 -0
  133. package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
  134. package/lib/esm/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js} +2 -2
  135. package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -0
  136. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +121 -0
  137. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
  138. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js +18 -0
  139. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
  140. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +234 -0
  141. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
  142. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js +26 -0
  143. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
  144. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +77 -0
  145. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
  146. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +425 -0
  147. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
  148. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
  149. package/lib/esm/hierarchies/{LimitingECSqlQueryExecutor.js → imodel/LimitingECSqlQueryExecutor.js} +3 -3
  150. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
  151. package/lib/{cjs/hierarchies → esm/hierarchies/imodel}/NodeSelectQueryFactory.d.ts +1 -1
  152. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
  153. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
  154. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +140 -0
  155. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
  156. package/lib/esm/hierarchies/{HierarchyDefinition.js → imodel/PredicateBasedHierarchyDefinition.js} +25 -34
  157. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
  158. package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/TreeNodesReader.d.ts +6 -6
  159. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
  160. package/lib/esm/hierarchies/{internal → imodel}/TreeNodesReader.js +2 -2
  161. package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -0
  162. package/lib/esm/hierarchies/imodel/Utils.d.ts +4 -0
  163. package/lib/esm/hierarchies/imodel/Utils.d.ts.map +1 -0
  164. package/lib/esm/hierarchies/imodel/Utils.js +56 -0
  165. package/lib/esm/hierarchies/imodel/Utils.js.map +1 -0
  166. package/lib/esm/hierarchies/{internal → imodel}/operators/DetermineChildren.d.ts +1 -1
  167. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
  168. package/lib/esm/hierarchies/{internal → imodel}/operators/DetermineChildren.js +3 -3
  169. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
  170. package/lib/esm/hierarchies/{internal → imodel}/operators/Grouping.d.ts +2 -1
  171. package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
  172. package/lib/esm/hierarchies/{internal → imodel}/operators/Grouping.js +6 -6
  173. package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +1 -0
  174. package/lib/esm/hierarchies/{internal → imodel}/operators/HideIfNoChildren.d.ts +1 -1
  175. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
  176. package/lib/esm/hierarchies/{internal → imodel}/operators/HideIfNoChildren.js +5 -5
  177. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
  178. package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/HideNodesInHierarchy.d.ts +1 -1
  179. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
  180. package/lib/esm/hierarchies/{internal → imodel}/operators/HideNodesInHierarchy.js +22 -9
  181. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
  182. package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
  183. package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
  184. package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/BaseClassGrouping.d.ts +2 -1
  185. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
  186. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
  187. package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/ClassGrouping.d.ts +2 -1
  188. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
  189. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
  190. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
  191. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
  192. package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.d.ts +1 -1
  193. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
  194. package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.js +2 -2
  195. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
  196. package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/PropertiesGrouping.d.ts +2 -1
  197. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
  198. package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/PropertiesGrouping.js +1 -1
  199. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
  200. package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/Shared.d.ts +1 -1
  201. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
  202. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
  203. package/lib/esm/hierarchies/internal/Common.d.ts +7 -4
  204. package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
  205. package/lib/esm/hierarchies/internal/Common.js +0 -65
  206. package/lib/esm/hierarchies/internal/Common.js.map +1 -1
  207. package/lib/esm/hierarchies/internal/operators/Sorting.d.ts +3 -2
  208. package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
  209. package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
  210. package/lib/esm/presentation-hierarchies.d.ts +10 -6
  211. package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
  212. package/lib/esm/presentation-hierarchies.js +8 -4
  213. package/lib/esm/presentation-hierarchies.js.map +1 -1
  214. package/package.json +3 -2
  215. package/lib/cjs/hierarchies/HierarchyDefinition.d.ts +0 -251
  216. package/lib/cjs/hierarchies/HierarchyDefinition.d.ts.map +0 -1
  217. package/lib/cjs/hierarchies/HierarchyDefinition.js.map +0 -1
  218. package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +0 -1
  219. package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.js.map +0 -1
  220. package/lib/cjs/hierarchies/NodeSelectQueryFactory.d.ts.map +0 -1
  221. package/lib/cjs/hierarchies/NodeSelectQueryFactory.js.map +0 -1
  222. package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts +0 -40
  223. package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +0 -1
  224. package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.js.map +0 -1
  225. package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +0 -1
  226. package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.js.map +0 -1
  227. package/lib/cjs/hierarchies/internal/TreeNodesReader.d.ts.map +0 -1
  228. package/lib/cjs/hierarchies/internal/TreeNodesReader.js.map +0 -1
  229. package/lib/cjs/hierarchies/internal/operators/DetermineChildren.d.ts.map +0 -1
  230. package/lib/cjs/hierarchies/internal/operators/DetermineChildren.js.map +0 -1
  231. package/lib/cjs/hierarchies/internal/operators/Grouping.d.ts.map +0 -1
  232. package/lib/cjs/hierarchies/internal/operators/Grouping.js.map +0 -1
  233. package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +0 -1
  234. package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.js.map +0 -1
  235. package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +0 -1
  236. package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.js.map +0 -1
  237. package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.d.ts.map +0 -1
  238. package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.js.map +0 -1
  239. package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
  240. package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +0 -1
  241. package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.d.ts.map +0 -1
  242. package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.js.map +0 -1
  243. package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.d.ts.map +0 -1
  244. package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.js.map +0 -1
  245. package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.d.ts.map +0 -1
  246. package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.js.map +0 -1
  247. package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
  248. package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +0 -1
  249. package/lib/cjs/hierarchies/internal/operators/grouping/Shared.d.ts.map +0 -1
  250. package/lib/cjs/hierarchies/internal/operators/grouping/Shared.js.map +0 -1
  251. package/lib/esm/hierarchies/HierarchyDefinition.d.ts +0 -251
  252. package/lib/esm/hierarchies/HierarchyDefinition.d.ts.map +0 -1
  253. package/lib/esm/hierarchies/HierarchyDefinition.js.map +0 -1
  254. package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +0 -1
  255. package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.js.map +0 -1
  256. package/lib/esm/hierarchies/NodeSelectQueryFactory.d.ts.map +0 -1
  257. package/lib/esm/hierarchies/NodeSelectQueryFactory.js.map +0 -1
  258. package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts +0 -40
  259. package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +0 -1
  260. package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.js.map +0 -1
  261. package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +0 -1
  262. package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.js.map +0 -1
  263. package/lib/esm/hierarchies/internal/TreeNodesReader.d.ts.map +0 -1
  264. package/lib/esm/hierarchies/internal/TreeNodesReader.js.map +0 -1
  265. package/lib/esm/hierarchies/internal/operators/DetermineChildren.d.ts.map +0 -1
  266. package/lib/esm/hierarchies/internal/operators/DetermineChildren.js.map +0 -1
  267. package/lib/esm/hierarchies/internal/operators/Grouping.d.ts.map +0 -1
  268. package/lib/esm/hierarchies/internal/operators/Grouping.js.map +0 -1
  269. package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +0 -1
  270. package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.js.map +0 -1
  271. package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +0 -1
  272. package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.js.map +0 -1
  273. package/lib/esm/hierarchies/internal/operators/grouping/AutoExpand.d.ts.map +0 -1
  274. package/lib/esm/hierarchies/internal/operators/grouping/AutoExpand.js.map +0 -1
  275. package/lib/esm/hierarchies/internal/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
  276. package/lib/esm/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +0 -1
  277. package/lib/esm/hierarchies/internal/operators/grouping/ClassGrouping.d.ts.map +0 -1
  278. package/lib/esm/hierarchies/internal/operators/grouping/ClassGrouping.js.map +0 -1
  279. package/lib/esm/hierarchies/internal/operators/grouping/GroupHiding.d.ts.map +0 -1
  280. package/lib/esm/hierarchies/internal/operators/grouping/GroupHiding.js.map +0 -1
  281. package/lib/esm/hierarchies/internal/operators/grouping/LabelGrouping.d.ts.map +0 -1
  282. package/lib/esm/hierarchies/internal/operators/grouping/LabelGrouping.js.map +0 -1
  283. package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
  284. package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +0 -1
  285. package/lib/esm/hierarchies/internal/operators/grouping/Shared.d.ts.map +0 -1
  286. package/lib/esm/hierarchies/internal/operators/grouping/Shared.js.map +0 -1
  287. /package/lib/cjs/hierarchies/{LimitingECSqlQueryExecutor.d.ts → imodel/LimitingECSqlQueryExecutor.d.ts} +0 -0
  288. /package/lib/cjs/hierarchies/{NodeSelectQueryFactory.js → imodel/NodeSelectQueryFactory.js} +0 -0
  289. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.d.ts +0 -0
  290. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.js +0 -0
  291. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/BaseClassGrouping.js +0 -0
  292. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/ClassGrouping.js +0 -0
  293. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.d.ts +0 -0
  294. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.js +0 -0
  295. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/PropertiesGrouping.js +0 -0
  296. /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/Shared.js +0 -0
  297. /package/lib/esm/hierarchies/{LimitingECSqlQueryExecutor.d.ts → imodel/LimitingECSqlQueryExecutor.d.ts} +0 -0
  298. /package/lib/esm/hierarchies/{NodeSelectQueryFactory.js → imodel/NodeSelectQueryFactory.js} +0 -0
  299. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.d.ts +0 -0
  300. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.js +0 -0
  301. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/BaseClassGrouping.js +0 -0
  302. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/ClassGrouping.js +0 -0
  303. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.d.ts +0 -0
  304. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.js +0 -0
  305. /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/Shared.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # @itwin/presentation-hierarchies
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#708](https://github.com/iTwin/presentation/pull/708): **BREAKING:** Added support for creating hierarchies from multiple data sources.
8
+
9
+ - `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.
10
+ - `HierarchyNode` terminology and related changes:
11
+ - "Standard" nodes were renamed to "IModel" nodes to signify the fact that they're based on iModel data:
12
+ - `StandardHierarchyNodeKey` renamed to `IModelHierarchyNodeKey`.
13
+ - `HierarchyNodeKey.isStandard` renamed to `HierarchyNodeKey.isIModelNodeKey`.
14
+ - `HierarchyNode.isStandard` renamed to `HierarchyNode.isIModelNode`.
15
+ - "Custom" nodes were renamed to "generic":
16
+ - `key` of custom nodes was a `string`. Now, `HierarchyProvider` returns these nodes with key of type `GenericNodeKey` (`HierarchyDefinition` still returns the `key` as `string` like before). This affects how generic nodes are identified through `HierarchyNodeIdentifier` when specifying hierarchy filter paths (was a `string`, now `GenericNodeKey`).
17
+ - `DefineCustomNodeChildHierarchyLevelProps` renamed to `DefineGenericNodeChildHierarchyLevelProps`.
18
+ - `HierarchyNodeKey.isCustom` renamed to `HierarchyNodeKey.isGeneric`.
19
+ - `HierarchyNode.isCustom` renamed to `HierarchyNode.isGeneric`.
20
+ - `HierarchyNodeIdentifier.isCustomNodeIdentifier` renamed to `HierarchyNodeIdentifier.isGenericNodeIdentifier`.
21
+ - `HierarchyNodesDefinition.isCustomNode` renamed to `HierarchyNodesDefinition.isGenericNode`.
22
+ - `ParsedHierarchyNode` was renamed to `SourceHierarchyNode`.
23
+ - Type guards in `HierarchyNode` namespace no longer narrow the type of the input node to `ProcessedHierarchyNode` subtypes. Instead, a `ProcessedHierarchyNode` namespace was added with a number of type guards to do that.
24
+ - Changes to `HierarchyProvider` interface:
25
+ - Removed `notifyDataSourceChanged` method. Each provider implementation should decide how it gets notified about data source changes.
26
+ - Added `setHierarchyFilter` method to allow setting or removing the filter without creating a new provider.
27
+ - Renamed `createHierarchyProvider` to `createIModelHierarchyProvider` to signify that the created provider creates nodes based on specific iModel. In addition, the function received the following changes:
28
+ - The `imodelAccess` object now requires an additional `imodelKey` attribute. See README for how to create the `imodelAccess` object.
29
+ - All nodes returned by the provider are now associated with the iModel this provider is using:
30
+ - Instances-based hierarchy nodes' instance keys have an `imodelKey` attribute.
31
+ - Generic nodes' keys have a `source` attribute set to imodel access' `imodelKey`.
32
+ - Added an optional `imodelChanged` prop of `Event` type. The created provider listens to this event and updates the hierarchy when the event is raised (previously this was done by calling `notifyDataSourceChanged` method on the provider).
33
+ - The returned provider now has a `dispose` method to clean up resources - make sure to call it when the provider is no longer needed.
34
+ - 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.
35
+ - Renamed `createClassBasedHierarchyDefinition` to `createPredicateBasedHierarchyDefinition` to signify its props changes:
36
+
37
+ - 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.
38
+ - 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.
39
+
40
+ Migration:
41
+
42
+ ```ts
43
+ // before
44
+ const definition = createClassBasedHierarchyDefinition({
45
+ classHierarchyInspector,
46
+ hierarchy: {
47
+ rootNodes: async () => [...],
48
+ childNodes: [
49
+ {
50
+ parentNodeClassName: "MySchema.MyClass",
51
+ definitions: async () => [...],
52
+ },
53
+ {
54
+ customParentNodeKey: "my-custom-node",
55
+ definitions: async () => [...],
56
+ },
57
+ ],
58
+ },
59
+ });
60
+
61
+ // after
62
+ const definition = createPredicateBasedHierarchyDefinition({
63
+ classHierarchyInspector,
64
+ hierarchy: {
65
+ rootNodes: async () => [...],
66
+ childNodes: [
67
+ {
68
+ parentInstancesNodePredicate: "MySchema.MyClass",
69
+ /* alternative:
70
+ parentInstancesNodePredicate: async (parentKey) =>
71
+ Promise.all(
72
+ parentKey.instanceKeys.map(async (instanceKey) =>
73
+ classHierarchyInspector.classDerivesFrom(instanceKey.className, "MySchema.MyClass"),
74
+ ),
75
+ ),
76
+ */
77
+ definitions: async () => [...],
78
+ },
79
+ {
80
+ parentGenericNodePredicate: async (parentKey) => parentKey.id === "my-custom-node",
81
+ definitions: async () => [...],
82
+ },
83
+ ],
84
+ },
85
+ });
86
+ ```
87
+
88
+ - [#708](https://github.com/iTwin/presentation/pull/708): Added utilities for custom hierarchy filtering handling:
89
+
90
+ - `extractFilteringProps` function, given root level hierarchy filtering paths and a parent node, returns props required to filter particular hierarchy level.
91
+ - `HierarchyFilteringPath` interface is now public and there's also a similarly-named namespace with the following utilities:
92
+ - `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.
93
+ - `normalize` takes `HierarchyFilteringPath`, which may be either a pure path or an object with a path and options, and returns normalized version of it - an object with `path` and `options` attributes.
94
+
95
+ - [#717](https://github.com/iTwin/presentation/pull/717): **BREAKING:** Added a required `HierarchyProvider.hierarchyChanged` attribute.
96
+
97
+ The attribute is of type `Event` and should be raised by the provider whenever the underlying data source changes in a way that affects the resulting hierarchy. This moves the responsibility of data source change tracking from the consumers using the provider to the provider itself. All provider implementations delivered by this package have been updated to raise this event when necessary.
98
+
3
99
  ## 0.6.0
4
100
 
5
101
  ### Minor Changes
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.
4
4
 
5
- The `@itwin/presentation-hierarchies` package provides APIs for creating hierarchical data structures based on data in an [iTwin.js iModel](https://www.itwinjs.org/learning/imodels/#imodel-overview).
5
+ The `@itwin/presentation-hierarchies` package provides APIs for creating hierarchical data structures. While most of the delivered APIs are intended for the use case we anticipate the most - hierarchies based on data in an [iTwin.js iModel](https://www.itwinjs.org/learning/imodels/#imodel-overview), the package also supports generic hierarchies that are not based on any specific data source.
6
6
 
7
- The package doesn't depend on any backend, frontend or UI specific packages. As such, it can be used in both backend and frontend applications, and in case of the latter, it can be used with any UI framework. For React-based frontend applications, please see the `@itwin/presentation-hierarchies-react` package.
7
+ The package doesn't depend on any backend, frontend or UI specific packages. As such, it can be used in both backend and frontend applications, and in case of the latter, it can be used with any UI framework. For React-based frontend applications, please see the [`@itwin/presentation-hierarchies-react`](../hierarchies-react/README.md) package.
8
8
 
9
9
  ## Concepts
10
10
 
@@ -18,14 +18,14 @@ Here are definitions of some basic hierarchy-related concepts based on the above
18
18
  - A hierarchy level is a group of hierarchy nodes that are at the same level in the hierarchy. In the above example the root level contains `Node 0`, `Node 1` and `Node 2`. Child level of `Node 2` contains `Node 2-0`, `Node 2-1`.
19
19
  - A hierarchy branch is a sub-hierarchy under specific parent node, including the parent itself. In the above example, the branch of `Node 2` contains `Node 2`, `Node 2-0`, `Node 2-1` and `Node 2-1-0`.
20
20
 
21
- In the context of `@itwin/presentation-hierarchies` package, a hierarchy is built by requesting hierarchy levels from a [hierarchy provider](#hierarchy-provider). The provider knows how to create hierarchy levels based on the data in an iModel and a [hierarchy definition](#hierarchy-definition).
21
+ In the context of `@itwin/presentation-hierarchies` package, a hierarchy is built by requesting hierarchy levels from a [hierarchy provider](#hierarchy-providers). A couple of built-in hierarchy provider implementations are delivered with the package - see [hierarchy providers](#hierarchy-providers) section for more information.
22
22
 
23
23
  ### Hierarchy nodes
24
24
 
25
- A `HierarchyNode` interface in the package represents a single node in a hierarchy. It contains information about what the node represents in the iModel (through it's `key` property), label and other properties. There are multiple types of nodes:
25
+ A `HierarchyNode` data structure in the package represents a single node in a hierarchy. It contains information about what the node represents (through it's `key` property), label and other properties. There are multiple types of nodes:
26
26
 
27
- - A custom node is not based on any iModel data and is created by the application. Its `key` is a string.
28
- - An instances node is based on one or more ECInstance(s) in the iModel. Its `key` is an `InstancesNodeKey` and contains identifiers of those ECInstances.
27
+ - A generic node is not based on any iModel data. Its `key` is a `GenericNodeKey` and has a consumer-supplied identifier with an optional `source` attribute identifying the hierarchy provider that created the node.
28
+ - An instances node is based on one or more ECInstance(s) in an iModel. Its `key` is an `InstancesNodeKey` and contains identifiers of those ECInstances, in addition to `imodelKey` attribute that identifies the source iModel.
29
29
  - A grouping node groups one or more instances nodes. Its `key` is a `GroupingNodeKey` and contains the grouping criteria, which depends on the type of grouping:
30
30
  - Label grouping node keys have a label.
31
31
  - Class grouping nodes have a full class name.
@@ -33,27 +33,13 @@ A `HierarchyNode` interface in the package represents a single node in a hierarc
33
33
 
34
34
  `HierarchyNode` and `HierarchyNodeKey` namespaces contain type guards and utility functions for working with hierarchy nodes and their keys.
35
35
 
36
- A `HierarchyNode` goes through several stages throughout its lifetime:
36
+ ### Hierarchy providers
37
37
 
38
- 1. A node starts its life as a `ParsedHierarchyNode` when it's initially parsed from ECSQL query results or returned by a [hierarchy definition](#hierarchy-definition) as a custom node. This variation has no information about its ancestors (position in the hierarchy) and may have unformatted label. Parsed nodes may only be custom or instances nodes.
38
+ `HierarchyProvider` is the core concept of the library, which consumers use directly to build hierarchies. While that is an interface that consumers are free to implement, the package delivers a couple of built-in implementations:
39
39
 
40
- 2. A node becomes a `ProcessedHierarchyNode` as soon as it starts being processed by a [hierarchy provider](#hierarchy-provider). During the processing, provider assigns a formatted label, handles node hiding, grouping, sorting and other operations. A [hierarchy definition](#hierarchy-definition) gets a chance to step into the process as well. In case of grouping, new grouping nodes may be created.
40
+ - A provider that builds hierarchies based on data in an [iTwin.js iModel](https://www.itwinjs.org/learning/imodels/#imodel-overview). The `createIModelHierarchyProvider` function is used to create such a provider. See [iModel-based hierarchies](./learning/imodel/HierarchyProvider.md) learning page for more information.
41
41
 
42
- 3. Finally, all the processing-related information is cleaned up from `ProcessedHierarchyNode` and it becomes a `HierarchyNode`, which is what consumers get from a [hierarchy provider](#hierarchy-provider).
43
-
44
- ### Hierarchy definition
45
-
46
- A hierarchy definition is what describes the hierarchy by defining what child nodes to return for a given parent node. In this package that is achieved though the `HierarchyDefinition` interface, which has one required method - `defineHierarchyLevel`. The method's responsibility is to create a `HierarchyLevelDefinition` for a given parent node. A `HierarchyLevelDefinition` is actually just a set of `HierarchyNodesDefinition` objects, which either describe a single custom node, or an ECSQL query that returns a number of ECInstance nodes. When `HierarchyLevelDefinition` consists of more than 1 `HierarchyNodesDefinition`, the hierarchy level is combined from multiple sets of nodes.
47
-
48
- In case of ECSQL queries for creating the hierarchy level, the definition may want to select some extra information and assign it to the nodes. For that purpose, there's an optional `HierarchyDefinition.parseNode` method, which lets the definition parse the query results handle those extra columns.
49
-
50
- Finally, the library also allows hierarchy definitions to step into nodes processing chain through the optional `preProcessNode` and `postProcessNode` methods. These methods are called before and after the node is processed by a [hierarchy provider](#hierarchy-provider) respectively and allow hiding and customizing nodes.
51
-
52
- In iTwin.js, the most common way to create hierarchies is based on EC data (schemas, classes, relationships) in iModels. To make consumers' life easier, the package provides an utility called `createClassBasedHierarchyDefinition`, which lets consumers define hierarchy levels based on parent nodes' class.
53
-
54
- ### Hierarchy provider
55
-
56
- `HierarchyProvider` the core concept of the library - it's responsibility is to glue everything together, including evaluating hierarchy definition, running the queries, processing nodes and, finally, returning them to consumers. The package delivers the `createHierarchyProvider` function to create an instance of `HierarchyProvider`.
42
+ - A merged provider that combines multiple providers into a single one. This is useful when you want to combine multiple hierarchies, possibly built from different data sources, into a single one. See [Merged hierarchies](./learning/MergedHierarchies.md) learning page for more information.
57
43
 
58
44
  ## Learning
59
45
 
@@ -61,24 +47,28 @@ Are you migrating from Presentation Rules? Check out our [Migrating from Present
61
47
 
62
48
  Below is a list of learning material related to building hierarchies:
63
49
 
64
- - [Hierarchy processing](./learning/HierarchyProcessing.md)
65
- - [Hierarchy definitions](./learning/HierarchyDefinitions.md)
66
- - [Hierarchy filtering](./learning/HierarchyFiltering.md)
67
- - [Hierarchy level filtering](./learning/HierarchyLevelFiltering.md)
68
- - [Hierarchy node labels](./learning/NodeLabels.md)
69
- - [Grouping](./learning/Grouping.md)
70
- - [Formatting](./learning/Formatting.md)
71
- - [Localization](./learning/Localization.md)
72
- - [Logging](./learning/Logging.md)
73
- - [Performance tuning](./learning/PerformanceTuning.md)
50
+ - General topics:
51
+ - [Formatting](./learning/Formatting.md)
52
+ - [Logging](./learning/Logging.md)
53
+ - [Hierarchy filtering](./learning/HierarchyFiltering.md)
54
+ - [Merged hierarchies](./learning/MergedHierarchies.md)
55
+ - iModel-based hierarchies:
56
+ - [Hierarchy provider](./learning/imodel/HierarchyProvider.md)
57
+ - [Hierarchy definition](./learning/imodel/HierarchyDefinition.md)
58
+ - [Hierarchy node labels](./learning/imodel/HierarchyNodeLabels.md)
59
+ - [Hierarchy filtering](./learning/imodel/HierarchyFiltering.md)
60
+ - [Hierarchy level filtering](./learning/imodel/HierarchyLevelFiltering.md)
61
+ - [Grouping](./learning/imodel/Grouping.md)
62
+ - [Localization](./learning/imodel/Localization.md)
63
+ - [Performance tuning](./learning/imodel/PerformanceTuning.md)
74
64
 
75
65
  Do you think something is missing in the above list? Let us know by [creating an issue](https://github.com/iTwin/presentation/issues/new?assignees=&labels=documentation%2C+presentation&projects=&template=learning-material-request.md&title=).
76
66
 
77
67
  ## Basic example
78
68
 
79
- Here's a simple example of how to create a hierarchy provider and build a hierarchy of Models and their Elements, with the latter grouped by class:
69
+ Here's a simple example of how to create a hierarchy provider and build a hierarchy of iModels' Models and Elements, with the latter grouped by class:
80
70
 
81
- <!-- [[include: Presentation.Hierarchies.Readme.BasicExample, ts]] -->
71
+ <!-- [[include: [Presentation.Hierarchies.IModelAccessImports, Presentation.Hierarchies.ReadmeExampleImports, Presentation.Hierarchies.IModelAccess, Presentation.Hierarchies.ReadmeExample], ts]] -->
82
72
  <!-- BEGIN EXTRACTION -->
83
73
 
84
74
  ```ts
@@ -86,16 +76,18 @@ import { IModelConnection } from "@itwin/core-frontend";
86
76
  import { SchemaContext } from "@itwin/ecschema-metadata";
87
77
  import { ECSchemaRpcLocater } from "@itwin/ecschema-rpcinterface-common";
88
78
  import { createECSchemaProvider, createECSqlQueryExecutor } from "@itwin/presentation-core-interop";
79
+ import { createLimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
80
+ import { createCachingECClassHierarchyInspector } from "@itwin/presentation-shared";
81
+
89
82
  import {
90
- createClassBasedHierarchyDefinition,
91
- createHierarchyProvider,
92
- createLimitingECSqlQueryExecutor,
83
+ createIModelHierarchyProvider,
93
84
  createNodesQueryClauseFactory,
85
+ createPredicateBasedHierarchyDefinition,
94
86
  DefineInstanceNodeChildHierarchyLevelProps,
95
87
  HierarchyNode,
96
88
  HierarchyProvider,
97
89
  } from "@itwin/presentation-hierarchies";
98
- import { createBisInstanceLabelSelectClauseFactory, createCachingECClassHierarchyInspector, ECSqlBinding } from "@itwin/presentation-shared";
90
+ import { createBisInstanceLabelSelectClauseFactory, ECSqlBinding } from "@itwin/presentation-shared";
99
91
 
100
92
  // Not really part of the package, but we need SchemaContext to create a hierarchy provider. It's
101
93
  // recommended to cache the schema context and reuse it across different application's components to
@@ -112,10 +104,12 @@ function getIModelSchemaContext(imodel: IModelConnection) {
112
104
  return context;
113
105
  }
114
106
 
115
- function createProvider(imodel: IModelConnection): HierarchyProvider {
116
- // First, set up access to the iModel
107
+ function createIModelAccess(imodel: IModelConnection) {
117
108
  const schemaProvider = createECSchemaProvider(getIModelSchemaContext(imodel));
118
- const imodelAccess = {
109
+ return {
110
+ // The key of the iModel we're accessing
111
+ imodelKey: imodel.key,
112
+ // Schema provider provides access to EC information (metadata)
119
113
  ...schemaProvider,
120
114
  // While caching for hierarchy inspector is not mandatory, it's recommended to use it to improve performance
121
115
  ...createCachingECClassHierarchyInspector({ schemaProvider, cacheSize: 100 }),
@@ -123,14 +117,17 @@ function createProvider(imodel: IModelConnection): HierarchyProvider {
123
117
  // avoid creating hierarchy levels of insane size (expensive to us and useless to users)
124
118
  ...createLimitingECSqlQueryExecutor(createECSqlQueryExecutor(imodel), 1000),
125
119
  };
120
+ }
126
121
 
122
+ function createProvider(imodelAccess: Parameters<typeof createIModelHierarchyProvider>[0]["imodelAccess"]): HierarchyProvider {
127
123
  // Create a factory for building labels SELECT query clauses according to BIS conventions
128
124
  const labelsQueryFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: imodelAccess });
125
+
129
126
  // Create a factory for building nodes SELECT query clauses in a format understood by the provider
130
127
  const nodesQueryFactory = createNodesQueryClauseFactory({ imodelAccess, instanceLabelSelectClauseFactory: labelsQueryFactory });
131
128
 
132
129
  // Then, define the hierarchy
133
- const hierarchyDefinition = createClassBasedHierarchyDefinition({
130
+ const hierarchyDefinition = createPredicateBasedHierarchyDefinition({
134
131
  classHierarchyInspector: imodelAccess,
135
132
  hierarchy: {
136
133
  // For root nodes, select all BisCore.GeometricModel3d instances
@@ -155,7 +152,7 @@ function createProvider(imodel: IModelConnection): HierarchyProvider {
155
152
  childNodes: [
156
153
  {
157
154
  // For BisCore.Model parent nodes, select all BisCore.Element instances contained in corresponding model
158
- parentNodeClassName: "BisCore.Model",
155
+ parentInstancesNodePredicate: "BisCore.Model",
159
156
  definitions: async ({ parentNodeInstanceIds }: DefineInstanceNodeChildHierarchyLevelProps) => [
160
157
  {
161
158
  fullClassName: "BisCore.Element",
@@ -185,11 +182,11 @@ function createProvider(imodel: IModelConnection): HierarchyProvider {
185
182
  });
186
183
 
187
184
  // Finally, create the provider
188
- return createHierarchyProvider({ imodelAccess, hierarchyDefinition });
185
+ return createIModelHierarchyProvider({ imodelAccess, hierarchyDefinition });
189
186
  }
190
187
 
191
188
  async function main() {
192
- const provider = createProvider(await getIModelConnection());
189
+ const provider = createProvider(createIModelAccess(await getIModelConnection()));
193
190
  async function loadBranch(parentNode: HierarchyNode | undefined, indent: number = 0) {
194
191
  for await (const node of provider.getNodes({ parentNode })) {
195
192
  console.log(`${new Array(indent * 2 + 1).join(" ")}${node.label}`);
@@ -0,0 +1,64 @@
1
+ import { NonGroupingHierarchyNode } from "./HierarchyNode";
2
+ import { HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier";
3
+ import { GroupingNodeKey } from "./HierarchyNodeKey";
4
+ /** @beta */
5
+ export interface FilterTargetGroupingNodeInfo {
6
+ /** Key of the grouping node. */
7
+ key: GroupingNodeKey;
8
+ /**
9
+ * Depth of the grouping node in the hierarchy.
10
+ * Generally, it can be retrieved from `parentKeys.length`.
11
+ */
12
+ depth: number;
13
+ }
14
+ /** @beta */
15
+ export interface HierarchyFilteringPathOptions {
16
+ /**
17
+ * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.
18
+ * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.
19
+ * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.
20
+ * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,
21
+ * will have `autoExpand` flag.
22
+ */
23
+ autoExpand?: boolean | FilterTargetGroupingNodeInfo;
24
+ }
25
+ /**
26
+ * A path of hierarchy node identifiers for filtering the hierarchy with additional options.
27
+ * @beta
28
+ */
29
+ export type HierarchyFilteringPath = HierarchyNodeIdentifiersPath | {
30
+ path: HierarchyNodeIdentifiersPath;
31
+ options?: HierarchyFilteringPathOptions;
32
+ };
33
+ /** @beta */
34
+ export declare namespace HierarchyFilteringPath {
35
+ /**
36
+ * Normalizes the hierarchy filtering path to the object form.
37
+ * @beta
38
+ */
39
+ function normalize(source: HierarchyFilteringPath): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath>;
40
+ /**
41
+ * Merges two given `HierarchyFilteringPathOptions` objects.
42
+ * - if both inputs are `undefined`, `undefined` is returned,
43
+ * - else if one of the inputs is `undefined`, the other one is returned.
44
+ * - else, merge each option individually.
45
+ *
46
+ * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:
47
+ * - if one of the inputs is `true`, return `true`,
48
+ * - else if both inputs are objects, return the one with the greater `depth` attribute.
49
+ * - else, return `false` or `undefined`.
50
+ *
51
+ * @beta
52
+ */
53
+ function mergeOptions(lhs: HierarchyFilteringPathOptions | undefined, rhs: HierarchyFilteringPathOptions | undefined): HierarchyFilteringPathOptions | undefined;
54
+ }
55
+ /**
56
+ * An utility that extracts filtering properties from given root level filtering props or
57
+ * the parent node. Returns `undefined` if filtering props are not present.
58
+ * @beta
59
+ */
60
+ export declare function extractFilteringProps(rootLevelFilteringProps: HierarchyFilteringPath[], parentNode: Pick<NonGroupingHierarchyNode, "filtering"> | undefined): {
61
+ filteredNodePaths: HierarchyFilteringPath[];
62
+ hasFilterTargetAncestor: boolean;
63
+ } | undefined;
64
+ //# sourceMappingURL=HierarchyFiltering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HierarchyFiltering.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,YAAY;AACZ,MAAM,WAAW,4BAA4B;IAC3C,gCAAgC;IAChC,GAAG,EAAE,eAAe,CAAC;IAErB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,YAAY;AACZ,MAAM,WAAW,6BAA6B;IAC5C;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,4BAA4B,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAAG;IAAE,IAAI,EAAE,4BAA4B,CAAC;IAAC,OAAO,CAAC,EAAE,6BAA6B,CAAA;CAAE,CAAC;AACpJ,YAAY;AAEZ,yBAAiB,sBAAsB,CAAC;IACtC;;;OAGG;IACH,SAAgB,SAAS,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,EAAE,4BAA4B,CAAC,CAKvH;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,YAAY,CAC1B,GAAG,EAAE,6BAA6B,GAAG,SAAS,EAC9C,GAAG,EAAE,6BAA6B,GAAG,SAAS,GAC7C,6BAA6B,GAAG,SAAS,CAwB3C;CACF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,uBAAuB,EAAE,sBAAsB,EAAE,EACjD,UAAU,EAAE,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,GAAG,SAAS,GAEjE;IACE,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;IAC5C,uBAAuB,EAAE,OAAO,CAAC;CAClC,GACD,SAAS,CAUZ"}
@@ -0,0 +1,80 @@
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.HierarchyFilteringPath = void 0;
8
+ exports.extractFilteringProps = extractFilteringProps;
9
+ /** @beta */
10
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
11
+ var HierarchyFilteringPath;
12
+ (function (HierarchyFilteringPath) {
13
+ /**
14
+ * Normalizes the hierarchy filtering path to the object form.
15
+ * @beta
16
+ */
17
+ function normalize(source) {
18
+ if (Array.isArray(source)) {
19
+ return { path: source, options: undefined };
20
+ }
21
+ return source;
22
+ }
23
+ HierarchyFilteringPath.normalize = normalize;
24
+ /**
25
+ * Merges two given `HierarchyFilteringPathOptions` objects.
26
+ * - if both inputs are `undefined`, `undefined` is returned,
27
+ * - else if one of the inputs is `undefined`, the other one is returned.
28
+ * - else, merge each option individually.
29
+ *
30
+ * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:
31
+ * - if one of the inputs is `true`, return `true`,
32
+ * - else if both inputs are objects, return the one with the greater `depth` attribute.
33
+ * - else, return `false` or `undefined`.
34
+ *
35
+ * @beta
36
+ */
37
+ function mergeOptions(lhs, rhs) {
38
+ // istanbul ignore next
39
+ if (!lhs && !rhs) {
40
+ return undefined;
41
+ }
42
+ // istanbul ignore next
43
+ if (!lhs) {
44
+ return rhs;
45
+ }
46
+ // istanbul ignore next
47
+ if (!rhs) {
48
+ return lhs;
49
+ }
50
+ return {
51
+ autoExpand: (() => {
52
+ if (rhs.autoExpand === true) {
53
+ return rhs.autoExpand;
54
+ }
55
+ if (typeof lhs.autoExpand === "object" && typeof rhs.autoExpand === "object" && rhs.autoExpand.depth > lhs.autoExpand.depth) {
56
+ return rhs.autoExpand;
57
+ }
58
+ return lhs.autoExpand;
59
+ })(),
60
+ };
61
+ }
62
+ HierarchyFilteringPath.mergeOptions = mergeOptions;
63
+ })(HierarchyFilteringPath || (exports.HierarchyFilteringPath = HierarchyFilteringPath = {}));
64
+ /**
65
+ * An utility that extracts filtering properties from given root level filtering props or
66
+ * the parent node. Returns `undefined` if filtering props are not present.
67
+ * @beta
68
+ */
69
+ function extractFilteringProps(rootLevelFilteringProps, parentNode) {
70
+ if (!parentNode) {
71
+ return { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false };
72
+ }
73
+ return parentNode.filtering?.filteredChildrenIdentifierPaths
74
+ ? {
75
+ filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths,
76
+ hasFilterTargetAncestor: !!parentNode.filtering.hasFilterTargetAncestor || !!parentNode.filtering.isFilterTarget,
77
+ }
78
+ : undefined;
79
+ }
80
+ //# sourceMappingURL=HierarchyFiltering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HierarchyFiltering.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAiGhG,sDAkBC;AAhFD,YAAY;AACZ,2DAA2D;AAC3D,IAAiB,sBAAsB,CAqDtC;AArDD,WAAiB,sBAAsB;IACrC;;;OAGG;IACH,SAAgB,SAAS,CAAC,MAA8B;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;QAC9C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IALe,gCAAS,YAKxB,CAAA;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,YAAY,CAC1B,GAA8C,EAC9C,GAA8C;QAE9C,uBAAuB;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,uBAAuB;QACvB,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,GAAG,CAAC;QACb,CAAC;QACD,uBAAuB;QACvB,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO;YACL,UAAU,EAAE,CAAC,GAAgD,EAAE;gBAC7D,IAAI,GAAG,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;oBAC5B,OAAO,GAAG,CAAC,UAAU,CAAC;gBACxB,CAAC;gBACD,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;oBAC5H,OAAO,GAAG,CAAC,UAAU,CAAC;gBACxB,CAAC;gBACD,OAAO,GAAG,CAAC,UAAU,CAAC;YACxB,CAAC,CAAC,EAAE;SACL,CAAC;IACJ,CAAC;IA3Be,mCAAY,eA2B3B,CAAA;AACH,CAAC,EArDgB,sBAAsB,sCAAtB,sBAAsB,QAqDtC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CACnC,uBAAiD,EACjD,UAAmE;IAOnE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC;IACxF,CAAC;IACD,OAAO,UAAU,CAAC,SAAS,EAAE,+BAA+B;QAC1D,CAAC,CAAC;YACE,iBAAiB,EAAE,UAAU,CAAC,SAAS,CAAC,+BAA+B;YACvE,uBAAuB,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,uBAAuB,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc;SACjH;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,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 { NonGroupingHierarchyNode } from \"./HierarchyNode\";\nimport { HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier\";\nimport { GroupingNodeKey } from \"./HierarchyNodeKey\";\n\n/** @beta */\nexport interface FilterTargetGroupingNodeInfo {\n /** Key of the grouping node. */\n key: GroupingNodeKey;\n\n /**\n * Depth of the grouping node in the hierarchy.\n * Generally, it can be retrieved from `parentKeys.length`.\n */\n depth: number;\n}\n\n/** @beta */\nexport interface HierarchyFilteringPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.\n * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,\n * will have `autoExpand` flag.\n */\n autoExpand?: boolean | FilterTargetGroupingNodeInfo;\n}\n\n/**\n * A path of hierarchy node identifiers for filtering the hierarchy with additional options.\n * @beta\n */\nexport type HierarchyFilteringPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options?: HierarchyFilteringPathOptions };\n/** @beta */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyFilteringPath {\n /**\n * Normalizes the hierarchy filtering path to the object form.\n * @beta\n */\n export function normalize(source: HierarchyFilteringPath): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source, options: undefined };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchyFilteringPathOptions` objects.\n * - if both inputs are `undefined`, `undefined` is returned,\n * - else if one of the inputs is `undefined`, the other one is returned.\n * - else, merge each option individually.\n *\n * For the `autoExpand` attribute, the merge chooses to auto-expand as deep as the deepest input:\n * - if one of the inputs is `true`, return `true`,\n * - else if both inputs are objects, return the one with the greater `depth` attribute.\n * - else, return `false` or `undefined`.\n *\n * @beta\n */\n export function mergeOptions(\n lhs: HierarchyFilteringPathOptions | undefined,\n rhs: HierarchyFilteringPathOptions | undefined,\n ): HierarchyFilteringPathOptions | undefined {\n // istanbul ignore next\n if (!lhs && !rhs) {\n return undefined;\n }\n // istanbul ignore next\n if (!lhs) {\n return rhs;\n }\n // istanbul ignore next\n if (!rhs) {\n return lhs;\n }\n return {\n autoExpand: ((): HierarchyFilteringPathOptions[\"autoExpand\"] => {\n if (rhs.autoExpand === true) {\n return rhs.autoExpand;\n }\n if (typeof lhs.autoExpand === \"object\" && typeof rhs.autoExpand === \"object\" && rhs.autoExpand.depth > lhs.autoExpand.depth) {\n return rhs.autoExpand;\n }\n return lhs.autoExpand;\n })(),\n };\n }\n}\n\n/**\n * An utility that extracts filtering properties from given root level filtering props or\n * the parent node. Returns `undefined` if filtering props are not present.\n * @beta\n */\nexport function extractFilteringProps(\n rootLevelFilteringProps: HierarchyFilteringPath[],\n parentNode: Pick<NonGroupingHierarchyNode, \"filtering\"> | undefined,\n):\n | {\n filteredNodePaths: HierarchyFilteringPath[];\n hasFilterTargetAncestor: boolean;\n }\n | undefined {\n if (!parentNode) {\n return { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false };\n }\n return parentNode.filtering?.filteredChildrenIdentifierPaths\n ? {\n filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths,\n hasFilterTargetAncestor: !!parentNode.filtering.hasFilterTargetAncestor || !!parentNode.filtering.isFilterTarget,\n }\n : undefined;\n}\n"]}