@itwin/tree-widget-react 3.0.0-dev.0 → 3.0.0-dev.2
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 +9 -1
- package/README.md +232 -147
- package/lib/cjs/TreeWidget.d.ts +0 -1
- 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 +10 -10
- 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/{esm/components/trees/category-tree → cjs/components/trees/categories-tree}/CategoriesTreeButtons.d.ts +2 -9
- package/lib/cjs/components/trees/{category-tree → categories-tree}/CategoriesTreeButtons.js +10 -11
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/{esm/components/trees/category-tree → cjs/components/trees/categories-tree}/CategoriesTreeComponent.d.ts +11 -12
- 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/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.js +7 -2
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.d.ts +6 -6
- package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.js +10 -10
- 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/{esm/components/trees/stateless → cjs/components/trees}/common/FocusedInstancesContext.d.ts +2 -1
- package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -0
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/common/FocusedInstancesContextProvider.d.ts +1 -1
- package/lib/cjs/components/trees/{stateless/common → common}/FocusedInstancesContextProvider.js +30 -6
- 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/{esm/components/trees/stateless → cjs/components/trees}/common/UseHierarchiesLocalization.d.ts +2 -2
- package/lib/cjs/components/trees/{stateless/common → common}/UseHierarchiesLocalization.js +12 -11
- 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/{stateless/common → common}/UseHierarchyFiltering.js +44 -26
- 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/{stateless/common → common}/UseHierarchyVisibility.js +45 -29
- 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.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 +78 -0
- package/lib/cjs/components/trees/common/components/BaseTree.js.map +1 -0
- package/lib/cjs/components/trees/common/components/Delayed.js.map +1 -0
- package/lib/cjs/components/trees/common/components/ProgressOverlay.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
- package/lib/cjs/components/trees/{stateless/common/components/VisibilityTreeNodeCheckbox.js → common/components/TreeNodeCheckbox.js} +11 -7
- 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/{stateless/common/components/VisibilityTreeNodeRenderer.js → common/components/TreeNodeRenderer.js} +6 -6
- package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.d.ts +17 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.js +44 -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/{esm/components/trees/stateless → cjs/components/trees}/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +6 -2
- package/lib/cjs/components/trees/{stateless/external-sources-tree → external-sources-tree}/ExternalSourcesTreeDefinition.js +55 -37
- 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 -55
- 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/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.d.ts +3 -0
- package/lib/cjs/components/trees/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.js +248 -268
- 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 -19
- package/lib/cjs/components/trees/index.js +9 -31
- 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 +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +40 -25
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +13 -12
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +35 -26
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/models-tree/ModelsTreeDefinition.d.ts +36 -4
- 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 +0 -1
- 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 +10 -10
- 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/{cjs/components/trees/category-tree → esm/components/trees/categories-tree}/CategoriesTreeButtons.d.ts +2 -9
- package/lib/esm/components/trees/{category-tree → categories-tree}/CategoriesTreeButtons.js +7 -8
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/{cjs/components/trees/category-tree → esm/components/trees/categories-tree}/CategoriesTreeComponent.d.ts +11 -12
- 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/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.js +7 -2
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.d.ts +6 -6
- package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.js +8 -8
- 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/{cjs/components/trees/stateless → esm/components/trees}/common/FocusedInstancesContext.d.ts +2 -1
- package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -0
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/common/FocusedInstancesContextProvider.d.ts +1 -1
- package/lib/esm/components/trees/{stateless/common → common}/FocusedInstancesContextProvider.js +30 -6
- 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/{cjs/components/trees/stateless → esm/components/trees}/common/UseHierarchiesLocalization.d.ts +2 -2
- package/lib/esm/components/trees/common/UseHierarchiesLocalization.js +30 -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/{stateless/common → common}/UseHierarchyFiltering.js +45 -27
- 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/{stateless/common → common}/UseHierarchyVisibility.js +45 -29
- 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.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 +74 -0
- package/lib/esm/components/trees/common/components/BaseTree.js.map +1 -0
- package/lib/esm/components/trees/common/components/Delayed.js.map +1 -0
- package/lib/esm/components/trees/common/components/ProgressOverlay.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
- package/lib/esm/components/trees/{stateless/common/components/VisibilityTreeNodeCheckbox.js → common/components/TreeNodeCheckbox.js} +6 -5
- 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 +17 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.js +40 -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/{cjs/components/trees/stateless → esm/components/trees}/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +6 -2
- package/lib/esm/components/trees/{stateless/external-sources-tree → external-sources-tree}/ExternalSourcesTreeDefinition.js +55 -37
- 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 -53
- 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/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.d.ts +3 -0
- package/lib/esm/components/trees/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.js +249 -269
- 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 -19
- package/lib/esm/components/trees/index.js +4 -17
- 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 +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +30 -15
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +13 -12
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +36 -27
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/models-tree/ModelsTreeDefinition.d.ts +36 -4
- 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 -62
- package/package.json +18 -11
- 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 -117
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +0 -104
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -65
- 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/trees/stateless/categories-tree/CategoriesTree.d.ts +0 -20
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js +0 -61
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +0 -43
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.d.ts +0 -21
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js +0 -34
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/Utils.d.ts +0 -3
- package/lib/cjs/components/trees/stateless/common/Utils.js +0 -23
- package/lib/cjs/components/trees/stateless/common/Utils.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/Delayed.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.d.ts +0 -23
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js +0 -66
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.d.ts +0 -26
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js +0 -68
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +0 -12
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +0 -10
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js +0 -23
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +0 -41
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +0 -13
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +0 -40
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +0 -14
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +0 -25
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +0 -13
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js +0 -48
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +0 -14
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +0 -25
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/index.d.ts +0 -5
- package/lib/cjs/components/trees/stateless/index.js +0 -16
- package/lib/cjs/components/trees/stateless/index.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js +0 -77
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +0 -17
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js +0 -55
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js +0 -856
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +0 -48
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +0 -470
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.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 -110
- package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +0 -97
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -65
- 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/trees/stateless/categories-tree/CategoriesTree.d.ts +0 -20
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js +0 -57
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +0 -16
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +0 -39
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js +0 -29
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.d.ts +0 -16
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.d.ts +0 -21
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js +0 -30
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/Utils.d.ts +0 -3
- package/lib/esm/components/trees/stateless/common/Utils.js +0 -19
- package/lib/esm/components/trees/stateless/common/Utils.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/Delayed.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.d.ts +0 -23
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js +0 -62
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.d.ts +0 -26
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js +0 -64
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +0 -12
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +0 -10
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js +0 -13
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +0 -16
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js +0 -19
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +0 -41
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +0 -13
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +0 -36
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +0 -14
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +0 -21
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +0 -13
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js +0 -44
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +0 -14
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +0 -21
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/index.d.ts +0 -5
- package/lib/esm/components/trees/stateless/index.js +0 -9
- package/lib/esm/components/trees/stateless/index.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.d.ts +0 -16
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js +0 -73
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +0 -17
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js +0 -51
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js +0 -852
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +0 -48
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +0 -466
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.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
- /package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/FocusedInstancesContext.js +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/UseMultiCheckboxHandler.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/Delayed.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/Delayed.js +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/ProgressOverlay.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/ProgressOverlay.js +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/ProgressOverlay.scss +0 -0
- /package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/FocusedInstancesContext.js +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/UseMultiCheckboxHandler.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/Delayed.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/Delayed.js +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/ProgressOverlay.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/ProgressOverlay.js +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/ProgressOverlay.scss +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CategoriesTree = 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_frontend_1 = require("@itwin/core-frontend");
|
|
11
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
12
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
13
|
+
const TreeWidget_1 = require("../../../TreeWidget");
|
|
14
|
+
const VisibilityTree_1 = require("../common/components/VisibilityTree");
|
|
15
|
+
const UseFeatureReporting_1 = require("../common/UseFeatureReporting");
|
|
16
|
+
const CategoriesTreeComponent_1 = require("./CategoriesTreeComponent");
|
|
17
|
+
const CategoriesTreeDefinition_1 = require("./CategoriesTreeDefinition");
|
|
18
|
+
const CategoriesVisibilityHandler_1 = require("./CategoriesVisibilityHandler");
|
|
19
|
+
/** @internal */
|
|
20
|
+
function CategoriesTree({ imodel, viewManager, categories, allViewports, getSchemaContext, height, width, activeView, filter, density, hierarchyLevelConfig, selectionMode, onPerformanceMeasured, onFeatureUsed, }) {
|
|
21
|
+
const [filteringError, setFilteringError] = (0, react_1.useState)();
|
|
22
|
+
const visibilityHandlerFactory = (0, react_1.useCallback)(() => {
|
|
23
|
+
const visibilityHandler = new CategoriesVisibilityHandler_1.CategoriesVisibilityHandler({
|
|
24
|
+
imodel,
|
|
25
|
+
viewport: activeView,
|
|
26
|
+
viewManager: viewManager ?? core_frontend_1.IModelApp.viewManager,
|
|
27
|
+
categories,
|
|
28
|
+
allViewports,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
getVisibilityStatus: async (node) => visibilityHandler.getVisibilityStatus(node),
|
|
32
|
+
changeVisibility: async (node, on) => visibilityHandler.changeVisibility(node, on),
|
|
33
|
+
onVisibilityChange: visibilityHandler.onVisibilityChange,
|
|
34
|
+
dispose: () => visibilityHandler.dispose(),
|
|
35
|
+
};
|
|
36
|
+
}, [activeView, allViewports, categories, imodel, viewManager]);
|
|
37
|
+
const { reportUsage } = (0, UseFeatureReporting_1.useFeatureReporting)({ onFeatureUsed, treeIdentifier: CategoriesTreeComponent_1.CategoriesTreeComponent.id });
|
|
38
|
+
const getDefinitionsProvider = (0, react_1.useCallback)((props) => {
|
|
39
|
+
return new CategoriesTreeDefinition_1.CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
40
|
+
}, [activeView]);
|
|
41
|
+
const getSearchFilteredPaths = (0, react_1.useMemo)(() => {
|
|
42
|
+
setFilteringError(undefined);
|
|
43
|
+
if (!filter) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return async ({ imodelAccess }) => {
|
|
47
|
+
reportUsage?.({ featureId: "filtering", reportInteraction: true });
|
|
48
|
+
try {
|
|
49
|
+
return await CategoriesTreeDefinition_1.CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
const newError = e instanceof Error && e.message.match(/Filter matches more than \d+ items/) ? "tooManyFilterMatches" : "unknownFilterError";
|
|
53
|
+
setFilteringError(newError);
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, [filter, activeView, reportUsage]);
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(VisibilityTree_1.VisibilityTree, { height: height, width: width, imodel: imodel, treeName: CategoriesTreeComponent_1.CategoriesTreeComponent.id, getSchemaContext: getSchemaContext, visibilityHandlerFactory: visibilityHandlerFactory, getHierarchyDefinition: getDefinitionsProvider, getFilteredPaths: getSearchFilteredPaths, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, getSublabel: getSublabel, getIcon: getIcon, density: density, noDataMessage: getNoDataMessage(filter, filteringError), selectionMode: selectionMode ?? "none", onPerformanceMeasured: (action, duration) => {
|
|
59
|
+
onPerformanceMeasured?.(`${CategoriesTreeComponent_1.CategoriesTreeComponent.id}-${action}`, duration);
|
|
60
|
+
}, reportUsage: reportUsage, searchText: filter }));
|
|
61
|
+
}
|
|
62
|
+
exports.CategoriesTree = CategoriesTree;
|
|
63
|
+
function getNoDataMessage(filter, error) {
|
|
64
|
+
if (error) {
|
|
65
|
+
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate(`categoriesTree.filtering.${error}`) });
|
|
66
|
+
}
|
|
67
|
+
if (filter) {
|
|
68
|
+
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate("categoriesTree.filtering.noMatches", { filter }) });
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
function getIcon() {
|
|
73
|
+
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgLayers, {});
|
|
74
|
+
}
|
|
75
|
+
function getSublabel(node) {
|
|
76
|
+
return node.extendedData?.description;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=CategoriesTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAuD;AACvD,wDAAiD;AACjD,oEAAuD;AACvD,wDAA4C;AAC5C,oDAAiD;AACjD,wEAAqE;AACrE,uEAAoE;AACpE,uEAAoE;AACpE,yEAAsE;AACtE,+EAA4E;AA6B5E,gBAAgB;AAChB,SAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,WAAW,EACX,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,UAAU,EACV,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,aAAa,GACG;IAChB,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,GAA4C,CAAC;IACjG,MAAM,wBAAwB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAChD,MAAM,iBAAiB,GAAG,IAAI,yDAA2B,CAAC;YACxD,MAAM;YACN,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,WAAW,IAAI,yBAAS,CAAC,WAAW;YACjD,UAAU;YACV,YAAY;SACb,CAAC,CAAC;QACH,OAAO;YACL,mBAAmB,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAC/F,gBAAgB,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1G,kBAAkB,EAAE,iBAAiB,CAAC,kBAAkB;YACxD,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE;SAC3C,CAAC;IACJ,C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d,OAAO,uBAAC,+BAAS,KAAG,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAAC,IAA+B;IAClD,OAAO,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC;AACxC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgLayers } from \"@itwin/itwinui-icons-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport { useFeatureReporting } from \"../common/UseFeatureReporting\";\nimport { CategoriesTreeComponent } from \"./CategoriesTreeComponent\";\nimport { CategoriesTreeDefinition } from \"./CategoriesTreeDefinition\";\nimport { CategoriesVisibilityHandler } from \"./CategoriesVisibilityHandler\";\n\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\ntype CategoriesTreeFilteringError = \"tooManyFilterMatches\" | \"unknownFilterError\";\n\ninterface CategoriesTreeOwnProps {\n filter: string;\n activeView: Viewport;\n categories: CategoryInfo[];\n viewManager?: ViewManager;\n allViewports?: boolean;\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\ntype GetFilteredPathsCallback = VisibilityTreeProps[\"getFilteredPaths\"];\ntype GetHierarchyDefinitionCallback = VisibilityTreeProps[\"getHierarchyDefinition\"];\n\ntype ModelsTreeProps = CategoriesTreeOwnProps & Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"height\" | \"width\" | \"density\" | \"selectionMode\">;\n\n/** @internal */\nexport function CategoriesTree({\n imodel,\n viewManager,\n categories,\n allViewports,\n getSchemaContext,\n height,\n width,\n activeView,\n filter,\n density,\n hierarchyLevelConfig,\n selectionMode,\n onPerformanceMeasured,\n onFeatureUsed,\n}: ModelsTreeProps) {\n const [filteringError, setFilteringError] = useState<CategoriesTreeFilteringError | undefined>();\n const visibilityHandlerFactory = useCallback(() => {\n const visibilityHandler = new CategoriesVisibilityHandler({\n imodel,\n viewport: activeView,\n viewManager: viewManager ?? IModelApp.viewManager,\n categories,\n allViewports,\n });\n return {\n getVisibilityStatus: async (node: HierarchyNode) => visibilityHandler.getVisibilityStatus(node),\n changeVisibility: async (node: HierarchyNode, on: boolean) => visibilityHandler.changeVisibility(node, on),\n onVisibilityChange: visibilityHandler.onVisibilityChange,\n dispose: () => visibilityHandler.dispose(),\n };\n }, [activeView, allViewports, categories, imodel, viewManager]);\n\n const { reportUsage } = useFeatureReporting({ onFeatureUsed, treeIdentifier: CategoriesTreeComponent.id });\n\n const getDefinitionsProvider = useCallback(\n (props: Parameters<GetHierarchyDefinitionCallback>[0]) => {\n return new CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? \"2d\" : \"3d\" });\n },\n [activeView],\n );\n\n const getSearchFilteredPaths = useMemo<GetFilteredPathsCallback | undefined>(() => {\n setFilteringError(undefined);\n if (!filter) {\n return undefined;\n }\n return async ({ imodelAccess }) => {\n reportUsage?.({ featureId: \"filtering\", reportInteraction: true });\n try {\n return await CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? \"2d\" : \"3d\" });\n } catch (e) {\n const newError = e instanceof Error && e.message.match(/Filter matches more than \\d+ items/) ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n setFilteringError(newError);\n return [];\n }\n };\n }, [filter, activeView, reportUsage]);\n\n return (\n <VisibilityTree\n height={height}\n width={width}\n imodel={imodel}\n treeName={CategoriesTreeComponent.id}\n getSchemaContext={getSchemaContext}\n visibilityHandlerFactory={visibilityHandlerFactory}\n getHierarchyDefinition={getDefinitionsProvider}\n getFilteredPaths={getSearchFilteredPaths}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n getSublabel={getSublabel}\n getIcon={getIcon}\n density={density}\n noDataMessage={getNoDataMessage(filter, filteringError)}\n selectionMode={selectionMode ?? \"none\"}\n onPerformanceMeasured={(action, duration) => {\n onPerformanceMeasured?.(`${CategoriesTreeComponent.id}-${action}`, duration);\n }}\n reportUsage={reportUsage}\n searchText={filter}\n />\n );\n}\n\nfunction getNoDataMessage(filter: string, error?: CategoriesTreeFilteringError) {\n if (error) {\n return <Text>{TreeWidget.translate(`categoriesTree.filtering.${error}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"categoriesTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction getIcon() {\n return <SvgLayers />;\n}\n\nfunction getSublabel(node: PresentationHierarchyNode) {\n return node.extendedData?.description;\n}\n"]}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { CategoryInfo } from "../common/CategoriesVisibilityUtils";
|
|
2
3
|
import type { TreeHeaderButtonProps } from "../../tree-header/TreeHeader";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export interface CategoryInfo {
|
|
8
|
-
categoryId: string;
|
|
9
|
-
subCategoryIds?: string[];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Props that get passed to [[CategoriesTreeComponent]] header button renderer.
|
|
5
|
+
* Props that get passed to `CategoriesTreeComponent` header button renderer.
|
|
13
6
|
* @see CategoriesTreeComponentProps.headerButtons
|
|
14
7
|
* @public
|
|
15
8
|
*/
|
|
@@ -9,29 +9,28 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
9
9
|
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
10
10
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
11
11
|
const TreeWidget_1 = require("../../../TreeWidget");
|
|
12
|
-
const
|
|
13
|
-
const CategoryVisibilityHandler_1 = require("./CategoryVisibilityHandler");
|
|
12
|
+
const CategoriesVisibilityUtils_1 = require("../common/CategoriesVisibilityUtils");
|
|
14
13
|
/** @internal */
|
|
15
14
|
function ShowAllButton(props) {
|
|
16
|
-
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: () => {
|
|
17
|
-
props.onFeatureUsed?.(
|
|
18
|
-
void (0,
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget_1.TreeWidget.translate("categoriesTree.buttons.showAll.tooltip"), onClick: () => {
|
|
16
|
+
props.onFeatureUsed?.(`categories-tree-showall`);
|
|
17
|
+
void (0, CategoriesVisibilityUtils_1.showAllCategories)((props.filteredCategories ?? props.categories).map((category) => category.categoryId), props.viewport);
|
|
19
18
|
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgVisibilityShow, {}) }));
|
|
20
19
|
}
|
|
21
20
|
exports.ShowAllButton = ShowAllButton;
|
|
22
21
|
/** @internal */
|
|
23
22
|
function HideAllButton(props) {
|
|
24
|
-
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: () => {
|
|
25
|
-
props.onFeatureUsed?.(
|
|
26
|
-
void (0,
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget_1.TreeWidget.translate("categoriesTree.buttons.hideAll.tooltip"), onClick: () => {
|
|
24
|
+
props.onFeatureUsed?.(`categories-tree-hideall`);
|
|
25
|
+
void (0, CategoriesVisibilityUtils_1.hideAllCategories)((props.filteredCategories ?? props.categories).map((category) => category.categoryId), props.viewport);
|
|
27
26
|
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgVisibilityHide, {}) }));
|
|
28
27
|
}
|
|
29
28
|
exports.HideAllButton = HideAllButton;
|
|
30
29
|
/** @internal */
|
|
31
30
|
function InvertAllButton(props) {
|
|
32
|
-
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: () => {
|
|
33
|
-
props.onFeatureUsed?.(
|
|
34
|
-
void (0,
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { title: TreeWidget_1.TreeWidget.translate("categoriesTree.buttons.invert.tooltip"), size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", onClick: () => {
|
|
32
|
+
props.onFeatureUsed?.(`categories-tree-invert`);
|
|
33
|
+
void (0, CategoriesVisibilityUtils_1.invertAllCategories)(props.filteredCategories ?? props.categories, props.viewport);
|
|
35
34
|
}, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgVisibilityHalf, {}) }));
|
|
36
35
|
}
|
|
37
36
|
exports.InvertAllButton = InvertAllButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTreeButtons.js","sourceRoot":"","sources":["../../../../../src/components/trees/categories-tree/CategoriesTreeButtons.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oEAAqG;AACrG,wDAAkD;AAClD,oDAAiD;AACjD,mFAAgH;AAiBhH,gBAAgB;AAChB,SAAgB,aAAa,CAAC,KAAsC;IAClE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KAAsC;IACpE,OAAO,CACL,uBAAC,0BAAU,IACT,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACpE,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,wBAAwB,CAAC,CAAC;YAChD,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;AAdD,0CAcC","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 { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { hideAllCategories, invertAllCategories, showAllCategories } from \"../common/CategoriesVisibilityUtils\";\n\nimport type { CategoryInfo } from \"../common/CategoriesVisibilityUtils\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\n\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/** @internal */\nexport function ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"categoriesTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-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\n/** @internal */\nexport function HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"categoriesTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-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\n/** @internal */\nexport function InvertAllButton(props: CategoriesTreeHeaderButtonProps) {\n return (\n <IconButton\n title={TreeWidget.translate(\"categoriesTree.buttons.invert.tooltip\")}\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n onClick={() => {\n props.onFeatureUsed?.(`categories-tree-invert`);\n void invertAllCategories(props.filteredCategories ?? props.categories, props.viewport);\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n"]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import "
|
|
1
|
+
import "../Tree.scss";
|
|
2
|
+
import { CategoriesTree } from "./CategoriesTree";
|
|
3
3
|
import { HideAllButton, InvertAllButton, ShowAllButton } from "./CategoriesTreeButtons";
|
|
4
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
5
|
+
import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
|
|
4
6
|
import type { CategoriesTreeHeaderButtonProps } from "./CategoriesTreeButtons";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Props for [[CategoriesTreeComponent]].
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export interface CategoriesTreeComponentProps extends Omit<CategoryTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied" | "categories" | "categoryVisibilityHandler" | "viewManager"> {
|
|
7
|
+
type CategoriesTreeProps = ComponentPropsWithoutRef<typeof CategoriesTree>;
|
|
8
|
+
interface CategoriesTreeComponentProps extends Pick<CategoriesTreeProps, "getSchemaContext" | "density" | "hierarchyLevelConfig" | "selectionMode" | "onPerformanceMeasured" | "onFeatureUsed"> {
|
|
11
9
|
/**
|
|
12
10
|
* Renderers of header buttons. Defaults to:
|
|
13
11
|
* ```ts
|
|
@@ -19,10 +17,10 @@ export interface CategoriesTreeComponentProps extends Omit<CategoryTreeProps, "i
|
|
|
19
17
|
* ```
|
|
20
18
|
*/
|
|
21
19
|
headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;
|
|
20
|
+
selectionStorage: SelectionStorage;
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
|
-
* A component that renders
|
|
25
|
-
* and header buttons.
|
|
23
|
+
* A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.
|
|
26
24
|
* @public
|
|
27
25
|
*/
|
|
28
26
|
export declare const CategoriesTreeComponent: {
|
|
@@ -43,14 +41,15 @@ export declare const CategoriesTreeComponent: {
|
|
|
43
41
|
*/
|
|
44
42
|
InvertAllButton: typeof InvertAllButton;
|
|
45
43
|
/**
|
|
46
|
-
* Id of the component. May be used when a creating a
|
|
44
|
+
* Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
47
45
|
* @public
|
|
48
46
|
*/
|
|
49
47
|
id: string;
|
|
50
48
|
/**
|
|
51
|
-
* Label of the component. May be used when a creating a
|
|
49
|
+
* Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
52
50
|
* @public
|
|
53
51
|
*/
|
|
54
52
|
getLabel(): string;
|
|
55
53
|
};
|
|
54
|
+
export {};
|
|
56
55
|
//# sourceMappingURL=CategoriesTreeComponent.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
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("../Tree.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 presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
18
|
+
const TreeWidget_1 = require("../../../TreeWidget");
|
|
19
|
+
const TreeHeader_1 = require("../../tree-header/TreeHeader");
|
|
20
|
+
const AutoSizer_1 = require("../../utils/AutoSizer");
|
|
21
|
+
const UseFiltering_1 = require("../common/UseFiltering");
|
|
22
|
+
const CategoriesTree_1 = require("./CategoriesTree");
|
|
23
|
+
const CategoriesTreeButtons_1 = require("./CategoriesTreeButtons");
|
|
24
|
+
const UseCategories_1 = require("./UseCategories");
|
|
25
|
+
/**
|
|
26
|
+
* A component that renders `CategoriesTree` and a header with filtering capabilities and header buttons.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
const CategoriesTreeComponent = (props) => {
|
|
30
|
+
const iModel = (0, appui_react_1.useActiveIModelConnection)();
|
|
31
|
+
const viewport = (0, appui_react_1.useActiveViewport)();
|
|
32
|
+
if (!iModel || !viewport) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return (0, jsx_runtime_1.jsx)(CategoriesTreeComponentImpl, { ...props, iModel: iModel, viewport: viewport });
|
|
36
|
+
};
|
|
37
|
+
exports.CategoriesTreeComponent = CategoriesTreeComponent;
|
|
38
|
+
/**
|
|
39
|
+
* Renders a "Show all" button that enables display of all categories and their subcategories.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
exports.CategoriesTreeComponent.ShowAllButton = CategoriesTreeButtons_1.ShowAllButton;
|
|
43
|
+
/**
|
|
44
|
+
* Renders a "Hide all" button that disables display of all categories.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
exports.CategoriesTreeComponent.HideAllButton = CategoriesTreeButtons_1.HideAllButton;
|
|
48
|
+
/**
|
|
49
|
+
* Renders an "Invert all" button that inverts display of all categories.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
exports.CategoriesTreeComponent.InvertAllButton = CategoriesTreeButtons_1.InvertAllButton;
|
|
53
|
+
/**
|
|
54
|
+
* Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
exports.CategoriesTreeComponent.id = "categories-tree-v2";
|
|
58
|
+
/**
|
|
59
|
+
* Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
exports.CategoriesTreeComponent.getLabel = () => TreeWidget_1.TreeWidget.translate("categoriesTree.label");
|
|
63
|
+
function CategoriesTreeComponentImpl({ iModel, viewport, headerButtons, selectionStorage, ...treeProps }) {
|
|
64
|
+
const categories = (0, UseCategories_1.useCategories)(core_frontend_1.IModelApp.viewManager, iModel, viewport);
|
|
65
|
+
const { filter, applyFilter, clearFilter } = (0, UseFiltering_1.useFiltering)();
|
|
66
|
+
const density = treeProps.density;
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)("tw-tree-with-header", density === "enlarged" && "enlarge"), children: (0, jsx_runtime_1.jsxs)(presentation_hierarchies_react_1.UnifiedSelectionProvider, { storage: selectionStorage, children: [(0, jsx_runtime_1.jsx)(TreeHeader_1.TreeHeader, { onFilterStart: applyFilter, onFilterClear: clearFilter, onSelectedChanged: () => { }, density: density, children: headerButtons
|
|
68
|
+
? headerButtons.map((btn, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: btn({ viewport, categories, onFeatureUsed: treeProps.onFeatureUsed }) }, index))
|
|
69
|
+
: [
|
|
70
|
+
(0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.ShowAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "show-all-btn"),
|
|
71
|
+
(0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.HideAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "hide-all-btn"),
|
|
72
|
+
(0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.InvertAllButton, { viewport: viewport, categories: categories, density: density, onFeatureUsed: treeProps.onFeatureUsed }, "invert-all-btn"),
|
|
73
|
+
] }), (0, jsx_runtime_1.jsx)("div", { className: "tw-tree-content", children: (0, jsx_runtime_1.jsx)(AutoSizer_1.AutoSizer, { children: ({ width, height }) => ((0, jsx_runtime_1.jsx)(CategoriesTree_1.CategoriesTree, { ...treeProps, imodel: iModel, categories: categories, activeView: viewport, width: width, height: height, filter: filter })) }) })] }) }));
|
|
74
|
+
}
|
|
75
|
+
//# 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,wBAAsB;AACtB,4DAAoC;AACpC,iCAAiC;AACjC,oDAAkF;AAClF,wDAAiD;AACjD,0FA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AAM,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"]}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.CategoriesTreeDefinition = void 0;
|
|
8
8
|
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
9
9
|
const presentation_shared_1 = require("@itwin/presentation-shared");
|
|
10
|
+
const MAX_FILTERING_INSTANCE_KEY_COUNT = 100;
|
|
10
11
|
class CategoriesTreeDefinition {
|
|
11
12
|
constructor(props) {
|
|
12
13
|
this._impl = (0, presentation_hierarchies_1.createClassBasedHierarchyDefinition)({
|
|
@@ -165,9 +166,10 @@ async function createInstanceKeyPathsFromInstanceLabel(props) {
|
|
|
165
166
|
IIF(c.ChildCount > 1, sc.ECInstanceId, NULL) AS SubcategoryId
|
|
166
167
|
FROM RootCategories c
|
|
167
168
|
JOIN SubCategoriesWithLabels sc ON sc.ParentId = c.ECInstanceId
|
|
168
|
-
WHERE sc.DisplayLabel LIKE '%' || ? || '%'
|
|
169
|
+
WHERE sc.DisplayLabel LIKE '%' || ? || '%' ESCAPE '\\'
|
|
170
|
+
LIMIT ${MAX_FILTERING_INSTANCE_KEY_COUNT + 1}
|
|
169
171
|
`,
|
|
170
|
-
bindings: [{ type: "string", value: props.label }],
|
|
172
|
+
bindings: [{ type: "string", value: props.label.replace(/[%_\\]/g, "\\$&") }],
|
|
171
173
|
}, { restartToken: "tree-widget/categories-tree/filter-by-label-query" });
|
|
172
174
|
const paths = new Array();
|
|
173
175
|
for await (const row of reader) {
|
|
@@ -175,6 +177,9 @@ async function createInstanceKeyPathsFromInstanceLabel(props) {
|
|
|
175
177
|
row.SubcategoryId && path.push({ className: row.SubcategoryClass, id: row.SubcategoryId });
|
|
176
178
|
paths.push(path);
|
|
177
179
|
}
|
|
180
|
+
if (paths.length > MAX_FILTERING_INSTANCE_KEY_COUNT) {
|
|
181
|
+
throw new Error(`Filter matches more than ${MAX_FILTERING_INSTANCE_KEY_COUNT} items`);
|
|
182
|
+
}
|
|
178
183
|
return paths;
|
|
179
184
|
}
|
|
180
185
|
//# 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,8EAAqH;AACrH,oEAA8F;AAc9F,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAa7C,MAAa,wBAAwB;IAKnC,YAAmB,KAAoC;QACrD,IAAI,CAAC,KAAK,GAAG,IAAA,8DAAmC,EAAC;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,IAAA,wDAA6B,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC,6BAA6B,G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SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;KAC9E,EACD,EAAE,YAAY,EAAE,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"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BeEvent } from "@itwin/core-bentley";
|
|
2
2
|
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
3
|
-
import type { CategoryInfo } from "
|
|
4
|
-
import type { VisibilityChangeListener, VisibilityStatus } from "../../VisibilityTreeEventHandler";
|
|
3
|
+
import type { CategoryInfo } from "../common/CategoriesVisibilityUtils";
|
|
5
4
|
import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
6
|
-
|
|
5
|
+
import type { HierarchyVisibilityHandler, VisibilityStatus } from "../common/UseHierarchyVisibility";
|
|
6
|
+
interface CategoriesVisibilityHandlerProps {
|
|
7
7
|
viewManager: ViewManager;
|
|
8
8
|
imodel: IModelConnection;
|
|
9
9
|
categories: CategoryInfo[];
|
|
@@ -11,15 +11,15 @@ interface StatelessCategoriesVisibilityHandlerProps {
|
|
|
11
11
|
allViewports?: boolean;
|
|
12
12
|
}
|
|
13
13
|
/** @internal */
|
|
14
|
-
export declare class
|
|
14
|
+
export declare class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {
|
|
15
15
|
private _viewManager;
|
|
16
16
|
private _imodel;
|
|
17
17
|
private _pendingVisibilityChange;
|
|
18
18
|
private _viewport;
|
|
19
19
|
private _useAllViewports;
|
|
20
|
-
constructor(props:
|
|
20
|
+
constructor(props: CategoriesVisibilityHandlerProps);
|
|
21
21
|
dispose(): void;
|
|
22
|
-
onVisibilityChange: BeEvent<
|
|
22
|
+
onVisibilityChange: BeEvent<import("@itwin/core-bentley").Listener>;
|
|
23
23
|
/** Returns visibility status of the tree node. */
|
|
24
24
|
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
|
|
25
25
|
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.CategoriesVisibilityHandler = void 0;
|
|
8
8
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
9
|
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
10
|
-
const CategoriesVisibilityUtils_1 = require("
|
|
10
|
+
const CategoriesVisibilityUtils_1 = require("../common/CategoriesVisibilityUtils");
|
|
11
11
|
/** @internal */
|
|
12
|
-
class
|
|
12
|
+
class CategoriesVisibilityHandler {
|
|
13
13
|
constructor(props) {
|
|
14
14
|
this.onVisibilityChange = new core_bentley_1.BeEvent();
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -46,7 +46,7 @@ class StatelessCategoriesVisibilityHandler {
|
|
|
46
46
|
}
|
|
47
47
|
// handle subcategory visibility change
|
|
48
48
|
if (node.parentKeys.length) {
|
|
49
|
-
const childId =
|
|
49
|
+
const childId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
50
50
|
const parentCategoryId = node.extendedData?.categoryId;
|
|
51
51
|
// make sure parent category is enabled
|
|
52
52
|
if (on && parentCategoryId) {
|
|
@@ -55,7 +55,7 @@ class StatelessCategoriesVisibilityHandler {
|
|
|
55
55
|
this.enableSubCategory(childId, on);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
const instanceId =
|
|
58
|
+
const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
59
59
|
await this.enableCategory([instanceId], on, true);
|
|
60
60
|
}
|
|
61
61
|
getSubCategoryVisibility(node) {
|
|
@@ -63,12 +63,12 @@ class StatelessCategoriesVisibilityHandler {
|
|
|
63
63
|
if (!parentCategoryId) {
|
|
64
64
|
return "hidden";
|
|
65
65
|
}
|
|
66
|
-
const subcategoryId =
|
|
66
|
+
const subcategoryId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
67
67
|
const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);
|
|
68
68
|
return isVisible ? "visible" : "hidden";
|
|
69
69
|
}
|
|
70
70
|
getCategoryVisibility(node) {
|
|
71
|
-
const instanceId =
|
|
71
|
+
const instanceId = CategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
72
72
|
return this._viewport.view.viewsCategory(instanceId) ? "visible" : "hidden";
|
|
73
73
|
}
|
|
74
74
|
onVisibilityChangeInternal() {
|
|
@@ -84,11 +84,11 @@ class StatelessCategoriesVisibilityHandler {
|
|
|
84
84
|
return presentation_hierarchies_1.HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : /* istanbul ignore next */ "";
|
|
85
85
|
}
|
|
86
86
|
async enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
87
|
-
await (0, CategoriesVisibilityUtils_1.
|
|
87
|
+
await (0, CategoriesVisibilityUtils_1.enableCategoryDisplay)(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);
|
|
88
88
|
}
|
|
89
89
|
enableSubCategory(key, enabled) {
|
|
90
|
-
(0, CategoriesVisibilityUtils_1.
|
|
90
|
+
(0, CategoriesVisibilityUtils_1.enableSubCategoryDisplay)(this._viewManager, key, enabled, this._useAllViewports);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
exports.
|
|
93
|
+
exports.CategoriesVisibilityHandler = CategoriesVisibilityHandler;
|
|
94
94
|
//# 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,sDAA8C;AAC9C,8EAAgE;AAChE,mFAAsG;AActG,gBAAgB;AAChB,MAAa,2BAA2B;IAOtC,YAAY,KAAuC;QAgB5C,uBAAkB,GAAG,IAAI,sBAAO,EAAE,CAAC;QAiD1C,gEAAgE;QACxD,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QAEF,gEAAgE;QACxD,8BAAyB,GAAG,GAAG,EAAE;YACvC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;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,CA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CAAC,EAAE,CAAC,CAAC,CAAC;IACR,CAAC;IAEM,MAAM,CAAC,8BAA8B,CAAC,IAAmB;QAC9D,OAAO,wCAAa,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,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,IAAA,iDAAqB,EAAC,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,IAAA,oDAAwB,EAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnF,CAAC;CACF;AAxGD,kEAwGC","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,22 @@
|
|
|
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.useCategories = void 0;
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const components_react_1 = require("@itwin/components-react");
|
|
10
|
+
const CategoriesVisibilityUtils_1 = require("../common/CategoriesVisibilityUtils");
|
|
11
|
+
const EMPTY_CATEGORIES_ARRAY = [];
|
|
12
|
+
/**
|
|
13
|
+
* Loads categories from viewport or uses provided list of categories.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
function useCategories(viewManager, imodel, view) {
|
|
17
|
+
const currentView = view || viewManager.getFirstOpenView();
|
|
18
|
+
const categoriesPromise = (0, react_1.useMemo)(async () => (0, CategoriesVisibilityUtils_1.loadCategoriesFromViewport)(imodel, currentView), [imodel, currentView]);
|
|
19
|
+
return (0, components_react_1.useAsyncValue)(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;
|
|
20
|
+
}
|
|
21
|
+
exports.useCategories = useCategories;
|
|
22
|
+
//# 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,iCAAgC;AAChC,8DAAwD;AACxD,mFAAiF;AAKjF,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","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
|