@itwin/tree-widget-react 4.0.0-alpha.2 → 4.0.0-alpha.20

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 (309) hide show
  1. package/CHANGELOG.md +281 -1
  2. package/README.md +190 -63
  3. package/lib/esm/tree-widget-react/TreeWidget.d.ts +7 -4
  4. package/lib/esm/tree-widget-react/TreeWidget.js +32 -12
  5. package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
  6. package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.d.ts +7 -1
  7. package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js +22 -23
  8. package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js.map +1 -1
  9. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +4 -3
  10. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
  11. package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +4 -3
  12. package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js.map +1 -1
  13. package/lib/esm/tree-widget-react/components/tree-header/SearchBox.d.ts +1 -1
  14. package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +6 -6
  15. package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
  16. package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +3 -2
  17. package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.d.ts +4 -4
  18. package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.js +1 -1
  19. package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.js.map +1 -1
  20. package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.css +1 -0
  21. package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.d.ts +12 -5
  22. package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +13 -9
  23. package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js.map +1 -1
  24. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +3 -3
  25. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +3 -2
  26. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  27. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +11 -7
  28. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +64 -14
  29. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  30. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +8 -6
  31. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +4 -4
  32. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  33. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +41 -8
  34. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +700 -125
  35. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  36. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +18 -7
  37. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +124 -83
  38. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  39. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +70 -0
  40. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +504 -0
  41. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -0
  42. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +41 -0
  43. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +50 -0
  44. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -0
  45. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.d.ts +27 -0
  46. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js +136 -0
  47. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js.map +1 -0
  48. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +54 -0
  49. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +291 -0
  50. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -0
  51. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +64 -0
  52. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +94 -0
  53. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -0
  54. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.d.ts +36 -0
  55. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js +219 -0
  56. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js.map +1 -0
  57. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.d.ts +12 -0
  58. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js +19 -0
  59. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js.map +1 -0
  60. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +30 -0
  61. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +47 -0
  62. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -0
  63. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.d.ts +45 -0
  64. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +569 -0
  65. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -0
  66. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +6 -0
  67. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js +33 -0
  68. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -0
  69. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +24 -0
  70. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +115 -0
  71. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -0
  72. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +44 -0
  73. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +61 -0
  74. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -0
  75. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +50 -0
  76. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +364 -0
  77. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -0
  78. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.d.ts +19 -0
  79. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js +32 -0
  80. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js.map +1 -0
  81. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.d.ts +20 -0
  82. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js +53 -0
  83. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js.map +1 -0
  84. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +37 -0
  85. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +177 -0
  86. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -0
  87. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.d.ts +55 -0
  88. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +53 -0
  89. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -0
  90. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.d.ts +32 -0
  91. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js +168 -0
  92. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js.map +1 -0
  93. package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +11 -23
  94. package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +22 -76
  95. package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  96. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +28 -4
  97. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js +73 -2
  98. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +1 -1
  99. package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js +1 -0
  100. package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js.map +1 -1
  101. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.d.ts +186 -0
  102. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +79 -0
  103. package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -0
  104. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +15 -7
  105. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +33 -22
  106. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
  107. package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -0
  108. package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js +2 -1
  109. package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +1 -1
  110. package/lib/esm/tree-widget-react/components/trees/common/Utils.d.ts +45 -23
  111. package/lib/esm/tree-widget-react/components/trees/common/Utils.js +110 -44
  112. package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
  113. package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.d.ts +2 -3
  114. package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js +4 -5
  115. package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js.map +1 -1
  116. package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -0
  117. package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js +1 -0
  118. package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js.map +1 -1
  119. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +25 -0
  120. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.d.ts +27 -0
  121. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js +47 -0
  122. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js.map +1 -0
  123. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -0
  124. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +4 -3
  125. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
  126. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.css +16 -0
  127. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.d.ts +7 -0
  128. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js +19 -0
  129. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js.map +1 -0
  130. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +11 -0
  131. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +9 -12
  132. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +55 -38
  133. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  134. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.css +2 -1
  135. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +24 -8
  136. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +41 -25
  137. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
  138. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +6 -1
  139. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +13 -4
  140. package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
  141. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +6 -5
  142. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js +7 -7
  143. package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
  144. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +5 -5
  145. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +10 -6
  146. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
  147. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +5 -3
  148. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +17 -15
  149. package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
  150. package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.d.ts +74 -0
  151. package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js +207 -0
  152. package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
  153. package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.d.ts +43 -0
  154. package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js +47 -0
  155. package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js.map +1 -0
  156. package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.d.ts +12 -0
  157. package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js +112 -0
  158. package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +1 -0
  159. package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.d.ts → internal/Rxjs.d.ts} +9 -2
  160. package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.js → internal/Rxjs.js} +10 -2
  161. package/lib/esm/tree-widget-react/components/trees/common/internal/Rxjs.js.map +1 -0
  162. package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.d.ts → internal/Tooltip.d.ts} +4 -8
  163. package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js +18 -0
  164. package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js.map +1 -0
  165. package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +14 -0
  166. package/lib/esm/tree-widget-react/components/{tree-header/SearchBox.css → trees/common/internal/Types.js} +2 -4
  167. package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -0
  168. package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.d.ts +6 -0
  169. package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.js +24 -0
  170. package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.js.map +1 -0
  171. package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.d.ts → internal/UseHierarchiesLocalization.d.ts} +3 -2
  172. package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.js → internal/UseHierarchiesLocalization.js} +6 -2
  173. package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchiesLocalization.js.map +1 -0
  174. package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.d.ts → internal/UseHierarchyFiltering.d.ts} +1 -1
  175. package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.js → internal/UseHierarchyFiltering.js} +5 -4
  176. package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchyFiltering.js.map +1 -0
  177. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +17 -0
  178. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +32 -0
  179. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js.map +1 -0
  180. package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.d.ts → internal/UseIModelChangeListener.d.ts} +1 -0
  181. package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.js → internal/UseIModelChangeListener.js} +1 -0
  182. package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelChangeListener.js.map +1 -0
  183. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +70 -0
  184. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +172 -0
  185. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
  186. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.d.ts +20 -0
  187. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js +60 -0
  188. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js.map +1 -0
  189. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +39 -0
  190. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +160 -0
  191. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -0
  192. package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.d.ts +3 -0
  193. package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.js +12 -0
  194. package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.js.map +1 -0
  195. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +68 -0
  196. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +170 -0
  197. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -0
  198. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +20 -0
  199. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +46 -0
  200. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -0
  201. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.d.ts +91 -0
  202. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js +112 -0
  203. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js.map +1 -0
  204. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +236 -0
  205. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +600 -0
  206. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -0
  207. package/lib/esm/tree-widget-react/components/trees/common/useGuid.d.ts +2 -0
  208. package/lib/esm/tree-widget-react/components/trees/common/useGuid.js +11 -0
  209. package/lib/esm/tree-widget-react/components/trees/common/useGuid.js.map +1 -0
  210. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +7 -2
  211. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +29 -20
  212. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  213. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +2 -6
  214. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +2 -2
  215. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  216. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +5 -6
  217. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +36 -21
  218. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
  219. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +9 -2
  220. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +48 -36
  221. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  222. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +2 -6
  223. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js +2 -2
  224. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  225. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +13 -4
  226. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +80 -74
  227. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  228. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +7 -10
  229. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +45 -36
  230. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  231. package/lib/esm/tree-widget-react/components/trees/index.d.ts +16 -5
  232. package/lib/esm/tree-widget-react/components/trees/index.js +16 -4
  233. package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
  234. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +3 -3
  235. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +3 -2
  236. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  237. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +3 -3
  238. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +34 -24
  239. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  240. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +14 -7
  241. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +11 -7
  242. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  243. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +24 -20
  244. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +193 -154
  245. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  246. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +60 -10
  247. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +97 -238
  248. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  249. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +22 -25
  250. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +280 -298
  251. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  252. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +1 -1
  253. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
  254. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.d.ts +41 -0
  255. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js +253 -0
  256. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js.map +1 -0
  257. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.d.ts +27 -0
  258. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js +148 -0
  259. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js.map +1 -0
  260. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +76 -0
  261. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +269 -0
  262. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -0
  263. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +53 -0
  264. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +71 -0
  265. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -0
  266. package/lib/esm/tree-widget-react-internal.d.ts +12 -0
  267. package/lib/esm/tree-widget-react-internal.js +18 -0
  268. package/lib/esm/tree-widget-react-internal.js.map +1 -0
  269. package/lib/public/locales/en/TreeWidget.json +41 -54
  270. package/package.json +76 -79
  271. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +0 -28
  272. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js +0 -87
  273. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
  274. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.d.ts +0 -7
  275. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js +0 -66
  276. package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js.map +0 -1
  277. package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
  278. package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js +0 -24
  279. package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
  280. package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.d.ts +0 -7
  281. package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js +0 -21
  282. package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
  283. package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
  284. package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js +0 -24
  285. package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
  286. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
  287. package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
  288. package/lib/esm/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
  289. package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +0 -20
  290. package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js +0 -127
  291. package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +0 -1
  292. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.d.ts +0 -7
  293. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js +0 -12
  294. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js.map +0 -1
  295. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
  296. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +0 -21
  297. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
  298. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
  299. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +0 -138
  300. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
  301. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +0 -25
  302. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +0 -173
  303. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +0 -1
  304. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +0 -106
  305. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +0 -663
  306. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +0 -1
  307. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
  308. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js +0 -48
  309. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
@@ -1,33 +1,49 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /*---------------------------------------------------------------------------------------------
2
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
5
  *--------------------------------------------------------------------------------------------*/
5
6
  import "./TreeNodeVisibilityButton.css";
6
- const visibilityShowIcon = new URL("@itwin/itwinui-icons/visibility-show.svg", import.meta.url).href;
7
- const visibilityHideIcon = new URL("@itwin/itwinui-icons/visibility-hide.svg", import.meta.url).href;
8
- const visibilityPartialIcon = new URL("@itwin/itwinui-icons/visibility-partial.svg", import.meta.url).href;
9
- /** @internal */
10
- export function createVisibilityAction({ getVisibilityButtonState, onVisibilityButtonClick, }) {
11
- return (node) => {
12
- const state = getVisibilityButtonState(node);
13
- const getIcon = () => {
14
- switch (state.state) {
15
- case "visible":
16
- return visibilityShowIcon;
17
- case "hidden":
18
- return visibilityHideIcon;
19
- case "partial":
20
- return visibilityPartialIcon;
21
- }
22
- };
23
- return {
24
- label: state.tooltip ?? "Determining visibility...",
25
- action: () => {
26
- onVisibilityButtonClick(node, state.state);
27
- },
28
- show: state.state !== "visible" ? true : undefined,
29
- icon: getIcon(),
30
- };
7
+ import { createContext, memo, useContext, useMemo } from "react";
8
+ import { TreeActionBase } from "@itwin/presentation-hierarchies-react";
9
+ import visibilityHideSvg from "@stratakit/icons/visibility-hide.svg";
10
+ import visibilityPartialSvg from "@stratakit/icons/visibility-partial.svg";
11
+ import visibilityShowSvg from "@stratakit/icons/visibility-show.svg";
12
+ import { TreeWidget } from "../../../../TreeWidget.js";
13
+ import { createTooltip } from "../internal/Tooltip.js";
14
+ /**
15
+ * React component that renders a visibility action for a tree item.
16
+ * Should be used with `VisibilityTreeRenderer`.
17
+ * @beta
18
+ */
19
+ export const VisibilityAction = memo(function VisibilityAction({ node, ...actionAttributes }) {
20
+ const context = useVisibilityContext();
21
+ const state = context?.getVisibilityButtonState(node);
22
+ if (!context || !state || ("isDisabled" in state && state.isDisabled) || "isLoading" in state) {
23
+ return (_jsx(TreeActionBase, { ...actionAttributes, label: TreeWidget.translate(`visibilityTooltips.status.disabled`), visible: false, icon: visibilityShowSvg, hide: true }));
24
+ }
25
+ const getIcon = () => {
26
+ switch (state.state) {
27
+ case "visible":
28
+ return visibilityShowSvg;
29
+ case "hidden":
30
+ return visibilityHideSvg;
31
+ case "partial":
32
+ return visibilityPartialSvg;
33
+ }
31
34
  };
35
+ return (_jsx(TreeActionBase, { ...actionAttributes, label: state.tooltip ?? createTooltip(state.state), onClick: () => context.onVisibilityButtonClick(node, state.state), visible: state.state !== "visible" ? true : undefined, icon: getIcon() }));
36
+ });
37
+ const visibilityContext = createContext(undefined);
38
+ /** @internal */
39
+ export const useVisibilityContext = () => {
40
+ return useContext(visibilityContext);
41
+ };
42
+ /** @internal */
43
+ export function VisibilityContextProvider({ onVisibilityButtonClick, getVisibilityButtonState, children }) {
44
+ return (_jsx(visibilityContext.Provider, { value: useMemo(() => ({
45
+ onVisibilityButtonClick,
46
+ getVisibilityButtonState,
47
+ }), [getVisibilityButtonState, onVisibilityButtonClick]), children: children }));
32
48
  }
33
49
  //# sourceMappingURL=TreeNodeVisibilityButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeVisibilityButton.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;AAIxC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACrG,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACrG,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAoB3G,gBAAgB;AAChB,MAAM,UAAU,sBAAsB,CAAC,EACrC,wBAAwB,EACxB,uBAAuB,GACO;IAC9B,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,QAAQ,KAAK,CAAC,KAAK,EAAE;gBACnB,KAAK,SAAS;oBACZ,OAAO,kBAAkB,CAAC;gBAC5B,KAAK,QAAQ;oBACX,OAAO,kBAAkB,CAAC;gBAC5B,KAAK,SAAS;oBACZ,OAAO,qBAAqB,CAAC;aAChC;QACH,CAAC,CAAC;QACF,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;YACnD,MAAM,EAAE,GAAG,EAAE;gBACX,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YAClD,IAAI,EAAE,OAAO,EAAE;SAChB,CAAC;IACJ,CAAC,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 \"./TreeNodeVisibilityButton.css\";\n\nimport type { PresentationHierarchyNode, TreeItemAction } from \"@itwin/presentation-hierarchies-react\";\n\nconst visibilityShowIcon = new URL(\"@itwin/itwinui-icons/visibility-show.svg\", import.meta.url).href;\nconst visibilityHideIcon = new URL(\"@itwin/itwinui-icons/visibility-hide.svg\", import.meta.url).href;\nconst visibilityPartialIcon = new URL(\"@itwin/itwinui-icons/visibility-partial.svg\", import.meta.url).href;\n\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\ninterface TreeItemVisibilityButtonState {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @beta */\nexport interface TreeItemVisibilityButtonProps {\n /** Callback that should be invoked when checkbox is clicked. */\n onVisibilityButtonClick: (node: PresentationHierarchyNode, state: TreeItemVisibilityButtonState[\"state\"]) => void;\n /** Callback that should be used to determine current checkbox state. */\n getVisibilityButtonState: (node: PresentationHierarchyNode) => TreeItemVisibilityButtonState;\n}\n\n/** @internal */\nexport function createVisibilityAction({\n getVisibilityButtonState,\n onVisibilityButtonClick,\n}: TreeItemVisibilityButtonProps): (node: PresentationHierarchyNode) => TreeItemAction {\n return (node) => {\n const state = getVisibilityButtonState(node);\n\n const getIcon = () => {\n switch (state.state) {\n case \"visible\":\n return visibilityShowIcon;\n case \"hidden\":\n return visibilityHideIcon;\n case \"partial\":\n return visibilityPartialIcon;\n }\n };\n return {\n label: state.tooltip ?? \"Determining visibility...\",\n action: () => {\n onVisibilityButtonClick(node, state.state);\n },\n show: state.state !== \"visible\" ? true : undefined,\n icon: getIcon(),\n };\n };\n}\n"]}
1
+ {"version":3,"file":"TreeNodeVisibilityButton.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAC3E,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAuBvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,gBAAgB,CAAC,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAkE;IAC1J,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,OAAO,EAAE,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAEtD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,IAAI,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,WAAW,IAAI,KAAK,EAAE,CAAC;QAC9F,OAAO,CACL,KAAC,cAAc,OACT,gBAAgB,EACpB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,oCAAoC,CAAC,EACjE,OAAO,EAAE,KAAK,EACd,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,IAAI,GACV,CACH,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;YACpB,KAAK,SAAS;gBACZ,OAAO,iBAAiB,CAAC;YAC3B,KAAK,QAAQ;gBACX,OAAO,iBAAiB,CAAC;YAC3B,KAAK,SAAS;gBACZ,OAAO,oBAAoB,CAAC;QAChC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,cAAc,OACT,gBAAgB,EACpB,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,EAClD,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,EACjE,OAAO,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACrD,IAAI,EAAE,OAAO,EAAE,GACf,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAUH,MAAM,iBAAiB,GAAG,aAAa,CAAgC,SAAS,CAAC,CAAC;AAElF,gBAAgB;AAChB,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,gBAAgB;AAChB,MAAM,UAAU,yBAAyB,CAAC,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,QAAQ,EAAwC;IAC7I,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;YACL,uBAAuB;YACvB,wBAAwB;SACzB,CAAC,EACF,CAAC,wBAAwB,EAAE,uBAAuB,CAAC,CACpD,YAEA,QAAQ,GACkB,CAC9B,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 \"./TreeNodeVisibilityButton.css\";\n\nimport { createContext, memo, useContext, useMemo } from \"react\";\nimport { TreeActionBase } from \"@itwin/presentation-hierarchies-react\";\nimport visibilityHideSvg from \"@stratakit/icons/visibility-hide.svg\";\nimport visibilityPartialSvg from \"@stratakit/icons/visibility-partial.svg\";\nimport visibilityShowSvg from \"@stratakit/icons/visibility-show.svg\";\nimport { TreeWidget } from \"../../../../TreeWidget.js\";\nimport { createTooltip } from \"../internal/Tooltip.js\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { PresentationHierarchyNode, TreeActionBaseAttributes } from \"@itwin/presentation-hierarchies-react\";\n\n/** @beta */\ninterface LoadedTreeItemVisibilityButtonState {\n state: \"visible\" | \"hidden\" | \"partial\";\n isDisabled?: boolean;\n}\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\nexport type TreeItemVisibilityButtonState = (\n | LoadedTreeItemVisibilityButtonState\n | {\n isLoading: true;\n }\n) & {\n tooltip?: string;\n};\n\n/**\n * React component that renders a visibility action for a tree item.\n * Should be used with `VisibilityTreeRenderer`.\n * @beta\n */\nexport const VisibilityAction = memo(function VisibilityAction({ node, ...actionAttributes }: { node: PresentationHierarchyNode } & TreeActionBaseAttributes) {\n const context = useVisibilityContext();\n const state = context?.getVisibilityButtonState(node);\n\n if (!context || !state || (\"isDisabled\" in state && state.isDisabled) || \"isLoading\" in state) {\n return (\n <TreeActionBase\n {...actionAttributes}\n label={TreeWidget.translate(`visibilityTooltips.status.disabled`)}\n visible={false}\n icon={visibilityShowSvg}\n hide={true}\n />\n );\n }\n\n const getIcon = () => {\n switch (state.state) {\n case \"visible\":\n return visibilityShowSvg;\n case \"hidden\":\n return visibilityHideSvg;\n case \"partial\":\n return visibilityPartialSvg;\n }\n };\n\n return (\n <TreeActionBase\n {...actionAttributes}\n label={state.tooltip ?? createTooltip(state.state)}\n onClick={() => context.onVisibilityButtonClick(node, state.state)}\n visible={state.state !== \"visible\" ? true : undefined}\n icon={getIcon()}\n />\n );\n});\n\n/** @beta */\nexport interface VisibilityContext {\n /** Callback that should be invoked when checkbox is clicked. */\n onVisibilityButtonClick: (node: PresentationHierarchyNode, state: LoadedTreeItemVisibilityButtonState[\"state\"]) => void;\n /** Callback that should be used to determine current checkbox state. */\n getVisibilityButtonState: (node: PresentationHierarchyNode) => TreeItemVisibilityButtonState;\n}\n\nconst visibilityContext = createContext<VisibilityContext | undefined>(undefined);\n\n/** @internal */\nexport const useVisibilityContext = () => {\n return useContext(visibilityContext);\n};\n\n/** @internal */\nexport function VisibilityContextProvider({ onVisibilityButtonClick, getVisibilityButtonState, children }: PropsWithChildren<VisibilityContext>) {\n return (\n <visibilityContext.Provider\n value={useMemo(\n () => ({\n onVisibilityButtonClick,\n getVisibilityButtonState,\n }),\n [getVisibilityButtonState, onVisibilityButtonClick],\n )}\n >\n {children}\n </visibilityContext.Provider>\n );\n}\n"]}
@@ -1,7 +1,12 @@
1
1
  import type { BaseTreeRendererProps } from "./BaseTreeRenderer.js";
2
+ /** @beta */
3
+ type TreeRendererProps = Omit<BaseTreeRendererProps, "getInlineActions" | "getMenuActions" | "getContextMenuActions" | "getDecorations"> & {
4
+ [Property in keyof Pick<BaseTreeRendererProps, "getInlineActions" | "getMenuActions" | "getContextMenuActions" | "getDecorations">]?: (args: Parameters<NonNullable<BaseTreeRendererProps[Property]>>[0], treeRendererProps: TreeRendererProps) => ReturnType<NonNullable<BaseTreeRendererProps[Property]>>;
5
+ };
2
6
  /**
3
7
  * Default renderer for rendering tree data.
4
8
  * @beta
5
9
  */
6
- export declare function TreeRenderer({ actions, ...props }: BaseTreeRendererProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function TreeRenderer(props: TreeRendererProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
7
12
  //# sourceMappingURL=TreeRenderer.d.ts.map
@@ -3,14 +3,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- /* eslint-disable @itwin/no-internal */
7
- import { createFilterAction } from "@itwin/presentation-hierarchies-react";
6
+ import { useCallback, useMemo } from "react";
7
+ import { FilterAction } from "@itwin/presentation-hierarchies-react";
8
8
  import { BaseTreeRenderer } from "./BaseTreeRenderer.js";
9
9
  /**
10
10
  * Default renderer for rendering tree data.
11
11
  * @beta
12
12
  */
13
- export function TreeRenderer({ actions, ...props }) {
14
- return (_jsx(BaseTreeRenderer, { ...props, actions: [createFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails }), ...(actions ? actions : [])] }));
13
+ export function TreeRenderer(props) {
14
+ const { getInlineActions, getMenuActions, getContextMenuActions, getDecorations, getHierarchyLevelDetails, onFilterClick, ...restProps } = props;
15
+ const nodeInlineActions = useCallback((actionsProps) => {
16
+ return getInlineActions
17
+ ? getInlineActions(actionsProps, props)
18
+ : [_jsx(FilterAction, { node: actionsProps.targetNode, onFilter: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails }, "Filter")];
19
+ }, [getInlineActions, onFilterClick, getHierarchyLevelDetails, props]);
20
+ const nodeMenuActions = useMemo(() => (getMenuActions ? (actionsProps) => getMenuActions(actionsProps, props) : undefined), [getMenuActions, props]);
21
+ const nodeContextMenuActions = useMemo(() => (getContextMenuActions ? (actionsProps) => getContextMenuActions(actionsProps, props) : undefined), [getContextMenuActions, props]);
22
+ const nodeDecorations = useMemo(() => (getDecorations ? (node) => getDecorations(node, props) : undefined), [getDecorations, props]);
23
+ return (_jsx(BaseTreeRenderer, { ...restProps, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails, getInlineActions: nodeInlineActions, getMenuActions: nodeMenuActions, getContextMenuActions: nodeContextMenuActions, getDecorations: nodeDecorations }));
15
24
  }
16
25
  //# sourceMappingURL=TreeRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,uCAAuC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAyB;IACvE,OAAO,CACL,KAAC,gBAAgB,OACX,KAAK,EACT,OAAO,EAAE,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,wBAAwB,EAAE,KAAK,CAAC,wBAAwB,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACvJ,CACH,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/* eslint-disable @itwin/no-internal */\n\nimport { createFilterAction } from \"@itwin/presentation-hierarchies-react\";\nimport { BaseTreeRenderer } from \"./BaseTreeRenderer.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\n\n/**\n * Default renderer for rendering tree data.\n * @beta\n */\nexport function TreeRenderer({ actions, ...props }: BaseTreeRendererProps) {\n return (\n <BaseTreeRenderer\n {...props}\n actions={[createFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails }), ...(actions ? actions : [])]}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"TreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAYzD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,qBAAqB,EAAE,cAAc,EAAE,wBAAwB,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAEjJ,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,YAAY,EAAE,EAAE;QACf,OAAO,gBAAgB;YACrB,CAAC,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,CAAC;YACvC,CAAC,CAAC,CAAC,KAAC,YAAY,IAAgB,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,wBAAwB,EAAE,wBAAwB,IAApH,QAAQ,CAAgH,CAAC,CAAC;IACpJ,CAAC,EACD,CAAC,gBAAgB,EAAE,aAAa,EAAE,wBAAwB,EAAE,KAAK,CAAC,CACnE,CAAC;IACF,MAAM,eAAe,GAAG,OAAO,CAC7B,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC1F,CAAC,cAAc,EAAE,KAAK,CAAC,CACxB,CAAC;IACF,MAAM,sBAAsB,GAAG,OAAO,CACpC,GAAG,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EACxG,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAC/B,CAAC;IACF,MAAM,eAAe,GAAG,OAAO,CAC7B,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC1E,CAAC,cAAc,EAAE,KAAK,CAAC,CACxB,CAAC;IAEF,OAAO,CACL,KAAC,gBAAgB,OACX,SAAS,EACb,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,iBAAiB,EACnC,cAAc,EAAE,eAAe,EAC/B,qBAAqB,EAAE,sBAAsB,EAC7C,cAAc,EAAE,eAAe,GAC/B,CACH,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 { useCallback, useMemo } from \"react\";\nimport { FilterAction } from \"@itwin/presentation-hierarchies-react\";\nimport { BaseTreeRenderer } from \"./BaseTreeRenderer.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\n\n/** @beta */\ntype TreeRendererProps = Omit<BaseTreeRendererProps, \"getInlineActions\" | \"getMenuActions\" | \"getContextMenuActions\" | \"getDecorations\"> & {\n [Property in keyof Pick<BaseTreeRendererProps, \"getInlineActions\" | \"getMenuActions\" | \"getContextMenuActions\" | \"getDecorations\">]?: (\n args: Parameters<NonNullable<BaseTreeRendererProps[Property]>>[0],\n treeRendererProps: TreeRendererProps,\n ) => ReturnType<NonNullable<BaseTreeRendererProps[Property]>>;\n};\n\n/**\n * Default renderer for rendering tree data.\n * @beta\n */\nexport function TreeRenderer(props: TreeRendererProps) {\n const { getInlineActions, getMenuActions, getContextMenuActions, getDecorations, getHierarchyLevelDetails, onFilterClick, ...restProps } = props;\n\n const nodeInlineActions = useCallback<Required<BaseTreeRendererProps>[\"getInlineActions\"]>(\n (actionsProps) => {\n return getInlineActions\n ? getInlineActions(actionsProps, props)\n : [<FilterAction key={\"Filter\"} node={actionsProps.targetNode} onFilter={onFilterClick} getHierarchyLevelDetails={getHierarchyLevelDetails} />];\n },\n [getInlineActions, onFilterClick, getHierarchyLevelDetails, props],\n );\n const nodeMenuActions = useMemo<BaseTreeRendererProps[\"getMenuActions\"]>(\n () => (getMenuActions ? (actionsProps) => getMenuActions(actionsProps, props) : undefined),\n [getMenuActions, props],\n );\n const nodeContextMenuActions = useMemo<BaseTreeRendererProps[\"getContextMenuActions\"]>(\n () => (getContextMenuActions ? (actionsProps) => getContextMenuActions(actionsProps, props) : undefined),\n [getContextMenuActions, props],\n );\n const nodeDecorations = useMemo<BaseTreeRendererProps[\"getDecorations\"]>(\n () => (getDecorations ? (node) => getDecorations(node, props) : undefined),\n [getDecorations, props],\n );\n\n return (\n <BaseTreeRenderer\n {...restProps}\n onFilterClick={onFilterClick}\n getHierarchyLevelDetails={getHierarchyLevelDetails}\n getInlineActions={nodeInlineActions}\n getMenuActions={nodeMenuActions}\n getContextMenuActions={nodeContextMenuActions}\n getDecorations={nodeDecorations}\n />\n );\n}\n"]}
@@ -1,13 +1,14 @@
1
- import type { PresentationTreeNode } from "@itwin/presentation-hierarchies-react";
2
- import type { TreeItemVisibilityButtonProps } from "./TreeNodeVisibilityButton.js";
1
+ import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
2
+ import type { VisibilityContext } from "./TreeNodeVisibilityButton.js";
3
3
  interface UseVisibilityButtonHandlerProps {
4
- rootNodes: PresentationTreeNode[] | undefined;
4
+ rootNodes: PresentationHierarchyNode[] | undefined;
5
5
  isNodeSelected?: (nodeId: string) => boolean;
6
- onClick: TreeItemVisibilityButtonProps["onVisibilityButtonClick"];
6
+ onClick: VisibilityContext["onVisibilityButtonClick"];
7
7
  }
8
8
  interface UseVisibilityButtonHandlerResult {
9
- onVisibilityButtonClick: TreeItemVisibilityButtonProps["onVisibilityButtonClick"];
9
+ onVisibilityButtonClick: VisibilityContext["onVisibilityButtonClick"];
10
10
  }
11
+ /** @internal */
11
12
  export declare function useVisibilityButtonHandler({ rootNodes, isNodeSelected, onClick }: UseVisibilityButtonHandlerProps): UseVisibilityButtonHandlerResult;
12
13
  export {};
13
14
  //# sourceMappingURL=UseVisibilityButtonHandler.d.ts.map
@@ -3,22 +3,22 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { useCallback } from "react";
6
- import { isPresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
6
+ import { useLatest } from "../internal/Utils.js";
7
+ /** @internal */
7
8
  export function useVisibilityButtonHandler({ rootNodes, isNodeSelected, onClick }) {
9
+ const isNodeSelectedRef = useLatest(isNodeSelected);
10
+ const rootNodesRef = useLatest(rootNodes);
8
11
  const onVisibilityButtonClick = useCallback((clickedNode, state) => {
9
- if (!isNodeSelected?.(clickedNode.id)) {
12
+ if (!isNodeSelectedRef.current?.(clickedNode.id)) {
10
13
  onClick(clickedNode, state);
11
14
  return;
12
15
  }
13
- rootNodes && forEachSelectedNode(rootNodes, isNodeSelected, (node) => onClick(node, state));
14
- }, [rootNodes, isNodeSelected, onClick]);
16
+ rootNodesRef.current && forEachSelectedNode(rootNodesRef.current, isNodeSelectedRef.current, (node) => onClick(node, state));
17
+ }, [onClick, isNodeSelectedRef, rootNodesRef]);
15
18
  return { onVisibilityButtonClick };
16
19
  }
17
20
  function forEachSelectedNode(nodes, isNodeSelected, callback) {
18
21
  nodes.forEach((node) => {
19
- if (!isPresentationHierarchyNode(node)) {
20
- return;
21
- }
22
22
  if (isNodeSelected(node.id)) {
23
23
  callback(node);
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UseVisibilityButtonHandler.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAepF,MAAM,UAAU,0BAA0B,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAmC;IAChH,MAAM,uBAAuB,GAAG,WAAW,CACzC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;YACrC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAC5B,OAAO;SACR;QACD,SAAS,IAAI,mBAAmB,CAAC,SAAS,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9F,CAAC,EACD,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CACrC,CAAC;IAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAkC,EAClC,cAA2C,EAC3C,QAAmD;IAEnD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,EAAE;YACtC,OAAO;SACR;QACD,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC3B,QAAQ,CAAC,IAAI,CAAC,CAAC;SAChB;QACD,IAAI,IAAI,CAAC,UAAU,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;YACzD,mBAAmB,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;SAC9D;IACH,CAAC,CAAC,CAAC;AACL,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 } from \"react\";\nimport { isPresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\nimport type { PresentationHierarchyNode, PresentationTreeNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { TreeItemVisibilityButtonProps } from \"./TreeNodeVisibilityButton.js\";\n\ninterface UseVisibilityButtonHandlerProps {\n rootNodes: PresentationTreeNode[] | undefined;\n isNodeSelected?: (nodeId: string) => boolean;\n onClick: TreeItemVisibilityButtonProps[\"onVisibilityButtonClick\"];\n}\n\ninterface UseVisibilityButtonHandlerResult {\n onVisibilityButtonClick: TreeItemVisibilityButtonProps[\"onVisibilityButtonClick\"];\n}\n\nexport function useVisibilityButtonHandler({ rootNodes, isNodeSelected, onClick }: UseVisibilityButtonHandlerProps): UseVisibilityButtonHandlerResult {\n const onVisibilityButtonClick = useCallback<TreeItemVisibilityButtonProps[\"onVisibilityButtonClick\"]>(\n (clickedNode, state) => {\n if (!isNodeSelected?.(clickedNode.id)) {\n onClick(clickedNode, state);\n return;\n }\n rootNodes && forEachSelectedNode(rootNodes, isNodeSelected, (node) => onClick(node, state));\n },\n [rootNodes, isNodeSelected, onClick],\n );\n\n return { onVisibilityButtonClick };\n}\n\nfunction forEachSelectedNode(\n nodes: Array<PresentationTreeNode>,\n isNodeSelected: (nodeId: string) => boolean,\n callback: (node: PresentationHierarchyNode) => void,\n) {\n nodes.forEach((node) => {\n if (!isPresentationHierarchyNode(node)) {\n return;\n }\n if (isNodeSelected(node.id)) {\n callback(node);\n }\n if (node.isExpanded && typeof node.children !== \"boolean\") {\n forEachSelectedNode(node.children, isNodeSelected, callback);\n }\n });\n}\n"]}
1
+ {"version":3,"file":"UseVisibilityButtonHandler.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAejD,gBAAgB;AAChB,MAAM,UAAU,0BAA0B,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAmC;IAChH,MAAM,iBAAiB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IAE1C,MAAM,uBAAuB,GAAG,WAAW,CACzC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;YACjD,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAC5B,OAAO;QACT,CAAC;QACD,YAAY,CAAC,OAAO,IAAI,mBAAmB,CAAC,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/H,CAAC,EACD,CAAC,OAAO,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAC3C,CAAC;IAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,mBAAmB,CAC1B,KAAuC,EACvC,cAA2C,EAC3C,QAAmD;IAEnD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAC5B,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC1D,mBAAmB,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,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 } from \"react\";\nimport { useLatest } from \"../internal/Utils.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { VisibilityContext } from \"./TreeNodeVisibilityButton.js\";\n\ninterface UseVisibilityButtonHandlerProps {\n rootNodes: PresentationHierarchyNode[] | undefined;\n isNodeSelected?: (nodeId: string) => boolean;\n onClick: VisibilityContext[\"onVisibilityButtonClick\"];\n}\n\ninterface UseVisibilityButtonHandlerResult {\n onVisibilityButtonClick: VisibilityContext[\"onVisibilityButtonClick\"];\n}\n\n/** @internal */\nexport function useVisibilityButtonHandler({ rootNodes, isNodeSelected, onClick }: UseVisibilityButtonHandlerProps): UseVisibilityButtonHandlerResult {\n const isNodeSelectedRef = useLatest(isNodeSelected);\n const rootNodesRef = useLatest(rootNodes);\n\n const onVisibilityButtonClick = useCallback<VisibilityContext[\"onVisibilityButtonClick\"]>(\n (clickedNode, state) => {\n if (!isNodeSelectedRef.current?.(clickedNode.id)) {\n onClick(clickedNode, state);\n return;\n }\n rootNodesRef.current && forEachSelectedNode(rootNodesRef.current, isNodeSelectedRef.current, (node) => onClick(node, state));\n },\n [onClick, isNodeSelectedRef, rootNodesRef],\n );\n\n return { onVisibilityButtonClick };\n}\n\nfunction forEachSelectedNode(\n nodes: Array<PresentationHierarchyNode>,\n isNodeSelected: (nodeId: string) => boolean,\n callback: (node: PresentationHierarchyNode) => void,\n) {\n nodes.forEach((node) => {\n if (isNodeSelected(node.id)) {\n callback(node);\n }\n if (node.isExpanded && typeof node.children !== \"boolean\") {\n forEachSelectedNode(node.children, isNodeSelected, callback);\n }\n });\n}\n"]}
@@ -1,9 +1,9 @@
1
- import type { FunctionProps } from "../Utils.js";
2
- import type { TreeProps } from "./Tree.js";
3
1
  import type { ReactNode } from "react";
4
- import type { VisibilityTreeRendererProps } from "./VisibilityTreeRenderer.js";
5
2
  import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
6
3
  import type { HierarchyVisibilityHandler } from "../UseHierarchyVisibility.js";
4
+ import type { FunctionProps } from "../Utils.js";
5
+ import type { TreeProps } from "./Tree.js";
6
+ import type { VisibilityContext } from "./TreeNodeVisibilityButton.js";
7
7
  /** @beta */
8
8
  export type VisibilityTreeProps = Omit<TreeProps, "treeRenderer" | "imodelAccess"> & {
9
9
  /** Callback for creating visibility handler used to control visibility of instances represented by tree nodes. */
@@ -11,11 +11,11 @@ export type VisibilityTreeProps = Omit<TreeProps, "treeRenderer" | "imodelAccess
11
11
  imodelAccess: ECClassHierarchyInspector;
12
12
  }) => HierarchyVisibilityHandler;
13
13
  /** Tree renderer that should be used to render tree data. */
14
- treeRenderer: (treeProps: FunctionProps<TreeProps["treeRenderer"]> & Pick<VisibilityTreeRendererProps, "getVisibilityButtonState" | "onVisibilityButtonClick">) => ReactNode;
14
+ treeRenderer: (treeProps: FunctionProps<TreeProps["treeRenderer"]> & Pick<VisibilityContext, "getVisibilityButtonState" | "onVisibilityButtonClick">) => ReactNode;
15
15
  };
16
16
  /**
17
17
  * Tree component that can control visibility of instances represented by tree nodes.
18
18
  * @beta
19
19
  */
20
- export declare function VisibilityTree({ visibilityHandlerFactory, treeRenderer, ...props }: VisibilityTreeProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function VisibilityTree({ visibilityHandlerFactory, treeRenderer, hierarchyLevelSizeLimit, ...props }: VisibilityTreeProps): import("react/jsx-runtime").JSX.Element;
21
21
  //# sourceMappingURL=VisibilityTree.d.ts.map
@@ -3,20 +3,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- import { useCallback, useMemo } from "react";
6
+ import { useCallback } from "react";
7
+ import { useIModelAccess } from "../internal/UseIModelAccess.js";
7
8
  import { useHierarchyVisibility } from "../UseHierarchyVisibility.js";
8
- import { createIModelAccess } from "../Utils.js";
9
9
  import { Tree } from "./Tree.js";
10
10
  /**
11
11
  * Tree component that can control visibility of instances represented by tree nodes.
12
12
  * @beta
13
13
  */
14
- export function VisibilityTree({ visibilityHandlerFactory, treeRenderer, ...props }) {
15
- const { imodel, getSchemaContext } = props;
16
- const imodelAccess = useMemo(() => createIModelAccess({ imodel, getSchemaContext }), [imodel, getSchemaContext]);
14
+ export function VisibilityTree({ visibilityHandlerFactory, treeRenderer, hierarchyLevelSizeLimit, ...props }) {
15
+ const { imodel, treeName } = props;
16
+ const { imodelAccess, currentHierarchyLevelSizeLimit } = useIModelAccess({
17
+ imodel,
18
+ treeName,
19
+ hierarchyLevelSizeLimit,
20
+ });
17
21
  const { getVisibilityButtonState, onVisibilityButtonClick, triggerRefresh } = useHierarchyVisibility({
18
22
  visibilityHandlerFactory: useCallback(() => visibilityHandlerFactory({ imodelAccess }), [visibilityHandlerFactory, imodelAccess]),
19
23
  });
20
- return (_jsx(Tree, { ...props, onReload: triggerRefresh, imodelAccess: imodelAccess, treeRenderer: (treeProps) => treeRenderer({ ...treeProps, getVisibilityButtonState, onVisibilityButtonClick }) }));
24
+ return (_jsx(Tree, { ...props, onReload: triggerRefresh, imodelAccess: imodelAccess, hierarchyLevelSizeLimit: currentHierarchyLevelSizeLimit, treeRenderer: (treeProps) => treeRenderer({ ...treeProps, getVisibilityButtonState, onVisibilityButtonClick }) }));
21
25
  }
22
26
  //# sourceMappingURL=VisibilityTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisibilityTree.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAmBjC;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,wBAAwB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAuB;IACtG,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACjH,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,cAAc,EAAE,GAAG,sBAAsB,CAAC;QACnG,wBAAwB,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,wBAAwB,EAAE,YAAY,CAAC,CAAC;KAClI,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,IAAI,OACC,KAAK,EACT,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,GAAG,SAAS,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC,GAC9G,CACH,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 { useCallback, useMemo } from \"react\";\nimport { useHierarchyVisibility } from \"../UseHierarchyVisibility.js\";\nimport { createIModelAccess } from \"../Utils.js\";\nimport { Tree } from \"./Tree.js\";\n\nimport type { FunctionProps } from \"../Utils.js\";\nimport type { TreeProps } from \"./Tree.js\";\nimport type { ReactNode } from \"react\";\nimport type { VisibilityTreeRendererProps } from \"./VisibilityTreeRenderer.js\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { HierarchyVisibilityHandler } from \"../UseHierarchyVisibility.js\";\n\n/** @beta */\nexport type VisibilityTreeProps = Omit<TreeProps, \"treeRenderer\" | \"imodelAccess\"> & {\n /** Callback for creating visibility handler used to control visibility of instances represented by tree nodes. */\n visibilityHandlerFactory: (props: { imodelAccess: ECClassHierarchyInspector }) => HierarchyVisibilityHandler;\n /** Tree renderer that should be used to render tree data. */\n treeRenderer: (\n treeProps: FunctionProps<TreeProps[\"treeRenderer\"]> & Pick<VisibilityTreeRendererProps, \"getVisibilityButtonState\" | \"onVisibilityButtonClick\">,\n ) => ReactNode;\n};\n\n/**\n * Tree component that can control visibility of instances represented by tree nodes.\n * @beta\n */\nexport function VisibilityTree({ visibilityHandlerFactory, treeRenderer, ...props }: VisibilityTreeProps) {\n const { imodel, getSchemaContext } = props;\n const imodelAccess = useMemo(() => createIModelAccess({ imodel, getSchemaContext }), [imodel, getSchemaContext]);\n const { getVisibilityButtonState, onVisibilityButtonClick, triggerRefresh } = useHierarchyVisibility({\n visibilityHandlerFactory: useCallback(() => visibilityHandlerFactory({ imodelAccess }), [visibilityHandlerFactory, imodelAccess]),\n });\n\n return (\n <Tree\n {...props}\n onReload={triggerRefresh}\n imodelAccess={imodelAccess}\n treeRenderer={(treeProps) => treeRenderer({ ...treeProps, getVisibilityButtonState, onVisibilityButtonClick })}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"VisibilityTree.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAmBjC;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,wBAAwB,EAAE,YAAY,EAAE,uBAAuB,EAAE,GAAG,KAAK,EAAuB;IAC/H,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACnC,MAAM,EAAE,YAAY,EAAE,8BAA8B,EAAE,GAAG,eAAe,CAAC;QACvE,MAAM;QACN,QAAQ;QACR,uBAAuB;KACxB,CAAC,CAAC;IAEH,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,cAAc,EAAE,GAAG,sBAAsB,CAAC;QACnG,wBAAwB,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,wBAAwB,EAAE,YAAY,CAAC,CAAC;KAClI,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,IAAI,OACC,KAAK,EACT,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,YAAY,EAC1B,uBAAuB,EAAE,8BAA8B,EACvD,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,GAAG,SAAS,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC,GAC9G,CACH,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 { useCallback } from \"react\";\nimport { useIModelAccess } from \"../internal/UseIModelAccess.js\";\nimport { useHierarchyVisibility } from \"../UseHierarchyVisibility.js\";\nimport { Tree } from \"./Tree.js\";\n\nimport type { ReactNode } from \"react\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { HierarchyVisibilityHandler } from \"../UseHierarchyVisibility.js\";\nimport type { FunctionProps } from \"../Utils.js\";\nimport type { TreeProps } from \"./Tree.js\";\nimport type { VisibilityContext } from \"./TreeNodeVisibilityButton.js\";\n\n/** @beta */\nexport type VisibilityTreeProps = Omit<TreeProps, \"treeRenderer\" | \"imodelAccess\"> & {\n /** Callback for creating visibility handler used to control visibility of instances represented by tree nodes. */\n visibilityHandlerFactory: (props: { imodelAccess: ECClassHierarchyInspector }) => HierarchyVisibilityHandler;\n /** Tree renderer that should be used to render tree data. */\n treeRenderer: (\n treeProps: FunctionProps<TreeProps[\"treeRenderer\"]> & Pick<VisibilityContext, \"getVisibilityButtonState\" | \"onVisibilityButtonClick\">,\n ) => ReactNode;\n};\n\n/**\n * Tree component that can control visibility of instances represented by tree nodes.\n * @beta\n */\nexport function VisibilityTree({ visibilityHandlerFactory, treeRenderer, hierarchyLevelSizeLimit, ...props }: VisibilityTreeProps) {\n const { imodel, treeName } = props;\n const { imodelAccess, currentHierarchyLevelSizeLimit } = useIModelAccess({\n imodel,\n treeName,\n hierarchyLevelSizeLimit,\n });\n\n const { getVisibilityButtonState, onVisibilityButtonClick, triggerRefresh } = useHierarchyVisibility({\n visibilityHandlerFactory: useCallback(() => visibilityHandlerFactory({ imodelAccess }), [visibilityHandlerFactory, imodelAccess]),\n });\n\n return (\n <Tree\n {...props}\n onReload={triggerRefresh}\n imodelAccess={imodelAccess}\n hierarchyLevelSizeLimit={currentHierarchyLevelSizeLimit}\n treeRenderer={(treeProps) => treeRenderer({ ...treeProps, getVisibilityButtonState, onVisibilityButtonClick })}\n />\n );\n}\n"]}
@@ -1,10 +1,12 @@
1
1
  import type { BaseTreeRendererProps } from "./BaseTreeRenderer.js";
2
- import type { TreeItemVisibilityButtonProps } from "./TreeNodeVisibilityButton.js";
2
+ import type { VisibilityContext } from "./TreeNodeVisibilityButton.js";
3
3
  /** @beta */
4
- export type VisibilityTreeRendererProps = BaseTreeRendererProps & TreeItemVisibilityButtonProps;
4
+ export type VisibilityTreeRendererProps = Omit<BaseTreeRendererProps, "getInlineActions" | "getMenuActions" | "getContextMenuActions" | "getDecorations"> & {
5
+ [Property in keyof Pick<BaseTreeRendererProps, "getInlineActions" | "getMenuActions" | "getContextMenuActions" | "getDecorations">]?: (args: Parameters<NonNullable<BaseTreeRendererProps[Property]>>[0], treeRendererProps: VisibilityTreeRendererProps) => ReturnType<NonNullable<BaseTreeRendererProps[Property]>>;
6
+ } & VisibilityContext;
5
7
  /**
6
8
  * Tree renderer that renders tree nodes with eye checkboxes for controlling visibility of instances represented by tree nodes.
7
9
  * @beta
8
10
  */
9
- export declare function VisibilityTreeRenderer({ getVisibilityButtonState, onVisibilityButtonClick: onClick, actions, ...props }: VisibilityTreeRendererProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function VisibilityTreeRenderer(props: VisibilityTreeRendererProps): import("react/jsx-runtime").JSX.Element;
10
12
  //# sourceMappingURL=VisibilityTreeRenderer.d.ts.map
@@ -3,27 +3,29 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- /* eslint-disable @itwin/no-internal */
7
- import { useMemo } from "react";
8
- import { createFilterAction } from "@itwin/presentation-hierarchies-react";
6
+ import { useCallback, useMemo } from "react";
7
+ import { FilterAction } from "@itwin/presentation-hierarchies-react";
9
8
  import { BaseTreeRenderer } from "./BaseTreeRenderer.js";
10
- import { createVisibilityAction } from "./TreeNodeVisibilityButton.js";
9
+ import { VisibilityAction, VisibilityContextProvider } from "./TreeNodeVisibilityButton.js";
11
10
  import { useVisibilityButtonHandler } from "./UseVisibilityButtonHandler.js";
12
11
  /**
13
12
  * Tree renderer that renders tree nodes with eye checkboxes for controlling visibility of instances represented by tree nodes.
14
13
  * @beta
15
14
  */
16
- export function VisibilityTreeRenderer({ getVisibilityButtonState, onVisibilityButtonClick: onClick, actions, ...props }) {
15
+ export function VisibilityTreeRenderer(props) {
16
+ const { getVisibilityButtonState, onVisibilityButtonClick: onClick, getInlineActions, getMenuActions, getContextMenuActions, getDecorations, onFilterClick, getHierarchyLevelDetails, ...restProps } = props;
17
17
  const { onVisibilityButtonClick } = useVisibilityButtonHandler({ rootNodes: props.rootNodes, isNodeSelected: props.isNodeSelected, onClick });
18
- const visibilityButtonProps = useMemo(() => ({
19
- variant: "eyeball",
20
- getVisibilityButtonState,
21
- onVisibilityButtonClick,
22
- }), [getVisibilityButtonState, onVisibilityButtonClick]);
23
- return (_jsx(BaseTreeRenderer, { ...props, actions: [
24
- ...(visibilityButtonProps ? [createVisibilityAction(visibilityButtonProps)] : []),
25
- createFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails }),
26
- ...(actions ? actions : []),
27
- ] }));
18
+ const nodeInlineActions = useCallback((actionsProps) => {
19
+ return getInlineActions
20
+ ? getInlineActions(actionsProps, props)
21
+ : [
22
+ _jsx(VisibilityAction, { node: actionsProps.targetNode }, "Visibility"),
23
+ _jsx(FilterAction, { node: actionsProps.targetNode, onFilter: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails }, "Filter"),
24
+ ];
25
+ }, [onFilterClick, getHierarchyLevelDetails, getInlineActions, props]);
26
+ const nodeMenuActions = useMemo(() => (getMenuActions ? (actionsProps) => getMenuActions(actionsProps, props) : undefined), [getMenuActions, props]);
27
+ const nodeContextMenuActions = useMemo(() => (getContextMenuActions ? (actionsProps) => getContextMenuActions(actionsProps, props) : undefined), [getContextMenuActions, props]);
28
+ const nodeDecorations = useMemo(() => (getDecorations ? (node) => getDecorations(node, props) : undefined), [getDecorations, props]);
29
+ return (_jsx(VisibilityContextProvider, { onVisibilityButtonClick: onVisibilityButtonClick, getVisibilityButtonState: getVisibilityButtonState, children: _jsx(BaseTreeRenderer, { ...restProps, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails, getInlineActions: nodeInlineActions, getMenuActions: nodeMenuActions, getContextMenuActions: nodeContextMenuActions, getDecorations: nodeDecorations }) }));
28
30
  }
29
31
  //# sourceMappingURL=VisibilityTreeRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisibilityTreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,uCAAuC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAO7E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAA+B;IACnJ,MAAM,EAAE,uBAAuB,EAAE,GAAG,0BAA0B,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9I,MAAM,qBAAqB,GAAkC,OAAO,CAClE,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,SAAS;QAClB,wBAAwB;QACxB,uBAAuB;KACxB,CAAC,EACF,CAAC,wBAAwB,EAAE,uBAAuB,CAAC,CACpD,CAAC;IAEF,OAAO,CACL,KAAC,gBAAgB,OACX,KAAK,EACT,OAAO,EAAE;YACP,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACjF,kBAAkB,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,wBAAwB,EAAE,KAAK,CAAC,wBAAwB,EAAE,CAAC;YAC/G,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5B,GACD,CACH,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/* eslint-disable @itwin/no-internal */\n\nimport { useMemo } from \"react\";\nimport { createFilterAction } from \"@itwin/presentation-hierarchies-react\";\nimport { BaseTreeRenderer } from \"./BaseTreeRenderer.js\";\nimport { createVisibilityAction } from \"./TreeNodeVisibilityButton.js\";\nimport { useVisibilityButtonHandler } from \"./UseVisibilityButtonHandler.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\nimport type { TreeItemVisibilityButtonProps } from \"./TreeNodeVisibilityButton.js\";\n/** @beta */\nexport type VisibilityTreeRendererProps = BaseTreeRendererProps & TreeItemVisibilityButtonProps;\n\n/**\n * Tree renderer that renders tree nodes with eye checkboxes for controlling visibility of instances represented by tree nodes.\n * @beta\n */\nexport function VisibilityTreeRenderer({ getVisibilityButtonState, onVisibilityButtonClick: onClick, actions, ...props }: VisibilityTreeRendererProps) {\n const { onVisibilityButtonClick } = useVisibilityButtonHandler({ rootNodes: props.rootNodes, isNodeSelected: props.isNodeSelected, onClick });\n const visibilityButtonProps: TreeItemVisibilityButtonProps = useMemo(\n () => ({\n variant: \"eyeball\",\n getVisibilityButtonState,\n onVisibilityButtonClick,\n }),\n [getVisibilityButtonState, onVisibilityButtonClick],\n );\n\n return (\n <BaseTreeRenderer\n {...props}\n actions={[\n ...(visibilityButtonProps ? [createVisibilityAction(visibilityButtonProps)] : []),\n createFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails }),\n ...(actions ? actions : []),\n ]}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"VisibilityTreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAa7E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EACJ,wBAAwB,EACxB,uBAAuB,EAAE,OAAO,EAChC,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,wBAAwB,EACxB,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,uBAAuB,EAAE,GAAG,0BAA0B,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;IAE9I,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,YAAY,EAAE,EAAE;QACf,OAAO,gBAAgB;YACrB,CAAC,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,CAAC;YACvC,CAAC,CAAC;gBACE,KAAC,gBAAgB,IAAoB,IAAI,EAAE,YAAY,CAAC,UAAU,IAA3C,YAAY,CAAmC;gBACtE,KAAC,YAAY,IAAgB,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,wBAAwB,EAAE,wBAAwB,IAApH,QAAQ,CAAgH;aAC5I,CAAC;IACR,CAAC,EACD,CAAC,aAAa,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CACnE,CAAC;IACF,MAAM,eAAe,GAAG,OAAO,CAC7B,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC1F,CAAC,cAAc,EAAE,KAAK,CAAC,CACxB,CAAC;IACF,MAAM,sBAAsB,GAAG,OAAO,CACpC,GAAG,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EACxG,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAC/B,CAAC;IACF,MAAM,eAAe,GAAG,OAAO,CAC7B,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC1E,CAAC,cAAc,EAAE,KAAK,CAAC,CACxB,CAAC;IAEF,OAAO,CACL,KAAC,yBAAyB,IAAC,uBAAuB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,wBAAwB,YAC7H,KAAC,gBAAgB,OACX,SAAS,EACb,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,wBAAwB,EAClD,gBAAgB,EAAE,iBAAiB,EACnC,cAAc,EAAE,eAAe,EAC/B,qBAAqB,EAAE,sBAAsB,EAC7C,cAAc,EAAE,eAAe,GAC/B,GACwB,CAC7B,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 { useCallback, useMemo } from \"react\";\nimport { FilterAction } from \"@itwin/presentation-hierarchies-react\";\nimport { BaseTreeRenderer } from \"./BaseTreeRenderer.js\";\nimport { VisibilityAction, VisibilityContextProvider } from \"./TreeNodeVisibilityButton.js\";\nimport { useVisibilityButtonHandler } from \"./UseVisibilityButtonHandler.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\nimport type { VisibilityContext } from \"./TreeNodeVisibilityButton.js\";\n\n/** @beta */\nexport type VisibilityTreeRendererProps = Omit<BaseTreeRendererProps, \"getInlineActions\" | \"getMenuActions\" | \"getContextMenuActions\" | \"getDecorations\"> & {\n [Property in keyof Pick<BaseTreeRendererProps, \"getInlineActions\" | \"getMenuActions\" | \"getContextMenuActions\" | \"getDecorations\">]?: (\n args: Parameters<NonNullable<BaseTreeRendererProps[Property]>>[0],\n treeRendererProps: VisibilityTreeRendererProps,\n ) => ReturnType<NonNullable<BaseTreeRendererProps[Property]>>;\n} & VisibilityContext;\n\n/**\n * Tree renderer that renders tree nodes with eye checkboxes for controlling visibility of instances represented by tree nodes.\n * @beta\n */\nexport function VisibilityTreeRenderer(props: VisibilityTreeRendererProps) {\n const {\n getVisibilityButtonState,\n onVisibilityButtonClick: onClick,\n getInlineActions,\n getMenuActions,\n getContextMenuActions,\n getDecorations,\n onFilterClick,\n getHierarchyLevelDetails,\n ...restProps\n } = props;\n const { onVisibilityButtonClick } = useVisibilityButtonHandler({ rootNodes: props.rootNodes, isNodeSelected: props.isNodeSelected, onClick });\n\n const nodeInlineActions = useCallback<Required<BaseTreeRendererProps>[\"getInlineActions\"]>(\n (actionsProps) => {\n return getInlineActions\n ? getInlineActions(actionsProps, props)\n : [\n <VisibilityAction key={\"Visibility\"} node={actionsProps.targetNode} />,\n <FilterAction key={\"Filter\"} node={actionsProps.targetNode} onFilter={onFilterClick} getHierarchyLevelDetails={getHierarchyLevelDetails} />,\n ];\n },\n [onFilterClick, getHierarchyLevelDetails, getInlineActions, props],\n );\n const nodeMenuActions = useMemo<BaseTreeRendererProps[\"getMenuActions\"]>(\n () => (getMenuActions ? (actionsProps) => getMenuActions(actionsProps, props) : undefined),\n [getMenuActions, props],\n );\n const nodeContextMenuActions = useMemo<BaseTreeRendererProps[\"getContextMenuActions\"]>(\n () => (getContextMenuActions ? (actionsProps) => getContextMenuActions(actionsProps, props) : undefined),\n [getContextMenuActions, props],\n );\n const nodeDecorations = useMemo<BaseTreeRendererProps[\"getDecorations\"]>(\n () => (getDecorations ? (node) => getDecorations(node, props) : undefined),\n [getDecorations, props],\n );\n\n return (\n <VisibilityContextProvider onVisibilityButtonClick={onVisibilityButtonClick} getVisibilityButtonState={getVisibilityButtonState}>\n <BaseTreeRenderer\n {...restProps}\n onFilterClick={onFilterClick}\n getHierarchyLevelDetails={getHierarchyLevelDetails}\n getInlineActions={nodeInlineActions}\n getMenuActions={nodeMenuActions}\n getContextMenuActions={nodeContextMenuActions}\n getDecorations={nodeDecorations}\n />\n </VisibilityContextProvider>\n );\n}\n"]}
@@ -0,0 +1,74 @@
1
+ import type { Observable } from "rxjs";
2
+ import type { GuidString, Id64Arg, Id64String } from "@itwin/core-bentley";
3
+ import type { TreeWidgetViewport } from "../TreeWidgetViewport.js";
4
+ import type { ChildrenTree } from "./Utils.js";
5
+ /** @internal */
6
+ export declare const SET_CHANGE_DEBOUNCE_TIME = 20;
7
+ type SetType = "always" | "never";
8
+ interface GetElementsTreeByModelProps {
9
+ /** Only always/never drawn elements that have the specified models will be returned. */
10
+ modelIds: Id64Arg;
11
+ /**
12
+ * The type of set from which tree should be retrieved.
13
+ * `always` - ChildrenTree will be created from `alwaysDrawn` set.
14
+ * `never` - ChildrenTree will be created from `neverDrawn` set.
15
+ */
16
+ setType: SetType;
17
+ }
18
+ interface GetElementsTreeByCategoryProps {
19
+ modelIds: Id64Arg | undefined;
20
+ /**
21
+ * Categories of root elements.
22
+ *
23
+ * Elements are filtered by given categories. Children of those elements are also included, no matter their category.
24
+ */
25
+ categoryIds: Id64Arg;
26
+ /**
27
+ * The type of set from which tree should be retrieved.
28
+ * `always` - ChildrenTree will be created from `alwaysDrawn` set.
29
+ * `never` - ChildrenTree will be created from `neverDrawn` set.
30
+ */
31
+ setType: SetType;
32
+ }
33
+ interface GetElementsTreeByElementProps extends GetElementsTreeByCategoryProps {
34
+ /** Path to element for which to get its' child always/never drawn elements. When undefined, models and categories will be used to get the always/never drawn elements. */
35
+ parentElementIdsPath: Array<Id64Arg>;
36
+ }
37
+ /** @internal */
38
+ export type GetElementsTreeProps = GetElementsTreeByModelProps | GetElementsTreeByCategoryProps | GetElementsTreeByElementProps;
39
+ /**
40
+ * - `categoryId` is assigned only to the elements in always/never drawn set.
41
+ * - `isInAlwaysOrNeverDrawnSet` flag determines if key (ECInstanceId) is in always/never set.
42
+ * @internal
43
+ */
44
+ export type MapEntry = {
45
+ isInAlwaysOrNeverDrawnSet: true;
46
+ categoryId: Id64String;
47
+ } | {
48
+ isInAlwaysOrNeverDrawnSet: false;
49
+ };
50
+ type CachedNodesMap = ChildrenTree<MapEntry>;
51
+ /** @internal */
52
+ export declare class AlwaysAndNeverDrawnElementInfo implements Disposable {
53
+ #private;
54
+ constructor(props: {
55
+ viewport: TreeWidgetViewport;
56
+ elementClassName?: string;
57
+ componentId?: GuidString;
58
+ });
59
+ suppressChangeEvents(): void;
60
+ resumeChangeEvents(): void;
61
+ getElementsTree({ setType, modelIds, ...props }: GetElementsTreeProps): Observable<CachedNodesMap>;
62
+ private getChildrenTree;
63
+ private createCacheEntryObservable;
64
+ [Symbol.dispose](): void;
65
+ private queryAlwaysOrNeverDrawnElementInfo;
66
+ private queryElementInfo;
67
+ getAlwaysOrNeverDrawnElements(props: GetElementsTreeProps): Observable<Set<string>>;
68
+ clearAlwaysAndNeverDrawnElements(props: {
69
+ categoryIds: Id64Arg;
70
+ modelId: Id64String | undefined;
71
+ }): Observable<void>;
72
+ }
73
+ export {};
74
+ //# sourceMappingURL=AlwaysAndNeverDrawnElementInfo.d.ts.map