@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
@@ -1,5 +1,6 @@
1
- import type { HierarchyDefinition } from "@itwin/presentation-hierarchies";
2
- import type { useIModelTree, useTree } from "@itwin/presentation-hierarchies-react";
1
+ import type { IModelConnection } from "@itwin/core-frontend";
2
+ import type { HierarchyDefinition, HierarchySearchPath } from "@itwin/presentation-hierarchies";
3
+ import type { useTree } from "@itwin/presentation-hierarchies-react";
3
4
  import type { InstanceKey } from "@itwin/presentation-shared";
4
5
  import type { FunctionProps } from "../common/Utils.js";
5
6
  import type { ClassificationsTreeHierarchyConfiguration } from "./ClassificationsTreeDefinition.js";
@@ -11,12 +12,7 @@ interface UseClassificationsTreeDefinitionProps {
11
12
  * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the
12
13
  * latest version. Not obeying this rule may result in undefined behavior.
13
14
  */
14
- imodels: Array<{
15
- /**
16
- * An object that provides access to iModel's data and metadata.
17
- */
18
- imodelAccess: FunctionProps<typeof useIModelTree>["imodelAccess"];
19
- }>;
15
+ imodels: Array<IModelConnection>;
20
16
  hierarchyConfig: ClassificationsTreeHierarchyConfiguration;
21
17
  /**
22
18
  * Optional parameters to search for tree nodes.
@@ -32,13 +28,20 @@ interface UseClassificationsTreeDefinitionProps {
32
28
  */
33
29
  targetItems: Array<InstanceKey>;
34
30
  };
31
+ /**
32
+ * Action to perform when search paths change.
33
+ */
34
+ onSearchPathsChanged?: (paths: HierarchySearchPath[] | undefined) => void;
35
35
  }
36
36
  /** @alpha */
37
37
  interface UseClassificationsTreeDefinitionResult {
38
38
  definition: HierarchyDefinition;
39
39
  getSearchPaths?: FunctionProps<typeof useTree>["getSearchPaths"];
40
40
  }
41
- /** @alpha */
41
+ /**
42
+ * Requires `SharedTreeContextProvider` to be present in components tree above.
43
+ * @alpha
44
+ */
42
45
  export declare function useClassificationsTreeDefinition(props: UseClassificationsTreeDefinitionProps): UseClassificationsTreeDefinitionResult;
43
46
  export {};
44
47
  //# sourceMappingURL=UseClassificationsTreeDefinition.d.ts.map
@@ -2,61 +2,65 @@
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 { useMemo, useRef } from "react";
6
- import { assert } from "@itwin/core-bentley";
5
+ import { useEffect, useMemo } from "react";
6
+ import { useSharedTreeContextInternal } from "../common/internal/SharedTreeContextProviderInternal.js";
7
+ import { createIModelAccess } from "../common/internal/UseIModelAccess.js";
8
+ import { useTelemetryContext } from "../common/UseTelemetryContext.js";
7
9
  import { ClassificationsTreeDefinition } from "./ClassificationsTreeDefinition.js";
8
- import { ClassificationsTreeIdsCache } from "./internal/ClassificationsTreeIdsCache.js";
9
- /** @alpha */
10
+ import { getClassificationsTreeIdsCache } from "./UseClassificationsTree.js";
11
+ /**
12
+ * Requires `SharedTreeContextProvider` to be present in components tree above.
13
+ * @alpha
14
+ */
10
15
  export function useClassificationsTreeDefinition(props) {
11
- const { imodels, hierarchyConfig, search } = props;
12
- const idsCaches = useRef(new Map());
16
+ const { imodels, hierarchyConfig, search, onSearchPathsChanged } = props;
17
+ const { getBaseIdsCache, getCache } = useSharedTreeContextInternal();
18
+ const { onFeatureUsed } = useTelemetryContext();
19
+ const imodelsWithCaches = useMemo(() => {
20
+ return imodels.map((imodel) => {
21
+ return {
22
+ imodelAccess: createIModelAccess({ imodel, hierarchyLevelSizeLimit: 1000 }),
23
+ cache: getClassificationsTreeIdsCache({ getBaseIdsCache, getCache, imodel, hierarchyConfig }),
24
+ };
25
+ });
26
+ }, [imodels, getBaseIdsCache, getCache, hierarchyConfig]);
13
27
  const definition = useMemo(() => {
14
28
  return new ClassificationsTreeDefinition({
15
- imodelAccess: imodels[imodels.length - 1].imodelAccess,
16
- getIdsCache: (imodelKey) => getOrCreateIdsCache({
17
- imodelKey,
18
- imodels,
19
- idsCaches,
20
- hierarchyConfig,
21
- }),
29
+ imodelAccess: imodelsWithCaches[imodelsWithCaches.length - 1].imodelAccess,
30
+ getIdsCache: (imodelKey) => imodelsWithCaches.find(({ imodelAccess }) => imodelAccess.imodelKey === imodelKey).cache,
22
31
  hierarchyConfig,
23
32
  });
24
- }, [imodels, hierarchyConfig]);
33
+ }, [hierarchyConfig, imodelsWithCaches]);
25
34
  const searchTerm = search ? ("searchText" in search ? search.searchText : search.targetItems) : undefined;
35
+ useEffect(() => {
36
+ if (!searchTerm) {
37
+ onSearchPathsChanged?.(undefined);
38
+ }
39
+ }, [onSearchPathsChanged, searchTerm]);
26
40
  const getSearchPaths = useMemo(() => {
27
41
  if (!searchTerm) {
28
42
  return undefined;
29
43
  }
30
44
  return async ({ abortSignal }) => {
31
- const [first, ...rest] = await Promise.all(imodels.map(async ({ imodelAccess }) => ClassificationsTreeDefinition.createInstanceKeyPaths({
32
- hierarchyConfig,
33
- idsCache: getOrCreateIdsCache({
34
- imodelKey: imodelAccess.imodelKey,
35
- imodels,
36
- idsCaches,
45
+ onFeatureUsed({ featureId: "search", reportInteraction: true });
46
+ const [first, ...rest] = await Promise.all(imodelsWithCaches.map(async ({ imodelAccess, cache }) => {
47
+ return ClassificationsTreeDefinition.createInstanceKeyPaths({
37
48
  hierarchyConfig,
38
- }),
39
- imodelAccess,
40
- abortSignal,
41
- limit: typeof searchTerm !== "string" ? "unbounded" : undefined,
42
- ...(typeof searchTerm === "string" ? { label: searchTerm } : { targetItems: searchTerm }),
43
- })));
44
- return first.concat(...rest);
49
+ idsCache: cache,
50
+ imodelAccess,
51
+ abortSignal,
52
+ limit: typeof searchTerm !== "string" ? "unbounded" : undefined,
53
+ ...(typeof searchTerm === "string" ? { label: searchTerm } : { targetItems: searchTerm }),
54
+ });
55
+ }));
56
+ const joinedPaths = first.concat(...rest);
57
+ onSearchPathsChanged?.(joinedPaths);
58
+ return joinedPaths;
45
59
  };
46
- }, [imodels, hierarchyConfig, searchTerm]);
60
+ }, [searchTerm, onFeatureUsed, imodelsWithCaches, onSearchPathsChanged, hierarchyConfig]);
47
61
  return {
48
62
  definition,
49
63
  getSearchPaths,
50
64
  };
51
65
  }
52
- function getOrCreateIdsCache({ imodelKey, imodels, hierarchyConfig, idsCaches, }) {
53
- let idsCache = idsCaches.current.get(imodelKey);
54
- if (!idsCache) {
55
- const imodel = imodels.find((currImodel) => currImodel.imodelAccess.imodelKey === imodelKey);
56
- assert(!!imodel);
57
- idsCache = new ClassificationsTreeIdsCache(imodel.imodelAccess, hierarchyConfig);
58
- idsCaches.current.set(imodelKey, idsCache);
59
- }
60
- return idsCache;
61
- }
62
66
  //# sourceMappingURL=UseClassificationsTreeDefinition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UseClassificationsTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,C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ACT,eAAe;iBAChB,CAAC;gBACF,YAAY;gBACZ,WAAW;gBACX,KAAK,EAAE,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBAC/D,GAAG,CAAC,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;aAC1F,CAAC,CACH,CACF,CAAC;YAEF,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3C,OAAO;QACL,UAAU;QACV,cAAc;KACf,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,OAAO,EACP,eAAe,EACf,SAAS,GAQV;IACC,IAAI,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAC7F,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACjB,QAAQ,GAAG,IAAI,2BAA2B,CAAC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QACjF,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,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 { useMemo, useRef } from \"react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { ClassificationsTreeDefinition } from \"./ClassificationsTreeDefinition.js\";\nimport { ClassificationsTreeIdsCache } from \"./internal/ClassificationsTreeIdsCache.js\";\n\nimport type { MutableRefObject } from \"react\";\nimport type { HierarchyDefinition } from \"@itwin/presentation-hierarchies\";\nimport type { useIModelTree, useTree } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { FunctionProps } from \"../common/Utils.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"./ClassificationsTreeDefinition.js\";\n\n/** @alpha */\ninterface UseClassificationsTreeDefinitionProps {\n /**\n * A list of iModels to create merged hierarchy for.\n *\n * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the\n * latest version. Not obeying this rule may result in undefined behavior.\n */\n imodels: Array<{\n /**\n * An object that provides access to iModel's data and metadata.\n */\n imodelAccess: FunctionProps<typeof useIModelTree>[\"imodelAccess\"];\n }>;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n /**\n * Optional parameters to search for tree nodes.\n */\n search?:\n | {\n /**\n * Text used to search tree nodes by label.\n */\n searchText: string;\n }\n | {\n /**\n * List of instance keys to search tree nodes by.\n */\n targetItems: Array<InstanceKey>;\n };\n}\n\n/** @alpha */\ninterface UseClassificationsTreeDefinitionResult {\n definition: HierarchyDefinition;\n getSearchPaths?: FunctionProps<typeof useTree>[\"getSearchPaths\"];\n}\n\n/** @alpha */\nexport function useClassificationsTreeDefinition(props: UseClassificationsTreeDefinitionProps): UseClassificationsTreeDefinitionResult {\n const { imodels, hierarchyConfig, search } = props;\n\n const idsCaches = useRef<Map<string, ClassificationsTreeIdsCache>>(new Map());\n\n const definition = useMemo(() => {\n return new ClassificationsTreeDefinition({\n imodelAccess: imodels[imodels.length - 1].imodelAccess,\n getIdsCache: (imodelKey: string) =>\n getOrCreateIdsCache({\n imodelKey,\n imodels,\n idsCaches,\n hierarchyConfig,\n }),\n hierarchyConfig,\n });\n }, [imodels, hierarchyConfig]);\n\n const searchTerm = search ? (\"searchText\" in search ? search.searchText : search.targetItems) : undefined;\n const getSearchPaths = useMemo<FunctionProps<typeof useTree>[\"getSearchPaths\"]>(() => {\n if (!searchTerm) {\n return undefined;\n }\n\n return async ({ abortSignal }) => {\n const [first, ...rest] = await Promise.all(\n imodels.map(async ({ imodelAccess }) =>\n ClassificationsTreeDefinition.createInstanceKeyPaths({\n hierarchyConfig,\n idsCache: getOrCreateIdsCache({\n imodelKey: imodelAccess.imodelKey,\n imodels,\n idsCaches,\n hierarchyConfig,\n }),\n imodelAccess,\n abortSignal,\n limit: typeof searchTerm !== \"string\" ? \"unbounded\" : undefined,\n ...(typeof searchTerm === \"string\" ? { label: searchTerm } : { targetItems: searchTerm }),\n }),\n ),\n );\n\n return first.concat(...rest);\n };\n }, [imodels, hierarchyConfig, searchTerm]);\n\n return {\n definition,\n getSearchPaths,\n };\n}\n\nfunction getOrCreateIdsCache({\n imodelKey,\n imodels,\n hierarchyConfig,\n idsCaches,\n}: {\n imodelKey: string;\n imodels: Array<{\n imodelAccess: FunctionProps<typeof useIModelTree>[\"imodelAccess\"];\n }>;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n idsCaches: MutableRefObject<Map<string, ClassificationsTreeIdsCache>>;\n}) {\n let idsCache = idsCaches.current.get(imodelKey);\n if (!idsCache) {\n const imodel = imodels.find((currImodel) => currImodel.imodelAccess.imodelKey === imodelKey);\n assert(!!imodel);\n idsCache = new ClassificationsTreeIdsCache(imodel.imodelAccess, hierarchyConfig);\n idsCaches.current.set(imodelKey, idsCache);\n }\n return idsCache;\n}\n"]}
1
+ {"version":3,"file":"UseClassificationsTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,M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AAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;iBAC1F,CAAC,CAAC;YACL,CAAC,CAAC,CACH,CAAC;YAEF,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;YAC1C,oBAAoB,EAAE,CAAC,WAAW,CAAC,CAAC;YACpC,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC,CAAC;IAE1F,OAAO;QACL,UAAU;QACV,cAAc;KACf,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 { useEffect, useMemo } from \"react\";\nimport { useSharedTreeContextInternal } from \"../common/internal/SharedTreeContextProviderInternal.js\";\nimport { createIModelAccess } from \"../common/internal/UseIModelAccess.js\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext.js\";\nimport { ClassificationsTreeDefinition } from \"./ClassificationsTreeDefinition.js\";\nimport { getClassificationsTreeIdsCache } from \"./UseClassificationsTree.js\";\n\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { HierarchyDefinition, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport type { useTree } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { FunctionProps } from \"../common/Utils.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"./ClassificationsTreeDefinition.js\";\n\n/** @alpha */\ninterface UseClassificationsTreeDefinitionProps {\n /**\n * A list of iModels to create merged hierarchy for.\n *\n * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the\n * latest version. Not obeying this rule may result in undefined behavior.\n */\n imodels: Array<IModelConnection>;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n /**\n * Optional parameters to search for tree nodes.\n */\n search?:\n | {\n /**\n * Text used to search tree nodes by label.\n */\n searchText: string;\n }\n | {\n /**\n * List of instance keys to search tree nodes by.\n */\n targetItems: Array<InstanceKey>;\n };\n /**\n * Action to perform when search paths change.\n */\n onSearchPathsChanged?: (paths: HierarchySearchPath[] | undefined) => void;\n}\n\n/** @alpha */\ninterface UseClassificationsTreeDefinitionResult {\n definition: HierarchyDefinition;\n getSearchPaths?: FunctionProps<typeof useTree>[\"getSearchPaths\"];\n}\n\n/**\n * Requires `SharedTreeContextProvider` to be present in components tree above.\n * @alpha\n */\nexport function useClassificationsTreeDefinition(props: UseClassificationsTreeDefinitionProps): UseClassificationsTreeDefinitionResult {\n const { imodels, hierarchyConfig, search, onSearchPathsChanged } = props;\n const { getBaseIdsCache, getCache } = useSharedTreeContextInternal();\n const { onFeatureUsed } = useTelemetryContext();\n\n const imodelsWithCaches = useMemo(() => {\n return imodels.map((imodel) => {\n return {\n imodelAccess: createIModelAccess({ imodel, hierarchyLevelSizeLimit: 1000 }),\n cache: getClassificationsTreeIdsCache({ getBaseIdsCache, getCache, imodel, hierarchyConfig }),\n };\n });\n }, [imodels, getBaseIdsCache, getCache, hierarchyConfig]);\n\n const definition = useMemo(() => {\n return new ClassificationsTreeDefinition({\n imodelAccess: imodelsWithCaches[imodelsWithCaches.length - 1].imodelAccess,\n getIdsCache: (imodelKey: string) => imodelsWithCaches.find(({ imodelAccess }) => imodelAccess.imodelKey === imodelKey)!.cache,\n hierarchyConfig,\n });\n }, [hierarchyConfig, imodelsWithCaches]);\n\n const searchTerm = search ? (\"searchText\" in search ? search.searchText : search.targetItems) : undefined;\n\n useEffect(() => {\n if (!searchTerm) {\n onSearchPathsChanged?.(undefined);\n }\n }, [onSearchPathsChanged, searchTerm]);\n\n const getSearchPaths = useMemo<FunctionProps<typeof useTree>[\"getSearchPaths\"]>(() => {\n if (!searchTerm) {\n return undefined;\n }\n\n return async ({ abortSignal }) => {\n onFeatureUsed({ featureId: \"search\", reportInteraction: true });\n const [first, ...rest] = await Promise.all(\n imodelsWithCaches.map(async ({ imodelAccess, cache }) => {\n return ClassificationsTreeDefinition.createInstanceKeyPaths({\n hierarchyConfig,\n idsCache: cache,\n imodelAccess,\n abortSignal,\n limit: typeof searchTerm !== \"string\" ? \"unbounded\" : undefined,\n ...(typeof searchTerm === \"string\" ? { label: searchTerm } : { targetItems: searchTerm }),\n });\n }),\n );\n\n const joinedPaths = first.concat(...rest);\n onSearchPathsChanged?.(joinedPaths);\n return joinedPaths;\n };\n }, [searchTerm, onFeatureUsed, imodelsWithCaches, onSearchPathsChanged, hierarchyConfig]);\n\n return {\n definition,\n getSearchPaths,\n };\n}\n"]}
@@ -1,56 +1,33 @@
1
+ import { BaseIdsCacheImpl } from "../../common/internal/caches/BaseIdsCache.js";
1
2
  import type { Observable } from "rxjs";
2
- import type { GuidString, Id64Arg, Id64Array, Id64Set, Id64String } from "@itwin/core-bentley";
3
+ import type { Id64Arg, Id64Array, Id64String } from "@itwin/core-bentley";
3
4
  import type { HierarchyNodeIdentifiersPath, LimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
4
- import type { CategoryId, ElementId, ModelId, SubCategoryId } from "../../common/internal/Types.js";
5
+ import type { BaseIdsCacheImplProps } from "../../common/internal/caches/BaseIdsCache.js";
6
+ import type { CategoryId, ClassificationId, ElementId } from "../../common/internal/Types.js";
5
7
  import type { ClassificationsTreeHierarchyConfiguration } from "../ClassificationsTreeDefinition.js";
8
+ interface ClassificationsTreeIdsCacheProps extends BaseIdsCacheImplProps {
9
+ queryExecutor: LimitingECSqlQueryExecutor;
10
+ hierarchyConfig: ClassificationsTreeHierarchyConfiguration;
11
+ }
6
12
  /** @internal */
7
- export type ClassificationId = Id64String;
8
- /** @internal */
9
- export type ClassificationTableId = Id64String;
10
- /** @internal */
11
- export declare class ClassificationsTreeIdsCache implements Disposable {
13
+ export declare class ClassificationsTreeIdsCache extends BaseIdsCacheImpl {
12
14
  #private;
13
- constructor(queryExecutor: LimitingECSqlQueryExecutor, hierarchyConfig: ClassificationsTreeHierarchyConfiguration, componentId?: GuidString);
14
- [Symbol.dispose](): void;
15
- private querySubCategories;
16
- private getSubCategoriesInfo;
17
- getSubCategories(categoryId: Id64String): Observable<Array<SubCategoryId>>;
18
- private queryElementModelCategories;
19
- private getElementModelsCategories;
20
- private queryModeledElements;
21
- private getModelWithCategoryModeledElements;
22
- getCategoriesModeledElements(modelId: Id64String, categoryIds: Id64Arg): Observable<Id64Array>;
23
- getCategoriesElementModels(categoryIds: Id64Arg, includeSubModels?: boolean): Observable<{
24
- id: CategoryId;
25
- models: Array<ModelId> | undefined;
26
- }>;
27
- getModelCategoryIds(modelId: Id64String): Observable<{
28
- drawing: Id64Array;
29
- spatial: Id64Array;
30
- }>;
31
- getAllCategories(): Observable<{
32
- drawing: Id64Set;
33
- spatial: Id64Set;
34
- }>;
35
- hasSubModel(elementId: Id64String): Observable<boolean>;
36
- getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Observable<number>;
15
+ constructor(props: ClassificationsTreeIdsCacheProps);
37
16
  private queryClassifications;
38
17
  private getClassificationsInfo;
39
- getAllContainedCategories(classificationOrTableIds: Id64Arg): Observable<{
40
- drawing: Id64Array;
41
- spatial: Id64Array;
42
- }>;
18
+ getAllContainedCategories(classificationOrTableIds: Id64Arg): Observable<Id64Array>;
43
19
  getDirectChildClassifications(classificationOrTableIds: Id64Arg): Observable<ClassificationId[]>;
44
20
  getClassificationsPathObs(classificationIds: Id64Arg): Observable<HierarchyNodeIdentifiersPath>;
45
21
  getAllClassifications(): Observable<ClassificationId[]>;
46
22
  private queryFilteredElementsData;
47
- getFilteredElementsData({ element2dIds, element3dIds, }: {
48
- element2dIds: Id64Arg;
49
- element3dIds: Id64Arg;
23
+ getFilteredElementsData({ elementIds, }: {
24
+ elementIds: Id64Arg;
50
25
  }): Observable<Map<ElementId, {
51
26
  categoryId: Id64String;
52
27
  modelId: Id64String;
28
+ categoryOfTopMostParentElement: CategoryId;
53
29
  }>>;
54
30
  clearFilteredElementsData(): void;
55
31
  }
32
+ export {};
56
33
  //# sourceMappingURL=ClassificationsTreeIdsCache.d.ts.map