@itwin/tree-widget-react 4.0.0-alpha.25 → 4.0.0-alpha.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +2 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +4 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +36 -47
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +75 -38
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.d.ts +3 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +38 -23
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +11 -21
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +16 -168
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.d.ts +65 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js +22 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNodeInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js +4 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseSearchPaths.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +6 -10
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +180 -88
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +14 -5
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +43 -24
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.d.ts +3 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js +78 -17
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +91 -114
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.d.ts +1 -3
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js +2 -4
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +13 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +62 -32
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +12 -9
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +42 -38
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +15 -38
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +59 -242
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.d.ts +29 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js +19 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNodeInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +4 -8
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +154 -78
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +20 -6
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.d.ts +6 -10
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js +104 -63
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.d.ts +7 -0
- package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js +14 -0
- package/lib/esm/tree-widget-react/components/trees/common/SharedTreeContextProvider.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +7 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +5 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js +44 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/SharedTreeContextProviderInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +4 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +12 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +17 -6
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +58 -29
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +8 -14
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +22 -26
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.d.ts → caches/AlwaysAndNeverDrawnElementInfoCache.d.ts} +15 -21
- package/lib/esm/tree-widget-react/components/trees/common/internal/{AlwaysAndNeverDrawnElementInfo.js → caches/AlwaysAndNeverDrawnElementInfoCache.js} +40 -38
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.d.ts +68 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js +148 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/BaseIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.d.ts +30 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js +151 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementChildrenCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.d.ts +32 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js +106 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ElementModelCategoriesCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.d.ts → caches/ModelCategoryElementsCountCache.d.ts} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/{ModelCategoryElementsCountCache.js → caches/ModelCategoryElementsCountCache.js} +17 -21
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModelCategoryElementsCountCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js +106 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/ModeledElementsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.d.ts +23 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js +56 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/caches/SubCategoriesCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +6 -6
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +27 -17
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +7 -13
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +36 -35
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.d.ts +18 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js +14 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +46 -70
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +229 -361
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +32 -19
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +2 -1
- package/lib/esm/tree-widget-react/components/trees/index.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +4 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +4 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +7 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +36 -35
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +3 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +56 -26
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +5 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +25 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +11 -23
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +56 -189
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.d.ts +52 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js +22 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNodeInternal.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js +8 -8
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseSearchPaths.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +6 -10
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +179 -72
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +20 -8
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js +73 -13
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.js.map +1 -1
- package/lib/esm/tree-widget-react-internal.d.ts +1 -0
- package/lib/esm/tree-widget-react-internal.js +1 -0
- package/lib/esm/tree-widget-react-internal.js.map +1 -1
- package/package.json +77 -82
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.d.ts +0 -20
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js +0 -53
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseSearchPaths.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassificationsTreeNode.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAKhG;;;GAGG;AACH,MAAM,KAAW,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ClassificationsTreeNode.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAKhG;;;GAGG;AACH,MAAM,KAAW,uBAAuB,CA0BvC;AA1BD,WAAiB,uBAAuB;IACtC,iGAAiG;IACpF,iDAAyB,GAAG,CAAC,IAAyC,EAAgE,EAAE,CACnJ,IAAI,CAAC,YAAY,EAAE,IAAI,KAAK,qBAAqB,CAAC;IAEpD,4FAA4F;IAC/E,4CAAoB,GAAG,CAAC,IAAyC,EAAgE,EAAE,CAC9I,IAAI,CAAC,YAAY,EAAE,IAAI,KAAK,gBAAgB,CAAC;IAE/C;;;;;;OAMG;IACU,8CAAsB,GAAG,CACpC,IAAyC,EAMzC,EAAE;QACF,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,KAAK,oBAAoB,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC,EA1BgB,uBAAuB,KAAvB,uBAAuB,QA0BvC","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 type { Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNode, InstancesNodeKey, NonGroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/**\n * Contains utility functions for working with Classifications Tree nodes.\n * @beta\n */\nexport namespace ClassificationsTreeNode {\n /** Checks if the given node represents a `ClassificationSystems.ClassificationTable` element. */\n export const isClassificationTableNode = (node: Pick<HierarchyNode, \"extendedData\">): node is NonGroupingHierarchyNode & { key: InstancesNodeKey } =>\n node.extendedData?.type === \"ClassificationTable\";\n\n /** Checks if the given node represents a `ClassificationSystems.Classification` element. */\n export const isClassificationNode = (node: Pick<HierarchyNode, \"extendedData\">): node is NonGroupingHierarchyNode & { key: InstancesNodeKey } =>\n node.extendedData?.type === \"Classification\";\n\n /**\n * Checks if the given node represents a `BisCore.GeometricElement3d` element.\n *\n * If it does, the node's `extendedData` will contain the following properties:\n * - `modelId`: `Id64String` of the model containing the element\n * - `categoryId`: `Id64String` of the category of the element\n */\n export const isGeometricElementNode = (\n node: Pick<HierarchyNode, \"extendedData\">,\n ): node is Omit<NonGroupingHierarchyNode, \"extendedData\"> & { key: InstancesNodeKey } & {\n extendedData: {\n modelId: Id64String;\n categoryId: Id64String;\n };\n } => {\n return node.extendedData?.type === \"GeometricElement3d\";\n };\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { useSharedTreeContextInternal } from "../common/internal/SharedTreeContextProviderInternal.js";
|
|
2
|
+
import { ClassificationsTreeIdsCache } from "./internal/ClassificationsTreeIdsCache.js";
|
|
1
3
|
import type { ReactNode } from "react";
|
|
4
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
5
|
import type { VisibilityTreeProps } from "../common/components/VisibilityTree.js";
|
|
3
6
|
import type { ExtendedVisibilityTreeRendererProps } from "../common/components/VisibilityTreeRenderer.js";
|
|
4
7
|
import type { TreeWidgetViewport } from "../common/TreeWidgetViewport.js";
|
|
@@ -17,9 +20,18 @@ interface UseClassificationsTreeResult {
|
|
|
17
20
|
getTreeItemProps: Required<ExtendedVisibilityTreeRendererProps>["getTreeItemProps"];
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
|
-
* Custom hook to create and manage state for the
|
|
23
|
+
* Custom hook to create and manage state for the classifications tree.
|
|
24
|
+
*
|
|
25
|
+
* **Note:** Requires `SharedTreeContextProvider` to be present in components tree above.
|
|
21
26
|
* @alpha
|
|
22
27
|
*/
|
|
23
28
|
export declare function useClassificationsTree({ activeView, emptyTreeContent, searchText, getTreeItemProps, ...rest }: UseClassificationsTreeProps): UseClassificationsTreeResult;
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare function getClassificationsTreeIdsCache({ getBaseIdsCache, getCache, imodel, hierarchyConfig, }: {
|
|
31
|
+
getCache: ReturnType<typeof useSharedTreeContextInternal>["getCache"];
|
|
32
|
+
getBaseIdsCache: ReturnType<typeof useSharedTreeContextInternal>["getBaseIdsCache"];
|
|
33
|
+
imodel: IModelConnection;
|
|
34
|
+
hierarchyConfig: ClassificationsTreeHierarchyConfiguration;
|
|
35
|
+
}): ClassificationsTreeIdsCache;
|
|
24
36
|
export {};
|
|
25
37
|
//# sourceMappingURL=UseClassificationsTree.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js
CHANGED
|
@@ -3,68 +3,86 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import { useCallback, useEffect, useMemo } from "react";
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
7
7
|
import { createECSqlQueryExecutor } from "@itwin/presentation-core-interop";
|
|
8
8
|
import iconBisCategory3d from "@stratakit/icons/bis-category-3d.svg";
|
|
9
9
|
import { EmptyTreeContent, NoSearchMatches, SearchUnknownError, TooManySearchMatches } from "../common/components/EmptyTree.js";
|
|
10
|
+
import { useSharedTreeContextInternal } from "../common/internal/SharedTreeContextProviderInternal.js";
|
|
10
11
|
import { useGuid } from "../common/internal/useGuid.js";
|
|
11
12
|
import { useCachedVisibility } from "../common/internal/useTreeHooks/UseCachedVisibility.js";
|
|
12
|
-
import {
|
|
13
|
+
import { getClassesByView } from "../common/internal/Utils.js";
|
|
14
|
+
import { SearchLimitExceededError } from "../common/TreeErrors.js";
|
|
15
|
+
import { useTelemetryContext } from "../common/UseTelemetryContext.js";
|
|
13
16
|
import { ClassificationsTreeComponent } from "./ClassificationsTreeComponent.js";
|
|
14
|
-
import { ClassificationsTreeDefinition } from "./ClassificationsTreeDefinition.js";
|
|
15
17
|
import { ClassificationsTreeIcon } from "./ClassificationsTreeIcon.js";
|
|
16
18
|
import { ClassificationsTreeIdsCache } from "./internal/ClassificationsTreeIdsCache.js";
|
|
17
|
-
import { useSearchPaths } from "./internal/UseSearchPaths.js";
|
|
18
19
|
import { ClassificationsTreeVisibilityHandler } from "./internal/visibility/ClassificationsTreeVisibilityHandler.js";
|
|
19
20
|
import { createClassificationsSearchResultsTree } from "./internal/visibility/SearchResultsTree.js";
|
|
21
|
+
import { useClassificationsTreeDefinition } from "./UseClassificationsTreeDefinition.js";
|
|
20
22
|
/**
|
|
21
|
-
* Custom hook to create and manage state for the
|
|
23
|
+
* Custom hook to create and manage state for the classifications tree.
|
|
24
|
+
*
|
|
25
|
+
* **Note:** Requires `SharedTreeContextProvider` to be present in components tree above.
|
|
22
26
|
* @alpha
|
|
23
27
|
*/
|
|
24
28
|
export function useClassificationsTree({ activeView, emptyTreeContent, searchText, getTreeItemProps, ...rest }) {
|
|
29
|
+
const { getBaseIdsCache, getCache } = useSharedTreeContextInternal();
|
|
30
|
+
const { onFeatureUsed } = useTelemetryContext();
|
|
31
|
+
const [searchError, setSearchError] = useState();
|
|
25
32
|
const hierarchyConfig = useMemo(() => ({ ...rest.hierarchyConfig }),
|
|
26
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
34
|
[...Object.values(rest.hierarchyConfig)]);
|
|
28
35
|
const componentId = useGuid();
|
|
29
|
-
const { getCache:
|
|
30
|
-
imodel: activeView.iModel,
|
|
31
|
-
createCache,
|
|
32
|
-
cacheSpecificProps: useMemo(() => ({ hierarchyConfig }), [hierarchyConfig]),
|
|
33
|
-
componentId,
|
|
34
|
-
});
|
|
36
|
+
const idsCache = getClassificationsTreeIdsCache({ getCache, getBaseIdsCache, imodel: activeView.iModel, hierarchyConfig });
|
|
35
37
|
const { visibilityHandlerFactory, onSearchPathsChanged } = useClassificationsCachedVisibility({
|
|
36
38
|
activeView,
|
|
37
|
-
|
|
39
|
+
idsCache,
|
|
38
40
|
componentId,
|
|
39
41
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
hierarchyConfiguration: hierarchyConfig,
|
|
45
|
-
searchText,
|
|
46
|
-
getClassificationsTreeIdsCache,
|
|
42
|
+
const { getSearchPaths, definition } = useClassificationsTreeDefinition({
|
|
43
|
+
imodels: useMemo(() => [activeView.iModel], [activeView.iModel]),
|
|
44
|
+
hierarchyConfig,
|
|
45
|
+
search: useMemo(() => (searchText ? { searchText } : undefined), [searchText]),
|
|
47
46
|
onSearchPathsChanged,
|
|
48
|
-
componentId,
|
|
49
47
|
});
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setSearchError(undefined);
|
|
50
|
+
}, [searchText]);
|
|
51
|
+
const getPaths = useMemo(() => {
|
|
52
|
+
if (!searchText || !getSearchPaths) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return async (props) => {
|
|
56
|
+
try {
|
|
57
|
+
return await getSearchPaths(props);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
const newError = e instanceof SearchLimitExceededError ? "tooManySearchMatches" : "unknownSearchError";
|
|
61
|
+
if (newError !== "tooManySearchMatches") {
|
|
62
|
+
const feature = e instanceof Error && e.message.includes("query too long to execute or server is too busy") ? "error-timeout" : "error-unknown";
|
|
63
|
+
onFeatureUsed({ featureId: feature, reportInteraction: false });
|
|
64
|
+
}
|
|
65
|
+
setSearchError(newError);
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [searchText, getSearchPaths, onFeatureUsed]);
|
|
50
70
|
return {
|
|
51
71
|
treeProps: {
|
|
52
72
|
treeName: ClassificationsTreeComponent.id,
|
|
53
|
-
getHierarchyDefinition,
|
|
73
|
+
getHierarchyDefinition: useCallback(() => definition, [definition]),
|
|
54
74
|
visibilityHandlerFactory,
|
|
55
75
|
getSearchPaths: getPaths,
|
|
56
76
|
emptyTreeContent: useMemo(() => getEmptyTreeContentComponent(searchText, searchError, emptyTreeContent), [searchText, searchError, emptyTreeContent]),
|
|
57
77
|
highlightText: searchText,
|
|
58
78
|
},
|
|
59
79
|
getTreeItemProps: (node, rendererProps) => ({
|
|
80
|
+
...rendererProps.getTreeItemProps?.(node),
|
|
60
81
|
decorations: _jsx(ClassificationsTreeIcon, { node: node }),
|
|
61
82
|
...getTreeItemProps?.(node, rendererProps),
|
|
62
83
|
}),
|
|
63
84
|
};
|
|
64
85
|
}
|
|
65
|
-
function createCache(props) {
|
|
66
|
-
return new ClassificationsTreeIdsCache(createECSqlQueryExecutor(props.imodel), props.specificProps.hierarchyConfig, props.componentId);
|
|
67
|
-
}
|
|
68
86
|
function getEmptyTreeContentComponent(searchText, error, emptyTreeContent) {
|
|
69
87
|
if (error) {
|
|
70
88
|
if (error === "tooManySearchMatches") {
|
|
@@ -81,36 +99,48 @@ function getEmptyTreeContentComponent(searchText, error, emptyTreeContent) {
|
|
|
81
99
|
return _jsx(EmptyTreeContent, { icon: iconBisCategory3d });
|
|
82
100
|
}
|
|
83
101
|
function useClassificationsCachedVisibility(props) {
|
|
84
|
-
const { activeView,
|
|
102
|
+
const { activeView, idsCache, componentId } = props;
|
|
85
103
|
const { visibilityHandlerFactory, searchPaths, onSearchPathsChanged } = useCachedVisibility({
|
|
86
104
|
activeView,
|
|
87
|
-
|
|
105
|
+
idsCache,
|
|
88
106
|
createSearchResultsTree,
|
|
89
107
|
createTreeSpecificVisibilityHandler,
|
|
90
108
|
componentId,
|
|
91
109
|
});
|
|
92
110
|
useEffect(() => {
|
|
93
|
-
|
|
94
|
-
}, [searchPaths,
|
|
111
|
+
idsCache.clearFilteredElementsData();
|
|
112
|
+
}, [searchPaths, idsCache]);
|
|
95
113
|
return {
|
|
96
114
|
visibilityHandlerFactory,
|
|
97
115
|
onSearchPathsChanged,
|
|
98
116
|
};
|
|
99
117
|
}
|
|
100
118
|
async function createSearchResultsTree(props) {
|
|
101
|
-
const { searchPaths,
|
|
119
|
+
const { searchPaths, idsCache, imodelAccess } = props;
|
|
102
120
|
return createClassificationsSearchResultsTree({
|
|
103
|
-
idsCache
|
|
121
|
+
idsCache,
|
|
104
122
|
searchPaths,
|
|
105
123
|
imodelAccess,
|
|
106
124
|
});
|
|
107
125
|
}
|
|
108
126
|
function createTreeSpecificVisibilityHandler(props) {
|
|
109
|
-
const { info,
|
|
127
|
+
const { info, idsCache, viewport } = props;
|
|
110
128
|
return new ClassificationsTreeVisibilityHandler({
|
|
111
129
|
alwaysAndNeverDrawnElementInfo: info,
|
|
112
|
-
idsCache
|
|
130
|
+
idsCache,
|
|
113
131
|
viewport,
|
|
114
132
|
});
|
|
115
133
|
}
|
|
134
|
+
/** @internal */
|
|
135
|
+
export function getClassificationsTreeIdsCache({ getBaseIdsCache, getCache, imodel, hierarchyConfig, }) {
|
|
136
|
+
return getCache({
|
|
137
|
+
imodel,
|
|
138
|
+
createCache: () => new ClassificationsTreeIdsCache({
|
|
139
|
+
baseIdsCache: getBaseIdsCache({ type: "3d", elementClassName: getClassesByView("3d").elementClass, imodel }),
|
|
140
|
+
hierarchyConfig,
|
|
141
|
+
queryExecutor: createECSqlQueryExecutor(imodel),
|
|
142
|
+
}),
|
|
143
|
+
cacheKey: `${hierarchyConfig.rootClassificationSystemCode}-ClassificationsTreeIdsCache`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
116
146
|
//# sourceMappingURL=UseClassificationsTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseClassificationsTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAChI,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;A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,IAAC,IAAI,EAAE,iBAAiB,GAAI,CAAC;AACvD,CAAC;AAED,SAAS,kCAAkC,CAAC,KAA+G;IACzJ,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACpD,MAAM,EAAE,wBAAwB,EAAE,WAAW,EAAE,oBAAoB,EAAE,GAAG,mBAAmB,CAAgE;QACzJ,UAAU;QACV,QAAQ;QACR,uBAAuB;QACvB,mCAAmC;QACnC,WAAW;KACZ,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,EAAE,CAAC,yBAAyB,EAAE,CAAC;IACzC,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO;QACL,wBAAwB;QACxB,oBAAoB;KACrB,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,KAAgE;IAEhE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACtD,OAAO,sCAAsC,CAAC;QAC5C,QAAQ,EAAE,QAAQ,EAAE;QACpB,WAAW;QACX,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED,SAAS,mCAAmC,CAAC,KAA4E;IACvH,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3C,OAAO,IAAI,oCAAoC,CAAC;QAC9C,8BAA8B,EAAE,IAAI;QACpC,QAAQ,EAAE,QAAQ,EAAE;QACpB,QAAQ;KACT,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 { useCallback, useEffect, useMemo } from \"react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport iconBisCategory3d from \"@stratakit/icons/bis-category-3d.svg\";\nimport { EmptyTreeContent, NoSearchMatches, SearchUnknownError, TooManySearchMatches } from \"../common/components/EmptyTree.js\";\nimport { useGuid } from \"../common/internal/useGuid.js\";\nimport { useCachedVisibility } from \"../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport { useIdsCache } from \"../common/internal/useTreeHooks/UseIdsCache.js\";\nimport { ClassificationsTreeComponent } from \"./ClassificationsTreeComponent.js\";\nimport { ClassificationsTreeDefinition } from \"./ClassificationsTreeDefinition.js\";\nimport { ClassificationsTreeIcon } from \"./ClassificationsTreeIcon.js\";\nimport { ClassificationsTreeIdsCache } from \"./internal/ClassificationsTreeIdsCache.js\";\nimport { useSearchPaths } from \"./internal/UseSearchPaths.js\";\nimport { ClassificationsTreeVisibilityHandler } from \"./internal/visibility/ClassificationsTreeVisibilityHandler.js\";\nimport { createClassificationsSearchResultsTree } from \"./internal/visibility/SearchResultsTree.js\";\n\nimport type { ReactNode } from \"react\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\nimport type { ExtendedVisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { CreateSearchResultsTreeProps, CreateTreeSpecificVisibilityHandlerProps } from \"../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport type { CreateCacheProps } from \"../common/internal/useTreeHooks/UseIdsCache.js\";\nimport type { SearchResultsTree } from \"../common/internal/visibility/BaseSearchResultsTree.js\";\nimport type { TreeWidgetViewport } from \"../common/TreeWidgetViewport.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"./ClassificationsTreeDefinition.js\";\nimport type { ClassificationsTreeSearchError } from \"./internal/UseSearchPaths.js\";\nimport type { ClassificationsTreeSearchTargets } from \"./internal/visibility/SearchResultsTree.js\";\n\n/** @alpha */\nexport interface UseClassificationsTreeProps {\n activeView: TreeWidgetViewport;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n emptyTreeContent?: ReactNode;\n searchText?: string;\n getTreeItemProps?: ExtendedVisibilityTreeRendererProps[\"getTreeItemProps\"];\n}\n\n/** @alpha */\ninterface UseClassificationsTreeResult {\n treeProps: Pick<\n VisibilityTreeProps,\n \"treeName\" | \"getHierarchyDefinition\" | \"visibilityHandlerFactory\" | \"getSearchPaths\" | \"emptyTreeContent\" | \"highlightText\"\n >;\n getTreeItemProps: Required<ExtendedVisibilityTreeRendererProps>[\"getTreeItemProps\"];\n}\n\n/**\n * Custom hook to create and manage state for the categories tree.\n * @alpha\n */\nexport function useClassificationsTree({\n activeView,\n emptyTreeContent,\n searchText,\n getTreeItemProps,\n ...rest\n}: UseClassificationsTreeProps): UseClassificationsTreeResult {\n const hierarchyConfig = useMemo(\n () => ({ ...rest.hierarchyConfig }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [...Object.values(rest.hierarchyConfig)],\n );\n const componentId = useGuid();\n\n const { getCache: getClassificationsTreeIdsCache } = useIdsCache<ClassificationsTreeIdsCache, { hierarchyConfig: ClassificationsTreeHierarchyConfiguration }>(\n {\n imodel: activeView.iModel,\n createCache,\n cacheSpecificProps: useMemo(() => ({ hierarchyConfig }), [hierarchyConfig]),\n componentId,\n },\n );\n\n const { visibilityHandlerFactory, onSearchPathsChanged } = useClassificationsCachedVisibility({\n activeView,\n getCache: getClassificationsTreeIdsCache,\n componentId,\n });\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n (props) => {\n return new ClassificationsTreeDefinition({ ...props, getIdsCache: getClassificationsTreeIdsCache, hierarchyConfig });\n },\n [getClassificationsTreeIdsCache, hierarchyConfig],\n );\n\n const { getPaths, searchError } = useSearchPaths({\n hierarchyConfiguration: hierarchyConfig,\n searchText,\n getClassificationsTreeIdsCache,\n onSearchPathsChanged,\n componentId,\n });\n\n return {\n treeProps: {\n treeName: ClassificationsTreeComponent.id,\n getHierarchyDefinition,\n visibilityHandlerFactory,\n getSearchPaths: getPaths,\n emptyTreeContent: useMemo(() => getEmptyTreeContentComponent(searchText, searchError, emptyTreeContent), [searchText, searchError, emptyTreeContent]),\n highlightText: searchText,\n },\n getTreeItemProps: (node, rendererProps) => ({\n decorations: <ClassificationsTreeIcon node={node} />,\n ...getTreeItemProps?.(node, rendererProps),\n }),\n };\n}\n\nfunction createCache(props: CreateCacheProps<{ hierarchyConfig: ClassificationsTreeHierarchyConfiguration }>) {\n return new ClassificationsTreeIdsCache(createECSqlQueryExecutor(props.imodel), props.specificProps.hierarchyConfig, props.componentId);\n}\n\nfunction getEmptyTreeContentComponent(searchText?: string, error?: ClassificationsTreeSearchError, emptyTreeContent?: React.ReactNode) {\n if (error) {\n if (error === \"tooManySearchMatches\") {\n return <TooManySearchMatches base={\"classificationsTree\"} />;\n }\n return <SearchUnknownError base={\"classificationsTree\"} />;\n }\n if (searchText) {\n return <NoSearchMatches base={\"classificationsTree\"} />;\n }\n if (emptyTreeContent) {\n return emptyTreeContent;\n }\n return <EmptyTreeContent icon={iconBisCategory3d} />;\n}\n\nfunction useClassificationsCachedVisibility(props: { activeView: TreeWidgetViewport; getCache: () => ClassificationsTreeIdsCache; componentId: GuidString }) {\n const { activeView, getCache, componentId } = props;\n const { visibilityHandlerFactory, searchPaths, onSearchPathsChanged } = useCachedVisibility<ClassificationsTreeIdsCache, ClassificationsTreeSearchTargets>({\n activeView,\n getCache,\n createSearchResultsTree,\n createTreeSpecificVisibilityHandler,\n componentId,\n });\n\n useEffect(() => {\n getCache().clearFilteredElementsData();\n }, [searchPaths, getCache]);\n\n return {\n visibilityHandlerFactory,\n onSearchPathsChanged,\n };\n}\n\nasync function createSearchResultsTree(\n props: CreateSearchResultsTreeProps<ClassificationsTreeIdsCache>,\n): Promise<SearchResultsTree<ClassificationsTreeSearchTargets>> {\n const { searchPaths, getCache, imodelAccess } = props;\n return createClassificationsSearchResultsTree({\n idsCache: getCache(),\n searchPaths,\n imodelAccess,\n });\n}\n\nfunction createTreeSpecificVisibilityHandler(props: CreateTreeSpecificVisibilityHandlerProps<ClassificationsTreeIdsCache>) {\n const { info, getCache, viewport } = props;\n return new ClassificationsTreeVisibilityHandler({\n alwaysAndNeverDrawnElementInfo: info,\n idsCache: getCache(),\n viewport,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UseClassificationsTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAChI,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AACrH,OAAO,EAAE,sCAAsC,EAAE,MAAM,4CAA4C,CAAC;AACpG,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAmCzF;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC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AE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO;QACL,wBAAwB;QACxB,oBAAoB;KACrB,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,KAAgE;IAEhE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACtD,OAAO,sCAAsC,CAAC;QAC5C,QAAQ;QACR,WAAW;QACX,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED,SAAS,mCAAmC,CAAC,KAA4E;IACvH,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3C,OAAO,IAAI,oCAAoC,CAAC;QAC9C,8BAA8B,EAAE,IAAI;QACpC,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,8BAA8B,CAAC,EAC7C,eAAe,EACf,QAAQ,EACR,MAAM,EACN,eAAe,GAMhB;IACC,OAAO,QAAQ,CAAC;QACd,MAAM;QACN,WAAW,EAAE,GAAG,EAAE,CAChB,IAAI,2BAA2B,CAAC;YAC9B,YAAY,EAAE,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;YAC5G,eAAe;YACf,aAAa,EAAE,wBAAwB,CAAC,MAAM,CAAC;SAChD,CAAC;QACJ,QAAQ,EAAE,GAAG,eAAe,CAAC,4BAA4B,8BAA8B;KACxF,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 { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport iconBisCategory3d from \"@stratakit/icons/bis-category-3d.svg\";\nimport { EmptyTreeContent, NoSearchMatches, SearchUnknownError, TooManySearchMatches } from \"../common/components/EmptyTree.js\";\nimport { useSharedTreeContextInternal } from \"../common/internal/SharedTreeContextProviderInternal.js\";\nimport { useGuid } from \"../common/internal/useGuid.js\";\nimport { useCachedVisibility } from \"../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport { getClassesByView } from \"../common/internal/Utils.js\";\nimport { SearchLimitExceededError } from \"../common/TreeErrors.js\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext.js\";\nimport { ClassificationsTreeComponent } from \"./ClassificationsTreeComponent.js\";\nimport { ClassificationsTreeIcon } from \"./ClassificationsTreeIcon.js\";\nimport { ClassificationsTreeIdsCache } from \"./internal/ClassificationsTreeIdsCache.js\";\nimport { ClassificationsTreeVisibilityHandler } from \"./internal/visibility/ClassificationsTreeVisibilityHandler.js\";\nimport { createClassificationsSearchResultsTree } from \"./internal/visibility/SearchResultsTree.js\";\nimport { useClassificationsTreeDefinition } from \"./UseClassificationsTreeDefinition.js\";\n\nimport type { ReactNode } from \"react\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { useTree } from \"@itwin/presentation-hierarchies-react\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\nimport type { ExtendedVisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { CreateSearchResultsTreeProps, CreateTreeSpecificVisibilityHandlerProps } from \"../common/internal/useTreeHooks/UseCachedVisibility.js\";\nimport type { SearchResultsTree } from \"../common/internal/visibility/BaseSearchResultsTree.js\";\nimport type { TreeWidgetViewport } from \"../common/TreeWidgetViewport.js\";\nimport type { FunctionProps } from \"../common/Utils.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"./ClassificationsTreeDefinition.js\";\nimport type { ClassificationsTreeSearchTargets } from \"./internal/visibility/SearchResultsTree.js\";\n\n/** @alpha */\nexport interface UseClassificationsTreeProps {\n activeView: TreeWidgetViewport;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n emptyTreeContent?: ReactNode;\n searchText?: string;\n getTreeItemProps?: ExtendedVisibilityTreeRendererProps[\"getTreeItemProps\"];\n}\n\ntype ClassificationsTreeSearchError = \"tooManySearchMatches\" | \"unknownSearchError\";\n\n/** @alpha */\ninterface UseClassificationsTreeResult {\n treeProps: Pick<\n VisibilityTreeProps,\n \"treeName\" | \"getHierarchyDefinition\" | \"visibilityHandlerFactory\" | \"getSearchPaths\" | \"emptyTreeContent\" | \"highlightText\"\n >;\n getTreeItemProps: Required<ExtendedVisibilityTreeRendererProps>[\"getTreeItemProps\"];\n}\n\n/**\n * Custom hook to create and manage state for the classifications tree.\n *\n * **Note:** Requires `SharedTreeContextProvider` to be present in components tree above.\n * @alpha\n */\nexport function useClassificationsTree({\n activeView,\n emptyTreeContent,\n searchText,\n getTreeItemProps,\n ...rest\n}: UseClassificationsTreeProps): UseClassificationsTreeResult {\n const { getBaseIdsCache, getCache } = useSharedTreeContextInternal();\n const { onFeatureUsed } = useTelemetryContext();\n\n const [searchError, setSearchError] = useState<ClassificationsTreeSearchError | undefined>();\n\n const hierarchyConfig = useMemo(\n () => ({ ...rest.hierarchyConfig }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [...Object.values(rest.hierarchyConfig)],\n );\n const componentId = useGuid();\n\n const idsCache = getClassificationsTreeIdsCache({ getCache, getBaseIdsCache, imodel: activeView.iModel, hierarchyConfig });\n\n const { visibilityHandlerFactory, onSearchPathsChanged } = useClassificationsCachedVisibility({\n activeView,\n idsCache,\n componentId,\n });\n\n const { getSearchPaths, definition } = useClassificationsTreeDefinition({\n imodels: useMemo(() => [activeView.iModel], [activeView.iModel]),\n hierarchyConfig,\n search: useMemo(() => (searchText ? { searchText } : undefined), [searchText]),\n onSearchPathsChanged,\n });\n\n useEffect(() => {\n setSearchError(undefined);\n }, [searchText]);\n\n const getPaths = useMemo<FunctionProps<typeof useTree>[\"getSearchPaths\"]>(() => {\n if (!searchText || !getSearchPaths) {\n return undefined;\n }\n return async (props) => {\n try {\n return await getSearchPaths(props);\n } catch (e) {\n const newError = e instanceof SearchLimitExceededError ? \"tooManySearchMatches\" : \"unknownSearchError\";\n if (newError !== \"tooManySearchMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setSearchError(newError);\n return [];\n }\n };\n }, [searchText, getSearchPaths, onFeatureUsed]);\n\n return {\n treeProps: {\n treeName: ClassificationsTreeComponent.id,\n getHierarchyDefinition: useCallback(() => definition, [definition]),\n visibilityHandlerFactory,\n getSearchPaths: getPaths,\n emptyTreeContent: useMemo(() => getEmptyTreeContentComponent(searchText, searchError, emptyTreeContent), [searchText, searchError, emptyTreeContent]),\n highlightText: searchText,\n },\n getTreeItemProps: (node, rendererProps) => ({\n ...rendererProps.getTreeItemProps?.(node),\n decorations: <ClassificationsTreeIcon node={node} />,\n ...getTreeItemProps?.(node, rendererProps),\n }),\n };\n}\n\nfunction getEmptyTreeContentComponent(searchText?: string, error?: ClassificationsTreeSearchError, emptyTreeContent?: React.ReactNode) {\n if (error) {\n if (error === \"tooManySearchMatches\") {\n return <TooManySearchMatches base={\"classificationsTree\"} />;\n }\n return <SearchUnknownError base={\"classificationsTree\"} />;\n }\n if (searchText) {\n return <NoSearchMatches base={\"classificationsTree\"} />;\n }\n if (emptyTreeContent) {\n return emptyTreeContent;\n }\n return <EmptyTreeContent icon={iconBisCategory3d} />;\n}\n\nfunction useClassificationsCachedVisibility(props: { activeView: TreeWidgetViewport; idsCache: ClassificationsTreeIdsCache; componentId: GuidString }) {\n const { activeView, idsCache, componentId } = props;\n const { visibilityHandlerFactory, searchPaths, onSearchPathsChanged } = useCachedVisibility<ClassificationsTreeIdsCache, ClassificationsTreeSearchTargets>({\n activeView,\n idsCache,\n createSearchResultsTree,\n createTreeSpecificVisibilityHandler,\n componentId,\n });\n\n useEffect(() => {\n idsCache.clearFilteredElementsData();\n }, [searchPaths, idsCache]);\n\n return {\n visibilityHandlerFactory,\n onSearchPathsChanged,\n };\n}\n\nasync function createSearchResultsTree(\n props: CreateSearchResultsTreeProps<ClassificationsTreeIdsCache>,\n): Promise<SearchResultsTree<ClassificationsTreeSearchTargets>> {\n const { searchPaths, idsCache, imodelAccess } = props;\n return createClassificationsSearchResultsTree({\n idsCache,\n searchPaths,\n imodelAccess,\n });\n}\n\nfunction createTreeSpecificVisibilityHandler(props: CreateTreeSpecificVisibilityHandlerProps<ClassificationsTreeIdsCache>) {\n const { info, idsCache, viewport } = props;\n return new ClassificationsTreeVisibilityHandler({\n alwaysAndNeverDrawnElementInfo: info,\n idsCache,\n viewport,\n });\n}\n\n/** @internal */\nexport function getClassificationsTreeIdsCache({\n getBaseIdsCache,\n getCache,\n imodel,\n hierarchyConfig,\n}: {\n getCache: ReturnType<typeof useSharedTreeContextInternal>[\"getCache\"];\n getBaseIdsCache: ReturnType<typeof useSharedTreeContextInternal>[\"getBaseIdsCache\"];\n imodel: IModelConnection;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n}) {\n return getCache({\n imodel,\n createCache: () =>\n new ClassificationsTreeIdsCache({\n baseIdsCache: getBaseIdsCache({ type: \"3d\", elementClassName: getClassesByView(\"3d\").elementClass, imodel }),\n hierarchyConfig,\n queryExecutor: createECSqlQueryExecutor(imodel),\n }),\n cacheKey: `${hierarchyConfig.rootClassificationSystemCode}-ClassificationsTreeIdsCache`,\n });\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
import type { HierarchyDefinition, HierarchySearchPath } from "@itwin/presentation-hierarchies";
|
|
3
|
+
import type { useTree } from "@itwin/presentation-hierarchies-react";
|
|
3
4
|
import type { InstanceKey } from "@itwin/presentation-shared";
|
|
4
5
|
import type { FunctionProps } from "../common/Utils.js";
|
|
5
6
|
import type { ClassificationsTreeHierarchyConfiguration } from "./ClassificationsTreeDefinition.js";
|
|
@@ -11,12 +12,7 @@ interface UseClassificationsTreeDefinitionProps {
|
|
|
11
12
|
* **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the
|
|
12
13
|
* latest version. Not obeying this rule may result in undefined behavior.
|
|
13
14
|
*/
|
|
14
|
-
imodels: Array<
|
|
15
|
-
/**
|
|
16
|
-
* An object that provides access to iModel's data and metadata.
|
|
17
|
-
*/
|
|
18
|
-
imodelAccess: FunctionProps<typeof useIModelTree>["imodelAccess"];
|
|
19
|
-
}>;
|
|
15
|
+
imodels: Array<IModelConnection>;
|
|
20
16
|
hierarchyConfig: ClassificationsTreeHierarchyConfiguration;
|
|
21
17
|
/**
|
|
22
18
|
* Optional parameters to search for tree nodes.
|
|
@@ -32,13 +28,20 @@ interface UseClassificationsTreeDefinitionProps {
|
|
|
32
28
|
*/
|
|
33
29
|
targetItems: Array<InstanceKey>;
|
|
34
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Action to perform when search paths change.
|
|
33
|
+
*/
|
|
34
|
+
onSearchPathsChanged?: (paths: HierarchySearchPath[] | undefined) => void;
|
|
35
35
|
}
|
|
36
36
|
/** @alpha */
|
|
37
37
|
interface UseClassificationsTreeDefinitionResult {
|
|
38
38
|
definition: HierarchyDefinition;
|
|
39
39
|
getSearchPaths?: FunctionProps<typeof useTree>["getSearchPaths"];
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Requires `SharedTreeContextProvider` to be present in components tree above.
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
42
45
|
export declare function useClassificationsTreeDefinition(props: UseClassificationsTreeDefinitionProps): UseClassificationsTreeDefinitionResult;
|
|
43
46
|
export {};
|
|
44
47
|
//# sourceMappingURL=UseClassificationsTreeDefinition.d.ts.map
|
|
@@ -2,61 +2,65 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect, useMemo } from "react";
|
|
6
|
+
import { useSharedTreeContextInternal } from "../common/internal/SharedTreeContextProviderInternal.js";
|
|
7
|
+
import { createIModelAccess } from "../common/internal/UseIModelAccess.js";
|
|
8
|
+
import { useTelemetryContext } from "../common/UseTelemetryContext.js";
|
|
7
9
|
import { ClassificationsTreeDefinition } from "./ClassificationsTreeDefinition.js";
|
|
8
|
-
import {
|
|
9
|
-
/**
|
|
10
|
+
import { getClassificationsTreeIdsCache } from "./UseClassificationsTree.js";
|
|
11
|
+
/**
|
|
12
|
+
* Requires `SharedTreeContextProvider` to be present in components tree above.
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
10
15
|
export function useClassificationsTreeDefinition(props) {
|
|
11
|
-
const { imodels, hierarchyConfig, search } = props;
|
|
12
|
-
const
|
|
16
|
+
const { imodels, hierarchyConfig, search, onSearchPathsChanged } = props;
|
|
17
|
+
const { getBaseIdsCache, getCache } = useSharedTreeContextInternal();
|
|
18
|
+
const { onFeatureUsed } = useTelemetryContext();
|
|
19
|
+
const imodelsWithCaches = useMemo(() => {
|
|
20
|
+
return imodels.map((imodel) => {
|
|
21
|
+
return {
|
|
22
|
+
imodelAccess: createIModelAccess({ imodel, hierarchyLevelSizeLimit: 1000 }),
|
|
23
|
+
cache: getClassificationsTreeIdsCache({ getBaseIdsCache, getCache, imodel, hierarchyConfig }),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}, [imodels, getBaseIdsCache, getCache, hierarchyConfig]);
|
|
13
27
|
const definition = useMemo(() => {
|
|
14
28
|
return new ClassificationsTreeDefinition({
|
|
15
|
-
imodelAccess:
|
|
16
|
-
getIdsCache: (imodelKey) =>
|
|
17
|
-
imodelKey,
|
|
18
|
-
imodels,
|
|
19
|
-
idsCaches,
|
|
20
|
-
hierarchyConfig,
|
|
21
|
-
}),
|
|
29
|
+
imodelAccess: imodelsWithCaches[imodelsWithCaches.length - 1].imodelAccess,
|
|
30
|
+
getIdsCache: (imodelKey) => imodelsWithCaches.find(({ imodelAccess }) => imodelAccess.imodelKey === imodelKey).cache,
|
|
22
31
|
hierarchyConfig,
|
|
23
32
|
});
|
|
24
|
-
}, [
|
|
33
|
+
}, [hierarchyConfig, imodelsWithCaches]);
|
|
25
34
|
const searchTerm = search ? ("searchText" in search ? search.searchText : search.targetItems) : undefined;
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!searchTerm) {
|
|
37
|
+
onSearchPathsChanged?.(undefined);
|
|
38
|
+
}
|
|
39
|
+
}, [onSearchPathsChanged, searchTerm]);
|
|
26
40
|
const getSearchPaths = useMemo(() => {
|
|
27
41
|
if (!searchTerm) {
|
|
28
42
|
return undefined;
|
|
29
43
|
}
|
|
30
44
|
return async ({ abortSignal }) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
imodelKey: imodelAccess.imodelKey,
|
|
35
|
-
imodels,
|
|
36
|
-
idsCaches,
|
|
45
|
+
onFeatureUsed({ featureId: "search", reportInteraction: true });
|
|
46
|
+
const [first, ...rest] = await Promise.all(imodelsWithCaches.map(async ({ imodelAccess, cache }) => {
|
|
47
|
+
return ClassificationsTreeDefinition.createInstanceKeyPaths({
|
|
37
48
|
hierarchyConfig,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
idsCache: cache,
|
|
50
|
+
imodelAccess,
|
|
51
|
+
abortSignal,
|
|
52
|
+
limit: typeof searchTerm !== "string" ? "unbounded" : undefined,
|
|
53
|
+
...(typeof searchTerm === "string" ? { label: searchTerm } : { targetItems: searchTerm }),
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
56
|
+
const joinedPaths = first.concat(...rest);
|
|
57
|
+
onSearchPathsChanged?.(joinedPaths);
|
|
58
|
+
return joinedPaths;
|
|
45
59
|
};
|
|
46
|
-
}, [
|
|
60
|
+
}, [searchTerm, onFeatureUsed, imodelsWithCaches, onSearchPathsChanged, hierarchyConfig]);
|
|
47
61
|
return {
|
|
48
62
|
definition,
|
|
49
63
|
getSearchPaths,
|
|
50
64
|
};
|
|
51
65
|
}
|
|
52
|
-
function getOrCreateIdsCache({ imodelKey, imodels, hierarchyConfig, idsCaches, }) {
|
|
53
|
-
let idsCache = idsCaches.current.get(imodelKey);
|
|
54
|
-
if (!idsCache) {
|
|
55
|
-
const imodel = imodels.find((currImodel) => currImodel.imodelAccess.imodelKey === imodelKey);
|
|
56
|
-
assert(!!imodel);
|
|
57
|
-
idsCache = new ClassificationsTreeIdsCache(imodel.imodelAccess, hierarchyConfig);
|
|
58
|
-
idsCaches.current.set(imodelKey, idsCache);
|
|
59
|
-
}
|
|
60
|
-
return idsCache;
|
|
61
|
-
}
|
|
62
66
|
//# sourceMappingURL=UseClassificationsTreeDefinition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseClassificationsTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"UseClassificationsTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CA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CACH,CAAC;YAEF,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;YAC1C,oBAAoB,EAAE,CAAC,WAAW,CAAC,CAAC;YACpC,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC,CAAC;IAE1F,OAAO;QACL,UAAU;QACV,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useEffect, useMemo } from \"react\";\nimport { useSharedTreeContextInternal } from \"../common/internal/SharedTreeContextProviderInternal.js\";\nimport { createIModelAccess } from \"../common/internal/UseIModelAccess.js\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext.js\";\nimport { ClassificationsTreeDefinition } from \"./ClassificationsTreeDefinition.js\";\nimport { getClassificationsTreeIdsCache } from \"./UseClassificationsTree.js\";\n\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { HierarchyDefinition, HierarchySearchPath } from \"@itwin/presentation-hierarchies\";\nimport type { useTree } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { FunctionProps } from \"../common/Utils.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"./ClassificationsTreeDefinition.js\";\n\n/** @alpha */\ninterface UseClassificationsTreeDefinitionProps {\n /**\n * A list of iModels to create merged hierarchy for.\n *\n * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the\n * latest version. Not obeying this rule may result in undefined behavior.\n */\n imodels: Array<IModelConnection>;\n hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n /**\n * Optional parameters to search for tree nodes.\n */\n search?:\n | {\n /**\n * Text used to search tree nodes by label.\n */\n searchText: string;\n }\n | {\n /**\n * List of instance keys to search tree nodes by.\n */\n targetItems: Array<InstanceKey>;\n };\n /**\n * Action to perform when search paths change.\n */\n onSearchPathsChanged?: (paths: HierarchySearchPath[] | undefined) => void;\n}\n\n/** @alpha */\ninterface UseClassificationsTreeDefinitionResult {\n definition: HierarchyDefinition;\n getSearchPaths?: FunctionProps<typeof useTree>[\"getSearchPaths\"];\n}\n\n/**\n * Requires `SharedTreeContextProvider` to be present in components tree above.\n * @alpha\n */\nexport function useClassificationsTreeDefinition(props: UseClassificationsTreeDefinitionProps): UseClassificationsTreeDefinitionResult {\n const { imodels, hierarchyConfig, search, onSearchPathsChanged } = props;\n const { getBaseIdsCache, getCache } = useSharedTreeContextInternal();\n const { onFeatureUsed } = useTelemetryContext();\n\n const imodelsWithCaches = useMemo(() => {\n return imodels.map((imodel) => {\n return {\n imodelAccess: createIModelAccess({ imodel, hierarchyLevelSizeLimit: 1000 }),\n cache: getClassificationsTreeIdsCache({ getBaseIdsCache, getCache, imodel, hierarchyConfig }),\n };\n });\n }, [imodels, getBaseIdsCache, getCache, hierarchyConfig]);\n\n const definition = useMemo(() => {\n return new ClassificationsTreeDefinition({\n imodelAccess: imodelsWithCaches[imodelsWithCaches.length - 1].imodelAccess,\n getIdsCache: (imodelKey: string) => imodelsWithCaches.find(({ imodelAccess }) => imodelAccess.imodelKey === imodelKey)!.cache,\n hierarchyConfig,\n });\n }, [hierarchyConfig, imodelsWithCaches]);\n\n const searchTerm = search ? (\"searchText\" in search ? search.searchText : search.targetItems) : undefined;\n\n useEffect(() => {\n if (!searchTerm) {\n onSearchPathsChanged?.(undefined);\n }\n }, [onSearchPathsChanged, searchTerm]);\n\n const getSearchPaths = useMemo<FunctionProps<typeof useTree>[\"getSearchPaths\"]>(() => {\n if (!searchTerm) {\n return undefined;\n }\n\n return async ({ abortSignal }) => {\n onFeatureUsed({ featureId: \"search\", reportInteraction: true });\n const [first, ...rest] = await Promise.all(\n imodelsWithCaches.map(async ({ imodelAccess, cache }) => {\n return ClassificationsTreeDefinition.createInstanceKeyPaths({\n hierarchyConfig,\n idsCache: cache,\n imodelAccess,\n abortSignal,\n limit: typeof searchTerm !== \"string\" ? \"unbounded\" : undefined,\n ...(typeof searchTerm === \"string\" ? { label: searchTerm } : { targetItems: searchTerm }),\n });\n }),\n );\n\n const joinedPaths = first.concat(...rest);\n onSearchPathsChanged?.(joinedPaths);\n return joinedPaths;\n };\n }, [searchTerm, onFeatureUsed, imodelsWithCaches, onSearchPathsChanged, hierarchyConfig]);\n\n return {\n definition,\n getSearchPaths,\n };\n}\n"]}
|
|
@@ -1,56 +1,33 @@
|
|
|
1
|
+
import { BaseIdsCacheImpl } from "../../common/internal/caches/BaseIdsCache.js";
|
|
1
2
|
import type { Observable } from "rxjs";
|
|
2
|
-
import type {
|
|
3
|
+
import type { Id64Arg, Id64Array, Id64String } from "@itwin/core-bentley";
|
|
3
4
|
import type { HierarchyNodeIdentifiersPath, LimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
|
|
4
|
-
import type {
|
|
5
|
+
import type { BaseIdsCacheImplProps } from "../../common/internal/caches/BaseIdsCache.js";
|
|
6
|
+
import type { CategoryId, ClassificationId, ElementId } from "../../common/internal/Types.js";
|
|
5
7
|
import type { ClassificationsTreeHierarchyConfiguration } from "../ClassificationsTreeDefinition.js";
|
|
8
|
+
interface ClassificationsTreeIdsCacheProps extends BaseIdsCacheImplProps {
|
|
9
|
+
queryExecutor: LimitingECSqlQueryExecutor;
|
|
10
|
+
hierarchyConfig: ClassificationsTreeHierarchyConfiguration;
|
|
11
|
+
}
|
|
6
12
|
/** @internal */
|
|
7
|
-
export
|
|
8
|
-
/** @internal */
|
|
9
|
-
export type ClassificationTableId = Id64String;
|
|
10
|
-
/** @internal */
|
|
11
|
-
export declare class ClassificationsTreeIdsCache implements Disposable {
|
|
13
|
+
export declare class ClassificationsTreeIdsCache extends BaseIdsCacheImpl {
|
|
12
14
|
#private;
|
|
13
|
-
constructor(
|
|
14
|
-
[Symbol.dispose](): void;
|
|
15
|
-
private querySubCategories;
|
|
16
|
-
private getSubCategoriesInfo;
|
|
17
|
-
getSubCategories(categoryId: Id64String): Observable<Array<SubCategoryId>>;
|
|
18
|
-
private queryElementModelCategories;
|
|
19
|
-
private getElementModelsCategories;
|
|
20
|
-
private queryModeledElements;
|
|
21
|
-
private getModelWithCategoryModeledElements;
|
|
22
|
-
getCategoriesModeledElements(modelId: Id64String, categoryIds: Id64Arg): Observable<Id64Array>;
|
|
23
|
-
getCategoriesElementModels(categoryIds: Id64Arg, includeSubModels?: boolean): Observable<{
|
|
24
|
-
id: CategoryId;
|
|
25
|
-
models: Array<ModelId> | undefined;
|
|
26
|
-
}>;
|
|
27
|
-
getModelCategoryIds(modelId: Id64String): Observable<{
|
|
28
|
-
drawing: Id64Array;
|
|
29
|
-
spatial: Id64Array;
|
|
30
|
-
}>;
|
|
31
|
-
getAllCategories(): Observable<{
|
|
32
|
-
drawing: Id64Set;
|
|
33
|
-
spatial: Id64Set;
|
|
34
|
-
}>;
|
|
35
|
-
hasSubModel(elementId: Id64String): Observable<boolean>;
|
|
36
|
-
getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Observable<number>;
|
|
15
|
+
constructor(props: ClassificationsTreeIdsCacheProps);
|
|
37
16
|
private queryClassifications;
|
|
38
17
|
private getClassificationsInfo;
|
|
39
|
-
getAllContainedCategories(classificationOrTableIds: Id64Arg): Observable<
|
|
40
|
-
drawing: Id64Array;
|
|
41
|
-
spatial: Id64Array;
|
|
42
|
-
}>;
|
|
18
|
+
getAllContainedCategories(classificationOrTableIds: Id64Arg): Observable<Id64Array>;
|
|
43
19
|
getDirectChildClassifications(classificationOrTableIds: Id64Arg): Observable<ClassificationId[]>;
|
|
44
20
|
getClassificationsPathObs(classificationIds: Id64Arg): Observable<HierarchyNodeIdentifiersPath>;
|
|
45
21
|
getAllClassifications(): Observable<ClassificationId[]>;
|
|
46
22
|
private queryFilteredElementsData;
|
|
47
|
-
getFilteredElementsData({
|
|
48
|
-
|
|
49
|
-
element3dIds: Id64Arg;
|
|
23
|
+
getFilteredElementsData({ elementIds, }: {
|
|
24
|
+
elementIds: Id64Arg;
|
|
50
25
|
}): Observable<Map<ElementId, {
|
|
51
26
|
categoryId: Id64String;
|
|
52
27
|
modelId: Id64String;
|
|
28
|
+
categoryOfTopMostParentElement: CategoryId;
|
|
53
29
|
}>>;
|
|
54
30
|
clearFilteredElementsData(): void;
|
|
55
31
|
}
|
|
32
|
+
export {};
|
|
56
33
|
//# sourceMappingURL=ClassificationsTreeIdsCache.d.ts.map
|