@itwin/tree-widget-react 4.0.0-alpha.25 → 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 +2 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +75 -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 +3 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js.map +1 -1
- 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 -10
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +180 -88
- 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 +1 -3
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js +2 -4
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js.map +1 -1
- 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 +4 -8
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +154 -78
- 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 +2 -1
- package/lib/esm/tree-widget-react/components/trees/index.js +2 -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 +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +56 -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/UseModelsTree.d.ts +5 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +25 -12
- 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 -10
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +179 -72
- 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 -0
- package/lib/esm/tree-widget-react-internal.js +1 -0
- package/lib/esm/tree-widget-react-internal.js.map +1 -1
- package/package.json +77 -82
- 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
|
@@ -2,11 +2,13 @@
|
|
|
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, from, map, merge, mergeMap, of
|
|
6
|
-
import { assert
|
|
7
|
-
import {
|
|
5
|
+
import { concat, defer, EMPTY, from, map, merge, mergeAll, mergeMap, of } from "rxjs";
|
|
6
|
+
import { assert } from "@itwin/core-bentley";
|
|
7
|
+
import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
8
|
+
import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
|
|
9
|
+
import { fromWithRelease, getIdsFromChildrenTree, getParentElementsIdsPath, setDifference, setIntersection } from "../../../common/internal/Utils.js";
|
|
8
10
|
import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
|
|
9
|
-
import {
|
|
11
|
+
import { ClassificationsTreeNodeInternal } from "../ClassificationsTreeNodeInternal.js";
|
|
10
12
|
import { ClassificationsTreeVisibilityHelper } from "./ClassificationsTreeVisibilityHelper.js";
|
|
11
13
|
/**
|
|
12
14
|
* Handles visibility status of classifications tree nodes.
|
|
@@ -19,22 +21,11 @@ export class ClassificationsTreeVisibilityHandler {
|
|
|
19
21
|
#visibilityHelper;
|
|
20
22
|
constructor(constructorProps) {
|
|
21
23
|
this.#props = constructorProps;
|
|
22
|
-
// Remove after https://github.com/iTwin/viewer-components-react/issues/1421.
|
|
23
|
-
// We won't need to create a custom base ids cache.
|
|
24
|
-
const baseIdsCache = {
|
|
25
|
-
getCategories: (props) => this.getCategories(props),
|
|
26
|
-
getAllCategories: () => this.getAllCategories(),
|
|
27
|
-
getElementsCount: (props) => this.getElementsCount(props),
|
|
28
|
-
getModels: (props) => this.getModels(props),
|
|
29
|
-
getSubCategories: (props) => this.getSubCategories(props),
|
|
30
|
-
getSubModels: (props) => this.getSubModels(props),
|
|
31
|
-
hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),
|
|
32
|
-
};
|
|
33
24
|
this.#visibilityHelper = new ClassificationsTreeVisibilityHelper({
|
|
34
25
|
viewport: this.#props.viewport,
|
|
35
26
|
idsCache: this.#props.idsCache,
|
|
36
27
|
alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,
|
|
37
|
-
baseIdsCache,
|
|
28
|
+
baseIdsCache: this.#props.idsCache,
|
|
38
29
|
});
|
|
39
30
|
}
|
|
40
31
|
[Symbol.dispose]() {
|
|
@@ -42,7 +33,10 @@ export class ClassificationsTreeVisibilityHandler {
|
|
|
42
33
|
}
|
|
43
34
|
changeSearchTargetsVisibilityStatus(targets, on) {
|
|
44
35
|
return defer(() => {
|
|
45
|
-
|
|
36
|
+
if (this.#props.viewport.viewType !== "3d") {
|
|
37
|
+
return EMPTY;
|
|
38
|
+
}
|
|
39
|
+
const { classificationIds, classificationTableIds, elements } = targets;
|
|
46
40
|
const observables = new Array();
|
|
47
41
|
if (classificationTableIds?.size) {
|
|
48
42
|
observables.push(this.#visibilityHelper.changeClassificationTablesVisibilityStatus({ classificationTableIds, on }));
|
|
@@ -50,56 +44,125 @@ export class ClassificationsTreeVisibilityHandler {
|
|
|
50
44
|
if (classificationIds?.size) {
|
|
51
45
|
observables.push(this.#visibilityHelper.changeClassificationsVisibilityStatus({ classificationIds, on }));
|
|
52
46
|
}
|
|
53
|
-
if (
|
|
54
|
-
observables.push(
|
|
55
|
-
}
|
|
56
|
-
if (elements3d?.length) {
|
|
57
|
-
observables.push(from(elements3d).pipe(mergeMap(({ modelId, categoryId, elements }) => this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }))));
|
|
47
|
+
if (elements?.length) {
|
|
48
|
+
observables.push(this.changeSearchTargetElementsVisibilityStatus({ elements, on }));
|
|
58
49
|
}
|
|
59
50
|
return merge(...observables);
|
|
60
51
|
});
|
|
61
52
|
}
|
|
53
|
+
changeSearchTargetElementsVisibilityStatus({ elements, on, }) {
|
|
54
|
+
const searchTargetElements = new Array();
|
|
55
|
+
const elementIdsSet = new Set();
|
|
56
|
+
const modelCategoryElementMap = new Map();
|
|
57
|
+
// elements is an array that stores elements grouped by:
|
|
58
|
+
// 1. Their path
|
|
59
|
+
// 2. Their modelId and categoryId
|
|
60
|
+
// When changing visibility of elements, visibility handler does not care about the path.
|
|
61
|
+
// So we can first get all elements and group them only by modelId and categoryId.
|
|
62
|
+
for (const { elements: elementsMap, categoryId, modelId } of elements) {
|
|
63
|
+
const key = `${modelId}-${categoryId}`;
|
|
64
|
+
let mapEntry = modelCategoryElementMap.get(key);
|
|
65
|
+
if (!mapEntry) {
|
|
66
|
+
mapEntry = [];
|
|
67
|
+
modelCategoryElementMap.set(key, mapEntry);
|
|
68
|
+
}
|
|
69
|
+
for (const [elementId, { isSearchTarget }] of elementsMap) {
|
|
70
|
+
mapEntry.push(elementId);
|
|
71
|
+
elementIdsSet.add(elementId);
|
|
72
|
+
if (isSearchTarget) {
|
|
73
|
+
searchTargetElements.push(elementId);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Get children for search targets, since non search targets don't have all the children present in the hierarchy.
|
|
78
|
+
return this.#props.idsCache.getChildElementsTree({ elementIds: searchTargetElements }).pipe(
|
|
79
|
+
// Need to filter out and keep only those children ids that are not part of elements that are present in search paths.
|
|
80
|
+
// Elements in search paths will have their visibility changed directly: they will be provided as elementIds to changeElementsVisibilityStatus.
|
|
81
|
+
map((childrenTree) => ({
|
|
82
|
+
childrenNotInSearchPaths: setDifference(getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 }), elementIdsSet),
|
|
83
|
+
childrenTree,
|
|
84
|
+
})), mergeMap(({ childrenNotInSearchPaths, childrenTree }) => fromWithRelease({ source: modelCategoryElementMap.entries(), size: modelCategoryElementMap.size, releaseOnCount: 50 }).pipe(mergeMap(([key, elementsInSearchPathsGroupedByModelAndCategory]) => {
|
|
85
|
+
const [modelId, categoryId] = key.split("-");
|
|
86
|
+
const childrenIds = new Set();
|
|
87
|
+
// A shared children tree was created, need to get the children for each element in the group.
|
|
88
|
+
for (const elementId of elementsInSearchPathsGroupedByModelAndCategory) {
|
|
89
|
+
const elementChildrenTree = childrenTree.get(elementId)?.children;
|
|
90
|
+
if (!elementChildrenTree) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
for (const childId of getIdsFromChildrenTree({ tree: elementChildrenTree })) {
|
|
94
|
+
childrenIds.add(childId);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return this.#visibilityHelper.changeElementsVisibilityStatus({
|
|
98
|
+
modelId,
|
|
99
|
+
categoryId,
|
|
100
|
+
elementIds: elementsInSearchPathsGroupedByModelAndCategory,
|
|
101
|
+
// Pass only those children that are not part of search paths.
|
|
102
|
+
children: setIntersection(childrenIds, childrenNotInSearchPaths),
|
|
103
|
+
on,
|
|
104
|
+
});
|
|
105
|
+
}))));
|
|
106
|
+
}
|
|
62
107
|
getVisibilityStatus(node) {
|
|
63
|
-
if (
|
|
108
|
+
if (this.#props.viewport.viewType !== "3d") {
|
|
109
|
+
return of(createVisibilityStatus("disabled"));
|
|
110
|
+
}
|
|
111
|
+
if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {
|
|
64
112
|
return this.#visibilityHelper.getClassificationTablesVisibilityStatus({
|
|
65
113
|
classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
66
114
|
});
|
|
67
115
|
}
|
|
68
|
-
if (
|
|
116
|
+
if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {
|
|
69
117
|
return this.#visibilityHelper.getClassificationsVisibilityStatus({
|
|
70
118
|
classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
71
119
|
});
|
|
72
120
|
}
|
|
73
|
-
assert(
|
|
121
|
+
assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));
|
|
122
|
+
const parentElementsIdsPath = getParentElementsIdsPath({
|
|
123
|
+
parentInstanceKeys: node.parentKeys.filter((parentKey) => HierarchyNodeKey.isInstances(parentKey)).map((parentKey) => parentKey.instanceKeys),
|
|
124
|
+
topMostParentElementId: node.extendedData.topMostParentElementId,
|
|
125
|
+
});
|
|
74
126
|
return this.#visibilityHelper.getElementsVisibilityStatus({
|
|
75
127
|
elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
76
128
|
modelId: node.extendedData.modelId,
|
|
77
129
|
categoryId: node.extendedData.categoryId,
|
|
78
|
-
|
|
130
|
+
parentElementsIdsPath,
|
|
131
|
+
childrenCount: node.extendedData.childrenCount,
|
|
132
|
+
categoryOfTopMostParentElement: node.extendedData.categoryOfTopMostParentElement,
|
|
79
133
|
});
|
|
80
134
|
}
|
|
81
135
|
/** Changes visibility of the items represented by the tree node. */
|
|
82
136
|
changeVisibilityStatus(node, on) {
|
|
83
137
|
const changeObs = defer(() => {
|
|
84
|
-
if (
|
|
138
|
+
if (this.#props.viewport.viewType !== "3d") {
|
|
139
|
+
return EMPTY;
|
|
140
|
+
}
|
|
141
|
+
if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {
|
|
85
142
|
return this.#visibilityHelper.changeClassificationTablesVisibilityStatus({
|
|
86
143
|
classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
87
144
|
on,
|
|
88
145
|
});
|
|
89
146
|
}
|
|
90
|
-
if (
|
|
147
|
+
if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {
|
|
91
148
|
return this.#visibilityHelper.changeClassificationsVisibilityStatus({
|
|
92
149
|
classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),
|
|
93
150
|
on,
|
|
94
151
|
});
|
|
95
152
|
}
|
|
96
|
-
assert(
|
|
97
|
-
|
|
98
|
-
|
|
153
|
+
assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));
|
|
154
|
+
const elementIds = node.key.instanceKeys.map(({ id }) => id);
|
|
155
|
+
return this.#props.idsCache.getChildElementsTree({ elementIds }).pipe(map((childrenTree) => {
|
|
156
|
+
// Children tree contains provided elementIds, they are at the root of this tree.
|
|
157
|
+
// We want to skip them and only get ids of children.
|
|
158
|
+
return getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 });
|
|
159
|
+
}), mergeMap((children) => this.#visibilityHelper.changeElementsVisibilityStatus({
|
|
160
|
+
elementIds,
|
|
99
161
|
modelId: node.extendedData.modelId,
|
|
100
162
|
categoryId: node.extendedData.categoryId,
|
|
163
|
+
children: children.size > 0 ? children : undefined,
|
|
101
164
|
on,
|
|
102
|
-
});
|
|
165
|
+
})));
|
|
103
166
|
});
|
|
104
167
|
if (this.#props.viewport.isAlwaysDrawnExclusive) {
|
|
105
168
|
return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);
|
|
@@ -107,8 +170,11 @@ export class ClassificationsTreeVisibilityHandler {
|
|
|
107
170
|
return changeObs;
|
|
108
171
|
}
|
|
109
172
|
getSearchTargetsVisibilityStatus(targets) {
|
|
173
|
+
if (this.#props.viewport.viewType !== "3d") {
|
|
174
|
+
return of(createVisibilityStatus("disabled"));
|
|
175
|
+
}
|
|
110
176
|
return defer(() => {
|
|
111
|
-
const { classificationIds, classificationTableIds,
|
|
177
|
+
const { classificationIds, classificationTableIds, elements } = targets;
|
|
112
178
|
const observables = new Array();
|
|
113
179
|
if (classificationTableIds?.size) {
|
|
114
180
|
observables.push(this.#visibilityHelper.getClassificationTablesVisibilityStatus({ classificationTableIds }));
|
|
@@ -116,56 +182,66 @@ export class ClassificationsTreeVisibilityHandler {
|
|
|
116
182
|
if (classificationIds?.size) {
|
|
117
183
|
observables.push(this.#visibilityHelper.getClassificationsVisibilityStatus({ classificationIds }));
|
|
118
184
|
}
|
|
119
|
-
if (
|
|
120
|
-
observables.push(
|
|
121
|
-
return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(mergeMap((elementId) => this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: "GeometricElement2d" })));
|
|
122
|
-
})));
|
|
123
|
-
}
|
|
124
|
-
if (elements3d?.length) {
|
|
125
|
-
observables.push(fromWithRelease({ source: elements3d, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, categoryId, elements }) => {
|
|
126
|
-
return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(mergeMap((elementId) => this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: "GeometricElement3d" })));
|
|
127
|
-
})));
|
|
185
|
+
if (elements?.length) {
|
|
186
|
+
observables.push(this.getSearchTargetElementsVisibilityStatus({ elements }));
|
|
128
187
|
}
|
|
129
|
-
return
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
getCategories(props) {
|
|
133
|
-
return from(Id64.iterable(props.modelIds)).pipe(mergeMap((modelId) => this.#props.idsCache
|
|
134
|
-
.getModelCategoryIds(modelId)
|
|
135
|
-
.pipe(map(({ spatial, drawing }) => ({ id: modelId, drawingCategories: drawing, spatialCategories: spatial })))));
|
|
136
|
-
}
|
|
137
|
-
getAllCategories() {
|
|
138
|
-
return this.#props.idsCache.getAllCategories().pipe(map(({ drawing, spatial }) => {
|
|
139
|
-
return { drawingCategories: drawing, spatialCategories: spatial };
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
getElementsCount(props) {
|
|
143
|
-
return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);
|
|
144
|
-
}
|
|
145
|
-
getModels(props) {
|
|
146
|
-
return this.#props.idsCache.getCategoriesElementModels(props.categoryIds, true);
|
|
147
|
-
}
|
|
148
|
-
getSubCategories(props) {
|
|
149
|
-
return this.#props.idsCache.getSubCategories(props.categoryId);
|
|
188
|
+
return from(observables).pipe(mergeAll(), mergeVisibilityStatuses());
|
|
189
|
+
});
|
|
150
190
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
191
|
+
getSearchTargetElementsVisibilityStatus({ elements, }) {
|
|
192
|
+
const searchTargetElements = new Array();
|
|
193
|
+
for (const { elements: elementsMap } of elements) {
|
|
194
|
+
for (const [elementId, { isSearchTarget }] of elementsMap) {
|
|
195
|
+
if (isSearchTarget) {
|
|
196
|
+
searchTargetElements.push(elementId);
|
|
156
197
|
}
|
|
157
|
-
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
if (props.modelId) {
|
|
161
|
-
return from(Id64.iterable(props.categoryIds)).pipe(mergeMap((categoryId) => this.#props.idsCache.getCategoriesModeledElements(props.modelId, categoryId).pipe(map((subModels) => ({ id: categoryId, subModels })))));
|
|
198
|
+
}
|
|
162
199
|
}
|
|
163
|
-
return this.#props.idsCache.
|
|
164
|
-
|
|
165
|
-
|
|
200
|
+
return this.#props.idsCache.getAllChildElementsCount({ elementIds: searchTargetElements }).pipe(mergeMap((elementsChildrenCountMap) => fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, categoryId, elements: elementsMap, pathToElements, categoryOfTopMostParentElement, topMostParentElementId }) => {
|
|
201
|
+
const parentElementsIdsPath = topMostParentElementId
|
|
202
|
+
? getParentElementsIdsPath({
|
|
203
|
+
parentInstanceKeys: pathToElements.map((instanceKey) => [instanceKey]),
|
|
204
|
+
topMostParentElementId,
|
|
205
|
+
})
|
|
206
|
+
: [];
|
|
207
|
+
let totalSearchTargetsChildrenCount = 0;
|
|
208
|
+
const nonSearchTargetIds = new Array();
|
|
209
|
+
const searchTargetIds = new Array();
|
|
210
|
+
for (const [elementId, { isSearchTarget }] of elementsMap) {
|
|
211
|
+
if (!isSearchTarget) {
|
|
212
|
+
nonSearchTargetIds.push(elementId);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
searchTargetIds.push(elementId);
|
|
216
|
+
const childCount = elementsChildrenCountMap.get(elementId);
|
|
217
|
+
if (childCount) {
|
|
218
|
+
totalSearchTargetsChildrenCount += childCount;
|
|
219
|
+
}
|
|
166
220
|
}
|
|
167
|
-
return
|
|
168
|
-
|
|
221
|
+
return merge(searchTargetIds.length > 0
|
|
222
|
+
? this.#visibilityHelper.getElementsVisibilityStatus({
|
|
223
|
+
modelId,
|
|
224
|
+
categoryId,
|
|
225
|
+
elementIds: searchTargetIds,
|
|
226
|
+
parentElementsIdsPath,
|
|
227
|
+
childrenCount: totalSearchTargetsChildrenCount,
|
|
228
|
+
categoryOfTopMostParentElement,
|
|
229
|
+
})
|
|
230
|
+
: EMPTY,
|
|
231
|
+
// Set childrenCount to undefined for non search targets, as some of their child elements might be filtered out.
|
|
232
|
+
// Since childrenCount is set to undefined, these elements won't check child always/never drawn child elements status.
|
|
233
|
+
// Child always/never drawn elements will be in search paths, and their visibility status will be handled separately.
|
|
234
|
+
nonSearchTargetIds.length > 0
|
|
235
|
+
? this.#visibilityHelper.getElementsVisibilityStatus({
|
|
236
|
+
modelId,
|
|
237
|
+
categoryId,
|
|
238
|
+
elementIds: nonSearchTargetIds,
|
|
239
|
+
parentElementsIdsPath,
|
|
240
|
+
childrenCount: undefined,
|
|
241
|
+
categoryOfTopMostParentElement,
|
|
242
|
+
})
|
|
243
|
+
: EMPTY).pipe(mergeVisibilityStatuses());
|
|
244
|
+
}))));
|
|
169
245
|
}
|
|
170
246
|
}
|
|
171
247
|
//# sourceMappingURL=ClassificationsTreeVisibilityHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassificationsTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAkB/F;;;;;GAKG;AACH,MAAM,OAAO,oCAAoC;IACtC,MAAM,CAA4C;IAC3D,iBAAiB,CAAsC;IAEvD,YAAY,gBAA2D;QACrE,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC;QAC/B,6EAA6E;QAC7E,mDAAmD;QACnD,MAAM,YAAY,GAAiB;YACjC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACnD,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC/C,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YACzD,SAAS,EAAE,CAAC,KAAK,EAA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AAW,CAAC,CAAC,CAAC,IAAI,CAChD,QAAQ,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAC,KAAK,CAAC,OAAQ,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CACxI,CACF,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAC5E,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;YAC1C,CAAC;YACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CACtB,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EACrF,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CACxC,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concat, defer, from, map, merge, mergeMap, of, toArray } from \"rxjs\";\nimport { assert, Id64 } from \"@itwin/core-bentley\";\nimport { fromWithRelease } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { ClassificationsTreeNode } from \"../../ClassificationsTreeNode.js\";\nimport { ClassificationsTreeVisibilityHelper } from \"./ClassificationsTreeVisibilityHelper.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { AlwaysAndNeverDrawnElementInfo } from \"../../../common/internal/AlwaysAndNeverDrawnElementInfo.js\";\nimport type { BaseIdsCache, TreeSpecificVisibilityHandler } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { TreeWidgetViewport } from \"../../../common/TreeWidgetViewport.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\nimport type { ClassificationsTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/** @internal */\nexport interface ClassificationsTreeVisibilityHandlerProps {\n idsCache: ClassificationsTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;\n}\n\n/**\n * Handles visibility status of classifications tree nodes.\n *\n * This handler knows how to get and change visibility status of nodes created by hierarchy definition.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ClassificationsTreeSearchTargets> {\n readonly #props: ClassificationsTreeVisibilityHandlerProps;\n #visibilityHelper: ClassificationsTreeVisibilityHelper;\n\n constructor(constructorProps: ClassificationsTreeVisibilityHandlerProps) {\n this.#props = constructorProps;\n // Remove after https://github.com/iTwin/viewer-components-react/issues/1421.\n // We won't need to create a custom base ids cache.\n const baseIdsCache: BaseIdsCache = {\n getCategories: (props) => this.getCategories(props),\n getAllCategories: () => this.getAllCategories(),\n getElementsCount: (props) => this.getElementsCount(props),\n getModels: (props) => this.getModels(props),\n getSubCategories: (props) => this.getSubCategories(props),\n getSubModels: (props) => this.getSubModels(props),\n hasSubModel: (props) => this.#props.idsCache.hasSubModel(props),\n };\n this.#visibilityHelper = new ClassificationsTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n baseIdsCache,\n });\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n const { classificationIds, classificationTableIds, elements2d, elements3d } = targets;\n const observables = new Array<Observable<void>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationTablesVisibilityStatus({ classificationTableIds, on }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationsVisibilityStatus({ classificationIds, on }));\n }\n\n if (elements2d?.length) {\n observables.push(\n from(elements2d).pipe(\n mergeMap(({ modelId, categoryId, elements }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }),\n ),\n ),\n );\n }\n\n if (elements3d?.length) {\n observables.push(\n from(elements3d).pipe(\n mergeMap(({ modelId, categoryId, elements }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elements.keys()], on }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n });\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (ClassificationsTreeNode.isClassificationTableNode(node)) {\n return this.#visibilityHelper.getClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n if (ClassificationsTreeNode.isClassificationNode(node)) {\n return this.#visibilityHelper.getClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n assert(ClassificationsTreeNode.isGeometricElementNode(node));\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n type: node.extendedData.type,\n });\n }\n\n /** Changes visibility of the items represented by the tree node. */\n public changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void> {\n const changeObs = defer(() => {\n if (ClassificationsTreeNode.isClassificationTableNode(node)) {\n return this.#visibilityHelper.changeClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n if (ClassificationsTreeNode.isClassificationNode(node)) {\n return this.#visibilityHelper.changeClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n assert(ClassificationsTreeNode.isGeometricElementNode(node));\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n on,\n });\n });\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets): Observable<VisibilityStatus> {\n return defer(() => {\n const { classificationIds, classificationTableIds, elements2d, elements3d } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationTablesVisibilityStatus({ classificationTableIds }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationsVisibilityStatus({ classificationIds }));\n }\n if (elements2d?.length) {\n observables.push(\n fromWithRelease({ source: elements2d, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, categoryId, elements }) => {\n return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(\n mergeMap((elementId) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: \"GeometricElement2d\" }),\n ),\n );\n }),\n ),\n );\n }\n\n if (elements3d?.length) {\n observables.push(\n fromWithRelease({ source: elements3d, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, categoryId, elements }) => {\n return fromWithRelease({ source: elements.keys(), size: elements.size, releaseOnCount: 1000 }).pipe(\n mergeMap((elementId) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: elementId, type: \"GeometricElement3d\" }),\n ),\n );\n }),\n ),\n );\n }\n\n return merge(...observables);\n }).pipe(mergeVisibilityStatuses);\n }\n\n private getCategories(props: Parameters<BaseIdsCache[\"getCategories\"]>[0]): ReturnType<BaseIdsCache[\"getCategories\"]> {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) =>\n this.#props.idsCache\n .getModelCategoryIds(modelId)\n .pipe(map(({ spatial, drawing }) => ({ id: modelId, drawingCategories: drawing, spatialCategories: spatial }))),\n ),\n );\n }\n\n private getAllCategories(): ReturnType<BaseIdsCache[\"getAllCategories\"]> {\n return this.#props.idsCache.getAllCategories().pipe(\n map(({ drawing, spatial }) => {\n return { drawingCategories: drawing, spatialCategories: spatial };\n }),\n );\n }\n\n private getElementsCount(props: Parameters<BaseIdsCache[\"getElementsCount\"]>[0]): ReturnType<BaseIdsCache[\"getElementsCount\"]> {\n return this.#props.idsCache.getCategoryElementsCount(props.modelId, props.categoryId);\n }\n\n private getModels(props: Parameters<BaseIdsCache[\"getModels\"]>[0]): ReturnType<BaseIdsCache[\"getModels\"]> {\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds, true);\n }\n\n private getSubCategories(props: Parameters<BaseIdsCache[\"getSubCategories\"]>[0]): ReturnType<BaseIdsCache[\"getSubCategories\"]> {\n return this.#props.idsCache.getSubCategories(props.categoryId);\n }\n\n private getSubModels(props: Parameters<BaseIdsCache[\"getSubModels\"]>[0]): ReturnType<BaseIdsCache[\"getSubModels\"]> {\n if (\"modelIds\" in props) {\n return from(Id64.iterable(props.modelIds)).pipe(\n mergeMap((modelId) => {\n if (props.categoryId) {\n return this.#props.idsCache.getCategoriesModeledElements(modelId, props.categoryId).pipe(map((subModels) => ({ id: modelId, subModels })));\n }\n return from(this.#props.idsCache.getModelCategoryIds(modelId)).pipe(\n mergeMap(({ drawing, spatial }) => merge(drawing, spatial)),\n toArray(),\n mergeMap((categoryIds) => this.#props.idsCache.getCategoriesModeledElements(modelId, categoryIds)),\n map((subModels) => ({ id: modelId, subModels })),\n );\n }),\n );\n }\n\n if (props.modelId) {\n return from(Id64.iterable(props.categoryIds)).pipe(\n mergeMap((categoryId) =>\n this.#props.idsCache.getCategoriesModeledElements(props.modelId!, categoryId).pipe(map((subModels) => ({ id: categoryId, subModels }))),\n ),\n );\n }\n\n return this.#props.idsCache.getCategoriesElementModels(props.categoryIds).pipe(\n mergeMap(({ id, models }) => {\n if (!models) {\n return of({ id, subModels: undefined });\n }\n return from(models).pipe(\n mergeMap((modelId) => this.#props.idsCache.getCategoriesModeledElements(modelId, id)),\n map((subModels) => ({ id, subModels })),\n );\n }),\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ClassificationsTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACtJ,OAAO,EAAE,u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MAAM,UAAU,GAAG,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC3D,IAAI,UAAU,EAAE,CAAC;oBACf,+BAA+B,IAAI,UAAU,CAAC;gBAChD,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CACV,eAAe,CAAC,MAAM,GAAG,CAAC;gBACxB,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,2BAA2B,CAAC;oBACjD,OAAO;oBACP,UAAU;oBACV,UAAU,EAAE,eAAe;oBAC3B,qBAAqB;oBACrB,aAAa,EAAE,+BAA+B;oBAC9C,8BAA8B;iBAC/B,CAAC;gBACJ,CAAC,CAAC,KAAK;YACT,gHAAgH;YAChH,sHAAsH;YACtH,qHAAqH;YACrH,kBAAkB,CAAC,MAAM,GAAG,CAAC;gBAC3B,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,2BAA2B,CAAC;oBACjD,OAAO;oBACP,UAAU;oBACV,UAAU,EAAE,kBAAkB;oBAC9B,qBAAqB;oBACrB,aAAa,EAAE,SAAS;oBACxB,8BAA8B;iBAC/B,CAAC;gBACJ,CAAC,CAAC,KAAK,CACV,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CACH,CACF,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concat, defer, EMPTY, from, map, merge, mergeAll, mergeMap, of } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { fromWithRelease, getIdsFromChildrenTree, getParentElementsIdsPath, setDifference, setIntersection } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { ClassificationsTreeNodeInternal } from \"../ClassificationsTreeNodeInternal.js\";\nimport { ClassificationsTreeVisibilityHelper } from \"./ClassificationsTreeVisibilityHelper.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { AlwaysAndNeverDrawnElementInfoCache } from \"../../../common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js\";\nimport type { CategoryId, ElementId, ModelId } from \"../../../common/internal/Types.js\";\nimport type { ChildrenTree } from \"../../../common/internal/Utils.js\";\nimport type { TreeSpecificVisibilityHandler } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { TreeWidgetViewport } from \"../../../common/TreeWidgetViewport.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\nimport type { ClassificationsTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/** @internal */\nexport interface ClassificationsTreeVisibilityHandlerProps {\n idsCache: ClassificationsTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfoCache;\n}\n\n/**\n * Handles visibility status of classifications tree nodes.\n *\n * This handler knows how to get and change visibility status of nodes created by hierarchy definition.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ClassificationsTreeSearchTargets> {\n readonly #props: ClassificationsTreeVisibilityHandlerProps;\n #visibilityHelper: ClassificationsTreeVisibilityHelper;\n\n constructor(constructorProps: ClassificationsTreeVisibilityHandlerProps) {\n this.#props = constructorProps;\n this.#visibilityHelper = new ClassificationsTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n baseIdsCache: this.#props.idsCache,\n });\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n if (this.#props.viewport.viewType !== \"3d\") {\n return EMPTY;\n }\n const { classificationIds, classificationTableIds, elements } = targets;\n const observables = new Array<Observable<void>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationTablesVisibilityStatus({ classificationTableIds, on }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.changeClassificationsVisibilityStatus({ classificationIds, on }));\n }\n\n if (elements?.length) {\n observables.push(this.changeSearchTargetElementsVisibilityStatus({ elements, on }));\n }\n\n return merge(...observables);\n });\n }\n\n private changeSearchTargetElementsVisibilityStatus({\n elements,\n on,\n }: {\n elements: Required<ClassificationsTreeSearchTargets>[\"elements\"];\n on: boolean;\n }): Observable<void> {\n const searchTargetElements = new Array<Id64String>();\n const elementIdsSet = new Set<Id64String>();\n const modelCategoryElementMap = new Map<`${ModelId}-${CategoryId}`, Array<ElementId>>();\n // elements is an array that stores elements grouped by:\n // 1. Their path\n // 2. Their modelId and categoryId\n // When changing visibility of elements, visibility handler does not care about the path.\n // So we can first get all elements and group them only by modelId and categoryId.\n for (const { elements: elementsMap, categoryId, modelId } of elements) {\n const key: `${ModelId}-${CategoryId}` = `${modelId}-${categoryId}`;\n let mapEntry = modelCategoryElementMap.get(key);\n if (!mapEntry) {\n mapEntry = [];\n modelCategoryElementMap.set(key, mapEntry);\n }\n for (const [elementId, { isSearchTarget }] of elementsMap) {\n mapEntry.push(elementId);\n elementIdsSet.add(elementId);\n if (isSearchTarget) {\n searchTargetElements.push(elementId);\n }\n }\n }\n // Get children for search targets, since non search targets don't have all the children present in the hierarchy.\n return this.#props.idsCache.getChildElementsTree({ elementIds: searchTargetElements }).pipe(\n // Need to filter out and keep only those children ids that are not part of elements that are present in search paths.\n // Elements in search paths will have their visibility changed directly: they will be provided as elementIds to changeElementsVisibilityStatus.\n map((childrenTree) => ({\n childrenNotInSearchPaths: setDifference(getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 }), elementIdsSet),\n childrenTree,\n })),\n mergeMap(({ childrenNotInSearchPaths, childrenTree }) =>\n fromWithRelease({ source: modelCategoryElementMap.entries(), size: modelCategoryElementMap.size, releaseOnCount: 50 }).pipe(\n mergeMap(([key, elementsInSearchPathsGroupedByModelAndCategory]) => {\n const [modelId, categoryId] = key.split(\"-\");\n const childrenIds = new Set<Id64String>();\n // A shared children tree was created, need to get the children for each element in the group.\n for (const elementId of elementsInSearchPathsGroupedByModelAndCategory) {\n const elementChildrenTree: ChildrenTree | undefined = childrenTree.get(elementId)?.children;\n if (!elementChildrenTree) {\n continue;\n }\n for (const childId of getIdsFromChildrenTree({ tree: elementChildrenTree })) {\n childrenIds.add(childId);\n }\n }\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n modelId,\n categoryId,\n elementIds: elementsInSearchPathsGroupedByModelAndCategory,\n // Pass only those children that are not part of search paths.\n children: setIntersection(childrenIds, childrenNotInSearchPaths),\n on,\n });\n }),\n ),\n ),\n );\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (this.#props.viewport.viewType !== \"3d\") {\n return of(createVisibilityStatus(\"disabled\"));\n }\n if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {\n return this.#visibilityHelper.getClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {\n return this.#visibilityHelper.getClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));\n const parentElementsIdsPath = getParentElementsIdsPath({\n parentInstanceKeys: node.parentKeys.filter((parentKey) => HierarchyNodeKey.isInstances(parentKey)).map((parentKey) => parentKey.instanceKeys),\n topMostParentElementId: node.extendedData.topMostParentElementId,\n });\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n parentElementsIdsPath,\n childrenCount: node.extendedData.childrenCount,\n categoryOfTopMostParentElement: node.extendedData.categoryOfTopMostParentElement,\n });\n }\n\n /** Changes visibility of the items represented by the tree node. */\n public changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void> {\n const changeObs = defer(() => {\n if (this.#props.viewport.viewType !== \"3d\") {\n return EMPTY;\n }\n if (ClassificationsTreeNodeInternal.isClassificationTableNode(node)) {\n return this.#visibilityHelper.changeClassificationTablesVisibilityStatus({\n classificationTableIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n if (ClassificationsTreeNodeInternal.isClassificationNode(node)) {\n return this.#visibilityHelper.changeClassificationsVisibilityStatus({\n classificationIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n assert(ClassificationsTreeNodeInternal.isGeometricElementNode(node));\n const elementIds = node.key.instanceKeys.map(({ id }) => id);\n return this.#props.idsCache.getChildElementsTree({ elementIds }).pipe(\n map((childrenTree): Id64Set => {\n // Children tree contains provided elementIds, they are at the root of this tree.\n // We want to skip them and only get ids of children.\n return getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ depth }) => depth > 0 });\n }),\n mergeMap((children) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds,\n modelId: node.extendedData.modelId,\n categoryId: node.extendedData.categoryId,\n children: children.size > 0 ? children : undefined,\n on,\n }),\n ),\n );\n });\n\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getSearchTargetsVisibilityStatus(targets: ClassificationsTreeSearchTargets): Observable<VisibilityStatus> {\n if (this.#props.viewport.viewType !== \"3d\") {\n return of(createVisibilityStatus(\"disabled\"));\n }\n return defer(() => {\n const { classificationIds, classificationTableIds, elements } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (classificationTableIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationTablesVisibilityStatus({ classificationTableIds }));\n }\n\n if (classificationIds?.size) {\n observables.push(this.#visibilityHelper.getClassificationsVisibilityStatus({ classificationIds }));\n }\n if (elements?.length) {\n observables.push(this.getSearchTargetElementsVisibilityStatus({ elements }));\n }\n\n return from(observables).pipe(mergeAll(), mergeVisibilityStatuses());\n });\n }\n\n private getSearchTargetElementsVisibilityStatus({\n elements,\n }: {\n elements: Required<ClassificationsTreeSearchTargets>[\"elements\"];\n }): Observable<VisibilityStatus> {\n const searchTargetElements = new Array<Id64String>();\n for (const { elements: elementsMap } of elements) {\n for (const [elementId, { isSearchTarget }] of elementsMap) {\n if (isSearchTarget) {\n searchTargetElements.push(elementId);\n }\n }\n }\n return this.#props.idsCache.getAllChildElementsCount({ elementIds: searchTargetElements }).pipe(\n mergeMap((elementsChildrenCountMap) =>\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, categoryId, elements: elementsMap, pathToElements, categoryOfTopMostParentElement, topMostParentElementId }) => {\n const parentElementsIdsPath = topMostParentElementId\n ? getParentElementsIdsPath({\n parentInstanceKeys: pathToElements.map((instanceKey) => [instanceKey]),\n topMostParentElementId,\n })\n : [];\n let totalSearchTargetsChildrenCount = 0;\n const nonSearchTargetIds = new Array<Id64String>();\n const searchTargetIds = new Array<Id64String>();\n for (const [elementId, { isSearchTarget }] of elementsMap) {\n if (!isSearchTarget) {\n nonSearchTargetIds.push(elementId);\n continue;\n }\n searchTargetIds.push(elementId);\n const childCount = elementsChildrenCountMap.get(elementId);\n if (childCount) {\n totalSearchTargetsChildrenCount += childCount;\n }\n }\n return merge(\n searchTargetIds.length > 0\n ? this.#visibilityHelper.getElementsVisibilityStatus({\n modelId,\n categoryId,\n elementIds: searchTargetIds,\n parentElementsIdsPath,\n childrenCount: totalSearchTargetsChildrenCount,\n categoryOfTopMostParentElement,\n })\n : EMPTY,\n // Set childrenCount to undefined for non search targets, as some of their child elements might be filtered out.\n // Since childrenCount is set to undefined, these elements won't check child always/never drawn child elements status.\n // Child always/never drawn elements will be in search paths, and their visibility status will be handled separately.\n nonSearchTargetIds.length > 0\n ? this.#visibilityHelper.getElementsVisibilityStatus({\n modelId,\n categoryId,\n elementIds: nonSearchTargetIds,\n parentElementsIdsPath,\n childrenCount: undefined,\n categoryOfTopMostParentElement,\n })\n : EMPTY,\n ).pipe(mergeVisibilityStatuses());\n }),\n ),\n ),\n );\n }\n}\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
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 {
|
|
5
|
+
import { defaultIfEmpty, mergeMap } from "rxjs";
|
|
6
|
+
import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
|
|
6
7
|
import { BaseVisibilityHelper } from "../../../common/internal/visibility/BaseVisibilityHelper.js";
|
|
7
|
-
import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
|
|
8
8
|
/**
|
|
9
9
|
* Visibility status helper for classifications tree.
|
|
10
10
|
*
|
|
@@ -23,7 +23,10 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
|
|
|
23
23
|
* Determines visibility status by checking visibility status of related categories.
|
|
24
24
|
*/
|
|
25
25
|
getClassificationTablesVisibilityStatus(props) {
|
|
26
|
-
return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap((
|
|
26
|
+
return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap((categories) => this.getCategoriesVisibilityStatus({
|
|
27
|
+
modelId: undefined,
|
|
28
|
+
categoryIds: categories,
|
|
29
|
+
})), defaultIfEmpty(createVisibilityStatus("disabled")));
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
* Gets visibility status of classifications.
|
|
@@ -31,7 +34,10 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
|
|
|
31
34
|
* Determines visibility status by checking visibility status of related categories.
|
|
32
35
|
*/
|
|
33
36
|
getClassificationsVisibilityStatus(props) {
|
|
34
|
-
return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap((
|
|
37
|
+
return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap((categories) => this.getCategoriesVisibilityStatus({
|
|
38
|
+
modelId: undefined,
|
|
39
|
+
categoryIds: categories,
|
|
40
|
+
})), defaultIfEmpty(createVisibilityStatus("disabled")));
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* Changes visibility status of classification tables.
|
|
@@ -39,7 +45,11 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
|
|
|
39
45
|
* Does this by changing visibility status of related categories.
|
|
40
46
|
*/
|
|
41
47
|
changeClassificationTablesVisibilityStatus(props) {
|
|
42
|
-
return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap((
|
|
48
|
+
return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(mergeMap((categories) => this.changeCategoriesVisibilityStatus({
|
|
49
|
+
modelId: undefined,
|
|
50
|
+
categoryIds: categories,
|
|
51
|
+
on: props.on,
|
|
52
|
+
})));
|
|
43
53
|
}
|
|
44
54
|
/**
|
|
45
55
|
* Changes visibility status of classifications.
|
|
@@ -47,7 +57,11 @@ export class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {
|
|
|
47
57
|
* Does this by changing visibility status of related categories.
|
|
48
58
|
*/
|
|
49
59
|
changeClassificationsVisibilityStatus(props) {
|
|
50
|
-
return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap((
|
|
60
|
+
return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(mergeMap((categories) => this.changeCategoriesVisibilityStatus({
|
|
61
|
+
modelId: undefined,
|
|
62
|
+
categoryIds: categories,
|
|
63
|
+
on: props.on,
|
|
64
|
+
})));
|
|
51
65
|
}
|
|
52
66
|
}
|
|
53
67
|
//# sourceMappingURL=ClassificationsTreeVisibilityHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassificationsTreeVisibilityHelper.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ClassificationsTreeVisibilityHelper.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAanG;;;;;GAKG;AACH,MAAM,OAAO,mCAAoC,SAAQ,oBAAoB;IAC3E,MAAM,CAA2C;IACjD,YAAY,KAA+C;QACzD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,uCAAuC,CAAC,KAA0C;QACvF,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,IAAI,CACtF,QAAQ,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,IAAI,CAAC,6BAA6B,CAAC;YACjC,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,UAAU;SACxB,CAAC,CACH,EACD,cAAc,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,CACnD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,kCAAkC,CAAC,KAAqC;QAC7E,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACjF,QAAQ,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,IAAI,CAAC,6BAA6B,CAAC;YACjC,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,UAAU;SACxB,CAAC,CACH,EACD,cAAc,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,CACnD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,0CAA0C,CAAC,KAAuD;QACvG,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,IAAI,CACtF,QAAQ,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,IAAI,CAAC,gCAAgC,CAAC;YACpC,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,UAAU;YACvB,EAAE,EAAE,KAAK,CAAC,EAAE;SACb,CAAC,CACH,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,qCAAqC,CAAC,KAAkD;QAC7F,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACjF,QAAQ,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,IAAI,CAAC,gCAAgC,CAAC;YACpC,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,UAAU;YACvB,EAAE,EAAE,KAAK,CAAC,EAAE;SACb,CAAC,CACH,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { defaultIfEmpty, mergeMap } from \"rxjs\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { BaseVisibilityHelper } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg } from \"@itwin/core-bentley\";\nimport type { BaseVisibilityHelperProps } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { ClassificationsTreeIdsCache } from \"../ClassificationsTreeIdsCache.js\";\n\n/** @internal */\nexport type ClassificationsTreeVisibilityHelperProps = BaseVisibilityHelperProps & {\n idsCache: ClassificationsTreeIdsCache;\n};\n\n/**\n * Visibility status helper for classifications tree.\n *\n * It extends base visibility status helper and provides methods to get and change visibility status of classification tables and classifications.\n * @internal\n */\nexport class ClassificationsTreeVisibilityHelper extends BaseVisibilityHelper {\n #props: ClassificationsTreeVisibilityHelperProps;\n constructor(props: ClassificationsTreeVisibilityHelperProps) {\n super(props);\n this.#props = props;\n }\n\n /**\n * Gets visibility status of classification tables.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getClassificationTablesVisibilityStatus(props: { classificationTableIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(\n mergeMap((categories) =>\n this.getCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n }),\n ),\n defaultIfEmpty(createVisibilityStatus(\"disabled\")),\n );\n }\n\n /**\n * Gets visibility status of classifications.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getClassificationsVisibilityStatus(props: { classificationIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(\n mergeMap((categories) =>\n this.getCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n }),\n ),\n defaultIfEmpty(createVisibilityStatus(\"disabled\")),\n );\n }\n\n /**\n * Changes visibility status of classification tables.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeClassificationTablesVisibilityStatus(props: { classificationTableIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationTableIds).pipe(\n mergeMap((categories) =>\n this.changeCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n on: props.on,\n }),\n ),\n );\n }\n\n /**\n * Changes visibility status of classifications.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeClassificationsVisibilityStatus(props: { classificationIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache.getAllContainedCategories(props.classificationIds).pipe(\n mergeMap((categories) =>\n this.changeCategoriesVisibilityStatus({\n modelId: undefined,\n categoryIds: categories,\n on: props.on,\n }),\n ),\n );\n }\n}\n"]}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import type { Id64Set, Id64String } from "@itwin/core-bentley";
|
|
2
2
|
import type { HierarchySearchPath } from "@itwin/presentation-hierarchies";
|
|
3
|
-
import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
|
|
4
|
-
import type { ElementId } from "../../../common/internal/Types.js";
|
|
3
|
+
import type { ECClassHierarchyInspector, InstanceKey } from "@itwin/presentation-shared";
|
|
4
|
+
import type { CategoryId, ElementId } from "../../../common/internal/Types.js";
|
|
5
5
|
import type { SearchResultsTree } from "../../../common/internal/visibility/BaseSearchResultsTree.js";
|
|
6
6
|
import type { ClassificationsTreeIdsCache } from "../ClassificationsTreeIdsCache.js";
|
|
7
7
|
/** @internal */
|
|
8
8
|
export interface ClassificationsTreeSearchTargets {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
categoryId: Id64String;
|
|
12
|
-
elements: Map<ElementId, {
|
|
13
|
-
isSearchTarget: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
}>;
|
|
16
|
-
elements3d?: Array<{
|
|
9
|
+
elements?: Array<{
|
|
10
|
+
pathToElements: InstanceKey[];
|
|
17
11
|
modelId: Id64String;
|
|
18
12
|
categoryId: Id64String;
|
|
13
|
+
topMostParentElementId?: Id64String;
|
|
19
14
|
elements: Map<ElementId, {
|
|
20
15
|
isSearchTarget: boolean;
|
|
21
16
|
}>;
|
|
17
|
+
categoryOfTopMostParentElement: CategoryId;
|
|
22
18
|
}>;
|
|
23
19
|
classificationTableIds?: Id64Set;
|
|
24
20
|
classificationIds?: Id64Set;
|