@itwin/presentation-hierarchies 2.0.0-alpha.2 → 2.0.0-alpha.20

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 (427) hide show
  1. package/CHANGELOG.md +929 -12
  2. package/README.md +20 -50
  3. package/lib/hierarchies/HierarchyErrors.d.ts.map +1 -0
  4. package/lib/hierarchies/HierarchyErrors.js.map +1 -0
  5. package/lib/hierarchies/HierarchyMerge.d.ts +19 -0
  6. package/lib/hierarchies/HierarchyMerge.d.ts.map +1 -0
  7. package/lib/{esm/hierarchies/HierarchyProvider.js → hierarchies/HierarchyMerge.js} +5 -6
  8. package/lib/hierarchies/HierarchyMerge.js.map +1 -0
  9. package/lib/{esm/hierarchies → hierarchies}/HierarchyNode.d.ts +21 -28
  10. package/lib/hierarchies/HierarchyNode.d.ts.map +1 -0
  11. package/lib/{esm/hierarchies → hierarchies}/HierarchyNode.js +19 -21
  12. package/lib/hierarchies/HierarchyNode.js.map +1 -0
  13. package/lib/{cjs/hierarchies → hierarchies}/HierarchyNodeIdentifier.d.ts +3 -1
  14. package/lib/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -0
  15. package/lib/{esm/hierarchies → hierarchies}/HierarchyNodeIdentifier.js +23 -6
  16. package/lib/hierarchies/HierarchyNodeIdentifier.js.map +1 -0
  17. package/lib/{esm/hierarchies → hierarchies}/HierarchyNodeKey.d.ts +5 -4
  18. package/lib/hierarchies/HierarchyNodeKey.d.ts.map +1 -0
  19. package/lib/{esm/hierarchies → hierarchies}/HierarchyNodeKey.js +1 -1
  20. package/lib/hierarchies/HierarchyNodeKey.js.map +1 -0
  21. package/lib/{esm/hierarchies → hierarchies}/HierarchyProvider.d.ts +59 -34
  22. package/lib/hierarchies/HierarchyProvider.d.ts.map +1 -0
  23. package/lib/hierarchies/HierarchyProvider.js +61 -0
  24. package/lib/hierarchies/HierarchyProvider.js.map +1 -0
  25. package/lib/hierarchies/HierarchySearch.d.ts +297 -0
  26. package/lib/hierarchies/HierarchySearch.d.ts.map +1 -0
  27. package/lib/hierarchies/HierarchySearch.js +464 -0
  28. package/lib/hierarchies/HierarchySearch.js.map +1 -0
  29. package/lib/{cjs/hierarchies → hierarchies}/Logging.d.ts +1 -1
  30. package/lib/hierarchies/Logging.d.ts.map +1 -0
  31. package/lib/{esm/hierarchies → hierarchies}/Logging.js +1 -1
  32. package/lib/hierarchies/Logging.js.map +1 -0
  33. package/lib/{cjs/hierarchies → hierarchies}/imodel/HierarchyCache.d.ts +1 -1
  34. package/lib/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
  35. package/lib/{esm/hierarchies → hierarchies}/imodel/HierarchyCache.js +4 -7
  36. package/lib/hierarchies/imodel/HierarchyCache.js.map +1 -0
  37. package/lib/{esm/hierarchies → hierarchies}/imodel/IModelHierarchyDefinition.d.ts +34 -11
  38. package/lib/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
  39. package/lib/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
  40. package/lib/{cjs/hierarchies → hierarchies}/imodel/IModelHierarchyNode.d.ts +5 -5
  41. package/lib/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
  42. package/lib/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
  43. package/lib/hierarchies/imodel/IModelHierarchyProvider.d.ts +136 -0
  44. package/lib/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
  45. package/lib/hierarchies/imodel/IModelHierarchyProvider.js +656 -0
  46. package/lib/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
  47. package/lib/{esm/hierarchies → hierarchies}/imodel/LimitingECSqlQueryExecutor.d.ts +1 -1
  48. package/lib/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
  49. package/lib/{esm/hierarchies → hierarchies}/imodel/LimitingECSqlQueryExecutor.js +14 -11
  50. package/lib/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
  51. package/lib/{esm/hierarchies → hierarchies}/imodel/NodeSelectQueryFactory.d.ts +17 -12
  52. package/lib/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
  53. package/lib/{esm/hierarchies → hierarchies}/imodel/NodeSelectQueryFactory.js +214 -139
  54. package/lib/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
  55. package/lib/{cjs/hierarchies → hierarchies}/imodel/PredicateBasedHierarchyDefinition.d.ts +7 -7
  56. package/lib/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
  57. package/lib/{esm/hierarchies → hierarchies}/imodel/PredicateBasedHierarchyDefinition.js +3 -2
  58. package/lib/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
  59. package/lib/hierarchies/imodel/SearchHierarchyDefinition.d.ts +35 -0
  60. package/lib/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
  61. package/lib/hierarchies/imodel/SearchHierarchyDefinition.js +261 -0
  62. package/lib/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
  63. package/lib/{esm/hierarchies → hierarchies}/imodel/TreeNodesReader.d.ts +10 -12
  64. package/lib/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
  65. package/lib/{esm/hierarchies → hierarchies}/imodel/TreeNodesReader.js +12 -9
  66. package/lib/hierarchies/imodel/TreeNodesReader.js.map +1 -0
  67. package/lib/{cjs/hierarchies → hierarchies}/imodel/Utils.d.ts +2 -1
  68. package/lib/hierarchies/imodel/Utils.d.ts.map +1 -0
  69. package/lib/{esm/hierarchies → hierarchies}/imodel/Utils.js +20 -7
  70. package/lib/hierarchies/imodel/Utils.js.map +1 -0
  71. package/lib/{cjs/hierarchies → hierarchies}/imodel/operators/DetermineChildren.d.ts +2 -2
  72. package/lib/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
  73. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/DetermineChildren.js +11 -5
  74. package/lib/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
  75. package/lib/hierarchies/imodel/operators/Grouping.d.ts +26 -0
  76. package/lib/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
  77. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/Grouping.js +33 -19
  78. package/lib/hierarchies/imodel/operators/Grouping.js.map +1 -0
  79. package/lib/{cjs/hierarchies → hierarchies}/imodel/operators/HideIfNoChildren.d.ts +1 -1
  80. package/lib/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
  81. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/HideIfNoChildren.js +33 -10
  82. package/lib/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
  83. package/lib/{cjs/hierarchies → hierarchies}/imodel/operators/HideNodesInHierarchy.d.ts +1 -1
  84. package/lib/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
  85. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/HideNodesInHierarchy.js +31 -15
  86. package/lib/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
  87. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/AutoExpand.d.ts +1 -1
  88. package/lib/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
  89. package/lib/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
  90. package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts +11 -0
  91. package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
  92. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/BaseClassGrouping.js +10 -12
  93. package/lib/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
  94. package/lib/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts +7 -0
  95. package/lib/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
  96. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/ClassGrouping.js +8 -11
  97. package/lib/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
  98. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/GroupHiding.d.ts +1 -1
  99. package/lib/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
  100. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/GroupHiding.js +1 -5
  101. package/lib/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
  102. package/lib/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts +5 -0
  103. package/lib/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
  104. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/LabelGrouping.js +2 -10
  105. package/lib/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
  106. package/lib/{cjs/hierarchies → hierarchies}/imodel/operators/grouping/PropertiesGrouping.d.ts +7 -7
  107. package/lib/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
  108. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/PropertiesGrouping.js +46 -37
  109. package/lib/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
  110. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/Shared.d.ts +2 -2
  111. package/lib/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
  112. package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/Shared.js +3 -1
  113. package/lib/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
  114. package/lib/{esm/hierarchies → hierarchies}/internal/Common.d.ts +5 -2
  115. package/lib/hierarchies/internal/Common.d.ts.map +1 -0
  116. package/lib/{esm/hierarchies → hierarchies}/internal/Common.js +13 -3
  117. package/lib/hierarchies/internal/Common.js.map +1 -0
  118. package/lib/hierarchies/internal/DisposePolyfill.d.ts.map +1 -0
  119. package/lib/hierarchies/internal/DisposePolyfill.js.map +1 -0
  120. package/lib/{esm/hierarchies → hierarchies}/internal/LoggingUtils.d.ts +1 -1
  121. package/lib/hierarchies/internal/LoggingUtils.d.ts.map +1 -0
  122. package/lib/hierarchies/internal/LoggingUtils.js.map +1 -0
  123. package/lib/{esm/hierarchies → hierarchies}/internal/RxjsHierarchyDefinition.d.ts +19 -8
  124. package/lib/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -0
  125. package/lib/{esm/hierarchies → hierarchies}/internal/RxjsHierarchyDefinition.js +9 -6
  126. package/lib/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -0
  127. package/lib/{cjs/hierarchies → hierarchies}/internal/SubscriptionScheduler.d.ts +1 -1
  128. package/lib/hierarchies/internal/SubscriptionScheduler.d.ts.map +1 -0
  129. package/lib/{esm/hierarchies → hierarchies}/internal/SubscriptionScheduler.js +1 -4
  130. package/lib/hierarchies/internal/SubscriptionScheduler.js.map +1 -0
  131. package/lib/{cjs/hierarchies → hierarchies}/internal/operators/Partition.d.ts +2 -1
  132. package/lib/hierarchies/internal/operators/Partition.d.ts.map +1 -0
  133. package/lib/hierarchies/internal/operators/Partition.js.map +1 -0
  134. package/lib/{esm/hierarchies → hierarchies}/internal/operators/ReduceToMergeMap.d.ts +3 -3
  135. package/lib/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -0
  136. package/lib/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -0
  137. package/lib/{cjs/hierarchies → hierarchies}/internal/operators/ReleaseMainThread.d.ts +1 -1
  138. package/lib/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +1 -0
  139. package/lib/hierarchies/internal/operators/ReleaseMainThread.js.map +1 -0
  140. package/lib/{cjs/hierarchies → hierarchies}/internal/operators/ShareReplayWithErrors.d.ts +1 -1
  141. package/lib/hierarchies/internal/operators/ShareReplayWithErrors.d.ts.map +1 -0
  142. package/lib/hierarchies/internal/operators/ShareReplayWithErrors.js.map +1 -0
  143. package/lib/{cjs/hierarchies → hierarchies}/internal/operators/Sorting.d.ts +1 -1
  144. package/lib/hierarchies/internal/operators/Sorting.d.ts.map +1 -0
  145. package/lib/hierarchies/internal/operators/Sorting.js.map +1 -0
  146. package/lib/{esm/hierarchies → hierarchies}/internal/operators/TapOnce.d.ts +1 -1
  147. package/lib/hierarchies/internal/operators/TapOnce.d.ts.map +1 -0
  148. package/lib/hierarchies/internal/operators/TapOnce.js.map +1 -0
  149. package/lib/presentation-hierarchies.d.ts +24 -0
  150. package/lib/presentation-hierarchies.d.ts.map +1 -0
  151. package/lib/{esm/presentation-hierarchies.js → presentation-hierarchies.js} +7 -7
  152. package/lib/presentation-hierarchies.js.map +1 -0
  153. package/package.json +29 -39
  154. package/lib/cjs/hierarchies/HierarchyErrors.d.ts.map +0 -1
  155. package/lib/cjs/hierarchies/HierarchyErrors.js +0 -20
  156. package/lib/cjs/hierarchies/HierarchyErrors.js.map +0 -1
  157. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +0 -133
  158. package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +0 -1
  159. package/lib/cjs/hierarchies/HierarchyFiltering.js +0 -232
  160. package/lib/cjs/hierarchies/HierarchyFiltering.js.map +0 -1
  161. package/lib/cjs/hierarchies/HierarchyNode.d.ts +0 -156
  162. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +0 -1
  163. package/lib/cjs/hierarchies/HierarchyNode.js +0 -84
  164. package/lib/cjs/hierarchies/HierarchyNode.js.map +0 -1
  165. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +0 -1
  166. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +0 -35
  167. package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +0 -1
  168. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +0 -161
  169. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +0 -1
  170. package/lib/cjs/hierarchies/HierarchyNodeKey.js +0 -166
  171. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +0 -1
  172. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +0 -109
  173. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +0 -1
  174. package/lib/cjs/hierarchies/HierarchyProvider.js +0 -44
  175. package/lib/cjs/hierarchies/HierarchyProvider.js.map +0 -1
  176. package/lib/cjs/hierarchies/Logging.d.ts.map +0 -1
  177. package/lib/cjs/hierarchies/Logging.js +0 -27
  178. package/lib/cjs/hierarchies/Logging.js.map +0 -1
  179. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +0 -36
  180. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
  181. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +0 -283
  182. package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
  183. package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +0 -1
  184. package/lib/cjs/hierarchies/imodel/HierarchyCache.js +0 -84
  185. package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +0 -1
  186. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +0 -121
  187. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +0 -1
  188. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js +0 -21
  189. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +0 -1
  190. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +0 -1
  191. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js +0 -29
  192. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +0 -1
  193. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +0 -80
  194. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +0 -1
  195. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +0 -449
  196. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +0 -1
  197. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts +0 -21
  198. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +0 -1
  199. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js +0 -123
  200. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +0 -1
  201. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +0 -230
  202. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +0 -1
  203. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +0 -591
  204. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +0 -1
  205. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +0 -1
  206. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +0 -93
  207. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +0 -1
  208. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts +0 -37
  209. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +0 -1
  210. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +0 -44
  211. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +0 -1
  212. package/lib/cjs/hierarchies/imodel/Utils.d.ts.map +0 -1
  213. package/lib/cjs/hierarchies/imodel/Utils.js +0 -59
  214. package/lib/cjs/hierarchies/imodel/Utils.js.map +0 -1
  215. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +0 -1
  216. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js +0 -34
  217. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +0 -1
  218. package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts +0 -26
  219. package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +0 -1
  220. package/lib/cjs/hierarchies/imodel/operators/Grouping.js +0 -162
  221. package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +0 -1
  222. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +0 -1
  223. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js +0 -52
  224. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +0 -1
  225. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +0 -1
  226. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js +0 -68
  227. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +0 -1
  228. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts +0 -4
  229. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +0 -1
  230. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js +0 -26
  231. package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js.map +0 -1
  232. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts +0 -11
  233. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
  234. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +0 -114
  235. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +0 -1
  236. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts +0 -7
  237. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +0 -1
  238. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +0 -55
  239. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +0 -1
  240. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts +0 -4
  241. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +0 -1
  242. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js +0 -53
  243. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +0 -1
  244. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts +0 -5
  245. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +0 -1
  246. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js +0 -60
  247. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +0 -1
  248. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
  249. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +0 -309
  250. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +0 -1
  251. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts +0 -5
  252. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts.map +0 -1
  253. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js +0 -29
  254. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +0 -1
  255. package/lib/cjs/hierarchies/internal/Common.d.ts +0 -58
  256. package/lib/cjs/hierarchies/internal/Common.d.ts.map +0 -1
  257. package/lib/cjs/hierarchies/internal/Common.js +0 -80
  258. package/lib/cjs/hierarchies/internal/Common.js.map +0 -1
  259. package/lib/cjs/hierarchies/internal/DisposePolyfill.d.ts +0 -1
  260. package/lib/cjs/hierarchies/internal/DisposePolyfill.d.ts.map +0 -1
  261. package/lib/cjs/hierarchies/internal/DisposePolyfill.js +0 -11
  262. package/lib/cjs/hierarchies/internal/DisposePolyfill.js.map +0 -1
  263. package/lib/cjs/hierarchies/internal/EachValueFrom.d.ts +0 -12
  264. package/lib/cjs/hierarchies/internal/EachValueFrom.d.ts.map +0 -1
  265. package/lib/cjs/hierarchies/internal/EachValueFrom.js +0 -110
  266. package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +0 -1
  267. package/lib/cjs/hierarchies/internal/LoggingUtils.d.ts +0 -12
  268. package/lib/cjs/hierarchies/internal/LoggingUtils.d.ts.map +0 -1
  269. package/lib/cjs/hierarchies/internal/LoggingUtils.js +0 -37
  270. package/lib/cjs/hierarchies/internal/LoggingUtils.js.map +0 -1
  271. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts +0 -64
  272. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +0 -1
  273. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js +0 -25
  274. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +0 -1
  275. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.d.ts.map +0 -1
  276. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.js +0 -57
  277. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.js.map +0 -1
  278. package/lib/cjs/hierarchies/internal/operators/Partition.d.ts.map +0 -1
  279. package/lib/cjs/hierarchies/internal/operators/Partition.js +0 -60
  280. package/lib/cjs/hierarchies/internal/operators/Partition.js.map +0 -1
  281. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts +0 -22
  282. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +0 -1
  283. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js +0 -50
  284. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js.map +0 -1
  285. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +0 -1
  286. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.js +0 -24
  287. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.js.map +0 -1
  288. package/lib/cjs/hierarchies/internal/operators/ShareReplayWithErrors.d.ts.map +0 -1
  289. package/lib/cjs/hierarchies/internal/operators/ShareReplayWithErrors.js +0 -23
  290. package/lib/cjs/hierarchies/internal/operators/ShareReplayWithErrors.js.map +0 -1
  291. package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +0 -1
  292. package/lib/cjs/hierarchies/internal/operators/Sorting.js +0 -25
  293. package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +0 -1
  294. package/lib/cjs/hierarchies/internal/operators/TapOnce.d.ts +0 -4
  295. package/lib/cjs/hierarchies/internal/operators/TapOnce.d.ts.map +0 -1
  296. package/lib/cjs/hierarchies/internal/operators/TapOnce.js +0 -19
  297. package/lib/cjs/hierarchies/internal/operators/TapOnce.js.map +0 -1
  298. package/lib/cjs/package.json +0 -1
  299. package/lib/cjs/presentation-hierarchies.d.ts +0 -15
  300. package/lib/cjs/presentation-hierarchies.d.ts.map +0 -1
  301. package/lib/cjs/presentation-hierarchies.js +0 -40
  302. package/lib/cjs/presentation-hierarchies.js.map +0 -1
  303. package/lib/esm/hierarchies/HierarchyErrors.d.ts +0 -9
  304. package/lib/esm/hierarchies/HierarchyErrors.d.ts.map +0 -1
  305. package/lib/esm/hierarchies/HierarchyErrors.js.map +0 -1
  306. package/lib/esm/hierarchies/HierarchyFiltering.d.ts +0 -133
  307. package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +0 -1
  308. package/lib/esm/hierarchies/HierarchyFiltering.js +0 -227
  309. package/lib/esm/hierarchies/HierarchyFiltering.js.map +0 -1
  310. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +0 -1
  311. package/lib/esm/hierarchies/HierarchyNode.js.map +0 -1
  312. package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +0 -29
  313. package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +0 -1
  314. package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +0 -1
  315. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +0 -1
  316. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +0 -1
  317. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +0 -1
  318. package/lib/esm/hierarchies/HierarchyProvider.js.map +0 -1
  319. package/lib/esm/hierarchies/Logging.d.ts +0 -13
  320. package/lib/esm/hierarchies/Logging.d.ts.map +0 -1
  321. package/lib/esm/hierarchies/Logging.js.map +0 -1
  322. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +0 -36
  323. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
  324. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +0 -277
  325. package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
  326. package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts +0 -18
  327. package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +0 -1
  328. package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +0 -1
  329. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +0 -1
  330. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +0 -1
  331. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +0 -234
  332. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +0 -1
  333. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +0 -1
  334. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +0 -80
  335. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +0 -1
  336. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +0 -446
  337. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +0 -1
  338. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +0 -1
  339. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +0 -1
  340. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +0 -1
  341. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +0 -1
  342. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +0 -140
  343. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +0 -1
  344. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +0 -1
  345. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +0 -1
  346. package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +0 -1
  347. package/lib/esm/hierarchies/imodel/Utils.d.ts +0 -4
  348. package/lib/esm/hierarchies/imodel/Utils.d.ts.map +0 -1
  349. package/lib/esm/hierarchies/imodel/Utils.js.map +0 -1
  350. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts +0 -11
  351. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +0 -1
  352. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js.map +0 -1
  353. package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts +0 -26
  354. package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +0 -1
  355. package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +0 -1
  356. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts +0 -11
  357. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +0 -1
  358. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +0 -1
  359. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts +0 -11
  360. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +0 -1
  361. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +0 -1
  362. package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +0 -1
  363. package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.js.map +0 -1
  364. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts +0 -11
  365. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
  366. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +0 -1
  367. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts +0 -7
  368. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +0 -1
  369. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +0 -1
  370. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +0 -1
  371. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js.map +0 -1
  372. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts +0 -5
  373. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +0 -1
  374. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +0 -1
  375. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts +0 -32
  376. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
  377. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +0 -1
  378. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts.map +0 -1
  379. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js.map +0 -1
  380. package/lib/esm/hierarchies/internal/Common.d.ts.map +0 -1
  381. package/lib/esm/hierarchies/internal/Common.js.map +0 -1
  382. package/lib/esm/hierarchies/internal/DisposePolyfill.d.ts.map +0 -1
  383. package/lib/esm/hierarchies/internal/DisposePolyfill.js.map +0 -1
  384. package/lib/esm/hierarchies/internal/EachValueFrom.d.ts +0 -12
  385. package/lib/esm/hierarchies/internal/EachValueFrom.d.ts.map +0 -1
  386. package/lib/esm/hierarchies/internal/EachValueFrom.js +0 -107
  387. package/lib/esm/hierarchies/internal/EachValueFrom.js.map +0 -1
  388. package/lib/esm/hierarchies/internal/LoggingUtils.d.ts.map +0 -1
  389. package/lib/esm/hierarchies/internal/LoggingUtils.js.map +0 -1
  390. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +0 -1
  391. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js.map +0 -1
  392. package/lib/esm/hierarchies/internal/SubscriptionScheduler.d.ts +0 -17
  393. package/lib/esm/hierarchies/internal/SubscriptionScheduler.d.ts.map +0 -1
  394. package/lib/esm/hierarchies/internal/SubscriptionScheduler.js.map +0 -1
  395. package/lib/esm/hierarchies/internal/operators/Partition.d.ts +0 -6
  396. package/lib/esm/hierarchies/internal/operators/Partition.d.ts.map +0 -1
  397. package/lib/esm/hierarchies/internal/operators/Partition.js.map +0 -1
  398. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +0 -1
  399. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.js.map +0 -1
  400. package/lib/esm/hierarchies/internal/operators/ReleaseMainThread.d.ts +0 -7
  401. package/lib/esm/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +0 -1
  402. package/lib/esm/hierarchies/internal/operators/ReleaseMainThread.js.map +0 -1
  403. package/lib/esm/hierarchies/internal/operators/ShareReplayWithErrors.d.ts +0 -9
  404. package/lib/esm/hierarchies/internal/operators/ShareReplayWithErrors.d.ts.map +0 -1
  405. package/lib/esm/hierarchies/internal/operators/ShareReplayWithErrors.js.map +0 -1
  406. package/lib/esm/hierarchies/internal/operators/Sorting.d.ts +0 -13
  407. package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +0 -1
  408. package/lib/esm/hierarchies/internal/operators/Sorting.js.map +0 -1
  409. package/lib/esm/hierarchies/internal/operators/TapOnce.d.ts.map +0 -1
  410. package/lib/esm/hierarchies/internal/operators/TapOnce.js.map +0 -1
  411. package/lib/esm/presentation-hierarchies.d.ts +0 -15
  412. package/lib/esm/presentation-hierarchies.d.ts.map +0 -1
  413. package/lib/esm/presentation-hierarchies.js.map +0 -1
  414. /package/lib/{cjs/hierarchies → hierarchies}/HierarchyErrors.d.ts +0 -0
  415. /package/lib/{esm/hierarchies → hierarchies}/HierarchyErrors.js +0 -0
  416. /package/lib/{esm/hierarchies → hierarchies}/imodel/IModelHierarchyDefinition.js +0 -0
  417. /package/lib/{esm/hierarchies → hierarchies}/imodel/IModelHierarchyNode.js +0 -0
  418. /package/lib/{esm/hierarchies → hierarchies}/imodel/operators/grouping/AutoExpand.js +0 -0
  419. /package/lib/{esm/hierarchies → hierarchies}/internal/DisposePolyfill.d.ts +0 -0
  420. /package/lib/{esm/hierarchies → hierarchies}/internal/DisposePolyfill.js +0 -0
  421. /package/lib/{esm/hierarchies → hierarchies}/internal/LoggingUtils.js +0 -0
  422. /package/lib/{esm/hierarchies → hierarchies}/internal/operators/Partition.js +0 -0
  423. /package/lib/{esm/hierarchies → hierarchies}/internal/operators/ReduceToMergeMap.js +0 -0
  424. /package/lib/{esm/hierarchies → hierarchies}/internal/operators/ReleaseMainThread.js +0 -0
  425. /package/lib/{esm/hierarchies → hierarchies}/internal/operators/ShareReplayWithErrors.js +0 -0
  426. /package/lib/{esm/hierarchies → hierarchies}/internal/operators/Sorting.js +0 -0
  427. /package/lib/{esm/hierarchies → hierarchies}/internal/operators/TapOnce.js +0 -0
@@ -5,7 +5,7 @@
5
5
  import { concat, defer, EMPTY, filter, finalize, map, merge, mergeAll, mergeMap, take } from "rxjs";
6
6
  import { assert } from "@itwin/core-bentley";
7
7
  import { HierarchyNodeKey } from "../../HierarchyNodeKey.js";
8
- import { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from "../../internal/Common.js";
8
+ import { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL, } from "../../internal/Common.js";
9
9
  import { doLog, log } from "../../internal/LoggingUtils.js";
10
10
  import { partition } from "../../internal/operators/Partition.js";
11
11
  import { reduceToMergeMapItem } from "../../internal/operators/ReduceToMergeMap.js";
@@ -21,12 +21,17 @@ export const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, L
21
21
  */
22
22
  export function createHideNodesInHierarchyOperator(getNodes, stopOnFirstChild) {
23
23
  return function (nodes) {
24
- const inputNodes = nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));
25
- const [withFlag, withoutFlag] = partition(inputNodes, (n) => (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideInHierarchy);
24
+ const inputNodes = nodes.pipe(
25
+ /* v8 ignore next -- @preserve */
26
+ log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }));
27
+ const [withFlag, withoutFlag] = partition(inputNodes, (n) => (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) &&
28
+ !!n.processingParams?.hideInHierarchy);
26
29
  // Defer to create a new seed for reduce on every subscribe
27
- const withLoadedChildren = defer(() => withFlag.pipe(log({
30
+ const withLoadedChildren = defer(() => withFlag.pipe(
31
+ /* v8 ignore next -- @preserve */
32
+ log({
28
33
  category: LOGGING_NAMESPACE,
29
- message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,
34
+ message: (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,
30
35
  }), filter((node) => node.children !== false), reduceToMergeMapItem((node) => createMergeMapKey(node), (node, mergedNode) => {
31
36
  if (mergedNode) {
32
37
  if (ProcessedHierarchyNode.isGeneric(mergedNode)) {
@@ -37,22 +42,33 @@ export function createHideNodesInHierarchyOperator(getNodes, stopOnFirstChild) {
37
42
  return mergeInstanceNodes(mergedNode, node);
38
43
  }
39
44
  return node;
40
- }), log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (mm) => `created a merge map of size ${mm.size}` }), mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))), mergeAll(), map((n) => n)));
41
- return merge(withoutFlag.pipe(log({
45
+ }),
46
+ /* v8 ignore next -- @preserve */
47
+ log({ category: LOGGING_NAMESPACE, message: (mm) => `created a merge map of size ${mm.size}` }), mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))), mergeAll(), map((n) => n)));
48
+ return merge(withoutFlag.pipe(
49
+ /* v8 ignore next -- @preserve */
50
+ log({
42
51
  category: LOGGING_NAMESPACE,
43
- message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,
52
+ message: (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,
44
53
  })), stopOnFirstChild
45
54
  ? concat(
46
55
  // a small hack to handle situation when we're here to only check if parent node has children and one of them has `hideIfNoChildren` flag
47
56
  // with a `hasChildren = true` - we just return the hidden node itself in that case to avoid digging deeper into the hierarchy
48
- inputNodes.pipe(filter(hasChildren), log({
57
+ inputNodes.pipe(filter(hasChildren),
58
+ /* v8 ignore next -- @preserve */
59
+ log({
49
60
  category: LOGGING_NAMESPACE,
50
- message: /* c8 ignore next */ (n) => `\`stopOnFirstChild = true\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,
51
- })), EMPTY.pipe(finalize(() => doLog({
52
- category: LOGGING_NAMESPACE,
53
- message: /* c8 ignore next */ () => `\`stopOnFirstChild = true\` but none of the nodes had children determined to \`true\` - do load children`,
54
- }))), withLoadedChildren).pipe(take(1))
55
- : withLoadedChildren).pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
61
+ message: (n) => `\`stopOnFirstChild = true\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,
62
+ })), EMPTY.pipe(finalize(() => {
63
+ /* v8 ignore next -- @preserve */
64
+ doLog({
65
+ category: LOGGING_NAMESPACE,
66
+ message: () => `\`stopOnFirstChild = true\` but none of the nodes had children determined to \`true\` - do load children`,
67
+ });
68
+ })), withLoadedChildren).pipe(take(1))
69
+ : withLoadedChildren).pipe(
70
+ /* v8 ignore next -- @preserve */
71
+ log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
56
72
  };
57
73
  }
58
74
  function createMergeMapKey(node) {
@@ -0,0 +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CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAA2D,IAAW;IAC9F,IAAI,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5C,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 { concat, defer, EMPTY, filter, finalize, map, merge, mergeAll, mergeMap, take } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeKey } from \"../../HierarchyNodeKey.js\";\nimport {\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n hasChildren,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { partition } from \"../../internal/operators/Partition.js\";\nimport { reduceToMergeMapItem } from \"../../internal/operators/ReduceToMergeMap.js\";\nimport { ProcessedHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport { mergeInstanceNodes } from \"../Utils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GenericNodeKey, InstancesNodeKey } from \"../../HierarchyNodeKey.js\";\nimport type { ProcessedGenericHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nconst OPERATOR_NAME = \"HideNodesInHierarchy\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Creates an operator that hides nodes and instead returns their children if the nodes have a `hideInHierarchy` handling param.\n *\n * @internal\n */\nexport function createHideNodesInHierarchyOperator(\n getNodes: (parentNode: ProcessedHierarchyNode) => Observable<ProcessedHierarchyNode>,\n stopOnFirstChild: boolean,\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n const inputNodes = nodes.pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n );\n const [withFlag, withoutFlag] = partition(\n inputNodes,\n (n): n is ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode =>\n (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) &&\n !!n.processingParams?.hideInHierarchy,\n );\n // Defer to create a new seed for reduce on every subscribe\n const withLoadedChildren = defer(() =>\n withFlag.pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,\n }),\n filter((node) => node.children !== false),\n reduceToMergeMapItem(\n (node) => createMergeMapKey(node),\n (node, mergedNode: ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode | undefined) => {\n if (mergedNode) {\n if (ProcessedHierarchyNode.isGeneric(mergedNode)) {\n // we don't merge generic nodes, just return the first one\n return mergedNode;\n }\n assert(ProcessedHierarchyNode.isInstancesNode(node));\n return mergeInstanceNodes(mergedNode, node);\n }\n return node;\n },\n ),\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (mm) => `created a merge map of size ${mm.size}` }),\n mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))),\n mergeAll(),\n map((n): ProcessedHierarchyNode => n),\n ),\n );\n\n return merge(\n withoutFlag.pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,\n }),\n ),\n stopOnFirstChild\n ? concat(\n // a small hack to handle situation when we're here to only check if parent node has children and one of them has `hideIfNoChildren` flag\n // with a `hasChildren = true` - we just return the hidden node itself in that case to avoid digging deeper into the hierarchy\n inputNodes.pipe(\n filter(hasChildren),\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) =>\n `\\`stopOnFirstChild = true\\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,\n }),\n ),\n EMPTY.pipe(\n finalize(() => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE,\n message: () =>\n `\\`stopOnFirstChild = true\\` but none of the nodes had children determined to \\`true\\` - do load children`,\n });\n }),\n ),\n withLoadedChildren,\n ).pipe(take(1))\n : withLoadedChildren,\n ).pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\nfunction createMergeMapKey<TNode extends { key: InstancesNodeKey | GenericNodeKey }>(node: TNode): string {\n if (HierarchyNodeKey.isGeneric(node.key)) {\n return `${node.key.source ? `${node.key.source}:` : \"\"}${node.key.id}`;\n }\n return node.key.instanceKeys[0].className;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { GroupingHandlerResult } from "../Grouping.js";
1
+ import type { GroupingHandlerResult } from "../Grouping.js";
2
2
  /** @internal */
3
3
  export declare function assignAutoExpand(props: GroupingHandlerResult): GroupingHandlerResult;
4
4
  //# sourceMappingURL=AutoExpand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoExpand.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/AutoExpand.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,qBAAqB,CAepF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoExpand.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/AutoExpand.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAK7D,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,cAAuD,CAAC;QAC5D,8BAA8B,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,EAAE;YACzE,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,cAAc,GAAG,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;YACvF,OAAO;QACT,CAAC,CAAC,CAAC;QACH,IAAI,cAAc,KAAK,QAAQ,IAAI,CAAC,cAAc,KAAK,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACrG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { iterateChildNodeGroupingParams } from \"./Shared.js\";\n\nimport type { HierarchyNodeAutoExpandProp } from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandlerResult } from \"../Grouping.js\";\n\n/** @internal */\nexport function assignAutoExpand(props: GroupingHandlerResult): GroupingHandlerResult {\n for (const node of props.grouped) {\n let autoExpandProp: HierarchyNodeAutoExpandProp | undefined;\n iterateChildNodeGroupingParams(node, props.groupingType, (groupingProps) => {\n if (autoExpandProp === \"always\") {\n return true;\n }\n autoExpandProp = groupingProps?.autoExpand ? groupingProps.autoExpand : autoExpandProp;\n return;\n });\n if (autoExpandProp === \"always\" || (autoExpandProp === \"single-child\" && node.children.length === 1)) {\n node.autoExpand = true;\n }\n }\n return props;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { EC, ECSchemaProvider } from "@itwin/presentation-shared";
2
+ import type { ParentHierarchyNode } from "../../../HierarchyNode.js";
3
+ import type { ProcessedInstanceHierarchyNode } from "../../IModelHierarchyNode.js";
4
+ import type { GroupingHandler, GroupingHandlerResult } from "../Grouping.js";
5
+ /** @internal */
6
+ export declare function getBaseClassGroupingECClasses(schemaProvider: ECSchemaProvider, parentNode: ParentHierarchyNode | undefined, nodes: ProcessedInstanceHierarchyNode[]): Promise<EC.Class[]>;
7
+ /** @internal */
8
+ export declare function createBaseClassGroupsForSingleBaseClass(nodes: ProcessedInstanceHierarchyNode[], baseECClass: EC.Class, classHierarchyInspector: Pick<ECSchemaProvider, "classDerivesFrom">): Promise<GroupingHandlerResult>;
9
+ /** @internal */
10
+ export declare function createBaseClassGroupingHandlers(imodelAccess: ECSchemaProvider, parentNode: ParentHierarchyNode | undefined, nodes: ProcessedInstanceHierarchyNode[]): Promise<GroupingHandler[]>;
11
+ //# sourceMappingURL=BaseClassGrouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseClassGrouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,gBAAgB;AAChB,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CA2BrB;AAED,gBAAgB;AAChB,wBAAsB,uCAAuC,CAC3D,KAAK,EAAE,8BAA8B,EAAE,EACvC,WAAW,EAAE,EAAE,CAAC,KAAK,EACrB,uBAAuB,EAAE,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAClE,OAAO,CAAC,qBAAqB,CAAC,CA0ChC;AAsCD,gBAAgB;AAChB,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,eAAe,EAAE,CAAC,CAK5B"}
@@ -8,7 +8,7 @@ import { HierarchyNode } from "../../../HierarchyNode.js";
8
8
  export async function getBaseClassGroupingECClasses(schemaProvider, parentNode, nodes) {
9
9
  // Get all base class names that are provided in the grouping information
10
10
  const baseClassesFullClassNames = await getGroupingBaseClassNames(nodes);
11
- if (baseClassesFullClassNames.size === 0) {
11
+ if (baseClassesFullClassNames.length === 0) {
12
12
  return [];
13
13
  }
14
14
  const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();
@@ -17,7 +17,7 @@ export async function getBaseClassGroupingECClasses(schemaProvider, parentNode,
17
17
  await releaseMainThread();
18
18
  baseClasses.push(await getClass(schemaProvider, fullName));
19
19
  }
20
- const sortedClasses = await sortByBaseClass(baseClasses.filter((baseClass) => baseClass.isRelationshipClass() || baseClass.isEntityClass()));
20
+ const sortedClasses = sortByBaseClass(baseClasses.filter((baseClass) => baseClass.isRelationshipClass() || baseClass.isEntityClass()));
21
21
  if (parentNode && HierarchyNode.isClassGroupingNode(parentNode)) {
22
22
  // if we have a class grouping node, we can cut the front of sortedClasses up to a point where our grouping class is
23
23
  const cutPosition = sortedClasses.findIndex((c) => c.fullName === parentNode.key.className);
@@ -37,14 +37,15 @@ export async function createBaseClassGroupsForSingleBaseClass(nodes, baseECClass
37
37
  for (const node of nodes) {
38
38
  await releaseMainThread();
39
39
  if (!node.processingParams?.grouping?.byBaseClasses ||
40
- !node.processingParams.grouping.byBaseClasses.fullClassNames.some((className) => className === baseClassFullName)) {
40
+ !node.processingParams.grouping.byBaseClasses.fullClassNames.includes(baseClassFullName)) {
41
41
  ungroupedNodes.push(node);
42
42
  continue;
43
43
  }
44
44
  const fullCurrentNodeClassName = node.key.instanceKeys[0].className;
45
45
  const baseCheckerResult = classHierarchyInspector.classDerivesFrom(fullCurrentNodeClassName, baseClassFullName);
46
- /* c8 ignore next */
47
- const isCurrentNodeClassOfBase = baseCheckerResult instanceof Promise ? await baseCheckerResult : baseCheckerResult;
46
+ const isCurrentNodeClassOfBase = baseCheckerResult instanceof Promise
47
+ ? await baseCheckerResult
48
+ : /* v8 ignore next -- @preserve */ baseCheckerResult;
48
49
  if (isCurrentNodeClassOfBase) {
49
50
  groupedNodes.push(node);
50
51
  }
@@ -54,10 +55,7 @@ export async function createBaseClassGroupsForSingleBaseClass(nodes, baseECClass
54
55
  }
55
56
  const result = { grouped: [], ungrouped: ungroupedNodes, groupingType: "base-class" };
56
57
  if (groupedNodes.length > 0) {
57
- const groupingNodeKey = {
58
- type: "class-grouping",
59
- className: baseClassFullName,
60
- };
58
+ const groupingNodeKey = { type: "class-grouping", className: baseClassFullName };
61
59
  result.grouped.push({
62
60
  label: baseECClass.label ?? baseECClass.name,
63
61
  key: groupingNodeKey,
@@ -79,9 +77,9 @@ async function getGroupingBaseClassNames(nodes) {
79
77
  }
80
78
  }
81
79
  }
82
- return baseClasses;
80
+ return [...baseClasses];
83
81
  }
84
- async function sortByBaseClass(classes) {
82
+ function sortByBaseClass(classes) {
85
83
  if (classes.length === 0) {
86
84
  return classes;
87
85
  }
@@ -89,7 +87,7 @@ async function sortByBaseClass(classes) {
89
87
  for (let inputIndex = 1; inputIndex < classes.length; ++inputIndex) {
90
88
  let wasAdded = false;
91
89
  for (let outputIndex = output.length - 1; outputIndex >= 0; --outputIndex) {
92
- if (await classes[inputIndex].is(output[outputIndex])) {
90
+ if (classes[inputIndex].is(output[outputIndex])) {
93
91
  output.splice(outputIndex + 1, 0, classes[inputIndex]);
94
92
  wasAdded = true;
95
93
  break;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseClassGrouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,0CAA0C,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAQ1D,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,cAAgC,EAChC,UAA2C,EAC3C,KAAuC;IAEvC,yEAAyE;IACzE,MAAM,yBAAyB,GAAG,MAAM,yBAAyB,CAAC,KAAK,CAAC,CAAC;IACzE,IAAI,yBAAyB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,iBAAiB,GAAG,0CAA0C,EAAE,CAAC;IACvE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,QAAQ,IAAI,yBAAyB,EAAE,CAAC;QACjD,MAAM,iBAAiB,EAAE,CAAC;QAC1B,WAAW,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,aAAa,GAAG,eAAe,CACnC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CA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Q,EAAE,CAAC;YACd,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,YAA8B,EAC9B,UAA2C,EAC3C,KAAuC;IAEvC,MAAM,0BAA0B,GAAG,MAAM,6BAA6B,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACxG,OAAO,0BAA0B,CAAC,GAAG,CACnC,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,uCAAuC,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,CAClH,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 { createMainThreadReleaseOnTimePassedHandler, getClass } from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../../../HierarchyNode.js\";\n\nimport type { EC, ECSchemaProvider } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../../HierarchyNode.js\";\nimport type { ClassGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type { ProcessedInstanceHierarchyNode } from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandler, GroupingHandlerResult } from \"../Grouping.js\";\n\n/** @internal */\nexport async function getBaseClassGroupingECClasses(\n schemaProvider: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<EC.Class[]> {\n // Get all base class names that are provided in the grouping information\n const baseClassesFullClassNames = await getGroupingBaseClassNames(nodes);\n if (baseClassesFullClassNames.length === 0) {\n return [];\n }\n\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const baseClasses = [];\n for (const fullName of baseClassesFullClassNames) {\n await releaseMainThread();\n baseClasses.push(await getClass(schemaProvider, fullName));\n }\n const sortedClasses = sortByBaseClass(\n baseClasses.filter((baseClass) => baseClass.isRelationshipClass() || baseClass.isEntityClass()),\n );\n\n if (parentNode && HierarchyNode.isClassGroupingNode(parentNode)) {\n // if we have a class grouping node, we can cut the front of sortedClasses up to a point where our grouping class is\n const cutPosition = sortedClasses.findIndex((c) => c.fullName === parentNode.key.className);\n if (cutPosition >= 0) {\n return sortedClasses.slice(cutPosition + 1);\n }\n return [];\n }\n\n return sortedClasses;\n}\n\n/** @internal */\nexport async function createBaseClassGroupsForSingleBaseClass(\n nodes: ProcessedInstanceHierarchyNode[],\n baseECClass: EC.Class,\n classHierarchyInspector: Pick<ECSchemaProvider, \"classDerivesFrom\">,\n): Promise<GroupingHandlerResult> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const groupedNodes = new Array<ProcessedInstanceHierarchyNode>();\n const ungroupedNodes = new Array<ProcessedInstanceHierarchyNode>();\n const baseClassFullName = baseECClass.fullName;\n for (const node of nodes) {\n await releaseMainThread();\n if (\n !node.processingParams?.grouping?.byBaseClasses ||\n !node.processingParams.grouping.byBaseClasses.fullClassNames.includes(baseClassFullName)\n ) {\n ungroupedNodes.push(node);\n continue;\n }\n const fullCurrentNodeClassName = node.key.instanceKeys[0].className;\n\n const baseCheckerResult = classHierarchyInspector.classDerivesFrom(fullCurrentNodeClassName, baseClassFullName);\n\n const isCurrentNodeClassOfBase =\n baseCheckerResult instanceof Promise\n ? await baseCheckerResult\n : /* v8 ignore next -- @preserve */ baseCheckerResult;\n\n if (isCurrentNodeClassOfBase) {\n groupedNodes.push(node);\n } else {\n ungroupedNodes.push(node);\n }\n }\n\n const result: GroupingHandlerResult = { grouped: [], ungrouped: ungroupedNodes, groupingType: \"base-class\" };\n if (groupedNodes.length > 0) {\n const groupingNodeKey: ClassGroupingNodeKey = { type: \"class-grouping\", className: baseClassFullName };\n result.grouped.push({\n label: baseECClass.label ?? baseECClass.name,\n key: groupingNodeKey,\n parentKeys: [...groupedNodes[0].parentKeys],\n groupedInstanceKeys: groupedNodes.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: groupedNodes.map((gn) => Object.assign(gn, { parentKeys: [...gn.parentKeys, groupingNodeKey] })),\n });\n }\n return result;\n}\n\nasync function getGroupingBaseClassNames(nodes: ProcessedInstanceHierarchyNode[]) {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const baseClasses = new Set<EC.FullClassNameDotNotation>();\n for (const node of nodes) {\n await releaseMainThread();\n if (node.processingParams?.grouping?.byBaseClasses) {\n for (const className of node.processingParams.grouping.byBaseClasses.fullClassNames) {\n baseClasses.add(className);\n }\n }\n }\n return [...baseClasses];\n}\n\nfunction sortByBaseClass(classes: EC.Class[]): EC.Class[] {\n if (classes.length === 0) {\n return classes;\n }\n const output: EC.Class[] = [classes[0]];\n for (let inputIndex = 1; inputIndex < classes.length; ++inputIndex) {\n let wasAdded = false;\n for (let outputIndex = output.length - 1; outputIndex >= 0; --outputIndex) {\n if (classes[inputIndex].is(output[outputIndex])) {\n output.splice(outputIndex + 1, 0, classes[inputIndex]);\n wasAdded = true;\n break;\n }\n }\n if (!wasAdded) {\n output.splice(0, 0, classes[inputIndex]);\n }\n }\n\n return output;\n}\n\n/** @internal */\nexport async function createBaseClassGroupingHandlers(\n imodelAccess: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<GroupingHandler[]> {\n const baseClassGroupingECClasses = await getBaseClassGroupingECClasses(imodelAccess, parentNode, nodes);\n return baseClassGroupingECClasses.map(\n (baseECClass) => async (allNodes) => createBaseClassGroupsForSingleBaseClass(allNodes, baseECClass, imodelAccess),\n );\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import type { ECSchemaProvider } from "@itwin/presentation-shared";
2
+ import type { ParentHierarchyNode } from "../../../HierarchyNode.js";
3
+ import type { ProcessedInstanceHierarchyNode } from "../../IModelHierarchyNode.js";
4
+ import type { GroupingHandlerResult } from "../Grouping.js";
5
+ /** @internal */
6
+ export declare function createClassGroups(schemaProvider: ECSchemaProvider, parentNode: ParentHierarchyNode | undefined, nodes: ProcessedInstanceHierarchyNode[]): Promise<GroupingHandlerResult>;
7
+ //# sourceMappingURL=ClassGrouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassGrouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/ClassGrouping.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAM,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAA2C,MAAM,gBAAgB,CAAC;AAarG,gBAAgB;AAChB,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,qBAAqB,CAAC,CA2BhC"}
@@ -7,19 +7,19 @@ import { HierarchyNode } from "../../../HierarchyNode.js";
7
7
  /** @internal */
8
8
  export async function createClassGroups(schemaProvider, parentNode, nodes) {
9
9
  const parentNodeClass = parentNode && HierarchyNode.isClassGroupingNode(parentNode) ? parentNode.key.className : undefined;
10
- const groupings = { ungrouped: [], grouped: new Map() };
10
+ const groupings = {
11
+ ungrouped: [],
12
+ grouped: new Map(),
13
+ };
11
14
  const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();
12
15
  for (const node of nodes) {
13
16
  await releaseMainThread();
14
17
  const nodeClassName = node.key.instanceKeys[0].className;
15
- if (node.processingParams?.grouping?.byClass && nodeClassName !== parentNodeClass) {
18
+ if (node.processingParams?.grouping?.byClass && (!parentNodeClass || nodeClassName !== parentNodeClass)) {
16
19
  let groupingInfo = groupings.grouped.get(nodeClassName);
17
20
  if (!groupingInfo) {
18
21
  const nodeClass = await getClass(schemaProvider, nodeClassName);
19
- groupingInfo = {
20
- class: nodeClass,
21
- groupedNodes: [],
22
- };
22
+ groupingInfo = { class: nodeClass, groupedNodes: [] };
23
23
  groupings.grouped.set(nodeClassName, groupingInfo);
24
24
  }
25
25
  groupingInfo.groupedNodes.push(node);
@@ -32,12 +32,9 @@ export async function createClassGroups(schemaProvider, parentNode, nodes) {
32
32
  async function createGroupingNodes(groupings) {
33
33
  const groupedNodes = new Array();
34
34
  const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();
35
- for (const [, entry] of groupings.grouped) {
35
+ for (const entry of groupings.grouped.values()) {
36
36
  await releaseMainThread();
37
- const groupingNodeKey = {
38
- type: "class-grouping",
39
- className: entry.class.fullName,
40
- };
37
+ const groupingNodeKey = { type: "class-grouping", className: entry.class.fullName };
41
38
  const groupedNodeParentKeys = entry.groupedNodes[0].parentKeys;
42
39
  groupedNodes.push({
43
40
  label: entry.class.label ?? entry.class.name,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassGrouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/ClassGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,0CAA0C,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAmB1D,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,cAAgC,EAChC,UAA2C,EAC3C,KAAuC;IAEvC,MAAM,eAAe,GACnB,UAAU,IAAI,aAAa,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,C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,iBAAiB,EAAE,CAAC;QAC1B,MAAM,eAAe,GAAyB,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC1G,MAAM,qBAAqB,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAC/D,YAAY,CAAC,IAAI,CAAC;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI;YAC5C,GAAG,EAAE,eAAe;YACpB,UAAU,EAAE,qBAAqB;YACjC,mBAAmB,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC;YAC9G,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CACtC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,qBAAqB,EAAE,eAAe,CAAC,EAAE,CAAC,CAC/E;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAC1F,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 { createMainThreadReleaseOnTimePassedHandler, getClass } from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../../../HierarchyNode.js\";\n\nimport type { EC, ECSchemaProvider } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../../HierarchyNode.js\";\nimport type { ClassGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type { ProcessedInstanceHierarchyNode } from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandlerResult, ProcessedInstancesGroupingHierarchyNode } from \"../Grouping.js\";\n\ninterface ClassInfo {\n fullName: EC.FullClassNameDotNotation;\n name: string;\n label?: string;\n}\n\ninterface ClassGroupingInformation {\n ungrouped: ProcessedInstanceHierarchyNode[];\n grouped: Map<EC.FullClassNameDotNotation, { class: ClassInfo; groupedNodes: ProcessedInstanceHierarchyNode[] }>;\n}\n\n/** @internal */\nexport async function createClassGroups(\n schemaProvider: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<GroupingHandlerResult> {\n const parentNodeClass =\n parentNode && HierarchyNode.isClassGroupingNode(parentNode) ? parentNode.key.className : undefined;\n const groupings: ClassGroupingInformation = {\n ungrouped: [],\n grouped: new Map<\n EC.FullClassNameDotNotation,\n { class: ClassInfo; groupedNodes: ProcessedInstanceHierarchyNode[] }\n >(),\n };\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n for (const node of nodes) {\n await releaseMainThread();\n const nodeClassName = node.key.instanceKeys[0].className;\n if (node.processingParams?.grouping?.byClass && (!parentNodeClass || nodeClassName !== parentNodeClass)) {\n let groupingInfo = groupings.grouped.get(nodeClassName);\n if (!groupingInfo) {\n const nodeClass = await getClass(schemaProvider, nodeClassName);\n groupingInfo = { class: nodeClass, groupedNodes: [] };\n groupings.grouped.set(nodeClassName, groupingInfo);\n }\n groupingInfo.groupedNodes.push(node);\n continue;\n }\n groupings.ungrouped.push(node);\n }\n return createGroupingNodes(groupings);\n}\n\nasync function createGroupingNodes(groupings: ClassGroupingInformation): Promise<GroupingHandlerResult> {\n const groupedNodes = new Array<ProcessedInstancesGroupingHierarchyNode>();\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n for (const entry of groupings.grouped.values()) {\n await releaseMainThread();\n const groupingNodeKey: ClassGroupingNodeKey = { type: \"class-grouping\", className: entry.class.fullName };\n const groupedNodeParentKeys = entry.groupedNodes[0].parentKeys;\n groupedNodes.push({\n label: entry.class.label ?? entry.class.name,\n key: groupingNodeKey,\n parentKeys: groupedNodeParentKeys,\n groupedInstanceKeys: entry.groupedNodes.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: entry.groupedNodes.map((gn) =>\n Object.assign(gn, { parentKeys: [...groupedNodeParentKeys, groupingNodeKey] }),\n ),\n });\n }\n return { grouped: groupedNodes, ungrouped: groupings.ungrouped, groupingType: \"class\" };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { GroupingHandlerResult } from "../Grouping.js";
1
+ import type { GroupingHandlerResult } from "../Grouping.js";
2
2
  /** @internal */
3
3
  export declare function applyGroupHidingParams(props: GroupingHandlerResult, extraSiblings: number): GroupingHandlerResult;
4
4
  //# sourceMappingURL=GroupHiding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupHiding.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/GroupHiding.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAyD,MAAM,gBAAgB,CAAC;AAEnH,gBAAgB;AAChB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,GAAG,qBAAqB,CA2BjH"}
@@ -28,11 +28,7 @@ export function applyGroupHidingParams(props, extraSiblings) {
28
28
  }
29
29
  filteredGrouped.push(node);
30
30
  }
31
- return {
32
- groupingType,
33
- grouped: filteredGrouped,
34
- ungrouped,
35
- };
31
+ return { groupingType, grouped: filteredGrouped, ungrouped };
36
32
  }
37
33
  function getHideOptionsFromNodeProcessingParams(groupingNode, groupingType) {
38
34
  let hideIfNoSiblings = false;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupHiding.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/GroupHiding.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,8BA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CAC7C,YAAqD,EACrD,YAA0B;IAE1B,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,8BAA8B,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,aAAa,EAAE,EAAE;QAC3E,IAAI,gBAAgB,IAAI,oBAAoB,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,gBAAgB,KAAK,CAAC,CAAC,aAAa,EAAE,gBAAgB,CAAC;QACvD,oBAAoB,KAAK,CAAC,CAAC,aAAa,EAAE,oBAAoB,CAAC;QAC/D,OAAO;IACT,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC;AACpD,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 { iterateChildNodeGroupingParams } from \"./Shared.js\";\n\nimport type { GroupingHandlerResult, GroupingType, ProcessedInstancesGroupingHierarchyNode } from \"../Grouping.js\";\n\n/** @internal */\nexport function applyGroupHidingParams(props: GroupingHandlerResult, extraSiblings: number): GroupingHandlerResult {\n const { grouped, ungrouped, groupingType } = props;\n if (grouped.length === 0) {\n return props;\n }\n\n // handle the \"no siblings\" case\n if (grouped.length === 1 && ungrouped.length === 0 && extraSiblings === 0) {\n const hideParams = getHideOptionsFromNodeProcessingParams(grouped[0], groupingType);\n if (hideParams.hideIfNoSiblings) {\n return { groupingType, grouped: [], ungrouped: grouped[0].children };\n }\n }\n\n // handle the \"no children\" case\n const filteredGrouped = new Array<ProcessedInstancesGroupingHierarchyNode>();\n for (const node of grouped) {\n if (node.children.length === 1) {\n const hideParams = getHideOptionsFromNodeProcessingParams(node, groupingType);\n if (hideParams.hideIfOneGroupedNode) {\n ungrouped.push(node.children[0]);\n continue;\n }\n }\n filteredGrouped.push(node);\n }\n return { groupingType, grouped: filteredGrouped, ungrouped };\n}\n\nfunction getHideOptionsFromNodeProcessingParams(\n groupingNode: ProcessedInstancesGroupingHierarchyNode,\n groupingType: GroupingType,\n): { hideIfNoSiblings: boolean; hideIfOneGroupedNode: boolean } {\n let hideIfNoSiblings = false;\n let hideIfOneGroupedNode = false;\n iterateChildNodeGroupingParams(groupingNode, groupingType, (groupingProps) => {\n if (hideIfNoSiblings && hideIfOneGroupedNode) {\n return true;\n }\n hideIfNoSiblings ||= !!groupingProps?.hideIfNoSiblings;\n hideIfOneGroupedNode ||= !!groupingProps?.hideIfOneGroupedNode;\n return;\n });\n return { hideIfNoSiblings, hideIfOneGroupedNode };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { ProcessedInstanceHierarchyNode } from "../../IModelHierarchyNode.js";
2
+ import type { GroupingHandlerResult } from "../Grouping.js";
3
+ /** @internal */
4
+ export declare function createLabelGroups(nodes: ProcessedInstanceHierarchyNode[]): Promise<GroupingHandlerResult>;
5
+ //# sourceMappingURL=LabelGrouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LabelGrouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/LabelGrouping.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAA2C,MAAM,gBAAgB,CAAC;AAErG,gBAAgB;AAChB,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,8BAA8B,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4C/G"}
@@ -34,11 +34,7 @@ export async function createLabelGroups(nodes) {
34
34
  nodesToGroupMap.forEach((entry) => {
35
35
  const byLabel = entry[0].processingParams?.grouping?.byLabel;
36
36
  const groupId = typeof byLabel === "object" ? byLabel.groupId : undefined;
37
- const groupingNodeKey = {
38
- type: "label-grouping",
39
- label: entry[0].label,
40
- groupId,
41
- };
37
+ const groupingNodeKey = { type: "label-grouping", label: entry[0].label, groupId };
42
38
  const groupedNodeParentKeys = entry[0].parentKeys;
43
39
  groupedNodes.push({
44
40
  label: entry[0].label,
@@ -48,10 +44,6 @@ export async function createLabelGroups(nodes) {
48
44
  children: entry.map((gn) => Object.assign(gn, { parentKeys: [...groupedNodeParentKeys, groupingNodeKey] })),
49
45
  });
50
46
  });
51
- return {
52
- groupingType: "label",
53
- grouped: groupedNodes,
54
- ungrouped,
55
- };
47
+ return { groupingType: "label", grouped: groupedNodes, ungrouped };
56
48
  }
57
49
  //# sourceMappingURL=LabelGrouping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LabelGrouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/LabelGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMpD,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAAuC;IAC7E,MAAM,SAAS,GAAG,IAAI,KAAK,EAAkC,CAAC;IAC9D,MAAM,eAAe,GAAG,IAAI,GAAG,EAA4C,CAAC;IAC5E,MAAM,eAAe,GAAG,IAAI,GAAG,EAA4C,CAAC;IAC5E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,OAAO,CAAC;QACzD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,SAAS;QACX,CAAC;QACD,MAAM,oBAAoB,GAAG,UAAU,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,SAAS,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1I,MAAM,GAAG,GAAG,OAAO,O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C,CAAC,CAAC,CAAC,UAAU,CAAC;QAClD,YAAY,CAAC,IAAI,CAAC;YAChB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;YACrB,GAAG,EAAE,eAAe;YACpB,UAAU,EAAE,qBAAqB;YACjC,mBAAmB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC;YACjG,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,qBAAqB,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC;SAC5G,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AACrE,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 { mergeInstanceNodes } from \"../../Utils.js\";\n\nimport type { LabelGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type { ProcessedInstanceHierarchyNode } from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandlerResult, ProcessedInstancesGroupingHierarchyNode } from \"../Grouping.js\";\n\n/** @internal */\nexport async function createLabelGroups(nodes: ProcessedInstanceHierarchyNode[]): Promise<GroupingHandlerResult> {\n const ungrouped = new Array<ProcessedInstanceHierarchyNode>();\n const nodesToMergeMap = new Map<string, ProcessedInstanceHierarchyNode[]>();\n const nodesToGroupMap = new Map<string, ProcessedInstanceHierarchyNode[]>();\n for (const node of nodes) {\n const byLabel = node.processingParams?.grouping?.byLabel;\n if (!byLabel) {\n ungrouped.push(node);\n continue;\n }\n const nodeMapKeyIdentifier = `label:\"${node.label}\";groupId:${JSON.stringify(typeof byLabel === \"object\" ? byLabel.groupId : undefined)}`;\n const map = typeof byLabel === \"object\" && byLabel.action === \"merge\" ? nodesToMergeMap : nodesToGroupMap;\n let list = map.get(nodeMapKeyIdentifier);\n if (!list) {\n list = [];\n map.set(nodeMapKeyIdentifier, list);\n }\n list.push(node);\n }\n\n nodesToMergeMap.forEach((entry) => {\n let finalNode = entry[0];\n for (let i = 1; i < entry.length; ++i) {\n finalNode = mergeInstanceNodes(finalNode, entry[i]);\n }\n ungrouped.push(finalNode);\n });\n\n const groupedNodes = new Array<ProcessedInstancesGroupingHierarchyNode>();\n nodesToGroupMap.forEach((entry) => {\n const byLabel = entry[0].processingParams?.grouping?.byLabel;\n const groupId = typeof byLabel === \"object\" ? byLabel.groupId : undefined;\n const groupingNodeKey: LabelGroupingNodeKey = { type: \"label-grouping\", label: entry[0].label, groupId };\n const groupedNodeParentKeys = entry[0].parentKeys;\n groupedNodes.push({\n label: entry[0].label,\n key: groupingNodeKey,\n parentKeys: groupedNodeParentKeys,\n groupedInstanceKeys: entry.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: entry.map((gn) => Object.assign(gn, { parentKeys: [...groupedNodeParentKeys, groupingNodeKey] })),\n });\n });\n\n return { groupingType: \"label\", grouped: groupedNodes, ungrouped };\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { EC, ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from "@itwin/presentation-shared";
2
- import { ParentHierarchyNode } from "../../../HierarchyNode.js";
3
- import { HierarchyNodePropertiesGroupingParams, HierarchyNodePropertyGroup, HierarchyNodePropertyValueRange, ProcessedInstanceHierarchyNode } from "../../IModelHierarchyNode.js";
4
- import { GroupingHandler, GroupingHandlerResult, ProcessedInstancesGroupingHierarchyNode } from "../Grouping.js";
1
+ import type { EC, ECSchemaProvider, IPrimitiveValueFormatter } from "@itwin/presentation-shared";
2
+ import type { ParentHierarchyNode } from "../../../HierarchyNode.js";
3
+ import type { HierarchyNodePropertiesGroupingParams, HierarchyNodePropertyGroup, HierarchyNodePropertyValueRange, ProcessedInstanceHierarchyNode } from "../../IModelHierarchyNode.js";
4
+ import type { GroupingHandler, GroupingHandlerResult, ProcessedInstancesGroupingHierarchyNode } from "../Grouping.js";
5
5
  /** @internal */
6
6
  export interface PropertiesGroupingLocalizedStrings {
7
7
  other: string;
@@ -15,12 +15,12 @@ export interface PropertyGroupInfo {
15
15
  }
16
16
  /** @internal */
17
17
  export type PreviousPropertiesGroupingInfo = Array<{
18
- propertiesClassName: string;
18
+ propertiesClassName: EC.FullClassNameDotNotation;
19
19
  propertyName: string;
20
20
  isRange?: boolean;
21
21
  }>;
22
22
  /** @internal */
23
- export declare function createPropertyGroups(nodesToGroup: ProcessedInstanceHierarchyNode[], nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[], handlerGroupingParams: PropertyGroupInfo, valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings, classHierarchyInspector: ECClassHierarchyInspector): Promise<GroupingHandlerResult>;
23
+ export declare function createPropertyGroups(nodesToGroup: ProcessedInstanceHierarchyNode[], nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[], handlerGroupingParams: PropertyGroupInfo, valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings, classHierarchyInspector: Pick<ECSchemaProvider, "classDerivesFrom">): Promise<GroupingHandlerResult>;
24
24
  /** @internal */
25
25
  export declare function getUniquePropertiesGroupInfo(schemaProvider: ECSchemaProvider, parentNode: ParentHierarchyNode | undefined, nodes: ProcessedInstanceHierarchyNode[]): Promise<Array<PropertyGroupInfo>>;
26
26
  /** @internal */
@@ -28,5 +28,5 @@ export declare function doPreviousPropertiesMatch(previousPropertiesGroupingInfo
28
28
  /** @internal */
29
29
  export declare function doRangesMatch(ranges1: HierarchyNodePropertyValueRange[] | undefined, ranges2: HierarchyNodePropertyValueRange[] | undefined): boolean;
30
30
  /** @internal */
31
- export declare function createPropertiesGroupingHandlers(imodelAccess: ECSchemaProvider & ECClassHierarchyInspector, parentNode: ParentHierarchyNode | undefined, nodes: ProcessedInstanceHierarchyNode[], valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings): Promise<GroupingHandler[]>;
31
+ export declare function createPropertiesGroupingHandlers(imodelAccess: ECSchemaProvider, parentNode: ParentHierarchyNode | undefined, nodes: ProcessedInstanceHierarchyNode[], valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings): Promise<GroupingHandler[]>;
32
32
  //# sourceMappingURL=PropertiesGrouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertiesGrouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/grouping/PropertiesGrouping.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAgB,EAAE,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC/G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EACV,qCAAqC,EACrC,0BAA0B,EAC1B,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,uCAAuC,EAAE,MAAM,gBAAgB,CAAC;AAetH,gBAAgB;AAChB,MAAM,WAAW,kCAAkC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC;IAClB,8BAA8B,EAAE,8BAA8B,CAAC;IAC/D,aAAa,EAAE,IAAI,CAAC,0BAA0B,EAAE,eAAe,CAAC,CAAC;CAClE;AAED,gBAAgB;AAChB,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC;IACjD,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAAC;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,gBAAgB;AAChB,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,8BAA8B,EAAE,EAC9C,mBAAmB,EAAE,uCAAuC,EAAE,EAC9D,qBAAqB,EAAE,iBAAiB,EACxC,cAAc,EAAE,wBAAwB,EACxC,gBAAgB,EAAE,kCAAkC,EACpD,uBAAuB,EAAE,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAClE,OAAO,CAAC,qBAAqB,CAAC,CAwKhC;AA8ED,gBAAgB;AAChB,wBAAsB,4BAA4B,CAChD,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAqEnC;AAqCD,gBAAgB;AAChB,wBAAgB,yBAAyB,CACvC,8BAA8B,EAAE,8BAA8B,EAC9D,eAAe,EAAE,qCAAqC,GACrD,OAAO,CAUT;AAED,gBAAgB;AAChB,wBAAgB,aAAa,CAC3B,OAAO,EAAE,+BAA+B,EAAE,GAAG,SAAS,EACtD,OAAO,EAAE,+BAA+B,EAAE,GAAG,SAAS,GACrD,OAAO,CA8BT;AAED,gBAAgB;AAChB,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,EACvC,cAAc,EAAE,wBAAwB,EACxC,gBAAgB,EAAE,kCAAkC,GACnD,OAAO,CAAC,eAAe,EAAE,CAAC,CAa5B"}
@@ -18,10 +18,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
18
18
  }
19
19
  otherValuesGrouping ??= {
20
20
  node: {
21
- key: {
22
- type: "property-grouping:other",
23
- properties: [],
24
- },
21
+ key: { type: "property-grouping:other", properties: [] },
25
22
  parentKeys: [],
26
23
  groupedInstanceKeys: [],
27
24
  label: localizedStrings.other,
@@ -45,22 +42,20 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
45
42
  continue;
46
43
  }
47
44
  const currentProperty = byProperties.propertyGroups[handlerGroupingParams.previousPropertiesGroupingInfo.length];
48
- const propertyIdentifier = {
49
- propertyName: currentProperty.propertyName,
50
- propertyClassName: byProperties.propertiesClassName,
51
- };
52
45
  const propertyClass = handlerGroupingParams.ecClass;
53
- const property = await propertyClass.getProperty(currentProperty.propertyName);
54
- if (!property?.isNavigation() && (!property?.isPrimitive() || property.primitiveType === "Binary" || property.primitiveType === "IGeometry")) {
46
+ const property = propertyClass.getProperty(currentProperty.propertyName);
47
+ if (!property?.isNavigation() &&
48
+ (!property?.isPrimitive() || property.primitiveType === "Binary" || property.primitiveType === "IGeometry")) {
55
49
  groupings.ungrouped.push(node);
56
50
  continue;
57
51
  }
52
+ const propertyIdentifier = { propertyName: property.name, propertyClassName: property.class.fullName };
58
53
  const extendedTypeName = "extendedTypeName" in property ? property.extendedTypeName : undefined;
59
54
  const primitiveType = "primitiveType" in property ? property.primitiveType : "String";
60
55
  assert(primitiveType !== "Binary" && primitiveType !== "IGeometry");
61
56
  if (!currentProperty.propertyValue) {
62
57
  if (byProperties.createGroupForUnspecifiedValues) {
63
- addGroupingToMap(groupings.grouped, `${currentProperty.propertyName}:Unspecified`, {
58
+ addGroupingToMap(groupings.grouped, `${propertyIdentifier.propertyName}:Unspecified`, {
64
59
  label: localizedStrings.unspecified,
65
60
  propertyGroupingNodeKey: {
66
61
  type: "property-grouping:value",
@@ -73,7 +68,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
73
68
  groupings.ungrouped.push(node);
74
69
  continue;
75
70
  }
76
- const koqName = (await property.kindOfQuantity)?.fullName;
71
+ const koqName = property.kindOfQuantity?.fullName;
77
72
  if (currentProperty.ranges) {
78
73
  if (typeof currentProperty.propertyValue === "number") {
79
74
  const propValue = currentProperty.propertyValue;
@@ -91,8 +86,9 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
91
86
  koqName,
92
87
  value: matchingRange.toValue,
93
88
  };
94
- const rangeLabel = matchingRange.rangeLabel ?? `${await valueFormatter(fromValueTypedPrimitive)} - ${await valueFormatter(toValueTypedPrimitive)}`;
95
- addGroupingToMap(groupings.grouped, `${currentProperty.propertyName}:[${matchingRange.fromValue}-${matchingRange.toValue}]${matchingRange.rangeLabel ? `(${matchingRange.rangeLabel})` : ""}`, {
89
+ const rangeLabel = matchingRange.rangeLabel ??
90
+ `${await valueFormatter(fromValueTypedPrimitive)} - ${await valueFormatter(toValueTypedPrimitive)}`;
91
+ addGroupingToMap(groupings.grouped, `${propertyIdentifier.propertyName}:[${matchingRange.fromValue}-${matchingRange.toValue}]${matchingRange.rangeLabel ? `(${matchingRange.rangeLabel})` : ""}`, {
96
92
  label: rangeLabel,
97
93
  propertyGroupingNodeKey: {
98
94
  ...propertyIdentifier,
@@ -126,7 +122,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
126
122
  const formattedValue = currentProperty.propertyValue instanceof Array
127
123
  ? await formatConcatenatedValue({ value: currentProperty.propertyValue, valueFormatter })
128
124
  : await valueFormatter(TypedPrimitiveValue.create(currentProperty.propertyValue, primitiveType, koqName, extendedTypeName));
129
- addGroupingToMap(groupings.grouped, `${currentProperty.propertyName}:${formattedValue}`, {
125
+ addGroupingToMap(groupings.grouped, `${propertyIdentifier.propertyName}:${formattedValue}`, {
130
126
  label: formattedValue,
131
127
  propertyGroupingNodeKey: {
132
128
  ...propertyIdentifier,
@@ -140,10 +136,7 @@ export async function createPropertyGroups(nodesToGroup, nodesAlreadyGrouped, ha
140
136
  function addGroupingToMap(groupingMap, mapKey, propertyToAdd, node) {
141
137
  let groupingInfo = groupingMap.get(mapKey);
142
138
  if (!groupingInfo) {
143
- groupingInfo = {
144
- displayablePropertyGroupingInfo: propertyToAdd,
145
- groupedNodes: [node],
146
- };
139
+ groupingInfo = { displayablePropertyGroupingInfo: propertyToAdd, groupedNodes: [node] };
147
140
  groupingMap.set(mapKey, groupingInfo);
148
141
  return;
149
142
  }
@@ -201,46 +194,58 @@ export async function getUniquePropertiesGroupInfo(schemaProvider, parentNode, n
201
194
  const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();
202
195
  const parentPropertyGroupPath = parentNode ? createNodePropertyGroupPathMatchers(parentNode) : [];
203
196
  const uniqueProperties = new Map();
197
+ // `getClass` resolves the same class for every node sharing a `propertiesClassName`, so resolve each class once and
198
+ // reuse it across nodes instead of calling `getClass` (schema lookup + class lookup) on every node.
199
+ const propertiesClassCache = new Map();
200
+ const getPropertiesClass = async (fullClassName) => {
201
+ let ecClass = propertiesClassCache.get(fullClassName);
202
+ if (!ecClass) {
203
+ ecClass = await getClass(schemaProvider, fullClassName);
204
+ propertiesClassCache.set(fullClassName, ecClass);
205
+ }
206
+ return ecClass;
207
+ };
204
208
  for (const node of nodes) {
205
209
  await releaseMainThread();
206
210
  const byProperties = node.processingParams?.grouping?.byProperties;
207
211
  if (!byProperties) {
208
212
  continue;
209
213
  }
214
+ const propertiesClass = await getPropertiesClass(byProperties.propertiesClassName);
210
215
  let propertyGroupIndex = 0;
211
216
  const previousPropertiesInfo = new Array();
212
217
  for (const propertyGroup of byProperties.propertyGroups) {
218
+ const property = propertiesClass.getProperty(propertyGroup.propertyName);
219
+ const propertyName = property?.name ?? propertyGroup.propertyName;
220
+ const propertyClassName = property?.class.fullName ?? propertiesClass.fullName;
213
221
  const mapKeyRanges = getRangesAsString(propertyGroup.ranges);
214
- const lastKey = previousPropertiesInfo.length > 0 ? previousPropertiesInfo[previousPropertiesInfo.length - 1].propertyGroupKey : "";
215
- const propertyGroupKey = `${lastKey}:${propertyGroup.propertyName}(${mapKeyRanges})`;
216
- const mapKey = `${byProperties.propertiesClassName}:${propertyGroupKey}`;
222
+ const lastKey = previousPropertiesInfo.length > 0
223
+ ? previousPropertiesInfo[previousPropertiesInfo.length - 1].propertyGroupKey
224
+ : "";
225
+ const propertyGroupKey = `${lastKey}:${propertyName}(${mapKeyRanges})`;
226
+ const mapKey = `${propertiesClass.fullName}:${propertyGroupKey}`;
217
227
  let isAlreadyGrouped = false;
218
- if (!isAlreadyGrouped && parentPropertyGroupPath.length > 0 && propertyGroupIndex < parentPropertyGroupPath.length) {
228
+ if (parentPropertyGroupPath.length > 0 && propertyGroupIndex < parentPropertyGroupPath.length) {
219
229
  const groupMatcher = parentPropertyGroupPath[propertyGroupIndex];
220
230
  isAlreadyGrouped = groupMatcher({
221
- propertiesClassName: byProperties.propertiesClassName,
222
- propertyName: propertyGroup.propertyName,
231
+ propertiesClassName: propertyClassName,
232
+ propertyName,
223
233
  isRange: !!propertyGroup.ranges,
224
234
  });
225
235
  }
226
236
  if (!isAlreadyGrouped && !uniqueProperties.get(mapKey)) {
227
237
  uniqueProperties.set(mapKey, {
228
- ecClass: await getClass(schemaProvider, byProperties.propertiesClassName),
229
- propertyGroup: {
230
- propertyName: propertyGroup.propertyName,
231
- ranges: propertyGroup.ranges,
232
- },
238
+ ecClass: propertiesClass,
239
+ propertyGroup: { propertyName, ranges: propertyGroup.ranges },
233
240
  previousPropertiesGroupingInfo: previousPropertiesInfo.map((groupingInfo) => ({
234
- propertiesClassName: byProperties.propertiesClassName,
241
+ propertiesClassName: propertiesClass.getProperty(groupingInfo.propertyGroup.propertyName)?.class.fullName ??
242
+ propertiesClass.fullName,
235
243
  propertyName: groupingInfo.propertyGroup.propertyName,
236
244
  isRange: !!groupingInfo.propertyGroup.ranges,
237
245
  })),
238
246
  });
239
247
  }
240
- previousPropertiesInfo.push({
241
- propertyGroup,
242
- propertyGroupKey,
243
- });
248
+ previousPropertiesInfo.push({ propertyGroup: { ...propertyGroup, propertyName }, propertyGroupKey });
244
249
  ++propertyGroupIndex;
245
250
  }
246
251
  }
@@ -291,8 +296,12 @@ export function doRangesMatch(ranges1, ranges2) {
291
296
  }
292
297
  return (
293
298
  // Check twice, to validate if both ranges have the same elements (elements can be in a different order)
294
- ranges1.every((lhsRange) => ranges2.some((rhsRange) => lhsRange.fromValue === rhsRange.fromValue && lhsRange.toValue === rhsRange.toValue && lhsRange.rangeLabel === rhsRange.rangeLabel)) &&
295
- ranges2.every((lhsRange) => ranges1.some((rhsRange) => lhsRange.fromValue === rhsRange.fromValue && lhsRange.toValue === rhsRange.toValue && lhsRange.rangeLabel === rhsRange.rangeLabel)));
299
+ ranges1.every((lhsRange) => ranges2.some((rhsRange) => lhsRange.fromValue === rhsRange.fromValue &&
300
+ lhsRange.toValue === rhsRange.toValue &&
301
+ lhsRange.rangeLabel === rhsRange.rangeLabel)) &&
302
+ ranges2.every((lhsRange) => ranges1.some((rhsRange) => lhsRange.fromValue === rhsRange.fromValue &&
303
+ lhsRange.toValue === rhsRange.toValue &&
304
+ lhsRange.rangeLabel === rhsRange.rangeLabel)));
296
305
  }
297
306
  /** @internal */
298
307
  export async function createPropertiesGroupingHandlers(imodelAccess, parentNode, nodes, valueFormatter, localizedStrings) {