@itwin/tree-widget-react 3.15.0 → 3.16.0

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 (126) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/lib/cjs/tree-widget-react/TreeWidget.d.ts +1 -2
  3. package/lib/cjs/tree-widget-react/TreeWidget.js +12 -12
  4. package/lib/cjs/tree-widget-react/TreeWidget.js.map +1 -1
  5. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +2 -3
  6. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +5 -4
  7. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  8. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +4 -7
  9. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +39 -31
  10. package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  11. package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +6 -2
  12. package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  13. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +3 -11
  14. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +45 -36
  15. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  16. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +1 -3
  17. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +30 -30
  18. package/lib/cjs/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
  19. package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +2 -7
  20. package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +8 -21
  21. package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  22. package/lib/cjs/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +3 -0
  23. package/lib/cjs/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +7 -7
  24. package/lib/cjs/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -1
  25. package/lib/cjs/tree-widget-react/components/trees/common/useGuid.d.ts +2 -0
  26. package/lib/cjs/tree-widget-react/components/trees/common/useGuid.js +14 -0
  27. package/lib/cjs/tree-widget-react/components/trees/common/useGuid.js.map +1 -0
  28. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +4 -1
  29. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  30. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +4 -6
  31. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +31 -26
  32. package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
  33. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  34. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +4 -2
  35. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  36. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +1 -5
  37. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +44 -44
  38. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  39. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +3 -6
  40. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +20 -16
  41. package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  42. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +3 -1
  43. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  44. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +6 -10
  45. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +107 -64
  46. package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  47. package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +18 -8
  48. package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  49. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.d.ts +24 -0
  50. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js +46 -0
  51. package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
  52. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +40 -9
  53. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +68 -39
  54. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
  55. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +13 -5
  56. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +20 -14
  57. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +1 -1
  58. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +5 -13
  59. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +70 -60
  60. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  61. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +6 -2
  62. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +189 -197
  63. package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  64. package/lib/esm/tree-widget-react/TreeWidget.d.ts +1 -2
  65. package/lib/esm/tree-widget-react/TreeWidget.js +12 -12
  66. package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
  67. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +2 -3
  68. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +5 -3
  69. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  70. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +4 -7
  71. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +39 -31
  72. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  73. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +6 -2
  74. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  75. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +3 -11
  76. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +45 -36
  77. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
  78. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +1 -3
  79. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +30 -30
  80. package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -1
  81. package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +2 -7
  82. package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +8 -20
  83. package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  84. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +3 -0
  85. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +7 -7
  86. package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -1
  87. package/lib/esm/tree-widget-react/components/trees/common/useGuid.d.ts +2 -0
  88. package/lib/esm/tree-widget-react/components/trees/common/useGuid.js +11 -0
  89. package/lib/esm/tree-widget-react/components/trees/common/useGuid.js.map +1 -0
  90. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +4 -1
  91. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  92. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +4 -6
  93. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +31 -26
  94. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
  95. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  96. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +4 -2
  97. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  98. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +1 -5
  99. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +44 -44
  100. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
  101. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +3 -6
  102. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +21 -17
  103. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
  104. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +3 -1
  105. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  106. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +6 -10
  107. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +107 -64
  108. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  109. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +18 -8
  110. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  111. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +24 -0
  112. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +44 -0
  113. package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +1 -1
  114. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +40 -9
  115. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +70 -41
  116. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
  117. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +13 -5
  118. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +22 -16
  119. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +1 -1
  120. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +5 -13
  121. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +71 -61
  122. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
  123. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +6 -2
  124. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +192 -200
  125. package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  126. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAsD;AACtD,wDAAkE;AAClE,8EAAgE;AAChE,4FAA4G;AAC5G,wDAAiE;AACjE,mEAA6D;AAc7D,gBAAgB;AAChB,MAAa,2BAA2B;IAC9B,wBAAwB,CAAM;IAC9B,SAAS,CAAW;IACpB,SAAS,CAAyB;IAE1C,YAAY,KAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACrF,IAAI,CAAC,SAAS,CAAC,iCAAiC,CAAC,WAAW,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QACrG,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,qBAA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------------------------------------------\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 { assert, BeEvent } from \"@itwin/core-bentley\";\nimport { PerModelCategoryVisibility } from \"@itwin/core-frontend\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { enableCategoryDisplay, enableSubCategoryDisplay } from \"../../common/CategoriesVisibilityUtils.js\";\nimport { createVisibilityStatus } from \"../../common/Tooltip.js\";\nimport { CategoriesTreeNode } from \"./CategoriesTreeNode.js\";\n\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { Visibility } from \"../../common/Tooltip.js\";\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../../common/UseHierarchyVisibility.js\";\nimport type { CategoriesTreeIdsCache } from \"./CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport interface CategoriesVisibilityHandlerProps {\n viewport: Viewport;\n idsCache: CategoriesTreeIdsCache;\n}\n\n/** @internal */\nexport class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {\n private _pendingVisibilityChange: any;\n private _viewport: Viewport;\n private _idsCache: CategoriesTreeIdsCache;\n\n constructor(props: CategoriesVisibilityHandlerProps) {\n this._idsCache = props.idsCache;\n this._viewport = props.viewport;\n this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n this._viewport.onViewedCategoriesPerModelChanged.addListener(this.onViewedCategoriesPerModelChanged);\n this._viewport.onViewedModelsChanged.addListener(this.onViewedModelsChanged);\n }\n\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public [Symbol.dispose]() {\n this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n this._viewport.onViewedCategoriesPerModelChanged.removeListener(this.onViewedCategoriesPerModelChanged);\n this._viewport.onViewedModelsChanged.removeListener(this.onViewedModelsChanged);\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent();\n\n /** Returns visibility status of the tree node. */\n public async getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> {\n if (!HierarchyNode.isInstancesNode(node)) {\n return { state: \"hidden\", isDisabled: true };\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n if (!node.extendedData?.categoryId) {\n return { state: \"hidden\", isDisabled: true };\n }\n return createVisibilityStatus(\n await this.getSubCategoriesVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node), node.extendedData.categoryId),\n );\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return createVisibilityStatus(await this.getCategoriesVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node)));\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return createVisibilityStatus(await this.getDefinitionContainerVisibility(node));\n }\n\n return { state: \"hidden\", isDisabled: true };\n }\n\n public async changeVisibility(node: HierarchyNode, on: boolean) {\n if (!HierarchyNode.isInstancesNode(node)) {\n return;\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.changeCategoryVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node), on);\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.changeSubCategoryVisibility(node, on);\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.changeDefinitionContainerVisibility(node, on);\n }\n }\n\n private async getSubCategoriesVisibility(subCategoryIds: Id64Array, parentCategoryId: Id64String): Promise<Visibility> {\n let visibility: \"visible\" | \"hidden\" | \"unknown\" = \"unknown\";\n const categoryModels = [...(await this._idsCache.getCategoriesElementModels([parentCategoryId])).values()].flat();\n let nonDefaultModelDisplayStatesCount = 0;\n for (const modelId of categoryModels) {\n if (!this._viewport.view.viewsModel(modelId)) {\n if (visibility === \"visible\") {\n return \"partial\";\n }\n visibility = \"hidden\";\n ++nonDefaultModelDisplayStatesCount;\n continue;\n }\n const override = this._viewport.perModelCategoryVisibility.getOverride(modelId, parentCategoryId);\n if (override === PerModelCategoryVisibility.Override.Show) {\n if (visibility === \"hidden\") {\n return \"partial\";\n }\n visibility = \"visible\";\n ++nonDefaultModelDisplayStatesCount;\n continue;\n }\n if (override === PerModelCategoryVisibility.Override.Hide) {\n if (visibility === \"visible\") {\n return \"partial\";\n }\n visibility = \"hidden\";\n ++nonDefaultModelDisplayStatesCount;\n continue;\n }\n }\n if (categoryModels.length > 0 && nonDefaultModelDisplayStatesCount === categoryModels.length) {\n assert(visibility === \"visible\" || visibility === \"hidden\");\n return visibility;\n }\n\n if (!this._viewport.view.viewsCategory(parentCategoryId)) {\n return visibility === \"visible\" ? \"partial\" : \"hidden\";\n }\n\n if (subCategoryIds.length === 0) {\n if (visibility === \"hidden\") {\n return \"partial\";\n }\n return \"visible\";\n }\n\n for (const subCategoryId of subCategoryIds) {\n const isSubCategoryVisible = this._viewport.isSubCategoryVisible(subCategoryId);\n if (isSubCategoryVisible && visibility === \"hidden\") {\n return \"partial\";\n }\n if (!isSubCategoryVisible && visibility === \"visible\") {\n return \"partial\";\n }\n visibility = isSubCategoryVisible ? \"visible\" : \"hidden\";\n }\n assert(visibility === \"visible\" || visibility === \"hidden\");\n return visibility;\n }\n\n private async getDefinitionContainerVisibility(node: HierarchyNode): Promise<Visibility> {\n const categoryIds = await this._idsCache.getAllContainedCategories(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node));\n return this.getCategoriesVisibility(categoryIds);\n }\n\n private async getCategoriesVisibility(categoryIds: Id64Array): Promise<Visibility> {\n const subCategoriesVisibilities = await Promise.all(\n categoryIds.map(async (categoryId) => {\n const subCategories = await this._idsCache.getSubCategories(categoryId);\n return this.getSubCategoriesVisibility(subCategories, categoryId);\n }),\n );\n let visibility: \"visible\" | \"hidden\" | \"unknown\" = \"unknown\";\n\n for (const subCategoriesVisibility of subCategoriesVisibilities) {\n if (subCategoriesVisibility === \"partial\") {\n return \"partial\";\n }\n if (subCategoriesVisibility === \"hidden\" && visibility === \"visible\") {\n return \"partial\";\n }\n if (subCategoriesVisibility === \"visible\" && visibility === \"hidden\") {\n return \"partial\";\n }\n visibility = subCategoriesVisibility;\n }\n assert(visibility !== \"unknown\");\n return visibility;\n }\n\n private async enableCategoriesElementModelsVisibility(categoryIds: Id64Array) {\n const categoriesModelsMap = await this._idsCache.getCategoriesElementModels(categoryIds);\n const modelIds = [...categoriesModelsMap.values()].flat();\n const hiddenModels = modelIds.filter((modelId) => !this._viewport.view.viewsModel(modelId));\n if (hiddenModels.length > 0) {\n this._viewport.changeModelDisplay(hiddenModels, true);\n }\n }\n\n private async changeSubCategoryVisibility(node: HierarchyNode, on: boolean) {\n const parentCategoryId = node.extendedData?.categoryId;\n\n // make sure parent category and models are enabled\n if (on && parentCategoryId) {\n await Promise.all([this.enableCategoriesElementModelsVisibility([parentCategoryId]), this.changeCategoryState([parentCategoryId], true, false)]);\n }\n\n const subCategoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n subCategoryIds.forEach((id) => {\n this.changeSubCategoryState(id, on);\n });\n }\n private async changeCategoryVisibility(categoryIds: Id64Array, on: boolean) {\n // make sure models are enabled\n if (on) {\n await this.enableCategoriesElementModelsVisibility(categoryIds);\n }\n return this.changeCategoryState(categoryIds, on, on);\n }\n\n private async changeDefinitionContainerVisibility(node: HierarchyNode, on: boolean) {\n const definitionContainerId = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n const childCategories = await this._idsCache.getAllContainedCategories(definitionContainerId);\n return this.changeCategoryVisibility(childCategories, on);\n }\n\n private onDisplayStyleChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onViewedCategoriesChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onViewedCategoriesPerModelChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onViewedModelsChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onVisibilityChangeInternal() {\n if (this._pendingVisibilityChange) {\n return;\n }\n\n this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n private static getInstanceIdsFromHierarchyNode(node: HierarchyNode) {\n return HierarchyNode.isInstancesNode(node) ? node.key.instanceKeys.map((instanceKey) => instanceKey.id) : /* istanbul ignore next */ [];\n }\n\n private async changeCategoryState(ids: string[], enabled: boolean, enableAllSubCategories: boolean) {\n await enableCategoryDisplay(this._viewport, ids, enabled, enableAllSubCategories);\n }\n\n private changeSubCategoryState(key: string, enabled: boolean) {\n enableSubCategoryDisplay(this._viewport, key, enabled);\n }\n}\n"]}
1
+ {"version":3,"file":"CategoriesVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAAsD;AACtD,wDAAkE;AAClE,8EAAgE;AAChE,4FAA4G;AAC5G,wDAAiE;AACjE,mEAA6D;AAc7D,gBAAgB;AAChB,MAAa,2BAA2B;IACtC,wBAAwB,CAAM;IAC9B,SAAS,CAAW;IACpB,SAAS,CAAyB;IAElC,YAAY,KAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACrF,IAAI,CAAC,SAAS,CAAC,iCAAiC,CAAC,WAAW,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QACrG,IAAI,CAAC,S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ACzD,CAAC;CACF;AA7OD,kEA6OC","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 { assert, BeEvent } from \"@itwin/core-bentley\";\nimport { PerModelCategoryVisibility } from \"@itwin/core-frontend\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { enableCategoryDisplay, enableSubCategoryDisplay } from \"../../common/CategoriesVisibilityUtils.js\";\nimport { createVisibilityStatus } from \"../../common/Tooltip.js\";\nimport { CategoriesTreeNode } from \"./CategoriesTreeNode.js\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { Visibility } from \"../../common/Tooltip.js\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../../common/UseHierarchyVisibility.js\";\nimport type { CategoriesTreeIdsCache } from \"./CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport interface CategoriesVisibilityHandlerProps {\n viewport: Viewport;\n idsCache: CategoriesTreeIdsCache;\n}\n\n/** @internal */\nexport class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {\n #pendingVisibilityChange: any;\n #viewport: Viewport;\n #idsCache: CategoriesTreeIdsCache;\n\n constructor(props: CategoriesVisibilityHandlerProps) {\n this.#idsCache = props.idsCache;\n this.#viewport = props.viewport;\n this.#viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this.#viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n this.#viewport.onViewedCategoriesPerModelChanged.addListener(this.onViewedCategoriesPerModelChanged);\n this.#viewport.onViewedModelsChanged.addListener(this.onViewedModelsChanged);\n }\n\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public [Symbol.dispose]() {\n this.#viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this.#viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n this.#viewport.onViewedCategoriesPerModelChanged.removeListener(this.onViewedCategoriesPerModelChanged);\n this.#viewport.onViewedModelsChanged.removeListener(this.onViewedModelsChanged);\n clearTimeout(this.#pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent();\n\n /** Returns visibility status of the tree node. */\n public async getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> {\n if (!HierarchyNode.isInstancesNode(node)) {\n return { state: \"hidden\", isDisabled: true };\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n if (!node.extendedData?.categoryId) {\n return { state: \"hidden\", isDisabled: true };\n }\n return createVisibilityStatus(\n await this.getSubCategoriesVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node), node.extendedData.categoryId),\n );\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return createVisibilityStatus(await this.getCategoriesVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node)));\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return createVisibilityStatus(await this.getDefinitionContainerVisibility(node));\n }\n\n return { state: \"hidden\", isDisabled: true };\n }\n\n public async changeVisibility(node: HierarchyNode, on: boolean) {\n if (!HierarchyNode.isInstancesNode(node)) {\n return;\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.changeCategoryVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node), on);\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.changeSubCategoryVisibility(node, on);\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.changeDefinitionContainerVisibility(node, on);\n }\n }\n\n private async getSubCategoriesVisibility(subCategoryIds: Id64Array, parentCategoryId: Id64String): Promise<Visibility> {\n let visibility: \"visible\" | \"hidden\" | \"unknown\" = \"unknown\";\n const categoryModels = [...(await this.#idsCache.getCategoriesElementModels([parentCategoryId])).values()].flat();\n let nonDefaultModelDisplayStatesCount = 0;\n for (const modelId of categoryModels) {\n if (!this.#viewport.view.viewsModel(modelId)) {\n if (visibility === \"visible\") {\n return \"partial\";\n }\n visibility = \"hidden\";\n ++nonDefaultModelDisplayStatesCount;\n continue;\n }\n const override = this.#viewport.perModelCategoryVisibility.getOverride(modelId, parentCategoryId);\n if (override === PerModelCategoryVisibility.Override.Show) {\n if (visibility === \"hidden\") {\n return \"partial\";\n }\n visibility = \"visible\";\n ++nonDefaultModelDisplayStatesCount;\n continue;\n }\n if (override === PerModelCategoryVisibility.Override.Hide) {\n if (visibility === \"visible\") {\n return \"partial\";\n }\n visibility = \"hidden\";\n ++nonDefaultModelDisplayStatesCount;\n continue;\n }\n }\n if (categoryModels.length > 0 && nonDefaultModelDisplayStatesCount === categoryModels.length) {\n assert(visibility === \"visible\" || visibility === \"hidden\");\n return visibility;\n }\n\n if (!this.#viewport.view.viewsCategory(parentCategoryId)) {\n return visibility === \"visible\" ? \"partial\" : \"hidden\";\n }\n\n if (subCategoryIds.length === 0) {\n if (visibility === \"hidden\") {\n return \"partial\";\n }\n return \"visible\";\n }\n\n for (const subCategoryId of subCategoryIds) {\n const isSubCategoryVisible = this.#viewport.isSubCategoryVisible(subCategoryId);\n if (isSubCategoryVisible && visibility === \"hidden\") {\n return \"partial\";\n }\n if (!isSubCategoryVisible && visibility === \"visible\") {\n return \"partial\";\n }\n visibility = isSubCategoryVisible ? \"visible\" : \"hidden\";\n }\n assert(visibility === \"visible\" || visibility === \"hidden\");\n return visibility;\n }\n\n private async getDefinitionContainerVisibility(node: HierarchyNode): Promise<Visibility> {\n const categoryIds = await this.#idsCache.getAllContainedCategories(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node));\n return this.getCategoriesVisibility(categoryIds);\n }\n\n private async getCategoriesVisibility(categoryIds: Id64Array): Promise<Visibility> {\n const subCategoriesVisibilities = await Promise.all(\n categoryIds.map(async (categoryId) => {\n const subCategories = await this.#idsCache.getSubCategories(categoryId);\n return this.getSubCategoriesVisibility(subCategories, categoryId);\n }),\n );\n let visibility: \"visible\" | \"hidden\" | \"unknown\" = \"unknown\";\n\n for (const subCategoriesVisibility of subCategoriesVisibilities) {\n if (subCategoriesVisibility === \"partial\") {\n return \"partial\";\n }\n if (subCategoriesVisibility === \"hidden\" && visibility === \"visible\") {\n return \"partial\";\n }\n if (subCategoriesVisibility === \"visible\" && visibility === \"hidden\") {\n return \"partial\";\n }\n visibility = subCategoriesVisibility;\n }\n assert(visibility !== \"unknown\");\n return visibility;\n }\n\n private async enableCategoriesElementModelsVisibility(categoryIds: Id64Array) {\n const categoriesModelsMap = await this.#idsCache.getCategoriesElementModels(categoryIds);\n const modelIds = [...categoriesModelsMap.values()].flat();\n const hiddenModels = modelIds.filter((modelId) => !this.#viewport.view.viewsModel(modelId));\n if (hiddenModels.length > 0) {\n this.#viewport.changeModelDisplay(hiddenModels, true);\n }\n }\n\n private async changeSubCategoryVisibility(node: HierarchyNode, on: boolean) {\n const parentCategoryId = node.extendedData?.categoryId;\n\n // make sure parent category and models are enabled\n if (on && parentCategoryId) {\n await Promise.all([this.enableCategoriesElementModelsVisibility([parentCategoryId]), this.changeCategoryState([parentCategoryId], true, false)]);\n }\n\n const subCategoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n subCategoryIds.forEach((id) => {\n this.changeSubCategoryState(id, on);\n });\n }\n private async changeCategoryVisibility(categoryIds: Id64Array, on: boolean) {\n // make sure models are enabled\n if (on) {\n await this.enableCategoriesElementModelsVisibility(categoryIds);\n }\n return this.changeCategoryState(categoryIds, on, on);\n }\n\n private async changeDefinitionContainerVisibility(node: HierarchyNode, on: boolean) {\n const definitionContainerId = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n const childCategories = await this.#idsCache.getAllContainedCategories(definitionContainerId);\n return this.changeCategoryVisibility(childCategories, on);\n }\n\n private onDisplayStyleChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onViewedCategoriesChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onViewedCategoriesPerModelChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onViewedModelsChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onVisibilityChangeInternal() {\n if (this.#pendingVisibilityChange) {\n return;\n }\n\n this.#pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this.#pendingVisibilityChange = undefined;\n }, 0);\n }\n\n private static getInstanceIdsFromHierarchyNode(node: HierarchyNode) {\n return HierarchyNode.isInstancesNode(node) ? node.key.instanceKeys.map((instanceKey) => instanceKey.id) : /* istanbul ignore next */ [];\n }\n\n private async changeCategoryState(ids: string[], enabled: boolean, enableAllSubCategories: boolean) {\n await enableCategoryDisplay(this.#viewport, ids, enabled, enableAllSubCategories);\n }\n\n private changeSubCategoryState(key: string, enabled: boolean) {\n enableSubCategoryDisplay(this.#viewport, key, enabled);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { Id64Array } from "@itwin/core-bentley";
1
+ import type { GuidString, Id64Array } from "@itwin/core-bentley";
2
2
  import type { Viewport } from "@itwin/core-frontend";
3
3
  /**
4
4
  * Data structure that describes category.
@@ -8,11 +8,6 @@ export interface CategoryInfo {
8
8
  categoryId: string;
9
9
  subCategoryIds?: string[];
10
10
  }
11
- /**
12
- * Toggles visibility of categories to show or hide.
13
- * @internal
14
- */
15
- export declare function toggleAllCategories(viewport: Viewport, display: boolean): Promise<void>;
16
11
  /**
17
12
  * Changes category display in the viewport.
18
13
  * @internal
@@ -24,7 +19,7 @@ export declare function enableCategoryDisplay(viewport: Viewport, categoryIds: I
24
19
  */
25
20
  export declare function enableSubCategoryDisplay(viewport: Viewport, key: string, enabled: boolean): void;
26
21
  /** @internal */
27
- export declare function loadCategoriesFromViewport(vp: Viewport): Promise<CategoryInfo[]>;
22
+ export declare function loadCategoriesFromViewport(vp: Viewport, componentId?: GuidString): Promise<CategoryInfo[]>;
28
23
  /**
29
24
  * Enable display of all given categories.
30
25
  * @public
@@ -4,33 +4,15 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toggleAllCategories = toggleAllCategories;
8
7
  exports.enableCategoryDisplay = enableCategoryDisplay;
9
8
  exports.enableSubCategoryDisplay = enableSubCategoryDisplay;
10
9
  exports.loadCategoriesFromViewport = loadCategoriesFromViewport;
11
10
  exports.showAllCategories = showAllCategories;
12
11
  exports.hideAllCategories = hideAllCategories;
13
12
  exports.invertAllCategories = invertAllCategories;
13
+ const core_bentley_1 = require("@itwin/core-bentley");
14
14
  const core_common_1 = require("@itwin/core-common");
15
15
  const core_frontend_1 = require("@itwin/core-frontend");
16
- /**
17
- * Toggles visibility of categories to show or hide.
18
- * @internal
19
- */
20
- async function toggleAllCategories(viewport, display) {
21
- const ids = await getCategories(viewport);
22
- if (ids.length === 0) {
23
- return;
24
- }
25
- await enableCategoryDisplay(viewport, ids, display);
26
- }
27
- /**
28
- * Gets ids of all categories from specified imodel and viewport.
29
- */
30
- async function getCategories(viewport) {
31
- const categories = await loadCategoriesFromViewport(viewport);
32
- return categories.map((category) => category.categoryId);
33
- }
34
16
  /**
35
17
  * Changes category display in the viewport.
36
18
  * @internal
@@ -60,14 +42,19 @@ function enableSubCategoryDisplay(viewport, key, enabled) {
60
42
  viewport.changeSubCategoryDisplay(key, enabled);
61
43
  }
62
44
  /** @internal */
63
- async function loadCategoriesFromViewport(vp) {
45
+ async function loadCategoriesFromViewport(vp, componentId) {
64
46
  // Query categories and add them to state
65
47
  const selectUsedSpatialCategoryIds = "SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)";
66
48
  const selectUsedDrawingCategoryIds = "SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)";
67
49
  const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;
68
50
  const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? "BisCore.SpatialCategory" : "BisCore.DrawingCategory"} WHERE ECInstanceId IN (${ecsql})`;
69
51
  const categories = [];
70
- const rows = await vp.iModel.createQueryReader(ecsql2, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }).toArray();
52
+ const rows = await vp.iModel
53
+ .createQueryReader(ecsql2, undefined, {
54
+ rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames,
55
+ restartToken: `CategoriesVisibilityUtils/${componentId ?? core_bentley_1.Guid.createValue()}/categories`,
56
+ })
57
+ .toArray();
71
58
  (await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {
72
59
  categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });
73
60
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAqBhG,kDAOC;AAcD,sDAkBC;AAMD,4DAEC;AAGD,gEAgBC;AAMD,8CAEC;AAMD,8CAEC;AAUD,kDA4BC;AA3ID,oDAAoD;AACpD,wDAAkE;AAclE;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CAAC,QAAkB,EAAE,OAAgB;IAC5E,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,MAAM,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,aAAa,CAAC,QAAkB;IAC7C,MAAM,UAAU,GAAG,MAAM,0BAA0B,CAAC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AC;YACnC,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,MAAM,qBAAqB,CAAC,QAAQ,EAAE,CAAC,GAAG,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAE7E,MAAM,qBAAqB,CAAC,QAAQ,EAAE,CAAC,GAAG,kBAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7E,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 { QueryRowFormat } from \"@itwin/core-common\";\nimport { PerModelCategoryVisibility } from \"@itwin/core-frontend\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Data structure that describes category.\n * @beta\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Toggles visibility of categories to show or hide.\n * @internal\n */\nexport async function toggleAllCategories(viewport: Viewport, display: boolean) {\n const ids = await getCategories(viewport);\n if (ids.length === 0) {\n return;\n }\n\n await enableCategoryDisplay(viewport, ids, display);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n */\nasync function getCategories(viewport: Viewport) {\n const categories = await loadCategoriesFromViewport(viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/**\n * Changes category display in the viewport.\n * @internal\n */\nexport async function enableCategoryDisplay(viewport: Viewport, categoryIds: Id64Array, enabled: boolean, enableAllSubCategories = true) {\n viewport.changeCategoryDisplay(categoryIds, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of viewport.perModelCategoryVisibility) {\n if (categoryIds.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n viewport.perModelCategoryVisibility.setOverride(modelsContainingOverrides, categoryIds, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await viewport.iModel.categories.getCategoryInfo(categoryIds)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewport, value.id, false));\n });\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n * @internal\n */\nexport function enableSubCategoryDisplay(viewport: Viewport, key: string, enabled: boolean) {\n viewport.changeSubCategoryDisplay(key, enabled);\n}\n\n/** @internal */\nexport async function loadCategoriesFromViewport(vp: Viewport) {\n // Query categories and add them to state\n const selectUsedSpatialCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)\";\n const selectUsedDrawingCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)\";\n const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;\n const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? \"BisCore.SpatialCategory\" : \"BisCore.DrawingCategory\"} WHERE ECInstanceId IN (${ecsql})`;\n\n const categories: CategoryInfo[] = [];\n\n const rows = await vp.iModel.createQueryReader(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n return categories;\n}\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(viewport, categories, true, true);\n}\n\n/**\n * Disable display of all given categories.\n * @public\n */\nexport async function hideAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(viewport, categories, false, true);\n}\n\n/**\n * Invert display of all given categories.\n * Categories are inverted like this:\n * - If category is visible, it will be hidden.\n * - If category is hidden, it will be visible.\n * - If category is partially visible, it will be fully visible.\n * @public\n */\nexport async function invertAllCategories(categories: CategoryInfo[], viewport: Viewport) {\n const categoriesToEnable = new Set<Id64String>();\n const categoriesToDisable = new Set<Id64String>();\n\n for (const category of categories) {\n if (!viewport.view.viewsCategory(category.categoryId)) {\n categoriesToEnable.add(category.categoryId);\n continue;\n }\n // Check if category is in partial state\n if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {\n categoriesToEnable.add(category.categoryId);\n } else {\n categoriesToDisable.add(category.categoryId);\n }\n }\n\n // collect per model overrides that need to be inverted\n for (const { categoryId, visible } of viewport.perModelCategoryVisibility) {\n if (!visible && categoriesToDisable.has(categoryId)) {\n categoriesToEnable.add(categoryId);\n categoriesToDisable.delete(categoryId);\n }\n }\n\n await enableCategoryDisplay(viewport, [...categoriesToDisable], false, true);\n\n await enableCategoryDisplay(viewport, [...categoriesToEnable], true, true);\n}\n"]}
1
+ {"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAsBhG,sDAkBC;AAMD,4DAEC;AAGD,gEAqBC;AAMD,8CAEC;AAMD,8CAEC;AAUD,kDA4BC;AA5HD,sDAA2C;AAC3C,oDAAoD;AACpD,wDAAkE;AAclE;;;GAGG;AACI,KAAK,UAAU,qBAAqB,CAAC,QAAkB,EAAE,WAAsB,EAAE,OAAgB,EAAE,sBAAsB,GAAG,IAAI;IACrI,QAAQ,CAAC,qBAAqB,CAAC,WAAW,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IAE7E,sCAAsC;IACtC,MAAM,yBAAyB,GAAa,EAAE,CAAC;IAC/C,KAAK,MAAM,GAAG,IAAI,QAAQ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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 { Guid } from \"@itwin/core-bentley\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { PerModelCategoryVisibility } from \"@itwin/core-frontend\";\n\nimport type { GuidString, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Data structure that describes category.\n * @beta\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/**\n * Changes category display in the viewport.\n * @internal\n */\nexport async function enableCategoryDisplay(viewport: Viewport, categoryIds: Id64Array, enabled: boolean, enableAllSubCategories = true) {\n viewport.changeCategoryDisplay(categoryIds, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of viewport.perModelCategoryVisibility) {\n if (categoryIds.findIndex((id) => id === ovr.categoryId) !== -1) {\n modelsContainingOverrides.push(ovr.modelId);\n }\n }\n viewport.perModelCategoryVisibility.setOverride(modelsContainingOverrides, categoryIds, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await viewport.iModel.categories.getCategoryInfo(categoryIds)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategoryDisplay(viewport, value.id, false));\n });\n }\n}\n\n/**\n * Changes subcategory display in the viewport\n * @internal\n */\nexport function enableSubCategoryDisplay(viewport: Viewport, key: string, enabled: boolean) {\n viewport.changeSubCategoryDisplay(key, enabled);\n}\n\n/** @internal */\nexport async function loadCategoriesFromViewport(vp: Viewport, componentId?: GuidString) {\n // Query categories and add them to state\n const selectUsedSpatialCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)\";\n const selectUsedDrawingCategoryIds =\n \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)\";\n const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;\n const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? \"BisCore.SpatialCategory\" : \"BisCore.DrawingCategory\"} WHERE ECInstanceId IN (${ecsql})`;\n\n const categories: CategoryInfo[] = [];\n\n const rows = await vp.iModel\n .createQueryReader(ecsql2, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n restartToken: `CategoriesVisibilityUtils/${componentId ?? Guid.createValue()}/categories`,\n })\n .toArray();\n (await vp.iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n return categories;\n}\n\n/**\n * Enable display of all given categories.\n * @public\n */\nexport async function showAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(viewport, categories, true, true);\n}\n\n/**\n * Disable display of all given categories.\n * @public\n */\nexport async function hideAllCategories(categories: string[], viewport: Viewport) {\n await enableCategoryDisplay(viewport, categories, false, true);\n}\n\n/**\n * Invert display of all given categories.\n * Categories are inverted like this:\n * - If category is visible, it will be hidden.\n * - If category is hidden, it will be visible.\n * - If category is partially visible, it will be fully visible.\n * @public\n */\nexport async function invertAllCategories(categories: CategoryInfo[], viewport: Viewport) {\n const categoriesToEnable = new Set<Id64String>();\n const categoriesToDisable = new Set<Id64String>();\n\n for (const category of categories) {\n if (!viewport.view.viewsCategory(category.categoryId)) {\n categoriesToEnable.add(category.categoryId);\n continue;\n }\n // Check if category is in partial state\n if (category.subCategoryIds?.some((subCategory) => !viewport.isSubCategoryVisible(subCategory))) {\n categoriesToEnable.add(category.categoryId);\n } else {\n categoriesToDisable.add(category.categoryId);\n }\n }\n\n // collect per model overrides that need to be inverted\n for (const { categoryId, visible } of viewport.perModelCategoryVisibility) {\n if (!visible && categoriesToDisable.has(categoryId)) {\n categoriesToEnable.add(categoryId);\n categoriesToDisable.delete(categoryId);\n }\n }\n\n await enableCategoryDisplay(viewport, [...categoriesToDisable], false, true);\n\n await enableCategoryDisplay(viewport, [...categoriesToEnable], true, true);\n}\n"]}
@@ -1,14 +1,17 @@
1
+ import type { GuidString } from "@itwin/core-bentley";
1
2
  import type { IModelConnection } from "@itwin/core-frontend";
2
3
  /** @internal */
3
4
  export interface CreateCacheProps<TCacheSpecificProps> {
4
5
  imodel: IModelConnection;
5
6
  specificProps: TCacheSpecificProps;
7
+ componentId: GuidString;
6
8
  }
7
9
  /** @internal */
8
10
  export interface UseIdsCacheProps<TCache, TCacheSpecificProps> {
9
11
  imodel: IModelConnection;
10
12
  createCache: (props: CreateCacheProps<TCacheSpecificProps>) => TCache;
11
13
  cacheSpecificProps: TCacheSpecificProps;
14
+ componentId: GuidString;
12
15
  }
13
16
  /** @internal */
14
17
  export declare function useIdsCache<TCache extends Disposable, TCacheSpecificProps extends object>(props: UseIdsCacheProps<TCache, TCacheSpecificProps>): {
@@ -15,32 +15,32 @@ function useIdsCache(props) {
15
15
  cacheRef.current = undefined;
16
16
  });
17
17
  const { imodel, createCache, cacheSpecificProps } = props;
18
- const createCacheGetterRef = (0, react_1.useRef)((currImodel, specificProps) => {
18
+ const createCacheGetterRef = (0, react_1.useRef)((currImodel, specificProps, componentId) => {
19
19
  return () => {
20
20
  if (cacheRef.current === undefined) {
21
- cacheRef.current = createCache({ imodel: currImodel, specificProps });
21
+ cacheRef.current = createCache({ imodel: currImodel, specificProps, componentId });
22
22
  }
23
23
  return cacheRef.current;
24
24
  };
25
25
  });
26
- const [getCache, setCacheGetter] = (0, react_1.useState)(() => createCacheGetterRef.current(imodel, cacheSpecificProps));
26
+ const [getCache, setCacheGetter] = (0, react_1.useState)(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));
27
27
  (0, react_1.useEffect)(() => {
28
28
  // clear cache in case it was created before `useEffect` was run first time
29
29
  clearCacheRef.current();
30
30
  // make sure all cache users rerender
31
- setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps));
31
+ setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));
32
32
  return () => {
33
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
34
  clearCacheRef.current();
35
35
  };
36
- }, [imodel, cacheSpecificProps]);
36
+ }, [imodel, cacheSpecificProps, props.componentId]);
37
37
  (0, UseIModelChangeListener_js_1.useIModelChangeListener)({
38
38
  imodel,
39
39
  action: (0, react_1.useCallback)(() => {
40
40
  clearCacheRef.current();
41
41
  // make sure all cache users rerender
42
- setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps));
43
- }, [imodel, cacheSpecificProps]),
42
+ setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));
43
+ }, [imodel, cacheSpecificProps, props.componentId]),
44
44
  });
45
45
  return {
46
46
  getCache,
@@ -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;;AAqBhG,kCA6CC;AAhED,iCAAiE;AACjE,iFAA2E;AAiB3E,gBAAgB;AAChB,SAAgB,WAAW,CACzB,KAAoD;IAEpD,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAqB,SAAS,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,GAAG,EAAE;QAChC,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;QACvC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/B,CAAC,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAE1D,MAAM,oBAAo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------------------------------------\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, useRef, useState } from \"react\";\nimport { useIModelChangeListener } from \"../../UseIModelChangeListener.js\";\n\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface CreateCacheProps<TCacheSpecificProps> {\n imodel: IModelConnection;\n specificProps: TCacheSpecificProps;\n}\n\n/** @internal */\nexport interface UseIdsCacheProps<TCache, TCacheSpecificProps> {\n imodel: IModelConnection;\n createCache: (props: CreateCacheProps<TCacheSpecificProps>) => TCache;\n cacheSpecificProps: TCacheSpecificProps;\n}\n\n/** @internal */\nexport function useIdsCache<TCache extends Disposable, TCacheSpecificProps extends object>(\n props: UseIdsCacheProps<TCache, TCacheSpecificProps>,\n): { getCache: () => TCache } {\n const cacheRef = useRef<TCache | undefined>(undefined);\n const clearCacheRef = useRef(() => {\n cacheRef.current?.[Symbol.dispose]?.();\n cacheRef.current = undefined;\n });\n const { imodel, createCache, cacheSpecificProps } = props;\n\n const createCacheGetterRef = useRef((currImodel: IModelConnection, specificProps: TCacheSpecificProps) => {\n return () => {\n if (cacheRef.current === undefined) {\n cacheRef.current = createCache({ imodel: currImodel, specificProps });\n }\n return cacheRef.current;\n };\n });\n\n const [getCache, setCacheGetter] = useState<() => TCache>(() => createCacheGetterRef.current(imodel, cacheSpecificProps));\n\n useEffect(() => {\n // clear cache in case it was created before `useEffect` was run first time\n clearCacheRef.current();\n\n // make sure all cache users rerender\n setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps));\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n clearCacheRef.current();\n };\n }, [imodel, cacheSpecificProps]);\n\n useIModelChangeListener({\n imodel,\n action: useCallback(() => {\n clearCacheRef.current();\n // make sure all cache users rerender\n setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps));\n }, [imodel, cacheSpecificProps]),\n });\n\n return {\n getCache,\n };\n}\n"]}
1
+ {"version":3,"file":"UseIdsCache.js","sourceRoot":"","sources":["../../../../../../../../src/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwBhG,kCA6CC;AAnED,iCAAiE;AACjE,iFAA2E;AAoB3E,gBAAgB;AAChB,SAAgB,WAAW,CACzB,KAAoD;IAEpD,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAqB,SAAS,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,GAAG,EAAE;QAChC,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;QACvC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/B,CAAC,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAE1D,MAAM,oBAAoB,GAAG,IAAA,cAAM,EAAC,CAAC,UAA4B,EAAE,aAAkC,EAAE,WAAuB,EAAE,EAAE;QAChI,OAAO,GAAG,EAAE;YACV,IAAI,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACnC,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,CAAC;YACrF,CAAC;YACD,OAAO,QAAQ,CAAC,OAAO,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAe,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAE7I,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,2EAA2E;QAC3E,aAAa,CAAC,OAAO,EAAE,CAAC;QAExB,qCAAqC;QACrC,cAAc,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;QAClG,OAAO,GAAG,EAAE;YACV,uDAAuD;YACvD,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAEpD,IAAA,oDAAuB,EAAC;QACtB,MAAM;QACN,MAAM,EAAE,IAAA,mBAAW,EAAC,GAAG,EAAE;YACvB,aAAa,CAAC,OAAO,EAAE,CAAC;YACxB,qCAAqC;YACrC,cAAc,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;QACpG,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;KACpD,CAAC,CAAC;IAEH,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, useEffect, useRef, useState } from \"react\";\nimport { useIModelChangeListener } from \"../../UseIModelChangeListener.js\";\n\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface CreateCacheProps<TCacheSpecificProps> {\n imodel: IModelConnection;\n specificProps: TCacheSpecificProps;\n componentId: GuidString;\n}\n\n/** @internal */\nexport interface UseIdsCacheProps<TCache, TCacheSpecificProps> {\n imodel: IModelConnection;\n createCache: (props: CreateCacheProps<TCacheSpecificProps>) => TCache;\n cacheSpecificProps: TCacheSpecificProps;\n componentId: GuidString;\n}\n\n/** @internal */\nexport function useIdsCache<TCache extends Disposable, TCacheSpecificProps extends object>(\n props: UseIdsCacheProps<TCache, TCacheSpecificProps>,\n): { getCache: () => TCache } {\n const cacheRef = useRef<TCache | undefined>(undefined);\n const clearCacheRef = useRef(() => {\n cacheRef.current?.[Symbol.dispose]?.();\n cacheRef.current = undefined;\n });\n const { imodel, createCache, cacheSpecificProps } = props;\n\n const createCacheGetterRef = useRef((currImodel: IModelConnection, specificProps: TCacheSpecificProps, componentId: GuidString) => {\n return () => {\n if (cacheRef.current === undefined) {\n cacheRef.current = createCache({ imodel: currImodel, specificProps, componentId });\n }\n return cacheRef.current;\n };\n });\n\n const [getCache, setCacheGetter] = useState<() => TCache>(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));\n\n useEffect(() => {\n // clear cache in case it was created before `useEffect` was run first time\n clearCacheRef.current();\n\n // make sure all cache users rerender\n setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n clearCacheRef.current();\n };\n }, [imodel, cacheSpecificProps, props.componentId]);\n\n useIModelChangeListener({\n imodel,\n action: useCallback(() => {\n clearCacheRef.current();\n // make sure all cache users rerender\n setCacheGetter(() => createCacheGetterRef.current(imodel, cacheSpecificProps, props.componentId));\n }, [imodel, cacheSpecificProps, props.componentId]),\n });\n\n return {\n getCache,\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function useGuid(): string;
2
+ //# sourceMappingURL=useGuid.d.ts.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.useGuid = useGuid;
8
+ const react_1 = require("react");
9
+ const core_bentley_1 = require("@itwin/core-bentley");
10
+ function useGuid() {
11
+ const [componentId] = (0, react_1.useState)(() => core_bentley_1.Guid.createValue());
12
+ return componentId;
13
+ }
14
+ //# sourceMappingURL=useGuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGuid.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/useGuid.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAKhG,0BAGC;AAND,iCAAiC;AACjC,sDAA2C;AAE3C,SAAgB,OAAO;IACrB,MAAM,CAAC,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,mBAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC;AACrB,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 { useState } from \"react\";\nimport { Guid } from \"@itwin/core-bentley\";\n\nexport function useGuid() {\n const [componentId] = useState(() => Guid.createValue());\n return componentId;\n}\n"]}
@@ -6,14 +6,17 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
7
7
  * See LICENSE.md in the project root for license terms and full copyright notice.
8
8
  *--------------------------------------------------------------------------------------------*/
9
+ const react_1 = require("react");
9
10
  const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
10
11
  const Tree_js_1 = require("../common/components/Tree.js");
11
12
  const TreeRenderer_js_1 = require("../common/components/TreeRenderer.js");
13
+ const useGuid_js_1 = require("../common/useGuid.js");
12
14
  const ExternalSourcesTreeComponent_js_1 = require("./ExternalSourcesTreeComponent.js");
13
15
  const ExternalSourcesTreeDefinition_js_1 = require("./ExternalSourcesTreeDefinition.js");
14
16
  /** @beta */
15
17
  function ExternalSourcesTree(props) {
16
- return ((0, jsx_runtime_1.jsx)(Tree_js_1.Tree, { ...props, treeName: ExternalSourcesTreeComponent_js_1.ExternalSourcesTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: props.selectionMode ?? "none", treeRenderer: (treeProps) => (0, jsx_runtime_1.jsx)(TreeRenderer_js_1.TreeRenderer, { ...treeProps, getIcon: getIcon }) }));
18
+ const componentId = (0, useGuid_js_1.useGuid)();
19
+ return ((0, jsx_runtime_1.jsx)(Tree_js_1.Tree, { ...props, treeName: ExternalSourcesTreeComponent_js_1.ExternalSourcesTreeComponent.id, getHierarchyDefinition: (0, react_1.useCallback)((definitionProps) => getDefinitionsProvider({ ...definitionProps, componentId }), [componentId]), selectionMode: props.selectionMode ?? "none", treeRenderer: (treeProps) => (0, jsx_runtime_1.jsx)(TreeRenderer_js_1.TreeRenderer, { ...treeProps, getIcon: getIcon }) }));
17
20
  }
18
21
  const getDefinitionsProvider = (props) => {
19
22
  return new ExternalSourcesTreeDefinition_js_1.ExternalSourcesTreeDefinition(props);
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";;AAuBA,kDAUC;;AAjCD;;;gGAGgG;AAEhG,oEAA8E;AAC9E,0DAAoD;AACpD,0EAAoE;AACpE,uFAAiF;AACjF,yFAAmF;AAanF,YAAY;AACZ,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,OAAO,CACL,uBAAC,cAAI,OACC,KAAK,EACT,QAAQ,EAAE,8DAA4B,CAAC,EAAE,EACzC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,MAAM,EAC5C,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,uBAAC,8BAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,GAAI,GAC9E,CACH,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAwC,CAAC,KAAK,EAAE,EAAE;IAC5E,OAAO,IAAI,gEAA6B,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,IAA+B;IAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAClC,KAAK,WAAW;YACd,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,iCAAW,KAAG,CAAC;QACzB,KAAK,gBAAgB;YACnB,OAAO,uBAAC,gCAAU,KAAG,CAAC;IAC1B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,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 { SvgDetails, SvgDocument, SvgItem } from \"@itwin/itwinui-icons-react\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent.js\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition.js\";\n\nimport type { TreeProps } from \"../common/components/Tree.js\";\nimport type { ReactElement } from \"react\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\n/** @beta */\nexport type ExternalSourcesTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"selectionMode\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n};\n\n/** @beta */\nexport function ExternalSourcesTree(props: ExternalSourcesTreeProps) {\n return (\n <Tree\n {...props}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={props.selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => <TreeRenderer {...treeProps} getIcon={getIcon} />}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = (props) => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgItem />;\n case \"icon-document\":\n return <SvgDocument />;\n case \"icon-ec-schema\":\n return <SvgDetails />;\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";;AA2BA,kDAWC;;AAtCD;;;gGAGgG;AAEhG,iCAAoC;AACpC,oEAA8E;AAC9E,0DAAoD;AACpD,0EAAoE;AACpE,qDAA+C;AAC/C,uFAAiF;AACjF,yFAAmF;AAenF,YAAY;AACZ,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,MAAM,WAAW,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC9B,OAAO,CACL,uBAAC,cAAI,OACC,KAAK,EACT,QAAQ,EAAE,8DAA4B,CAAC,EAAE,EACzC,sBAAsB,EAAE,IAAA,mBAAW,EAAC,CAAC,eAAe,EAAE,EAAE,CAAC,sBAAsB,CAAC,EAAE,GAAG,eAAe,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,EACpI,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,MAAM,EAC5C,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,uBAAC,8BAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,GAAI,GAC9E,CACH,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAG,CAAC,KAAuF,EAAuB,EAAE;IAC9I,OAAO,IAAI,gEAA6B,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,IAA+B;IAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAClC,KAAK,WAAW;YACd,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,iCAAW,KAAG,CAAC;QACzB,KAAK,gBAAgB;YACnB,OAAO,uBAAC,gCAAU,KAAG,CAAC;IAC1B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,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 } from \"react\";\nimport { SvgDetails, SvgDocument, SvgItem } from \"@itwin/itwinui-icons-react\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { useGuid } from \"../common/useGuid.js\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent.js\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition.js\";\n\nimport type { ReactElement } from \"react\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { HierarchyDefinition } from \"@itwin/presentation-hierarchies\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n\n/** @beta */\nexport type ExternalSourcesTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"selectionMode\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n};\n\n/** @beta */\nexport function ExternalSourcesTree(props: ExternalSourcesTreeProps) {\n const componentId = useGuid();\n return (\n <Tree\n {...props}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={useCallback((definitionProps) => getDefinitionsProvider({ ...definitionProps, componentId }), [componentId])}\n selectionMode={props.selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => <TreeRenderer {...treeProps} getIcon={getIcon} />}\n />\n );\n}\n\nconst getDefinitionsProvider = (props: Parameters<TreeProps[\"getHierarchyDefinition\"]>[0] & { componentId: GuidString }): HierarchyDefinition => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgItem />;\n case \"icon-document\":\n return <SvgDocument />;\n case \"icon-ec-schema\":\n return <SvgDetails />;\n }\n\n return undefined;\n}\n"]}
@@ -1,14 +1,12 @@
1
- import type { ECClassHierarchyInspector, ECSchemaProvider } from "@itwin/presentation-shared";
1
+ import type { GuidString } from "@itwin/core-bentley";
2
2
  import type { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyLevelDefinition, LimitingECSqlQueryExecutor, ProcessedHierarchyNode } from "@itwin/presentation-hierarchies";
3
+ import type { ECClassHierarchyInspector, ECSchemaProvider } from "@itwin/presentation-shared";
3
4
  interface ExternalSourcesTreeDefinitionProps {
4
5
  imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & LimitingECSqlQueryExecutor;
6
+ componentId?: GuidString;
5
7
  }
6
8
  export declare class ExternalSourcesTreeDefinition implements HierarchyDefinition {
7
- private _impl;
8
- private _selectQueryFactory;
9
- private _nodeLabelSelectClauseFactory;
10
- private _queryExecutor;
11
- private _isSupported?;
9
+ #private;
12
10
  constructor(props: ExternalSourcesTreeDefinitionProps);
13
11
  postProcessNode(node: ProcessedHierarchyNode): Promise<ProcessedHierarchyNode>;
14
12
  defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;
@@ -5,16 +5,19 @@
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ExternalSourcesTreeDefinition = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
8
9
  const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
9
10
  const presentation_shared_1 = require("@itwin/presentation-shared");
10
11
  class ExternalSourcesTreeDefinition {
11
- _impl;
12
- _selectQueryFactory;
13
- _nodeLabelSelectClauseFactory;
14
- _queryExecutor;
15
- _isSupported;
12
+ #impl;
13
+ #selectQueryFactory;
14
+ #nodeLabelSelectClauseFactory;
15
+ #queryExecutor;
16
+ #isSupported;
17
+ #componentId;
18
+ #componentName;
16
19
  constructor(props) {
17
- this._impl = (0, presentation_hierarchies_1.createPredicateBasedHierarchyDefinition)({
20
+ this.#impl = (0, presentation_hierarchies_1.createPredicateBasedHierarchyDefinition)({
18
21
  classHierarchyInspector: props.imodelAccess,
19
22
  hierarchy: {
20
23
  rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition(requestProps),
@@ -34,12 +37,14 @@ class ExternalSourcesTreeDefinition {
34
37
  ],
35
38
  },
36
39
  });
37
- this._queryExecutor = props.imodelAccess;
38
- this._nodeLabelSelectClauseFactory = (0, presentation_shared_1.createBisInstanceLabelSelectClauseFactory)({ classHierarchyInspector: props.imodelAccess });
39
- this._selectQueryFactory = (0, presentation_hierarchies_1.createNodesQueryClauseFactory)({
40
+ this.#queryExecutor = props.imodelAccess;
41
+ this.#nodeLabelSelectClauseFactory = (0, presentation_shared_1.createBisInstanceLabelSelectClauseFactory)({ classHierarchyInspector: props.imodelAccess });
42
+ this.#selectQueryFactory = (0, presentation_hierarchies_1.createNodesQueryClauseFactory)({
40
43
  imodelAccess: props.imodelAccess,
41
- instanceLabelSelectClauseFactory: this._nodeLabelSelectClauseFactory,
44
+ instanceLabelSelectClauseFactory: this.#nodeLabelSelectClauseFactory,
42
45
  });
46
+ this.#componentId = props.componentId ?? core_bentley_1.Guid.createValue();
47
+ this.#componentName = "ExternalSourcesTreeDefinition";
43
48
  }
44
49
  async postProcessNode(node) {
45
50
  if (presentation_hierarchies_1.HierarchyNode.isClassGroupingNode(node)) {
@@ -49,16 +54,16 @@ class ExternalSourcesTreeDefinition {
49
54
  return node;
50
55
  }
51
56
  async defineHierarchyLevel(props) {
52
- if (this._isSupported === undefined) {
53
- this._isSupported = this.isSupported();
57
+ if (this.#isSupported === undefined) {
58
+ this.#isSupported = this.isSupported();
54
59
  }
55
- if ((await this._isSupported) === false) {
60
+ if ((await this.#isSupported) === false) {
56
61
  return [];
57
62
  }
58
- return this._impl.defineHierarchyLevel(props);
63
+ return this.#impl.defineHierarchyLevel(props);
59
64
  }
60
65
  async createRootHierarchyLevelDefinition(props) {
61
- const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
66
+ const instanceFilterClauses = await this.#selectQueryFactory.createFilterClauses({
62
67
  filter: props.instanceFilter,
63
68
  contentClass: { fullName: "BisCore.ExternalSource", alias: "this" },
64
69
  });
@@ -69,7 +74,7 @@ class ExternalSourcesTreeDefinition {
69
74
  query: {
70
75
  ecsql: `
71
76
  SELECT
72
- ${await this._selectQueryFactory.createSelectClause({
77
+ ${await this.#selectQueryFactory.createSelectClause({
73
78
  ecClassId: { selector: presentation_shared_1.ECSql.createRawPropertyValueSelector("this", "ECClassId") },
74
79
  ecInstanceId: { selector: "this.ECInstanceId" },
75
80
  nodeLabel: {
@@ -93,7 +98,7 @@ class ExternalSourcesTreeDefinition {
93
98
  // cspell:enable
94
99
  }
95
100
  async createExternalSourcesGroupChildrenQuery({ parentNodeInstanceIds: groupIds, instanceFilter, }) {
96
- const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
101
+ const instanceFilterClauses = await this.#selectQueryFactory.createFilterClauses({
97
102
  filter: instanceFilter,
98
103
  contentClass: { fullName: "BisCore.ExternalSource", alias: "this" },
99
104
  });
@@ -104,7 +109,7 @@ class ExternalSourcesTreeDefinition {
104
109
  query: {
105
110
  ecsql: `
106
111
  SELECT
107
- ${await this._selectQueryFactory.createSelectClause({
112
+ ${await this.#selectQueryFactory.createSelectClause({
108
113
  ecClassId: { selector: "this.ECClassId" },
109
114
  ecInstanceId: { selector: "this.ECInstanceId" },
110
115
  nodeLabel: {
@@ -130,7 +135,7 @@ class ExternalSourcesTreeDefinition {
130
135
  // cspell:enable
131
136
  }
132
137
  async createExternalSourceChildrenQuery({ parentNodeInstanceIds: sourceIds, instanceFilter, }) {
133
- const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
138
+ const instanceFilterClauses = await this.#selectQueryFactory.createFilterClauses({
134
139
  filter: instanceFilter,
135
140
  contentClass: { fullName: "BisCore.ExternalSource", alias: "this" },
136
141
  });
@@ -140,7 +145,7 @@ class ExternalSourcesTreeDefinition {
140
145
  query: {
141
146
  ecsql: `
142
147
  SELECT
143
- ${await this._selectQueryFactory.createSelectClause({
148
+ ${await this.#selectQueryFactory.createSelectClause({
144
149
  ecClassId: { selector: "this.ECClassId" },
145
150
  ecInstanceId: { selector: "this.ECInstanceId" },
146
151
  nodeLabel: {
@@ -193,7 +198,7 @@ class ExternalSourcesTreeDefinition {
193
198
  }
194
199
  async createElementsNodeChildrenQuery({ parentNode, instanceFilter }) {
195
200
  const sourceIds = parentNode.extendedData?.sourceIds;
196
- const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
201
+ const instanceFilterClauses = await this.#selectQueryFactory.createFilterClauses({
197
202
  filter: instanceFilter,
198
203
  contentClass: { fullName: "BisCore.GeometricElement", alias: "this" },
199
204
  });
@@ -203,11 +208,11 @@ class ExternalSourcesTreeDefinition {
203
208
  query: {
204
209
  ecsql: `
205
210
  SELECT
206
- ${await this._selectQueryFactory.createSelectClause({
211
+ ${await this.#selectQueryFactory.createSelectClause({
207
212
  ecClassId: { selector: "this.ECClassId" },
208
213
  ecInstanceId: { selector: "this.ECInstanceId" },
209
214
  nodeLabel: {
210
- selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
215
+ selector: await this.#nodeLabelSelectClauseFactory.createSelectClause({
211
216
  classAlias: "this",
212
217
  className: "BisCore.GeometricElement",
213
218
  }),
@@ -237,7 +242,7 @@ class ExternalSourcesTreeDefinition {
237
242
  ${repositoryLinkAlias}.ECInstanceId IS NOT NULL,
238
243
  ${presentation_shared_1.ECSql.createConcatenatedValueJsonSelector([
239
244
  {
240
- selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
245
+ selector: await this.#nodeLabelSelectClauseFactory.createSelectClause({
241
246
  classAlias: repositoryLinkAlias,
242
247
  className: "BisCore.RepositoryLink",
243
248
  }),
@@ -251,7 +256,7 @@ class ExternalSourcesTreeDefinition {
251
256
  )`,
252
257
  },
253
258
  {
254
- selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
259
+ selector: await this.#nodeLabelSelectClauseFactory.createSelectClause({
255
260
  classAlias: externalSourceAlias,
256
261
  className: "BisCore.ExternalSource",
257
262
  }),
@@ -264,7 +269,7 @@ class ExternalSourcesTreeDefinition {
264
269
  FROM ECDbMeta.ECSchemaDef
265
270
  WHERE Name = 'BisCore' AND (VersionMajor > 1 OR (VersionMajor = 1 AND VersionMinor > 12))
266
271
  `;
267
- for await (const _row of this._queryExecutor.createQueryReader({ ecsql: query })) {
272
+ for await (const _row of this.#queryExecutor.createQueryReader({ ecsql: query }, { restartToken: `${this.#componentName}/${this.#componentId}/is-external-source-supported` })) {
268
273
  return true;
269
274
  }
270
275
  return false;