@itwin/tree-widget-react 4.0.0-alpha.24 → 4.0.0-alpha.26
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 +35 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +2 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +4 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +36 -47
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +87 -38
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.d.ts +86 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js +50 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +38 -23
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +11 -21
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +16 -168
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.d.ts +65 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js +22 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js +4 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +6 -12
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +192 -127
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +14 -5
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +43 -24
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.d.ts +3 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js +78 -17
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +91 -114
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.d.ts +32 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js +26 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +13 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +62 -32
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +12 -9
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +42 -38
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +15 -38
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +59 -242
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.d.ts +29 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js +19 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +5 -9
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +155 -84
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +20 -6
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.d.ts +6 -10
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js +104 -63
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.d.ts +7 -0
- package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js +14 -0
- package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +7 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +5 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js +44 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +4 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +12 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +17 -6
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +58 -29
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +8 -14
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +22 -26
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.d.ts → caches/AlwaysAndNeverDrawnElementInfoCache.d.ts} +15 -21
- package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.js → caches/AlwaysAndNeverDrawnElementInfoCache.js} +40 -38
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.d.ts +68 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js +148 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.d.ts +30 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js +151 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.d.ts +32 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js +106 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.d.ts → caches/ModelCategoryElementsCountCache.d.ts} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.js → caches/ModelCategoryElementsCountCache.js} +17 -21
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModelCategoryElementsCountCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js +106 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.d.ts +23 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js +56 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +6 -6
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +27 -17
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +7 -13
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +36 -35
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.d.ts +18 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js +14 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +46 -70
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +229 -361
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +32 -19
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +5 -1
- package/lib/esm/tree-widget-react/components/trees/index.js +5 -1
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +4 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +7 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +36 -35
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +3 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +3 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +70 -26
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.d.ts +63 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.js +56 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +5 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +26 -13
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +11 -23
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +56 -189
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.d.ts +52 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js +22 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js +8 -8
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +6 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +190 -114
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +20 -8
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js +73 -13
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react-internal.d.ts +1 -1
- package/lib/esm/tree-widget-react-internal.js +1 -1
- package/lib/esm/tree-widget-react-internal.js.map +1 -1
- package/package.json +77 -82
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +0 -41
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +0 -50
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.d.ts +0 -19
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js +0 -32
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.d.ts +0 -20
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js +0 -53
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +0 -37
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js +0 -54
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +0 -1
package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseSearchPaths.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAc1E,gBAAgB;AAChB,MAAM,UAAU,cAAc,CAAC,EAC7B,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,GASZ;IAIC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAyC,CAAC;IACxF,MAAM,EAAE,aAAa,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,SAAS,CAAC,CAAC;QAC1B,oBAAoB,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,o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CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3E,UAAU;YACV,cAAc,EAAE,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc;SACzE,CAAC,CAAC;QACH,MAAM;KACP,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 { useEffect, useMemo, useState } from \"react\";\nimport { firstValueFrom } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeIdentifier, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport { CLASS_NAME_DefinitionContainer, CLASS_NAME_SubCategory } from \"../../common/internal/ClassNameDefinitions.js\";\nimport { getClassesByView } from \"../../common/internal/Utils.js\";\nimport { SearchLimitExceededError } from \"../../common/TreeErrors.js\";\nimport { useTelemetryContext } from \"../../common/UseTelemetryContext.js\";\nimport { CategoriesTreeDefinition } from \"../CategoriesTreeDefinition.js\";\n\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { CategoryInfo } from \"../../common/CategoriesVisibilityUtils.js\";\nimport type { VisibilityTreeProps } from \"../../common/components/VisibilityTree.js\";\nimport type { CategoryId, ElementId, ModelId, SubCategoryId } from \"../../common/internal/Types.js\";\nimport type { CategoriesTreeHierarchyConfiguration } from \"../CategoriesTreeDefinition.js\";\nimport type { CategoriesTreeIdsCache } from \"./CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport type CategoriesTreeSearchError = \"tooManySearchMatches\" | \"unknownSearchError\";\n\ntype HierarchySearchPaths = Awaited<ReturnType<Required<VisibilityTreeProps>[\"getSearchPaths\"]>>;\n\n/** @internal */\nexport function useSearchPaths({\n searchText,\n viewType,\n hierarchyConfiguration,\n getCategoriesTreeIdsCache,\n onCategoriesFiltered,\n onSearchPathsChanged,\n componentId,\n}: {\n viewType: \"2d\" | \"3d\";\n searchText?: string;\n hierarchyConfiguration: CategoriesTreeHierarchyConfiguration;\n getCategoriesTreeIdsCache: () => CategoriesTreeIdsCache;\n onCategoriesFiltered?: (categories: { categories: CategoryInfo[] | undefined; models?: Array<ModelId> }) => void;\n onSearchPathsChanged: (paths: HierarchySearchPaths | undefined) => void;\n componentId: GuidString;\n}): {\n getPaths: VisibilityTreeProps[\"getSearchPaths\"] | undefined;\n searchError: CategoriesTreeSearchError | undefined;\n} {\n const [searchError, setSearchError] = useState<CategoriesTreeSearchError | undefined>();\n const { onFeatureUsed } = useTelemetryContext();\n\n useEffect(() => {\n setSearchError(undefined);\n onCategoriesFiltered?.({ categories: undefined, models: undefined });\n if (!searchText) {\n onSearchPathsChanged(undefined);\n }\n }, [searchText, onCategoriesFiltered, onSearchPathsChanged]);\n\n const getSearchPaths = useMemo<VisibilityTreeProps[\"getSearchPaths\"] | undefined>(() => {\n if (!searchText) {\n return undefined;\n }\n\n return async ({ imodelAccess, abortSignal }) => {\n onFeatureUsed({ featureId: \"search\", reportInteraction: true });\n try {\n const paths = await CategoriesTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n abortSignal,\n label: searchText,\n viewType,\n idsCache: getCategoriesTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n componentId,\n });\n onSearchPathsChanged(paths);\n const { elementClass, modelClass } = getClassesByView(viewType);\n onCategoriesFiltered?.(await getCategoriesFromPaths(paths, getCategoriesTreeIdsCache(), elementClass, modelClass, hierarchyConfiguration));\n return paths;\n } catch (e) {\n const newError = e instanceof SearchLimitExceededError ? \"tooManySearchMatches\" : \"unknownSearchError\";\n if (newError !== \"tooManySearchMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setSearchError(newError);\n return [];\n }\n };\n }, [onCategoriesFiltered, searchText, onSearchPathsChanged, onFeatureUsed, viewType, getCategoriesTreeIdsCache, hierarchyConfiguration, componentId]);\n\n return {\n getPaths: getSearchPaths,\n searchError,\n };\n}\n\nasync function getCategoriesFromPaths(\n paths: HierarchySearchPaths,\n idsCache: CategoriesTreeIdsCache,\n elementClassName: string,\n modelsClassName: string,\n hierarchyConfig: CategoriesTreeHierarchyConfiguration,\n): Promise<{ categories: CategoryInfo[] | undefined; models?: Array<ModelId> }> {\n if (!paths) {\n return { categories: undefined };\n }\n\n const rootFilteredElementIds = new Set<ElementId>();\n const subModelIds = new Set<ModelId>();\n\n const categories = new Map<CategoryId, Array<SubCategoryId>>();\n for (const path of paths) {\n const currPath = HierarchySearchPath.normalize(path).path;\n if (currPath.length === 0) {\n continue;\n }\n\n let category: HierarchyNodeIdentifier;\n let subCategory: HierarchyNodeIdentifier | undefined;\n\n let lastNodeInfo: { lastNode: HierarchyNodeIdentifier; nodeIndex: number } | undefined;\n\n for (let i = 0; i < currPath.length; ++i) {\n const currentNode = currPath[i];\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(currentNode)) {\n continue;\n }\n if (currentNode.className === elementClassName) {\n rootFilteredElementIds.add(currentNode.id);\n for (let j = i + 1; j < currPath.length; ++j) {\n const childNode = currPath[j];\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(childNode)) {\n continue;\n }\n if (childNode.className === modelsClassName) {\n subModelIds.add(childNode.id);\n }\n }\n break;\n }\n lastNodeInfo = { lastNode: currentNode, nodeIndex: i };\n }\n\n assert(lastNodeInfo !== undefined && HierarchyNodeIdentifier.isInstanceNodeIdentifier(lastNodeInfo.lastNode));\n\n if (lastNodeInfo.lastNode.className === CLASS_NAME_DefinitionContainer) {\n const definitionContainerCategories = await firstValueFrom(\n idsCache.getAllContainedCategories({ definitionContainerIds: lastNodeInfo.lastNode.id, includeEmptyCategories: hierarchyConfig.showEmptyCategories }),\n );\n for (const categoryId of definitionContainerCategories) {\n const value = categories.get(categoryId);\n if (value === undefined) {\n categories.set(categoryId, []);\n }\n }\n continue;\n }\n\n if (lastNodeInfo.lastNode.className === CLASS_NAME_SubCategory) {\n const secondToLastNode = lastNodeInfo.nodeIndex > 0 ? currPath[lastNodeInfo.nodeIndex - 1] : undefined;\n assert(secondToLastNode !== undefined && HierarchyNodeIdentifier.isInstanceNodeIdentifier(secondToLastNode));\n\n subCategory = lastNodeInfo.lastNode;\n category = secondToLastNode;\n } else {\n category = lastNodeInfo.lastNode;\n }\n\n let entry = categories.get(category.id);\n if (entry === undefined) {\n entry = [];\n categories.set(category.id, entry);\n }\n\n if (subCategory) {\n entry.push(subCategory.id);\n }\n }\n const rootElementModelMap = await firstValueFrom(idsCache.getFilteredElementsModels(rootFilteredElementIds));\n const models = [...subModelIds, ...new Set(rootElementModelMap.values())];\n return {\n categories: [...categories.entries()].map(([categoryId, subCategoryIds]) => ({\n categoryId,\n subCategoryIds: subCategoryIds.length === 0 ? undefined : subCategoryIds,\n })),\n models,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UseSearchPaths.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EA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xC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,KAAK,GAAG,EAAE,CAAC;YACX,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,MAAM,mBAAmB,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC7G,MAAM,MAAM,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,OAAO;QACL,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3E,UAAU;YACV,cAAc,EAAE,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc;SACzE,CAAC,CAAC;QACH,MAAM;KACP,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 { useEffect, useMemo, useState } from \"react\";\nimport { firstValueFrom } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeIdentifier, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport { CLASS_NAME_DefinitionContainer, CLASS_NAME_SubCategory } from \"../../common/internal/ClassNameDefinitions.js\";\nimport { getClassesByView } from \"../../common/internal/Utils.js\";\nimport { SearchLimitExceededError } from \"../../common/TreeErrors.js\";\nimport { useTelemetryContext } from \"../../common/UseTelemetryContext.js\";\nimport { CategoriesTreeDefinition } from \"../CategoriesTreeDefinition.js\";\n\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { CategoryInfo } from \"../../common/CategoriesVisibilityUtils.js\";\nimport type { VisibilityTreeProps } from \"../../common/components/VisibilityTree.js\";\nimport type { CategoryId, ElementId, ModelId, SubCategoryId } from \"../../common/internal/Types.js\";\nimport type { CategoriesTreeHierarchyConfiguration } from \"../CategoriesTreeDefinition.js\";\nimport type { CategoriesTreeIdsCache } from \"./CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport type CategoriesTreeSearchError = \"tooManySearchMatches\" | \"unknownSearchError\";\n\ntype HierarchySearchPaths = Awaited<ReturnType<Required<VisibilityTreeProps>[\"getSearchPaths\"]>>;\n\n/** @internal */\nexport function useSearchPaths({\n searchText,\n viewType,\n hierarchyConfiguration,\n idsCache,\n onCategoriesFiltered,\n onSearchPathsChanged,\n componentId,\n}: {\n viewType: \"2d\" | \"3d\";\n searchText?: string;\n hierarchyConfiguration: CategoriesTreeHierarchyConfiguration;\n idsCache: CategoriesTreeIdsCache;\n onCategoriesFiltered?: (categories: { categories: CategoryInfo[] | undefined; models?: Array<ModelId> }) => void;\n onSearchPathsChanged: (paths: HierarchySearchPaths | undefined) => void;\n componentId: GuidString;\n}): {\n getPaths: VisibilityTreeProps[\"getSearchPaths\"] | undefined;\n searchError: CategoriesTreeSearchError | undefined;\n} {\n const [searchError, setSearchError] = useState<CategoriesTreeSearchError | undefined>();\n const { onFeatureUsed } = useTelemetryContext();\n\n useEffect(() => {\n setSearchError(undefined);\n onCategoriesFiltered?.({ categories: undefined, models: undefined });\n if (!searchText) {\n onSearchPathsChanged(undefined);\n }\n }, [searchText, onCategoriesFiltered, onSearchPathsChanged]);\n\n const getSearchPaths = useMemo<VisibilityTreeProps[\"getSearchPaths\"] | undefined>(() => {\n if (!searchText) {\n return undefined;\n }\n\n return async ({ imodelAccess, abortSignal }) => {\n onFeatureUsed({ featureId: \"search\", reportInteraction: true });\n try {\n const paths = await CategoriesTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n abortSignal,\n label: searchText,\n viewType,\n idsCache,\n hierarchyConfig: hierarchyConfiguration,\n componentId,\n });\n onSearchPathsChanged(paths);\n const { elementClass, modelClass } = getClassesByView(viewType);\n onCategoriesFiltered?.(await getCategoriesFromPaths(paths, idsCache, elementClass, modelClass, hierarchyConfiguration));\n return paths;\n } catch (e) {\n const newError = e instanceof SearchLimitExceededError ? \"tooManySearchMatches\" : \"unknownSearchError\";\n if (newError !== \"tooManySearchMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setSearchError(newError);\n return [];\n }\n };\n }, [onCategoriesFiltered, searchText, onSearchPathsChanged, onFeatureUsed, viewType, idsCache, hierarchyConfiguration, componentId]);\n\n return {\n getPaths: getSearchPaths,\n searchError,\n };\n}\n\nasync function getCategoriesFromPaths(\n paths: HierarchySearchPaths,\n idsCache: CategoriesTreeIdsCache,\n elementClassName: string,\n modelsClassName: string,\n hierarchyConfig: CategoriesTreeHierarchyConfiguration,\n): Promise<{ categories: CategoryInfo[] | undefined; models?: Array<ModelId> }> {\n if (!paths) {\n return { categories: undefined };\n }\n\n const rootFilteredElementIds = new Set<ElementId>();\n const subModelIds = new Set<ModelId>();\n\n const categories = new Map<CategoryId, Array<SubCategoryId>>();\n for (const path of paths) {\n const currPath = HierarchySearchPath.normalize(path).path;\n if (currPath.length === 0) {\n continue;\n }\n\n let category: HierarchyNodeIdentifier;\n let subCategory: HierarchyNodeIdentifier | undefined;\n\n let lastNodeInfo: { lastNode: HierarchyNodeIdentifier; nodeIndex: number } | undefined;\n\n for (let i = 0; i < currPath.length; ++i) {\n const currentNode = currPath[i];\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(currentNode)) {\n continue;\n }\n if (currentNode.className === elementClassName) {\n rootFilteredElementIds.add(currentNode.id);\n for (let j = i + 1; j < currPath.length; ++j) {\n const childNode = currPath[j];\n if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(childNode)) {\n continue;\n }\n if (childNode.className === modelsClassName) {\n subModelIds.add(childNode.id);\n }\n }\n break;\n }\n lastNodeInfo = { lastNode: currentNode, nodeIndex: i };\n }\n\n assert(lastNodeInfo !== undefined && HierarchyNodeIdentifier.isInstanceNodeIdentifier(lastNodeInfo.lastNode));\n\n if (lastNodeInfo.lastNode.className === CLASS_NAME_DefinitionContainer) {\n const definitionContainerCategories = await firstValueFrom(\n idsCache.getAllContainedCategories({ definitionContainerIds: lastNodeInfo.lastNode.id, includeEmptyCategories: hierarchyConfig.showEmptyCategories }),\n );\n for (const categoryId of definitionContainerCategories) {\n const value = categories.get(categoryId);\n if (value === undefined) {\n categories.set(categoryId, []);\n }\n }\n continue;\n }\n\n if (lastNodeInfo.lastNode.className === CLASS_NAME_SubCategory) {\n const secondToLastNode = lastNodeInfo.nodeIndex > 0 ? currPath[lastNodeInfo.nodeIndex - 1] : undefined;\n assert(secondToLastNode !== undefined && HierarchyNodeIdentifier.isInstanceNodeIdentifier(secondToLastNode));\n\n subCategory = lastNodeInfo.lastNode;\n category = secondToLastNode;\n } else {\n category = lastNodeInfo.lastNode;\n }\n\n let entry = categories.get(category.id);\n if (entry === undefined) {\n entry = [];\n categories.set(category.id, entry);\n }\n\n if (subCategory) {\n entry.push(subCategory.id);\n }\n }\n const rootElementModelMap = await firstValueFrom(idsCache.getFilteredElementsModels(rootFilteredElementIds));\n const models = [...subModelIds, ...new Set(rootElementModelMap.values())];\n return {\n categories: [...categories.entries()].map(([categoryId, subCategoryIds]) => ({\n categoryId,\n subCategoryIds: subCategoryIds.length === 0 ? undefined : subCategoryIds,\n })),\n models,\n };\n}\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
2
1
|
import { HierarchyVisibilityHandlerImpl } from "../../../common/internal/useTreeHooks/UseCachedVisibility.js";
|
|
3
2
|
import type { Observable } from "rxjs";
|
|
4
|
-
import type { HierarchySearchPath } from "@itwin/presentation-hierarchies";
|
|
3
|
+
import type { ClassGroupingNodeKey, HierarchyNode, HierarchySearchPath, InstancesNodeKey } from "@itwin/presentation-hierarchies";
|
|
5
4
|
import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
|
|
6
|
-
import type {
|
|
5
|
+
import type { AlwaysAndNeverDrawnElementInfoCache } from "../../../common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js";
|
|
7
6
|
import type { TreeSpecificVisibilityHandler } from "../../../common/internal/visibility/BaseVisibilityHelper.js";
|
|
8
7
|
import type { TreeWidgetViewport } from "../../../common/TreeWidgetViewport.js";
|
|
9
8
|
import type { VisibilityStatus } from "../../../common/UseHierarchyVisibility.js";
|
|
@@ -14,7 +13,7 @@ import type { CategoriesTreeSearchTargets } from "./SearchResultsTree.js";
|
|
|
14
13
|
export interface CategoriesTreeVisibilityHandlerProps {
|
|
15
14
|
idsCache: CategoriesTreeIdsCache;
|
|
16
15
|
viewport: TreeWidgetViewport;
|
|
17
|
-
alwaysAndNeverDrawnElementInfo:
|
|
16
|
+
alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfoCache;
|
|
18
17
|
hierarchyConfig: CategoriesTreeHierarchyConfiguration;
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
@@ -31,14 +30,9 @@ export declare class CategoriesTreeVisibilityHandler implements Disposable, Tree
|
|
|
31
30
|
getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus>;
|
|
32
31
|
/** Changes visibility of the items represented by the tree node. */
|
|
33
32
|
changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void>;
|
|
34
|
-
getSearchTargetsVisibilityStatus(targets: CategoriesTreeSearchTargets
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
private getElementsCount;
|
|
38
|
-
private getModels;
|
|
39
|
-
private getSubCategories;
|
|
40
|
-
private getSubModels;
|
|
41
|
-
private getGroupingNodeInfo;
|
|
33
|
+
getSearchTargetsVisibilityStatus(targets: CategoriesTreeSearchTargets, node: HierarchyNode & {
|
|
34
|
+
key: ClassGroupingNodeKey | InstancesNodeKey;
|
|
35
|
+
}): Observable<VisibilityStatus>;
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
38
|
* Creates categories tree visibility handler. Is used by integration and performance tests.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { concat, defer, EMPTY, from, map, merge, mergeMap, of } from "rxjs";
|
|
6
|
-
import { assert, Guid
|
|
7
|
-
import {
|
|
5
|
+
import { concat, defer, EMPTY, from, map, merge, mergeAll, mergeMap, of } from "rxjs";
|
|
6
|
+
import { assert, Guid } from "@itwin/core-bentley";
|
|
7
|
+
import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
8
8
|
import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
|
|
9
9
|
import { HierarchyVisibilityHandlerImpl } from "../../../common/internal/useTreeHooks/UseCachedVisibility.js";
|
|
10
|
-
import { fromWithRelease, getClassesByView } from "../../../common/internal/Utils.js";
|
|
10
|
+
import { fromWithRelease, getClassesByView, getIdsFromChildrenTree, getParentElementsIdsPath, setDifference, setIntersection, } from "../../../common/internal/Utils.js";
|
|
11
11
|
import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
|
|
12
|
-
import {
|
|
12
|
+
import { CategoriesTreeNodeInternal } from "../../internal/CategoriesTreeNodeInternal.js";
|
|
13
13
|
import { CategoriesTreeVisibilityHelper } from "./CategoriesTreeVisibilityHelper.js";
|
|
14
14
|
import { createCategoriesSearchResultsTree } from "./SearchResultsTree.js";
|
|
15
15
|
/**
|
|
@@ -21,38 +21,24 @@ import { createCategoriesSearchResultsTree } from "./SearchResultsTree.js";
|
|
|
21
21
|
export class CategoriesTreeVisibilityHandler {
|
|
22
22
|
#props;
|
|
23
23
|
#visibilityHelper;
|
|
24
|
-
#elementType;
|
|
25
|
-
#categoryType;
|
|
26
|
-
#modelType;
|
|
27
24
|
constructor(constructorProps) {
|
|
28
25
|
this.#props = constructorProps;
|
|
29
|
-
// Remove after https://github.com/iTwin/viewer-components-react/issues/1421.
|
|
30
|
-
// We won't need to create a custom base ids cache.
|
|
31
|
-
const baseIdsCache = {
|
|
32
|
-
getCategories: (props) => this.getCategories(props),
|
|
33
|
-
getAllCategories: () => this.getAllCategories(),
|
|
34
|
-
getElementsCount: (props) => this.getElementsCount(props),
|
|
35
|
-
getModels: (props) => this.getModels(props),
|
|
36
|
-
getSubCategories: (props) => this.getSubCategories(props),
|
|
37
|
-
getSubModels: (props) => this.getSubModels(props),
|
|
38
|
-
hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),
|
|
39
|
-
};
|
|
40
26
|
this.#visibilityHelper = new CategoriesTreeVisibilityHelper({
|
|
41
27
|
viewport: this.#props.viewport,
|
|
42
28
|
idsCache: this.#props.idsCache,
|
|
43
29
|
alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,
|
|
44
|
-
baseIdsCache,
|
|
30
|
+
baseIdsCache: constructorProps.idsCache,
|
|
45
31
|
hierarchyConfig: constructorProps.hierarchyConfig,
|
|
46
32
|
});
|
|
47
|
-
this.#elementType = this.#props.viewport.viewType === "2d" ? "GeometricElement2d" : "GeometricElement3d";
|
|
48
|
-
this.#categoryType = this.#props.viewport.viewType === "2d" ? "DrawingCategory" : "SpatialCategory";
|
|
49
|
-
this.#modelType = this.#props.viewport.viewType === "2d" ? "GeometricModel2d" : "GeometricModel3d";
|
|
50
33
|
}
|
|
51
34
|
[Symbol.dispose]() {
|
|
52
35
|
this.#visibilityHelper[Symbol.dispose]();
|
|
53
36
|
}
|
|
54
37
|
changeSearchTargetsVisibilityStatus(targets, on) {
|
|
55
38
|
return defer(() => {
|
|
39
|
+
if (this.#props.viewport.viewType === "other") {
|
|
40
|
+
return EMPTY;
|
|
41
|
+
}
|
|
56
42
|
const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;
|
|
57
43
|
const observables = new Array();
|
|
58
44
|
if (definitionContainerIds?.size) {
|
|
@@ -68,119 +54,174 @@ export class CategoriesTreeVisibilityHandler {
|
|
|
68
54
|
observables.push(from(subCategories).pipe(mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.changeSubCategoriesVisibilityStatus({ subCategoryIds, categoryId, on }))));
|
|
69
55
|
}
|
|
70
56
|
if (elements?.length) {
|
|
71
|
-
|
|
57
|
+
const searchTargetElements = new Array();
|
|
58
|
+
const elementIdsSet = new Set();
|
|
59
|
+
const modelCategoryElementMap = new Map();
|
|
60
|
+
// elements is an array that stores elements grouped by:
|
|
61
|
+
// 1. Their path
|
|
62
|
+
// 2. Their modelId and categoryId
|
|
63
|
+
// When changing visibility of elements, visibility handler does not care about the path.
|
|
64
|
+
// So we can first get all elements and group them only by modelId and categoryId.
|
|
65
|
+
for (const { elements: elementsMap, categoryId, modelId } of elements) {
|
|
66
|
+
const key = `${modelId}-${categoryId}`;
|
|
67
|
+
let mapEntry = modelCategoryElementMap.get(key);
|
|
68
|
+
if (!mapEntry) {
|
|
69
|
+
mapEntry = [];
|
|
70
|
+
modelCategoryElementMap.set(key, mapEntry);
|
|
71
|
+
}
|
|
72
|
+
for (const [elementId, { isSearchTarget }] of elementsMap) {
|
|
73
|
+
mapEntry.push(elementId);
|
|
74
|
+
elementIdsSet.add(elementId);
|
|
75
|
+
if (isSearchTarget) {
|
|
76
|
+
searchTargetElements.push(elementId);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
observables.push(
|
|
81
|
+
// Get children for search targets, since non search targets don't have all the children present in the hierarchy.
|
|
82
|
+
this.#props.idsCache.getChildElementsTree({ elementIds: searchTargetElements }).pipe(
|
|
83
|
+
// Need to filter out and keep only those children ids that are not part of elements that are present in search paths.
|
|
84
|
+
// Elements in search paths will have their visibility changed directly: they will be provided as elementIds to changeElementsVisibilityStatus.
|
|
85
|
+
map((childrenTree) => ({
|
|
86
|
+
childrenNotInSearchPaths: setDifference(getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 }), elementIdsSet),
|
|
87
|
+
childrenTree,
|
|
88
|
+
})), mergeMap(({ childrenNotInSearchPaths, childrenTree }) => fromWithRelease({ source: modelCategoryElementMap.entries(), size: modelCategoryElementMap.size, releaseOnCount: 50 }).pipe(mergeMap(([key, elementsInSearchPathsGroupedByModelAndCategory]) => {
|
|
89
|
+
const [modelId, categoryId] = key.split("-");
|
|
90
|
+
const childrenIds = new Set();
|
|
91
|
+
// A shared children tree was created, need to get the children for each element in the group.
|
|
92
|
+
for (const elementId of elementsInSearchPathsGroupedByModelAndCategory) {
|
|
93
|
+
const elementChildrenTree = childrenTree.get(elementId)?.children;
|
|
94
|
+
if (!elementChildrenTree) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
for (const childId of getIdsFromChildrenTree({ tree: elementChildrenTree })) {
|
|
98
|
+
childrenIds.add(childId);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return this.#visibilityHelper.changeElementsVisibilityStatus({
|
|
102
|
+
modelId,
|
|
103
|
+
categoryId,
|
|
104
|
+
elementIds: elementsInSearchPathsGroupedByModelAndCategory,
|
|
105
|
+
// Pass only those children that are not part of search paths.
|
|
106
|
+
children: setIntersection(childrenIds, childrenNotInSearchPaths),
|
|
107
|
+
on,
|
|
108
|
+
});
|
|
109
|
+
})))));
|
|
72
110
|
}
|
|
73
111
|
return merge(...observables);
|
|
74
112
|
});
|
|
75
113
|
}
|
|
76
114
|
getVisibilityStatus(node) {
|
|
77
|
-
if (
|
|
78
|
-
const nodeInfo = this.getGroupingNodeInfo(node);
|
|
79
|
-
return this.#visibilityHelper.getGroupedElementsVisibilityStatus({ categoryId: nodeInfo.categoryId, modelElementsMap: nodeInfo.modelElementsMap });
|
|
80
|
-
}
|
|
81
|
-
if (!HierarchyNode.isInstancesNode(node)) {
|
|
115
|
+
if (this.#props.viewport.viewType === "other") {
|
|
82
116
|
return of(createVisibilityStatus("disabled"));
|
|
83
117
|
}
|
|
84
|
-
if (
|
|
118
|
+
if (CategoriesTreeNodeInternal.isElementClassGroupingNode(node)) {
|
|
119
|
+
return this.#visibilityHelper.getGroupedElementsVisibilityStatus({
|
|
120
|
+
categoryId: node.extendedData.categoryId,
|
|
121
|
+
modelElementsMap: node.extendedData.modelElementsMap,
|
|
122
|
+
parentKeys: node.parentKeys,
|
|
123
|
+
childrenCount: node.extendedData.childrenCount,
|
|
124
|
+
topMostParentElementId: node.extendedData.topMostParentElementId,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (CategoriesTreeNodeInternal.isDefinitionContainerNode(node)) {
|
|
85
128
|
return this.#visibilityHelper.getDefinitionContainersVisibilityStatus({
|
|
86
129
|
definitionContainerIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
87
130
|
});
|
|
88
131
|
}
|
|
89
|
-
if (
|
|
132
|
+
if (CategoriesTreeNodeInternal.isModelNode(node)) {
|
|
90
133
|
return this.#visibilityHelper.getModelsVisibilityStatus({
|
|
91
134
|
modelIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
92
|
-
type: this.#modelType,
|
|
93
135
|
});
|
|
94
136
|
}
|
|
95
|
-
if (
|
|
137
|
+
if (CategoriesTreeNodeInternal.isCategoryNode(node)) {
|
|
96
138
|
return this.#visibilityHelper.getCategoriesVisibilityStatus({
|
|
97
139
|
categoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
98
|
-
modelId:
|
|
99
|
-
type: this.#categoryType,
|
|
140
|
+
modelId: node.extendedData.isCategoryOfSubModel ? node.extendedData.modelIds[0] : undefined,
|
|
100
141
|
});
|
|
101
142
|
}
|
|
102
|
-
|
|
103
|
-
if (!categoryId) {
|
|
104
|
-
return of(createVisibilityStatus("disabled"));
|
|
105
|
-
}
|
|
106
|
-
if (CategoriesTreeNode.isSubCategoryNode(node)) {
|
|
143
|
+
if (CategoriesTreeNodeInternal.isSubCategoryNode(node)) {
|
|
107
144
|
return this.#visibilityHelper.getSubCategoriesVisibilityStatus({
|
|
108
|
-
categoryId,
|
|
145
|
+
categoryId: node.extendedData.categoryId,
|
|
109
146
|
subCategoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
110
147
|
});
|
|
111
148
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
149
|
+
assert(CategoriesTreeNodeInternal.isElementNode(node));
|
|
150
|
+
const parentElementsIdsPath = getParentElementsIdsPath({
|
|
151
|
+
parentInstanceKeys: node.parentKeys.filter((parentKey) => HierarchyNodeKey.isInstances(parentKey)).map((key) => key.instanceKeys),
|
|
152
|
+
topMostParentElementId: node.extendedData.topMostParentElementId,
|
|
153
|
+
});
|
|
116
154
|
return this.#visibilityHelper.getElementsVisibilityStatus({
|
|
117
155
|
elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
118
|
-
modelId,
|
|
119
|
-
categoryId,
|
|
120
|
-
|
|
156
|
+
modelId: node.extendedData.modelId,
|
|
157
|
+
categoryId: node.extendedData.categoryId,
|
|
158
|
+
parentElementsIdsPath,
|
|
159
|
+
childrenCount: node.extendedData.childrenCount,
|
|
160
|
+
categoryOfTopMostParentElement: node.extendedData.categoryOfTopMostParentElement,
|
|
121
161
|
});
|
|
122
162
|
}
|
|
123
163
|
/** Changes visibility of the items represented by the tree node. */
|
|
124
164
|
changeVisibilityStatus(node, on) {
|
|
125
165
|
const changeObs = defer(() => {
|
|
126
|
-
if (
|
|
127
|
-
|
|
166
|
+
if (this.#props.viewport.viewType === "other") {
|
|
167
|
+
return EMPTY;
|
|
168
|
+
}
|
|
169
|
+
if (CategoriesTreeNodeInternal.isElementClassGroupingNode(node)) {
|
|
128
170
|
return this.#visibilityHelper.changeGroupedElementsVisibilityStatus({
|
|
129
|
-
categoryId:
|
|
130
|
-
modelElementsMap:
|
|
171
|
+
categoryId: node.extendedData.categoryId,
|
|
172
|
+
modelElementsMap: node.extendedData.modelElementsMap,
|
|
131
173
|
on,
|
|
132
174
|
});
|
|
133
175
|
}
|
|
134
|
-
if (
|
|
135
|
-
return EMPTY;
|
|
136
|
-
}
|
|
137
|
-
if (CategoriesTreeNode.isDefinitionContainerNode(node)) {
|
|
176
|
+
if (CategoriesTreeNodeInternal.isDefinitionContainerNode(node)) {
|
|
138
177
|
return this.#visibilityHelper.changeDefinitionContainersVisibilityStatus({
|
|
139
178
|
definitionContainerIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
140
179
|
on,
|
|
141
180
|
});
|
|
142
181
|
}
|
|
143
|
-
if (
|
|
182
|
+
if (CategoriesTreeNodeInternal.isModelNode(node)) {
|
|
144
183
|
return this.#visibilityHelper.changeModelsVisibilityStatus({
|
|
145
184
|
modelIds: node.key.instanceKeys.map(({ id }) => id),
|
|
146
185
|
on,
|
|
147
186
|
});
|
|
148
187
|
}
|
|
149
|
-
if (
|
|
188
|
+
if (CategoriesTreeNodeInternal.isCategoryNode(node)) {
|
|
150
189
|
return this.#visibilityHelper.changeCategoriesVisibilityStatus({
|
|
151
190
|
categoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
152
|
-
modelId:
|
|
191
|
+
modelId: node.extendedData.isCategoryOfSubModel ? node.extendedData.modelIds[0] : undefined,
|
|
153
192
|
on,
|
|
154
193
|
});
|
|
155
194
|
}
|
|
156
|
-
|
|
157
|
-
if (!categoryId) {
|
|
158
|
-
return EMPTY;
|
|
159
|
-
}
|
|
160
|
-
if (CategoriesTreeNode.isSubCategoryNode(node)) {
|
|
195
|
+
if (CategoriesTreeNodeInternal.isSubCategoryNode(node)) {
|
|
161
196
|
return this.#visibilityHelper.changeSubCategoriesVisibilityStatus({
|
|
162
|
-
categoryId,
|
|
197
|
+
categoryId: node.extendedData.categoryId,
|
|
163
198
|
subCategoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
164
199
|
on,
|
|
165
200
|
});
|
|
166
201
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
202
|
+
assert(CategoriesTreeNodeInternal.isElementNode(node));
|
|
203
|
+
const elementIds = node.key.instanceKeys.map(({ id }) => id);
|
|
204
|
+
return this.#props.idsCache.getChildElementsTree({ elementIds }).pipe(map((childrenTree) => {
|
|
205
|
+
// Children tree contains provided elementIds, they are at the root of this tree.
|
|
206
|
+
// We want to skip them and only get ids of children.
|
|
207
|
+
return getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 });
|
|
208
|
+
}), mergeMap((children) => this.#visibilityHelper.changeElementsVisibilityStatus({
|
|
209
|
+
elementIds,
|
|
210
|
+
modelId: node.extendedData.modelId,
|
|
211
|
+
children: children.size > 0 ? children : undefined,
|
|
212
|
+
categoryId: node.extendedData.categoryId,
|
|
175
213
|
on,
|
|
176
|
-
});
|
|
214
|
+
})));
|
|
177
215
|
});
|
|
178
216
|
if (this.#props.viewport.isAlwaysDrawnExclusive) {
|
|
179
217
|
return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);
|
|
180
218
|
}
|
|
181
219
|
return changeObs;
|
|
182
220
|
}
|
|
183
|
-
getSearchTargetsVisibilityStatus(targets) {
|
|
221
|
+
getSearchTargetsVisibilityStatus(targets, node) {
|
|
222
|
+
if (this.#props.viewport.viewType === "other") {
|
|
223
|
+
return of(createVisibilityStatus("disabled"));
|
|
224
|
+
}
|
|
184
225
|
return defer(() => {
|
|
185
226
|
const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;
|
|
186
227
|
const observables = new Array();
|
|
@@ -188,71 +229,95 @@ export class CategoriesTreeVisibilityHandler {
|
|
|
188
229
|
observables.push(this.#visibilityHelper.getDefinitionContainersVisibilityStatus({ definitionContainerIds }));
|
|
189
230
|
}
|
|
190
231
|
if (modelIds?.size) {
|
|
191
|
-
observables.push(this.#visibilityHelper.getModelsVisibilityStatus({ modelIds
|
|
232
|
+
observables.push(this.#visibilityHelper.getModelsVisibilityStatus({ modelIds }));
|
|
192
233
|
}
|
|
193
234
|
if (categories?.length) {
|
|
194
235
|
observables.push(from(categories).pipe(mergeMap(({ modelId, categoryIds }) => this.#visibilityHelper.getCategoriesVisibilityStatus({
|
|
195
236
|
categoryIds,
|
|
196
237
|
modelId,
|
|
197
|
-
type: this.#categoryType,
|
|
198
238
|
}))));
|
|
199
239
|
}
|
|
200
240
|
if (subCategories?.length) {
|
|
201
241
|
observables.push(from(subCategories).pipe(mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.getSubCategoriesVisibilityStatus({ subCategoryIds, categoryId }))));
|
|
202
242
|
}
|
|
203
243
|
if (elements?.length) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
id: modelId,
|
|
212
|
-
...(this.#props.viewport.viewType === "2d" ? { drawingCategories: categories } : { spatialCategories: categories }),
|
|
213
|
-
})))));
|
|
214
|
-
}
|
|
215
|
-
getAllCategories() {
|
|
216
|
-
return this.#props.idsCache.getAllCategories().pipe(map((categories) => {
|
|
217
|
-
if (this.#props.viewport.viewType === "2d") {
|
|
218
|
-
return { drawingCategories: categories };
|
|
219
|
-
}
|
|
220
|
-
return { spatialCategories: categories };
|
|
221
|
-
}));
|
|
222
|
-
}
|
|
223
|
-
getElementsCount(props) {
|
|
224
|
-
return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);
|
|
225
|
-
}
|
|
226
|
-
getModels(props) {
|
|
227
|
-
return this.#props.idsCache.getCategoriesElementModels(props.categoryIds, true);
|
|
228
|
-
}
|
|
229
|
-
getSubCategories(props) {
|
|
230
|
-
return this.#props.idsCache.getSubCategories(props.categoryId);
|
|
231
|
-
}
|
|
232
|
-
getSubModels(props) {
|
|
233
|
-
if ("modelIds" in props) {
|
|
234
|
-
return from(Id64.iterable(props.modelIds)).pipe(mergeMap((modelId) => {
|
|
235
|
-
if (props.categoryId) {
|
|
236
|
-
return this.#props.idsCache.getCategoriesModeledElements(modelId, props.categoryId).pipe(map((subModels) => ({ id: modelId, subModels })));
|
|
244
|
+
const searchTargetElements = new Array();
|
|
245
|
+
for (const { elements: elementsMap } of elements) {
|
|
246
|
+
for (const [elementId, { isSearchTarget }] of elementsMap) {
|
|
247
|
+
if (isSearchTarget) {
|
|
248
|
+
searchTargetElements.push(elementId);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
237
251
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
252
|
+
let childrenCountMapObs;
|
|
253
|
+
if (CategoriesTreeNodeInternal.isElementClassGroupingNode(node)) {
|
|
254
|
+
const groupingNodesSearchTargets = node.extendedData?.searchTargets;
|
|
255
|
+
const nestedSearchTargetElements = searchTargetElements.filter((searchTarget) => !groupingNodesSearchTargets?.has(searchTarget));
|
|
256
|
+
// Only need to request children count for indirect children search targets.
|
|
257
|
+
// Direct children search targets already have children count stored in grouping nodes extended data.
|
|
258
|
+
childrenCountMapObs = this.#props.idsCache.getAllChildElementsCount({ elementIds: nestedSearchTargetElements }).pipe(map((elementCountMap) => {
|
|
259
|
+
// Direct children search targets already have children count stored in grouping nodes extended data.
|
|
260
|
+
for (const [key, value] of node.extendedData.searchTargets ?? []) {
|
|
261
|
+
elementCountMap.set(key, value.childrenCount);
|
|
262
|
+
}
|
|
263
|
+
return elementCountMap;
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
childrenCountMapObs = this.#props.idsCache.getAllChildElementsCount({ elementIds: searchTargetElements });
|
|
268
|
+
}
|
|
269
|
+
observables.push(childrenCountMapObs.pipe(mergeMap((elementsChildrenCountMap) => fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, elements: elementsMap, categoryId, pathToElements, topMostParentElementId }) => {
|
|
270
|
+
const parentElementsIdsPath = topMostParentElementId
|
|
271
|
+
? getParentElementsIdsPath({
|
|
272
|
+
parentInstanceKeys: pathToElements.map((instanceKey) => [instanceKey]),
|
|
273
|
+
topMostParentElementId,
|
|
274
|
+
})
|
|
275
|
+
: [];
|
|
276
|
+
let totalSearchTargetsChildrenCount = 0;
|
|
277
|
+
const nonSearchTargetIds = new Array();
|
|
278
|
+
const searchTargetIds = new Array();
|
|
279
|
+
for (const [elementId, { isSearchTarget }] of elementsMap) {
|
|
280
|
+
if (!isSearchTarget) {
|
|
281
|
+
nonSearchTargetIds.push(elementId);
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
searchTargetIds.push(elementId);
|
|
285
|
+
const childCount = elementsChildrenCountMap.get(elementId);
|
|
286
|
+
if (childCount) {
|
|
287
|
+
totalSearchTargetsChildrenCount += childCount;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return merge(searchTargetIds.length > 0
|
|
291
|
+
? this.#visibilityHelper.getElementsVisibilityStatus({
|
|
292
|
+
modelId,
|
|
293
|
+
categoryId,
|
|
294
|
+
elementIds: searchTargetIds,
|
|
295
|
+
parentElementsIdsPath,
|
|
296
|
+
childrenCount: totalSearchTargetsChildrenCount,
|
|
297
|
+
// Search results tree is created on search paths. Since search paths contain only categories that are directly under models
|
|
298
|
+
// or at the root, categoryId can be used here here.
|
|
299
|
+
categoryOfTopMostParentElement: categoryId,
|
|
300
|
+
})
|
|
301
|
+
: EMPTY,
|
|
302
|
+
// Set childrenCount to undefined for non search targets, as some of their child elements might be filtered out.
|
|
303
|
+
// Since childrenCount is set to undefined, these elements won't check child always/never drawn child elements status.
|
|
304
|
+
// Child always/never drawn elements will be in search paths, and their visibility status will be handled separately.
|
|
305
|
+
nonSearchTargetIds.length > 0
|
|
306
|
+
? this.#visibilityHelper.getElementsVisibilityStatus({
|
|
307
|
+
modelId,
|
|
308
|
+
categoryId,
|
|
309
|
+
elementIds: nonSearchTargetIds,
|
|
310
|
+
parentElementsIdsPath,
|
|
311
|
+
childrenCount: undefined,
|
|
312
|
+
// Search results tree is created on search paths. Since search paths contain only categories that are directly under models
|
|
313
|
+
// or at the root, categoryId can be used here here.
|
|
314
|
+
categoryOfTopMostParentElement: categoryId,
|
|
315
|
+
})
|
|
316
|
+
: EMPTY).pipe(mergeVisibilityStatuses());
|
|
317
|
+
})))));
|
|
247
318
|
}
|
|
248
|
-
return from(
|
|
249
|
-
})
|
|
250
|
-
}
|
|
251
|
-
getGroupingNodeInfo(node) {
|
|
252
|
-
const modelElementsMap = node.extendedData?.modelElementsMap;
|
|
253
|
-
const categoryId = node.extendedData?.categoryId;
|
|
254
|
-
assert(!!modelElementsMap && !!categoryId);
|
|
255
|
-
return { modelElementsMap, categoryId };
|
|
319
|
+
return from(observables).pipe(mergeAll(), mergeVisibilityStatuses());
|
|
320
|
+
});
|
|
256
321
|
}
|
|
257
322
|
}
|
|
258
323
|
/**
|