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

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 (418) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +232 -147
  3. package/lib/cjs/TreeWidget.d.ts +2 -4
  4. package/lib/cjs/TreeWidget.js +0 -6
  5. package/lib/cjs/TreeWidget.js.map +1 -1
  6. package/lib/cjs/components/SelectableTree.d.ts +3 -9
  7. package/lib/cjs/components/SelectableTree.js +1 -1
  8. package/lib/cjs/components/SelectableTree.js.map +1 -1
  9. package/lib/cjs/components/TreeSelector.d.ts +2 -2
  10. package/lib/cjs/components/TreeSelector.js.map +1 -1
  11. package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +14 -25
  12. package/lib/cjs/components/TreeWidgetUiItemsProvider.js +43 -45
  13. package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
  14. package/lib/cjs/components/tree-header/TreeHeader.js +17 -9
  15. package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
  16. package/lib/cjs/components/tree-header/TreeHeader.scss +7 -41
  17. package/lib/cjs/components/trees/Tree.scss +23 -0
  18. package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +22 -0
  19. package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +78 -0
  20. package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -0
  21. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.d.ts +21 -0
  22. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js +37 -0
  23. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
  24. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.d.ts +55 -0
  25. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +75 -0
  26. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -0
  27. package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
  28. package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js +185 -0
  29. package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
  30. package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
  31. package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js +94 -0
  32. package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
  33. package/lib/cjs/components/trees/categories-tree/UseCategories.d.ts +8 -0
  34. package/lib/cjs/components/trees/categories-tree/UseCategories.js +22 -0
  35. package/lib/cjs/components/trees/categories-tree/UseCategories.js.map +1 -0
  36. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +46 -0
  37. package/lib/cjs/components/trees/{CategoriesVisibilityUtils.js → common/CategoriesVisibilityUtils.js} +56 -8
  38. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -0
  39. package/lib/cjs/components/trees/common/FocusedInstancesContext.d.ts +14 -0
  40. package/lib/cjs/components/trees/common/FocusedInstancesContext.js +16 -0
  41. package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -0
  42. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.d.ts +8 -0
  43. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js +71 -0
  44. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
  45. package/lib/cjs/components/trees/common/Rxjs.d.ts +10 -0
  46. package/lib/cjs/components/trees/common/Rxjs.js +46 -0
  47. package/lib/cjs/components/trees/common/Rxjs.js.map +1 -0
  48. package/lib/cjs/components/trees/common/UseFeatureReporting.d.ts +11 -0
  49. package/lib/cjs/components/trees/common/UseFeatureReporting.js +10 -1
  50. package/lib/cjs/components/trees/common/UseFeatureReporting.js.map +1 -1
  51. package/lib/cjs/components/trees/common/UseFiltering.d.ts +12 -0
  52. package/lib/cjs/components/trees/common/UseFiltering.js +29 -0
  53. package/lib/cjs/components/trees/common/UseFiltering.js.map +1 -0
  54. package/lib/cjs/components/trees/common/UseHierarchiesLocalization.d.ts +8 -0
  55. package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js +33 -0
  56. package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js.map +1 -0
  57. package/lib/cjs/components/trees/common/UseHierarchyFiltering.d.ts +19 -0
  58. package/lib/cjs/components/trees/common/UseHierarchyFiltering.js +157 -0
  59. package/lib/cjs/components/trees/common/UseHierarchyFiltering.js.map +1 -0
  60. package/lib/cjs/components/trees/common/UseHierarchyVisibility.d.ts +30 -0
  61. package/lib/cjs/components/trees/common/UseHierarchyVisibility.js +98 -0
  62. package/lib/cjs/components/trees/common/UseHierarchyVisibility.js.map +1 -0
  63. package/lib/cjs/components/trees/common/UseIModelChangeListener.d.ts +9 -0
  64. package/lib/cjs/components/trees/common/UseIModelChangeListener.js +20 -0
  65. package/lib/cjs/components/trees/common/UseIModelChangeListener.js.map +1 -0
  66. package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.d.ts +13 -0
  67. package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js +35 -0
  68. package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js.map +1 -0
  69. package/lib/cjs/components/trees/common/UseNodeHighlighting.d.ts +16 -0
  70. package/lib/cjs/components/trees/common/UseNodeHighlighting.js +140 -0
  71. package/lib/cjs/components/trees/common/UseNodeHighlighting.js.map +1 -0
  72. package/lib/cjs/components/trees/common/Utils.d.ts +16 -6
  73. package/lib/cjs/components/trees/common/Utils.js +38 -34
  74. package/lib/cjs/components/trees/common/Utils.js.map +1 -1
  75. package/lib/cjs/components/trees/common/components/BaseTree.d.ts +34 -0
  76. package/lib/cjs/components/trees/common/components/BaseTree.js +77 -0
  77. package/lib/cjs/components/trees/common/components/BaseTree.js.map +1 -0
  78. package/lib/cjs/components/trees/common/components/Delayed.d.ts +6 -0
  79. package/lib/cjs/components/trees/common/components/Delayed.js +31 -0
  80. package/lib/cjs/components/trees/common/components/Delayed.js.map +1 -0
  81. package/lib/cjs/components/trees/common/components/ProgressOverlay.d.ts +5 -0
  82. package/lib/cjs/components/trees/common/components/ProgressOverlay.js +16 -0
  83. package/lib/cjs/components/trees/common/components/ProgressOverlay.js.map +1 -0
  84. package/lib/cjs/components/trees/common/components/ProgressOverlay.scss +21 -0
  85. package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
  86. package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.js +28 -0
  87. package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.js.map +1 -0
  88. package/lib/cjs/components/trees/common/components/TreeNodeRenderer.d.ts +13 -0
  89. package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js +20 -0
  90. package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
  91. package/lib/cjs/components/trees/common/components/TreeRenderer.d.ts +19 -0
  92. package/lib/cjs/components/trees/common/components/TreeRenderer.js +30 -0
  93. package/lib/cjs/components/trees/common/components/TreeRenderer.js.map +1 -0
  94. package/lib/cjs/components/trees/common/components/TreeRenderer.scss +62 -0
  95. package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +14 -0
  96. package/lib/cjs/components/trees/common/components/VisibilityTree.js +41 -0
  97. package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -0
  98. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +11 -35
  99. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js +29 -83
  100. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  101. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -14
  102. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +12 -12
  103. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  104. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +24 -0
  105. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +262 -0
  106. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
  107. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +11 -35
  108. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js +41 -79
  109. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  110. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -14
  111. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +12 -12
  112. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  113. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +28 -0
  114. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +619 -0
  115. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
  116. package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +26 -0
  117. package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +203 -0
  118. package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -0
  119. package/lib/cjs/components/trees/index.d.ts +4 -16
  120. package/lib/cjs/components/trees/index.js +9 -30
  121. package/lib/cjs/components/trees/index.js.map +1 -1
  122. package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +17 -72
  123. package/lib/cjs/components/trees/models-tree/ModelsTree.js +196 -135
  124. package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
  125. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
  126. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +101 -0
  127. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
  128. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +14 -35
  129. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +40 -83
  130. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  131. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.d.ts +67 -0
  132. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js +617 -0
  133. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -0
  134. package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +24 -0
  135. package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +121 -0
  136. package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
  137. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +44 -0
  138. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.js +325 -0
  139. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -0
  140. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.d.ts +31 -0
  141. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.js +40 -0
  142. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -0
  143. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +122 -0
  144. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +757 -0
  145. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -0
  146. package/lib/cjs/components/trees/models-tree/internal/Tooltip.d.ts +13 -0
  147. package/lib/cjs/components/trees/models-tree/internal/Tooltip.js +29 -0
  148. package/lib/cjs/components/trees/models-tree/internal/Tooltip.js.map +1 -0
  149. package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +10 -0
  150. package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.js +43 -0
  151. package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +1 -0
  152. package/lib/cjs/tree-widget-react.d.ts +3 -4
  153. package/lib/cjs/tree-widget-react.js +8 -4
  154. package/lib/cjs/tree-widget-react.js.map +1 -1
  155. package/lib/esm/TreeWidget.d.ts +2 -4
  156. package/lib/esm/TreeWidget.js +0 -6
  157. package/lib/esm/TreeWidget.js.map +1 -1
  158. package/lib/esm/components/SelectableTree.d.ts +3 -9
  159. package/lib/esm/components/SelectableTree.js +1 -1
  160. package/lib/esm/components/SelectableTree.js.map +1 -1
  161. package/lib/esm/components/TreeSelector.d.ts +2 -2
  162. package/lib/esm/components/TreeSelector.js.map +1 -1
  163. package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +14 -25
  164. package/lib/esm/components/TreeWidgetUiItemsProvider.js +42 -44
  165. package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
  166. package/lib/esm/components/tree-header/TreeHeader.js +17 -9
  167. package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
  168. package/lib/esm/components/tree-header/TreeHeader.scss +7 -41
  169. package/lib/esm/components/trees/Tree.scss +23 -0
  170. package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +22 -0
  171. package/lib/esm/components/trees/categories-tree/CategoriesTree.js +74 -0
  172. package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -0
  173. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.d.ts +21 -0
  174. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js +31 -0
  175. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
  176. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.d.ts +55 -0
  177. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +68 -0
  178. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -0
  179. package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
  180. package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js +181 -0
  181. package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
  182. package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
  183. package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js +90 -0
  184. package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
  185. package/lib/esm/components/trees/categories-tree/UseCategories.d.ts +8 -0
  186. package/lib/esm/components/trees/categories-tree/UseCategories.js +18 -0
  187. package/lib/esm/components/trees/categories-tree/UseCategories.js.map +1 -0
  188. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +46 -0
  189. package/lib/esm/components/trees/{CategoriesVisibilityUtils.js → common/CategoriesVisibilityUtils.js} +51 -6
  190. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -0
  191. package/lib/esm/components/trees/common/FocusedInstancesContext.d.ts +14 -0
  192. package/lib/esm/components/trees/common/FocusedInstancesContext.js +12 -0
  193. package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -0
  194. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.d.ts +8 -0
  195. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js +67 -0
  196. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
  197. package/lib/esm/components/trees/common/Rxjs.d.ts +10 -0
  198. package/lib/esm/components/trees/common/Rxjs.js +40 -0
  199. package/lib/esm/components/trees/common/Rxjs.js.map +1 -0
  200. package/lib/esm/components/trees/common/UseFeatureReporting.d.ts +11 -0
  201. package/lib/esm/components/trees/common/UseFeatureReporting.js +8 -0
  202. package/lib/esm/components/trees/common/UseFeatureReporting.js.map +1 -1
  203. package/lib/esm/components/trees/common/UseFiltering.d.ts +12 -0
  204. package/lib/esm/components/trees/common/UseFiltering.js +25 -0
  205. package/lib/esm/components/trees/common/UseFiltering.js.map +1 -0
  206. package/lib/esm/components/trees/common/UseHierarchiesLocalization.d.ts +8 -0
  207. package/lib/esm/components/trees/common/UseHierarchiesLocalization.js +29 -0
  208. package/lib/esm/components/trees/common/UseHierarchiesLocalization.js.map +1 -0
  209. package/lib/esm/components/trees/common/UseHierarchyFiltering.d.ts +19 -0
  210. package/lib/esm/components/trees/common/UseHierarchyFiltering.js +153 -0
  211. package/lib/esm/components/trees/common/UseHierarchyFiltering.js.map +1 -0
  212. package/lib/esm/components/trees/common/UseHierarchyVisibility.d.ts +30 -0
  213. package/lib/esm/components/trees/common/UseHierarchyVisibility.js +94 -0
  214. package/lib/esm/components/trees/common/UseHierarchyVisibility.js.map +1 -0
  215. package/lib/esm/components/trees/common/UseIModelChangeListener.d.ts +9 -0
  216. package/lib/esm/components/trees/common/UseIModelChangeListener.js +16 -0
  217. package/lib/esm/components/trees/common/UseIModelChangeListener.js.map +1 -0
  218. package/lib/esm/components/trees/common/UseMultiCheckboxHandler.d.ts +13 -0
  219. package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js +31 -0
  220. package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js.map +1 -0
  221. package/lib/esm/components/trees/common/UseNodeHighlighting.d.ts +16 -0
  222. package/lib/esm/components/trees/common/UseNodeHighlighting.js +136 -0
  223. package/lib/esm/components/trees/common/UseNodeHighlighting.js.map +1 -0
  224. package/lib/esm/components/trees/common/Utils.d.ts +16 -6
  225. package/lib/esm/components/trees/common/Utils.js +33 -29
  226. package/lib/esm/components/trees/common/Utils.js.map +1 -1
  227. package/lib/esm/components/trees/common/components/BaseTree.d.ts +34 -0
  228. package/lib/esm/components/trees/common/components/BaseTree.js +73 -0
  229. package/lib/esm/components/trees/common/components/BaseTree.js.map +1 -0
  230. package/lib/esm/components/trees/common/components/Delayed.d.ts +6 -0
  231. package/lib/esm/components/trees/common/components/Delayed.js +27 -0
  232. package/lib/esm/components/trees/common/components/Delayed.js.map +1 -0
  233. package/lib/esm/components/trees/common/components/ProgressOverlay.d.ts +5 -0
  234. package/lib/esm/components/trees/common/components/ProgressOverlay.js +12 -0
  235. package/lib/esm/components/trees/common/components/ProgressOverlay.js.map +1 -0
  236. package/lib/esm/components/trees/common/components/ProgressOverlay.scss +21 -0
  237. package/lib/esm/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
  238. package/lib/esm/components/trees/common/components/TreeNodeCheckbox.js +21 -0
  239. package/lib/esm/components/trees/common/components/TreeNodeCheckbox.js.map +1 -0
  240. package/lib/esm/components/trees/common/components/TreeNodeRenderer.d.ts +13 -0
  241. package/lib/esm/components/trees/common/components/TreeNodeRenderer.js +13 -0
  242. package/lib/esm/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
  243. package/lib/esm/components/trees/common/components/TreeRenderer.d.ts +19 -0
  244. package/lib/esm/components/trees/common/components/TreeRenderer.js +26 -0
  245. package/lib/esm/components/trees/common/components/TreeRenderer.js.map +1 -0
  246. package/lib/esm/components/trees/common/components/TreeRenderer.scss +62 -0
  247. package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +14 -0
  248. package/lib/esm/components/trees/common/components/VisibilityTree.js +37 -0
  249. package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -0
  250. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +11 -35
  251. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +27 -58
  252. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  253. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -14
  254. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +12 -12
  255. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  256. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +24 -0
  257. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +258 -0
  258. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
  259. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +11 -35
  260. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +39 -54
  261. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  262. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -14
  263. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +12 -12
  264. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  265. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +28 -0
  266. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +615 -0
  267. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
  268. package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +26 -0
  269. package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +199 -0
  270. package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -0
  271. package/lib/esm/components/trees/index.d.ts +4 -16
  272. package/lib/esm/components/trees/index.js +4 -16
  273. package/lib/esm/components/trees/index.js.map +1 -1
  274. package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +17 -72
  275. package/lib/esm/components/trees/models-tree/ModelsTree.js +196 -132
  276. package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
  277. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
  278. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +92 -0
  279. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
  280. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +14 -35
  281. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +38 -81
  282. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  283. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.d.ts +67 -0
  284. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js +613 -0
  285. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -0
  286. package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +24 -0
  287. package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +117 -0
  288. package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
  289. package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +44 -0
  290. package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.js +321 -0
  291. package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -0
  292. package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.d.ts +31 -0
  293. package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.js +37 -0
  294. package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -0
  295. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +122 -0
  296. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +748 -0
  297. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -0
  298. package/lib/esm/components/trees/models-tree/internal/Tooltip.d.ts +13 -0
  299. package/lib/esm/components/trees/models-tree/internal/Tooltip.js +24 -0
  300. package/lib/esm/components/trees/models-tree/internal/Tooltip.js.map +1 -0
  301. package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +10 -0
  302. package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.js +39 -0
  303. package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +1 -0
  304. package/lib/esm/tree-widget-react.d.ts +3 -4
  305. package/lib/esm/tree-widget-react.js +3 -4
  306. package/lib/esm/tree-widget-react.js.map +1 -1
  307. package/lib/public/locales/en/TreeWidget.json +126 -42
  308. package/package.json +19 -6
  309. package/lib/cjs/components/TreeFilteringState.d.ts +0 -18
  310. package/lib/cjs/components/TreeFilteringState.js +0 -46
  311. package/lib/cjs/components/TreeFilteringState.js.map +0 -1
  312. package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +0 -25
  313. package/lib/cjs/components/trees/CategoriesVisibilityUtils.js.map +0 -1
  314. package/lib/cjs/components/trees/VisibilityTreeBase.scss +0 -82
  315. package/lib/cjs/components/trees/VisibilityTreeEventHandler.d.ts +0 -67
  316. package/lib/cjs/components/trees/VisibilityTreeEventHandler.js +0 -158
  317. package/lib/cjs/components/trees/VisibilityTreeEventHandler.js.map +0 -1
  318. package/lib/cjs/components/trees/VisibilityTreeRenderer.d.ts +0 -100
  319. package/lib/cjs/components/trees/VisibilityTreeRenderer.js +0 -98
  320. package/lib/cjs/components/trees/VisibilityTreeRenderer.js.map +0 -1
  321. package/lib/cjs/components/trees/category-tree/Categories.json +0 -99
  322. package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +0 -60
  323. package/lib/cjs/components/trees/category-tree/CategoriesTree.js +0 -141
  324. package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +0 -1
  325. package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.d.ts +0 -71
  326. package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +0 -123
  327. package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
  328. package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -72
  329. package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js +0 -172
  330. package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +0 -1
  331. package/lib/cjs/components/trees/common/ContextMenu.d.ts +0 -39
  332. package/lib/cjs/components/trees/common/ContextMenu.js +0 -44
  333. package/lib/cjs/components/trees/common/ContextMenu.js.map +0 -1
  334. package/lib/cjs/components/trees/common/ReportingTreeEventHandler.d.ts +0 -27
  335. package/lib/cjs/components/trees/common/ReportingTreeEventHandler.js +0 -51
  336. package/lib/cjs/components/trees/common/ReportingTreeEventHandler.js.map +0 -1
  337. package/lib/cjs/components/trees/common/TreeNodeRenderer.d.ts +0 -61
  338. package/lib/cjs/components/trees/common/TreeNodeRenderer.js +0 -50
  339. package/lib/cjs/components/trees/common/TreeNodeRenderer.js.map +0 -1
  340. package/lib/cjs/components/trees/common/TreeRenderer.d.ts +0 -55
  341. package/lib/cjs/components/trees/common/TreeRenderer.js +0 -67
  342. package/lib/cjs/components/trees/common/TreeRenderer.js.map +0 -1
  343. package/lib/cjs/components/trees/common/TreeRenderer.scss +0 -149
  344. package/lib/cjs/components/trees/common/Types.d.ts +0 -57
  345. package/lib/cjs/components/trees/common/Types.js +0 -21
  346. package/lib/cjs/components/trees/common/Types.js.map +0 -1
  347. package/lib/cjs/components/trees/common/UseVisibilityTreeState.d.ts +0 -43
  348. package/lib/cjs/components/trees/common/UseVisibilityTreeState.js +0 -49
  349. package/lib/cjs/components/trees/common/UseVisibilityTreeState.js.map +0 -1
  350. package/lib/cjs/components/trees/external-sources-tree/ExternalSources.json +0 -228
  351. package/lib/cjs/components/trees/imodel-content-tree/IModelContent.json +0 -443
  352. package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.d.ts +0 -19
  353. package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.js +0 -36
  354. package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.js.map +0 -1
  355. package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.d.ts +0 -130
  356. package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js +0 -651
  357. package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js.map +0 -1
  358. package/lib/cjs/components/trees/models-tree/Utils.d.ts +0 -29
  359. package/lib/cjs/components/trees/models-tree/Utils.js +0 -556
  360. package/lib/cjs/components/trees/models-tree/Utils.js.map +0 -1
  361. package/lib/cjs/components/utils/UseTreeTransientState.d.ts +0 -19
  362. package/lib/cjs/components/utils/UseTreeTransientState.js +0 -33
  363. package/lib/cjs/components/utils/UseTreeTransientState.js.map +0 -1
  364. package/lib/esm/components/TreeFilteringState.d.ts +0 -18
  365. package/lib/esm/components/TreeFilteringState.js +0 -42
  366. package/lib/esm/components/TreeFilteringState.js.map +0 -1
  367. package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +0 -25
  368. package/lib/esm/components/trees/CategoriesVisibilityUtils.js.map +0 -1
  369. package/lib/esm/components/trees/VisibilityTreeBase.scss +0 -82
  370. package/lib/esm/components/trees/VisibilityTreeEventHandler.d.ts +0 -67
  371. package/lib/esm/components/trees/VisibilityTreeEventHandler.js +0 -154
  372. package/lib/esm/components/trees/VisibilityTreeEventHandler.js.map +0 -1
  373. package/lib/esm/components/trees/VisibilityTreeRenderer.d.ts +0 -100
  374. package/lib/esm/components/trees/VisibilityTreeRenderer.js +0 -86
  375. package/lib/esm/components/trees/VisibilityTreeRenderer.js.map +0 -1
  376. package/lib/esm/components/trees/category-tree/Categories.json +0 -99
  377. package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +0 -60
  378. package/lib/esm/components/trees/category-tree/CategoriesTree.js +0 -111
  379. package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +0 -1
  380. package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.d.ts +0 -71
  381. package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +0 -116
  382. package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
  383. package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -72
  384. package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js +0 -164
  385. package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +0 -1
  386. package/lib/esm/components/trees/common/ContextMenu.d.ts +0 -39
  387. package/lib/esm/components/trees/common/ContextMenu.js +0 -39
  388. package/lib/esm/components/trees/common/ContextMenu.js.map +0 -1
  389. package/lib/esm/components/trees/common/ReportingTreeEventHandler.d.ts +0 -27
  390. package/lib/esm/components/trees/common/ReportingTreeEventHandler.js +0 -47
  391. package/lib/esm/components/trees/common/ReportingTreeEventHandler.js.map +0 -1
  392. package/lib/esm/components/trees/common/TreeNodeRenderer.d.ts +0 -61
  393. package/lib/esm/components/trees/common/TreeNodeRenderer.js +0 -44
  394. package/lib/esm/components/trees/common/TreeNodeRenderer.js.map +0 -1
  395. package/lib/esm/components/trees/common/TreeRenderer.d.ts +0 -55
  396. package/lib/esm/components/trees/common/TreeRenderer.js +0 -59
  397. package/lib/esm/components/trees/common/TreeRenderer.js.map +0 -1
  398. package/lib/esm/components/trees/common/TreeRenderer.scss +0 -149
  399. package/lib/esm/components/trees/common/Types.d.ts +0 -57
  400. package/lib/esm/components/trees/common/Types.js +0 -18
  401. package/lib/esm/components/trees/common/Types.js.map +0 -1
  402. package/lib/esm/components/trees/common/UseVisibilityTreeState.d.ts +0 -43
  403. package/lib/esm/components/trees/common/UseVisibilityTreeState.js +0 -45
  404. package/lib/esm/components/trees/common/UseVisibilityTreeState.js.map +0 -1
  405. package/lib/esm/components/trees/external-sources-tree/ExternalSources.json +0 -228
  406. package/lib/esm/components/trees/imodel-content-tree/IModelContent.json +0 -443
  407. package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.d.ts +0 -19
  408. package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.js +0 -32
  409. package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.js.map +0 -1
  410. package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.d.ts +0 -130
  411. package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js +0 -641
  412. package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js.map +0 -1
  413. package/lib/esm/components/trees/models-tree/Utils.d.ts +0 -29
  414. package/lib/esm/components/trees/models-tree/Utils.js +0 -548
  415. package/lib/esm/components/trees/models-tree/Utils.js.map +0 -1
  416. package/lib/esm/components/utils/UseTreeTransientState.d.ts +0 -19
  417. package/lib/esm/components/utils/UseTreeTransientState.js +0 -29
  418. package/lib/esm/components/utils/UseTreeTransientState.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Change Log - @itwin/tree-widget-react
2
2
 
3
- This log was last generated on Mon, 10 Jun 2024 12:47:40 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 10 Jun 2024 12:47:48 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
7
  ## 2.3.2
8
8
 
9
- Mon, 10 Jun 2024 12:47:40 GMT
9
+ Mon, 10 Jun 2024 12:47:48 GMT
10
10
 
11
11
  ### Patches
12
12
 
package/README.md CHANGED
@@ -6,6 +6,31 @@ The `@itwin/tree-widget-react` package provides React components to build a widg
6
6
 
7
7
  ![Widget example](./media/widget.png)
8
8
 
9
+ ## 3.0 highlights
10
+
11
+ The new `3.0` version of the package contains a few notable changes, compared to the previous `2.x` generation.
12
+
13
+ - To allow easier customization of widget placement, the package now delivers a `createTreeWidget()` function that creates a tree widget definition, instead of a full `UiItemsProvider` implementation. See [Usage](#usage) section for details on how to use the new function.
14
+
15
+ - The underlying engine for building hierarchies has been changed from `@itwin/presentation-components` to `@itwin/presentation-hierarchies-react`. This is a significant change as the new library runs plain ECSQL queries and handles hierarchy creation on the frontend, as opposed to the previous version that relied on the backend to provide hierarchy data. This change allows this package to use more optimal queries and to be more flexible in terms of hierarchy creation.
16
+
17
+ This change adds a requirement for all tree components in this package to access iModels' metadata, which is achieved through a required `getSchemaContext` prop. See [Creating schema context](#creating-schema-context) section for an example implementation of this function.
18
+
19
+ In addition, the new tree components don't rely on the global selection manager provided by `@itwin/presentation-frontend` package. Instead, they require a unified selection storage object created using `createStorage()` function from `@itwin/unified-selection` package. See sections of individual tree components for how to supply it to them, and [Creating unified selection storage](#creating-unified-selection-storage) section for an example for how to create the storage.
20
+
21
+ - The tree components delivered with the package have been updated to use the [`Tree` component from `@itwin/itwinui-react` package](https://itwinui.bentley.com/docs/tree) instead of [`ControlledTree` from `@itwin/components-react`](https://www.itwinjs.org/reference/components-react/tree/controlledtree/). The new component is a little less dense, provides better accessibility and customization options.
22
+
23
+ | 2.x | 3.0 |
24
+ | ----------------------------------------------- | ----------------------------------------------- |
25
+ | ![Tree widget 2.x](./media/tree-widget-2.x.png) | ![Tree widget 3.0](./media/tree-widget-3.0.png) |
26
+
27
+ - The tree components now have hierarchy level size limiting and filtering features always turned on. The features were already available in `2.x` versions, but were not enabled by default. See [Hierarchy level size limiting](#hierarchy-level-size-limiting) and [Hierarchy level filtering](#hierarchy-level-filtering) sections for more details.
28
+
29
+ - Models tree:
30
+ - The label filtering feature has been expanded to filter not only up to Models, but the whole hierarchy. This allows filtering the hierarchy to additionally find Category or Element nodes.
31
+ - [Focus mode](#focus-mode) feature has been added to allow automatic hierarchy filtering as the application selection changes.
32
+ - Display states' control has been modified to be hierarchy based. This means that changing display state of something deep in the hierarchy affects checkbox state of all its ancestors. And vice versa - changing display state of an ancestor affects all its descendants.
33
+
9
34
  ## Usage
10
35
 
11
36
  Typically, the package is used with an [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) based application, but the building blocks may as well be used with any other iTwin.js React app.
@@ -15,66 +40,56 @@ In any case, **before** using any APIs or components delivered with the package,
15
40
  ```ts
16
41
  import { IModelApp } from "@itwin/core-frontend";
17
42
  import { TreeWidget } from "@itwin/tree-widget-react";
18
- ...
19
- await TreeWidget.initialize(IModelApp.localization);
20
- ```
21
-
22
- In [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) based applications widgets are typically provided using `UiItemsProvider` implementations. The `@itwin/tree-widget-react` package delivers `TreeWidgetUiItemsProvider` that can be used to add the tree widget to UI:
23
43
 
24
- ```ts
25
- import { UiItemsManager } from "@itwin/appui-react";
26
- import { TreeWidgetUiItemsProvider } from "@itwin/tree-widget-react";
27
- ...
28
- UiItemsManager.register(
29
- new TreeWidgetUiItemsProvider()
30
- );
44
+ await TreeWidget.initialize(IModelApp.localization);
31
45
  ```
32
46
 
33
- The above example uses default widget parameters and results in a component similar to the one visible at the top of this README. Customization is also possible:
47
+ In [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) based applications widgets are typically provided using `UiItemsProvider` implementations. The `@itwin/tree-widget-react` package delivers `createTreeWidget` function that can be used to add the tree widget to UI through a `UiItemsProvider`:
34
48
 
35
49
  ```ts
36
50
  import { UiItemsManager } from "@itwin/appui-react";
37
- import { TreeWidgetUiItemsProvider, ModelsTreeComponent } from "@itwin/tree-widget-react";
38
- ...
39
- UiItemsManager.register(
40
- new TreeWidgetUiItemsProvider({
41
- // defaults to `StagePanelLocation.Right`
42
- defaultPanelLocation: StagePanelLocation.Left,
43
- // defaults to `StagePanelSection.Start`
44
- defaultPanelSection: StagePanelSection.End,
45
- // defaults to whatever the default `Widget.priority` in AppUI is
46
- defaultTreeWidgetPriority: 1000,
47
- // defaults to `ModelsTreeComponent` and `CategoriesTreeComponent`
48
- trees: [{
49
- id: ModelsTreeComponent.id,
50
- getLabel: ModelsTreeComponent.getLabel,
51
- render: () => <ModelsTreeComponent />,
52
- }, {
53
- id: "my-tree-id",
54
- getLabel: "My Custom Tree",
55
- render: () => <>This is my custom tree.</>,
56
- }];
57
- })
58
- );
51
+ import { createTreeWidget, ModelsTreeComponent } from "@itwin/tree-widget-react";
52
+
53
+ UiItemsManager.register({
54
+ id: "tree-widget-provider",
55
+ getWidgets: () => [
56
+ createTreeWidget({
57
+ trees: [
58
+ // add the Models tree component delivered with the package
59
+ {
60
+ id: ModelsTreeComponent.id,
61
+ getLabel: () => ModelsTreeComponent.getLabel(),
62
+ render: (props) => (
63
+ <ModelsTreeComponent
64
+ // see "Models tree" section for details regarding `getSchemaContext` and `selectionStorage` props
65
+ getSchemaContext={getSchemaContext}
66
+ selectionStorage={unifiedSelectionStorage}
67
+ selectionMode={"extended"}
68
+ />
69
+ ),
70
+ },
71
+ // add a custom component
72
+ {
73
+ id: "my-tree-id",
74
+ startIcon: <MyTreeIcon />,
75
+ getLabel: () => "My Custom Tree",
76
+ render: () => <>This is my custom tree.</>,
77
+ },
78
+ ],
79
+ }),
80
+ ],
81
+ });
59
82
  ```
60
83
 
61
- As seen in the above code snippet, `TreeWidgetUiItemsProvider` takes a list of trees that are displayed in the widget. This package delivers a number of tree components for everyone's use (see below), but providing custom trees is also an option.
84
+ As seen in the above code snippet, `createTreeWidget` takes a list of trees that are displayed in the widget. This package delivers a number of tree components for everyone's use (see below), but providing custom trees is also an option.
62
85
 
63
86
  ## Components
64
87
 
65
- While we expect this package to be mostly used with [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) and widget created through `TreeWidgetUiItemsProvider`, the package delivers components used within the widget to meet other use cases:
88
+ While we expect this package to be mostly used with [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) and widget created through `createTreeWidget`, the package delivers components used within the widget to meet other use cases.
66
89
 
67
- - `SelectableTree` renders a tree selector and selected tree (based on the `trees` prop).
90
+ ### Selectable tree
68
91
 
69
- - Visibility tree components help you build trees that look and feel like [Models](#models-tree) and [Categories](#categories-tree) trees, letting you control display of elements in the hierarchy.
70
-
71
- - `createVisibilityTreeRenderer` returns a tree renderer that renders nodes with "eye" checkboxes. Its building blocks:
72
- - `createVisibilityTreeNodeRenderer`
73
- - `VisibilityTreeNodeCheckbox`
74
- - `useVisibilityTreeState` is used to create and manage tree state.
75
- - `VisibilityTreeNoFilteredData` is used to render a "no results" when filtering.
76
- - `VisibilityTreeEventHandler` is an extension of [UnifiedSelectionTreeEventHandler](https://www.itwinjs.org/reference/presentation-components/tree/unifiedselectiontreeeventhandler/), that additionally handles checkbox events and calls provided `IVisibilityHandler` to get/set display of the elements in the hierarchy.
77
- - `useTreeTransientState` is used to persist tree scroll position when tree is used in [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) widget.
92
+ `SelectableTree` renders a tree selector and selected tree, based on the `trees` prop. Each tree definition contains a label, an optional icon and a render function that renders the component.
78
93
 
79
94
  ### Models tree
80
95
 
@@ -85,20 +100,37 @@ The component renders a tree that tries to replicate how a typical "Models" tree
85
100
  Typical usage:
86
101
 
87
102
  ```tsx
88
- import { ModelsTreeComponent, ClassGroupingOption } from "@itwin/tree-widget-react";
89
- import { SelectionMode } from "@itwin/components-react";
90
- ...
103
+ import { IModelConnection } from "@itwin/core-frontend";
104
+ import { SchemaContext } from "@itwin/ecschema-metadata";
105
+ import { SelectionStorage } from "@itwin/unified-selection";
106
+ import { ModelsTreeComponent } from "@itwin/tree-widget-react";
107
+
108
+ // The Models tree requires a unified selection storage to support selection synchronization with the
109
+ // application. The storage should be created once per application and shared across multiple selection-enabled
110
+ // components.
111
+ function getUnifiedSelectionStorage(): SelectionStorage {
112
+ // see "Creating unified selection storage" section for example implementation
113
+ }
114
+
115
+ // Schema context is used by Models tree to access iModels metadata. Similar to selection storage, it should be
116
+ // created once per application and shared across multiple components.
117
+ function getSchemaContext(imodel: IModelConnection): SchemaContext {
118
+ // see "Creating schema context" section for example implementation
119
+ }
120
+
91
121
  function MyWidget() {
92
122
  return (
93
123
  <ModelsTreeComponent
124
+ getSchemaContext={getSchemaContext}
125
+ selectionStorage={getUnifiedSelectionStorage()}
94
126
  headerButtons={[
95
127
  (props) => <ModelsTreeComponent.ShowAllButton {...props} />,
96
128
  (props) => <ModelsTreeComponent.HideAllButton {...props} />,
97
129
  (props) => <MyCustomButton />,
98
130
  ]}
99
- selectionMode={SelectionMode.Extended}
131
+ selectionMode={"extended"}
100
132
  hierarchyConfig={{
101
- enableElementsClassGrouping: ClassGroupingOption.Yes,
133
+ elementClassGrouping: "enable",
102
134
  }}
103
135
  />
104
136
  );
@@ -113,10 +145,11 @@ Available header buttons:
113
145
  - `ModelsTreeComponent.View2DButton` toggles plan projection models' display.
114
146
  - `ModelsTreeComponent.View3DButton` toggles non-plan projection models' display.
115
147
 
116
- `ModelsTreeComponent` building blocks:
148
+ #### Focus mode
117
149
 
118
- - `ModelsTree` renders the tree without the header.
119
- - `ModelsVisibilityHandler` knows how to get and control display of various concepts displayed in the Models tree: Subjects, Models, Categories, Elements.
150
+ The Models tree can be used in a "focus mode" where the tree is automatically filtered to show only elements that are selected in the application. The mode can be controlled through a toggle button in the component's header. Since the feature is mutually exclusive with the "search" feature, enabling it automatically disables the search functionality.
151
+
152
+ ![Models tree focus mode demo](./media/models-tree-focus-mode.gif)
120
153
 
121
154
  ### Categories tree
122
155
 
@@ -127,11 +160,29 @@ The component, based on the active view, renders a hierarchy of either spatial (
127
160
  Typical usage:
128
161
 
129
162
  ```tsx
130
- import { CategoriesTreeComponent } from "@itwin/tree-widget-react";
131
- ...
163
+ import { IModelConnection } from "@itwin/core-frontend";
164
+ import { SchemaContext } from "@itwin/ecschema-metadata";
165
+ import { SelectionStorage } from "@itwin/unified-selection";
166
+ import { CategoriesTreeComponent, CategoriesTreeComponent } from "@itwin/tree-widget-react";
167
+
168
+ // The Categories tree requires a unified selection storage to support selection synchronization with the
169
+ // application. The storage should be created once per application and shared across multiple selection-enabled
170
+ // components.
171
+ function getUnifiedSelectionStorage(): SelectionStorage {
172
+ // see "Creating unified selection storage" section for example implementation
173
+ }
174
+
175
+ // Schema context is used by Categories tree to access iModels metadata. Similar to selection storage, it should be
176
+ // created once per application and shared across multiple components.
177
+ function getSchemaContext(imodel: IModelConnection): SchemaContext {
178
+ // see "Creating schema context" section for example implementation
179
+ }
180
+
132
181
  function MyWidget() {
133
182
  return (
134
183
  <CategoriesTreeComponent
184
+ getSchemaContext={getSchemaContext}
185
+ selectionStorage={getUnifiedSelectionStorage()}
135
186
  headerButtons={[
136
187
  (props) => <CategoriesTreeComponent.ShowAllButton {...props} />,
137
188
  (props) => <CategoriesTreeComponent.HideAllButton {...props} />,
@@ -148,19 +199,14 @@ Available header buttons:
148
199
  - `ModelsTreeComponent.HideAllButton` makes all categories hidden.
149
200
  - `ModelsTreeComponent.InvertButton` inverts display of all categories.
150
201
 
151
- `CategoriesTreeComponent` building blocks:
152
-
153
- - `CategoryTree` renders the tree without the header.
154
- - `CategoryVisibilityHandler` knows how to get and control display of Categories and SubCategories.
155
-
156
- ### IModel content tree
202
+ ### iModel content tree
157
203
 
158
204
  The component renders a similar hierarchy to [Models tree](#models-tree), but with the following changes:
159
205
 
160
206
  - Only the hierarchy, without a header is rendered.
161
207
  - Visibility control is not allowed.
162
208
  - There's less hiding of `Subject` and `Model` nodes.
163
- - Show not only geometric, but all Models.
209
+ - Show not only geometric, but all Models and Elements.
164
210
 
165
211
  In general, the component is expected to be used by advanced users to inspect contents of the iModel.
166
212
 
@@ -169,142 +215,181 @@ In general, the component is expected to be used by advanced users to inspect co
169
215
  Typical usage:
170
216
 
171
217
  ```tsx
218
+ import { IModelConnection } from "@itwin/core-frontend";
219
+ import { SchemaContext } from "@itwin/ecschema-metadata";
220
+ import { SelectionStorage } from "@itwin/unified-selection";
172
221
  import { IModelContentTreeComponent } from "@itwin/tree-widget-react";
173
- ...
222
+
223
+ // The iModel content tree requires a unified selection storage to support selection synchronization with the
224
+ // application. The storage should be created once per application and shared across multiple selection-enabled
225
+ // components.
226
+ function getUnifiedSelectionStorage(): SelectionStorage {
227
+ // see "Creating unified selection storage" section for example implementation
228
+ }
229
+
230
+ // Schema context is used by iModel content tree to access iModels metadata. Similar to selection storage, it should be
231
+ // created once per application and shared across multiple components.
232
+ function getSchemaContext(imodel: IModelConnection): SchemaContext {
233
+ // see "Creating schema context" section for example implementation
234
+ }
235
+
174
236
  function MyWidget() {
175
237
  return (
176
- <IModelContentTreeComponent />
238
+ <IModelContentTreeComponent
239
+ getSchemaContext={getSchemaContext}
240
+ selectionStorage={getUnifiedSelectionStorage()}
241
+ />
177
242
  );
178
243
  }
179
244
  ```
180
245
 
181
- ## Performance tracking
246
+ ### Hierarchy level size limiting
182
247
 
183
- Components from this package allows consumers to track performance of specific features.
248
+ All tree components in this package enforce a hierarchy level size limit. This means that when a node is expanded, only a certain number of child nodes are loaded. The limit is enforced to prevent loading too many nodes at once and to keep the performance of the tree components at an acceptable level.
184
249
 
185
- This can be achieved by passing `onPerformanceMeasured` function to `CategoriesTreeComponent`, `ModelsTreeComponent`, `IModelContentTreeComponent` or `TreeWidgetUiItemsProvider`. The function is invoked with feature id and time elapsed as the component is being used. List of tracked features:
250
+ By default, the limit is set to `1000` nodes and components allow users to increase it to `10,000` for each hierarchy level individually:
186
251
 
187
- - `"{tree}-initial-load"` - time it takes to load initial nodes after the tree is created.
188
- - `"{tree}-hierarchy-level-load"` - time it takes to load children nodes when a node is expanded.
252
+ ![Hierarchy level size limit override example](./media/hierarchy-level-size-limit-override-example.gif)
189
253
 
190
- Where `{tree}` specifies which tree component the feature is of.
254
+ ### Hierarchy level filtering
255
+
256
+ All tree components in this package allow users to filter nodes at each hierarchy level. The filter is applied to a single hierarchy level, which allows users to reduce amount of nodes being loaded - this is especially useful when a [hierarchy level size limit](#hierarchy-level-size-limiting) is hit:
191
257
 
192
- Example:
258
+ ![Hierarchy level filtering example](./media/hierarchy-level-filtering-example.gif)
259
+
260
+ ### Creating unified selection storage
261
+
262
+ Tree components that support selection synchronization, require a unified selection storage object created using `createStorage()` function from `@itwin/unified-selection` package.
263
+
264
+ Typically, we want one unified selection storage per application - this makes sure that selection in all application's components is synchronized. Below is an example implementation of `getUnifiedSelectionStorage` function that creates the storage and clears it when an iModel is closed:
193
265
 
194
266
  ```ts
195
- import { UiItemsManager } from "@itwin/appui-react";
196
- import { TreeWidgetUiItemsProvider, ModelsTreeComponent } from "@itwin/tree-widget-react";
197
- ...
198
- UiItemsManager.register(
199
- new TreeWidgetUiItemsProvider({
200
- defaultPanelLocation: StagePanelLocation.Left,
201
- defaultPanelSection: StagePanelSection.End,
202
- defaultTreeWidgetPriority: 1000,
203
- onPerformanceMeasured={(feature, elapsedTime) => {
204
- telemetryClient.log(`TreeWidget [${feature}] took ${elapsedTime} ms`);
205
- }},
206
- trees: [{
207
- id: ModelsTreeComponent.id,
208
- getLabel: ModelsTreeComponent.getLabel,
209
- render: (props) => <ModelsTreeComponent { ...props } />,
210
- }];
211
- })
212
- );
267
+ import { IModelConnection } from "@itwin/core-frontend";
268
+ import { createStorage, SelectionStorage } from "@itwin/unified-selection";
269
+
270
+ let unifiedSelectionStorage: SelectionStorage | undefined;
271
+ function getUnifiedSelectionStorage(): SelectionStorage {
272
+ if (!unifiedSelectionStorage) {
273
+ unifiedSelectionStorage = createStorage();
274
+ IModelConnection.onClose.addListener((imodel) => {
275
+ unifiedSelectionStorage!.clearStorage({ imodelKey: imodel.key });
276
+ });
277
+ }
278
+ return unifiedSelectionStorage;
279
+ }
213
280
  ```
214
281
 
215
- For individual tree components the `onPerformanceMeasured` callback should be supplied through props:
282
+ In case the application is also using components driven by APIs from `@itwin/presentation-frontend` package, which has its own selection manager, the single unified selection storage object should be passed to [`Presentation.initialize`](https://www.itwinjs.org/reference/presentation-frontend/core/presentation/initializestatic/) function, e.g.:
216
283
 
217
284
  ```ts
218
- return (
219
- <ModelsTreeComponent
220
- onPerformanceMeasured={(feature, elapsedTime) => {
221
- console.log(`TreeWidget [${feature}] took ${elapsedTime} ms`)
222
- }}
223
- />
224
- );
285
+ import { Presentation } from "@itwin/presentation-frontend";
286
+
287
+ Presentation.initialize({
288
+ selection: {
289
+ selectionStorage: getUnifiedSelectionStorage(),
290
+ },
291
+ });
292
+ ```
293
+
294
+ ### Creating schema context
295
+
296
+ All tree components delivered with the package require a [`SchemaContext`](https://www.itwinjs.org/reference/ecschema-metadata/context/schemacontext/) to be able to access iModels metadata.
297
+
298
+ Typically, we want one schema context per iModel per application - this allows schema information to be shared across components, saving memory and time required to access the metadata. Below is an example implementation of `getSchemaContext` function, required by tree components:
299
+
300
+ ```ts
301
+ import { IModelConnection } from "@itwin/core-frontend";
302
+ import { SchemaContext } from "@itwin/ecschema-metadata";
303
+ import { ECSchemaRpcLocater } from "@itwin/ecschema-rpcinterface-common";
304
+
305
+ const schemaContextCache = new Map<string, SchemaContext>();
306
+ function getSchemaContext(imodel: IModelConnection) {
307
+ const key = imodel.getRpcProps().key;
308
+ let schemaContext = schemaContextCache.get(key);
309
+ if (!schemaContext) {
310
+ const schemaLocater = new ECSchemaRpcLocater(imodel.getRpcProps());
311
+ schemaContext = new SchemaContext();
312
+ schemaContext.addLocater(schemaLocater);
313
+ schemaContextCache.set(key, schemaContext);
314
+ imodel.onClose.addOnce(() => schemaContextCache.delete(key));
315
+ }
316
+ return schemaContext;
317
+ }
225
318
  ```
226
319
 
227
- ## Usage tracking
320
+ ## Telemetry
321
+
322
+ ### Performance tracking
323
+
324
+ Components from this package allows consumers to track performance of specific features.
325
+
326
+ This can be achieved by passing `onPerformanceMeasured` function to `CategoriesTreeComponent`, `ModelsTreeComponent`, `IModelContentTreeComponent` or `TreeWidgetUiItemsProvider`. The function is invoked with feature id and time elapsed as the component is being used. List of tracked features:
327
+
328
+ - `"{tree}-initial-load"` - time it takes to load initial nodes after the tree is created.
329
+ - `"{tree}-hierarchy-level-load"` - time it takes to load child nodes when a node is expanded.
330
+ - `"{tree}-reload"` - time it takes to reload the tree after data in the iModel changes or it's being reloaded due to filtering.
331
+
332
+ Where `{tree}` specifies which tree component the feature is of.
333
+
334
+ ### Usage tracking
228
335
 
229
336
  Components from this package allows consumers to track the usage of specific features.
230
337
 
231
338
  This can be achieved by passing `onFeatureUsed` function to `CategoriesTreeComponent`, `ModelsTreeComponent`, `IModelContentTreeComponent` or `TreeWidgetUiItemsProvider`. The function is invoked with feature id as the component is being used. List of tracked features:
232
339
 
233
340
  - `"choose-{tree}"` - when a tree is selected in the tree selector.
234
- - `"use-{tree}"` - when an interaction with a tree hierarchy happens.
341
+ - `"use-{tree}"` - when an interaction with a tree hierarchy happens. This includes any kind of interaction with nodes, including them being expanded/collapsed, selected, filtered, their visibility change, etc.
235
342
  - `"{tree}-visibility-change"` - when visibility is toggled using an "eye" button.
236
343
  - `"models-tree-showall"` - when "Show All" button is used in `ModelsTreeComponent`.
237
344
  - `"models-tree-hideall"` - when "Hide All" button is used in `ModelsTreeComponent`.
238
345
  - `"models-tree-invert"` - when "Invert" button is used in `ModelsTreeComponent`.
239
346
  - `"models-tree-view2d"` - when "Toggle 2D Views" button is used in `ModelsTreeComponent`.
240
347
  - `"models-tree-view3d"` - when "Toggle 3D Views" button is used in `ModelsTreeComponent`.
348
+ - `"models-tree-instancesfocus"` - when "Instances focus mode" toggle button is used in `ModelsTreeComponent`.
241
349
  - `"models-tree-zoom-to-node"` - when node is zoomed to in `ModelsTree`.
242
350
  - `"models-tree-filtering"` - when a filter is applied in `ModelsTree`.
243
- - `"models-tree-hierarchy-level-filtering"` - when a hierarchy level filter is applied in `ModelsTree`.
244
- - `"models-tree-hierarchy-level-size-limit-hit"` - when hierarchy limit is exceeded while loading nodes in `ModelsTree`.
351
+ - `"models-tree-hierarchy-level-filtering"` - when a hierarchy level filter is applied in the `ModelsTree`.
352
+ - `"models-tree-hierarchy-level-size-limit-hit"` - when hierarchy level size limit is exceeded while loading nodes in the `ModelsTree`.
245
353
  - `"categories-tree-showall"` - when "Show All" button is used in `CategoriesTreeComponent`.
246
354
  - `"categories-tree-hideall"` - when "Hide All" button is used in `CategoriesTreeComponent`.
247
355
  - `"categories-tree-invert"` - when "Invert" button is used in `CategoriesTreeComponent`.
248
356
 
249
357
  Where `{tree}` specifies which tree component the feature is of.
250
358
 
251
- Example:
359
+ ### Example
252
360
 
253
361
  ```ts
254
362
  import { UiItemsManager } from "@itwin/appui-react";
255
- import { TreeWidgetUiItemsProvider, ModelsTreeComponent } from "@itwin/tree-widget-react";
256
- ...
363
+ import { TreeWidgetUiItemsProvider } from "@itwin/tree-widget-react";
364
+
257
365
  UiItemsManager.register(
258
366
  new TreeWidgetUiItemsProvider({
259
- defaultPanelLocation: StagePanelLocation.Left,
260
- defaultPanelSection: StagePanelSection.End,
261
- defaultTreeWidgetPriority: 1000,
367
+ onPerformanceMeasured={(feature, elapsedTime) => {
368
+ telemetryClient.log(`TreeWidget [${feature}] took ${elapsedTime} ms`);
369
+ }},
262
370
  onFeatureUsed={(feature) => {
263
371
  telemetryClient.log(`TreeWidget [${feature}] used`);
264
372
  }},
265
- trees: [{
266
- id: ModelsTreeComponent.id,
267
- getLabel: ModelsTreeComponent.getLabel,
268
- render: (props) => <ModelsTreeComponent { ...props } />,
269
- }];
270
373
  })
271
374
  );
272
375
  ```
273
376
 
274
- For individual tree components the `onFeatureUsed` callback should be supplied through props:
377
+ For individual tree components the callbacks should be supplied through props:
275
378
 
276
379
  ```ts
277
- return (
278
- <ModelsTreeComponent
279
- onFeatureUsed={(feature) => {
280
- console.log(`TreeWidget [${feature}] used`)
281
- }}
282
- />
283
- );
284
- ```
285
-
286
- ## Tree selector icons
287
-
288
- Provided trees to `TreeWidgetUiItemsProvider` can define a `startIcon` property that will be shown next to the tree label in tree selector.
380
+ import { ModelsTreeComponent } from "@itwin/tree-widget-react";
289
381
 
290
- Example:
291
-
292
- ```ts
293
- import { UiItemsManager } from "@itwin/appui-react";
294
- import { TreeWidgetUiItemsProvider, ModelsTreeComponent } from "@itwin/tree-widget-react";
295
- import { SvgTechnicalPreviewMiniBw } from "@itwin/itwinui-icons-react";
296
- ...
297
- UiItemsManager.register(
298
- new TreeWidgetUiItemsProvider({
299
- defaultPanelLocation: StagePanelLocation.Left,
300
- defaultPanelSection: StagePanelSection.End,
301
- defaultTreeWidgetPriority: 1000,
302
- trees: [{
303
- id: ModelsTreeComponent.id,
304
- getLabel: ModelsTreeComponent.getLabel,
305
- render: (props) => <ModelsTreeComponent { ...props } />,
306
- startIcon: <SvgTechnicalPreviewMiniBw />,
307
- }];
308
- })
309
- );
382
+ function MyWidget() {
383
+ return (
384
+ <ModelsTreeComponent
385
+ {...otherProps}
386
+ onPerformanceMeasured={(feature, elapsedTime) => {
387
+ console.log(`TreeWidget [${feature}] took ${elapsedTime} ms`)
388
+ }}
389
+ onFeatureUsed={(feature) => {
390
+ console.log(`TreeWidget [${feature}] used`)
391
+ }}
392
+ />
393
+ );
394
+ }
310
395
  ```
@@ -1,5 +1,4 @@
1
- import type { Localization } from "@itwin/core-common";
2
- import type { LocalizationOptions } from "@itwin/core-i18n";
1
+ import type { Localization, TranslationOptions } from "@itwin/core-common";
3
2
  /**
4
3
  * Entry point for static initialization required by various components used in the package.
5
4
  * @public
@@ -7,7 +6,6 @@ import type { LocalizationOptions } from "@itwin/core-i18n";
7
6
  export declare class TreeWidget {
8
7
  private static _i18n?;
9
8
  private static _initialized?;
10
- private static _dispose?;
11
9
  /**
12
10
  * Called by IModelApp to initialize the Tree Widget
13
11
  * @param i18n - The internationalization service created by the IModelApp.
@@ -21,6 +19,6 @@ export declare class TreeWidget {
21
19
  static get i18nNamespace(): string;
22
20
  /** Calls i18n.translateWithNamespace with the "TreeWidget" namespace. Do NOT include the namespace in the key.
23
21
  */
24
- static translate(key: string | string[], options?: LocalizationOptions): string;
22
+ static translate(key: string | string[], options?: TranslationOptions): string;
25
23
  }
26
24
  //# sourceMappingURL=TreeWidget.d.ts.map
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.TreeWidget = void 0;
8
8
  const core_common_1 = require("@itwin/core-common");
9
9
  const core_frontend_1 = require("@itwin/core-frontend");
10
- const Utils_1 = require("./components/trees/common/Utils");
11
10
  /**
12
11
  * Entry point for static initialization required by various components used in the package.
13
12
  * @public
@@ -23,7 +22,6 @@ class TreeWidget {
23
22
  }
24
23
  TreeWidget._initialized = true;
25
24
  TreeWidget._i18n = i18n ?? core_frontend_1.IModelApp.localization;
26
- TreeWidget._dispose = (0, Utils_1.registerRenderers)();
27
25
  return TreeWidget._i18n.registerNamespace(TreeWidget.i18nNamespace);
28
26
  }
29
27
  /** Unregisters the TreeWidget internationalization service namespace */
@@ -32,10 +30,6 @@ class TreeWidget {
32
30
  TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace);
33
31
  TreeWidget._i18n = undefined;
34
32
  }
35
- if (TreeWidget._dispose) {
36
- TreeWidget._dispose();
37
- TreeWidget._dispose = undefined;
38
- }
39
33
  TreeWidget._initialized = false;
40
34
  }
41
35
  /** The internationalization service created by the IModelApp. */
@@ -1 +1 @@
1
- {"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../src/TreeWidget.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAGhG,oDAAiE;AACjE,wDAAiD;AACjD,2DAAoE;AAIpE;;;GAGG;AACH,MAAa,UAAU;IAKrB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAmB;QAChD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,OAAO;SACR;QAED,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,yBAAS,CAAC,YAAY,CAAC;QAClD,UAAU,CAAC,QAAQ,GAAG,IAAA,yBAAiB,GAAE,CAAC;QAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,SAAS;QACrB,IAAI,UAAU,CAAC,KAAK,EAAE;YACpB,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/D,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;SAC9B;QAED,IAAI,UAAU,CAAC,QAAQ,EAAE;YACvB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;SACjC;QAED,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,iEAAiE;IAC1D,MAAM,KAAK,IAAI;QACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;YACrB,MAAM,IAAI,0BAAY,CAAC,2BAAa,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;SAC3E;QACD,OAAO,UAAU,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,aAAa;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;OACG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB,EAAE,OAA6B;QAC3E,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AAtDD,gCAsDC","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 type { Localization } from \"@itwin/core-common\";\nimport { BentleyError, BentleyStatus } from \"@itwin/core-common\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { registerRenderers } from \"./components/trees/common/Utils\";\n\nimport type { LocalizationOptions } from \"@itwin/core-i18n\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n private static _i18n?: Localization;\n private static _initialized?: boolean;\n private static _dispose?: () => void;\n\n /**\n * Called by IModelApp to initialize the Tree Widget\n * @param i18n - The internationalization service created by the IModelApp.\n */\n public static async initialize(i18n?: Localization): Promise<void> {\n if (this._initialized) {\n return;\n }\n\n TreeWidget._initialized = true;\n TreeWidget._i18n = i18n ?? IModelApp.localization;\n TreeWidget._dispose = registerRenderers();\n return TreeWidget._i18n.registerNamespace(TreeWidget.i18nNamespace);\n }\n\n /** Unregisters the TreeWidget internationalization service namespace */\n public static terminate() {\n if (TreeWidget._i18n) {\n TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace);\n TreeWidget._i18n = undefined;\n }\n\n if (TreeWidget._dispose) {\n TreeWidget._dispose();\n TreeWidget._dispose = undefined;\n }\n\n TreeWidget._initialized = false;\n }\n\n /** The internationalization service created by the IModelApp. */\n public static get i18n(): Localization {\n if (!TreeWidget._i18n) {\n throw new BentleyError(BentleyStatus.ERROR, \"TreeWidget not initialized\");\n }\n return TreeWidget._i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"TreeWidget\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(key: string | string[], options?: LocalizationOptions): string {\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(stringKey, options);\n }\n}\n"]}
1
+ {"version":3,"file":"TreeWidget.js","sourceRoot":"","sources":["../../src/TreeWidget.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,oDAAiE;AACjE,wDAAiD;AAIjD;;;GAGG;AACH,MAAa,UAAU;IAIrB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAmB;QAChD,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,OAAO;SACR;QAED,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,KAAK,GAAG,IAAI,IAAI,yBAAS,CAAC,YAAY,CAAC;QAClD,OAAO,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC;IAED,wEAAwE;IACjE,MAAM,CAAC,SAAS;QACrB,IAAI,UAAU,CAAC,KAAK,EAAE;YACpB,UAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YAC/D,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC;SAC9B;QAED,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,iEAAiE;IAC1D,MAAM,KAAK,IAAI;QACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;YACrB,MAAM,IAAI,0BAAY,CAAC,2BAAa,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;SAC3E;QACD,OAAO,UAAU,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,aAAa;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;OACG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB,EAAE,OAA4B;QAC1E,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,aAAa,IAAI,GAAG,EAAE,CAAC;QACvD,OAAO,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AA/CD,gCA+CC","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 { BentleyError, BentleyStatus } from \"@itwin/core-common\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\nimport type { Localization, TranslationOptions } from \"@itwin/core-common\";\n\n/**\n * Entry point for static initialization required by various components used in the package.\n * @public\n */\nexport class TreeWidget {\n private static _i18n?: Localization;\n private static _initialized?: boolean;\n\n /**\n * Called by IModelApp to initialize the Tree Widget\n * @param i18n - The internationalization service created by the IModelApp.\n */\n public static async initialize(i18n?: Localization): Promise<void> {\n if (this._initialized) {\n return;\n }\n\n TreeWidget._initialized = true;\n TreeWidget._i18n = i18n ?? IModelApp.localization;\n return TreeWidget._i18n.registerNamespace(TreeWidget.i18nNamespace);\n }\n\n /** Unregisters the TreeWidget internationalization service namespace */\n public static terminate() {\n if (TreeWidget._i18n) {\n TreeWidget._i18n.unregisterNamespace(TreeWidget.i18nNamespace);\n TreeWidget._i18n = undefined;\n }\n\n TreeWidget._initialized = false;\n }\n\n /** The internationalization service created by the IModelApp. */\n public static get i18n(): Localization {\n if (!TreeWidget._i18n) {\n throw new BentleyError(BentleyStatus.ERROR, \"TreeWidget not initialized\");\n }\n return TreeWidget._i18n;\n }\n\n /** The internationalization service namespace. */\n public static get i18nNamespace(): string {\n return \"TreeWidget\";\n }\n\n /** Calls i18n.translateWithNamespace with the \"TreeWidget\" namespace. Do NOT include the namespace in the key.\n */\n public static translate(key: string | string[], options?: TranslationOptions): string {\n const stringKey = `${TreeWidget.i18nNamespace}:${key}`;\n return TreeWidget.i18n.getLocalizedString(stringKey, options);\n }\n}\n"]}
@@ -1,17 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import "./SelectableTree.scss";
3
3
  import type { IModelConnection } from "@itwin/core-frontend";
4
- /**
5
- * Props for rendering trees
6
- * @public
7
- */
4
+ /** Props for rendering trees */
8
5
  export interface TreeRenderProps {
9
6
  density?: "enlarged" | "default";
10
7
  onPerformanceMeasured?: (featureId: string, elapsedTime: number) => void;
11
8
  onFeatureUsed?: (feature: string) => void;
12
9
  }
13
10
  /**
14
- * Definition of a tree component displayed in [[SelectableTree]]
11
+ * Definition of a tree component displayed in `SelectableTree`.
15
12
  * @public
16
13
  */
17
14
  export interface TreeDefinition {
@@ -29,10 +26,7 @@ export interface TreeDefinition {
29
26
  /** Icon to render before tree label in tree selector */
30
27
  startIcon?: React.ReactNode;
31
28
  }
32
- /**
33
- * Props for [[SelectableTree]]
34
- * @public
35
- */
29
+ /** Props for `SelectableTree` */
36
30
  export interface SelectableTreeProps {
37
31
  trees: TreeDefinition[];
38
32
  density?: "enlarged" | "default";
@@ -81,7 +81,7 @@ function getTreeSelectorProps(trees) {
81
81
  {
82
82
  id: "no-trees",
83
83
  label: "",
84
- render: () => (0, jsx_runtime_1.jsx)(core_react_1.FillCentered, { children: TreeWidget_1.TreeWidget.translate("noTrees") }),
84
+ render: () => (0, jsx_runtime_1.jsx)(core_react_1.FillCentered, { children: TreeWidget_1.TreeWidget.translate("selectableTree.noTrees") }),
85
85
  },
86
86
  ],
87
87
  };