@itwin/tree-widget-react 4.0.0-alpha.25 → 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 (192) 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 +2 -1
  16. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +75 -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 +3 -1
  19. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js.map +1 -1
  20. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +4 -2
  21. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +38 -23
  22. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  23. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +11 -21
  24. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +16 -168
  25. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  26. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.d.ts +65 -0
  27. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js +22 -0
  28. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js.map +1 -0
  29. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.d.ts +2 -2
  30. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js +4 -4
  31. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js.map +1 -1
  32. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +6 -10
  33. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +180 -88
  34. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -1
  35. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +14 -5
  36. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +43 -24
  37. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -1
  38. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.d.ts +3 -1
  39. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js +78 -17
  40. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js.map +1 -1
  41. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +2 -0
  42. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +4 -1
  43. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -1
  44. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +91 -114
  45. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -1
  46. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +2 -2
  47. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -1
  48. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.d.ts +1 -3
  49. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js +2 -4
  50. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js.map +1 -1
  51. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +13 -1
  52. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +62 -32
  53. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -1
  54. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +12 -9
  55. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +42 -38
  56. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -1
  57. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +15 -38
  58. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +59 -242
  59. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -1
  60. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.d.ts +29 -0
  61. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js +19 -0
  62. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js.map +1 -0
  63. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +4 -8
  64. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +154 -78
  65. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -1
  66. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +20 -6
  67. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -1
  68. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.d.ts +6 -10
  69. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js +104 -63
  70. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js.map +1 -1
  71. package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.d.ts +7 -0
  72. package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js +14 -0
  73. package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js.map +1 -0
  74. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +1 -1
  75. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -1
  76. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +2 -2
  77. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  78. package/lib/esm/tree-widget-react/components/trees/common/Utils.js +2 -2
  79. package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
  80. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +4 -4
  81. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +1 -1
  82. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  83. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +4 -4
  84. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
  85. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +7 -5
  86. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
  87. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +2 -2
  88. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
  89. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +5 -5
  90. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
  91. package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.d.ts +20 -0
  92. package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js +44 -0
  93. package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js.map +1 -0
  94. package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +4 -0
  95. package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -1
  96. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +12 -0
  97. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +2 -1
  98. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js.map +1 -1
  99. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +17 -6
  100. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +58 -29
  101. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -1
  102. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +8 -14
  103. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +22 -26
  104. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -1
  105. package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.d.ts → caches/AlwaysAndNeverDrawnElementInfoCache.d.ts} +15 -21
  106. package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.js → caches/AlwaysAndNeverDrawnElementInfoCache.js} +40 -38
  107. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js.map +1 -0
  108. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.d.ts +68 -0
  109. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js +148 -0
  110. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js.map +1 -0
  111. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.d.ts +30 -0
  112. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js +151 -0
  113. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js.map +1 -0
  114. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.d.ts +32 -0
  115. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js +106 -0
  116. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js.map +1 -0
  117. package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.d.ts → caches/ModelCategoryElementsCountCache.d.ts} +9 -2
  118. package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.js → caches/ModelCategoryElementsCountCache.js} +17 -21
  119. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModelCategoryElementsCountCache.js.map +1 -0
  120. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.d.ts +27 -0
  121. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js +106 -0
  122. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js.map +1 -0
  123. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.d.ts +23 -0
  124. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js +56 -0
  125. package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js.map +1 -0
  126. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +6 -6
  127. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +27 -17
  128. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -1
  129. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +7 -13
  130. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +36 -35
  131. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -1
  132. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.d.ts +18 -0
  133. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js +14 -1
  134. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js.map +1 -1
  135. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +46 -70
  136. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +229 -361
  137. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -1
  138. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +2 -2
  139. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  140. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  141. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +2 -2
  142. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  143. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  144. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +1 -1
  145. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  146. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +32 -19
  147. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  148. package/lib/esm/tree-widget-react/components/trees/index.d.ts +2 -1
  149. package/lib/esm/tree-widget-react/components/trees/index.js +2 -1
  150. package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
  151. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +4 -1
  152. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +4 -1
  153. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  154. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +7 -3
  155. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +36 -35
  156. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  157. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -0
  158. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +3 -1
  159. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  160. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +1 -0
  161. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +56 -26
  162. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  163. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +5 -3
  164. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +25 -12
  165. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  166. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +11 -23
  167. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +56 -189
  168. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  169. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.d.ts +52 -0
  170. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js +22 -0
  171. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js.map +1 -0
  172. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.d.ts +2 -2
  173. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js +8 -8
  174. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js.map +1 -1
  175. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +6 -10
  176. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +179 -72
  177. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -1
  178. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +6 -0
  179. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +20 -8
  180. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -1
  181. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.d.ts +4 -2
  182. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js +73 -13
  183. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js.map +1 -1
  184. package/lib/esm/tree-widget-react-internal.d.ts +1 -0
  185. package/lib/esm/tree-widget-react-internal.js +1 -0
  186. package/lib/esm/tree-widget-react-internal.js.map +1 -1
  187. package/package.json +77 -82
  188. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.d.ts +0 -20
  189. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js +0 -53
  190. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js.map +0 -1
  191. package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
  192. package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BaseSearchResultsTree.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,mBAAmB,EA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;aAChD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,MAAM,2BAA2B,GAAG,MAAM,yBAAyB,CAAC,yBAAyB,EAAE,CAAC;IAChG,OAAO;QACL,gBAAgB,EAAE,CAAC,IAAsE,EAAE,EAAE,CAAC,2BAA2B,CAAC,oBAAoB,CAAC,IAAI,CAAC;KACrJ,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 { Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyNode, HierarchyNodeIdentifier, HierarchyNodeKey, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\n\nimport type { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport type { ClassGroupingNodeKey, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\n/** @internal */\nexport type SearchResultsTreeNodeChildren<TSearchResultsTreeNode> = Map<Id64String, TSearchResultsTreeNode>;\n\n/**\n * A generic interface for a search results tree root node.\n *\n * It differs from `BaseSearchResultsTreeNode` in that it only contains children details and nothing else.\n * @internal\n */\nexport interface SearchResultsTreeRootNode<TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>> {\n children: SearchResultsTreeNodeChildren<TSearchResultsTreeNode>;\n}\n\n/**\n * A generic interface for a search results tree node.\n *\n * It represents every node in a search results tree structure.\n * @internal\n * */\nexport interface BaseSearchResultsTreeNode<TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>> {\n type: string;\n id: Id64String;\n children?: SearchResultsTreeNodeChildren<TSearchResultsTreeNode>;\n isSearchTarget: boolean;\n}\n\n/**\n * Class that provides methods to handle search results nodes in a tree structure.\n *\n * It provides two methods that can be shared across different search results trees:\n * - `processSearchResultsNodes` - processes search results nodes and returns a function to get search targets for a node.\n * - `accept` - accepts a new node and adds it to the tree structure.\n * @internal\n */\nexport abstract class SearchResultsNodesHandler<\n TProcessedSearchResultsNodes,\n TSearchTargets,\n TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>,\n> {\n public readonly root: SearchResultsTreeRootNode<TSearchResultsTreeNode> = {\n children: new Map(),\n };\n public readonly searchResultsNodesArr = new Array<TSearchResultsTreeNode>();\n\n /** Returns search results tree node type based on its' className */\n public abstract getType(className: string): Promise<TSearchResultsTreeNode[\"type\"]>;\n /** Converts nodes to search targets */\n public abstract convertNodesToSearchTargets(\n searchResultsNodes: TSearchResultsTreeNode[],\n processedSearchResultsNodes: TProcessedSearchResultsNodes,\n ): TSearchTargets | undefined;\n /**\n * Processes search results nodes.\n *\n * Nodes are created using search paths, and some information is not present in the search paths.\n * Because of this, some nodes may need to be processed to get additional information.\n *\n * E.g. Retrieving categoryId of elements can't be done using search paths.\n */\n public abstract getProcessedSearchResultsNodes(): Promise<TProcessedSearchResultsNodes>;\n /** Creates search results nodes */\n public abstract createSearchResultsTreeNode(props: {\n type: TSearchResultsTreeNode[\"type\"];\n id: Id64String;\n isSearchTarget: boolean;\n parent: TSearchResultsTreeNode | SearchResultsTreeRootNode<TSearchResultsTreeNode>;\n }): TSearchResultsTreeNode;\n\n public async processSearchResultsNodes(): Promise<{\n getNodeSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) => TSearchTargets | undefined;\n }> {\n const processedSearchResultsNodes = await this.getProcessedSearchResultsNodes();\n return {\n getNodeSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) =>\n this.getNodeSearchTargets(node, processedSearchResultsNodes),\n };\n }\n\n /** Takes a new node and adds it to the tree structure. */\n public async accept(props: {\n instanceKey: InstanceKey;\n parentNode: TSearchResultsTreeNode | SearchResultsTreeRootNode<TSearchResultsTreeNode>;\n isSearchTarget: boolean;\n }): Promise<TSearchResultsTreeNode> {\n const { instanceKey, parentNode, isSearchTarget } = props;\n const type = await this.getType(instanceKey.className);\n\n const newNode = this.createSearchResultsTreeNode({\n type,\n id: instanceKey.id,\n isSearchTarget,\n parent: parentNode,\n });\n (parentNode.children ??= new Map()).set(instanceKey.id, newNode);\n this.searchResultsNodesArr.push(newNode);\n return newNode;\n }\n\n /** Takes a specific node and gets all search targets related to it. */\n private getNodeSearchTargets(\n node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey },\n processedSearchResultsNodes: TProcessedSearchResultsNodes,\n ): TSearchTargets | undefined {\n let lookupParents: Array<SearchResultsTreeRootNode<TSearchResultsTreeNode> | TSearchResultsTreeNode> = [this.root];\n\n // find the search results parent nodes of the `node`\n for (const parentKey of node.parentKeys) {\n if (!HierarchyNodeKey.isInstances(parentKey)) {\n continue;\n }\n\n // tree node might be merged from multiple instances. As search results tree stores only one instance per node, we need to find all matching nodes\n // and use them when checking for matching node in one level deeper.\n const parentNodes = this.findMatchingSearchResultsNodes(\n lookupParents,\n parentKey.instanceKeys.map((key) => key.id),\n );\n if (parentNodes.length === 0) {\n return undefined;\n }\n lookupParents = parentNodes;\n }\n\n const ids = HierarchyNode.isInstancesNode(node) ? node.key.instanceKeys.map(({ id }) => id) : node.groupedInstanceKeys.map(({ id }) => id);\n // find search results nodes that match the `node`\n const searchResultsNodes = this.findMatchingSearchResultsNodes(lookupParents, ids);\n if (searchResultsNodes.length === 0) {\n return undefined;\n }\n\n return this.convertNodesToSearchTargets(searchResultsNodes, processedSearchResultsNodes);\n }\n\n /** Finds search results nodes that match the given keys. */\n private findMatchingSearchResultsNodes(lookupParents: Array<SearchResultsTreeRootNode<TSearchResultsTreeNode> | TSearchResultsTreeNode>, ids: Id64Arg) {\n return lookupParents.flatMap((lookup) => {\n const childrenArray = Array<TSearchResultsTreeNode>();\n for (const id of Id64.iterable(ids)) {\n const node = lookup.children?.get(id);\n if (node) {\n childrenArray.push(node);\n }\n }\n return childrenArray;\n });\n }\n}\n\n/** @internal */\nexport interface SearchResultsTree<TSearchTargets> {\n getSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) => TSearchTargets | undefined;\n}\n\n/** @internal */\nexport interface CreateSearchResultsTreeProps<\n TProcessedSearchResultsNodes,\n TSearchTargets,\n TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>,\n> {\n searchResultsNodesHandler: SearchResultsNodesHandler<TProcessedSearchResultsNodes, TSearchTargets, TSearchResultsTreeNode>;\n searchPaths: HierarchySearchPath[];\n}\n\n/**\n * Function iterates over search paths and uses `searchResultsNodesHandler` to create a search results tree.\n * @internal\n */\nexport async function createSearchResultsTree<\n TProcessedSearchResultsNodes,\n TSearchTargets,\n TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>,\n>(props: CreateSearchResultsTreeProps<TProcessedSearchResultsNodes, TSearchTargets, TSearchResultsTreeNode>): Promise<SearchResultsTree<TSearchTargets>> {\n const { searchPaths, searchResultsNodesHandler } = props;\n\n for (const searchPath of searchPaths) {\n const normalizedPath = HierarchySearchPath.normalize(searchPath).path;\n\n let parentNode: SearchResultsTreeRootNode<TSearchResultsTreeNode> | TSearchResultsTreeNode = searchResultsNodesHandler.root;\n for (let i = 0; i < normalizedPath.length; ++i) {\n if (\"type\" in parentNode && \"isSearchTarget\" in parentNode && parentNode.isSearchTarget) {\n break;\n }\n\n const identifier = normalizedPath[i];\n\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(identifier)) {\n break;\n }\n\n const currentNode: TSearchResultsTreeNode | undefined = parentNode.children?.get(identifier.id);\n if (currentNode !== undefined) {\n parentNode = currentNode;\n continue;\n }\n parentNode = await searchResultsNodesHandler.accept({\n instanceKey: identifier,\n parentNode,\n isSearchTarget: i === normalizedPath.length - 1,\n });\n }\n }\n const processedSearchResultsNodes = await searchResultsNodesHandler.processSearchResultsNodes();\n return {\n getSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) => processedSearchResultsNodes.getNodeSearchTargets(node),\n };\n}\n"]}
1
+ {"version":3,"file":"BaseSearchResultsTree.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AA6ChI;;;;;;;GAOG;AACH,MAAM,OAAgB,yBAAyB;IAK7B,IAAI,GAAsD;QACxE,QAAQ,EAAE,IAAI,GAAG,EAAE;KACpB,CAAC;IACc,qBAAqB,GAAG,IAAI,KAAK,EAA0B,CAAC;IA4BrE,KAAK,CAAC,yBAAyB;QAGpC,MAAM,2BAA2B,GAAG,MAAM,IAAI,CAAC,8BAA8B,EAAE,CAAC;QAChF,OAAO;YACL,oBAAoB,EAAE,CAAC,IAAsE,EAAE,EAAE,CAC/F,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,2BAA2B,CAAC;SAC/D,CAAC;IACJ,CAAC;IAED,4EAA4E;IACrE,0CAA0C,CAAC,UAAuC;QACvF,OAAO,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,EAAE,EAAE,CAAC;IAC/C,CAAC;IAED,gHAAgH;IACzG,iEAAiE,CAAC,UAA+C;QACtH,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IACpD,CAAC;IAED,0DAA0D;IACnD,KAAK,CAAC,MAAM,CAAC,KAInB;QACC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;QAC1D,MAAM,IAAI,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AC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1J,KAAK,MAAM,UAAU,IAAI,iBAAiB,EAAE,CAAC;QAC3C,MAAM,cAAc,GAAG,mBAAmB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QAEtE,IAAI,UAAU,GAA+E,yBAAyB,CAAC,IAAI,CAAC;QAC5H,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YAC/C,IAAI,MAAM,IAAI,UAAU,IAAI,gBAAgB,IAAI,UAAU,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;gBACxF,MAAM;YACR,CAAC;YAED,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;YAErC,IAAI,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClE,MAAM;YACR,CAAC;YAED,MAAM,WAAW,GAAuC,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAChG,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,UAAU,GAAG,WAAW,CAAC;gBACzB,SAAS;YACX,CAAC;YACD,UAAU,GAAG,MAAM,yBAAyB,CAAC,MAAM,CAAC;gBAClD,WAAW,EAAE,UAAU;gBACvB,UAAU;gBACV,cAAc,EAAE,CAAC,KAAK,cAAc,CAAC,MAAM,GAAG,CAAC;aAChD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,MAAM,2BAA2B,GAAG,MAAM,yBAAyB,CAAC,yBAAyB,EAAE,CAAC;IAChG,OAAO;QACL,gBAAgB,EAAE,CAAC,IAAsE,EAAE,EAAE,CAAC,2BAA2B,CAAC,oBAAoB,CAAC,IAAI,CAAC;KACrJ,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 { Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyNode, HierarchyNodeIdentifier, HierarchyNodeKey, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\n\nimport type { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport type { ClassGroupingNodeKey, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\n/** @internal */\nexport type SearchResultsTreeNodeChildren<TSearchResultsTreeNode> = Map<Id64String, TSearchResultsTreeNode>;\n\n/**\n * A generic interface for a search results tree root node.\n *\n * It differs from `BaseSearchResultsTreeNode` in that it only contains children details and nothing else.\n * @internal\n */\nexport interface SearchResultsTreeRootNode<TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>> {\n children: SearchResultsTreeNodeChildren<TSearchResultsTreeNode>;\n}\n\ntype SearchResultsNodeType = string;\ntype SearchResultsNodeId = Id64String;\n\n/** @internal */\nexport interface SearchResultsNodeIdentifier {\n type: SearchResultsNodeType;\n id: SearchResultsNodeId;\n}\n/** @internal */\nexport type SearchResultsNodeIdentifierAsString = `${SearchResultsNodeType}-${SearchResultsNodeId}`;\n\n/**\n * A generic interface for a search results tree node.\n *\n * It represents every node in a search results tree structure.\n * @internal\n * */\nexport interface BaseSearchResultsTreeNode<TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>> {\n type: string;\n id: Id64String;\n children?: SearchResultsTreeNodeChildren<TSearchResultsTreeNode>;\n isSearchTarget: boolean;\n /** Represents the path from the root to this node. It depends on the hierarchy structure. */\n pathToNode: Array<SearchResultsNodeIdentifier>;\n}\n\n/**\n * Class that provides methods to handle search results nodes in a tree structure.\n *\n * It provides two methods that can be shared across different search results trees:\n * - `processSearchResultsNodes` - processes search results nodes and returns a function to get search targets for a node.\n * - `accept` - accepts a new node and adds it to the tree structure.\n * @internal\n */\nexport abstract class SearchResultsNodesHandler<\n TProcessedSearchResultsNodes,\n TSearchTargets,\n TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>,\n> {\n public readonly root: SearchResultsTreeRootNode<TSearchResultsTreeNode> = {\n children: new Map(),\n };\n public readonly searchResultsNodesArr = new Array<TSearchResultsTreeNode>();\n\n /** Returns search results tree node type based on its' className */\n public abstract getType(className: string): Promise<TSearchResultsTreeNode[\"type\"]>;\n /** Returns search results tree node className based on its' type */\n public abstract getClassName(type: TSearchResultsTreeNode[\"type\"]): string;\n /** Converts nodes to search targets */\n public abstract convertNodesToSearchTargets(\n searchResultsNodes: TSearchResultsTreeNode[],\n processedSearchResultsNodes: TProcessedSearchResultsNodes,\n ): TSearchTargets | undefined;\n /**\n * Processes search results nodes.\n *\n * Nodes are created using search paths, and some information is not present in the search paths.\n * Because of this, some nodes may need to be processed to get additional information.\n *\n * E.g. Retrieving categoryId of elements can't be done using search paths.\n */\n public abstract getProcessedSearchResultsNodes(): Promise<TProcessedSearchResultsNodes>;\n /** Creates search results nodes */\n public abstract createSearchResultsTreeNode(props: {\n type: TSearchResultsTreeNode[\"type\"];\n id: Id64String;\n isSearchTarget: boolean;\n parent: TSearchResultsTreeNode | SearchResultsTreeRootNode<TSearchResultsTreeNode>;\n }): TSearchResultsTreeNode;\n\n public async processSearchResultsNodes(): Promise<{\n getNodeSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) => TSearchTargets | undefined;\n }> {\n const processedSearchResultsNodes = await this.getProcessedSearchResultsNodes();\n return {\n getNodeSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) =>\n this.getNodeSearchTargets(node, processedSearchResultsNodes),\n };\n }\n\n /** Converts a search results node identifier to a string representation. */\n public convertSearchResultsNodeIdentifierToString(identifier: SearchResultsNodeIdentifier): SearchResultsNodeIdentifierAsString {\n return `${identifier.type}-${identifier.id}`;\n }\n\n /** Converts a string representation of a search results node identifier back to a hierarchy node identifier. */\n public convertSearchResultsNodeIdentifierStringToHierarchyNodeIdentifier(identifier: SearchResultsNodeIdentifierAsString): InstanceKey {\n const [type, id] = identifier.split(\"-\");\n return { className: this.getClassName(type), id };\n }\n\n /** Takes a new node and adds it to the tree structure. */\n public async accept(props: {\n instanceKey: InstanceKey;\n parentNode: TSearchResultsTreeNode | SearchResultsTreeRootNode<TSearchResultsTreeNode>;\n isSearchTarget: boolean;\n }): Promise<TSearchResultsTreeNode> {\n const { instanceKey, parentNode, isSearchTarget } = props;\n const type = await this.getType(instanceKey.className);\n\n const newNode = this.createSearchResultsTreeNode({\n type,\n id: instanceKey.id,\n isSearchTarget,\n parent: parentNode,\n });\n (parentNode.children ??= new Map()).set(instanceKey.id, newNode);\n this.searchResultsNodesArr.push(newNode);\n return newNode;\n }\n\n /** Takes a specific node and gets all search targets related to it. */\n private getNodeSearchTargets(\n node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey },\n processedSearchResultsNodes: TProcessedSearchResultsNodes,\n ): TSearchTargets | undefined {\n let lookupParents: Array<SearchResultsTreeRootNode<TSearchResultsTreeNode> | TSearchResultsTreeNode> = [this.root];\n\n // find the search results parent nodes of the `node`\n for (const parentKey of node.parentKeys) {\n if (!HierarchyNodeKey.isInstances(parentKey)) {\n continue;\n }\n\n // tree node might be merged from multiple instances. As search results tree stores only one instance per node, we need to find all matching nodes\n // and use them when checking for matching node in one level deeper.\n const parentNodes = this.findMatchingSearchResultsNodes(\n lookupParents,\n parentKey.instanceKeys.map((key) => key.id),\n );\n if (parentNodes.length === 0) {\n return undefined;\n }\n lookupParents = parentNodes;\n }\n\n const ids = HierarchyNode.isInstancesNode(node) ? node.key.instanceKeys.map(({ id }) => id) : node.groupedInstanceKeys.map(({ id }) => id);\n // find search results nodes that match the `node`\n const searchResultsNodes = this.findMatchingSearchResultsNodes(lookupParents, ids);\n if (searchResultsNodes.length === 0) {\n return undefined;\n }\n\n return this.convertNodesToSearchTargets(searchResultsNodes, processedSearchResultsNodes);\n }\n\n /** Finds search results nodes that match the given keys. */\n private findMatchingSearchResultsNodes(lookupParents: Array<SearchResultsTreeRootNode<TSearchResultsTreeNode> | TSearchResultsTreeNode>, ids: Id64Arg) {\n return lookupParents.flatMap((lookup) => {\n const childrenArray = Array<TSearchResultsTreeNode>();\n for (const id of Id64.iterable(ids)) {\n const node = lookup.children?.get(id);\n if (node) {\n childrenArray.push(node);\n }\n }\n return childrenArray;\n });\n }\n}\n\n/** @internal */\nexport interface SearchResultsTree<TSearchTargets> {\n getSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) => TSearchTargets | undefined;\n}\n\n/** @internal */\nexport interface CreateSearchResultsTreeProps<\n TProcessedSearchResultsNodes,\n TSearchTargets,\n TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>,\n> {\n searchResultsNodesHandler: SearchResultsNodesHandler<TProcessedSearchResultsNodes, TSearchTargets, TSearchResultsTreeNode>;\n searchPaths: HierarchySearchPath[];\n}\n\n/**\n * Function iterates over search paths and uses `searchResultsNodesHandler` to create a search results tree.\n * @internal\n */\nexport async function createSearchResultsTree<\n TProcessedSearchResultsNodes,\n TSearchTargets,\n TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>,\n>(props: CreateSearchResultsTreeProps<TProcessedSearchResultsNodes, TSearchTargets, TSearchResultsTreeNode>): Promise<SearchResultsTree<TSearchTargets>> {\n const { searchPaths, searchResultsNodesHandler } = props;\n // Sort search paths by their length, this ensures that nodes which have search target ancestors, and are search targets, won't be included in the\n // search results tree. Search results tree is only needed to find which nodes might have children missing. Since nodes which have search target ancestors\n // always have all children, they can be skipped.\n const sortedSearchPaths = searchPaths.sort((lhs, rhs) => HierarchySearchPath.normalize(lhs).path.length - HierarchySearchPath.normalize(rhs).path.length);\n for (const searchPath of sortedSearchPaths) {\n const normalizedPath = HierarchySearchPath.normalize(searchPath).path;\n\n let parentNode: SearchResultsTreeRootNode<TSearchResultsTreeNode> | TSearchResultsTreeNode = searchResultsNodesHandler.root;\n for (let i = 0; i < normalizedPath.length; ++i) {\n if (\"type\" in parentNode && \"isSearchTarget\" in parentNode && parentNode.isSearchTarget) {\n break;\n }\n\n const identifier = normalizedPath[i];\n\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(identifier)) {\n break;\n }\n\n const currentNode: TSearchResultsTreeNode | undefined = parentNode.children?.get(identifier.id);\n if (currentNode !== undefined) {\n parentNode = currentNode;\n continue;\n }\n parentNode = await searchResultsNodesHandler.accept({\n instanceKey: identifier,\n parentNode,\n isSearchTarget: i === normalizedPath.length - 1,\n });\n }\n }\n const processedSearchResultsNodes = await searchResultsNodesHandler.processSearchResultsNodes();\n return {\n getSearchTargets: (node: HierarchyNode & { key: ClassGroupingNodeKey | InstancesNodeKey }) => processedSearchResultsNodes.getNodeSearchTargets(node),\n };\n}\n"]}
@@ -1,9 +1,12 @@
1
1
  import type { Observable } from "rxjs";
2
- import type { Id64Arg, Id64Array, Id64Set, Id64String } from "@itwin/core-bentley";
3
- import type { HierarchyNode } from "@itwin/presentation-hierarchies";
2
+ import type { Id64Arg, Id64String } from "@itwin/core-bentley";
3
+ import type { ClassGroupingNodeKey, HierarchyNode, InstancesNodeKey } from "@itwin/presentation-hierarchies";
4
4
  import type { TreeWidgetViewport } from "../../TreeWidgetViewport.js";
5
5
  import type { HierarchyVisibilityHandlerOverridableMethod, HierarchyVisibilityOverrideHandler, VisibilityStatus } from "../../UseHierarchyVisibility.js";
6
- import type { AlwaysAndNeverDrawnElementInfo } from "../AlwaysAndNeverDrawnElementInfo.js";
6
+ import type { AlwaysAndNeverDrawnElementInfoCache } from "../caches/AlwaysAndNeverDrawnElementInfoCache.js";
7
+ import type { BaseIdsCacheImpl } from "../caches/BaseIdsCache.js";
8
+ import type { NonPartialVisibilityStatus } from "../Tooltip.js";
9
+ import type { CategoryId } from "../Types.js";
7
10
  /**
8
11
  * Functionality of tree visibility handler methods that can be overridden.
9
12
  * Each callback is provided original implementation and reference to a `HierarchyVisibilityHandler`.
@@ -38,44 +41,6 @@ export interface BaseTreeVisibilityHandlerOverrides {
38
41
  on: boolean;
39
42
  }) => Promise<void>>;
40
43
  }
41
- /** @internal */
42
- export interface BaseIdsCache {
43
- hasSubModel: (elementId: Id64String) => Observable<boolean>;
44
- getElementsCount: (props: {
45
- modelId: Id64String;
46
- categoryId: Id64String;
47
- }) => Observable<number>;
48
- getSubCategories: (props: {
49
- categoryId: Id64String;
50
- }) => Observable<Id64Array>;
51
- getModels: (props: {
52
- categoryIds: Id64Arg;
53
- }) => Observable<{
54
- id: Id64String;
55
- models: Id64Arg | undefined;
56
- }>;
57
- getCategories: (props: {
58
- modelIds: Id64Arg;
59
- }) => Observable<{
60
- id: Id64String;
61
- drawingCategories?: Id64Arg;
62
- spatialCategories?: Id64Arg;
63
- }>;
64
- getSubModels: (props: {
65
- modelIds: Id64Arg;
66
- categoryId?: Id64String;
67
- } | {
68
- categoryIds: Id64Arg;
69
- modelId: Id64String | undefined;
70
- }) => Observable<{
71
- id: Id64String;
72
- subModels: Id64Arg | undefined;
73
- }>;
74
- getAllCategories: () => Observable<{
75
- drawingCategories?: Id64Set;
76
- spatialCategories?: Id64Set;
77
- }>;
78
- }
79
44
  /**
80
45
  * Interface for a tree visibility handler that provides methods to get and change visibility status of hierarchy nodes.
81
46
  * @internal
@@ -83,16 +48,18 @@ export interface BaseIdsCache {
83
48
  export interface TreeSpecificVisibilityHandler<TSearchTargets> {
84
49
  getVisibilityStatus: (node: HierarchyNode) => Observable<VisibilityStatus>;
85
50
  changeVisibilityStatus: (node: HierarchyNode, on: boolean) => Observable<void>;
86
- getSearchTargetsVisibilityStatus: (targets: TSearchTargets) => Observable<VisibilityStatus>;
51
+ getSearchTargetsVisibilityStatus: (targets: TSearchTargets, node: HierarchyNode & {
52
+ key: ClassGroupingNodeKey | InstancesNodeKey;
53
+ }) => Observable<VisibilityStatus>;
87
54
  changeSearchTargetsVisibilityStatus: (targets: TSearchTargets, on: boolean) => Observable<void>;
88
55
  }
89
56
  /** @internal */
90
57
  export interface BaseVisibilityHelperProps {
91
58
  viewport: TreeWidgetViewport;
92
- alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;
59
+ alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfoCache;
93
60
  overrideHandler?: HierarchyVisibilityOverrideHandler;
94
61
  overrides?: BaseTreeVisibilityHandlerOverrides;
95
- baseIdsCache: BaseIdsCache;
62
+ baseIdsCache: BaseIdsCacheImpl;
96
63
  }
97
64
  /**
98
65
  * Base class for visibility status getters and modifiers.
@@ -110,7 +77,7 @@ export declare class BaseVisibilityHelper implements Disposable {
110
77
  * This is achieved by:
111
78
  * - Resets `alwaysDrawn` exclusive flag to `false`;
112
79
  * - Turns off all categories;
113
- * - Clears always drawn list;
80
+ * - Clears never drawn list;
114
81
  * - Removes all per-model category overrides. */
115
82
  removeAlwaysDrawnExclusive(): Observable<void>;
116
83
  /**
@@ -123,25 +90,11 @@ export declare class BaseVisibilityHelper implements Disposable {
123
90
  */
124
91
  getModelsVisibilityStatus(props: {
125
92
  modelIds: Id64Arg;
126
- type: "GeometricModel3d" | "GeometricModel2d";
127
93
  }): Observable<VisibilityStatus>;
128
- /**
129
- * Gets visibility status of a model's categories, assuming model is visible.
130
- *
131
- * Determines visibility status by checking:
132
- * - Elements in the viewports' always/never drawn lists;
133
- * - Default categories visibility status in the viewport;
134
- * - SubModels that are related to the modelId and categoryIds
135
- */
136
- private getVisibleModelCategoriesVisibilityStatus;
137
- /** Gets visibility status of sub-categories, assuming category is visible. */
138
- private getVisibleCategorySubCategoriesVisibilityStatus;
139
94
  /**
140
95
  * Gets visibility status of sub-categories.
141
96
  *
142
97
  * Determines visibility status by checking:
143
- * - Models that contain the category visibility;
144
- * - Per model category visibility overrides;
145
98
  * - Category selector visibility in the viewport.
146
99
  * - Sub-categories visibility in the viewport.
147
100
  */
@@ -160,19 +113,27 @@ export declare class BaseVisibilityHelper implements Disposable {
160
113
  getCategoriesVisibilityStatus(props: {
161
114
  categoryIds: Id64Arg;
162
115
  modelId: Id64String | undefined;
163
- type: "DrawingCategory" | "SpatialCategory";
164
116
  }): Observable<VisibilityStatus>;
165
117
  /**
166
- * Gets visibility status of categories, assuming model is visible.
118
+ * Gets visibility status of a model's category.
119
+ *
120
+ * Determines visibility status by checking:
121
+ * - Elements in the viewports' always/never drawn lists;
122
+ * - Default categories visibility status in the viewport;
123
+ * - SubModels that are related to the modelId and categoryId.
124
+ */
125
+ private getModelWithCategoryVisibilityStatus;
126
+ /**
127
+ * Gets visibility status of category, assuming model is visible.
167
128
  *
168
129
  * Determines visibility status by checking:
169
130
  * - Per model category visibility overrides;
170
131
  * - Category selector visibility in the viewport.
171
132
  */
172
- getVisibleModelCategoriesDirectVisibilityStatus({ modelId, categoryIds }: {
173
- categoryIds: Id64Arg;
133
+ getVisibleModelCategoryDirectVisibilityStatus({ modelId, categoryId }: {
134
+ categoryId: Id64String;
174
135
  modelId: Id64String;
175
- }): VisibilityStatus;
136
+ }): NonPartialVisibilityStatus;
176
137
  /**
177
138
  * Gets visibility status of elements.
178
139
  *
@@ -185,7 +146,9 @@ export declare class BaseVisibilityHelper implements Disposable {
185
146
  elementIds: Id64Arg;
186
147
  modelId: Id64String;
187
148
  categoryId: Id64String;
188
- type: "GeometricElement3d" | "GeometricElement2d";
149
+ categoryOfTopMostParentElement: CategoryId;
150
+ parentElementsIdsPath: Array<Id64Arg>;
151
+ childrenCount: number | undefined;
189
152
  }): Observable<VisibilityStatus>;
190
153
  /** Gets visibility status of elements based on viewport's always/never drawn elements and related categories and models. */
191
154
  private getVisibilityFromAlwaysAndNeverDrawnElements;
@@ -205,16 +168,28 @@ export declare class BaseVisibilityHelper implements Disposable {
205
168
  /**
206
169
  * Changes categories visibility status.
207
170
  *
208
- * Also:
209
- * - Turns on models in cases where categories need to be turned on and models are not already on.
210
- * - Removed related elements from always/never drawn elements.
211
- * - changes visibility of sub-models that are related to the specified categories.
171
+ * - Changes category selector for specified categories
172
+ * - Removes per-model category overrides
173
+ * - Clears always and never drawn elements related to those categories
174
+ * - Changes sub-models visibility status that are related to specified categories.
175
+ * - If `on` is set to true:
176
+ * - Turns on models of those categories without affecting any visibilities
177
+ * - Turns on sub-categories visibility status of specified categories.
212
178
  */
213
179
  changeCategoriesVisibilityStatus(props: {
214
- modelId: Id64String | undefined;
215
180
  categoryIds: Id64Arg;
216
181
  on: boolean;
182
+ modelId: Id64String | undefined;
217
183
  }): Observable<void>;
184
+ /**
185
+ * Changes categories under specific model visibility status.
186
+ *
187
+ * - Turns on model without affecting it's elements or categories
188
+ * - sets per-model category overrides for specified categories.
189
+ * - Clears always and never drawn elements related to those categories
190
+ * - Changes sub-models visibility status that are related to specified categories in the model.
191
+ */
192
+ private changeCategoriesUnderModelVisibilityStatus;
218
193
  /**
219
194
  * Changes visibility status of elements by adding them to the viewport's always/never drawn elements.
220
195
  *
@@ -225,6 +200,7 @@ export declare class BaseVisibilityHelper implements Disposable {
225
200
  modelId: Id64String;
226
201
  categoryId: Id64String;
227
202
  on: boolean;
203
+ children: Id64Arg | undefined;
228
204
  }): Observable<void>;
229
205
  /** Queues visibility change for elements. */
230
206
  private queueElementsVisibilityChange;