@itwin/tree-widget-react 3.0.0-dev.1 → 3.0.0-dev.3

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 (233) hide show
  1. package/README.md +136 -1
  2. package/lib/cjs/components/SelectableTree.d.ts +12 -6
  3. package/lib/cjs/components/SelectableTree.js.map +1 -1
  4. package/lib/cjs/components/TreeSelector.d.ts +2 -2
  5. package/lib/cjs/components/TreeSelector.js.map +1 -1
  6. package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +3 -2
  7. package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
  8. package/lib/cjs/components/tree-header/TreeHeader.d.ts +1 -1
  9. package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
  10. package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +6 -5
  11. package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +8 -9
  12. package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  13. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.d.ts +3 -3
  14. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js +3 -3
  15. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  16. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.d.ts +4 -4
  17. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +7 -7
  18. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  19. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +1 -5
  20. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js +0 -5
  21. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  22. package/lib/cjs/components/trees/common/FocusedInstancesContext.d.ts +0 -3
  23. package/lib/cjs/components/trees/common/FocusedInstancesContext.js +0 -2
  24. package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -1
  25. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.d.ts +0 -1
  26. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js +0 -1
  27. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js.map +1 -1
  28. package/lib/cjs/components/trees/common/UseFiltering.d.ts +0 -1
  29. package/lib/cjs/components/trees/common/UseFiltering.js +0 -1
  30. package/lib/cjs/components/trees/common/UseFiltering.js.map +1 -1
  31. package/lib/cjs/components/trees/common/UseHierarchiesLocalization.d.ts +0 -1
  32. package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js +1 -1
  33. package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js.map +1 -1
  34. package/lib/cjs/components/trees/common/UseHierarchyFiltering.d.ts +1 -7
  35. package/lib/cjs/components/trees/common/UseHierarchyFiltering.js +4 -3
  36. package/lib/cjs/components/trees/common/UseHierarchyFiltering.js.map +1 -1
  37. package/lib/cjs/components/trees/common/UseHierarchyVisibility.d.ts +15 -10
  38. package/lib/cjs/components/trees/common/UseHierarchyVisibility.js +20 -17
  39. package/lib/cjs/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  40. package/lib/cjs/components/trees/common/UseIModelChangeListener.d.ts +0 -1
  41. package/lib/cjs/components/trees/common/UseIModelChangeListener.js +0 -1
  42. package/lib/cjs/components/trees/common/UseIModelChangeListener.js.map +1 -1
  43. package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.d.ts +0 -1
  44. package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js +0 -1
  45. package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js.map +1 -1
  46. package/lib/cjs/components/trees/common/UseNodeHighlighting.d.ts +9 -5
  47. package/lib/cjs/components/trees/common/UseNodeHighlighting.js +15 -24
  48. package/lib/cjs/components/trees/common/UseNodeHighlighting.js.map +1 -1
  49. package/lib/cjs/components/trees/common/UseTelemetryContext.d.ts +29 -0
  50. package/lib/cjs/components/trees/common/UseTelemetryContext.js +49 -0
  51. package/lib/cjs/components/trees/common/UseTelemetryContext.js.map +1 -0
  52. package/lib/cjs/components/trees/common/Utils.d.ts +3 -0
  53. package/lib/cjs/components/trees/common/Utils.js +11 -1
  54. package/lib/cjs/components/trees/common/Utils.js.map +1 -1
  55. package/lib/cjs/components/trees/common/components/Delayed.d.ts +0 -1
  56. package/lib/cjs/components/trees/common/components/Delayed.js +0 -1
  57. package/lib/cjs/components/trees/common/components/Delayed.js.map +1 -1
  58. package/lib/cjs/components/trees/common/components/ProgressOverlay.d.ts +0 -1
  59. package/lib/cjs/components/trees/common/components/ProgressOverlay.js +0 -1
  60. package/lib/cjs/components/trees/common/components/ProgressOverlay.js.map +1 -1
  61. package/lib/cjs/components/trees/common/components/Tree.d.ts +54 -0
  62. package/lib/cjs/components/trees/common/components/{BaseTree.js → Tree.js} +26 -22
  63. package/lib/cjs/components/trees/common/components/Tree.js.map +1 -0
  64. package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.d.ts +14 -7
  65. package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
  66. package/lib/cjs/components/trees/common/components/TreeNodeRenderer.d.ts +7 -6
  67. package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js +1 -1
  68. package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js.map +1 -1
  69. package/lib/cjs/components/trees/common/components/TreeRenderer.d.ts +13 -5
  70. package/lib/cjs/components/trees/common/components/TreeRenderer.js +21 -4
  71. package/lib/cjs/components/trees/common/components/TreeRenderer.js.map +1 -1
  72. package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +27 -9
  73. package/lib/cjs/components/trees/common/components/VisibilityTree.js +8 -23
  74. package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -1
  75. package/lib/cjs/components/trees/common/components/VisibilityTreeRenderer.d.ts +12 -0
  76. package/lib/cjs/components/trees/common/components/VisibilityTreeRenderer.js +26 -0
  77. package/lib/cjs/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -0
  78. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +8 -7
  79. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js +7 -10
  80. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  81. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +5 -5
  82. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +3 -3
  83. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  84. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +8 -7
  85. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js +9 -12
  86. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  87. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +5 -5
  88. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +3 -3
  89. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  90. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  91. package/lib/cjs/components/trees/index.d.ts +7 -0
  92. package/lib/cjs/components/trees/index.js +11 -1
  93. package/lib/cjs/components/trees/index.js.map +1 -1
  94. package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +10 -9
  95. package/lib/cjs/components/trees/models-tree/ModelsTree.js +19 -20
  96. package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
  97. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +10 -5
  98. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +19 -6
  99. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  100. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +11 -5
  101. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +15 -23
  102. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  103. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.d.ts +9 -5
  104. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  105. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +11 -3
  106. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  107. package/lib/cjs/tree-widget-react.d.ts +1 -1
  108. package/lib/cjs/tree-widget-react.js.map +1 -1
  109. package/lib/esm/components/SelectableTree.d.ts +12 -6
  110. package/lib/esm/components/SelectableTree.js.map +1 -1
  111. package/lib/esm/components/TreeSelector.d.ts +2 -2
  112. package/lib/esm/components/TreeSelector.js.map +1 -1
  113. package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +3 -2
  114. package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
  115. package/lib/esm/components/tree-header/TreeHeader.d.ts +1 -1
  116. package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
  117. package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +6 -5
  118. package/lib/esm/components/trees/categories-tree/CategoriesTree.js +8 -9
  119. package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  120. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.d.ts +3 -3
  121. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js +3 -3
  122. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  123. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.d.ts +4 -4
  124. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +7 -7
  125. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  126. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +1 -5
  127. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js +0 -5
  128. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  129. package/lib/esm/components/trees/common/FocusedInstancesContext.d.ts +0 -3
  130. package/lib/esm/components/trees/common/FocusedInstancesContext.js +0 -2
  131. package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -1
  132. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.d.ts +0 -1
  133. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js +0 -1
  134. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js.map +1 -1
  135. package/lib/esm/components/trees/common/UseFiltering.d.ts +0 -1
  136. package/lib/esm/components/trees/common/UseFiltering.js +0 -1
  137. package/lib/esm/components/trees/common/UseFiltering.js.map +1 -1
  138. package/lib/esm/components/trees/common/UseHierarchiesLocalization.d.ts +0 -1
  139. package/lib/esm/components/trees/common/UseHierarchiesLocalization.js +1 -1
  140. package/lib/esm/components/trees/common/UseHierarchiesLocalization.js.map +1 -1
  141. package/lib/esm/components/trees/common/UseHierarchyFiltering.d.ts +1 -7
  142. package/lib/esm/components/trees/common/UseHierarchyFiltering.js +4 -3
  143. package/lib/esm/components/trees/common/UseHierarchyFiltering.js.map +1 -1
  144. package/lib/esm/components/trees/common/UseHierarchyVisibility.d.ts +15 -10
  145. package/lib/esm/components/trees/common/UseHierarchyVisibility.js +20 -17
  146. package/lib/esm/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  147. package/lib/esm/components/trees/common/UseIModelChangeListener.d.ts +0 -1
  148. package/lib/esm/components/trees/common/UseIModelChangeListener.js +0 -1
  149. package/lib/esm/components/trees/common/UseIModelChangeListener.js.map +1 -1
  150. package/lib/esm/components/trees/common/UseMultiCheckboxHandler.d.ts +0 -1
  151. package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js +0 -1
  152. package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js.map +1 -1
  153. package/lib/esm/components/trees/common/UseNodeHighlighting.d.ts +9 -5
  154. package/lib/esm/components/trees/common/UseNodeHighlighting.js +14 -23
  155. package/lib/esm/components/trees/common/UseNodeHighlighting.js.map +1 -1
  156. package/lib/esm/components/trees/common/UseTelemetryContext.d.ts +29 -0
  157. package/lib/esm/components/trees/common/UseTelemetryContext.js +43 -0
  158. package/lib/esm/components/trees/common/UseTelemetryContext.js.map +1 -0
  159. package/lib/esm/components/trees/common/Utils.d.ts +3 -0
  160. package/lib/esm/components/trees/common/Utils.js +9 -0
  161. package/lib/esm/components/trees/common/Utils.js.map +1 -1
  162. package/lib/esm/components/trees/common/components/Delayed.d.ts +0 -1
  163. package/lib/esm/components/trees/common/components/Delayed.js +0 -1
  164. package/lib/esm/components/trees/common/components/Delayed.js.map +1 -1
  165. package/lib/esm/components/trees/common/components/ProgressOverlay.d.ts +0 -1
  166. package/lib/esm/components/trees/common/components/ProgressOverlay.js +0 -1
  167. package/lib/esm/components/trees/common/components/ProgressOverlay.js.map +1 -1
  168. package/lib/esm/components/trees/common/components/Tree.d.ts +54 -0
  169. package/lib/esm/components/trees/common/components/{BaseTree.js → Tree.js} +25 -21
  170. package/lib/esm/components/trees/common/components/Tree.js.map +1 -0
  171. package/lib/esm/components/trees/common/components/TreeNodeCheckbox.d.ts +14 -7
  172. package/lib/esm/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
  173. package/lib/esm/components/trees/common/components/TreeNodeRenderer.d.ts +7 -6
  174. package/lib/esm/components/trees/common/components/TreeNodeRenderer.js +1 -1
  175. package/lib/esm/components/trees/common/components/TreeNodeRenderer.js.map +1 -1
  176. package/lib/esm/components/trees/common/components/TreeRenderer.d.ts +13 -5
  177. package/lib/esm/components/trees/common/components/TreeRenderer.js +21 -4
  178. package/lib/esm/components/trees/common/components/TreeRenderer.js.map +1 -1
  179. package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +27 -9
  180. package/lib/esm/components/trees/common/components/VisibilityTree.js +8 -23
  181. package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -1
  182. package/lib/esm/components/trees/common/components/VisibilityTreeRenderer.d.ts +12 -0
  183. package/lib/esm/components/trees/common/components/VisibilityTreeRenderer.js +22 -0
  184. package/lib/esm/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -0
  185. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +8 -7
  186. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +7 -10
  187. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  188. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +5 -5
  189. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +3 -3
  190. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  191. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +8 -7
  192. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +9 -12
  193. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  194. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +5 -5
  195. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +3 -3
  196. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  197. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  198. package/lib/esm/components/trees/index.d.ts +7 -0
  199. package/lib/esm/components/trees/index.js +5 -0
  200. package/lib/esm/components/trees/index.js.map +1 -1
  201. package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +10 -9
  202. package/lib/esm/components/trees/models-tree/ModelsTree.js +19 -20
  203. package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
  204. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +10 -5
  205. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +18 -6
  206. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  207. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +11 -5
  208. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +16 -24
  209. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  210. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.d.ts +9 -5
  211. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  212. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +11 -3
  213. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  214. package/lib/esm/tree-widget-react.d.ts +1 -1
  215. package/lib/esm/tree-widget-react.js.map +1 -1
  216. package/lib/public/locales/en/TreeWidget.json +2 -1
  217. package/package.json +2 -2
  218. package/lib/cjs/components/trees/common/UseFeatureReporting.d.ts +0 -34
  219. package/lib/cjs/components/trees/common/UseFeatureReporting.js +0 -39
  220. package/lib/cjs/components/trees/common/UseFeatureReporting.js.map +0 -1
  221. package/lib/cjs/components/trees/common/UsePerformanceReporting.d.ts +0 -18
  222. package/lib/cjs/components/trees/common/UsePerformanceReporting.js +0 -25
  223. package/lib/cjs/components/trees/common/UsePerformanceReporting.js.map +0 -1
  224. package/lib/cjs/components/trees/common/components/BaseTree.d.ts +0 -34
  225. package/lib/cjs/components/trees/common/components/BaseTree.js.map +0 -1
  226. package/lib/esm/components/trees/common/UseFeatureReporting.d.ts +0 -34
  227. package/lib/esm/components/trees/common/UseFeatureReporting.js +0 -34
  228. package/lib/esm/components/trees/common/UseFeatureReporting.js.map +0 -1
  229. package/lib/esm/components/trees/common/UsePerformanceReporting.d.ts +0 -18
  230. package/lib/esm/components/trees/common/UsePerformanceReporting.js +0 -21
  231. package/lib/esm/components/trees/common/UsePerformanceReporting.js.map +0 -1
  232. package/lib/esm/components/trees/common/components/BaseTree.d.ts +0 -34
  233. package/lib/esm/components/trees/common/components/BaseTree.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeButtons.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeButtons.tsx"],"names":[],"mapp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AAQ,CACf,CAAC;QACJ,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAjBD,sCAiBC;AAED,gBAAgB;AAChB,SAAgB,eAAe,CAAC,KAAsC;IACpE,OAAO,CACL,uBAAC,0BAAU,IACT,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACpE,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,wBAAwB,CAAC,CAAC;YAChD,KAAK,IAAA,+CAAmB,EAAC,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzF,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAdD,0CAcC","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 { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { hideAllCategories, invertAllCategories, showAllCategories } from \"../common/CategoriesVisibilityUtils\";\n\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\n\n/**\n * Props that get passed to `CategoriesTreeComponent` header button renderer.\n * @see CategoriesTreeComponentProps.headerButtons\n * @public\n */\nexport interface CategoriesTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of categories available in the iModel */\n categories: CategoryInfo[];\n /** In case the tree is filtered, a list of filtered categories. */\n filteredCategories?: CategoryInfo[];\n}\n\n/** @internal */\nexport function ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"categoriesTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-showall`);\n void showAllCategories(\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\n/** @internal */\nexport function HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"categoriesTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-hideall`);\n void hideAllCategories(\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\n/** @internal */\nexport function InvertAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n title={TreeWidget.translate(\"categoriesTree.buttons.invert.tooltip\")}\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-invert`);\n void invertAllCategories(props.filteredCategories ?? props.categories, props.viewport);\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeButtons.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeButtons.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oEAAqG;AACrG,wDAAkD;AAClD,oDAAiD;AACjD,mFAAgH;AAiBhH,cAAc;AACd,SAAgB,aAAa,CAAC,KAAsC;IAClE,OAAO,CACL,uBAAC,0BAAU,IACT,IAAI,EAAE,KAAK,CA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AU,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACpE,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,wBAAwB,CAAC,CAAC;YAChD,KAAK,IAAA,+CAAmB,EAAC,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzF,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAdD,0CAcC","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 { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { hideAllCategories, invertAllCategories, showAllCategories } from \"../common/CategoriesVisibilityUtils\";\n\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\n\n/**\n * Props that get passed to `CategoriesTreeComponent` header button renderer.\n * @see CategoriesTreeComponentProps.headerButtons\n * @public\n */\nexport interface CategoriesTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of categories available in the iModel */\n categories: CategoryInfo[];\n /** In case the tree is filtered, a list of filtered categories. */\n filteredCategories?: CategoryInfo[];\n}\n\n/** @public */\nexport function ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"categoriesTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-showall`);\n void showAllCategories(\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\n/** @public */\nexport function HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"categoriesTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-hideall`);\n void hideAllCategories(\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\n/** @public */\nexport function InvertAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n title={TreeWidget.translate(\"categoriesTree.buttons.invert.tooltip\")}\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-invert`);\n void invertAllCategories(props.filteredCategories ?? props.categories, props.viewport);\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n"]}
@@ -2,10 +2,9 @@ import "../Tree.scss";
2
2
  import { CategoriesTree } from "./CategoriesTree";
3
3
  import { HideAllButton, InvertAllButton, ShowAllButton } from "./CategoriesTreeButtons";
4
4
  import type { ComponentPropsWithoutRef } from "react";
5
- import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
6
5
  import type { CategoriesTreeHeaderButtonProps } from "./CategoriesTreeButtons";
7
- type CategoriesTreeProps = ComponentPropsWithoutRef<typeof CategoriesTree>;
8
- interface CategoriesTreeComponentProps extends Pick<CategoriesTreeProps, "getSchemaContext" | "density" | "hierarchyLevelConfig" | "selectionMode" | "onPerformanceMeasured" | "onFeatureUsed"> {
6
+ /** @public */
7
+ interface CategoriesTreeComponentProps extends Pick<ComponentPropsWithoutRef<typeof CategoriesTree>, "getSchemaContext" | "selectionStorage" | "density" | "hierarchyLevelConfig" | "selectionMode"> {
9
8
  /**
10
9
  * Renderers of header buttons. Defaults to:
11
10
  * ```ts
@@ -17,7 +16,8 @@ interface CategoriesTreeComponentProps extends Pick<CategoriesTreeProps, "getSch
17
16
  * ```
18
17
  */
19
18
  headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;
20
- selectionStorage: SelectionStorage;
19
+ onPerformanceMeasured?: (featureId: string, duration: number) => void;
20
+ onFeatureUsed?: (feature: string) => void;
21
21
  }
22
22
  /**
23
23
  * A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.
@@ -14,11 +14,11 @@ const classnames_1 = __importDefault(require("classnames"));
14
14
  const react_1 = require("react");
15
15
  const appui_react_1 = require("@itwin/appui-react");
16
16
  const core_frontend_1 = require("@itwin/core-frontend");
17
- const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
18
17
  const TreeWidget_1 = require("../../../TreeWidget");
19
18
  const TreeHeader_1 = require("../../tree-header/TreeHeader");
20
19
  const AutoSizer_1 = require("../../utils/AutoSizer");
21
20
  const UseFiltering_1 = require("../common/UseFiltering");
21
+ const UseTelemetryContext_1 = require("../common/UseTelemetryContext");
22
22
  const CategoriesTree_1 = require("./CategoriesTree");
23
23
  const CategoriesTreeButtons_1 = require("./CategoriesTreeButtons");
24
24
  const UseCategories_1 = require("./UseCategories");
@@ -60,16 +60,16 @@ exports.CategoriesTreeComponent.id = "categories-tree-v2";
60
60
  * @public
61
61
  */
62
62
  exports.CategoriesTreeComponent.getLabel = () => TreeWidget_1.TreeWidget.translate("categoriesTree.label");
63
- function CategoriesTreeComponentImpl({ iModel, viewport, headerButtons, selectionStorage, ...treeProps }) {
63
+ function CategoriesTreeComponentImpl({ iModel, viewport, headerButtons, onPerformanceMeasured, onFeatureUsed, ...treeProps }) {
64
64
  const categories = (0, UseCategories_1.useCategories)(core_frontend_1.IModelApp.viewManager, iModel, viewport);
65
65
  const { filter, applyFilter, clearFilter } = (0, UseFiltering_1.useFiltering)();
66
66
  const density = treeProps.density;
67
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)("tw-tree-with-header", density === "enlarged" && "enlarge"), children: (0, jsx_runtime_1.jsxs)(presentation_hierarchies_react_1.UnifiedSelectionProvider, { storage: selectionStorage, children: [(0, jsx_runtime_1.jsx)(TreeHeader_1.TreeHeader, { onFilterStart: applyFilter, onFilterClear: clearFilter, onSelectedChanged: () => { }, density: density, children: headerButtons
68
- ? headerButtons.map((btn, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: btn({ viewport, categories, onFeatureUsed: treeProps.onFeatureUsed }) }, index))
67
+ return ((0, jsx_runtime_1.jsx)(UseTelemetryContext_1.TelemetryContextProvider, { componentIdentifier: exports.CategoriesTreeComponent.id, onFeatureUsed: onFeatureUsed, onPerformanceMeasured: onPerformanceMeasured, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)("tw-tree-with-header", density === "enlarged" && "enlarge"), children: [(0, jsx_runtime_1.jsx)(TreeHeader_1.TreeHeader, { onFilterStart: applyFilter, onFilterClear: clearFilter, onSelectedChanged: () => { }, density: density, children: headerButtons
68
+ ? headerButtons.map((btn, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: btn({ viewport, categories, onFeatureUsed }) }, index))
69
69
  : [
70
- (0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.ShowAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "show-all-btn"),
71
- (0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.HideAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "hide-all-btn"),
72
- (0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.InvertAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "invert-all-btn"),
70
+ (0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.ShowAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: onFeatureUsed }, "show-all-btn"),
71
+ (0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.HideAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: onFeatureUsed }, "hide-all-btn"),
72
+ (0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.InvertAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: onFeatureUsed }, "invert-all-btn"),
73
73
  ] }), (0, jsx_runtime_1.jsx)("div", { className: "tw-tree-content", children: (0, jsx_runtime_1.jsx)(AutoSizer_1.AutoSizer, { children: ({ width, height }) => ((0, jsx_runtime_1.jsx)(CategoriesTree_1.CategoriesTree, { ...treeProps, imodel: iModel, categories: categories, activeView: viewport, width: width, height: height, filter: filter })) }) })] }) }));
74
74
  }
75
75
  //# sourceMappingURL=CategoriesTreeComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;gGAGgG;AAEhG,wBAAsB;AACtB,4DAAoC;AACpC,iCAAiC;AACjC,oDAAkF;AAClF,wDAAiD;AACjD,0FAAiF;AACjF,oDAAiD;AACjD,6DAA0D;AAC1D,qDAAkD;AAClD,yDAAsD;AACtD,qDAAkD;AAClD,mEAAwF;AACxF,mDAAgD;AAyBhD;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAmC,EAAE,EAAE;IAC7E,MAAM,MAAM,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAA,+BAAiB,GAAE,CAAC;IAErC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,uBAAC,2BAA2B,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,G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E,CAAC,IAA7E,KAAK,CAAoF,CAAC;wBAC7I,CAAC,CAAC;4BACE,uBAAC,qCAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAqB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,aAAa,IAAvE,cAAc,CAA6D;4BAC1I,uBAAC,qCAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAqB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,aAAa,IAAvE,cAAc,CAA6D;4BAC1I,uBAAC,uCAAe,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAuB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,aAAa,IAAzE,gBAAgB,CAA6D;yBAC/I,GACM,EACb,gCAAK,SAAS,EAAC,iBAAiB,YAC9B,uBAAC,qBAAS,cACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,uBAAC,+BAAc,OAAK,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CAC9I,GACS,GACR,IACmB,GACvB,CACP,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 \"../Tree.scss\";\nimport classNames from \"classnames\";\nimport { Fragment } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UnifiedSelectionProvider } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeHeader } from \"../../tree-header/TreeHeader\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport { useFiltering } from \"../common/UseFiltering\";\nimport { CategoriesTree } from \"./CategoriesTree\";\nimport { HideAllButton, InvertAllButton, ShowAllButton } from \"./CategoriesTreeButtons\";\nimport { useCategories } from \"./UseCategories\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { CategoriesTreeHeaderButtonProps } from \"./CategoriesTreeButtons\";\n\ntype CategoriesTreeProps = ComponentPropsWithoutRef<typeof CategoriesTree>;\n\ninterface CategoriesTreeComponentProps\n extends Pick<CategoriesTreeProps, \"getSchemaContext\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"onPerformanceMeasured\" | \"onFeatureUsed\"> {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * CategoriesTreeComponent.ShowAllButton,\n * CategoriesTreeComponent.HideAllButton,\n * CategoriesTreeComponent.InvertAllButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;\n selectionStorage: SelectionStorage;\n}\n\n/**\n * A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.\n * @public\n */\nexport const CategoriesTreeComponent = (props: CategoriesTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all categories and their subcategories.\n * @public\n */\nCategoriesTreeComponent.ShowAllButton = ShowAllButton;\n\n/**\n * Renders a \"Hide all\" button that disables display of all categories.\n * @public\n */\nCategoriesTreeComponent.HideAllButton = HideAllButton;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all categories.\n * @public\n */\nCategoriesTreeComponent.InvertAllButton = InvertAllButton;\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.id = \"categories-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.getLabel = () => TreeWidget.translate(\"categoriesTree.label\");\n\nfunction CategoriesTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n selectionStorage,\n ...treeProps\n}: CategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, iModel, viewport);\n const { filter, applyFilter, clearFilter } = useFiltering();\n const density = treeProps.density;\n return (\n <div className={classNames(\"tw-tree-with-header\", density === \"enlarged\" && \"enlarge\")}>\n <UnifiedSelectionProvider storage={selectionStorage}>\n <TreeHeader onFilterStart={applyFilter} onFilterClear={clearFilter} onSelectedChanged={() => {}} density={density}>\n {headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ viewport, categories, onFeatureUsed: treeProps.onFeatureUsed })}</Fragment>)\n : [\n <ShowAllButton viewport={viewport} categories={categories} key=\"show-all-btn\" density={density} onFeatureUsed={treeProps.onFeatureUsed} />,\n <HideAllButton viewport={viewport} categories={categories} key=\"hide-all-btn\" density={density} onFeatureUsed={treeProps.onFeatureUsed} />,\n <InvertAllButton viewport={viewport} categories={categories} key=\"invert-all-btn\" density={density} onFeatureUsed={treeProps.onFeatureUsed} />,\n ]}\n </TreeHeader>\n <div className=\"tw-tree-content\">\n <AutoSizer>\n {({ width, height }) => (\n <CategoriesTree {...treeProps} imodel={iModel} categories={categories} activeView={viewport} width={width} height={height} filter={filter} />\n )}\n </AutoSizer>\n </div>\n </UnifiedSelectionProvider>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;g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AAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CAC9I,GACS,GACR,IACF,GACmB,CAC5B,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 \"../Tree.scss\";\nimport classNames from \"classnames\";\nimport { Fragment } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeHeader } from \"../../tree-header/TreeHeader\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport { useFiltering } from \"../common/UseFiltering\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext\";\nimport { CategoriesTree } from \"./CategoriesTree\";\nimport { HideAllButton, InvertAllButton, ShowAllButton } from \"./CategoriesTreeButtons\";\nimport { useCategories } from \"./UseCategories\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { CategoriesTreeHeaderButtonProps } from \"./CategoriesTreeButtons\";\n\n/** @public */\ninterface CategoriesTreeComponentProps\n extends Pick<\n ComponentPropsWithoutRef<typeof CategoriesTree>,\n \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\"\n > {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * CategoriesTreeComponent.ShowAllButton,\n * CategoriesTreeComponent.HideAllButton,\n * CategoriesTreeComponent.InvertAllButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.\n * @public\n */\nexport const CategoriesTreeComponent = (props: CategoriesTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all categories and their subcategories.\n * @public\n */\nCategoriesTreeComponent.ShowAllButton = ShowAllButton;\n\n/**\n * Renders a \"Hide all\" button that disables display of all categories.\n * @public\n */\nCategoriesTreeComponent.HideAllButton = HideAllButton;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all categories.\n * @public\n */\nCategoriesTreeComponent.InvertAllButton = InvertAllButton;\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.id = \"categories-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.getLabel = () => TreeWidget.translate(\"categoriesTree.label\");\n\nfunction CategoriesTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n onPerformanceMeasured,\n onFeatureUsed,\n ...treeProps\n}: CategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, iModel, viewport);\n const { filter, applyFilter, clearFilter } = useFiltering();\n const density = treeProps.density;\n return (\n <TelemetryContextProvider componentIdentifier={CategoriesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <div className={classNames(\"tw-tree-with-header\", density === \"enlarged\" && \"enlarge\")}>\n <TreeHeader onFilterStart={applyFilter} onFilterClear={clearFilter} onSelectedChanged={() => {}} density={density}>\n {headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ viewport, categories, onFeatureUsed })}</Fragment>)\n : [\n <ShowAllButton viewport={viewport} categories={categories} key=\"show-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <HideAllButton viewport={viewport} categories={categories} key=\"hide-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <InvertAllButton viewport={viewport} categories={categories} key=\"invert-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n ]}\n </TreeHeader>\n <div className=\"tw-tree-content\">\n <AutoSizer>\n {({ width, height }) => (\n <CategoriesTree {...treeProps} imodel={iModel} categories={categories} activeView={viewport} width={width} height={height} filter={filter} />\n )}\n </AutoSizer>\n </div>\n </div>\n </TelemetryContextProvider>\n );\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
2
2
  /**
3
3
  * Data structure that describes category.
4
+ * @beta
4
5
  */
5
6
  export interface CategoryInfo {
6
7
  categoryId: string;
@@ -8,25 +9,20 @@ export interface CategoryInfo {
8
9
  }
9
10
  /**
10
11
  * Toggles visibility of categories to show or hide.
11
- * @internal
12
12
  */
13
13
  export declare function toggleAllCategories(viewManager: ViewManager, imodel: IModelConnection, display: boolean, viewport?: Viewport, forAllViewports?: boolean): Promise<void>;
14
14
  /**
15
15
  * Gets ids of all categories from specified imodel and viewport.
16
- * @internal
17
16
  */
18
17
  export declare function getCategories(imodel: IModelConnection, viewport?: Viewport): Promise<string[]>;
19
18
  /**
20
19
  * Changes category display in the viewport.
21
- * @internal
22
20
  */
23
21
  export declare function enableCategoryDisplay(viewManager: ViewManager, imodel: IModelConnection, ids: string[], enabled: boolean, forAllViewports: boolean, enableAllSubCategories?: boolean): Promise<void>;
24
22
  /**
25
23
  * Changes subcategory display in the viewport
26
- * @internal
27
24
  */
28
25
  export declare function enableSubCategoryDisplay(viewManager: ViewManager, key: string, enabled: boolean, forAllViewports?: boolean): void;
29
- /** @internal */
30
26
  export declare function loadCategoriesFromViewport(iModel?: IModelConnection, vp?: Viewport): Promise<CategoryInfo[]>;
31
27
  /**
32
28
  * Enable display of all given categories.
@@ -9,7 +9,6 @@ const core_common_1 = require("@itwin/core-common");
9
9
  const core_frontend_1 = require("@itwin/core-frontend");
10
10
  /**
11
11
  * Toggles visibility of categories to show or hide.
12
- * @internal
13
12
  */
14
13
  async function toggleAllCategories(viewManager, imodel, display, viewport, forAllViewports) {
15
14
  // istanbul ignore next
@@ -24,7 +23,6 @@ async function toggleAllCategories(viewManager, imodel, display, viewport, forAl
24
23
  exports.toggleAllCategories = toggleAllCategories;
25
24
  /**
26
25
  * Gets ids of all categories from specified imodel and viewport.
27
- * @internal
28
26
  */
29
27
  async function getCategories(imodel, viewport) {
30
28
  const categories = await loadCategoriesFromViewport(imodel, viewport);
@@ -33,7 +31,6 @@ async function getCategories(imodel, viewport) {
33
31
  exports.getCategories = getCategories;
34
32
  /**
35
33
  * Changes category display in the viewport.
36
- * @internal
37
34
  */
38
35
  async function enableCategoryDisplay(viewManager, imodel, ids, enabled, forAllViewports, enableAllSubCategories = true) {
39
36
  if (!viewManager.selectedView) {
@@ -74,7 +71,6 @@ async function enableCategoryDisplay(viewManager, imodel, ids, enabled, forAllVi
74
71
  exports.enableCategoryDisplay = enableCategoryDisplay;
75
72
  /**
76
73
  * Changes subcategory display in the viewport
77
- * @internal
78
74
  */
79
75
  function enableSubCategoryDisplay(viewManager, key, enabled, forAllViewports) {
80
76
  if (!viewManager.selectedView) {
@@ -98,7 +94,6 @@ function enableSubCategoryDisplay(viewManager, key, enabled, forAllViewports) {
98
94
  }
99
95
  }
100
96
  exports.enableSubCategoryDisplay = enableSubCategoryDisplay;
101
- /** @internal */
102
97
  async function loadCategoriesFromViewport(iModel, vp) {
103
98
  if (!vp) {
104
99
  return EMPTY_CATEGORIES_ARRAY;
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEh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*---------------------------------------------------------------------------------------------\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 { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelApp, PerModelCategoryVisibility } from \"@itwin/core-frontend\";\n\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Data structure that describes category.\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Toggles visibility of categories to show or hide.\n * @internal\n */\nexport async function toggleAllCategories(\n viewManager: ViewManager,\n imodel: IModelConnection,\n display: boolean,\n viewport?: Viewport,\n forAllViewports?: boolean,\n) {\n // istanbul ignore next\n const activeView = viewport ?? viewManager.getFirstOpenView();\n const ids = await getCategories(imodel, activeView);\n\n // istanbul ignore if\n if (ids.length === 0) {\n return;\n }\n\n await enableCategoryDisplay(viewManager, imodel, ids, display, forAllViewports ?? false);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n * @internal\n */\nexport async function getCategories(imodel: IModelConnection, viewport?: Viewport) {\n const categories = await loadCategoriesFromViewport(imodel, viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/**\n * Changes category display in the viewport.\n * @internal\n */\nexport async function enableCategoryDisplay(\n viewManager: ViewManager,\n imodel: IModelConnection,\n ids: string[],\n enabled: boolean,\n forAllViewports: boolean,\n enableAllSubCategories = true,\n) {\n if (!viewManager.selectedView) {\n return;\n }\n\n const updateViewport = async (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeCategoryDisplay(ids, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of vp.perModelCategoryVisibility) {\n // istanbul ignore else\n if (ids.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n vp.perModelCategoryVisibility.setOverride(modelsContainingOverrides, ids, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await imodel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewManager, value.id, false, forAllViewports));\n });\n }\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n await updateViewport(viewport);\n }\n } else {\n await updateViewport(viewManager.selectedView);\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n * @internal\n */\nexport function enableSubCategoryDisplay(viewManager: ViewManager, key: string, enabled: boolean, forAllViewports?: boolean) {\n if (!viewManager.selectedView) {\n return;\n }\n\n const updateViewport = (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeSubCategoryDisplay(key, enabled);\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n updateViewport(viewport);\n }\n } else {\n updateViewport(viewManager.selectedView);\n }\n}\n\n/** @internal */\nexport async function loadCategoriesFromViewport(iModel?: IModelConnection, vp?: Viewport) {\n if (!vp) {\n return EMPTY_CATEGORIES_ARRAY;\n }\n\n // Query categories and add them to state\n const selectUsedSpatialCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)\";\n const selectUsedDrawingCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)\";\n const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;\n const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? \"BisCore.SpatialCategory\" : \"BisCore.DrawingCategory\"} WHERE ECInstanceId IN (${ecsql})`;\n\n const categories: CategoryInfo[] = [];\n\n // istanbul ignore else\n if (iModel) {\n const rows = await iModel.createQueryReader(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n }\n return categories;\n}\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, categories, true, true);\n}\n\n/**\n * Disable display of all given categories.\n * @public\n */\nexport async function hideAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, categories, false, true);\n}\n\n/**\n * Invert display of all given categories.\n * @public\n */\nexport async function invertAllCategories(categories: CategoryInfo[], viewport: Viewport) {\n const enabled: string[] = [];\n const disabled: string[] = [];\n const enabledSubCategories: string[] = [];\n const disabledSubCategories: string[] = [];\n\n for (const category of categories) {\n if (!viewport.view.viewsCategory(category.categoryId)) {\n disabled.push(category.categoryId);\n continue;\n }\n // First, we need to check if at least one subcategory is disabled. If it is true, then only subcategories should change display, not categories.\n if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {\n for (const subCategory of category.subCategoryIds) {\n viewport.isSubCategoryVisible(subCategory) ? enabledSubCategories.push(subCategory) : disabledSubCategories.push(subCategory);\n }\n } else {\n enabled.push(category.categoryId);\n }\n }\n\n // Disable enabled\n enabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, false, true));\n\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, enabled, false, true);\n\n // Enable disabled\n disabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, true, true));\n\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, disabled, true, true);\n}\n"]}
1
+ {"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,oDAAoD;AACpD,wDAA6E;AAa7E;;GAEG;AACI,KAAK,UAAU,mBAAmB,CACvC,WAAwB,EACxB,MAAwB,EACxB,OAAgB,EAChB,QAAmB,EACnB,eAAyB;IAEzB,uBAAuB;IACvB,MAAM,UAAU,GAAG,QAAQ,IAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC9D,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAEpD,qBAAqB;IACrB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO;KACR;IAED,MAAM,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,IAAI,KAAK,CAAC,CAAC;AAC3F,CAAC;AAjBD,kDAiBC;AAED;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,MAAwB,EAAE,QAAmB;IAC/E,MAAM,UAAU,GAAG,MAAM,0BAA0B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC3D,CAAC;AAHD,sCAGC;AAED;;GAEG;AACI,KAAK,UAAU,qBAAqB,CACzC,WAAwB,EACxB,MAAwB,EACxB,GAAa,EACb,OAAgB,EAChB,eAAwB,EACxB,sBAAsB,GAAG,IAAI;IAE7B,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE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CAAC,WAAW,EAAE,EAAE,CAAC,wBAAwB,CAAC,yBAAS,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAEzH,MAAM,qBAAqB,CAAC,yBAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5F,CAAC;AA9BD,kDA8BC","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 { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelApp, PerModelCategoryVisibility } from \"@itwin/core-frontend\";\n\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Data structure that describes category.\n * @beta\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Toggles visibility of categories to show or hide.\n */\nexport async function toggleAllCategories(\n viewManager: ViewManager,\n imodel: IModelConnection,\n display: boolean,\n viewport?: Viewport,\n forAllViewports?: boolean,\n) {\n // istanbul ignore next\n const activeView = viewport ?? viewManager.getFirstOpenView();\n const ids = await getCategories(imodel, activeView);\n\n // istanbul ignore if\n if (ids.length === 0) {\n return;\n }\n\n await enableCategoryDisplay(viewManager, imodel, ids, display, forAllViewports ?? false);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n */\nexport async function getCategories(imodel: IModelConnection, viewport?: Viewport) {\n const categories = await loadCategoriesFromViewport(imodel, viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/**\n * Changes category display in the viewport.\n */\nexport async function enableCategoryDisplay(\n viewManager: ViewManager,\n imodel: IModelConnection,\n ids: string[],\n enabled: boolean,\n forAllViewports: boolean,\n enableAllSubCategories = true,\n) {\n if (!viewManager.selectedView) {\n return;\n }\n\n const updateViewport = async (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeCategoryDisplay(ids, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of vp.perModelCategoryVisibility) {\n // istanbul ignore else\n if (ids.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n vp.perModelCategoryVisibility.setOverride(modelsContainingOverrides, ids, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await imodel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewManager, value.id, false, forAllViewports));\n });\n }\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n await updateViewport(viewport);\n }\n } else {\n await updateViewport(viewManager.selectedView);\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n */\nexport function enableSubCategoryDisplay(viewManager: ViewManager, key: string, enabled: boolean, forAllViewports?: boolean) {\n if (!viewManager.selectedView) {\n return;\n }\n\n const updateViewport = (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeSubCategoryDisplay(key, enabled);\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n updateViewport(viewport);\n }\n } else {\n updateViewport(viewManager.selectedView);\n }\n}\n\nexport async function loadCategoriesFromViewport(iModel?: IModelConnection, vp?: Viewport) {\n if (!vp) {\n return EMPTY_CATEGORIES_ARRAY;\n }\n\n // Query categories and add them to state\n const selectUsedSpatialCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)\";\n const selectUsedDrawingCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)\";\n const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;\n const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? \"BisCore.SpatialCategory\" : \"BisCore.DrawingCategory\"} WHERE ECInstanceId IN (${ecsql})`;\n\n const categories: CategoryInfo[] = [];\n\n // istanbul ignore else\n if (iModel) {\n const rows = await iModel.createQueryReader(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n }\n return categories;\n}\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, categories, true, true);\n}\n\n/**\n * Disable display of all given categories.\n * @public\n */\nexport async function hideAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, categories, false, true);\n}\n\n/**\n * Invert display of all given categories.\n * @public\n */\nexport async function invertAllCategories(categories: CategoryInfo[], viewport: Viewport) {\n const enabled: string[] = [];\n const disabled: string[] = [];\n const enabledSubCategories: string[] = [];\n const disabledSubCategories: string[] = [];\n\n for (const category of categories) {\n if (!viewport.view.viewsCategory(category.categoryId)) {\n disabled.push(category.categoryId);\n continue;\n }\n // First, we need to check if at least one subcategory is disabled. If it is true, then only subcategories should change display, not categories.\n if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {\n for (const subCategory of category.subCategoryIds) {\n viewport.isSubCategoryVisible(subCategory) ? enabledSubCategories.push(subCategory) : disabledSubCategories.push(subCategory);\n }\n } else {\n enabled.push(category.categoryId);\n }\n }\n\n // Disable enabled\n enabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, false, true));\n\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, enabled, false, true);\n\n // Enable disabled\n disabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, true, true));\n\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, disabled, true, true);\n}\n"]}
@@ -1,14 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { InstanceKey } from "@itwin/presentation-shared";
3
3
  import type { GroupingHierarchyNode } from "@itwin/presentation-hierarchies";
4
- /** @internal */
5
4
  export interface FocusedInstancesContext {
6
5
  loadInstanceKeys?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;
7
6
  enabled: boolean;
8
7
  toggle: () => void;
9
8
  }
10
- /** @internal */
11
9
  export declare const focusedInstancesContext: import("react").Context<FocusedInstancesContext>;
12
- /** @internal */
13
10
  export declare function useFocusedInstancesContext(): FocusedInstancesContext;
14
11
  //# sourceMappingURL=FocusedInstancesContext.d.ts.map
@@ -6,9 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.useFocusedInstancesContext = exports.focusedInstancesContext = void 0;
8
8
  const react_1 = require("react");
9
- /** @internal */
10
9
  exports.focusedInstancesContext = (0, react_1.createContext)({ enabled: false, toggle: () => { } });
11
- /** @internal */
12
10
  function useFocusedInstancesContext() {
13
11
  return (0, react_1.useContext)(exports.focusedInstancesContext);
14
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FocusedInstancesContext.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContext.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAkD;AAYlD,gBAAgB;AACH,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAEpH,gBAAgB;AAChB,SAAgB,0BAA0B;IACxC,OAAO,IAAA,kBAAU,EAAC,+BAAuB,CAAC,CAAC;AAC7C,CAAC;AAFD,gEAEC","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 { createContext, useContext } from \"react\";\n\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport interface FocusedInstancesContext {\n loadInstanceKeys?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;\n enabled: boolean;\n toggle: () => void;\n}\n\n/** @internal */\nexport const focusedInstancesContext = createContext<FocusedInstancesContext>({ enabled: false, toggle: () => {} });\n\n/** @internal */\nexport function useFocusedInstancesContext() {\n return useContext(focusedInstancesContext);\n}\n"]}
1
+ {"version":3,"file":"FocusedInstancesContext.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContext.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAkD;AAWrC,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAEpH,SAAgB,0BAA0B;IACxC,OAAO,IAAA,kBAAU,EAAC,+BAAuB,CAAC,CAAC;AAC7C,CAAC;AAFD,gEAEC","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 { createContext, useContext } from \"react\";\n\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\nexport interface FocusedInstancesContext {\n loadInstanceKeys?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;\n enabled: boolean;\n toggle: () => void;\n}\n\nexport const focusedInstancesContext = createContext<FocusedInstancesContext>({ enabled: false, toggle: () => {} });\n\nexport function useFocusedInstancesContext() {\n return useContext(focusedInstancesContext);\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
2
2
  import type { PropsWithChildren } from "react";
3
- /** @internal */
4
3
  export declare function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }: PropsWithChildren<{
5
4
  selectionStorage: SelectionStorage;
6
5
  imodelKey: string;
@@ -10,7 +10,6 @@ const react_1 = require("react");
10
10
  const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
11
11
  const unified_selection_1 = require("@itwin/unified-selection");
12
12
  const FocusedInstancesContext_1 = require("./FocusedInstancesContext");
13
- /** @internal */
14
13
  function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }) {
15
14
  const [state, setState] = (0, react_1.useState)({
16
15
  enabled: false,
@@ -1 +1 @@
1
- {"version":3,"file":"FocusedInstancesContextProvider.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContextProvider.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAA4C;AAC5C,0FAAsE;AACtE,gEAAmE;AACnE,uEAAoE;AAQpE,gBAAgB;AAChB,SAAgB,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,QAAQ,GACqE;IAC7E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAA0B;QAC1D,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,GAAG,EAAE;YACX,QAA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AAgB,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;YAEH,MAAM,gBAAgB,GAAqE,KAAK,SAAS,CAAC;gBACxG,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;oBAC3B,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;wBAC9B,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;qBACf;yBAAM;wBACL,MAAM,IAAI,CAAC;qBACZ;iBACF;YACH,CAAC,CAAC;YAEF,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF,kBAAkB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,EAAE;YACjG,IAAI,eAAe,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,EAAE;gBAChD,OAAO;aACR;YACD,kBAAkB,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE3C,OAAO,uBAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAAC;AACvG,CAAC;AAhED,0EAgEC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAC;AAC7D,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, useState } from \"react\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport { Selectable, Selectables } from \"@itwin/unified-selection\";\nimport { focusedInstancesContext } from \"./FocusedInstancesContext\";\n\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { PropsWithChildren } from \"react\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport type { FocusedInstancesContext } from \"./FocusedInstancesContext\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport function FocusedInstancesContextProvider({\n selectionStorage,\n imodelKey,\n children,\n}: PropsWithChildren<{ selectionStorage: SelectionStorage; imodelKey: string }>) {\n const [state, setState] = useState<FocusedInstancesContext>({\n enabled: false,\n toggle: () => {\n setState((prev) => ({ ...prev, enabled: !prev.enabled }));\n },\n });\n const enabled = state.enabled;\n\n useEffect(() => {\n if (!enabled) {\n setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));\n return;\n }\n\n const onSelectionChanged = () => {\n const selection = selectionStorage.getSelection({ imodelKey, level: 0 });\n if (Selectables.isEmpty(selection)) {\n setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));\n return;\n }\n\n const selected: Array<InstanceKey | GroupingHierarchyNode | (() => AsyncIterableIterator<InstanceKey>)> = [];\n Selectables.forEach(selection, (selectable) => {\n if (Selectable.isInstanceKey(selectable)) {\n selected.push(selectable);\n return;\n }\n\n if (isHierarchyNode(selectable.data) && HierarchyNode.isGroupingNode(selectable.data)) {\n selected.push(selectable.data);\n return;\n }\n\n selected.push(selectable.loadInstanceKeys);\n });\n\n const loadInstanceKeys: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode> = async function* () {\n for (const item of selected) {\n if (typeof item === \"function\") {\n yield* item();\n } else {\n yield item;\n }\n }\n };\n\n setState((prev) => ({ ...prev, loadInstanceKeys }));\n };\n\n onSelectionChanged();\n return selectionStorage.selectionChangeEvent.addListener(({ imodelKey: changeImodelKey, level }) => {\n if (changeImodelKey !== imodelKey || level !== 0) {\n return;\n }\n onSelectionChanged();\n });\n }, [enabled, imodelKey, selectionStorage]);\n\n return <focusedInstancesContext.Provider value={state}>{children}</focusedInstancesContext.Provider>;\n}\n\nfunction isHierarchyNode(data: unknown): data is HierarchyNode {\n return !!data && typeof data === \"object\" && \"key\" in data;\n}\n"]}
1
+ {"version":3,"file":"FocusedInstancesContextProvider.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContextProvider.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAA4C;AAC5C,0FAAsE;AACtE,gEAAmE;AACnE,uEAAoE;AAQpE,SAAgB,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,QAAQ,GACqE;IAC7E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAA0B;QAC1D,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,GAAG,EAAE;YACX,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAE9B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE;YACZ,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAC/D,OAAO;SACR;QAED,MAAM,kBAAkB,GAAG,GAAG,EAAE;YAC9B,MAAM,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;YACzE,IAAI,+BAAW,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gBAClC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,gBAAgB,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CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE3C,OAAO,uBAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAAC;AACvG,CAAC;AAhED,0EAgEC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAC;AAC7D,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, useState } from \"react\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport { Selectable, Selectables } from \"@itwin/unified-selection\";\nimport { focusedInstancesContext } from \"./FocusedInstancesContext\";\n\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { PropsWithChildren } from \"react\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport type { FocusedInstancesContext } from \"./FocusedInstancesContext\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\nexport function FocusedInstancesContextProvider({\n selectionStorage,\n imodelKey,\n children,\n}: PropsWithChildren<{ selectionStorage: SelectionStorage; imodelKey: string }>) {\n const [state, setState] = useState<FocusedInstancesContext>({\n enabled: false,\n toggle: () => {\n setState((prev) => ({ ...prev, enabled: !prev.enabled }));\n },\n });\n const enabled = state.enabled;\n\n useEffect(() => {\n if (!enabled) {\n setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));\n return;\n }\n\n const onSelectionChanged = () => {\n const selection = selectionStorage.getSelection({ imodelKey, level: 0 });\n if (Selectables.isEmpty(selection)) {\n setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));\n return;\n }\n\n const selected: Array<InstanceKey | GroupingHierarchyNode | (() => AsyncIterableIterator<InstanceKey>)> = [];\n Selectables.forEach(selection, (selectable) => {\n if (Selectable.isInstanceKey(selectable)) {\n selected.push(selectable);\n return;\n }\n\n if (isHierarchyNode(selectable.data) && HierarchyNode.isGroupingNode(selectable.data)) {\n selected.push(selectable.data);\n return;\n }\n\n selected.push(selectable.loadInstanceKeys);\n });\n\n const loadInstanceKeys: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode> = async function* () {\n for (const item of selected) {\n if (typeof item === \"function\") {\n yield* item();\n } else {\n yield item;\n }\n }\n };\n\n setState((prev) => ({ ...prev, loadInstanceKeys }));\n };\n\n onSelectionChanged();\n return selectionStorage.selectionChangeEvent.addListener(({ imodelKey: changeImodelKey, level }) => {\n if (changeImodelKey !== imodelKey || level !== 0) {\n return;\n }\n onSelectionChanged();\n });\n }, [enabled, imodelKey, selectionStorage]);\n\n return <focusedInstancesContext.Provider value={state}>{children}</focusedInstancesContext.Provider>;\n}\n\nfunction isHierarchyNode(data: unknown): data is HierarchyNode {\n return !!data && typeof data === \"object\" && \"key\" in data;\n}\n"]}
@@ -6,7 +6,6 @@ interface UseFilteringResult {
6
6
  clearFilter: () => void;
7
7
  onHighlightChanged: (index: number, matches?: number) => void;
8
8
  }
9
- /** @internal */
10
9
  export declare function useFiltering(): UseFilteringResult;
11
10
  export {};
12
11
  //# sourceMappingURL=UseFiltering.d.ts.map
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.useFiltering = void 0;
8
8
  const react_1 = require("react");
9
- /** @internal */
10
9
  function useFiltering() {
11
10
  const [filter, setFilter] = (0, react_1.useState)("");
12
11
  const [activeMatchIndex, setActiveMatchIndex] = (0, react_1.useState)(0);
@@ -1 +1 @@
1
- {"version":3,"file":"UseFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFiltering.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAA8C;AAW9C,gBAAgB;AAChB,SAAgB,YAAY;IAC1B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,CAAC,SAAiB,EAAE,EAAE;QACpD,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACnC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,IAAA,mBAAW,EAAC,CAAC,KAAa,EAAE,OAAgB,EAAE,EAAE;QACzE,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAClG,CAAC;AArBD,oCAqBC","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 { useCallback, useState } from \"react\";\n\ninterface UseFilteringResult {\n filter: string;\n activeMatchIndex: number;\n totalMatches: number;\n applyFilter: (filter: string) => void;\n clearFilter: () => void;\n onHighlightChanged: (index: number, matches?: number) => void;\n}\n\n/** @internal */\nexport function useFiltering(): UseFilteringResult {\n const [filter, setFilter] = useState(\"\");\n const [activeMatchIndex, setActiveMatchIndex] = useState(0);\n const [totalMatches, setTotalMatches] = useState(0);\n\n const applyFilter = useCallback((newFilter: string) => {\n setActiveMatchIndex(0);\n setFilter(newFilter);\n }, []);\n\n const clearFilter = useCallback(() => {\n setActiveMatchIndex(0);\n setFilter(\"\");\n }, []);\n\n const onHighlightChanged = useCallback((index: number, matches?: number) => {\n setActiveMatchIndex(index);\n matches && setTotalMatches(matches);\n }, []);\n\n return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };\n}\n"]}
1
+ {"version":3,"file":"UseFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFiltering.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAA8C;AAW9C,SAAgB,YAAY;IAC1B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,CAAC,SAAiB,EAAE,EAAE;QACpD,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACnC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,IAAA,mBAAW,EAAC,CAAC,KAAa,EAAE,OAAgB,EAAE,EAAE;QACzE,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAClG,CAAC;AArBD,oCAqBC","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 { useCallback, useState } from \"react\";\n\ninterface UseFilteringResult {\n filter: string;\n activeMatchIndex: number;\n totalMatches: number;\n applyFilter: (filter: string) => void;\n clearFilter: () => void;\n onHighlightChanged: (index: number, matches?: number) => void;\n}\n\nexport function useFiltering(): UseFilteringResult {\n const [filter, setFilter] = useState(\"\");\n const [activeMatchIndex, setActiveMatchIndex] = useState(0);\n const [totalMatches, setTotalMatches] = useState(0);\n\n const applyFilter = useCallback((newFilter: string) => {\n setActiveMatchIndex(0);\n setFilter(newFilter);\n }, []);\n\n const clearFilter = useCallback(() => {\n setActiveMatchIndex(0);\n setFilter(\"\");\n }, []);\n\n const onHighlightChanged = useCallback((index: number, matches?: number) => {\n setActiveMatchIndex(index);\n matches && setTotalMatches(matches);\n }, []);\n\n return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };\n}\n"]}
@@ -2,7 +2,6 @@ import type { TreeRenderer, useTree } from "@itwin/presentation-hierarchies-reac
2
2
  type UseTreeLocalizedStrings = Parameters<typeof useTree>[0]["localizedStrings"];
3
3
  type TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0]["localizedStrings"];
4
4
  type UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;
5
- /** @internal */
6
5
  export declare function useHierarchiesLocalization(): UseHierarchiesLocalizationResult;
7
6
  export {};
8
7
  //# sourceMappingURL=UseHierarchiesLocalization.d.ts.map
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.useHierarchiesLocalization = void 0;
8
8
  const react_1 = require("react");
9
9
  const TreeWidget_1 = require("../../../TreeWidget");
10
- /** @internal */
11
10
  function useHierarchiesLocalization() {
12
11
  const stringValues = Object.values(getLocalizedStrings());
13
12
  const localizedStrings = (0, react_1.useMemo)(getLocalizedStrings, stringValues);
@@ -28,6 +27,7 @@ function getLocalizedStrings() {
28
27
  resultLimitExceededWithFiltering: TreeWidget_1.TreeWidget.translate("presentation-hierarchies.resultLimitExceededWithFiltering"),
29
28
  increaseHierarchyLimit: TreeWidget_1.TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimit"),
30
29
  increaseHierarchyLimitWithFiltering: TreeWidget_1.TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimitWithFiltering"),
30
+ retry: TreeWidget_1.TreeWidget.translate("presentation-hierarchies.retry"),
31
31
  };
32
32
  }
33
33
  //# sourceMappingURL=UseHierarchiesLocalization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UseHierarchiesLocalization.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchiesLocalization.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAgC;AAChC,oDAAiD;AASjD,gBAAgB;AAChB,SAAgB,0BAA0B;IACxC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAG,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IACpE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAJD,gEAIC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,iDAAiD;QACjD,WAAW,EAAE,uBAAU,CAAC,SAAS,CAAC,sCAAsC,CAAC;QACzE,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;QAE7D,oDAAoD;QACpD,OAAO,EAAE,uBAAU,CAAC,SAAS,CAAC,kCAAkC,CAAC;QACjE,oBAAoB,EAAE,uBAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC;QAC3F,yBAAyB,EAAE,uBAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;QACrG,kBAAkB,EAAE,uBAAU,CAAC,SAAS,CAAC,6CAA6C,CAAC;QACvF,mBAAmB,EAAE,uBAAU,CAAC,SAAS,CAAC,8CAA8C,CAAC;QACzF,gCAAgC,EAAE,uBAAU,CAAC,SAAS,CAAC,2DAA2D,CAAC;QACnH,sBAAsB,EAAE,uBAAU,CAAC,SAAS,CAAC,iDAAiD,CAAC;QAC/F,mCAAmC,EAAE,uBAAU,CAAC,SAAS,CAAC,8DAA8D,CAAC;KAC1H,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 { useMemo } from \"react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\n\nimport type { TreeRenderer, useTree } from \"@itwin/presentation-hierarchies-react\";\n\ntype UseTreeLocalizedStrings = Parameters<typeof useTree>[0][\"localizedStrings\"];\ntype TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0][\"localizedStrings\"];\n\ntype UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;\n\n/** @internal */\nexport function useHierarchiesLocalization(): UseHierarchiesLocalizationResult {\n const stringValues = Object.values(getLocalizedStrings()!);\n const localizedStrings = useMemo(getLocalizedStrings, stringValues);\n return localizedStrings;\n}\n\nfunction getLocalizedStrings(): UseHierarchiesLocalizationResult {\n return {\n // strings for the `useUnifiedSelectionTree` hook\n unspecified: TreeWidget.translate(\"presentation-hierarchies.unspecified\"),\n other: TreeWidget.translate(\"presentation-hierarchies.other\"),\n\n // strings for `TreeRenderer` and `TreeNodeRenderer`\n loading: TreeWidget.translate(\"presentation-hierarchies.loading\"),\n filterHierarchyLevel: TreeWidget.translate(\"presentation-hierarchies.filterHierarchyLevel\"),\n clearHierarchyLevelFilter: TreeWidget.translate(\"presentation-hierarchies.clearHierarchyLevelFilter\"),\n noFilteredChildren: TreeWidget.translate(\"presentation-hierarchies.noFilteredChildren\"),\n resultLimitExceeded: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceeded\"),\n resultLimitExceededWithFiltering: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceededWithFiltering\"),\n increaseHierarchyLimit: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimit\"),\n increaseHierarchyLimitWithFiltering: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimitWithFiltering\"),\n };\n}\n"]}
1
+ {"version":3,"file":"UseHierarchiesLocalization.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchiesLocalization.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAgC;AAChC,oDAAiD;AASjD,SAAgB,0BAA0B;IACxC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAG,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IACpE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAJD,gEAIC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,iDAAiD;QACjD,WAAW,EAAE,uBAAU,CAAC,SAAS,CAAC,sCAAsC,CAAC;QACzE,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;QAE7D,oDAAoD;QACpD,OAAO,EAAE,uBAAU,CAAC,SAAS,CAAC,kCAAkC,CAAC;QACjE,oBAAoB,EAAE,uBAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC;QAC3F,yBAAyB,EAAE,uBAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;QACrG,kBAAkB,EAAE,uBAAU,CAAC,SAAS,CAAC,6CAA6C,CAAC;QACvF,mBAAmB,EAAE,uBAAU,CAAC,SAAS,CAAC,8CAA8C,CAAC;QACzF,gCAAgC,EAAE,uBAAU,CAAC,SAAS,CAAC,2DAA2D,CAAC;QACnH,sBAAsB,EAAE,uBAAU,CAAC,SAAS,CAAC,iDAAiD,CAAC;QAC/F,mCAAmC,EAAE,uBAAU,CAAC,SAAS,CAAC,8DAA8D,CAAC;QACzH,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;KAC9D,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 { useMemo } from \"react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\n\nimport type { TreeRenderer, useTree } from \"@itwin/presentation-hierarchies-react\";\n\ntype UseTreeLocalizedStrings = Parameters<typeof useTree>[0][\"localizedStrings\"];\ntype TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0][\"localizedStrings\"];\n\ntype UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;\n\nexport function useHierarchiesLocalization(): UseHierarchiesLocalizationResult {\n const stringValues = Object.values(getLocalizedStrings()!);\n const localizedStrings = useMemo(getLocalizedStrings, stringValues);\n return localizedStrings;\n}\n\nfunction getLocalizedStrings(): UseHierarchiesLocalizationResult {\n return {\n // strings for the `useUnifiedSelectionTree` hook\n unspecified: TreeWidget.translate(\"presentation-hierarchies.unspecified\"),\n other: TreeWidget.translate(\"presentation-hierarchies.other\"),\n\n // strings for `TreeRenderer` and `TreeNodeRenderer`\n loading: TreeWidget.translate(\"presentation-hierarchies.loading\"),\n filterHierarchyLevel: TreeWidget.translate(\"presentation-hierarchies.filterHierarchyLevel\"),\n clearHierarchyLevelFilter: TreeWidget.translate(\"presentation-hierarchies.clearHierarchyLevelFilter\"),\n noFilteredChildren: TreeWidget.translate(\"presentation-hierarchies.noFilteredChildren\"),\n resultLimitExceeded: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceeded\"),\n resultLimitExceededWithFiltering: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceededWithFiltering\"),\n increaseHierarchyLimit: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimit\"),\n increaseHierarchyLimitWithFiltering: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimitWithFiltering\"),\n retry: TreeWidget.translate(\"presentation-hierarchies.retry\"),\n };\n}\n"]}
@@ -1,17 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { IModelConnection } from "@itwin/core-frontend";
3
3
  import type { HierarchyLevelDetails } from "@itwin/presentation-hierarchies-react";
4
- import type { UsageTrackedFeatures } from "./UseFeatureReporting";
5
4
  interface UseHierarchyLevelFilteringProps {
6
5
  imodel: IModelConnection;
7
6
  defaultHierarchyLevelSizeLimit: number;
8
- reportUsage?: (props: {
9
- featureId?: UsageTrackedFeatures;
10
- reportInteraction: true;
11
- }) => void;
12
7
  }
13
- /** @internal */
14
- export declare function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }: UseHierarchyLevelFilteringProps): {
8
+ export declare function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit }: UseHierarchyLevelFilteringProps): {
15
9
  onFilterClick: import("react").Dispatch<import("react").SetStateAction<HierarchyLevelDetails | undefined>>;
16
10
  filteringDialog: JSX.Element;
17
11
  };
@@ -16,9 +16,10 @@ const presentation_frontend_1 = require("@itwin/presentation-frontend");
16
16
  const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
17
17
  const TreeWidget_1 = require("../../../TreeWidget");
18
18
  const Delayed_1 = require("./components/Delayed");
19
- /** @internal */
20
- function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }) {
19
+ const UseTelemetryContext_1 = require("./UseTelemetryContext");
20
+ function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit }) {
21
21
  const [filteringOptions, setFilteringOptions] = (0, react_1.useState)();
22
+ const { onFeatureUsed } = (0, UseTelemetryContext_1.useTelemetryContext)();
22
23
  const propertiesSource = (0, react_1.useMemo)(() => {
23
24
  if (!filteringOptions) {
24
25
  return undefined;
@@ -63,7 +64,7 @@ function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, re
63
64
  if (!filteringOptions) {
64
65
  return;
65
66
  }
66
- reportUsage?.({ featureId: info ? "hierarchy-level-filtering" : undefined, reportInteraction: true });
67
+ onFeatureUsed({ featureId: info ? "hierarchy-level-filtering" : undefined, reportInteraction: true });
67
68
  filteringOptions.setInstanceFilter(toGenericFilter(info));
68
69
  setFilteringOptions(undefined);
69
70
  }, onClose: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"UseHierarchyFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchyFiltering.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAuD;AACvD,8DAAiE;AACjE,sDAAwD;AACxD,wDAAsD;AACtD,oEAAgF;AAChF,4EAA8G;AAC9G,wEAA4D;AAC5D,8EAAgG;AAChG,oDAAiD;AACjD,kDAA+C;AAgB/C,gBAAgB;AAChB,SAAgB,0BAA0B,CAAC,EAAE,MAAM,EAAE,8BAA8B,EAAE,WAAW,EAAmC;IACjI,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,GAAyB,CAAC;IAElF,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAA0E,GAAG,EAAE;QAC7G,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,CAAC,CAA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,CAAC;KAClB;IAED,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACtB,OAAO,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YACtC,CAAC,CAAC;gBACE,kBAAkB,EAAE,EAAE;gBACtB,gBAAgB,EAAE,EAAE;gBACpB,kBAAkB,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;aACtC;YACH,CAAC,CAAC,SAAS,CAAC;KACf;IAED,OAAO,oDAA0B,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;AACvG,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 { useCallback, useMemo, useState } from \"react\";\nimport { useDebouncedAsyncValue } from \"@itwin/components-react\";\nimport { CompressedId64Set } from \"@itwin/core-bentley\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\nimport { DefaultContentDisplayTypes, KeySet } from \"@itwin/presentation-common\";\nimport { PresentationInstanceFilter, PresentationInstanceFilterDialog } from \"@itwin/presentation-components\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { GenericInstanceFilter, RowsLimitExceededError } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { Delayed } from \"./components/Delayed\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ClassInfo, Descriptor } from \"@itwin/presentation-common\";\nimport type { PresentationInstanceFilterInfo, PresentationInstanceFilterPropertiesSource } from \"@itwin/presentation-components\";\nimport type { HierarchyLevelDetails } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { UsageTrackedFeatures } from \"./UseFeatureReporting\";\n\ninterface UseHierarchyLevelFilteringProps {\n imodel: IModelConnection;\n defaultHierarchyLevelSizeLimit: number;\n reportUsage?: (props: { featureId?: UsageTrackedFeatures; reportInteraction: true }) => void;\n}\n\n/** @internal */\nexport function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }: UseHierarchyLevelFilteringProps) {\n const [filteringOptions, setFilteringOptions] = useState<HierarchyLevelDetails>();\n\n const propertiesSource = useMemo<(() => Promise<PresentationInstanceFilterPropertiesSource>) | undefined>(() => {\n if (!filteringOptions) {\n return undefined;\n }\n\n return async () => {\n const keySet = await collectInstanceKeys(filteringOptions.getInstanceKeysIterator());\n if (keySet.isEmpty) {\n throw new Error(\"Hierarchy level is empty - unable to create content descriptor.\");\n }\n\n const descriptor = await Presentation.presentation.getContentDescriptor({\n imodel,\n rulesetOrId: {\n id: `Hierarchy level descriptor ruleset`,\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n displayType: DefaultContentDisplayTypes.PropertyPane,\n keys: keySet,\n });\n if (!descriptor) {\n throw new Error(\"Failed to create content descriptor\");\n }\n\n return { descriptor, inputKeys: keySet };\n };\n }, [filteringOptions, imodel]);\n\n const getInitialFilter = useMemo(() => {\n const currentFilter = filteringOptions?.instanceFilter;\n if (!currentFilter) {\n return undefined;\n }\n\n return (descriptor: Descriptor) => fromGenericFilter(descriptor, currentFilter);\n }, [filteringOptions]);\n\n const filteringDialog = (\n <PresentationInstanceFilterDialog\n imodel={imodel}\n isOpen={!!filteringOptions}\n onApply={(info) => {\n if (!filteringOptions) {\n return;\n }\n reportUsage?.({ featureId: info ? \"hierarchy-level-filtering\" : undefined, reportInteraction: true });\n filteringOptions.setInstanceFilter(toGenericFilter(info));\n setFilteringOptions(undefined);\n }}\n onClose={() => {\n setFilteringOptions(undefined);\n }}\n propertiesSource={propertiesSource}\n initialFilter={getInitialFilter}\n filterResultsCountRenderer={(filter) => {\n if (!filteringOptions) {\n return null;\n }\n\n return (\n <MatchingInstancesCount filter={filter} hierarchyLevelDetails={filteringOptions} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n );\n }}\n />\n );\n\n return {\n onFilterClick: setFilteringOptions,\n filteringDialog,\n };\n}\n\ninterface MatchingInstancesCountProps {\n filter: PresentationInstanceFilterInfo;\n hierarchyLevelDetails: HierarchyLevelDetails;\n defaultHierarchyLevelSizeLimit: number;\n}\n\nfunction MatchingInstancesCount({ filter, defaultHierarchyLevelSizeLimit, hierarchyLevelDetails }: MatchingInstancesCountProps) {\n const { value, inProgress } = useDebouncedAsyncValue(\n useCallback(async () => {\n const instanceFilter = toGenericFilter(filter);\n try {\n const instanceCount = await countInstanceKeys(\n hierarchyLevelDetails.getInstanceKeysIterator({\n instanceFilter,\n hierarchyLevelSizeLimit: hierarchyLevelDetails.sizeLimit ?? defaultHierarchyLevelSizeLimit,\n }),\n );\n return TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", {\n instanceCount: instanceCount.toLocaleString(undefined, { useGrouping: true }),\n });\n } catch (e) {\n if (e instanceof RowsLimitExceededError) {\n return TreeWidget.translate(\"filteringDialog.filterExceedsLimit\", { limit: e.limit.toLocaleString(undefined, { useGrouping: true }) });\n }\n return TreeWidget.translate(\"filteringDialog.failedToCalculateMatchingInstancesCount\");\n }\n }, [filter, hierarchyLevelDetails, defaultHierarchyLevelSizeLimit]),\n );\n\n if (inProgress) {\n return (\n <Delayed show={true}>\n {TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", { instanceCount: \"\" })}\n <ProgressRadial size=\"x-small\" />\n </Delayed>\n );\n }\n\n return value ? <>{value}</> : null;\n}\n\nasync function countInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n let result = 0;\n for await (const _ of iterator) {\n result++;\n }\n return result;\n}\n\nasync function collectInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n const idsByClassName = new Map<Id64String, Id64Array>();\n for await (const { className, id } of iterator) {\n let idSet = idsByClassName.get(className);\n if (!idSet) {\n idSet = [];\n idsByClassName.set(className, idSet);\n }\n idSet.push(id);\n }\n\n const instanceKeys = new Array<[className: string, compressedIds: CompressedId64Set]>();\n for (const [className, ids] of idsByClassName) {\n instanceKeys.push([className.toLowerCase(), CompressedId64Set.sortAndCompress(ids)]);\n }\n return KeySet.fromJSON({ instanceKeys, nodeKeys: [] });\n}\n\nfunction fromGenericFilter(descriptor: Descriptor, filter: GenericInstanceFilter): PresentationInstanceFilterInfo {\n const presentationFilter =\n GenericInstanceFilter.isFilterRuleGroup(filter.rules) && filter.rules.rules.length === 0\n ? undefined\n : PresentationInstanceFilter.fromGenericInstanceFilter(descriptor, filter);\n return {\n filter: presentationFilter,\n usedClasses: (filter.filteredClassNames ?? [])\n .map((name) => descriptor.selectClasses.find((selectClass) => selectClass.selectClassInfo.name === name)?.selectClassInfo)\n .filter((classInfo): classInfo is ClassInfo => classInfo !== undefined),\n };\n}\n\nfunction toGenericFilter(filterInfo?: PresentationInstanceFilterInfo): GenericInstanceFilter | undefined {\n if (!filterInfo) {\n return undefined;\n }\n\n if (!filterInfo.filter) {\n return filterInfo.usedClasses.length > 0\n ? {\n propertyClassNames: [],\n relatedInstances: [],\n filteredClassNames: filterInfo.usedClasses.map((info) => info.name),\n rules: { operator: \"and\", rules: [] },\n }\n : undefined;\n }\n\n return PresentationInstanceFilter.toGenericInstanceFilter(filterInfo.filter, filterInfo.usedClasses);\n}\n"]}
1
+ {"version":3,"file":"UseHierarchyFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchyFiltering.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAuD;AACvD,8DAAiE;AACjE,sDAAwD;AACxD,wDAAsD;AACtD,oEAAgF;AAChF,4EAA8G;AAC9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C,yBAAyB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/E,OAAO;QACL,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC;aAC3C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,eAAe,CAAC;aACzH,MAAM,CAAC,CAAC,SAAS,EAA0B,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,UAA2C;IAClE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACtB,OAAO,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YACtC,CAAC,CAAC;gBACE,kBAAkB,EAAE,EAAE;gBACtB,gBAAgB,EAAE,EAAE;gBACpB,kBAAkB,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;aACtC;YACH,CAAC,CAAC,SAAS,CAAC;KACf;IAED,OAAO,oDAA0B,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;AACvG,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 { useCallback, useMemo, useState } from \"react\";\nimport { useDebouncedAsyncValue } from \"@itwin/components-react\";\nimport { CompressedId64Set } from \"@itwin/core-bentley\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\nimport { DefaultContentDisplayTypes, KeySet } from \"@itwin/presentation-common\";\nimport { PresentationInstanceFilter, PresentationInstanceFilterDialog } from \"@itwin/presentation-components\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { GenericInstanceFilter, RowsLimitExceededError } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { Delayed } from \"./components/Delayed\";\nimport { useTelemetryContext } from \"./UseTelemetryContext\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ClassInfo, Descriptor } from \"@itwin/presentation-common\";\nimport type { PresentationInstanceFilterInfo, PresentationInstanceFilterPropertiesSource } from \"@itwin/presentation-components\";\nimport type { HierarchyLevelDetails } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\ninterface UseHierarchyLevelFilteringProps {\n imodel: IModelConnection;\n defaultHierarchyLevelSizeLimit: number;\n}\n\nexport function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit }: UseHierarchyLevelFilteringProps) {\n const [filteringOptions, setFilteringOptions] = useState<HierarchyLevelDetails>();\n const { onFeatureUsed } = useTelemetryContext();\n\n const propertiesSource = useMemo<(() => Promise<PresentationInstanceFilterPropertiesSource>) | undefined>(() => {\n if (!filteringOptions) {\n return undefined;\n }\n\n return async () => {\n const keySet = await collectInstanceKeys(filteringOptions.getInstanceKeysIterator());\n if (keySet.isEmpty) {\n throw new Error(\"Hierarchy level is empty - unable to create content descriptor.\");\n }\n\n const descriptor = await Presentation.presentation.getContentDescriptor({\n imodel,\n rulesetOrId: {\n id: `Hierarchy level descriptor ruleset`,\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n displayType: DefaultContentDisplayTypes.PropertyPane,\n keys: keySet,\n });\n if (!descriptor) {\n throw new Error(\"Failed to create content descriptor\");\n }\n\n return { descriptor, inputKeys: keySet };\n };\n }, [filteringOptions, imodel]);\n\n const getInitialFilter = useMemo(() => {\n const currentFilter = filteringOptions?.instanceFilter;\n if (!currentFilter) {\n return undefined;\n }\n\n return (descriptor: Descriptor) => fromGenericFilter(descriptor, currentFilter);\n }, [filteringOptions]);\n\n const filteringDialog = (\n <PresentationInstanceFilterDialog\n imodel={imodel}\n isOpen={!!filteringOptions}\n onApply={(info) => {\n if (!filteringOptions) {\n return;\n }\n onFeatureUsed({ featureId: info ? \"hierarchy-level-filtering\" : undefined, reportInteraction: true });\n filteringOptions.setInstanceFilter(toGenericFilter(info));\n setFilteringOptions(undefined);\n }}\n onClose={() => {\n setFilteringOptions(undefined);\n }}\n propertiesSource={propertiesSource}\n initialFilter={getInitialFilter}\n filterResultsCountRenderer={(filter) => {\n if (!filteringOptions) {\n return null;\n }\n\n return (\n <MatchingInstancesCount filter={filter} hierarchyLevelDetails={filteringOptions} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n );\n }}\n />\n );\n\n return {\n onFilterClick: setFilteringOptions,\n filteringDialog,\n };\n}\n\ninterface MatchingInstancesCountProps {\n filter: PresentationInstanceFilterInfo;\n hierarchyLevelDetails: HierarchyLevelDetails;\n defaultHierarchyLevelSizeLimit: number;\n}\n\nfunction MatchingInstancesCount({ filter, defaultHierarchyLevelSizeLimit, hierarchyLevelDetails }: MatchingInstancesCountProps) {\n const { value, inProgress } = useDebouncedAsyncValue(\n useCallback(async () => {\n const instanceFilter = toGenericFilter(filter);\n try {\n const instanceCount = await countInstanceKeys(\n hierarchyLevelDetails.getInstanceKeysIterator({\n instanceFilter,\n hierarchyLevelSizeLimit: hierarchyLevelDetails.sizeLimit ?? defaultHierarchyLevelSizeLimit,\n }),\n );\n return TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", {\n instanceCount: instanceCount.toLocaleString(undefined, { useGrouping: true }),\n });\n } catch (e) {\n if (e instanceof RowsLimitExceededError) {\n return TreeWidget.translate(\"filteringDialog.filterExceedsLimit\", { limit: e.limit.toLocaleString(undefined, { useGrouping: true }) });\n }\n return TreeWidget.translate(\"filteringDialog.failedToCalculateMatchingInstancesCount\");\n }\n }, [filter, hierarchyLevelDetails, defaultHierarchyLevelSizeLimit]),\n );\n\n if (inProgress) {\n return (\n <Delayed show={true}>\n {TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", { instanceCount: \"\" })}\n <ProgressRadial size=\"x-small\" />\n </Delayed>\n );\n }\n\n return value ? <>{value}</> : null;\n}\n\nasync function countInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n let result = 0;\n for await (const _ of iterator) {\n result++;\n }\n return result;\n}\n\nasync function collectInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n const idsByClassName = new Map<Id64String, Id64Array>();\n for await (const { className, id } of iterator) {\n let idSet = idsByClassName.get(className);\n if (!idSet) {\n idSet = [];\n idsByClassName.set(className, idSet);\n }\n idSet.push(id);\n }\n\n const instanceKeys = new Array<[className: string, compressedIds: CompressedId64Set]>();\n for (const [className, ids] of idsByClassName) {\n instanceKeys.push([className.toLowerCase(), CompressedId64Set.sortAndCompress(ids)]);\n }\n return KeySet.fromJSON({ instanceKeys, nodeKeys: [] });\n}\n\nfunction fromGenericFilter(descriptor: Descriptor, filter: GenericInstanceFilter): PresentationInstanceFilterInfo {\n const presentationFilter =\n GenericInstanceFilter.isFilterRuleGroup(filter.rules) && filter.rules.rules.length === 0\n ? undefined\n : PresentationInstanceFilter.fromGenericInstanceFilter(descriptor, filter);\n return {\n filter: presentationFilter,\n usedClasses: (filter.filteredClassNames ?? [])\n .map((name) => descriptor.selectClasses.find((selectClass) => selectClass.selectClassInfo.name === name)?.selectClassInfo)\n .filter((classInfo): classInfo is ClassInfo => classInfo !== undefined),\n };\n}\n\nfunction toGenericFilter(filterInfo?: PresentationInstanceFilterInfo): GenericInstanceFilter | undefined {\n if (!filterInfo) {\n return undefined;\n }\n\n if (!filterInfo.filter) {\n return filterInfo.usedClasses.length > 0\n ? {\n propertyClassNames: [],\n relatedInstances: [],\n filteredClassNames: filterInfo.usedClasses.map((info) => info.name),\n rules: { operator: \"and\", rules: [] },\n }\n : undefined;\n }\n\n return PresentationInstanceFilter.toGenericInstanceFilter(filterInfo.filter, filterInfo.usedClasses);\n}\n"]}
@@ -1,30 +1,35 @@
1
- import type { HierarchyNode, PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
2
- import type { TreeNodeCheckboxState } from "./components/TreeNodeCheckbox";
3
1
  import type { BeEvent, IDisposable } from "@itwin/core-bentley";
2
+ import type { HierarchyNode } from "@itwin/presentation-hierarchies-react";
3
+ import type { TreeCheckboxProps } from "./components/TreeNodeCheckbox";
4
4
  /**
5
5
  * Data structure that describes instance visibility status.
6
- * @internal
6
+ * @beta
7
7
  */
8
8
  export interface VisibilityStatus {
9
+ /** Instance visibility state. */
9
10
  state: "visible" | "partial" | "hidden";
11
+ /** Specifies whether visibility changing is disabled or not. */
10
12
  isDisabled?: boolean;
13
+ /** Tooltip that should be displayed when hovering over the visibility checkbox. */
11
14
  tooltip?: string;
12
15
  }
13
- /** @internal */
16
+ /**
17
+ * Handler that can be used to determine and change visibility of instances represented by tree nodes.
18
+ * @beta
19
+ */
14
20
  export interface HierarchyVisibilityHandler extends IDisposable {
21
+ /** Event used to notify tree about visibility changes from outside. */
15
22
  readonly onVisibilityChange: BeEvent<() => void>;
23
+ /** Returns current visibility status for tree node. */
16
24
  getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
25
+ /** Changes visibility of the instance represented by tree node. */
17
26
  changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
18
27
  }
19
28
  interface UseHierarchyVisibilityProps {
20
29
  visibilityHandlerFactory: () => HierarchyVisibilityHandler;
21
30
  }
22
- interface UseHierarchyVisibilityResult {
23
- onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;
24
- getCheckboxState: (node: PresentationHierarchyNode) => TreeNodeCheckboxState;
31
+ export declare function useHierarchyVisibility({ visibilityHandlerFactory }: UseHierarchyVisibilityProps): TreeCheckboxProps & {
25
32
  triggerRefresh: () => void;
26
- }
27
- /** @internal */
28
- export declare function useHierarchyVisibility({ visibilityHandlerFactory }: UseHierarchyVisibilityProps): UseHierarchyVisibilityResult;
33
+ };
29
34
  export {};
30
35
  //# sourceMappingURL=UseHierarchyVisibility.d.ts.map