@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.
- package/CHANGELOG.md +281 -1
- package/README.md +190 -63
- package/lib/esm/tree-widget-react/TreeWidget.d.ts +7 -4
- package/lib/esm/tree-widget-react/TreeWidget.js +32 -12
- package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.d.ts +7 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js +22 -23
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +4 -3
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +4 -3
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +6 -6
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +3 -2
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.js +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.css +1 -0
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.d.ts +12 -5
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +13 -9
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +3 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +3 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +11 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +64 -14
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +8 -6
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +4 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +41 -8
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +700 -125
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +18 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +124 -83
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +70 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +504 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +41 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +50 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js +136 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +54 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +291 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +64 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +94 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.d.ts +36 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js +219 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.d.ts +12 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js +19 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +30 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +47 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.d.ts +45 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +569 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js +33 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +24 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +115 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +44 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +61 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +50 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +364 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.d.ts +19 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js +32 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js +53 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +37 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +177 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.d.ts +55 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +53 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.d.ts +32 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js +168 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +11 -23
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +22 -76
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +28 -4
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js +73 -2
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.d.ts +186 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +79 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +15 -7
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +33 -22
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/Utils.d.ts +45 -23
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +110 -44
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.d.ts +2 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js +4 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +25 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js +47 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +4 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.css +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.d.ts +7 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js +19 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +11 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +9 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +55 -38
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.css +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +24 -8
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +41 -25
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +6 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +13 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +6 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js +7 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +5 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +10 -6
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +5 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +17 -15
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.d.ts +74 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js +207 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.d.ts +43 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js +47 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.d.ts +12 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js +112 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.d.ts → internal/Rxjs.d.ts} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.js → internal/Rxjs.js} +10 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/Rxjs.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.d.ts → internal/Tooltip.d.ts} +4 -8
- package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js +18 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +14 -0
- package/lib/esm/tree-widget-react/components/{tree-header/SearchBox.css → trees/common/internal/Types.js} +2 -4
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.js +24 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.d.ts → internal/UseHierarchiesLocalization.d.ts} +3 -2
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.js → internal/UseHierarchiesLocalization.js} +6 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.d.ts → internal/UseHierarchyFiltering.d.ts} +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.js → internal/UseHierarchyFiltering.js} +5 -4
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +17 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +32 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.d.ts → internal/UseIModelChangeListener.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.js → internal/UseIModelChangeListener.js} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelChangeListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +70 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +172 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js +60 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +39 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +160 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.d.ts +3 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.js +12 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +68 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +170 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +46 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.d.ts +91 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js +112 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +236 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +600 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/useGuid.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/common/useGuid.js +11 -0
- package/lib/esm/tree-widget-react/components/trees/common/useGuid.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +7 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +29 -20
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +2 -6
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +5 -6
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +36 -21
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +9 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +48 -36
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +2 -6
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +13 -4
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +80 -74
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +7 -10
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +45 -36
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +16 -5
- package/lib/esm/tree-widget-react/components/trees/index.js +16 -4
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +3 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +3 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +3 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +34 -24
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +14 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +11 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +24 -20
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +193 -154
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +60 -10
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +97 -238
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +22 -25
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +280 -298
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.d.ts +41 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js +253 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js +148 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +76 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +269 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +53 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +71 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react-internal.d.ts +12 -0
- package/lib/esm/tree-widget-react-internal.js +18 -0
- package/lib/esm/tree-widget-react-internal.js.map +1 -0
- package/lib/public/locales/en/TreeWidget.json +41 -54
- package/package.json +76 -79
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +0 -28
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js +0 -87
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js +0 -66
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js +0 -24
- package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js +0 -21
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js +0 -24
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +0 -20
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js +0 -127
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js +0 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +0 -21
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +0 -138
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +0 -25
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +0 -173
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +0 -106
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +0 -663
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js +0 -48
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map
CHANGED
|
@@ -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;
|
|
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(
|
|
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
|
-
|
|
7
|
-
import {
|
|
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(
|
|
14
|
-
|
|
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;
|
|
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"]}
|
package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
import type { VisibilityContext } from "./TreeNodeVisibilityButton.js";
|
|
3
3
|
interface UseVisibilityButtonHandlerProps {
|
|
4
|
-
rootNodes:
|
|
4
|
+
rootNodes: PresentationHierarchyNode[] | undefined;
|
|
5
5
|
isNodeSelected?: (nodeId: string) => boolean;
|
|
6
|
-
onClick:
|
|
6
|
+
onClick: VisibilityContext["onVisibilityButtonClick"];
|
|
7
7
|
}
|
|
8
8
|
interface UseVisibilityButtonHandlerResult {
|
|
9
|
-
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
|
package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js
CHANGED
|
@@ -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 {
|
|
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 (!
|
|
12
|
+
if (!isNodeSelectedRef.current?.(clickedNode.id)) {
|
|
10
13
|
onClick(clickedNode, state);
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
}, [
|
|
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,
|
|
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<
|
|
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
|
|
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,
|
|
16
|
-
const
|
|
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,
|
|
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"]}
|
package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { BaseTreeRendererProps } from "./BaseTreeRenderer.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { VisibilityContext } from "./TreeNodeVisibilityButton.js";
|
|
3
3
|
/** @beta */
|
|
4
|
-
export type VisibilityTreeRendererProps = BaseTreeRendererProps &
|
|
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(
|
|
11
|
+
export declare function VisibilityTreeRenderer(props: VisibilityTreeRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
//# sourceMappingURL=VisibilityTreeRenderer.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js
CHANGED
|
@@ -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
|
-
|
|
7
|
-
import {
|
|
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 {
|
|
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(
|
|
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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisibilityTreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;
|
|
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
|