@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
package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Observable } from "rxjs";
|
|
2
|
+
import type { GuidString, Id64String } from "@itwin/core-bentley";
|
|
3
|
+
import type { LimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
|
|
4
|
+
import type { CategoryId, SubCategoryId } from "../Types.js";
|
|
5
|
+
interface SubCategoriesCacheProps {
|
|
6
|
+
queryExecutor: LimitingECSqlQueryExecutor;
|
|
7
|
+
componentId?: GuidString;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare class SubCategoriesCache {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(props: SubCategoriesCacheProps);
|
|
13
|
+
private querySubCategories;
|
|
14
|
+
getSubCategoriesInfo(): Observable<{
|
|
15
|
+
subCategoryCategories: Map<SubCategoryId, CategoryId>;
|
|
16
|
+
categorySubCategories: Map<CategoryId, Array<SubCategoryId>>;
|
|
17
|
+
}>;
|
|
18
|
+
getSubCategories(props: {
|
|
19
|
+
categoryId: Id64String;
|
|
20
|
+
}): Observable<Array<SubCategoryId>>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=SubCategoriesCache.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { defer, map, reduce, shareReplay } from "rxjs";
|
|
6
|
+
import { Guid } from "@itwin/core-bentley";
|
|
7
|
+
import { CLASS_NAME_SubCategory } from "../ClassNameDefinitions.js";
|
|
8
|
+
import { catchBeSQLiteInterrupts } from "../UseErrorState.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export class SubCategoriesCache {
|
|
11
|
+
#queryExecutor;
|
|
12
|
+
#componentId;
|
|
13
|
+
#componentName;
|
|
14
|
+
#subCategoriesInfo;
|
|
15
|
+
constructor(props) {
|
|
16
|
+
this.#queryExecutor = props.queryExecutor;
|
|
17
|
+
this.#componentId = props.componentId ?? Guid.createValue();
|
|
18
|
+
this.#componentName = "SubCategoriesCache";
|
|
19
|
+
}
|
|
20
|
+
querySubCategories() {
|
|
21
|
+
return defer(() => {
|
|
22
|
+
const ecsql = `
|
|
23
|
+
SELECT
|
|
24
|
+
sc.ECInstanceId id,
|
|
25
|
+
sc.Parent.Id categoryId
|
|
26
|
+
FROM
|
|
27
|
+
${CLASS_NAME_SubCategory} sc
|
|
28
|
+
WHERE
|
|
29
|
+
NOT sc.IsPrivate
|
|
30
|
+
`;
|
|
31
|
+
return this.#queryExecutor.createQueryReader({ ecsql }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/sub-categories` });
|
|
32
|
+
}).pipe(catchBeSQLiteInterrupts, map((row) => {
|
|
33
|
+
return { id: row.id, parentId: row.categoryId };
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
getSubCategoriesInfo() {
|
|
37
|
+
this.#subCategoriesInfo ??= this.querySubCategories()
|
|
38
|
+
.pipe(reduce((acc, queriedSubCategory) => {
|
|
39
|
+
acc.subCategoryCategories.set(queriedSubCategory.id, queriedSubCategory.parentId);
|
|
40
|
+
const entry = acc.categorySubCategories.get(queriedSubCategory.parentId);
|
|
41
|
+
if (entry) {
|
|
42
|
+
entry.push(queriedSubCategory.id);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
acc.categorySubCategories.set(queriedSubCategory.parentId, [queriedSubCategory.id]);
|
|
46
|
+
}
|
|
47
|
+
return acc;
|
|
48
|
+
}, { subCategoryCategories: new Map(), categorySubCategories: new Map() }))
|
|
49
|
+
.pipe(shareReplay());
|
|
50
|
+
return this.#subCategoriesInfo;
|
|
51
|
+
}
|
|
52
|
+
getSubCategories(props) {
|
|
53
|
+
return this.getSubCategoriesInfo().pipe(map(({ categorySubCategories }) => categorySubCategories.get(props.categoryId) ?? []));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=SubCategoriesCache.js.map
|
package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAY9D,gBAAgB;AAChB,MAAM,OAAO,kBAAkB;IAC7B,cAAc,CAA6B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AAkB,CAAC,EAAE,CAAC,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;YACtF,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAE,qBAAqB,EAAE,IAAI,GAAG,EAA6B,EAAE,qBAAqB,EAAE,IAAI,GAAG,EAAoC,EAAE,CACpI,CACF;aACA,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAEM,gBAAgB,CAAC,KAAiC;QACvD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjI,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 { defer, map, reduce, shareReplay } from \"rxjs\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { CLASS_NAME_SubCategory } from \"../ClassNameDefinitions.js\";\nimport { catchBeSQLiteInterrupts } from \"../UseErrorState.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GuidString, Id64String } from \"@itwin/core-bentley\";\nimport type { LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { CategoryId, SubCategoryId } from \"../Types.js\";\n\ninterface SubCategoriesCacheProps {\n queryExecutor: LimitingECSqlQueryExecutor;\n componentId?: GuidString;\n}\n\n/** @internal */\nexport class SubCategoriesCache {\n #queryExecutor: LimitingECSqlQueryExecutor;\n #componentId: GuidString;\n #componentName: string;\n #subCategoriesInfo:\n | Observable<{ subCategoryCategories: Map<SubCategoryId, CategoryId>; categorySubCategories: Map<CategoryId, Array<SubCategoryId>> }>\n | undefined;\n\n constructor(props: SubCategoriesCacheProps) {\n this.#queryExecutor = props.queryExecutor;\n this.#componentId = props.componentId ?? Guid.createValue();\n this.#componentName = \"SubCategoriesCache\";\n }\n\n private querySubCategories(): Observable<{ id: SubCategoryId; parentId: CategoryId }> {\n return defer(() => {\n const ecsql = `\n SELECT\n sc.ECInstanceId id,\n sc.Parent.Id categoryId\n FROM\n ${CLASS_NAME_SubCategory} sc\n WHERE\n NOT sc.IsPrivate\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/sub-categories` },\n );\n }).pipe(\n catchBeSQLiteInterrupts,\n map((row) => {\n return { id: row.id, parentId: row.categoryId };\n }),\n );\n }\n\n public getSubCategoriesInfo() {\n this.#subCategoriesInfo ??= this.querySubCategories()\n .pipe(\n reduce(\n (acc, queriedSubCategory) => {\n acc.subCategoryCategories.set(queriedSubCategory.id, queriedSubCategory.parentId);\n const entry = acc.categorySubCategories.get(queriedSubCategory.parentId);\n if (entry) {\n entry.push(queriedSubCategory.id);\n } else {\n acc.categorySubCategories.set(queriedSubCategory.parentId, [queriedSubCategory.id]);\n }\n return acc;\n },\n { subCategoryCategories: new Map<SubCategoryId, CategoryId>(), categorySubCategories: new Map<CategoryId, Array<SubCategoryId>>() },\n ),\n )\n .pipe(shareReplay());\n return this.#subCategoriesInfo;\n }\n\n public getSubCategories(props: { categoryId: Id64String }): Observable<Array<SubCategoryId>> {\n return this.getSubCategoriesInfo().pipe(map(({ categorySubCategories }) => categorySubCategories.get(props.categoryId) ?? []));\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
2
2
|
import { HierarchyVisibilityOverrideHandler } from "../../UseHierarchyVisibility.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AlwaysAndNeverDrawnElementInfoCache } from "../caches/AlwaysAndNeverDrawnElementInfoCache.js";
|
|
4
4
|
import type { GuidString } from "@itwin/core-bentley";
|
|
5
5
|
import type { HierarchySearchPath } from "@itwin/presentation-hierarchies";
|
|
6
6
|
import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
|
|
@@ -10,14 +10,14 @@ import type { SearchResultsTree } from "../visibility/BaseSearchResultsTree.js";
|
|
|
10
10
|
import type { TreeSpecificVisibilityHandler } from "../visibility/BaseVisibilityHelper.js";
|
|
11
11
|
/** @internal */
|
|
12
12
|
export interface CreateSearchResultsTreeProps<TCache> {
|
|
13
|
-
|
|
13
|
+
idsCache: TCache;
|
|
14
14
|
imodelAccess: ECClassHierarchyInspector;
|
|
15
15
|
searchPaths: HierarchySearchPath[];
|
|
16
16
|
}
|
|
17
17
|
/** @internal */
|
|
18
18
|
export interface CreateTreeSpecificVisibilityHandlerProps<TCache> {
|
|
19
|
-
info:
|
|
20
|
-
|
|
19
|
+
info: AlwaysAndNeverDrawnElementInfoCache;
|
|
20
|
+
idsCache: TCache;
|
|
21
21
|
viewport: TreeWidgetViewport;
|
|
22
22
|
overrideHandler: HierarchyVisibilityOverrideHandler;
|
|
23
23
|
}
|
|
@@ -25,7 +25,7 @@ export interface CreateTreeSpecificVisibilityHandlerProps<TCache> {
|
|
|
25
25
|
export interface UseCachedVisibilityProps<TCache, TSearchTargets> {
|
|
26
26
|
componentId: GuidString;
|
|
27
27
|
activeView: TreeWidgetViewport;
|
|
28
|
-
|
|
28
|
+
idsCache: TCache;
|
|
29
29
|
createSearchResultsTree: (props: CreateSearchResultsTreeProps<TCache>) => Promise<SearchResultsTree<TSearchTargets>>;
|
|
30
30
|
createTreeSpecificVisibilityHandler: (props: CreateTreeSpecificVisibilityHandlerProps<TCache>) => TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;
|
|
31
31
|
}
|
|
@@ -40,7 +40,7 @@ export declare function useCachedVisibility<TCache, TSearchTargets>(props: UseCa
|
|
|
40
40
|
/** @internal */
|
|
41
41
|
export interface HierarchyVisibilityHandlerImplProps<TSearchTargets> {
|
|
42
42
|
viewport: TreeWidgetViewport;
|
|
43
|
-
getTreeSpecificVisibilityHandler: (info:
|
|
43
|
+
getTreeSpecificVisibilityHandler: (info: AlwaysAndNeverDrawnElementInfoCache, overrideHandler: HierarchyVisibilityOverrideHandler) => TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;
|
|
44
44
|
getSearchResultsTree: () => Promise<SearchResultsTree<TSearchTargets>> | undefined;
|
|
45
45
|
componentId?: GuidString;
|
|
46
46
|
}
|
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { useCallback, useEffect, useState } from "react";
|
|
6
6
|
import { defaultIfEmpty, EMPTY, filter, firstValueFrom, from, fromEventPattern, map, mergeMap, Subject, takeUntil, tap } from "rxjs";
|
|
7
|
-
import { assert } from "@itwin/core-bentley";
|
|
8
7
|
import { HierarchyNode, HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
9
8
|
import { HierarchyVisibilityOverrideHandler } from "../../UseHierarchyVisibility.js";
|
|
10
|
-
import {
|
|
9
|
+
import { AlwaysAndNeverDrawnElementInfoCache } from "../caches/AlwaysAndNeverDrawnElementInfoCache.js";
|
|
11
10
|
import { toVoidPromise } from "../Rxjs.js";
|
|
12
11
|
import { createVisibilityStatus } from "../Tooltip.js";
|
|
13
12
|
import { createVisibilityChangeEventListener } from "../VisibilityChangeEventListener.js";
|
|
14
13
|
/** @internal */
|
|
15
14
|
export function useCachedVisibility(props) {
|
|
16
15
|
const [searchPaths, setSearchPaths] = useState(undefined);
|
|
17
|
-
const { activeView,
|
|
16
|
+
const { activeView, idsCache, createSearchResultsTree, createTreeSpecificVisibilityHandler, componentId } = props;
|
|
18
17
|
const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState(() => createVisibilityHandlerFactory({
|
|
19
18
|
activeView,
|
|
20
|
-
|
|
19
|
+
idsCache,
|
|
21
20
|
createSearchResultsTree,
|
|
22
21
|
createTreeSpecificVisibilityHandler,
|
|
23
22
|
searchPaths,
|
|
@@ -26,13 +25,13 @@ export function useCachedVisibility(props) {
|
|
|
26
25
|
useEffect(() => {
|
|
27
26
|
setVisibilityHandlerFactory(() => createVisibilityHandlerFactory({
|
|
28
27
|
activeView,
|
|
29
|
-
|
|
28
|
+
idsCache,
|
|
30
29
|
createSearchResultsTree,
|
|
31
30
|
createTreeSpecificVisibilityHandler,
|
|
32
31
|
searchPaths,
|
|
33
32
|
componentId,
|
|
34
33
|
}));
|
|
35
|
-
}, [activeView,
|
|
34
|
+
}, [activeView, idsCache, searchPaths, createSearchResultsTree, createTreeSpecificVisibilityHandler, componentId]);
|
|
36
35
|
return {
|
|
37
36
|
visibilityHandlerFactory,
|
|
38
37
|
onSearchPathsChanged: useCallback((paths) => setSearchPaths(paths), []),
|
|
@@ -40,19 +39,19 @@ export function useCachedVisibility(props) {
|
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
function createVisibilityHandlerFactory(props) {
|
|
43
|
-
const { activeView, createSearchResultsTree, createTreeSpecificVisibilityHandler,
|
|
42
|
+
const { activeView, createSearchResultsTree, createTreeSpecificVisibilityHandler, idsCache, searchPaths, componentId } = props;
|
|
44
43
|
return ({ imodelAccess }) => new HierarchyVisibilityHandlerImpl({
|
|
45
44
|
componentId,
|
|
46
45
|
viewport: activeView,
|
|
47
46
|
getSearchResultsTree: () => {
|
|
48
47
|
if (searchPaths) {
|
|
49
|
-
return createSearchResultsTree({ imodelAccess, searchPaths,
|
|
48
|
+
return createSearchResultsTree({ imodelAccess, searchPaths, idsCache });
|
|
50
49
|
}
|
|
51
50
|
return undefined;
|
|
52
51
|
},
|
|
53
52
|
getTreeSpecificVisibilityHandler: (info, overrideHandler) => createTreeSpecificVisibilityHandler({
|
|
54
53
|
info,
|
|
55
|
-
|
|
54
|
+
idsCache,
|
|
56
55
|
viewport: activeView,
|
|
57
56
|
overrideHandler,
|
|
58
57
|
}),
|
|
@@ -84,9 +83,12 @@ export class HierarchyVisibilityHandlerImpl {
|
|
|
84
83
|
displayStyle: true,
|
|
85
84
|
},
|
|
86
85
|
});
|
|
87
|
-
this.#alwaysAndNeverDrawnElements = new AlwaysAndNeverDrawnElementInfo({ viewport: this.#props.viewport, componentId: props.componentId });
|
|
88
|
-
this.#treeSpecificVisibilityHandler = this.#props.getTreeSpecificVisibilityHandler(this.#alwaysAndNeverDrawnElements, new HierarchyVisibilityOverrideHandler(this));
|
|
89
86
|
this.#searchResultsTree = this.#props.getSearchResultsTree();
|
|
87
|
+
this.#alwaysAndNeverDrawnElements = new AlwaysAndNeverDrawnElementInfoCache({
|
|
88
|
+
viewport: this.#props.viewport,
|
|
89
|
+
componentId: props.componentId,
|
|
90
|
+
});
|
|
91
|
+
this.#treeSpecificVisibilityHandler = this.#props.getTreeSpecificVisibilityHandler(this.#alwaysAndNeverDrawnElements, new HierarchyVisibilityOverrideHandler(this));
|
|
90
92
|
}
|
|
91
93
|
get onVisibilityChange() {
|
|
92
94
|
return this.#eventListener.onVisibilityChange;
|
|
@@ -100,7 +102,7 @@ export class HierarchyVisibilityHandlerImpl {
|
|
|
100
102
|
this.#eventListener.onVisibilityChange.addListener(handler);
|
|
101
103
|
}, (handler) => {
|
|
102
104
|
this.#eventListener.onVisibilityChange.removeListener(handler);
|
|
103
|
-
})), defaultIfEmpty(createVisibilityStatus("
|
|
105
|
+
})), defaultIfEmpty(createVisibilityStatus("disabled"))));
|
|
104
106
|
}
|
|
105
107
|
async changeVisibility(node, shouldDisplay) {
|
|
106
108
|
// notify about new change request
|
|
@@ -130,7 +132,10 @@ export class HierarchyVisibilityHandlerImpl {
|
|
|
130
132
|
return this.getSearchResultsNodeVisibility({ node });
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
|
-
if (HierarchyNode.isInstancesNode(node) &&
|
|
135
|
+
if (HierarchyNode.isInstancesNode(node) &&
|
|
136
|
+
node.search?.childrenTargetPaths?.length &&
|
|
137
|
+
!node.search.isSearchTarget &&
|
|
138
|
+
!node.search.hasSearchTargetAncestor) {
|
|
134
139
|
return this.getSearchResultsNodeVisibility({ node });
|
|
135
140
|
}
|
|
136
141
|
return this.#treeSpecificVisibilityHandler.getVisibilityStatus(node);
|
|
@@ -141,7 +146,10 @@ export class HierarchyVisibilityHandlerImpl {
|
|
|
141
146
|
return this.changeSearchResultsNodeVisibility({ node, on });
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
|
-
if (HierarchyNode.isInstancesNode(node) &&
|
|
149
|
+
if (HierarchyNode.isInstancesNode(node) &&
|
|
150
|
+
node.search?.childrenTargetPaths?.length &&
|
|
151
|
+
!node.search.isSearchTarget &&
|
|
152
|
+
!node.search.hasSearchTargetAncestor) {
|
|
145
153
|
return this.changeSearchResultsNodeVisibility({ node, on });
|
|
146
154
|
}
|
|
147
155
|
return this.#treeSpecificVisibilityHandler.changeVisibilityStatus(node, on);
|
|
@@ -151,12 +159,14 @@ export class HierarchyVisibilityHandlerImpl {
|
|
|
151
159
|
if (!targets) {
|
|
152
160
|
return EMPTY;
|
|
153
161
|
}
|
|
154
|
-
return this.#treeSpecificVisibilityHandler.getSearchTargetsVisibilityStatus(targets);
|
|
162
|
+
return this.#treeSpecificVisibilityHandler.getSearchTargetsVisibilityStatus(targets, props.node);
|
|
155
163
|
}));
|
|
156
164
|
}
|
|
157
165
|
getSearchResultsTreeTargets({ node, }) {
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
// There can be cases where search paths used to exist and are removed, search results tree becomes undefined,
|
|
167
|
+
// but visibility is re-requested for old nodes (have search paths).
|
|
168
|
+
// In such cases return EMPTY.
|
|
169
|
+
return this.#searchResultsTree ? from(this.#searchResultsTree).pipe(map((searchResultsTree) => searchResultsTree.getSearchTargets(node))) : EMPTY;
|
|
160
170
|
}
|
|
161
171
|
changeSearchResultsNodeVisibility({ on, node, }) {
|
|
162
172
|
return this.getSearchResultsTreeTargets({ node }).pipe(mergeMap((targets) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseCachedVisibility.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACrI,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAqC1F,gBAAgB;AAChB,MAAM,UAAU,mBAAmB,CAAyB,KAAuD;IACjH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAoC,SAAS,CAAC,CAAC;IAC7F,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,uBAAuB,EAAE,mCAAmC,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAElH,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,GAAG,QAAQ,CAAkD,GAAG,EAAE,CAC7H,8BAA8B,CAAC;QAC7B,UAAU;QACV,QAAQ;QAC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CAAC;YACD,OAAO,IAAI,CAAC,8BAA8B,CAAC,mCAAmC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9F,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 { useCallback, useEffect, useState } from \"react\";\nimport { defaultIfEmpty, EMPTY, filter, firstValueFrom, from, fromEventPattern, map, mergeMap, Subject, takeUntil, tap } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { HierarchyVisibilityOverrideHandler } from \"../../UseHierarchyVisibility.js\";\nimport { AlwaysAndNeverDrawnElementInfo } from \"../AlwaysAndNeverDrawnElementInfo.js\";\nimport { toVoidPromise } from \"../Rxjs.js\";\nimport { createVisibilityStatus } from \"../Tooltip.js\";\nimport { createVisibilityChangeEventListener } from \"../VisibilityChangeEventListener.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { ClassGroupingNodeKey, HierarchySearchPath, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { VisibilityTreeProps } from \"../../components/VisibilityTree.js\";\nimport type { TreeWidgetViewport } from \"../../TreeWidgetViewport.js\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../../UseHierarchyVisibility.js\";\nimport type { SearchResultsTree } from \"../visibility/BaseSearchResultsTree.js\";\nimport type { TreeSpecificVisibilityHandler } from \"../visibility/BaseVisibilityHelper.js\";\nimport type { IVisibilityChangeEventListener } from \"../VisibilityChangeEventListener.js\";\n\n/** @internal */\nexport interface CreateSearchResultsTreeProps<TCache> {\n getCache: () => TCache;\n imodelAccess: ECClassHierarchyInspector;\n searchPaths: HierarchySearchPath[];\n}\n\n/** @internal */\nexport interface CreateTreeSpecificVisibilityHandlerProps<TCache> {\n info: AlwaysAndNeverDrawnElementInfo;\n getCache: () => TCache;\n viewport: TreeWidgetViewport;\n overrideHandler: HierarchyVisibilityOverrideHandler;\n}\n\n/** @internal */\nexport interface UseCachedVisibilityProps<TCache, TSearchTargets> {\n componentId: GuidString;\n activeView: TreeWidgetViewport;\n getCache: () => TCache;\n createSearchResultsTree: (props: CreateSearchResultsTreeProps<TCache>) => Promise<SearchResultsTree<TSearchTargets>>;\n createTreeSpecificVisibilityHandler: (props: CreateTreeSpecificVisibilityHandlerProps<TCache>) => TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;\n}\n\n/** @internal */\nexport function useCachedVisibility<TCache, TSearchTargets>(props: UseCachedVisibilityProps<TCache, TSearchTargets>) {\n const [searchPaths, setSearchPaths] = useState<HierarchySearchPath[] | undefined>(undefined);\n const { activeView, getCache, createSearchResultsTree, createTreeSpecificVisibilityHandler, componentId } = props;\n\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState<VisibilityTreeProps[\"visibilityHandlerFactory\"]>(() =>\n createVisibilityHandlerFactory({\n activeView,\n getCache,\n createSearchResultsTree,\n createTreeSpecificVisibilityHandler,\n searchPaths,\n componentId,\n }),\n );\n\n useEffect(() => {\n setVisibilityHandlerFactory(() =>\n createVisibilityHandlerFactory({\n activeView,\n getCache,\n createSearchResultsTree,\n createTreeSpecificVisibilityHandler,\n searchPaths,\n componentId,\n }),\n );\n }, [activeView, getCache, searchPaths, createSearchResultsTree, createTreeSpecificVisibilityHandler, componentId]);\n\n return {\n visibilityHandlerFactory,\n onSearchPathsChanged: useCallback((paths: HierarchySearchPath[] | undefined) => setSearchPaths(paths), []),\n searchPaths,\n };\n}\n\nfunction createVisibilityHandlerFactory<TCache, TSearchTargets>(\n props: UseCachedVisibilityProps<TCache, TSearchTargets> & {\n searchPaths: HierarchySearchPath[] | undefined;\n },\n): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n const { activeView, createSearchResultsTree, createTreeSpecificVisibilityHandler, getCache, searchPaths, componentId } = props;\n return ({ imodelAccess }) =>\n new HierarchyVisibilityHandlerImpl<TSearchTargets>({\n componentId,\n viewport: activeView,\n getSearchResultsTree: (): Promise<SearchResultsTree<TSearchTargets>> | undefined => {\n if (searchPaths) {\n return createSearchResultsTree({ imodelAccess, searchPaths, getCache });\n }\n return undefined;\n },\n getTreeSpecificVisibilityHandler: (info, overrideHandler) =>\n createTreeSpecificVisibilityHandler({\n info,\n getCache,\n viewport: activeView,\n overrideHandler,\n }),\n });\n}\n\n/** @internal */\nexport interface HierarchyVisibilityHandlerImplProps<TSearchTargets> {\n viewport: TreeWidgetViewport;\n getTreeSpecificVisibilityHandler: (\n info: AlwaysAndNeverDrawnElementInfo,\n overrideHandler: HierarchyVisibilityOverrideHandler,\n ) => TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;\n getSearchResultsTree: () => Promise<SearchResultsTree<TSearchTargets>> | undefined;\n componentId?: GuidString;\n}\n\n/**\n * Class that handles visibility of hierarchy nodes in a tree.\n *\n * - It provides methods to get and change visibility status of nodes.\n * - Also handles filtered tree nodes visibility.\n * - Listens to visibility change events and updates visibility status accordingly.\n * @internal\n */\nexport class HierarchyVisibilityHandlerImpl<TSearchTargets> implements HierarchyVisibilityHandler, Disposable {\n readonly #props: HierarchyVisibilityHandlerImplProps<TSearchTargets>;\n readonly #eventListener: IVisibilityChangeEventListener;\n readonly #alwaysAndNeverDrawnElements: AlwaysAndNeverDrawnElementInfo;\n #treeSpecificVisibilityHandler: TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;\n #changeRequest = new Subject<{ key: HierarchyNodeKey; depth: number }>();\n #searchResultsTree: Promise<SearchResultsTree<TSearchTargets>> | undefined;\n\n constructor(props: HierarchyVisibilityHandlerImplProps<TSearchTargets>) {\n this.#props = props;\n this.#eventListener = createVisibilityChangeEventListener({\n viewport: this.#props.viewport,\n listeners: {\n models: true,\n categories: true,\n elements: true,\n displayStyle: true,\n },\n });\n this.#alwaysAndNeverDrawnElements = new AlwaysAndNeverDrawnElementInfo({ viewport: this.#props.viewport, componentId: props.componentId });\n this.#treeSpecificVisibilityHandler = this.#props.getTreeSpecificVisibilityHandler(\n this.#alwaysAndNeverDrawnElements,\n new HierarchyVisibilityOverrideHandler(this),\n );\n this.#searchResultsTree = this.#props.getSearchResultsTree();\n }\n\n public get onVisibilityChange() {\n return this.#eventListener.onVisibilityChange;\n }\n\n public async getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> {\n return firstValueFrom(\n this.getVisibilityStatusInternal(node).pipe(\n // unsubscribe from the observable if the change request for this node is received\n takeUntil(this.#changeRequest.pipe(filter(({ key, depth }) => depth === node.parentKeys.length && HierarchyNodeKey.equals(node.key, key)))),\n // unsubscribe if visibility changes\n takeUntil(\n fromEventPattern(\n (handler) => {\n this.#eventListener.onVisibilityChange.addListener(handler);\n },\n (handler) => {\n this.#eventListener.onVisibilityChange.removeListener(handler);\n },\n ),\n ),\n defaultIfEmpty(createVisibilityStatus(\"hidden\")),\n ),\n );\n }\n\n public async changeVisibility(node: HierarchyNode, shouldDisplay: boolean): Promise<void> {\n // notify about new change request\n this.#changeRequest.next({ key: node.key, depth: node.parentKeys.length });\n\n const changeObservable = this.changeVisibilityStatusInternal(node, shouldDisplay).pipe(\n // unsubscribe from the observable if the change request for this node is received\n takeUntil(this.#changeRequest.pipe(filter(({ key, depth }) => depth === node.parentKeys.length && HierarchyNodeKey.equals(node.key, key)))),\n tap({\n subscribe: () => {\n this.#eventListener.suppressChangeEvents();\n this.#alwaysAndNeverDrawnElements.suppressChangeEvents();\n },\n finalize: () => {\n this.#eventListener.resumeChangeEvents();\n this.#alwaysAndNeverDrawnElements.resumeChangeEvents();\n },\n }),\n );\n\n return toVoidPromise(changeObservable);\n }\n\n public [Symbol.dispose]() {\n this.#eventListener[Symbol.dispose]();\n this.#alwaysAndNeverDrawnElements[Symbol.dispose]();\n this.#treeSpecificVisibilityHandler[Symbol.dispose]();\n }\n\n private getVisibilityStatusInternal(node: HierarchyNode) {\n if (HierarchyNode.isClassGroupingNode(node)) {\n if (node.extendedData?.hasDirectNonSearchTargets && !node.extendedData?.hasSearchTargetAncestor) {\n return this.getSearchResultsNodeVisibility({ node });\n }\n }\n\n if (HierarchyNode.isInstancesNode(node) && node.search?.childrenTargetPaths?.length && !node.search.isSearchTarget) {\n return this.getSearchResultsNodeVisibility({ node });\n }\n return this.#treeSpecificVisibilityHandler.getVisibilityStatus(node);\n }\n\n private changeVisibilityStatusInternal(node: HierarchyNode, on: boolean): Observable<void> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n if (node.extendedData?.hasDirectNonSearchTargets && !node.extendedData?.hasSearchTargetAncestor) {\n return this.changeSearchResultsNodeVisibility({ node, on });\n }\n }\n if (HierarchyNode.isInstancesNode(node) && node.search?.childrenTargetPaths?.length && !node.search.isSearchTarget) {\n return this.changeSearchResultsNodeVisibility({ node, on });\n }\n return this.#treeSpecificVisibilityHandler.changeVisibilityStatus(node, on);\n }\n\n private getSearchResultsNodeVisibility(props: {\n node: HierarchyNode & {\n key: ClassGroupingNodeKey | InstancesNodeKey;\n };\n }) {\n return this.getSearchResultsTreeTargets(props).pipe(\n mergeMap((targets) => {\n if (!targets) {\n return EMPTY;\n }\n return this.#treeSpecificVisibilityHandler.getSearchTargetsVisibilityStatus(targets);\n }),\n );\n }\n\n private getSearchResultsTreeTargets({\n node,\n }: {\n node: HierarchyNode & {\n key: ClassGroupingNodeKey | InstancesNodeKey;\n };\n }): Observable<TSearchTargets | undefined> {\n assert(this.#searchResultsTree !== undefined);\n return from(this.#searchResultsTree).pipe(map((searchResultsTree) => searchResultsTree.getSearchTargets(node)));\n }\n\n private changeSearchResultsNodeVisibility({\n on,\n node,\n }: {\n on: boolean;\n node: HierarchyNode & {\n key: ClassGroupingNodeKey | InstancesNodeKey;\n };\n }) {\n return this.getSearchResultsTreeTargets({ node }).pipe(\n mergeMap((targets) => {\n if (!targets) {\n return EMPTY;\n }\n return this.#treeSpecificVisibilityHandler.changeSearchTargetsVisibilityStatus(targets, on);\n }),\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UseCachedVisibility.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACrI,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,mCAAmC,EAAE,MAAM,kDAAkD,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAqC1F,gBAAgB;AAChB,MAAM,UAAU,mBAAmB,CAAyB,KAAuD;IACjH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAoC,SAAS,CAAC,CAAC;IAC7F,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,uBAAuB,EAAE,mCAAmC,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAElH,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,GAAG,QAAQ,CAAkD,GAAG,EAAE,CAC7H,8BAA8B,CAAC;QAC7B,UAAU;QACV,QAAQ;QACR,uBAAuB;QACvB,mCAAmC;QACnC,WA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AAC,CAAC,IAAI,CACpD,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC,8BAA8B,CAAC,mCAAmC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9F,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 { useCallback, useEffect, useState } from \"react\";\nimport { defaultIfEmpty, EMPTY, filter, firstValueFrom, from, fromEventPattern, map, mergeMap, Subject, takeUntil, tap } from \"rxjs\";\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { HierarchyVisibilityOverrideHandler } from \"../../UseHierarchyVisibility.js\";\nimport { AlwaysAndNeverDrawnElementInfoCache } from \"../caches/AlwaysAndNeverDrawnElementInfoCache.js\";\nimport { toVoidPromise } from \"../Rxjs.js\";\nimport { createVisibilityStatus } from \"../Tooltip.js\";\nimport { createVisibilityChangeEventListener } from \"../VisibilityChangeEventListener.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { ClassGroupingNodeKey, HierarchySearchPath, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { VisibilityTreeProps } from \"../../components/VisibilityTree.js\";\nimport type { TreeWidgetViewport } from \"../../TreeWidgetViewport.js\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../../UseHierarchyVisibility.js\";\nimport type { SearchResultsTree } from \"../visibility/BaseSearchResultsTree.js\";\nimport type { TreeSpecificVisibilityHandler } from \"../visibility/BaseVisibilityHelper.js\";\nimport type { IVisibilityChangeEventListener } from \"../VisibilityChangeEventListener.js\";\n\n/** @internal */\nexport interface CreateSearchResultsTreeProps<TCache> {\n idsCache: TCache;\n imodelAccess: ECClassHierarchyInspector;\n searchPaths: HierarchySearchPath[];\n}\n\n/** @internal */\nexport interface CreateTreeSpecificVisibilityHandlerProps<TCache> {\n info: AlwaysAndNeverDrawnElementInfoCache;\n idsCache: TCache;\n viewport: TreeWidgetViewport;\n overrideHandler: HierarchyVisibilityOverrideHandler;\n}\n\n/** @internal */\nexport interface UseCachedVisibilityProps<TCache, TSearchTargets> {\n componentId: GuidString;\n activeView: TreeWidgetViewport;\n idsCache: TCache;\n createSearchResultsTree: (props: CreateSearchResultsTreeProps<TCache>) => Promise<SearchResultsTree<TSearchTargets>>;\n createTreeSpecificVisibilityHandler: (props: CreateTreeSpecificVisibilityHandlerProps<TCache>) => TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;\n}\n\n/** @internal */\nexport function useCachedVisibility<TCache, TSearchTargets>(props: UseCachedVisibilityProps<TCache, TSearchTargets>) {\n const [searchPaths, setSearchPaths] = useState<HierarchySearchPath[] | undefined>(undefined);\n const { activeView, idsCache, createSearchResultsTree, createTreeSpecificVisibilityHandler, componentId } = props;\n\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState<VisibilityTreeProps[\"visibilityHandlerFactory\"]>(() =>\n createVisibilityHandlerFactory({\n activeView,\n idsCache,\n createSearchResultsTree,\n createTreeSpecificVisibilityHandler,\n searchPaths,\n componentId,\n }),\n );\n\n useEffect(() => {\n setVisibilityHandlerFactory(() =>\n createVisibilityHandlerFactory({\n activeView,\n idsCache,\n createSearchResultsTree,\n createTreeSpecificVisibilityHandler,\n searchPaths,\n componentId,\n }),\n );\n }, [activeView, idsCache, searchPaths, createSearchResultsTree, createTreeSpecificVisibilityHandler, componentId]);\n\n return {\n visibilityHandlerFactory,\n onSearchPathsChanged: useCallback((paths: HierarchySearchPath[] | undefined) => setSearchPaths(paths), []),\n searchPaths,\n };\n}\n\nfunction createVisibilityHandlerFactory<TCache, TSearchTargets>(\n props: UseCachedVisibilityProps<TCache, TSearchTargets> & {\n searchPaths: HierarchySearchPath[] | undefined;\n },\n): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n const { activeView, createSearchResultsTree, createTreeSpecificVisibilityHandler, idsCache, searchPaths, componentId } = props;\n return ({ imodelAccess }) =>\n new HierarchyVisibilityHandlerImpl<TSearchTargets>({\n componentId,\n viewport: activeView,\n getSearchResultsTree: (): Promise<SearchResultsTree<TSearchTargets>> | undefined => {\n if (searchPaths) {\n return createSearchResultsTree({ imodelAccess, searchPaths, idsCache });\n }\n return undefined;\n },\n getTreeSpecificVisibilityHandler: (info, overrideHandler) =>\n createTreeSpecificVisibilityHandler({\n info,\n idsCache,\n viewport: activeView,\n overrideHandler,\n }),\n });\n}\n\n/** @internal */\nexport interface HierarchyVisibilityHandlerImplProps<TSearchTargets> {\n viewport: TreeWidgetViewport;\n getTreeSpecificVisibilityHandler: (\n info: AlwaysAndNeverDrawnElementInfoCache,\n overrideHandler: HierarchyVisibilityOverrideHandler,\n ) => TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;\n getSearchResultsTree: () => Promise<SearchResultsTree<TSearchTargets>> | undefined;\n componentId?: GuidString;\n}\n\n/**\n * Class that handles visibility of hierarchy nodes in a tree.\n *\n * - It provides methods to get and change visibility status of nodes.\n * - Also handles filtered tree nodes visibility.\n * - Listens to visibility change events and updates visibility status accordingly.\n * @internal\n */\nexport class HierarchyVisibilityHandlerImpl<TSearchTargets> implements HierarchyVisibilityHandler, Disposable {\n readonly #props: HierarchyVisibilityHandlerImplProps<TSearchTargets>;\n readonly #eventListener: IVisibilityChangeEventListener;\n readonly #alwaysAndNeverDrawnElements: AlwaysAndNeverDrawnElementInfoCache;\n #treeSpecificVisibilityHandler: TreeSpecificVisibilityHandler<TSearchTargets> & Disposable;\n #changeRequest = new Subject<{ key: HierarchyNodeKey; depth: number }>();\n #searchResultsTree: Promise<SearchResultsTree<TSearchTargets>> | undefined;\n\n constructor(props: HierarchyVisibilityHandlerImplProps<TSearchTargets>) {\n this.#props = props;\n this.#eventListener = createVisibilityChangeEventListener({\n viewport: this.#props.viewport,\n listeners: {\n models: true,\n categories: true,\n elements: true,\n displayStyle: true,\n },\n });\n this.#searchResultsTree = this.#props.getSearchResultsTree();\n this.#alwaysAndNeverDrawnElements = new AlwaysAndNeverDrawnElementInfoCache({\n viewport: this.#props.viewport,\n componentId: props.componentId,\n });\n this.#treeSpecificVisibilityHandler = this.#props.getTreeSpecificVisibilityHandler(\n this.#alwaysAndNeverDrawnElements,\n new HierarchyVisibilityOverrideHandler(this),\n );\n }\n\n public get onVisibilityChange() {\n return this.#eventListener.onVisibilityChange;\n }\n\n public async getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> {\n return firstValueFrom(\n this.getVisibilityStatusInternal(node).pipe(\n // unsubscribe from the observable if the change request for this node is received\n takeUntil(this.#changeRequest.pipe(filter(({ key, depth }) => depth === node.parentKeys.length && HierarchyNodeKey.equals(node.key, key)))),\n // unsubscribe if visibility changes\n takeUntil(\n fromEventPattern(\n (handler) => {\n this.#eventListener.onVisibilityChange.addListener(handler);\n },\n (handler) => {\n this.#eventListener.onVisibilityChange.removeListener(handler);\n },\n ),\n ),\n defaultIfEmpty(createVisibilityStatus(\"disabled\")),\n ),\n );\n }\n\n public async changeVisibility(node: HierarchyNode, shouldDisplay: boolean): Promise<void> {\n // notify about new change request\n this.#changeRequest.next({ key: node.key, depth: node.parentKeys.length });\n\n const changeObservable = this.changeVisibilityStatusInternal(node, shouldDisplay).pipe(\n // unsubscribe from the observable if the change request for this node is received\n takeUntil(this.#changeRequest.pipe(filter(({ key, depth }) => depth === node.parentKeys.length && HierarchyNodeKey.equals(node.key, key)))),\n tap({\n subscribe: () => {\n this.#eventListener.suppressChangeEvents();\n this.#alwaysAndNeverDrawnElements.suppressChangeEvents();\n },\n finalize: () => {\n this.#eventListener.resumeChangeEvents();\n this.#alwaysAndNeverDrawnElements.resumeChangeEvents();\n },\n }),\n );\n\n return toVoidPromise(changeObservable);\n }\n\n public [Symbol.dispose]() {\n this.#eventListener[Symbol.dispose]();\n this.#alwaysAndNeverDrawnElements[Symbol.dispose]();\n this.#treeSpecificVisibilityHandler[Symbol.dispose]();\n }\n\n private getVisibilityStatusInternal(node: HierarchyNode) {\n if (HierarchyNode.isClassGroupingNode(node)) {\n if (node.extendedData?.hasDirectNonSearchTargets && !node.extendedData?.hasSearchTargetAncestor) {\n return this.getSearchResultsNodeVisibility({ node });\n }\n }\n\n if (\n HierarchyNode.isInstancesNode(node) &&\n node.search?.childrenTargetPaths?.length &&\n !node.search.isSearchTarget &&\n !node.search.hasSearchTargetAncestor\n ) {\n return this.getSearchResultsNodeVisibility({ node });\n }\n return this.#treeSpecificVisibilityHandler.getVisibilityStatus(node);\n }\n\n private changeVisibilityStatusInternal(node: HierarchyNode, on: boolean): Observable<void> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n if (node.extendedData?.hasDirectNonSearchTargets && !node.extendedData?.hasSearchTargetAncestor) {\n return this.changeSearchResultsNodeVisibility({ node, on });\n }\n }\n if (\n HierarchyNode.isInstancesNode(node) &&\n node.search?.childrenTargetPaths?.length &&\n !node.search.isSearchTarget &&\n !node.search.hasSearchTargetAncestor\n ) {\n return this.changeSearchResultsNodeVisibility({ node, on });\n }\n return this.#treeSpecificVisibilityHandler.changeVisibilityStatus(node, on);\n }\n\n private getSearchResultsNodeVisibility(props: {\n node: HierarchyNode & {\n key: ClassGroupingNodeKey | InstancesNodeKey;\n };\n }) {\n return this.getSearchResultsTreeTargets(props).pipe(\n mergeMap((targets) => {\n if (!targets) {\n return EMPTY;\n }\n return this.#treeSpecificVisibilityHandler.getSearchTargetsVisibilityStatus(targets, props.node);\n }),\n );\n }\n\n private getSearchResultsTreeTargets({\n node,\n }: {\n node: HierarchyNode & {\n key: ClassGroupingNodeKey | InstancesNodeKey;\n };\n }): Observable<TSearchTargets | undefined> {\n // There can be cases where search paths used to exist and are removed, search results tree becomes undefined,\n // but visibility is re-requested for old nodes (have search paths).\n // In such cases return EMPTY.\n return this.#searchResultsTree ? from(this.#searchResultsTree).pipe(map((searchResultsTree) => searchResultsTree.getSearchTargets(node))) : EMPTY;\n }\n\n private changeSearchResultsNodeVisibility({\n on,\n node,\n }: {\n on: boolean;\n node: HierarchyNode & {\n key: ClassGroupingNodeKey | InstancesNodeKey;\n };\n }) {\n return this.getSearchResultsTreeTargets({ node }).pipe(\n mergeMap((targets) => {\n if (!targets) {\n return EMPTY;\n }\n return this.#treeSpecificVisibilityHandler.changeSearchTargetsVisibilityStatus(targets, on);\n }),\n );\n }\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import type { GuidString } from "@itwin/core-bentley";
|
|
2
1
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
type CacheKey = string;
|
|
3
3
|
/** @internal */
|
|
4
|
-
export interface
|
|
4
|
+
export interface GetCacheProps<TCache> {
|
|
5
|
+
createCache: () => TCache;
|
|
6
|
+
cacheKey: CacheKey;
|
|
5
7
|
imodel: IModelConnection;
|
|
6
|
-
specificProps: TCacheSpecificProps;
|
|
7
|
-
componentId: GuidString;
|
|
8
8
|
}
|
|
9
9
|
/** @internal */
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
createCache: (props: CreateCacheProps<TCacheSpecificProps>) => TCache;
|
|
13
|
-
cacheSpecificProps: TCacheSpecificProps;
|
|
14
|
-
componentId: GuidString;
|
|
15
|
-
}
|
|
16
|
-
/** @internal */
|
|
17
|
-
export declare function useIdsCache<TCache extends Disposable, TCacheSpecificProps extends object>(props: UseIdsCacheProps<TCache, TCacheSpecificProps>): {
|
|
18
|
-
getCache: () => TCache;
|
|
10
|
+
export declare function useIdsCache(): {
|
|
11
|
+
getCache: <TCache extends Disposable>(createCacheProps: GetCacheProps<TCache>) => TCache;
|
|
19
12
|
};
|
|
13
|
+
export {};
|
|
20
14
|
//# sourceMappingURL=UseIdsCache.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js
CHANGED
|
@@ -2,43 +2,44 @@
|
|
|
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 { useCallback,
|
|
6
|
-
import {
|
|
5
|
+
import { useCallback, useRef, useState } from "react";
|
|
6
|
+
import { registerTxnListeners } from "@itwin/presentation-core-interop";
|
|
7
7
|
/** @internal */
|
|
8
|
-
export function useIdsCache(
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
export function useIdsCache() {
|
|
9
|
+
const state = useRef({});
|
|
10
|
+
const [forceRerender, setForceRerender] = useState({});
|
|
11
|
+
const getCache = useCallback(({ createCache, cacheKey, imodel }) => {
|
|
12
|
+
const imodelCaches = state.current[imodel.key];
|
|
13
|
+
if (imodelCaches && imodelCaches[cacheKey]) {
|
|
14
|
+
return imodelCaches[cacheKey];
|
|
15
|
+
}
|
|
16
|
+
// Create the cache before adding event listeners, to avoid race conditions
|
|
17
|
+
const cache = createCache();
|
|
18
|
+
state.current = { ...state.current, [imodel.key]: { ...state.current[imodel.key], [cacheKey]: cache } };
|
|
19
|
+
if (!imodelCaches) {
|
|
20
|
+
let listener;
|
|
21
|
+
if (imodel.isBriefcaseConnection()) {
|
|
22
|
+
listener = registerTxnListeners(imodel.txns, () => {
|
|
23
|
+
for (const cacheToDispose of Object.values(state.current[imodel.key])) {
|
|
24
|
+
cacheToDispose[Symbol.dispose]();
|
|
25
|
+
}
|
|
26
|
+
state.current[imodel.key] = {};
|
|
27
|
+
setForceRerender({});
|
|
28
|
+
});
|
|
19
29
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [imodel, cacheSpecificProps, props.componentId]);
|
|
34
|
-
useIModelChangeListener({
|
|
35
|
-
imodel,
|
|
36
|
-
action: useCallback(() => {
|
|
37
|
-
clearCacheRef.current();
|
|
38
|
-
// make sure all cache users rerender
|
|
39
|
-
setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));
|
|
40
|
-
}, [imodel, cacheSpecificProps, props.componentId]),
|
|
41
|
-
});
|
|
30
|
+
imodel.onClose.addOnce(() => {
|
|
31
|
+
for (const cacheToDispose of Object.values(state.current[imodel.key])) {
|
|
32
|
+
cacheToDispose[Symbol.dispose]();
|
|
33
|
+
}
|
|
34
|
+
delete state.current[imodel.key];
|
|
35
|
+
listener?.();
|
|
36
|
+
setForceRerender({});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return cache;
|
|
40
|
+
},
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
[forceRerender]);
|
|
42
43
|
return {
|
|
43
44
|
getCache,
|
|
44
45
|
};
|
package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseIdsCache.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"UseIdsCache.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAE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,CAAC;oBACnC,CAAC;oBACD,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;oBAC/B,gBAAgB,CAAC,EAAE,CAAC,CAAC;gBACvB,CAAC,CAAC,CAAC;YACL,CAAC;YACD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC1B,KAAK,MAAM,cAAc,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;oBACtE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnC,CAAC;gBACD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjC,QAAQ,EAAE,EAAE,CAAC;gBACb,gBAAgB,CAAC,EAAE,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uDAAuD;IACvD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,OAAO;QACL,QAAQ;KACT,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 { useCallback, useRef, useState } from \"react\";\nimport { registerTxnListeners } from \"@itwin/presentation-core-interop\";\n\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\ntype IModelKey = string;\ntype CacheKey = string;\n\n/** @internal */\nexport interface GetCacheProps<TCache> {\n createCache: () => TCache;\n cacheKey: CacheKey;\n imodel: IModelConnection;\n}\n\n/** @internal */\nexport function useIdsCache(): {\n getCache: <TCache extends Disposable>(createCacheProps: GetCacheProps<TCache>) => TCache;\n} {\n const state = useRef<Record<IModelKey, Record<CacheKey, Disposable>>>({});\n const [forceRerender, setForceRerender] = useState({});\n const getCache = useCallback(\n <TCache extends Disposable>({ createCache, cacheKey, imodel }: GetCacheProps<TCache>) => {\n const imodelCaches = state.current[imodel.key];\n if (imodelCaches && imodelCaches[cacheKey]) {\n return imodelCaches[cacheKey] as TCache;\n }\n\n // Create the cache before adding event listeners, to avoid race conditions\n const cache = createCache();\n state.current = { ...state.current, [imodel.key]: { ...state.current[imodel.key], [cacheKey]: cache } };\n\n if (!imodelCaches) {\n let listener: undefined | (() => void);\n if (imodel.isBriefcaseConnection()) {\n listener = registerTxnListeners(imodel.txns, () => {\n for (const cacheToDispose of Object.values(state.current[imodel.key])) {\n cacheToDispose[Symbol.dispose]();\n }\n state.current[imodel.key] = {};\n setForceRerender({});\n });\n }\n imodel.onClose.addOnce(() => {\n for (const cacheToDispose of Object.values(state.current[imodel.key])) {\n cacheToDispose[Symbol.dispose]();\n }\n delete state.current[imodel.key];\n listener?.();\n setForceRerender({});\n });\n }\n return cache;\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [forceRerender],\n );\n\n return {\n getCache,\n };\n}\n"]}
|
|
@@ -13,6 +13,15 @@ export type SearchResultsTreeNodeChildren<TSearchResultsTreeNode> = Map<Id64Stri
|
|
|
13
13
|
export interface SearchResultsTreeRootNode<TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>> {
|
|
14
14
|
children: SearchResultsTreeNodeChildren<TSearchResultsTreeNode>;
|
|
15
15
|
}
|
|
16
|
+
type SearchResultsNodeType = string;
|
|
17
|
+
type SearchResultsNodeId = Id64String;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export interface SearchResultsNodeIdentifier {
|
|
20
|
+
type: SearchResultsNodeType;
|
|
21
|
+
id: SearchResultsNodeId;
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
24
|
+
export type SearchResultsNodeIdentifierAsString = `${SearchResultsNodeType}-${SearchResultsNodeId}`;
|
|
16
25
|
/**
|
|
17
26
|
* A generic interface for a search results tree node.
|
|
18
27
|
*
|
|
@@ -24,6 +33,8 @@ export interface BaseSearchResultsTreeNode<TSearchResultsTreeNode extends BaseSe
|
|
|
24
33
|
id: Id64String;
|
|
25
34
|
children?: SearchResultsTreeNodeChildren<TSearchResultsTreeNode>;
|
|
26
35
|
isSearchTarget: boolean;
|
|
36
|
+
/** Represents the path from the root to this node. It depends on the hierarchy structure. */
|
|
37
|
+
pathToNode: Array<SearchResultsNodeIdentifier>;
|
|
27
38
|
}
|
|
28
39
|
/**
|
|
29
40
|
* Class that provides methods to handle search results nodes in a tree structure.
|
|
@@ -38,6 +49,8 @@ export declare abstract class SearchResultsNodesHandler<TProcessedSearchResultsN
|
|
|
38
49
|
readonly searchResultsNodesArr: TSearchResultsTreeNode[];
|
|
39
50
|
/** Returns search results tree node type based on its' className */
|
|
40
51
|
abstract getType(className: string): Promise<TSearchResultsTreeNode["type"]>;
|
|
52
|
+
/** Returns search results tree node className based on its' type */
|
|
53
|
+
abstract getClassName(type: TSearchResultsTreeNode["type"]): string;
|
|
41
54
|
/** Converts nodes to search targets */
|
|
42
55
|
abstract convertNodesToSearchTargets(searchResultsNodes: TSearchResultsTreeNode[], processedSearchResultsNodes: TProcessedSearchResultsNodes): TSearchTargets | undefined;
|
|
43
56
|
/**
|
|
@@ -61,6 +74,10 @@ export declare abstract class SearchResultsNodesHandler<TProcessedSearchResultsN
|
|
|
61
74
|
key: ClassGroupingNodeKey | InstancesNodeKey;
|
|
62
75
|
}) => TSearchTargets | undefined;
|
|
63
76
|
}>;
|
|
77
|
+
/** Converts a search results node identifier to a string representation. */
|
|
78
|
+
convertSearchResultsNodeIdentifierToString(identifier: SearchResultsNodeIdentifier): SearchResultsNodeIdentifierAsString;
|
|
79
|
+
/** Converts a string representation of a search results node identifier back to a hierarchy node identifier. */
|
|
80
|
+
convertSearchResultsNodeIdentifierStringToHierarchyNodeIdentifier(identifier: SearchResultsNodeIdentifierAsString): InstanceKey;
|
|
64
81
|
/** Takes a new node and adds it to the tree structure. */
|
|
65
82
|
accept(props: {
|
|
66
83
|
instanceKey: InstanceKey;
|
|
@@ -88,4 +105,5 @@ export interface CreateSearchResultsTreeProps<TProcessedSearchResultsNodes, TSea
|
|
|
88
105
|
* @internal
|
|
89
106
|
*/
|
|
90
107
|
export declare function createSearchResultsTree<TProcessedSearchResultsNodes, TSearchTargets, TSearchResultsTreeNode extends BaseSearchResultsTreeNode<TSearchResultsTreeNode>>(props: CreateSearchResultsTreeProps<TProcessedSearchResultsNodes, TSearchTargets, TSearchResultsTreeNode>): Promise<SearchResultsTree<TSearchTargets>>;
|
|
108
|
+
export {};
|
|
91
109
|
//# sourceMappingURL=BaseSearchResultsTree.d.ts.map
|
|
@@ -23,6 +23,15 @@ export class SearchResultsNodesHandler {
|
|
|
23
23
|
getNodeSearchTargets: (node) => this.getNodeSearchTargets(node, processedSearchResultsNodes),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
/** Converts a search results node identifier to a string representation. */
|
|
27
|
+
convertSearchResultsNodeIdentifierToString(identifier) {
|
|
28
|
+
return `${identifier.type}-${identifier.id}`;
|
|
29
|
+
}
|
|
30
|
+
/** Converts a string representation of a search results node identifier back to a hierarchy node identifier. */
|
|
31
|
+
convertSearchResultsNodeIdentifierStringToHierarchyNodeIdentifier(identifier) {
|
|
32
|
+
const [type, id] = identifier.split("-");
|
|
33
|
+
return { className: this.getClassName(type), id };
|
|
34
|
+
}
|
|
26
35
|
/** Takes a new node and adds it to the tree structure. */
|
|
27
36
|
async accept(props) {
|
|
28
37
|
const { instanceKey, parentNode, isSearchTarget } = props;
|
|
@@ -81,7 +90,11 @@ export class SearchResultsNodesHandler {
|
|
|
81
90
|
*/
|
|
82
91
|
export async function createSearchResultsTree(props) {
|
|
83
92
|
const { searchPaths, searchResultsNodesHandler } = props;
|
|
84
|
-
|
|
93
|
+
// Sort search paths by their length, this ensures that nodes which have search target ancestors, and are search targets, won't be included in the
|
|
94
|
+
// search results tree. Search results tree is only needed to find which nodes might have children missing. Since nodes which have search target ancestors
|
|
95
|
+
// always have all children, they can be skipped.
|
|
96
|
+
const sortedSearchPaths = searchPaths.sort((lhs, rhs) => HierarchySearchPath.normalize(lhs).path.length - HierarchySearchPath.normalize(rhs).path.length);
|
|
97
|
+
for (const searchPath of sortedSearchPaths) {
|
|
85
98
|
const normalizedPath = HierarchySearchPath.normalize(searchPath).path;
|
|
86
99
|
let parentNode = searchResultsNodesHandler.root;
|
|
87
100
|
for (let i = 0; i < normalizedPath.length; ++i) {
|