@itwin/tree-widget-react 3.4.1 → 4.0.0-alpha.0
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 +18 -25
- 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/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BeEvent } from "@itwin/core-bentley";
|
|
2
|
-
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
3
|
-
import type { Viewport } from "@itwin/core-frontend";
|
|
4
|
-
import type { HierarchyVisibilityHandler, VisibilityStatus } from "../common/UseHierarchyVisibility.js";
|
|
5
|
-
interface CategoriesVisibilityHandlerProps {
|
|
6
|
-
viewport: Viewport;
|
|
7
|
-
}
|
|
8
|
-
/** @internal */
|
|
9
|
-
export declare class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {
|
|
10
|
-
private _pendingVisibilityChange;
|
|
11
|
-
private _viewport;
|
|
12
|
-
constructor(props: CategoriesVisibilityHandlerProps);
|
|
13
|
-
dispose(): void;
|
|
14
|
-
onVisibilityChange: BeEvent<import("@itwin/core-bentley").Listener>;
|
|
15
|
-
/** Returns visibility status of the tree node. */
|
|
16
|
-
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
|
|
17
|
-
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
18
|
-
getSubCategoryVisibility(node: HierarchyNode): "visible" | "hidden";
|
|
19
|
-
getCategoryVisibility(node: HierarchyNode): "visible" | "hidden";
|
|
20
|
-
private onDisplayStyleChanged;
|
|
21
|
-
private onViewedCategoriesChanged;
|
|
22
|
-
private onVisibilityChangeInternal;
|
|
23
|
-
static getInstanceIdFromHierarchyNode(node: HierarchyNode): string;
|
|
24
|
-
enableCategory(ids: string[], enabled: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
25
|
-
enableSubCategory(key: string, enabled: boolean): void;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=CategoriesVisibilityHandler.d.ts.map
|
package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.CategoriesVisibilityHandler = void 0;
|
|
8
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
|
-
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
10
|
-
const CategoriesVisibilityUtils_js_1 = require("../common/CategoriesVisibilityUtils.js");
|
|
11
|
-
const Tooltip_js_1 = require("../common/Tooltip.js");
|
|
12
|
-
/** @internal */
|
|
13
|
-
class CategoriesVisibilityHandler {
|
|
14
|
-
constructor(props) {
|
|
15
|
-
this.onVisibilityChange = new core_bentley_1.BeEvent();
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
-
this.onDisplayStyleChanged = () => {
|
|
18
|
-
this.onVisibilityChangeInternal();
|
|
19
|
-
};
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
21
|
-
this.onViewedCategoriesChanged = () => {
|
|
22
|
-
this.onVisibilityChangeInternal();
|
|
23
|
-
};
|
|
24
|
-
this._viewport = props.viewport;
|
|
25
|
-
this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);
|
|
26
|
-
this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);
|
|
27
|
-
}
|
|
28
|
-
dispose() {
|
|
29
|
-
this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);
|
|
30
|
-
this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);
|
|
31
|
-
clearTimeout(this._pendingVisibilityChange);
|
|
32
|
-
}
|
|
33
|
-
/** Returns visibility status of the tree node. */
|
|
34
|
-
getVisibilityStatus(node) {
|
|
35
|
-
if (!presentation_hierarchies_1.HierarchyNode.isInstancesNode(node)) {
|
|
36
|
-
return { state: "hidden", isDisabled: true };
|
|
37
|
-
}
|
|
38
|
-
return (0, Tooltip_js_1.createVisibilityStatus)(node.parentKeys.length ? this.getSubCategoryVisibility(node) : this.getCategoryVisibility(node));
|
|
39
|
-
}
|
|
40
|
-
async changeVisibility(node, on) {
|
|
41
|
-
if (!presentation_hierarchies_1.HierarchyNode.isInstancesNode(node)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
// handle subcategory visibility change
|
|
45
|
-
if (node.parentKeys.length) {
|
|
46
|
-
const childId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
47
|
-
const parentCategoryId = node.extendedData?.categoryId;
|
|
48
|
-
// make sure parent category is enabled
|
|
49
|
-
if (on && parentCategoryId) {
|
|
50
|
-
await this.enableCategory([parentCategoryId], true, false);
|
|
51
|
-
}
|
|
52
|
-
this.enableSubCategory(childId, on);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
56
|
-
await this.enableCategory([instanceId], on, true);
|
|
57
|
-
}
|
|
58
|
-
getSubCategoryVisibility(node) {
|
|
59
|
-
const parentCategoryId = node.extendedData?.categoryId;
|
|
60
|
-
if (!parentCategoryId) {
|
|
61
|
-
return "hidden";
|
|
62
|
-
}
|
|
63
|
-
const subcategoryId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
64
|
-
const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);
|
|
65
|
-
return isVisible ? "visible" : "hidden";
|
|
66
|
-
}
|
|
67
|
-
getCategoryVisibility(node) {
|
|
68
|
-
const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
69
|
-
return this._viewport.view.viewsCategory(instanceId) ? "visible" : "hidden";
|
|
70
|
-
}
|
|
71
|
-
onVisibilityChangeInternal() {
|
|
72
|
-
if (this._pendingVisibilityChange) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
this._pendingVisibilityChange = setTimeout(() => {
|
|
76
|
-
this.onVisibilityChange.raiseEvent();
|
|
77
|
-
this._pendingVisibilityChange = undefined;
|
|
78
|
-
}, 0);
|
|
79
|
-
}
|
|
80
|
-
static getInstanceIdFromHierarchyNode(node) {
|
|
81
|
-
return presentation_hierarchies_1.HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : "";
|
|
82
|
-
}
|
|
83
|
-
async enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
84
|
-
await (0, CategoriesVisibilityUtils_js_1.enableCategoryDisplay)(this._viewport, ids, enabled, enableAllSubCategories);
|
|
85
|
-
}
|
|
86
|
-
enableSubCategory(key, enabled) {
|
|
87
|
-
(0, CategoriesVisibilityUtils_js_1.enableSubCategoryDisplay)(this._viewport, key, enabled);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.CategoriesVisibilityHandler = CategoriesVisibilityHandler;
|
|
91
|
-
//# sourceMappingURL=CategoriesVisibilityHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAA8C;AAC9C,8EAAgE;AAChE,yFAAyG;AACzG,qDAA8D;AAS9D,gBAAgB;AAChB,MAAa,2BAA2B;IAItC,YAAY,KAAuC;QAY5C,uBAAkB,GAAG,IAAI,sBAAO,EAAE,CAAC;QAiD1C,gEAAgE;QACxD,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QAEF,gEAAgE;QACxD,8BAAyB,GAAG,GAAG,EAAE;YACvC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QApEA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACvF,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,SAAS,CAAC,qBAA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IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpH,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAa,EAAE,OAAgB,EAAE,sBAAsB,GAAG,IAAI;QACxF,MAAM,IAAA,oDAAqB,EAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACpF,CAAC;IAEM,iBAAiB,CAAC,GAAW,EAAE,OAAgB;QACpD,IAAA,uDAAwB,EAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACF;AAjGD,kEAiGC","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { enableCategoryDisplay, enableSubCategoryDisplay } from \"../common/CategoriesVisibilityUtils.js\";\nimport { createVisibilityStatus } from \"../common/Tooltip.js\";\n\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../common/UseHierarchyVisibility.js\";\n\ninterface CategoriesVisibilityHandlerProps {\n viewport: Viewport;\n}\n\n/** @internal */\nexport class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {\n private _pendingVisibilityChange: any;\n private _viewport: Viewport;\n\n constructor(props: CategoriesVisibilityHandlerProps) {\n this._viewport = props.viewport;\n this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n\n public dispose() {\n this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent();\n\n /** Returns visibility status of the tree node. */\n public getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus {\n if (!HierarchyNode.isInstancesNode(node)) {\n return { state: \"hidden\", isDisabled: true };\n }\n return createVisibilityStatus(node.parentKeys.length ? this.getSubCategoryVisibility(node) : this.getCategoryVisibility(node));\n }\n\n public async changeVisibility(node: HierarchyNode, on: boolean) {\n if (!HierarchyNode.isInstancesNode(node)) {\n return;\n }\n\n // handle subcategory visibility change\n if (node.parentKeys.length) {\n const childId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n const parentCategoryId = node.extendedData?.categoryId;\n\n // make sure parent category is enabled\n if (on && parentCategoryId) {\n await this.enableCategory([parentCategoryId], true, false);\n }\n\n this.enableSubCategory(childId, on);\n return;\n }\n\n const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n await this.enableCategory([instanceId], on, true);\n }\n\n public getSubCategoryVisibility(node: HierarchyNode) {\n const parentCategoryId = node.extendedData?.categoryId;\n if (!parentCategoryId) {\n return \"hidden\";\n }\n\n const subcategoryId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);\n return isVisible ? \"visible\" : \"hidden\";\n }\n\n public getCategoryVisibility(node: HierarchyNode) {\n const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n return this._viewport.view.viewsCategory(instanceId) ? \"visible\" : \"hidden\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onDisplayStyleChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onViewedCategoriesChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onVisibilityChangeInternal() {\n if (this._pendingVisibilityChange) {\n return;\n }\n\n this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n public static getInstanceIdFromHierarchyNode(node: HierarchyNode) {\n return HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : \"\";\n }\n\n public async enableCategory(ids: string[], enabled: boolean, enableAllSubCategories = true) {\n await enableCategoryDisplay(this._viewport, ids, enabled, enableAllSubCategories);\n }\n\n public enableSubCategory(key: string, enabled: boolean) {\n enableSubCategoryDisplay(this._viewport, key, enabled);\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { VisibilityTreeProps } from "../common/components/VisibilityTree.js";
|
|
2
|
-
import type { Viewport } from "@itwin/core-frontend";
|
|
3
|
-
import type { VisibilityTreeRendererProps } from "../common/components/VisibilityTreeRenderer.js";
|
|
4
|
-
import type { CategoryInfo } from "../common/CategoriesVisibilityUtils.js";
|
|
5
|
-
/** @beta */
|
|
6
|
-
export interface UseCategoriesTreeProps {
|
|
7
|
-
filter: string;
|
|
8
|
-
activeView: Viewport;
|
|
9
|
-
onCategoriesFiltered?: (categories: CategoryInfo[] | undefined) => void;
|
|
10
|
-
}
|
|
11
|
-
/** @beta */
|
|
12
|
-
interface UseCategoriesTreeResult {
|
|
13
|
-
categoriesTreeProps: Pick<VisibilityTreeProps, "treeName" | "getHierarchyDefinition" | "getFilteredPaths" | "visibilityHandlerFactory" | "highlight" | "noDataMessage">;
|
|
14
|
-
rendererProps: Required<Pick<VisibilityTreeRendererProps, "getIcon" | "getSublabel">>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Custom hook to create and manage state for the categories tree.
|
|
18
|
-
* @beta
|
|
19
|
-
*/
|
|
20
|
-
export declare function useCategoriesTree({ filter, activeView, onCategoriesFiltered }: UseCategoriesTreeProps): UseCategoriesTreeResult;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=UseCategoriesTree.d.ts.map
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useCategoriesTree = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
/*---------------------------------------------------------------------------------------------
|
|
6
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
-
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
11
|
-
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
12
|
-
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
13
|
-
const TreeWidget_js_1 = require("../../../TreeWidget.js");
|
|
14
|
-
const TreeErrors_js_1 = require("../common/TreeErrors.js");
|
|
15
|
-
const UseTelemetryContext_js_1 = require("../common/UseTelemetryContext.js");
|
|
16
|
-
const CategoriesTreeDefinition_js_1 = require("./CategoriesTreeDefinition.js");
|
|
17
|
-
const CategoriesVisibilityHandler_js_1 = require("./CategoriesVisibilityHandler.js");
|
|
18
|
-
/**
|
|
19
|
-
* Custom hook to create and manage state for the categories tree.
|
|
20
|
-
* @beta
|
|
21
|
-
*/
|
|
22
|
-
function useCategoriesTree({ filter, activeView, onCategoriesFiltered }) {
|
|
23
|
-
const [filteringError, setFilteringError] = (0, react_1.useState)();
|
|
24
|
-
const visibilityHandlerFactory = (0, react_1.useCallback)(() => {
|
|
25
|
-
const visibilityHandler = new CategoriesVisibilityHandler_js_1.CategoriesVisibilityHandler({
|
|
26
|
-
viewport: activeView,
|
|
27
|
-
});
|
|
28
|
-
return {
|
|
29
|
-
getVisibilityStatus: async (node) => visibilityHandler.getVisibilityStatus(node),
|
|
30
|
-
changeVisibility: async (node, on) => visibilityHandler.changeVisibility(node, on),
|
|
31
|
-
onVisibilityChange: visibilityHandler.onVisibilityChange,
|
|
32
|
-
dispose: () => visibilityHandler.dispose(),
|
|
33
|
-
};
|
|
34
|
-
}, [activeView]);
|
|
35
|
-
const { onFeatureUsed } = (0, UseTelemetryContext_js_1.useTelemetryContext)();
|
|
36
|
-
const getHierarchyDefinition = (0, react_1.useCallback)((props) => {
|
|
37
|
-
return new CategoriesTreeDefinition_js_1.CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
38
|
-
}, [activeView]);
|
|
39
|
-
const getFilteredPaths = (0, react_1.useMemo)(() => {
|
|
40
|
-
setFilteringError(undefined);
|
|
41
|
-
onCategoriesFiltered?.(undefined);
|
|
42
|
-
if (!filter) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
return async ({ imodelAccess }) => {
|
|
46
|
-
onFeatureUsed({ featureId: "filtering", reportInteraction: true });
|
|
47
|
-
try {
|
|
48
|
-
const paths = await CategoriesTreeDefinition_js_1.CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
49
|
-
onCategoriesFiltered?.(getCategories(paths));
|
|
50
|
-
return paths;
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
const newError = e instanceof TreeErrors_js_1.FilterLimitExceededError ? "tooManyFilterMatches" : "unknownFilterError";
|
|
54
|
-
if (newError !== "tooManyFilterMatches") {
|
|
55
|
-
const feature = e instanceof Error && e.message.includes("query too long to execute or server is too busy") ? "error-timeout" : "error-unknown";
|
|
56
|
-
onFeatureUsed({ featureId: feature, reportInteraction: false });
|
|
57
|
-
}
|
|
58
|
-
setFilteringError(newError);
|
|
59
|
-
return [];
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}, [filter, activeView, onFeatureUsed, onCategoriesFiltered]);
|
|
63
|
-
return {
|
|
64
|
-
categoriesTreeProps: {
|
|
65
|
-
treeName: "categories-tree-v2",
|
|
66
|
-
getHierarchyDefinition,
|
|
67
|
-
getFilteredPaths,
|
|
68
|
-
visibilityHandlerFactory,
|
|
69
|
-
noDataMessage: getNoDataMessage(filter, filteringError),
|
|
70
|
-
highlight: filter ? { text: filter } : undefined,
|
|
71
|
-
},
|
|
72
|
-
rendererProps: {
|
|
73
|
-
getIcon,
|
|
74
|
-
getSublabel,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
exports.useCategoriesTree = useCategoriesTree;
|
|
79
|
-
function getCategories(paths) {
|
|
80
|
-
if (!paths) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
const categories = new Map();
|
|
84
|
-
for (const path of paths) {
|
|
85
|
-
const currPath = Array.isArray(path) ? path : path.path;
|
|
86
|
-
const [category, subCategory] = currPath;
|
|
87
|
-
if (!presentation_hierarchies_1.HierarchyNodeIdentifier.isInstanceNodeIdentifier(category)) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (!categories.has(category.id)) {
|
|
91
|
-
categories.set(category.id, []);
|
|
92
|
-
}
|
|
93
|
-
if (subCategory && presentation_hierarchies_1.HierarchyNodeIdentifier.isInstanceNodeIdentifier(subCategory)) {
|
|
94
|
-
categories.get(category.id).push(subCategory.id);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return [...categories.entries()].map(([categoryId, subCategoryIds]) => ({
|
|
98
|
-
categoryId,
|
|
99
|
-
subCategoryIds: subCategoryIds.length === 0 ? undefined : subCategoryIds,
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
function getNoDataMessage(filter, error) {
|
|
103
|
-
if (error) {
|
|
104
|
-
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_js_1.TreeWidget.translate(`categoriesTree.filtering.${error}`) });
|
|
105
|
-
}
|
|
106
|
-
if (filter) {
|
|
107
|
-
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_js_1.TreeWidget.translate("categoriesTree.filtering.noMatches", { filter }) });
|
|
108
|
-
}
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
function getIcon() {
|
|
112
|
-
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgLayers, {});
|
|
113
|
-
}
|
|
114
|
-
function getSublabel(node) {
|
|
115
|
-
return node.extendedData?.description;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=UseCategoriesTree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseCategoriesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAuD;AACvD,oEAAuD;AACvD,wDAA4C;AAC5C,8EAA0E;AAC1E,0DAAoD;AACpD,2DAAmE;AACnE,6EAAuE;AACvE,+EAAyE;AACzE,qFAA+E;AA6B/E;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAA0B;IACpG,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,GAA4C,CAAC;IACjG,MAAM,wBAAwB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAChD,MAAM,iBAAiB,GAAG,IAAI,4DAA2B,CAAC;YACxD,QAAQ,EAAE,UAAU;SACrB,CAAC,CAAC;QACH,OAAO;YACL,mBAAmB,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAC/F,gBAAgB,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1G,kBAAkB,EAAE,iBAAiB,CAAC,kBAAkB;YACxD,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE;SA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S;SACV;QAED,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;YAChC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;SACjC;QAED,IAAI,WAAW,IAAI,kDAAuB,CAAC,wBAAwB,CAAC,WAAW,CAAC,EAAE;YAChF,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;SACnD;KACF;IAED,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;QACtE,UAAU;QACV,cAAc,EAAE,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc;KACzE,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc,EAAE,KAAoC;IAC5E,IAAI,KAAK,EAAE;QACT,OAAO,uBAAC,oBAAI,cAAE,0BAAU,CAAC,SAAS,CAAC,4BAA4B,KAAK,EAAE,CAAC,GAAQ,CAAC;KACjF;IACD,IAAI,MAAM,EAAE;QACV,OAAO,uBAAC,oBAAI,cAAE,0BAAU,CAAC,SAAS,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAQ,CAAC;KAC9F;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO;IACd,OAAO,uBAAC,+BAAS,KAAG,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAAC,IAA+B;IAClD,OAAO,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC;AACxC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport { SvgLayers } from \"@itwin/itwinui-icons-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { HierarchyNodeIdentifier } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { FilterLimitExceededError } from \"../common/TreeErrors.js\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext.js\";\nimport { CategoriesTreeDefinition } from \"./CategoriesTreeDefinition.js\";\nimport { CategoriesVisibilityHandler } from \"./CategoriesVisibilityHandler.js\";\n\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { VisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils.js\";\n\ntype CategoriesTreeFilteringError = \"tooManyFilterMatches\" | \"unknownFilterError\";\ntype HierarchyFilteringPaths = Awaited<ReturnType<Required<VisibilityTreeProps>[\"getFilteredPaths\"]>>;\n\n/** @beta */\nexport interface UseCategoriesTreeProps {\n filter: string;\n activeView: Viewport;\n onCategoriesFiltered?: (categories: CategoryInfo[] | undefined) => void;\n}\n\n/** @beta */\ninterface UseCategoriesTreeResult {\n categoriesTreeProps: Pick<\n VisibilityTreeProps,\n \"treeName\" | \"getHierarchyDefinition\" | \"getFilteredPaths\" | \"visibilityHandlerFactory\" | \"highlight\" | \"noDataMessage\"\n >;\n rendererProps: Required<Pick<VisibilityTreeRendererProps, \"getIcon\" | \"getSublabel\">>;\n}\n\n/**\n * Custom hook to create and manage state for the categories tree.\n * @beta\n */\nexport function useCategoriesTree({ filter, activeView, onCategoriesFiltered }: UseCategoriesTreeProps): UseCategoriesTreeResult {\n const [filteringError, setFilteringError] = useState<CategoriesTreeFilteringError | undefined>();\n const visibilityHandlerFactory = useCallback(() => {\n const visibilityHandler = new CategoriesVisibilityHandler({\n viewport: activeView,\n });\n return {\n getVisibilityStatus: async (node: HierarchyNode) => visibilityHandler.getVisibilityStatus(node),\n changeVisibility: async (node: HierarchyNode, on: boolean) => visibilityHandler.changeVisibility(node, on),\n onVisibilityChange: visibilityHandler.onVisibilityChange,\n dispose: () => visibilityHandler.dispose(),\n };\n }, [activeView]);\n const { onFeatureUsed } = useTelemetryContext();\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n (props) => {\n return new CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? \"2d\" : \"3d\" });\n },\n [activeView],\n );\n\n const getFilteredPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n onCategoriesFiltered?.(undefined);\n if (!filter) {\n return undefined;\n }\n return async ({ imodelAccess }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n const paths = await CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? \"2d\" : \"3d\" });\n onCategoriesFiltered?.(getCategories(paths));\n return paths;\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }, [filter, activeView, onFeatureUsed, onCategoriesFiltered]);\n\n return {\n categoriesTreeProps: {\n treeName: \"categories-tree-v2\",\n getHierarchyDefinition,\n getFilteredPaths,\n visibilityHandlerFactory,\n noDataMessage: getNoDataMessage(filter, filteringError),\n highlight: filter ? { text: filter } : undefined,\n },\n rendererProps: {\n getIcon,\n getSublabel,\n },\n };\n}\n\nfunction getCategories(paths: HierarchyFilteringPaths): CategoryInfo[] | undefined {\n if (!paths) {\n return undefined;\n }\n\n const categories = new Map<Id64String, Id64String[]>();\n for (const path of paths) {\n const currPath = Array.isArray(path) ? path : path.path;\n const [category, subCategory] = currPath;\n\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(category)) {\n continue;\n }\n\n if (!categories.has(category.id)) {\n categories.set(category.id, []);\n }\n\n if (subCategory && HierarchyNodeIdentifier.isInstanceNodeIdentifier(subCategory)) {\n categories.get(category.id)!.push(subCategory.id);\n }\n }\n\n return [...categories.entries()].map(([categoryId, subCategoryIds]) => ({\n categoryId,\n subCategoryIds: subCategoryIds.length === 0 ? undefined : subCategoryIds,\n }));\n}\n\nfunction getNoDataMessage(filter: string, error?: CategoriesTreeFilteringError) {\n if (error) {\n return <Text>{TreeWidget.translate(`categoriesTree.filtering.${error}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"categoriesTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction getIcon() {\n return <SvgLayers />;\n}\n\nfunction getSublabel(node: PresentationHierarchyNode) {\n return node.extendedData?.description;\n}\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Viewport } from "@itwin/core-frontend";
|
|
2
|
-
/**
|
|
3
|
-
* Data structure that describes category.
|
|
4
|
-
* @beta
|
|
5
|
-
*/
|
|
6
|
-
export interface CategoryInfo {
|
|
7
|
-
categoryId: string;
|
|
8
|
-
subCategoryIds?: string[];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Toggles visibility of categories to show or hide.
|
|
12
|
-
*/
|
|
13
|
-
export declare function toggleAllCategories(viewport: Viewport, display: boolean): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Gets ids of all categories from specified imodel and viewport.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getCategories(viewport: Viewport): Promise<string[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Changes category display in the viewport.
|
|
20
|
-
*/
|
|
21
|
-
export declare function enableCategoryDisplay(viewport: Viewport, ids: string[], enabled: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Changes subcategory display in the viewport
|
|
24
|
-
*/
|
|
25
|
-
export declare function enableSubCategoryDisplay(viewport: Viewport, key: string, enabled: boolean): void;
|
|
26
|
-
export declare function loadCategoriesFromViewport(vp: Viewport): Promise<CategoryInfo[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Enable display of all given categories.
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export declare function showAllCategories(categories: string[], viewport: Viewport): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Disable display of all given categories.
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
export declare function hideAllCategories(categories: string[], viewport: Viewport): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Invert display of all given categories.
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare function invertAllCategories(categories: CategoryInfo[], viewport: Viewport): Promise<void>;
|
|
42
|
-
//# sourceMappingURL=CategoriesVisibilityUtils.d.ts.map
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.invertAllCategories = exports.hideAllCategories = exports.showAllCategories = exports.loadCategoriesFromViewport = exports.enableSubCategoryDisplay = exports.enableCategoryDisplay = exports.getCategories = exports.toggleAllCategories = void 0;
|
|
8
|
-
const core_common_1 = require("@itwin/core-common");
|
|
9
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
10
|
-
/**
|
|
11
|
-
* Toggles visibility of categories to show or hide.
|
|
12
|
-
*/
|
|
13
|
-
async function toggleAllCategories(viewport, display) {
|
|
14
|
-
const ids = await getCategories(viewport);
|
|
15
|
-
if (ids.length === 0) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
await enableCategoryDisplay(viewport, ids, display);
|
|
19
|
-
}
|
|
20
|
-
exports.toggleAllCategories = toggleAllCategories;
|
|
21
|
-
/**
|
|
22
|
-
* Gets ids of all categories from specified imodel and viewport.
|
|
23
|
-
*/
|
|
24
|
-
async function getCategories(viewport) {
|
|
25
|
-
const categories = await loadCategoriesFromViewport(viewport);
|
|
26
|
-
return categories.map((category) => category.categoryId);
|
|
27
|
-
}
|
|
28
|
-
exports.getCategories = getCategories;
|
|
29
|
-
/**
|
|
30
|
-
* Changes category display in the viewport.
|
|
31
|
-
*/
|
|
32
|
-
async function enableCategoryDisplay(viewport, ids, enabled, enableAllSubCategories = true) {
|
|
33
|
-
viewport.changeCategoryDisplay(ids, enabled, enableAllSubCategories);
|
|
34
|
-
// remove category overrides per model
|
|
35
|
-
const modelsContainingOverrides = [];
|
|
36
|
-
for (const ovr of viewport.perModelCategoryVisibility) {
|
|
37
|
-
if (ids.findIndex((id) => id === ovr.categoryId) !== -1) {
|
|
38
|
-
modelsContainingOverrides.push(ovr.modelId);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
viewport.perModelCategoryVisibility.setOverride(modelsContainingOverrides, ids, core_frontend_1.PerModelCategoryVisibility.Override.None);
|
|
42
|
-
// changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.
|
|
43
|
-
if (false === enabled) {
|
|
44
|
-
(await viewport.iModel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {
|
|
45
|
-
categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewport, value.id, false));
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.enableCategoryDisplay = enableCategoryDisplay;
|
|
50
|
-
/**
|
|
51
|
-
* Changes subcategory display in the viewport
|
|
52
|
-
*/
|
|
53
|
-
function enableSubCategoryDisplay(viewport, key, enabled) {
|
|
54
|
-
viewport.changeSubCategoryDisplay(key, enabled);
|
|
55
|
-
}
|
|
56
|
-
exports.enableSubCategoryDisplay = enableSubCategoryDisplay;
|
|
57
|
-
async function loadCategoriesFromViewport(vp) {
|
|
58
|
-
// Query categories and add them to state
|
|
59
|
-
const selectUsedSpatialCategoryIds = "SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)";
|
|
60
|
-
const selectUsedDrawingCategoryIds = "SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)";
|
|
61
|
-
const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;
|
|
62
|
-
const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? "BisCore.SpatialCategory" : "BisCore.DrawingCategory"} WHERE ECInstanceId IN (${ecsql})`;
|
|
63
|
-
const categories = [];
|
|
64
|
-
const rows = await vp.iModel.createQueryReader(ecsql2, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }).toArray();
|
|
65
|
-
(await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {
|
|
66
|
-
categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });
|
|
67
|
-
});
|
|
68
|
-
return categories;
|
|
69
|
-
}
|
|
70
|
-
exports.loadCategoriesFromViewport = loadCategoriesFromViewport;
|
|
71
|
-
/**
|
|
72
|
-
* Enable display of all given categories.
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
async function showAllCategories(categories, viewport) {
|
|
76
|
-
await enableCategoryDisplay(viewport, categories, true, true);
|
|
77
|
-
}
|
|
78
|
-
exports.showAllCategories = showAllCategories;
|
|
79
|
-
/**
|
|
80
|
-
* Disable display of all given categories.
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
async function hideAllCategories(categories, viewport) {
|
|
84
|
-
await enableCategoryDisplay(viewport, categories, false, true);
|
|
85
|
-
}
|
|
86
|
-
exports.hideAllCategories = hideAllCategories;
|
|
87
|
-
/**
|
|
88
|
-
* Invert display of all given categories.
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
async function invertAllCategories(categories, viewport) {
|
|
92
|
-
const enabled = [];
|
|
93
|
-
const disabled = [];
|
|
94
|
-
const enabledSubCategories = [];
|
|
95
|
-
const disabledSubCategories = [];
|
|
96
|
-
for (const category of categories) {
|
|
97
|
-
if (!viewport.view.viewsCategory(category.categoryId)) {
|
|
98
|
-
disabled.push(category.categoryId);
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
// First, we need to check if at least one subcategory is disabled. If it is true, then only subcategories should change display, not categories.
|
|
102
|
-
if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {
|
|
103
|
-
for (const subCategory of category.subCategoryIds) {
|
|
104
|
-
viewport.isSubCategoryVisible(subCategory) ? enabledSubCategories.push(subCategory) : disabledSubCategories.push(subCategory);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
enabled.push(category.categoryId);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// Disable enabled
|
|
112
|
-
enabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(viewport, subCategory, false));
|
|
113
|
-
await enableCategoryDisplay(viewport, enabled, false, true);
|
|
114
|
-
// Enable disabled
|
|
115
|
-
disabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(viewport, subCategory, true));
|
|
116
|
-
await enableCategoryDisplay(viewport, disabled, true, true);
|
|
117
|
-
}
|
|
118
|
-
exports.invertAllCategories = invertAllCategories;
|
|
119
|
-
//# sourceMappingURL=CategoriesVisibilityUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,oDAAoD;AACpD,wDAAkE;AAalE;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAAC,QAAkB,EAAE,OAAgB;IAC5E,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO;KACR;IAED,MAAM,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAPD,kDAOC;AAED;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,QAAkB;IACpD,MAAM,UAAU,GAAG,MAAM,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IAC9D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC3D,CAAC;AAHD,sCAGC;AAED;;GAEG;AACI,KAAK,UAAU,qBAAqB,CAAC,QAAkB,EAAE,GAAa,EAAE,OAAgB,EAAE,sBAAsB,GAAG,IAAI;IAC5H,QAAQ,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IAErE,sCAAsC;IACtC,MAAM,yBAAyB,GAAa,EAAE,CAAC;IAC/C,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,0BAA0B,EAAE;QACrD,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE;YACvD,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,C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QAAQ,CAAC,UAAU,CAAC,EAAE;YACrD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACnC,SAAS;SACV;QACD,iJAAiJ;QACjJ,IAAI,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,EAAE;YAC/F,KAAK,MAAM,WAAW,IAAI,QAAQ,CAAC,cAAc,EAAE;gBACjD,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;aAC/H;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SACnC;KACF;IAED,kBAAkB;IAClB,oBAAoB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,wBAAwB,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;IAEtG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5D,kBAAkB;IAClB,qBAAqB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,wBAAwB,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;IAEtG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC;AA9BD,kDA8BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { PerModelCategoryVisibility } from \"@itwin/core-frontend\";\n\nimport type { Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Data structure that describes category.\n * @beta\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Toggles visibility of categories to show or hide.\n */\nexport async function toggleAllCategories(viewport: Viewport, display: boolean) {\n const ids = await getCategories(viewport);\n if (ids.length === 0) {\n return;\n }\n\n await enableCategoryDisplay(viewport, ids, display);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n */\nexport async function getCategories(viewport: Viewport) {\n const categories = await loadCategoriesFromViewport(viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/**\n * Changes category display in the viewport.\n */\nexport async function enableCategoryDisplay(viewport: Viewport, ids: string[], enabled: boolean, enableAllSubCategories = true) {\n viewport.changeCategoryDisplay(ids, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of viewport.perModelCategoryVisibility) {\n if (ids.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n viewport.perModelCategoryVisibility.setOverride(modelsContainingOverrides, ids, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await viewport.iModel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewport, value.id, false));\n });\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n */\nexport function enableSubCategoryDisplay(viewport: Viewport, key: string, enabled: boolean) {\n viewport.changeSubCategoryDisplay(key, enabled);\n}\n\nexport async function loadCategoriesFromViewport(vp: Viewport) {\n // Query categories and add them to state\n const selectUsedSpatialCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)\";\n const selectUsedDrawingCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)\";\n const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;\n const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? \"BisCore.SpatialCategory\" : \"BisCore.DrawingCategory\"} WHERE ECInstanceId IN (${ecsql})`;\n\n const categories: CategoryInfo[] = [];\n\n const rows = await vp.iModel.createQueryReader(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n return categories;\n}\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(viewport, categories, true, true);\n}\n\n/**\n * Disable display of all given categories.\n * @public\n */\nexport async function hideAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(viewport, categories, false, true);\n}\n\n/**\n * Invert display of all given categories.\n * @public\n */\nexport async function invertAllCategories(categories: CategoryInfo[], viewport: Viewport) {\n const enabled: string[] = [];\n const disabled: string[] = [];\n const enabledSubCategories: string[] = [];\n const disabledSubCategories: string[] = [];\n\n for (const category of categories) {\n if (!viewport.view.viewsCategory(category.categoryId)) {\n disabled.push(category.categoryId);\n continue;\n }\n // First, we need to check if at least one subcategory is disabled. If it is true, then only subcategories should change display, not categories.\n if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {\n for (const subCategory of category.subCategoryIds) {\n viewport.isSubCategoryVisible(subCategory) ? enabledSubCategories.push(subCategory) : disabledSubCategories.push(subCategory);\n }\n } else {\n enabled.push(category.categoryId);\n }\n }\n\n // Disable enabled\n enabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(viewport, subCategory, false));\n\n await enableCategoryDisplay(viewport, enabled, false, true);\n\n // Enable disabled\n disabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(viewport, subCategory, true));\n\n await enableCategoryDisplay(viewport, disabled, true, true);\n}\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from "react";
|
|
2
|
-
import type { GroupingHierarchyNode } from "@itwin/presentation-hierarchies";
|
|
3
|
-
import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
|
|
4
|
-
import type { InstanceKey } from "@itwin/presentation-shared";
|
|
5
|
-
/** @public */
|
|
6
|
-
interface FocusedInstancesContext {
|
|
7
|
-
/**
|
|
8
|
-
* A function, returning an async iterator of items that should be focused. The function is not set
|
|
9
|
-
* when instances focus mode is disabled or selection is empty.
|
|
10
|
-
*/
|
|
11
|
-
loadFocusedItems?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;
|
|
12
|
-
/** A flag indicating whether instances focus mode is enabled. */
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
/** Toggle enable or disable instances focus mode. */
|
|
15
|
-
toggle: () => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A React hook for getting focused instances context. The context must be provided
|
|
19
|
-
* using `FocusedInstancesContextProvider`.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export declare function useFocusedInstancesContext(): FocusedInstancesContext;
|
|
24
|
-
/**
|
|
25
|
-
* A React context provider for setting up focused instances context, which can then be acquired
|
|
26
|
-
* using `useFocusedInstancesContext` hook.
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
export declare function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }: PropsWithChildren<{
|
|
31
|
-
selectionStorage: SelectionStorage;
|
|
32
|
-
imodelKey: string;
|
|
33
|
-
}>): JSX.Element;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=FocusedInstancesContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FocusedInstancesContext.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/FocusedInstancesContext.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAuE;AACvE,0FAAsE;AACtE,gEAAmE;AAsBnE,MAAM,uBAAuB,GAAG,IAAA,qBAAa,EAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAE7G;;;;;GAKG;AACH,SAAgB,0BAA0B;IACxC,OAAO,IAAA,kBAAU,EAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC;AAFD,gEAEC;AAED;;;;;GAKG;AACH,SAAgB,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,QAAQ,GACqE;IAC7E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAA0B;QAC1D,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,GAAG,EAAE;YACX,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAE9B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE;YACZ,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAC/D,OAAO;SACR;QAED,MAAM,kBAAkB,GAAG,GAAG,EAAE;YAC9B,MAAM,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,C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AAE;YACjG,IAAI,eAAe,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,EAAE;gBAChD,OAAO;aACR;YACD,kBAAkB,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE3C,OAAO,uBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAAC;AACvG,CAAC;AAhED,0EAgEC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAC;AAC7D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createContext, useContext, useEffect, useState } from \"react\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport { Selectable, Selectables } from \"@itwin/unified-selection\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\n/** @public */\ninterface FocusedInstancesContext {\n /**\n * A function, returning an async iterator of items that should be focused. The function is not set\n * when instances focus mode is disabled or selection is empty.\n */\n loadFocusedItems?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;\n\n /** A flag indicating whether instances focus mode is enabled. */\n enabled: boolean;\n\n /** Toggle enable or disable instances focus mode. */\n toggle: () => void;\n}\n\nconst focusedInstancesContext = createContext<FocusedInstancesContext>({ enabled: false, toggle: () => {} });\n\n/**\n * A React hook for getting focused instances context. The context must be provided\n * using `FocusedInstancesContextProvider`.\n *\n * @public\n */\nexport function useFocusedInstancesContext(): FocusedInstancesContext {\n return useContext(focusedInstancesContext);\n}\n\n/**\n * A React context provider for setting up focused instances context, which can then be acquired\n * using `useFocusedInstancesContext` hook.\n *\n * @public\n */\nexport function FocusedInstancesContextProvider({\n selectionStorage,\n imodelKey,\n children,\n}: PropsWithChildren<{ selectionStorage: SelectionStorage; imodelKey: string }>) {\n const [state, setState] = useState<FocusedInstancesContext>({\n enabled: false,\n toggle: () => {\n setState((prev) => ({ ...prev, enabled: !prev.enabled }));\n },\n });\n const enabled = state.enabled;\n\n useEffect(() => {\n if (!enabled) {\n setState((prev) => ({ ...prev, loadFocusedItems: undefined }));\n return;\n }\n\n const onSelectionChanged = () => {\n const selection = selectionStorage.getSelection({ imodelKey, level: 0 });\n if (Selectables.isEmpty(selection)) {\n setState((prev) => ({ ...prev, loadFocusedItems: undefined }));\n return;\n }\n\n const selected: Array<InstanceKey | GroupingHierarchyNode | (() => AsyncIterableIterator<InstanceKey>)> = [];\n Selectables.forEach(selection, (selectable) => {\n if (Selectable.isInstanceKey(selectable)) {\n selected.push(selectable);\n return;\n }\n\n if (isHierarchyNode(selectable.data) && HierarchyNode.isGroupingNode(selectable.data)) {\n selected.push(selectable.data);\n return;\n }\n\n selected.push(selectable.loadInstanceKeys);\n });\n\n const loadFocusedItems: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode> = async function* () {\n for (const item of selected) {\n if (typeof item === \"function\") {\n yield* item();\n } else {\n yield item;\n }\n }\n };\n\n setState((prev) => ({ ...prev, loadFocusedItems }));\n };\n\n onSelectionChanged();\n return selectionStorage.selectionChangeEvent.addListener(({ imodelKey: changeImodelKey, level }) => {\n if (changeImodelKey !== imodelKey || level !== 0) {\n return;\n }\n onSelectionChanged();\n });\n }, [enabled, imodelKey, selectionStorage]);\n\n return <focusedInstancesContext.Provider value={state}>{children}</focusedInstancesContext.Provider>;\n}\n\nfunction isHierarchyNode(data: unknown): data is HierarchyNode {\n return !!data && typeof data === \"object\" && \"key\" in data;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Observable, ObservableInput, OperatorFunction } from "rxjs";
|
|
2
|
-
/**
|
|
3
|
-
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
4
|
-
*/
|
|
5
|
-
export declare function reduceWhile<TValue, TAccumulator>(predicate: (x: TAccumulator) => boolean, reduceFunc: (acc: TAccumulator, val: TValue) => TAccumulator, initial: TAccumulator): OperatorFunction<TValue, TAccumulator | undefined>;
|
|
6
|
-
/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */
|
|
7
|
-
export declare function toVoidPromise(obs: Observable<any>): Promise<void>;
|
|
8
|
-
/** Returns observable results in an array */
|
|
9
|
-
export declare function collect<T>(obs: ObservableInput<T>): Promise<T[]>;
|
|
10
|
-
//# sourceMappingURL=Rxjs.d.ts.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.collect = exports.toVoidPromise = exports.reduceWhile = void 0;
|
|
8
|
-
const rxjs_1 = require("rxjs");
|
|
9
|
-
/**
|
|
10
|
-
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
11
|
-
*/
|
|
12
|
-
function reduceWhile(predicate, reduceFunc, initial) {
|
|
13
|
-
return (obs) => {
|
|
14
|
-
return obs.pipe((0, rxjs_1.scan)(reduceFunc, initial), (0, rxjs_1.takeWhile)(predicate, true), (0, rxjs_1.defaultIfEmpty)(undefined), (0, rxjs_1.last)());
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.reduceWhile = reduceWhile;
|
|
18
|
-
/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */
|
|
19
|
-
async function toVoidPromise(obs) {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
obs.subscribe({
|
|
22
|
-
complete: () => resolve(),
|
|
23
|
-
error: reject,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.toVoidPromise = toVoidPromise;
|
|
28
|
-
/** Returns observable results in an array */
|
|
29
|
-
async function collect(obs) {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const arr = new Array();
|
|
32
|
-
(0, rxjs_1.from)(obs).subscribe({
|
|
33
|
-
next(item) {
|
|
34
|
-
arr.push(item);
|
|
35
|
-
},
|
|
36
|
-
complete() {
|
|
37
|
-
resolve(arr);
|
|
38
|
-
},
|
|
39
|
-
error(reason) {
|
|
40
|
-
reject(reason);
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
exports.collect = collect;
|
|
46
|
-
//# sourceMappingURL=Rxjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Rxjs.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/Rxjs.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAmE;AAInE;;GAEG;AACH,SAAgB,WAAW,CACzB,SAAuC,EACvC,UAA4D,EAC5D,OAAqB;IAErB,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,GAAG,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,UAAU,EAAE,OAAO,CAAC,EAAE,IAAA,gBAAS,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAA,qBAAc,EAAC,SAAS,CAAC,EAAE,IAAA,WAAI,GAAE,CAAC,CAAC;IAC5G,CAAC,CAAC;AACJ,CAAC;AARD,kCAQC;AAED,wFAAwF;AACjF,KAAK,UAAU,aAAa,CAAC,GAAoB;IACtD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,GAAG,CAAC,SAAS,CAAC;YACZ,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;YACzB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,sCAOC;AAED,6CAA6C;AACtC,KAAK,UAAU,OAAO,CAAI,GAAuB;IACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,KAAK,EAAK,CAAC;QAC3B,IAAA,WAAI,EAAC,GAAG,CAAC,CAAC,SAAS,CAAC;YAClB,IAAI,CAAC,IAAO;gBACV,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;YACD,QAAQ;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YACD,KAAK,CAAC,MAAM;gBACV,MAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,0BAeC","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 { defaultIfEmpty, from, last, scan, takeWhile } from \"rxjs\";\n\nimport type { Observable, ObservableInput, OperatorFunction } from \"rxjs\";\n\n/**\n * Applies reduce function and \"returns\" early if the predicate returns `false` for the accumulator.\n */\nexport function reduceWhile<TValue, TAccumulator>(\n predicate: (x: TAccumulator) => boolean,\n reduceFunc: (acc: TAccumulator, val: TValue) => TAccumulator,\n initial: TAccumulator,\n): OperatorFunction<TValue, TAccumulator | undefined> {\n return (obs) => {\n return obs.pipe(scan(reduceFunc, initial), takeWhile(predicate, true), defaultIfEmpty(undefined), last());\n };\n}\n\n/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */\nexport async function toVoidPromise(obs: Observable<any>): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n obs.subscribe({\n complete: () => resolve(),\n error: reject,\n });\n });\n}\n\n/** Returns observable results in an array */\nexport async function collect<T>(obs: ObservableInput<T>): Promise<T[]> {\n return new Promise((resolve, reject) => {\n const arr = new Array<T>();\n from(obs).subscribe({\n next(item: T) {\n arr.push(item);\n },\n complete() {\n resolve(arr);\n },\n error(reason) {\n reject(reason);\n },\n });\n });\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { VisibilityStatus } from "./UseHierarchyVisibility.js";
|
|
2
|
-
/** @internal */
|
|
3
|
-
export type Visibility = "visible" | "hidden" | "partial";
|
|
4
|
-
/** @internal */
|
|
5
|
-
export type NonPartialVisibilityStatus = Omit<VisibilityStatus, "state"> & {
|
|
6
|
-
state: "visible" | "hidden";
|
|
7
|
-
};
|
|
8
|
-
interface VisibilityStatusOptions {
|
|
9
|
-
useTooltip?: string | false;
|
|
10
|
-
}
|
|
11
|
-
/** @internal */
|
|
12
|
-
export declare function createVisibilityStatus(status: "visible" | "hidden", options?: VisibilityStatusOptions): NonPartialVisibilityStatus;
|
|
13
|
-
export declare function createVisibilityStatus(status: "visible" | "hidden" | "partial" | "disabled", options?: VisibilityStatusOptions): VisibilityStatus;
|
|
14
|
-
/** @internal */
|
|
15
|
-
export declare function createTooltip(status: Visibility | "disabled", tooltipStringId: string | undefined): string;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=Tooltip.d.ts.map
|