@itwin/tree-widget-react 3.4.1 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -18
- package/README.md +3 -76
- package/lib/esm/tree-widget-react/components/SelectableTree.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/SelectableTree.js +4 -4
- package/lib/esm/tree-widget-react/components/SelectableTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeSelector.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/TreeSelector.js +11 -14
- package/lib/esm/tree-widget-react/components/TreeSelector.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +3 -5
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js +6 -49
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.scss +0 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeWithHeader.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +10 -8
- 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 +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +3 -3
- 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/UseCategoriesTree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +4 -28
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js +2 -73
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.d.ts +7 -0
- package/lib/{cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.js → esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js} +14 -34
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +12 -10
- 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 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +3 -2
- 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/Tree.d.ts +4 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +11 -12
- 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 +8 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +28 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +34 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +6 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +5 -31
- 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 +13 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseMultiCheckboxHandler.js → components/UseVisibilityButtonHandler.js} +7 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +2 -2
- 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 +3 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +9 -8
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +0 -1
- package/lib/esm/tree-widget-react/components/trees/index.js +0 -1
- 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 +1 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +8 -9
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +19 -16
- 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 +2 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +9 -13
- 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/UseModelsTree.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +7 -14
- 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/ModelsTreeVisibilityHandler.js.map +1 -1
- package/package.json +19 -24
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/tree-widget-react/TreeWidget.d.ts +0 -24
- package/lib/cjs/tree-widget-react/TreeWidget.js +0 -54
- package/lib/cjs/tree-widget-react/TreeWidget.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/SelectableTree.d.ts +0 -47
- package/lib/cjs/tree-widget-react/components/SelectableTree.js +0 -107
- package/lib/cjs/tree-widget-react/components/SelectableTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/SelectableTree.scss +0 -18
- package/lib/cjs/tree-widget-react/components/TreeSelector.d.ts +0 -31
- package/lib/cjs/tree-widget-react/components/TreeSelector.js +0 -30
- package/lib/cjs/tree-widget-react/components/TreeSelector.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/TreeSelector.scss +0 -27
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.d.ts +0 -36
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js +0 -74
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.scss +0 -9
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.d.ts +0 -33
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js +0 -75
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.scss +0 -57
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.d.ts +0 -13
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.js +0 -20
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.scss +0 -23
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +0 -22
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +0 -47
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +0 -75
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -53
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +0 -73
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +0 -23
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +0 -207
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +0 -28
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js +0 -91
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +0 -22
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +0 -117
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +0 -42
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +0 -119
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +0 -35
- package/lib/cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.d.ts +0 -10
- package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.js +0 -46
- package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/Tooltip.d.ts +0 -17
- package/lib/cjs/tree-widget-react/components/trees/common/Tooltip.js +0 -29
- package/lib/cjs/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/TreeErrors.d.ts +0 -9
- package/lib/cjs/tree-widget-react/components/trees/common/TreeErrors.js +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/TreeErrors.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.d.ts +0 -7
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.js +0 -25
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/common/UseFiltering.js +0 -28
- package/lib/cjs/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchiesLocalization.d.ts +0 -7
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js +0 -33
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.d.ts +0 -13
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.js +0 -158
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +0 -55
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +0 -114
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseIModelChangeListener.d.ts +0 -8
- package/lib/cjs/tree-widget-react/components/trees/common/UseIModelChangeListener.js +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.js +0 -34
- package/lib/cjs/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +0 -20
- package/lib/cjs/tree-widget-react/components/trees/common/UseNodeHighlighting.js +0 -131
- package/lib/cjs/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +0 -29
- package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.js +0 -49
- package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/Utils.d.ts +0 -27
- package/lib/cjs/tree-widget-react/components/trees/common/Utils.js +0 -66
- package/lib/cjs/tree-widget-react/components/trees/common/Utils.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.d.ts +0 -5
- package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.js +0 -30
- package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +0 -4
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.js +0 -15
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.scss +0 -21
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.d.ts +0 -44
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js +0 -98
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +0 -27
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js +0 -27
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js +0 -48
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +0 -21
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.js +0 -26
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +0 -26
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +0 -38
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +0 -26
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +0 -35
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +0 -24
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +0 -265
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +0 -50
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +0 -26
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js +0 -35
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +0 -29
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +0 -622
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +0 -26
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +0 -203
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/index.d.ts +0 -18
- package/lib/cjs/tree-widget-react/components/trees/index.js +0 -39
- package/lib/cjs/tree-widget-react/components/trees/index.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.js +0 -26
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +0 -65
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +0 -144
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +0 -78
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +0 -106
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +0 -79
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +0 -650
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +0 -44
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +0 -312
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js +0 -25
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +0 -142
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +0 -25
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +0 -178
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +0 -44
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +0 -385
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +0 -37
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js +0 -57
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +0 -106
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +0 -672
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js +0 -52
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/utils/IsPromiseLike.d.ts +0 -6
- package/lib/cjs/tree-widget-react/components/utils/IsPromiseLike.js +0 -16
- package/lib/cjs/tree-widget-react/components/utils/IsPromiseLike.js.map +0 -1
- package/lib/cjs/tree-widget-react.d.ts +0 -6
- package/lib/cjs/tree-widget-react.js +0 -32
- package/lib/cjs/tree-widget-react.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.d.ts +0 -12
- package/lib/esm/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +0 -27
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js +0 -23
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.d.ts +0 -11
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js +0 -16
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
# Change Log - @itwin/tree-widget-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 27 Jan 2025 18:30:40 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 3.4.1
|
|
8
|
-
|
|
9
|
-
Thu, 06 Feb 2025 13:36:08 GMT
|
|
10
|
-
|
|
11
|
-
### Patches
|
|
12
|
-
|
|
13
|
-
- Removed horizontal scroll from trees. ([#1180](https://github.com/iTwin/viewer-components-react/pull/1180))
|
|
14
|
-
|
|
15
|
-
## 3.4.0
|
|
16
|
-
|
|
17
|
-
Tue, 04 Feb 2025 15:29:52 GMT
|
|
18
|
-
|
|
19
|
-
### Minor changes
|
|
20
|
-
|
|
21
|
-
- Expose `FocusedInstancesContextProvider` and `useFocusedInstancesContext` to allow using `ModelsTreeComponent.ToggleInstancesFocusButton` from outside of `ModelsTreeComponent` and accesing the context from other React components. ([#1175](https://github.com/iTwin/viewer-components-react/pull/1175))
|
|
22
|
-
- Add `filterButtonsVisibility` prop to `TreeRenderer`. The prop allows to control visibility of hierarchy level filtering buttons in the tree: `show-on-hover` (default) shows them on hover or focus, `hide` only shows them when a node is filtered. ([#1178](https://github.com/iTwin/viewer-components-react/pull/1178))
|
|
23
|
-
|
|
24
7
|
## 3.3.0
|
|
25
8
|
|
|
26
9
|
Mon, 27 Jan 2025 18:30:40 GMT
|
package/README.md
CHANGED
|
@@ -42,9 +42,6 @@ Typically, the package is used with an [AppUI](https://github.com/iTwin/appui/tr
|
|
|
42
42
|
|
|
43
43
|
In any case, **before** using any APIs or components delivered with the package, it needs to be initialized:
|
|
44
44
|
|
|
45
|
-
<!-- [[include: [TreeWidget.TreeWidgetInitializeImports, TreeWidget.TreeWidgetInitialize], tsx]] -->
|
|
46
|
-
<!-- BEGIN EXTRACTION -->
|
|
47
|
-
|
|
48
45
|
```tsx
|
|
49
46
|
import { TreeWidget } from "@itwin/tree-widget-react";
|
|
50
47
|
import { IModelApp } from "@itwin/core-frontend";
|
|
@@ -52,13 +49,8 @@ import { IModelApp } from "@itwin/core-frontend";
|
|
|
52
49
|
await TreeWidget.initialize(IModelApp.localization);
|
|
53
50
|
```
|
|
54
51
|
|
|
55
|
-
<!-- END EXTRACTION -->
|
|
56
|
-
|
|
57
52
|
In [AppUI](https://github.com/iTwin/appui/tree/master/ui/appui-react) based applications widgets are typically provided using `UiItemsProvider` implementations. The `@itwin/tree-widget-react` package delivers `createTreeWidget` function that can be used to add the tree widget to UI through a `UiItemsProvider`:
|
|
58
53
|
|
|
59
|
-
<!-- [[include: [TreeWidget.RegisterExampleImports, TreeWidget.RegisterExample], tsx]] -->
|
|
60
|
-
<!-- BEGIN EXTRACTION -->
|
|
61
|
-
|
|
62
54
|
```tsx
|
|
63
55
|
import { UiItemsManager } from "@itwin/appui-react";
|
|
64
56
|
import { createTreeWidget, ModelsTreeComponent } from "@itwin/tree-widget-react";
|
|
@@ -90,8 +82,6 @@ UiItemsManager.register({
|
|
|
90
82
|
});
|
|
91
83
|
```
|
|
92
84
|
|
|
93
|
-
<!-- END EXTRACTION -->
|
|
94
|
-
|
|
95
85
|
As seen in the above code snippet, `createTreeWidget` takes a list of trees that are displayed in the widget. This package delivers a number of tree components for everyone's use (see below), but providing custom trees is also an option.
|
|
96
86
|
|
|
97
87
|
## Components
|
|
@@ -110,9 +100,6 @@ The component renders a tree that tries to replicate how a typical "Models" tree
|
|
|
110
100
|
|
|
111
101
|
Typical usage:
|
|
112
102
|
|
|
113
|
-
<!-- [[include: [TreeWidget.ModelsTreeExampleImports, TreeWidget.ModelsTreeExample], tsx]] -->
|
|
114
|
-
<!-- BEGIN EXTRACTION -->
|
|
115
|
-
|
|
116
103
|
```tsx
|
|
117
104
|
import { ModelsTreeComponent } from "@itwin/tree-widget-react";
|
|
118
105
|
|
|
@@ -132,8 +119,6 @@ function MyWidget() {
|
|
|
132
119
|
}
|
|
133
120
|
```
|
|
134
121
|
|
|
135
|
-
<!-- END EXTRACTION -->
|
|
136
|
-
|
|
137
122
|
Available header buttons:
|
|
138
123
|
|
|
139
124
|
- `ModelsTreeComponent.ShowAllButton` makes everything in the iModel displayed.
|
|
@@ -158,11 +143,7 @@ This package provides building blocks for custom models tree:
|
|
|
158
143
|
|
|
159
144
|
Example:
|
|
160
145
|
|
|
161
|
-
<!-- [[include: [TreeWidget.CustomModelsTreeExampleImports, TreeWidget.CustomModelsTreeExample], tsx]] -->
|
|
162
|
-
<!-- BEGIN EXTRACTION -->
|
|
163
|
-
|
|
164
146
|
```tsx
|
|
165
|
-
import { useCallback } from "react";
|
|
166
147
|
import { TreeWithHeader, useModelsTree, useModelsTreeButtonProps, VisibilityTree, VisibilityTreeRenderer } from "@itwin/tree-widget-react";
|
|
167
148
|
import type { SelectionStorage } from "@itwin/unified-selection";
|
|
168
149
|
import type { IModelConnection, Viewport } from "@itwin/core-frontend";
|
|
@@ -213,15 +194,10 @@ function CustomModelsTreeComponent({ imodel, viewport, getSchemaContext, selecti
|
|
|
213
194
|
}
|
|
214
195
|
```
|
|
215
196
|
|
|
216
|
-
<!-- END EXTRACTION -->
|
|
217
|
-
|
|
218
197
|
#### Displaying a subset of the tree
|
|
219
198
|
|
|
220
199
|
Models tree allows displaying a subset of all nodes by providing a `getFilteredPaths` function, which receives a `createInstanceKeyPaths` function for creating hierarchy node paths from instance keys or an instance label and returns a list of hierarchy node paths targeting some nodes. When these paths are provided, the displayed hierarchy consists only of the targeted nodes, their ancestors, and their children. Example implementation of `getFilteredPaths`:
|
|
221
200
|
|
|
222
|
-
<!-- [[include: [TreeWidget.GetFilteredPathsComponentExample], tsx]] -->
|
|
223
|
-
<!-- BEGIN EXTRACTION -->
|
|
224
|
-
|
|
225
201
|
```tsx
|
|
226
202
|
type UseModelsTreeProps = Parameters<typeof useModelsTree>[0];
|
|
227
203
|
type GetFilteredPathsType = Exclude<UseModelsTreeProps["getFilteredPaths"], undefined>;
|
|
@@ -257,8 +233,6 @@ function CustomModelsTreeComponent({ viewport, selectionStorage, imodel, targetI
|
|
|
257
233
|
}
|
|
258
234
|
```
|
|
259
235
|
|
|
260
|
-
<!-- END EXTRACTION -->
|
|
261
|
-
|
|
262
236
|
### Categories tree
|
|
263
237
|
|
|
264
238
|
The component, based on the active view, renders a hierarchy of either spatial (3d) or drawing (2d) categories. The hierarchy consists of two levels - the category (spatial or drawing) and its sub-categories. There's also a header that renders categories search box and various visibility control buttons.
|
|
@@ -267,9 +241,6 @@ The component, based on the active view, renders a hierarchy of either spatial (
|
|
|
267
241
|
|
|
268
242
|
Typical usage:
|
|
269
243
|
|
|
270
|
-
<!-- [[include: [TreeWidget.CategoriesTreeExampleImports, TreeWidget.CategoriesTreeExample], tsx]] -->
|
|
271
|
-
<!-- BEGIN EXTRACTION -->
|
|
272
|
-
|
|
273
244
|
```tsx
|
|
274
245
|
import { CategoriesTreeComponent } from "@itwin/tree-widget-react";
|
|
275
246
|
|
|
@@ -286,8 +257,6 @@ function MyWidget() {
|
|
|
286
257
|
}
|
|
287
258
|
```
|
|
288
259
|
|
|
289
|
-
<!-- END EXTRACTION -->
|
|
290
|
-
|
|
291
260
|
Available header buttons:
|
|
292
261
|
|
|
293
262
|
- `ModelsTreeComponent.ShowAllButton` makes all categories and their subcategories displayed.
|
|
@@ -303,9 +272,6 @@ This package provides building blocks for custom categories tree:
|
|
|
303
272
|
|
|
304
273
|
Example:
|
|
305
274
|
|
|
306
|
-
<!-- [[include: [TreeWidget.CustomCategoriesTreeExampleImports, TreeWidget.CustomCategoriesTreeExample], tsx]] -->
|
|
307
|
-
<!-- BEGIN EXTRACTION -->
|
|
308
|
-
|
|
309
275
|
```tsx
|
|
310
276
|
import { TreeWithHeader, useCategoriesTree, useCategoriesTreeButtonProps, VisibilityTree, VisibilityTreeRenderer } from "@itwin/tree-widget-react";
|
|
311
277
|
import type { IModelConnection, Viewport } from "@itwin/core-frontend";
|
|
@@ -325,9 +291,11 @@ function CustomCategoriesTreeRenderer(props: CustomCategoriesTreeRendererProps)
|
|
|
325
291
|
},
|
|
326
292
|
[getLabel],
|
|
327
293
|
);
|
|
294
|
+
|
|
328
295
|
const getSublabel = useCallback<Required<VisibilityTreeRendererProps>["getSublabel"]>(() => {
|
|
329
296
|
return <>Custom sub label</>;
|
|
330
297
|
}, []);
|
|
298
|
+
|
|
331
299
|
return <VisibilityTreeRenderer {...props} getLabel={getLabelCallback} getSublabel={getSublabel} />;
|
|
332
300
|
}
|
|
333
301
|
|
|
@@ -341,6 +309,7 @@ interface CustomCategoriesTreeProps {
|
|
|
341
309
|
function CustomCategoriesTreeComponent({ imodel, viewport, getSchemaContext, selectionStorage }: CustomCategoriesTreeProps) {
|
|
342
310
|
const { buttonProps } = useCategoriesTreeButtonProps({ viewport });
|
|
343
311
|
const { categoriesTreeProps, rendererProps } = useCategoriesTree({ activeView: viewport, filter: "" });
|
|
312
|
+
|
|
344
313
|
return (
|
|
345
314
|
<TreeWithHeader
|
|
346
315
|
buttons={[
|
|
@@ -360,8 +329,6 @@ function CustomCategoriesTreeComponent({ imodel, viewport, getSchemaContext, sel
|
|
|
360
329
|
}
|
|
361
330
|
```
|
|
362
331
|
|
|
363
|
-
<!-- END EXTRACTION -->
|
|
364
|
-
|
|
365
332
|
### iModel content tree
|
|
366
333
|
|
|
367
334
|
The component renders a similar hierarchy to [Models tree](#models-tree), but with the following changes:
|
|
@@ -377,9 +344,6 @@ In general, the component is expected to be used by advanced users to inspect co
|
|
|
377
344
|
|
|
378
345
|
Typical usage:
|
|
379
346
|
|
|
380
|
-
<!-- [[include: [TreeWidget.ImodelContentTreeExampleImports, TreeWidget.ImodelContentTreeExample], tsx]] -->
|
|
381
|
-
<!-- BEGIN EXTRACTION -->
|
|
382
|
-
|
|
383
347
|
```tsx
|
|
384
348
|
import { IModelContentTreeComponent } from "@itwin/tree-widget-react";
|
|
385
349
|
|
|
@@ -395,8 +359,6 @@ function MyWidget() {
|
|
|
395
359
|
}
|
|
396
360
|
```
|
|
397
361
|
|
|
398
|
-
<!-- END EXTRACTION -->
|
|
399
|
-
|
|
400
362
|
### Custom trees
|
|
401
363
|
|
|
402
364
|
The package delivers a set of building blocks for creating trees that look and feel similar to the tree components provided by this package.
|
|
@@ -410,9 +372,6 @@ A "basic" tree is a tree that renders the hierarchy without visibility control -
|
|
|
410
372
|
|
|
411
373
|
Example:
|
|
412
374
|
|
|
413
|
-
<!-- [[include: [TreeWidget.CustomTreeExampleImports, TreeWidget.CustomTreeExample], tsx]] -->
|
|
414
|
-
<!-- BEGIN EXTRACTION -->
|
|
415
|
-
|
|
416
375
|
```tsx
|
|
417
376
|
import type { ComponentPropsWithoutRef } from "react";
|
|
418
377
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
@@ -471,8 +430,6 @@ function MyTree({ imodel }: MyTreeProps) {
|
|
|
471
430
|
}
|
|
472
431
|
```
|
|
473
432
|
|
|
474
|
-
<!-- END EXTRACTION -->
|
|
475
|
-
|
|
476
433
|
#### Custom visibility tree
|
|
477
434
|
|
|
478
435
|
A visibility tree is a tree that renders the hierarchy and allows controlling visibility control through the use of "eye" checkboxes - see [Models](#models-tree) and [Categories](#categories-tree) trees. Core components:
|
|
@@ -482,9 +439,6 @@ A visibility tree is a tree that renders the hierarchy and allows controlling vi
|
|
|
482
439
|
|
|
483
440
|
Example:
|
|
484
441
|
|
|
485
|
-
<!-- [[include: [TreeWidget.CustomVisibilityTreeExampleImports, TreeWidget.CustomVisibilityTreeExample], tsx]] -->
|
|
486
|
-
<!-- BEGIN EXTRACTION -->
|
|
487
|
-
|
|
488
442
|
```tsx
|
|
489
443
|
import { BeEvent } from "@itwin/core-bentley";
|
|
490
444
|
import { VisibilityTree, VisibilityTreeRenderer } from "@itwin/tree-widget-react";
|
|
@@ -562,8 +516,6 @@ function MyVisibilityTree({ imodel }: MyVisibilityTreeProps) {
|
|
|
562
516
|
}
|
|
563
517
|
```
|
|
564
518
|
|
|
565
|
-
<!-- END EXTRACTION -->
|
|
566
|
-
|
|
567
519
|
### Hierarchy level size limiting
|
|
568
520
|
|
|
569
521
|
All tree components in this package enforce a hierarchy level size limit. This means that when a node is expanded, only a certain number of child nodes are loaded. The limit is enforced to prevent loading too many nodes at once and to keep the performance of the tree components at an acceptable level.
|
|
@@ -584,9 +536,6 @@ Tree components that support selection synchronization, require a unified select
|
|
|
584
536
|
|
|
585
537
|
Typically, we want one unified selection storage per application - this makes sure that selection in all application's components is synchronized. Below is an example implementation of `getUnifiedSelectionStorage` function that creates the storage and clears it when an iModel is closed:
|
|
586
538
|
|
|
587
|
-
<!-- [[include: [TreeWidget.SelectionStorageExampleImports, TreeWidget.SelectionStorageExample], tsx]] -->
|
|
588
|
-
<!-- BEGIN EXTRACTION -->
|
|
589
|
-
|
|
590
539
|
```tsx
|
|
591
540
|
import { IModelConnection } from "@itwin/core-frontend";
|
|
592
541
|
import { createStorage } from "@itwin/unified-selection";
|
|
@@ -604,30 +553,20 @@ function getUnifiedSelectionStorage(): SelectionStorage {
|
|
|
604
553
|
}
|
|
605
554
|
```
|
|
606
555
|
|
|
607
|
-
<!-- END EXTRACTION -->
|
|
608
|
-
|
|
609
556
|
In case the application is also using components driven by APIs from `@itwin/presentation-frontend` package, which has its own selection manager, the single unified selection storage object should be passed to [`initialize`](https://www.itwinjs.org/reference/presentation-frontend/core/presentation/initializestatic/) function, e.g.:
|
|
610
557
|
|
|
611
|
-
<!-- [[include: [TreeWidget.SelectionStorageInitializeExampleImports, TreeWidget.SelectionStorageInitializeExample], tsx]] -->
|
|
612
|
-
<!-- BEGIN EXTRACTION -->
|
|
613
|
-
|
|
614
558
|
```tsx
|
|
615
559
|
import { Presentation } from "@itwin/presentation-frontend";
|
|
616
560
|
|
|
617
561
|
await Presentation.initialize({ selection: { selectionStorage: getUnifiedSelectionStorage() } });
|
|
618
562
|
```
|
|
619
563
|
|
|
620
|
-
<!-- END EXTRACTION -->
|
|
621
|
-
|
|
622
564
|
### Creating schema context
|
|
623
565
|
|
|
624
566
|
All tree components delivered with the package require a [`SchemaContext`](https://www.itwinjs.org/reference/ecschema-metadata/context/schemacontext/) to be able to access iModels metadata.
|
|
625
567
|
|
|
626
568
|
Typically, we want one schema context per iModel per application - this allows schema information to be shared across components, saving memory and time required to access the metadata. Below is an example implementation of `getSchemaContext` function, required by tree components:
|
|
627
569
|
|
|
628
|
-
<!-- [[include: [TreeWidget.GetSchemaContextExampleImports, TreeWidget.GetSchemaContextExample], tsx]] -->
|
|
629
|
-
<!-- BEGIN EXTRACTION -->
|
|
630
|
-
|
|
631
570
|
```tsx
|
|
632
571
|
import { SchemaContext } from "@itwin/ecschema-metadata";
|
|
633
572
|
import { ECSchemaRpcLocater } from "@itwin/ecschema-rpcinterface-common";
|
|
@@ -648,8 +587,6 @@ function getSchemaContext(imodel: IModelConnection) {
|
|
|
648
587
|
}
|
|
649
588
|
```
|
|
650
589
|
|
|
651
|
-
<!-- END EXTRACTION -->
|
|
652
|
-
|
|
653
590
|
Note: Using `ECSchemaRpcLocater` requires the application to support [ECSchemaRpcInterface](https://github.com/iTwin/itwinjs-core/blob/111ab9053f4718896de17bdaeb8de037bad281bd/core/ecschema-rpc/common/src/ECSchemaRpcInterface.ts#L14). This means [registering the interface](https://www.itwinjs.org/learning/rpcinterface/#configure-interfaces) and, on the backend, [registering the implementation](https://www.itwinjs.org/learning/rpcinterface/#server-side-configuration) by calling [ECSchemaRpcImpl.register()](https://github.com/iTwin/itwinjs-core/blob/111ab9053f4718896de17bdaeb8de037bad281bd/core/ecschema-rpc/impl/src/ECSchemaRpcImpl.ts#L29).
|
|
654
591
|
|
|
655
592
|
## Telemetry
|
|
@@ -697,9 +634,6 @@ Where `{tree}` specifies which tree component the feature is of.
|
|
|
697
634
|
|
|
698
635
|
For individual tree components the callbacks should be supplied through props:
|
|
699
636
|
|
|
700
|
-
<!-- [[include: [TreeWidget.TelemetryTreeComponentExampleImports, TreeWidget.TelemetryTreeComponentExample], tsx]] -->
|
|
701
|
-
<!-- BEGIN EXTRACTION -->
|
|
702
|
-
|
|
703
637
|
```tsx
|
|
704
638
|
import { IModelContentTreeComponent } from "@itwin/tree-widget-react";
|
|
705
639
|
|
|
@@ -719,13 +653,8 @@ function MyWidget() {
|
|
|
719
653
|
}
|
|
720
654
|
```
|
|
721
655
|
|
|
722
|
-
<!-- END EXTRACTION -->
|
|
723
|
-
|
|
724
656
|
For custom tree components `TelemetryContextProvider` should be used:
|
|
725
657
|
|
|
726
|
-
<!-- [[include: [TreeWidget.TelemetryCustomTreeExampleImports, TreeWidget.TelemetryCustomTreeExample], tsx]] -->
|
|
727
|
-
<!-- BEGIN EXTRACTION -->
|
|
728
|
-
|
|
729
658
|
```tsx
|
|
730
659
|
import { TelemetryContextProvider, useCategoriesTree, VisibilityTree, VisibilityTreeRenderer } from "@itwin/tree-widget-react";
|
|
731
660
|
|
|
@@ -760,5 +689,3 @@ function MyTree() {
|
|
|
760
689
|
// see "Custom trees" section for more example implementations
|
|
761
690
|
}
|
|
762
691
|
```
|
|
763
|
-
|
|
764
|
-
<!-- END EXTRACTION -->
|
|
@@ -43,5 +43,5 @@ export interface SelectableTreeProps {
|
|
|
43
43
|
* A component that renders a tree (combo box) selector and the selected tree component.
|
|
44
44
|
* @public
|
|
45
45
|
*/
|
|
46
|
-
export declare function SelectableTree(props: SelectableTreeProps): JSX.Element | null;
|
|
46
|
+
export declare function SelectableTree(props: SelectableTreeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
47
47
|
//# sourceMappingURL=SelectableTree.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
6
6
|
import "./SelectableTree.scss";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
9
|
-
import {
|
|
9
|
+
import { Spinner } from "@itwin/itwinui-react/bricks";
|
|
10
10
|
import { TreeWidget } from "../TreeWidget.js";
|
|
11
11
|
import { TreeSelector } from "./TreeSelector.js";
|
|
12
12
|
/**
|
|
@@ -23,7 +23,7 @@ export function SelectableTree(props) {
|
|
|
23
23
|
function SelectableTreeContent(props) {
|
|
24
24
|
const { trees: treeDefinitions, imodel } = props;
|
|
25
25
|
const trees = useActiveTrees(treeDefinitions, imodel);
|
|
26
|
-
return (_jsx("div", { className: "tree-widget-selectable-tree", children: _jsx(TreeSelector, { ...getTreeSelectorProps(trees),
|
|
26
|
+
return (_jsx("div", { className: "tree-widget-selectable-tree", children: _jsx(TreeSelector, { ...getTreeSelectorProps(trees), onPerformanceMeasured: props.onPerformanceMeasured, onFeatureUsed: props.onFeatureUsed }) }));
|
|
27
27
|
}
|
|
28
28
|
function useActiveTrees(treeDefinitions, imodel) {
|
|
29
29
|
const [trees, setTrees] = useState();
|
|
@@ -63,7 +63,7 @@ function getTreeSelectorProps(trees) {
|
|
|
63
63
|
{
|
|
64
64
|
id: "loading",
|
|
65
65
|
label: "",
|
|
66
|
-
render: () => (_jsx(Delayed, { children: _jsx(
|
|
66
|
+
render: () => (_jsx(Delayed, { children: _jsx(Spinner, {}) })),
|
|
67
67
|
},
|
|
68
68
|
],
|
|
69
69
|
};
|
|
@@ -75,7 +75,7 @@ function getTreeSelectorProps(trees) {
|
|
|
75
75
|
{
|
|
76
76
|
id: "no-trees",
|
|
77
77
|
label: "",
|
|
78
|
-
render: () => (_jsx(
|
|
78
|
+
render: () => (_jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, className: "tree-widget-no-trees-container", children: TreeWidget.translate("selectableTree.noTrees") })),
|
|
79
79
|
},
|
|
80
80
|
],
|
|
81
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableTree.js","sourceRoot":"","sources":["../../../../src/tree-widget-react/components/SelectableTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SelectableTree.js","sourceRoot":"","sources":["../../../../src/tree-widget-react/components/SelectableTree.tsx"],"names":[],"mappings":"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","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 \"./SelectableTree.scss\";\nimport { useEffect, useState } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { Spinner } from \"@itwin/itwinui-react/bricks\";\nimport { TreeWidget } from \"../TreeWidget.js\";\nimport { TreeSelector } from \"./TreeSelector.js\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { TreeContentDefinition, TreeSelectorProps } from \"./TreeSelector.js\";\n/**\n * Props for rendering trees\n * @public\n */\nexport interface SelectableTreeRenderProps {\n density?: \"enlarged\" | \"default\";\n onPerformanceMeasured?: (featureId: string, elapsedTime: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n// TODO: fix interface so startIcon type is taken from this interface for `TreeSelector`\n/**\n * Definition of a tree component displayed in `SelectableTree`.\n * @public\n */\nexport interface SelectableTreeDefinition {\n /** Id of the tree */\n id: string;\n /** Callback that is used to get tree label */\n getLabel: () => string;\n /** Callback that is used to render tree component */\n render: (props: SelectableTreeRenderProps) => React.ReactNode;\n /**\n * Callback that is used to determine if tree should be shown for current active iModel connection.\n * If callback is `undefined` tree is shown for all iModel connections.\n */\n shouldShow?: (imodel: IModelConnection) => Promise<boolean>;\n /** Icon to render before tree label in tree selector */\n startIcon?: React.ReactNode;\n}\n\n/**\n * Props for `SelectableTree`\n * @public\n */\nexport interface SelectableTreeProps {\n trees: SelectableTreeDefinition[];\n density?: \"enlarged\" | \"default\";\n onPerformanceMeasured?: (feature: string, elapsedTime: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders a tree (combo box) selector and the selected tree component.\n * @public\n */\nexport function SelectableTree(props: SelectableTreeProps) {\n const imodel = useActiveIModelConnection();\n if (!imodel) {\n return null;\n }\n return <SelectableTreeContent {...props} imodel={imodel} />;\n}\n\nfunction SelectableTreeContent(props: SelectableTreeProps & { imodel: IModelConnection }) {\n const { trees: treeDefinitions, imodel } = props;\n const trees = useActiveTrees(treeDefinitions, imodel);\n\n return (\n <div className=\"tree-widget-selectable-tree\">\n <TreeSelector {...getTreeSelectorProps(trees)} onPerformanceMeasured={props.onPerformanceMeasured} onFeatureUsed={props.onFeatureUsed} />\n </div>\n );\n}\n\nfunction useActiveTrees(treeDefinitions: SelectableTreeDefinition[], imodel: IModelConnection) {\n const [trees, setTrees] = useState<TreeContentDefinition[]>();\n\n useEffect(() => {\n let disposed = false;\n void (async () => {\n const visibleTrees = await getActiveTrees(treeDefinitions, imodel);\n if (!disposed) {\n setTrees(visibleTrees);\n }\n })();\n\n return () => {\n disposed = true;\n };\n }, [treeDefinitions, imodel]);\n\n return trees;\n}\n\nasync function getActiveTrees(treeDefinitions: SelectableTreeDefinition[], imodel: IModelConnection): Promise<TreeContentDefinition[]> {\n const handleDefinition = async (treeDef: SelectableTreeDefinition) => {\n if (treeDef.shouldShow !== undefined && !(await treeDef.shouldShow(imodel))) {\n return undefined;\n }\n return {\n id: treeDef.id,\n label: treeDef.getLabel(),\n render: treeDef.render,\n startIcon: treeDef.startIcon,\n };\n };\n\n return (await Promise.all(treeDefinitions.map(handleDefinition))).filter((tree) => tree !== undefined) as TreeContentDefinition[];\n}\n\nfunction getTreeSelectorProps(trees?: TreeContentDefinition[]): TreeSelectorProps {\n if (trees === undefined) {\n return {\n defaultSelectedContentId: \"loading\",\n trees: [\n {\n id: \"loading\",\n label: \"\",\n render: () => (\n <Delayed>\n {/* <ProgressLinear indeterminate={true} /> */}\n <Spinner />\n </Delayed>\n ),\n },\n ],\n };\n }\n\n if (trees.length === 0) {\n return {\n defaultSelectedContentId: \"no-trees\",\n trees: [\n {\n id: \"no-trees\",\n label: \"\",\n render: () => (\n <div style={{ display: \"flex\", justifyContent: \"center\", alignItems: \"center\" }} className=\"tree-widget-no-trees-container\">\n {TreeWidget.translate(\"selectableTree.noTrees\")}\n </div>\n ),\n },\n ],\n };\n }\n\n return {\n defaultSelectedContentId: trees[0].id,\n trees,\n };\n}\n\nfunction Delayed({ delay = 200, children }: PropsWithChildren<{ delay?: number }>) {\n const [show, setShow] = useState(false);\n\n useEffect(() => {\n const id = setTimeout(() => {\n setShow(true);\n }, delay);\n return () => {\n clearTimeout(id);\n };\n }, [delay]);\n\n if (!show) {\n return null;\n }\n\n return <>{children}</>;\n}\n"]}
|
|
@@ -18,7 +18,6 @@ export interface TreeContentDefinition {
|
|
|
18
18
|
export interface TreeSelectorProps {
|
|
19
19
|
defaultSelectedContentId: string;
|
|
20
20
|
trees: TreeContentDefinition[];
|
|
21
|
-
density?: "enlarged" | "default";
|
|
22
21
|
onPerformanceMeasured?: (feature: string, elapsedTime: number) => void;
|
|
23
22
|
onFeatureUsed?: (feature: string) => void;
|
|
24
23
|
}
|
|
@@ -27,5 +26,5 @@ export interface TreeSelectorProps {
|
|
|
27
26
|
* allowing to choose which of the provided tree components should be rendered at the bottom.
|
|
28
27
|
* @internal
|
|
29
28
|
*/
|
|
30
|
-
export declare function TreeSelector(
|
|
29
|
+
export declare function TreeSelector({ defaultSelectedContentId, trees, onFeatureUsed, onPerformanceMeasured }: TreeSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
31
30
|
//# sourceMappingURL=TreeSelector.d.ts.map
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
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
6
|
import "./TreeSelector.scss";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Select } from "@itwin/itwinui-react/bricks";
|
|
9
9
|
/**
|
|
10
10
|
* A component that accepts a list of trees and renders a select box at the top,
|
|
11
11
|
* allowing to choose which of the provided tree components should be rendered at the bottom.
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
|
-
export function TreeSelector(
|
|
15
|
-
const [selectedContentId, setSelectedContentId] = useState(
|
|
16
|
-
const selectedContent =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
props.onFeatureUsed?.(`choose-${treeId}`);
|
|
23
|
-
setSelectedContentId(treeId);
|
|
24
|
-
}, itemRenderer: (option, itemProps) => (_jsx(MenuItem, { ...option, isSelected: itemProps.isSelected, size: isEnlarged ? "large" : "default", children: option.label })) })) }), _jsx("div", { className: "presentation-components-tree-selector-content-wrapper", children: selectedContent?.render({ density: props.density, onPerformanceMeasured: props.onPerformanceMeasured, onFeatureUsed: props.onFeatureUsed }) })] }));
|
|
14
|
+
export function TreeSelector({ defaultSelectedContentId, trees, onFeatureUsed, onPerformanceMeasured }) {
|
|
15
|
+
const [selectedContentId, setSelectedContentId] = useState(defaultSelectedContentId);
|
|
16
|
+
const selectedContent = trees.find((c) => c.id === selectedContentId) ?? trees[0];
|
|
17
|
+
return (_jsxs("div", { className: "presentation-components-tree-selector-content", children: [_jsx("div", { className: "presentation-components-tree-selector-content-header", children: trees.length > 0 && (_jsx(Select.Root, { children: _jsx(Select.HtmlSelect, { value: selectedContent.id, onChange: (e) => {
|
|
18
|
+
const treeId = e.target.value;
|
|
19
|
+
onFeatureUsed?.(`choose-${treeId}`);
|
|
20
|
+
setSelectedContentId(treeId);
|
|
21
|
+
}, children: trees.map((tree) => (_jsxs("option", { value: tree.id, children: [tree.startIcon, tree.label] }, tree.id))) }) })) }), _jsx("div", { className: "presentation-components-tree-selector-content-wrapper", children: selectedContent?.render({ onPerformanceMeasured, onFeatureUsed }) })] }));
|
|
25
22
|
}
|
|
26
23
|
//# sourceMappingURL=TreeSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSelector.js","sourceRoot":"","sources":["../../../../src/tree-widget-react/components/TreeSelector.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TreeSelector.js","sourceRoot":"","sources":["../../../../src/tree-widget-react/components/TreeSelector.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AA0BrD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,wBAAwB,EAAE,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAqB;IACvH,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IACrF,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,iBAAiB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAElF,OAAO,CACL,eAAK,SAAS,EAAC,+CAA+C,aAC5D,cAAK,SAAS,EAAC,sDAAsD,YAClE,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CACnB,KAAC,MAAM,CAAC,IAAI,cACV,KAAC,MAAM,CAAC,UAAU,IAChB,KAAK,EAAE,eAAe,CAAC,EAAE,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;4BACd,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;4BAC9B,aAAa,EAAE,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;4BACpC,oBAAoB,CAAC,MAAM,CAAC,CAAC;wBAC/B,CAAC,YAEA,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,kBAAsB,KAAK,EAAE,IAAI,CAAC,EAAE,aACjC,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,KAFA,IAAI,CAAC,EAAE,CAGX,CACV,CAAC,GACgB,GACR,CACf,GACG,EACN,cAAK,SAAS,EAAC,uDAAuD,YAAE,eAAe,EAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC,GAAO,IAC5I,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./TreeSelector.scss\";\nimport { useState } from \"react\";\nimport { Select } from \"@itwin/itwinui-react/bricks\";\n\nimport type { SelectableTreeRenderProps } from \"./SelectableTree.js\";\n\n/**\n * A definition for trees displayed in `TreeSelector`\n * @internal\n */\nexport interface TreeContentDefinition {\n id: string;\n label: string;\n render: (props: SelectableTreeRenderProps) => React.ReactNode;\n startIcon?: React.ReactNode;\n}\n\n/**\n * Props for `TreeSelector`\n * @internal\n */\nexport interface TreeSelectorProps {\n defaultSelectedContentId: string;\n trees: TreeContentDefinition[];\n onPerformanceMeasured?: (feature: string, elapsedTime: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that accepts a list of trees and renders a select box at the top,\n * allowing to choose which of the provided tree components should be rendered at the bottom.\n * @internal\n */\nexport function TreeSelector({ defaultSelectedContentId, trees, onFeatureUsed, onPerformanceMeasured }: TreeSelectorProps) {\n const [selectedContentId, setSelectedContentId] = useState(defaultSelectedContentId);\n const selectedContent = trees.find((c) => c.id === selectedContentId) ?? trees[0];\n\n return (\n <div className=\"presentation-components-tree-selector-content\">\n <div className=\"presentation-components-tree-selector-content-header\">\n {trees.length > 0 && (\n <Select.Root>\n <Select.HtmlSelect\n value={selectedContent.id}\n onChange={(e) => {\n const treeId = e.target.value;\n onFeatureUsed?.(`choose-${treeId}`);\n setSelectedContentId(treeId);\n }}\n >\n {trees.map((tree) => (\n <option key={tree.id} value={tree.id}>\n {tree.startIcon}\n {tree.label}\n </option>\n ))}\n </Select.HtmlSelect>\n </Select.Root>\n )}\n </div>\n <div className=\"presentation-components-tree-selector-content-wrapper\">{selectedContent?.render({ onPerformanceMeasured, onFeatureUsed })}</div>\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import "./TreeWidgetUiItemsProvider.scss";
|
|
3
2
|
import type { Widget } from "@itwin/appui-react";
|
|
4
3
|
import type { SelectableTreeDefinition, SelectableTreeProps } from "./SelectableTree.js";
|
|
@@ -31,6 +30,6 @@ export declare function createTreeWidget(props: TreeWidgetProps): Widget;
|
|
|
31
30
|
* Tree widget component which allows selecting which tree to render.
|
|
32
31
|
* @public
|
|
33
32
|
*/
|
|
34
|
-
export declare function TreeWidgetComponent(props: SelectableTreeProps): JSX.Element;
|
|
33
|
+
export declare function TreeWidgetComponent(props: SelectableTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
35
34
|
export {};
|
|
36
35
|
//# sourceMappingURL=TreeWidgetUiItemsProvider.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
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.
|
|
@@ -8,8 +8,6 @@ import { useRef } from "react";
|
|
|
8
8
|
import { ErrorBoundary } from "react-error-boundary";
|
|
9
9
|
import { StagePanelLocation, StagePanelSection, useTransientState } from "@itwin/appui-react";
|
|
10
10
|
import { SvgHierarchyTree } from "@itwin/itwinui-icons-react";
|
|
11
|
-
import { SvgError } from "@itwin/itwinui-illustrations-react";
|
|
12
|
-
import { Button, NonIdealState } from "@itwin/itwinui-react";
|
|
13
11
|
import { TreeWidget } from "../TreeWidget.js";
|
|
14
12
|
import { SelectableTree } from "./SelectableTree.js";
|
|
15
13
|
/**
|
|
@@ -38,8 +36,8 @@ export function TreeWidgetComponent(props) {
|
|
|
38
36
|
const ref = useTreeWidgetTransientState();
|
|
39
37
|
return (_jsx("div", { ref: ref, className: "tree-widget", children: _jsx(ErrorBoundary, { FallbackComponent: ErrorState, children: _jsx(SelectableTree, { ...props }) }) }));
|
|
40
38
|
}
|
|
41
|
-
function ErrorState({
|
|
42
|
-
return
|
|
39
|
+
function ErrorState({}) {
|
|
40
|
+
return _jsx(_Fragment, { children: " ERROR WINDOW TBD " });
|
|
43
41
|
}
|
|
44
42
|
function useTreeWidgetTransientState() {
|
|
45
43
|
const { ref, persist, restore } = useTreeStorage();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../../src/tree-widget-react/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../../src/tree-widget-react/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4BrD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAsB;IACrD,OAAO;QACL,EAAE,EAAE,yBAAyB;QAC7B,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC;QAC3C,IAAI,EAAE,KAAC,gBAAgB,KAAG;QAC1B,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR,OAAO,EAAE,iBAAiB,CAAC,KAAK;gBAChC,QAAQ,EAAE,kBAAkB,CAAC,KAAK;aACnC;SACF;QACD,OAAO,EAAE,CACP,KAAC,mBAAmB,IAClB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,aAAa,EAAE,KAAK,CAAC,aAAa,GAClC,CACH;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA0B;IAC5D,MAAM,GAAG,GAAG,2BAA2B,EAAE,CAAC;IAC1C,OAAO,CACL,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,aAAa,YACpC,KAAC,aAAa,IAAC,iBAAiB,EAAE,UAAU,YAC1C,KAAC,cAAc,OAAK,KAAK,GAAI,GACf,GACZ,CACP,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,EAAiB;IACnC,OAAO,mDAAuB,CAAC;AACjC,CAAC;AAED,SAAS,2BAA2B;IAClC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IACnD,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAQD,SAAS,cAAc;IACrB,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,MAAM,EAAsB,CAAC;IAE/C,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,OAAO,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,6BAA6B,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;QACjC,SAAS,CAAC,OAAO,GAAG,SAAS,EAAE,SAAS,CAAC;IAC3C,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;YACjC,IAAI,SAAS,IAAI,SAAS,CAAC,OAAO,EAAE;gBAClC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;aACzC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACnC,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 \"./TreeWidgetUiItemsProvider.scss\";\nimport { useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\nimport { StagePanelLocation, StagePanelSection, useTransientState } from \"@itwin/appui-react\";\nimport { SvgHierarchyTree } from \"@itwin/itwinui-icons-react\";\nimport { TreeWidget } from \"../TreeWidget.js\";\nimport { SelectableTree } from \"./SelectableTree.js\";\n\nimport type { Widget } from \"@itwin/appui-react\";\nimport type { SelectableTreeDefinition, SelectableTreeProps } from \"./SelectableTree.js\";\nimport type { FallbackProps } from \"react-error-boundary\";\nimport type { Ref } from \"react\";\n\n/**\n * Props for `createWidget`.\n * @public\n */\ninterface TreeWidgetProps {\n /**\n * Trees to show in the widget.\n * @see ModelsTreeComponent\n * @see CategoriesTreeComponent\n * @see ExternalSourcesTreeComponent\n * @see IModelContentTreeComponent\n */\n trees: SelectableTreeDefinition[];\n /** Modifies the density of the tree widget. `enlarged` widget contains larger content */\n density?: \"enlarged\" | \"default\";\n /** Callback that is invoked when performance of tracked feature is measured. */\n onPerformanceMeasured?: (feature: string, elapsedTime: number) => void;\n /** Callback that is invoked when a tracked feature is used. */\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * Creates a tree widget definition that should be returned from `UiItemsProvider.getWidgets()`.\n * @public\n */\nexport function createTreeWidget(props: TreeWidgetProps): Widget {\n return {\n id: \"tree-widget-react:trees\",\n label: TreeWidget.translate(\"widget.label\"),\n icon: <SvgHierarchyTree />,\n layouts: {\n standard: {\n section: StagePanelSection.Start,\n location: StagePanelLocation.Right,\n },\n },\n content: (\n <TreeWidgetComponent\n trees={props.trees}\n density={props.density}\n onPerformanceMeasured={props.onPerformanceMeasured}\n onFeatureUsed={props.onFeatureUsed}\n />\n ),\n };\n}\n\n/**\n * Tree widget component which allows selecting which tree to render.\n * @public\n */\nexport function TreeWidgetComponent(props: SelectableTreeProps) {\n const ref = useTreeWidgetTransientState();\n return (\n <div ref={ref} className=\"tree-widget\">\n <ErrorBoundary FallbackComponent={ErrorState}>\n <SelectableTree {...props} />\n </ErrorBoundary>\n </div>\n );\n}\n\nfunction ErrorState({}: FallbackProps) {\n return <> ERROR WINDOW TBD </>;\n}\n\nfunction useTreeWidgetTransientState() {\n const { ref, persist, restore } = useTreeStorage();\n useTransientState(persist, restore);\n return ref;\n}\n\ninterface UseTreeStorageResult {\n ref: Ref<HTMLDivElement>;\n persist: () => void;\n restore: () => void;\n}\n\nfunction useTreeStorage(): UseTreeStorageResult {\n const ref = useRef<HTMLDivElement>(null);\n const scrollTop = useRef<number | undefined>();\n\n const getContainer = () => {\n return ref.current?.querySelector(\"#tw-tree-renderer-container\");\n };\n\n const persist = () => {\n const container = getContainer();\n scrollTop.current = container?.scrollTop;\n };\n\n const restore = () => {\n setTimeout(() => {\n const container = getContainer();\n if (container && scrollTop.current) {\n container.scrollTop = scrollTop.current;\n }\n });\n };\n\n return { ref, persist, restore };\n}\n"]}
|
|
@@ -4,7 +4,6 @@ import type { Viewport } from "@itwin/core-frontend";
|
|
|
4
4
|
/** @public */
|
|
5
5
|
export interface TreeHeaderButtonProps {
|
|
6
6
|
viewport: Viewport;
|
|
7
|
-
density?: "default" | "enlarged";
|
|
8
7
|
onFeatureUsed?: (feature: string) => void;
|
|
9
8
|
}
|
|
10
9
|
/** @beta */
|
|
@@ -28,6 +27,6 @@ interface TreeHeaderProps {
|
|
|
28
27
|
density?: "default" | "enlarged";
|
|
29
28
|
className?: string;
|
|
30
29
|
}
|
|
31
|
-
export declare function TreeHeader(props: PropsWithChildren<TreeHeaderProps>): JSX.Element;
|
|
30
|
+
export declare function TreeHeader(props: PropsWithChildren<TreeHeaderProps>): import("react/jsx-runtime").JSX.Element;
|
|
32
31
|
export {};
|
|
33
32
|
//# sourceMappingURL=TreeHeader.d.ts.map
|