@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
|
@@ -1,29 +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.createTooltip = exports.createVisibilityStatus = void 0;
|
|
8
|
-
const TreeWidget_js_1 = require("../../../TreeWidget.js");
|
|
9
|
-
function createVisibilityStatus(status, { useTooltip } = {}) {
|
|
10
|
-
return {
|
|
11
|
-
state: status === "disabled" ? "hidden" : status,
|
|
12
|
-
isDisabled: status === "disabled",
|
|
13
|
-
tooltip: useTooltip === false ? undefined : createTooltip(status, useTooltip),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.createVisibilityStatus = createVisibilityStatus;
|
|
17
|
-
/** @internal */
|
|
18
|
-
function createTooltip(status, tooltipStringId) {
|
|
19
|
-
const statusStringId = `visibilityTooltips.status.${status}`;
|
|
20
|
-
const statusString = TreeWidget_js_1.TreeWidget.translate(statusStringId);
|
|
21
|
-
if (!tooltipStringId) {
|
|
22
|
-
return statusString;
|
|
23
|
-
}
|
|
24
|
-
tooltipStringId = `visibilityTooltips.${tooltipStringId}`;
|
|
25
|
-
const tooltipString = TreeWidget_js_1.TreeWidget.translate(tooltipStringId);
|
|
26
|
-
return `${statusString}: ${tooltipString}`;
|
|
27
|
-
}
|
|
28
|
-
exports.createTooltip = createTooltip;
|
|
29
|
-
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/Tooltip.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,0DAAoD;AAmBpD,SAAgB,sBAAsB,CAAC,MAA+B,EAAE,EAAE,UAAU,KAA8B,EAAE;IAClH,OAAO;QACL,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;QAChD,UAAU,EAAE,MAAM,KAAK,UAAU;QACjC,OAAO,EAAE,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC;KAC9E,CAAC;AACJ,CAAC;AAND,wDAMC;AAED,gBAAgB;AAChB,SAAgB,aAAa,CAAC,MAA+B,EAAE,eAAmC;IAChG,MAAM,cAAc,GAAG,6BAA6B,MAAM,EAAE,CAAC;IAC7D,MAAM,YAAY,GAAG,0BAAU,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1D,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,YAAY,CAAC;KACrB;IAED,eAAe,GAAG,sBAAsB,eAAe,EAAE,CAAC;IAC1D,MAAM,aAAa,GAAG,0BAAU,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC5D,OAAO,GAAG,YAAY,KAAK,aAAa,EAAE,CAAC;AAC7C,CAAC;AAVD,sCAUC","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 { TreeWidget } from \"../../../TreeWidget.js\";\n\nimport type { VisibilityStatus } from \"./UseHierarchyVisibility.js\";\n\n/** @internal */\nexport type Visibility = \"visible\" | \"hidden\" | \"partial\";\n\n/** @internal */\nexport type NonPartialVisibilityStatus = Omit<VisibilityStatus, \"state\"> & { state: \"visible\" | \"hidden\" };\n\ninterface VisibilityStatusOptions {\n // id of localized string to use as an additional tooltip or false to not use tooltip at all\n // if undefined tooltip will be created based only on the visibility status\n useTooltip?: string | false;\n}\n\n/** @internal */\nexport function createVisibilityStatus(status: \"visible\" | \"hidden\", options?: VisibilityStatusOptions): NonPartialVisibilityStatus;\nexport function createVisibilityStatus(status: \"visible\" | \"hidden\" | \"partial\" | \"disabled\", options?: VisibilityStatusOptions): VisibilityStatus;\nexport function createVisibilityStatus(status: Visibility | \"disabled\", { useTooltip }: VisibilityStatusOptions = {}): VisibilityStatus {\n return {\n state: status === \"disabled\" ? \"hidden\" : status,\n isDisabled: status === \"disabled\",\n tooltip: useTooltip === false ? undefined : createTooltip(status, useTooltip),\n };\n}\n\n/** @internal */\nexport function createTooltip(status: Visibility | \"disabled\", tooltipStringId: string | undefined): string {\n const statusStringId = `visibilityTooltips.status.${status}`;\n const statusString = TreeWidget.translate(statusStringId);\n if (!tooltipStringId) {\n return statusString;\n }\n\n tooltipStringId = `visibilityTooltips.${tooltipStringId}`;\n const tooltipString = TreeWidget.translate(tooltipStringId);\n return `${statusString}: ${tooltipString}`;\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error that is thrown when too many matches are found while filtering the tree.
|
|
3
|
-
* @beta
|
|
4
|
-
*/
|
|
5
|
-
export declare class FilterLimitExceededError extends Error {
|
|
6
|
-
readonly limit: number;
|
|
7
|
-
constructor(limit: number);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=TreeErrors.d.ts.map
|
|
@@ -1,19 +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.FilterLimitExceededError = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Error that is thrown when too many matches are found while filtering the tree.
|
|
10
|
-
* @beta
|
|
11
|
-
*/
|
|
12
|
-
class FilterLimitExceededError extends Error {
|
|
13
|
-
constructor(limit) {
|
|
14
|
-
super("Too many filter matches");
|
|
15
|
-
this.limit = limit;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.FilterLimitExceededError = FilterLimitExceededError;
|
|
19
|
-
//# sourceMappingURL=TreeErrors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrors.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/TreeErrors.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAmC,KAAa;QAC9C,KAAK,CAAC,yBAAyB,CAAC,CAAC;QADA,UAAK,GAAL,KAAK,CAAQ;IAEhD,CAAC;CACF;AAJD,4DAIC","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\n/**\n * Error that is thrown when too many matches are found while filtering the tree.\n * @beta\n */\nexport class FilterLimitExceededError extends Error {\n public constructor(public readonly limit: number) {\n super(\"Too many filter matches\");\n }\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ScreenViewport } from "@itwin/core-frontend";
|
|
2
|
-
/**
|
|
3
|
-
* A copy of `useActiveViewport` from `@itwin/appui-react` package until X is fixed.
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export declare function useActiveViewport(): ScreenViewport | undefined;
|
|
7
|
-
//# sourceMappingURL=UseActiveViewport.d.ts.map
|
|
@@ -1,25 +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.useActiveViewport = void 0;
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
10
|
-
/**
|
|
11
|
-
* A copy of `useActiveViewport` from `@itwin/appui-react` package until X is fixed.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
function useActiveViewport() {
|
|
15
|
-
const [activeViewport, setActiveViewport] = (0, react_1.useState)(core_frontend_1.IModelApp.viewManager.selectedView);
|
|
16
|
-
(0, react_1.useEffect)(() => {
|
|
17
|
-
setActiveViewport(core_frontend_1.IModelApp.viewManager.selectedView);
|
|
18
|
-
return core_frontend_1.IModelApp.viewManager.onSelectedViewportChanged.addListener((args) => {
|
|
19
|
-
setActiveViewport(args.current);
|
|
20
|
-
});
|
|
21
|
-
}, []);
|
|
22
|
-
return activeViewport;
|
|
23
|
-
}
|
|
24
|
-
exports.useActiveViewport = useActiveViewport;
|
|
25
|
-
//# sourceMappingURL=UseActiveViewport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseActiveViewport.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/UseActiveViewport.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAA4C;AAE5C,wDAAiD;AAEjD;;;GAGG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACzF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACtD,OAAO,yBAAS,CAAC,WAAW,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAC1E,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC;AAVD,8CAUC","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 { useEffect, useState } from \"react\";\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\n/**\n * A copy of `useActiveViewport` from `@itwin/appui-react` package until X is fixed.\n * @internal\n */\nexport function useActiveViewport(): ScreenViewport | undefined {\n const [activeViewport, setActiveViewport] = useState(IModelApp.viewManager.selectedView);\n useEffect(() => {\n setActiveViewport(IModelApp.viewManager.selectedView);\n return IModelApp.viewManager.onSelectedViewportChanged.addListener((args) => {\n setActiveViewport(args.current);\n });\n }, []);\n\n return activeViewport;\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface UseFilteringResult {
|
|
2
|
-
filter: string;
|
|
3
|
-
activeMatchIndex: number;
|
|
4
|
-
totalMatches: number;
|
|
5
|
-
applyFilter: (filter: string) => void;
|
|
6
|
-
clearFilter: () => void;
|
|
7
|
-
onHighlightChanged: (index: number, matches?: number) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function useFiltering(): UseFilteringResult;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=UseFiltering.d.ts.map
|
|
@@ -1,28 +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.useFiltering = void 0;
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
function useFiltering() {
|
|
10
|
-
const [filter, setFilter] = (0, react_1.useState)("");
|
|
11
|
-
const [activeMatchIndex, setActiveMatchIndex] = (0, react_1.useState)(0);
|
|
12
|
-
const [totalMatches, setTotalMatches] = (0, react_1.useState)(0);
|
|
13
|
-
const applyFilter = (0, react_1.useCallback)((newFilter) => {
|
|
14
|
-
setActiveMatchIndex(0);
|
|
15
|
-
setFilter(newFilter);
|
|
16
|
-
}, []);
|
|
17
|
-
const clearFilter = (0, react_1.useCallback)(() => {
|
|
18
|
-
setActiveMatchIndex(0);
|
|
19
|
-
setFilter("");
|
|
20
|
-
}, []);
|
|
21
|
-
const onHighlightChanged = (0, react_1.useCallback)((index, matches) => {
|
|
22
|
-
setActiveMatchIndex(index);
|
|
23
|
-
matches && setTotalMatches(matches);
|
|
24
|
-
}, []);
|
|
25
|
-
return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };
|
|
26
|
-
}
|
|
27
|
-
exports.useFiltering = useFiltering;
|
|
28
|
-
//# sourceMappingURL=UseFiltering.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseFiltering.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/UseFiltering.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAA8C;AAW9C,SAAgB,YAAY;IAC1B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,CAAC,SAAiB,EAAE,EAAE;QACpD,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACnC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,IAAA,mBAAW,EAAC,CAAC,KAAa,EAAE,OAAgB,EAAE,EAAE;QACzE,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAClG,CAAC;AArBD,oCAqBC","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, useState } from \"react\";\n\ninterface UseFilteringResult {\n filter: string;\n activeMatchIndex: number;\n totalMatches: number;\n applyFilter: (filter: string) => void;\n clearFilter: () => void;\n onHighlightChanged: (index: number, matches?: number) => void;\n}\n\nexport function useFiltering(): UseFilteringResult {\n const [filter, setFilter] = useState(\"\");\n const [activeMatchIndex, setActiveMatchIndex] = useState(0);\n const [totalMatches, setTotalMatches] = useState(0);\n\n const applyFilter = useCallback((newFilter: string) => {\n setActiveMatchIndex(0);\n setFilter(newFilter);\n }, []);\n\n const clearFilter = useCallback(() => {\n setActiveMatchIndex(0);\n setFilter(\"\");\n }, []);\n\n const onHighlightChanged = useCallback((index: number, matches?: number) => {\n setActiveMatchIndex(index);\n matches && setTotalMatches(matches);\n }, []);\n\n return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TreeRenderer, useIModelTree } from "@itwin/presentation-hierarchies-react";
|
|
2
|
-
type UseTreeLocalizedStrings = NonNullable<Parameters<typeof useIModelTree>[0]["localizedStrings"]>;
|
|
3
|
-
type TreeRendererLocalizedStrings = NonNullable<Parameters<typeof TreeRenderer>[0]["localizedStrings"]>;
|
|
4
|
-
type UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;
|
|
5
|
-
export declare function useHierarchiesLocalization(): UseHierarchiesLocalizationResult;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=UseHierarchiesLocalization.d.ts.map
|
|
@@ -1,33 +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.useHierarchiesLocalization = void 0;
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const TreeWidget_js_1 = require("../../../TreeWidget.js");
|
|
10
|
-
function useHierarchiesLocalization() {
|
|
11
|
-
const stringValues = Object.values(getLocalizedStrings());
|
|
12
|
-
const localizedStrings = (0, react_1.useMemo)(getLocalizedStrings, stringValues);
|
|
13
|
-
return localizedStrings;
|
|
14
|
-
}
|
|
15
|
-
exports.useHierarchiesLocalization = useHierarchiesLocalization;
|
|
16
|
-
function getLocalizedStrings() {
|
|
17
|
-
return {
|
|
18
|
-
// strings for the `useUnifiedSelectionTree` hook
|
|
19
|
-
unspecified: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.unspecified"),
|
|
20
|
-
other: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.other"),
|
|
21
|
-
// strings for `TreeRenderer` and `TreeNodeRenderer`
|
|
22
|
-
loading: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.loading"),
|
|
23
|
-
filterHierarchyLevel: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.filterHierarchyLevel"),
|
|
24
|
-
clearHierarchyLevelFilter: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.clearHierarchyLevelFilter"),
|
|
25
|
-
noFilteredChildren: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.noFilteredChildren"),
|
|
26
|
-
resultLimitExceeded: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.resultLimitExceeded"),
|
|
27
|
-
resultLimitExceededWithFiltering: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.resultLimitExceededWithFiltering"),
|
|
28
|
-
increaseHierarchyLimit: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimit"),
|
|
29
|
-
increaseHierarchyLimitWithFiltering: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimitWithFiltering"),
|
|
30
|
-
retry: TreeWidget_js_1.TreeWidget.translate("presentation-hierarchies.retry"),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=UseHierarchiesLocalization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseHierarchiesLocalization.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/UseHierarchiesLocalization.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAgC;AAChC,0DAAoD;AASpD,SAAgB,0BAA0B;IACxC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1D,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IACpE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAJD,gEAIC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,iDAAiD;QACjD,WAAW,EAAE,0BAAU,CAAC,SAAS,CAAC,sCAAsC,CAAC;QACzE,KAAK,EAAE,0BAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;QAE7D,oDAAoD;QACpD,OAAO,EAAE,0BAAU,CAAC,SAAS,CAAC,kCAAkC,CAAC;QACjE,oBAAoB,EAAE,0BAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC;QAC3F,yBAAyB,EAAE,0BAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;QACrG,kBAAkB,EAAE,0BAAU,CAAC,SAAS,CAAC,6CAA6C,CAAC;QACvF,mBAAmB,EAAE,0BAAU,CAAC,SAAS,CAAC,8CAA8C,CAAC;QACzF,gCAAgC,EAAE,0BAAU,CAAC,SAAS,CAAC,2DAA2D,CAAC;QACnH,sBAAsB,EAAE,0BAAU,CAAC,SAAS,CAAC,iDAAiD,CAAC;QAC/F,mCAAmC,EAAE,0BAAU,CAAC,SAAS,CAAC,8DAA8D,CAAC;QACzH,KAAK,EAAE,0BAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;KAC9D,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 { useMemo } from \"react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\n\nimport type { TreeRenderer, useIModelTree } from \"@itwin/presentation-hierarchies-react\";\n\ntype UseTreeLocalizedStrings = NonNullable<Parameters<typeof useIModelTree>[0][\"localizedStrings\"]>;\ntype TreeRendererLocalizedStrings = NonNullable<Parameters<typeof TreeRenderer>[0][\"localizedStrings\"]>;\n\ntype UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;\n\nexport function useHierarchiesLocalization(): UseHierarchiesLocalizationResult {\n const stringValues = Object.values(getLocalizedStrings());\n const localizedStrings = useMemo(getLocalizedStrings, stringValues);\n return localizedStrings;\n}\n\nfunction getLocalizedStrings(): UseHierarchiesLocalizationResult {\n return {\n // strings for the `useUnifiedSelectionTree` hook\n unspecified: TreeWidget.translate(\"presentation-hierarchies.unspecified\"),\n other: TreeWidget.translate(\"presentation-hierarchies.other\"),\n\n // strings for `TreeRenderer` and `TreeNodeRenderer`\n loading: TreeWidget.translate(\"presentation-hierarchies.loading\"),\n filterHierarchyLevel: TreeWidget.translate(\"presentation-hierarchies.filterHierarchyLevel\"),\n clearHierarchyLevelFilter: TreeWidget.translate(\"presentation-hierarchies.clearHierarchyLevelFilter\"),\n noFilteredChildren: TreeWidget.translate(\"presentation-hierarchies.noFilteredChildren\"),\n resultLimitExceeded: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceeded\"),\n resultLimitExceededWithFiltering: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceededWithFiltering\"),\n increaseHierarchyLimit: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimit\"),\n increaseHierarchyLimitWithFiltering: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimitWithFiltering\"),\n retry: TreeWidget.translate(\"presentation-hierarchies.retry\"),\n };\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
-
import type { HierarchyLevelDetails } from "@itwin/presentation-hierarchies-react";
|
|
4
|
-
interface UseHierarchyLevelFilteringProps {
|
|
5
|
-
imodel: IModelConnection;
|
|
6
|
-
defaultHierarchyLevelSizeLimit: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit }: UseHierarchyLevelFilteringProps): {
|
|
9
|
-
onFilterClick: import("react").Dispatch<import("react").SetStateAction<HierarchyLevelDetails | undefined>>;
|
|
10
|
-
filteringDialog: JSX.Element;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=UseHierarchyFiltering.d.ts.map
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useHierarchyLevelFiltering = 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 components_react_1 = require("@itwin/components-react");
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
13
|
-
const presentation_common_1 = require("@itwin/presentation-common");
|
|
14
|
-
const presentation_components_1 = require("@itwin/presentation-components");
|
|
15
|
-
const presentation_frontend_1 = require("@itwin/presentation-frontend");
|
|
16
|
-
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
17
|
-
const TreeWidget_js_1 = require("../../../TreeWidget.js");
|
|
18
|
-
const Delayed_js_1 = require("./components/Delayed.js");
|
|
19
|
-
const UseTelemetryContext_js_1 = require("./UseTelemetryContext.js");
|
|
20
|
-
function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit }) {
|
|
21
|
-
const [filteringOptions, setFilteringOptions] = (0, react_1.useState)();
|
|
22
|
-
const { onFeatureUsed } = (0, UseTelemetryContext_js_1.useTelemetryContext)();
|
|
23
|
-
const propertiesSource = (0, react_1.useMemo)(() => {
|
|
24
|
-
if (!filteringOptions) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
return async () => {
|
|
28
|
-
const keySet = await collectInstanceKeys(filteringOptions.getInstanceKeysIterator());
|
|
29
|
-
if (keySet.isEmpty) {
|
|
30
|
-
throw new Error("Hierarchy level is empty - unable to create content descriptor.");
|
|
31
|
-
}
|
|
32
|
-
const descriptor = await presentation_frontend_1.Presentation.presentation.getContentDescriptor({
|
|
33
|
-
imodel,
|
|
34
|
-
rulesetOrId: {
|
|
35
|
-
id: `Hierarchy level descriptor ruleset`,
|
|
36
|
-
rules: [
|
|
37
|
-
{
|
|
38
|
-
ruleType: "Content",
|
|
39
|
-
specifications: [
|
|
40
|
-
{
|
|
41
|
-
specType: "SelectedNodeInstances",
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
displayType: presentation_common_1.DefaultContentDisplayTypes.PropertyPane,
|
|
48
|
-
keys: keySet,
|
|
49
|
-
});
|
|
50
|
-
if (!descriptor) {
|
|
51
|
-
throw new Error("Failed to create content descriptor");
|
|
52
|
-
}
|
|
53
|
-
return { descriptor, inputKeys: keySet };
|
|
54
|
-
};
|
|
55
|
-
}, [filteringOptions, imodel]);
|
|
56
|
-
const getInitialFilter = (0, react_1.useMemo)(() => {
|
|
57
|
-
const currentFilter = filteringOptions?.instanceFilter;
|
|
58
|
-
if (!currentFilter) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
return (descriptor) => fromGenericFilter(descriptor, currentFilter);
|
|
62
|
-
}, [filteringOptions]);
|
|
63
|
-
const filteringDialog = ((0, jsx_runtime_1.jsx)(presentation_components_1.PresentationInstanceFilterDialog, { imodel: imodel, isOpen: !!filteringOptions, onApply: (info) => {
|
|
64
|
-
if (!filteringOptions) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
onFeatureUsed({ featureId: info ? "hierarchy-level-filtering" : undefined, reportInteraction: true });
|
|
68
|
-
filteringOptions.setInstanceFilter(toGenericFilter(info));
|
|
69
|
-
setFilteringOptions(undefined);
|
|
70
|
-
}, onClose: () => {
|
|
71
|
-
setFilteringOptions(undefined);
|
|
72
|
-
}, propertiesSource: propertiesSource, initialFilter: getInitialFilter, filterResultsCountRenderer: (filter) => {
|
|
73
|
-
if (!filteringOptions) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(MatchingInstancesCount, { filter: filter, hierarchyLevelDetails: filteringOptions, defaultHierarchyLevelSizeLimit: defaultHierarchyLevelSizeLimit }));
|
|
77
|
-
} }));
|
|
78
|
-
return {
|
|
79
|
-
onFilterClick: setFilteringOptions,
|
|
80
|
-
filteringDialog,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
exports.useHierarchyLevelFiltering = useHierarchyLevelFiltering;
|
|
84
|
-
function MatchingInstancesCount({ filter, defaultHierarchyLevelSizeLimit, hierarchyLevelDetails }) {
|
|
85
|
-
const { value, inProgress } = (0, components_react_1.useDebouncedAsyncValue)((0, react_1.useCallback)(async () => {
|
|
86
|
-
const instanceFilter = toGenericFilter(filter);
|
|
87
|
-
try {
|
|
88
|
-
const instanceCount = await countInstanceKeys(hierarchyLevelDetails.getInstanceKeysIterator({
|
|
89
|
-
instanceFilter,
|
|
90
|
-
hierarchyLevelSizeLimit: hierarchyLevelDetails.sizeLimit ?? defaultHierarchyLevelSizeLimit,
|
|
91
|
-
}));
|
|
92
|
-
return TreeWidget_js_1.TreeWidget.translate("filteringDialog.matchingInstancesCount", {
|
|
93
|
-
instanceCount: instanceCount.toLocaleString(undefined, { useGrouping: true }),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
if (e instanceof presentation_hierarchies_1.RowsLimitExceededError) {
|
|
98
|
-
return TreeWidget_js_1.TreeWidget.translate("filteringDialog.filterExceedsLimit", { limit: e.limit.toLocaleString(undefined, { useGrouping: true }) });
|
|
99
|
-
}
|
|
100
|
-
return TreeWidget_js_1.TreeWidget.translate("filteringDialog.failedToCalculateMatchingInstancesCount");
|
|
101
|
-
}
|
|
102
|
-
}, [filter, hierarchyLevelDetails, defaultHierarchyLevelSizeLimit]));
|
|
103
|
-
if (inProgress) {
|
|
104
|
-
return ((0, jsx_runtime_1.jsxs)(Delayed_js_1.Delayed, { show: true, children: [TreeWidget_js_1.TreeWidget.translate("filteringDialog.matchingInstancesCount", { instanceCount: "" }), (0, jsx_runtime_1.jsx)(itwinui_react_1.ProgressRadial, { size: "x-small" })] }));
|
|
105
|
-
}
|
|
106
|
-
return value ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: value }) : null;
|
|
107
|
-
}
|
|
108
|
-
async function countInstanceKeys(iterator) {
|
|
109
|
-
let result = 0;
|
|
110
|
-
for await (const _ of iterator) {
|
|
111
|
-
result++;
|
|
112
|
-
}
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
async function collectInstanceKeys(iterator) {
|
|
116
|
-
const idsByClassName = new Map();
|
|
117
|
-
for await (const { className, id } of iterator) {
|
|
118
|
-
let idSet = idsByClassName.get(className);
|
|
119
|
-
if (!idSet) {
|
|
120
|
-
idSet = [];
|
|
121
|
-
idsByClassName.set(className, idSet);
|
|
122
|
-
}
|
|
123
|
-
idSet.push(id);
|
|
124
|
-
}
|
|
125
|
-
const instanceKeys = new Array();
|
|
126
|
-
for (const [className, ids] of idsByClassName) {
|
|
127
|
-
instanceKeys.push([className.toLowerCase(), core_bentley_1.CompressedId64Set.sortAndCompress(ids)]);
|
|
128
|
-
}
|
|
129
|
-
return presentation_common_1.KeySet.fromJSON({ instanceKeys, nodeKeys: [] });
|
|
130
|
-
}
|
|
131
|
-
function fromGenericFilter(descriptor, filter) {
|
|
132
|
-
const presentationFilter = presentation_hierarchies_1.GenericInstanceFilter.isFilterRuleGroup(filter.rules) && filter.rules.rules.length === 0
|
|
133
|
-
? undefined
|
|
134
|
-
: presentation_components_1.PresentationInstanceFilter.fromGenericInstanceFilter(descriptor, filter);
|
|
135
|
-
return {
|
|
136
|
-
filter: presentationFilter,
|
|
137
|
-
usedClasses: (filter.filteredClassNames ?? [])
|
|
138
|
-
.map((name) => descriptor.selectClasses.find((selectClass) => selectClass.selectClassInfo.name === name)?.selectClassInfo)
|
|
139
|
-
.filter((classInfo) => classInfo !== undefined),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function toGenericFilter(filterInfo) {
|
|
143
|
-
if (!filterInfo) {
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
if (!filterInfo.filter) {
|
|
147
|
-
return filterInfo.usedClasses.length > 0
|
|
148
|
-
? {
|
|
149
|
-
propertyClassNames: [],
|
|
150
|
-
relatedInstances: [],
|
|
151
|
-
filteredClassNames: filterInfo.usedClasses.map((info) => info.name),
|
|
152
|
-
rules: { operator: "and", rules: [] },
|
|
153
|
-
}
|
|
154
|
-
: undefined;
|
|
155
|
-
}
|
|
156
|
-
return presentation_components_1.PresentationInstanceFilter.toGenericInstanceFilter(filterInfo.filter, filterInfo.usedClasses);
|
|
157
|
-
}
|
|
158
|
-
//# sourceMappingURL=UseHierarchyFiltering.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseHierarchyFiltering.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/UseHierarchyFiltering.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAuD;AACvD,8DAAiE;AACjE,sDAAwD;AACxD,wDAAsD;AACtD,oEAAgF;AAChF,4EAA8G;AAC9G,wEAA4D;AAC5D,8EAAgG;AAChG,0DAAoD;AACpD,wDAAkD;AAClD,qEAA+D;AAc/D,SAAgB,0BAA0B,CAAC,EAAE,MAAM,EAAE,8BAA8B,EAAmC;IACpH,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,GAAyB,CAAC;IAClF,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,4CAAmB,GAAE,CAAC;IAEhD,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAA0E,GAAG,EAAE;QAC7G,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,CAAC,CAAC;YACrF,IAAI,MAAM,CAAC,OAAO,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;aACpF;YAED,MAAM,UAAU,GAAG,MAAM,oCAAY,CAAC,YAAY,CAAC,oBAAoB,CAAC;gBACtE,MAAM;gBACN,WAAW,EAAE;oBACX,EAAE,EAAE,oCAAoC;oBACxC,KAAK,EAAE;wBACL;4BACE,QAAQ,EAAE,SAAS;4BACnB,cAAc,EAAE;gCACd;oCACE,QAA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AE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;aACtC;YACH,CAAC,CAAC,SAAS,CAAC;KACf;IAED,OAAO,oDAA0B,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;AACvG,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 { useDebouncedAsyncValue } from \"@itwin/components-react\";\nimport { CompressedId64Set } from \"@itwin/core-bentley\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\nimport { DefaultContentDisplayTypes, KeySet } from \"@itwin/presentation-common\";\nimport { PresentationInstanceFilter, PresentationInstanceFilterDialog } from \"@itwin/presentation-components\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { GenericInstanceFilter, RowsLimitExceededError } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { Delayed } from \"./components/Delayed.js\";\nimport { useTelemetryContext } from \"./UseTelemetryContext.js\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ClassInfo, Descriptor } from \"@itwin/presentation-common\";\nimport type { PresentationInstanceFilterInfo, PresentationInstanceFilterPropertiesSource } from \"@itwin/presentation-components\";\nimport type { HierarchyLevelDetails } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\ninterface UseHierarchyLevelFilteringProps {\n imodel: IModelConnection;\n defaultHierarchyLevelSizeLimit: number;\n}\n\nexport function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit }: UseHierarchyLevelFilteringProps) {\n const [filteringOptions, setFilteringOptions] = useState<HierarchyLevelDetails>();\n const { onFeatureUsed } = useTelemetryContext();\n\n const propertiesSource = useMemo<(() => Promise<PresentationInstanceFilterPropertiesSource>) | undefined>(() => {\n if (!filteringOptions) {\n return undefined;\n }\n\n return async () => {\n const keySet = await collectInstanceKeys(filteringOptions.getInstanceKeysIterator());\n if (keySet.isEmpty) {\n throw new Error(\"Hierarchy level is empty - unable to create content descriptor.\");\n }\n\n const descriptor = await Presentation.presentation.getContentDescriptor({\n imodel,\n rulesetOrId: {\n id: `Hierarchy level descriptor ruleset`,\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n displayType: DefaultContentDisplayTypes.PropertyPane,\n keys: keySet,\n });\n if (!descriptor) {\n throw new Error(\"Failed to create content descriptor\");\n }\n\n return { descriptor, inputKeys: keySet };\n };\n }, [filteringOptions, imodel]);\n\n const getInitialFilter = useMemo(() => {\n const currentFilter = filteringOptions?.instanceFilter;\n if (!currentFilter) {\n return undefined;\n }\n\n return (descriptor: Descriptor) => fromGenericFilter(descriptor, currentFilter);\n }, [filteringOptions]);\n\n const filteringDialog = (\n <PresentationInstanceFilterDialog\n imodel={imodel}\n isOpen={!!filteringOptions}\n onApply={(info) => {\n if (!filteringOptions) {\n return;\n }\n onFeatureUsed({ featureId: info ? \"hierarchy-level-filtering\" : undefined, reportInteraction: true });\n filteringOptions.setInstanceFilter(toGenericFilter(info));\n setFilteringOptions(undefined);\n }}\n onClose={() => {\n setFilteringOptions(undefined);\n }}\n propertiesSource={propertiesSource}\n initialFilter={getInitialFilter}\n filterResultsCountRenderer={(filter) => {\n if (!filteringOptions) {\n return null;\n }\n\n return (\n <MatchingInstancesCount filter={filter} hierarchyLevelDetails={filteringOptions} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n );\n }}\n />\n );\n\n return {\n onFilterClick: setFilteringOptions,\n filteringDialog,\n };\n}\n\ninterface MatchingInstancesCountProps {\n filter: PresentationInstanceFilterInfo;\n hierarchyLevelDetails: HierarchyLevelDetails;\n defaultHierarchyLevelSizeLimit: number;\n}\n\nfunction MatchingInstancesCount({ filter, defaultHierarchyLevelSizeLimit, hierarchyLevelDetails }: MatchingInstancesCountProps) {\n const { value, inProgress } = useDebouncedAsyncValue(\n useCallback(async () => {\n const instanceFilter = toGenericFilter(filter);\n try {\n const instanceCount = await countInstanceKeys(\n hierarchyLevelDetails.getInstanceKeysIterator({\n instanceFilter,\n hierarchyLevelSizeLimit: hierarchyLevelDetails.sizeLimit ?? defaultHierarchyLevelSizeLimit,\n }),\n );\n return TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", {\n instanceCount: instanceCount.toLocaleString(undefined, { useGrouping: true }),\n });\n } catch (e) {\n if (e instanceof RowsLimitExceededError) {\n return TreeWidget.translate(\"filteringDialog.filterExceedsLimit\", { limit: e.limit.toLocaleString(undefined, { useGrouping: true }) });\n }\n return TreeWidget.translate(\"filteringDialog.failedToCalculateMatchingInstancesCount\");\n }\n }, [filter, hierarchyLevelDetails, defaultHierarchyLevelSizeLimit]),\n );\n\n if (inProgress) {\n return (\n <Delayed show={true}>\n {TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", { instanceCount: \"\" })}\n <ProgressRadial size=\"x-small\" />\n </Delayed>\n );\n }\n\n return value ? <>{value}</> : null;\n}\n\nasync function countInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n let result = 0;\n for await (const _ of iterator) {\n result++;\n }\n return result;\n}\n\nasync function collectInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n const idsByClassName = new Map<Id64String, Id64Array>();\n for await (const { className, id } of iterator) {\n let idSet = idsByClassName.get(className);\n if (!idSet) {\n idSet = [];\n idsByClassName.set(className, idSet);\n }\n idSet.push(id);\n }\n\n const instanceKeys = new Array<[className: string, compressedIds: CompressedId64Set]>();\n for (const [className, ids] of idsByClassName) {\n instanceKeys.push([className.toLowerCase(), CompressedId64Set.sortAndCompress(ids)]);\n }\n return KeySet.fromJSON({ instanceKeys, nodeKeys: [] });\n}\n\nfunction fromGenericFilter(descriptor: Descriptor, filter: GenericInstanceFilter): PresentationInstanceFilterInfo {\n const presentationFilter =\n GenericInstanceFilter.isFilterRuleGroup(filter.rules) && filter.rules.rules.length === 0\n ? undefined\n : PresentationInstanceFilter.fromGenericInstanceFilter(descriptor, filter);\n return {\n filter: presentationFilter,\n usedClasses: (filter.filteredClassNames ?? [])\n .map((name) => descriptor.selectClasses.find((selectClass) => selectClass.selectClassInfo.name === name)?.selectClassInfo)\n .filter((classInfo): classInfo is ClassInfo => classInfo !== undefined),\n };\n}\n\nfunction toGenericFilter(filterInfo?: PresentationInstanceFilterInfo): GenericInstanceFilter | undefined {\n if (!filterInfo) {\n return undefined;\n }\n\n if (!filterInfo.filter) {\n return filterInfo.usedClasses.length > 0\n ? {\n propertyClassNames: [],\n relatedInstances: [],\n filteredClassNames: filterInfo.usedClasses.map((info) => info.name),\n rules: { operator: \"and\", rules: [] },\n }\n : undefined;\n }\n\n return PresentationInstanceFilter.toGenericInstanceFilter(filterInfo.filter, filterInfo.usedClasses);\n}\n"]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Observable } from "rxjs";
|
|
2
|
-
import type { BeEvent, IDisposable } from "@itwin/core-bentley";
|
|
3
|
-
import type { HierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
4
|
-
import type { TreeCheckboxProps } from "./components/TreeNodeCheckbox.js";
|
|
5
|
-
/**
|
|
6
|
-
* Data structure that describes instance visibility status.
|
|
7
|
-
* @beta
|
|
8
|
-
*/
|
|
9
|
-
export interface VisibilityStatus {
|
|
10
|
-
/** Instance visibility state. */
|
|
11
|
-
state: "visible" | "partial" | "hidden";
|
|
12
|
-
/** Specifies whether visibility changing is disabled or not. */
|
|
13
|
-
isDisabled?: boolean;
|
|
14
|
-
/** Tooltip that should be displayed when hovering over the visibility checkbox. */
|
|
15
|
-
tooltip?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Handler that can be used to determine and change visibility of instances represented by tree nodes.
|
|
19
|
-
* @beta
|
|
20
|
-
*/
|
|
21
|
-
export interface HierarchyVisibilityHandler extends IDisposable {
|
|
22
|
-
/** Event used to notify tree about visibility changes from outside. */
|
|
23
|
-
readonly onVisibilityChange: BeEvent<() => void>;
|
|
24
|
-
/** Returns current visibility status for tree node. */
|
|
25
|
-
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
|
|
26
|
-
/** Changes visibility of the instance represented by tree node. */
|
|
27
|
-
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
interface UseHierarchyVisibilityProps {
|
|
30
|
-
visibilityHandlerFactory: () => HierarchyVisibilityHandler;
|
|
31
|
-
}
|
|
32
|
-
export declare function useHierarchyVisibility({ visibilityHandlerFactory }: UseHierarchyVisibilityProps): TreeCheckboxProps & {
|
|
33
|
-
triggerRefresh: () => void;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Properties for an overridden method of a `HierarchyVisibilityHandler` implementation.
|
|
37
|
-
* @beta
|
|
38
|
-
*/
|
|
39
|
-
export type HierarchyVisibilityHandlerOverridableMethodProps<TFunc> = TFunc extends (props: infer TProps) => infer TResult ? TProps & {
|
|
40
|
-
/** A callback that produces the value from the original implementation. */
|
|
41
|
-
readonly originalImplementation: () => TResult;
|
|
42
|
-
/**
|
|
43
|
-
* Reference to the hierarchy based handler.
|
|
44
|
-
* @note Calling `getVisibility` or `changeVisibility` of this object invokes the overridden implementation as well.
|
|
45
|
-
*/
|
|
46
|
-
readonly handler: HierarchyVisibilityHandler;
|
|
47
|
-
} : never;
|
|
48
|
-
/**
|
|
49
|
-
* Function type for an overridden method of `HierarchyVisibilityHandler`.
|
|
50
|
-
* @beta
|
|
51
|
-
*/
|
|
52
|
-
export type HierarchyVisibilityHandlerOverridableMethod<TFunc> = TFunc extends (...args: any[]) => infer TResult ? (props: HierarchyVisibilityHandlerOverridableMethodProps<TFunc>) => TResult : never;
|
|
53
|
-
export declare function createVisibilityHandlerResult<TResult, TOverrideProps>(handler: HierarchyVisibilityHandler, props: TOverrideProps, obs: Observable<TResult>, override: HierarchyVisibilityHandlerOverridableMethod<(props: TOverrideProps) => Promise<TResult>> | undefined): Observable<TResult>;
|
|
54
|
-
export {};
|
|
55
|
-
//# sourceMappingURL=UseHierarchyVisibility.d.ts.map
|
|
@@ -1,114 +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.createVisibilityHandlerResult = exports.useHierarchyVisibility = void 0;
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const rxjs_1 = require("rxjs");
|
|
10
|
-
const UseTelemetryContext_js_1 = require("./UseTelemetryContext.js");
|
|
11
|
-
function useHierarchyVisibility({ visibilityHandlerFactory }) {
|
|
12
|
-
const visibilityStatusMap = (0, react_1.useRef)(new Map());
|
|
13
|
-
const [state, setState] = (0, react_1.useState)({
|
|
14
|
-
getCheckboxState: () => ({ state: "off", isDisabled: true }),
|
|
15
|
-
onCheckboxClicked: () => { },
|
|
16
|
-
triggerRefresh: () => { },
|
|
17
|
-
});
|
|
18
|
-
const { onFeatureUsed } = (0, UseTelemetryContext_js_1.useTelemetryContext)();
|
|
19
|
-
(0, react_1.useEffect)(() => {
|
|
20
|
-
visibilityStatusMap.current.clear();
|
|
21
|
-
const handler = visibilityHandlerFactory();
|
|
22
|
-
const visibilityChanged = new rxjs_1.Subject();
|
|
23
|
-
const calculate = new rxjs_1.Subject();
|
|
24
|
-
const calculateNodeStatus = (node) => {
|
|
25
|
-
calculate.next(node);
|
|
26
|
-
};
|
|
27
|
-
const resetCache = () => {
|
|
28
|
-
visibilityStatusMap.current.forEach((value) => {
|
|
29
|
-
value.needsRefresh = true;
|
|
30
|
-
});
|
|
31
|
-
visibilityChanged.next();
|
|
32
|
-
};
|
|
33
|
-
const triggerCheckboxUpdate = () => {
|
|
34
|
-
setState((prev) => ({
|
|
35
|
-
...prev,
|
|
36
|
-
getCheckboxState: createStateGetter(visibilityStatusMap, calculateNodeStatus),
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
const subscription = calculate
|
|
40
|
-
.pipe((0, rxjs_1.distinct)(undefined, visibilityChanged), (0, rxjs_1.observeOn)(rxjs_1.asyncScheduler), (0, rxjs_1.mergeMap)((node) => (0, rxjs_1.defer)(async () => handler.getVisibilityStatus(node.nodeData)).pipe((0, rxjs_1.tap)({
|
|
41
|
-
next: (status) => {
|
|
42
|
-
visibilityStatusMap.current.set(node.id, {
|
|
43
|
-
node,
|
|
44
|
-
status,
|
|
45
|
-
needsRefresh: false,
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
}), (0, rxjs_1.takeUntil)(visibilityChanged), (0, rxjs_1.onErrorResumeNextWith)(rxjs_1.EMPTY))), (0, rxjs_1.throttleTime)(100, undefined, { leading: false, trailing: true }))
|
|
49
|
-
.subscribe({
|
|
50
|
-
next: () => {
|
|
51
|
-
triggerCheckboxUpdate();
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
const changeVisibility = (node, checked) => {
|
|
55
|
-
onFeatureUsed({ featureId: "visibility-change", reportInteraction: true });
|
|
56
|
-
void handler.changeVisibility(node.nodeData, checked);
|
|
57
|
-
const entry = visibilityStatusMap.current.get(node.id);
|
|
58
|
-
if (!entry) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
entry.status.state = checked ? "visible" : "hidden";
|
|
62
|
-
entry.status.tooltip = undefined;
|
|
63
|
-
triggerCheckboxUpdate();
|
|
64
|
-
};
|
|
65
|
-
setState({
|
|
66
|
-
onCheckboxClicked: changeVisibility,
|
|
67
|
-
getCheckboxState: createStateGetter(visibilityStatusMap, calculateNodeStatus),
|
|
68
|
-
triggerRefresh: () => {
|
|
69
|
-
resetCache();
|
|
70
|
-
triggerCheckboxUpdate();
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
const removeListener = handler.onVisibilityChange.addListener(() => {
|
|
74
|
-
resetCache();
|
|
75
|
-
triggerCheckboxUpdate();
|
|
76
|
-
});
|
|
77
|
-
return () => {
|
|
78
|
-
subscription.unsubscribe();
|
|
79
|
-
removeListener();
|
|
80
|
-
handler.dispose();
|
|
81
|
-
};
|
|
82
|
-
}, [visibilityHandlerFactory, onFeatureUsed]);
|
|
83
|
-
return state;
|
|
84
|
-
}
|
|
85
|
-
exports.useHierarchyVisibility = useHierarchyVisibility;
|
|
86
|
-
function createStateGetter(map, calculateVisibility) {
|
|
87
|
-
return (node) => {
|
|
88
|
-
const entry = map.current.get(node.id);
|
|
89
|
-
if (entry === undefined) {
|
|
90
|
-
calculateVisibility(node);
|
|
91
|
-
return { state: "off", isDisabled: true };
|
|
92
|
-
}
|
|
93
|
-
if (entry.needsRefresh) {
|
|
94
|
-
calculateVisibility(node);
|
|
95
|
-
}
|
|
96
|
-
const status = entry.status;
|
|
97
|
-
return {
|
|
98
|
-
state: status.state === "visible" ? "on" : status.state === "hidden" ? "off" : "partial",
|
|
99
|
-
tooltip: status.tooltip,
|
|
100
|
-
isDisabled: status.isDisabled,
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function createVisibilityHandlerResult(handler, props, obs, override) {
|
|
105
|
-
return override
|
|
106
|
-
? (0, rxjs_1.from)(override({
|
|
107
|
-
...props,
|
|
108
|
-
originalImplementation: async () => (0, rxjs_1.lastValueFrom)(obs, { defaultValue: undefined }),
|
|
109
|
-
handler,
|
|
110
|
-
}))
|
|
111
|
-
: obs;
|
|
112
|
-
}
|
|
113
|
-
exports.createVisibilityHandlerResult = createVisibilityHandlerResult;
|
|
114
|
-
//# sourceMappingURL=UseHierarchyVisibility.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseHierarchyVisibility.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/UseHierarchyVisibility.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAoD;AACpD,+BAEc;AACd,qEAA+D;AAsC/D,SAAgB,sBAAsB,CAAC,EAAE,wBAAwB,EAA+B;IAC9F,MAAM,mBAAmB,GAAG,IAAA,cAAM,EAAC,IAAI,GAAG,EAAgG,CAAC,CAAC;IAC5I,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAqD;QACrF,gBAAgB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QAC5D,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;QAC3B,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;KACzB,CAAC,CAAC;IACH,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,4CAAmB,GAAE,CAAC;IAEhD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,wBAAwB,EAAE,CAAC;QAE3C,MAAM,iBAAiB,GAAG,IAAI,cAAO,EAAQ,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,cAAO,EAA6B,CAAC;QAC3D,MAAM,mBAAmB,GAAG,CAAC,IAA+B,EAAE,EAAE;YAC9D,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC;QAEF,MAAM,UAAU,GAAG,GAAG,EAAE;YACtB,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC5C,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC,CAAC;YACH,iBAAiB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AAC,CAAC;QACvC,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;SAC3C;QACD,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,mBAAmB,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YACxF,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA0BD,SAAgB,6BAA6B,CAC3C,OAAmC,EACnC,KAAqB,EACrB,GAAwB,EACxB,QAA8G;IAE9G,OAAO,QAAQ;QACb,CAAC,CAAC,IAAA,WAAI,EACF,QAAQ,CAAC;YACP,GAAG,KAAK;YACR,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,EAAE,EAAE,YAAY,EAAE,SAAoB,EAAE,CAAC;YAC9F,OAAO;SACR,CAAC,CACH;QACH,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAfD,sEAeC","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 { useEffect, useRef, useState } from \"react\";\nimport {\n asyncScheduler, defer, distinct, EMPTY, from, lastValueFrom, mergeMap, observeOn, onErrorResumeNextWith, Subject, takeUntil, tap, throttleTime,\n} from \"rxjs\";\nimport { useTelemetryContext } from \"./UseTelemetryContext.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { MutableRefObject } from \"react\";\nimport type { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport type { HierarchyNode, PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { TreeCheckboxProps } from \"./components/TreeNodeCheckbox.js\";\n\n/**\n * Data structure that describes instance visibility status.\n * @beta\n */\nexport interface VisibilityStatus {\n /** Instance visibility state. */\n state: \"visible\" | \"partial\" | \"hidden\";\n /** Specifies whether visibility changing is disabled or not. */\n isDisabled?: boolean;\n /** Tooltip that should be displayed when hovering over the visibility checkbox. */\n tooltip?: string;\n}\n\n/**\n * Handler that can be used to determine and change visibility of instances represented by tree nodes.\n * @beta\n */\nexport interface HierarchyVisibilityHandler extends IDisposable {\n /** Event used to notify tree about visibility changes from outside. */\n readonly onVisibilityChange: BeEvent<() => void>;\n /** Returns current visibility status for tree node. */\n getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;\n /** Changes visibility of the instance represented by tree node. */\n changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;\n}\n\ninterface UseHierarchyVisibilityProps {\n visibilityHandlerFactory: () => HierarchyVisibilityHandler;\n}\n\nexport function useHierarchyVisibility({ visibilityHandlerFactory }: UseHierarchyVisibilityProps): TreeCheckboxProps & { triggerRefresh: () => void } {\n const visibilityStatusMap = useRef(new Map<string, { node: PresentationHierarchyNode; status: VisibilityStatus; needsRefresh: boolean }>());\n const [state, setState] = useState<TreeCheckboxProps & { triggerRefresh: () => void }>({\n getCheckboxState: () => ({ state: \"off\", isDisabled: true }),\n onCheckboxClicked: () => {},\n triggerRefresh: () => {},\n });\n const { onFeatureUsed } = useTelemetryContext();\n\n useEffect(() => {\n visibilityStatusMap.current.clear();\n const handler = visibilityHandlerFactory();\n\n const visibilityChanged = new Subject<void>();\n const calculate = new Subject<PresentationHierarchyNode>();\n const calculateNodeStatus = (node: PresentationHierarchyNode) => {\n calculate.next(node);\n };\n\n const resetCache = () => {\n visibilityStatusMap.current.forEach((value) => {\n value.needsRefresh = true;\n });\n visibilityChanged.next();\n };\n\n const triggerCheckboxUpdate = () => {\n setState((prev) => ({\n ...prev,\n getCheckboxState: createStateGetter(visibilityStatusMap, calculateNodeStatus),\n }));\n };\n\n const subscription = calculate\n .pipe(\n distinct(undefined, visibilityChanged),\n observeOn(asyncScheduler),\n mergeMap((node) =>\n defer(async () => handler.getVisibilityStatus(node.nodeData)).pipe(\n tap({\n next: (status) => {\n visibilityStatusMap.current.set(node.id, {\n node,\n status,\n needsRefresh: false,\n });\n },\n }),\n takeUntil(visibilityChanged),\n onErrorResumeNextWith(EMPTY),\n ),\n ),\n throttleTime(100, undefined, { leading: false, trailing: true }),\n )\n .subscribe({\n next: () => {\n triggerCheckboxUpdate();\n },\n });\n\n const changeVisibility = (node: PresentationHierarchyNode, checked: boolean) => {\n onFeatureUsed({ featureId: \"visibility-change\", reportInteraction: true });\n void handler.changeVisibility(node.nodeData, checked);\n const entry = visibilityStatusMap.current.get(node.id);\n if (!entry) {\n return;\n }\n entry.status.state = checked ? \"visible\" : \"hidden\";\n entry.status.tooltip = undefined;\n triggerCheckboxUpdate();\n };\n\n setState({\n onCheckboxClicked: changeVisibility,\n getCheckboxState: createStateGetter(visibilityStatusMap, calculateNodeStatus),\n triggerRefresh: () => {\n resetCache();\n triggerCheckboxUpdate();\n },\n });\n\n const removeListener = handler.onVisibilityChange.addListener(() => {\n resetCache();\n triggerCheckboxUpdate();\n });\n\n return () => {\n subscription.unsubscribe();\n removeListener();\n handler.dispose();\n };\n }, [visibilityHandlerFactory, onFeatureUsed]);\n\n return state;\n}\n\nfunction createStateGetter(\n map: MutableRefObject<Map<string, { node: PresentationHierarchyNode; status: VisibilityStatus; needsRefresh: boolean }>>,\n calculateVisibility: (node: PresentationHierarchyNode) => void,\n): TreeCheckboxProps[\"getCheckboxState\"] {\n return (node) => {\n const entry = map.current.get(node.id);\n if (entry === undefined) {\n calculateVisibility(node);\n return { state: \"off\", isDisabled: true };\n }\n if (entry.needsRefresh) {\n calculateVisibility(node);\n }\n\n const status = entry.status;\n return {\n state: status.state === \"visible\" ? \"on\" : status.state === \"hidden\" ? \"off\" : \"partial\",\n tooltip: status.tooltip,\n isDisabled: status.isDisabled,\n };\n };\n}\n\n/**\n * Properties for an overridden method of a `HierarchyVisibilityHandler` implementation.\n * @beta\n */\nexport type HierarchyVisibilityHandlerOverridableMethodProps<TFunc> = TFunc extends (props: infer TProps) => infer TResult\n ? TProps & {\n /** A callback that produces the value from the original implementation. */\n readonly originalImplementation: () => TResult;\n /**\n * Reference to the hierarchy based handler.\n * @note Calling `getVisibility` or `changeVisibility` of this object invokes the overridden implementation as well.\n */\n readonly handler: HierarchyVisibilityHandler;\n }\n : never;\n\n/**\n * Function type for an overridden method of `HierarchyVisibilityHandler`.\n * @beta\n */\nexport type HierarchyVisibilityHandlerOverridableMethod<TFunc> = TFunc extends (...args: any[]) => infer TResult\n ? (props: HierarchyVisibilityHandlerOverridableMethodProps<TFunc>) => TResult\n : never;\n\nexport function createVisibilityHandlerResult<TResult, TOverrideProps>(\n handler: HierarchyVisibilityHandler,\n props: TOverrideProps,\n obs: Observable<TResult>,\n override: HierarchyVisibilityHandlerOverridableMethod<(props: TOverrideProps) => Promise<TResult>> | undefined,\n): Observable<TResult> {\n return override\n ? from(\n override({\n ...props,\n originalImplementation: async () => lastValueFrom(obs, { defaultValue: undefined as TResult }),\n handler,\n }),\n )\n : obs;\n}\n"]}
|