@itwin/tree-widget-react 4.0.0-alpha.5 → 4.0.0-alpha.7
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 +22 -1
- package/README.md +2 -1
- package/lib/esm/tree-widget-react/TreeWidget.js +1 -1
- package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +3 -2
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +2 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +3 -2
- 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 +9 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +53 -7
- 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 +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +1 -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 +30 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +588 -170
- 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/UseCategoriesTree.d.ts +15 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +149 -56
- 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 +30 -15
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +192 -38
- 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/CategoriesTreeNode.d.ts +18 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +30 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.d.ts +24 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.js +785 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.d.ts +39 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.js +221 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +5 -17
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +5 -62
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +4 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/Utils.d.ts +33 -23
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +60 -47
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js +3 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +4 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/{categories-tree/internal/ClassNameDefinitions.js → common/components/SkeletonTree.css} +12 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.d.ts +4 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +11 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +8 -7
- 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.js +3 -3
- 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/UseVisibilityButtonHandler.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js +1 -0
- 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/VisibilityTree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
- 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/AlwaysAndNeverDrawnElementInfo.d.ts +44 -0
- package/lib/esm/tree-widget-react/components/trees/{models-tree → common}/internal/AlwaysAndNeverDrawnElementInfo.js +81 -31
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.d.ts +33 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js +37 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.d.ts +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js +72 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.d.ts → internal/Rxjs.d.ts} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.js → internal/Rxjs.js} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/Rxjs.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.d.ts → internal/Tooltip.d.ts} +5 -1
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.js → internal/Tooltip.js} +7 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +14 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js +6 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.d.ts → internal/UseHierarchiesLocalization.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.js → internal/UseHierarchiesLocalization.js} +6 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.d.ts → internal/UseHierarchyFiltering.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.js → internal/UseHierarchyFiltering.js} +4 -3
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.d.ts → internal/UseIModelChangeListener.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.js → internal/UseIModelChangeListener.js} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelChangeListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +47 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +101 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/{models-tree → common}/internal/VisibilityChangeEventListener.js +17 -9
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +82 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +234 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +7 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +24 -18
- 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.d.ts +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/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +9 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +44 -34
- 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.d.ts +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.d.ts +13 -0
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +39 -38
- 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.d.ts +5 -5
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +25 -24
- 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 +4 -2
- package/lib/esm/tree-widget-react/components/trees/index.js +4 -2
- 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 +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +2 -2
- 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.js +15 -11
- 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 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +1 -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 +7 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +73 -70
- 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 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +73 -49
- 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/FilteredTree.d.ts +7 -9
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +4 -6
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +4 -5
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +54 -104
- 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/ModelsTreeVisibilityHandler.d.ts +0 -26
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +75 -291
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +55 -6
- package/package.json +17 -18
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +0 -37
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +0 -214
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js +0 -24
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +0 -21
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
- /package/lib/esm/tree-widget-react/components/trees/common/{UseActiveViewport.d.ts → internal/UseActiveViewport.d.ts} +0 -0
- /package/lib/esm/tree-widget-react/components/trees/common/{UseActiveViewport.js → internal/UseActiveViewport.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTreeIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AA2B3F,gBAAgB;AAChB,MAAM,OAAO,sBAAsB;IAQjC,YACU,cAA0C,EAClD,QAAqB;QADb,mBAAc,GAAd,cAAc,CAA4B;QAGlD,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC3E,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CA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,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAC5B;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,iCAAiC;QAC5C,IAAI,CAAC,+BAA+B,KAAK,IAAI,CAAC,oCAAoC,EAAE,CAAC;QACrF,OAAO,IAAI,CAAC,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAC,QAAqB;IACpD,OAAO,QAAQ,KAAK,IAAI;QACtB,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE;QAClG,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,CAAC;AACvG,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 { DEFINITION_CONTAINER_CLASS, SUB_CATEGORY_CLASS } from \"./ClassNameDefinitions.js\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\ninterface DefinitionContainerInfo {\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCategories: CategoryInfo[];\n childDefinitionContainers: Id64Array;\n}\n\ninterface CategoriesInfo {\n childCategories: CategoryInfo[];\n parentDefinitionContainerExists: boolean;\n}\n\ninterface CategoryInfo {\n id: Id64String;\n childCount: number;\n}\n\ninterface SubCategoryInfo {\n categoryId: Id64String;\n}\n\n/** @internal */\nexport class CategoriesTreeIdsCache {\n private _definitionContainersInfo: Promise<Map<Id64String, DefinitionContainerInfo>> | undefined;\n private _modelsCategoriesInfo: Promise<Map<Id64String, CategoriesInfo>> | undefined;\n private _subCategoriesInfo: Promise<Map<Id64String, SubCategoryInfo>> | undefined;\n private _categoryClass: string;\n private _categoryElementClass: string;\n private _isDefinitionContainerSupported: Promise<boolean> | undefined;\n\n constructor(\n private _queryExecutor: LimitingECSqlQueryExecutor,\n viewType: \"3d\" | \"2d\",\n ) {\n const { categoryClass, categoryElementClass } = getClassesByView(viewType);\n this._categoryClass = categoryClass;\n this._categoryElementClass = categoryElementClass;\n }\n\n private async *queryCategories(): AsyncIterableIterator<{\n id: Id64String;\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCount: number;\n }> {\n const isDefinitionContainerSupported = await this.getIsDefinitionContainerSupported();\n const categoriesQuery = `\n SELECT\n this.ECInstanceId id,\n COUNT(sc.ECInstanceId) childCount,\n this.Model.Id modelId,\n ${\n isDefinitionContainerSupported\n ? `\n IIF(this.Model.Id IN (SELECT dc.ECInstanceId FROM ${DEFINITION_CONTAINER_CLASS} dc),\n true,\n false\n )`\n : \"false\"\n } parentDefinitionContainerExists\n FROM\n ${this._categoryClass} this\n JOIN ${SUB_CATEGORY_CLASS} sc ON sc.Parent.Id = this.ECInstanceId\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n AND EXISTS (SELECT 1 FROM ${this._categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)\n GROUP BY this.ECInstanceId\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: categoriesQuery }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { id: row.id, modelId: row.modelId, parentDefinitionContainerExists: row.parentDefinitionContainerExists, childCount: row.childCount };\n }\n }\n\n private async queryIsDefinitionContainersSupported(): Promise<boolean> {\n const query = `\n SELECT\n 1\n FROM\n ECDbMeta.ECSchemaDef s\n JOIN ECDbMeta.ECClassDef c ON c.Schema.Id = s.ECInstanceId\n WHERE\n s.Name = 'BisCore'\n AND c.Name = 'DefinitionContainer'\n `;\n\n for await (const _row of this._queryExecutor.createQueryReader({ ecsql: query })) {\n return true;\n }\n return false;\n }\n\n private async *queryDefinitionContainers(): AsyncIterableIterator<{ id: Id64String; modelId: Id64String }> {\n // DefinitionModel ECInstanceId will always be the same as modeled DefinitionContainer ECInstanceId, if this wasn't the case, we would need to do something like:\n // JOIN BisCore.DefinitionModel dm ON dm.ECInstanceId = ${modelIdAccessor}\n // JOIN BisCore.DefinitionModelBreaksDownDefinitionContainer dr ON dr.SourceECInstanceId = dm.ECInstanceId\n // JOIN BisCore.DefinitionContainer dc ON dc.ECInstanceId = dr.TargetECInstanceId\n const DEFINITION_CONTAINERS_CTE = \"DefinitionContainers\";\n const ctes = [\n `\n ${DEFINITION_CONTAINERS_CTE}(ECInstanceId, ModelId) AS (\n SELECT\n dc.ECInstanceId,\n dc.Model.Id\n FROM\n ${DEFINITION_CONTAINER_CLASS} dc\n WHERE\n dc.ECInstanceId IN (SELECT c.Model.Id FROM ${this._categoryClass} c WHERE NOT c.IsPrivate)\n AND NOT dc.IsPrivate\n\n UNION ALL\n\n SELECT\n pdc.ECInstanceId,\n pdc.Model.Id\n FROM\n ${DEFINITION_CONTAINERS_CTE} cdc\n JOIN ${DEFINITION_CONTAINER_CLASS} pdc ON pdc.ECInstanceId = cdc.ModelId\n WHERE\n NOT pdc.IsPrivate\n )\n `,\n ];\n const definitionsQuery = `\n SELECT dc.ECInstanceId id, dc.ModelId modelId FROM ${DEFINITION_CONTAINERS_CTE} dc GROUP BY dc.ECInstanceId\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ctes, ecsql: definitionsQuery }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { id: row.id, modelId: row.modelId };\n }\n }\n\n private async *queryVisibleSubCategories(categoriesInfo: Id64Array): AsyncIterableIterator<{ id: Id64String; parentId: Id64String }> {\n const definitionsQuery = `\n SELECT\n sc.ECInstanceId id,\n sc.Parent.Id categoryId\n FROM\n ${SUB_CATEGORY_CLASS} sc\n WHERE\n NOT sc.IsPrivate\n AND sc.Parent.Id IN (${categoriesInfo.join(\",\")})\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: definitionsQuery }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { id: row.id, parentId: row.categoryId };\n }\n }\n\n private async getModelsCategoriesInfo() {\n this._modelsCategoriesInfo ??= (async () => {\n const allModelsCategories = new Map<Id64String, CategoriesInfo>();\n for await (const queriedCategory of this.queryCategories()) {\n let modelCategories = allModelsCategories.get(queriedCategory.modelId);\n if (modelCategories === undefined) {\n modelCategories = { parentDefinitionContainerExists: queriedCategory.parentDefinitionContainerExists, childCategories: [] };\n allModelsCategories.set(queriedCategory.modelId, modelCategories);\n }\n modelCategories.childCategories.push({ id: queriedCategory.id, childCount: queriedCategory.childCount });\n }\n return allModelsCategories;\n })();\n return this._modelsCategoriesInfo;\n }\n\n private async getSubCategoriesInfo() {\n this._subCategoriesInfo ??= (async () => {\n const allSubCategories = new Map<Id64String, SubCategoryInfo>();\n const modelsCategoriesInfo = await this.getModelsCategoriesInfo();\n const categoriesWithMoreThanOneSubCategory = new Array<Id64String>();\n for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {\n categoriesWithMoreThanOneSubCategory.push(\n ...modelCategoriesInfo.childCategories.filter((categoryInfo) => categoryInfo.childCount > 1).map((categoryInfo) => categoryInfo.id),\n );\n }\n\n if (categoriesWithMoreThanOneSubCategory.length === 0) {\n return allSubCategories;\n }\n\n for await (const queriedSubCategory of this.queryVisibleSubCategories(categoriesWithMoreThanOneSubCategory)) {\n allSubCategories.set(queriedSubCategory.id, { categoryId: queriedSubCategory.parentId });\n }\n return allSubCategories;\n })();\n return this._subCategoriesInfo;\n }\n\n private async getDefinitionContainersInfo() {\n this._definitionContainersInfo ??= (async () => {\n const definitionContainersInfo = new Map<Id64String, DefinitionContainerInfo>();\n const [isDefinitionContainerSupported, modelsCategoriesInfo] = await Promise.all([\n this.getIsDefinitionContainerSupported(),\n this.getModelsCategoriesInfo(),\n ]);\n if (!isDefinitionContainerSupported || modelsCategoriesInfo.size === 0) {\n return definitionContainersInfo;\n }\n\n for await (const queriedDefinitionContainer of this.queryDefinitionContainers()) {\n const modelCategoriesInfo = modelsCategoriesInfo.get(queriedDefinitionContainer.id);\n\n definitionContainersInfo.set(queriedDefinitionContainer.id, {\n childCategories: modelCategoriesInfo?.childCategories ?? [],\n modelId: queriedDefinitionContainer.modelId,\n childDefinitionContainers: [],\n parentDefinitionContainerExists: false,\n });\n }\n\n for (const [definitionContainerId, definitionContainerInfo] of definitionContainersInfo) {\n const parentDefinitionContainer = definitionContainersInfo.get(definitionContainerInfo.modelId);\n if (parentDefinitionContainer !== undefined) {\n parentDefinitionContainer.childDefinitionContainers.push(definitionContainerId);\n definitionContainerInfo.parentDefinitionContainerExists = true;\n }\n }\n\n return definitionContainersInfo;\n })();\n return this._definitionContainersInfo;\n }\n\n public async getDirectChildDefinitionContainersAndCategories(\n parentDefinitionContainerIds: Id64Array,\n ): Promise<{ categories: CategoryInfo[]; definitionContainers: Id64Array }> {\n const definitionContainersInfo = await this.getDefinitionContainersInfo();\n\n const result = { definitionContainers: new Array<Id64String>(), categories: new Array<CategoryInfo>() };\n\n parentDefinitionContainerIds.forEach((parentDefinitionContainerId) => {\n const parentDefinitionContainerInfo = definitionContainersInfo.get(parentDefinitionContainerId);\n if (parentDefinitionContainerInfo !== undefined) {\n result.definitionContainers.push(...parentDefinitionContainerInfo.childDefinitionContainers);\n result.categories.push(...parentDefinitionContainerInfo.childCategories);\n }\n });\n return result;\n }\n\n public async getAllContainedCategories(definitionContainerIds: Id64Array): Promise<Id64Array> {\n const result = new Array<Id64String>();\n\n const definitionContainersInfo = await this.getDefinitionContainersInfo();\n const indirectCategories = await Promise.all(\n definitionContainerIds.map(async (definitionContainerId) => {\n const definitionContainerInfo = definitionContainersInfo.get(definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return [];\n }\n result.push(...definitionContainerInfo.childCategories.map((category) => category.id));\n return this.getAllContainedCategories(definitionContainerInfo.childDefinitionContainers);\n }),\n );\n for (const categories of indirectCategories) {\n result.push(...categories);\n }\n\n return result;\n }\n\n public async getInstanceKeyPaths(\n props: { categoryId: Id64String } | { definitionContainerId: Id64String } | { subCategoryId: Id64String },\n ): Promise<InstanceKey[]> {\n if (\"subCategoryId\" in props) {\n const subCategoriesInfo = await this.getSubCategoriesInfo();\n const subCategoryInfo = subCategoriesInfo.get(props.subCategoryId);\n if (subCategoryInfo === undefined) {\n return [];\n }\n return [...(await this.getInstanceKeyPaths({ categoryId: subCategoryInfo.categoryId })), { id: props.subCategoryId, className: SUB_CATEGORY_CLASS }];\n }\n\n if (\"categoryId\" in props) {\n const modelsCategoriesInfo = await this.getModelsCategoriesInfo();\n for (const [modelId, modelCategoriesInfo] of modelsCategoriesInfo) {\n if (modelCategoriesInfo.childCategories.find((childCategory) => childCategory.id === props.categoryId)) {\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n return [{ id: props.categoryId, className: this._categoryClass }];\n }\n\n return [...(await this.getInstanceKeyPaths({ definitionContainerId: modelId })), { id: props.categoryId, className: this._categoryClass }];\n }\n }\n return [];\n }\n\n const definitionContainersInfo = await this.getDefinitionContainersInfo();\n const definitionContainerInfo = definitionContainersInfo.get(props.definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return [];\n }\n\n if (!definitionContainerInfo.parentDefinitionContainerExists) {\n return [{ id: props.definitionContainerId, className: DEFINITION_CONTAINER_CLASS }];\n }\n\n return [\n ...(await this.getInstanceKeyPaths({ definitionContainerId: definitionContainerInfo.modelId })),\n { id: props.definitionContainerId, className: DEFINITION_CONTAINER_CLASS },\n ];\n }\n\n public async getAllDefinitionContainersAndCategories(): Promise<{ categories: Id64Array; definitionContainers: Id64Array }> {\n const [modelsCategoriesInfo, definitionContainersInfo] = await Promise.all([this.getModelsCategoriesInfo(), this.getDefinitionContainersInfo()]);\n const result = { definitionContainers: [...definitionContainersInfo.keys()], categories: new Array<Id64String>() };\n for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {\n result.categories.push(...modelCategoriesInfo.childCategories.map((childCategory) => childCategory.id));\n }\n\n return result;\n }\n\n public async getRootDefinitionContainersAndCategories(): Promise<{ categories: CategoryInfo[]; definitionContainers: Id64Array }> {\n const [modelsCategoriesInfo, definitionContainersInfo] = await Promise.all([this.getModelsCategoriesInfo(), this.getDefinitionContainersInfo()]);\n const result = { definitionContainers: new Array<Id64String>(), categories: new Array<CategoryInfo>() };\n for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n result.categories.push(...modelCategoriesInfo.childCategories);\n }\n }\n\n for (const [definitionContainerId, definitionContainerInfo] of definitionContainersInfo) {\n if (!definitionContainerInfo.parentDefinitionContainerExists) {\n result.definitionContainers.push(definitionContainerId);\n }\n }\n return result;\n }\n\n public async getSubCategories(categoryId: Id64String): Promise<Id64Array> {\n const subCategoriesInfo = await this.getSubCategoriesInfo();\n const result = new Array<Id64String>();\n for (const [subCategoryId, subCategoryInfo] of subCategoriesInfo) {\n if (subCategoryInfo.categoryId === categoryId) {\n result.push(subCategoryId);\n }\n }\n return result;\n }\n\n public async getIsDefinitionContainerSupported(): Promise<boolean> {\n this._isDefinitionContainerSupported ??= this.queryIsDefinitionContainersSupported();\n return this._isDefinitionContainerSupported;\n }\n}\n\n/** @internal */\nexport function getClassesByView(viewType: \"2d\" | \"3d\") {\n return viewType === \"2d\"\n ? { categoryClass: \"BisCore.DrawingCategory\", categoryElementClass: \"BisCore.GeometricElement2d\" }\n : { categoryClass: \"BisCore.SpatialCategory\", categoryElementClass: \"BisCore.GeometricElement3d\" };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CategoriesTreeIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAA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AAK,MAAM,mBAAmB,IAAI,oBAAoB,CAAC,MAAM,EAAE,EAAE;YAC/D,IAAI,CAAC,mBAAmB,CAAC,+BAA+B,EAAE;gBACxD,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;aAChE;SACF;QAED,KAAK,MAAM,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,IAAI,wBAAwB,EAAE;YACvF,IAAI,CAAC,uBAAuB,CAAC,+BAA+B,EAAE;gBAC5D,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;aACzD;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,WAAsB;QAClD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoC,CAAC;QAC3D,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACpC,KAAK,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,IAAI,iBAAiB,EAAE;gBAChE,IAAI,eAAe,CAAC,UAAU,KAAK,UAAU,EAAE;oBAC7C,IAAI,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBAC3C,IAAI,CAAC,aAAa,EAAE;wBAClB,aAAa,GAAG,EAAE,CAAC;wBACnB,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;qBACvC;oBACD,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;iBACnC;aACF;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,iCAAiC;QAC5C,IAAI,CAAC,+BAA+B,KAAK,IAAI,CAAC,oCAAoC,EAAE,CAAC;QACrF,OAAO,IAAI,CAAC,+BAA+B,CAAC;IAC9C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { DEFINITION_CONTAINER_CLASS_NAME, MODEL_CLASS_NAME, SUB_CATEGORY_CLASS_NAME } from \"../../common/internal/ClassNameDefinitions.js\";\nimport { ModelCategoryElementsCountCache } from \"../../common/internal/ModelCategoryElementsCountCache.js\";\nimport { getClassesByView, getDistinctMapValues } from \"../../common/internal/Utils.js\";\n\nimport type { CategoryId, DefinitionContainerId, ElementId, ModelId, SubCategoryId } from \"../../common/internal/Types.js\";\nimport type { Id64Array, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\ninterface DefinitionContainerInfo {\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n childCategories: CategoryInfo[];\n childDefinitionContainerIds: Id64Array;\n}\n\ninterface CategoriesInfo {\n childCategories: CategoryInfo[];\n parentDefinitionContainerExists: boolean;\n}\n\n/** @internal */\nexport interface CategoryInfo {\n id: CategoryId;\n subCategoryChildCount: number;\n}\n\ninterface SubCategoryInfo {\n categoryId: Id64String;\n}\n\ntype ModelCategoryKey = `${ModelId}-${CategoryId}`;\n\n/** @internal */\nexport class CategoriesTreeIdsCache implements Disposable {\n private _definitionContainersInfo: Promise<Map<DefinitionContainerId, DefinitionContainerInfo>> | undefined;\n private _modelsCategoriesInfo: Promise<Map<ModelId, CategoriesInfo>> | undefined;\n private _elementModelsCategories: Promise<Map<ModelId, { categoryIds: Id64Set; isSubModel: boolean; isModelPrivate: boolean }>> | undefined;\n private _subCategoriesInfo: Promise<Map<SubCategoryId, SubCategoryInfo>> | undefined;\n private readonly _categoryElementCounts: ModelCategoryElementsCountCache;\n private _modelWithCategoryModeledElements: Promise<Map<ModelCategoryKey, Set<ElementId>>> | undefined;\n private _categoryClass: string;\n private _categoryElementClass: string;\n private _categoryModelClass: string;\n private _isDefinitionContainerSupported: Promise<boolean> | undefined;\n private _filteredElementsModels: Promise<Map<ElementId, ModelId>> | undefined;\n\n constructor(\n private _queryExecutor: LimitingECSqlQueryExecutor,\n viewType: \"3d\" | \"2d\",\n ) {\n const { categoryClass, elementClass, modelClass } = getClassesByView(viewType);\n this._categoryClass = categoryClass;\n this._categoryElementClass = elementClass;\n this._categoryModelClass = modelClass;\n this._categoryElementCounts = new ModelCategoryElementsCountCache(_queryExecutor, elementClass);\n }\n\n public [Symbol.dispose]() {\n this._categoryElementCounts[Symbol.dispose]();\n }\n\n private async *queryFilteredElementsModels(filteredElementIds: Id64Array): AsyncIterableIterator<{\n modelId: Id64String;\n id: ElementId;\n }> {\n const query = `\n SELECT Model.Id modelId, ECInstanceId id\n FROM ${this._categoryElementClass}\n WHERE ECInstanceId IN (${filteredElementIds.join(\", \")})\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { modelId: row.modelId, id: row.id };\n }\n }\n\n public async getFilteredElementsModels(filteredElementIds: Id64Array) {\n if (filteredElementIds.length === 0) {\n return new Map<ElementId, ModelId>();\n }\n\n this._filteredElementsModels ??= (async () => {\n const filteredElementsModels = new Map();\n for await (const { modelId, id } of this.queryFilteredElementsModels(filteredElementIds)) {\n filteredElementsModels.set(id, modelId);\n }\n return filteredElementsModels;\n })();\n return this._filteredElementsModels;\n }\n\n public clearFilteredElementsModels() {\n this._filteredElementsModels = undefined;\n }\n\n private async *queryElementModelCategories(): AsyncIterableIterator<{\n modelId: Id64String;\n categoryId: Id64String;\n isModelPrivate: boolean;\n }> {\n const query = `\n SELECT this.Model.Id modelId, this.Category.Id categoryId, m.IsPrivate isModelPrivate\n FROM ${this._categoryModelClass} m\n JOIN ${this._categoryElementClass} this ON m.ECInstanceId = this.Model.Id\n WHERE this.Parent.Id IS NULL\n GROUP BY modelId, categoryId, isModelPrivate\n `;\n for await (const row of this._queryExecutor.createQueryReader(\n { ecsql: query },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: \"tree-widget/categories-tree/element-models-and-categories-query\" },\n )) {\n yield { modelId: row.modelId, categoryId: row.categoryId, isModelPrivate: !!row.isModelPrivate };\n }\n }\n\n private async *queryCategories(): AsyncIterableIterator<{\n id: CategoryId;\n modelId: Id64String;\n parentDefinitionContainerExists: boolean;\n subCategoryChildCount: number;\n }> {\n const isDefinitionContainerSupported = await this.getIsDefinitionContainerSupported();\n const categoriesQuery = `\n SELECT\n this.ECInstanceId id,\n COUNT(sc.ECInstanceId) subCategoryChildCount,\n this.Model.Id modelId,\n ${\n isDefinitionContainerSupported\n ? `\n IIF(this.Model.Id IN (SELECT dc.ECInstanceId FROM ${DEFINITION_CONTAINER_CLASS_NAME} dc),\n true,\n false\n )`\n : \"false\"\n } parentDefinitionContainerExists\n FROM\n ${this._categoryClass} this\n JOIN ${SUB_CATEGORY_CLASS_NAME} sc ON sc.Parent.Id = this.ECInstanceId\n JOIN ${MODEL_CLASS_NAME} m ON m.ECInstanceId = this.Model.Id\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n AND EXISTS (SELECT 1 FROM ${this._categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)\n GROUP BY this.ECInstanceId\n `;\n for await (const row of this._queryExecutor.createQueryReader(\n { ecsql: categoriesQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: \"tree-widget/categories-tree/categories-query\" },\n )) {\n yield {\n id: row.id,\n modelId: row.modelId,\n parentDefinitionContainerExists: row.parentDefinitionContainerExists,\n subCategoryChildCount: row.subCategoryChildCount,\n };\n }\n }\n\n private async queryIsDefinitionContainersSupported(): Promise<boolean> {\n const query = `\n SELECT\n 1\n FROM\n ECDbMeta.ECSchemaDef s\n JOIN ECDbMeta.ECClassDef c ON c.Schema.Id = s.ECInstanceId\n WHERE\n s.Name = 'BisCore'\n AND c.Name = 'DefinitionContainer'\n `;\n\n for await (const _row of this._queryExecutor.createQueryReader(\n { ecsql: query },\n { restartToken: \"tree-widget/categories-tree/is-definition-container-supported-query\" },\n )) {\n return true;\n }\n return false;\n }\n\n private async *queryDefinitionContainers(): AsyncIterableIterator<{ id: DefinitionContainerId; modelId: Id64String }> {\n // DefinitionModel ECInstanceId will always be the same as modeled DefinitionContainer ECInstanceId, if this wasn't the case, we would need to do something like:\n // JOIN BisCore.DefinitionModel dm ON dm.ECInstanceId = ${modelIdAccessor}\n // JOIN BisCore.DefinitionModelBreaksDownDefinitionContainer dr ON dr.SourceECInstanceId = dm.ECInstanceId\n // JOIN BisCore.DefinitionContainer dc ON dc.ECInstanceId = dr.TargetECInstanceId\n const DEFINITION_CONTAINERS_CTE = \"DefinitionContainers\";\n const ctes = [\n `\n ${DEFINITION_CONTAINERS_CTE}(ECInstanceId, ModelId) AS (\n SELECT\n dc.ECInstanceId,\n dc.Model.Id\n FROM\n ${DEFINITION_CONTAINER_CLASS_NAME} dc\n WHERE\n dc.ECInstanceId IN (SELECT c.Model.Id FROM ${this._categoryClass} c WHERE NOT c.IsPrivate AND EXISTS (SELECT 1 FROM ${this._categoryElementClass} e WHERE e.Category.Id = c.ECInstanceId))\n AND NOT dc.IsPrivate\n\n UNION ALL\n\n SELECT\n pdc.ECInstanceId,\n pdc.Model.Id\n FROM\n ${DEFINITION_CONTAINERS_CTE} cdc\n JOIN ${DEFINITION_CONTAINER_CLASS_NAME} pdc ON pdc.ECInstanceId = cdc.ModelId\n WHERE\n NOT pdc.IsPrivate\n )\n `,\n ];\n const definitionsQuery = `\n SELECT dc.ECInstanceId id, dc.ModelId modelId FROM ${DEFINITION_CONTAINERS_CTE} dc GROUP BY dc.ECInstanceId\n `;\n for await (const row of this._queryExecutor.createQueryReader(\n { ctes, ecsql: definitionsQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: \"tree-widget/categories-tree/definition-containers-query\" },\n )) {\n yield { id: row.id, modelId: row.modelId };\n }\n }\n\n private async *queryVisibleSubCategories(categoryIds: Id64Array): AsyncIterableIterator<{ id: SubCategoryId; parentId: CategoryId }> {\n const definitionsQuery = `\n SELECT\n sc.ECInstanceId id,\n sc.Parent.Id categoryId\n FROM\n ${SUB_CATEGORY_CLASS_NAME} sc\n WHERE\n NOT sc.IsPrivate\n AND sc.Parent.Id IN (${categoryIds.join(\",\")})\n `;\n for await (const row of this._queryExecutor.createQueryReader(\n { ecsql: definitionsQuery },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: \"tree-widget/categories-tree/sub-categories-query\" },\n )) {\n yield { id: row.id, parentId: row.categoryId };\n }\n }\n\n private async getModelsCategoriesInfo() {\n this._modelsCategoriesInfo ??= (async () => {\n const allModelsCategories = new Map<ModelId, CategoriesInfo>();\n for await (const queriedCategory of this.queryCategories()) {\n let modelCategories = allModelsCategories.get(queriedCategory.modelId);\n if (modelCategories === undefined) {\n modelCategories = { parentDefinitionContainerExists: queriedCategory.parentDefinitionContainerExists, childCategories: [] };\n allModelsCategories.set(queriedCategory.modelId, modelCategories);\n }\n modelCategories.childCategories.push({ id: queriedCategory.id, subCategoryChildCount: queriedCategory.subCategoryChildCount });\n }\n return allModelsCategories;\n })();\n return this._modelsCategoriesInfo;\n }\n\n private async getElementModelsCategories() {\n this._elementModelsCategories ??= (async () => {\n const [modelCategories, modelWithCategoryModeledElements] = await Promise.all([\n (async () => {\n const elementModelsCategories = new Map<ModelId, { categoryIds: Id64Set; isModelPrivate: boolean }>();\n for await (const queriedCategory of this.queryElementModelCategories()) {\n let modelEntry = elementModelsCategories.get(queriedCategory.modelId);\n if (modelEntry === undefined) {\n modelEntry = { categoryIds: new Set(), isModelPrivate: queriedCategory.isModelPrivate };\n elementModelsCategories.set(queriedCategory.modelId, modelEntry);\n }\n modelEntry.categoryIds.add(queriedCategory.categoryId);\n }\n return elementModelsCategories;\n })(),\n this.getModelWithCategoryModeledElements(),\n ]);\n const result = new Map<ModelId, { categoryIds: Set<CategoryId>; isSubModel: boolean; isModelPrivate: boolean }>();\n const subModels = getDistinctMapValues(modelWithCategoryModeledElements);\n for (const [modelId, modelEntry] of modelCategories) {\n const isSubModel = subModels.has(modelId);\n result.set(modelId, { categoryIds: modelEntry.categoryIds, isSubModel, isModelPrivate: modelEntry.isModelPrivate });\n }\n return result;\n })();\n return this._elementModelsCategories;\n }\n\n private async *queryModeledElements(): AsyncIterableIterator<{\n modelId: Id64String;\n modeledElementId: Id64String;\n categoryId: Id64String;\n rootCategoryId: Id64String;\n }> {\n const query = `\n SELECT\n pe.ECInstanceId modeledElementId,\n pe.Category.Id categoryId,\n pe.Model.Id modelId\n FROM ${this._categoryModelClass} m\n JOIN ${this._categoryElementClass} pe ON pe.ECInstanceId = m.ModeledElement.Id\n WHERE\n m.IsPrivate = false\n AND m.ECInstanceId IN (SELECT Model.Id FROM ${this._categoryElementClass})\n `;\n for await (const row of this._queryExecutor.createQueryReader(\n { ecsql: query },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: \"tree-widget/categories-tree/modeled-elements-query\" },\n )) {\n yield { modelId: row.modelId, categoryId: row.categoryId, modeledElementId: row.modeledElementId, rootCategoryId: row.rootCategoryId };\n }\n }\n\n private async getModelWithCategoryModeledElements() {\n this._modelWithCategoryModeledElements ??= (async () => {\n const modelWithCategoryModeledElements = new Map<ModelCategoryKey, Set<ElementId>>();\n for await (const { modelId, categoryId, modeledElementId } of this.queryModeledElements()) {\n const key: ModelCategoryKey = `${modelId}-${categoryId}`;\n const entry = modelWithCategoryModeledElements.get(key);\n if (entry === undefined) {\n modelWithCategoryModeledElements.set(key, new Set([modeledElementId]));\n } else {\n entry.add(modeledElementId);\n }\n }\n return modelWithCategoryModeledElements;\n })();\n return this._modelWithCategoryModeledElements;\n }\n\n public async getCategoriesModeledElements(modelId: Id64String, categoryIds: Id64Array): Promise<Id64Array> {\n const modelWithCategoryModeledElements = await this.getModelWithCategoryModeledElements();\n const result = new Array<ElementId>();\n for (const categoryId of categoryIds) {\n const entry = modelWithCategoryModeledElements.get(`${modelId}-${categoryId}`);\n if (entry !== undefined) {\n result.push(...entry);\n }\n }\n return result;\n }\n\n private async getSubCategoriesInfo() {\n this._subCategoriesInfo ??= (async () => {\n const allSubCategories = new Map<SubCategoryId, SubCategoryInfo>();\n const modelsCategoriesInfo = await this.getModelsCategoriesInfo();\n const categoriesWithMoreThanOneSubCategory = new Array<CategoryId>();\n for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {\n categoriesWithMoreThanOneSubCategory.push(\n ...modelCategoriesInfo.childCategories.filter((categoryInfo) => categoryInfo.subCategoryChildCount > 1).map((categoryInfo) => categoryInfo.id),\n );\n }\n\n if (categoriesWithMoreThanOneSubCategory.length === 0) {\n return allSubCategories;\n }\n\n for await (const queriedSubCategory of this.queryVisibleSubCategories(categoriesWithMoreThanOneSubCategory)) {\n allSubCategories.set(queriedSubCategory.id, { categoryId: queriedSubCategory.parentId });\n }\n return allSubCategories;\n })();\n return this._subCategoriesInfo;\n }\n\n private async getDefinitionContainersInfo() {\n this._definitionContainersInfo ??= (async () => {\n const definitionContainersInfo = new Map<DefinitionContainerId, DefinitionContainerInfo>();\n const [isDefinitionContainerSupported, modelsCategoriesInfo] = await Promise.all([\n this.getIsDefinitionContainerSupported(),\n this.getModelsCategoriesInfo(),\n ]);\n if (!isDefinitionContainerSupported || modelsCategoriesInfo.size === 0) {\n return definitionContainersInfo;\n }\n\n for await (const queriedDefinitionContainer of this.queryDefinitionContainers()) {\n const modelCategoriesInfo = modelsCategoriesInfo.get(queriedDefinitionContainer.id);\n\n definitionContainersInfo.set(queriedDefinitionContainer.id, {\n childCategories: modelCategoriesInfo?.childCategories ?? [],\n modelId: queriedDefinitionContainer.modelId,\n childDefinitionContainerIds: [],\n parentDefinitionContainerExists: false,\n });\n }\n\n for (const [definitionContainerId, definitionContainerInfo] of definitionContainersInfo) {\n const parentDefinitionContainer = definitionContainersInfo.get(definitionContainerInfo.modelId);\n if (parentDefinitionContainer !== undefined) {\n parentDefinitionContainer.childDefinitionContainerIds.push(definitionContainerId);\n definitionContainerInfo.parentDefinitionContainerExists = true;\n }\n }\n\n return definitionContainersInfo;\n })();\n return this._definitionContainersInfo;\n }\n\n public async getDirectChildDefinitionContainersAndCategories(\n parentDefinitionContainerIds: Id64Array,\n ): Promise<{ categories: CategoryInfo[]; definitionContainers: Array<DefinitionContainerId> }> {\n const definitionContainersInfo = await this.getDefinitionContainersInfo();\n\n const result = { definitionContainers: new Array<DefinitionContainerId>(), categories: new Array<CategoryInfo>() };\n\n parentDefinitionContainerIds.forEach((parentDefinitionContainerId) => {\n const parentDefinitionContainerInfo = definitionContainersInfo.get(parentDefinitionContainerId);\n if (parentDefinitionContainerInfo !== undefined) {\n result.definitionContainers.push(...parentDefinitionContainerInfo.childDefinitionContainerIds);\n result.categories.push(...parentDefinitionContainerInfo.childCategories);\n }\n });\n return result;\n }\n\n public async getCategoriesElementModels(categoryIds: Id64Array, includeSubModels?: boolean): Promise<Map<CategoryId, Array<ModelId>>> {\n const elementModelsCategories = await this.getElementModelsCategories();\n const result = new Map<CategoryId, Array<ModelId>>();\n for (const categoryId of categoryIds) {\n for (const [modelId, { categoryIds: categories, isSubModel }] of elementModelsCategories) {\n if ((includeSubModels || !isSubModel) && categories.has(categoryId)) {\n let categoryModels = result.get(categoryId);\n if (!categoryModels) {\n categoryModels = new Array<ModelId>();\n result.set(categoryId, categoryModels);\n }\n categoryModels.push(modelId);\n }\n }\n }\n return result;\n }\n\n public async getModelCategoryIds(modelId: Id64String): Promise<Id64Array> {\n const elementModelsCategories = await this.getElementModelsCategories();\n return [...(elementModelsCategories.get(modelId)?.categoryIds ?? [])];\n }\n\n public async hasSubModel(elementId: Id64String): Promise<boolean> {\n const elementModelsCategories = await this.getElementModelsCategories();\n const modeledElementInfo = elementModelsCategories.get(elementId);\n if (!modeledElementInfo) {\n return false;\n }\n return !modeledElementInfo.isModelPrivate;\n }\n\n public async getAllContainedCategories(definitionContainerIds: Id64Array): Promise<Id64Array> {\n const result = new Array<CategoryId>();\n\n const definitionContainersInfo = await this.getDefinitionContainersInfo();\n const indirectCategories = await Promise.all(\n definitionContainerIds.map(async (definitionContainerId) => {\n const definitionContainerInfo = definitionContainersInfo.get(definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return [];\n }\n result.push(...definitionContainerInfo.childCategories.map((category) => category.id));\n return this.getAllContainedCategories(definitionContainerInfo.childDefinitionContainerIds);\n }),\n );\n for (const categories of indirectCategories) {\n result.push(...categories);\n }\n\n return result;\n }\n\n public async getInstanceKeyPaths(\n props: { categoryId: Id64String } | { definitionContainerId: Id64String } | { subCategoryId: Id64String },\n ): Promise<InstanceKey[]> {\n if (\"subCategoryId\" in props) {\n const subCategoriesInfo = await this.getSubCategoriesInfo();\n const subCategoryInfo = subCategoriesInfo.get(props.subCategoryId);\n if (subCategoryInfo === undefined) {\n return [];\n }\n return [...(await this.getInstanceKeyPaths({ categoryId: subCategoryInfo.categoryId })), { id: props.subCategoryId, className: SUB_CATEGORY_CLASS_NAME }];\n }\n\n if (\"categoryId\" in props) {\n const modelsCategoriesInfo = await this.getModelsCategoriesInfo();\n for (const [modelId, modelCategoriesInfo] of modelsCategoriesInfo) {\n if (modelCategoriesInfo.childCategories.find((childCategory) => childCategory.id === props.categoryId)) {\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n return [{ id: props.categoryId, className: this._categoryClass }];\n }\n\n return [...(await this.getInstanceKeyPaths({ definitionContainerId: modelId })), { id: props.categoryId, className: this._categoryClass }];\n }\n }\n return [];\n }\n\n const definitionContainersInfo = await this.getDefinitionContainersInfo();\n const definitionContainerInfo = definitionContainersInfo.get(props.definitionContainerId);\n if (definitionContainerInfo === undefined) {\n return [];\n }\n\n if (!definitionContainerInfo.parentDefinitionContainerExists) {\n return [{ id: props.definitionContainerId, className: DEFINITION_CONTAINER_CLASS_NAME }];\n }\n\n return [\n ...(await this.getInstanceKeyPaths({ definitionContainerId: definitionContainerInfo.modelId })),\n { id: props.definitionContainerId, className: DEFINITION_CONTAINER_CLASS_NAME },\n ];\n }\n\n public async getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Promise<number> {\n return this._categoryElementCounts.getCategoryElementsCount(modelId, categoryId);\n }\n\n public async getAllDefinitionContainersAndCategories(): Promise<{ categories: Array<CategoryId>; definitionContainers: Array<DefinitionContainerId> }> {\n const [modelsCategoriesInfo, definitionContainersInfo] = await Promise.all([this.getModelsCategoriesInfo(), this.getDefinitionContainersInfo()]);\n const result = { definitionContainers: [...definitionContainersInfo.keys()], categories: new Array<Id64String>() };\n for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {\n result.categories.push(...modelCategoriesInfo.childCategories.map((childCategory) => childCategory.id));\n }\n\n return result;\n }\n\n public async getRootDefinitionContainersAndCategories(): Promise<{ categories: CategoryInfo[]; definitionContainers: Array<DefinitionContainerId> }> {\n const [modelsCategoriesInfo, definitionContainersInfo] = await Promise.all([this.getModelsCategoriesInfo(), this.getDefinitionContainersInfo()]);\n const result = { definitionContainers: new Array<Id64String>(), categories: new Array<CategoryInfo>() };\n for (const modelCategoriesInfo of modelsCategoriesInfo.values()) {\n if (!modelCategoriesInfo.parentDefinitionContainerExists) {\n result.categories.push(...modelCategoriesInfo.childCategories);\n }\n }\n\n for (const [definitionContainerId, definitionContainerInfo] of definitionContainersInfo) {\n if (!definitionContainerInfo.parentDefinitionContainerExists) {\n result.definitionContainers.push(definitionContainerId);\n }\n }\n return result;\n }\n\n public async getSubCategories(categoryIds: Id64Array): Promise<Map<CategoryId, Array<SubCategoryId>>> {\n const subCategoriesInfo = await this.getSubCategoriesInfo();\n const result = new Map<CategoryId, Array<SubCategoryId>>();\n for (const categoryId of categoryIds) {\n for (const [subCategoryId, subCategoryInfo] of subCategoriesInfo) {\n if (subCategoryInfo.categoryId === categoryId) {\n let categoryEntry = result.get(categoryId);\n if (!categoryEntry) {\n categoryEntry = [];\n result.set(categoryId, categoryEntry);\n }\n categoryEntry.push(subCategoryId);\n }\n }\n }\n\n return result;\n }\n\n public async getIsDefinitionContainerSupported(): Promise<boolean> {\n this._isDefinitionContainerSupported ??= this.queryIsDefinitionContainersSupported();\n return this._isDefinitionContainerSupported;\n }\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Id64String } from "@itwin/core-bentley";
|
|
1
2
|
import type { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
2
3
|
interface CategoriesTreeNode {
|
|
3
4
|
key: HierarchyNodeKey;
|
|
@@ -5,9 +6,7 @@ interface CategoriesTreeNode {
|
|
|
5
6
|
[id: string]: any;
|
|
6
7
|
};
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
9
|
+
/** @internal */
|
|
11
10
|
export declare namespace CategoriesTreeNode {
|
|
12
11
|
/**
|
|
13
12
|
* Determines if node represents a definition container.
|
|
@@ -17,10 +16,26 @@ export declare namespace CategoriesTreeNode {
|
|
|
17
16
|
* Determines if node represents a category.
|
|
18
17
|
*/
|
|
19
18
|
const isCategoryNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Determines if node represents a model.
|
|
21
|
+
*/
|
|
22
|
+
const isModelNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Determines if node represents an element.
|
|
25
|
+
*/
|
|
26
|
+
const isElementNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
20
27
|
/**
|
|
21
28
|
* Determines if node represents a sub-category.
|
|
22
29
|
*/
|
|
23
30
|
const isSubCategoryNode: (node: Pick<CategoriesTreeNode, "extendedData">) => boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves model ID from node's extended data.
|
|
33
|
+
*/
|
|
34
|
+
const getModelId: (node: Pick<CategoriesTreeNode, "extendedData">) => Id64String | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves category ID from node's extended data.
|
|
37
|
+
*/
|
|
38
|
+
const getCategoryId: (node: Pick<CategoriesTreeNode, "extendedData">) => Id64String | undefined;
|
|
24
39
|
}
|
|
25
40
|
export {};
|
|
26
41
|
//# sourceMappingURL=CategoriesTreeNode.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
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
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
5
|
+
/** @internal */
|
|
8
6
|
export var CategoriesTreeNode;
|
|
9
7
|
(function (CategoriesTreeNode) {
|
|
10
8
|
/**
|
|
@@ -15,9 +13,38 @@ export var CategoriesTreeNode;
|
|
|
15
13
|
* Determines if node represents a category.
|
|
16
14
|
*/
|
|
17
15
|
CategoriesTreeNode.isCategoryNode = (node) => node.extendedData && "isCategory" in node.extendedData && !!node.extendedData.isCategory;
|
|
16
|
+
/**
|
|
17
|
+
* Determines if node represents a model.
|
|
18
|
+
*/
|
|
19
|
+
CategoriesTreeNode.isModelNode = (node) => node.extendedData && "isModel" in node.extendedData && !!node.extendedData.isModel;
|
|
20
|
+
/**
|
|
21
|
+
* Determines if node represents an element.
|
|
22
|
+
*/
|
|
23
|
+
CategoriesTreeNode.isElementNode = (node) => node.extendedData && "isElement" in node.extendedData && !!node.extendedData.isElement;
|
|
18
24
|
/**
|
|
19
25
|
* Determines if node represents a sub-category.
|
|
20
26
|
*/
|
|
21
27
|
CategoriesTreeNode.isSubCategoryNode = (node) => node.extendedData && "isSubCategory" in node.extendedData && !!node.extendedData.isSubCategory;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves model ID from node's extended data.
|
|
30
|
+
*/
|
|
31
|
+
CategoriesTreeNode.getModelId = (node) => {
|
|
32
|
+
// Elements have modelId property set
|
|
33
|
+
if (node.extendedData?.modelId) {
|
|
34
|
+
return node.extendedData?.modelId;
|
|
35
|
+
}
|
|
36
|
+
// This is for categories:
|
|
37
|
+
// a) If category is at root, then it won't have 'modelId' or 'modelIds' set - it will return undefined;
|
|
38
|
+
// b) If category is under subModel then it will have 'modelIds' set just like in models tree.
|
|
39
|
+
const modelIds = node.extendedData?.modelIds?.[0];
|
|
40
|
+
return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves category ID from node's extended data.
|
|
44
|
+
*/
|
|
45
|
+
CategoriesTreeNode.getCategoryId = (node) => {
|
|
46
|
+
// Elements have categoryId property set
|
|
47
|
+
return node.extendedData?.categoryId;
|
|
48
|
+
};
|
|
22
49
|
})(CategoriesTreeNode || (CategoriesTreeNode = {}));
|
|
23
50
|
//# sourceMappingURL=CategoriesTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;
|
|
1
|
+
{"version":3,"file":"CategoriesTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAUhG,gBAAgB;AAChB,MAAM,KAAW,kBAAkB,CAsDlC;AAtDD,WAAiB,kBAAkB;IACjC;;OAEG;IACU,4CAAyB,GAAG,CAAC,IAA8C,EAAE,EAAE,CAC1F,IAAI,CAAC,YAAY,IAAI,uBAAuB,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IA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G,CAAC,IAA8C,EAA0B,EAAE;QACtG,wCAAwC;QACxC,OAAO,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC,EAtDgB,kBAAkB,KAAlB,kBAAkB,QAsDlC","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 { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\ninterface CategoriesTreeNode {\n key: HierarchyNodeKey;\n extendedData?: { [id: string]: any };\n}\n\n/** @internal */\nexport namespace CategoriesTreeNode {\n /**\n * Determines if node represents a definition container.\n */\n export const isDefinitionContainerNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isDefinitionContainer\" in node.extendedData && !!node.extendedData.isDefinitionContainer;\n\n /**\n * Determines if node represents a category.\n */\n export const isCategoryNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isCategory\" in node.extendedData && !!node.extendedData.isCategory;\n\n /**\n * Determines if node represents a model.\n */\n export const isModelNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isModel\" in node.extendedData && !!node.extendedData.isModel;\n\n /**\n * Determines if node represents an element.\n */\n export const isElementNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isElement\" in node.extendedData && !!node.extendedData.isElement;\n\n /**\n * Determines if node represents a sub-category.\n */\n export const isSubCategoryNode = (node: Pick<CategoriesTreeNode, \"extendedData\">) =>\n node.extendedData && \"isSubCategory\" in node.extendedData && !!node.extendedData.isSubCategory;\n\n /**\n * Retrieves model ID from node's extended data.\n */\n export const getModelId = (node: Pick<CategoriesTreeNode, \"extendedData\">): Id64String | undefined => {\n // Elements have modelId property set\n if (node.extendedData?.modelId) {\n return node.extendedData?.modelId;\n }\n\n // This is for categories:\n // a) If category is at root, then it won't have 'modelId' or 'modelIds' set - it will return undefined;\n // b) If category is under subModel then it will have 'modelIds' set just like in models tree.\n const modelIds = node.extendedData?.modelIds?.[0];\n return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);\n };\n\n /**\n * Retrieves category ID from node's extended data.\n */\n export const getCategoryId = (node: Pick<CategoriesTreeNode, \"extendedData\">): Id64String | undefined => {\n // Elements have categoryId property set\n return node.extendedData?.categoryId;\n };\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { Viewport } from "@itwin/core-frontend";
|
|
3
|
+
import type { HierarchyFilteringPath } from "@itwin/presentation-hierarchies";
|
|
4
|
+
import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
|
|
5
|
+
import type { HierarchyVisibilityHandler } from "../../common/UseHierarchyVisibility.js";
|
|
6
|
+
import type { CategoriesTreeHierarchyConfiguration } from "../CategoriesTreeDefinition.js";
|
|
7
|
+
import type { CategoriesTreeIdsCache } from "./CategoriesTreeIdsCache.js";
|
|
8
|
+
/**
|
|
9
|
+
* Props for `createCategoriesTreeVisibilityHandler`.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export interface CategoriesTreeVisibilityHandlerProps {
|
|
13
|
+
viewport: Viewport;
|
|
14
|
+
idsCache: CategoriesTreeIdsCache;
|
|
15
|
+
imodelAccess: ECClassHierarchyInspector;
|
|
16
|
+
filteredPaths?: HierarchyFilteringPath[];
|
|
17
|
+
hierarchyConfig: CategoriesTreeHierarchyConfiguration;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance if `CategoriesTreeVisibilityHandler`.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function createCategoriesTreeVisibilityHandler(props: CategoriesTreeVisibilityHandlerProps): HierarchyVisibilityHandler & Disposable;
|
|
24
|
+
//# sourceMappingURL=CategoriesTreeVisibilityHandler.d.ts.map
|