@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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import "../Tree.scss";
|
|
2
|
+
import { CategoriesTree } from "./CategoriesTree";
|
|
3
|
+
import { HideAllButton, InvertAllButton, ShowAllButton } from "./CategoriesTreeButtons";
|
|
4
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
5
|
+
import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
|
|
6
|
+
import type { CategoriesTreeHeaderButtonProps } from "./CategoriesTreeButtons";
|
|
7
|
+
type CategoriesTreeProps = ComponentPropsWithoutRef<typeof CategoriesTree>;
|
|
8
|
+
interface CategoriesTreeComponentProps extends Pick<CategoriesTreeProps, "getSchemaContext" | "density" | "hierarchyLevelConfig" | "selectionMode" | "onPerformanceMeasured" | "onFeatureUsed"> {
|
|
9
|
+
/**
|
|
10
|
+
* Renderers of header buttons. Defaults to:
|
|
11
|
+
* ```ts
|
|
12
|
+
* [
|
|
13
|
+
* CategoriesTreeComponent.ShowAllButton,
|
|
14
|
+
* CategoriesTreeComponent.HideAllButton,
|
|
15
|
+
* CategoriesTreeComponent.InvertAllButton,
|
|
16
|
+
* ]
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;
|
|
20
|
+
selectionStorage: SelectionStorage;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare const CategoriesTreeComponent: {
|
|
27
|
+
(props: CategoriesTreeComponentProps): JSX.Element | null;
|
|
28
|
+
/**
|
|
29
|
+
* Renders a "Show all" button that enables display of all categories and their subcategories.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
ShowAllButton: typeof ShowAllButton;
|
|
33
|
+
/**
|
|
34
|
+
* Renders a "Hide all" button that disables display of all categories.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
HideAllButton: typeof HideAllButton;
|
|
38
|
+
/**
|
|
39
|
+
* Renders an "Invert all" button that inverts display of all categories.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
InvertAllButton: typeof InvertAllButton;
|
|
43
|
+
/**
|
|
44
|
+
* Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
id: string;
|
|
48
|
+
/**
|
|
49
|
+
* Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
getLabel(): string;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=CategoriesTreeComponent.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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 "../Tree.scss";
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
import { Fragment } from "react";
|
|
9
|
+
import { useActiveIModelConnection, useActiveViewport } from "@itwin/appui-react";
|
|
10
|
+
import { IModelApp } from "@itwin/core-frontend";
|
|
11
|
+
import { UnifiedSelectionProvider } from "@itwin/presentation-hierarchies-react";
|
|
12
|
+
import { TreeWidget } from "../../../TreeWidget";
|
|
13
|
+
import { TreeHeader } from "../../tree-header/TreeHeader";
|
|
14
|
+
import { AutoSizer } from "../../utils/AutoSizer";
|
|
15
|
+
import { useFiltering } from "../common/UseFiltering";
|
|
16
|
+
import { CategoriesTree } from "./CategoriesTree";
|
|
17
|
+
import { HideAllButton, InvertAllButton, ShowAllButton } from "./CategoriesTreeButtons";
|
|
18
|
+
import { useCategories } from "./UseCategories";
|
|
19
|
+
/**
|
|
20
|
+
* A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export const CategoriesTreeComponent = (props) => {
|
|
24
|
+
const iModel = useActiveIModelConnection();
|
|
25
|
+
const viewport = useActiveViewport();
|
|
26
|
+
if (!iModel || !viewport) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return _jsx(CategoriesTreeComponentImpl, { ...props, iModel: iModel, viewport: viewport });
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Renders a "Show all" button that enables display of all categories and their subcategories.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
CategoriesTreeComponent.ShowAllButton = ShowAllButton;
|
|
36
|
+
/**
|
|
37
|
+
* Renders a "Hide all" button that disables display of all categories.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
CategoriesTreeComponent.HideAllButton = HideAllButton;
|
|
41
|
+
/**
|
|
42
|
+
* Renders an "Invert all" button that inverts display of all categories.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
CategoriesTreeComponent.InvertAllButton = InvertAllButton;
|
|
46
|
+
/**
|
|
47
|
+
* Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
CategoriesTreeComponent.id = "categories-tree-v2";
|
|
51
|
+
/**
|
|
52
|
+
* Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
CategoriesTreeComponent.getLabel = () => TreeWidget.translate("categoriesTree.label");
|
|
56
|
+
function CategoriesTreeComponentImpl({ iModel, viewport, headerButtons, selectionStorage, ...treeProps }) {
|
|
57
|
+
const categories = useCategories(IModelApp.viewManager, iModel, viewport);
|
|
58
|
+
const { filter, applyFilter, clearFilter } = useFiltering();
|
|
59
|
+
const density = treeProps.density;
|
|
60
|
+
return (_jsx("div", { className: classNames("tw-tree-with-header", density === "enlarged" && "enlarge"), children: _jsxs(UnifiedSelectionProvider, { storage: selectionStorage, children: [_jsx(TreeHeader, { onFilterStart: applyFilter, onFilterClear: clearFilter, onSelectedChanged: () => { }, density: density, children: headerButtons
|
|
61
|
+
? headerButtons.map((btn, index) => _jsx(Fragment, { children: btn({ viewport, categories, onFeatureUsed: treeProps.onFeatureUsed }) }, index))
|
|
62
|
+
: [
|
|
63
|
+
_jsx(ShowAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "show-all-btn"),
|
|
64
|
+
_jsx(HideAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "hide-all-btn"),
|
|
65
|
+
_jsx(InvertAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "invert-all-btn"),
|
|
66
|
+
] }), _jsx("div", { className: "tw-tree-content", children: _jsx(AutoSizer, { children: ({ width, height }) => (_jsx(CategoriesTree, { ...treeProps, imodel: iModel, categories: categories, activeView: viewport, width: width, height: height, filter: filter })) }) })] }) }));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=CategoriesTreeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,cA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AAa,EAAE,SAAS,CAAC,aAAa,IAAvE,cAAc,CAA6D;4BAC1I,KAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAuB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,aAAa,IAAzE,gBAAgB,CAA6D;yBAC/I,GACM,EACb,cAAK,SAAS,EAAC,iBAAiB,YAC9B,KAAC,SAAS,cACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,KAAC,cAAc,OAAK,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CAC9I,GACS,GACR,IACmB,GACvB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"../Tree.scss\";\nimport classNames from \"classnames\";\nimport { Fragment } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UnifiedSelectionProvider } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeHeader } from \"../../tree-header/TreeHeader\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport { useFiltering } from \"../common/UseFiltering\";\nimport { CategoriesTree } from \"./CategoriesTree\";\nimport { HideAllButton, InvertAllButton, ShowAllButton } from \"./CategoriesTreeButtons\";\nimport { useCategories } from \"./UseCategories\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { CategoriesTreeHeaderButtonProps } from \"./CategoriesTreeButtons\";\n\ntype CategoriesTreeProps = ComponentPropsWithoutRef<typeof CategoriesTree>;\n\ninterface CategoriesTreeComponentProps\n extends Pick<CategoriesTreeProps, \"getSchemaContext\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"onPerformanceMeasured\" | \"onFeatureUsed\"> {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * CategoriesTreeComponent.ShowAllButton,\n * CategoriesTreeComponent.HideAllButton,\n * CategoriesTreeComponent.InvertAllButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;\n selectionStorage: SelectionStorage;\n}\n\n/**\n * A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.\n * @public\n */\nexport const CategoriesTreeComponent = (props: CategoriesTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all categories and their subcategories.\n * @public\n */\nCategoriesTreeComponent.ShowAllButton = ShowAllButton;\n\n/**\n * Renders a \"Hide all\" button that disables display of all categories.\n * @public\n */\nCategoriesTreeComponent.HideAllButton = HideAllButton;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all categories.\n * @public\n */\nCategoriesTreeComponent.InvertAllButton = InvertAllButton;\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.id = \"categories-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nCategoriesTreeComponent.getLabel = () => TreeWidget.translate(\"categoriesTree.label\");\n\nfunction CategoriesTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n selectionStorage,\n ...treeProps\n}: CategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, iModel, viewport);\n const { filter, applyFilter, clearFilter } = useFiltering();\n const density = treeProps.density;\n return (\n <div className={classNames(\"tw-tree-with-header\", density === \"enlarged\" && \"enlarge\")}>\n <UnifiedSelectionProvider storage={selectionStorage}>\n <TreeHeader onFilterStart={applyFilter} onFilterClear={clearFilter} onSelectedChanged={() => {}} density={density}>\n {headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ viewport, categories, onFeatureUsed: treeProps.onFeatureUsed })}</Fragment>)\n : [\n <ShowAllButton viewport={viewport} categories={categories} key=\"show-all-btn\" density={density} onFeatureUsed={treeProps.onFeatureUsed} />,\n <HideAllButton viewport={viewport} categories={categories} key=\"hide-all-btn\" density={density} onFeatureUsed={treeProps.onFeatureUsed} />,\n <InvertAllButton viewport={viewport} categories={categories} key=\"invert-all-btn\" density={density} onFeatureUsed={treeProps.onFeatureUsed} />,\n ]}\n </TreeHeader>\n <div className=\"tw-tree-content\">\n <AutoSizer>\n {({ width, height }) => (\n <CategoriesTree {...treeProps} imodel={iModel} categories={categories} activeView={viewport} width={width} height={height} filter={filter} />\n )}\n </AutoSizer>\n </div>\n </UnifiedSelectionProvider>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ECClassHierarchyInspector, ECSchemaProvider } from "@itwin/presentation-shared";
|
|
2
|
+
import type { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyLevelDefinition, HierarchyNodeIdentifiersPath, LimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
|
|
3
|
+
interface CategoriesTreeDefinitionProps {
|
|
4
|
+
imodelAccess: ECSchemaProvider & ECClassHierarchyInspector;
|
|
5
|
+
viewType: "2d" | "3d";
|
|
6
|
+
}
|
|
7
|
+
interface CategoriesTreeInstanceKeyPathsFromInstanceLabelProps {
|
|
8
|
+
imodelAccess: ECClassHierarchyInspector & LimitingECSqlQueryExecutor;
|
|
9
|
+
label: string;
|
|
10
|
+
viewType: "2d" | "3d";
|
|
11
|
+
}
|
|
12
|
+
export declare class CategoriesTreeDefinition implements HierarchyDefinition {
|
|
13
|
+
private _impl;
|
|
14
|
+
private _selectQueryFactory;
|
|
15
|
+
private _nodeLabelSelectClauseFactory;
|
|
16
|
+
constructor(props: CategoriesTreeDefinitionProps);
|
|
17
|
+
defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;
|
|
18
|
+
private createRootHierarchyLevelDefinition;
|
|
19
|
+
private createSubcategoryQuery;
|
|
20
|
+
static createInstanceKeyPaths(props: CategoriesTreeInstanceKeyPathsFromInstanceLabelProps): Promise<HierarchyNodeIdentifiersPath[]>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=CategoriesTreeDefinition.d.ts.map
|
|
@@ -0,0 +1,181 @@
|
|
|
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 { createClassBasedHierarchyDefinition, createNodesQueryClauseFactory } from "@itwin/presentation-hierarchies";
|
|
6
|
+
import { createBisInstanceLabelSelectClauseFactory, ECSql } from "@itwin/presentation-shared";
|
|
7
|
+
const MAX_FILTERING_INSTANCE_KEY_COUNT = 100;
|
|
8
|
+
export class CategoriesTreeDefinition {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
this._impl = createClassBasedHierarchyDefinition({
|
|
11
|
+
classHierarchyInspector: props.imodelAccess,
|
|
12
|
+
hierarchy: {
|
|
13
|
+
rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition({ ...requestProps, viewType: props.viewType }),
|
|
14
|
+
childNodes: [
|
|
15
|
+
{
|
|
16
|
+
parentNodeClassName: "BisCore.Category",
|
|
17
|
+
definitions: async (requestProps) => this.createSubcategoryQuery(requestProps),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
this._selectQueryFactory = createNodesQueryClauseFactory({ imodelAccess: props.imodelAccess });
|
|
23
|
+
this._nodeLabelSelectClauseFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });
|
|
24
|
+
}
|
|
25
|
+
async defineHierarchyLevel(props) {
|
|
26
|
+
return this._impl.defineHierarchyLevel(props);
|
|
27
|
+
}
|
|
28
|
+
async createRootHierarchyLevelDefinition(props) {
|
|
29
|
+
const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);
|
|
30
|
+
const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
|
|
31
|
+
filter: props.instanceFilter,
|
|
32
|
+
contentClass: { fullName: categoryClass, alias: "this" },
|
|
33
|
+
});
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
fullClassName: categoryClass,
|
|
37
|
+
query: {
|
|
38
|
+
ecsql: `
|
|
39
|
+
SELECT
|
|
40
|
+
${await this._selectQueryFactory.createSelectClause({
|
|
41
|
+
ecClassId: { selector: ECSql.createRawPropertyValueSelector("this", "ECClassId") },
|
|
42
|
+
ecInstanceId: { selector: "this.ECInstanceId" },
|
|
43
|
+
nodeLabel: {
|
|
44
|
+
selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
|
|
45
|
+
classAlias: "this",
|
|
46
|
+
className: categoryClass,
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
hasChildren: {
|
|
50
|
+
selector: `
|
|
51
|
+
IFNULL((
|
|
52
|
+
SELECT 1
|
|
53
|
+
FROM (
|
|
54
|
+
SELECT COUNT(1) AS ChildCount
|
|
55
|
+
FROM BisCore.SubCategory sc
|
|
56
|
+
WHERE sc.Parent.Id = this.ECInstanceId
|
|
57
|
+
)
|
|
58
|
+
WHERE ChildCount > 1
|
|
59
|
+
), 0)
|
|
60
|
+
`,
|
|
61
|
+
},
|
|
62
|
+
extendedData: {
|
|
63
|
+
description: { selector: "this.Description" },
|
|
64
|
+
},
|
|
65
|
+
supportsFiltering: true,
|
|
66
|
+
})}
|
|
67
|
+
FROM ${instanceFilterClauses.from} this
|
|
68
|
+
${instanceFilterClauses.joins}
|
|
69
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
70
|
+
WHERE
|
|
71
|
+
NOT this.IsPrivate
|
|
72
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
73
|
+
AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)
|
|
74
|
+
${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : ""}
|
|
75
|
+
`,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
async createSubcategoryQuery({ parentNodeInstanceIds: elementIds, instanceFilter, }) {
|
|
81
|
+
const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
|
|
82
|
+
filter: instanceFilter,
|
|
83
|
+
contentClass: { fullName: "BisCore.SubCategory", alias: "this" },
|
|
84
|
+
});
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
fullClassName: "BisCore.SubCategory",
|
|
88
|
+
query: {
|
|
89
|
+
ecsql: `
|
|
90
|
+
SELECT
|
|
91
|
+
${await this._selectQueryFactory.createSelectClause({
|
|
92
|
+
ecClassId: { selector: "this.ECClassId" },
|
|
93
|
+
ecInstanceId: { selector: "this.ECInstanceId" },
|
|
94
|
+
nodeLabel: {
|
|
95
|
+
selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
|
|
96
|
+
classAlias: "this",
|
|
97
|
+
className: "BisCore.SubCategory",
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
extendedData: {
|
|
101
|
+
categoryId: { selector: "printf('0x%x', this.Parent.Id)" },
|
|
102
|
+
},
|
|
103
|
+
supportsFiltering: false,
|
|
104
|
+
})}
|
|
105
|
+
FROM ${instanceFilterClauses.from} this
|
|
106
|
+
${instanceFilterClauses.joins}
|
|
107
|
+
WHERE
|
|
108
|
+
NOT this.IsPrivate AND this.Parent.Id IN (${elementIds.map(() => "?").join(",")})
|
|
109
|
+
${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : ""}
|
|
110
|
+
`,
|
|
111
|
+
bindings: elementIds.map((id) => ({ type: "id", value: id })),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
static async createInstanceKeyPaths(props) {
|
|
117
|
+
const labelsFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });
|
|
118
|
+
return createInstanceKeyPathsFromInstanceLabel({ ...props, labelsFactory });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function getClassesByView(viewType) {
|
|
122
|
+
return viewType === "2d"
|
|
123
|
+
? { categoryClass: "BisCore.DrawingCategory", categoryElementClass: "BisCore:GeometricElement2d" }
|
|
124
|
+
: { categoryClass: "BisCore.SpatialCategory", categoryElementClass: "BisCore:GeometricElement3d" };
|
|
125
|
+
}
|
|
126
|
+
async function createInstanceKeyPathsFromInstanceLabel(props) {
|
|
127
|
+
const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);
|
|
128
|
+
const reader = props.imodelAccess.createQueryReader({
|
|
129
|
+
ctes: [
|
|
130
|
+
`RootCategories(ClassName, ECInstanceId, ChildCount) as (
|
|
131
|
+
SELECT
|
|
132
|
+
ec_classname(this.ECClassId, 's.c'),
|
|
133
|
+
this.ECInstanceId,
|
|
134
|
+
COUNT(sc.ECInstanceId)
|
|
135
|
+
FROM ${categoryClass} this
|
|
136
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
137
|
+
JOIN BisCore.SubCategory sc ON sc.Parent.Id = this.ECInstanceId
|
|
138
|
+
WHERE
|
|
139
|
+
NOT this.IsPrivate
|
|
140
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
141
|
+
AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)
|
|
142
|
+
GROUP BY this.ECInstanceId
|
|
143
|
+
)`,
|
|
144
|
+
`SubCategoriesWithLabels(ClassName, ECInstanceId, ParentId, DisplayLabel) as (
|
|
145
|
+
SELECT
|
|
146
|
+
ec_classname(this.ECClassId, 's.c'),
|
|
147
|
+
this.ECInstanceId,
|
|
148
|
+
this.Parent.Id,
|
|
149
|
+
${await props.labelsFactory.createSelectClause({
|
|
150
|
+
classAlias: "this",
|
|
151
|
+
className: "BisCore.SubCategory",
|
|
152
|
+
})}
|
|
153
|
+
FROM BisCore.SubCategory this
|
|
154
|
+
WHERE NOT this.IsPrivate
|
|
155
|
+
)`,
|
|
156
|
+
],
|
|
157
|
+
ecsql: `
|
|
158
|
+
SELECT
|
|
159
|
+
c.ClassName AS CategoryClass,
|
|
160
|
+
c.ECInstanceId AS CategoryId,
|
|
161
|
+
IIF(c.ChildCount > 1, sc.ClassName, NULL) AS SubcategoryClass,
|
|
162
|
+
IIF(c.ChildCount > 1, sc.ECInstanceId, NULL) AS SubcategoryId
|
|
163
|
+
FROM RootCategories c
|
|
164
|
+
JOIN SubCategoriesWithLabels sc ON sc.ParentId = c.ECInstanceId
|
|
165
|
+
WHERE sc.DisplayLabel LIKE '%' || ? || '%' ESCAPE '\\'
|
|
166
|
+
LIMIT ${MAX_FILTERING_INSTANCE_KEY_COUNT + 1}
|
|
167
|
+
`,
|
|
168
|
+
bindings: [{ type: "string", value: props.label.replace(/[%_\\]/g, "\\$&") }],
|
|
169
|
+
}, { restartToken: "tree-widget/categories-tree/filter-by-label-query" });
|
|
170
|
+
const paths = new Array();
|
|
171
|
+
for await (const row of reader) {
|
|
172
|
+
const path = [{ className: row.CategoryClass, id: row.CategoryId }];
|
|
173
|
+
row.SubcategoryId && path.push({ className: row.SubcategoryClass, id: row.SubcategoryId });
|
|
174
|
+
paths.push(path);
|
|
175
|
+
}
|
|
176
|
+
if (paths.length > MAX_FILTERING_INSTANCE_KEY_COUNT) {
|
|
177
|
+
throw new Error(`Filter matches more than ${MAX_FILTERING_INSTANCE_KEY_COUNT} items`);
|
|
178
|
+
}
|
|
179
|
+
return paths;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=CategoriesTreeDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTreeDefinition.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mCAAmC,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,yCAAyC,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAc9F,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAa7C,MAAM,OAAO,wBAAwB;IAKnC,YAAmB,KAAoC;QACrD,IAAI,CAAC,KAAK,GAAG,mCAAmC,CAAC;YAC/C,uBAAuB,EAAE,KAAK,CAAC,YAAY;YAC3C,SAAS,EAAE;gBACT,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,GAAG,YAAY,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACzH,UAAU,EAAE;oBACV;wBACE,mBAAmB,EAAE,kBAAkB;wBACvC,WAAW,EAAE,KAAK,EAAE,YAAwD,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC;qBAC3H;iBACF;aACF;SACF,CAAC,CAAC;QACH,IAAI,CAAC,mBAAmB,GAAG,6BAA6B,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC,6BAA6B,GAAG,yCAAyC,CAAC,EAAE,uBAAuB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AAE,mDAAmD,EAAE,CACtE,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,KAAK,EAAgC,CAAC;IACxD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE;QAC9B,MAAM,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,aAAa,EAAE,EAAE,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACpE,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,gBAAgB,EAAE,EAAE,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;QAC3F,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClB;IACD,IAAI,KAAK,CAAC,MAAM,GAAG,gCAAgC,EAAE;QACnD,MAAM,IAAI,KAAK,CAAC,4BAA4B,gCAAgC,QAAQ,CAAC,CAAC;KACvF;IACD,OAAO,KAAK,CAAC;AACf,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 { createClassBasedHierarchyDefinition, createNodesQueryClauseFactory } from \"@itwin/presentation-hierarchies\";\nimport { createBisInstanceLabelSelectClauseFactory, ECSql } from \"@itwin/presentation-shared\";\n\nimport type { ECClassHierarchyInspector, ECSchemaProvider, IInstanceLabelSelectClauseFactory } from \"@itwin/presentation-shared\";\nimport type {\n DefineHierarchyLevelProps,\n DefineInstanceNodeChildHierarchyLevelProps,\n DefineRootHierarchyLevelProps,\n HierarchyDefinition,\n HierarchyLevelDefinition,\n HierarchyNodeIdentifiersPath,\n LimitingECSqlQueryExecutor,\n NodesQueryClauseFactory,\n} from \"@itwin/presentation-hierarchies\";\n\nconst MAX_FILTERING_INSTANCE_KEY_COUNT = 100;\n\ninterface CategoriesTreeDefinitionProps {\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector;\n viewType: \"2d\" | \"3d\";\n}\n\ninterface CategoriesTreeInstanceKeyPathsFromInstanceLabelProps {\n imodelAccess: ECClassHierarchyInspector & LimitingECSqlQueryExecutor;\n label: string;\n viewType: \"2d\" | \"3d\";\n}\n\nexport class CategoriesTreeDefinition implements HierarchyDefinition {\n private _impl: HierarchyDefinition;\n private _selectQueryFactory: NodesQueryClauseFactory;\n private _nodeLabelSelectClauseFactory: IInstanceLabelSelectClauseFactory;\n\n public constructor(props: CategoriesTreeDefinitionProps) {\n this._impl = createClassBasedHierarchyDefinition({\n classHierarchyInspector: props.imodelAccess,\n hierarchy: {\n rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition({ ...requestProps, viewType: props.viewType }),\n childNodes: [\n {\n parentNodeClassName: \"BisCore.Category\",\n definitions: async (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => this.createSubcategoryQuery(requestProps),\n },\n ],\n },\n });\n this._selectQueryFactory = createNodesQueryClauseFactory({ imodelAccess: props.imodelAccess });\n this._nodeLabelSelectClauseFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });\n }\n\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps) {\n return this._impl.defineHierarchyLevel(props);\n }\n\n private async createRootHierarchyLevelDefinition(props: DefineRootHierarchyLevelProps & { viewType: \"2d\" | \"3d\" }): Promise<HierarchyLevelDefinition> {\n const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: props.instanceFilter,\n contentClass: { fullName: categoryClass, alias: \"this\" },\n });\n return [\n {\n fullClassName: categoryClass,\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: ECSql.createRawPropertyValueSelector(\"this\", \"ECClassId\") },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: \"this\",\n className: categoryClass,\n }),\n },\n hasChildren: {\n selector: `\n IFNULL((\n SELECT 1\n FROM (\n SELECT COUNT(1) AS ChildCount\n FROM BisCore.SubCategory sc\n WHERE sc.Parent.Id = this.ECInstanceId\n )\n WHERE ChildCount > 1\n ), 0)\n `,\n },\n extendedData: {\n description: { selector: \"this.Description\" },\n },\n supportsFiltering: true,\n })}\n FROM ${instanceFilterClauses.from} this\n ${instanceFilterClauses.joins}\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n },\n },\n ];\n }\n\n private async createSubcategoryQuery({\n parentNodeInstanceIds: elementIds,\n instanceFilter,\n }: DefineInstanceNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.SubCategory\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.SubCategory\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: \"this\",\n className: \"BisCore.SubCategory\",\n }),\n },\n extendedData: {\n categoryId: { selector: \"printf('0x%x', this.Parent.Id)\" },\n },\n supportsFiltering: false,\n })}\n FROM ${instanceFilterClauses.from} this\n ${instanceFilterClauses.joins}\n WHERE\n NOT this.IsPrivate AND this.Parent.Id IN (${elementIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: elementIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n ];\n }\n\n public static async createInstanceKeyPaths(props: CategoriesTreeInstanceKeyPathsFromInstanceLabelProps) {\n const labelsFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });\n return createInstanceKeyPathsFromInstanceLabel({ ...props, labelsFactory });\n }\n}\n\nfunction getClassesByView(viewType: \"2d\" | \"3d\") {\n return viewType === \"2d\"\n ? { categoryClass: \"BisCore.DrawingCategory\", categoryElementClass: \"BisCore:GeometricElement2d\" }\n : { categoryClass: \"BisCore.SpatialCategory\", categoryElementClass: \"BisCore:GeometricElement3d\" };\n}\n\nasync function createInstanceKeyPathsFromInstanceLabel(\n props: CategoriesTreeInstanceKeyPathsFromInstanceLabelProps & { labelsFactory: IInstanceLabelSelectClauseFactory },\n) {\n const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);\n const reader = props.imodelAccess.createQueryReader(\n {\n ctes: [\n `RootCategories(ClassName, ECInstanceId, ChildCount) as (\n SELECT\n ec_classname(this.ECClassId, 's.c'),\n this.ECInstanceId,\n COUNT(sc.ECInstanceId)\n FROM ${categoryClass} this\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n JOIN BisCore.SubCategory sc ON sc.Parent.Id = this.ECInstanceId\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)\n GROUP BY this.ECInstanceId\n )`,\n `SubCategoriesWithLabels(ClassName, ECInstanceId, ParentId, DisplayLabel) as (\n SELECT\n ec_classname(this.ECClassId, 's.c'),\n this.ECInstanceId,\n this.Parent.Id,\n ${await props.labelsFactory.createSelectClause({\n classAlias: \"this\",\n className: \"BisCore.SubCategory\",\n })}\n FROM BisCore.SubCategory this\n WHERE NOT this.IsPrivate\n )`,\n ],\n ecsql: `\n SELECT\n c.ClassName AS CategoryClass,\n c.ECInstanceId AS CategoryId,\n IIF(c.ChildCount > 1, sc.ClassName, NULL) AS SubcategoryClass,\n IIF(c.ChildCount > 1, sc.ECInstanceId, NULL) AS SubcategoryId\n FROM RootCategories c\n JOIN SubCategoriesWithLabels sc ON sc.ParentId = c.ECInstanceId\n WHERE sc.DisplayLabel LIKE '%' || ? || '%' ESCAPE '\\\\'\n LIMIT ${MAX_FILTERING_INSTANCE_KEY_COUNT + 1}\n `,\n bindings: [{ type: \"string\", value: props.label.replace(/[%_\\\\]/g, \"\\\\$&\") }],\n },\n { restartToken: \"tree-widget/categories-tree/filter-by-label-query\" },\n );\n const paths = new Array<HierarchyNodeIdentifiersPath>();\n for await (const row of reader) {\n const path = [{ className: row.CategoryClass, id: row.CategoryId }];\n row.SubcategoryId && path.push({ className: row.SubcategoryClass, id: row.SubcategoryId });\n paths.push(path);\n }\n if (paths.length > MAX_FILTERING_INSTANCE_KEY_COUNT) {\n throw new Error(`Filter matches more than ${MAX_FILTERING_INSTANCE_KEY_COUNT} items`);\n }\n return paths;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
2
|
+
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
3
|
+
import type { CategoryInfo } from "../common/CategoriesVisibilityUtils";
|
|
4
|
+
import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
5
|
+
import type { HierarchyVisibilityHandler, VisibilityStatus } from "../common/UseHierarchyVisibility";
|
|
6
|
+
interface CategoriesVisibilityHandlerProps {
|
|
7
|
+
viewManager: ViewManager;
|
|
8
|
+
imodel: IModelConnection;
|
|
9
|
+
categories: CategoryInfo[];
|
|
10
|
+
viewport: Viewport;
|
|
11
|
+
allViewports?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {
|
|
15
|
+
private _viewManager;
|
|
16
|
+
private _imodel;
|
|
17
|
+
private _pendingVisibilityChange;
|
|
18
|
+
private _viewport;
|
|
19
|
+
private _useAllViewports;
|
|
20
|
+
constructor(props: CategoriesVisibilityHandlerProps);
|
|
21
|
+
dispose(): void;
|
|
22
|
+
onVisibilityChange: BeEvent<import("@itwin/core-bentley").Listener>;
|
|
23
|
+
/** Returns visibility status of the tree node. */
|
|
24
|
+
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
|
|
25
|
+
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
26
|
+
getSubCategoryVisibility(node: HierarchyNode): "visible" | "hidden";
|
|
27
|
+
getCategoryVisibility(node: HierarchyNode): "visible" | "hidden";
|
|
28
|
+
private onDisplayStyleChanged;
|
|
29
|
+
private onViewedCategoriesChanged;
|
|
30
|
+
private onVisibilityChangeInternal;
|
|
31
|
+
static getInstanceIdFromHierarchyNode(node: HierarchyNode): string;
|
|
32
|
+
enableCategory(ids: string[], enabled: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
33
|
+
enableSubCategory(key: string, enabled: boolean): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=CategoriesVisibilityHandler.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { BeEvent } from "@itwin/core-bentley";
|
|
6
|
+
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
7
|
+
import { enableCategoryDisplay, enableSubCategoryDisplay } from "../common/CategoriesVisibilityUtils";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export class CategoriesVisibilityHandler {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
this.onVisibilityChange = new BeEvent();
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
+
this.onDisplayStyleChanged = () => {
|
|
14
|
+
this.onVisibilityChangeInternal();
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
+
this.onViewedCategoriesChanged = () => {
|
|
18
|
+
this.onVisibilityChangeInternal();
|
|
19
|
+
};
|
|
20
|
+
this._viewManager = props.viewManager;
|
|
21
|
+
this._imodel = props.imodel;
|
|
22
|
+
this._viewport = props.viewport;
|
|
23
|
+
// istanbul ignore next
|
|
24
|
+
this._useAllViewports = props.allViewports ?? false;
|
|
25
|
+
this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);
|
|
26
|
+
this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);
|
|
27
|
+
}
|
|
28
|
+
dispose() {
|
|
29
|
+
this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);
|
|
30
|
+
this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);
|
|
31
|
+
clearTimeout(this._pendingVisibilityChange);
|
|
32
|
+
}
|
|
33
|
+
/** Returns visibility status of the tree node. */
|
|
34
|
+
getVisibilityStatus(node) {
|
|
35
|
+
if (!HierarchyNode.isInstancesNode(node)) {
|
|
36
|
+
return { state: "hidden", isDisabled: true };
|
|
37
|
+
}
|
|
38
|
+
return { state: node.parentKeys.length ? this.getSubCategoryVisibility(node) : this.getCategoryVisibility(node) };
|
|
39
|
+
}
|
|
40
|
+
async changeVisibility(node, on) {
|
|
41
|
+
if (!HierarchyNode.isInstancesNode(node)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// handle subcategory visibility change
|
|
45
|
+
if (node.parentKeys.length) {
|
|
46
|
+
const childId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
47
|
+
const parentCategoryId = node.extendedData?.categoryId;
|
|
48
|
+
// make sure parent category is enabled
|
|
49
|
+
if (on && parentCategoryId) {
|
|
50
|
+
await this.enableCategory([parentCategoryId], true, false);
|
|
51
|
+
}
|
|
52
|
+
this.enableSubCategory(childId, on);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
56
|
+
await this.enableCategory([instanceId], on, true);
|
|
57
|
+
}
|
|
58
|
+
getSubCategoryVisibility(node) {
|
|
59
|
+
const parentCategoryId = node.extendedData?.categoryId;
|
|
60
|
+
if (!parentCategoryId) {
|
|
61
|
+
return "hidden";
|
|
62
|
+
}
|
|
63
|
+
const subcategoryId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
64
|
+
const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);
|
|
65
|
+
return isVisible ? "visible" : "hidden";
|
|
66
|
+
}
|
|
67
|
+
getCategoryVisibility(node) {
|
|
68
|
+
const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
69
|
+
return this._viewport.view.viewsCategory(instanceId) ? "visible" : "hidden";
|
|
70
|
+
}
|
|
71
|
+
onVisibilityChangeInternal() {
|
|
72
|
+
if (this._pendingVisibilityChange) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this._pendingVisibilityChange = setTimeout(() => {
|
|
76
|
+
this.onVisibilityChange.raiseEvent();
|
|
77
|
+
this._pendingVisibilityChange = undefined;
|
|
78
|
+
}, 0);
|
|
79
|
+
}
|
|
80
|
+
static getInstanceIdFromHierarchyNode(node) {
|
|
81
|
+
return HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : /* istanbul ignore next */ "";
|
|
82
|
+
}
|
|
83
|
+
async enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
84
|
+
await enableCategoryDisplay(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);
|
|
85
|
+
}
|
|
86
|
+
enableSubCategory(key, enabled) {
|
|
87
|
+
enableSubCategoryDisplay(this._viewManager, key, enabled, this._useAllViewports);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=CategoriesVisibilityHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesVisibilityHandler.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AActG,gBAAgB;AAChB,MAAM,OAAO,2BAA2B;IAOtC,YAAY,KAAuC;QAgB5C,uBAAkB,GAAG,IAAI,OAAO,EAAE,CAAC;QAiD1C,gEAAgE;QACxD,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QAEF,gEAAgE;QACxD,8BAAyB,GAAG,GAAG,EAAE;YACvC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QAxEA,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,uBAAuB;QACvB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC;QACpD,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACvF,CAAC;IAEM,OAAO;QAC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G,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAC/I,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAa,EAAE,OAAgB,EAAE,sBAAsB,GAAG,IAAI;QACxF,MAAM,qBAAqB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;IAC5H,CAAC;IAEM,iBAAiB,CAAC,GAAW,EAAE,OAAgB;QACpD,wBAAwB,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnF,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { enableCategoryDisplay, enableSubCategoryDisplay } from \"../common/CategoriesVisibilityUtils\";\n\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils\";\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../common/UseHierarchyVisibility\";\n\ninterface CategoriesVisibilityHandlerProps {\n viewManager: ViewManager;\n imodel: IModelConnection;\n categories: CategoryInfo[];\n viewport: Viewport;\n allViewports?: boolean;\n}\n\n/** @internal */\nexport class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {\n private _viewManager: ViewManager;\n private _imodel: IModelConnection;\n private _pendingVisibilityChange: any | undefined;\n private _viewport: Viewport;\n private _useAllViewports: boolean;\n\n constructor(props: CategoriesVisibilityHandlerProps) {\n this._viewManager = props.viewManager;\n this._imodel = props.imodel;\n this._viewport = props.viewport;\n // istanbul ignore next\n this._useAllViewports = props.allViewports ?? false;\n this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n\n public dispose() {\n this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent();\n\n /** Returns visibility status of the tree node. */\n public getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus {\n if (!HierarchyNode.isInstancesNode(node)) {\n return { state: \"hidden\", isDisabled: true };\n }\n return { state: node.parentKeys.length ? this.getSubCategoryVisibility(node) : this.getCategoryVisibility(node) };\n }\n\n public async changeVisibility(node: HierarchyNode, on: boolean) {\n if (!HierarchyNode.isInstancesNode(node)) {\n return;\n }\n\n // handle subcategory visibility change\n if (node.parentKeys.length) {\n const childId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n const parentCategoryId = node.extendedData?.categoryId;\n\n // make sure parent category is enabled\n if (on && parentCategoryId) {\n await this.enableCategory([parentCategoryId], true, false);\n }\n\n this.enableSubCategory(childId, on);\n return;\n }\n\n const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n await this.enableCategory([instanceId], on, true);\n }\n\n public getSubCategoryVisibility(node: HierarchyNode) {\n const parentCategoryId = node.extendedData?.categoryId;\n if (!parentCategoryId) {\n return \"hidden\";\n }\n\n const subcategoryId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);\n return isVisible ? \"visible\" : \"hidden\";\n }\n\n public getCategoryVisibility(node: HierarchyNode) {\n const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n return this._viewport.view.viewsCategory(instanceId) ? \"visible\" : \"hidden\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onDisplayStyleChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onViewedCategoriesChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onVisibilityChangeInternal() {\n if (this._pendingVisibilityChange) {\n return;\n }\n\n this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n public static getInstanceIdFromHierarchyNode(node: HierarchyNode) {\n return HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : /* istanbul ignore next */ \"\";\n }\n\n public async enableCategory(ids: string[], enabled: boolean, enableAllSubCategories = true) {\n await enableCategoryDisplay(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);\n }\n\n public enableSubCategory(key: string, enabled: boolean) {\n enableSubCategoryDisplay(this._viewManager, key, enabled, this._useAllViewports);\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
2
|
+
import type { CategoryInfo } from "../common/CategoriesVisibilityUtils";
|
|
3
|
+
/**
|
|
4
|
+
* Loads categories from viewport or uses provided list of categories.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function useCategories(viewManager: ViewManager, imodel: IModelConnection, view?: Viewport): CategoryInfo[];
|
|
8
|
+
//# sourceMappingURL=UseCategories.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { useAsyncValue } from "@itwin/components-react";
|
|
7
|
+
import { loadCategoriesFromViewport } from "../common/CategoriesVisibilityUtils";
|
|
8
|
+
const EMPTY_CATEGORIES_ARRAY = [];
|
|
9
|
+
/**
|
|
10
|
+
* Loads categories from viewport or uses provided list of categories.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export function useCategories(viewManager, imodel, view) {
|
|
14
|
+
const currentView = view || viewManager.getFirstOpenView();
|
|
15
|
+
const categoriesPromise = useMemo(async () => loadCategoriesFromViewport(imodel, currentView), [imodel, currentView]);
|
|
16
|
+
return useAsyncValue(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=UseCategories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseCategories.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/UseCategories.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAKjF,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,WAAwB,EAAE,MAAwB,EAAE,IAAe;IAC/F,MAAM,WAAW,GAAG,IAAI,IAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,0BAA0B,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACtH,OAAO,aAAa,CAAC,iBAAiB,CAAC,IAAI,sBAAsB,CAAC;AACpE,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 { useAsyncValue } from \"@itwin/components-react\";\nimport { loadCategoriesFromViewport } from \"../common/CategoriesVisibilityUtils\";\n\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils\";\n\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Loads categories from viewport or uses provided list of categories.\n * @internal\n */\nexport function useCategories(viewManager: ViewManager, imodel: IModelConnection, view?: Viewport) {\n const currentView = view || viewManager.getFirstOpenView();\n const categoriesPromise = useMemo(async () => loadCategoriesFromViewport(imodel, currentView), [imodel, currentView]);\n return useAsyncValue(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
2
|
+
/**
|
|
3
|
+
* Data structure that describes category.
|
|
4
|
+
*/
|
|
5
|
+
export interface CategoryInfo {
|
|
6
|
+
categoryId: string;
|
|
7
|
+
subCategoryIds?: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Toggles visibility of categories to show or hide.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function toggleAllCategories(viewManager: ViewManager, imodel: IModelConnection, display: boolean, viewport?: Viewport, forAllViewports?: boolean): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets ids of all categories from specified imodel and viewport.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCategories(imodel: IModelConnection, viewport?: Viewport): Promise<string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Changes category display in the viewport.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function enableCategoryDisplay(viewManager: ViewManager, imodel: IModelConnection, ids: string[], enabled: boolean, forAllViewports: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Changes subcategory display in the viewport
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function enableSubCategoryDisplay(viewManager: ViewManager, key: string, enabled: boolean, forAllViewports?: boolean): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare function loadCategoriesFromViewport(iModel?: IModelConnection, vp?: Viewport): Promise<CategoryInfo[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Enable display of all given categories.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare function showAllCategories(categories: string[], viewport: Viewport): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Disable display of all given categories.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare function hideAllCategories(categories: string[], viewport: Viewport): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Invert display of all given categories.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare function invertAllCategories(categories: CategoryInfo[], viewport: Viewport): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=CategoriesVisibilityUtils.d.ts.map
|