@itwin/tree-widget-react 4.0.0-alpha.22 → 4.0.0-alpha.23

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.
Files changed (129) hide show
  1. package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.d.ts +1 -1
  2. package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js +1 -1
  3. package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js.map +1 -1
  4. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +1 -1
  5. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +2 -2
  6. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  7. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +2 -2
  8. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +3 -3
  9. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  10. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -2
  11. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +11 -11
  12. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  13. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +3 -3
  14. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +25 -25
  15. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  16. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +2 -2
  17. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +23 -39
  18. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  19. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/{UseFilteredPaths.d.ts → UseSearchPaths.d.ts} +8 -8
  20. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/{UseFilteredPaths.js → UseSearchPaths.js} +21 -21
  21. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js.map +1 -0
  22. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +7 -7
  23. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +11 -11
  24. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -1
  25. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +2 -2
  26. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -1
  27. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/{FilteredTree.d.ts → SearchResultsTree.d.ts} +8 -8
  28. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/{FilteredTree.js → SearchResultsTree.js} +62 -62
  29. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js.map +1 -0
  30. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.d.ts +1 -1
  31. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js +2 -2
  32. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js.map +1 -1
  33. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +1 -1
  34. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +2 -2
  35. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -1
  36. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.d.ts +2 -2
  37. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +7 -7
  38. package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -1
  39. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +3 -3
  40. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +25 -25
  41. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -1
  42. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +4 -4
  43. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +2 -2
  44. package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -1
  45. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +4 -1
  46. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +36 -1
  47. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -1
  48. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.d.ts +20 -0
  49. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/{UseFilteredPaths.js → UseSearchPaths.js} +19 -19
  50. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js.map +1 -0
  51. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +4 -4
  52. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +8 -8
  53. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -1
  54. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/{FilteredTree.d.ts → SearchResultsTree.d.ts} +9 -9
  55. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js +168 -0
  56. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js.map +1 -0
  57. package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.d.ts +2 -2
  58. package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js +3 -3
  59. package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js.map +1 -1
  60. package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -1
  61. package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +1 -1
  62. package/lib/esm/tree-widget-react/components/trees/common/Utils.d.ts +3 -3
  63. package/lib/esm/tree-widget-react/components/trees/common/Utils.js +17 -17
  64. package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
  65. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +1 -1
  66. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.d.ts +6 -6
  67. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js +11 -11
  68. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js.map +1 -1
  69. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +1 -1
  70. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
  71. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +2 -2
  72. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +2 -2
  73. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  74. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +21 -5
  75. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +24 -8
  76. package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -1
  77. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +1 -6
  78. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +4 -11
  79. package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -1
  80. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +18 -18
  81. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +32 -32
  82. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -1
  83. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.d.ts +91 -0
  84. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js +112 -0
  85. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js.map +1 -0
  86. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +6 -10
  87. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +27 -15
  88. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -1
  89. package/lib/esm/tree-widget-react/components/trees/index.d.ts +1 -1
  90. package/lib/esm/tree-widget-react/components/trees/index.js +1 -1
  91. package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
  92. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -1
  93. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +3 -3
  94. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  95. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -1
  96. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +5 -5
  97. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  98. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +2 -2
  99. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +12 -12
  100. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  101. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +29 -29
  102. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +26 -26
  103. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  104. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +4 -1
  105. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +36 -1
  106. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  107. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.d.ts +41 -0
  108. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/{UseFilteredPaths.js → UseSearchPaths.js} +47 -47
  109. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js.map +1 -0
  110. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +7 -7
  111. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +11 -11
  112. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -1
  113. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/{FilteredTree.d.ts → SearchResultsTree.d.ts} +8 -8
  114. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/{FilteredTree.js → SearchResultsTree.js} +43 -43
  115. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js.map +1 -0
  116. package/lib/public/locales/en/TreeWidget.json +13 -13
  117. package/package.json +7 -7
  118. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js.map +0 -1
  119. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js.map +0 -1
  120. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.d.ts +0 -20
  121. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js.map +0 -1
  122. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js +0 -168
  123. package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js.map +0 -1
  124. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.d.ts +0 -91
  125. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js +0 -112
  126. package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js.map +0 -1
  127. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.d.ts +0 -41
  128. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js.map +0 -1
  129. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js.map +0 -1
@@ -7,11 +7,11 @@ import { assert, Id64 } from "@itwin/core-bentley";
7
7
  import { HierarchyNode } from "@itwin/presentation-hierarchies";
8
8
  import { createVisibilityStatus } from "../../../common/internal/Tooltip.js";
9
9
  import { HierarchyVisibilityHandlerImpl } from "../../../common/internal/useTreeHooks/UseCachedVisibility.js";
10
- import { getClassesByView, releaseMainThreadOnItemsCount } from "../../../common/internal/Utils.js";
10
+ import { fromWithRelease, getClassesByView } from "../../../common/internal/Utils.js";
11
11
  import { mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
12
12
  import { CategoriesTreeNode } from "../CategoriesTreeNode.js";
13
13
  import { CategoriesTreeVisibilityHelper } from "./CategoriesTreeVisibilityHelper.js";
14
- import { createFilteredCategoriesTree } from "./FilteredTree.js";
14
+ import { createCategoriesSearchResultsTree } from "./SearchResultsTree.js";
15
15
  /**
16
16
  * Handles visibility status of categories tree nodes.
17
17
  *
@@ -51,7 +51,7 @@ export class CategoriesTreeVisibilityHandler {
51
51
  [Symbol.dispose]() {
52
52
  this.#visibilityHelper[Symbol.dispose]();
53
53
  }
54
- changeFilterTargetsVisibilityStatus(targets, on) {
54
+ changeSearchTargetsVisibilityStatus(targets, on) {
55
55
  return defer(() => {
56
56
  const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;
57
57
  const observables = new Array();
@@ -68,7 +68,7 @@ export class CategoriesTreeVisibilityHandler {
68
68
  observables.push(from(subCategories).pipe(mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.changeSubCategoriesVisibilityStatus({ subCategoryIds, categoryId, on }))));
69
69
  }
70
70
  if (elements?.length) {
71
- observables.push(from(elements).pipe(releaseMainThreadOnItemsCount(50), mergeMap(({ modelId, elements: elementsMap, categoryId }) => this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], on }))));
71
+ observables.push(fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, elements: elementsMap, categoryId }) => this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], on }))));
72
72
  }
73
73
  return merge(...observables);
74
74
  });
@@ -180,7 +180,7 @@ export class CategoriesTreeVisibilityHandler {
180
180
  }
181
181
  return changeObs;
182
182
  }
183
- getFilterTargetsVisibilityStatus(targets) {
183
+ getSearchTargetsVisibilityStatus(targets) {
184
184
  return defer(() => {
185
185
  const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;
186
186
  const observables = new Array();
@@ -201,7 +201,7 @@ export class CategoriesTreeVisibilityHandler {
201
201
  observables.push(from(subCategories).pipe(mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.getSubCategoriesVisibilityStatus({ subCategoryIds, categoryId }))));
202
202
  }
203
203
  if (elements?.length) {
204
- observables.push(from(elements).pipe(releaseMainThreadOnItemsCount(50), mergeMap(({ modelId, elements: elementsMap, categoryId }) => this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], type: this.#elementType }))));
204
+ observables.push(fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(mergeMap(({ modelId, elements: elementsMap, categoryId }) => this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], type: this.#elementType }))));
205
205
  }
206
206
  return merge(...observables);
207
207
  }).pipe(mergeVisibilityStatuses);
@@ -227,7 +227,7 @@ export class CategoriesTreeVisibilityHandler {
227
227
  return this.#props.idsCache.getCategoriesElementModels(props.categoryIds, true);
228
228
  }
229
229
  getSubCategories(props) {
230
- return from(Id64.iterable(props.categoryIds)).pipe(mergeMap((categoryId) => this.#props.idsCache.getSubCategories(categoryId).pipe(mergeMap((categorySubCategoriesMap) => (categorySubCategoriesMap.size > 0 ? categorySubCategoriesMap.values() : of(undefined))), map((subCategories) => ({ id: categoryId, subCategories })))));
230
+ return this.#props.idsCache.getSubCategories(props.categoryId);
231
231
  }
232
232
  getSubModels(props) {
233
233
  if ("modelIds" in props) {
@@ -261,14 +261,14 @@ export class CategoriesTreeVisibilityHandler {
261
261
  */
262
262
  export function createCategoriesTreeVisibilityHandler(props) {
263
263
  return new HierarchyVisibilityHandlerImpl({
264
- getFilteredTree: () => {
265
- if (!props.filteredPaths) {
264
+ getSearchResultsTree: () => {
265
+ if (!props.searchPaths) {
266
266
  return undefined;
267
267
  }
268
268
  const { categoryClass, elementClass, modelClass } = getClassesByView(props.viewport.viewType === "2d" ? "2d" : "3d");
269
- return createFilteredCategoriesTree({
269
+ return createCategoriesSearchResultsTree({
270
270
  idsCache: props.idsCache,
271
- filteringPaths: props.filteredPaths,
271
+ searchPaths: props.searchPaths,
272
272
  imodelAccess: props.imodelAccess,
273
273
  categoryClassName: categoryClass,
274
274
  categoryElementClassName: elementClass,
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-wid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O,IAAI,8BAA8B,CAA8B;QACrE,eAAe,EAAE,GAAmE,EAAE;YACpF,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gBACzB,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACrH,OAAO,4BAA4B,CAAC;gBAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,cAAc,EAAE,KAAK,CAAC,aAAa;gBACnC,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,iBAAiB,EAAE,aAAa;gBAChC,wBAAwB,EAAE,YAAY;gBACtC,sBAAsB,EAAE,UAAU;aACnC,CAAC,CAAC;QACL,CAAC;QACD,gCAAgC,EAAE,CAAC,IAAI,EAAE,EAAE;YACzC,OAAO,IAAI,+BAA+B,CAAC;gBACzC,8BAA8B,EAAE,IAAI;gBACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,eAAe,EAAE,KAAK,CAAC,eAAe;aACvC,CAAC,CAAC;QACL,CAAC;QACD,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,MAAM;KACpB,CAAC,CAAC;AACL,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 { concat, defer, EMPTY, from, map, merge, mergeMap, of } from \"rxjs\";\nimport { assert, Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { HierarchyVisibilityHandlerImpl } from \"../../../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport { getClassesByView, releaseMainThreadOnItemsCount } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { CategoriesTreeNode } from \"../CategoriesTreeNode.js\";\nimport { CategoriesTreeVisibilityHelper } from \"./CategoriesTreeVisibilityHelper.js\";\nimport { createFilteredCategoriesTree } from \"./FilteredTree.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GroupingHierarchyNode, HierarchyFilteringPath } from \"@itwin/presentation-hierarchies\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { AlwaysAndNeverDrawnElementInfo } from \"../../../common/internal/AlwaysAndNeverDrawnElementInfo.js\";\nimport type { ElementId, ModelId } from \"../../../common/internal/Types.js\";\nimport type { FilteredTree } from \"../../../common/internal/visibility/BaseFilteredTree.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 { CategoriesTreeHierarchyConfiguration } from \"../../CategoriesTreeDefinition.js\";\nimport type { CategoriesTreeIdsCache } from \"../CategoriesTreeIdsCache.js\";\nimport type { CategoriesTreeFilterTargets } from \"./FilteredTree.js\";\n\n/** @internal */\nexport interface CategoriesTreeVisibilityHandlerProps {\n idsCache: CategoriesTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;\n hierarchyConfig: CategoriesTreeHierarchyConfiguration;\n}\n\n/**\n * Handles visibility status of categories 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 CategoriesTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<CategoriesTreeFilterTargets> {\n readonly #props: CategoriesTreeVisibilityHandlerProps;\n #visibilityHelper: CategoriesTreeVisibilityHelper;\n #elementType: \"GeometricElement3d\" | \"GeometricElement2d\";\n #categoryType: \"DrawingCategory\" | \"SpatialCategory\";\n #modelType: \"GeometricModel3d\" | \"GeometricModel2d\";\n constructor(constructorProps: CategoriesTreeVisibilityHandlerProps) {\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 CategoriesTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n baseIdsCache,\n hierarchyConfig: constructorProps.hierarchyConfig,\n });\n\n this.#elementType = this.#props.viewport.viewType === \"2d\" ? \"GeometricElement2d\" : \"GeometricElement3d\";\n this.#categoryType = this.#props.viewport.viewType === \"2d\" ? \"DrawingCategory\" : \"SpatialCategory\";\n this.#modelType = this.#props.viewport.viewType === \"2d\" ? \"GeometricModel2d\" : \"GeometricModel3d\";\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeFilterTargetsVisibilityStatus(targets: CategoriesTreeFilterTargets, on: boolean): Observable<void> {\n return defer(() => {\n const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<void>>();\n if (definitionContainerIds?.size) {\n observables.push(this.#visibilityHelper.changeDefinitionContainersVisibilityStatus({ definitionContainerIds, on }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds, on }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(mergeMap(({ modelId, categoryIds }) => this.#visibilityHelper.changeCategoriesVisibilityStatus({ categoryIds, modelId, on }))),\n );\n }\n\n if (subCategories?.length) {\n observables.push(\n from(subCategories).pipe(\n mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.changeSubCategoriesVisibilityStatus({ subCategoryIds, categoryId, on })),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n from(elements).pipe(\n releaseMainThreadOnItemsCount(50),\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], on }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n });\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n const nodeInfo = this.getGroupingNodeInfo(node);\n return this.#visibilityHelper.getGroupedElementsVisibilityStatus({ categoryId: nodeInfo.categoryId, modelElementsMap: nodeInfo.modelElementsMap });\n }\n\n if (!HierarchyNode.isInstancesNode(node)) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.#visibilityHelper.getDefinitionContainersVisibilityStatus({\n definitionContainerIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n if (CategoriesTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.getModelsVisibilityStatus({\n modelIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n type: this.#modelType,\n });\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: CategoriesTreeNode.getModelId(node),\n type: this.#categoryType,\n });\n }\n\n const categoryId = CategoriesTreeNode.getCategoryId(node);\n if (!categoryId) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.#visibilityHelper.getSubCategoriesVisibilityStatus({\n categoryId,\n subCategoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n const modelId = CategoriesTreeNode.getModelId(node);\n if (!modelId) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId,\n categoryId,\n type: this.#elementType,\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 (HierarchyNode.isClassGroupingNode(node)) {\n const nodeInfo = this.getGroupingNodeInfo(node);\n return this.#visibilityHelper.changeGroupedElementsVisibilityStatus({\n categoryId: nodeInfo.categoryId,\n modelElementsMap: nodeInfo.modelElementsMap,\n on,\n });\n }\n\n if (!HierarchyNode.isInstancesNode(node)) {\n return EMPTY;\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.#visibilityHelper.changeDefinitionContainersVisibilityStatus({\n definitionContainerIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n if (CategoriesTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.changeModelsVisibilityStatus({\n modelIds: node.key.instanceKeys.map(({ id }) => id),\n on,\n });\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.changeCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: CategoriesTreeNode.getModelId(node),\n on,\n });\n }\n\n const categoryId = CategoriesTreeNode.getCategoryId(node);\n if (!categoryId) {\n return EMPTY;\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.#visibilityHelper.changeSubCategoriesVisibilityStatus({\n categoryId,\n subCategoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n const modelId = CategoriesTreeNode.getModelId(node);\n if (!modelId) {\n return EMPTY;\n }\n\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId,\n categoryId,\n on,\n });\n });\n\n if (this.#props.viewport.isAlwaysDrawnExclusive) {\n return concat(this.#visibilityHelper.removeAlwaysDrawnExclusive(), changeObs);\n }\n return changeObs;\n }\n\n public getFilterTargetsVisibilityStatus(targets: CategoriesTreeFilterTargets): Observable<VisibilityStatus> {\n return defer(() => {\n const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (definitionContainerIds?.size) {\n observables.push(this.#visibilityHelper.getDefinitionContainersVisibilityStatus({ definitionContainerIds }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.getModelsVisibilityStatus({ modelIds, type: this.#modelType }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(\n mergeMap(({ modelId, categoryIds }) =>\n this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds,\n modelId,\n type: this.#categoryType,\n }),\n ),\n ),\n );\n }\n\n if (subCategories?.length) {\n observables.push(\n from(subCategories).pipe(\n mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.getSubCategoriesVisibilityStatus({ subCategoryIds, categoryId })),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n from(elements).pipe(\n releaseMainThreadOnItemsCount(50),\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], type: this.#elementType }),\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.getModelCategoryIds(modelId).pipe(\n map((categories) => ({\n id: modelId,\n ...(this.#props.viewport.viewType === \"2d\" ? { drawingCategories: categories } : { spatialCategories: categories }),\n })),\n ),\n ),\n );\n }\n\n private getAllCategories(): ReturnType<BaseIdsCache[\"getAllCategories\"]> {\n return this.#props.idsCache.getAllCategories().pipe(\n map((categories) => {\n if (this.#props.viewport.viewType === \"2d\") {\n return { drawingCategories: categories };\n }\n return { spatialCategories: categories };\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 from(Id64.iterable(props.categoryIds)).pipe(\n mergeMap((categoryId) =>\n this.#props.idsCache.getSubCategories(categoryId).pipe(\n mergeMap((categorySubCategoriesMap) => (categorySubCategoriesMap.size > 0 ? categorySubCategoriesMap.values() : of(undefined))),\n map((subCategories) => ({ id: categoryId, subCategories })),\n ),\n ),\n );\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 this.#props.idsCache.getModelCategoryIds(modelId).pipe(\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 private getGroupingNodeInfo(node: GroupingHierarchyNode) {\n const modelElementsMap: Map<ModelId, Set<ElementId>> = node.extendedData?.modelElementsMap;\n const categoryId = node.extendedData?.categoryId;\n assert(!!modelElementsMap && !!categoryId);\n\n return { modelElementsMap, categoryId };\n }\n}\n\n/**\n * Creates categories tree visibility handler. Is used by integration and performance tests.\n * @internal\n */\nexport function createCategoriesTreeVisibilityHandler(props: {\n viewport: TreeWidgetViewport;\n idsCache: CategoriesTreeIdsCache;\n imodelAccess: ECClassHierarchyInspector;\n filteredPaths?: HierarchyFilteringPath[];\n hierarchyConfig: CategoriesTreeHierarchyConfiguration;\n}) {\n return new HierarchyVisibilityHandlerImpl<CategoriesTreeFilterTargets>({\n getFilteredTree: (): undefined | Promise<FilteredTree<CategoriesTreeFilterTargets>> => {\n if (!props.filteredPaths) {\n return undefined;\n }\n const { categoryClass, elementClass, modelClass } = getClassesByView(props.viewport.viewType === \"2d\" ? \"2d\" : \"3d\");\n return createFilteredCategoriesTree({\n idsCache: props.idsCache,\n filteringPaths: props.filteredPaths,\n imodelAccess: props.imodelAccess,\n categoryClassName: categoryClass,\n categoryElementClassName: elementClass,\n categoryModelClassName: modelClass,\n });\n },\n getTreeSpecificVisibilityHandler: (info) => {\n return new CategoriesTreeVisibilityHandler({\n alwaysAndNeverDrawnElementInfo: info,\n idsCache: props.idsCache,\n viewport: props.viewport,\n hierarchyConfig: props.hierarchyConfig,\n });\n },\n viewport: props.viewport,\n componentId: \"Test\",\n });\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,8DAA8D,CAAC;AAC9G,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAuB3E;;;;;GAKG;AACH,MAAM,OAAO,+BAA+B;IACjC,MAAM,CAAuC;IACtD,iBAAiB,CAAiC;IAClD,YAAY,CAA8C;IAC1D,aAAa,CAAwC;IACrD,UAAU,CAA0C;IACpD,YAAY,gBAAsD;QAChE,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,EAA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CAAC,CAAC;YACrH,OAAO,iCAAiC,CAAC;gBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,iBAAiB,EAAE,aAAa;gBAChC,wBAAwB,EAAE,YAAY;gBACtC,sBAAsB,EAAE,UAAU;aACnC,CAAC,CAAC;QACL,CAAC;QACD,gCAAgC,EAAE,CAAC,IAAI,EAAE,EAAE;YACzC,OAAO,IAAI,+BAA+B,CAAC;gBACzC,8BAA8B,EAAE,IAAI;gBACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,eAAe,EAAE,KAAK,CAAC,eAAe;aACvC,CAAC,CAAC;QACL,CAAC;QACD,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,MAAM;KACpB,CAAC,CAAC;AACL,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 { concat, defer, EMPTY, from, map, merge, mergeMap, of } from \"rxjs\";\nimport { assert, Id64 } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { createVisibilityStatus } from \"../../../common/internal/Tooltip.js\";\nimport { HierarchyVisibilityHandlerImpl } from \"../../../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport { fromWithRelease, getClassesByView } from \"../../../common/internal/Utils.js\";\nimport { mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\nimport { CategoriesTreeNode } from \"../CategoriesTreeNode.js\";\nimport { CategoriesTreeVisibilityHelper } from \"./CategoriesTreeVisibilityHelper.js\";\nimport { createCategoriesSearchResultsTree } from \"./SearchResultsTree.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GroupingHierarchyNode, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport type { ECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport type { AlwaysAndNeverDrawnElementInfo } from \"../../../common/internal/AlwaysAndNeverDrawnElementInfo.js\";\nimport type { ElementId, ModelId } from \"../../../common/internal/Types.js\";\nimport type { SearchResultsTree } from \"../../../common/internal/visibility/BaseSearchResultsTree.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 { CategoriesTreeHierarchyConfiguration } from \"../../CategoriesTreeDefinition.js\";\nimport type { CategoriesTreeIdsCache } from \"../CategoriesTreeIdsCache.js\";\nimport type { CategoriesTreeSearchTargets } from \"./SearchResultsTree.js\";\n\n/** @internal */\nexport interface CategoriesTreeVisibilityHandlerProps {\n idsCache: CategoriesTreeIdsCache;\n viewport: TreeWidgetViewport;\n alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;\n hierarchyConfig: CategoriesTreeHierarchyConfiguration;\n}\n\n/**\n * Handles visibility status of categories 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 CategoriesTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<CategoriesTreeSearchTargets> {\n readonly #props: CategoriesTreeVisibilityHandlerProps;\n #visibilityHelper: CategoriesTreeVisibilityHelper;\n #elementType: \"GeometricElement3d\" | \"GeometricElement2d\";\n #categoryType: \"DrawingCategory\" | \"SpatialCategory\";\n #modelType: \"GeometricModel3d\" | \"GeometricModel2d\";\n constructor(constructorProps: CategoriesTreeVisibilityHandlerProps) {\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 CategoriesTreeVisibilityHelper({\n viewport: this.#props.viewport,\n idsCache: this.#props.idsCache,\n alwaysAndNeverDrawnElementInfo: this.#props.alwaysAndNeverDrawnElementInfo,\n baseIdsCache,\n hierarchyConfig: constructorProps.hierarchyConfig,\n });\n\n this.#elementType = this.#props.viewport.viewType === \"2d\" ? \"GeometricElement2d\" : \"GeometricElement3d\";\n this.#categoryType = this.#props.viewport.viewType === \"2d\" ? \"DrawingCategory\" : \"SpatialCategory\";\n this.#modelType = this.#props.viewport.viewType === \"2d\" ? \"GeometricModel2d\" : \"GeometricModel3d\";\n }\n\n public [Symbol.dispose]() {\n this.#visibilityHelper[Symbol.dispose]();\n }\n\n public changeSearchTargetsVisibilityStatus(targets: CategoriesTreeSearchTargets, on: boolean): Observable<void> {\n return defer(() => {\n const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<void>>();\n if (definitionContainerIds?.size) {\n observables.push(this.#visibilityHelper.changeDefinitionContainersVisibilityStatus({ definitionContainerIds, on }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.changeModelsVisibilityStatus({ modelIds, on }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(mergeMap(({ modelId, categoryIds }) => this.#visibilityHelper.changeCategoriesVisibilityStatus({ categoryIds, modelId, on }))),\n );\n }\n\n if (subCategories?.length) {\n observables.push(\n from(subCategories).pipe(\n mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.changeSubCategoriesVisibilityStatus({ subCategoryIds, categoryId, on })),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.changeElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], on }),\n ),\n ),\n );\n }\n\n return merge(...observables);\n });\n }\n\n public getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus> {\n if (HierarchyNode.isClassGroupingNode(node)) {\n const nodeInfo = this.getGroupingNodeInfo(node);\n return this.#visibilityHelper.getGroupedElementsVisibilityStatus({ categoryId: nodeInfo.categoryId, modelElementsMap: nodeInfo.modelElementsMap });\n }\n\n if (!HierarchyNode.isInstancesNode(node)) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.#visibilityHelper.getDefinitionContainersVisibilityStatus({\n definitionContainerIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n if (CategoriesTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.getModelsVisibilityStatus({\n modelIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n type: this.#modelType,\n });\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: CategoriesTreeNode.getModelId(node),\n type: this.#categoryType,\n });\n }\n\n const categoryId = CategoriesTreeNode.getCategoryId(node);\n if (!categoryId) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.#visibilityHelper.getSubCategoriesVisibilityStatus({\n categoryId,\n subCategoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n });\n }\n\n const modelId = CategoriesTreeNode.getModelId(node);\n if (!modelId) {\n return of(createVisibilityStatus(\"disabled\"));\n }\n return this.#visibilityHelper.getElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId,\n categoryId,\n type: this.#elementType,\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 (HierarchyNode.isClassGroupingNode(node)) {\n const nodeInfo = this.getGroupingNodeInfo(node);\n return this.#visibilityHelper.changeGroupedElementsVisibilityStatus({\n categoryId: nodeInfo.categoryId,\n modelElementsMap: nodeInfo.modelElementsMap,\n on,\n });\n }\n\n if (!HierarchyNode.isInstancesNode(node)) {\n return EMPTY;\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.#visibilityHelper.changeDefinitionContainersVisibilityStatus({\n definitionContainerIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n if (CategoriesTreeNode.isModelNode(node)) {\n return this.#visibilityHelper.changeModelsVisibilityStatus({\n modelIds: node.key.instanceKeys.map(({ id }) => id),\n on,\n });\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.#visibilityHelper.changeCategoriesVisibilityStatus({\n categoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n modelId: CategoriesTreeNode.getModelId(node),\n on,\n });\n }\n\n const categoryId = CategoriesTreeNode.getCategoryId(node);\n if (!categoryId) {\n return EMPTY;\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.#visibilityHelper.changeSubCategoriesVisibilityStatus({\n categoryId,\n subCategoryIds: node.key.instanceKeys.map((instanceKey) => instanceKey.id),\n on,\n });\n }\n\n const modelId = CategoriesTreeNode.getModelId(node);\n if (!modelId) {\n return EMPTY;\n }\n\n return this.#visibilityHelper.changeElementsVisibilityStatus({\n elementIds: node.key.instanceKeys.map(({ id }) => id),\n modelId,\n categoryId,\n on,\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: CategoriesTreeSearchTargets): Observable<VisibilityStatus> {\n return defer(() => {\n const { definitionContainerIds, subCategories, modelIds, categories, elements } = targets;\n const observables = new Array<Observable<VisibilityStatus>>();\n if (definitionContainerIds?.size) {\n observables.push(this.#visibilityHelper.getDefinitionContainersVisibilityStatus({ definitionContainerIds }));\n }\n\n if (modelIds?.size) {\n observables.push(this.#visibilityHelper.getModelsVisibilityStatus({ modelIds, type: this.#modelType }));\n }\n\n if (categories?.length) {\n observables.push(\n from(categories).pipe(\n mergeMap(({ modelId, categoryIds }) =>\n this.#visibilityHelper.getCategoriesVisibilityStatus({\n categoryIds,\n modelId,\n type: this.#categoryType,\n }),\n ),\n ),\n );\n }\n\n if (subCategories?.length) {\n observables.push(\n from(subCategories).pipe(\n mergeMap(({ categoryId, subCategoryIds }) => this.#visibilityHelper.getSubCategoriesVisibilityStatus({ subCategoryIds, categoryId })),\n ),\n );\n }\n\n if (elements?.length) {\n observables.push(\n fromWithRelease({ source: elements, releaseOnCount: 50 }).pipe(\n mergeMap(({ modelId, elements: elementsMap, categoryId }) =>\n this.#visibilityHelper.getElementsVisibilityStatus({ modelId, categoryId, elementIds: [...elementsMap.keys()], type: this.#elementType }),\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.getModelCategoryIds(modelId).pipe(\n map((categories) => ({\n id: modelId,\n ...(this.#props.viewport.viewType === \"2d\" ? { drawingCategories: categories } : { spatialCategories: categories }),\n })),\n ),\n ),\n );\n }\n\n private getAllCategories(): ReturnType<BaseIdsCache[\"getAllCategories\"]> {\n return this.#props.idsCache.getAllCategories().pipe(\n map((categories) => {\n if (this.#props.viewport.viewType === \"2d\") {\n return { drawingCategories: categories };\n }\n return { spatialCategories: categories };\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 this.#props.idsCache.getModelCategoryIds(modelId).pipe(\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 private getGroupingNodeInfo(node: GroupingHierarchyNode) {\n const modelElementsMap: Map<ModelId, Set<ElementId>> = node.extendedData?.modelElementsMap;\n const categoryId = node.extendedData?.categoryId;\n assert(!!modelElementsMap && !!categoryId);\n\n return { modelElementsMap, categoryId };\n }\n}\n\n/**\n * Creates categories tree visibility handler. Is used by integration and performance tests.\n * @internal\n */\nexport function createCategoriesTreeVisibilityHandler(props: {\n viewport: TreeWidgetViewport;\n idsCache: CategoriesTreeIdsCache;\n imodelAccess: ECClassHierarchyInspector;\n searchPaths?: HierarchySearchPath[];\n hierarchyConfig: CategoriesTreeHierarchyConfiguration;\n}) {\n return new HierarchyVisibilityHandlerImpl<CategoriesTreeSearchTargets>({\n getSearchResultsTree: (): undefined | Promise<SearchResultsTree<CategoriesTreeSearchTargets>> => {\n if (!props.searchPaths) {\n return undefined;\n }\n const { categoryClass, elementClass, modelClass } = getClassesByView(props.viewport.viewType === \"2d\" ? \"2d\" : \"3d\");\n return createCategoriesSearchResultsTree({\n idsCache: props.idsCache,\n searchPaths: props.searchPaths,\n imodelAccess: props.imodelAccess,\n categoryClassName: categoryClass,\n categoryElementClassName: elementClass,\n categoryModelClassName: modelClass,\n });\n },\n getTreeSpecificVisibilityHandler: (info) => {\n return new CategoriesTreeVisibilityHandler({\n alwaysAndNeverDrawnElementInfo: info,\n idsCache: props.idsCache,\n viewport: props.viewport,\n hierarchyConfig: props.hierarchyConfig,\n });\n },\n viewport: props.viewport,\n componentId: \"Test\",\n });\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { concat, EMPTY, from, map, mergeMap, reduce } from "rxjs";
6
6
  import { BaseVisibilityHelper } from "../../../common/internal/visibility/BaseVisibilityHelper.js";
7
- import { enableCategoryDisplay, enableSubCategoryDisplay, mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
7
+ import { enableCategoryDisplay, mergeVisibilityStatuses } from "../../../common/internal/VisibilityUtils.js";
8
8
  /**
9
9
  * Visibility status helper for categories tree.
10
10
  *
@@ -67,7 +67,7 @@ export class CategoriesTreeVisibilityHelper extends BaseVisibilityHelper {
67
67
  // make sure parent category and models are enabled
68
68
  props.on
69
69
  ? concat(from(enableCategoryDisplay(this.#props.viewport, props.categoryId, props.on, false)), this.enableCategoriesElementModelsVisibilityStatus(props.categoryId))
70
- : EMPTY, from(props.subCategoryIds).pipe(map((subCategoryId) => enableSubCategoryDisplay(this.#props.viewport, subCategoryId, props.on))));
70
+ : EMPTY, from(props.subCategoryIds).pipe(map((subCategoryId) => this.#props.viewport.changeSubCategoryDisplay({ subCategoryId, display: props.on }))));
71
71
  }
72
72
  /** Changes grouped elements visibility status. */
73
73
  changeGroupedElementsVisibilityStatus(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesTreeVisibilityHelper.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAgBvI;;;;;GAKG;AACH,MAAM,OAAO,8BAA+B,SAAQ,oBAAoB;IACtE,MAAM,CAAsC;IAC5C,YAAY,KAA0C;QACpD,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;aACxB,yBAAyB,CAAC;YACzB,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;YACpD,sBAAsB,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,mBAAmB;SACxE,CAAC;aACD,IAAI,CACH,QAAQ,CAAC,CAAC,WAAW,EAAE,EAAE,CACvB,IAAI,CAAC,6BAA6B,CAAC;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CAAC;YACH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,IAAI,GAAG,EAAc,CAAC,EACzB,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;YACnB,IAAI,YAAY,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YACrF,CAAC;QACH,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, EMPTY, from, map, mergeMap, reduce } from \"rxjs\";\nimport { BaseVisibilityHelper } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport { enableCategoryDisplay, enableSubCategoryDisplay, mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport type { ElementId, ModelId } from \"../../../common/internal/Types.js\";\nimport type { BaseVisibilityHelperProps } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { CategoriesTreeHierarchyConfiguration } from \"../../CategoriesTreeDefinition.js\";\nimport type { CategoriesTreeIdsCache } from \"../CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport type CategoriesTreeVisibilityHelperProps = BaseVisibilityHelperProps & {\n idsCache: CategoriesTreeIdsCache;\n hierarchyConfig: CategoriesTreeHierarchyConfiguration;\n};\n\n/**\n * Visibility status helper for categories tree.\n *\n * It extends base visibility status helper and provides methods to get and change visibility status of definition containers and grouped elements.\n * @internal\n */\nexport class CategoriesTreeVisibilityHelper extends BaseVisibilityHelper {\n #props: CategoriesTreeVisibilityHelperProps;\n constructor(props: CategoriesTreeVisibilityHelperProps) {\n super(props);\n this.#props = props;\n }\n\n /**\n * Gets visibility status of definition containers.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getDefinitionContainersVisibilityStatus(props: { definitionContainerIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache\n .getAllContainedCategories({\n definitionContainerIds: props.definitionContainerIds,\n includeEmptyCategories: this.#props.hierarchyConfig.showEmptyCategories,\n })\n .pipe(\n mergeMap((categoryIds) =>\n this.getCategoriesVisibilityStatus({\n categoryIds,\n modelId: undefined,\n type: this.#props.viewport.viewType === \"2d\" ? \"DrawingCategory\" : \"SpatialCategory\",\n }),\n ),\n );\n }\n\n /** Gets grouped elements visibility status. */\n public getGroupedElementsVisibilityStatus(props: { modelElementsMap: Map<ModelId, Set<ElementId>>; categoryId: Id64String }): Observable<VisibilityStatus> {\n const { modelElementsMap, categoryId } = props;\n return from(modelElementsMap).pipe(\n mergeMap(([modelId, elementIds]) =>\n this.getElementsVisibilityStatus({\n elementIds,\n modelId,\n categoryId,\n type: this.#props.viewport.viewType === \"2d\" ? \"GeometricElement2d\" : \"GeometricElement3d\",\n }),\n ),\n mergeVisibilityStatuses,\n );\n }\n\n /**\n * Changes visibility status of definition containers.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeDefinitionContainersVisibilityStatus(props: { definitionContainerIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache\n .getAllContainedCategories({\n definitionContainerIds: props.definitionContainerIds,\n includeEmptyCategories: this.#props.hierarchyConfig.showEmptyCategories,\n })\n .pipe(mergeMap((categoryIds) => this.changeCategoriesVisibilityStatus({ categoryIds, modelId: undefined, on: props.on })));\n }\n\n /**\n * Changes visibility status of sub-categories.\n *\n * Also, enables parent categories if `on` is true.\n */\n public changeSubCategoriesVisibilityStatus(props: { categoryId: Id64String; subCategoryIds: Id64Arg; on: boolean }): Observable<void> {\n return concat(\n // make sure parent category and models are enabled\n props.on\n ? concat(\n from(enableCategoryDisplay(this.#props.viewport, props.categoryId, props.on, false)),\n this.enableCategoriesElementModelsVisibilityStatus(props.categoryId),\n )\n : EMPTY,\n from(props.subCategoryIds).pipe(map((subCategoryId) => enableSubCategoryDisplay(this.#props.viewport, subCategoryId, props.on))),\n );\n }\n\n /** Changes grouped elements visibility status. */\n public changeGroupedElementsVisibilityStatus(props: {\n modelElementsMap: Map<ModelId, Set<ElementId>>;\n categoryId: Id64String;\n on: boolean;\n }): Observable<void> {\n return from(props.modelElementsMap).pipe(\n mergeMap(([modelId, elementIds]) => {\n return this.changeElementsVisibilityStatus({ modelId, elementIds, categoryId: props.categoryId, on: props.on });\n }),\n );\n }\n\n /** Turns on visibility status of models (that are not yet turned on) that are related to categories. */\n private enableCategoriesElementModelsVisibilityStatus(categoryIds: Id64Arg): Observable<void> {\n return this.#props.idsCache.getCategoriesElementModels(categoryIds, true).pipe(\n reduce((acc, { models }) => {\n models?.forEach((modelId) => {\n if (!this.#props.viewport.viewsModel(modelId)) {\n acc.add(modelId);\n }\n });\n return acc;\n }, new Set<Id64String>()),\n map((hiddenModels) => {\n if (hiddenModels.size > 0) {\n this.#props.viewport.changeModelDisplay({ modelIds: hiddenModels, display: true });\n }\n }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"CategoriesTreeVisibilityHelper.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAgB7G;;;;;GAKG;AACH,MAAM,OAAO,8BAA+B,SAAQ,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AAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,wGAAwG;IAChG,6CAA6C,CAAC,WAAoB;QACxE,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAC5E,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC9C,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,IAAI,GAAG,EAAc,CAAC,EACzB,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;YACnB,IAAI,YAAY,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YACrF,CAAC;QACH,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, EMPTY, from, map, mergeMap, reduce } from \"rxjs\";\nimport { BaseVisibilityHelper } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport { enableCategoryDisplay, mergeVisibilityStatuses } from \"../../../common/internal/VisibilityUtils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport type { ElementId, ModelId } from \"../../../common/internal/Types.js\";\nimport type { BaseVisibilityHelperProps } from \"../../../common/internal/visibility/BaseVisibilityHelper.js\";\nimport type { VisibilityStatus } from \"../../../common/UseHierarchyVisibility.js\";\nimport type { CategoriesTreeHierarchyConfiguration } from \"../../CategoriesTreeDefinition.js\";\nimport type { CategoriesTreeIdsCache } from \"../CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport type CategoriesTreeVisibilityHelperProps = BaseVisibilityHelperProps & {\n idsCache: CategoriesTreeIdsCache;\n hierarchyConfig: CategoriesTreeHierarchyConfiguration;\n};\n\n/**\n * Visibility status helper for categories tree.\n *\n * It extends base visibility status helper and provides methods to get and change visibility status of definition containers and grouped elements.\n * @internal\n */\nexport class CategoriesTreeVisibilityHelper extends BaseVisibilityHelper {\n #props: CategoriesTreeVisibilityHelperProps;\n constructor(props: CategoriesTreeVisibilityHelperProps) {\n super(props);\n this.#props = props;\n }\n\n /**\n * Gets visibility status of definition containers.\n *\n * Determines visibility status by checking visibility status of related categories.\n */\n public getDefinitionContainersVisibilityStatus(props: { definitionContainerIds: Id64Arg }): Observable<VisibilityStatus> {\n return this.#props.idsCache\n .getAllContainedCategories({\n definitionContainerIds: props.definitionContainerIds,\n includeEmptyCategories: this.#props.hierarchyConfig.showEmptyCategories,\n })\n .pipe(\n mergeMap((categoryIds) =>\n this.getCategoriesVisibilityStatus({\n categoryIds,\n modelId: undefined,\n type: this.#props.viewport.viewType === \"2d\" ? \"DrawingCategory\" : \"SpatialCategory\",\n }),\n ),\n );\n }\n\n /** Gets grouped elements visibility status. */\n public getGroupedElementsVisibilityStatus(props: { modelElementsMap: Map<ModelId, Set<ElementId>>; categoryId: Id64String }): Observable<VisibilityStatus> {\n const { modelElementsMap, categoryId } = props;\n return from(modelElementsMap).pipe(\n mergeMap(([modelId, elementIds]) =>\n this.getElementsVisibilityStatus({\n elementIds,\n modelId,\n categoryId,\n type: this.#props.viewport.viewType === \"2d\" ? \"GeometricElement2d\" : \"GeometricElement3d\",\n }),\n ),\n mergeVisibilityStatuses,\n );\n }\n\n /**\n * Changes visibility status of definition containers.\n *\n * Does this by changing visibility status of related categories.\n */\n public changeDefinitionContainersVisibilityStatus(props: { definitionContainerIds: Id64Arg; on: boolean }): Observable<void> {\n return this.#props.idsCache\n .getAllContainedCategories({\n definitionContainerIds: props.definitionContainerIds,\n includeEmptyCategories: this.#props.hierarchyConfig.showEmptyCategories,\n })\n .pipe(mergeMap((categoryIds) => this.changeCategoriesVisibilityStatus({ categoryIds, modelId: undefined, on: props.on })));\n }\n\n /**\n * Changes visibility status of sub-categories.\n *\n * Also, enables parent categories if `on` is true.\n */\n public changeSubCategoriesVisibilityStatus(props: { categoryId: Id64String; subCategoryIds: Id64Arg; on: boolean }): Observable<void> {\n return concat(\n // make sure parent category and models are enabled\n props.on\n ? concat(\n from(enableCategoryDisplay(this.#props.viewport, props.categoryId, props.on, false)),\n this.enableCategoriesElementModelsVisibilityStatus(props.categoryId),\n )\n : EMPTY,\n from(props.subCategoryIds).pipe(map((subCategoryId) => this.#props.viewport.changeSubCategoryDisplay({ subCategoryId, display: props.on }))),\n );\n }\n\n /** Changes grouped elements visibility status. */\n public changeGroupedElementsVisibilityStatus(props: {\n modelElementsMap: Map<ModelId, Set<ElementId>>;\n categoryId: Id64String;\n on: boolean;\n }): Observable<void> {\n return from(props.modelElementsMap).pipe(\n mergeMap(([modelId, elementIds]) => {\n return this.changeElementsVisibilityStatus({ modelId, elementIds, categoryId: props.categoryId, on: props.on });\n }),\n );\n }\n\n /** Turns on visibility status of models (that are not yet turned on) that are related to categories. */\n private enableCategoriesElementModelsVisibilityStatus(categoryIds: Id64Arg): Observable<void> {\n return this.#props.idsCache.getCategoriesElementModels(categoryIds, true).pipe(\n reduce((acc, { models }) => {\n models?.forEach((modelId) => {\n if (!this.#props.viewport.viewsModel(modelId)) {\n acc.add(modelId);\n }\n });\n return acc;\n }, new Set<Id64String>()),\n map((hiddenModels) => {\n if (hiddenModels.size > 0) {\n this.#props.viewport.changeModelDisplay({ modelIds: hiddenModels, display: true });\n }\n }),\n );\n }\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  import type { Id64Set, Id64String } from "@itwin/core-bentley";
2
- import type { HierarchyFilteringPath } from "@itwin/presentation-hierarchies";
2
+ import type { HierarchySearchPath } from "@itwin/presentation-hierarchies";
3
3
  import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
4
4
  import type { ElementId } from "../../../common/internal/Types.js";
5
- import type { FilteredTree } from "../../../common/internal/visibility/BaseFilteredTree.js";
5
+ import type { SearchResultsTree } from "../../../common/internal/visibility/BaseSearchResultsTree.js";
6
6
  import type { CategoriesTreeIdsCache } from "../CategoriesTreeIdsCache.js";
7
7
  /** @internal */
8
- export interface CategoriesTreeFilterTargets {
8
+ export interface CategoriesTreeSearchTargets {
9
9
  categories?: Array<{
10
10
  modelId: Id64String | undefined;
11
11
  categoryIds: Id64Set;
@@ -14,7 +14,7 @@ export interface CategoriesTreeFilterTargets {
14
14
  modelId: Id64String;
15
15
  categoryId: Id64String;
16
16
  elements: Map<ElementId, {
17
- isFilterTarget: boolean;
17
+ isSearchTarget: boolean;
18
18
  }>;
19
19
  }>;
20
20
  definitionContainerIds?: Id64Set;
@@ -25,12 +25,12 @@ export interface CategoriesTreeFilterTargets {
25
25
  }>;
26
26
  }
27
27
  /** @internal */
28
- export declare function createFilteredCategoriesTree(props: {
28
+ export declare function createCategoriesSearchResultsTree(props: {
29
29
  imodelAccess: ECClassHierarchyInspector;
30
- filteringPaths: HierarchyFilteringPath[];
30
+ searchPaths: HierarchySearchPath[];
31
31
  categoryClassName: string;
32
32
  categoryElementClassName: string;
33
33
  categoryModelClassName: string;
34
34
  idsCache: CategoriesTreeIdsCache;
35
- }): Promise<FilteredTree<CategoriesTreeFilterTargets>>;
36
- //# sourceMappingURL=FilteredTree.d.ts.map
35
+ }): Promise<SearchResultsTree<CategoriesTreeSearchTargets>>;
36
+ //# sourceMappingURL=SearchResultsTree.d.ts.map
@@ -5,129 +5,129 @@
5
5
  import { firstValueFrom } from "rxjs";
6
6
  import { assert } from "@itwin/core-bentley";
7
7
  import { CLASS_NAME_SubCategory } from "../../../common/internal/ClassNameDefinitions.js";
8
- import { createFilteredTree, FilteredNodesHandler } from "../../../common/internal/visibility/BaseFilteredTree.js";
8
+ import { createSearchResultsTree, SearchResultsNodesHandler } from "../../../common/internal/visibility/BaseSearchResultsTree.js";
9
9
  /** @internal */
10
- export async function createFilteredCategoriesTree(props) {
11
- const { imodelAccess, filteringPaths, categoryClassName, categoryElementClassName, categoryModelClassName, idsCache } = props;
12
- return createFilteredTree({
13
- filteredNodesHandler: new CategoriesTreeFilteredNodesHandler({
10
+ export async function createCategoriesSearchResultsTree(props) {
11
+ const { imodelAccess, searchPaths, categoryClassName, categoryElementClassName, categoryModelClassName, idsCache } = props;
12
+ return createSearchResultsTree({
13
+ searchResultsNodesHandler: new CategoriesTreeSearchResultsNodesHandler({
14
14
  idsCache,
15
15
  imodelAccess,
16
16
  categoryClassName,
17
17
  categoryElementClassName,
18
18
  categoryModelClassName,
19
19
  }),
20
- filteringPaths,
20
+ searchPaths,
21
21
  });
22
22
  }
23
- class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
23
+ class CategoriesTreeSearchResultsNodesHandler extends SearchResultsNodesHandler {
24
24
  #props;
25
25
  constructor(props) {
26
26
  super();
27
27
  this.#props = props;
28
28
  }
29
- async getProcessedFilteredNodes() {
30
- const filteredTemporaryElements = new Map();
29
+ async getProcessedSearchResultsNodes() {
30
+ const searchResultsTemporaryElements = new Map();
31
31
  const result = {
32
- filteredElements: new Map(),
32
+ searchResultsElements: new Map(),
33
33
  };
34
- this.filteredNodesArr.forEach((node) => {
34
+ this.searchResultsNodesArr.forEach((node) => {
35
35
  if (node.type === "element") {
36
- filteredTemporaryElements.set(node.id, node);
36
+ searchResultsTemporaryElements.set(node.id, node);
37
37
  }
38
38
  });
39
- const filteredElementsModels = await firstValueFrom(this.#props.idsCache.getFilteredElementsModels([...filteredTemporaryElements.keys()]));
40
- filteredTemporaryElements.forEach((element, id) => {
41
- const modelId = filteredElementsModels.get(element.id);
39
+ const searchResultsElementsModels = await firstValueFrom(this.#props.idsCache.getFilteredElementsModels([...searchResultsTemporaryElements.keys()]));
40
+ searchResultsTemporaryElements.forEach((element, id) => {
41
+ const modelId = searchResultsElementsModels.get(element.id);
42
42
  assert(modelId !== undefined);
43
- result.filteredElements.set(id, { ...element, modelId });
43
+ result.searchResultsElements.set(id, { ...element, modelId });
44
44
  });
45
45
  return result;
46
46
  }
47
- convertNodesToFilterTargets(filteredNodes, processedFilteredNodes) {
48
- const filterTargets = {};
49
- filteredNodes.forEach((filteredNode) => this.collectFilterTargets(filterTargets, filteredNode, processedFilteredNodes));
50
- return this.convertInternalFilterTargets(filterTargets);
47
+ convertNodesToSearchTargets(searchResultsNodes, processedSearchResultsNodes) {
48
+ const searchTargets = {};
49
+ searchResultsNodes.forEach((searchResultsNode) => this.collectSearchTargets(searchTargets, searchResultsNode, processedSearchResultsNodes));
50
+ return this.convertInternalSearchTargets(searchTargets);
51
51
  }
52
- convertInternalFilterTargets(filterTargets) {
53
- if (!filterTargets.categories &&
54
- !filterTargets.definitionContainerIds &&
55
- !filterTargets.elements &&
56
- !filterTargets.modelIds &&
57
- !filterTargets.subCategories) {
52
+ convertInternalSearchTargets(searchTargets) {
53
+ if (!searchTargets.categories &&
54
+ !searchTargets.definitionContainerIds &&
55
+ !searchTargets.elements &&
56
+ !searchTargets.modelIds &&
57
+ !searchTargets.subCategories) {
58
58
  return undefined;
59
59
  }
60
60
  return {
61
- categories: filterTargets.categories
62
- ? [...filterTargets.categories.entries()].map(([modelId, categoryIds]) => {
61
+ categories: searchTargets.categories
62
+ ? [...searchTargets.categories.entries()].map(([modelId, categoryIds]) => {
63
63
  return { modelId, categoryIds };
64
64
  })
65
65
  : undefined,
66
- elements: filterTargets.elements
67
- ? [...filterTargets.elements.entries()].map(([modelCategoryKey, elements]) => {
66
+ elements: searchTargets.elements
67
+ ? [...searchTargets.elements.entries()].map(([modelCategoryKey, elements]) => {
68
68
  const { modelId, categoryId } = this.parseModelCategoryKey(modelCategoryKey);
69
69
  return { modelId, categoryId, elements };
70
70
  })
71
71
  : undefined,
72
- definitionContainerIds: filterTargets.definitionContainerIds,
73
- modelIds: filterTargets.modelIds,
74
- subCategories: filterTargets.subCategories
75
- ? [...filterTargets.subCategories.entries()].map(([categoryId, subCategoryIds]) => {
72
+ definitionContainerIds: searchTargets.definitionContainerIds,
73
+ modelIds: searchTargets.modelIds,
74
+ subCategories: searchTargets.subCategories
75
+ ? [...searchTargets.subCategories.entries()].map(([categoryId, subCategoryIds]) => {
76
76
  return { categoryId, subCategoryIds };
77
77
  })
78
78
  : undefined,
79
79
  };
80
80
  }
81
- collectFilterTargets(changeTargets, node, processedFilteredNodes) {
82
- const filteredNode = node.type !== "element" ? node : processedFilteredNodes.filteredElements.get(node.id);
83
- assert(filteredNode !== undefined);
84
- if (filteredNode.isFilterTarget) {
85
- this.addTarget(changeTargets, filteredNode);
81
+ collectSearchTargets(searchTargets, node, processedSearchResultsNodes) {
82
+ const searchResultsNode = node.type !== "element" ? node : processedSearchResultsNodes.searchResultsElements.get(node.id);
83
+ assert(searchResultsNode !== undefined);
84
+ if (searchResultsNode.isSearchTarget) {
85
+ this.addTarget(searchTargets, searchResultsNode);
86
86
  return;
87
87
  }
88
- if (filteredNode.type === "element") {
89
- // need to add parent ids as filter target will be an element
90
- this.addTarget(changeTargets, filteredNode);
88
+ if (searchResultsNode.type === "element") {
89
+ // need to add parent ids as search target will be an element
90
+ this.addTarget(searchTargets, searchResultsNode);
91
91
  }
92
92
  if (!node.children) {
93
93
  return;
94
94
  }
95
95
  for (const child of node.children.values()) {
96
- this.collectFilterTargets(changeTargets, child, processedFilteredNodes);
96
+ this.collectSearchTargets(searchTargets, child, processedSearchResultsNodes);
97
97
  }
98
98
  }
99
- addTarget(filterTargets, node) {
99
+ addTarget(searchTargets, node) {
100
100
  switch (node.type) {
101
101
  case "definitionContainer":
102
- (filterTargets.definitionContainerIds ??= new Set()).add(node.id);
102
+ (searchTargets.definitionContainerIds ??= new Set()).add(node.id);
103
103
  return;
104
104
  case "model":
105
- (filterTargets.modelIds ??= new Set()).add(node.id);
105
+ (searchTargets.modelIds ??= new Set()).add(node.id);
106
106
  return;
107
107
  case "subCategory":
108
- const subCategories = (filterTargets.subCategories ??= new Map()).get(node.categoryId);
108
+ const subCategories = (searchTargets.subCategories ??= new Map()).get(node.categoryId);
109
109
  if (subCategories) {
110
110
  subCategories.add(node.id);
111
111
  return;
112
112
  }
113
- filterTargets.subCategories.set(node.categoryId, new Set([node.id]));
113
+ searchTargets.subCategories.set(node.categoryId, new Set([node.id]));
114
114
  return;
115
115
  case "category":
116
- const categories = (filterTargets.categories ??= new Map()).get(node.modelId);
116
+ const categories = (searchTargets.categories ??= new Map()).get(node.modelId);
117
117
  if (!categories) {
118
118
  categories.add(node.id);
119
119
  return;
120
120
  }
121
- filterTargets.categories.set(node.modelId, new Set([node.id]));
121
+ searchTargets.categories.set(node.modelId, new Set([node.id]));
122
122
  return;
123
123
  case "element":
124
124
  const modelCategoryKey = this.createModelCategoryKey(node.modelId, node.categoryId);
125
- const elements = (filterTargets.elements ??= new Map()).get(modelCategoryKey);
125
+ const elements = (searchTargets.elements ??= new Map()).get(modelCategoryKey);
126
126
  if (elements) {
127
- elements.set(node.id, { isFilterTarget: node.isFilterTarget });
127
+ elements.set(node.id, { isSearchTarget: node.isSearchTarget });
128
128
  }
129
129
  else {
130
- filterTargets.elements.set(modelCategoryKey, new Map([[node.id, { isFilterTarget: node.isFilterTarget }]]));
130
+ searchTargets.elements.set(modelCategoryKey, new Map([[node.id, { isSearchTarget: node.isSearchTarget }]]));
131
131
  }
132
132
  }
133
133
  }
@@ -138,11 +138,11 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
138
138
  const [modelId, categoryId] = key.split("-");
139
139
  return { modelId, categoryId };
140
140
  }
141
- createFilteredTreeNode({ type, id, isFilterTarget, parent, }) {
141
+ createSearchResultsTreeNode({ type, id, isSearchTarget, parent, }) {
142
142
  if (type === "definitionContainer") {
143
143
  return {
144
144
  id,
145
- isFilterTarget,
145
+ isSearchTarget,
146
146
  type,
147
147
  };
148
148
  }
@@ -150,7 +150,7 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
150
150
  assert("id" in parent);
151
151
  return {
152
152
  id,
153
- isFilterTarget,
153
+ isSearchTarget,
154
154
  type,
155
155
  categoryId: parent.id,
156
156
  };
@@ -159,14 +159,14 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
159
159
  if ("type" in parent && parent.type === "model") {
160
160
  return {
161
161
  id,
162
- isFilterTarget,
162
+ isSearchTarget,
163
163
  type,
164
164
  modelId: parent.id,
165
165
  };
166
166
  }
167
167
  return {
168
168
  id,
169
- isFilterTarget,
169
+ isSearchTarget,
170
170
  type,
171
171
  };
172
172
  }
@@ -174,7 +174,7 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
174
174
  assert("id" in parent);
175
175
  return {
176
176
  id,
177
- isFilterTarget,
177
+ isSearchTarget,
178
178
  type,
179
179
  categoryId: parent.type === "category" ? parent.id : undefined,
180
180
  };
@@ -183,7 +183,7 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
183
183
  if (parent.type === "category") {
184
184
  return {
185
185
  id,
186
- isFilterTarget,
186
+ isSearchTarget,
187
187
  type,
188
188
  categoryId: parent.id,
189
189
  modelId: undefined,
@@ -192,7 +192,7 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
192
192
  assert(parent.type === "element");
193
193
  return {
194
194
  id,
195
- isFilterTarget,
195
+ isSearchTarget,
196
196
  type,
197
197
  categoryId: parent.categoryId,
198
198
  modelId: undefined,
@@ -216,4 +216,4 @@ class CategoriesTreeFilteredNodesHandler extends FilteredNodesHandler {
216
216
  return "definitionContainer";
217
217
  }
218
218
  }
219
- //# sourceMappingURL=FilteredTree.js.map
219
+ //# sourceMappingURL=SearchResultsTree.js.map