@itwin/tree-widget-react 2.3.2 → 3.0.0-dev.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 +2 -2
- package/README.md +232 -147
- package/lib/cjs/TreeWidget.d.ts +2 -4
- package/lib/cjs/TreeWidget.js +0 -6
- package/lib/cjs/TreeWidget.js.map +1 -1
- package/lib/cjs/components/SelectableTree.d.ts +3 -9
- package/lib/cjs/components/SelectableTree.js +1 -1
- package/lib/cjs/components/SelectableTree.js.map +1 -1
- package/lib/cjs/components/TreeSelector.d.ts +2 -2
- package/lib/cjs/components/TreeSelector.js.map +1 -1
- package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +14 -25
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js +43 -45
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.js +17 -9
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.scss +7 -41
- package/lib/cjs/components/trees/Tree.scss +23 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +22 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +78 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.d.ts +21 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js +37 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.d.ts +55 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +75 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js +185 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js +94 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/UseCategories.d.ts +8 -0
- package/lib/cjs/components/trees/categories-tree/UseCategories.js +22 -0
- package/lib/cjs/components/trees/categories-tree/UseCategories.js.map +1 -0
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +46 -0
- package/lib/cjs/components/trees/{CategoriesVisibilityUtils.js → common/CategoriesVisibilityUtils.js} +56 -8
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -0
- package/lib/cjs/components/trees/common/FocusedInstancesContext.d.ts +14 -0
- package/lib/cjs/components/trees/common/FocusedInstancesContext.js +16 -0
- package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -0
- package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.d.ts +8 -0
- package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js +71 -0
- package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/cjs/components/trees/common/Rxjs.d.ts +10 -0
- package/lib/cjs/components/trees/common/Rxjs.js +46 -0
- package/lib/cjs/components/trees/common/Rxjs.js.map +1 -0
- package/lib/cjs/components/trees/common/UseFeatureReporting.d.ts +11 -0
- package/lib/cjs/components/trees/common/UseFeatureReporting.js +10 -1
- package/lib/cjs/components/trees/common/UseFeatureReporting.js.map +1 -1
- package/lib/cjs/components/trees/common/UseFiltering.d.ts +12 -0
- package/lib/cjs/components/trees/common/UseFiltering.js +29 -0
- package/lib/cjs/components/trees/common/UseFiltering.js.map +1 -0
- package/lib/cjs/components/trees/common/UseHierarchiesLocalization.d.ts +8 -0
- package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js +33 -0
- package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/cjs/components/trees/common/UseHierarchyFiltering.d.ts +19 -0
- package/lib/cjs/components/trees/common/UseHierarchyFiltering.js +157 -0
- package/lib/cjs/components/trees/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/cjs/components/trees/common/UseHierarchyVisibility.d.ts +30 -0
- package/lib/cjs/components/trees/common/UseHierarchyVisibility.js +98 -0
- package/lib/cjs/components/trees/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/cjs/components/trees/common/UseIModelChangeListener.d.ts +9 -0
- package/lib/cjs/components/trees/common/UseIModelChangeListener.js +20 -0
- package/lib/cjs/components/trees/common/UseIModelChangeListener.js.map +1 -0
- package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.d.ts +13 -0
- package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js +35 -0
- package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/cjs/components/trees/common/UseNodeHighlighting.d.ts +16 -0
- package/lib/cjs/components/trees/common/UseNodeHighlighting.js +140 -0
- package/lib/cjs/components/trees/common/UseNodeHighlighting.js.map +1 -0
- package/lib/cjs/components/trees/common/Utils.d.ts +16 -6
- package/lib/cjs/components/trees/common/Utils.js +38 -34
- package/lib/cjs/components/trees/common/Utils.js.map +1 -1
- package/lib/cjs/components/trees/common/components/BaseTree.d.ts +34 -0
- package/lib/cjs/components/trees/common/components/BaseTree.js +77 -0
- package/lib/cjs/components/trees/common/components/BaseTree.js.map +1 -0
- package/lib/cjs/components/trees/common/components/Delayed.d.ts +6 -0
- package/lib/cjs/components/trees/common/components/Delayed.js +31 -0
- package/lib/cjs/components/trees/common/components/Delayed.js.map +1 -0
- package/lib/cjs/components/trees/common/components/ProgressOverlay.d.ts +5 -0
- package/lib/cjs/components/trees/common/components/ProgressOverlay.js +16 -0
- package/lib/cjs/components/trees/common/components/ProgressOverlay.js.map +1 -0
- package/lib/cjs/components/trees/common/components/ProgressOverlay.scss +21 -0
- package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
- package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.js +28 -0
- package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeNodeRenderer.d.ts +13 -0
- package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js +20 -0
- package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.d.ts +19 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.js +30 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.scss +62 -0
- package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +14 -0
- package/lib/cjs/components/trees/common/components/VisibilityTree.js +41 -0
- package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +11 -35
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js +29 -83
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -14
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +12 -12
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +24 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +262 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +11 -35
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js +41 -79
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -14
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +12 -12
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +28 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +619 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +26 -0
- package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +203 -0
- package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -0
- package/lib/cjs/components/trees/index.d.ts +4 -16
- package/lib/cjs/components/trees/index.js +9 -30
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +17 -72
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +196 -135
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +101 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +14 -35
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +40 -83
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.d.ts +67 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js +617 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +24 -0
- package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +121 -0
- package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +44 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.js +325 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.d.ts +31 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.js +40 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +122 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +757 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/Tooltip.d.ts +13 -0
- package/lib/cjs/components/trees/models-tree/internal/Tooltip.js +29 -0
- package/lib/cjs/components/trees/models-tree/internal/Tooltip.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +10 -0
- package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.js +43 -0
- package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/cjs/tree-widget-react.d.ts +3 -4
- package/lib/cjs/tree-widget-react.js +8 -4
- package/lib/cjs/tree-widget-react.js.map +1 -1
- package/lib/esm/TreeWidget.d.ts +2 -4
- package/lib/esm/TreeWidget.js +0 -6
- package/lib/esm/TreeWidget.js.map +1 -1
- package/lib/esm/components/SelectableTree.d.ts +3 -9
- package/lib/esm/components/SelectableTree.js +1 -1
- package/lib/esm/components/SelectableTree.js.map +1 -1
- package/lib/esm/components/TreeSelector.d.ts +2 -2
- package/lib/esm/components/TreeSelector.js.map +1 -1
- package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +14 -25
- package/lib/esm/components/TreeWidgetUiItemsProvider.js +42 -44
- package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.js +17 -9
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.scss +7 -41
- package/lib/esm/components/trees/Tree.scss +23 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +22 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js +74 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.d.ts +21 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js +31 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.d.ts +55 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +68 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js +181 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js +90 -0
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/UseCategories.d.ts +8 -0
- package/lib/esm/components/trees/categories-tree/UseCategories.js +18 -0
- package/lib/esm/components/trees/categories-tree/UseCategories.js.map +1 -0
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +46 -0
- package/lib/esm/components/trees/{CategoriesVisibilityUtils.js → common/CategoriesVisibilityUtils.js} +51 -6
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -0
- package/lib/esm/components/trees/common/FocusedInstancesContext.d.ts +14 -0
- package/lib/esm/components/trees/common/FocusedInstancesContext.js +12 -0
- package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -0
- package/lib/esm/components/trees/common/FocusedInstancesContextProvider.d.ts +8 -0
- package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js +67 -0
- package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/esm/components/trees/common/Rxjs.d.ts +10 -0
- package/lib/esm/components/trees/common/Rxjs.js +40 -0
- package/lib/esm/components/trees/common/Rxjs.js.map +1 -0
- package/lib/esm/components/trees/common/UseFeatureReporting.d.ts +11 -0
- package/lib/esm/components/trees/common/UseFeatureReporting.js +8 -0
- package/lib/esm/components/trees/common/UseFeatureReporting.js.map +1 -1
- package/lib/esm/components/trees/common/UseFiltering.d.ts +12 -0
- package/lib/esm/components/trees/common/UseFiltering.js +25 -0
- package/lib/esm/components/trees/common/UseFiltering.js.map +1 -0
- package/lib/esm/components/trees/common/UseHierarchiesLocalization.d.ts +8 -0
- package/lib/esm/components/trees/common/UseHierarchiesLocalization.js +29 -0
- package/lib/esm/components/trees/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/components/trees/common/UseHierarchyFiltering.d.ts +19 -0
- package/lib/esm/components/trees/common/UseHierarchyFiltering.js +153 -0
- package/lib/esm/components/trees/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/components/trees/common/UseHierarchyVisibility.d.ts +30 -0
- package/lib/esm/components/trees/common/UseHierarchyVisibility.js +94 -0
- package/lib/esm/components/trees/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/esm/components/trees/common/UseIModelChangeListener.d.ts +9 -0
- package/lib/esm/components/trees/common/UseIModelChangeListener.js +16 -0
- package/lib/esm/components/trees/common/UseIModelChangeListener.js.map +1 -0
- package/lib/esm/components/trees/common/UseMultiCheckboxHandler.d.ts +13 -0
- package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js +31 -0
- package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/esm/components/trees/common/UseNodeHighlighting.d.ts +16 -0
- package/lib/esm/components/trees/common/UseNodeHighlighting.js +136 -0
- package/lib/esm/components/trees/common/UseNodeHighlighting.js.map +1 -0
- package/lib/esm/components/trees/common/Utils.d.ts +16 -6
- package/lib/esm/components/trees/common/Utils.js +33 -29
- package/lib/esm/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/components/trees/common/components/BaseTree.d.ts +34 -0
- package/lib/esm/components/trees/common/components/BaseTree.js +73 -0
- package/lib/esm/components/trees/common/components/BaseTree.js.map +1 -0
- package/lib/esm/components/trees/common/components/Delayed.d.ts +6 -0
- package/lib/esm/components/trees/common/components/Delayed.js +27 -0
- package/lib/esm/components/trees/common/components/Delayed.js.map +1 -0
- package/lib/esm/components/trees/common/components/ProgressOverlay.d.ts +5 -0
- package/lib/esm/components/trees/common/components/ProgressOverlay.js +12 -0
- package/lib/esm/components/trees/common/components/ProgressOverlay.js.map +1 -0
- package/lib/esm/components/trees/common/components/ProgressOverlay.scss +21 -0
- package/lib/esm/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
- package/lib/esm/components/trees/common/components/TreeNodeCheckbox.js +21 -0
- package/lib/esm/components/trees/common/components/TreeNodeCheckbox.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeNodeRenderer.d.ts +13 -0
- package/lib/esm/components/trees/common/components/TreeNodeRenderer.js +13 -0
- package/lib/esm/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.d.ts +19 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.js +26 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.scss +62 -0
- package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +14 -0
- package/lib/esm/components/trees/common/components/VisibilityTree.js +37 -0
- package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +11 -35
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +27 -58
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -14
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +12 -12
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +24 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +258 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +11 -35
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +39 -54
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -14
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +12 -12
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +28 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +615 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +26 -0
- package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +199 -0
- package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -0
- package/lib/esm/components/trees/index.d.ts +4 -16
- package/lib/esm/components/trees/index.js +4 -16
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +17 -72
- package/lib/esm/components/trees/models-tree/ModelsTree.js +196 -132
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +92 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +14 -35
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +38 -81
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.d.ts +67 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js +613 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +24 -0
- package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +117 -0
- package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +44 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.js +321 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.d.ts +31 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.js +37 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +122 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +748 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/Tooltip.d.ts +13 -0
- package/lib/esm/components/trees/models-tree/internal/Tooltip.js +24 -0
- package/lib/esm/components/trees/models-tree/internal/Tooltip.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +10 -0
- package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.js +39 -0
- package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/esm/tree-widget-react.d.ts +3 -4
- package/lib/esm/tree-widget-react.js +3 -4
- package/lib/esm/tree-widget-react.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +126 -42
- package/package.json +19 -6
- package/lib/cjs/components/TreeFilteringState.d.ts +0 -18
- package/lib/cjs/components/TreeFilteringState.js +0 -46
- package/lib/cjs/components/TreeFilteringState.js.map +0 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +0 -25
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js.map +0 -1
- package/lib/cjs/components/trees/VisibilityTreeBase.scss +0 -82
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.d.ts +0 -67
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js +0 -158
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js.map +0 -1
- package/lib/cjs/components/trees/VisibilityTreeRenderer.d.ts +0 -100
- package/lib/cjs/components/trees/VisibilityTreeRenderer.js +0 -98
- package/lib/cjs/components/trees/VisibilityTreeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/Categories.json +0 -99
- package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +0 -60
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js +0 -141
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.d.ts +0 -71
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +0 -123
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -72
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js +0 -172
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/trees/common/ContextMenu.d.ts +0 -39
- package/lib/cjs/components/trees/common/ContextMenu.js +0 -44
- package/lib/cjs/components/trees/common/ContextMenu.js.map +0 -1
- package/lib/cjs/components/trees/common/ReportingTreeEventHandler.d.ts +0 -27
- package/lib/cjs/components/trees/common/ReportingTreeEventHandler.js +0 -51
- package/lib/cjs/components/trees/common/ReportingTreeEventHandler.js.map +0 -1
- package/lib/cjs/components/trees/common/TreeNodeRenderer.d.ts +0 -61
- package/lib/cjs/components/trees/common/TreeNodeRenderer.js +0 -50
- package/lib/cjs/components/trees/common/TreeNodeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/common/TreeRenderer.d.ts +0 -55
- package/lib/cjs/components/trees/common/TreeRenderer.js +0 -67
- package/lib/cjs/components/trees/common/TreeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/common/TreeRenderer.scss +0 -149
- package/lib/cjs/components/trees/common/Types.d.ts +0 -57
- package/lib/cjs/components/trees/common/Types.js +0 -21
- package/lib/cjs/components/trees/common/Types.js.map +0 -1
- package/lib/cjs/components/trees/common/UseVisibilityTreeState.d.ts +0 -43
- package/lib/cjs/components/trees/common/UseVisibilityTreeState.js +0 -49
- package/lib/cjs/components/trees/common/UseVisibilityTreeState.js.map +0 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSources.json +0 -228
- package/lib/cjs/components/trees/imodel-content-tree/IModelContent.json +0 -443
- package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.d.ts +0 -19
- package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.js +0 -36
- package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.js.map +0 -1
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.d.ts +0 -130
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js +0 -651
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/trees/models-tree/Utils.d.ts +0 -29
- package/lib/cjs/components/trees/models-tree/Utils.js +0 -556
- package/lib/cjs/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/cjs/components/utils/UseTreeTransientState.d.ts +0 -19
- package/lib/cjs/components/utils/UseTreeTransientState.js +0 -33
- package/lib/cjs/components/utils/UseTreeTransientState.js.map +0 -1
- package/lib/esm/components/TreeFilteringState.d.ts +0 -18
- package/lib/esm/components/TreeFilteringState.js +0 -42
- package/lib/esm/components/TreeFilteringState.js.map +0 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +0 -25
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js.map +0 -1
- package/lib/esm/components/trees/VisibilityTreeBase.scss +0 -82
- package/lib/esm/components/trees/VisibilityTreeEventHandler.d.ts +0 -67
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js +0 -154
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js.map +0 -1
- package/lib/esm/components/trees/VisibilityTreeRenderer.d.ts +0 -100
- package/lib/esm/components/trees/VisibilityTreeRenderer.js +0 -86
- package/lib/esm/components/trees/VisibilityTreeRenderer.js.map +0 -1
- package/lib/esm/components/trees/category-tree/Categories.json +0 -99
- package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +0 -60
- package/lib/esm/components/trees/category-tree/CategoriesTree.js +0 -111
- package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.d.ts +0 -71
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +0 -116
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -72
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js +0 -164
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +0 -1
- package/lib/esm/components/trees/common/ContextMenu.d.ts +0 -39
- package/lib/esm/components/trees/common/ContextMenu.js +0 -39
- package/lib/esm/components/trees/common/ContextMenu.js.map +0 -1
- package/lib/esm/components/trees/common/ReportingTreeEventHandler.d.ts +0 -27
- package/lib/esm/components/trees/common/ReportingTreeEventHandler.js +0 -47
- package/lib/esm/components/trees/common/ReportingTreeEventHandler.js.map +0 -1
- package/lib/esm/components/trees/common/TreeNodeRenderer.d.ts +0 -61
- package/lib/esm/components/trees/common/TreeNodeRenderer.js +0 -44
- package/lib/esm/components/trees/common/TreeNodeRenderer.js.map +0 -1
- package/lib/esm/components/trees/common/TreeRenderer.d.ts +0 -55
- package/lib/esm/components/trees/common/TreeRenderer.js +0 -59
- package/lib/esm/components/trees/common/TreeRenderer.js.map +0 -1
- package/lib/esm/components/trees/common/TreeRenderer.scss +0 -149
- package/lib/esm/components/trees/common/Types.d.ts +0 -57
- package/lib/esm/components/trees/common/Types.js +0 -18
- package/lib/esm/components/trees/common/Types.js.map +0 -1
- package/lib/esm/components/trees/common/UseVisibilityTreeState.d.ts +0 -43
- package/lib/esm/components/trees/common/UseVisibilityTreeState.js +0 -45
- package/lib/esm/components/trees/common/UseVisibilityTreeState.js.map +0 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSources.json +0 -228
- package/lib/esm/components/trees/imodel-content-tree/IModelContent.json +0 -443
- package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.d.ts +0 -19
- package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.js +0 -32
- package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.js.map +0 -1
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.d.ts +0 -130
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js +0 -641
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js.map +0 -1
- package/lib/esm/components/trees/models-tree/Utils.d.ts +0 -29
- package/lib/esm/components/trees/models-tree/Utils.js +0 -548
- package/lib/esm/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/esm/components/utils/UseTreeTransientState.d.ts +0 -19
- package/lib/esm/components/utils/UseTreeTransientState.js +0 -29
- package/lib/esm/components/utils/UseTreeTransientState.js.map +0 -1
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { QueryRowFormat } from "@itwin/core-common";
|
|
6
|
-
import { PerModelCategoryVisibility } from "@itwin/core-frontend";
|
|
7
|
-
const EMPTY_CATEGORIES_ARRAY = [];
|
|
6
|
+
import { IModelApp, PerModelCategoryVisibility } from "@itwin/core-frontend";
|
|
8
7
|
/**
|
|
9
8
|
* Toggles visibility of categories to show or hide.
|
|
10
9
|
* @internal
|
|
@@ -17,7 +16,7 @@ export async function toggleAllCategories(viewManager, imodel, display, viewport
|
|
|
17
16
|
if (ids.length === 0) {
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
|
-
await
|
|
19
|
+
await enableCategoryDisplay(viewManager, imodel, ids, display, forAllViewports ?? false);
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* Gets ids of all categories from specified imodel and viewport.
|
|
@@ -31,7 +30,7 @@ export async function getCategories(imodel, viewport) {
|
|
|
31
30
|
* Changes category display in the viewport.
|
|
32
31
|
* @internal
|
|
33
32
|
*/
|
|
34
|
-
export async function
|
|
33
|
+
export async function enableCategoryDisplay(viewManager, imodel, ids, enabled, forAllViewports, enableAllSubCategories = true) {
|
|
35
34
|
if (!viewManager.selectedView) {
|
|
36
35
|
return;
|
|
37
36
|
}
|
|
@@ -52,7 +51,7 @@ export async function enableCategory(viewManager, imodel, ids, enabled, forAllVi
|
|
|
52
51
|
// changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.
|
|
53
52
|
if (false === enabled) {
|
|
54
53
|
(await imodel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {
|
|
55
|
-
categoryInfo.subCategories.forEach((value) =>
|
|
54
|
+
categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewManager, value.id, false, forAllViewports));
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
}
|
|
@@ -71,7 +70,7 @@ export async function enableCategory(viewManager, imodel, ids, enabled, forAllVi
|
|
|
71
70
|
* Changes subcategory display in the viewport
|
|
72
71
|
* @internal
|
|
73
72
|
*/
|
|
74
|
-
export function
|
|
73
|
+
export function enableSubCategoryDisplay(viewManager, key, enabled, forAllViewports) {
|
|
75
74
|
if (!viewManager.selectedView) {
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
@@ -112,4 +111,50 @@ export async function loadCategoriesFromViewport(iModel, vp) {
|
|
|
112
111
|
}
|
|
113
112
|
return categories;
|
|
114
113
|
}
|
|
114
|
+
const EMPTY_CATEGORIES_ARRAY = [];
|
|
115
|
+
/**
|
|
116
|
+
* Enable display of all given categories.
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export async function showAllCategories(categories, viewport) {
|
|
120
|
+
await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, categories, true, true);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Disable display of all given categories.
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
export async function hideAllCategories(categories, viewport) {
|
|
127
|
+
await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, categories, false, true);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Invert display of all given categories.
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
export async function invertAllCategories(categories, viewport) {
|
|
134
|
+
const enabled = [];
|
|
135
|
+
const disabled = [];
|
|
136
|
+
const enabledSubCategories = [];
|
|
137
|
+
const disabledSubCategories = [];
|
|
138
|
+
for (const category of categories) {
|
|
139
|
+
if (!viewport.view.viewsCategory(category.categoryId)) {
|
|
140
|
+
disabled.push(category.categoryId);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
// First, we need to check if at least one subcategory is disabled. If it is true, then only subcategories should change display, not categories.
|
|
144
|
+
if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {
|
|
145
|
+
for (const subCategory of category.subCategoryIds) {
|
|
146
|
+
viewport.isSubCategoryVisible(subCategory) ? enabledSubCategories.push(subCategory) : disabledSubCategories.push(subCategory);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
enabled.push(category.categoryId);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Disable enabled
|
|
154
|
+
enabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, false, true));
|
|
155
|
+
await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, enabled, false, true);
|
|
156
|
+
// Enable disabled
|
|
157
|
+
disabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, true, true));
|
|
158
|
+
await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, disabled, true, true);
|
|
159
|
+
}
|
|
115
160
|
//# sourceMappingURL=CategoriesVisibilityUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/CategoriesVisibilityUtils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAY7E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,WAAwB,EACxB,MAAwB,EACxB,OAAgB,EA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AAC;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,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAEzH,MAAM,qBAAqB,CAAC,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAE1F,kBAAkB;IAClB,qBAAqB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,wBAAwB,CAAC,SAAS,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAEzH,MAAM,qBAAqB,CAAC,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5F,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 { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelApp, PerModelCategoryVisibility } from \"@itwin/core-frontend\";\n\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Data structure that describes category.\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Toggles visibility of categories to show or hide.\n * @internal\n */\nexport async function toggleAllCategories(\n viewManager: ViewManager,\n imodel: IModelConnection,\n display: boolean,\n viewport?: Viewport,\n forAllViewports?: boolean,\n) {\n // istanbul ignore next\n const activeView = viewport ?? viewManager.getFirstOpenView();\n const ids = await getCategories(imodel, activeView);\n\n // istanbul ignore if\n if (ids.length === 0) {\n return;\n }\n\n await enableCategoryDisplay(viewManager, imodel, ids, display, forAllViewports ?? false);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n * @internal\n */\nexport async function getCategories(imodel: IModelConnection, viewport?: Viewport) {\n const categories = await loadCategoriesFromViewport(imodel, viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/**\n * Changes category display in the viewport.\n * @internal\n */\nexport async function enableCategoryDisplay(\n viewManager: ViewManager,\n imodel: IModelConnection,\n ids: string[],\n enabled: boolean,\n forAllViewports: boolean,\n enableAllSubCategories = true,\n) {\n if (!viewManager.selectedView) {\n return;\n }\n\n const updateViewport = async (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeCategoryDisplay(ids, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of vp.perModelCategoryVisibility) {\n // istanbul ignore else\n if (ids.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n vp.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 imodel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewManager, value.id, false, forAllViewports));\n });\n }\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n await updateViewport(viewport);\n }\n } else {\n await updateViewport(viewManager.selectedView);\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n * @internal\n */\nexport function enableSubCategoryDisplay(viewManager: ViewManager, key: string, enabled: boolean, forAllViewports?: boolean) {\n if (!viewManager.selectedView) {\n return;\n }\n\n const updateViewport = (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeSubCategoryDisplay(key, enabled);\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n updateViewport(viewport);\n }\n } else {\n updateViewport(viewManager.selectedView);\n }\n}\n\n/** @internal */\nexport async function loadCategoriesFromViewport(iModel?: IModelConnection, vp?: Viewport) {\n if (!vp) {\n return EMPTY_CATEGORIES_ARRAY;\n }\n\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 // istanbul ignore else\n if (iModel) {\n const rows = await iModel.createQueryReader(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await 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 }\n return categories;\n}\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, 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(IModelApp.viewManager, viewport.iModel, 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(IModelApp.viewManager, subCategory, false, true));\n\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, enabled, false, true);\n\n // Enable disabled\n disabledSubCategories.forEach((subCategory) => enableSubCategoryDisplay(IModelApp.viewManager, subCategory, true, true));\n\n await enableCategoryDisplay(IModelApp.viewManager, viewport.iModel, disabled, true, true);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { InstanceKey } from "@itwin/presentation-shared";
|
|
3
|
+
import type { GroupingHierarchyNode } from "@itwin/presentation-hierarchies";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export interface FocusedInstancesContext {
|
|
6
|
+
loadInstanceKeys?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const focusedInstancesContext: import("react").Context<FocusedInstancesContext>;
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare function useFocusedInstancesContext(): FocusedInstancesContext;
|
|
14
|
+
//# sourceMappingURL=FocusedInstancesContext.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const focusedInstancesContext = createContext({ enabled: false, toggle: () => { } });
|
|
8
|
+
/** @internal */
|
|
9
|
+
export function useFocusedInstancesContext() {
|
|
10
|
+
return useContext(focusedInstancesContext);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=FocusedInstancesContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusedInstancesContext.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContext.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAYlD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAEpH,gBAAgB;AAChB,MAAM,UAAU,0BAA0B;IACxC,OAAO,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7C,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 } from \"react\";\n\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport interface FocusedInstancesContext {\n loadInstanceKeys?: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>;\n enabled: boolean;\n toggle: () => void;\n}\n\n/** @internal */\nexport const focusedInstancesContext = createContext<FocusedInstancesContext>({ enabled: false, toggle: () => {} });\n\n/** @internal */\nexport function useFocusedInstancesContext() {\n return useContext(focusedInstancesContext);\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }: PropsWithChildren<{
|
|
5
|
+
selectionStorage: SelectionStorage;
|
|
6
|
+
imodelKey: string;
|
|
7
|
+
}>): JSX.Element;
|
|
8
|
+
//# sourceMappingURL=FocusedInstancesContextProvider.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
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
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { HierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
8
|
+
import { Selectable, Selectables } from "@itwin/unified-selection";
|
|
9
|
+
import { focusedInstancesContext } from "./FocusedInstancesContext";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }) {
|
|
12
|
+
const [state, setState] = useState({
|
|
13
|
+
enabled: false,
|
|
14
|
+
toggle: () => {
|
|
15
|
+
setState((prev) => ({ ...prev, enabled: !prev.enabled }));
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const enabled = state.enabled;
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!enabled) {
|
|
21
|
+
setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const onSelectionChanged = () => {
|
|
25
|
+
const selection = selectionStorage.getSelection({ imodelKey, level: 0 });
|
|
26
|
+
if (Selectables.isEmpty(selection)) {
|
|
27
|
+
setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const selected = [];
|
|
31
|
+
Selectables.forEach(selection, (selectable) => {
|
|
32
|
+
if (Selectable.isInstanceKey(selectable)) {
|
|
33
|
+
selected.push(selectable);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (isHierarchyNode(selectable.data) && HierarchyNode.isGroupingNode(selectable.data)) {
|
|
37
|
+
selected.push(selectable.data);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
selected.push(selectable.loadInstanceKeys);
|
|
41
|
+
});
|
|
42
|
+
const loadInstanceKeys = async function* () {
|
|
43
|
+
for (const item of selected) {
|
|
44
|
+
if (typeof item === "function") {
|
|
45
|
+
yield* item();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
yield item;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
setState((prev) => ({ ...prev, loadInstanceKeys }));
|
|
53
|
+
};
|
|
54
|
+
onSelectionChanged();
|
|
55
|
+
return selectionStorage.selectionChangeEvent.addListener(({ imodelKey: changeImodelKey, level }) => {
|
|
56
|
+
if (changeImodelKey !== imodelKey || level !== 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
onSelectionChanged();
|
|
60
|
+
});
|
|
61
|
+
}, [enabled, imodelKey, selectionStorage]);
|
|
62
|
+
return _jsx(focusedInstancesContext.Provider, { value: state, children: children });
|
|
63
|
+
}
|
|
64
|
+
function isHierarchyNode(data) {
|
|
65
|
+
return !!data && typeof data === "object" && "key" in data;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=FocusedInstancesContextProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusedInstancesContextProvider.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContextProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAQpE,gBAAgB;AAChB,MAAM,UAAU,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,QAAQ,GACqE;IAC7E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA0B;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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IAAI,KAAK,UAAU,EAAE;wBAC9B,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;qBACf;yBAAM;wBACL,MAAM,IAAI,CAAC;qBACZ;iBACF;YACH,CAAC,CAAC;YAEF,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF,kBAAkB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,EAAE;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,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAAC;AACvG,CAAC;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 { useEffect, useState } from \"react\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport { Selectable, Selectables } from \"@itwin/unified-selection\";\nimport { focusedInstancesContext } from \"./FocusedInstancesContext\";\n\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { PropsWithChildren } from \"react\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport type { FocusedInstancesContext } from \"./FocusedInstancesContext\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\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, loadInstanceKeys: 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, loadInstanceKeys: 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 loadInstanceKeys: () => 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, loadInstanceKeys }));\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"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { defaultIfEmpty, from, last, scan, takeWhile } from "rxjs";
|
|
6
|
+
/**
|
|
7
|
+
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
8
|
+
*/
|
|
9
|
+
export function reduceWhile(predicate, reduceFunc, initial) {
|
|
10
|
+
return (obs) => {
|
|
11
|
+
return obs.pipe(scan(reduceFunc, initial), takeWhile(predicate, true), defaultIfEmpty(undefined), last());
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */
|
|
15
|
+
export async function toVoidPromise(obs) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
obs.subscribe({
|
|
18
|
+
complete: () => resolve(),
|
|
19
|
+
error: reject,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Returns observable results in an array */
|
|
24
|
+
export async function collect(obs) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const arr = new Array();
|
|
27
|
+
from(obs).subscribe({
|
|
28
|
+
next(item) {
|
|
29
|
+
arr.push(item);
|
|
30
|
+
},
|
|
31
|
+
complete() {
|
|
32
|
+
resolve(arr);
|
|
33
|
+
},
|
|
34
|
+
error(reason) {
|
|
35
|
+
reject(reason);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Rxjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rxjs.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/Rxjs.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAInE;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,SAAuC,EACvC,UAA4D,EAC5D,OAAqB;IAErB,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5G,CAAC,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,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;AAED,6CAA6C;AAC7C,MAAM,CAAC,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,IAAI,CAAC,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","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"]}
|
|
@@ -20,4 +20,15 @@ export type UsageTrackedFeatures = "visibility-change" | "hierarchy-level-filter
|
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export declare function useFeatureReporting(props: UseFeatureReportingProps): UseFeatureReportingResult;
|
|
23
|
+
interface UseReportingActionProps<T> {
|
|
24
|
+
action: T;
|
|
25
|
+
featureId?: UsageTrackedFeatures;
|
|
26
|
+
reportUsage?: (props: {
|
|
27
|
+
featureId?: UsageTrackedFeatures;
|
|
28
|
+
reportInteraction: true;
|
|
29
|
+
}) => void;
|
|
30
|
+
}
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare function useReportingAction<T extends (...args: any[]) => void>({ action, featureId, reportUsage }: UseReportingActionProps<T>): (...args: Parameters<T>) => void;
|
|
33
|
+
export {};
|
|
23
34
|
//# sourceMappingURL=UseFeatureReporting.d.ts.map
|
|
@@ -23,4 +23,12 @@ export function useFeatureReporting(props) {
|
|
|
23
23
|
}, [treeIdentifier]);
|
|
24
24
|
return { reportUsage };
|
|
25
25
|
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
// istanbul ignore next
|
|
28
|
+
export function useReportingAction({ action, featureId, reportUsage }) {
|
|
29
|
+
return useCallback((...args) => {
|
|
30
|
+
reportUsage?.({ featureId, reportInteraction: true });
|
|
31
|
+
action(...args);
|
|
32
|
+
}, [action, reportUsage, featureId]);
|
|
33
|
+
}
|
|
26
34
|
//# sourceMappingURL=UseFeatureReporting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseFeatureReporting.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFeatureReporting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmBvD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC3C,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAoE,EAAE,EAAE;QACrG,IAAI,iBAAiB,KAAK,KAAK,EAAE;YAC/B,gBAAgB,CAAC,OAAO,EAAE,CAAC,OAAO,cAAc,EAAE,CAAC,CAAC;SACrD;QACD,IAAI,SAAS,EAAE;YACb,gBAAgB,CAAC,OAAO,EAAE,CAAC,GAAG,cAAc,IAAI,SAAS,EAAE,CAAC,CAAC;SAC9D;IACH,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,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, useEffect, useRef } from \"react\";\n\n/** @internal */\nexport interface UseFeatureReportingProps {\n treeIdentifier: string;\n onFeatureUsed?: (featureId: string) => void;\n}\n\n/** @internal */\nexport interface UseFeatureReportingResult {\n reportUsage: (props: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => void;\n}\n\n/**\n * Features that are tracked for usage.\n * @internal\n */\nexport type UsageTrackedFeatures = \"visibility-change\" | \"hierarchy-level-filtering\" | \"filtering\" | \"hierarchy-level-size-limit-hit\" | \"zoom-to-node\";\n\n/**\n * Enables feature reporting for a tree component.\n * @internal\n */\nexport function useFeatureReporting(props: UseFeatureReportingProps): UseFeatureReportingResult {\n const { treeIdentifier, onFeatureUsed } = props;\n const onFeatureUsedRef = useRef(onFeatureUsed);\n\n useEffect(() => {\n onFeatureUsedRef.current = onFeatureUsed;\n }, [onFeatureUsed]);\n\n const reportUsage = useCallback(\n ({ featureId, reportInteraction }: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => {\n if (reportInteraction !== false) {\n onFeatureUsedRef.current?.(`use-${treeIdentifier}`);\n }\n if (featureId) {\n onFeatureUsedRef.current?.(`${treeIdentifier}-${featureId}`);\n }\n },\n [treeIdentifier],\n );\n\n return { reportUsage };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UseFeatureReporting.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFeatureReporting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmBvD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC3C,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAoE,EAAE,EAAE;QACrG,IAAI,iBAAiB,KAAK,KAAK,EAAE;YAC/B,gBAAgB,CAAC,OAAO,EAAE,CAAC,OAAO,cAAc,EAAE,CAAC,CAAC;SACrD;QACD,IAAI,SAAS,EAAE;YACb,gBAAgB,CAAC,OAAO,EAAE,CAAC,GAAG,cAAc,IAAI,SAAS,EAAE,CAAC,CAAC;SAC9D;IACH,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC;AAQD,gBAAgB;AAChB,uBAAuB;AACvB,MAAM,UAAU,kBAAkB,CAAqC,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAA8B;IACnI,OAAO,WAAW,CAChB,CAAC,GAAG,IAAI,EAAE,EAAE;QACV,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClB,CAAC,EACD,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CACjC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\n/** @internal */\nexport interface UseFeatureReportingProps {\n treeIdentifier: string;\n onFeatureUsed?: (featureId: string) => void;\n}\n\n/** @internal */\nexport interface UseFeatureReportingResult {\n reportUsage: (props: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => void;\n}\n\n/**\n * Features that are tracked for usage.\n * @internal\n */\nexport type UsageTrackedFeatures = \"visibility-change\" | \"hierarchy-level-filtering\" | \"filtering\" | \"hierarchy-level-size-limit-hit\" | \"zoom-to-node\";\n\n/**\n * Enables feature reporting for a tree component.\n * @internal\n */\nexport function useFeatureReporting(props: UseFeatureReportingProps): UseFeatureReportingResult {\n const { treeIdentifier, onFeatureUsed } = props;\n const onFeatureUsedRef = useRef(onFeatureUsed);\n\n useEffect(() => {\n onFeatureUsedRef.current = onFeatureUsed;\n }, [onFeatureUsed]);\n\n const reportUsage = useCallback(\n ({ featureId, reportInteraction }: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => {\n if (reportInteraction !== false) {\n onFeatureUsedRef.current?.(`use-${treeIdentifier}`);\n }\n if (featureId) {\n onFeatureUsedRef.current?.(`${treeIdentifier}-${featureId}`);\n }\n },\n [treeIdentifier],\n );\n\n return { reportUsage };\n}\n\ninterface UseReportingActionProps<T> {\n action: T;\n featureId?: UsageTrackedFeatures;\n reportUsage?: (props: { featureId?: UsageTrackedFeatures; reportInteraction: true }) => void;\n}\n\n/** @internal */\n// istanbul ignore next\nexport function useReportingAction<T extends (...args: any[]) => void>({ action, featureId, reportUsage }: UseReportingActionProps<T>) {\n return useCallback<(...args: Parameters<T>) => void>(\n (...args) => {\n reportUsage?.({ featureId, reportInteraction: true });\n action(...args);\n },\n [action, reportUsage, featureId],\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
/** @internal */
|
|
10
|
+
export declare function useFiltering(): UseFilteringResult;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=UseFiltering.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { useCallback, useState } from "react";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export function useFiltering() {
|
|
8
|
+
const [filter, setFilter] = useState("");
|
|
9
|
+
const [activeMatchIndex, setActiveMatchIndex] = useState(0);
|
|
10
|
+
const [totalMatches, setTotalMatches] = useState(0);
|
|
11
|
+
const applyFilter = useCallback((newFilter) => {
|
|
12
|
+
setActiveMatchIndex(0);
|
|
13
|
+
setFilter(newFilter);
|
|
14
|
+
}, []);
|
|
15
|
+
const clearFilter = useCallback(() => {
|
|
16
|
+
setActiveMatchIndex(0);
|
|
17
|
+
setFilter("");
|
|
18
|
+
}, []);
|
|
19
|
+
const onHighlightChanged = useCallback((index, matches) => {
|
|
20
|
+
setActiveMatchIndex(index);
|
|
21
|
+
matches && setTotalMatches(matches);
|
|
22
|
+
}, []);
|
|
23
|
+
return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=UseFiltering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFiltering.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAW9C,gBAAgB;AAChB,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,WAAW,CAAC,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,WAAW,CAAC,GAAG,EAAE;QACnC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,WAAW,CAAC,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","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\n/** @internal */\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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TreeRenderer, useTree } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
type UseTreeLocalizedStrings = Parameters<typeof useTree>[0]["localizedStrings"];
|
|
3
|
+
type TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0]["localizedStrings"];
|
|
4
|
+
type UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare function useHierarchiesLocalization(): UseHierarchiesLocalizationResult;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=UseHierarchiesLocalization.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { TreeWidget } from "../../../TreeWidget";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export function useHierarchiesLocalization() {
|
|
9
|
+
const stringValues = Object.values(getLocalizedStrings());
|
|
10
|
+
const localizedStrings = useMemo(getLocalizedStrings, stringValues);
|
|
11
|
+
return localizedStrings;
|
|
12
|
+
}
|
|
13
|
+
function getLocalizedStrings() {
|
|
14
|
+
return {
|
|
15
|
+
// strings for the `useUnifiedSelectionTree` hook
|
|
16
|
+
unspecified: TreeWidget.translate("presentation-hierarchies.unspecified"),
|
|
17
|
+
other: TreeWidget.translate("presentation-hierarchies.other"),
|
|
18
|
+
// strings for `TreeRenderer` and `TreeNodeRenderer`
|
|
19
|
+
loading: TreeWidget.translate("presentation-hierarchies.loading"),
|
|
20
|
+
filterHierarchyLevel: TreeWidget.translate("presentation-hierarchies.filterHierarchyLevel"),
|
|
21
|
+
clearHierarchyLevelFilter: TreeWidget.translate("presentation-hierarchies.clearHierarchyLevelFilter"),
|
|
22
|
+
noFilteredChildren: TreeWidget.translate("presentation-hierarchies.noFilteredChildren"),
|
|
23
|
+
resultLimitExceeded: TreeWidget.translate("presentation-hierarchies.resultLimitExceeded"),
|
|
24
|
+
resultLimitExceededWithFiltering: TreeWidget.translate("presentation-hierarchies.resultLimitExceededWithFiltering"),
|
|
25
|
+
increaseHierarchyLimit: TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimit"),
|
|
26
|
+
increaseHierarchyLimitWithFiltering: TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimitWithFiltering"),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=UseHierarchiesLocalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseHierarchiesLocalization.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchiesLocalization.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AASjD,gBAAgB;AAChB,MAAM,UAAU,0BAA0B;IACxC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAG,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IACpE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,iDAAiD;QACjD,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,sCAAsC,CAAC;QACzE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;QAE7D,oDAAoD;QACpD,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,kCAAkC,CAAC;QACjE,oBAAoB,EAAE,UAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC;QAC3F,yBAAyB,EAAE,UAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;QACrG,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,6CAA6C,CAAC;QACvF,mBAAmB,EAAE,UAAU,CAAC,SAAS,CAAC,8CAA8C,CAAC;QACzF,gCAAgC,EAAE,UAAU,CAAC,SAAS,CAAC,2DAA2D,CAAC;QACnH,sBAAsB,EAAE,UAAU,CAAC,SAAS,CAAC,iDAAiD,CAAC;QAC/F,mCAAmC,EAAE,UAAU,CAAC,SAAS,CAAC,8DAA8D,CAAC;KAC1H,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\";\n\nimport type { TreeRenderer, useTree } from \"@itwin/presentation-hierarchies-react\";\n\ntype UseTreeLocalizedStrings = Parameters<typeof useTree>[0][\"localizedStrings\"];\ntype TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0][\"localizedStrings\"];\n\ntype UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;\n\n/** @internal */\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 };\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
+
import type { HierarchyLevelDetails } from "@itwin/presentation-hierarchies-react";
|
|
4
|
+
import type { UsageTrackedFeatures } from "./UseFeatureReporting";
|
|
5
|
+
interface UseHierarchyLevelFilteringProps {
|
|
6
|
+
imodel: IModelConnection;
|
|
7
|
+
defaultHierarchyLevelSizeLimit: number;
|
|
8
|
+
reportUsage?: (props: {
|
|
9
|
+
featureId?: UsageTrackedFeatures;
|
|
10
|
+
reportInteraction: true;
|
|
11
|
+
}) => void;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }: UseHierarchyLevelFilteringProps): {
|
|
15
|
+
onFilterClick: import("react").Dispatch<import("react").SetStateAction<HierarchyLevelDetails | undefined>>;
|
|
16
|
+
filteringDialog: JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=UseHierarchyFiltering.d.ts.map
|