@itwin/tree-widget-react 4.0.0-alpha.24 → 4.0.0-alpha.26

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 (205) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +2 -1
  3. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
  4. package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +1 -1
  5. package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js.map +1 -1
  6. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +4 -1
  7. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +4 -1
  8. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  9. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +1 -0
  10. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +36 -47
  11. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  12. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +2 -0
  13. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +4 -1
  14. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  15. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +4 -2
  16. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +87 -38
  17. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  18. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.d.ts +86 -0
  19. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js +50 -0
  20. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js.map +1 -0
  21. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +4 -2
  22. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +38 -23
  23. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  24. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +11 -21
  25. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +16 -168
  26. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  27. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.d.ts +65 -0
  28. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js +22 -0
  29. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js.map +1 -0
  30. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.d.ts +2 -2
  31. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js +4 -4
  32. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js.map +1 -1
  33. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +6 -12
  34. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +192 -127
  35. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -1
  36. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +14 -5
  37. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +43 -24
  38. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -1
  39. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.d.ts +3 -1
  40. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js +78 -17
  41. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js.map +1 -1
  42. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +2 -0
  43. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +4 -1
  44. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -1
  45. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +91 -114
  46. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -1
  47. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +2 -2
  48. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -1
  49. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.d.ts +32 -0
  50. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js +26 -0
  51. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js.map +1 -0
  52. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +13 -1
  53. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +62 -32
  54. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -1
  55. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +12 -9
  56. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +42 -38
  57. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -1
  58. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +15 -38
  59. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +59 -242
  60. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -1
  61. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.d.ts +29 -0
  62. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js +19 -0
  63. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js.map +1 -0
  64. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +5 -9
  65. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +155 -84
  66. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -1
  67. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +20 -6
  68. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -1
  69. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.d.ts +6 -10
  70. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js +104 -63
  71. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js.map +1 -1
  72. package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.d.ts +7 -0
  73. package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js +14 -0
  74. package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js.map +1 -0
  75. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +1 -1
  76. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -1
  77. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +2 -2
  78. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  79. package/lib/esm/tree-widget-react/components/trees/common/Utils.js +2 -2
  80. package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
  81. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +4 -4
  82. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +1 -1
  83. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  84. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +4 -4
  85. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
  86. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +7 -5
  87. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
  88. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +2 -2
  89. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
  90. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +5 -5
  91. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
  92. package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.d.ts +20 -0
  93. package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js +44 -0
  94. package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js.map +1 -0
  95. package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +4 -0
  96. package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -1
  97. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +12 -0
  98. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +2 -1
  99. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js.map +1 -1
  100. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +17 -6
  101. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +58 -29
  102. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -1
  103. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +8 -14
  104. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +22 -26
  105. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -1
  106. package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.d.ts → caches/AlwaysAndNeverDrawnElementInfoCache.d.ts} +15 -21
  107. package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.js → caches/AlwaysAndNeverDrawnElementInfoCache.js} +40 -38
  108. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js.map +1 -0
  109. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.d.ts +68 -0
  110. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js +148 -0
  111. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js.map +1 -0
  112. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.d.ts +30 -0
  113. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js +151 -0
  114. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js.map +1 -0
  115. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.d.ts +32 -0
  116. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js +106 -0
  117. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js.map +1 -0
  118. package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.d.ts → caches/ModelCategoryElementsCountCache.d.ts} +9 -2
  119. package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.js → caches/ModelCategoryElementsCountCache.js} +17 -21
  120. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModelCategoryElementsCountCache.js.map +1 -0
  121. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.d.ts +27 -0
  122. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js +106 -0
  123. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js.map +1 -0
  124. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.d.ts +23 -0
  125. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js +56 -0
  126. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js.map +1 -0
  127. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +6 -6
  128. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +27 -17
  129. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -1
  130. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +7 -13
  131. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +36 -35
  132. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -1
  133. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.d.ts +18 -0
  134. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js +14 -1
  135. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js.map +1 -1
  136. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +46 -70
  137. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +229 -361
  138. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -1
  139. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +2 -2
  140. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  141. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  142. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +2 -2
  143. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  144. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  145. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +1 -1
  146. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  147. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +32 -19
  148. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  149. package/lib/esm/tree-widget-react/components/trees/index.d.ts +5 -1
  150. package/lib/esm/tree-widget-react/components/trees/index.js +5 -1
  151. package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
  152. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +4 -1
  153. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +4 -1
  154. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  155. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +7 -3
  156. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +36 -35
  157. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  158. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -0
  159. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +3 -1
  160. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  161. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +3 -1
  162. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +70 -26
  163. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  164. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.d.ts +63 -0
  165. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.js +56 -0
  166. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.js.map +1 -0
  167. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +5 -3
  168. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +26 -13
  169. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  170. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +11 -23
  171. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +56 -189
  172. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  173. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.d.ts +52 -0
  174. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js +22 -0
  175. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js.map +1 -0
  176. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.d.ts +2 -2
  177. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js +8 -8
  178. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js.map +1 -1
  179. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +6 -12
  180. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +190 -114
  181. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -1
  182. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +6 -0
  183. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +20 -8
  184. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -1
  185. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.d.ts +4 -2
  186. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js +73 -13
  187. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js.map +1 -1
  188. package/lib/esm/tree-widget-react-internal.d.ts +1 -1
  189. package/lib/esm/tree-widget-react-internal.js +1 -1
  190. package/lib/esm/tree-widget-react-internal.js.map +1 -1
  191. package/package.json +77 -82
  192. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +0 -41
  193. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +0 -50
  194. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +0 -1
  195. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.d.ts +0 -19
  196. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js +0 -32
  197. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js.map +0 -1
  198. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.d.ts +0 -20
  199. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js +0 -53
  200. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js.map +0 -1
  201. package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
  202. package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +0 -1
  203. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +0 -37
  204. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js +0 -54
  205. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +0 -1
@@ -2,12 +2,13 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { concat, defer, EMPTY, from, map, merge, mergeMap, of, toArray } from "rxjs";
6
- import { Id64 } from "@itwin/core-bentley";
7
- import { HierarchyNode } from "@itwin/presentation-hierarchies";
8
- import { fromWithRelease } from "../../../common/internal/Utils.js";
5
+ import { concat, defer, EMPTY, from, map, merge, mergeAll, mergeMap, of } from "rxjs";
6
+ import { assert } from "@itwin/core-bentley";
7
+ import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
8
+ import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
9
+ import { fromWithRelease, getIdsFromChildrenTree, getParentElementsIdsPath, setDifference, setIntersection } from "../../../common/internal/Utils.js";
9
10
  import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
10
- import { ClassificationsTreeNode } from "../ClassificationsTreeNode.js";
11
+ import { ClassificationsTreeNodeInternal } from "../ClassificationsTreeNodeInternal.js";
11
12
  import { ClassificationsTreeVisibilityHelper } from "./ClassificationsTreeVisibilityHelper.js";
12
13
  /**
13
14
  * Handles visibility status of classifications tree nodes.
@@ -20,22 +21,11 @@ export class ClassificationsTreeVisibilityHandler {
20
21
  #visibilityHelper;
21
22
  constructor(constructorProps) {
22
23
  this.#props = constructorProps;
23
- // Remove after https://github.com/iTwin/viewer-components-react/issues/1421.
24
- // We won't need to create a custom base ids cache.
25
- const baseIdsCache = {
26
- getCategories: (props) => this.getCategories(props),
27
- getAllCategories: () => this.getAllCategories(),
28
- getElementsCount: (props) => this.getElementsCount(props),
29
- getModels: (props) => this.getModels(props),
30
- getSubCategories: (props) => this.getSubCategories(props),
31
- getSubModels: (props) => this.getSubModels(props),
32
- hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),
33
- };
34
24
  this.#visibilityHelper = new ClassificationsTreeVisibilityHelper({
35
25
  viewport: this.#props.viewport,
36
26
  idsCache: this.#props.idsCache,
37
27
  alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,
38
- baseIdsCache,
28
+ baseIdsCache: this.#props.idsCache,
39
29
  });
40
30
  }
41
31
  [Symbol.dispose]() {
@@ -43,7 +33,10 @@ export class ClassificationsTreeVisibilityHandler {
43
33
  }
44
34
  changeSearchTargetsVisibilityStatus(targets, on) {
45
35
  return defer(() => {
46
- const { classificationIds, classificationTableIds, elements2d, elements3d } = targets;
36
+ if (this.#props.viewport.viewType !== "3d") {
37
+ return EMPTY;
38
+ }
39
+ const { classificationIds, classificationTableIds, elements } = targets;
47
40
  const observables = new Array();
48
41
  if (classificationTableIds?.size) {
49
42
  observables.push(this.#visibilityHelper.changeClassificationTablesVisibilityStatus({ classificationTableIds, on }));
@@ -51,60 +44,125 @@ export class ClassificationsTreeVisibilityHandler {
51
44
  if (classificationIds?.size) {
52
45
  observables.push(this.#visibilityHelper.changeClassificationsVisibilityStatus({ classificationIds, on }));
53
46
  }
54
- if (elements2d?.length) {
55
- observables.push(from(elements2d).pipe(mergeMap(({ modelId, categoryId, elements }) => this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }))));
56
- }
57
- if (elements3d?.length) {
58
- observables.push(from(elements3d).pipe(mergeMap(({ modelId, categoryId, elements }) => this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }))));
47
+ if (elements?.length) {
48
+ observables.push(this.changeSearchTargetElementsVisibilityStatus({ elements, on }));
59
49
  }
60
50
  return merge(...observables);
61
51
  });
62
52
  }
53
+ changeSearchTargetElementsVisibilityStatus({ elements, on, }) {
54
+ const searchTargetElements = new Array();
55
+ const elementIdsSet = new Set();
56
+ const modelCategoryElementMap = new Map();
57
+ // elements is an array that stores elements grouped by:
58
+ // 1. Their path
59
+ // 2. Their modelId and categoryId
60
+ // When changing visibility of elements, visibility handler does not care about the path.
61
+ // So we can first get all elements and group them only by modelId and categoryId.
62
+ for (const { elements: elementsMap, categoryId, modelId } of elements) {
63
+ const key = `${modelId}-${categoryId}`;
64
+ let mapEntry = modelCategoryElementMap.get(key);
65
+ if (!mapEntry) {
66
+ mapEntry = [];
67
+ modelCategoryElementMap.set(key, mapEntry);
68
+ }
69
+ for (const [elementId, { isSearchTarget }] of elementsMap) {
70
+ mapEntry.push(elementId);
71
+ elementIdsSet.add(elementId);
72
+ if (isSearchTarget) {
73
+ searchTargetElements.push(elementId);
74
+ }
75
+ }
76
+ }
77
+ // Get children for search targets, since non search targets don't have all the children present in the hierarchy.
78
+ return this.#props.idsCache.getChildElementsTree({ elementIds: searchTargetElements }).pipe(
79
+ // Need to filter out and keep only those children ids that are not part of elements that are present in search paths.
80
+ // Elements in search paths will have their visibility changed directly: they will be provided as elementIds to changeElementsVisibilityStatus.
81
+ map((childrenTree) => ({
82
+ childrenNotInSearchPaths: setDifference(getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 }), elementIdsSet),
83
+ childrenTree,
84
+ })), mergeMap(({ childrenNotInSearchPaths, childrenTree }) => fromWithRelease({ source: modelCategoryElementMap.entries(), size: modelCategoryElementMap.size, releaseOnCount: 50 }).pipe(mergeMap(([key, elementsInSearchPathsGroupedByModelAndCategory]) => {
85
+ const [modelId, categoryId] = key.split("-");
86
+ const childrenIds = new Set();
87
+ // A shared children tree was created, need to get the children for each element in the group.
88
+ for (const elementId of elementsInSearchPathsGroupedByModelAndCategory) {
89
+ const elementChildrenTree = childrenTree.get(elementId)?.children;
90
+ if (!elementChildrenTree) {
91
+ continue;
92
+ }
93
+ for (const childId of getIdsFromChildrenTree({ tree: elementChildrenTree })) {
94
+ childrenIds.add(childId);
95
+ }
96
+ }
97
+ return this.#visibilityHelper.changeElementsVisibilityStatus({
98
+ modelId,
99
+ categoryId,
100
+ elementIds: elementsInSearchPathsGroupedByModelAndCategory,
101
+ // Pass only those children that are not part of search paths.
102
+ children: setIntersection(childrenIds, childrenNotInSearchPaths),
103
+ on,
104
+ });
105
+ }))));
106
+ }
63
107
  getVisibilityStatus(node) {
64
- if (!HierarchyNode.isInstancesNode(node)) {
65
- return EMPTY;
108
+ if (this.#props.viewport.viewType !== "3d") {
109
+ return of(createVisibilityStatus("disabled"));
66
110
  }
67
- if (ClassificationsTreeNode.isClassificationTableNode(node)) {
111
+ if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {
68
112
  return this.#visibilityHelper.getClassificationTablesVisibilityStatus({
69
113
  classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
70
114
  });
71
115
  }
72
- if (ClassificationsTreeNode.isClassificationNode(node)) {
116
+ if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {
73
117
  return this.#visibilityHelper.getClassificationsVisibilityStatus({
74
118
  classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
75
119
  });
76
120
  }
121
+ assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));
122
+ const parentElementsIdsPath = getParentElementsIdsPath({
123
+ parentInstanceKeys: node.parentKeys.filter((parentKey) => HierarchyNodeKey.isInstances(parentKey)).map((parentKey) => parentKey.instanceKeys),
124
+ topMostParentElementId: node.extendedData.topMostParentElementId,
125
+ });
77
126
  return this.#visibilityHelper.getElementsVisibilityStatus({
78
127
  elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
79
- modelId: ClassificationsTreeNode.getModelId(node),
80
- categoryId: ClassificationsTreeNode.getCategoryId(node),
81
- type: node.extendedData?.type,
128
+ modelId: node.extendedData.modelId,
129
+ categoryId: node.extendedData.categoryId,
130
+ parentElementsIdsPath,
131
+ childrenCount: node.extendedData.childrenCount,
132
+ categoryOfTopMostParentElement: node.extendedData.categoryOfTopMostParentElement,
82
133
  });
83
134
  }
84
135
  /** Changes visibility of the items represented by the tree node. */
85
136
  changeVisibilityStatus(node, on) {
86
137
  const changeObs = defer(() => {
87
- if (!HierarchyNode.isInstancesNode(node)) {
138
+ if (this.#props.viewport.viewType !== "3d") {
88
139
  return EMPTY;
89
140
  }
90
- if (ClassificationsTreeNode.isClassificationTableNode(node)) {
141
+ if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {
91
142
  return this.#visibilityHelper.changeClassificationTablesVisibilityStatus({
92
143
  classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
93
144
  on,
94
145
  });
95
146
  }
96
- if (ClassificationsTreeNode.isClassificationNode(node)) {
147
+ if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {
97
148
  return this.#visibilityHelper.changeClassificationsVisibilityStatus({
98
149
  classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
99
150
  on,
100
151
  });
101
152
  }
102
- return this.#visibilityHelper.changeElementsVisibilityStatus({
103
- elementIds: node.key.instanceKeys.map(({ id }) => id),
104
- modelId: ClassificationsTreeNode.getModelId(node),
105
- categoryId: ClassificationsTreeNode.getCategoryId(node),
153
+ assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));
154
+ const elementIds = node.key.instanceKeys.map(({ id }) => id);
155
+ return this.#props.idsCache.getChildElementsTree({ elementIds }).pipe(map((childrenTree) => {
156
+ // Children tree contains provided elementIds, they are at the root of this tree.
157
+ // We want to skip them and only get ids of children.
158
+ return getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 });
159
+ }), mergeMap((children) => this.#visibilityHelper.changeElementsVisibilityStatus({
160
+ elementIds,
161
+ modelId: node.extendedData.modelId,
162
+ categoryId: node.extendedData.categoryId,
163
+ children: children.size > 0 ? children : undefined,
106
164
  on,
107
- });
165
+ })));
108
166
  });
109
167
  if (this.#props.viewport.isAlwaysDrawnExclusive) {
110
168
  return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);
@@ -112,8 +170,11 @@ export class ClassificationsTreeVisibilityHandler {
112
170
  return changeObs;
113
171
  }
114
172
  getSearchTargetsVisibilityStatus(targets) {
173
+ if (this.#props.viewport.viewType !== "3d") {
174
+ return of(createVisibilityStatus("disabled"));
175
+ }
115
176
  return defer(() => {
116
- const { classificationIds, classificationTableIds, elements2d, elements3d } = targets;
177
+ const { classificationIds, classificationTableIds, elements } = targets;
117
178
  const observables = new Array();
118
179
  if (classificationTableIds?.size) {
119
180
  observables.push(this.#visibilityHelper.getClassificationTablesVisibilityStatus({ classificationTableIds }));
@@ -121,56 +182,66 @@ export class ClassificationsTreeVisibilityHandler {
121
182
  if (classificationIds?.size) {
122
183
  observables.push(this.#visibilityHelper.getClassificationsVisibilityStatus({ classificationIds }));
123
184
  }
124
- if (elements2d?.length) {
125
- observables.push(fromWithRelease({ source: elements2d, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, categoryId, elements }) => {
126
- return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(mergeMap((elementId) => this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: "GeometricElement2d" })));
127
- })));
128
- }
129
- if (elements3d?.length) {
130
- observables.push(fromWithRelease({ source: elements3d, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, categoryId, elements }) => {
131
- return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(mergeMap((elementId) => this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: "GeometricElement3d" })));
132
- })));
185
+ if (elements?.length) {
186
+ observables.push(this.getSearchTargetElementsVisibilityStatus({ elements }));
133
187
  }
134
- return merge(...observables);
135
- }).pipe(mergeVisibilityStatuses);
136
- }
137
- getCategories(props) {
138
- return from(Id64.iterable(props.modelIds)).pipe(mergeMap((modelId) => this.#props.idsCache
139
- .getModelCategoryIds(modelId)
140
- .pipe(map(({ spatial, drawing }) => ({ id: modelId, drawingCategories: drawing, spatialCategories: spatial })))));
141
- }
142
- getAllCategories() {
143
- return this.#props.idsCache.getAllCategories().pipe(map(({ drawing, spatial }) => {
144
- return { drawingCategories: drawing, spatialCategories: spatial };
145
- }));
146
- }
147
- getElementsCount(props) {
148
- return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);
149
- }
150
- getModels(props) {
151
- return this.#props.idsCache.getCategoriesElementModels(props.categoryIds, true);
152
- }
153
- getSubCategories(props) {
154
- return this.#props.idsCache.getSubCategories(props.categoryId);
188
+ return from(observables).pipe(mergeAll(), mergeVisibilityStatuses());
189
+ });
155
190
  }
156
- getSubModels(props) {
157
- if ("modelIds" in props) {
158
- return from(Id64.iterable(props.modelIds)).pipe(mergeMap((modelId) => {
159
- if (props.categoryId) {
160
- return this.#props.idsCache.getCategoriesModeledElements(modelId, props.categoryId).pipe(map((subModels) => ({ id: modelId, subModels })));
191
+ getSearchTargetElementsVisibilityStatus({ elements, }) {
192
+ const searchTargetElements = new Array();
193
+ for (const { elements: elementsMap } of elements) {
194
+ for (const [elementId, { isSearchTarget }] of elementsMap) {
195
+ if (isSearchTarget) {
196
+ searchTargetElements.push(elementId);
161
197
  }
162
- return from(this.#props.idsCache.getModelCategoryIds(modelId)).pipe(mergeMap(({ drawing, spatial }) => merge(drawing, spatial)), toArray(), mergeMap((categoryIds) => this.#props.idsCache.getCategoriesModeledElements(modelId, categoryIds)), map((subModels) => ({ id: modelId, subModels })));
163
- }));
164
- }
165
- if (props.modelId) {
166
- return from(Id64.iterable(props.categoryIds)).pipe(mergeMap((categoryId) => this.#props.idsCache.getCategoriesModeledElements(props.modelId, categoryId).pipe(map((subModels) => ({ id: categoryId, subModels })))));
198
+ }
167
199
  }
168
- return this.#props.idsCache.getCategoriesElementModels(props.categoryIds).pipe(mergeMap(({ id, models }) => {
169
- if (!models) {
170
- return of({ id, subModels: undefined });
200
+ return this.#props.idsCache.getAllChildElementsCount({ elementIds: searchTargetElements }).pipe(mergeMap((elementsChildrenCountMap) => fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, categoryId, elements: elementsMap, pathToElements, categoryOfTopMostParentElement, topMostParentElementId }) => {
201
+ const parentElementsIdsPath = topMostParentElementId
202
+ ? getParentElementsIdsPath({
203
+ parentInstanceKeys: pathToElements.map((instanceKey) => [instanceKey]),
204
+ topMostParentElementId,
205
+ })
206
+ : [];
207
+ let totalSearchTargetsChildrenCount = 0;
208
+ const nonSearchTargetIds = new Array();
209
+ const searchTargetIds = new Array();
210
+ for (const [elementId, { isSearchTarget }] of elementsMap) {
211
+ if (!isSearchTarget) {
212
+ nonSearchTargetIds.push(elementId);
213
+ continue;
214
+ }
215
+ searchTargetIds.push(elementId);
216
+ const childCount = elementsChildrenCountMap.get(elementId);
217
+ if (childCount) {
218
+ totalSearchTargetsChildrenCount += childCount;
219
+ }
171
220
  }
172
- return from(models).pipe(mergeMap((modelId) => this.#props.idsCache.getCategoriesModeledElements(modelId, id)), map((subModels) => ({ id, subModels })));
173
- }));
221
+ return merge(searchTargetIds.length > 0
222
+ ? this.#visibilityHelper.getElementsVisibilityStatus({
223
+ modelId,
224
+ categoryId,
225
+ elementIds: searchTargetIds,
226
+ parentElementsIdsPath,
227
+ childrenCount: totalSearchTargetsChildrenCount,
228
+ categoryOfTopMostParentElement,
229
+ })
230
+ : EMPTY,
231
+ // Set childrenCount to undefined for non search targets, as some of their child elements might be filtered out.
232
+ // Since childrenCount is set to undefined, these elements won't check child always/never drawn child elements status.
233
+ // Child always/never drawn elements will be in search paths, and their visibility status will be handled separately.
234
+ nonSearchTargetIds.length > 0
235
+ ? this.#visibilityHelper.getElementsVisibilityStatus({
236
+ modelId,
237
+ categoryId,
238
+ elementIds: nonSearchTargetIds,
239
+ parentElementsIdsPath,
240
+ childrenCount: undefined,
241
+ categoryOfTopMostParentElement,
242
+ })
243
+ : EMPTY).pipe(mergeVisibilityStatuses());
244
+ }))));
174
245
  }
175
246
  }
176
247
  //# sourceMappingURL=ClassificationsTreeVisibilityHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassificationsTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAiB/F;;;;;GAKG;AACH,MAAM,OAAO,oCAAoC;IACtC,MAAM,CAA4C;IAC3D,iBAAiB,CAAsC;IAEvD,YAAY,gBAA2D;QACrE,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC;QAC/B,6EAA6E;QAC7E,mDAAmD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AC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CACxC,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF","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, from, map, merge, mergeMap, of, toArray } from \"rxjs\";\nimport { Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { fromWithRelease } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { ClassificationsTreeNode } from \"../ClassificationsTreeNode.js\";\nimport { ClassificationsTreeVisibilityHelper } from \"./ClassificationsTreeVisibilityHelper.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { AlwaysAndNeverDrawnElementInfo } from \"../../../common/internal/AlwaysAndNeverDrawnElementInfo.js\";\nimport type { BaseIdsCache, TreeSpecificVisibilityHandler } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { TreeWidgetViewport } from \"../../../common/TreeWidgetViewport.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\nimport type { ClassificationsTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/** @internal */\nexport interface ClassificationsTreeVisibilityHandlerProps {\n idsCache: ClassificationsTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;\n}\n\n/**\n * Handles visibility status of classifications tree nodes.\n *\n * This handler knows how to get and change visibility status of nodes created by hierarchy definition.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ClassificationsTreeSearchTargets> {\n readonly #props: ClassificationsTreeVisibilityHandlerProps;\n #visibilityHelper: ClassificationsTreeVisibilityHelper;\n\n constructor(constructorProps: ClassificationsTreeVisibilityHandlerProps) {\n this.#props = constructorProps;\n // Remove after https://github.com/iTwin/viewer-components-react/issues/1421.\n // We won't need to create a custom base ids cache.\n const baseIdsCache: BaseIdsCache = {\n getCategories: (props) => this.getCategories(props),\n getAllCategories: () => this.getAllCategories(),\n getElementsCount: (props) => this.getElementsCount(props),\n getModels: (props) => this.getModels(props),\n getSubCategories: (props) => this.getSubCategories(props),\n getSubModels: (props) => this.getSubModels(props),\n hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),\n };\n this.#visibilityHelper = new ClassificationsTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n baseIdsCache,\n });\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n const { classificationIds, classificationTableIds, elements2d, elements3d } = targets;\n const observables = new Array<Observable<void>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationTablesVisibilityStatus({ classificationTableIds, on }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationsVisibilityStatus({ classificationIds, on }));\n }\n\n if (elements2d?.length) {\n observables.push(\n from(elements2d).pipe(\n mergeMap(({ modelId, categoryId, elements }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }),\n ),\n ),\n );\n }\n\n if (elements3d?.length) {\n observables.push(\n from(elements3d).pipe(\n mergeMap(({ modelId, categoryId, elements }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n });\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (!HierarchyNode.isInstancesNode(node)) {\n return EMPTY;\n }\n\n if (ClassificationsTreeNode.isClassificationTableNode(node)) {\n return this.#visibilityHelper.getClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n if (ClassificationsTreeNode.isClassificationNode(node)) {\n return this.#visibilityHelper.getClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: ClassificationsTreeNode.getModelId(node),\n categoryId: ClassificationsTreeNode.getCategoryId(node),\n type: node.extendedData?.type,\n });\n }\n\n /** Changes visibility of the items represented by the tree node. */\n public changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void> {\n const changeObs = defer(() => {\n if (!HierarchyNode.isInstancesNode(node)) {\n return EMPTY;\n }\n\n if (ClassificationsTreeNode.isClassificationTableNode(node)) {\n return this.#visibilityHelper.changeClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n if (ClassificationsTreeNode.isClassificationNode(node)) {\n return this.#visibilityHelper.changeClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId: ClassificationsTreeNode.getModelId(node),\n categoryId: ClassificationsTreeNode.getCategoryId(node),\n on,\n });\n });\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets): Observable<VisibilityStatus> {\n return defer(() => {\n const { classificationIds, classificationTableIds, elements2d, elements3d } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationTablesVisibilityStatus({ classificationTableIds }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationsVisibilityStatus({ classificationIds }));\n }\n if (elements2d?.length) {\n observables.push(\n fromWithRelease({ source: elements2d, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, categoryId, elements }) => {\n return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(\n mergeMap((elementId) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: \"GeometricElement2d\" }),\n ),\n );\n }),\n ),\n );\n }\n\n if (elements3d?.length) {\n observables.push(\n fromWithRelease({ source: elements3d, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, categoryId, elements }) => {\n return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(\n mergeMap((elementId) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: \"GeometricElement3d\" }),\n ),\n );\n }),\n ),\n );\n }\n\n return merge(...observables);\n }).pipe(mergeVisibilityStatuses);\n }\n\n private getCategories(props: Parameters<BaseIdsCache[\"getCategories\"]>[0]): ReturnType<BaseIdsCache[\"getCategories\"]> {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) =>\n this.#props.idsCache\n .getModelCategoryIds(modelId)\n .pipe(map(({ spatial, drawing }) => ({ id: modelId, drawingCategories: drawing, spatialCategories: spatial }))),\n ),\n );\n }\n\n private getAllCategories(): ReturnType<BaseIdsCache[\"getAllCategories\"]> {\n return this.#props.idsCache.getAllCategories().pipe(\n map(({ drawing, spatial }) => {\n return { drawingCategories: drawing, spatialCategories: spatial };\n }),\n );\n }\n\n private getElementsCount(props: Parameters<BaseIdsCache[\"getElementsCount\"]>[0]): ReturnType<BaseIdsCache[\"getElementsCount\"]> {\n return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);\n }\n\n private getModels(props: Parameters<BaseIdsCache[\"getModels\"]>[0]): ReturnType<BaseIdsCache[\"getModels\"]> {\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds, true);\n }\n\n private getSubCategories(props: Parameters<BaseIdsCache[\"getSubCategories\"]>[0]): ReturnType<BaseIdsCache[\"getSubCategories\"]> {\n return this.#props.idsCache.getSubCategories(props.categoryId);\n }\n\n private getSubModels(props: Parameters<BaseIdsCache[\"getSubModels\"]>[0]): ReturnType<BaseIdsCache[\"getSubModels\"]> {\n if (\"modelIds\" in props) {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) => {\n if (props.categoryId) {\n return this.#props.idsCache.getCategoriesModeledElements(modelId, props.categoryId).pipe(map((subModels) => ({ id: modelId, subModels })));\n }\n return from(this.#props.idsCache.getModelCategoryIds(modelId)).pipe(\n mergeMap(({ drawing, spatial }) => merge(drawing, spatial)),\n toArray(),\n mergeMap((categoryIds) => this.#props.idsCache.getCategoriesModeledElements(modelId, categoryIds)),\n map((subModels) => ({ id: modelId, subModels })),\n );\n }),\n );\n }\n\n if (props.modelId) {\n return from(Id64.iterable(props.categoryIds)).pipe(\n mergeMap((categoryId) =>\n this.#props.idsCache.getCategoriesModeledElements(props.modelId!, categoryId).pipe(map((subModels) => ({ id: categoryId, subModels }))),\n ),\n );\n }\n\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds).pipe(\n mergeMap(({ id, models }) => {\n if (!models) {\n return of({ id, subModels: undefined });\n }\n return from(models).pipe(\n mergeMap((modelId) => this.#props.idsCache.getCategoriesModeledElements(modelId, id)),\n map((subModels) => ({ id, subModels })),\n );\n }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ClassificationsTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.ts"],"names":[],"mappings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CACF,CAAC;IACJ,CAAC;CACF","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, from, map, merge, mergeAll, mergeMap, of } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { fromWithRelease, getIdsFromChildrenTree, getParentElementsIdsPath, setDifference, setIntersection } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { ClassificationsTreeNodeInternal } from \"../ClassificationsTreeNodeInternal.js\";\nimport { ClassificationsTreeVisibilityHelper } from \"./ClassificationsTreeVisibilityHelper.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { AlwaysAndNeverDrawnElementInfoCache } from \"../../../common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js\";\nimport type { CategoryId, ElementId, ModelId } from \"../../../common/internal/Types.js\";\nimport type { ChildrenTree } from \"../../../common/internal/Utils.js\";\nimport type { TreeSpecificVisibilityHandler } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { TreeWidgetViewport } from \"../../../common/TreeWidgetViewport.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\nimport type { ClassificationsTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/** @internal */\nexport interface ClassificationsTreeVisibilityHandlerProps {\n idsCache: ClassificationsTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfoCache;\n}\n\n/**\n * Handles visibility status of classifications tree nodes.\n *\n * This handler knows how to get and change visibility status of nodes created by hierarchy definition.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ClassificationsTreeSearchTargets> {\n readonly #props: ClassificationsTreeVisibilityHandlerProps;\n #visibilityHelper: ClassificationsTreeVisibilityHelper;\n\n constructor(constructorProps: ClassificationsTreeVisibilityHandlerProps) {\n this.#props = constructorProps;\n this.#visibilityHelper = new ClassificationsTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n baseIdsCache: this.#props.idsCache,\n });\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n if (this.#props.viewport.viewType !== \"3d\") {\n return EMPTY;\n }\n const { classificationIds, classificationTableIds, elements } = targets;\n const observables = new Array<Observable<void>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationTablesVisibilityStatus({ classificationTableIds, on }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationsVisibilityStatus({ classificationIds, on }));\n }\n\n if (elements?.length) {\n observables.push(this.changeSearchTargetElementsVisibilityStatus({ elements, on }));\n }\n\n return merge(...observables);\n });\n }\n\n private changeSearchTargetElementsVisibilityStatus({\n elements,\n on,\n }: {\n elements: Required<ClassificationsTreeSearchTargets>[\"elements\"];\n on: boolean;\n }): Observable<void> {\n const searchTargetElements = new Array<Id64String>();\n const elementIdsSet = new Set<Id64String>();\n const modelCategoryElementMap = new Map<`${ModelId}-${CategoryId}`, Array<ElementId>>();\n // elements is an array that stores elements grouped by:\n // 1. Their path\n // 2. Their modelId and categoryId\n // When changing visibility of elements, visibility handler does not care about the path.\n // So we can first get all elements and group them only by modelId and categoryId.\n for (const { elements: elementsMap, categoryId, modelId } of elements) {\n const key: `${ModelId}-${CategoryId}` = `${modelId}-${categoryId}`;\n let mapEntry = modelCategoryElementMap.get(key);\n if (!mapEntry) {\n mapEntry = [];\n modelCategoryElementMap.set(key, mapEntry);\n }\n for (const [elementId, { isSearchTarget }] of elementsMap) {\n mapEntry.push(elementId);\n elementIdsSet.add(elementId);\n if (isSearchTarget) {\n searchTargetElements.push(elementId);\n }\n }\n }\n // Get children for search targets, since non search targets don't have all the children present in the hierarchy.\n return this.#props.idsCache.getChildElementsTree({ elementIds: searchTargetElements }).pipe(\n // Need to filter out and keep only those children ids that are not part of elements that are present in search paths.\n // Elements in search paths will have their visibility changed directly: they will be provided as elementIds to changeElementsVisibilityStatus.\n map((childrenTree) => ({\n childrenNotInSearchPaths: setDifference(getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 }), elementIdsSet),\n childrenTree,\n })),\n mergeMap(({ childrenNotInSearchPaths, childrenTree }) =>\n fromWithRelease({ source: modelCategoryElementMap.entries(), size: modelCategoryElementMap.size, releaseOnCount: 50 }).pipe(\n mergeMap(([key, elementsInSearchPathsGroupedByModelAndCategory]) => {\n const [modelId, categoryId] = key.split(\"-\");\n const childrenIds = new Set<Id64String>();\n // A shared children tree was created, need to get the children for each element in the group.\n for (const elementId of elementsInSearchPathsGroupedByModelAndCategory) {\n const elementChildrenTree: ChildrenTree | undefined = childrenTree.get(elementId)?.children;\n if (!elementChildrenTree) {\n continue;\n }\n for (const childId of getIdsFromChildrenTree({ tree: elementChildrenTree })) {\n childrenIds.add(childId);\n }\n }\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n modelId,\n categoryId,\n elementIds: elementsInSearchPathsGroupedByModelAndCategory,\n // Pass only those children that are not part of search paths.\n children: setIntersection(childrenIds, childrenNotInSearchPaths),\n on,\n });\n }),\n ),\n ),\n );\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (this.#props.viewport.viewType !== \"3d\") {\n return of(createVisibilityStatus(\"disabled\"));\n }\n if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {\n return this.#visibilityHelper.getClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {\n return this.#visibilityHelper.getClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));\n const parentElementsIdsPath = getParentElementsIdsPath({\n parentInstanceKeys: node.parentKeys.filter((parentKey) => HierarchyNodeKey.isInstances(parentKey)).map((parentKey) => parentKey.instanceKeys),\n topMostParentElementId: node.extendedData.topMostParentElementId,\n });\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n parentElementsIdsPath,\n childrenCount: node.extendedData.childrenCount,\n categoryOfTopMostParentElement: node.extendedData.categoryOfTopMostParentElement,\n });\n }\n\n /** Changes visibility of the items represented by the tree node. */\n public changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void> {\n const changeObs = defer(() => {\n if (this.#props.viewport.viewType !== \"3d\") {\n return EMPTY;\n }\n if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {\n return this.#visibilityHelper.changeClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {\n return this.#visibilityHelper.changeClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));\n const elementIds = node.key.instanceKeys.map(({ id }) => id);\n return this.#props.idsCache.getChildElementsTree({ elementIds }).pipe(\n map((childrenTree): Id64Set => {\n // Children tree contains provided elementIds, they are at the root of this tree.\n // We want to skip them and only get ids of children.\n return getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 });\n }),\n mergeMap((children) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds,\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n children: children.size > 0 ? children : undefined,\n on,\n }),\n ),\n );\n });\n\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets): Observable<VisibilityStatus> {\n if (this.#props.viewport.viewType !== \"3d\") {\n return of(createVisibilityStatus(\"disabled\"));\n }\n return defer(() => {\n const { classificationIds, classificationTableIds, elements } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationTablesVisibilityStatus({ classificationTableIds }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationsVisibilityStatus({ classificationIds }));\n }\n if (elements?.length) {\n observables.push(this.getSearchTargetElementsVisibilityStatus({ elements }));\n }\n\n return from(observables).pipe(mergeAll(), mergeVisibilityStatuses());\n });\n }\n\n private getSearchTargetElementsVisibilityStatus({\n elements,\n }: {\n elements: Required<ClassificationsTreeSearchTargets>[\"elements\"];\n }): Observable<VisibilityStatus> {\n const searchTargetElements = new Array<Id64String>();\n for (const { elements: elementsMap } of elements) {\n for (const [elementId, { isSearchTarget }] of elementsMap) {\n if (isSearchTarget) {\n searchTargetElements.push(elementId);\n }\n }\n }\n return this.#props.idsCache.getAllChildElementsCount({ elementIds: searchTargetElements }).pipe(\n mergeMap((elementsChildrenCountMap) =>\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, categoryId, elements: elementsMap, pathToElements, categoryOfTopMostParentElement, topMostParentElementId }) => {\n const parentElementsIdsPath = topMostParentElementId\n ? getParentElementsIdsPath({\n parentInstanceKeys: pathToElements.map((instanceKey) => [instanceKey]),\n topMostParentElementId,\n })\n : [];\n let totalSearchTargetsChildrenCount = 0;\n const nonSearchTargetIds = new Array<Id64String>();\n const searchTargetIds = new Array<Id64String>();\n for (const [elementId, { isSearchTarget }] of elementsMap) {\n if (!isSearchTarget) {\n nonSearchTargetIds.push(elementId);\n continue;\n }\n searchTargetIds.push(elementId);\n const childCount = elementsChildrenCountMap.get(elementId);\n if (childCount) {\n totalSearchTargetsChildrenCount += childCount;\n }\n }\n return merge(\n searchTargetIds.length > 0\n ? this.#visibilityHelper.getElementsVisibilityStatus({\n modelId,\n categoryId,\n elementIds: searchTargetIds,\n parentElementsIdsPath,\n childrenCount: totalSearchTargetsChildrenCount,\n categoryOfTopMostParentElement,\n })\n : EMPTY,\n // Set childrenCount to undefined for non search targets, as some of their child elements might be filtered out.\n // Since childrenCount is set to undefined, these elements won't check child always/never drawn child elements status.\n // Child always/never drawn elements will be in search paths, and their visibility status will be handled separately.\n nonSearchTargetIds.length > 0\n ? this.#visibilityHelper.getElementsVisibilityStatus({\n modelId,\n categoryId,\n elementIds: nonSearchTargetIds,\n parentElementsIdsPath,\n childrenCount: undefined,\n categoryOfTopMostParentElement,\n })\n : EMPTY,\n ).pipe(mergeVisibilityStatuses());\n }),\n ),\n ),\n );\n }\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { merge, mergeMap, of, toArray } from "rxjs";
5
+ import { defaultIfEmpty, mergeMap } from "rxjs";
6
+ import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
6
7
  import { BaseVisibilityHelper } from "../../../common/internal/visibility/BaseVisibilityHelper.js";
7
- import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
8
8
  /**
9
9
  * Visibility status helper for classifications tree.
10
10
  *
@@ -23,7 +23,10 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
23
23
  * Determines visibility status by checking visibility status of related categories.
24
24
  */
25
25
  getClassificationTablesVisibilityStatus(props) {
26
- return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap(({ drawing, spatial }) => merge(of(drawing).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: "DrawingCategory" }))), of(spatial).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: "SpatialCategory" }))))), mergeVisibilityStatuses);
26
+ return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap((categories) => this.getCategoriesVisibilityStatus({
27
+ modelId: undefined,
28
+ categoryIds: categories,
29
+ })), defaultIfEmpty(createVisibilityStatus("disabled")));
27
30
  }
28
31
  /**
29
32
  * Gets visibility status of classifications.
@@ -31,7 +34,10 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
31
34
  * Determines visibility status by checking visibility status of related categories.
32
35
  */
33
36
  getClassificationsVisibilityStatus(props) {
34
- return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap(({ drawing, spatial }) => merge(of(drawing).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: "DrawingCategory" }))), of(spatial).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: "SpatialCategory" }))))), mergeVisibilityStatuses);
37
+ return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap((categories) => this.getCategoriesVisibilityStatus({
38
+ modelId: undefined,
39
+ categoryIds: categories,
40
+ })), defaultIfEmpty(createVisibilityStatus("disabled")));
35
41
  }
36
42
  /**
37
43
  * Changes visibility status of classification tables.
@@ -39,7 +45,11 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
39
45
  * Does this by changing visibility status of related categories.
40
46
  */
41
47
  changeClassificationTablesVisibilityStatus(props) {
42
- return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap(({ drawing, spatial }) => merge(drawing, spatial)), toArray(), mergeMap((categoryIds) => this.changeCategoriesVisibilityStatus({ modelId: undefined, categoryIds, on: props.on })));
48
+ return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap((categories) => this.changeCategoriesVisibilityStatus({
49
+ modelId: undefined,
50
+ categoryIds: categories,
51
+ on: props.on,
52
+ })));
43
53
  }
44
54
  /**
45
55
  * Changes visibility status of classifications.
@@ -47,7 +57,11 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
47
57
  * Does this by changing visibility status of related categories.
48
58
  */
49
59
  changeClassificationsVisibilityStatus(props) {
50
- return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap(({ drawing, spatial }) => merge(drawing, spatial)), toArray(), mergeMap((categoryIds) => this.changeCategoriesVisibilityStatus({ modelId: undefined, categoryIds, on: props.on })));
60
+ return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap((categories) => this.changeCategoriesVisibilityStatus({
61
+ modelId: undefined,
62
+ categoryIds: categories,
63
+ on: props.on,
64
+ })));
51
65
  }
52
66
  }
53
67
  //# sourceMappingURL=ClassificationsTreeVisibilityHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassificationsTreeVisibilityHelper.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,uBAAuB,E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AE,EAAE,CAAC,CAAC,CACpH,CAAC;IACJ,CAAC;CACF","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 { merge, mergeMap, of, toArray } from \"rxjs\";\nimport { BaseVisibilityHelper } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg } from \"@itwin/core-bentley\";\nimport type { BaseVisibilityHelperProps } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\n\n/** @internal */\nexport type ClassificationsTreeVisibilityHelperProps = BaseVisibilityHelperProps & {\n idsCache: ClassificationsTreeIdsCache;\n};\n\n/**\n * Visibility status helper for classifications tree.\n *\n * It extends base visibility status helper and provides methods to get and change visibility status of classification tables and classifications.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {\n #props: ClassificationsTreeVisibilityHelperProps;\n constructor(props: ClassificationsTreeVisibilityHelperProps) {\n super(props);\n this.#props = props;\n }\n\n /**\n * Gets visibility status of classification tables.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getClassificationTablesVisibilityStatus(props: { classificationTableIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(\n mergeMap(({ drawing, spatial }) =>\n merge(\n of(drawing).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: \"DrawingCategory\" }))),\n of(spatial).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: \"SpatialCategory\" }))),\n ),\n ),\n mergeVisibilityStatuses,\n );\n }\n\n /**\n * Gets visibility status of classifications.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getClassificationsVisibilityStatus(props: { classificationIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(\n mergeMap(({ drawing, spatial }) =>\n merge(\n of(drawing).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: \"DrawingCategory\" }))),\n of(spatial).pipe(mergeMap((categoryIds) => this.getCategoriesVisibilityStatus({ modelId: undefined, categoryIds, type: \"SpatialCategory\" }))),\n ),\n ),\n mergeVisibilityStatuses,\n );\n }\n\n /**\n * Changes visibility status of classification tables.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeClassificationTablesVisibilityStatus(props: { classificationTableIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(\n mergeMap(({ drawing, spatial }) => merge(drawing, spatial)),\n toArray(),\n mergeMap((categoryIds) => this.changeCategoriesVisibilityStatus({ modelId: undefined, categoryIds, on: props.on })),\n );\n }\n\n /**\n * Changes visibility status of classifications.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeClassificationsVisibilityStatus(props: { classificationIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(\n mergeMap(({ drawing, spatial }) => merge(drawing, spatial)),\n toArray(),\n mergeMap((categoryIds) => this.changeCategoriesVisibilityStatus({ modelId: undefined, categoryIds, on: props.on })),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ClassificationsTreeVisibilityHelper.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,s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;YAClB,WAAW,EAAE,UAAU;YACvB,EAAE,EAAE,KAAK,CAAC,EAAE;SACb,CAAC,CACH,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,qCAAqC,CAAC,KAAkD;QAC7F,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACjF,QAAQ,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,IAAI,CAAC,gCAAgC,CAAC;YACpC,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,UAAU;YACvB,EAAE,EAAE,KAAK,CAAC,EAAE;SACb,CAAC,CACH,CACF,CAAC;IACJ,CAAC;CACF","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 { defaultIfEmpty, mergeMap } from \"rxjs\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { BaseVisibilityHelper } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg } from \"@itwin/core-bentley\";\nimport type { BaseVisibilityHelperProps } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\n\n/** @internal */\nexport type ClassificationsTreeVisibilityHelperProps = BaseVisibilityHelperProps & {\n idsCache: ClassificationsTreeIdsCache;\n};\n\n/**\n * Visibility status helper for classifications tree.\n *\n * It extends base visibility status helper and provides methods to get and change visibility status of classification tables and classifications.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {\n #props: ClassificationsTreeVisibilityHelperProps;\n constructor(props: ClassificationsTreeVisibilityHelperProps) {\n super(props);\n this.#props = props;\n }\n\n /**\n * Gets visibility status of classification tables.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getClassificationTablesVisibilityStatus(props: { classificationTableIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(\n mergeMap((categories) =>\n this.getCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n }),\n ),\n defaultIfEmpty(createVisibilityStatus(\"disabled\")),\n );\n }\n\n /**\n * Gets visibility status of classifications.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getClassificationsVisibilityStatus(props: { classificationIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(\n mergeMap((categories) =>\n this.getCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n }),\n ),\n defaultIfEmpty(createVisibilityStatus(\"disabled\")),\n );\n }\n\n /**\n * Changes visibility status of classification tables.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeClassificationTablesVisibilityStatus(props: { classificationTableIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(\n mergeMap((categories) =>\n this.changeCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n on: props.on,\n }),\n ),\n );\n }\n\n /**\n * Changes visibility status of classifications.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeClassificationsVisibilityStatus(props: { classificationIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(\n mergeMap((categories) =>\n this.changeCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n on: props.on,\n }),\n ),\n );\n }\n}\n"]}
@@ -1,24 +1,20 @@
1
1
  import type { Id64Set, Id64String } from "@itwin/core-bentley";
2
2
  import type { HierarchySearchPath } from "@itwin/presentation-hierarchies";
3
- import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
4
- import type { ElementId } from "../../../common/internal/Types.js";
3
+ import type { ECClassHierarchyInspector, InstanceKey } from "@itwin/presentation-shared";
4
+ import type { CategoryId, ElementId } from "../../../common/internal/Types.js";
5
5
  import type { SearchResultsTree } from "../../../common/internal/visibility/BaseSearchResultsTree.js";
6
6
  import type { ClassificationsTreeIdsCache } from "../ClassificationsTreeIdsCache.js";
7
7
  /** @internal */
8
8
  export interface ClassificationsTreeSearchTargets {
9
- elements2d?: Array<{
10
- modelId: Id64String;
11
- categoryId: Id64String;
12
- elements: Map<ElementId, {
13
- isSearchTarget: boolean;
14
- }>;
15
- }>;
16
- elements3d?: Array<{
9
+ elements?: Array<{
10
+ pathToElements: InstanceKey[];
17
11
  modelId: Id64String;
18
12
  categoryId: Id64String;
13
+ topMostParentElementId?: Id64String;
19
14
  elements: Map<ElementId, {
20
15
  isSearchTarget: boolean;
21
16
  }>;
17
+ categoryOfTopMostParentElement: CategoryId;
22
18
  }>;
23
19
  classificationTableIds?: Id64Set;
24
20
  classificationIds?: Id64Set;