@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
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CategoriesTreeComponent = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
/*---------------------------------------------------------------------------------------------
|
|
9
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
10
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
11
|
-
*--------------------------------------------------------------------------------------------*/
|
|
12
|
-
require("../VisibilityTreeBase.scss");
|
|
13
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
-
const react_1 = require("react");
|
|
15
|
-
const appui_react_1 = require("@itwin/appui-react");
|
|
16
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
17
|
-
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
18
|
-
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
19
|
-
const presentation_components_1 = require("@itwin/presentation-components");
|
|
20
|
-
const TreeWidget_1 = require("../../../TreeWidget");
|
|
21
|
-
const TreeHeader_1 = require("../../tree-header/TreeHeader");
|
|
22
|
-
const TreeFilteringState_1 = require("../../TreeFilteringState");
|
|
23
|
-
const AutoSizer_1 = require("../../utils/AutoSizer");
|
|
24
|
-
const CategoriesTree_1 = require("./CategoriesTree");
|
|
25
|
-
const CategoryVisibilityHandler_1 = require("./CategoryVisibilityHandler");
|
|
26
|
-
/**
|
|
27
|
-
* A component that renders [[CategoriesTree]] and a header with filtering capabilities
|
|
28
|
-
* and header buttons.
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
const CategoriesTreeComponent = (props) => {
|
|
32
|
-
const iModel = (0, appui_react_1.useActiveIModelConnection)();
|
|
33
|
-
const viewport = (0, appui_react_1.useActiveViewport)();
|
|
34
|
-
if (!iModel || !viewport) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
return (0, jsx_runtime_1.jsx)(CategoriesTreeComponentImpl, { ...props, iModel: iModel, viewport: viewport });
|
|
38
|
-
};
|
|
39
|
-
exports.CategoriesTreeComponent = CategoriesTreeComponent;
|
|
40
|
-
/**
|
|
41
|
-
* Renders a "Show all" button that enables display of all categories and their subcategories.
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
exports.CategoriesTreeComponent.ShowAllButton = ShowAllButton;
|
|
45
|
-
/**
|
|
46
|
-
* Renders a "Hide all" button that disables display of all categories.
|
|
47
|
-
* @public
|
|
48
|
-
*/
|
|
49
|
-
exports.CategoriesTreeComponent.HideAllButton = HideAllButton;
|
|
50
|
-
/**
|
|
51
|
-
* Renders an "Invert all" button that inverts display of all categories.
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
exports.CategoriesTreeComponent.InvertAllButton = InvertAllButton;
|
|
55
|
-
/**
|
|
56
|
-
* Id of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
exports.CategoriesTreeComponent.id = "categories-tree";
|
|
60
|
-
/**
|
|
61
|
-
* Label of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].
|
|
62
|
-
* @public
|
|
63
|
-
*/
|
|
64
|
-
exports.CategoriesTreeComponent.getLabel = () => TreeWidget_1.TreeWidget.translate("categories");
|
|
65
|
-
function CategoriesTreeComponentImpl(props) {
|
|
66
|
-
const categories = (0, CategoryVisibilityHandler_1.useCategories)(core_frontend_1.IModelApp.viewManager, props.iModel, props.viewport);
|
|
67
|
-
const [filteredCategories, setFilteredCategories] = (0, react_1.useState)();
|
|
68
|
-
const { searchOptions, filterString, onFilterApplied, filteredProvider } = (0, TreeFilteringState_1.useTreeFilteringState)();
|
|
69
|
-
const contentClassName = (0, classnames_1.default)("tree-widget-tree-content", props.density === "enlarged" && "enlarge");
|
|
70
|
-
(0, react_1.useEffect)(() => {
|
|
71
|
-
void (async () => {
|
|
72
|
-
if (filteredProvider) {
|
|
73
|
-
setFilteredCategories(await getFilteredCategories(filteredProvider));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
setFilteredCategories(undefined);
|
|
77
|
-
}
|
|
78
|
-
})();
|
|
79
|
-
}, [filteredProvider]);
|
|
80
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "tree-widget-tree-with-header", children: [(0, jsx_runtime_1.jsx)(TreeHeader_1.TreeHeader, { onFilterClear: searchOptions.onFilterCancel, onFilterStart: searchOptions.onFilterStart, onSelectedChanged: searchOptions.onResultSelectedChanged, resultCount: searchOptions.matchedResultCount, selectedIndex: searchOptions.activeMatchIndex, density: props.density, children: props.headerButtons
|
|
81
|
-
? props.headerButtons.map((btn, index) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: btn({ viewport: props.viewport, categories, filteredCategories, density: props.density, onFeatureUsed: props.onFeatureUsed }) }, index)))
|
|
82
|
-
: [
|
|
83
|
-
(0, jsx_runtime_1.jsx)(ShowAllButton, { viewport: props.viewport, categories: categories, filteredCategories: filteredCategories, density: props.density, onFeatureUsed: props.onFeatureUsed }, "show-all-btn"),
|
|
84
|
-
(0, jsx_runtime_1.jsx)(HideAllButton, { viewport: props.viewport, categories: categories, filteredCategories: filteredCategories, density: props.density, onFeatureUsed: props.onFeatureUsed }, "hide-all-btn"),
|
|
85
|
-
(0, jsx_runtime_1.jsx)(InvertAllButton, { viewport: props.viewport, categories: categories, filteredCategories: filteredCategories, density: props.density, onFeatureUsed: props.onFeatureUsed }, "invert-all-btn"),
|
|
86
|
-
] }), (0, jsx_runtime_1.jsx)("div", { className: contentClassName, children: (0, jsx_runtime_1.jsx)(AutoSizer_1.AutoSizer, { children: ({ width, height }) => ((0, jsx_runtime_1.jsx)(CategoriesTree_1.CategoryTree, { ...props, categories: categories, width: width, height: height, filterInfo: { filter: filterString, activeMatchIndex: searchOptions.activeMatchIndex }, onFilterApplied: onFilterApplied, activeView: props.viewport })) }) })] }));
|
|
87
|
-
}
|
|
88
|
-
async function getFilteredCategories(filteredProvider) {
|
|
89
|
-
const filteredCategories = [];
|
|
90
|
-
const nodes = await filteredProvider.getNodes();
|
|
91
|
-
for (const node of nodes) {
|
|
92
|
-
if (!(0, presentation_components_1.isPresentationTreeNodeItem)(node)) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
const filteredCategoryId = CategoryVisibilityHandler_1.CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(node.key);
|
|
96
|
-
const filteredSubCategoriesIds = node.hasChildren
|
|
97
|
-
? (await filteredProvider.getNodes(node))
|
|
98
|
-
.filter(presentation_components_1.isPresentationTreeNodeItem)
|
|
99
|
-
.map((child) => CategoryVisibilityHandler_1.CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(child.key))
|
|
100
|
-
: [];
|
|
101
|
-
filteredCategories.push({ categoryId: filteredCategoryId, subCategoryIds: filteredSubCategoriesIds });
|
|
102
|
-
}
|
|
103
|
-
return filteredCategories;
|
|
104
|
-
}
|
|
105
|
-
function ShowAllButton(props) {
|
|
106
|
-
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget_1.TreeWidget.translate("showAll"), onClick: () => {
|
|
107
|
-
props.onFeatureUsed?.(`${exports.CategoriesTreeComponent.id}-showall`);
|
|
108
|
-
void (0, CategoryVisibilityHandler_1.showAllCategories)((props.filteredCategories ?? props.categories).map((category) => category.categoryId), props.viewport);
|
|
109
|
-
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgVisibilityShow, {}) }));
|
|
110
|
-
}
|
|
111
|
-
function HideAllButton(props) {
|
|
112
|
-
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget_1.TreeWidget.translate("hideAll"), onClick: () => {
|
|
113
|
-
props.onFeatureUsed?.(`${exports.CategoriesTreeComponent.id}-hideall`);
|
|
114
|
-
void (0, CategoryVisibilityHandler_1.hideAllCategories)((props.filteredCategories ?? props.categories).map((category) => category.categoryId), props.viewport);
|
|
115
|
-
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgVisibilityHide, {}) }));
|
|
116
|
-
}
|
|
117
|
-
function InvertAllButton(props) {
|
|
118
|
-
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { title: TreeWidget_1.TreeWidget.translate("invert"), size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", onClick: () => {
|
|
119
|
-
props.onFeatureUsed?.(`${exports.CategoriesTreeComponent.id}-invert`);
|
|
120
|
-
void (0, CategoryVisibilityHandler_1.invertAllCategories)(props.filteredCategories ?? props.categories, props.viewport);
|
|
121
|
-
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgVisibilityHalf, {}) }));
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=CategoriesTreeComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;gGAGgG;AAEhG,sCAAoC;AACpC,4DAAoC;AACpC,iCAAsD;AACtD,oDAAkF;AAClF,wDAAiD;AACjD,oEAAqG;A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,SAAS,CAAC,SAAS,CAAC,EACtC,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,GAAG,+BAAuB,CAAC,EAAE,UAAU,CAAC,CAAC;YAC/D,KAAK,IAAA,6CAAiB,EACpB,CAAC,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EACrF,KAAK,CAAC,QAAQ,CACf,CAAC;QACJ,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAsC;IAC7D,OAAO,CACL,uBAAC,0BAAU,IACT,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EACrC,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,GAAG,+BAAuB,CAAC,EAAE,SAAS,CAAC,CAAC;YAC9D,KAAK,IAAA,+CAAmB,EAAC,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzF,CAAC,YAED,uBAAC,uCAAiB,KAAG,GACV,CACd,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 \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { Fragment, useEffect, useState } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { isPresentationTreeNodeItem } from \"@itwin/presentation-components\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeHeader } from \"../../tree-header/TreeHeader\";\nimport { useTreeFilteringState } from \"../../TreeFilteringState\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport { CategoryTree } from \"./CategoriesTree\";\nimport { CategoryVisibilityHandler, hideAllCategories, invertAllCategories, showAllCategories, useCategories } from \"./CategoryVisibilityHandler\";\n\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\nimport type { CategoryTreeProps } from \"./CategoriesTree\";\nimport type { CategoryInfo } from \"./CategoryVisibilityHandler\";\n/**\n * Props that get passed to [[CategoriesTreeComponent]] header button renderer.\n * @see CategoriesTreeComponentProps.headerButtons\n * @public\n */\nexport interface CategoriesTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of categories available in the iModel */\n categories: CategoryInfo[];\n /** In case the tree is filtered, a list of filtered categories. */\n filteredCategories?: CategoryInfo[];\n}\n\n/**\n * Props for [[CategoriesTreeComponent]].\n * @public\n */\nexport interface CategoriesTreeComponentProps\n extends Omit<\n CategoryTreeProps,\n \"iModel\" | \"activeView\" | \"width\" | \"height\" | \"filterInfo\" | \"onFilterApplied\" | \"categories\" | \"categoryVisibilityHandler\" | \"viewManager\"\n > {\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}\n\n/**\n * A component that renders [[CategoriesTree]] and a header with filtering capabilities\n * 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\";\n\n/**\n * Label of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].\n * @public\n */\nCategoriesTreeComponent.getLabel = () => TreeWidget.translate(\"categories\");\n\nfunction CategoriesTreeComponentImpl(props: CategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, props.iModel, props.viewport);\n const [filteredCategories, setFilteredCategories] = useState<CategoryInfo[]>();\n const { searchOptions, filterString, onFilterApplied, filteredProvider } = useTreeFilteringState();\n const contentClassName = classNames(\"tree-widget-tree-content\", props.density === \"enlarged\" && \"enlarge\");\n\n useEffect(() => {\n void (async () => {\n if (filteredProvider) {\n setFilteredCategories(await getFilteredCategories(filteredProvider));\n } else {\n setFilteredCategories(undefined);\n }\n })();\n }, [filteredProvider]);\n\n return (\n <div className=\"tree-widget-tree-with-header\">\n <TreeHeader\n onFilterClear={searchOptions.onFilterCancel}\n onFilterStart={searchOptions.onFilterStart}\n onSelectedChanged={searchOptions.onResultSelectedChanged}\n resultCount={searchOptions.matchedResultCount}\n selectedIndex={searchOptions.activeMatchIndex}\n density={props.density}\n >\n {props.headerButtons\n ? props.headerButtons.map((btn, index) => (\n <Fragment key={index}>\n {btn({ viewport: props.viewport, categories, filteredCategories, density: props.density, onFeatureUsed: props.onFeatureUsed })}\n </Fragment>\n ))\n : [\n <ShowAllButton\n viewport={props.viewport}\n categories={categories}\n filteredCategories={filteredCategories}\n key=\"show-all-btn\"\n density={props.density}\n onFeatureUsed={props.onFeatureUsed}\n />,\n <HideAllButton\n viewport={props.viewport}\n categories={categories}\n filteredCategories={filteredCategories}\n key=\"hide-all-btn\"\n density={props.density}\n onFeatureUsed={props.onFeatureUsed}\n />,\n <InvertAllButton\n viewport={props.viewport}\n categories={categories}\n filteredCategories={filteredCategories}\n key=\"invert-all-btn\"\n density={props.density}\n onFeatureUsed={props.onFeatureUsed}\n />,\n ]}\n </TreeHeader>\n <div className={contentClassName}>\n <AutoSizer>\n {({ width, height }) => (\n <CategoryTree\n {...props}\n categories={categories}\n width={width}\n height={height}\n filterInfo={{ filter: filterString, activeMatchIndex: searchOptions.activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n activeView={props.viewport}\n />\n )}\n </AutoSizer>\n </div>\n </div>\n );\n}\n\nasync function getFilteredCategories(filteredProvider: IPresentationTreeDataProvider) {\n const filteredCategories: CategoryInfo[] = [];\n const nodes = await filteredProvider.getNodes();\n for (const node of nodes) {\n if (!isPresentationTreeNodeItem(node)) {\n continue;\n }\n const filteredCategoryId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(node.key);\n const filteredSubCategoriesIds = node.hasChildren\n ? (await filteredProvider.getNodes(node))\n .filter(isPresentationTreeNodeItem)\n .map((child) => CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(child.key))\n : [];\n filteredCategories.push({ categoryId: filteredCategoryId, subCategoryIds: filteredSubCategoriesIds });\n }\n return filteredCategories;\n}\n\nfunction ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"showAll\")}\n onClick={() => {\n props.onFeatureUsed?.(`${CategoriesTreeComponent.id}-showall`);\n void showAllCategories(\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\nfunction HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"hideAll\")}\n onClick={() => {\n props.onFeatureUsed?.(`${CategoriesTreeComponent.id}-hideall`);\n void hideAllCategories(\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\nfunction InvertAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n title={TreeWidget.translate(\"invert\")}\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n onClick={() => {\n props.onFeatureUsed?.(`${CategoriesTreeComponent.id}-invert`);\n void invertAllCategories(props.filteredCategories ?? props.categories, props.viewport);\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n"]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { BeEvent } from "@itwin/core-bentley";
|
|
2
|
-
import { NodeKey } from "@itwin/presentation-common";
|
|
3
|
-
import type { TreeNodeItem } from "@itwin/components-react";
|
|
4
|
-
import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
5
|
-
import type { IVisibilityHandler, VisibilityChangeListener, VisibilityStatus } from "../VisibilityTreeEventHandler";
|
|
6
|
-
/**
|
|
7
|
-
* Loads categories from viewport or uses provided list of categories.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare function useCategories(viewManager: ViewManager, imodel: IModelConnection, view?: Viewport): CategoryInfo[];
|
|
11
|
-
/**
|
|
12
|
-
* Data structure that describes category.
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export interface CategoryInfo {
|
|
16
|
-
categoryId: string;
|
|
17
|
-
subCategoryIds?: string[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Params for creating a [[CategoryVisibilityHandler]].
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export interface CategoryVisibilityHandlerParams {
|
|
24
|
-
viewManager: ViewManager;
|
|
25
|
-
imodel: IModelConnection;
|
|
26
|
-
categories: CategoryInfo[];
|
|
27
|
-
activeView: Viewport;
|
|
28
|
-
allViewports?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* An [[IVisibilityHandler]] implementation that knows how to determine and change visibility of categories
|
|
32
|
-
* and subcategories.
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export declare class CategoryVisibilityHandler implements IVisibilityHandler {
|
|
36
|
-
private _viewManager;
|
|
37
|
-
private _imodel;
|
|
38
|
-
private _pendingVisibilityChange;
|
|
39
|
-
private _activeView;
|
|
40
|
-
private _useAllViewports;
|
|
41
|
-
private _categories;
|
|
42
|
-
constructor(params: CategoryVisibilityHandlerParams);
|
|
43
|
-
dispose(): void;
|
|
44
|
-
onVisibilityChange: BeEvent<VisibilityChangeListener>;
|
|
45
|
-
getVisibilityStatus(node: TreeNodeItem): VisibilityStatus;
|
|
46
|
-
changeVisibility(node: TreeNodeItem, shouldDisplay: boolean): Promise<void>;
|
|
47
|
-
getSubCategoryVisibility(id: string): "visible" | "hidden";
|
|
48
|
-
getCategoryVisibility(id: string): "visible" | "hidden";
|
|
49
|
-
getParent(key: string): CategoryInfo | undefined;
|
|
50
|
-
private onDisplayStyleChanged;
|
|
51
|
-
private onViewedCategoriesChanged;
|
|
52
|
-
private onVisibilityChangeInternal;
|
|
53
|
-
static getInstanceIdFromTreeNodeKey(nodeKey: NodeKey): string;
|
|
54
|
-
enableCategory(ids: string[], enabled: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
55
|
-
enableSubCategory(key: string, enabled: boolean): void;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Enable display of all given categories.
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
export declare function showAllCategories(categories: string[], viewport: Viewport): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Disable display of all given categories.
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
export declare function hideAllCategories(categories: string[], viewport: Viewport): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Invert display of all given categories.
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
export declare function invertAllCategories(categories: CategoryInfo[], viewport: Viewport): Promise<void>;
|
|
72
|
-
//# sourceMappingURL=CategoryVisibilityHandler.d.ts.map
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.invertAllCategories = exports.hideAllCategories = exports.showAllCategories = exports.CategoryVisibilityHandler = exports.useCategories = void 0;
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const components_react_1 = require("@itwin/components-react");
|
|
10
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
|
-
const presentation_common_1 = require("@itwin/presentation-common");
|
|
13
|
-
const presentation_components_1 = require("@itwin/presentation-components");
|
|
14
|
-
const CategoriesVisibilityUtils_1 = require("../CategoriesVisibilityUtils");
|
|
15
|
-
const EMPTY_CATEGORIES_ARRAY = [];
|
|
16
|
-
/**
|
|
17
|
-
* Loads categories from viewport or uses provided list of categories.
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
function useCategories(viewManager, imodel, view) {
|
|
21
|
-
const currentView = view || viewManager.getFirstOpenView();
|
|
22
|
-
const categoriesPromise = (0, react_1.useMemo)(async () => (0, CategoriesVisibilityUtils_1.loadCategoriesFromViewport)(imodel, currentView), [imodel, currentView]);
|
|
23
|
-
return (0, components_react_1.useAsyncValue)(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;
|
|
24
|
-
}
|
|
25
|
-
exports.useCategories = useCategories;
|
|
26
|
-
/**
|
|
27
|
-
* An [[IVisibilityHandler]] implementation that knows how to determine and change visibility of categories
|
|
28
|
-
* and subcategories.
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
class CategoryVisibilityHandler {
|
|
32
|
-
constructor(params) {
|
|
33
|
-
this.onVisibilityChange = new core_bentley_1.BeEvent();
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
|
-
this.onDisplayStyleChanged = () => {
|
|
36
|
-
this.onVisibilityChangeInternal();
|
|
37
|
-
};
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
39
|
-
this.onViewedCategoriesChanged = () => {
|
|
40
|
-
this.onVisibilityChangeInternal();
|
|
41
|
-
};
|
|
42
|
-
this._viewManager = params.viewManager;
|
|
43
|
-
this._imodel = params.imodel;
|
|
44
|
-
this._activeView = params.activeView;
|
|
45
|
-
// istanbul ignore next
|
|
46
|
-
this._useAllViewports = params.allViewports ?? false;
|
|
47
|
-
this._categories = params.categories;
|
|
48
|
-
this._activeView.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);
|
|
49
|
-
this._activeView.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);
|
|
50
|
-
}
|
|
51
|
-
dispose() {
|
|
52
|
-
this._activeView.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);
|
|
53
|
-
this._activeView.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);
|
|
54
|
-
clearTimeout(this._pendingVisibilityChange);
|
|
55
|
-
}
|
|
56
|
-
getVisibilityStatus(node) {
|
|
57
|
-
const nodeKey = (0, presentation_components_1.isPresentationTreeNodeItem)(node) ? node.key : undefined;
|
|
58
|
-
if (!nodeKey) {
|
|
59
|
-
return { state: "hidden", isDisabled: true };
|
|
60
|
-
}
|
|
61
|
-
const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);
|
|
62
|
-
return { state: node.parentId ? this.getSubCategoryVisibility(instanceId) : this.getCategoryVisibility(instanceId) };
|
|
63
|
-
}
|
|
64
|
-
async changeVisibility(node, shouldDisplay) {
|
|
65
|
-
const nodeKey = (0, presentation_components_1.isPresentationTreeNodeItem)(node) ? node.key : undefined;
|
|
66
|
-
if (!nodeKey) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
// handle subcategory visibility change
|
|
70
|
-
if (node.parentId) {
|
|
71
|
-
const childId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);
|
|
72
|
-
// istanbul ignore next
|
|
73
|
-
const parentId = this.getParent(childId)?.categoryId;
|
|
74
|
-
// make sure parent category is enabled
|
|
75
|
-
if (shouldDisplay && parentId) {
|
|
76
|
-
await this.enableCategory([parentId], true, false);
|
|
77
|
-
}
|
|
78
|
-
this.enableSubCategory(childId, shouldDisplay);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);
|
|
82
|
-
await this.enableCategory([instanceId], shouldDisplay, true);
|
|
83
|
-
}
|
|
84
|
-
getSubCategoryVisibility(id) {
|
|
85
|
-
const parentItem = this.getParent(id);
|
|
86
|
-
if (!parentItem) {
|
|
87
|
-
return "hidden";
|
|
88
|
-
}
|
|
89
|
-
const isVisible = this._activeView.view.viewsCategory(parentItem.categoryId) && this._activeView.isSubCategoryVisible(id);
|
|
90
|
-
return isVisible ? "visible" : "hidden";
|
|
91
|
-
}
|
|
92
|
-
getCategoryVisibility(id) {
|
|
93
|
-
return this._activeView.view.viewsCategory(id) ? "visible" : "hidden";
|
|
94
|
-
}
|
|
95
|
-
getParent(key) {
|
|
96
|
-
for (const category of this._categories) {
|
|
97
|
-
// istanbul ignore else
|
|
98
|
-
if (category.subCategoryIds && category.subCategoryIds.indexOf(key) !== -1) {
|
|
99
|
-
return category;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
onVisibilityChangeInternal() {
|
|
105
|
-
if (this._pendingVisibilityChange) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
this._pendingVisibilityChange = setTimeout(() => {
|
|
109
|
-
this.onVisibilityChange.raiseEvent();
|
|
110
|
-
this._pendingVisibilityChange = undefined;
|
|
111
|
-
}, 0);
|
|
112
|
-
}
|
|
113
|
-
static getInstanceIdFromTreeNodeKey(nodeKey) {
|
|
114
|
-
return presentation_common_1.NodeKey.isInstancesNodeKey(nodeKey) && nodeKey.instanceKeys.length > 0 ? nodeKey.instanceKeys[0].id : /* istanbul ignore next */ "";
|
|
115
|
-
}
|
|
116
|
-
async enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
117
|
-
await (0, CategoriesVisibilityUtils_1.enableCategory)(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);
|
|
118
|
-
}
|
|
119
|
-
enableSubCategory(key, enabled) {
|
|
120
|
-
(0, CategoriesVisibilityUtils_1.enableSubCategory)(this._viewManager, key, enabled, this._useAllViewports);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.CategoryVisibilityHandler = CategoryVisibilityHandler;
|
|
124
|
-
/**
|
|
125
|
-
* Enable display of all given categories.
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
async function showAllCategories(categories, viewport) {
|
|
129
|
-
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, viewport.iModel, categories, true, true);
|
|
130
|
-
}
|
|
131
|
-
exports.showAllCategories = showAllCategories;
|
|
132
|
-
/**
|
|
133
|
-
* Disable display of all given categories.
|
|
134
|
-
* @public
|
|
135
|
-
*/
|
|
136
|
-
async function hideAllCategories(categories, viewport) {
|
|
137
|
-
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, viewport.iModel, categories, false, true);
|
|
138
|
-
}
|
|
139
|
-
exports.hideAllCategories = hideAllCategories;
|
|
140
|
-
/**
|
|
141
|
-
* Invert display of all given categories.
|
|
142
|
-
* @public
|
|
143
|
-
*/
|
|
144
|
-
async function invertAllCategories(categories, viewport) {
|
|
145
|
-
const enabled = [];
|
|
146
|
-
const disabled = [];
|
|
147
|
-
const enabledSubCategories = [];
|
|
148
|
-
const disabledSubCategories = [];
|
|
149
|
-
for (const category of categories) {
|
|
150
|
-
if (!viewport.view.viewsCategory(category.categoryId)) {
|
|
151
|
-
disabled.push(category.categoryId);
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
// First, we need to check if at least one subcategory is disabled. If it is true, then only subcategories should change display, not categories.
|
|
155
|
-
if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {
|
|
156
|
-
for (const subCategory of category.subCategoryIds) {
|
|
157
|
-
viewport.isSubCategoryVisible(subCategory) ? enabledSubCategories.push(subCategory) : disabledSubCategories.push(subCategory);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
enabled.push(category.categoryId);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// Disable enabled
|
|
165
|
-
enabledSubCategories.forEach((subCategory) => (0, CategoriesVisibilityUtils_1.enableSubCategory)(core_frontend_1.IModelApp.viewManager, subCategory, false, true));
|
|
166
|
-
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, viewport.iModel, enabled, false, true);
|
|
167
|
-
// Enable disabled
|
|
168
|
-
disabledSubCategories.forEach((subCategory) => (0, CategoriesVisibilityUtils_1.enableSubCategory)(core_frontend_1.IModelApp.viewManager, subCategory, true, true));
|
|
169
|
-
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, viewport.iModel, disabled, true, true);
|
|
170
|
-
}
|
|
171
|
-
exports.invertAllCategories = invertAllCategories;
|
|
172
|
-
//# sourceMappingURL=CategoryVisibilityHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryVisibilityHandler.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoryVisibilityHandler.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,iCAAgC;AAChC,8DAAwD;AACxD,sDAA8C;AAC9C,wDAAiD;AACjD,oEAAqD;AACrD,4EAA4E;AAC5E,4EAA6G;AAM7G,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD;;;GAGG;AACH,SAAgB,aAAa,CAAC,WAAwB,EAAE,MAAwB,EAAE,IAAe;IAC/F,MAAM,WAAW,GAAG,IAAI,IAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,IAAA,eAAO,EAAC,KAAK,IAAI,EAAE,CAAC,IAAA,sDAA0B,EAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACtH,OAAO,IAAA,gCAAa,EAAC,iBAAiB,CAAC,IAAI,sBAAsB,CAAC;AACpE,CAAC;AAJD,sCAIC;AAuBD;;;;GAIG;AACH,MAAa,yBAAyB;IAQpC,YAAY,MAAuC;QAiB5C,uBAAkB,GAAG,IAAI,sBAAO,EAA4B,CAAC;QA8DpE,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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C,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,IAAA,6CAAiB,EAAC,yBAAS,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAElH,MAAM,IAAA,0CAAc,EAAC,yBAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAEnF,kBAAkB;IAClB,qBAAqB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,6CAAiB,EAAC,yBAAS,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAElH,MAAM,IAAA,0CAAc,EAAC,yBAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrF,CAAC;AA9BD,kDA8BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useMemo } from \"react\";\nimport { useAsyncValue } from \"@itwin/components-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { NodeKey } from \"@itwin/presentation-common\";\nimport { isPresentationTreeNodeItem } from \"@itwin/presentation-components\";\nimport { enableCategory, enableSubCategory, loadCategoriesFromViewport } from \"../CategoriesVisibilityUtils\";\n\nimport type { TreeNodeItem } from \"@itwin/components-react\";\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport type { IVisibilityHandler, VisibilityChangeListener, VisibilityStatus } from \"../VisibilityTreeEventHandler\";\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\n/**\n * Data structure that describes category.\n * @public\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Params for creating a [[CategoryVisibilityHandler]].\n * @public\n */\nexport interface CategoryVisibilityHandlerParams {\n viewManager: ViewManager;\n imodel: IModelConnection;\n categories: CategoryInfo[];\n activeView: Viewport;\n allViewports?: boolean;\n}\n\n/**\n * An [[IVisibilityHandler]] implementation that knows how to determine and change visibility of categories\n * and subcategories.\n * @public\n */\nexport class CategoryVisibilityHandler implements IVisibilityHandler {\n private _viewManager: ViewManager;\n private _imodel: IModelConnection;\n private _pendingVisibilityChange: any | undefined;\n private _activeView: Viewport;\n private _useAllViewports: boolean;\n private _categories: CategoryInfo[];\n\n constructor(params: CategoryVisibilityHandlerParams) {\n this._viewManager = params.viewManager;\n this._imodel = params.imodel;\n this._activeView = params.activeView;\n // istanbul ignore next\n this._useAllViewports = params.allViewports ?? false;\n this._categories = params.categories;\n this._activeView.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._activeView.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n\n public dispose() {\n this._activeView.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._activeView.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent<VisibilityChangeListener>();\n\n public getVisibilityStatus(node: TreeNodeItem): VisibilityStatus {\n const nodeKey = isPresentationTreeNodeItem(node) ? node.key : undefined;\n if (!nodeKey) {\n return { state: \"hidden\", isDisabled: true };\n }\n\n const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n return { state: node.parentId ? this.getSubCategoryVisibility(instanceId) : this.getCategoryVisibility(instanceId) };\n }\n\n public async changeVisibility(node: TreeNodeItem, shouldDisplay: boolean): Promise<void> {\n const nodeKey = isPresentationTreeNodeItem(node) ? node.key : undefined;\n if (!nodeKey) {\n return;\n }\n\n // handle subcategory visibility change\n if (node.parentId) {\n const childId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n // istanbul ignore next\n const parentId = this.getParent(childId)?.categoryId;\n\n // make sure parent category is enabled\n if (shouldDisplay && parentId) {\n await this.enableCategory([parentId], true, false);\n }\n\n this.enableSubCategory(childId, shouldDisplay);\n return;\n }\n\n const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n await this.enableCategory([instanceId], shouldDisplay, true);\n }\n\n public getSubCategoryVisibility(id: string) {\n const parentItem = this.getParent(id);\n if (!parentItem) {\n return \"hidden\";\n }\n\n const isVisible = this._activeView.view.viewsCategory(parentItem.categoryId) && this._activeView.isSubCategoryVisible(id);\n return isVisible ? \"visible\" : \"hidden\";\n }\n\n public getCategoryVisibility(id: string) {\n return this._activeView.view.viewsCategory(id) ? \"visible\" : \"hidden\";\n }\n\n public getParent(key: string): CategoryInfo | undefined {\n for (const category of this._categories) {\n // istanbul ignore else\n if (category.subCategoryIds && category.subCategoryIds.indexOf(key) !== -1) {\n return category;\n }\n }\n\n return undefined;\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 getInstanceIdFromTreeNodeKey(nodeKey: NodeKey) {\n return NodeKey.isInstancesNodeKey(nodeKey) && nodeKey.instanceKeys.length > 0 ? nodeKey.instanceKeys[0].id : /* istanbul ignore next */ \"\";\n }\n\n public async enableCategory(ids: string[], enabled: boolean, enableAllSubCategories = true) {\n await enableCategory(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);\n }\n\n public enableSubCategory(key: string, enabled: boolean) {\n enableSubCategory(this._viewManager, key, enabled, this._useAllViewports);\n }\n}\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategory(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 enableCategory(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) => enableSubCategory(IModelApp.viewManager, subCategory, false, true));\n\n await enableCategory(IModelApp.viewManager, viewport.iModel, enabled, false, true);\n\n // Enable disabled\n disabledSubCategories.forEach((subCategory) => enableSubCategory(IModelApp.viewManager, subCategory, true, true));\n\n await enableCategory(IModelApp.viewManager, viewport.iModel, disabled, true, true);\n}\n"]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { MouseEvent, PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
import type { TreeModelNode } from "@itwin/components-react";
|
|
3
|
-
/**
|
|
4
|
-
* Props for single context menu item.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export interface ContextMenuItemProps {
|
|
8
|
-
node: TreeModelNode;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Props for configuring tree context menu.
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export interface TreeContextMenuProps {
|
|
15
|
-
contextMenuItems?: Array<(props: ContextMenuItemProps) => ReactNode>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Props for [[TreeContextMenuItem]] component.
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export interface TreeContextMenuItemProps {
|
|
22
|
-
/** Unique id of the context menu item. */
|
|
23
|
-
id: string;
|
|
24
|
-
/** Description of the context menu item. */
|
|
25
|
-
title?: string;
|
|
26
|
-
/** Callback that is invoked when context menu item is clicked. */
|
|
27
|
-
onSelect: () => void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Base component for rendering single context menu item.
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export declare function TreeContextMenuItem({ id, children, title, onSelect }: PropsWithChildren<TreeContextMenuItemProps>): JSX.Element;
|
|
34
|
-
/** @internal */
|
|
35
|
-
export declare function useContextMenu({ contextMenuItems }: TreeContextMenuProps): {
|
|
36
|
-
onContextMenu: (e: MouseEvent, node: TreeModelNode) => void;
|
|
37
|
-
renderContextMenu: () => JSX.Element | null;
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=ContextMenu.d.ts.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useContextMenu = exports.TreeContextMenuItem = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
/*---------------------------------------------------------------------------------------------
|
|
6
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
-
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const core_react_1 = require("@itwin/core-react");
|
|
11
|
-
/**
|
|
12
|
-
* Base component for rendering single context menu item.
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
function TreeContextMenuItem({ id, children, title, onSelect }) {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(core_react_1.ContextMenuItem, { onSelect: onSelect, title: title, children: children }, id));
|
|
17
|
-
}
|
|
18
|
-
exports.TreeContextMenuItem = TreeContextMenuItem;
|
|
19
|
-
/** @internal */
|
|
20
|
-
function useContextMenu({ contextMenuItems }) {
|
|
21
|
-
const [contextMenu, setContextMenu] = (0, react_1.useState)();
|
|
22
|
-
const close = () => setContextMenu(undefined);
|
|
23
|
-
const onContextMenu = (e, node) => {
|
|
24
|
-
if (!contextMenuItems) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
setContextMenu({
|
|
28
|
-
items: contextMenuItems.map((item, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: item({ node }) }, index)),
|
|
29
|
-
position: { x: e.clientX, y: e.clientY },
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
const renderContextMenu = () => {
|
|
33
|
-
if (!contextMenu) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(core_react_1.GlobalContextMenu, { identifier: "tree-widget-context-menu", x: contextMenu.position.x, y: contextMenu.position.y, opened: true, onOutsideClick: close, onEsc: close, onSelect: close, children: contextMenu.items }));
|
|
37
|
-
};
|
|
38
|
-
return {
|
|
39
|
-
onContextMenu,
|
|
40
|
-
renderContextMenu,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
exports.useContextMenu = useContextMenu;
|
|
44
|
-
//# sourceMappingURL=ContextMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/ContextMenu.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAA2C;AAC3C,kDAAuE;AAkCvE;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAA+C;IAChH,OAAO,CACL,uBAAC,4BAAe,IAAU,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,YACvD,QAAQ,IADW,EAAE,CAEN,CACnB,CAAC;AACJ,CAAC;AAND,kDAMC;AAOD,gBAAgB;AAChB,SAAgB,cAAc,CAAC,EAAE,gBAAgB,EAAwB;IACvE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,GAAe,CAAC;IAC9D,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAE9C,MAAM,aAAa,GAAG,CAAC,CAAa,EAAE,IAAmB,EAAE,EAAE;QAC3D,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO;SACR;QAED,cAAc,CAAC;YACb,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,uBAAC,gBAAQ,cAAc,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,IAAtB,KAAK,CAA6B,CAAC;YAC/F,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE;SACzC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CACL,uBAAC,8BAAiB,IAChB,UAAU,EAAC,0BAA0B,EACrC,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,EACzB,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,EACzB,MAAM,EAAE,IAAI,EACZ,cAAc,EAAE,KAAK,EACrB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,YAEd,WAAW,CAAC,KAAK,GACA,CACrB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,aAAa;QACb,iBAAiB;KAClB,CAAC;AACJ,CAAC;AAvCD,wCAuCC","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 { Fragment, useState } from \"react\";\nimport { ContextMenuItem, GlobalContextMenu } from \"@itwin/core-react\";\n\nimport type { MouseEvent, PropsWithChildren, ReactNode } from \"react\";\nimport type { TreeModelNode } from \"@itwin/components-react\";\n\n/**\n * Props for single context menu item.\n * @public\n */\nexport interface ContextMenuItemProps {\n node: TreeModelNode;\n}\n\n/**\n * Props for configuring tree context menu.\n * @public\n */\nexport interface TreeContextMenuProps {\n contextMenuItems?: Array<(props: ContextMenuItemProps) => ReactNode>;\n}\n\n/**\n * Props for [[TreeContextMenuItem]] component.\n * @public\n */\nexport interface TreeContextMenuItemProps {\n /** Unique id of the context menu item. */\n id: string;\n /** Description of the context menu item. */\n title?: string;\n /** Callback that is invoked when context menu item is clicked. */\n onSelect: () => void;\n}\n\n/**\n * Base component for rendering single context menu item.\n * @public\n */\nexport function TreeContextMenuItem({ id, children, title, onSelect }: PropsWithChildren<TreeContextMenuItemProps>) {\n return (\n <ContextMenuItem key={id} onSelect={onSelect} title={title}>\n {children}\n </ContextMenuItem>\n );\n}\n\ninterface ContextMenu {\n items: ReactNode[];\n position: { x: number; y: number };\n}\n\n/** @internal */\nexport function useContextMenu({ contextMenuItems }: TreeContextMenuProps) {\n const [contextMenu, setContextMenu] = useState<ContextMenu>();\n const close = () => setContextMenu(undefined);\n\n const onContextMenu = (e: MouseEvent, node: TreeModelNode) => {\n if (!contextMenuItems) {\n return;\n }\n\n setContextMenu({\n items: contextMenuItems.map((item, index) => <Fragment key={index}>{item({ node })}</Fragment>),\n position: { x: e.clientX, y: e.clientY },\n });\n };\n\n const renderContextMenu = () => {\n if (!contextMenu) {\n return null;\n }\n\n return (\n <GlobalContextMenu\n identifier=\"tree-widget-context-menu\"\n x={contextMenu.position.x}\n y={contextMenu.position.y}\n opened={true}\n onOutsideClick={close}\n onEsc={close}\n onSelect={close}\n >\n {contextMenu.items}\n </GlobalContextMenu>\n );\n };\n\n return {\n onContextMenu,\n renderContextMenu,\n };\n}\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { TreeEventHandler } from "@itwin/components-react";
|
|
2
|
-
import type { AbstractTreeNodeLoaderWithProvider, TreeCheckboxStateChangeEventArgs, TreeNodeEventArgs, TreeSelectionModificationEventArgs, TreeSelectionReplacementEventArgs } from "@itwin/components-react";
|
|
3
|
-
import type { IPresentationTreeDataProvider } from "@itwin/presentation-components";
|
|
4
|
-
export interface ReportingTreeEventHandlerProps {
|
|
5
|
-
nodeLoader: AbstractTreeNodeLoaderWithProvider<IPresentationTreeDataProvider>;
|
|
6
|
-
eventHandler: TreeEventHandler;
|
|
7
|
-
reportUsage: (props: {
|
|
8
|
-
reportInteraction: boolean;
|
|
9
|
-
}) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare class ReportingTreeEventHandler extends TreeEventHandler {
|
|
12
|
-
protected _eventHandler: TreeEventHandler;
|
|
13
|
-
protected _reportUsage: (props: {
|
|
14
|
-
reportInteraction: boolean;
|
|
15
|
-
}) => void;
|
|
16
|
-
constructor(props: ReportingTreeEventHandlerProps);
|
|
17
|
-
dispose(): void;
|
|
18
|
-
onNodeExpanded(props: TreeNodeEventArgs): void;
|
|
19
|
-
onNodeCollapsed(props: TreeNodeEventArgs): void;
|
|
20
|
-
onSelectionModified(props: TreeSelectionModificationEventArgs): import("@itwin/components-react").Subscription | undefined;
|
|
21
|
-
onSelectionReplaced(props: TreeSelectionReplacementEventArgs): import("@itwin/components-react").Subscription | undefined;
|
|
22
|
-
onCheckboxStateChanged(props: TreeCheckboxStateChangeEventArgs): import("@itwin/components-react").Subscription | undefined;
|
|
23
|
-
onDelayedNodeClick(props: TreeNodeEventArgs): void;
|
|
24
|
-
onNodeDoubleClick(props: TreeNodeEventArgs): void;
|
|
25
|
-
onNodeEditorActivated(props: TreeNodeEventArgs): void;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=ReportingTreeEventHandler.d.ts.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ReportingTreeEventHandler = void 0;
|
|
8
|
-
const components_react_1 = require("@itwin/components-react");
|
|
9
|
-
class ReportingTreeEventHandler extends components_react_1.TreeEventHandler {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super({ modelSource: props.nodeLoader.modelSource, nodeLoader: props.nodeLoader });
|
|
12
|
-
this._eventHandler = props.eventHandler;
|
|
13
|
-
this._reportUsage = props.reportUsage;
|
|
14
|
-
}
|
|
15
|
-
dispose() {
|
|
16
|
-
this._eventHandler.dispose();
|
|
17
|
-
super.dispose();
|
|
18
|
-
}
|
|
19
|
-
onNodeExpanded(props) {
|
|
20
|
-
this._reportUsage({ reportInteraction: true });
|
|
21
|
-
this._eventHandler.onNodeExpanded(props);
|
|
22
|
-
}
|
|
23
|
-
onNodeCollapsed(props) {
|
|
24
|
-
this._reportUsage({ reportInteraction: true });
|
|
25
|
-
this._eventHandler.onNodeCollapsed(props);
|
|
26
|
-
}
|
|
27
|
-
onSelectionModified(props) {
|
|
28
|
-
this._reportUsage({ reportInteraction: true });
|
|
29
|
-
return this._eventHandler.onSelectionModified(props);
|
|
30
|
-
}
|
|
31
|
-
onSelectionReplaced(props) {
|
|
32
|
-
this._reportUsage({ reportInteraction: true });
|
|
33
|
-
return this._eventHandler.onSelectionReplaced(props);
|
|
34
|
-
}
|
|
35
|
-
onCheckboxStateChanged(props) {
|
|
36
|
-
return this._eventHandler.onCheckboxStateChanged(props);
|
|
37
|
-
}
|
|
38
|
-
onDelayedNodeClick(props) {
|
|
39
|
-
this._eventHandler.onDelayedNodeClick(props);
|
|
40
|
-
}
|
|
41
|
-
onNodeDoubleClick(props) {
|
|
42
|
-
this._reportUsage({ reportInteraction: true });
|
|
43
|
-
this._eventHandler.onNodeDoubleClick(props);
|
|
44
|
-
}
|
|
45
|
-
onNodeEditorActivated(props) {
|
|
46
|
-
this._reportUsage({ reportInteraction: true });
|
|
47
|
-
this._eventHandler.onNodeEditorActivated(props);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.ReportingTreeEventHandler = ReportingTreeEventHandler;
|
|
51
|
-
//# sourceMappingURL=ReportingTreeEventHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReportingTreeEventHandler.js","source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,sBAAsB,CAAC,KAAuC;QAC5E,OAAO,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAEe,kBAAkB,CAAC,KAAwB;QACzD,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAEe,iBAAiB,CAAC,KAAwB;QACxD,IAAI,CAAC,YAAY,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEe,qBAAqB,CAAC,KAAwB;QAC5D,IAAI,CAAC,YAAY,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;CACF;AApDD,8DAoDC","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 { TreeEventHandler } from \"@itwin/components-react\";\n\nimport type {\n AbstractTreeNodeLoaderWithProvider,\n TreeCheckboxStateChangeEventArgs,\n TreeNodeEventArgs,\n TreeSelectionModificationEventArgs,\n TreeSelectionReplacementEventArgs,\n} from \"@itwin/components-react\";\nimport type { IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nexport interface ReportingTreeEventHandlerProps {\n nodeLoader: AbstractTreeNodeLoaderWithProvider<IPresentationTreeDataProvider>;\n eventHandler: TreeEventHandler;\n reportUsage: (props: { reportInteraction: boolean }) => void;\n}\n\nexport class ReportingTreeEventHandler extends TreeEventHandler {\n protected _eventHandler: TreeEventHandler;\n protected _reportUsage: (props: { reportInteraction: boolean }) => void;\n\n constructor(props: ReportingTreeEventHandlerProps) {\n super({ modelSource: props.nodeLoader.modelSource, nodeLoader: props.nodeLoader });\n this._eventHandler = props.eventHandler;\n this._reportUsage = props.reportUsage;\n }\n\n public dispose() {\n this._eventHandler.dispose();\n super.dispose();\n }\n\n public override onNodeExpanded(props: TreeNodeEventArgs) {\n this._reportUsage({ reportInteraction: true });\n this._eventHandler.onNodeExpanded(props);\n }\n\n public override onNodeCollapsed(props: TreeNodeEventArgs) {\n this._reportUsage({ reportInteraction: true });\n this._eventHandler.onNodeCollapsed(props);\n }\n\n public override onSelectionModified(props: TreeSelectionModificationEventArgs) {\n this._reportUsage({ reportInteraction: true });\n return this._eventHandler.onSelectionModified(props);\n }\n\n public override onSelectionReplaced(props: TreeSelectionReplacementEventArgs) {\n this._reportUsage({ reportInteraction: true });\n return this._eventHandler.onSelectionReplaced(props);\n }\n\n public override onCheckboxStateChanged(props: TreeCheckboxStateChangeEventArgs) {\n return this._eventHandler.onCheckboxStateChanged(props);\n }\n\n public override onDelayedNodeClick(props: TreeNodeEventArgs) {\n this._eventHandler.onDelayedNodeClick(props);\n }\n\n public override onNodeDoubleClick(props: TreeNodeEventArgs) {\n this._reportUsage({ reportInteraction: true });\n this._eventHandler.onNodeDoubleClick(props);\n }\n\n public override onNodeEditorActivated(props: TreeNodeEventArgs) {\n this._reportUsage({ reportInteraction: true });\n this._eventHandler.onNodeEditorActivated(props);\n }\n}\n"]}
|